agent-dag 3.11.0 → 3.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/assets/{index-XrBtr430.css → index-ClmtUpYO.css} +1 -1
- package/dist/web/assets/{index-Dya_sxoa.js → index-DfcEnmf5.js} +22 -22
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/release-notes.json +10 -0
- package/src/server/index.mjs +9 -1
- package/src/server/system-metrics.mjs +300 -17
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Qx;function JA(){if(Qx)return Ka;Qx=1;var e=Nl(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function l(u,h,p){var f,g={},v=null,w=null;p!==void 0&&(v=""+p),h.key!==void 0&&(v=""+h.key),h.ref!==void 0&&(w=h.ref);for(f in h)s.call(h,f)&&!a.hasOwnProperty(f)&&(g[f]=h[f]);if(u&&u.defaultProps)for(f in h=u.defaultProps,h)g[f]===void 0&&(g[f]=h[f]);return{$$typeof:t,type:u,key:v,ref:w,props:g,_owner:i.current}}return Ka.Fragment=n,Ka.jsx=l,Ka.jsxs=l,Ka}var Zx;function
|
|
17
|
+
*/var Qx;function JA(){if(Qx)return Ka;Qx=1;var e=Nl(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function l(u,h,p){var f,g={},v=null,w=null;p!==void 0&&(v=""+p),h.key!==void 0&&(v=""+h.key),h.ref!==void 0&&(w=h.ref);for(f in h)s.call(h,f)&&!a.hasOwnProperty(f)&&(g[f]=h[f]);if(u&&u.defaultProps)for(f in h=u.defaultProps,h)g[f]===void 0&&(g[f]=h[f]);return{$$typeof:t,type:u,key:v,ref:w,props:g,_owner:i.current}}return Ka.Fragment=n,Ka.jsx=l,Ka.jsxs=l,Ka}var Zx;function eM(){return Zx||(Zx=1,zf.exports=JA()),zf.exports}var d=eM(),Qc={},Uf={exports:{}},fn={},Wf={exports:{}},Hf={};/**
|
|
18
18
|
* @license React
|
|
19
19
|
* scheduler.production.min.js
|
|
20
20
|
*
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the MIT license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var Jx;function
|
|
25
|
+
*/var Jx;function tM(){return Jx||(Jx=1,(function(e){function t(Q,W){var ee=Q.length;Q.push(W);e:for(;0<ee;){var $=ee-1>>>1,Y=Q[$];if(0<i(Y,W))Q[$]=W,Q[ee]=Y,ee=$;else break e}}function n(Q){return Q.length===0?null:Q[0]}function s(Q){if(Q.length===0)return null;var W=Q[0],ee=Q.pop();if(ee!==W){Q[0]=ee;e:for(var $=0,Y=Q.length,ue=Y>>>1;$<ue;){var z=2*($+1)-1,D=Q[z],J=z+1,V=Q[J];if(0>i(D,ee))J<Y&&0>i(V,D)?(Q[$]=V,Q[J]=ee,$=J):(Q[$]=D,Q[z]=ee,$=z);else if(J<Y&&0>i(V,ee))Q[$]=V,Q[J]=ee,$=J;else break e}}return W}function i(Q,W){var ee=Q.sortIndex-W.sortIndex;return ee!==0?ee:Q.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var h=[],p=[],f=1,g=null,v=3,w=!1,E=!1,b=!1,S=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(Q){for(var W=n(p);W!==null;){if(W.callback===null)s(p);else if(W.startTime<=Q)s(p),W.sortIndex=W.expirationTime,t(h,W);else break;W=n(p)}}function j(Q){if(b=!1,C(Q),!E)if(n(h)!==null)E=!0,G(M);else{var W=n(p);W!==null&&ne(j,W.startTime-Q)}}function M(Q,W){E=!1,b&&(b=!1,_(F),F=-1),w=!0;var ee=v;try{for(C(W),g=n(h);g!==null&&(!(g.expirationTime>W)||Q&&!L());){var $=g.callback;if(typeof $=="function"){g.callback=null,v=g.priorityLevel;var Y=$(g.expirationTime<=W);W=e.unstable_now(),typeof Y=="function"?g.callback=Y:g===n(h)&&s(h),C(W)}else s(h);g=n(h)}if(g!==null)var ue=!0;else{var z=n(p);z!==null&&ne(j,z.startTime-W),ue=!1}return ue}finally{g=null,v=ee,w=!1}}var P=!1,I=null,F=-1,O=5,A=-1;function L(){return!(e.unstable_now()-A<O)}function H(){if(I!==null){var Q=e.unstable_now();A=Q;var W=!0;try{W=I(!0,Q)}finally{W?X():(P=!1,I=null)}}else P=!1}var X;if(typeof N=="function")X=function(){N(H)};else if(typeof MessageChannel<"u"){var R=new MessageChannel,K=R.port2;R.port1.onmessage=H,X=function(){K.postMessage(null)}}else X=function(){S(H,0)};function G(Q){I=Q,P||(P=!0,X())}function ne(Q,W){F=S(function(){Q(e.unstable_now())},W)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(Q){Q.callback=null},e.unstable_continueExecution=function(){E||w||(E=!0,G(M))},e.unstable_forceFrameRate=function(Q){0>Q||125<Q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<Q?Math.floor(1e3/Q):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return n(h)},e.unstable_next=function(Q){switch(v){case 1:case 2:case 3:var W=3;break;default:W=v}var ee=v;v=W;try{return Q()}finally{v=ee}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Q,W){switch(Q){case 1:case 2:case 3:case 4:case 5:break;default:Q=3}var ee=v;v=Q;try{return W()}finally{v=ee}},e.unstable_scheduleCallback=function(Q,W,ee){var $=e.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?$+ee:$):ee=$,Q){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=ee+Y,Q={id:f++,callback:W,priorityLevel:Q,startTime:ee,expirationTime:Y,sortIndex:-1},ee>$?(Q.sortIndex=ee,t(p,Q),n(h)===null&&Q===n(p)&&(b?(_(F),F=-1):b=!0,ne(j,ee-$))):(Q.sortIndex=Y,t(h,Q),E||w||(E=!0,G(M))),Q},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(Q){var W=v;return function(){var ee=v;v=W;try{return Q.apply(this,arguments)}finally{v=ee}}}})(Hf)),Hf}var eb;function nM(){return eb||(eb=1,Wf.exports=tM()),Wf.exports}/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.min.js
|
|
28
28
|
*
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
*
|
|
31
31
|
* This source code is licensed under the MIT license found in the
|
|
32
32
|
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var tb;function
|
|
33
|
+
*/var tb;function rM(){if(tb)return fn;tb=1;var e=Nl(),t=nM();function n(r){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+r,c=1;c<arguments.length;c++)o+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+r+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,i={};function a(r,o){l(r,o),l(r+"Capture",o)}function l(r,o){for(i[r]=o,r=0;r<o.length;r++)s.add(o[r])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},g={};function v(r){return h.call(g,r)?!0:h.call(f,r)?!1:p.test(r)?g[r]=!0:(f[r]=!0,!1)}function w(r,o,c,m){if(c!==null&&c.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return m?!1:c!==null?!c.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function E(r,o,c,m){if(o===null||typeof o>"u"||w(r,o,c,m))return!0;if(m)return!1;if(c!==null)switch(c.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function b(r,o,c,m,y,x,T){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=m,this.attributeNamespace=y,this.mustUseProperty=c,this.propertyName=r,this.type=o,this.sanitizeURL=x,this.removeEmptyString=T}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){S[r]=new b(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var o=r[0];S[o]=new b(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){S[r]=new b(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){S[r]=new b(r,2,!1,r,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(r){S[r]=new b(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){S[r]=new b(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){S[r]=new b(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){S[r]=new b(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){S[r]=new b(r,5,!1,r.toLowerCase(),null,!1,!1)});var _=/[\-:]([a-z])/g;function N(r){return r[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(r){var o=r.replace(_,N);S[o]=new b(o,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var o=r.replace(_,N);S[o]=new b(o,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var o=r.replace(_,N);S[o]=new b(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){S[r]=new b(r,1,!1,r.toLowerCase(),null,!1,!1)}),S.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){S[r]=new b(r,1,!1,r.toLowerCase(),null,!0,!0)});function C(r,o,c,m){var y=S.hasOwnProperty(o)?S[o]:null;(y!==null?y.type!==0:m||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(E(o,c,y,m)&&(c=null),m||y===null?v(o)&&(c===null?r.removeAttribute(o):r.setAttribute(o,""+c)):y.mustUseProperty?r[y.propertyName]=c===null?y.type===3?!1:"":c:(o=y.attributeName,m=y.attributeNamespace,c===null?r.removeAttribute(o):(y=y.type,c=y===3||y===4&&c===!0?"":""+c,m?r.setAttributeNS(m,o,c):r.setAttribute(o,c))))}var j=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,M=Symbol.for("react.element"),P=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),L=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),K=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),ne=Symbol.for("react.offscreen"),Q=Symbol.iterator;function W(r){return r===null||typeof r!="object"?null:(r=Q&&r[Q]||r["@@iterator"],typeof r=="function"?r:null)}var ee=Object.assign,$;function Y(r){if($===void 0)try{throw Error()}catch(c){var o=c.stack.trim().match(/\n( *(at )?)/);$=o&&o[1]||""}return`
|
|
34
34
|
`+$+r}var ue=!1;function z(r,o){if(!r||ue)return"";ue=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(le){var m=le}Reflect.construct(r,[],o)}else{try{o.call()}catch(le){m=le}r.call(o.prototype)}else{try{throw Error()}catch(le){m=le}r()}}catch(le){if(le&&m&&typeof le.stack=="string"){for(var y=le.stack.split(`
|
|
35
35
|
`),x=m.stack.split(`
|
|
36
36
|
`),T=y.length-1,B=x.length-1;1<=T&&0<=B&&y[T]!==x[B];)B--;for(;1<=T&&0<=B;T--,B--)if(y[T]!==x[B]){if(T!==1||B!==1)do if(T--,B--,0>B||y[T]!==x[B]){var Z=`
|
|
37
|
-
`+y[T].replace(" at new "," at ");return r.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",r.displayName)),Z}while(1<=T&&0<=B);break}}}finally{ue=!1,Error.prepareStackTrace=c}return(r=r?r.displayName||r.name:"")?Y(r):""}function D(r){switch(r.tag){case 5:return Y(r.type);case 16:return Y("Lazy");case 13:return Y("Suspense");case 19:return Y("SuspenseList");case 0:case 2:case 15:return r=z(r.type,!1),r;case 11:return r=z(r.type.render,!1),r;case 1:return r=z(r.type,!0),r;default:return""}}function J(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case I:return"Fragment";case P:return"Portal";case O:return"Profiler";case F:return"StrictMode";case X:return"Suspense";case R:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case L:return(r.displayName||"Context")+".Consumer";case A:return(r._context.displayName||"Context")+".Provider";case H:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case K:return o=r.displayName||null,o!==null?o:J(r.type)||"Memo";case G:o=r._payload,r=r._init;try{return J(r(o))}catch{}}return null}function V(r){var o=r.type;switch(r.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=o.render,r=r.displayName||r.name||"",o.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return J(o);case 8:return o===F?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function ae(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function he(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function ye(r){var o=he(r)?"checked":"value",c=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),m=""+r[o];if(!r.hasOwnProperty(o)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var y=c.get,x=c.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return y.call(this)},set:function(T){m=""+T,x.call(this,T)}}),Object.defineProperty(r,o,{enumerable:c.enumerable}),{getValue:function(){return m},setValue:function(T){m=""+T},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function _e(r){r._valueTracker||(r._valueTracker=ye(r))}function Ve(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var c=o.getValue(),m="";return r&&(m=he(r)?r.checked?"true":"false":r.value),r=m,r!==c?(o.setValue(r),!0):!1}function Be(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function qe(r,o){var c=o.checked;return ee({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:c??r._wrapperState.initialChecked})}function Se(r,o){var c=o.defaultValue==null?"":o.defaultValue,m=o.checked!=null?o.checked:o.defaultChecked;c=ae(o.value!=null?o.value:c),r._wrapperState={initialChecked:m,initialValue:c,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function ce(r,o){o=o.checked,o!=null&&C(r,"checked",o,!1)}function be(r,o){ce(r,o);var c=ae(o.value),m=o.type;if(c!=null)m==="number"?(c===0&&r.value===""||r.value!=c)&&(r.value=""+c):r.value!==""+c&&(r.value=""+c);else if(m==="submit"||m==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?Ye(r,o.type,c):o.hasOwnProperty("defaultValue")&&Ye(r,o.type,ae(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function ke(r,o,c){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var m=o.type;if(!(m!=="submit"&&m!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+r._wrapperState.initialValue,c||o===r.value||(r.value=o),r.defaultValue=o}c=r.name,c!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,c!==""&&(r.name=c)}function Ye(r,o,c){(o!=="number"||Be(r.ownerDocument)!==r)&&(c==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+c&&(r.defaultValue=""+c))}var dt=Array.isArray;function lt(r,o,c,m){if(r=r.options,o){o={};for(var y=0;y<c.length;y++)o["$"+c[y]]=!0;for(c=0;c<r.length;c++)y=o.hasOwnProperty("$"+r[c].value),r[c].selected!==y&&(r[c].selected=y),y&&m&&(r[c].defaultSelected=!0)}else{for(c=""+ae(c),o=null,y=0;y<r.length;y++){if(r[y].value===c){r[y].selected=!0,m&&(r[y].defaultSelected=!0);return}o!==null||r[y].disabled||(o=r[y])}o!==null&&(o.selected=!0)}}function pe(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return ee({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function me(r,o){var c=o.value;if(c==null){if(c=o.children,o=o.defaultValue,c!=null){if(o!=null)throw Error(n(92));if(dt(c)){if(1<c.length)throw Error(n(93));c=c[0]}o=c}o==null&&(o=""),c=o}r._wrapperState={initialValue:ae(c)}}function Me(r,o){var c=ae(o.value),m=ae(o.defaultValue);c!=null&&(c=""+c,c!==r.value&&(r.value=c),o.defaultValue==null&&r.defaultValue!==c&&(r.defaultValue=c)),m!=null&&(r.defaultValue=""+m)}function He(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function ct(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function je(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?ct(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var Ge,Ke=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,c,m,y){MSApp.execUnsafeLocalFunction(function(){return r(o,c,m,y)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(Ge=Ge||document.createElement("div"),Ge.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=Ge.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function se(r,o){if(o){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=o;return}}r.textContent=o}var Pe={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},$e=["Webkit","ms","Moz","O"];Object.keys(Pe).forEach(function(r){$e.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),Pe[o]=Pe[r]})});function Te(r,o,c){return o==null||typeof o=="boolean"||o===""?"":c||typeof o!="number"||o===0||Pe.hasOwnProperty(r)&&Pe[r]?(""+o).trim():o+"px"}function Xe(r,o){r=r.style;for(var c in o)if(o.hasOwnProperty(c)){var m=c.indexOf("--")===0,y=Te(c,o[c],m);c==="float"&&(c="cssFloat"),m?r.setProperty(c,y):r[c]=y}}var jt=ee({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 ot(r,o){if(o){if(jt[r]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(n(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(n(61))}if(o.style!=null&&typeof o.style!="object")throw Error(n(62))}}function Ie(r,o){if(r.indexOf("-")===-1)return typeof o.is=="string";switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var xt=null;function ft(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var gt=null,Nn=null,Bn=null;function En(r){if(r=Oa(r)){if(typeof gt!="function")throw Error(n(280));var o=r.stateNode;o&&(o=dc(o),gt(r.stateNode,r.type,o))}}function Ro(r){Nn?Bn?Bn.push(r):Bn=[r]:Nn=r}function mn(){if(Nn){var r=Nn,o=Bn;if(Bn=Nn=null,En(r),o)for(r=0;r<o.length;r++)En(o[r])}}function Ao(r,o){return r(o)}function Mo(){}var Bt=!1;function Rr(r,o,c){if(Bt)return r(o,c);Bt=!0;try{return Ao(r,o,c)}finally{Bt=!1,(Nn!==null||Bn!==null)&&(Mo(),mn())}}function Un(r,o){var c=r.stateNode;if(c===null)return null;var m=dc(c);if(m===null)return null;c=m[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(r=r.type,m=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!m;break e;default:r=!1}if(r)return null;if(c&&typeof c!="function")throw Error(n(231,o,typeof c));return c}var Ls=!1;if(u)try{var Ar={};Object.defineProperty(Ar,"passive",{get:function(){Ls=!0}}),window.addEventListener("test",Ar,Ar),window.removeEventListener("test",Ar,Ar)}catch{Ls=!1}function Io(r,o,c,m,y,x,T,B,Z){var le=Array.prototype.slice.call(arguments,3);try{o.apply(c,le)}catch(ve){this.onError(ve)}}var pr=!1,Mr=null,mr=!1,rs=null,Oo={onError:function(r){pr=!0,Mr=r}};function Po(r,o,c,m,y,x,T,B,Z){pr=!1,Mr=null,Io.apply(Oo,arguments)}function $o(r,o,c,m,y,x,T,B,Z){if(Po.apply(this,arguments),pr){if(pr){var le=Mr;pr=!1,Mr=null}else throw Error(n(198));mr||(mr=!0,rs=le)}}function Cn(r){var o=r,c=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(c=o.return),r=o.return;while(r)}return o.tag===3?c:null}function Lo(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function Ir(r){if(Cn(r)!==r)throw Error(n(188))}function qo(r){var o=r.alternate;if(!o){if(o=Cn(r),o===null)throw Error(n(188));return o!==r?null:r}for(var c=r,m=o;;){var y=c.return;if(y===null)break;var x=y.alternate;if(x===null){if(m=y.return,m!==null){c=m;continue}break}if(y.child===x.child){for(x=y.child;x;){if(x===c)return Ir(y),r;if(x===m)return Ir(y),o;x=x.sibling}throw Error(n(188))}if(c.return!==m.return)c=y,m=x;else{for(var T=!1,B=y.child;B;){if(B===c){T=!0,c=y,m=x;break}if(B===m){T=!0,m=y,c=x;break}B=B.sibling}if(!T){for(B=x.child;B;){if(B===c){T=!0,c=x,m=y;break}if(B===m){T=!0,m=x,c=y;break}B=B.sibling}if(!T)throw Error(n(189))}}if(c.alternate!==m)throw Error(n(190))}if(c.tag!==3)throw Error(n(188));return c.stateNode.current===c?r:o}function Wn(r){return r=qo(r),r!==null?Do(r):null}function Do(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=Do(r);if(o!==null)return o;r=r.sibling}return null}var qs=t.unstable_scheduleCallback,Ds=t.unstable_cancelCallback,Fo=t.unstable_shouldYield,zo=t.unstable_requestPaint,it=t.unstable_now,sa=t.unstable_getCurrentPriorityLevel,ss=t.unstable_ImmediatePriority,Gt=t.unstable_UserBlockingPriority,Hn=t.unstable_NormalPriority,Bo=t.unstable_LowPriority,os=t.unstable_IdlePriority,bt=null,sn=null;function Gn(r){if(sn&&typeof sn.onCommitFiberRoot=="function")try{sn.onCommitFiberRoot(bt,r,void 0,(r.current.flags&128)===128)}catch{}}var gn=Math.clz32?Math.clz32:Uo,gd=Math.log,Or=Math.LN2;function Uo(r){return r>>>=0,r===0?32:31-(gd(r)/Or|0)|0}var Wo=64,Ho=4194304;function is(r){switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function Fs(r,o){var c=r.pendingLanes;if(c===0)return 0;var m=0,y=r.suspendedLanes,x=r.pingedLanes,T=c&268435455;if(T!==0){var B=T&~y;B!==0?m=is(B):(x&=T,x!==0&&(m=is(x)))}else T=c&~y,T!==0?m=is(T):x!==0&&(m=is(x));if(m===0)return 0;if(o!==0&&o!==m&&(o&y)===0&&(y=m&-m,x=o&-o,y>=x||y===16&&(x&4194240)!==0))return o;if((m&4)!==0&&(m|=c&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=m;0<o;)c=31-gn(o),y=1<<c,m|=r[c],o&=~y;return m}function as(r,o){switch(r){case 1:case 2:case 4:return o+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function zl(r,o){for(var c=r.suspendedLanes,m=r.pingedLanes,y=r.expirationTimes,x=r.pendingLanes;0<x;){var T=31-gn(x),B=1<<T,Z=y[T];Z===-1?((B&c)===0||(B&m)!==0)&&(y[T]=as(B,o)):Z<=o&&(r.expiredLanes|=B),x&=~B}}function Go(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function zs(){var r=Wo;return Wo<<=1,(Wo&4194240)===0&&(Wo=64),r}function Vo(r){for(var o=[],c=0;31>c;c++)o.push(r);return o}function ls(r,o,c){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-gn(o),r[o]=c}function Zt(r,o){var c=r.pendingLanes&~o;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=o,r.mutableReadLanes&=o,r.entangledLanes&=o,o=r.entanglements;var m=r.eventTimes;for(r=r.expirationTimes;0<c;){var y=31-gn(c),x=1<<y;o[y]=0,m[y]=-1,r[y]=-1,c&=~x}}function cs(r,o){var c=r.entangledLanes|=o;for(r=r.entanglements;c;){var m=31-gn(c),y=1<<m;y&o|r[m]&o&&(r[m]|=o),c&=~y}}var Je=0;function Yo(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Bl,Pr,oa,Vn,Ul,Ko=!1,Xo=[],gr=null,Yn=null,yr=null,yn=new Map,Kn=new Map,Xn=[],ia="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 jn(r,o){switch(r){case"focusin":case"focusout":gr=null;break;case"dragenter":case"dragleave":Yn=null;break;case"mouseover":case"mouseout":yr=null;break;case"pointerover":case"pointerout":yn.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Kn.delete(o.pointerId)}}function Bs(r,o,c,m,y,x){return r===null||r.nativeEvent!==x?(r={blockedOn:o,domEventName:c,eventSystemFlags:m,nativeEvent:x,targetContainers:[y]},o!==null&&(o=Oa(o),o!==null&&Pr(o)),r):(r.eventSystemFlags|=m,o=r.targetContainers,y!==null&&o.indexOf(y)===-1&&o.push(y),r)}function Tn(r,o,c,m,y){switch(o){case"focusin":return gr=Bs(gr,r,o,c,m,y),!0;case"dragenter":return Yn=Bs(Yn,r,o,c,m,y),!0;case"mouseover":return yr=Bs(yr,r,o,c,m,y),!0;case"pointerover":var x=y.pointerId;return yn.set(x,Bs(yn.get(x)||null,r,o,c,m,y)),!0;case"gotpointercapture":return x=y.pointerId,Kn.set(x,Bs(Kn.get(x)||null,r,o,c,m,y)),!0}return!1}function Qo(r){var o=ro(r.target);if(o!==null){var c=Cn(o);if(c!==null){if(o=c.tag,o===13){if(o=Lo(c),o!==null){r.blockedOn=o,Ul(r.priority,function(){oa(c)});return}}else if(o===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function us(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var c=Jo(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(c===null){c=r.nativeEvent;var m=new c.constructor(c.type,c);xt=m,c.target.dispatchEvent(m),xt=null}else return o=Oa(c),o!==null&&Pr(o),r.blockedOn=c,!1;o.shift()}return!0}function aa(r,o,c){us(r)&&c.delete(o)}function Zo(){Ko=!1,gr!==null&&us(gr)&&(gr=null),Yn!==null&&us(Yn)&&(Yn=null),yr!==null&&us(yr)&&(yr=null),yn.forEach(aa),Kn.forEach(aa)}function $r(r,o){r.blockedOn===o&&(r.blockedOn=null,Ko||(Ko=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Zo)))}function ds(r){function o(y){return $r(y,r)}if(0<Xo.length){$r(Xo[0],r);for(var c=1;c<Xo.length;c++){var m=Xo[c];m.blockedOn===r&&(m.blockedOn=null)}}for(gr!==null&&$r(gr,r),Yn!==null&&$r(Yn,r),yr!==null&&$r(yr,r),yn.forEach(o),Kn.forEach(o),c=0;c<Xn.length;c++)m=Xn[c],m.blockedOn===r&&(m.blockedOn=null);for(;0<Xn.length&&(c=Xn[0],c.blockedOn===null);)Qo(c),c.blockedOn===null&&Xn.shift()}var vr=j.ReactCurrentBatchConfig,Us=!0;function la(r,o,c,m){var y=Je,x=vr.transition;vr.transition=null;try{Je=1,wr(r,o,c,m)}finally{Je=y,vr.transition=x}}function Wl(r,o,c,m){var y=Je,x=vr.transition;vr.transition=null;try{Je=4,wr(r,o,c,m)}finally{Je=y,vr.transition=x}}function wr(r,o,c,m){if(Us){var y=Jo(r,o,c,m);if(y===null)Rd(r,o,m,Ws,c),jn(r,m);else if(Tn(y,r,o,c,m))m.stopPropagation();else if(jn(r,m),o&4&&-1<ia.indexOf(r)){for(;y!==null;){var x=Oa(y);if(x!==null&&Bl(x),x=Jo(r,o,c,m),x===null&&Rd(r,o,m,Ws,c),x===y)break;y=x}y!==null&&m.stopPropagation()}else Rd(r,o,m,null,c)}}var Ws=null;function Jo(r,o,c,m){if(Ws=null,r=ft(m),r=ro(r),r!==null)if(o=Cn(r),o===null)r=null;else if(c=o.tag,c===13){if(r=Lo(o),r!==null)return r;r=null}else if(c===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return Ws=r,null}function ei(r){switch(r){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(sa()){case ss:return 1;case Gt:return 4;case Hn:case Bo:return 16;case os:return 536870912;default:return 16}default:return 16}}var xr=null,Hs=null,Qn=null;function ca(){if(Qn)return Qn;var r,o=Hs,c=o.length,m,y="value"in xr?xr.value:xr.textContent,x=y.length;for(r=0;r<c&&o[r]===y[r];r++);var T=c-r;for(m=1;m<=T&&o[c-m]===y[x-m];m++);return Qn=y.slice(r,1<m?1-m:void 0)}function ti(r){var o=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&o===13&&(r=13)):r=o,r===10&&(r=13),32<=r||r===13?r:0}function Gs(){return!0}function ua(){return!1}function Jt(r){function o(c,m,y,x,T){this._reactName=c,this._targetInst=y,this.type=m,this.nativeEvent=x,this.target=T,this.currentTarget=null;for(var B in r)r.hasOwnProperty(B)&&(c=r[B],this[B]=c?c(x):x[B]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Gs:ua,this.isPropagationStopped=ua,this}return ee(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Gs)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Gs)},persist:function(){},isPersistent:Gs}),o}var Ot={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},da=Jt(Ot),Lr=ee({},Ot,{view:0,detail:0}),fs=Jt(Lr),qr,Vs,Dr,Ys=ee({},Lr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Rn,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Dr&&(Dr&&r.type==="mousemove"?(qr=r.screenX-Dr.screenX,Vs=r.screenY-Dr.screenY):Vs=qr=0,Dr=r),qr)},movementY:function(r){return"movementY"in r?r.movementY:Vs}}),Ks=Jt(Ys),Hl=ee({},Ys,{dataTransfer:0}),yd=Jt(Hl),vd=ee({},Lr,{relatedTarget:0}),ni=Jt(vd),wd=ee({},Ot,{animationName:0,elapsedTime:0,pseudoElement:0}),xd=Jt(wd),fa=ee({},Ot,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),br=Jt(fa),ha=ee({},Ot,{data:0}),pa=Jt(ha),bd={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},kd={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"},Gl={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Vl(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=Gl[r])?!!o[r]:!1}function Rn(){return Vl}var _d=ee({},Lr,{key:function(r){if(r.key){var o=bd[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=ti(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?kd[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Rn,charCode:function(r){return r.type==="keypress"?ti(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?ti(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Yl=Jt(_d),Sd=ee({},Ys,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Xs=Jt(Sd),Nd=ee({},Lr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Rn}),en=Jt(Nd),ma=ee({},Ot,{propertyName:0,elapsedTime:0,pseudoElement:0}),Kl=Jt(ma),Xl=ee({},Ys,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),Ql=Jt(Xl),ga=[9,13,27,32],hs=u&&"CompositionEvent"in window,Fr=null;u&&"documentMode"in document&&(Fr=document.documentMode);var Zl=u&&"TextEvent"in window&&!Fr,Qs=u&&(!hs||Fr&&8<Fr&&11>=Fr),ya=" ",ri=!1;function si(r,o){switch(r){case"keyup":return ga.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function va(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var kt=!1;function Jl(r,o){switch(r){case"compositionend":return va(o);case"keypress":return o.which!==32?null:(ri=!0,ya);case"textInput":return r=o.data,r===ya&&ri?null:r;default:return null}}function ec(r,o){if(kt)return r==="compositionend"||!hs&&si(r,o)?(r=ca(),Qn=Hs=xr=null,kt=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return Qs&&o.locale!=="ko"?null:o.data;default:return null}}var Ed={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 tc(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!Ed[r.type]:o==="textarea"}function wa(r,o,c,m){Ro(m),o=lc(o,"onChange"),0<o.length&&(c=new da("onChange","change",null,c,m),r.push({event:c,listeners:o}))}var Zn=null,Zs=null;function zr(r){d0(r,0)}function ps(r){var o=ui(r);if(Ve(o))return r}function Cd(r,o){if(r==="change")return o}var nc=!1;if(u){var Jn;if(u){var Js="oninput"in document;if(!Js){var rc=document.createElement("div");rc.setAttribute("oninput","return;"),Js=typeof rc.oninput=="function"}Jn=Js}else Jn=!1;nc=Jn&&(!document.documentMode||9<document.documentMode)}function xa(){Zn&&(Zn.detachEvent("onpropertychange",ba),Zs=Zn=null)}function ba(r){if(r.propertyName==="value"&&ps(Zs)){var o=[];wa(o,Zs,r,ft(r)),Rr(zr,o)}}function jd(r,o,c){r==="focusin"?(xa(),Zn=o,Zs=c,Zn.attachEvent("onpropertychange",ba)):r==="focusout"&&xa()}function sc(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return ps(Zs)}function ka(r,o){if(r==="click")return ps(o)}function _a(r,o){if(r==="input"||r==="change")return ps(o)}function oi(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var tn=typeof Object.is=="function"?Object.is:oi;function eo(r,o){if(tn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var c=Object.keys(r),m=Object.keys(o);if(c.length!==m.length)return!1;for(m=0;m<c.length;m++){var y=c[m];if(!h.call(o,y)||!tn(r[y],o[y]))return!1}return!0}function Sa(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Na(r,o){var c=Sa(r);r=0;for(var m;c;){if(c.nodeType===3){if(m=r+c.textContent.length,r<=o&&m>=o)return{node:c,offset:o-r};r=m}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Sa(c)}}function Ea(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?Ea(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function Ca(){for(var r=window,o=Be();o instanceof r.HTMLIFrameElement;){try{var c=typeof o.contentWindow.location.href=="string"}catch{c=!1}if(c)r=o.contentWindow;else break;o=Be(r.document)}return o}function q(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o&&(o==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||o==="textarea"||r.contentEditable==="true")}function U(r){var o=Ca(),c=r.focusedElem,m=r.selectionRange;if(o!==c&&c&&c.ownerDocument&&Ea(c.ownerDocument.documentElement,c)){if(m!==null&&q(c)){if(o=m.start,r=m.end,r===void 0&&(r=o),"selectionStart"in c)c.selectionStart=o,c.selectionEnd=Math.min(r,c.value.length);else if(r=(o=c.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var y=c.textContent.length,x=Math.min(m.start,y);m=m.end===void 0?x:Math.min(m.end,y),!r.extend&&x>m&&(y=m,m=x,x=y),y=Na(c,x);var T=Na(c,m);y&&T&&(r.rangeCount!==1||r.anchorNode!==y.node||r.anchorOffset!==y.offset||r.focusNode!==T.node||r.focusOffset!==T.offset)&&(o=o.createRange(),o.setStart(y.node,y.offset),r.removeAllRanges(),x>m?(r.addRange(o),r.extend(T.node,T.offset)):(o.setEnd(T.node,T.offset),r.addRange(o)))}}for(o=[],r=c;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;c<o.length;c++)r=o[c],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var ie=u&&"documentMode"in document&&11>=document.documentMode,fe=null,Ee=null,Re=null,Ue=!1;function nt(r,o,c){var m=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Ue||fe==null||fe!==Be(m)||(m=fe,"selectionStart"in m&&q(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Re&&eo(Re,m)||(Re=m,m=lc(Ee,"onSelect"),0<m.length&&(o=new da("onSelect","select",null,o,c),r.push({event:o,listeners:m}),o.target=fe)))}function ut(r,o){var c={};return c[r.toLowerCase()]=o.toLowerCase(),c["Webkit"+r]="webkit"+o,c["Moz"+r]="moz"+o,c}var et={animationend:ut("Animation","AnimationEnd"),animationiteration:ut("Animation","AnimationIteration"),animationstart:ut("Animation","AnimationStart"),transitionend:ut("Transition","TransitionEnd")},Vt={},to={};u&&(to=document.createElement("div").style,"AnimationEvent"in window||(delete et.animationend.animation,delete et.animationiteration.animation,delete et.animationstart.animation),"TransitionEvent"in window||delete et.transitionend.transition);function no(r){if(Vt[r])return Vt[r];if(!et[r])return r;var o=et[r],c;for(c in o)if(o.hasOwnProperty(c)&&c in to)return Vt[r]=o[c];return r}var oc=no("animationend"),ja=no("animationiteration"),ic=no("animationstart"),Ta=no("transitionend"),ii=new Map,ms="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 on(r,o){ii.set(r,o),a(o,[r])}for(var Nt=0;Nt<ms.length;Nt++){var ai=ms[Nt],aA=ai.toLowerCase(),lA=ai[0].toUpperCase()+ai.slice(1);on(aA,"on"+lA)}on(oc,"onAnimationEnd"),on(ja,"onAnimationIteration"),on(ic,"onAnimationStart"),on("dblclick","onDoubleClick"),on("focusin","onFocus"),on("focusout","onBlur"),on(Ta,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ra="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(" "),cA=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ra));function u0(r,o,c){var m=r.type||"unknown-event";r.currentTarget=c,$o(m,o,void 0,r),r.currentTarget=null}function d0(r,o){o=(o&4)!==0;for(var c=0;c<r.length;c++){var m=r[c],y=m.event;m=m.listeners;e:{var x=void 0;if(o)for(var T=m.length-1;0<=T;T--){var B=m[T],Z=B.instance,le=B.currentTarget;if(B=B.listener,Z!==x&&y.isPropagationStopped())break e;u0(y,B,le),x=Z}else for(T=0;T<m.length;T++){if(B=m[T],Z=B.instance,le=B.currentTarget,B=B.listener,Z!==x&&y.isPropagationStopped())break e;u0(y,B,le),x=Z}}}if(mr)throw r=rs,mr=!1,rs=null,r}function pt(r,o){var c=o[$d];c===void 0&&(c=o[$d]=new Set);var m=r+"__bubble";c.has(m)||(f0(o,r,2,!1),c.add(m))}function Td(r,o,c){var m=0;o&&(m|=4),f0(c,r,m,o)}var ac="_reactListening"+Math.random().toString(36).slice(2);function Aa(r){if(!r[ac]){r[ac]=!0,s.forEach(function(c){c!=="selectionchange"&&(cA.has(c)||Td(c,!1,r),Td(c,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[ac]||(o[ac]=!0,Td("selectionchange",!1,o))}}function f0(r,o,c,m){switch(ei(o)){case 1:var y=la;break;case 4:y=Wl;break;default:y=wr}c=y.bind(null,o,c,r),y=void 0,!Ls||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(y=!0),m?y!==void 0?r.addEventListener(o,c,{capture:!0,passive:y}):r.addEventListener(o,c,!0):y!==void 0?r.addEventListener(o,c,{passive:y}):r.addEventListener(o,c,!1)}function Rd(r,o,c,m,y){var x=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var T=m.tag;if(T===3||T===4){var B=m.stateNode.containerInfo;if(B===y||B.nodeType===8&&B.parentNode===y)break;if(T===4)for(T=m.return;T!==null;){var Z=T.tag;if((Z===3||Z===4)&&(Z=T.stateNode.containerInfo,Z===y||Z.nodeType===8&&Z.parentNode===y))return;T=T.return}for(;B!==null;){if(T=ro(B),T===null)return;if(Z=T.tag,Z===5||Z===6){m=x=T;continue e}B=B.parentNode}}m=m.return}Rr(function(){var le=x,ve=ft(c),we=[];e:{var ge=ii.get(r);if(ge!==void 0){var Ne=da,Ae=r;switch(r){case"keypress":if(ti(c)===0)break e;case"keydown":case"keyup":Ne=Yl;break;case"focusin":Ae="focus",Ne=ni;break;case"focusout":Ae="blur",Ne=ni;break;case"beforeblur":case"afterblur":Ne=ni;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ne=Ks;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ne=yd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ne=en;break;case oc:case ja:case ic:Ne=xd;break;case Ta:Ne=Kl;break;case"scroll":Ne=fs;break;case"wheel":Ne=Ql;break;case"copy":case"cut":case"paste":Ne=br;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ne=Xs}var Oe=(o&4)!==0,Tt=!Oe&&r==="scroll",re=Oe?ge!==null?ge+"Capture":null:ge;Oe=[];for(var te=le,oe;te!==null;){oe=te;var xe=oe.stateNode;if(oe.tag===5&&xe!==null&&(oe=xe,re!==null&&(xe=Un(te,re),xe!=null&&Oe.push(Ma(te,xe,oe)))),Tt)break;te=te.return}0<Oe.length&&(ge=new Ne(ge,Ae,null,c,ve),we.push({event:ge,listeners:Oe}))}}if((o&7)===0){e:{if(ge=r==="mouseover"||r==="pointerover",Ne=r==="mouseout"||r==="pointerout",ge&&c!==xt&&(Ae=c.relatedTarget||c.fromElement)&&(ro(Ae)||Ae[Br]))break e;if((Ne||ge)&&(ge=ve.window===ve?ve:(ge=ve.ownerDocument)?ge.defaultView||ge.parentWindow:window,Ne?(Ae=c.relatedTarget||c.toElement,Ne=le,Ae=Ae?ro(Ae):null,Ae!==null&&(Tt=Cn(Ae),Ae!==Tt||Ae.tag!==5&&Ae.tag!==6)&&(Ae=null)):(Ne=null,Ae=le),Ne!==Ae)){if(Oe=Ks,xe="onMouseLeave",re="onMouseEnter",te="mouse",(r==="pointerout"||r==="pointerover")&&(Oe=Xs,xe="onPointerLeave",re="onPointerEnter",te="pointer"),Tt=Ne==null?ge:ui(Ne),oe=Ae==null?ge:ui(Ae),ge=new Oe(xe,te+"leave",Ne,c,ve),ge.target=Tt,ge.relatedTarget=oe,xe=null,ro(ve)===le&&(Oe=new Oe(re,te+"enter",Ae,c,ve),Oe.target=oe,Oe.relatedTarget=Tt,xe=Oe),Tt=xe,Ne&&Ae)t:{for(Oe=Ne,re=Ae,te=0,oe=Oe;oe;oe=li(oe))te++;for(oe=0,xe=re;xe;xe=li(xe))oe++;for(;0<te-oe;)Oe=li(Oe),te--;for(;0<oe-te;)re=li(re),oe--;for(;te--;){if(Oe===re||re!==null&&Oe===re.alternate)break t;Oe=li(Oe),re=li(re)}Oe=null}else Oe=null;Ne!==null&&h0(we,ge,Ne,Oe,!1),Ae!==null&&Tt!==null&&h0(we,Tt,Ae,Oe,!0)}}e:{if(ge=le?ui(le):window,Ne=ge.nodeName&&ge.nodeName.toLowerCase(),Ne==="select"||Ne==="input"&&ge.type==="file")var Le=Cd;else if(tc(ge))if(nc)Le=_a;else{Le=sc;var Fe=jd}else(Ne=ge.nodeName)&&Ne.toLowerCase()==="input"&&(ge.type==="checkbox"||ge.type==="radio")&&(Le=ka);if(Le&&(Le=Le(r,le))){wa(we,Le,c,ve);break e}Fe&&Fe(r,ge,le),r==="focusout"&&(Fe=ge._wrapperState)&&Fe.controlled&&ge.type==="number"&&Ye(ge,"number",ge.value)}switch(Fe=le?ui(le):window,r){case"focusin":(tc(Fe)||Fe.contentEditable==="true")&&(fe=Fe,Ee=le,Re=null);break;case"focusout":Re=Ee=fe=null;break;case"mousedown":Ue=!0;break;case"contextmenu":case"mouseup":case"dragend":Ue=!1,nt(we,c,ve);break;case"selectionchange":if(ie)break;case"keydown":case"keyup":nt(we,c,ve)}var ze;if(hs)e:{switch(r){case"compositionstart":var We="onCompositionStart";break e;case"compositionend":We="onCompositionEnd";break e;case"compositionupdate":We="onCompositionUpdate";break e}We=void 0}else kt?si(r,c)&&(We="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(We="onCompositionStart");We&&(Qs&&c.locale!=="ko"&&(kt||We!=="onCompositionStart"?We==="onCompositionEnd"&&kt&&(ze=ca()):(xr=ve,Hs="value"in xr?xr.value:xr.textContent,kt=!0)),Fe=lc(le,We),0<Fe.length&&(We=new pa(We,r,null,c,ve),we.push({event:We,listeners:Fe}),ze?We.data=ze:(ze=va(c),ze!==null&&(We.data=ze)))),(ze=Zl?Jl(r,c):ec(r,c))&&(le=lc(le,"onBeforeInput"),0<le.length&&(ve=new pa("onBeforeInput","beforeinput",null,c,ve),we.push({event:ve,listeners:le}),ve.data=ze))}d0(we,o)})}function Ma(r,o,c){return{instance:r,listener:o,currentTarget:c}}function lc(r,o){for(var c=o+"Capture",m=[];r!==null;){var y=r,x=y.stateNode;y.tag===5&&x!==null&&(y=x,x=Un(r,c),x!=null&&m.unshift(Ma(r,x,y)),x=Un(r,o),x!=null&&m.push(Ma(r,x,y))),r=r.return}return m}function li(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function h0(r,o,c,m,y){for(var x=o._reactName,T=[];c!==null&&c!==m;){var B=c,Z=B.alternate,le=B.stateNode;if(Z!==null&&Z===m)break;B.tag===5&&le!==null&&(B=le,y?(Z=Un(c,x),Z!=null&&T.unshift(Ma(c,Z,B))):y||(Z=Un(c,x),Z!=null&&T.push(Ma(c,Z,B)))),c=c.return}T.length!==0&&r.push({event:o,listeners:T})}var uA=/\r\n?/g,dA=/\u0000|\uFFFD/g;function p0(r){return(typeof r=="string"?r:""+r).replace(uA,`
|
|
38
|
-
`).replace(dA,"")}function cc(r,o,c){if(o=p0(o),p0(r)!==o&&c)throw Error(n(425))}function uc(){}var Ad=null,Md=null;function Id(r,o){return r==="textarea"||r==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var Od=typeof setTimeout=="function"?setTimeout:void 0,fA=typeof clearTimeout=="function"?clearTimeout:void 0,m0=typeof Promise=="function"?Promise:void 0,hA=typeof queueMicrotask=="function"?queueMicrotask:typeof m0<"u"?function(r){return m0.resolve(null).then(r).catch(pA)}:Od;function pA(r){setTimeout(function(){throw r})}function Pd(r,o){var c=o,m=0;do{var y=c.nextSibling;if(r.removeChild(c),y&&y.nodeType===8)if(c=y.data,c==="/$"){if(m===0){r.removeChild(y),ds(o);return}m--}else c!=="$"&&c!=="$?"&&c!=="$!"||m++;c=y}while(c);ds(o)}function gs(r){for(;r!=null;r=r.nextSibling){var o=r.nodeType;if(o===1||o===3)break;if(o===8){if(o=r.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return r}function g0(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"){if(o===0)return r;o--}else c==="/$"&&o++}r=r.previousSibling}return null}var ci=Math.random().toString(36).slice(2),kr="__reactFiber$"+ci,Ia="__reactProps$"+ci,Br="__reactContainer$"+ci,$d="__reactEvents$"+ci,mA="__reactListeners$"+ci,gA="__reactHandles$"+ci;function ro(r){var o=r[kr];if(o)return o;for(var c=r.parentNode;c;){if(o=c[Br]||c[kr]){if(c=o.alternate,o.child!==null||c!==null&&c.child!==null)for(r=g0(r);r!==null;){if(c=r[kr])return c;r=g0(r)}return o}r=c,c=r.parentNode}return null}function Oa(r){return r=r[kr]||r[Br],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function ui(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function dc(r){return r[Ia]||null}var Ld=[],di=-1;function ys(r){return{current:r}}function mt(r){0>di||(r.current=Ld[di],Ld[di]=null,di--)}function ht(r,o){di++,Ld[di]=r.current,r.current=o}var vs={},Yt=ys(vs),an=ys(!1),so=vs;function fi(r,o){var c=r.type.contextTypes;if(!c)return vs;var m=r.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===o)return m.__reactInternalMemoizedMaskedChildContext;var y={},x;for(x in c)y[x]=o[x];return m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=y),y}function ln(r){return r=r.childContextTypes,r!=null}function fc(){mt(an),mt(Yt)}function y0(r,o,c){if(Yt.current!==vs)throw Error(n(168));ht(Yt,o),ht(an,c)}function v0(r,o,c){var m=r.stateNode;if(o=o.childContextTypes,typeof m.getChildContext!="function")return c;m=m.getChildContext();for(var y in m)if(!(y in o))throw Error(n(108,V(r)||"Unknown",y));return ee({},c,m)}function hc(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||vs,so=Yt.current,ht(Yt,r),ht(an,an.current),!0}function w0(r,o,c){var m=r.stateNode;if(!m)throw Error(n(169));c?(r=v0(r,o,so),m.__reactInternalMemoizedMergedChildContext=r,mt(an),mt(Yt),ht(Yt,r)):mt(an),ht(an,c)}var Ur=null,pc=!1,qd=!1;function x0(r){Ur===null?Ur=[r]:Ur.push(r)}function yA(r){pc=!0,x0(r)}function ws(){if(!qd&&Ur!==null){qd=!0;var r=0,o=Je;try{var c=Ur;for(Je=1;r<c.length;r++){var m=c[r];do m=m(!0);while(m!==null)}Ur=null,pc=!1}catch(y){throw Ur!==null&&(Ur=Ur.slice(r+1)),qs(ss,ws),y}finally{Je=o,qd=!1}}return null}var hi=[],pi=0,mc=null,gc=0,An=[],Mn=0,oo=null,Wr=1,Hr="";function io(r,o){hi[pi++]=gc,hi[pi++]=mc,mc=r,gc=o}function b0(r,o,c){An[Mn++]=Wr,An[Mn++]=Hr,An[Mn++]=oo,oo=r;var m=Wr;r=Hr;var y=32-gn(m)-1;m&=~(1<<y),c+=1;var x=32-gn(o)+y;if(30<x){var T=y-y%5;x=(m&(1<<T)-1).toString(32),m>>=T,y-=T,Wr=1<<32-gn(o)+y|c<<y|m,Hr=x+r}else Wr=1<<x|c<<y|m,Hr=r}function Dd(r){r.return!==null&&(io(r,1),b0(r,1,0))}function Fd(r){for(;r===mc;)mc=hi[--pi],hi[pi]=null,gc=hi[--pi],hi[pi]=null;for(;r===oo;)oo=An[--Mn],An[Mn]=null,Hr=An[--Mn],An[Mn]=null,Wr=An[--Mn],An[Mn]=null}var vn=null,wn=null,yt=!1,er=null;function k0(r,o){var c=$n(5,null,null,0);c.elementType="DELETED",c.stateNode=o,c.return=r,o=r.deletions,o===null?(r.deletions=[c],r.flags|=16):o.push(c)}function _0(r,o){switch(r.tag){case 5:var c=r.type;return o=o.nodeType!==1||c.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,vn=r,wn=gs(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,vn=r,wn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(c=oo!==null?{id:Wr,overflow:Hr}:null,r.memoizedState={dehydrated:o,treeContext:c,retryLane:1073741824},c=$n(18,null,null,0),c.stateNode=o,c.return=r,r.child=c,vn=r,wn=null,!0):!1;default:return!1}}function zd(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Bd(r){if(yt){var o=wn;if(o){var c=o;if(!_0(r,o)){if(zd(r))throw Error(n(418));o=gs(c.nextSibling);var m=vn;o&&_0(r,o)?k0(m,c):(r.flags=r.flags&-4097|2,yt=!1,vn=r)}}else{if(zd(r))throw Error(n(418));r.flags=r.flags&-4097|2,yt=!1,vn=r}}}function S0(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;vn=r}function yc(r){if(r!==vn)return!1;if(!yt)return S0(r),yt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!Id(r.type,r.memoizedProps)),o&&(o=wn)){if(zd(r))throw N0(),Error(n(418));for(;o;)k0(r,o),o=gs(o.nextSibling)}if(S0(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,o=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"){if(o===0){wn=gs(r.nextSibling);break e}o--}else c!=="$"&&c!=="$!"&&c!=="$?"||o++}r=r.nextSibling}wn=null}}else wn=vn?gs(r.stateNode.nextSibling):null;return!0}function N0(){for(var r=wn;r;)r=gs(r.nextSibling)}function mi(){wn=vn=null,yt=!1}function Ud(r){er===null?er=[r]:er.push(r)}var vA=j.ReactCurrentBatchConfig;function Pa(r,o,c){if(r=c.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(c._owner){if(c=c._owner,c){if(c.tag!==1)throw Error(n(309));var m=c.stateNode}if(!m)throw Error(n(147,r));var y=m,x=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===x?o.ref:(o=function(T){var B=y.refs;T===null?delete B[x]:B[x]=T},o._stringRef=x,o)}if(typeof r!="string")throw Error(n(284));if(!c._owner)throw Error(n(290,r))}return r}function vc(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function E0(r){var o=r._init;return o(r._payload)}function C0(r){function o(re,te){if(r){var oe=re.deletions;oe===null?(re.deletions=[te],re.flags|=16):oe.push(te)}}function c(re,te){if(!r)return null;for(;te!==null;)o(re,te),te=te.sibling;return null}function m(re,te){for(re=new Map;te!==null;)te.key!==null?re.set(te.key,te):re.set(te.index,te),te=te.sibling;return re}function y(re,te){return re=Cs(re,te),re.index=0,re.sibling=null,re}function x(re,te,oe){return re.index=oe,r?(oe=re.alternate,oe!==null?(oe=oe.index,oe<te?(re.flags|=2,te):oe):(re.flags|=2,te)):(re.flags|=1048576,te)}function T(re){return r&&re.alternate===null&&(re.flags|=2),re}function B(re,te,oe,xe){return te===null||te.tag!==6?(te=Pf(oe,re.mode,xe),te.return=re,te):(te=y(te,oe),te.return=re,te)}function Z(re,te,oe,xe){var Le=oe.type;return Le===I?ve(re,te,oe.props.children,xe,oe.key):te!==null&&(te.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===G&&E0(Le)===te.type)?(xe=y(te,oe.props),xe.ref=Pa(re,te,oe),xe.return=re,xe):(xe=Bc(oe.type,oe.key,oe.props,null,re.mode,xe),xe.ref=Pa(re,te,oe),xe.return=re,xe)}function le(re,te,oe,xe){return te===null||te.tag!==4||te.stateNode.containerInfo!==oe.containerInfo||te.stateNode.implementation!==oe.implementation?(te=$f(oe,re.mode,xe),te.return=re,te):(te=y(te,oe.children||[]),te.return=re,te)}function ve(re,te,oe,xe,Le){return te===null||te.tag!==7?(te=mo(oe,re.mode,xe,Le),te.return=re,te):(te=y(te,oe),te.return=re,te)}function we(re,te,oe){if(typeof te=="string"&&te!==""||typeof te=="number")return te=Pf(""+te,re.mode,oe),te.return=re,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case M:return oe=Bc(te.type,te.key,te.props,null,re.mode,oe),oe.ref=Pa(re,null,te),oe.return=re,oe;case P:return te=$f(te,re.mode,oe),te.return=re,te;case G:var xe=te._init;return we(re,xe(te._payload),oe)}if(dt(te)||W(te))return te=mo(te,re.mode,oe,null),te.return=re,te;vc(re,te)}return null}function ge(re,te,oe,xe){var Le=te!==null?te.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number")return Le!==null?null:B(re,te,""+oe,xe);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case M:return oe.key===Le?Z(re,te,oe,xe):null;case P:return oe.key===Le?le(re,te,oe,xe):null;case G:return Le=oe._init,ge(re,te,Le(oe._payload),xe)}if(dt(oe)||W(oe))return Le!==null?null:ve(re,te,oe,xe,null);vc(re,oe)}return null}function Ne(re,te,oe,xe,Le){if(typeof xe=="string"&&xe!==""||typeof xe=="number")return re=re.get(oe)||null,B(te,re,""+xe,Le);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case M:return re=re.get(xe.key===null?oe:xe.key)||null,Z(te,re,xe,Le);case P:return re=re.get(xe.key===null?oe:xe.key)||null,le(te,re,xe,Le);case G:var Fe=xe._init;return Ne(re,te,oe,Fe(xe._payload),Le)}if(dt(xe)||W(xe))return re=re.get(oe)||null,ve(te,re,xe,Le,null);vc(te,xe)}return null}function Ae(re,te,oe,xe){for(var Le=null,Fe=null,ze=te,We=te=0,Ft=null;ze!==null&&We<oe.length;We++){ze.index>We?(Ft=ze,ze=null):Ft=ze.sibling;var st=ge(re,ze,oe[We],xe);if(st===null){ze===null&&(ze=Ft);break}r&&ze&&st.alternate===null&&o(re,ze),te=x(st,te,We),Fe===null?Le=st:Fe.sibling=st,Fe=st,ze=Ft}if(We===oe.length)return c(re,ze),yt&&io(re,We),Le;if(ze===null){for(;We<oe.length;We++)ze=we(re,oe[We],xe),ze!==null&&(te=x(ze,te,We),Fe===null?Le=ze:Fe.sibling=ze,Fe=ze);return yt&&io(re,We),Le}for(ze=m(re,ze);We<oe.length;We++)Ft=Ne(ze,re,We,oe[We],xe),Ft!==null&&(r&&Ft.alternate!==null&&ze.delete(Ft.key===null?We:Ft.key),te=x(Ft,te,We),Fe===null?Le=Ft:Fe.sibling=Ft,Fe=Ft);return r&&ze.forEach(function(js){return o(re,js)}),yt&&io(re,We),Le}function Oe(re,te,oe,xe){var Le=W(oe);if(typeof Le!="function")throw Error(n(150));if(oe=Le.call(oe),oe==null)throw Error(n(151));for(var Fe=Le=null,ze=te,We=te=0,Ft=null,st=oe.next();ze!==null&&!st.done;We++,st=oe.next()){ze.index>We?(Ft=ze,ze=null):Ft=ze.sibling;var js=ge(re,ze,st.value,xe);if(js===null){ze===null&&(ze=Ft);break}r&&ze&&js.alternate===null&&o(re,ze),te=x(js,te,We),Fe===null?Le=js:Fe.sibling=js,Fe=js,ze=Ft}if(st.done)return c(re,ze),yt&&io(re,We),Le;if(ze===null){for(;!st.done;We++,st=oe.next())st=we(re,st.value,xe),st!==null&&(te=x(st,te,We),Fe===null?Le=st:Fe.sibling=st,Fe=st);return yt&&io(re,We),Le}for(ze=m(re,ze);!st.done;We++,st=oe.next())st=Ne(ze,re,We,st.value,xe),st!==null&&(r&&st.alternate!==null&&ze.delete(st.key===null?We:st.key),te=x(st,te,We),Fe===null?Le=st:Fe.sibling=st,Fe=st);return r&&ze.forEach(function(QA){return o(re,QA)}),yt&&io(re,We),Le}function Tt(re,te,oe,xe){if(typeof oe=="object"&&oe!==null&&oe.type===I&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case M:e:{for(var Le=oe.key,Fe=te;Fe!==null;){if(Fe.key===Le){if(Le=oe.type,Le===I){if(Fe.tag===7){c(re,Fe.sibling),te=y(Fe,oe.props.children),te.return=re,re=te;break e}}else if(Fe.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===G&&E0(Le)===Fe.type){c(re,Fe.sibling),te=y(Fe,oe.props),te.ref=Pa(re,Fe,oe),te.return=re,re=te;break e}c(re,Fe);break}else o(re,Fe);Fe=Fe.sibling}oe.type===I?(te=mo(oe.props.children,re.mode,xe,oe.key),te.return=re,re=te):(xe=Bc(oe.type,oe.key,oe.props,null,re.mode,xe),xe.ref=Pa(re,te,oe),xe.return=re,re=xe)}return T(re);case P:e:{for(Fe=oe.key;te!==null;){if(te.key===Fe)if(te.tag===4&&te.stateNode.containerInfo===oe.containerInfo&&te.stateNode.implementation===oe.implementation){c(re,te.sibling),te=y(te,oe.children||[]),te.return=re,re=te;break e}else{c(re,te);break}else o(re,te);te=te.sibling}te=$f(oe,re.mode,xe),te.return=re,re=te}return T(re);case G:return Fe=oe._init,Tt(re,te,Fe(oe._payload),xe)}if(dt(oe))return Ae(re,te,oe,xe);if(W(oe))return Oe(re,te,oe,xe);vc(re,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"?(oe=""+oe,te!==null&&te.tag===6?(c(re,te.sibling),te=y(te,oe),te.return=re,re=te):(c(re,te),te=Pf(oe,re.mode,xe),te.return=re,re=te),T(re)):c(re,te)}return Tt}var gi=C0(!0),j0=C0(!1),wc=ys(null),xc=null,yi=null,Wd=null;function Hd(){Wd=yi=xc=null}function Gd(r){var o=wc.current;mt(wc),r._currentValue=o}function Vd(r,o,c){for(;r!==null;){var m=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,m!==null&&(m.childLanes|=o)):m!==null&&(m.childLanes&o)!==o&&(m.childLanes|=o),r===c)break;r=r.return}}function vi(r,o){xc=r,Wd=yi=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(cn=!0),r.firstContext=null)}function In(r){var o=r._currentValue;if(Wd!==r)if(r={context:r,memoizedValue:o,next:null},yi===null){if(xc===null)throw Error(n(308));yi=r,xc.dependencies={lanes:0,firstContext:r}}else yi=yi.next=r;return o}var ao=null;function Yd(r){ao===null?ao=[r]:ao.push(r)}function T0(r,o,c,m){var y=o.interleaved;return y===null?(c.next=c,Yd(o)):(c.next=y.next,y.next=c),o.interleaved=c,Gr(r,m)}function Gr(r,o){r.lanes|=o;var c=r.alternate;for(c!==null&&(c.lanes|=o),c=r,r=r.return;r!==null;)r.childLanes|=o,c=r.alternate,c!==null&&(c.childLanes|=o),c=r,r=r.return;return c.tag===3?c.stateNode:null}var xs=!1;function Kd(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function R0(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function Vr(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function bs(r,o,c){var m=r.updateQueue;if(m===null)return null;if(m=m.shared,(rt&2)!==0){var y=m.pending;return y===null?o.next=o:(o.next=y.next,y.next=o),m.pending=o,Gr(r,c)}return y=m.interleaved,y===null?(o.next=o,Yd(m)):(o.next=y.next,y.next=o),m.interleaved=o,Gr(r,c)}function bc(r,o,c){if(o=o.updateQueue,o!==null&&(o=o.shared,(c&4194240)!==0)){var m=o.lanes;m&=r.pendingLanes,c|=m,o.lanes=c,cs(r,c)}}function A0(r,o){var c=r.updateQueue,m=r.alternate;if(m!==null&&(m=m.updateQueue,c===m)){var y=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var T={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};x===null?y=x=T:x=x.next=T,c=c.next}while(c!==null);x===null?y=x=o:x=x.next=o}else y=x=o;c={baseState:m.baseState,firstBaseUpdate:y,lastBaseUpdate:x,shared:m.shared,effects:m.effects},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=o:r.next=o,c.lastBaseUpdate=o}function kc(r,o,c,m){var y=r.updateQueue;xs=!1;var x=y.firstBaseUpdate,T=y.lastBaseUpdate,B=y.shared.pending;if(B!==null){y.shared.pending=null;var Z=B,le=Z.next;Z.next=null,T===null?x=le:T.next=le,T=Z;var ve=r.alternate;ve!==null&&(ve=ve.updateQueue,B=ve.lastBaseUpdate,B!==T&&(B===null?ve.firstBaseUpdate=le:B.next=le,ve.lastBaseUpdate=Z))}if(x!==null){var we=y.baseState;T=0,ve=le=Z=null,B=x;do{var ge=B.lane,Ne=B.eventTime;if((m&ge)===ge){ve!==null&&(ve=ve.next={eventTime:Ne,lane:0,tag:B.tag,payload:B.payload,callback:B.callback,next:null});e:{var Ae=r,Oe=B;switch(ge=o,Ne=c,Oe.tag){case 1:if(Ae=Oe.payload,typeof Ae=="function"){we=Ae.call(Ne,we,ge);break e}we=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=Oe.payload,ge=typeof Ae=="function"?Ae.call(Ne,we,ge):Ae,ge==null)break e;we=ee({},we,ge);break e;case 2:xs=!0}}B.callback!==null&&B.lane!==0&&(r.flags|=64,ge=y.effects,ge===null?y.effects=[B]:ge.push(B))}else Ne={eventTime:Ne,lane:ge,tag:B.tag,payload:B.payload,callback:B.callback,next:null},ve===null?(le=ve=Ne,Z=we):ve=ve.next=Ne,T|=ge;if(B=B.next,B===null){if(B=y.shared.pending,B===null)break;ge=B,B=ge.next,ge.next=null,y.lastBaseUpdate=ge,y.shared.pending=null}}while(!0);if(ve===null&&(Z=we),y.baseState=Z,y.firstBaseUpdate=le,y.lastBaseUpdate=ve,o=y.shared.interleaved,o!==null){y=o;do T|=y.lane,y=y.next;while(y!==o)}else x===null&&(y.shared.lanes=0);uo|=T,r.lanes=T,r.memoizedState=we}}function M0(r,o,c){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var m=r[o],y=m.callback;if(y!==null){if(m.callback=null,m=c,typeof y!="function")throw Error(n(191,y));y.call(m)}}}var $a={},_r=ys($a),La=ys($a),qa=ys($a);function lo(r){if(r===$a)throw Error(n(174));return r}function Xd(r,o){switch(ht(qa,o),ht(La,r),ht(_r,$a),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:je(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=je(o,r)}mt(_r),ht(_r,o)}function wi(){mt(_r),mt(La),mt(qa)}function I0(r){lo(qa.current);var o=lo(_r.current),c=je(o,r.type);o!==c&&(ht(La,r),ht(_r,c))}function Qd(r){La.current===r&&(mt(_r),mt(La))}var _t=ys(0);function _c(r){for(var o=r;o!==null;){if(o.tag===13){var c=o.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||c.data==="$?"||c.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Zd=[];function Jd(){for(var r=0;r<Zd.length;r++)Zd[r]._workInProgressVersionPrimary=null;Zd.length=0}var Sc=j.ReactCurrentDispatcher,ef=j.ReactCurrentBatchConfig,co=0,St=null,Pt=null,qt=null,Nc=!1,Da=!1,Fa=0,wA=0;function Kt(){throw Error(n(321))}function tf(r,o){if(o===null)return!1;for(var c=0;c<o.length&&c<r.length;c++)if(!tn(r[c],o[c]))return!1;return!0}function nf(r,o,c,m,y,x){if(co=x,St=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,Sc.current=r===null||r.memoizedState===null?_A:SA,r=c(m,y),Da){x=0;do{if(Da=!1,Fa=0,25<=x)throw Error(n(301));x+=1,qt=Pt=null,o.updateQueue=null,Sc.current=NA,r=c(m,y)}while(Da)}if(Sc.current=jc,o=Pt!==null&&Pt.next!==null,co=0,qt=Pt=St=null,Nc=!1,o)throw Error(n(300));return r}function rf(){var r=Fa!==0;return Fa=0,r}function Sr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qt===null?St.memoizedState=qt=r:qt=qt.next=r,qt}function On(){if(Pt===null){var r=St.alternate;r=r!==null?r.memoizedState:null}else r=Pt.next;var o=qt===null?St.memoizedState:qt.next;if(o!==null)qt=o,Pt=r;else{if(r===null)throw Error(n(310));Pt=r,r={memoizedState:Pt.memoizedState,baseState:Pt.baseState,baseQueue:Pt.baseQueue,queue:Pt.queue,next:null},qt===null?St.memoizedState=qt=r:qt=qt.next=r}return qt}function za(r,o){return typeof o=="function"?o(r):o}function sf(r){var o=On(),c=o.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=Pt,y=m.baseQueue,x=c.pending;if(x!==null){if(y!==null){var T=y.next;y.next=x.next,x.next=T}m.baseQueue=y=x,c.pending=null}if(y!==null){x=y.next,m=m.baseState;var B=T=null,Z=null,le=x;do{var ve=le.lane;if((co&ve)===ve)Z!==null&&(Z=Z.next={lane:0,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),m=le.hasEagerState?le.eagerState:r(m,le.action);else{var we={lane:ve,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null};Z===null?(B=Z=we,T=m):Z=Z.next=we,St.lanes|=ve,uo|=ve}le=le.next}while(le!==null&&le!==x);Z===null?T=m:Z.next=B,tn(m,o.memoizedState)||(cn=!0),o.memoizedState=m,o.baseState=T,o.baseQueue=Z,c.lastRenderedState=m}if(r=c.interleaved,r!==null){y=r;do x=y.lane,St.lanes|=x,uo|=x,y=y.next;while(y!==r)}else y===null&&(c.lanes=0);return[o.memoizedState,c.dispatch]}function of(r){var o=On(),c=o.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=c.dispatch,y=c.pending,x=o.memoizedState;if(y!==null){c.pending=null;var T=y=y.next;do x=r(x,T.action),T=T.next;while(T!==y);tn(x,o.memoizedState)||(cn=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),c.lastRenderedState=x}return[x,m]}function O0(){}function P0(r,o){var c=St,m=On(),y=o(),x=!tn(m.memoizedState,y);if(x&&(m.memoizedState=y,cn=!0),m=m.queue,af(q0.bind(null,c,m,r),[r]),m.getSnapshot!==o||x||qt!==null&&qt.memoizedState.tag&1){if(c.flags|=2048,Ba(9,L0.bind(null,c,m,y,o),void 0,null),Dt===null)throw Error(n(349));(co&30)!==0||$0(c,o,y)}return y}function $0(r,o,c){r.flags|=16384,r={getSnapshot:o,value:c},o=St.updateQueue,o===null?(o={lastEffect:null,stores:null},St.updateQueue=o,o.stores=[r]):(c=o.stores,c===null?o.stores=[r]:c.push(r))}function L0(r,o,c,m){o.value=c,o.getSnapshot=m,D0(o)&&F0(r)}function q0(r,o,c){return c(function(){D0(o)&&F0(r)})}function D0(r){var o=r.getSnapshot;r=r.value;try{var c=o();return!tn(r,c)}catch{return!0}}function F0(r){var o=Gr(r,1);o!==null&&sr(o,r,1,-1)}function z0(r){var o=Sr();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:za,lastRenderedState:r},o.queue=r,r=r.dispatch=kA.bind(null,St,r),[o.memoizedState,r]}function Ba(r,o,c,m){return r={tag:r,create:o,destroy:c,deps:m,next:null},o=St.updateQueue,o===null?(o={lastEffect:null,stores:null},St.updateQueue=o,o.lastEffect=r.next=r):(c=o.lastEffect,c===null?o.lastEffect=r.next=r:(m=c.next,c.next=r,r.next=m,o.lastEffect=r)),r}function B0(){return On().memoizedState}function Ec(r,o,c,m){var y=Sr();St.flags|=r,y.memoizedState=Ba(1|o,c,void 0,m===void 0?null:m)}function Cc(r,o,c,m){var y=On();m=m===void 0?null:m;var x=void 0;if(Pt!==null){var T=Pt.memoizedState;if(x=T.destroy,m!==null&&tf(m,T.deps)){y.memoizedState=Ba(o,c,x,m);return}}St.flags|=r,y.memoizedState=Ba(1|o,c,x,m)}function U0(r,o){return Ec(8390656,8,r,o)}function af(r,o){return Cc(2048,8,r,o)}function W0(r,o){return Cc(4,2,r,o)}function H0(r,o){return Cc(4,4,r,o)}function G0(r,o){if(typeof o=="function")return r=r(),o(r),function(){o(null)};if(o!=null)return r=r(),o.current=r,function(){o.current=null}}function V0(r,o,c){return c=c!=null?c.concat([r]):null,Cc(4,4,G0.bind(null,o,r),c)}function lf(){}function Y0(r,o){var c=On();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&tf(o,m[1])?m[0]:(c.memoizedState=[r,o],r)}function K0(r,o){var c=On();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&tf(o,m[1])?m[0]:(r=r(),c.memoizedState=[r,o],r)}function X0(r,o,c){return(co&21)===0?(r.baseState&&(r.baseState=!1,cn=!0),r.memoizedState=c):(tn(c,o)||(c=zs(),St.lanes|=c,uo|=c,r.baseState=!0),o)}function xA(r,o){var c=Je;Je=c!==0&&4>c?c:4,r(!0);var m=ef.transition;ef.transition={};try{r(!1),o()}finally{Je=c,ef.transition=m}}function Q0(){return On().memoizedState}function bA(r,o,c){var m=Ns(r);if(c={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null},Z0(r))J0(o,c);else if(c=T0(r,o,c,m),c!==null){var y=rn();sr(c,r,m,y),ex(c,o,m)}}function kA(r,o,c){var m=Ns(r),y={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null};if(Z0(r))J0(o,y);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=o.lastRenderedReducer,x!==null))try{var T=o.lastRenderedState,B=x(T,c);if(y.hasEagerState=!0,y.eagerState=B,tn(B,T)){var Z=o.interleaved;Z===null?(y.next=y,Yd(o)):(y.next=Z.next,Z.next=y),o.interleaved=y;return}}catch{}finally{}c=T0(r,o,y,m),c!==null&&(y=rn(),sr(c,r,m,y),ex(c,o,m))}}function Z0(r){var o=r.alternate;return r===St||o!==null&&o===St}function J0(r,o){Da=Nc=!0;var c=r.pending;c===null?o.next=o:(o.next=c.next,c.next=o),r.pending=o}function ex(r,o,c){if((c&4194240)!==0){var m=o.lanes;m&=r.pendingLanes,c|=m,o.lanes=c,cs(r,c)}}var jc={readContext:In,useCallback:Kt,useContext:Kt,useEffect:Kt,useImperativeHandle:Kt,useInsertionEffect:Kt,useLayoutEffect:Kt,useMemo:Kt,useReducer:Kt,useRef:Kt,useState:Kt,useDebugValue:Kt,useDeferredValue:Kt,useTransition:Kt,useMutableSource:Kt,useSyncExternalStore:Kt,useId:Kt,unstable_isNewReconciler:!1},_A={readContext:In,useCallback:function(r,o){return Sr().memoizedState=[r,o===void 0?null:o],r},useContext:In,useEffect:U0,useImperativeHandle:function(r,o,c){return c=c!=null?c.concat([r]):null,Ec(4194308,4,G0.bind(null,o,r),c)},useLayoutEffect:function(r,o){return Ec(4194308,4,r,o)},useInsertionEffect:function(r,o){return Ec(4,2,r,o)},useMemo:function(r,o){var c=Sr();return o=o===void 0?null:o,r=r(),c.memoizedState=[r,o],r},useReducer:function(r,o,c){var m=Sr();return o=c!==void 0?c(o):o,m.memoizedState=m.baseState=o,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:o},m.queue=r,r=r.dispatch=bA.bind(null,St,r),[m.memoizedState,r]},useRef:function(r){var o=Sr();return r={current:r},o.memoizedState=r},useState:z0,useDebugValue:lf,useDeferredValue:function(r){return Sr().memoizedState=r},useTransition:function(){var r=z0(!1),o=r[0];return r=xA.bind(null,r[1]),Sr().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,c){var m=St,y=Sr();if(yt){if(c===void 0)throw Error(n(407));c=c()}else{if(c=o(),Dt===null)throw Error(n(349));(co&30)!==0||$0(m,o,c)}y.memoizedState=c;var x={value:c,getSnapshot:o};return y.queue=x,U0(q0.bind(null,m,x,r),[r]),m.flags|=2048,Ba(9,L0.bind(null,m,x,c,o),void 0,null),c},useId:function(){var r=Sr(),o=Dt.identifierPrefix;if(yt){var c=Hr,m=Wr;c=(m&~(1<<32-gn(m)-1)).toString(32)+c,o=":"+o+"R"+c,c=Fa++,0<c&&(o+="H"+c.toString(32)),o+=":"}else c=wA++,o=":"+o+"r"+c.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},SA={readContext:In,useCallback:Y0,useContext:In,useEffect:af,useImperativeHandle:V0,useInsertionEffect:W0,useLayoutEffect:H0,useMemo:K0,useReducer:sf,useRef:B0,useState:function(){return sf(za)},useDebugValue:lf,useDeferredValue:function(r){var o=On();return X0(o,Pt.memoizedState,r)},useTransition:function(){var r=sf(za)[0],o=On().memoizedState;return[r,o]},useMutableSource:O0,useSyncExternalStore:P0,useId:Q0,unstable_isNewReconciler:!1},NA={readContext:In,useCallback:Y0,useContext:In,useEffect:af,useImperativeHandle:V0,useInsertionEffect:W0,useLayoutEffect:H0,useMemo:K0,useReducer:of,useRef:B0,useState:function(){return of(za)},useDebugValue:lf,useDeferredValue:function(r){var o=On();return Pt===null?o.memoizedState=r:X0(o,Pt.memoizedState,r)},useTransition:function(){var r=of(za)[0],o=On().memoizedState;return[r,o]},useMutableSource:O0,useSyncExternalStore:P0,useId:Q0,unstable_isNewReconciler:!1};function tr(r,o){if(r&&r.defaultProps){o=ee({},o),r=r.defaultProps;for(var c in r)o[c]===void 0&&(o[c]=r[c]);return o}return o}function cf(r,o,c,m){o=r.memoizedState,c=c(m,o),c=c==null?o:ee({},o,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var Tc={isMounted:function(r){return(r=r._reactInternals)?Cn(r)===r:!1},enqueueSetState:function(r,o,c){r=r._reactInternals;var m=rn(),y=Ns(r),x=Vr(m,y);x.payload=o,c!=null&&(x.callback=c),o=bs(r,x,y),o!==null&&(sr(o,r,y,m),bc(o,r,y))},enqueueReplaceState:function(r,o,c){r=r._reactInternals;var m=rn(),y=Ns(r),x=Vr(m,y);x.tag=1,x.payload=o,c!=null&&(x.callback=c),o=bs(r,x,y),o!==null&&(sr(o,r,y,m),bc(o,r,y))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var c=rn(),m=Ns(r),y=Vr(c,m);y.tag=2,o!=null&&(y.callback=o),o=bs(r,y,m),o!==null&&(sr(o,r,m,c),bc(o,r,m))}};function tx(r,o,c,m,y,x,T){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(m,x,T):o.prototype&&o.prototype.isPureReactComponent?!eo(c,m)||!eo(y,x):!0}function nx(r,o,c){var m=!1,y=vs,x=o.contextType;return typeof x=="object"&&x!==null?x=In(x):(y=ln(o)?so:Yt.current,m=o.contextTypes,x=(m=m!=null)?fi(r,y):vs),o=new o(c,x),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Tc,r.stateNode=o,o._reactInternals=r,m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=y,r.__reactInternalMemoizedMaskedChildContext=x),o}function rx(r,o,c,m){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(c,m),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(c,m),o.state!==r&&Tc.enqueueReplaceState(o,o.state,null)}function uf(r,o,c,m){var y=r.stateNode;y.props=c,y.state=r.memoizedState,y.refs={},Kd(r);var x=o.contextType;typeof x=="object"&&x!==null?y.context=In(x):(x=ln(o)?so:Yt.current,y.context=fi(r,x)),y.state=r.memoizedState,x=o.getDerivedStateFromProps,typeof x=="function"&&(cf(r,o,x,c),y.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(o=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),o!==y.state&&Tc.enqueueReplaceState(y,y.state,null),kc(r,c,y,m),y.state=r.memoizedState),typeof y.componentDidMount=="function"&&(r.flags|=4194308)}function xi(r,o){try{var c="",m=o;do c+=D(m),m=m.return;while(m);var y=c}catch(x){y=`
|
|
37
|
+
`+y[T].replace(" at new "," at ");return r.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",r.displayName)),Z}while(1<=T&&0<=B);break}}}finally{ue=!1,Error.prepareStackTrace=c}return(r=r?r.displayName||r.name:"")?Y(r):""}function D(r){switch(r.tag){case 5:return Y(r.type);case 16:return Y("Lazy");case 13:return Y("Suspense");case 19:return Y("SuspenseList");case 0:case 2:case 15:return r=z(r.type,!1),r;case 11:return r=z(r.type.render,!1),r;case 1:return r=z(r.type,!0),r;default:return""}}function J(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case I:return"Fragment";case P:return"Portal";case O:return"Profiler";case F:return"StrictMode";case X:return"Suspense";case R:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case L:return(r.displayName||"Context")+".Consumer";case A:return(r._context.displayName||"Context")+".Provider";case H:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case K:return o=r.displayName||null,o!==null?o:J(r.type)||"Memo";case G:o=r._payload,r=r._init;try{return J(r(o))}catch{}}return null}function V(r){var o=r.type;switch(r.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=o.render,r=r.displayName||r.name||"",o.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return J(o);case 8:return o===F?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function ae(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function he(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function ye(r){var o=he(r)?"checked":"value",c=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),m=""+r[o];if(!r.hasOwnProperty(o)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var y=c.get,x=c.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return y.call(this)},set:function(T){m=""+T,x.call(this,T)}}),Object.defineProperty(r,o,{enumerable:c.enumerable}),{getValue:function(){return m},setValue:function(T){m=""+T},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function _e(r){r._valueTracker||(r._valueTracker=ye(r))}function Ve(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var c=o.getValue(),m="";return r&&(m=he(r)?r.checked?"true":"false":r.value),r=m,r!==c?(o.setValue(r),!0):!1}function Be(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function qe(r,o){var c=o.checked;return ee({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:c??r._wrapperState.initialChecked})}function Se(r,o){var c=o.defaultValue==null?"":o.defaultValue,m=o.checked!=null?o.checked:o.defaultChecked;c=ae(o.value!=null?o.value:c),r._wrapperState={initialChecked:m,initialValue:c,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function ce(r,o){o=o.checked,o!=null&&C(r,"checked",o,!1)}function be(r,o){ce(r,o);var c=ae(o.value),m=o.type;if(c!=null)m==="number"?(c===0&&r.value===""||r.value!=c)&&(r.value=""+c):r.value!==""+c&&(r.value=""+c);else if(m==="submit"||m==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?Ye(r,o.type,c):o.hasOwnProperty("defaultValue")&&Ye(r,o.type,ae(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function ke(r,o,c){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var m=o.type;if(!(m!=="submit"&&m!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+r._wrapperState.initialValue,c||o===r.value||(r.value=o),r.defaultValue=o}c=r.name,c!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,c!==""&&(r.name=c)}function Ye(r,o,c){(o!=="number"||Be(r.ownerDocument)!==r)&&(c==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+c&&(r.defaultValue=""+c))}var dt=Array.isArray;function lt(r,o,c,m){if(r=r.options,o){o={};for(var y=0;y<c.length;y++)o["$"+c[y]]=!0;for(c=0;c<r.length;c++)y=o.hasOwnProperty("$"+r[c].value),r[c].selected!==y&&(r[c].selected=y),y&&m&&(r[c].defaultSelected=!0)}else{for(c=""+ae(c),o=null,y=0;y<r.length;y++){if(r[y].value===c){r[y].selected=!0,m&&(r[y].defaultSelected=!0);return}o!==null||r[y].disabled||(o=r[y])}o!==null&&(o.selected=!0)}}function pe(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return ee({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function me(r,o){var c=o.value;if(c==null){if(c=o.children,o=o.defaultValue,c!=null){if(o!=null)throw Error(n(92));if(dt(c)){if(1<c.length)throw Error(n(93));c=c[0]}o=c}o==null&&(o=""),c=o}r._wrapperState={initialValue:ae(c)}}function Me(r,o){var c=ae(o.value),m=ae(o.defaultValue);c!=null&&(c=""+c,c!==r.value&&(r.value=c),o.defaultValue==null&&r.defaultValue!==c&&(r.defaultValue=c)),m!=null&&(r.defaultValue=""+m)}function He(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function ct(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function je(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?ct(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var Ge,Ke=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,c,m,y){MSApp.execUnsafeLocalFunction(function(){return r(o,c,m,y)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(Ge=Ge||document.createElement("div"),Ge.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=Ge.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function se(r,o){if(o){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=o;return}}r.textContent=o}var Pe={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},$e=["Webkit","ms","Moz","O"];Object.keys(Pe).forEach(function(r){$e.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),Pe[o]=Pe[r]})});function Te(r,o,c){return o==null||typeof o=="boolean"||o===""?"":c||typeof o!="number"||o===0||Pe.hasOwnProperty(r)&&Pe[r]?(""+o).trim():o+"px"}function Xe(r,o){r=r.style;for(var c in o)if(o.hasOwnProperty(c)){var m=c.indexOf("--")===0,y=Te(c,o[c],m);c==="float"&&(c="cssFloat"),m?r.setProperty(c,y):r[c]=y}}var jt=ee({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 ot(r,o){if(o){if(jt[r]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(n(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(n(61))}if(o.style!=null&&typeof o.style!="object")throw Error(n(62))}}function Ie(r,o){if(r.indexOf("-")===-1)return typeof o.is=="string";switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var xt=null;function ft(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var gt=null,Nn=null,Bn=null;function En(r){if(r=Oa(r)){if(typeof gt!="function")throw Error(n(280));var o=r.stateNode;o&&(o=dc(o),gt(r.stateNode,r.type,o))}}function Ao(r){Nn?Bn?Bn.push(r):Bn=[r]:Nn=r}function mn(){if(Nn){var r=Nn,o=Bn;if(Bn=Nn=null,En(r),o)for(r=0;r<o.length;r++)En(o[r])}}function Mo(r,o){return r(o)}function Io(){}var Bt=!1;function Rr(r,o,c){if(Bt)return r(o,c);Bt=!0;try{return Mo(r,o,c)}finally{Bt=!1,(Nn!==null||Bn!==null)&&(Io(),mn())}}function Un(r,o){var c=r.stateNode;if(c===null)return null;var m=dc(c);if(m===null)return null;c=m[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(r=r.type,m=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!m;break e;default:r=!1}if(r)return null;if(c&&typeof c!="function")throw Error(n(231,o,typeof c));return c}var qs=!1;if(u)try{var Ar={};Object.defineProperty(Ar,"passive",{get:function(){qs=!0}}),window.addEventListener("test",Ar,Ar),window.removeEventListener("test",Ar,Ar)}catch{qs=!1}function Oo(r,o,c,m,y,x,T,B,Z){var le=Array.prototype.slice.call(arguments,3);try{o.apply(c,le)}catch(ve){this.onError(ve)}}var pr=!1,Mr=null,mr=!1,ss=null,Po={onError:function(r){pr=!0,Mr=r}};function $o(r,o,c,m,y,x,T,B,Z){pr=!1,Mr=null,Oo.apply(Po,arguments)}function Lo(r,o,c,m,y,x,T,B,Z){if($o.apply(this,arguments),pr){if(pr){var le=Mr;pr=!1,Mr=null}else throw Error(n(198));mr||(mr=!0,ss=le)}}function Cn(r){var o=r,c=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(c=o.return),r=o.return;while(r)}return o.tag===3?c:null}function qo(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function Ir(r){if(Cn(r)!==r)throw Error(n(188))}function Do(r){var o=r.alternate;if(!o){if(o=Cn(r),o===null)throw Error(n(188));return o!==r?null:r}for(var c=r,m=o;;){var y=c.return;if(y===null)break;var x=y.alternate;if(x===null){if(m=y.return,m!==null){c=m;continue}break}if(y.child===x.child){for(x=y.child;x;){if(x===c)return Ir(y),r;if(x===m)return Ir(y),o;x=x.sibling}throw Error(n(188))}if(c.return!==m.return)c=y,m=x;else{for(var T=!1,B=y.child;B;){if(B===c){T=!0,c=y,m=x;break}if(B===m){T=!0,m=y,c=x;break}B=B.sibling}if(!T){for(B=x.child;B;){if(B===c){T=!0,c=x,m=y;break}if(B===m){T=!0,m=x,c=y;break}B=B.sibling}if(!T)throw Error(n(189))}}if(c.alternate!==m)throw Error(n(190))}if(c.tag!==3)throw Error(n(188));return c.stateNode.current===c?r:o}function Wn(r){return r=Do(r),r!==null?Fo(r):null}function Fo(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=Fo(r);if(o!==null)return o;r=r.sibling}return null}var Ds=t.unstable_scheduleCallback,Fs=t.unstable_cancelCallback,zo=t.unstable_shouldYield,Bo=t.unstable_requestPaint,it=t.unstable_now,sa=t.unstable_getCurrentPriorityLevel,os=t.unstable_ImmediatePriority,Gt=t.unstable_UserBlockingPriority,Hn=t.unstable_NormalPriority,Uo=t.unstable_LowPriority,is=t.unstable_IdlePriority,bt=null,sn=null;function Gn(r){if(sn&&typeof sn.onCommitFiberRoot=="function")try{sn.onCommitFiberRoot(bt,r,void 0,(r.current.flags&128)===128)}catch{}}var gn=Math.clz32?Math.clz32:Wo,gd=Math.log,Or=Math.LN2;function Wo(r){return r>>>=0,r===0?32:31-(gd(r)/Or|0)|0}var Ho=64,Go=4194304;function as(r){switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function zs(r,o){var c=r.pendingLanes;if(c===0)return 0;var m=0,y=r.suspendedLanes,x=r.pingedLanes,T=c&268435455;if(T!==0){var B=T&~y;B!==0?m=as(B):(x&=T,x!==0&&(m=as(x)))}else T=c&~y,T!==0?m=as(T):x!==0&&(m=as(x));if(m===0)return 0;if(o!==0&&o!==m&&(o&y)===0&&(y=m&-m,x=o&-o,y>=x||y===16&&(x&4194240)!==0))return o;if((m&4)!==0&&(m|=c&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=m;0<o;)c=31-gn(o),y=1<<c,m|=r[c],o&=~y;return m}function ls(r,o){switch(r){case 1:case 2:case 4:return o+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function zl(r,o){for(var c=r.suspendedLanes,m=r.pingedLanes,y=r.expirationTimes,x=r.pendingLanes;0<x;){var T=31-gn(x),B=1<<T,Z=y[T];Z===-1?((B&c)===0||(B&m)!==0)&&(y[T]=ls(B,o)):Z<=o&&(r.expiredLanes|=B),x&=~B}}function Vo(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Bs(){var r=Ho;return Ho<<=1,(Ho&4194240)===0&&(Ho=64),r}function Yo(r){for(var o=[],c=0;31>c;c++)o.push(r);return o}function cs(r,o,c){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-gn(o),r[o]=c}function Zt(r,o){var c=r.pendingLanes&~o;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=o,r.mutableReadLanes&=o,r.entangledLanes&=o,o=r.entanglements;var m=r.eventTimes;for(r=r.expirationTimes;0<c;){var y=31-gn(c),x=1<<y;o[y]=0,m[y]=-1,r[y]=-1,c&=~x}}function us(r,o){var c=r.entangledLanes|=o;for(r=r.entanglements;c;){var m=31-gn(c),y=1<<m;y&o|r[m]&o&&(r[m]|=o),c&=~y}}var Je=0;function Ko(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Bl,Pr,oa,Vn,Ul,Xo=!1,Qo=[],gr=null,Yn=null,yr=null,yn=new Map,Kn=new Map,Xn=[],ia="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 jn(r,o){switch(r){case"focusin":case"focusout":gr=null;break;case"dragenter":case"dragleave":Yn=null;break;case"mouseover":case"mouseout":yr=null;break;case"pointerover":case"pointerout":yn.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Kn.delete(o.pointerId)}}function Us(r,o,c,m,y,x){return r===null||r.nativeEvent!==x?(r={blockedOn:o,domEventName:c,eventSystemFlags:m,nativeEvent:x,targetContainers:[y]},o!==null&&(o=Oa(o),o!==null&&Pr(o)),r):(r.eventSystemFlags|=m,o=r.targetContainers,y!==null&&o.indexOf(y)===-1&&o.push(y),r)}function Tn(r,o,c,m,y){switch(o){case"focusin":return gr=Us(gr,r,o,c,m,y),!0;case"dragenter":return Yn=Us(Yn,r,o,c,m,y),!0;case"mouseover":return yr=Us(yr,r,o,c,m,y),!0;case"pointerover":var x=y.pointerId;return yn.set(x,Us(yn.get(x)||null,r,o,c,m,y)),!0;case"gotpointercapture":return x=y.pointerId,Kn.set(x,Us(Kn.get(x)||null,r,o,c,m,y)),!0}return!1}function Zo(r){var o=so(r.target);if(o!==null){var c=Cn(o);if(c!==null){if(o=c.tag,o===13){if(o=qo(c),o!==null){r.blockedOn=o,Ul(r.priority,function(){oa(c)});return}}else if(o===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function ds(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var c=ei(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(c===null){c=r.nativeEvent;var m=new c.constructor(c.type,c);xt=m,c.target.dispatchEvent(m),xt=null}else return o=Oa(c),o!==null&&Pr(o),r.blockedOn=c,!1;o.shift()}return!0}function aa(r,o,c){ds(r)&&c.delete(o)}function Jo(){Xo=!1,gr!==null&&ds(gr)&&(gr=null),Yn!==null&&ds(Yn)&&(Yn=null),yr!==null&&ds(yr)&&(yr=null),yn.forEach(aa),Kn.forEach(aa)}function $r(r,o){r.blockedOn===o&&(r.blockedOn=null,Xo||(Xo=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Jo)))}function fs(r){function o(y){return $r(y,r)}if(0<Qo.length){$r(Qo[0],r);for(var c=1;c<Qo.length;c++){var m=Qo[c];m.blockedOn===r&&(m.blockedOn=null)}}for(gr!==null&&$r(gr,r),Yn!==null&&$r(Yn,r),yr!==null&&$r(yr,r),yn.forEach(o),Kn.forEach(o),c=0;c<Xn.length;c++)m=Xn[c],m.blockedOn===r&&(m.blockedOn=null);for(;0<Xn.length&&(c=Xn[0],c.blockedOn===null);)Zo(c),c.blockedOn===null&&Xn.shift()}var vr=j.ReactCurrentBatchConfig,Ws=!0;function la(r,o,c,m){var y=Je,x=vr.transition;vr.transition=null;try{Je=1,wr(r,o,c,m)}finally{Je=y,vr.transition=x}}function Wl(r,o,c,m){var y=Je,x=vr.transition;vr.transition=null;try{Je=4,wr(r,o,c,m)}finally{Je=y,vr.transition=x}}function wr(r,o,c,m){if(Ws){var y=ei(r,o,c,m);if(y===null)Rd(r,o,m,Hs,c),jn(r,m);else if(Tn(y,r,o,c,m))m.stopPropagation();else if(jn(r,m),o&4&&-1<ia.indexOf(r)){for(;y!==null;){var x=Oa(y);if(x!==null&&Bl(x),x=ei(r,o,c,m),x===null&&Rd(r,o,m,Hs,c),x===y)break;y=x}y!==null&&m.stopPropagation()}else Rd(r,o,m,null,c)}}var Hs=null;function ei(r,o,c,m){if(Hs=null,r=ft(m),r=so(r),r!==null)if(o=Cn(r),o===null)r=null;else if(c=o.tag,c===13){if(r=qo(o),r!==null)return r;r=null}else if(c===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return Hs=r,null}function ti(r){switch(r){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(sa()){case os:return 1;case Gt:return 4;case Hn:case Uo:return 16;case is:return 536870912;default:return 16}default:return 16}}var xr=null,Gs=null,Qn=null;function ca(){if(Qn)return Qn;var r,o=Gs,c=o.length,m,y="value"in xr?xr.value:xr.textContent,x=y.length;for(r=0;r<c&&o[r]===y[r];r++);var T=c-r;for(m=1;m<=T&&o[c-m]===y[x-m];m++);return Qn=y.slice(r,1<m?1-m:void 0)}function ni(r){var o=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&o===13&&(r=13)):r=o,r===10&&(r=13),32<=r||r===13?r:0}function Vs(){return!0}function ua(){return!1}function Jt(r){function o(c,m,y,x,T){this._reactName=c,this._targetInst=y,this.type=m,this.nativeEvent=x,this.target=T,this.currentTarget=null;for(var B in r)r.hasOwnProperty(B)&&(c=r[B],this[B]=c?c(x):x[B]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Vs:ua,this.isPropagationStopped=ua,this}return ee(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Vs)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Vs)},persist:function(){},isPersistent:Vs}),o}var Ot={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},da=Jt(Ot),Lr=ee({},Ot,{view:0,detail:0}),hs=Jt(Lr),qr,Ys,Dr,Ks=ee({},Lr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Rn,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Dr&&(Dr&&r.type==="mousemove"?(qr=r.screenX-Dr.screenX,Ys=r.screenY-Dr.screenY):Ys=qr=0,Dr=r),qr)},movementY:function(r){return"movementY"in r?r.movementY:Ys}}),Xs=Jt(Ks),Hl=ee({},Ks,{dataTransfer:0}),yd=Jt(Hl),vd=ee({},Lr,{relatedTarget:0}),ri=Jt(vd),wd=ee({},Ot,{animationName:0,elapsedTime:0,pseudoElement:0}),xd=Jt(wd),fa=ee({},Ot,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),br=Jt(fa),ha=ee({},Ot,{data:0}),pa=Jt(ha),bd={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},kd={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"},Gl={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Vl(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=Gl[r])?!!o[r]:!1}function Rn(){return Vl}var _d=ee({},Lr,{key:function(r){if(r.key){var o=bd[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=ni(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?kd[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Rn,charCode:function(r){return r.type==="keypress"?ni(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?ni(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Yl=Jt(_d),Sd=ee({},Ks,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Qs=Jt(Sd),Nd=ee({},Lr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Rn}),en=Jt(Nd),ma=ee({},Ot,{propertyName:0,elapsedTime:0,pseudoElement:0}),Kl=Jt(ma),Xl=ee({},Ks,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),Ql=Jt(Xl),ga=[9,13,27,32],ps=u&&"CompositionEvent"in window,Fr=null;u&&"documentMode"in document&&(Fr=document.documentMode);var Zl=u&&"TextEvent"in window&&!Fr,Zs=u&&(!ps||Fr&&8<Fr&&11>=Fr),ya=" ",si=!1;function oi(r,o){switch(r){case"keyup":return ga.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function va(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var kt=!1;function Jl(r,o){switch(r){case"compositionend":return va(o);case"keypress":return o.which!==32?null:(si=!0,ya);case"textInput":return r=o.data,r===ya&&si?null:r;default:return null}}function ec(r,o){if(kt)return r==="compositionend"||!ps&&oi(r,o)?(r=ca(),Qn=Gs=xr=null,kt=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return Zs&&o.locale!=="ko"?null:o.data;default:return null}}var Ed={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 tc(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!Ed[r.type]:o==="textarea"}function wa(r,o,c,m){Ao(m),o=lc(o,"onChange"),0<o.length&&(c=new da("onChange","change",null,c,m),r.push({event:c,listeners:o}))}var Zn=null,Js=null;function zr(r){d0(r,0)}function ms(r){var o=di(r);if(Ve(o))return r}function Cd(r,o){if(r==="change")return o}var nc=!1;if(u){var Jn;if(u){var eo="oninput"in document;if(!eo){var rc=document.createElement("div");rc.setAttribute("oninput","return;"),eo=typeof rc.oninput=="function"}Jn=eo}else Jn=!1;nc=Jn&&(!document.documentMode||9<document.documentMode)}function xa(){Zn&&(Zn.detachEvent("onpropertychange",ba),Js=Zn=null)}function ba(r){if(r.propertyName==="value"&&ms(Js)){var o=[];wa(o,Js,r,ft(r)),Rr(zr,o)}}function jd(r,o,c){r==="focusin"?(xa(),Zn=o,Js=c,Zn.attachEvent("onpropertychange",ba)):r==="focusout"&&xa()}function sc(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return ms(Js)}function ka(r,o){if(r==="click")return ms(o)}function _a(r,o){if(r==="input"||r==="change")return ms(o)}function ii(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var tn=typeof Object.is=="function"?Object.is:ii;function to(r,o){if(tn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var c=Object.keys(r),m=Object.keys(o);if(c.length!==m.length)return!1;for(m=0;m<c.length;m++){var y=c[m];if(!h.call(o,y)||!tn(r[y],o[y]))return!1}return!0}function Sa(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Na(r,o){var c=Sa(r);r=0;for(var m;c;){if(c.nodeType===3){if(m=r+c.textContent.length,r<=o&&m>=o)return{node:c,offset:o-r};r=m}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Sa(c)}}function Ea(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?Ea(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function Ca(){for(var r=window,o=Be();o instanceof r.HTMLIFrameElement;){try{var c=typeof o.contentWindow.location.href=="string"}catch{c=!1}if(c)r=o.contentWindow;else break;o=Be(r.document)}return o}function q(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o&&(o==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||o==="textarea"||r.contentEditable==="true")}function U(r){var o=Ca(),c=r.focusedElem,m=r.selectionRange;if(o!==c&&c&&c.ownerDocument&&Ea(c.ownerDocument.documentElement,c)){if(m!==null&&q(c)){if(o=m.start,r=m.end,r===void 0&&(r=o),"selectionStart"in c)c.selectionStart=o,c.selectionEnd=Math.min(r,c.value.length);else if(r=(o=c.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var y=c.textContent.length,x=Math.min(m.start,y);m=m.end===void 0?x:Math.min(m.end,y),!r.extend&&x>m&&(y=m,m=x,x=y),y=Na(c,x);var T=Na(c,m);y&&T&&(r.rangeCount!==1||r.anchorNode!==y.node||r.anchorOffset!==y.offset||r.focusNode!==T.node||r.focusOffset!==T.offset)&&(o=o.createRange(),o.setStart(y.node,y.offset),r.removeAllRanges(),x>m?(r.addRange(o),r.extend(T.node,T.offset)):(o.setEnd(T.node,T.offset),r.addRange(o)))}}for(o=[],r=c;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;c<o.length;c++)r=o[c],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var ie=u&&"documentMode"in document&&11>=document.documentMode,fe=null,Ee=null,Re=null,Ue=!1;function nt(r,o,c){var m=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Ue||fe==null||fe!==Be(m)||(m=fe,"selectionStart"in m&&q(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Re&&to(Re,m)||(Re=m,m=lc(Ee,"onSelect"),0<m.length&&(o=new da("onSelect","select",null,o,c),r.push({event:o,listeners:m}),o.target=fe)))}function ut(r,o){var c={};return c[r.toLowerCase()]=o.toLowerCase(),c["Webkit"+r]="webkit"+o,c["Moz"+r]="moz"+o,c}var et={animationend:ut("Animation","AnimationEnd"),animationiteration:ut("Animation","AnimationIteration"),animationstart:ut("Animation","AnimationStart"),transitionend:ut("Transition","TransitionEnd")},Vt={},no={};u&&(no=document.createElement("div").style,"AnimationEvent"in window||(delete et.animationend.animation,delete et.animationiteration.animation,delete et.animationstart.animation),"TransitionEvent"in window||delete et.transitionend.transition);function ro(r){if(Vt[r])return Vt[r];if(!et[r])return r;var o=et[r],c;for(c in o)if(o.hasOwnProperty(c)&&c in no)return Vt[r]=o[c];return r}var oc=ro("animationend"),ja=ro("animationiteration"),ic=ro("animationstart"),Ta=ro("transitionend"),ai=new Map,gs="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 on(r,o){ai.set(r,o),a(o,[r])}for(var Nt=0;Nt<gs.length;Nt++){var li=gs[Nt],aA=li.toLowerCase(),lA=li[0].toUpperCase()+li.slice(1);on(aA,"on"+lA)}on(oc,"onAnimationEnd"),on(ja,"onAnimationIteration"),on(ic,"onAnimationStart"),on("dblclick","onDoubleClick"),on("focusin","onFocus"),on("focusout","onBlur"),on(Ta,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ra="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(" "),cA=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ra));function u0(r,o,c){var m=r.type||"unknown-event";r.currentTarget=c,Lo(m,o,void 0,r),r.currentTarget=null}function d0(r,o){o=(o&4)!==0;for(var c=0;c<r.length;c++){var m=r[c],y=m.event;m=m.listeners;e:{var x=void 0;if(o)for(var T=m.length-1;0<=T;T--){var B=m[T],Z=B.instance,le=B.currentTarget;if(B=B.listener,Z!==x&&y.isPropagationStopped())break e;u0(y,B,le),x=Z}else for(T=0;T<m.length;T++){if(B=m[T],Z=B.instance,le=B.currentTarget,B=B.listener,Z!==x&&y.isPropagationStopped())break e;u0(y,B,le),x=Z}}}if(mr)throw r=ss,mr=!1,ss=null,r}function pt(r,o){var c=o[$d];c===void 0&&(c=o[$d]=new Set);var m=r+"__bubble";c.has(m)||(f0(o,r,2,!1),c.add(m))}function Td(r,o,c){var m=0;o&&(m|=4),f0(c,r,m,o)}var ac="_reactListening"+Math.random().toString(36).slice(2);function Aa(r){if(!r[ac]){r[ac]=!0,s.forEach(function(c){c!=="selectionchange"&&(cA.has(c)||Td(c,!1,r),Td(c,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[ac]||(o[ac]=!0,Td("selectionchange",!1,o))}}function f0(r,o,c,m){switch(ti(o)){case 1:var y=la;break;case 4:y=Wl;break;default:y=wr}c=y.bind(null,o,c,r),y=void 0,!qs||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(y=!0),m?y!==void 0?r.addEventListener(o,c,{capture:!0,passive:y}):r.addEventListener(o,c,!0):y!==void 0?r.addEventListener(o,c,{passive:y}):r.addEventListener(o,c,!1)}function Rd(r,o,c,m,y){var x=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var T=m.tag;if(T===3||T===4){var B=m.stateNode.containerInfo;if(B===y||B.nodeType===8&&B.parentNode===y)break;if(T===4)for(T=m.return;T!==null;){var Z=T.tag;if((Z===3||Z===4)&&(Z=T.stateNode.containerInfo,Z===y||Z.nodeType===8&&Z.parentNode===y))return;T=T.return}for(;B!==null;){if(T=so(B),T===null)return;if(Z=T.tag,Z===5||Z===6){m=x=T;continue e}B=B.parentNode}}m=m.return}Rr(function(){var le=x,ve=ft(c),we=[];e:{var ge=ai.get(r);if(ge!==void 0){var Ne=da,Ae=r;switch(r){case"keypress":if(ni(c)===0)break e;case"keydown":case"keyup":Ne=Yl;break;case"focusin":Ae="focus",Ne=ri;break;case"focusout":Ae="blur",Ne=ri;break;case"beforeblur":case"afterblur":Ne=ri;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ne=Xs;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ne=yd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ne=en;break;case oc:case ja:case ic:Ne=xd;break;case Ta:Ne=Kl;break;case"scroll":Ne=hs;break;case"wheel":Ne=Ql;break;case"copy":case"cut":case"paste":Ne=br;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ne=Qs}var Oe=(o&4)!==0,Tt=!Oe&&r==="scroll",re=Oe?ge!==null?ge+"Capture":null:ge;Oe=[];for(var te=le,oe;te!==null;){oe=te;var xe=oe.stateNode;if(oe.tag===5&&xe!==null&&(oe=xe,re!==null&&(xe=Un(te,re),xe!=null&&Oe.push(Ma(te,xe,oe)))),Tt)break;te=te.return}0<Oe.length&&(ge=new Ne(ge,Ae,null,c,ve),we.push({event:ge,listeners:Oe}))}}if((o&7)===0){e:{if(ge=r==="mouseover"||r==="pointerover",Ne=r==="mouseout"||r==="pointerout",ge&&c!==xt&&(Ae=c.relatedTarget||c.fromElement)&&(so(Ae)||Ae[Br]))break e;if((Ne||ge)&&(ge=ve.window===ve?ve:(ge=ve.ownerDocument)?ge.defaultView||ge.parentWindow:window,Ne?(Ae=c.relatedTarget||c.toElement,Ne=le,Ae=Ae?so(Ae):null,Ae!==null&&(Tt=Cn(Ae),Ae!==Tt||Ae.tag!==5&&Ae.tag!==6)&&(Ae=null)):(Ne=null,Ae=le),Ne!==Ae)){if(Oe=Xs,xe="onMouseLeave",re="onMouseEnter",te="mouse",(r==="pointerout"||r==="pointerover")&&(Oe=Qs,xe="onPointerLeave",re="onPointerEnter",te="pointer"),Tt=Ne==null?ge:di(Ne),oe=Ae==null?ge:di(Ae),ge=new Oe(xe,te+"leave",Ne,c,ve),ge.target=Tt,ge.relatedTarget=oe,xe=null,so(ve)===le&&(Oe=new Oe(re,te+"enter",Ae,c,ve),Oe.target=oe,Oe.relatedTarget=Tt,xe=Oe),Tt=xe,Ne&&Ae)t:{for(Oe=Ne,re=Ae,te=0,oe=Oe;oe;oe=ci(oe))te++;for(oe=0,xe=re;xe;xe=ci(xe))oe++;for(;0<te-oe;)Oe=ci(Oe),te--;for(;0<oe-te;)re=ci(re),oe--;for(;te--;){if(Oe===re||re!==null&&Oe===re.alternate)break t;Oe=ci(Oe),re=ci(re)}Oe=null}else Oe=null;Ne!==null&&h0(we,ge,Ne,Oe,!1),Ae!==null&&Tt!==null&&h0(we,Tt,Ae,Oe,!0)}}e:{if(ge=le?di(le):window,Ne=ge.nodeName&&ge.nodeName.toLowerCase(),Ne==="select"||Ne==="input"&&ge.type==="file")var Le=Cd;else if(tc(ge))if(nc)Le=_a;else{Le=sc;var Fe=jd}else(Ne=ge.nodeName)&&Ne.toLowerCase()==="input"&&(ge.type==="checkbox"||ge.type==="radio")&&(Le=ka);if(Le&&(Le=Le(r,le))){wa(we,Le,c,ve);break e}Fe&&Fe(r,ge,le),r==="focusout"&&(Fe=ge._wrapperState)&&Fe.controlled&&ge.type==="number"&&Ye(ge,"number",ge.value)}switch(Fe=le?di(le):window,r){case"focusin":(tc(Fe)||Fe.contentEditable==="true")&&(fe=Fe,Ee=le,Re=null);break;case"focusout":Re=Ee=fe=null;break;case"mousedown":Ue=!0;break;case"contextmenu":case"mouseup":case"dragend":Ue=!1,nt(we,c,ve);break;case"selectionchange":if(ie)break;case"keydown":case"keyup":nt(we,c,ve)}var ze;if(ps)e:{switch(r){case"compositionstart":var We="onCompositionStart";break e;case"compositionend":We="onCompositionEnd";break e;case"compositionupdate":We="onCompositionUpdate";break e}We=void 0}else kt?oi(r,c)&&(We="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(We="onCompositionStart");We&&(Zs&&c.locale!=="ko"&&(kt||We!=="onCompositionStart"?We==="onCompositionEnd"&&kt&&(ze=ca()):(xr=ve,Gs="value"in xr?xr.value:xr.textContent,kt=!0)),Fe=lc(le,We),0<Fe.length&&(We=new pa(We,r,null,c,ve),we.push({event:We,listeners:Fe}),ze?We.data=ze:(ze=va(c),ze!==null&&(We.data=ze)))),(ze=Zl?Jl(r,c):ec(r,c))&&(le=lc(le,"onBeforeInput"),0<le.length&&(ve=new pa("onBeforeInput","beforeinput",null,c,ve),we.push({event:ve,listeners:le}),ve.data=ze))}d0(we,o)})}function Ma(r,o,c){return{instance:r,listener:o,currentTarget:c}}function lc(r,o){for(var c=o+"Capture",m=[];r!==null;){var y=r,x=y.stateNode;y.tag===5&&x!==null&&(y=x,x=Un(r,c),x!=null&&m.unshift(Ma(r,x,y)),x=Un(r,o),x!=null&&m.push(Ma(r,x,y))),r=r.return}return m}function ci(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function h0(r,o,c,m,y){for(var x=o._reactName,T=[];c!==null&&c!==m;){var B=c,Z=B.alternate,le=B.stateNode;if(Z!==null&&Z===m)break;B.tag===5&&le!==null&&(B=le,y?(Z=Un(c,x),Z!=null&&T.unshift(Ma(c,Z,B))):y||(Z=Un(c,x),Z!=null&&T.push(Ma(c,Z,B)))),c=c.return}T.length!==0&&r.push({event:o,listeners:T})}var uA=/\r\n?/g,dA=/\u0000|\uFFFD/g;function p0(r){return(typeof r=="string"?r:""+r).replace(uA,`
|
|
38
|
+
`).replace(dA,"")}function cc(r,o,c){if(o=p0(o),p0(r)!==o&&c)throw Error(n(425))}function uc(){}var Ad=null,Md=null;function Id(r,o){return r==="textarea"||r==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var Od=typeof setTimeout=="function"?setTimeout:void 0,fA=typeof clearTimeout=="function"?clearTimeout:void 0,m0=typeof Promise=="function"?Promise:void 0,hA=typeof queueMicrotask=="function"?queueMicrotask:typeof m0<"u"?function(r){return m0.resolve(null).then(r).catch(pA)}:Od;function pA(r){setTimeout(function(){throw r})}function Pd(r,o){var c=o,m=0;do{var y=c.nextSibling;if(r.removeChild(c),y&&y.nodeType===8)if(c=y.data,c==="/$"){if(m===0){r.removeChild(y),fs(o);return}m--}else c!=="$"&&c!=="$?"&&c!=="$!"||m++;c=y}while(c);fs(o)}function ys(r){for(;r!=null;r=r.nextSibling){var o=r.nodeType;if(o===1||o===3)break;if(o===8){if(o=r.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return r}function g0(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"){if(o===0)return r;o--}else c==="/$"&&o++}r=r.previousSibling}return null}var ui=Math.random().toString(36).slice(2),kr="__reactFiber$"+ui,Ia="__reactProps$"+ui,Br="__reactContainer$"+ui,$d="__reactEvents$"+ui,mA="__reactListeners$"+ui,gA="__reactHandles$"+ui;function so(r){var o=r[kr];if(o)return o;for(var c=r.parentNode;c;){if(o=c[Br]||c[kr]){if(c=o.alternate,o.child!==null||c!==null&&c.child!==null)for(r=g0(r);r!==null;){if(c=r[kr])return c;r=g0(r)}return o}r=c,c=r.parentNode}return null}function Oa(r){return r=r[kr]||r[Br],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function di(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function dc(r){return r[Ia]||null}var Ld=[],fi=-1;function vs(r){return{current:r}}function mt(r){0>fi||(r.current=Ld[fi],Ld[fi]=null,fi--)}function ht(r,o){fi++,Ld[fi]=r.current,r.current=o}var ws={},Yt=vs(ws),an=vs(!1),oo=ws;function hi(r,o){var c=r.type.contextTypes;if(!c)return ws;var m=r.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===o)return m.__reactInternalMemoizedMaskedChildContext;var y={},x;for(x in c)y[x]=o[x];return m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=y),y}function ln(r){return r=r.childContextTypes,r!=null}function fc(){mt(an),mt(Yt)}function y0(r,o,c){if(Yt.current!==ws)throw Error(n(168));ht(Yt,o),ht(an,c)}function v0(r,o,c){var m=r.stateNode;if(o=o.childContextTypes,typeof m.getChildContext!="function")return c;m=m.getChildContext();for(var y in m)if(!(y in o))throw Error(n(108,V(r)||"Unknown",y));return ee({},c,m)}function hc(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||ws,oo=Yt.current,ht(Yt,r),ht(an,an.current),!0}function w0(r,o,c){var m=r.stateNode;if(!m)throw Error(n(169));c?(r=v0(r,o,oo),m.__reactInternalMemoizedMergedChildContext=r,mt(an),mt(Yt),ht(Yt,r)):mt(an),ht(an,c)}var Ur=null,pc=!1,qd=!1;function x0(r){Ur===null?Ur=[r]:Ur.push(r)}function yA(r){pc=!0,x0(r)}function xs(){if(!qd&&Ur!==null){qd=!0;var r=0,o=Je;try{var c=Ur;for(Je=1;r<c.length;r++){var m=c[r];do m=m(!0);while(m!==null)}Ur=null,pc=!1}catch(y){throw Ur!==null&&(Ur=Ur.slice(r+1)),Ds(os,xs),y}finally{Je=o,qd=!1}}return null}var pi=[],mi=0,mc=null,gc=0,An=[],Mn=0,io=null,Wr=1,Hr="";function ao(r,o){pi[mi++]=gc,pi[mi++]=mc,mc=r,gc=o}function b0(r,o,c){An[Mn++]=Wr,An[Mn++]=Hr,An[Mn++]=io,io=r;var m=Wr;r=Hr;var y=32-gn(m)-1;m&=~(1<<y),c+=1;var x=32-gn(o)+y;if(30<x){var T=y-y%5;x=(m&(1<<T)-1).toString(32),m>>=T,y-=T,Wr=1<<32-gn(o)+y|c<<y|m,Hr=x+r}else Wr=1<<x|c<<y|m,Hr=r}function Dd(r){r.return!==null&&(ao(r,1),b0(r,1,0))}function Fd(r){for(;r===mc;)mc=pi[--mi],pi[mi]=null,gc=pi[--mi],pi[mi]=null;for(;r===io;)io=An[--Mn],An[Mn]=null,Hr=An[--Mn],An[Mn]=null,Wr=An[--Mn],An[Mn]=null}var vn=null,wn=null,yt=!1,er=null;function k0(r,o){var c=$n(5,null,null,0);c.elementType="DELETED",c.stateNode=o,c.return=r,o=r.deletions,o===null?(r.deletions=[c],r.flags|=16):o.push(c)}function _0(r,o){switch(r.tag){case 5:var c=r.type;return o=o.nodeType!==1||c.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,vn=r,wn=ys(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,vn=r,wn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(c=io!==null?{id:Wr,overflow:Hr}:null,r.memoizedState={dehydrated:o,treeContext:c,retryLane:1073741824},c=$n(18,null,null,0),c.stateNode=o,c.return=r,r.child=c,vn=r,wn=null,!0):!1;default:return!1}}function zd(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Bd(r){if(yt){var o=wn;if(o){var c=o;if(!_0(r,o)){if(zd(r))throw Error(n(418));o=ys(c.nextSibling);var m=vn;o&&_0(r,o)?k0(m,c):(r.flags=r.flags&-4097|2,yt=!1,vn=r)}}else{if(zd(r))throw Error(n(418));r.flags=r.flags&-4097|2,yt=!1,vn=r}}}function S0(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;vn=r}function yc(r){if(r!==vn)return!1;if(!yt)return S0(r),yt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!Id(r.type,r.memoizedProps)),o&&(o=wn)){if(zd(r))throw N0(),Error(n(418));for(;o;)k0(r,o),o=ys(o.nextSibling)}if(S0(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,o=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"){if(o===0){wn=ys(r.nextSibling);break e}o--}else c!=="$"&&c!=="$!"&&c!=="$?"||o++}r=r.nextSibling}wn=null}}else wn=vn?ys(r.stateNode.nextSibling):null;return!0}function N0(){for(var r=wn;r;)r=ys(r.nextSibling)}function gi(){wn=vn=null,yt=!1}function Ud(r){er===null?er=[r]:er.push(r)}var vA=j.ReactCurrentBatchConfig;function Pa(r,o,c){if(r=c.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(c._owner){if(c=c._owner,c){if(c.tag!==1)throw Error(n(309));var m=c.stateNode}if(!m)throw Error(n(147,r));var y=m,x=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===x?o.ref:(o=function(T){var B=y.refs;T===null?delete B[x]:B[x]=T},o._stringRef=x,o)}if(typeof r!="string")throw Error(n(284));if(!c._owner)throw Error(n(290,r))}return r}function vc(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function E0(r){var o=r._init;return o(r._payload)}function C0(r){function o(re,te){if(r){var oe=re.deletions;oe===null?(re.deletions=[te],re.flags|=16):oe.push(te)}}function c(re,te){if(!r)return null;for(;te!==null;)o(re,te),te=te.sibling;return null}function m(re,te){for(re=new Map;te!==null;)te.key!==null?re.set(te.key,te):re.set(te.index,te),te=te.sibling;return re}function y(re,te){return re=js(re,te),re.index=0,re.sibling=null,re}function x(re,te,oe){return re.index=oe,r?(oe=re.alternate,oe!==null?(oe=oe.index,oe<te?(re.flags|=2,te):oe):(re.flags|=2,te)):(re.flags|=1048576,te)}function T(re){return r&&re.alternate===null&&(re.flags|=2),re}function B(re,te,oe,xe){return te===null||te.tag!==6?(te=Pf(oe,re.mode,xe),te.return=re,te):(te=y(te,oe),te.return=re,te)}function Z(re,te,oe,xe){var Le=oe.type;return Le===I?ve(re,te,oe.props.children,xe,oe.key):te!==null&&(te.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===G&&E0(Le)===te.type)?(xe=y(te,oe.props),xe.ref=Pa(re,te,oe),xe.return=re,xe):(xe=Bc(oe.type,oe.key,oe.props,null,re.mode,xe),xe.ref=Pa(re,te,oe),xe.return=re,xe)}function le(re,te,oe,xe){return te===null||te.tag!==4||te.stateNode.containerInfo!==oe.containerInfo||te.stateNode.implementation!==oe.implementation?(te=$f(oe,re.mode,xe),te.return=re,te):(te=y(te,oe.children||[]),te.return=re,te)}function ve(re,te,oe,xe,Le){return te===null||te.tag!==7?(te=go(oe,re.mode,xe,Le),te.return=re,te):(te=y(te,oe),te.return=re,te)}function we(re,te,oe){if(typeof te=="string"&&te!==""||typeof te=="number")return te=Pf(""+te,re.mode,oe),te.return=re,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case M:return oe=Bc(te.type,te.key,te.props,null,re.mode,oe),oe.ref=Pa(re,null,te),oe.return=re,oe;case P:return te=$f(te,re.mode,oe),te.return=re,te;case G:var xe=te._init;return we(re,xe(te._payload),oe)}if(dt(te)||W(te))return te=go(te,re.mode,oe,null),te.return=re,te;vc(re,te)}return null}function ge(re,te,oe,xe){var Le=te!==null?te.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number")return Le!==null?null:B(re,te,""+oe,xe);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case M:return oe.key===Le?Z(re,te,oe,xe):null;case P:return oe.key===Le?le(re,te,oe,xe):null;case G:return Le=oe._init,ge(re,te,Le(oe._payload),xe)}if(dt(oe)||W(oe))return Le!==null?null:ve(re,te,oe,xe,null);vc(re,oe)}return null}function Ne(re,te,oe,xe,Le){if(typeof xe=="string"&&xe!==""||typeof xe=="number")return re=re.get(oe)||null,B(te,re,""+xe,Le);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case M:return re=re.get(xe.key===null?oe:xe.key)||null,Z(te,re,xe,Le);case P:return re=re.get(xe.key===null?oe:xe.key)||null,le(te,re,xe,Le);case G:var Fe=xe._init;return Ne(re,te,oe,Fe(xe._payload),Le)}if(dt(xe)||W(xe))return re=re.get(oe)||null,ve(te,re,xe,Le,null);vc(te,xe)}return null}function Ae(re,te,oe,xe){for(var Le=null,Fe=null,ze=te,We=te=0,Ft=null;ze!==null&&We<oe.length;We++){ze.index>We?(Ft=ze,ze=null):Ft=ze.sibling;var st=ge(re,ze,oe[We],xe);if(st===null){ze===null&&(ze=Ft);break}r&&ze&&st.alternate===null&&o(re,ze),te=x(st,te,We),Fe===null?Le=st:Fe.sibling=st,Fe=st,ze=Ft}if(We===oe.length)return c(re,ze),yt&&ao(re,We),Le;if(ze===null){for(;We<oe.length;We++)ze=we(re,oe[We],xe),ze!==null&&(te=x(ze,te,We),Fe===null?Le=ze:Fe.sibling=ze,Fe=ze);return yt&&ao(re,We),Le}for(ze=m(re,ze);We<oe.length;We++)Ft=Ne(ze,re,We,oe[We],xe),Ft!==null&&(r&&Ft.alternate!==null&&ze.delete(Ft.key===null?We:Ft.key),te=x(Ft,te,We),Fe===null?Le=Ft:Fe.sibling=Ft,Fe=Ft);return r&&ze.forEach(function(Ts){return o(re,Ts)}),yt&&ao(re,We),Le}function Oe(re,te,oe,xe){var Le=W(oe);if(typeof Le!="function")throw Error(n(150));if(oe=Le.call(oe),oe==null)throw Error(n(151));for(var Fe=Le=null,ze=te,We=te=0,Ft=null,st=oe.next();ze!==null&&!st.done;We++,st=oe.next()){ze.index>We?(Ft=ze,ze=null):Ft=ze.sibling;var Ts=ge(re,ze,st.value,xe);if(Ts===null){ze===null&&(ze=Ft);break}r&&ze&&Ts.alternate===null&&o(re,ze),te=x(Ts,te,We),Fe===null?Le=Ts:Fe.sibling=Ts,Fe=Ts,ze=Ft}if(st.done)return c(re,ze),yt&&ao(re,We),Le;if(ze===null){for(;!st.done;We++,st=oe.next())st=we(re,st.value,xe),st!==null&&(te=x(st,te,We),Fe===null?Le=st:Fe.sibling=st,Fe=st);return yt&&ao(re,We),Le}for(ze=m(re,ze);!st.done;We++,st=oe.next())st=Ne(ze,re,We,st.value,xe),st!==null&&(r&&st.alternate!==null&&ze.delete(st.key===null?We:st.key),te=x(st,te,We),Fe===null?Le=st:Fe.sibling=st,Fe=st);return r&&ze.forEach(function(QA){return o(re,QA)}),yt&&ao(re,We),Le}function Tt(re,te,oe,xe){if(typeof oe=="object"&&oe!==null&&oe.type===I&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case M:e:{for(var Le=oe.key,Fe=te;Fe!==null;){if(Fe.key===Le){if(Le=oe.type,Le===I){if(Fe.tag===7){c(re,Fe.sibling),te=y(Fe,oe.props.children),te.return=re,re=te;break e}}else if(Fe.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===G&&E0(Le)===Fe.type){c(re,Fe.sibling),te=y(Fe,oe.props),te.ref=Pa(re,Fe,oe),te.return=re,re=te;break e}c(re,Fe);break}else o(re,Fe);Fe=Fe.sibling}oe.type===I?(te=go(oe.props.children,re.mode,xe,oe.key),te.return=re,re=te):(xe=Bc(oe.type,oe.key,oe.props,null,re.mode,xe),xe.ref=Pa(re,te,oe),xe.return=re,re=xe)}return T(re);case P:e:{for(Fe=oe.key;te!==null;){if(te.key===Fe)if(te.tag===4&&te.stateNode.containerInfo===oe.containerInfo&&te.stateNode.implementation===oe.implementation){c(re,te.sibling),te=y(te,oe.children||[]),te.return=re,re=te;break e}else{c(re,te);break}else o(re,te);te=te.sibling}te=$f(oe,re.mode,xe),te.return=re,re=te}return T(re);case G:return Fe=oe._init,Tt(re,te,Fe(oe._payload),xe)}if(dt(oe))return Ae(re,te,oe,xe);if(W(oe))return Oe(re,te,oe,xe);vc(re,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"?(oe=""+oe,te!==null&&te.tag===6?(c(re,te.sibling),te=y(te,oe),te.return=re,re=te):(c(re,te),te=Pf(oe,re.mode,xe),te.return=re,re=te),T(re)):c(re,te)}return Tt}var yi=C0(!0),j0=C0(!1),wc=vs(null),xc=null,vi=null,Wd=null;function Hd(){Wd=vi=xc=null}function Gd(r){var o=wc.current;mt(wc),r._currentValue=o}function Vd(r,o,c){for(;r!==null;){var m=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,m!==null&&(m.childLanes|=o)):m!==null&&(m.childLanes&o)!==o&&(m.childLanes|=o),r===c)break;r=r.return}}function wi(r,o){xc=r,Wd=vi=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(cn=!0),r.firstContext=null)}function In(r){var o=r._currentValue;if(Wd!==r)if(r={context:r,memoizedValue:o,next:null},vi===null){if(xc===null)throw Error(n(308));vi=r,xc.dependencies={lanes:0,firstContext:r}}else vi=vi.next=r;return o}var lo=null;function Yd(r){lo===null?lo=[r]:lo.push(r)}function T0(r,o,c,m){var y=o.interleaved;return y===null?(c.next=c,Yd(o)):(c.next=y.next,y.next=c),o.interleaved=c,Gr(r,m)}function Gr(r,o){r.lanes|=o;var c=r.alternate;for(c!==null&&(c.lanes|=o),c=r,r=r.return;r!==null;)r.childLanes|=o,c=r.alternate,c!==null&&(c.childLanes|=o),c=r,r=r.return;return c.tag===3?c.stateNode:null}var bs=!1;function Kd(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function R0(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function Vr(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function ks(r,o,c){var m=r.updateQueue;if(m===null)return null;if(m=m.shared,(rt&2)!==0){var y=m.pending;return y===null?o.next=o:(o.next=y.next,y.next=o),m.pending=o,Gr(r,c)}return y=m.interleaved,y===null?(o.next=o,Yd(m)):(o.next=y.next,y.next=o),m.interleaved=o,Gr(r,c)}function bc(r,o,c){if(o=o.updateQueue,o!==null&&(o=o.shared,(c&4194240)!==0)){var m=o.lanes;m&=r.pendingLanes,c|=m,o.lanes=c,us(r,c)}}function A0(r,o){var c=r.updateQueue,m=r.alternate;if(m!==null&&(m=m.updateQueue,c===m)){var y=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var T={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};x===null?y=x=T:x=x.next=T,c=c.next}while(c!==null);x===null?y=x=o:x=x.next=o}else y=x=o;c={baseState:m.baseState,firstBaseUpdate:y,lastBaseUpdate:x,shared:m.shared,effects:m.effects},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=o:r.next=o,c.lastBaseUpdate=o}function kc(r,o,c,m){var y=r.updateQueue;bs=!1;var x=y.firstBaseUpdate,T=y.lastBaseUpdate,B=y.shared.pending;if(B!==null){y.shared.pending=null;var Z=B,le=Z.next;Z.next=null,T===null?x=le:T.next=le,T=Z;var ve=r.alternate;ve!==null&&(ve=ve.updateQueue,B=ve.lastBaseUpdate,B!==T&&(B===null?ve.firstBaseUpdate=le:B.next=le,ve.lastBaseUpdate=Z))}if(x!==null){var we=y.baseState;T=0,ve=le=Z=null,B=x;do{var ge=B.lane,Ne=B.eventTime;if((m&ge)===ge){ve!==null&&(ve=ve.next={eventTime:Ne,lane:0,tag:B.tag,payload:B.payload,callback:B.callback,next:null});e:{var Ae=r,Oe=B;switch(ge=o,Ne=c,Oe.tag){case 1:if(Ae=Oe.payload,typeof Ae=="function"){we=Ae.call(Ne,we,ge);break e}we=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=Oe.payload,ge=typeof Ae=="function"?Ae.call(Ne,we,ge):Ae,ge==null)break e;we=ee({},we,ge);break e;case 2:bs=!0}}B.callback!==null&&B.lane!==0&&(r.flags|=64,ge=y.effects,ge===null?y.effects=[B]:ge.push(B))}else Ne={eventTime:Ne,lane:ge,tag:B.tag,payload:B.payload,callback:B.callback,next:null},ve===null?(le=ve=Ne,Z=we):ve=ve.next=Ne,T|=ge;if(B=B.next,B===null){if(B=y.shared.pending,B===null)break;ge=B,B=ge.next,ge.next=null,y.lastBaseUpdate=ge,y.shared.pending=null}}while(!0);if(ve===null&&(Z=we),y.baseState=Z,y.firstBaseUpdate=le,y.lastBaseUpdate=ve,o=y.shared.interleaved,o!==null){y=o;do T|=y.lane,y=y.next;while(y!==o)}else x===null&&(y.shared.lanes=0);fo|=T,r.lanes=T,r.memoizedState=we}}function M0(r,o,c){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var m=r[o],y=m.callback;if(y!==null){if(m.callback=null,m=c,typeof y!="function")throw Error(n(191,y));y.call(m)}}}var $a={},_r=vs($a),La=vs($a),qa=vs($a);function co(r){if(r===$a)throw Error(n(174));return r}function Xd(r,o){switch(ht(qa,o),ht(La,r),ht(_r,$a),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:je(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=je(o,r)}mt(_r),ht(_r,o)}function xi(){mt(_r),mt(La),mt(qa)}function I0(r){co(qa.current);var o=co(_r.current),c=je(o,r.type);o!==c&&(ht(La,r),ht(_r,c))}function Qd(r){La.current===r&&(mt(_r),mt(La))}var _t=vs(0);function _c(r){for(var o=r;o!==null;){if(o.tag===13){var c=o.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||c.data==="$?"||c.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Zd=[];function Jd(){for(var r=0;r<Zd.length;r++)Zd[r]._workInProgressVersionPrimary=null;Zd.length=0}var Sc=j.ReactCurrentDispatcher,ef=j.ReactCurrentBatchConfig,uo=0,St=null,Pt=null,qt=null,Nc=!1,Da=!1,Fa=0,wA=0;function Kt(){throw Error(n(321))}function tf(r,o){if(o===null)return!1;for(var c=0;c<o.length&&c<r.length;c++)if(!tn(r[c],o[c]))return!1;return!0}function nf(r,o,c,m,y,x){if(uo=x,St=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,Sc.current=r===null||r.memoizedState===null?_A:SA,r=c(m,y),Da){x=0;do{if(Da=!1,Fa=0,25<=x)throw Error(n(301));x+=1,qt=Pt=null,o.updateQueue=null,Sc.current=NA,r=c(m,y)}while(Da)}if(Sc.current=jc,o=Pt!==null&&Pt.next!==null,uo=0,qt=Pt=St=null,Nc=!1,o)throw Error(n(300));return r}function rf(){var r=Fa!==0;return Fa=0,r}function Sr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qt===null?St.memoizedState=qt=r:qt=qt.next=r,qt}function On(){if(Pt===null){var r=St.alternate;r=r!==null?r.memoizedState:null}else r=Pt.next;var o=qt===null?St.memoizedState:qt.next;if(o!==null)qt=o,Pt=r;else{if(r===null)throw Error(n(310));Pt=r,r={memoizedState:Pt.memoizedState,baseState:Pt.baseState,baseQueue:Pt.baseQueue,queue:Pt.queue,next:null},qt===null?St.memoizedState=qt=r:qt=qt.next=r}return qt}function za(r,o){return typeof o=="function"?o(r):o}function sf(r){var o=On(),c=o.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=Pt,y=m.baseQueue,x=c.pending;if(x!==null){if(y!==null){var T=y.next;y.next=x.next,x.next=T}m.baseQueue=y=x,c.pending=null}if(y!==null){x=y.next,m=m.baseState;var B=T=null,Z=null,le=x;do{var ve=le.lane;if((uo&ve)===ve)Z!==null&&(Z=Z.next={lane:0,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),m=le.hasEagerState?le.eagerState:r(m,le.action);else{var we={lane:ve,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null};Z===null?(B=Z=we,T=m):Z=Z.next=we,St.lanes|=ve,fo|=ve}le=le.next}while(le!==null&&le!==x);Z===null?T=m:Z.next=B,tn(m,o.memoizedState)||(cn=!0),o.memoizedState=m,o.baseState=T,o.baseQueue=Z,c.lastRenderedState=m}if(r=c.interleaved,r!==null){y=r;do x=y.lane,St.lanes|=x,fo|=x,y=y.next;while(y!==r)}else y===null&&(c.lanes=0);return[o.memoizedState,c.dispatch]}function of(r){var o=On(),c=o.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=c.dispatch,y=c.pending,x=o.memoizedState;if(y!==null){c.pending=null;var T=y=y.next;do x=r(x,T.action),T=T.next;while(T!==y);tn(x,o.memoizedState)||(cn=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),c.lastRenderedState=x}return[x,m]}function O0(){}function P0(r,o){var c=St,m=On(),y=o(),x=!tn(m.memoizedState,y);if(x&&(m.memoizedState=y,cn=!0),m=m.queue,af(q0.bind(null,c,m,r),[r]),m.getSnapshot!==o||x||qt!==null&&qt.memoizedState.tag&1){if(c.flags|=2048,Ba(9,L0.bind(null,c,m,y,o),void 0,null),Dt===null)throw Error(n(349));(uo&30)!==0||$0(c,o,y)}return y}function $0(r,o,c){r.flags|=16384,r={getSnapshot:o,value:c},o=St.updateQueue,o===null?(o={lastEffect:null,stores:null},St.updateQueue=o,o.stores=[r]):(c=o.stores,c===null?o.stores=[r]:c.push(r))}function L0(r,o,c,m){o.value=c,o.getSnapshot=m,D0(o)&&F0(r)}function q0(r,o,c){return c(function(){D0(o)&&F0(r)})}function D0(r){var o=r.getSnapshot;r=r.value;try{var c=o();return!tn(r,c)}catch{return!0}}function F0(r){var o=Gr(r,1);o!==null&&sr(o,r,1,-1)}function z0(r){var o=Sr();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:za,lastRenderedState:r},o.queue=r,r=r.dispatch=kA.bind(null,St,r),[o.memoizedState,r]}function Ba(r,o,c,m){return r={tag:r,create:o,destroy:c,deps:m,next:null},o=St.updateQueue,o===null?(o={lastEffect:null,stores:null},St.updateQueue=o,o.lastEffect=r.next=r):(c=o.lastEffect,c===null?o.lastEffect=r.next=r:(m=c.next,c.next=r,r.next=m,o.lastEffect=r)),r}function B0(){return On().memoizedState}function Ec(r,o,c,m){var y=Sr();St.flags|=r,y.memoizedState=Ba(1|o,c,void 0,m===void 0?null:m)}function Cc(r,o,c,m){var y=On();m=m===void 0?null:m;var x=void 0;if(Pt!==null){var T=Pt.memoizedState;if(x=T.destroy,m!==null&&tf(m,T.deps)){y.memoizedState=Ba(o,c,x,m);return}}St.flags|=r,y.memoizedState=Ba(1|o,c,x,m)}function U0(r,o){return Ec(8390656,8,r,o)}function af(r,o){return Cc(2048,8,r,o)}function W0(r,o){return Cc(4,2,r,o)}function H0(r,o){return Cc(4,4,r,o)}function G0(r,o){if(typeof o=="function")return r=r(),o(r),function(){o(null)};if(o!=null)return r=r(),o.current=r,function(){o.current=null}}function V0(r,o,c){return c=c!=null?c.concat([r]):null,Cc(4,4,G0.bind(null,o,r),c)}function lf(){}function Y0(r,o){var c=On();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&tf(o,m[1])?m[0]:(c.memoizedState=[r,o],r)}function K0(r,o){var c=On();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&tf(o,m[1])?m[0]:(r=r(),c.memoizedState=[r,o],r)}function X0(r,o,c){return(uo&21)===0?(r.baseState&&(r.baseState=!1,cn=!0),r.memoizedState=c):(tn(c,o)||(c=Bs(),St.lanes|=c,fo|=c,r.baseState=!0),o)}function xA(r,o){var c=Je;Je=c!==0&&4>c?c:4,r(!0);var m=ef.transition;ef.transition={};try{r(!1),o()}finally{Je=c,ef.transition=m}}function Q0(){return On().memoizedState}function bA(r,o,c){var m=Es(r);if(c={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null},Z0(r))J0(o,c);else if(c=T0(r,o,c,m),c!==null){var y=rn();sr(c,r,m,y),ex(c,o,m)}}function kA(r,o,c){var m=Es(r),y={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null};if(Z0(r))J0(o,y);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=o.lastRenderedReducer,x!==null))try{var T=o.lastRenderedState,B=x(T,c);if(y.hasEagerState=!0,y.eagerState=B,tn(B,T)){var Z=o.interleaved;Z===null?(y.next=y,Yd(o)):(y.next=Z.next,Z.next=y),o.interleaved=y;return}}catch{}finally{}c=T0(r,o,y,m),c!==null&&(y=rn(),sr(c,r,m,y),ex(c,o,m))}}function Z0(r){var o=r.alternate;return r===St||o!==null&&o===St}function J0(r,o){Da=Nc=!0;var c=r.pending;c===null?o.next=o:(o.next=c.next,c.next=o),r.pending=o}function ex(r,o,c){if((c&4194240)!==0){var m=o.lanes;m&=r.pendingLanes,c|=m,o.lanes=c,us(r,c)}}var jc={readContext:In,useCallback:Kt,useContext:Kt,useEffect:Kt,useImperativeHandle:Kt,useInsertionEffect:Kt,useLayoutEffect:Kt,useMemo:Kt,useReducer:Kt,useRef:Kt,useState:Kt,useDebugValue:Kt,useDeferredValue:Kt,useTransition:Kt,useMutableSource:Kt,useSyncExternalStore:Kt,useId:Kt,unstable_isNewReconciler:!1},_A={readContext:In,useCallback:function(r,o){return Sr().memoizedState=[r,o===void 0?null:o],r},useContext:In,useEffect:U0,useImperativeHandle:function(r,o,c){return c=c!=null?c.concat([r]):null,Ec(4194308,4,G0.bind(null,o,r),c)},useLayoutEffect:function(r,o){return Ec(4194308,4,r,o)},useInsertionEffect:function(r,o){return Ec(4,2,r,o)},useMemo:function(r,o){var c=Sr();return o=o===void 0?null:o,r=r(),c.memoizedState=[r,o],r},useReducer:function(r,o,c){var m=Sr();return o=c!==void 0?c(o):o,m.memoizedState=m.baseState=o,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:o},m.queue=r,r=r.dispatch=bA.bind(null,St,r),[m.memoizedState,r]},useRef:function(r){var o=Sr();return r={current:r},o.memoizedState=r},useState:z0,useDebugValue:lf,useDeferredValue:function(r){return Sr().memoizedState=r},useTransition:function(){var r=z0(!1),o=r[0];return r=xA.bind(null,r[1]),Sr().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,c){var m=St,y=Sr();if(yt){if(c===void 0)throw Error(n(407));c=c()}else{if(c=o(),Dt===null)throw Error(n(349));(uo&30)!==0||$0(m,o,c)}y.memoizedState=c;var x={value:c,getSnapshot:o};return y.queue=x,U0(q0.bind(null,m,x,r),[r]),m.flags|=2048,Ba(9,L0.bind(null,m,x,c,o),void 0,null),c},useId:function(){var r=Sr(),o=Dt.identifierPrefix;if(yt){var c=Hr,m=Wr;c=(m&~(1<<32-gn(m)-1)).toString(32)+c,o=":"+o+"R"+c,c=Fa++,0<c&&(o+="H"+c.toString(32)),o+=":"}else c=wA++,o=":"+o+"r"+c.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},SA={readContext:In,useCallback:Y0,useContext:In,useEffect:af,useImperativeHandle:V0,useInsertionEffect:W0,useLayoutEffect:H0,useMemo:K0,useReducer:sf,useRef:B0,useState:function(){return sf(za)},useDebugValue:lf,useDeferredValue:function(r){var o=On();return X0(o,Pt.memoizedState,r)},useTransition:function(){var r=sf(za)[0],o=On().memoizedState;return[r,o]},useMutableSource:O0,useSyncExternalStore:P0,useId:Q0,unstable_isNewReconciler:!1},NA={readContext:In,useCallback:Y0,useContext:In,useEffect:af,useImperativeHandle:V0,useInsertionEffect:W0,useLayoutEffect:H0,useMemo:K0,useReducer:of,useRef:B0,useState:function(){return of(za)},useDebugValue:lf,useDeferredValue:function(r){var o=On();return Pt===null?o.memoizedState=r:X0(o,Pt.memoizedState,r)},useTransition:function(){var r=of(za)[0],o=On().memoizedState;return[r,o]},useMutableSource:O0,useSyncExternalStore:P0,useId:Q0,unstable_isNewReconciler:!1};function tr(r,o){if(r&&r.defaultProps){o=ee({},o),r=r.defaultProps;for(var c in r)o[c]===void 0&&(o[c]=r[c]);return o}return o}function cf(r,o,c,m){o=r.memoizedState,c=c(m,o),c=c==null?o:ee({},o,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var Tc={isMounted:function(r){return(r=r._reactInternals)?Cn(r)===r:!1},enqueueSetState:function(r,o,c){r=r._reactInternals;var m=rn(),y=Es(r),x=Vr(m,y);x.payload=o,c!=null&&(x.callback=c),o=ks(r,x,y),o!==null&&(sr(o,r,y,m),bc(o,r,y))},enqueueReplaceState:function(r,o,c){r=r._reactInternals;var m=rn(),y=Es(r),x=Vr(m,y);x.tag=1,x.payload=o,c!=null&&(x.callback=c),o=ks(r,x,y),o!==null&&(sr(o,r,y,m),bc(o,r,y))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var c=rn(),m=Es(r),y=Vr(c,m);y.tag=2,o!=null&&(y.callback=o),o=ks(r,y,m),o!==null&&(sr(o,r,m,c),bc(o,r,m))}};function tx(r,o,c,m,y,x,T){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(m,x,T):o.prototype&&o.prototype.isPureReactComponent?!to(c,m)||!to(y,x):!0}function nx(r,o,c){var m=!1,y=ws,x=o.contextType;return typeof x=="object"&&x!==null?x=In(x):(y=ln(o)?oo:Yt.current,m=o.contextTypes,x=(m=m!=null)?hi(r,y):ws),o=new o(c,x),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Tc,r.stateNode=o,o._reactInternals=r,m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=y,r.__reactInternalMemoizedMaskedChildContext=x),o}function rx(r,o,c,m){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(c,m),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(c,m),o.state!==r&&Tc.enqueueReplaceState(o,o.state,null)}function uf(r,o,c,m){var y=r.stateNode;y.props=c,y.state=r.memoizedState,y.refs={},Kd(r);var x=o.contextType;typeof x=="object"&&x!==null?y.context=In(x):(x=ln(o)?oo:Yt.current,y.context=hi(r,x)),y.state=r.memoizedState,x=o.getDerivedStateFromProps,typeof x=="function"&&(cf(r,o,x,c),y.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(o=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),o!==y.state&&Tc.enqueueReplaceState(y,y.state,null),kc(r,c,y,m),y.state=r.memoizedState),typeof y.componentDidMount=="function"&&(r.flags|=4194308)}function bi(r,o){try{var c="",m=o;do c+=D(m),m=m.return;while(m);var y=c}catch(x){y=`
|
|
39
39
|
Error generating stack: `+x.message+`
|
|
40
|
-
`+x.stack}return{value:r,source:o,stack:y,digest:null}}function df(r,o,c){return{value:r,source:null,stack:c??null,digest:o??null}}function ff(r,o){try{console.error(o.value)}catch(c){setTimeout(function(){throw c})}}var EA=typeof WeakMap=="function"?WeakMap:Map;function sx(r,o,c){c=Vr(-1,c),c.tag=3,c.payload={element:null};var m=o.value;return c.callback=function(){$c||($c=!0,Cf=m),ff(r,o)},c}function ox(r,o,c){c=Vr(-1,c),c.tag=3;var m=r.type.getDerivedStateFromError;if(typeof m=="function"){var y=o.value;c.payload=function(){return m(y)},c.callback=function(){ff(r,o)}}var x=r.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(c.callback=function(){ff(r,o),typeof m!="function"&&(_s===null?_s=new Set([this]):_s.add(this));var T=o.stack;this.componentDidCatch(o.value,{componentStack:T!==null?T:""})}),c}function ix(r,o,c){var m=r.pingCache;if(m===null){m=r.pingCache=new EA;var y=new Set;m.set(o,y)}else y=m.get(o),y===void 0&&(y=new Set,m.set(o,y));y.has(c)||(y.add(c),r=FA.bind(null,r,o,c),o.then(r,r))}function ax(r){do{var o;if((o=r.tag===13)&&(o=r.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return r;r=r.return}while(r!==null);return null}function lx(r,o,c,m,y){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,c.flags|=131072,c.flags&=-52805,c.tag===1&&(c.alternate===null?c.tag=17:(o=Vr(-1,1),o.tag=2,bs(c,o,1))),c.lanes|=1),r):(r.flags|=65536,r.lanes=y,r)}var CA=j.ReactCurrentOwner,cn=!1;function nn(r,o,c,m){o.child=r===null?j0(o,null,c,m):gi(o,r.child,c,m)}function cx(r,o,c,m,y){c=c.render;var x=o.ref;return vi(o,y),m=nf(r,o,c,m,x,y),c=rf(),r!==null&&!cn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~y,Yr(r,o,y)):(yt&&c&&Dd(o),o.flags|=1,nn(r,o,m,y),o.child)}function ux(r,o,c,m,y){if(r===null){var x=c.type;return typeof x=="function"&&!Of(x)&&x.defaultProps===void 0&&c.compare===null&&c.defaultProps===void 0?(o.tag=15,o.type=x,dx(r,o,x,m,y)):(r=Bc(c.type,null,m,o,o.mode,y),r.ref=o.ref,r.return=o,o.child=r)}if(x=r.child,(r.lanes&y)===0){var T=x.memoizedProps;if(c=c.compare,c=c!==null?c:eo,c(T,m)&&r.ref===o.ref)return Yr(r,o,y)}return o.flags|=1,r=Cs(x,m),r.ref=o.ref,r.return=o,o.child=r}function dx(r,o,c,m,y){if(r!==null){var x=r.memoizedProps;if(eo(x,m)&&r.ref===o.ref)if(cn=!1,o.pendingProps=m=x,(r.lanes&y)!==0)(r.flags&131072)!==0&&(cn=!0);else return o.lanes=r.lanes,Yr(r,o,y)}return hf(r,o,c,m,y)}function fx(r,o,c){var m=o.pendingProps,y=m.children,x=r!==null?r.memoizedState:null;if(m.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},ht(ki,xn),xn|=c;else{if((c&1073741824)===0)return r=x!==null?x.baseLanes|c:c,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,ht(ki,xn),xn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=x!==null?x.baseLanes:c,ht(ki,xn),xn|=m}else x!==null?(m=x.baseLanes|c,o.memoizedState=null):m=c,ht(ki,xn),xn|=m;return nn(r,o,y,c),o.child}function hx(r,o){var c=o.ref;(r===null&&c!==null||r!==null&&r.ref!==c)&&(o.flags|=512,o.flags|=2097152)}function hf(r,o,c,m,y){var x=ln(c)?so:Yt.current;return x=fi(o,x),vi(o,y),c=nf(r,o,c,m,x,y),m=rf(),r!==null&&!cn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~y,Yr(r,o,y)):(yt&&m&&Dd(o),o.flags|=1,nn(r,o,c,y),o.child)}function px(r,o,c,m,y){if(ln(c)){var x=!0;hc(o)}else x=!1;if(vi(o,y),o.stateNode===null)Ac(r,o),nx(o,c,m),uf(o,c,m,y),m=!0;else if(r===null){var T=o.stateNode,B=o.memoizedProps;T.props=B;var Z=T.context,le=c.contextType;typeof le=="object"&&le!==null?le=In(le):(le=ln(c)?so:Yt.current,le=fi(o,le));var ve=c.getDerivedStateFromProps,we=typeof ve=="function"||typeof T.getSnapshotBeforeUpdate=="function";we||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(B!==m||Z!==le)&&rx(o,T,m,le),xs=!1;var ge=o.memoizedState;T.state=ge,kc(o,m,T,y),Z=o.memoizedState,B!==m||ge!==Z||an.current||xs?(typeof ve=="function"&&(cf(o,c,ve,m),Z=o.memoizedState),(B=xs||tx(o,c,B,m,ge,Z,le))?(we||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount()),typeof T.componentDidMount=="function"&&(o.flags|=4194308)):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=Z),T.props=m,T.state=Z,T.context=le,m=B):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{T=o.stateNode,R0(r,o),B=o.memoizedProps,le=o.type===o.elementType?B:tr(o.type,B),T.props=le,we=o.pendingProps,ge=T.context,Z=c.contextType,typeof Z=="object"&&Z!==null?Z=In(Z):(Z=ln(c)?so:Yt.current,Z=fi(o,Z));var Ne=c.getDerivedStateFromProps;(ve=typeof Ne=="function"||typeof T.getSnapshotBeforeUpdate=="function")||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(B!==we||ge!==Z)&&rx(o,T,m,Z),xs=!1,ge=o.memoizedState,T.state=ge,kc(o,m,T,y);var Ae=o.memoizedState;B!==we||ge!==Ae||an.current||xs?(typeof Ne=="function"&&(cf(o,c,Ne,m),Ae=o.memoizedState),(le=xs||tx(o,c,le,m,ge,Ae,Z)||!1)?(ve||typeof T.UNSAFE_componentWillUpdate!="function"&&typeof T.componentWillUpdate!="function"||(typeof T.componentWillUpdate=="function"&&T.componentWillUpdate(m,Ae,Z),typeof T.UNSAFE_componentWillUpdate=="function"&&T.UNSAFE_componentWillUpdate(m,Ae,Z)),typeof T.componentDidUpdate=="function"&&(o.flags|=4),typeof T.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof T.componentDidUpdate!="function"||B===r.memoizedProps&&ge===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||B===r.memoizedProps&&ge===r.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=Ae),T.props=m,T.state=Ae,T.context=Z,m=le):(typeof T.componentDidUpdate!="function"||B===r.memoizedProps&&ge===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||B===r.memoizedProps&&ge===r.memoizedState||(o.flags|=1024),m=!1)}return pf(r,o,c,m,x,y)}function pf(r,o,c,m,y,x){hx(r,o);var T=(o.flags&128)!==0;if(!m&&!T)return y&&w0(o,c,!1),Yr(r,o,x);m=o.stateNode,CA.current=o;var B=T&&typeof c.getDerivedStateFromError!="function"?null:m.render();return o.flags|=1,r!==null&&T?(o.child=gi(o,r.child,null,x),o.child=gi(o,null,B,x)):nn(r,o,B,x),o.memoizedState=m.state,y&&w0(o,c,!0),o.child}function mx(r){var o=r.stateNode;o.pendingContext?y0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&y0(r,o.context,!1),Xd(r,o.containerInfo)}function gx(r,o,c,m,y){return mi(),Ud(y),o.flags|=256,nn(r,o,c,m),o.child}var mf={dehydrated:null,treeContext:null,retryLane:0};function gf(r){return{baseLanes:r,cachePool:null,transitions:null}}function yx(r,o,c){var m=o.pendingProps,y=_t.current,x=!1,T=(o.flags&128)!==0,B;if((B=T)||(B=r!==null&&r.memoizedState===null?!1:(y&2)!==0),B?(x=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(y|=1),ht(_t,y&1),r===null)return Bd(o),r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((o.mode&1)===0?o.lanes=1:r.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(T=m.children,r=m.fallback,x?(m=o.mode,x=o.child,T={mode:"hidden",children:T},(m&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=T):x=Uc(T,m,0,null),r=mo(r,m,c,null),x.return=o,r.return=o,x.sibling=r,o.child=x,o.child.memoizedState=gf(c),o.memoizedState=mf,r):yf(o,T));if(y=r.memoizedState,y!==null&&(B=y.dehydrated,B!==null))return jA(r,o,T,m,B,y,c);if(x){x=m.fallback,T=o.mode,y=r.child,B=y.sibling;var Z={mode:"hidden",children:m.children};return(T&1)===0&&o.child!==y?(m=o.child,m.childLanes=0,m.pendingProps=Z,o.deletions=null):(m=Cs(y,Z),m.subtreeFlags=y.subtreeFlags&14680064),B!==null?x=Cs(B,x):(x=mo(x,T,c,null),x.flags|=2),x.return=o,m.return=o,m.sibling=x,o.child=m,m=x,x=o.child,T=r.child.memoizedState,T=T===null?gf(c):{baseLanes:T.baseLanes|c,cachePool:null,transitions:T.transitions},x.memoizedState=T,x.childLanes=r.childLanes&~c,o.memoizedState=mf,m}return x=r.child,r=x.sibling,m=Cs(x,{mode:"visible",children:m.children}),(o.mode&1)===0&&(m.lanes=c),m.return=o,m.sibling=null,r!==null&&(c=o.deletions,c===null?(o.deletions=[r],o.flags|=16):c.push(r)),o.child=m,o.memoizedState=null,m}function yf(r,o){return o=Uc({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function Rc(r,o,c,m){return m!==null&&Ud(m),gi(o,r.child,null,c),r=yf(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function jA(r,o,c,m,y,x,T){if(c)return o.flags&256?(o.flags&=-257,m=df(Error(n(422))),Rc(r,o,T,m)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(x=m.fallback,y=o.mode,m=Uc({mode:"visible",children:m.children},y,0,null),x=mo(x,y,T,null),x.flags|=2,m.return=o,x.return=o,m.sibling=x,o.child=m,(o.mode&1)!==0&&gi(o,r.child,null,T),o.child.memoizedState=gf(T),o.memoizedState=mf,x);if((o.mode&1)===0)return Rc(r,o,T,null);if(y.data==="$!"){if(m=y.nextSibling&&y.nextSibling.dataset,m)var B=m.dgst;return m=B,x=Error(n(419)),m=df(x,m,void 0),Rc(r,o,T,m)}if(B=(T&r.childLanes)!==0,cn||B){if(m=Dt,m!==null){switch(T&-T){case 4:y=2;break;case 16:y=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:y=32;break;case 536870912:y=268435456;break;default:y=0}y=(y&(m.suspendedLanes|T))!==0?0:y,y!==0&&y!==x.retryLane&&(x.retryLane=y,Gr(r,y),sr(m,r,y,-1))}return If(),m=df(Error(n(421))),Rc(r,o,T,m)}return y.data==="$?"?(o.flags|=128,o.child=r.child,o=zA.bind(null,r),y._reactRetry=o,null):(r=x.treeContext,wn=gs(y.nextSibling),vn=o,yt=!0,er=null,r!==null&&(An[Mn++]=Wr,An[Mn++]=Hr,An[Mn++]=oo,Wr=r.id,Hr=r.overflow,oo=o),o=yf(o,m.children),o.flags|=4096,o)}function vx(r,o,c){r.lanes|=o;var m=r.alternate;m!==null&&(m.lanes|=o),Vd(r.return,o,c)}function vf(r,o,c,m,y){var x=r.memoizedState;x===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:c,tailMode:y}:(x.isBackwards=o,x.rendering=null,x.renderingStartTime=0,x.last=m,x.tail=c,x.tailMode=y)}function wx(r,o,c){var m=o.pendingProps,y=m.revealOrder,x=m.tail;if(nn(r,o,m.children,c),m=_t.current,(m&2)!==0)m=m&1|2,o.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&vx(r,c,o);else if(r.tag===19)vx(r,c,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}m&=1}if(ht(_t,m),(o.mode&1)===0)o.memoizedState=null;else switch(y){case"forwards":for(c=o.child,y=null;c!==null;)r=c.alternate,r!==null&&_c(r)===null&&(y=c),c=c.sibling;c=y,c===null?(y=o.child,o.child=null):(y=c.sibling,c.sibling=null),vf(o,!1,y,c,x);break;case"backwards":for(c=null,y=o.child,o.child=null;y!==null;){if(r=y.alternate,r!==null&&_c(r)===null){o.child=y;break}r=y.sibling,y.sibling=c,c=y,y=r}vf(o,!0,c,null,x);break;case"together":vf(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function Ac(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function Yr(r,o,c){if(r!==null&&(o.dependencies=r.dependencies),uo|=o.lanes,(c&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,c=Cs(r,r.pendingProps),o.child=c,c.return=o;r.sibling!==null;)r=r.sibling,c=c.sibling=Cs(r,r.pendingProps),c.return=o;c.sibling=null}return o.child}function TA(r,o,c){switch(o.tag){case 3:mx(o),mi();break;case 5:I0(o);break;case 1:ln(o.type)&&hc(o);break;case 4:Xd(o,o.stateNode.containerInfo);break;case 10:var m=o.type._context,y=o.memoizedProps.value;ht(wc,m._currentValue),m._currentValue=y;break;case 13:if(m=o.memoizedState,m!==null)return m.dehydrated!==null?(ht(_t,_t.current&1),o.flags|=128,null):(c&o.child.childLanes)!==0?yx(r,o,c):(ht(_t,_t.current&1),r=Yr(r,o,c),r!==null?r.sibling:null);ht(_t,_t.current&1);break;case 19:if(m=(c&o.childLanes)!==0,(r.flags&128)!==0){if(m)return wx(r,o,c);o.flags|=128}if(y=o.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),ht(_t,_t.current),m)break;return null;case 22:case 23:return o.lanes=0,fx(r,o,c)}return Yr(r,o,c)}var xx,wf,bx,kx;xx=function(r,o){for(var c=o.child;c!==null;){if(c.tag===5||c.tag===6)r.appendChild(c.stateNode);else if(c.tag!==4&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return;c=c.return}c.sibling.return=c.return,c=c.sibling}},wf=function(){},bx=function(r,o,c,m){var y=r.memoizedProps;if(y!==m){r=o.stateNode,lo(_r.current);var x=null;switch(c){case"input":y=qe(r,y),m=qe(r,m),x=[];break;case"select":y=ee({},y,{value:void 0}),m=ee({},m,{value:void 0}),x=[];break;case"textarea":y=pe(r,y),m=pe(r,m),x=[];break;default:typeof y.onClick!="function"&&typeof m.onClick=="function"&&(r.onclick=uc)}ot(c,m);var T;c=null;for(le in y)if(!m.hasOwnProperty(le)&&y.hasOwnProperty(le)&&y[le]!=null)if(le==="style"){var B=y[le];for(T in B)B.hasOwnProperty(T)&&(c||(c={}),c[T]="")}else le!=="dangerouslySetInnerHTML"&&le!=="children"&&le!=="suppressContentEditableWarning"&&le!=="suppressHydrationWarning"&&le!=="autoFocus"&&(i.hasOwnProperty(le)?x||(x=[]):(x=x||[]).push(le,null));for(le in m){var Z=m[le];if(B=y!=null?y[le]:void 0,m.hasOwnProperty(le)&&Z!==B&&(Z!=null||B!=null))if(le==="style")if(B){for(T in B)!B.hasOwnProperty(T)||Z&&Z.hasOwnProperty(T)||(c||(c={}),c[T]="");for(T in Z)Z.hasOwnProperty(T)&&B[T]!==Z[T]&&(c||(c={}),c[T]=Z[T])}else c||(x||(x=[]),x.push(le,c)),c=Z;else le==="dangerouslySetInnerHTML"?(Z=Z?Z.__html:void 0,B=B?B.__html:void 0,Z!=null&&B!==Z&&(x=x||[]).push(le,Z)):le==="children"?typeof Z!="string"&&typeof Z!="number"||(x=x||[]).push(le,""+Z):le!=="suppressContentEditableWarning"&&le!=="suppressHydrationWarning"&&(i.hasOwnProperty(le)?(Z!=null&&le==="onScroll"&&pt("scroll",r),x||B===Z||(x=[])):(x=x||[]).push(le,Z))}c&&(x=x||[]).push("style",c);var le=x;(o.updateQueue=le)&&(o.flags|=4)}},kx=function(r,o,c,m){c!==m&&(o.flags|=4)};function Ua(r,o){if(!yt)switch(r.tailMode){case"hidden":o=r.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:m.sibling=null}}function Xt(r){var o=r.alternate!==null&&r.alternate.child===r.child,c=0,m=0;if(o)for(var y=r.child;y!==null;)c|=y.lanes|y.childLanes,m|=y.subtreeFlags&14680064,m|=y.flags&14680064,y.return=r,y=y.sibling;else for(y=r.child;y!==null;)c|=y.lanes|y.childLanes,m|=y.subtreeFlags,m|=y.flags,y.return=r,y=y.sibling;return r.subtreeFlags|=m,r.childLanes=c,o}function RA(r,o,c){var m=o.pendingProps;switch(Fd(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xt(o),null;case 1:return ln(o.type)&&fc(),Xt(o),null;case 3:return m=o.stateNode,wi(),mt(an),mt(Yt),Jd(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(r===null||r.child===null)&&(yc(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,er!==null&&(Rf(er),er=null))),wf(r,o),Xt(o),null;case 5:Qd(o);var y=lo(qa.current);if(c=o.type,r!==null&&o.stateNode!=null)bx(r,o,c,m,y),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!m){if(o.stateNode===null)throw Error(n(166));return Xt(o),null}if(r=lo(_r.current),yc(o)){m=o.stateNode,c=o.type;var x=o.memoizedProps;switch(m[kr]=o,m[Ia]=x,r=(o.mode&1)!==0,c){case"dialog":pt("cancel",m),pt("close",m);break;case"iframe":case"object":case"embed":pt("load",m);break;case"video":case"audio":for(y=0;y<Ra.length;y++)pt(Ra[y],m);break;case"source":pt("error",m);break;case"img":case"image":case"link":pt("error",m),pt("load",m);break;case"details":pt("toggle",m);break;case"input":Se(m,x),pt("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!x.multiple},pt("invalid",m);break;case"textarea":me(m,x),pt("invalid",m)}ot(c,x),y=null;for(var T in x)if(x.hasOwnProperty(T)){var B=x[T];T==="children"?typeof B=="string"?m.textContent!==B&&(x.suppressHydrationWarning!==!0&&cc(m.textContent,B,r),y=["children",B]):typeof B=="number"&&m.textContent!==""+B&&(x.suppressHydrationWarning!==!0&&cc(m.textContent,B,r),y=["children",""+B]):i.hasOwnProperty(T)&&B!=null&&T==="onScroll"&&pt("scroll",m)}switch(c){case"input":_e(m),ke(m,x,!0);break;case"textarea":_e(m),He(m);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(m.onclick=uc)}m=y,o.updateQueue=m,m!==null&&(o.flags|=4)}else{T=y.nodeType===9?y:y.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=ct(c)),r==="http://www.w3.org/1999/xhtml"?c==="script"?(r=T.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof m.is=="string"?r=T.createElement(c,{is:m.is}):(r=T.createElement(c),c==="select"&&(T=r,m.multiple?T.multiple=!0:m.size&&(T.size=m.size))):r=T.createElementNS(r,c),r[kr]=o,r[Ia]=m,xx(r,o,!1,!1),o.stateNode=r;e:{switch(T=Ie(c,m),c){case"dialog":pt("cancel",r),pt("close",r),y=m;break;case"iframe":case"object":case"embed":pt("load",r),y=m;break;case"video":case"audio":for(y=0;y<Ra.length;y++)pt(Ra[y],r);y=m;break;case"source":pt("error",r),y=m;break;case"img":case"image":case"link":pt("error",r),pt("load",r),y=m;break;case"details":pt("toggle",r),y=m;break;case"input":Se(r,m),y=qe(r,m),pt("invalid",r);break;case"option":y=m;break;case"select":r._wrapperState={wasMultiple:!!m.multiple},y=ee({},m,{value:void 0}),pt("invalid",r);break;case"textarea":me(r,m),y=pe(r,m),pt("invalid",r);break;default:y=m}ot(c,y),B=y;for(x in B)if(B.hasOwnProperty(x)){var Z=B[x];x==="style"?Xe(r,Z):x==="dangerouslySetInnerHTML"?(Z=Z?Z.__html:void 0,Z!=null&&Ke(r,Z)):x==="children"?typeof Z=="string"?(c!=="textarea"||Z!=="")&&se(r,Z):typeof Z=="number"&&se(r,""+Z):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(i.hasOwnProperty(x)?Z!=null&&x==="onScroll"&&pt("scroll",r):Z!=null&&C(r,x,Z,T))}switch(c){case"input":_e(r),ke(r,m,!1);break;case"textarea":_e(r),He(r);break;case"option":m.value!=null&&r.setAttribute("value",""+ae(m.value));break;case"select":r.multiple=!!m.multiple,x=m.value,x!=null?lt(r,!!m.multiple,x,!1):m.defaultValue!=null&<(r,!!m.multiple,m.defaultValue,!0);break;default:typeof y.onClick=="function"&&(r.onclick=uc)}switch(c){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}}m&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return Xt(o),null;case 6:if(r&&o.stateNode!=null)kx(r,o,r.memoizedProps,m);else{if(typeof m!="string"&&o.stateNode===null)throw Error(n(166));if(c=lo(qa.current),lo(_r.current),yc(o)){if(m=o.stateNode,c=o.memoizedProps,m[kr]=o,(x=m.nodeValue!==c)&&(r=vn,r!==null))switch(r.tag){case 3:cc(m.nodeValue,c,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&cc(m.nodeValue,c,(r.mode&1)!==0)}x&&(o.flags|=4)}else m=(c.nodeType===9?c:c.ownerDocument).createTextNode(m),m[kr]=o,o.stateNode=m}return Xt(o),null;case 13:if(mt(_t),m=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(yt&&wn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)N0(),mi(),o.flags|=98560,x=!1;else if(x=yc(o),m!==null&&m.dehydrated!==null){if(r===null){if(!x)throw Error(n(318));if(x=o.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(n(317));x[kr]=o}else mi(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Xt(o),x=!1}else er!==null&&(Rf(er),er=null),x=!0;if(!x)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=c,o):(m=m!==null,m!==(r!==null&&r.memoizedState!==null)&&m&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(_t.current&1)!==0?$t===0&&($t=3):If())),o.updateQueue!==null&&(o.flags|=4),Xt(o),null);case 4:return wi(),wf(r,o),r===null&&Aa(o.stateNode.containerInfo),Xt(o),null;case 10:return Gd(o.type._context),Xt(o),null;case 17:return ln(o.type)&&fc(),Xt(o),null;case 19:if(mt(_t),x=o.memoizedState,x===null)return Xt(o),null;if(m=(o.flags&128)!==0,T=x.rendering,T===null)if(m)Ua(x,!1);else{if($t!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(T=_c(r),T!==null){for(o.flags|=128,Ua(x,!1),m=T.updateQueue,m!==null&&(o.updateQueue=m,o.flags|=4),o.subtreeFlags=0,m=c,c=o.child;c!==null;)x=c,r=m,x.flags&=14680066,T=x.alternate,T===null?(x.childLanes=0,x.lanes=r,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=T.childLanes,x.lanes=T.lanes,x.child=T.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=T.memoizedProps,x.memoizedState=T.memoizedState,x.updateQueue=T.updateQueue,x.type=T.type,r=T.dependencies,x.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),c=c.sibling;return ht(_t,_t.current&1|2),o.child}r=r.sibling}x.tail!==null&&it()>_i&&(o.flags|=128,m=!0,Ua(x,!1),o.lanes=4194304)}else{if(!m)if(r=_c(T),r!==null){if(o.flags|=128,m=!0,c=r.updateQueue,c!==null&&(o.updateQueue=c,o.flags|=4),Ua(x,!0),x.tail===null&&x.tailMode==="hidden"&&!T.alternate&&!yt)return Xt(o),null}else 2*it()-x.renderingStartTime>_i&&c!==1073741824&&(o.flags|=128,m=!0,Ua(x,!1),o.lanes=4194304);x.isBackwards?(T.sibling=o.child,o.child=T):(c=x.last,c!==null?c.sibling=T:o.child=T,x.last=T)}return x.tail!==null?(o=x.tail,x.rendering=o,x.tail=o.sibling,x.renderingStartTime=it(),o.sibling=null,c=_t.current,ht(_t,m?c&1|2:c&1),o):(Xt(o),null);case 22:case 23:return Mf(),m=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==m&&(o.flags|=8192),m&&(o.mode&1)!==0?(xn&1073741824)!==0&&(Xt(o),o.subtreeFlags&6&&(o.flags|=8192)):Xt(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function AA(r,o){switch(Fd(o),o.tag){case 1:return ln(o.type)&&fc(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return wi(),mt(an),mt(Yt),Jd(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return Qd(o),null;case 13:if(mt(_t),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));mi()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return mt(_t),null;case 4:return wi(),null;case 10:return Gd(o.type._context),null;case 22:case 23:return Mf(),null;case 24:return null;default:return null}}var Mc=!1,Qt=!1,MA=typeof WeakSet=="function"?WeakSet:Set,Ce=null;function bi(r,o){var c=r.ref;if(c!==null)if(typeof c=="function")try{c(null)}catch(m){Et(r,o,m)}else c.current=null}function xf(r,o,c){try{c()}catch(m){Et(r,o,m)}}var _x=!1;function IA(r,o){if(Ad=Us,r=Ca(),q(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var m=c.getSelection&&c.getSelection();if(m&&m.rangeCount!==0){c=m.anchorNode;var y=m.anchorOffset,x=m.focusNode;m=m.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var T=0,B=-1,Z=-1,le=0,ve=0,we=r,ge=null;t:for(;;){for(var Ne;we!==c||y!==0&&we.nodeType!==3||(B=T+y),we!==x||m!==0&&we.nodeType!==3||(Z=T+m),we.nodeType===3&&(T+=we.nodeValue.length),(Ne=we.firstChild)!==null;)ge=we,we=Ne;for(;;){if(we===r)break t;if(ge===c&&++le===y&&(B=T),ge===x&&++ve===m&&(Z=T),(Ne=we.nextSibling)!==null)break;we=ge,ge=we.parentNode}we=Ne}c=B===-1||Z===-1?null:{start:B,end:Z}}else c=null}c=c||{start:0,end:0}}else c=null;for(Md={focusedElem:r,selectionRange:c},Us=!1,Ce=o;Ce!==null;)if(o=Ce,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,Ce=r;else for(;Ce!==null;){o=Ce;try{var Ae=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(Ae!==null){var Oe=Ae.memoizedProps,Tt=Ae.memoizedState,re=o.stateNode,te=re.getSnapshotBeforeUpdate(o.elementType===o.type?Oe:tr(o.type,Oe),Tt);re.__reactInternalSnapshotBeforeUpdate=te}break;case 3:var oe=o.stateNode.containerInfo;oe.nodeType===1?oe.textContent="":oe.nodeType===9&&oe.documentElement&&oe.removeChild(oe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(xe){Et(o,o.return,xe)}if(r=o.sibling,r!==null){r.return=o.return,Ce=r;break}Ce=o.return}return Ae=_x,_x=!1,Ae}function Wa(r,o,c){var m=o.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var y=m=m.next;do{if((y.tag&r)===r){var x=y.destroy;y.destroy=void 0,x!==void 0&&xf(o,c,x)}y=y.next}while(y!==m)}}function Ic(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var c=o=o.next;do{if((c.tag&r)===r){var m=c.create;c.destroy=m()}c=c.next}while(c!==o)}}function bf(r){var o=r.ref;if(o!==null){var c=r.stateNode;switch(r.tag){case 5:r=c;break;default:r=c}typeof o=="function"?o(r):o.current=r}}function Sx(r){var o=r.alternate;o!==null&&(r.alternate=null,Sx(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[kr],delete o[Ia],delete o[$d],delete o[mA],delete o[gA])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function Nx(r){return r.tag===5||r.tag===3||r.tag===4}function Ex(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Nx(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function kf(r,o,c){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?c.nodeType===8?c.parentNode.insertBefore(r,o):c.insertBefore(r,o):(c.nodeType===8?(o=c.parentNode,o.insertBefore(r,c)):(o=c,o.appendChild(r)),c=c._reactRootContainer,c!=null||o.onclick!==null||(o.onclick=uc));else if(m!==4&&(r=r.child,r!==null))for(kf(r,o,c),r=r.sibling;r!==null;)kf(r,o,c),r=r.sibling}function _f(r,o,c){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?c.insertBefore(r,o):c.appendChild(r);else if(m!==4&&(r=r.child,r!==null))for(_f(r,o,c),r=r.sibling;r!==null;)_f(r,o,c),r=r.sibling}var Ut=null,nr=!1;function ks(r,o,c){for(c=c.child;c!==null;)Cx(r,o,c),c=c.sibling}function Cx(r,o,c){if(sn&&typeof sn.onCommitFiberUnmount=="function")try{sn.onCommitFiberUnmount(bt,c)}catch{}switch(c.tag){case 5:Qt||bi(c,o);case 6:var m=Ut,y=nr;Ut=null,ks(r,o,c),Ut=m,nr=y,Ut!==null&&(nr?(r=Ut,c=c.stateNode,r.nodeType===8?r.parentNode.removeChild(c):r.removeChild(c)):Ut.removeChild(c.stateNode));break;case 18:Ut!==null&&(nr?(r=Ut,c=c.stateNode,r.nodeType===8?Pd(r.parentNode,c):r.nodeType===1&&Pd(r,c),ds(r)):Pd(Ut,c.stateNode));break;case 4:m=Ut,y=nr,Ut=c.stateNode.containerInfo,nr=!0,ks(r,o,c),Ut=m,nr=y;break;case 0:case 11:case 14:case 15:if(!Qt&&(m=c.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){y=m=m.next;do{var x=y,T=x.destroy;x=x.tag,T!==void 0&&((x&2)!==0||(x&4)!==0)&&xf(c,o,T),y=y.next}while(y!==m)}ks(r,o,c);break;case 1:if(!Qt&&(bi(c,o),m=c.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=c.memoizedProps,m.state=c.memoizedState,m.componentWillUnmount()}catch(B){Et(c,o,B)}ks(r,o,c);break;case 21:ks(r,o,c);break;case 22:c.mode&1?(Qt=(m=Qt)||c.memoizedState!==null,ks(r,o,c),Qt=m):ks(r,o,c);break;default:ks(r,o,c)}}function jx(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var c=r.stateNode;c===null&&(c=r.stateNode=new MA),o.forEach(function(m){var y=BA.bind(null,r,m);c.has(m)||(c.add(m),m.then(y,y))})}}function rr(r,o){var c=o.deletions;if(c!==null)for(var m=0;m<c.length;m++){var y=c[m];try{var x=r,T=o,B=T;e:for(;B!==null;){switch(B.tag){case 5:Ut=B.stateNode,nr=!1;break e;case 3:Ut=B.stateNode.containerInfo,nr=!0;break e;case 4:Ut=B.stateNode.containerInfo,nr=!0;break e}B=B.return}if(Ut===null)throw Error(n(160));Cx(x,T,y),Ut=null,nr=!1;var Z=y.alternate;Z!==null&&(Z.return=null),y.return=null}catch(le){Et(y,o,le)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)Tx(o,r),o=o.sibling}function Tx(r,o){var c=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(rr(o,r),Nr(r),m&4){try{Wa(3,r,r.return),Ic(3,r)}catch(Oe){Et(r,r.return,Oe)}try{Wa(5,r,r.return)}catch(Oe){Et(r,r.return,Oe)}}break;case 1:rr(o,r),Nr(r),m&512&&c!==null&&bi(c,c.return);break;case 5:if(rr(o,r),Nr(r),m&512&&c!==null&&bi(c,c.return),r.flags&32){var y=r.stateNode;try{se(y,"")}catch(Oe){Et(r,r.return,Oe)}}if(m&4&&(y=r.stateNode,y!=null)){var x=r.memoizedProps,T=c!==null?c.memoizedProps:x,B=r.type,Z=r.updateQueue;if(r.updateQueue=null,Z!==null)try{B==="input"&&x.type==="radio"&&x.name!=null&&ce(y,x),Ie(B,T);var le=Ie(B,x);for(T=0;T<Z.length;T+=2){var ve=Z[T],we=Z[T+1];ve==="style"?Xe(y,we):ve==="dangerouslySetInnerHTML"?Ke(y,we):ve==="children"?se(y,we):C(y,ve,we,le)}switch(B){case"input":be(y,x);break;case"textarea":Me(y,x);break;case"select":var ge=y._wrapperState.wasMultiple;y._wrapperState.wasMultiple=!!x.multiple;var Ne=x.value;Ne!=null?lt(y,!!x.multiple,Ne,!1):ge!==!!x.multiple&&(x.defaultValue!=null?lt(y,!!x.multiple,x.defaultValue,!0):lt(y,!!x.multiple,x.multiple?[]:"",!1))}y[Ia]=x}catch(Oe){Et(r,r.return,Oe)}}break;case 6:if(rr(o,r),Nr(r),m&4){if(r.stateNode===null)throw Error(n(162));y=r.stateNode,x=r.memoizedProps;try{y.nodeValue=x}catch(Oe){Et(r,r.return,Oe)}}break;case 3:if(rr(o,r),Nr(r),m&4&&c!==null&&c.memoizedState.isDehydrated)try{ds(o.containerInfo)}catch(Oe){Et(r,r.return,Oe)}break;case 4:rr(o,r),Nr(r);break;case 13:rr(o,r),Nr(r),y=r.child,y.flags&8192&&(x=y.memoizedState!==null,y.stateNode.isHidden=x,!x||y.alternate!==null&&y.alternate.memoizedState!==null||(Ef=it())),m&4&&jx(r);break;case 22:if(ve=c!==null&&c.memoizedState!==null,r.mode&1?(Qt=(le=Qt)||ve,rr(o,r),Qt=le):rr(o,r),Nr(r),m&8192){if(le=r.memoizedState!==null,(r.stateNode.isHidden=le)&&!ve&&(r.mode&1)!==0)for(Ce=r,ve=r.child;ve!==null;){for(we=Ce=ve;Ce!==null;){switch(ge=Ce,Ne=ge.child,ge.tag){case 0:case 11:case 14:case 15:Wa(4,ge,ge.return);break;case 1:bi(ge,ge.return);var Ae=ge.stateNode;if(typeof Ae.componentWillUnmount=="function"){m=ge,c=ge.return;try{o=m,Ae.props=o.memoizedProps,Ae.state=o.memoizedState,Ae.componentWillUnmount()}catch(Oe){Et(m,c,Oe)}}break;case 5:bi(ge,ge.return);break;case 22:if(ge.memoizedState!==null){Mx(we);continue}}Ne!==null?(Ne.return=ge,Ce=Ne):Mx(we)}ve=ve.sibling}e:for(ve=null,we=r;;){if(we.tag===5){if(ve===null){ve=we;try{y=we.stateNode,le?(x=y.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(B=we.stateNode,Z=we.memoizedProps.style,T=Z!=null&&Z.hasOwnProperty("display")?Z.display:null,B.style.display=Te("display",T))}catch(Oe){Et(r,r.return,Oe)}}}else if(we.tag===6){if(ve===null)try{we.stateNode.nodeValue=le?"":we.memoizedProps}catch(Oe){Et(r,r.return,Oe)}}else if((we.tag!==22&&we.tag!==23||we.memoizedState===null||we===r)&&we.child!==null){we.child.return=we,we=we.child;continue}if(we===r)break e;for(;we.sibling===null;){if(we.return===null||we.return===r)break e;ve===we&&(ve=null),we=we.return}ve===we&&(ve=null),we.sibling.return=we.return,we=we.sibling}}break;case 19:rr(o,r),Nr(r),m&4&&jx(r);break;case 21:break;default:rr(o,r),Nr(r)}}function Nr(r){var o=r.flags;if(o&2){try{e:{for(var c=r.return;c!==null;){if(Nx(c)){var m=c;break e}c=c.return}throw Error(n(160))}switch(m.tag){case 5:var y=m.stateNode;m.flags&32&&(se(y,""),m.flags&=-33);var x=Ex(r);_f(r,x,y);break;case 3:case 4:var T=m.stateNode.containerInfo,B=Ex(r);kf(r,B,T);break;default:throw Error(n(161))}}catch(Z){Et(r,r.return,Z)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function OA(r,o,c){Ce=r,Rx(r)}function Rx(r,o,c){for(var m=(r.mode&1)!==0;Ce!==null;){var y=Ce,x=y.child;if(y.tag===22&&m){var T=y.memoizedState!==null||Mc;if(!T){var B=y.alternate,Z=B!==null&&B.memoizedState!==null||Qt;B=Mc;var le=Qt;if(Mc=T,(Qt=Z)&&!le)for(Ce=y;Ce!==null;)T=Ce,Z=T.child,T.tag===22&&T.memoizedState!==null?Ix(y):Z!==null?(Z.return=T,Ce=Z):Ix(y);for(;x!==null;)Ce=x,Rx(x),x=x.sibling;Ce=y,Mc=B,Qt=le}Ax(r)}else(y.subtreeFlags&8772)!==0&&x!==null?(x.return=y,Ce=x):Ax(r)}}function Ax(r){for(;Ce!==null;){var o=Ce;if((o.flags&8772)!==0){var c=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:Qt||Ic(5,o);break;case 1:var m=o.stateNode;if(o.flags&4&&!Qt)if(c===null)m.componentDidMount();else{var y=o.elementType===o.type?c.memoizedProps:tr(o.type,c.memoizedProps);m.componentDidUpdate(y,c.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var x=o.updateQueue;x!==null&&M0(o,x,m);break;case 3:var T=o.updateQueue;if(T!==null){if(c=null,o.child!==null)switch(o.child.tag){case 5:c=o.child.stateNode;break;case 1:c=o.child.stateNode}M0(o,T,c)}break;case 5:var B=o.stateNode;if(c===null&&o.flags&4){c=B;var Z=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":Z.autoFocus&&c.focus();break;case"img":Z.src&&(c.src=Z.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var le=o.alternate;if(le!==null){var ve=le.memoizedState;if(ve!==null){var we=ve.dehydrated;we!==null&&ds(we)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Qt||o.flags&512&&bf(o)}catch(ge){Et(o,o.return,ge)}}if(o===r){Ce=null;break}if(c=o.sibling,c!==null){c.return=o.return,Ce=c;break}Ce=o.return}}function Mx(r){for(;Ce!==null;){var o=Ce;if(o===r){Ce=null;break}var c=o.sibling;if(c!==null){c.return=o.return,Ce=c;break}Ce=o.return}}function Ix(r){for(;Ce!==null;){var o=Ce;try{switch(o.tag){case 0:case 11:case 15:var c=o.return;try{Ic(4,o)}catch(Z){Et(o,c,Z)}break;case 1:var m=o.stateNode;if(typeof m.componentDidMount=="function"){var y=o.return;try{m.componentDidMount()}catch(Z){Et(o,y,Z)}}var x=o.return;try{bf(o)}catch(Z){Et(o,x,Z)}break;case 5:var T=o.return;try{bf(o)}catch(Z){Et(o,T,Z)}}}catch(Z){Et(o,o.return,Z)}if(o===r){Ce=null;break}var B=o.sibling;if(B!==null){B.return=o.return,Ce=B;break}Ce=o.return}}var PA=Math.ceil,Oc=j.ReactCurrentDispatcher,Sf=j.ReactCurrentOwner,Pn=j.ReactCurrentBatchConfig,rt=0,Dt=null,Rt=null,Wt=0,xn=0,ki=ys(0),$t=0,Ha=null,uo=0,Pc=0,Nf=0,Ga=null,un=null,Ef=0,_i=1/0,Kr=null,$c=!1,Cf=null,_s=null,Lc=!1,Ss=null,qc=0,Va=0,jf=null,Dc=-1,Fc=0;function rn(){return(rt&6)!==0?it():Dc!==-1?Dc:Dc=it()}function Ns(r){return(r.mode&1)===0?1:(rt&2)!==0&&Wt!==0?Wt&-Wt:vA.transition!==null?(Fc===0&&(Fc=zs()),Fc):(r=Je,r!==0||(r=window.event,r=r===void 0?16:ei(r.type)),r)}function sr(r,o,c,m){if(50<Va)throw Va=0,jf=null,Error(n(185));ls(r,c,m),((rt&2)===0||r!==Dt)&&(r===Dt&&((rt&2)===0&&(Pc|=c),$t===4&&Es(r,Wt)),dn(r,m),c===1&&rt===0&&(o.mode&1)===0&&(_i=it()+500,pc&&ws()))}function dn(r,o){var c=r.callbackNode;zl(r,o);var m=Fs(r,r===Dt?Wt:0);if(m===0)c!==null&&Ds(c),r.callbackNode=null,r.callbackPriority=0;else if(o=m&-m,r.callbackPriority!==o){if(c!=null&&Ds(c),o===1)r.tag===0?yA(Px.bind(null,r)):x0(Px.bind(null,r)),hA(function(){(rt&6)===0&&ws()}),c=null;else{switch(Yo(m)){case 1:c=ss;break;case 4:c=Gt;break;case 16:c=Hn;break;case 536870912:c=os;break;default:c=Hn}c=Ux(c,Ox.bind(null,r))}r.callbackPriority=o,r.callbackNode=c}}function Ox(r,o){if(Dc=-1,Fc=0,(rt&6)!==0)throw Error(n(327));var c=r.callbackNode;if(Si()&&r.callbackNode!==c)return null;var m=Fs(r,r===Dt?Wt:0);if(m===0)return null;if((m&30)!==0||(m&r.expiredLanes)!==0||o)o=zc(r,m);else{o=m;var y=rt;rt|=2;var x=Lx();(Dt!==r||Wt!==o)&&(Kr=null,_i=it()+500,ho(r,o));do try{qA();break}catch(B){$x(r,B)}while(!0);Hd(),Oc.current=x,rt=y,Rt!==null?o=0:(Dt=null,Wt=0,o=$t)}if(o!==0){if(o===2&&(y=Go(r),y!==0&&(m=y,o=Tf(r,y))),o===1)throw c=Ha,ho(r,0),Es(r,m),dn(r,it()),c;if(o===6)Es(r,m);else{if(y=r.current.alternate,(m&30)===0&&!$A(y)&&(o=zc(r,m),o===2&&(x=Go(r),x!==0&&(m=x,o=Tf(r,x))),o===1))throw c=Ha,ho(r,0),Es(r,m),dn(r,it()),c;switch(r.finishedWork=y,r.finishedLanes=m,o){case 0:case 1:throw Error(n(345));case 2:po(r,un,Kr);break;case 3:if(Es(r,m),(m&130023424)===m&&(o=Ef+500-it(),10<o)){if(Fs(r,0)!==0)break;if(y=r.suspendedLanes,(y&m)!==m){rn(),r.pingedLanes|=r.suspendedLanes&y;break}r.timeoutHandle=Od(po.bind(null,r,un,Kr),o);break}po(r,un,Kr);break;case 4:if(Es(r,m),(m&4194240)===m)break;for(o=r.eventTimes,y=-1;0<m;){var T=31-gn(m);x=1<<T,T=o[T],T>y&&(y=T),m&=~x}if(m=y,m=it()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*PA(m/1960))-m,10<m){r.timeoutHandle=Od(po.bind(null,r,un,Kr),m);break}po(r,un,Kr);break;case 5:po(r,un,Kr);break;default:throw Error(n(329))}}}return dn(r,it()),r.callbackNode===c?Ox.bind(null,r):null}function Tf(r,o){var c=Ga;return r.current.memoizedState.isDehydrated&&(ho(r,o).flags|=256),r=zc(r,o),r!==2&&(o=un,un=c,o!==null&&Rf(o)),r}function Rf(r){un===null?un=r:un.push.apply(un,r)}function $A(r){for(var o=r;;){if(o.flags&16384){var c=o.updateQueue;if(c!==null&&(c=c.stores,c!==null))for(var m=0;m<c.length;m++){var y=c[m],x=y.getSnapshot;y=y.value;try{if(!tn(x(),y))return!1}catch{return!1}}}if(c=o.child,o.subtreeFlags&16384&&c!==null)c.return=o,o=c;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Es(r,o){for(o&=~Nf,o&=~Pc,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var c=31-gn(o),m=1<<c;r[c]=-1,o&=~m}}function Px(r){if((rt&6)!==0)throw Error(n(327));Si();var o=Fs(r,0);if((o&1)===0)return dn(r,it()),null;var c=zc(r,o);if(r.tag!==0&&c===2){var m=Go(r);m!==0&&(o=m,c=Tf(r,m))}if(c===1)throw c=Ha,ho(r,0),Es(r,o),dn(r,it()),c;if(c===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,po(r,un,Kr),dn(r,it()),null}function Af(r,o){var c=rt;rt|=1;try{return r(o)}finally{rt=c,rt===0&&(_i=it()+500,pc&&ws())}}function fo(r){Ss!==null&&Ss.tag===0&&(rt&6)===0&&Si();var o=rt;rt|=1;var c=Pn.transition,m=Je;try{if(Pn.transition=null,Je=1,r)return r()}finally{Je=m,Pn.transition=c,rt=o,(rt&6)===0&&ws()}}function Mf(){xn=ki.current,mt(ki)}function ho(r,o){r.finishedWork=null,r.finishedLanes=0;var c=r.timeoutHandle;if(c!==-1&&(r.timeoutHandle=-1,fA(c)),Rt!==null)for(c=Rt.return;c!==null;){var m=c;switch(Fd(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&fc();break;case 3:wi(),mt(an),mt(Yt),Jd();break;case 5:Qd(m);break;case 4:wi();break;case 13:mt(_t);break;case 19:mt(_t);break;case 10:Gd(m.type._context);break;case 22:case 23:Mf()}c=c.return}if(Dt=r,Rt=r=Cs(r.current,null),Wt=xn=o,$t=0,Ha=null,Nf=Pc=uo=0,un=Ga=null,ao!==null){for(o=0;o<ao.length;o++)if(c=ao[o],m=c.interleaved,m!==null){c.interleaved=null;var y=m.next,x=c.pending;if(x!==null){var T=x.next;x.next=y,m.next=T}c.pending=m}ao=null}return r}function $x(r,o){do{var c=Rt;try{if(Hd(),Sc.current=jc,Nc){for(var m=St.memoizedState;m!==null;){var y=m.queue;y!==null&&(y.pending=null),m=m.next}Nc=!1}if(co=0,qt=Pt=St=null,Da=!1,Fa=0,Sf.current=null,c===null||c.return===null){$t=1,Ha=o,Rt=null;break}e:{var x=r,T=c.return,B=c,Z=o;if(o=Wt,B.flags|=32768,Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var le=Z,ve=B,we=ve.tag;if((ve.mode&1)===0&&(we===0||we===11||we===15)){var ge=ve.alternate;ge?(ve.updateQueue=ge.updateQueue,ve.memoizedState=ge.memoizedState,ve.lanes=ge.lanes):(ve.updateQueue=null,ve.memoizedState=null)}var Ne=ax(T);if(Ne!==null){Ne.flags&=-257,lx(Ne,T,B,x,o),Ne.mode&1&&ix(x,le,o),o=Ne,Z=le;var Ae=o.updateQueue;if(Ae===null){var Oe=new Set;Oe.add(Z),o.updateQueue=Oe}else Ae.add(Z);break e}else{if((o&1)===0){ix(x,le,o),If();break e}Z=Error(n(426))}}else if(yt&&B.mode&1){var Tt=ax(T);if(Tt!==null){(Tt.flags&65536)===0&&(Tt.flags|=256),lx(Tt,T,B,x,o),Ud(xi(Z,B));break e}}x=Z=xi(Z,B),$t!==4&&($t=2),Ga===null?Ga=[x]:Ga.push(x),x=T;do{switch(x.tag){case 3:x.flags|=65536,o&=-o,x.lanes|=o;var re=sx(x,Z,o);A0(x,re);break e;case 1:B=Z;var te=x.type,oe=x.stateNode;if((x.flags&128)===0&&(typeof te.getDerivedStateFromError=="function"||oe!==null&&typeof oe.componentDidCatch=="function"&&(_s===null||!_s.has(oe)))){x.flags|=65536,o&=-o,x.lanes|=o;var xe=ox(x,B,o);A0(x,xe);break e}}x=x.return}while(x!==null)}Dx(c)}catch(Le){o=Le,Rt===c&&c!==null&&(Rt=c=c.return);continue}break}while(!0)}function Lx(){var r=Oc.current;return Oc.current=jc,r===null?jc:r}function If(){($t===0||$t===3||$t===2)&&($t=4),Dt===null||(uo&268435455)===0&&(Pc&268435455)===0||Es(Dt,Wt)}function zc(r,o){var c=rt;rt|=2;var m=Lx();(Dt!==r||Wt!==o)&&(Kr=null,ho(r,o));do try{LA();break}catch(y){$x(r,y)}while(!0);if(Hd(),rt=c,Oc.current=m,Rt!==null)throw Error(n(261));return Dt=null,Wt=0,$t}function LA(){for(;Rt!==null;)qx(Rt)}function qA(){for(;Rt!==null&&!Fo();)qx(Rt)}function qx(r){var o=Bx(r.alternate,r,xn);r.memoizedProps=r.pendingProps,o===null?Dx(r):Rt=o,Sf.current=null}function Dx(r){var o=r;do{var c=o.alternate;if(r=o.return,(o.flags&32768)===0){if(c=RA(c,o,xn),c!==null){Rt=c;return}}else{if(c=AA(c,o),c!==null){c.flags&=32767,Rt=c;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{$t=6,Rt=null;return}}if(o=o.sibling,o!==null){Rt=o;return}Rt=o=r}while(o!==null);$t===0&&($t=5)}function po(r,o,c){var m=Je,y=Pn.transition;try{Pn.transition=null,Je=1,DA(r,o,c,m)}finally{Pn.transition=y,Je=m}return null}function DA(r,o,c,m){do Si();while(Ss!==null);if((rt&6)!==0)throw Error(n(327));c=r.finishedWork;var y=r.finishedLanes;if(c===null)return null;if(r.finishedWork=null,r.finishedLanes=0,c===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var x=c.lanes|c.childLanes;if(Zt(r,x),r===Dt&&(Rt=Dt=null,Wt=0),(c.subtreeFlags&2064)===0&&(c.flags&2064)===0||Lc||(Lc=!0,Ux(Hn,function(){return Si(),null})),x=(c.flags&15990)!==0,(c.subtreeFlags&15990)!==0||x){x=Pn.transition,Pn.transition=null;var T=Je;Je=1;var B=rt;rt|=4,Sf.current=null,IA(r,c),Tx(c,r),U(Md),Us=!!Ad,Md=Ad=null,r.current=c,OA(c),zo(),rt=B,Je=T,Pn.transition=x}else r.current=c;if(Lc&&(Lc=!1,Ss=r,qc=y),x=r.pendingLanes,x===0&&(_s=null),Gn(c.stateNode),dn(r,it()),o!==null)for(m=r.onRecoverableError,c=0;c<o.length;c++)y=o[c],m(y.value,{componentStack:y.stack,digest:y.digest});if($c)throw $c=!1,r=Cf,Cf=null,r;return(qc&1)!==0&&r.tag!==0&&Si(),x=r.pendingLanes,(x&1)!==0?r===jf?Va++:(Va=0,jf=r):Va=0,ws(),null}function Si(){if(Ss!==null){var r=Yo(qc),o=Pn.transition,c=Je;try{if(Pn.transition=null,Je=16>r?16:r,Ss===null)var m=!1;else{if(r=Ss,Ss=null,qc=0,(rt&6)!==0)throw Error(n(331));var y=rt;for(rt|=4,Ce=r.current;Ce!==null;){var x=Ce,T=x.child;if((Ce.flags&16)!==0){var B=x.deletions;if(B!==null){for(var Z=0;Z<B.length;Z++){var le=B[Z];for(Ce=le;Ce!==null;){var ve=Ce;switch(ve.tag){case 0:case 11:case 15:Wa(8,ve,x)}var we=ve.child;if(we!==null)we.return=ve,Ce=we;else for(;Ce!==null;){ve=Ce;var ge=ve.sibling,Ne=ve.return;if(Sx(ve),ve===le){Ce=null;break}if(ge!==null){ge.return=Ne,Ce=ge;break}Ce=Ne}}}var Ae=x.alternate;if(Ae!==null){var Oe=Ae.child;if(Oe!==null){Ae.child=null;do{var Tt=Oe.sibling;Oe.sibling=null,Oe=Tt}while(Oe!==null)}}Ce=x}}if((x.subtreeFlags&2064)!==0&&T!==null)T.return=x,Ce=T;else e:for(;Ce!==null;){if(x=Ce,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Wa(9,x,x.return)}var re=x.sibling;if(re!==null){re.return=x.return,Ce=re;break e}Ce=x.return}}var te=r.current;for(Ce=te;Ce!==null;){T=Ce;var oe=T.child;if((T.subtreeFlags&2064)!==0&&oe!==null)oe.return=T,Ce=oe;else e:for(T=te;Ce!==null;){if(B=Ce,(B.flags&2048)!==0)try{switch(B.tag){case 0:case 11:case 15:Ic(9,B)}}catch(Le){Et(B,B.return,Le)}if(B===T){Ce=null;break e}var xe=B.sibling;if(xe!==null){xe.return=B.return,Ce=xe;break e}Ce=B.return}}if(rt=y,ws(),sn&&typeof sn.onPostCommitFiberRoot=="function")try{sn.onPostCommitFiberRoot(bt,r)}catch{}m=!0}return m}finally{Je=c,Pn.transition=o}}return!1}function Fx(r,o,c){o=xi(c,o),o=sx(r,o,1),r=bs(r,o,1),o=rn(),r!==null&&(ls(r,1,o),dn(r,o))}function Et(r,o,c){if(r.tag===3)Fx(r,r,c);else for(;o!==null;){if(o.tag===3){Fx(o,r,c);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(_s===null||!_s.has(m))){r=xi(c,r),r=ox(o,r,1),o=bs(o,r,1),r=rn(),o!==null&&(ls(o,1,r),dn(o,r));break}}o=o.return}}function FA(r,o,c){var m=r.pingCache;m!==null&&m.delete(o),o=rn(),r.pingedLanes|=r.suspendedLanes&c,Dt===r&&(Wt&c)===c&&($t===4||$t===3&&(Wt&130023424)===Wt&&500>it()-Ef?ho(r,0):Nf|=c),dn(r,o)}function zx(r,o){o===0&&((r.mode&1)===0?o=1:(o=Ho,Ho<<=1,(Ho&130023424)===0&&(Ho=4194304)));var c=rn();r=Gr(r,o),r!==null&&(ls(r,o,c),dn(r,c))}function zA(r){var o=r.memoizedState,c=0;o!==null&&(c=o.retryLane),zx(r,c)}function BA(r,o){var c=0;switch(r.tag){case 13:var m=r.stateNode,y=r.memoizedState;y!==null&&(c=y.retryLane);break;case 19:m=r.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(o),zx(r,c)}var Bx;Bx=function(r,o,c){if(r!==null)if(r.memoizedProps!==o.pendingProps||an.current)cn=!0;else{if((r.lanes&c)===0&&(o.flags&128)===0)return cn=!1,TA(r,o,c);cn=(r.flags&131072)!==0}else cn=!1,yt&&(o.flags&1048576)!==0&&b0(o,gc,o.index);switch(o.lanes=0,o.tag){case 2:var m=o.type;Ac(r,o),r=o.pendingProps;var y=fi(o,Yt.current);vi(o,c),y=nf(null,o,m,r,y,c);var x=rf();return o.flags|=1,typeof y=="object"&&y!==null&&typeof y.render=="function"&&y.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,ln(m)?(x=!0,hc(o)):x=!1,o.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,Kd(o),y.updater=Tc,o.stateNode=y,y._reactInternals=o,uf(o,m,r,c),o=pf(null,o,m,!0,x,c)):(o.tag=0,yt&&x&&Dd(o),nn(null,o,y,c),o=o.child),o;case 16:m=o.elementType;e:{switch(Ac(r,o),r=o.pendingProps,y=m._init,m=y(m._payload),o.type=m,y=o.tag=WA(m),r=tr(m,r),y){case 0:o=hf(null,o,m,r,c);break e;case 1:o=px(null,o,m,r,c);break e;case 11:o=cx(null,o,m,r,c);break e;case 14:o=ux(null,o,m,tr(m.type,r),c);break e}throw Error(n(306,m,""))}return o;case 0:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:tr(m,y),hf(r,o,m,y,c);case 1:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:tr(m,y),px(r,o,m,y,c);case 3:e:{if(mx(o),r===null)throw Error(n(387));m=o.pendingProps,x=o.memoizedState,y=x.element,R0(r,o),kc(o,m,null,c);var T=o.memoizedState;if(m=T.element,x.isDehydrated)if(x={element:m,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},o.updateQueue.baseState=x,o.memoizedState=x,o.flags&256){y=xi(Error(n(423)),o),o=gx(r,o,m,c,y);break e}else if(m!==y){y=xi(Error(n(424)),o),o=gx(r,o,m,c,y);break e}else for(wn=gs(o.stateNode.containerInfo.firstChild),vn=o,yt=!0,er=null,c=j0(o,null,m,c),o.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(mi(),m===y){o=Yr(r,o,c);break e}nn(r,o,m,c)}o=o.child}return o;case 5:return I0(o),r===null&&Bd(o),m=o.type,y=o.pendingProps,x=r!==null?r.memoizedProps:null,T=y.children,Id(m,y)?T=null:x!==null&&Id(m,x)&&(o.flags|=32),hx(r,o),nn(r,o,T,c),o.child;case 6:return r===null&&Bd(o),null;case 13:return yx(r,o,c);case 4:return Xd(o,o.stateNode.containerInfo),m=o.pendingProps,r===null?o.child=gi(o,null,m,c):nn(r,o,m,c),o.child;case 11:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:tr(m,y),cx(r,o,m,y,c);case 7:return nn(r,o,o.pendingProps,c),o.child;case 8:return nn(r,o,o.pendingProps.children,c),o.child;case 12:return nn(r,o,o.pendingProps.children,c),o.child;case 10:e:{if(m=o.type._context,y=o.pendingProps,x=o.memoizedProps,T=y.value,ht(wc,m._currentValue),m._currentValue=T,x!==null)if(tn(x.value,T)){if(x.children===y.children&&!an.current){o=Yr(r,o,c);break e}}else for(x=o.child,x!==null&&(x.return=o);x!==null;){var B=x.dependencies;if(B!==null){T=x.child;for(var Z=B.firstContext;Z!==null;){if(Z.context===m){if(x.tag===1){Z=Vr(-1,c&-c),Z.tag=2;var le=x.updateQueue;if(le!==null){le=le.shared;var ve=le.pending;ve===null?Z.next=Z:(Z.next=ve.next,ve.next=Z),le.pending=Z}}x.lanes|=c,Z=x.alternate,Z!==null&&(Z.lanes|=c),Vd(x.return,c,o),B.lanes|=c;break}Z=Z.next}}else if(x.tag===10)T=x.type===o.type?null:x.child;else if(x.tag===18){if(T=x.return,T===null)throw Error(n(341));T.lanes|=c,B=T.alternate,B!==null&&(B.lanes|=c),Vd(T,c,o),T=x.sibling}else T=x.child;if(T!==null)T.return=x;else for(T=x;T!==null;){if(T===o){T=null;break}if(x=T.sibling,x!==null){x.return=T.return,T=x;break}T=T.return}x=T}nn(r,o,y.children,c),o=o.child}return o;case 9:return y=o.type,m=o.pendingProps.children,vi(o,c),y=In(y),m=m(y),o.flags|=1,nn(r,o,m,c),o.child;case 14:return m=o.type,y=tr(m,o.pendingProps),y=tr(m.type,y),ux(r,o,m,y,c);case 15:return dx(r,o,o.type,o.pendingProps,c);case 17:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:tr(m,y),Ac(r,o),o.tag=1,ln(m)?(r=!0,hc(o)):r=!1,vi(o,c),nx(o,m,y),uf(o,m,y,c),pf(null,o,m,!0,r,c);case 19:return wx(r,o,c);case 22:return fx(r,o,c)}throw Error(n(156,o.tag))};function Ux(r,o){return qs(r,o)}function UA(r,o,c,m){this.tag=r,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $n(r,o,c,m){return new UA(r,o,c,m)}function Of(r){return r=r.prototype,!(!r||!r.isReactComponent)}function WA(r){if(typeof r=="function")return Of(r)?1:0;if(r!=null){if(r=r.$$typeof,r===H)return 11;if(r===K)return 14}return 2}function Cs(r,o){var c=r.alternate;return c===null?(c=$n(r.tag,o,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=o,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&14680064,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,o=r.dependencies,c.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c}function Bc(r,o,c,m,y,x){var T=2;if(m=r,typeof r=="function")Of(r)&&(T=1);else if(typeof r=="string")T=5;else e:switch(r){case I:return mo(c.children,y,x,o);case F:T=8,y|=8;break;case O:return r=$n(12,c,o,y|2),r.elementType=O,r.lanes=x,r;case X:return r=$n(13,c,o,y),r.elementType=X,r.lanes=x,r;case R:return r=$n(19,c,o,y),r.elementType=R,r.lanes=x,r;case ne:return Uc(c,y,x,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case A:T=10;break e;case L:T=9;break e;case H:T=11;break e;case K:T=14;break e;case G:T=16,m=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=$n(T,c,o,y),o.elementType=r,o.type=m,o.lanes=x,o}function mo(r,o,c,m){return r=$n(7,r,m,o),r.lanes=c,r}function Uc(r,o,c,m){return r=$n(22,r,m,o),r.elementType=ne,r.lanes=c,r.stateNode={isHidden:!1},r}function Pf(r,o,c){return r=$n(6,r,null,o),r.lanes=c,r}function $f(r,o,c){return o=$n(4,r.children!==null?r.children:[],r.key,o),o.lanes=c,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function HA(r,o,c,m,y){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Vo(0),this.expirationTimes=Vo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vo(0),this.identifierPrefix=m,this.onRecoverableError=y,this.mutableSourceEagerHydrationData=null}function Lf(r,o,c,m,y,x,T,B,Z){return r=new HA(r,o,c,B,Z),o===1?(o=1,x===!0&&(o|=8)):o=0,x=$n(3,null,null,o),r.current=x,x.stateNode=r,x.memoizedState={element:m,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null},Kd(x),r}function GA(r,o,c){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:P,key:m==null?null:""+m,children:r,containerInfo:o,implementation:c}}function Wx(r){if(!r)return vs;r=r._reactInternals;e:{if(Cn(r)!==r||r.tag!==1)throw Error(n(170));var o=r;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(ln(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(r.tag===1){var c=r.type;if(ln(c))return v0(r,c,o)}return o}function Hx(r,o,c,m,y,x,T,B,Z){return r=Lf(c,m,!0,r,y,x,T,B,Z),r.context=Wx(null),c=r.current,m=rn(),y=Ns(c),x=Vr(m,y),x.callback=o??null,bs(c,x,y),r.current.lanes=y,ls(r,y,m),dn(r,m),r}function Wc(r,o,c,m){var y=o.current,x=rn(),T=Ns(y);return c=Wx(c),o.context===null?o.context=c:o.pendingContext=c,o=Vr(x,T),o.payload={element:r},m=m===void 0?null:m,m!==null&&(o.callback=m),r=bs(y,o,T),r!==null&&(sr(r,y,T,x),bc(r,y,T)),T}function Hc(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function Gx(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<o?c:o}}function qf(r,o){Gx(r,o),(r=r.alternate)&&Gx(r,o)}function VA(){return null}var Vx=typeof reportError=="function"?reportError:function(r){console.error(r)};function Df(r){this._internalRoot=r}Gc.prototype.render=Df.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));Wc(r,o,null,null)},Gc.prototype.unmount=Df.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;fo(function(){Wc(null,r,null,null)}),o[Br]=null}};function Gc(r){this._internalRoot=r}Gc.prototype.unstable_scheduleHydration=function(r){if(r){var o=Vn();r={blockedOn:null,target:r,priority:o};for(var c=0;c<Xn.length&&o!==0&&o<Xn[c].priority;c++);Xn.splice(c,0,r),c===0&&Qo(r)}};function Ff(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function Vc(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Yx(){}function YA(r,o,c,m,y){if(y){if(typeof m=="function"){var x=m;m=function(){var le=Hc(T);x.call(le)}}var T=Hx(o,m,r,0,null,!1,!1,"",Yx);return r._reactRootContainer=T,r[Br]=T.current,Aa(r.nodeType===8?r.parentNode:r),fo(),T}for(;y=r.lastChild;)r.removeChild(y);if(typeof m=="function"){var B=m;m=function(){var le=Hc(Z);B.call(le)}}var Z=Lf(r,0,!1,null,null,!1,!1,"",Yx);return r._reactRootContainer=Z,r[Br]=Z.current,Aa(r.nodeType===8?r.parentNode:r),fo(function(){Wc(o,Z,c,m)}),Z}function Yc(r,o,c,m,y){var x=c._reactRootContainer;if(x){var T=x;if(typeof y=="function"){var B=y;y=function(){var Z=Hc(T);B.call(Z)}}Wc(o,T,r,y)}else T=YA(c,o,r,y,m);return Hc(T)}Bl=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var c=is(o.pendingLanes);c!==0&&(cs(o,c|1),dn(o,it()),(rt&6)===0&&(_i=it()+500,ws()))}break;case 13:fo(function(){var m=Gr(r,1);if(m!==null){var y=rn();sr(m,r,1,y)}}),qf(r,1)}},Pr=function(r){if(r.tag===13){var o=Gr(r,134217728);if(o!==null){var c=rn();sr(o,r,134217728,c)}qf(r,134217728)}},oa=function(r){if(r.tag===13){var o=Ns(r),c=Gr(r,o);if(c!==null){var m=rn();sr(c,r,o,m)}qf(r,o)}},Vn=function(){return Je},Ul=function(r,o){var c=Je;try{return Je=r,o()}finally{Je=c}},gt=function(r,o,c){switch(o){case"input":if(be(r,c),o=c.name,c.type==="radio"&&o!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<c.length;o++){var m=c[o];if(m!==r&&m.form===r.form){var y=dc(m);if(!y)throw Error(n(90));Ve(m),be(m,y)}}}break;case"textarea":Me(r,c);break;case"select":o=c.value,o!=null&<(r,!!c.multiple,o,!1)}},Ao=Af,Mo=fo;var KA={usingClientEntryPoint:!1,Events:[Oa,ui,dc,Ro,mn,Af]},Ya={findFiberByHostInstance:ro,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},XA={bundleType:Ya.bundleType,version:Ya.version,rendererPackageName:Ya.rendererPackageName,rendererConfig:Ya.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:j.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=Wn(r),r===null?null:r.stateNode},findFiberByHostInstance:Ya.findFiberByHostInstance||VA,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 Kc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kc.isDisabled&&Kc.supportsFiber)try{bt=Kc.inject(XA),sn=Kc}catch{}}return fn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=KA,fn.createPortal=function(r,o){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ff(o))throw Error(n(200));return GA(r,o,null,c)},fn.createRoot=function(r,o){if(!Ff(r))throw Error(n(299));var c=!1,m="",y=Vx;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onRecoverableError!==void 0&&(y=o.onRecoverableError)),o=Lf(r,1,!1,null,null,c,!1,m,y),r[Br]=o.current,Aa(r.nodeType===8?r.parentNode:r),new Df(o)},fn.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var o=r._reactInternals;if(o===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=Wn(o),r=r===null?null:r.stateNode,r},fn.flushSync=function(r){return fo(r)},fn.hydrate=function(r,o,c){if(!Vc(o))throw Error(n(200));return Yc(null,r,o,!0,c)},fn.hydrateRoot=function(r,o,c){if(!Ff(r))throw Error(n(405));var m=c!=null&&c.hydratedSources||null,y=!1,x="",T=Vx;if(c!=null&&(c.unstable_strictMode===!0&&(y=!0),c.identifierPrefix!==void 0&&(x=c.identifierPrefix),c.onRecoverableError!==void 0&&(T=c.onRecoverableError)),o=Hx(o,null,r,1,c??null,y,!1,x,T),r[Br]=o.current,Aa(r),m)for(r=0;r<m.length;r++)c=m[r],y=c._getVersion,y=y(c._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[c,y]:o.mutableSourceEagerHydrationData.push(c,y);return new Gc(o)},fn.render=function(r,o,c){if(!Vc(o))throw Error(n(200));return Yc(null,r,o,!1,c)},fn.unmountComponentAtNode=function(r){if(!Vc(r))throw Error(n(40));return r._reactRootContainer?(fo(function(){Yc(null,null,r,!1,function(){r._reactRootContainer=null,r[Br]=null})}),!0):!1},fn.unstable_batchedUpdates=Af,fn.unstable_renderSubtreeIntoContainer=function(r,o,c,m){if(!Vc(c))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return Yc(r,o,c,!1,m)},fn.version="18.3.1-next-f1338f8080-20240426",fn}var nb;function PC(){if(nb)return Uf.exports;nb=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(),Uf.exports=r2(),Uf.exports}var rb;function s2(){if(rb)return Qc;rb=1;var e=PC();return Qc.createRoot=e.createRoot,Qc.hydrateRoot=e.hydrateRoot,Qc}var o2=s2(),k=Nl();const de=fw(k);function Ht(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n<e.length;n++)(s=Ht(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Gf={exports:{}},Vf={},Yf={exports:{}},Kf={};/**
|
|
40
|
+
`+x.stack}return{value:r,source:o,stack:y,digest:null}}function df(r,o,c){return{value:r,source:null,stack:c??null,digest:o??null}}function ff(r,o){try{console.error(o.value)}catch(c){setTimeout(function(){throw c})}}var EA=typeof WeakMap=="function"?WeakMap:Map;function sx(r,o,c){c=Vr(-1,c),c.tag=3,c.payload={element:null};var m=o.value;return c.callback=function(){$c||($c=!0,Cf=m),ff(r,o)},c}function ox(r,o,c){c=Vr(-1,c),c.tag=3;var m=r.type.getDerivedStateFromError;if(typeof m=="function"){var y=o.value;c.payload=function(){return m(y)},c.callback=function(){ff(r,o)}}var x=r.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(c.callback=function(){ff(r,o),typeof m!="function"&&(Ss===null?Ss=new Set([this]):Ss.add(this));var T=o.stack;this.componentDidCatch(o.value,{componentStack:T!==null?T:""})}),c}function ix(r,o,c){var m=r.pingCache;if(m===null){m=r.pingCache=new EA;var y=new Set;m.set(o,y)}else y=m.get(o),y===void 0&&(y=new Set,m.set(o,y));y.has(c)||(y.add(c),r=FA.bind(null,r,o,c),o.then(r,r))}function ax(r){do{var o;if((o=r.tag===13)&&(o=r.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return r;r=r.return}while(r!==null);return null}function lx(r,o,c,m,y){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,c.flags|=131072,c.flags&=-52805,c.tag===1&&(c.alternate===null?c.tag=17:(o=Vr(-1,1),o.tag=2,ks(c,o,1))),c.lanes|=1),r):(r.flags|=65536,r.lanes=y,r)}var CA=j.ReactCurrentOwner,cn=!1;function nn(r,o,c,m){o.child=r===null?j0(o,null,c,m):yi(o,r.child,c,m)}function cx(r,o,c,m,y){c=c.render;var x=o.ref;return wi(o,y),m=nf(r,o,c,m,x,y),c=rf(),r!==null&&!cn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~y,Yr(r,o,y)):(yt&&c&&Dd(o),o.flags|=1,nn(r,o,m,y),o.child)}function ux(r,o,c,m,y){if(r===null){var x=c.type;return typeof x=="function"&&!Of(x)&&x.defaultProps===void 0&&c.compare===null&&c.defaultProps===void 0?(o.tag=15,o.type=x,dx(r,o,x,m,y)):(r=Bc(c.type,null,m,o,o.mode,y),r.ref=o.ref,r.return=o,o.child=r)}if(x=r.child,(r.lanes&y)===0){var T=x.memoizedProps;if(c=c.compare,c=c!==null?c:to,c(T,m)&&r.ref===o.ref)return Yr(r,o,y)}return o.flags|=1,r=js(x,m),r.ref=o.ref,r.return=o,o.child=r}function dx(r,o,c,m,y){if(r!==null){var x=r.memoizedProps;if(to(x,m)&&r.ref===o.ref)if(cn=!1,o.pendingProps=m=x,(r.lanes&y)!==0)(r.flags&131072)!==0&&(cn=!0);else return o.lanes=r.lanes,Yr(r,o,y)}return hf(r,o,c,m,y)}function fx(r,o,c){var m=o.pendingProps,y=m.children,x=r!==null?r.memoizedState:null;if(m.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},ht(_i,xn),xn|=c;else{if((c&1073741824)===0)return r=x!==null?x.baseLanes|c:c,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,ht(_i,xn),xn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=x!==null?x.baseLanes:c,ht(_i,xn),xn|=m}else x!==null?(m=x.baseLanes|c,o.memoizedState=null):m=c,ht(_i,xn),xn|=m;return nn(r,o,y,c),o.child}function hx(r,o){var c=o.ref;(r===null&&c!==null||r!==null&&r.ref!==c)&&(o.flags|=512,o.flags|=2097152)}function hf(r,o,c,m,y){var x=ln(c)?oo:Yt.current;return x=hi(o,x),wi(o,y),c=nf(r,o,c,m,x,y),m=rf(),r!==null&&!cn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~y,Yr(r,o,y)):(yt&&m&&Dd(o),o.flags|=1,nn(r,o,c,y),o.child)}function px(r,o,c,m,y){if(ln(c)){var x=!0;hc(o)}else x=!1;if(wi(o,y),o.stateNode===null)Ac(r,o),nx(o,c,m),uf(o,c,m,y),m=!0;else if(r===null){var T=o.stateNode,B=o.memoizedProps;T.props=B;var Z=T.context,le=c.contextType;typeof le=="object"&&le!==null?le=In(le):(le=ln(c)?oo:Yt.current,le=hi(o,le));var ve=c.getDerivedStateFromProps,we=typeof ve=="function"||typeof T.getSnapshotBeforeUpdate=="function";we||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(B!==m||Z!==le)&&rx(o,T,m,le),bs=!1;var ge=o.memoizedState;T.state=ge,kc(o,m,T,y),Z=o.memoizedState,B!==m||ge!==Z||an.current||bs?(typeof ve=="function"&&(cf(o,c,ve,m),Z=o.memoizedState),(B=bs||tx(o,c,B,m,ge,Z,le))?(we||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount()),typeof T.componentDidMount=="function"&&(o.flags|=4194308)):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=Z),T.props=m,T.state=Z,T.context=le,m=B):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{T=o.stateNode,R0(r,o),B=o.memoizedProps,le=o.type===o.elementType?B:tr(o.type,B),T.props=le,we=o.pendingProps,ge=T.context,Z=c.contextType,typeof Z=="object"&&Z!==null?Z=In(Z):(Z=ln(c)?oo:Yt.current,Z=hi(o,Z));var Ne=c.getDerivedStateFromProps;(ve=typeof Ne=="function"||typeof T.getSnapshotBeforeUpdate=="function")||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(B!==we||ge!==Z)&&rx(o,T,m,Z),bs=!1,ge=o.memoizedState,T.state=ge,kc(o,m,T,y);var Ae=o.memoizedState;B!==we||ge!==Ae||an.current||bs?(typeof Ne=="function"&&(cf(o,c,Ne,m),Ae=o.memoizedState),(le=bs||tx(o,c,le,m,ge,Ae,Z)||!1)?(ve||typeof T.UNSAFE_componentWillUpdate!="function"&&typeof T.componentWillUpdate!="function"||(typeof T.componentWillUpdate=="function"&&T.componentWillUpdate(m,Ae,Z),typeof T.UNSAFE_componentWillUpdate=="function"&&T.UNSAFE_componentWillUpdate(m,Ae,Z)),typeof T.componentDidUpdate=="function"&&(o.flags|=4),typeof T.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof T.componentDidUpdate!="function"||B===r.memoizedProps&&ge===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||B===r.memoizedProps&&ge===r.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=Ae),T.props=m,T.state=Ae,T.context=Z,m=le):(typeof T.componentDidUpdate!="function"||B===r.memoizedProps&&ge===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||B===r.memoizedProps&&ge===r.memoizedState||(o.flags|=1024),m=!1)}return pf(r,o,c,m,x,y)}function pf(r,o,c,m,y,x){hx(r,o);var T=(o.flags&128)!==0;if(!m&&!T)return y&&w0(o,c,!1),Yr(r,o,x);m=o.stateNode,CA.current=o;var B=T&&typeof c.getDerivedStateFromError!="function"?null:m.render();return o.flags|=1,r!==null&&T?(o.child=yi(o,r.child,null,x),o.child=yi(o,null,B,x)):nn(r,o,B,x),o.memoizedState=m.state,y&&w0(o,c,!0),o.child}function mx(r){var o=r.stateNode;o.pendingContext?y0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&y0(r,o.context,!1),Xd(r,o.containerInfo)}function gx(r,o,c,m,y){return gi(),Ud(y),o.flags|=256,nn(r,o,c,m),o.child}var mf={dehydrated:null,treeContext:null,retryLane:0};function gf(r){return{baseLanes:r,cachePool:null,transitions:null}}function yx(r,o,c){var m=o.pendingProps,y=_t.current,x=!1,T=(o.flags&128)!==0,B;if((B=T)||(B=r!==null&&r.memoizedState===null?!1:(y&2)!==0),B?(x=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(y|=1),ht(_t,y&1),r===null)return Bd(o),r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((o.mode&1)===0?o.lanes=1:r.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(T=m.children,r=m.fallback,x?(m=o.mode,x=o.child,T={mode:"hidden",children:T},(m&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=T):x=Uc(T,m,0,null),r=go(r,m,c,null),x.return=o,r.return=o,x.sibling=r,o.child=x,o.child.memoizedState=gf(c),o.memoizedState=mf,r):yf(o,T));if(y=r.memoizedState,y!==null&&(B=y.dehydrated,B!==null))return jA(r,o,T,m,B,y,c);if(x){x=m.fallback,T=o.mode,y=r.child,B=y.sibling;var Z={mode:"hidden",children:m.children};return(T&1)===0&&o.child!==y?(m=o.child,m.childLanes=0,m.pendingProps=Z,o.deletions=null):(m=js(y,Z),m.subtreeFlags=y.subtreeFlags&14680064),B!==null?x=js(B,x):(x=go(x,T,c,null),x.flags|=2),x.return=o,m.return=o,m.sibling=x,o.child=m,m=x,x=o.child,T=r.child.memoizedState,T=T===null?gf(c):{baseLanes:T.baseLanes|c,cachePool:null,transitions:T.transitions},x.memoizedState=T,x.childLanes=r.childLanes&~c,o.memoizedState=mf,m}return x=r.child,r=x.sibling,m=js(x,{mode:"visible",children:m.children}),(o.mode&1)===0&&(m.lanes=c),m.return=o,m.sibling=null,r!==null&&(c=o.deletions,c===null?(o.deletions=[r],o.flags|=16):c.push(r)),o.child=m,o.memoizedState=null,m}function yf(r,o){return o=Uc({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function Rc(r,o,c,m){return m!==null&&Ud(m),yi(o,r.child,null,c),r=yf(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function jA(r,o,c,m,y,x,T){if(c)return o.flags&256?(o.flags&=-257,m=df(Error(n(422))),Rc(r,o,T,m)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(x=m.fallback,y=o.mode,m=Uc({mode:"visible",children:m.children},y,0,null),x=go(x,y,T,null),x.flags|=2,m.return=o,x.return=o,m.sibling=x,o.child=m,(o.mode&1)!==0&&yi(o,r.child,null,T),o.child.memoizedState=gf(T),o.memoizedState=mf,x);if((o.mode&1)===0)return Rc(r,o,T,null);if(y.data==="$!"){if(m=y.nextSibling&&y.nextSibling.dataset,m)var B=m.dgst;return m=B,x=Error(n(419)),m=df(x,m,void 0),Rc(r,o,T,m)}if(B=(T&r.childLanes)!==0,cn||B){if(m=Dt,m!==null){switch(T&-T){case 4:y=2;break;case 16:y=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:y=32;break;case 536870912:y=268435456;break;default:y=0}y=(y&(m.suspendedLanes|T))!==0?0:y,y!==0&&y!==x.retryLane&&(x.retryLane=y,Gr(r,y),sr(m,r,y,-1))}return If(),m=df(Error(n(421))),Rc(r,o,T,m)}return y.data==="$?"?(o.flags|=128,o.child=r.child,o=zA.bind(null,r),y._reactRetry=o,null):(r=x.treeContext,wn=ys(y.nextSibling),vn=o,yt=!0,er=null,r!==null&&(An[Mn++]=Wr,An[Mn++]=Hr,An[Mn++]=io,Wr=r.id,Hr=r.overflow,io=o),o=yf(o,m.children),o.flags|=4096,o)}function vx(r,o,c){r.lanes|=o;var m=r.alternate;m!==null&&(m.lanes|=o),Vd(r.return,o,c)}function vf(r,o,c,m,y){var x=r.memoizedState;x===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:c,tailMode:y}:(x.isBackwards=o,x.rendering=null,x.renderingStartTime=0,x.last=m,x.tail=c,x.tailMode=y)}function wx(r,o,c){var m=o.pendingProps,y=m.revealOrder,x=m.tail;if(nn(r,o,m.children,c),m=_t.current,(m&2)!==0)m=m&1|2,o.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&vx(r,c,o);else if(r.tag===19)vx(r,c,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}m&=1}if(ht(_t,m),(o.mode&1)===0)o.memoizedState=null;else switch(y){case"forwards":for(c=o.child,y=null;c!==null;)r=c.alternate,r!==null&&_c(r)===null&&(y=c),c=c.sibling;c=y,c===null?(y=o.child,o.child=null):(y=c.sibling,c.sibling=null),vf(o,!1,y,c,x);break;case"backwards":for(c=null,y=o.child,o.child=null;y!==null;){if(r=y.alternate,r!==null&&_c(r)===null){o.child=y;break}r=y.sibling,y.sibling=c,c=y,y=r}vf(o,!0,c,null,x);break;case"together":vf(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function Ac(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function Yr(r,o,c){if(r!==null&&(o.dependencies=r.dependencies),fo|=o.lanes,(c&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,c=js(r,r.pendingProps),o.child=c,c.return=o;r.sibling!==null;)r=r.sibling,c=c.sibling=js(r,r.pendingProps),c.return=o;c.sibling=null}return o.child}function TA(r,o,c){switch(o.tag){case 3:mx(o),gi();break;case 5:I0(o);break;case 1:ln(o.type)&&hc(o);break;case 4:Xd(o,o.stateNode.containerInfo);break;case 10:var m=o.type._context,y=o.memoizedProps.value;ht(wc,m._currentValue),m._currentValue=y;break;case 13:if(m=o.memoizedState,m!==null)return m.dehydrated!==null?(ht(_t,_t.current&1),o.flags|=128,null):(c&o.child.childLanes)!==0?yx(r,o,c):(ht(_t,_t.current&1),r=Yr(r,o,c),r!==null?r.sibling:null);ht(_t,_t.current&1);break;case 19:if(m=(c&o.childLanes)!==0,(r.flags&128)!==0){if(m)return wx(r,o,c);o.flags|=128}if(y=o.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),ht(_t,_t.current),m)break;return null;case 22:case 23:return o.lanes=0,fx(r,o,c)}return Yr(r,o,c)}var xx,wf,bx,kx;xx=function(r,o){for(var c=o.child;c!==null;){if(c.tag===5||c.tag===6)r.appendChild(c.stateNode);else if(c.tag!==4&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return;c=c.return}c.sibling.return=c.return,c=c.sibling}},wf=function(){},bx=function(r,o,c,m){var y=r.memoizedProps;if(y!==m){r=o.stateNode,co(_r.current);var x=null;switch(c){case"input":y=qe(r,y),m=qe(r,m),x=[];break;case"select":y=ee({},y,{value:void 0}),m=ee({},m,{value:void 0}),x=[];break;case"textarea":y=pe(r,y),m=pe(r,m),x=[];break;default:typeof y.onClick!="function"&&typeof m.onClick=="function"&&(r.onclick=uc)}ot(c,m);var T;c=null;for(le in y)if(!m.hasOwnProperty(le)&&y.hasOwnProperty(le)&&y[le]!=null)if(le==="style"){var B=y[le];for(T in B)B.hasOwnProperty(T)&&(c||(c={}),c[T]="")}else le!=="dangerouslySetInnerHTML"&&le!=="children"&&le!=="suppressContentEditableWarning"&&le!=="suppressHydrationWarning"&&le!=="autoFocus"&&(i.hasOwnProperty(le)?x||(x=[]):(x=x||[]).push(le,null));for(le in m){var Z=m[le];if(B=y!=null?y[le]:void 0,m.hasOwnProperty(le)&&Z!==B&&(Z!=null||B!=null))if(le==="style")if(B){for(T in B)!B.hasOwnProperty(T)||Z&&Z.hasOwnProperty(T)||(c||(c={}),c[T]="");for(T in Z)Z.hasOwnProperty(T)&&B[T]!==Z[T]&&(c||(c={}),c[T]=Z[T])}else c||(x||(x=[]),x.push(le,c)),c=Z;else le==="dangerouslySetInnerHTML"?(Z=Z?Z.__html:void 0,B=B?B.__html:void 0,Z!=null&&B!==Z&&(x=x||[]).push(le,Z)):le==="children"?typeof Z!="string"&&typeof Z!="number"||(x=x||[]).push(le,""+Z):le!=="suppressContentEditableWarning"&&le!=="suppressHydrationWarning"&&(i.hasOwnProperty(le)?(Z!=null&&le==="onScroll"&&pt("scroll",r),x||B===Z||(x=[])):(x=x||[]).push(le,Z))}c&&(x=x||[]).push("style",c);var le=x;(o.updateQueue=le)&&(o.flags|=4)}},kx=function(r,o,c,m){c!==m&&(o.flags|=4)};function Ua(r,o){if(!yt)switch(r.tailMode){case"hidden":o=r.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:m.sibling=null}}function Xt(r){var o=r.alternate!==null&&r.alternate.child===r.child,c=0,m=0;if(o)for(var y=r.child;y!==null;)c|=y.lanes|y.childLanes,m|=y.subtreeFlags&14680064,m|=y.flags&14680064,y.return=r,y=y.sibling;else for(y=r.child;y!==null;)c|=y.lanes|y.childLanes,m|=y.subtreeFlags,m|=y.flags,y.return=r,y=y.sibling;return r.subtreeFlags|=m,r.childLanes=c,o}function RA(r,o,c){var m=o.pendingProps;switch(Fd(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xt(o),null;case 1:return ln(o.type)&&fc(),Xt(o),null;case 3:return m=o.stateNode,xi(),mt(an),mt(Yt),Jd(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(r===null||r.child===null)&&(yc(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,er!==null&&(Rf(er),er=null))),wf(r,o),Xt(o),null;case 5:Qd(o);var y=co(qa.current);if(c=o.type,r!==null&&o.stateNode!=null)bx(r,o,c,m,y),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!m){if(o.stateNode===null)throw Error(n(166));return Xt(o),null}if(r=co(_r.current),yc(o)){m=o.stateNode,c=o.type;var x=o.memoizedProps;switch(m[kr]=o,m[Ia]=x,r=(o.mode&1)!==0,c){case"dialog":pt("cancel",m),pt("close",m);break;case"iframe":case"object":case"embed":pt("load",m);break;case"video":case"audio":for(y=0;y<Ra.length;y++)pt(Ra[y],m);break;case"source":pt("error",m);break;case"img":case"image":case"link":pt("error",m),pt("load",m);break;case"details":pt("toggle",m);break;case"input":Se(m,x),pt("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!x.multiple},pt("invalid",m);break;case"textarea":me(m,x),pt("invalid",m)}ot(c,x),y=null;for(var T in x)if(x.hasOwnProperty(T)){var B=x[T];T==="children"?typeof B=="string"?m.textContent!==B&&(x.suppressHydrationWarning!==!0&&cc(m.textContent,B,r),y=["children",B]):typeof B=="number"&&m.textContent!==""+B&&(x.suppressHydrationWarning!==!0&&cc(m.textContent,B,r),y=["children",""+B]):i.hasOwnProperty(T)&&B!=null&&T==="onScroll"&&pt("scroll",m)}switch(c){case"input":_e(m),ke(m,x,!0);break;case"textarea":_e(m),He(m);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(m.onclick=uc)}m=y,o.updateQueue=m,m!==null&&(o.flags|=4)}else{T=y.nodeType===9?y:y.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=ct(c)),r==="http://www.w3.org/1999/xhtml"?c==="script"?(r=T.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof m.is=="string"?r=T.createElement(c,{is:m.is}):(r=T.createElement(c),c==="select"&&(T=r,m.multiple?T.multiple=!0:m.size&&(T.size=m.size))):r=T.createElementNS(r,c),r[kr]=o,r[Ia]=m,xx(r,o,!1,!1),o.stateNode=r;e:{switch(T=Ie(c,m),c){case"dialog":pt("cancel",r),pt("close",r),y=m;break;case"iframe":case"object":case"embed":pt("load",r),y=m;break;case"video":case"audio":for(y=0;y<Ra.length;y++)pt(Ra[y],r);y=m;break;case"source":pt("error",r),y=m;break;case"img":case"image":case"link":pt("error",r),pt("load",r),y=m;break;case"details":pt("toggle",r),y=m;break;case"input":Se(r,m),y=qe(r,m),pt("invalid",r);break;case"option":y=m;break;case"select":r._wrapperState={wasMultiple:!!m.multiple},y=ee({},m,{value:void 0}),pt("invalid",r);break;case"textarea":me(r,m),y=pe(r,m),pt("invalid",r);break;default:y=m}ot(c,y),B=y;for(x in B)if(B.hasOwnProperty(x)){var Z=B[x];x==="style"?Xe(r,Z):x==="dangerouslySetInnerHTML"?(Z=Z?Z.__html:void 0,Z!=null&&Ke(r,Z)):x==="children"?typeof Z=="string"?(c!=="textarea"||Z!=="")&&se(r,Z):typeof Z=="number"&&se(r,""+Z):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(i.hasOwnProperty(x)?Z!=null&&x==="onScroll"&&pt("scroll",r):Z!=null&&C(r,x,Z,T))}switch(c){case"input":_e(r),ke(r,m,!1);break;case"textarea":_e(r),He(r);break;case"option":m.value!=null&&r.setAttribute("value",""+ae(m.value));break;case"select":r.multiple=!!m.multiple,x=m.value,x!=null?lt(r,!!m.multiple,x,!1):m.defaultValue!=null&<(r,!!m.multiple,m.defaultValue,!0);break;default:typeof y.onClick=="function"&&(r.onclick=uc)}switch(c){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}}m&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return Xt(o),null;case 6:if(r&&o.stateNode!=null)kx(r,o,r.memoizedProps,m);else{if(typeof m!="string"&&o.stateNode===null)throw Error(n(166));if(c=co(qa.current),co(_r.current),yc(o)){if(m=o.stateNode,c=o.memoizedProps,m[kr]=o,(x=m.nodeValue!==c)&&(r=vn,r!==null))switch(r.tag){case 3:cc(m.nodeValue,c,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&cc(m.nodeValue,c,(r.mode&1)!==0)}x&&(o.flags|=4)}else m=(c.nodeType===9?c:c.ownerDocument).createTextNode(m),m[kr]=o,o.stateNode=m}return Xt(o),null;case 13:if(mt(_t),m=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(yt&&wn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)N0(),gi(),o.flags|=98560,x=!1;else if(x=yc(o),m!==null&&m.dehydrated!==null){if(r===null){if(!x)throw Error(n(318));if(x=o.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(n(317));x[kr]=o}else gi(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Xt(o),x=!1}else er!==null&&(Rf(er),er=null),x=!0;if(!x)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=c,o):(m=m!==null,m!==(r!==null&&r.memoizedState!==null)&&m&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(_t.current&1)!==0?$t===0&&($t=3):If())),o.updateQueue!==null&&(o.flags|=4),Xt(o),null);case 4:return xi(),wf(r,o),r===null&&Aa(o.stateNode.containerInfo),Xt(o),null;case 10:return Gd(o.type._context),Xt(o),null;case 17:return ln(o.type)&&fc(),Xt(o),null;case 19:if(mt(_t),x=o.memoizedState,x===null)return Xt(o),null;if(m=(o.flags&128)!==0,T=x.rendering,T===null)if(m)Ua(x,!1);else{if($t!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(T=_c(r),T!==null){for(o.flags|=128,Ua(x,!1),m=T.updateQueue,m!==null&&(o.updateQueue=m,o.flags|=4),o.subtreeFlags=0,m=c,c=o.child;c!==null;)x=c,r=m,x.flags&=14680066,T=x.alternate,T===null?(x.childLanes=0,x.lanes=r,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=T.childLanes,x.lanes=T.lanes,x.child=T.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=T.memoizedProps,x.memoizedState=T.memoizedState,x.updateQueue=T.updateQueue,x.type=T.type,r=T.dependencies,x.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),c=c.sibling;return ht(_t,_t.current&1|2),o.child}r=r.sibling}x.tail!==null&&it()>Si&&(o.flags|=128,m=!0,Ua(x,!1),o.lanes=4194304)}else{if(!m)if(r=_c(T),r!==null){if(o.flags|=128,m=!0,c=r.updateQueue,c!==null&&(o.updateQueue=c,o.flags|=4),Ua(x,!0),x.tail===null&&x.tailMode==="hidden"&&!T.alternate&&!yt)return Xt(o),null}else 2*it()-x.renderingStartTime>Si&&c!==1073741824&&(o.flags|=128,m=!0,Ua(x,!1),o.lanes=4194304);x.isBackwards?(T.sibling=o.child,o.child=T):(c=x.last,c!==null?c.sibling=T:o.child=T,x.last=T)}return x.tail!==null?(o=x.tail,x.rendering=o,x.tail=o.sibling,x.renderingStartTime=it(),o.sibling=null,c=_t.current,ht(_t,m?c&1|2:c&1),o):(Xt(o),null);case 22:case 23:return Mf(),m=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==m&&(o.flags|=8192),m&&(o.mode&1)!==0?(xn&1073741824)!==0&&(Xt(o),o.subtreeFlags&6&&(o.flags|=8192)):Xt(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function AA(r,o){switch(Fd(o),o.tag){case 1:return ln(o.type)&&fc(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return xi(),mt(an),mt(Yt),Jd(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return Qd(o),null;case 13:if(mt(_t),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));gi()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return mt(_t),null;case 4:return xi(),null;case 10:return Gd(o.type._context),null;case 22:case 23:return Mf(),null;case 24:return null;default:return null}}var Mc=!1,Qt=!1,MA=typeof WeakSet=="function"?WeakSet:Set,Ce=null;function ki(r,o){var c=r.ref;if(c!==null)if(typeof c=="function")try{c(null)}catch(m){Et(r,o,m)}else c.current=null}function xf(r,o,c){try{c()}catch(m){Et(r,o,m)}}var _x=!1;function IA(r,o){if(Ad=Ws,r=Ca(),q(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var m=c.getSelection&&c.getSelection();if(m&&m.rangeCount!==0){c=m.anchorNode;var y=m.anchorOffset,x=m.focusNode;m=m.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var T=0,B=-1,Z=-1,le=0,ve=0,we=r,ge=null;t:for(;;){for(var Ne;we!==c||y!==0&&we.nodeType!==3||(B=T+y),we!==x||m!==0&&we.nodeType!==3||(Z=T+m),we.nodeType===3&&(T+=we.nodeValue.length),(Ne=we.firstChild)!==null;)ge=we,we=Ne;for(;;){if(we===r)break t;if(ge===c&&++le===y&&(B=T),ge===x&&++ve===m&&(Z=T),(Ne=we.nextSibling)!==null)break;we=ge,ge=we.parentNode}we=Ne}c=B===-1||Z===-1?null:{start:B,end:Z}}else c=null}c=c||{start:0,end:0}}else c=null;for(Md={focusedElem:r,selectionRange:c},Ws=!1,Ce=o;Ce!==null;)if(o=Ce,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,Ce=r;else for(;Ce!==null;){o=Ce;try{var Ae=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(Ae!==null){var Oe=Ae.memoizedProps,Tt=Ae.memoizedState,re=o.stateNode,te=re.getSnapshotBeforeUpdate(o.elementType===o.type?Oe:tr(o.type,Oe),Tt);re.__reactInternalSnapshotBeforeUpdate=te}break;case 3:var oe=o.stateNode.containerInfo;oe.nodeType===1?oe.textContent="":oe.nodeType===9&&oe.documentElement&&oe.removeChild(oe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(xe){Et(o,o.return,xe)}if(r=o.sibling,r!==null){r.return=o.return,Ce=r;break}Ce=o.return}return Ae=_x,_x=!1,Ae}function Wa(r,o,c){var m=o.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var y=m=m.next;do{if((y.tag&r)===r){var x=y.destroy;y.destroy=void 0,x!==void 0&&xf(o,c,x)}y=y.next}while(y!==m)}}function Ic(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var c=o=o.next;do{if((c.tag&r)===r){var m=c.create;c.destroy=m()}c=c.next}while(c!==o)}}function bf(r){var o=r.ref;if(o!==null){var c=r.stateNode;switch(r.tag){case 5:r=c;break;default:r=c}typeof o=="function"?o(r):o.current=r}}function Sx(r){var o=r.alternate;o!==null&&(r.alternate=null,Sx(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[kr],delete o[Ia],delete o[$d],delete o[mA],delete o[gA])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function Nx(r){return r.tag===5||r.tag===3||r.tag===4}function Ex(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Nx(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function kf(r,o,c){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?c.nodeType===8?c.parentNode.insertBefore(r,o):c.insertBefore(r,o):(c.nodeType===8?(o=c.parentNode,o.insertBefore(r,c)):(o=c,o.appendChild(r)),c=c._reactRootContainer,c!=null||o.onclick!==null||(o.onclick=uc));else if(m!==4&&(r=r.child,r!==null))for(kf(r,o,c),r=r.sibling;r!==null;)kf(r,o,c),r=r.sibling}function _f(r,o,c){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?c.insertBefore(r,o):c.appendChild(r);else if(m!==4&&(r=r.child,r!==null))for(_f(r,o,c),r=r.sibling;r!==null;)_f(r,o,c),r=r.sibling}var Ut=null,nr=!1;function _s(r,o,c){for(c=c.child;c!==null;)Cx(r,o,c),c=c.sibling}function Cx(r,o,c){if(sn&&typeof sn.onCommitFiberUnmount=="function")try{sn.onCommitFiberUnmount(bt,c)}catch{}switch(c.tag){case 5:Qt||ki(c,o);case 6:var m=Ut,y=nr;Ut=null,_s(r,o,c),Ut=m,nr=y,Ut!==null&&(nr?(r=Ut,c=c.stateNode,r.nodeType===8?r.parentNode.removeChild(c):r.removeChild(c)):Ut.removeChild(c.stateNode));break;case 18:Ut!==null&&(nr?(r=Ut,c=c.stateNode,r.nodeType===8?Pd(r.parentNode,c):r.nodeType===1&&Pd(r,c),fs(r)):Pd(Ut,c.stateNode));break;case 4:m=Ut,y=nr,Ut=c.stateNode.containerInfo,nr=!0,_s(r,o,c),Ut=m,nr=y;break;case 0:case 11:case 14:case 15:if(!Qt&&(m=c.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){y=m=m.next;do{var x=y,T=x.destroy;x=x.tag,T!==void 0&&((x&2)!==0||(x&4)!==0)&&xf(c,o,T),y=y.next}while(y!==m)}_s(r,o,c);break;case 1:if(!Qt&&(ki(c,o),m=c.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=c.memoizedProps,m.state=c.memoizedState,m.componentWillUnmount()}catch(B){Et(c,o,B)}_s(r,o,c);break;case 21:_s(r,o,c);break;case 22:c.mode&1?(Qt=(m=Qt)||c.memoizedState!==null,_s(r,o,c),Qt=m):_s(r,o,c);break;default:_s(r,o,c)}}function jx(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var c=r.stateNode;c===null&&(c=r.stateNode=new MA),o.forEach(function(m){var y=BA.bind(null,r,m);c.has(m)||(c.add(m),m.then(y,y))})}}function rr(r,o){var c=o.deletions;if(c!==null)for(var m=0;m<c.length;m++){var y=c[m];try{var x=r,T=o,B=T;e:for(;B!==null;){switch(B.tag){case 5:Ut=B.stateNode,nr=!1;break e;case 3:Ut=B.stateNode.containerInfo,nr=!0;break e;case 4:Ut=B.stateNode.containerInfo,nr=!0;break e}B=B.return}if(Ut===null)throw Error(n(160));Cx(x,T,y),Ut=null,nr=!1;var Z=y.alternate;Z!==null&&(Z.return=null),y.return=null}catch(le){Et(y,o,le)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)Tx(o,r),o=o.sibling}function Tx(r,o){var c=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(rr(o,r),Nr(r),m&4){try{Wa(3,r,r.return),Ic(3,r)}catch(Oe){Et(r,r.return,Oe)}try{Wa(5,r,r.return)}catch(Oe){Et(r,r.return,Oe)}}break;case 1:rr(o,r),Nr(r),m&512&&c!==null&&ki(c,c.return);break;case 5:if(rr(o,r),Nr(r),m&512&&c!==null&&ki(c,c.return),r.flags&32){var y=r.stateNode;try{se(y,"")}catch(Oe){Et(r,r.return,Oe)}}if(m&4&&(y=r.stateNode,y!=null)){var x=r.memoizedProps,T=c!==null?c.memoizedProps:x,B=r.type,Z=r.updateQueue;if(r.updateQueue=null,Z!==null)try{B==="input"&&x.type==="radio"&&x.name!=null&&ce(y,x),Ie(B,T);var le=Ie(B,x);for(T=0;T<Z.length;T+=2){var ve=Z[T],we=Z[T+1];ve==="style"?Xe(y,we):ve==="dangerouslySetInnerHTML"?Ke(y,we):ve==="children"?se(y,we):C(y,ve,we,le)}switch(B){case"input":be(y,x);break;case"textarea":Me(y,x);break;case"select":var ge=y._wrapperState.wasMultiple;y._wrapperState.wasMultiple=!!x.multiple;var Ne=x.value;Ne!=null?lt(y,!!x.multiple,Ne,!1):ge!==!!x.multiple&&(x.defaultValue!=null?lt(y,!!x.multiple,x.defaultValue,!0):lt(y,!!x.multiple,x.multiple?[]:"",!1))}y[Ia]=x}catch(Oe){Et(r,r.return,Oe)}}break;case 6:if(rr(o,r),Nr(r),m&4){if(r.stateNode===null)throw Error(n(162));y=r.stateNode,x=r.memoizedProps;try{y.nodeValue=x}catch(Oe){Et(r,r.return,Oe)}}break;case 3:if(rr(o,r),Nr(r),m&4&&c!==null&&c.memoizedState.isDehydrated)try{fs(o.containerInfo)}catch(Oe){Et(r,r.return,Oe)}break;case 4:rr(o,r),Nr(r);break;case 13:rr(o,r),Nr(r),y=r.child,y.flags&8192&&(x=y.memoizedState!==null,y.stateNode.isHidden=x,!x||y.alternate!==null&&y.alternate.memoizedState!==null||(Ef=it())),m&4&&jx(r);break;case 22:if(ve=c!==null&&c.memoizedState!==null,r.mode&1?(Qt=(le=Qt)||ve,rr(o,r),Qt=le):rr(o,r),Nr(r),m&8192){if(le=r.memoizedState!==null,(r.stateNode.isHidden=le)&&!ve&&(r.mode&1)!==0)for(Ce=r,ve=r.child;ve!==null;){for(we=Ce=ve;Ce!==null;){switch(ge=Ce,Ne=ge.child,ge.tag){case 0:case 11:case 14:case 15:Wa(4,ge,ge.return);break;case 1:ki(ge,ge.return);var Ae=ge.stateNode;if(typeof Ae.componentWillUnmount=="function"){m=ge,c=ge.return;try{o=m,Ae.props=o.memoizedProps,Ae.state=o.memoizedState,Ae.componentWillUnmount()}catch(Oe){Et(m,c,Oe)}}break;case 5:ki(ge,ge.return);break;case 22:if(ge.memoizedState!==null){Mx(we);continue}}Ne!==null?(Ne.return=ge,Ce=Ne):Mx(we)}ve=ve.sibling}e:for(ve=null,we=r;;){if(we.tag===5){if(ve===null){ve=we;try{y=we.stateNode,le?(x=y.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(B=we.stateNode,Z=we.memoizedProps.style,T=Z!=null&&Z.hasOwnProperty("display")?Z.display:null,B.style.display=Te("display",T))}catch(Oe){Et(r,r.return,Oe)}}}else if(we.tag===6){if(ve===null)try{we.stateNode.nodeValue=le?"":we.memoizedProps}catch(Oe){Et(r,r.return,Oe)}}else if((we.tag!==22&&we.tag!==23||we.memoizedState===null||we===r)&&we.child!==null){we.child.return=we,we=we.child;continue}if(we===r)break e;for(;we.sibling===null;){if(we.return===null||we.return===r)break e;ve===we&&(ve=null),we=we.return}ve===we&&(ve=null),we.sibling.return=we.return,we=we.sibling}}break;case 19:rr(o,r),Nr(r),m&4&&jx(r);break;case 21:break;default:rr(o,r),Nr(r)}}function Nr(r){var o=r.flags;if(o&2){try{e:{for(var c=r.return;c!==null;){if(Nx(c)){var m=c;break e}c=c.return}throw Error(n(160))}switch(m.tag){case 5:var y=m.stateNode;m.flags&32&&(se(y,""),m.flags&=-33);var x=Ex(r);_f(r,x,y);break;case 3:case 4:var T=m.stateNode.containerInfo,B=Ex(r);kf(r,B,T);break;default:throw Error(n(161))}}catch(Z){Et(r,r.return,Z)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function OA(r,o,c){Ce=r,Rx(r)}function Rx(r,o,c){for(var m=(r.mode&1)!==0;Ce!==null;){var y=Ce,x=y.child;if(y.tag===22&&m){var T=y.memoizedState!==null||Mc;if(!T){var B=y.alternate,Z=B!==null&&B.memoizedState!==null||Qt;B=Mc;var le=Qt;if(Mc=T,(Qt=Z)&&!le)for(Ce=y;Ce!==null;)T=Ce,Z=T.child,T.tag===22&&T.memoizedState!==null?Ix(y):Z!==null?(Z.return=T,Ce=Z):Ix(y);for(;x!==null;)Ce=x,Rx(x),x=x.sibling;Ce=y,Mc=B,Qt=le}Ax(r)}else(y.subtreeFlags&8772)!==0&&x!==null?(x.return=y,Ce=x):Ax(r)}}function Ax(r){for(;Ce!==null;){var o=Ce;if((o.flags&8772)!==0){var c=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:Qt||Ic(5,o);break;case 1:var m=o.stateNode;if(o.flags&4&&!Qt)if(c===null)m.componentDidMount();else{var y=o.elementType===o.type?c.memoizedProps:tr(o.type,c.memoizedProps);m.componentDidUpdate(y,c.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var x=o.updateQueue;x!==null&&M0(o,x,m);break;case 3:var T=o.updateQueue;if(T!==null){if(c=null,o.child!==null)switch(o.child.tag){case 5:c=o.child.stateNode;break;case 1:c=o.child.stateNode}M0(o,T,c)}break;case 5:var B=o.stateNode;if(c===null&&o.flags&4){c=B;var Z=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":Z.autoFocus&&c.focus();break;case"img":Z.src&&(c.src=Z.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var le=o.alternate;if(le!==null){var ve=le.memoizedState;if(ve!==null){var we=ve.dehydrated;we!==null&&fs(we)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Qt||o.flags&512&&bf(o)}catch(ge){Et(o,o.return,ge)}}if(o===r){Ce=null;break}if(c=o.sibling,c!==null){c.return=o.return,Ce=c;break}Ce=o.return}}function Mx(r){for(;Ce!==null;){var o=Ce;if(o===r){Ce=null;break}var c=o.sibling;if(c!==null){c.return=o.return,Ce=c;break}Ce=o.return}}function Ix(r){for(;Ce!==null;){var o=Ce;try{switch(o.tag){case 0:case 11:case 15:var c=o.return;try{Ic(4,o)}catch(Z){Et(o,c,Z)}break;case 1:var m=o.stateNode;if(typeof m.componentDidMount=="function"){var y=o.return;try{m.componentDidMount()}catch(Z){Et(o,y,Z)}}var x=o.return;try{bf(o)}catch(Z){Et(o,x,Z)}break;case 5:var T=o.return;try{bf(o)}catch(Z){Et(o,T,Z)}}}catch(Z){Et(o,o.return,Z)}if(o===r){Ce=null;break}var B=o.sibling;if(B!==null){B.return=o.return,Ce=B;break}Ce=o.return}}var PA=Math.ceil,Oc=j.ReactCurrentDispatcher,Sf=j.ReactCurrentOwner,Pn=j.ReactCurrentBatchConfig,rt=0,Dt=null,Rt=null,Wt=0,xn=0,_i=vs(0),$t=0,Ha=null,fo=0,Pc=0,Nf=0,Ga=null,un=null,Ef=0,Si=1/0,Kr=null,$c=!1,Cf=null,Ss=null,Lc=!1,Ns=null,qc=0,Va=0,jf=null,Dc=-1,Fc=0;function rn(){return(rt&6)!==0?it():Dc!==-1?Dc:Dc=it()}function Es(r){return(r.mode&1)===0?1:(rt&2)!==0&&Wt!==0?Wt&-Wt:vA.transition!==null?(Fc===0&&(Fc=Bs()),Fc):(r=Je,r!==0||(r=window.event,r=r===void 0?16:ti(r.type)),r)}function sr(r,o,c,m){if(50<Va)throw Va=0,jf=null,Error(n(185));cs(r,c,m),((rt&2)===0||r!==Dt)&&(r===Dt&&((rt&2)===0&&(Pc|=c),$t===4&&Cs(r,Wt)),dn(r,m),c===1&&rt===0&&(o.mode&1)===0&&(Si=it()+500,pc&&xs()))}function dn(r,o){var c=r.callbackNode;zl(r,o);var m=zs(r,r===Dt?Wt:0);if(m===0)c!==null&&Fs(c),r.callbackNode=null,r.callbackPriority=0;else if(o=m&-m,r.callbackPriority!==o){if(c!=null&&Fs(c),o===1)r.tag===0?yA(Px.bind(null,r)):x0(Px.bind(null,r)),hA(function(){(rt&6)===0&&xs()}),c=null;else{switch(Ko(m)){case 1:c=os;break;case 4:c=Gt;break;case 16:c=Hn;break;case 536870912:c=is;break;default:c=Hn}c=Ux(c,Ox.bind(null,r))}r.callbackPriority=o,r.callbackNode=c}}function Ox(r,o){if(Dc=-1,Fc=0,(rt&6)!==0)throw Error(n(327));var c=r.callbackNode;if(Ni()&&r.callbackNode!==c)return null;var m=zs(r,r===Dt?Wt:0);if(m===0)return null;if((m&30)!==0||(m&r.expiredLanes)!==0||o)o=zc(r,m);else{o=m;var y=rt;rt|=2;var x=Lx();(Dt!==r||Wt!==o)&&(Kr=null,Si=it()+500,po(r,o));do try{qA();break}catch(B){$x(r,B)}while(!0);Hd(),Oc.current=x,rt=y,Rt!==null?o=0:(Dt=null,Wt=0,o=$t)}if(o!==0){if(o===2&&(y=Vo(r),y!==0&&(m=y,o=Tf(r,y))),o===1)throw c=Ha,po(r,0),Cs(r,m),dn(r,it()),c;if(o===6)Cs(r,m);else{if(y=r.current.alternate,(m&30)===0&&!$A(y)&&(o=zc(r,m),o===2&&(x=Vo(r),x!==0&&(m=x,o=Tf(r,x))),o===1))throw c=Ha,po(r,0),Cs(r,m),dn(r,it()),c;switch(r.finishedWork=y,r.finishedLanes=m,o){case 0:case 1:throw Error(n(345));case 2:mo(r,un,Kr);break;case 3:if(Cs(r,m),(m&130023424)===m&&(o=Ef+500-it(),10<o)){if(zs(r,0)!==0)break;if(y=r.suspendedLanes,(y&m)!==m){rn(),r.pingedLanes|=r.suspendedLanes&y;break}r.timeoutHandle=Od(mo.bind(null,r,un,Kr),o);break}mo(r,un,Kr);break;case 4:if(Cs(r,m),(m&4194240)===m)break;for(o=r.eventTimes,y=-1;0<m;){var T=31-gn(m);x=1<<T,T=o[T],T>y&&(y=T),m&=~x}if(m=y,m=it()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*PA(m/1960))-m,10<m){r.timeoutHandle=Od(mo.bind(null,r,un,Kr),m);break}mo(r,un,Kr);break;case 5:mo(r,un,Kr);break;default:throw Error(n(329))}}}return dn(r,it()),r.callbackNode===c?Ox.bind(null,r):null}function Tf(r,o){var c=Ga;return r.current.memoizedState.isDehydrated&&(po(r,o).flags|=256),r=zc(r,o),r!==2&&(o=un,un=c,o!==null&&Rf(o)),r}function Rf(r){un===null?un=r:un.push.apply(un,r)}function $A(r){for(var o=r;;){if(o.flags&16384){var c=o.updateQueue;if(c!==null&&(c=c.stores,c!==null))for(var m=0;m<c.length;m++){var y=c[m],x=y.getSnapshot;y=y.value;try{if(!tn(x(),y))return!1}catch{return!1}}}if(c=o.child,o.subtreeFlags&16384&&c!==null)c.return=o,o=c;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Cs(r,o){for(o&=~Nf,o&=~Pc,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var c=31-gn(o),m=1<<c;r[c]=-1,o&=~m}}function Px(r){if((rt&6)!==0)throw Error(n(327));Ni();var o=zs(r,0);if((o&1)===0)return dn(r,it()),null;var c=zc(r,o);if(r.tag!==0&&c===2){var m=Vo(r);m!==0&&(o=m,c=Tf(r,m))}if(c===1)throw c=Ha,po(r,0),Cs(r,o),dn(r,it()),c;if(c===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,mo(r,un,Kr),dn(r,it()),null}function Af(r,o){var c=rt;rt|=1;try{return r(o)}finally{rt=c,rt===0&&(Si=it()+500,pc&&xs())}}function ho(r){Ns!==null&&Ns.tag===0&&(rt&6)===0&&Ni();var o=rt;rt|=1;var c=Pn.transition,m=Je;try{if(Pn.transition=null,Je=1,r)return r()}finally{Je=m,Pn.transition=c,rt=o,(rt&6)===0&&xs()}}function Mf(){xn=_i.current,mt(_i)}function po(r,o){r.finishedWork=null,r.finishedLanes=0;var c=r.timeoutHandle;if(c!==-1&&(r.timeoutHandle=-1,fA(c)),Rt!==null)for(c=Rt.return;c!==null;){var m=c;switch(Fd(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&fc();break;case 3:xi(),mt(an),mt(Yt),Jd();break;case 5:Qd(m);break;case 4:xi();break;case 13:mt(_t);break;case 19:mt(_t);break;case 10:Gd(m.type._context);break;case 22:case 23:Mf()}c=c.return}if(Dt=r,Rt=r=js(r.current,null),Wt=xn=o,$t=0,Ha=null,Nf=Pc=fo=0,un=Ga=null,lo!==null){for(o=0;o<lo.length;o++)if(c=lo[o],m=c.interleaved,m!==null){c.interleaved=null;var y=m.next,x=c.pending;if(x!==null){var T=x.next;x.next=y,m.next=T}c.pending=m}lo=null}return r}function $x(r,o){do{var c=Rt;try{if(Hd(),Sc.current=jc,Nc){for(var m=St.memoizedState;m!==null;){var y=m.queue;y!==null&&(y.pending=null),m=m.next}Nc=!1}if(uo=0,qt=Pt=St=null,Da=!1,Fa=0,Sf.current=null,c===null||c.return===null){$t=1,Ha=o,Rt=null;break}e:{var x=r,T=c.return,B=c,Z=o;if(o=Wt,B.flags|=32768,Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var le=Z,ve=B,we=ve.tag;if((ve.mode&1)===0&&(we===0||we===11||we===15)){var ge=ve.alternate;ge?(ve.updateQueue=ge.updateQueue,ve.memoizedState=ge.memoizedState,ve.lanes=ge.lanes):(ve.updateQueue=null,ve.memoizedState=null)}var Ne=ax(T);if(Ne!==null){Ne.flags&=-257,lx(Ne,T,B,x,o),Ne.mode&1&&ix(x,le,o),o=Ne,Z=le;var Ae=o.updateQueue;if(Ae===null){var Oe=new Set;Oe.add(Z),o.updateQueue=Oe}else Ae.add(Z);break e}else{if((o&1)===0){ix(x,le,o),If();break e}Z=Error(n(426))}}else if(yt&&B.mode&1){var Tt=ax(T);if(Tt!==null){(Tt.flags&65536)===0&&(Tt.flags|=256),lx(Tt,T,B,x,o),Ud(bi(Z,B));break e}}x=Z=bi(Z,B),$t!==4&&($t=2),Ga===null?Ga=[x]:Ga.push(x),x=T;do{switch(x.tag){case 3:x.flags|=65536,o&=-o,x.lanes|=o;var re=sx(x,Z,o);A0(x,re);break e;case 1:B=Z;var te=x.type,oe=x.stateNode;if((x.flags&128)===0&&(typeof te.getDerivedStateFromError=="function"||oe!==null&&typeof oe.componentDidCatch=="function"&&(Ss===null||!Ss.has(oe)))){x.flags|=65536,o&=-o,x.lanes|=o;var xe=ox(x,B,o);A0(x,xe);break e}}x=x.return}while(x!==null)}Dx(c)}catch(Le){o=Le,Rt===c&&c!==null&&(Rt=c=c.return);continue}break}while(!0)}function Lx(){var r=Oc.current;return Oc.current=jc,r===null?jc:r}function If(){($t===0||$t===3||$t===2)&&($t=4),Dt===null||(fo&268435455)===0&&(Pc&268435455)===0||Cs(Dt,Wt)}function zc(r,o){var c=rt;rt|=2;var m=Lx();(Dt!==r||Wt!==o)&&(Kr=null,po(r,o));do try{LA();break}catch(y){$x(r,y)}while(!0);if(Hd(),rt=c,Oc.current=m,Rt!==null)throw Error(n(261));return Dt=null,Wt=0,$t}function LA(){for(;Rt!==null;)qx(Rt)}function qA(){for(;Rt!==null&&!zo();)qx(Rt)}function qx(r){var o=Bx(r.alternate,r,xn);r.memoizedProps=r.pendingProps,o===null?Dx(r):Rt=o,Sf.current=null}function Dx(r){var o=r;do{var c=o.alternate;if(r=o.return,(o.flags&32768)===0){if(c=RA(c,o,xn),c!==null){Rt=c;return}}else{if(c=AA(c,o),c!==null){c.flags&=32767,Rt=c;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{$t=6,Rt=null;return}}if(o=o.sibling,o!==null){Rt=o;return}Rt=o=r}while(o!==null);$t===0&&($t=5)}function mo(r,o,c){var m=Je,y=Pn.transition;try{Pn.transition=null,Je=1,DA(r,o,c,m)}finally{Pn.transition=y,Je=m}return null}function DA(r,o,c,m){do Ni();while(Ns!==null);if((rt&6)!==0)throw Error(n(327));c=r.finishedWork;var y=r.finishedLanes;if(c===null)return null;if(r.finishedWork=null,r.finishedLanes=0,c===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var x=c.lanes|c.childLanes;if(Zt(r,x),r===Dt&&(Rt=Dt=null,Wt=0),(c.subtreeFlags&2064)===0&&(c.flags&2064)===0||Lc||(Lc=!0,Ux(Hn,function(){return Ni(),null})),x=(c.flags&15990)!==0,(c.subtreeFlags&15990)!==0||x){x=Pn.transition,Pn.transition=null;var T=Je;Je=1;var B=rt;rt|=4,Sf.current=null,IA(r,c),Tx(c,r),U(Md),Ws=!!Ad,Md=Ad=null,r.current=c,OA(c),Bo(),rt=B,Je=T,Pn.transition=x}else r.current=c;if(Lc&&(Lc=!1,Ns=r,qc=y),x=r.pendingLanes,x===0&&(Ss=null),Gn(c.stateNode),dn(r,it()),o!==null)for(m=r.onRecoverableError,c=0;c<o.length;c++)y=o[c],m(y.value,{componentStack:y.stack,digest:y.digest});if($c)throw $c=!1,r=Cf,Cf=null,r;return(qc&1)!==0&&r.tag!==0&&Ni(),x=r.pendingLanes,(x&1)!==0?r===jf?Va++:(Va=0,jf=r):Va=0,xs(),null}function Ni(){if(Ns!==null){var r=Ko(qc),o=Pn.transition,c=Je;try{if(Pn.transition=null,Je=16>r?16:r,Ns===null)var m=!1;else{if(r=Ns,Ns=null,qc=0,(rt&6)!==0)throw Error(n(331));var y=rt;for(rt|=4,Ce=r.current;Ce!==null;){var x=Ce,T=x.child;if((Ce.flags&16)!==0){var B=x.deletions;if(B!==null){for(var Z=0;Z<B.length;Z++){var le=B[Z];for(Ce=le;Ce!==null;){var ve=Ce;switch(ve.tag){case 0:case 11:case 15:Wa(8,ve,x)}var we=ve.child;if(we!==null)we.return=ve,Ce=we;else for(;Ce!==null;){ve=Ce;var ge=ve.sibling,Ne=ve.return;if(Sx(ve),ve===le){Ce=null;break}if(ge!==null){ge.return=Ne,Ce=ge;break}Ce=Ne}}}var Ae=x.alternate;if(Ae!==null){var Oe=Ae.child;if(Oe!==null){Ae.child=null;do{var Tt=Oe.sibling;Oe.sibling=null,Oe=Tt}while(Oe!==null)}}Ce=x}}if((x.subtreeFlags&2064)!==0&&T!==null)T.return=x,Ce=T;else e:for(;Ce!==null;){if(x=Ce,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Wa(9,x,x.return)}var re=x.sibling;if(re!==null){re.return=x.return,Ce=re;break e}Ce=x.return}}var te=r.current;for(Ce=te;Ce!==null;){T=Ce;var oe=T.child;if((T.subtreeFlags&2064)!==0&&oe!==null)oe.return=T,Ce=oe;else e:for(T=te;Ce!==null;){if(B=Ce,(B.flags&2048)!==0)try{switch(B.tag){case 0:case 11:case 15:Ic(9,B)}}catch(Le){Et(B,B.return,Le)}if(B===T){Ce=null;break e}var xe=B.sibling;if(xe!==null){xe.return=B.return,Ce=xe;break e}Ce=B.return}}if(rt=y,xs(),sn&&typeof sn.onPostCommitFiberRoot=="function")try{sn.onPostCommitFiberRoot(bt,r)}catch{}m=!0}return m}finally{Je=c,Pn.transition=o}}return!1}function Fx(r,o,c){o=bi(c,o),o=sx(r,o,1),r=ks(r,o,1),o=rn(),r!==null&&(cs(r,1,o),dn(r,o))}function Et(r,o,c){if(r.tag===3)Fx(r,r,c);else for(;o!==null;){if(o.tag===3){Fx(o,r,c);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Ss===null||!Ss.has(m))){r=bi(c,r),r=ox(o,r,1),o=ks(o,r,1),r=rn(),o!==null&&(cs(o,1,r),dn(o,r));break}}o=o.return}}function FA(r,o,c){var m=r.pingCache;m!==null&&m.delete(o),o=rn(),r.pingedLanes|=r.suspendedLanes&c,Dt===r&&(Wt&c)===c&&($t===4||$t===3&&(Wt&130023424)===Wt&&500>it()-Ef?po(r,0):Nf|=c),dn(r,o)}function zx(r,o){o===0&&((r.mode&1)===0?o=1:(o=Go,Go<<=1,(Go&130023424)===0&&(Go=4194304)));var c=rn();r=Gr(r,o),r!==null&&(cs(r,o,c),dn(r,c))}function zA(r){var o=r.memoizedState,c=0;o!==null&&(c=o.retryLane),zx(r,c)}function BA(r,o){var c=0;switch(r.tag){case 13:var m=r.stateNode,y=r.memoizedState;y!==null&&(c=y.retryLane);break;case 19:m=r.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(o),zx(r,c)}var Bx;Bx=function(r,o,c){if(r!==null)if(r.memoizedProps!==o.pendingProps||an.current)cn=!0;else{if((r.lanes&c)===0&&(o.flags&128)===0)return cn=!1,TA(r,o,c);cn=(r.flags&131072)!==0}else cn=!1,yt&&(o.flags&1048576)!==0&&b0(o,gc,o.index);switch(o.lanes=0,o.tag){case 2:var m=o.type;Ac(r,o),r=o.pendingProps;var y=hi(o,Yt.current);wi(o,c),y=nf(null,o,m,r,y,c);var x=rf();return o.flags|=1,typeof y=="object"&&y!==null&&typeof y.render=="function"&&y.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,ln(m)?(x=!0,hc(o)):x=!1,o.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,Kd(o),y.updater=Tc,o.stateNode=y,y._reactInternals=o,uf(o,m,r,c),o=pf(null,o,m,!0,x,c)):(o.tag=0,yt&&x&&Dd(o),nn(null,o,y,c),o=o.child),o;case 16:m=o.elementType;e:{switch(Ac(r,o),r=o.pendingProps,y=m._init,m=y(m._payload),o.type=m,y=o.tag=WA(m),r=tr(m,r),y){case 0:o=hf(null,o,m,r,c);break e;case 1:o=px(null,o,m,r,c);break e;case 11:o=cx(null,o,m,r,c);break e;case 14:o=ux(null,o,m,tr(m.type,r),c);break e}throw Error(n(306,m,""))}return o;case 0:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:tr(m,y),hf(r,o,m,y,c);case 1:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:tr(m,y),px(r,o,m,y,c);case 3:e:{if(mx(o),r===null)throw Error(n(387));m=o.pendingProps,x=o.memoizedState,y=x.element,R0(r,o),kc(o,m,null,c);var T=o.memoizedState;if(m=T.element,x.isDehydrated)if(x={element:m,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},o.updateQueue.baseState=x,o.memoizedState=x,o.flags&256){y=bi(Error(n(423)),o),o=gx(r,o,m,c,y);break e}else if(m!==y){y=bi(Error(n(424)),o),o=gx(r,o,m,c,y);break e}else for(wn=ys(o.stateNode.containerInfo.firstChild),vn=o,yt=!0,er=null,c=j0(o,null,m,c),o.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(gi(),m===y){o=Yr(r,o,c);break e}nn(r,o,m,c)}o=o.child}return o;case 5:return I0(o),r===null&&Bd(o),m=o.type,y=o.pendingProps,x=r!==null?r.memoizedProps:null,T=y.children,Id(m,y)?T=null:x!==null&&Id(m,x)&&(o.flags|=32),hx(r,o),nn(r,o,T,c),o.child;case 6:return r===null&&Bd(o),null;case 13:return yx(r,o,c);case 4:return Xd(o,o.stateNode.containerInfo),m=o.pendingProps,r===null?o.child=yi(o,null,m,c):nn(r,o,m,c),o.child;case 11:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:tr(m,y),cx(r,o,m,y,c);case 7:return nn(r,o,o.pendingProps,c),o.child;case 8:return nn(r,o,o.pendingProps.children,c),o.child;case 12:return nn(r,o,o.pendingProps.children,c),o.child;case 10:e:{if(m=o.type._context,y=o.pendingProps,x=o.memoizedProps,T=y.value,ht(wc,m._currentValue),m._currentValue=T,x!==null)if(tn(x.value,T)){if(x.children===y.children&&!an.current){o=Yr(r,o,c);break e}}else for(x=o.child,x!==null&&(x.return=o);x!==null;){var B=x.dependencies;if(B!==null){T=x.child;for(var Z=B.firstContext;Z!==null;){if(Z.context===m){if(x.tag===1){Z=Vr(-1,c&-c),Z.tag=2;var le=x.updateQueue;if(le!==null){le=le.shared;var ve=le.pending;ve===null?Z.next=Z:(Z.next=ve.next,ve.next=Z),le.pending=Z}}x.lanes|=c,Z=x.alternate,Z!==null&&(Z.lanes|=c),Vd(x.return,c,o),B.lanes|=c;break}Z=Z.next}}else if(x.tag===10)T=x.type===o.type?null:x.child;else if(x.tag===18){if(T=x.return,T===null)throw Error(n(341));T.lanes|=c,B=T.alternate,B!==null&&(B.lanes|=c),Vd(T,c,o),T=x.sibling}else T=x.child;if(T!==null)T.return=x;else for(T=x;T!==null;){if(T===o){T=null;break}if(x=T.sibling,x!==null){x.return=T.return,T=x;break}T=T.return}x=T}nn(r,o,y.children,c),o=o.child}return o;case 9:return y=o.type,m=o.pendingProps.children,wi(o,c),y=In(y),m=m(y),o.flags|=1,nn(r,o,m,c),o.child;case 14:return m=o.type,y=tr(m,o.pendingProps),y=tr(m.type,y),ux(r,o,m,y,c);case 15:return dx(r,o,o.type,o.pendingProps,c);case 17:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:tr(m,y),Ac(r,o),o.tag=1,ln(m)?(r=!0,hc(o)):r=!1,wi(o,c),nx(o,m,y),uf(o,m,y,c),pf(null,o,m,!0,r,c);case 19:return wx(r,o,c);case 22:return fx(r,o,c)}throw Error(n(156,o.tag))};function Ux(r,o){return Ds(r,o)}function UA(r,o,c,m){this.tag=r,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $n(r,o,c,m){return new UA(r,o,c,m)}function Of(r){return r=r.prototype,!(!r||!r.isReactComponent)}function WA(r){if(typeof r=="function")return Of(r)?1:0;if(r!=null){if(r=r.$$typeof,r===H)return 11;if(r===K)return 14}return 2}function js(r,o){var c=r.alternate;return c===null?(c=$n(r.tag,o,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=o,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&14680064,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,o=r.dependencies,c.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c}function Bc(r,o,c,m,y,x){var T=2;if(m=r,typeof r=="function")Of(r)&&(T=1);else if(typeof r=="string")T=5;else e:switch(r){case I:return go(c.children,y,x,o);case F:T=8,y|=8;break;case O:return r=$n(12,c,o,y|2),r.elementType=O,r.lanes=x,r;case X:return r=$n(13,c,o,y),r.elementType=X,r.lanes=x,r;case R:return r=$n(19,c,o,y),r.elementType=R,r.lanes=x,r;case ne:return Uc(c,y,x,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case A:T=10;break e;case L:T=9;break e;case H:T=11;break e;case K:T=14;break e;case G:T=16,m=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=$n(T,c,o,y),o.elementType=r,o.type=m,o.lanes=x,o}function go(r,o,c,m){return r=$n(7,r,m,o),r.lanes=c,r}function Uc(r,o,c,m){return r=$n(22,r,m,o),r.elementType=ne,r.lanes=c,r.stateNode={isHidden:!1},r}function Pf(r,o,c){return r=$n(6,r,null,o),r.lanes=c,r}function $f(r,o,c){return o=$n(4,r.children!==null?r.children:[],r.key,o),o.lanes=c,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function HA(r,o,c,m,y){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Yo(0),this.expirationTimes=Yo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yo(0),this.identifierPrefix=m,this.onRecoverableError=y,this.mutableSourceEagerHydrationData=null}function Lf(r,o,c,m,y,x,T,B,Z){return r=new HA(r,o,c,B,Z),o===1?(o=1,x===!0&&(o|=8)):o=0,x=$n(3,null,null,o),r.current=x,x.stateNode=r,x.memoizedState={element:m,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null},Kd(x),r}function GA(r,o,c){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:P,key:m==null?null:""+m,children:r,containerInfo:o,implementation:c}}function Wx(r){if(!r)return ws;r=r._reactInternals;e:{if(Cn(r)!==r||r.tag!==1)throw Error(n(170));var o=r;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(ln(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(r.tag===1){var c=r.type;if(ln(c))return v0(r,c,o)}return o}function Hx(r,o,c,m,y,x,T,B,Z){return r=Lf(c,m,!0,r,y,x,T,B,Z),r.context=Wx(null),c=r.current,m=rn(),y=Es(c),x=Vr(m,y),x.callback=o??null,ks(c,x,y),r.current.lanes=y,cs(r,y,m),dn(r,m),r}function Wc(r,o,c,m){var y=o.current,x=rn(),T=Es(y);return c=Wx(c),o.context===null?o.context=c:o.pendingContext=c,o=Vr(x,T),o.payload={element:r},m=m===void 0?null:m,m!==null&&(o.callback=m),r=ks(y,o,T),r!==null&&(sr(r,y,T,x),bc(r,y,T)),T}function Hc(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function Gx(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<o?c:o}}function qf(r,o){Gx(r,o),(r=r.alternate)&&Gx(r,o)}function VA(){return null}var Vx=typeof reportError=="function"?reportError:function(r){console.error(r)};function Df(r){this._internalRoot=r}Gc.prototype.render=Df.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));Wc(r,o,null,null)},Gc.prototype.unmount=Df.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;ho(function(){Wc(null,r,null,null)}),o[Br]=null}};function Gc(r){this._internalRoot=r}Gc.prototype.unstable_scheduleHydration=function(r){if(r){var o=Vn();r={blockedOn:null,target:r,priority:o};for(var c=0;c<Xn.length&&o!==0&&o<Xn[c].priority;c++);Xn.splice(c,0,r),c===0&&Zo(r)}};function Ff(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function Vc(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Yx(){}function YA(r,o,c,m,y){if(y){if(typeof m=="function"){var x=m;m=function(){var le=Hc(T);x.call(le)}}var T=Hx(o,m,r,0,null,!1,!1,"",Yx);return r._reactRootContainer=T,r[Br]=T.current,Aa(r.nodeType===8?r.parentNode:r),ho(),T}for(;y=r.lastChild;)r.removeChild(y);if(typeof m=="function"){var B=m;m=function(){var le=Hc(Z);B.call(le)}}var Z=Lf(r,0,!1,null,null,!1,!1,"",Yx);return r._reactRootContainer=Z,r[Br]=Z.current,Aa(r.nodeType===8?r.parentNode:r),ho(function(){Wc(o,Z,c,m)}),Z}function Yc(r,o,c,m,y){var x=c._reactRootContainer;if(x){var T=x;if(typeof y=="function"){var B=y;y=function(){var Z=Hc(T);B.call(Z)}}Wc(o,T,r,y)}else T=YA(c,o,r,y,m);return Hc(T)}Bl=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var c=as(o.pendingLanes);c!==0&&(us(o,c|1),dn(o,it()),(rt&6)===0&&(Si=it()+500,xs()))}break;case 13:ho(function(){var m=Gr(r,1);if(m!==null){var y=rn();sr(m,r,1,y)}}),qf(r,1)}},Pr=function(r){if(r.tag===13){var o=Gr(r,134217728);if(o!==null){var c=rn();sr(o,r,134217728,c)}qf(r,134217728)}},oa=function(r){if(r.tag===13){var o=Es(r),c=Gr(r,o);if(c!==null){var m=rn();sr(c,r,o,m)}qf(r,o)}},Vn=function(){return Je},Ul=function(r,o){var c=Je;try{return Je=r,o()}finally{Je=c}},gt=function(r,o,c){switch(o){case"input":if(be(r,c),o=c.name,c.type==="radio"&&o!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<c.length;o++){var m=c[o];if(m!==r&&m.form===r.form){var y=dc(m);if(!y)throw Error(n(90));Ve(m),be(m,y)}}}break;case"textarea":Me(r,c);break;case"select":o=c.value,o!=null&<(r,!!c.multiple,o,!1)}},Mo=Af,Io=ho;var KA={usingClientEntryPoint:!1,Events:[Oa,di,dc,Ao,mn,Af]},Ya={findFiberByHostInstance:so,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},XA={bundleType:Ya.bundleType,version:Ya.version,rendererPackageName:Ya.rendererPackageName,rendererConfig:Ya.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:j.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=Wn(r),r===null?null:r.stateNode},findFiberByHostInstance:Ya.findFiberByHostInstance||VA,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 Kc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kc.isDisabled&&Kc.supportsFiber)try{bt=Kc.inject(XA),sn=Kc}catch{}}return fn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=KA,fn.createPortal=function(r,o){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ff(o))throw Error(n(200));return GA(r,o,null,c)},fn.createRoot=function(r,o){if(!Ff(r))throw Error(n(299));var c=!1,m="",y=Vx;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onRecoverableError!==void 0&&(y=o.onRecoverableError)),o=Lf(r,1,!1,null,null,c,!1,m,y),r[Br]=o.current,Aa(r.nodeType===8?r.parentNode:r),new Df(o)},fn.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var o=r._reactInternals;if(o===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=Wn(o),r=r===null?null:r.stateNode,r},fn.flushSync=function(r){return ho(r)},fn.hydrate=function(r,o,c){if(!Vc(o))throw Error(n(200));return Yc(null,r,o,!0,c)},fn.hydrateRoot=function(r,o,c){if(!Ff(r))throw Error(n(405));var m=c!=null&&c.hydratedSources||null,y=!1,x="",T=Vx;if(c!=null&&(c.unstable_strictMode===!0&&(y=!0),c.identifierPrefix!==void 0&&(x=c.identifierPrefix),c.onRecoverableError!==void 0&&(T=c.onRecoverableError)),o=Hx(o,null,r,1,c??null,y,!1,x,T),r[Br]=o.current,Aa(r),m)for(r=0;r<m.length;r++)c=m[r],y=c._getVersion,y=y(c._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[c,y]:o.mutableSourceEagerHydrationData.push(c,y);return new Gc(o)},fn.render=function(r,o,c){if(!Vc(o))throw Error(n(200));return Yc(null,r,o,!1,c)},fn.unmountComponentAtNode=function(r){if(!Vc(r))throw Error(n(40));return r._reactRootContainer?(ho(function(){Yc(null,null,r,!1,function(){r._reactRootContainer=null,r[Br]=null})}),!0):!1},fn.unstable_batchedUpdates=Af,fn.unstable_renderSubtreeIntoContainer=function(r,o,c,m){if(!Vc(c))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return Yc(r,o,c,!1,m)},fn.version="18.3.1-next-f1338f8080-20240426",fn}var nb;function PC(){if(nb)return Uf.exports;nb=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(),Uf.exports=rM(),Uf.exports}var rb;function sM(){if(rb)return Qc;rb=1;var e=PC();return Qc.createRoot=e.createRoot,Qc.hydrateRoot=e.hydrateRoot,Qc}var oM=sM(),k=Nl();const de=fw(k);function Ht(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n<e.length;n++)(s=Ht(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Gf={exports:{}},Vf={},Yf={exports:{}},Kf={};/**
|
|
41
41
|
* @license React
|
|
42
42
|
* use-sync-external-store-shim.production.js
|
|
43
43
|
*
|
|
@@ -45,7 +45,7 @@ Error generating stack: `+x.message+`
|
|
|
45
45
|
*
|
|
46
46
|
* This source code is licensed under the MIT license found in the
|
|
47
47
|
* LICENSE file in the root directory of this source tree.
|
|
48
|
-
*/var sb;function
|
|
48
|
+
*/var sb;function iM(){if(sb)return Kf;sb=1;var e=Nl();function t(g,v){return g===v&&(g!==0||1/g===1/v)||g!==g&&v!==v}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,i=e.useEffect,a=e.useLayoutEffect,l=e.useDebugValue;function u(g,v){var w=v(),E=s({inst:{value:w,getSnapshot:v}}),b=E[0].inst,S=E[1];return a(function(){b.value=w,b.getSnapshot=v,h(b)&&S({inst:b})},[g,w,v]),i(function(){return h(b)&&S({inst:b}),g(function(){h(b)&&S({inst:b})})},[g]),l(w),w}function h(g){var v=g.getSnapshot;g=g.value;try{var w=v();return!n(g,w)}catch{return!0}}function p(g,v){return v()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return Kf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Kf}var ob;function aM(){return ob||(ob=1,Yf.exports=iM()),Yf.exports}/**
|
|
49
49
|
* @license React
|
|
50
50
|
* use-sync-external-store-shim/with-selector.production.js
|
|
51
51
|
*
|
|
@@ -53,29 +53,29 @@ Error generating stack: `+x.message+`
|
|
|
53
53
|
*
|
|
54
54
|
* This source code is licensed under the MIT license found in the
|
|
55
55
|
* LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/var ib;function l2(){if(ib)return Vf;ib=1;var e=Nl(),t=a2();function n(p,f){return p===f&&(p!==0||1/p===1/f)||p!==p&&f!==f}var s=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,a=e.useRef,l=e.useEffect,u=e.useMemo,h=e.useDebugValue;return Vf.useSyncExternalStoreWithSelector=function(p,f,g,v,w){var E=a(null);if(E.current===null){var b={hasValue:!1,value:null};E.current=b}else b=E.current;E=u(function(){function _(P){if(!N){if(N=!0,C=P,P=v(P),w!==void 0&&b.hasValue){var I=b.value;if(w(I,P))return j=I}return j=P}if(I=j,s(C,P))return I;var F=v(P);return w!==void 0&&w(I,F)?(C=P,I):(C=P,j=F)}var N=!1,C,j,M=g===void 0?null:g;return[function(){return _(f())},M===null?void 0:function(){return _(M())}]},[f,g,v,w]);var S=i(p,E[0],E[1]);return l(function(){b.hasValue=!0,b.value=S},[S]),h(S),S},Vf}var ab;function c2(){return ab||(ab=1,Gf.exports=l2()),Gf.exports}var u2=c2();const d2=fw(u2),f2={},lb=e=>{let t;const n=new Set,s=(f,g)=>{const v=typeof f=="function"?f(t):f;if(!Object.is(v,t)){const w=t;t=g??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(E=>E(t,w))}},i=()=>t,h={setState:s,getState:i,getInitialState:()=>p,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(f2?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},p=t=e(s,i,h);return h},h2=e=>e?lb(e):lb,{useDebugValue:p2}=de,{useSyncExternalStoreWithSelector:m2}=d2,g2=e=>e;function $C(e,t=g2,n){const s=m2(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return p2(s),s}const cb=(e,t)=>{const n=h2(e),s=(i,a=t)=>$C(n,i,a);return Object.assign(s,n),s},y2=(e,t)=>e?cb(e,t):cb;function Lt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,i]of e)if(!Object.is(i,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}var v2={value:()=>{}};function zu(){for(var e=0,t=arguments.length,n={},s;e<t;++e){if(!(s=arguments[e]+"")||s in n||/[\s.]/.test(s))throw new Error("illegal type: "+s);n[s]=[]}return new yu(n)}function yu(e){this._=e}function w2(e,t){return e.trim().split(/^|\s+/).map(function(n){var s="",i=n.indexOf(".");if(i>=0&&(s=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}yu.prototype=zu.prototype={constructor:yu,on:function(e,t){var n=this._,s=w2(e+"",n),i,a=-1,l=s.length;if(arguments.length<2){for(;++a<l;)if((i=(e=s[a]).type)&&(i=x2(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<l;)if(i=(e=s[a]).type)n[i]=ub(n[i],e.name,t);else if(t==null)for(i in n)n[i]=ub(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new yu(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),s=0,i,a;s<i;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],s=0,i=a.length;s<i;++s)a[s].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var s=this._[e],i=0,a=s.length;i<a;++i)s[i].value.apply(t,n)}};function x2(e,t){for(var n=0,s=e.length,i;n<s;++n)if((i=e[n]).name===t)return i.value}function ub(e,t,n){for(var s=0,i=e.length;s<i;++s)if(e[s].name===t){e[s]=v2,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var Mv="http://www.w3.org/1999/xhtml";const db={svg:"http://www.w3.org/2000/svg",xhtml:Mv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Bu(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),db.hasOwnProperty(t)?{space:db[t],local:e}:e}function b2(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Mv&&t.documentElement.namespaceURI===Mv?t.createElement(e):t.createElementNS(n,e)}}function k2(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function LC(e){var t=Bu(e);return(t.local?k2:b2)(t)}function _2(){}function hw(e){return e==null?_2:function(){return this.querySelector(e)}}function S2(e){typeof e!="function"&&(e=hw(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var a=t[i],l=a.length,u=s[i]=new Array(l),h,p,f=0;f<l;++f)(h=a[f])&&(p=e.call(h,h.__data__,f,a))&&("__data__"in h&&(p.__data__=h.__data__),u[f]=p);return new _n(s,this._parents)}function N2(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function E2(){return[]}function qC(e){return e==null?E2:function(){return this.querySelectorAll(e)}}function C2(e){return function(){return N2(e.apply(this,arguments))}}function j2(e){typeof e=="function"?e=C2(e):e=qC(e);for(var t=this._groups,n=t.length,s=[],i=[],a=0;a<n;++a)for(var l=t[a],u=l.length,h,p=0;p<u;++p)(h=l[p])&&(s.push(e.call(h,h.__data__,p,l)),i.push(h));return new _n(s,i)}function DC(e){return function(){return this.matches(e)}}function FC(e){return function(t){return t.matches(e)}}var T2=Array.prototype.find;function R2(e){return function(){return T2.call(this.children,e)}}function A2(){return this.firstElementChild}function M2(e){return this.select(e==null?A2:R2(typeof e=="function"?e:FC(e)))}var I2=Array.prototype.filter;function O2(){return Array.from(this.children)}function P2(e){return function(){return I2.call(this.children,e)}}function $2(e){return this.selectAll(e==null?O2:P2(typeof e=="function"?e:FC(e)))}function L2(e){typeof e!="function"&&(e=DC(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var a=t[i],l=a.length,u=s[i]=[],h,p=0;p<l;++p)(h=a[p])&&e.call(h,h.__data__,p,a)&&u.push(h);return new _n(s,this._parents)}function zC(e){return new Array(e.length)}function q2(){return new _n(this._enter||this._groups.map(zC),this._parents)}function Su(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Su.prototype={constructor:Su,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 D2(e){return function(){return e}}function F2(e,t,n,s,i,a){for(var l=0,u,h=t.length,p=a.length;l<p;++l)(u=t[l])?(u.__data__=a[l],s[l]=u):n[l]=new Su(e,a[l]);for(;l<h;++l)(u=t[l])&&(i[l]=u)}function z2(e,t,n,s,i,a,l){var u,h,p=new Map,f=t.length,g=a.length,v=new Array(f),w;for(u=0;u<f;++u)(h=t[u])&&(v[u]=w=l.call(h,h.__data__,u,t)+"",p.has(w)?i[u]=h:p.set(w,h));for(u=0;u<g;++u)w=l.call(e,a[u],u,a)+"",(h=p.get(w))?(s[u]=h,h.__data__=a[u],p.delete(w)):n[u]=new Su(e,a[u]);for(u=0;u<f;++u)(h=t[u])&&p.get(v[u])===h&&(i[u]=h)}function B2(e){return e.__data__}function U2(e,t){if(!arguments.length)return Array.from(this,B2);var n=t?z2:F2,s=this._parents,i=this._groups;typeof e!="function"&&(e=D2(e));for(var a=i.length,l=new Array(a),u=new Array(a),h=new Array(a),p=0;p<a;++p){var f=s[p],g=i[p],v=g.length,w=W2(e.call(f,f&&f.__data__,p,s)),E=w.length,b=u[p]=new Array(E),S=l[p]=new Array(E),_=h[p]=new Array(v);n(f,g,b,S,_,w,t);for(var N=0,C=0,j,M;N<E;++N)if(j=b[N]){for(N>=C&&(C=N+1);!(M=S[C])&&++C<E;);j._next=M||null}}return l=new _n(l,s),l._enter=u,l._exit=h,l}function W2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function H2(){return new _n(this._exit||this._groups.map(zC),this._parents)}function G2(e,t,n){var s=this.enter(),i=this,a=this.exit();return typeof e=="function"?(s=e(s),s&&(s=s.selection())):s=s.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?a.remove():n(a),s&&i?s.merge(i).order():i}function V2(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,i=n.length,a=s.length,l=Math.min(i,a),u=new Array(i),h=0;h<l;++h)for(var p=n[h],f=s[h],g=p.length,v=u[h]=new Array(g),w,E=0;E<g;++E)(w=p[E]||f[E])&&(v[E]=w);for(;h<i;++h)u[h]=n[h];return new _n(u,this._parents)}function Y2(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var s=e[t],i=s.length-1,a=s[i],l;--i>=0;)(l=s[i])&&(a&&l.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(l,a),a=l);return this}function K2(e){e||(e=X2);function t(g,v){return g&&v?e(g.__data__,v.__data__):!g-!v}for(var n=this._groups,s=n.length,i=new Array(s),a=0;a<s;++a){for(var l=n[a],u=l.length,h=i[a]=new Array(u),p,f=0;f<u;++f)(p=l[f])&&(h[f]=p);h.sort(t)}return new _n(i,this._parents).order()}function X2(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Q2(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Z2(){return Array.from(this)}function J2(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],i=0,a=s.length;i<a;++i){var l=s[i];if(l)return l}return null}function eM(){let e=0;for(const t of this)++e;return e}function tM(){return!this.node()}function nM(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var i=t[n],a=0,l=i.length,u;a<l;++a)(u=i[a])&&e.call(u,u.__data__,a,i);return this}function rM(e){return function(){this.removeAttribute(e)}}function sM(e){return function(){this.removeAttributeNS(e.space,e.local)}}function oM(e,t){return function(){this.setAttribute(e,t)}}function iM(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function aM(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function lM(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function cM(e,t){var n=Bu(e);if(arguments.length<2){var s=this.node();return n.local?s.getAttributeNS(n.space,n.local):s.getAttribute(n)}return this.each((t==null?n.local?sM:rM:typeof t=="function"?n.local?lM:aM:n.local?iM:oM)(n,t))}function BC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function uM(e){return function(){this.style.removeProperty(e)}}function dM(e,t,n){return function(){this.style.setProperty(e,t,n)}}function fM(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function hM(e,t,n){return arguments.length>1?this.each((t==null?uM:typeof t=="function"?fM:dM)(e,t,n??"")):Bi(this.node(),e)}function Bi(e,t){return e.style.getPropertyValue(t)||BC(e).getComputedStyle(e,null).getPropertyValue(t)}function pM(e){return function(){delete this[e]}}function mM(e,t){return function(){this[e]=t}}function gM(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function yM(e,t){return arguments.length>1?this.each((t==null?pM:typeof t=="function"?gM:mM)(e,t)):this.node()[e]}function UC(e){return e.trim().split(/^|\s+/)}function pw(e){return e.classList||new WC(e)}function WC(e){this._node=e,this._names=UC(e.getAttribute("class")||"")}WC.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 HC(e,t){for(var n=pw(e),s=-1,i=t.length;++s<i;)n.add(t[s])}function GC(e,t){for(var n=pw(e),s=-1,i=t.length;++s<i;)n.remove(t[s])}function vM(e){return function(){HC(this,e)}}function wM(e){return function(){GC(this,e)}}function xM(e,t){return function(){(t.apply(this,arguments)?HC:GC)(this,e)}}function bM(e,t){var n=UC(e+"");if(arguments.length<2){for(var s=pw(this.node()),i=-1,a=n.length;++i<a;)if(!s.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?xM:t?vM:wM)(n,t))}function kM(){this.textContent=""}function _M(e){return function(){this.textContent=e}}function SM(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function NM(e){return arguments.length?this.each(e==null?kM:(typeof e=="function"?SM:_M)(e)):this.node().textContent}function EM(){this.innerHTML=""}function CM(e){return function(){this.innerHTML=e}}function jM(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function TM(e){return arguments.length?this.each(e==null?EM:(typeof e=="function"?jM:CM)(e)):this.node().innerHTML}function RM(){this.nextSibling&&this.parentNode.appendChild(this)}function AM(){return this.each(RM)}function MM(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function IM(){return this.each(MM)}function OM(e){var t=typeof e=="function"?e:LC(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function PM(){return null}function $M(e,t){var n=typeof e=="function"?e:LC(e),s=t==null?PM:typeof t=="function"?t:hw(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function LM(){var e=this.parentNode;e&&e.removeChild(this)}function qM(){return this.each(LM)}function DM(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function FM(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function zM(e){return this.select(e?FM:DM)}function BM(e){return arguments.length?this.property("__data__",e):this.node().__data__}function UM(e){return function(t){e.call(this,t,this.__data__)}}function WM(e){return e.trim().split(/^|\s+/).map(function(t){var n="",s=t.indexOf(".");return s>=0&&(n=t.slice(s+1),t=t.slice(0,s)),{type:t,name:n}})}function HM(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++s]=a;++s?t.length=s:delete this.__on}}}function GM(e,t,n){return function(){var s=this.__on,i,a=UM(t);if(s){for(var l=0,u=s.length;l<u;++l)if((i=s[l]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},s?s.push(i):this.__on=[i]}}function VM(e,t,n){var s=WM(e+""),i,a=s.length,l;if(arguments.length<2){var u=this.node().__on;if(u){for(var h=0,p=u.length,f;h<p;++h)for(i=0,f=u[h];i<a;++i)if((l=s[i]).type===f.type&&l.name===f.name)return f.value}return}for(u=t?GM:HM,i=0;i<a;++i)this.each(u(s[i],t,n));return this}function VC(e,t,n){var s=BC(e),i=s.CustomEvent;typeof i=="function"?i=new i(t,n):(i=s.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function YM(e,t){return function(){return VC(this,e,t)}}function KM(e,t){return function(){return VC(this,e,t.apply(this,arguments))}}function XM(e,t){return this.each((typeof t=="function"?KM:YM)(e,t))}function*QM(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],i=0,a=s.length,l;i<a;++i)(l=s[i])&&(yield l)}var YC=[null];function _n(e,t){this._groups=e,this._parents=t}function El(){return new _n([[document.documentElement]],YC)}function ZM(){return this}_n.prototype=El.prototype={constructor:_n,select:S2,selectAll:j2,selectChild:M2,selectChildren:$2,filter:L2,data:U2,enter:q2,exit:H2,join:G2,merge:V2,selection:ZM,order:Y2,sort:K2,call:Q2,nodes:Z2,node:J2,size:eM,empty:tM,each:nM,attr:cM,style:hM,property:yM,classed:bM,text:NM,html:TM,raise:AM,lower:IM,append:OM,insert:$M,remove:qM,clone:zM,datum:BM,on:VM,dispatch:XM,[Symbol.iterator]:QM};function qn(e){return typeof e=="string"?new _n([[document.querySelector(e)]],[document.documentElement]):new _n([[e]],YC)}function JM(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ir(e,t){if(e=JM(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var s=n.createSVGPoint();return s.x=e.clientX,s.y=e.clientY,s=s.matrixTransform(t.getScreenCTM().inverse()),[s.x,s.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const eI={passive:!1},fl={capture:!0,passive:!1};function Xf(e){e.stopImmediatePropagation()}function $i(e){e.preventDefault(),e.stopImmediatePropagation()}function KC(e){var t=e.document.documentElement,n=qn(e).on("dragstart.drag",$i,fl);"onselectstart"in t?n.on("selectstart.drag",$i,fl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function XC(e,t){var n=e.document.documentElement,s=qn(e).on("dragstart.drag",null);t&&(s.on("click.drag",$i,fl),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in n?s.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Zc=e=>()=>e;function Iv(e,{sourceEvent:t,subject:n,target:s,identifier:i,active:a,x:l,y:u,dx:h,dy:p,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:f}})}Iv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function tI(e){return!e.ctrlKey&&!e.button}function nI(){return this.parentNode}function rI(e,t){return t??{x:e.x,y:e.y}}function sI(){return navigator.maxTouchPoints||"ontouchstart"in this}function oI(){var e=tI,t=nI,n=rI,s=sI,i={},a=zu("start","drag","end"),l=0,u,h,p,f,g=0;function v(j){j.on("mousedown.drag",w).filter(s).on("touchstart.drag",S).on("touchmove.drag",_,eI).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(j,M){if(!(f||!e.call(this,j,M))){var P=C(this,t.call(this,j,M),j,M,"mouse");P&&(qn(j.view).on("mousemove.drag",E,fl).on("mouseup.drag",b,fl),KC(j.view),Xf(j),p=!1,u=j.clientX,h=j.clientY,P("start",j))}}function E(j){if($i(j),!p){var M=j.clientX-u,P=j.clientY-h;p=M*M+P*P>g}i.mouse("drag",j)}function b(j){qn(j.view).on("mousemove.drag mouseup.drag",null),XC(j.view,p),$i(j),i.mouse("end",j)}function S(j,M){if(e.call(this,j,M)){var P=j.changedTouches,I=t.call(this,j,M),F=P.length,O,A;for(O=0;O<F;++O)(A=C(this,I,j,M,P[O].identifier,P[O]))&&(Xf(j),A("start",j,P[O]))}}function _(j){var M=j.changedTouches,P=M.length,I,F;for(I=0;I<P;++I)(F=i[M[I].identifier])&&($i(j),F("drag",j,M[I]))}function N(j){var M=j.changedTouches,P=M.length,I,F;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),I=0;I<P;++I)(F=i[M[I].identifier])&&(Xf(j),F("end",j,M[I]))}function C(j,M,P,I,F,O){var A=a.copy(),L=ir(O||P,M),H,X,R;if((R=n.call(j,new Iv("beforestart",{sourceEvent:P,target:v,identifier:F,active:l,x:L[0],y:L[1],dx:0,dy:0,dispatch:A}),I))!=null)return H=R.x-L[0]||0,X=R.y-L[1]||0,function K(G,ne,Q){var W=L,ee;switch(G){case"start":i[F]=K,ee=l++;break;case"end":delete i[F],--l;case"drag":L=ir(Q||ne,M),ee=l;break}A.call(G,j,new Iv(G,{sourceEvent:ne,subject:R,target:v,identifier:F,active:ee,x:L[0]+H,y:L[1]+X,dx:L[0]-W[0],dy:L[1]-W[1],dispatch:A}),I)}}return v.filter=function(j){return arguments.length?(e=typeof j=="function"?j:Zc(!!j),v):e},v.container=function(j){return arguments.length?(t=typeof j=="function"?j:Zc(j),v):t},v.subject=function(j){return arguments.length?(n=typeof j=="function"?j:Zc(j),v):n},v.touchable=function(j){return arguments.length?(s=typeof j=="function"?j:Zc(!!j),v):s},v.on=function(){var j=a.on.apply(a,arguments);return j===a?v:j},v.clickDistance=function(j){return arguments.length?(g=(j=+j)*j,v):Math.sqrt(g)},v}function mw(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function QC(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function Cl(){}var hl=.7,Nu=1/hl,Li="\\s*([+-]?\\d+)\\s*",pl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Cr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",iI=/^#([0-9a-f]{3,8})$/,aI=new RegExp(`^rgb\\(${Li},${Li},${Li}\\)$`),lI=new RegExp(`^rgb\\(${Cr},${Cr},${Cr}\\)$`),cI=new RegExp(`^rgba\\(${Li},${Li},${Li},${pl}\\)$`),uI=new RegExp(`^rgba\\(${Cr},${Cr},${Cr},${pl}\\)$`),dI=new RegExp(`^hsl\\(${pl},${Cr},${Cr}\\)$`),fI=new RegExp(`^hsla\\(${pl},${Cr},${Cr},${pl}\\)$`),fb={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};mw(Cl,ml,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:hb,formatHex:hb,formatHex8:hI,formatHsl:pI,formatRgb:pb,toString:pb});function hb(){return this.rgb().formatHex()}function hI(){return this.rgb().formatHex8()}function pI(){return ZC(this).formatHsl()}function pb(){return this.rgb().formatRgb()}function ml(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=iI.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?mb(t):n===3?new hn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Jc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Jc(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=aI.exec(e))?new hn(t[1],t[2],t[3],1):(t=lI.exec(e))?new hn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=cI.exec(e))?Jc(t[1],t[2],t[3],t[4]):(t=uI.exec(e))?Jc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=dI.exec(e))?vb(t[1],t[2]/100,t[3]/100,1):(t=fI.exec(e))?vb(t[1],t[2]/100,t[3]/100,t[4]):fb.hasOwnProperty(e)?mb(fb[e]):e==="transparent"?new hn(NaN,NaN,NaN,0):null}function mb(e){return new hn(e>>16&255,e>>8&255,e&255,1)}function Jc(e,t,n,s){return s<=0&&(e=t=n=NaN),new hn(e,t,n,s)}function mI(e){return e instanceof Cl||(e=ml(e)),e?(e=e.rgb(),new hn(e.r,e.g,e.b,e.opacity)):new hn}function Ov(e,t,n,s){return arguments.length===1?mI(e):new hn(e,t,n,s??1)}function hn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}mw(hn,Ov,QC(Cl,{brighter(e){return e=e==null?Nu:Math.pow(Nu,e),new hn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?hl:Math.pow(hl,e),new hn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new hn(ko(this.r),ko(this.g),ko(this.b),Eu(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:gb,formatHex:gb,formatHex8:gI,formatRgb:yb,toString:yb}));function gb(){return`#${xo(this.r)}${xo(this.g)}${xo(this.b)}`}function gI(){return`#${xo(this.r)}${xo(this.g)}${xo(this.b)}${xo((isNaN(this.opacity)?1:this.opacity)*255)}`}function yb(){const e=Eu(this.opacity);return`${e===1?"rgb(":"rgba("}${ko(this.r)}, ${ko(this.g)}, ${ko(this.b)}${e===1?")":`, ${e})`}`}function Eu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ko(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function xo(e){return e=ko(e),(e<16?"0":"")+e.toString(16)}function vb(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ar(e,t,n,s)}function ZC(e){if(e instanceof ar)return new ar(e.h,e.s,e.l,e.opacity);if(e instanceof Cl||(e=ml(e)),!e)return new ar;if(e instanceof ar)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,i=Math.min(t,n,s),a=Math.max(t,n,s),l=NaN,u=a-i,h=(a+i)/2;return u?(t===a?l=(n-s)/u+(n<s)*6:n===a?l=(s-t)/u+2:l=(t-n)/u+4,u/=h<.5?a+i:2-a-i,l*=60):u=h>0&&h<1?0:l,new ar(l,u,h,e.opacity)}function yI(e,t,n,s){return arguments.length===1?ZC(e):new ar(e,t,n,s??1)}function ar(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}mw(ar,yI,QC(Cl,{brighter(e){return e=e==null?Nu:Math.pow(Nu,e),new ar(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?hl:Math.pow(hl,e),new ar(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,s=n+(n<.5?n:1-n)*t,i=2*n-s;return new hn(Qf(e>=240?e-240:e+120,i,s),Qf(e,i,s),Qf(e<120?e+240:e-120,i,s),this.opacity)},clamp(){return new ar(wb(this.h),eu(this.s),eu(this.l),Eu(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=Eu(this.opacity);return`${e===1?"hsl(":"hsla("}${wb(this.h)}, ${eu(this.s)*100}%, ${eu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function wb(e){return e=(e||0)%360,e<0?e+360:e}function eu(e){return Math.max(0,Math.min(1,e||0))}function Qf(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const JC=e=>()=>e;function vI(e,t){return function(n){return e+n*t}}function wI(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function xI(e){return(e=+e)==1?ej:function(t,n){return n-t?wI(t,n,e):JC(isNaN(t)?n:t)}}function ej(e,t){var n=t-e;return n?vI(e,n):JC(isNaN(e)?t:e)}const xb=(function e(t){var n=xI(t);function s(i,a){var l=n((i=Ov(i)).r,(a=Ov(a)).r),u=n(i.g,a.g),h=n(i.b,a.b),p=ej(i.opacity,a.opacity);return function(f){return i.r=l(f),i.g=u(f),i.b=h(f),i.opacity=p(f),i+""}}return s.gamma=e,s})(1);function Rs(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Pv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Zf=new RegExp(Pv.source,"g");function bI(e){return function(){return e}}function kI(e){return function(t){return e(t)+""}}function _I(e,t){var n=Pv.lastIndex=Zf.lastIndex=0,s,i,a,l=-1,u=[],h=[];for(e=e+"",t=t+"";(s=Pv.exec(e))&&(i=Zf.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),u[l]?u[l]+=a:u[++l]=a),(s=s[0])===(i=i[0])?u[l]?u[l]+=i:u[++l]=i:(u[++l]=null,h.push({i:l,x:Rs(s,i)})),n=Zf.lastIndex;return n<t.length&&(a=t.slice(n),u[l]?u[l]+=a:u[++l]=a),u.length<2?h[0]?kI(h[0].x):bI(t):(t=h.length,function(p){for(var f=0,g;f<t;++f)u[(g=h[f]).i]=g.x(p);return u.join("")})}var bb=180/Math.PI,$v={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function tj(e,t,n,s,i,a){var l,u,h;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(h=e*n+t*s)&&(n-=e*h,s-=t*h),(u=Math.sqrt(n*n+s*s))&&(n/=u,s/=u,h/=u),e*s<t*n&&(e=-e,t=-t,h=-h,l=-l),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*bb,skewX:Math.atan(h)*bb,scaleX:l,scaleY:u}}var tu;function SI(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?$v:tj(t.a,t.b,t.c,t.d,t.e,t.f)}function NI(e){return e==null||(tu||(tu=document.createElementNS("http://www.w3.org/2000/svg","g")),tu.setAttribute("transform",e),!(e=tu.transform.baseVal.consolidate()))?$v:(e=e.matrix,tj(e.a,e.b,e.c,e.d,e.e,e.f))}function nj(e,t,n,s){function i(p){return p.length?p.pop()+" ":""}function a(p,f,g,v,w,E){if(p!==g||f!==v){var b=w.push("translate(",null,t,null,n);E.push({i:b-4,x:Rs(p,g)},{i:b-2,x:Rs(f,v)})}else(g||v)&&w.push("translate("+g+t+v+n)}function l(p,f,g,v){p!==f?(p-f>180?f+=360:f-p>180&&(p+=360),v.push({i:g.push(i(g)+"rotate(",null,s)-2,x:Rs(p,f)})):f&&g.push(i(g)+"rotate("+f+s)}function u(p,f,g,v){p!==f?v.push({i:g.push(i(g)+"skewX(",null,s)-2,x:Rs(p,f)}):f&&g.push(i(g)+"skewX("+f+s)}function h(p,f,g,v,w,E){if(p!==g||f!==v){var b=w.push(i(w)+"scale(",null,",",null,")");E.push({i:b-4,x:Rs(p,g)},{i:b-2,x:Rs(f,v)})}else(g!==1||v!==1)&&w.push(i(w)+"scale("+g+","+v+")")}return function(p,f){var g=[],v=[];return p=e(p),f=e(f),a(p.translateX,p.translateY,f.translateX,f.translateY,g,v),l(p.rotate,f.rotate,g,v),u(p.skewX,f.skewX,g,v),h(p.scaleX,p.scaleY,f.scaleX,f.scaleY,g,v),p=f=null,function(w){for(var E=-1,b=v.length,S;++E<b;)g[(S=v[E]).i]=S.x(w);return g.join("")}}}var EI=nj(SI,"px, ","px)","deg)"),CI=nj(NI,", ",")",")"),jI=1e-12;function kb(e){return((e=Math.exp(e))+1/e)/2}function TI(e){return((e=Math.exp(e))-1/e)/2}function RI(e){return((e=Math.exp(2*e))-1)/(e+1)}const AI=(function e(t,n,s){function i(a,l){var u=a[0],h=a[1],p=a[2],f=l[0],g=l[1],v=l[2],w=f-u,E=g-h,b=w*w+E*E,S,_;if(b<jI)_=Math.log(v/p)/t,S=function(I){return[u+I*w,h+I*E,p*Math.exp(t*I*_)]};else{var N=Math.sqrt(b),C=(v*v-p*p+s*b)/(2*p*n*N),j=(v*v-p*p-s*b)/(2*v*n*N),M=Math.log(Math.sqrt(C*C+1)-C),P=Math.log(Math.sqrt(j*j+1)-j);_=(P-M)/t,S=function(I){var F=I*_,O=kb(M),A=p/(n*N)*(O*RI(t*F+M)-TI(M));return[u+A*w,h+A*E,p*O/kb(t*F+M)]}}return S.duration=_*1e3*t/Math.SQRT2,S}return i.rho=function(a){var l=Math.max(.001,+a),u=l*l,h=u*u;return e(l,u,h)},i})(Math.SQRT2,2,4);var Ui=0,ol=0,Xa=0,rj=1e3,Cu,il,ju=0,So=0,Uu=0,gl=typeof performance=="object"&&performance.now?performance:Date,sj=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function gw(){return So||(sj(MI),So=gl.now()+Uu)}function MI(){So=0}function Tu(){this._call=this._time=this._next=null}Tu.prototype=oj.prototype={constructor:Tu,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?gw():+n)+(t==null?0:+t),!this._next&&il!==this&&(il?il._next=this:Cu=this,il=this),this._call=e,this._time=n,Lv()},stop:function(){this._call&&(this._call=null,this._time=1/0,Lv())}};function oj(e,t,n){var s=new Tu;return s.restart(e,t,n),s}function II(){gw(),++Ui;for(var e=Cu,t;e;)(t=So-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ui}function _b(){So=(ju=gl.now())+Uu,Ui=ol=0;try{II()}finally{Ui=0,PI(),So=0}}function OI(){var e=gl.now(),t=e-ju;t>rj&&(Uu-=t,ju=e)}function PI(){for(var e,t=Cu,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Cu=n);il=e,Lv(s)}function Lv(e){if(!Ui){ol&&(ol=clearTimeout(ol));var t=e-So;t>24?(e<1/0&&(ol=setTimeout(_b,e-gl.now()-Uu)),Xa&&(Xa=clearInterval(Xa))):(Xa||(ju=gl.now(),Xa=setInterval(OI,rj)),Ui=1,sj(_b))}}function Sb(e,t,n){var s=new Tu;return t=t==null?0:+t,s.restart(i=>{s.stop(),e(i+t)},t,n),s}var $I=zu("start","end","cancel","interrupt"),LI=[],ij=0,Nb=1,qv=2,vu=3,Eb=4,Dv=5,wu=6;function Wu(e,t,n,s,i,a){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;qI(e,n,{name:t,index:s,group:i,on:$I,tween:LI,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:ij})}function yw(e,t){var n=fr(e,t);if(n.state>ij)throw new Error("too late; already scheduled");return n}function jr(e,t){var n=fr(e,t);if(n.state>vu)throw new Error("too late; already running");return n}function fr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function qI(e,t,n){var s=e.__transition,i;s[t]=n,n.timer=oj(a,0,n.time);function a(p){n.state=Nb,n.timer.restart(l,n.delay,n.time),n.delay<=p&&l(p-n.delay)}function l(p){var f,g,v,w;if(n.state!==Nb)return h();for(f in s)if(w=s[f],w.name===n.name){if(w.state===vu)return Sb(l);w.state===Eb?(w.state=wu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete s[f]):+f<t&&(w.state=wu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete s[f])}if(Sb(function(){n.state===vu&&(n.state=Eb,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=qv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===qv){for(n.state=vu,i=new Array(v=n.tween.length),f=0,g=-1;f<v;++f)(w=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(i[++g]=w);i.length=g+1}}function u(p){for(var f=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(h),n.state=Dv,1),g=-1,v=i.length;++g<v;)i[g].call(e,f);n.state===Dv&&(n.on.call("end",e,e.__data__,n.index,n.group),h())}function h(){n.state=wu,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function xu(e,t){var n=e.__transition,s,i,a=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((s=n[l]).name!==t){a=!1;continue}i=s.state>qv&&s.state<Dv,s.state=wu,s.timer.stop(),s.on.call(i?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[l]}a&&delete e.__transition}}function DI(e){return this.each(function(){xu(this,e)})}function FI(e,t){var n,s;return function(){var i=jr(this,e),a=i.tween;if(a!==n){s=n=a;for(var l=0,u=s.length;l<u;++l)if(s[l].name===t){s=s.slice(),s.splice(l,1);break}}i.tween=s}}function zI(e,t,n){var s,i;if(typeof n!="function")throw new Error;return function(){var a=jr(this,e),l=a.tween;if(l!==s){i=(s=l).slice();for(var u={name:t,value:n},h=0,p=i.length;h<p;++h)if(i[h].name===t){i[h]=u;break}h===p&&i.push(u)}a.tween=i}}function BI(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=fr(this.node(),n).tween,i=0,a=s.length,l;i<a;++i)if((l=s[i]).name===e)return l.value;return null}return this.each((t==null?FI:zI)(n,e,t))}function vw(e,t,n){var s=e._id;return e.each(function(){var i=jr(this,s);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return fr(i,s).value[t]}}function aj(e,t){var n;return(typeof t=="number"?Rs:t instanceof ml?xb:(n=ml(t))?(t=n,xb):_I)(e,t)}function UI(e){return function(){this.removeAttribute(e)}}function WI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function HI(e,t,n){var s,i=n+"",a;return function(){var l=this.getAttribute(e);return l===i?null:l===s?a:a=t(s=l,n)}}function GI(e,t,n){var s,i=n+"",a;return function(){var l=this.getAttributeNS(e.space,e.local);return l===i?null:l===s?a:a=t(s=l,n)}}function VI(e,t,n){var s,i,a;return function(){var l,u=n(this),h;return u==null?void this.removeAttribute(e):(l=this.getAttribute(e),h=u+"",l===h?null:l===s&&h===i?a:(i=h,a=t(s=l,u)))}}function YI(e,t,n){var s,i,a;return function(){var l,u=n(this),h;return u==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),h=u+"",l===h?null:l===s&&h===i?a:(i=h,a=t(s=l,u)))}}function KI(e,t){var n=Bu(e),s=n==="transform"?CI:aj;return this.attrTween(e,typeof t=="function"?(n.local?YI:VI)(n,s,vw(this,"attr."+e,t)):t==null?(n.local?WI:UI)(n):(n.local?GI:HI)(n,s,t))}function XI(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function QI(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function ZI(e,t){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&QI(e,a)),n}return i._value=t,i}function JI(e,t){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&XI(e,a)),n}return i._value=t,i}function eO(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var s=Bu(e);return this.tween(n,(s.local?ZI:JI)(s,t))}function tO(e,t){return function(){yw(this,e).delay=+t.apply(this,arguments)}}function nO(e,t){return t=+t,function(){yw(this,e).delay=t}}function rO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?tO:nO)(t,e)):fr(this.node(),t).delay}function sO(e,t){return function(){jr(this,e).duration=+t.apply(this,arguments)}}function oO(e,t){return t=+t,function(){jr(this,e).duration=t}}function iO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?sO:oO)(t,e)):fr(this.node(),t).duration}function aO(e,t){if(typeof t!="function")throw new Error;return function(){jr(this,e).ease=t}}function lO(e){var t=this._id;return arguments.length?this.each(aO(t,e)):fr(this.node(),t).ease}function cO(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;jr(this,e).ease=n}}function uO(e){if(typeof e!="function")throw new Error;return this.each(cO(this._id,e))}function dO(e){typeof e!="function"&&(e=DC(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var a=t[i],l=a.length,u=s[i]=[],h,p=0;p<l;++p)(h=a[p])&&e.call(h,h.__data__,p,a)&&u.push(h);return new Jr(s,this._parents,this._name,this._id)}function fO(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,i=n.length,a=Math.min(s,i),l=new Array(s),u=0;u<a;++u)for(var h=t[u],p=n[u],f=h.length,g=l[u]=new Array(f),v,w=0;w<f;++w)(v=h[w]||p[w])&&(g[w]=v);for(;u<s;++u)l[u]=t[u];return new Jr(l,this._parents,this._name,this._id)}function hO(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function pO(e,t,n){var s,i,a=hO(t)?yw:jr;return function(){var l=a(this,e),u=l.on;u!==s&&(i=(s=u).copy()).on(t,n),l.on=i}}function mO(e,t){var n=this._id;return arguments.length<2?fr(this.node(),n).on.on(e):this.each(pO(n,e,t))}function gO(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function yO(){return this.on("end.remove",gO(this._id))}function vO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=hw(e));for(var s=this._groups,i=s.length,a=new Array(i),l=0;l<i;++l)for(var u=s[l],h=u.length,p=a[l]=new Array(h),f,g,v=0;v<h;++v)(f=u[v])&&(g=e.call(f,f.__data__,v,u))&&("__data__"in f&&(g.__data__=f.__data__),p[v]=g,Wu(p[v],t,n,v,p,fr(f,n)));return new Jr(a,this._parents,t,n)}function wO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=qC(e));for(var s=this._groups,i=s.length,a=[],l=[],u=0;u<i;++u)for(var h=s[u],p=h.length,f,g=0;g<p;++g)if(f=h[g]){for(var v=e.call(f,f.__data__,g,h),w,E=fr(f,n),b=0,S=v.length;b<S;++b)(w=v[b])&&Wu(w,t,n,b,v,E);a.push(v),l.push(f)}return new Jr(a,l,t,n)}var xO=El.prototype.constructor;function bO(){return new xO(this._groups,this._parents)}function kO(e,t){var n,s,i;return function(){var a=Bi(this,e),l=(this.style.removeProperty(e),Bi(this,e));return a===l?null:a===n&&l===s?i:i=t(n=a,s=l)}}function lj(e){return function(){this.style.removeProperty(e)}}function _O(e,t,n){var s,i=n+"",a;return function(){var l=Bi(this,e);return l===i?null:l===s?a:a=t(s=l,n)}}function SO(e,t,n){var s,i,a;return function(){var l=Bi(this,e),u=n(this),h=u+"";return u==null&&(h=u=(this.style.removeProperty(e),Bi(this,e))),l===h?null:l===s&&h===i?a:(i=h,a=t(s=l,u))}}function NO(e,t){var n,s,i,a="style."+t,l="end."+a,u;return function(){var h=jr(this,e),p=h.on,f=h.value[a]==null?u||(u=lj(t)):void 0;(p!==n||i!==f)&&(s=(n=p).copy()).on(l,i=f),h.on=s}}function EO(e,t,n){var s=(e+="")=="transform"?EI:aj;return t==null?this.styleTween(e,kO(e,s)).on("end.style."+e,lj(e)):typeof t=="function"?this.styleTween(e,SO(e,s,vw(this,"style."+e,t))).each(NO(this._id,e)):this.styleTween(e,_O(e,s,t),n).on("end.style."+e,null)}function CO(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function jO(e,t,n){var s,i;function a(){var l=t.apply(this,arguments);return l!==i&&(s=(i=l)&&CO(e,l,n)),s}return a._value=t,a}function TO(e,t,n){var s="style."+(e+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(t==null)return this.tween(s,null);if(typeof t!="function")throw new Error;return this.tween(s,jO(e,t,n??""))}function RO(e){return function(){this.textContent=e}}function AO(e){return function(){var t=e(this);this.textContent=t??""}}function MO(e){return this.tween("text",typeof e=="function"?AO(vw(this,"text",e)):RO(e==null?"":e+""))}function IO(e){return function(t){this.textContent=e.call(this,t)}}function OO(e){var t,n;function s(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&IO(i)),t}return s._value=e,s}function PO(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,OO(e))}function $O(){for(var e=this._name,t=this._id,n=cj(),s=this._groups,i=s.length,a=0;a<i;++a)for(var l=s[a],u=l.length,h,p=0;p<u;++p)if(h=l[p]){var f=fr(h,t);Wu(h,e,n,p,l,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Jr(s,this._parents,e,n)}function LO(){var e,t,n=this,s=n._id,i=n.size();return new Promise(function(a,l){var u={value:l},h={value:function(){--i===0&&a()}};n.each(function(){var p=jr(this,s),f=p.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(h)),p.on=t}),i===0&&a()})}var qO=0;function Jr(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function cj(){return++qO}var Xr=El.prototype;Jr.prototype={constructor:Jr,select:vO,selectAll:wO,selectChild:Xr.selectChild,selectChildren:Xr.selectChildren,filter:dO,merge:fO,selection:bO,transition:$O,call:Xr.call,nodes:Xr.nodes,node:Xr.node,size:Xr.size,empty:Xr.empty,each:Xr.each,on:mO,attr:KI,attrTween:eO,style:EO,styleTween:TO,text:MO,textTween:PO,remove:yO,tween:BI,delay:rO,duration:iO,ease:lO,easeVarying:uO,end:LO,[Symbol.iterator]:Xr[Symbol.iterator]};function DO(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var FO={time:null,delay:0,duration:250,ease:DO};function zO(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function BO(e){var t,n;e instanceof Jr?(t=e._id,e=e._name):(t=cj(),(n=FO).time=gw(),e=e==null?null:e+"");for(var s=this._groups,i=s.length,a=0;a<i;++a)for(var l=s[a],u=l.length,h,p=0;p<u;++p)(h=l[p])&&Wu(h,e,t,p,l,n||zO(h,t));return new Jr(s,this._parents,e,t)}El.prototype.interrupt=DI;El.prototype.transition=BO;const nu=e=>()=>e;function UO(e,{sourceEvent:t,target:n,transform:s,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:i}})}function Qr(e,t,n){this.k=e,this.x=t,this.y=n}Qr.prototype={constructor:Qr,scale:function(e){return e===1?this:new Qr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Qr(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 Zr=new Qr(1,0,0);Qr.prototype;function Jf(e){e.stopImmediatePropagation()}function Qa(e){e.preventDefault(),e.stopImmediatePropagation()}function WO(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function HO(){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 Cb(){return this.__zoom||Zr}function GO(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function VO(){return navigator.maxTouchPoints||"ontouchstart"in this}function YO(e,t,n){var s=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i),l>a?(a+l)/2:Math.min(0,a)||Math.max(0,l))}function uj(){var e=WO,t=HO,n=YO,s=GO,i=VO,a=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,h=AI,p=zu("start","zoom","end"),f,g,v,w=500,E=150,b=0,S=10;function _(R){R.property("__zoom",Cb).on("wheel.zoom",F,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",L).on("touchmove.zoom",H).on("touchend.zoom touchcancel.zoom",X).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(R,K,G,ne){var Q=R.selection?R.selection():R;Q.property("__zoom",Cb),R!==Q?M(R,K,G,ne):Q.interrupt().each(function(){P(this,arguments).event(ne).start().zoom(null,typeof K=="function"?K.apply(this,arguments):K).end()})},_.scaleBy=function(R,K,G,ne){_.scaleTo(R,function(){var Q=this.__zoom.k,W=typeof K=="function"?K.apply(this,arguments):K;return Q*W},G,ne)},_.scaleTo=function(R,K,G,ne){_.transform(R,function(){var Q=t.apply(this,arguments),W=this.__zoom,ee=G==null?j(Q):typeof G=="function"?G.apply(this,arguments):G,$=W.invert(ee),Y=typeof K=="function"?K.apply(this,arguments):K;return n(C(N(W,Y),ee,$),Q,l)},G,ne)},_.translateBy=function(R,K,G,ne){_.transform(R,function(){return n(this.__zoom.translate(typeof K=="function"?K.apply(this,arguments):K,typeof G=="function"?G.apply(this,arguments):G),t.apply(this,arguments),l)},null,ne)},_.translateTo=function(R,K,G,ne,Q){_.transform(R,function(){var W=t.apply(this,arguments),ee=this.__zoom,$=ne==null?j(W):typeof ne=="function"?ne.apply(this,arguments):ne;return n(Zr.translate($[0],$[1]).scale(ee.k).translate(typeof K=="function"?-K.apply(this,arguments):-K,typeof G=="function"?-G.apply(this,arguments):-G),W,l)},ne,Q)};function N(R,K){return K=Math.max(a[0],Math.min(a[1],K)),K===R.k?R:new Qr(K,R.x,R.y)}function C(R,K,G){var ne=K[0]-G[0]*R.k,Q=K[1]-G[1]*R.k;return ne===R.x&&Q===R.y?R:new Qr(R.k,ne,Q)}function j(R){return[(+R[0][0]+ +R[1][0])/2,(+R[0][1]+ +R[1][1])/2]}function M(R,K,G,ne){R.on("start.zoom",function(){P(this,arguments).event(ne).start()}).on("interrupt.zoom end.zoom",function(){P(this,arguments).event(ne).end()}).tween("zoom",function(){var Q=this,W=arguments,ee=P(Q,W).event(ne),$=t.apply(Q,W),Y=G==null?j($):typeof G=="function"?G.apply(Q,W):G,ue=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),z=Q.__zoom,D=typeof K=="function"?K.apply(Q,W):K,J=h(z.invert(Y).concat(ue/z.k),D.invert(Y).concat(ue/D.k));return function(V){if(V===1)V=D;else{var ae=J(V),he=ue/ae[2];V=new Qr(he,Y[0]-ae[0]*he,Y[1]-ae[1]*he)}ee.zoom(null,V)}})}function P(R,K,G){return!G&&R.__zooming||new I(R,K)}function I(R,K){this.that=R,this.args=K,this.active=0,this.sourceEvent=null,this.extent=t.apply(R,K),this.taps=0}I.prototype={event:function(R){return R&&(this.sourceEvent=R),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(R,K){return this.mouse&&R!=="mouse"&&(this.mouse[1]=K.invert(this.mouse[0])),this.touch0&&R!=="touch"&&(this.touch0[1]=K.invert(this.touch0[0])),this.touch1&&R!=="touch"&&(this.touch1[1]=K.invert(this.touch1[0])),this.that.__zoom=K,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(R){var K=qn(this.that).datum();p.call(R,this.that,new UO(R,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:p}),K)}};function F(R,...K){if(!e.apply(this,arguments))return;var G=P(this,K).event(R),ne=this.__zoom,Q=Math.max(a[0],Math.min(a[1],ne.k*Math.pow(2,s.apply(this,arguments)))),W=ir(R);if(G.wheel)(G.mouse[0][0]!==W[0]||G.mouse[0][1]!==W[1])&&(G.mouse[1]=ne.invert(G.mouse[0]=W)),clearTimeout(G.wheel);else{if(ne.k===Q)return;G.mouse=[W,ne.invert(W)],xu(this),G.start()}Qa(R),G.wheel=setTimeout(ee,E),G.zoom("mouse",n(C(N(ne,Q),G.mouse[0],G.mouse[1]),G.extent,l));function ee(){G.wheel=null,G.end()}}function O(R,...K){if(v||!e.apply(this,arguments))return;var G=R.currentTarget,ne=P(this,K,!0).event(R),Q=qn(R.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",ue,!0),W=ir(R,G),ee=R.clientX,$=R.clientY;KC(R.view),Jf(R),ne.mouse=[W,this.__zoom.invert(W)],xu(this),ne.start();function Y(z){if(Qa(z),!ne.moved){var D=z.clientX-ee,J=z.clientY-$;ne.moved=D*D+J*J>b}ne.event(z).zoom("mouse",n(C(ne.that.__zoom,ne.mouse[0]=ir(z,G),ne.mouse[1]),ne.extent,l))}function ue(z){Q.on("mousemove.zoom mouseup.zoom",null),XC(z.view,ne.moved),Qa(z),ne.event(z).end()}}function A(R,...K){if(e.apply(this,arguments)){var G=this.__zoom,ne=ir(R.changedTouches?R.changedTouches[0]:R,this),Q=G.invert(ne),W=G.k*(R.shiftKey?.5:2),ee=n(C(N(G,W),ne,Q),t.apply(this,K),l);Qa(R),u>0?qn(this).transition().duration(u).call(M,ee,ne,R):qn(this).call(_.transform,ee,ne,R)}}function L(R,...K){if(e.apply(this,arguments)){var G=R.touches,ne=G.length,Q=P(this,K,R.changedTouches.length===ne).event(R),W,ee,$,Y;for(Jf(R),ee=0;ee<ne;++ee)$=G[ee],Y=ir($,this),Y=[Y,this.__zoom.invert(Y),$.identifier],Q.touch0?!Q.touch1&&Q.touch0[2]!==Y[2]&&(Q.touch1=Y,Q.taps=0):(Q.touch0=Y,W=!0,Q.taps=1+!!f);f&&(f=clearTimeout(f)),W&&(Q.taps<2&&(g=Y[0],f=setTimeout(function(){f=null},w)),xu(this),Q.start())}}function H(R,...K){if(this.__zooming){var G=P(this,K).event(R),ne=R.changedTouches,Q=ne.length,W,ee,$,Y;for(Qa(R),W=0;W<Q;++W)ee=ne[W],$=ir(ee,this),G.touch0&&G.touch0[2]===ee.identifier?G.touch0[0]=$:G.touch1&&G.touch1[2]===ee.identifier&&(G.touch1[0]=$);if(ee=G.that.__zoom,G.touch1){var ue=G.touch0[0],z=G.touch0[1],D=G.touch1[0],J=G.touch1[1],V=(V=D[0]-ue[0])*V+(V=D[1]-ue[1])*V,ae=(ae=J[0]-z[0])*ae+(ae=J[1]-z[1])*ae;ee=N(ee,Math.sqrt(V/ae)),$=[(ue[0]+D[0])/2,(ue[1]+D[1])/2],Y=[(z[0]+J[0])/2,(z[1]+J[1])/2]}else if(G.touch0)$=G.touch0[0],Y=G.touch0[1];else return;G.zoom("touch",n(C(ee,$,Y),G.extent,l))}}function X(R,...K){if(this.__zooming){var G=P(this,K).event(R),ne=R.changedTouches,Q=ne.length,W,ee;for(Jf(R),v&&clearTimeout(v),v=setTimeout(function(){v=null},w),W=0;W<Q;++W)ee=ne[W],G.touch0&&G.touch0[2]===ee.identifier?delete G.touch0:G.touch1&&G.touch1[2]===ee.identifier&&delete G.touch1;if(G.touch1&&!G.touch0&&(G.touch0=G.touch1,delete G.touch1),G.touch0)G.touch0[1]=this.__zoom.invert(G.touch0[0]);else if(G.end(),G.taps===2&&(ee=ir(ee,this),Math.hypot(g[0]-ee[0],g[1]-ee[1])<S)){var $=qn(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return _.wheelDelta=function(R){return arguments.length?(s=typeof R=="function"?R:nu(+R),_):s},_.filter=function(R){return arguments.length?(e=typeof R=="function"?R:nu(!!R),_):e},_.touchable=function(R){return arguments.length?(i=typeof R=="function"?R:nu(!!R),_):i},_.extent=function(R){return arguments.length?(t=typeof R=="function"?R:nu([[+R[0][0],+R[0][1]],[+R[1][0],+R[1][1]]]),_):t},_.scaleExtent=function(R){return arguments.length?(a[0]=+R[0],a[1]=+R[1],_):[a[0],a[1]]},_.translateExtent=function(R){return arguments.length?(l[0][0]=+R[0][0],l[1][0]=+R[1][0],l[0][1]=+R[0][1],l[1][1]=+R[1][1],_):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},_.constrain=function(R){return arguments.length?(n=R,_):n},_.duration=function(R){return arguments.length?(u=+R,_):u},_.interpolate=function(R){return arguments.length?(h=R,_):h},_.on=function(){var R=p.on.apply(p,arguments);return R===p?_:R},_.clickDistance=function(R){return arguments.length?(b=(R=+R)*R,_):Math.sqrt(b)},_.tapDistance=function(R){return arguments.length?(S=+R,_):S},_}var ww=PC();const Hu=k.createContext(null),KO=Hu.Provider,es={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},dj=es.error001();function at(e,t){const n=k.useContext(Hu);if(n===null)throw new Error(dj);return $C(n,e,t)}const Mt=()=>{const e=k.useContext(Hu);if(e===null)throw new Error(dj);return k.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},XO=e=>e.userSelectionActive?"none":"all";function xw({position:e,children:t,className:n,style:s,...i}){const a=at(XO),l=`${e}`.split("-");return de.createElement("div",{className:Ht(["react-flow__panel",n,...l]),style:{...s,pointerEvents:a},...i},t)}function QO({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:de.createElement(xw,{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"},de.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const ZO=({x:e,y:t,label:n,labelStyle:s={},labelShowBg:i=!0,labelBgStyle:a={},labelBgPadding:l=[2,4],labelBgBorderRadius:u=2,children:h,className:p,...f})=>{const g=k.useRef(null),[v,w]=k.useState({x:0,y:0,width:0,height:0}),E=Ht(["react-flow__edge-textwrapper",p]);return k.useEffect(()=>{if(g.current){const b=g.current.getBBox();w({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),typeof n>"u"||!n?null:de.createElement("g",{transform:`translate(${e-v.width/2} ${t-v.height/2})`,className:E,visibility:v.width?"visible":"hidden",...f},i&&de.createElement("rect",{width:v.width+2*l[0],x:-l[0],y:-l[1],height:v.height+2*l[1],className:"react-flow__edge-textbg",style:a,rx:u,ry:u}),de.createElement("text",{className:"react-flow__edge-text",y:v.height/2,dy:"0.3em",ref:g,style:s},n),h)};var JO=k.memo(ZO);const bw=e=>({width:e.offsetWidth,height:e.offsetHeight}),Wi=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),kw=(e={x:0,y:0},t)=>({x:Wi(e.x,t[0][0],t[1][0]),y:Wi(e.y,t[0][1],t[1][1])}),jb=(e,t,n)=>e<t?Wi(Math.abs(e-t),1,50)/50:e>n?-Wi(Math.abs(e-n),1,50)/50:0,fj=(e,t)=>{const n=jb(e.x,35,t.width-35)*20,s=jb(e.y,35,t.height-35)*20;return[n,s]},hj=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},pj=(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)}),yl=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),mj=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Tb=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),eP=(e,t)=>mj(pj(yl(e),yl(t))),Fv=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},tP=e=>Dn(e.width)&&Dn(e.height)&&Dn(e.x)&&Dn(e.y),Dn=e=>!isNaN(e)&&isFinite(e),Ct=Symbol.for("internals"),gj=["Enter"," ","Escape"],nP=(e,t)=>{},rP=e=>"nativeEvent"in e;function zv(e){var i,a;const t=rP(e)?e.nativeEvent:e,n=((a=(i=t.composedPath)==null?void 0:i.call(t))==null?void 0:a[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const yj=e=>"clientX"in e,Is=(e,t)=>{var a,l;const n=yj(e),s=n?e.clientX:(a=e.touches)==null?void 0:a[0].clientX,i=n?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},Ru=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},jl=({id:e,path:t,labelX:n,labelY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:v,interactionWidth:w=20})=>de.createElement(de.Fragment,null,de.createElement("path",{id:e,style:f,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:g,markerStart:v}),w&&de.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),i&&Dn(n)&&Dn(s)?de.createElement(JO,{x:n,y:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p}):null);jl.displayName="BaseEdge";function Za(e,t,n){return n===void 0?n:s=>{const i=t().edges.find(a=>a.id===e);i&&n(s,{...i})}}function vj({sourceX:e,sourceY:t,targetX:n,targetY:s}){const i=Math.abs(n-e)/2,a=n<e?n+i:n-i,l=Math.abs(s-t)/2,u=s<t?s+l:s-l;return[a,u,i,l]}function wj({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:u}){const h=e*.125+i*.375+l*.375+n*.125,p=t*.125+a*.375+u*.375+s*.125,f=Math.abs(h-e),g=Math.abs(p-t);return[h,p,f,g]}var No;(function(e){e.Strict="strict",e.Loose="loose"})(No||(No={}));var bo;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(bo||(bo={}));var vl;(function(e){e.Partial="partial",e.Full="full"})(vl||(vl={}));var Ms;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ms||(Ms={}));var Au;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Au||(Au={}));var De;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(De||(De={}));function Rb({pos:e,x1:t,y1:n,x2:s,y2:i}){return e===De.Left||e===De.Right?[.5*(t+s),n]:[t,.5*(n+i)]}function xj({sourceX:e,sourceY:t,sourcePosition:n=De.Bottom,targetX:s,targetY:i,targetPosition:a=De.Top}){const[l,u]=Rb({pos:n,x1:e,y1:t,x2:s,y2:i}),[h,p]=Rb({pos:a,x1:s,y1:i,x2:e,y2:t}),[f,g,v,w]=wj({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:l,sourceControlY:u,targetControlX:h,targetControlY:p});return[`M${e},${t} C${l},${u} ${h},${p} ${s},${i}`,f,g,v,w]}const _w=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=De.Bottom,targetPosition:a=De.Top,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:E,interactionWidth:b})=>{const[S,_,N]=xj({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:a});return de.createElement(jl,{path:S,labelX:_,labelY:N,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:E,interactionWidth:b})});_w.displayName="SimpleBezierEdge";const Ab={[De.Left]:{x:-1,y:0},[De.Right]:{x:1,y:0},[De.Top]:{x:0,y:-1},[De.Bottom]:{x:0,y:1}},sP=({source:e,sourcePosition:t=De.Bottom,target:n})=>t===De.Left||t===De.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Mb=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function oP({source:e,sourcePosition:t=De.Bottom,target:n,targetPosition:s=De.Top,center:i,offset:a}){const l=Ab[t],u=Ab[s],h={x:e.x+l.x*a,y:e.y+l.y*a},p={x:n.x+u.x*a,y:n.y+u.y*a},f=sP({source:h,sourcePosition:t,target:p}),g=f.x!==0?"x":"y",v=f[g];let w=[],E,b;const S={x:0,y:0},_={x:0,y:0},[N,C,j,M]=vj({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[g]*u[g]===-1){E=i.x??N,b=i.y??C;const I=[{x:E,y:h.y},{x:E,y:p.y}],F=[{x:h.x,y:b},{x:p.x,y:b}];l[g]===v?w=g==="x"?I:F:w=g==="x"?F:I}else{const I=[{x:h.x,y:p.y}],F=[{x:p.x,y:h.y}];if(g==="x"?w=l.x===v?F:I:w=l.y===v?I:F,t===s){const X=Math.abs(e[g]-n[g]);if(X<=a){const R=Math.min(a-1,a-X);l[g]===v?S[g]=(h[g]>e[g]?-1:1)*R:_[g]=(p[g]>n[g]?-1:1)*R}}if(t!==s){const X=g==="x"?"y":"x",R=l[g]===u[X],K=h[X]>p[X],G=h[X]<p[X];(l[g]===1&&(!R&&K||R&&G)||l[g]!==1&&(!R&&G||R&&K))&&(w=g==="x"?I:F)}const O={x:h.x+S.x,y:h.y+S.y},A={x:p.x+_.x,y:p.y+_.y},L=Math.max(Math.abs(O.x-w[0].x),Math.abs(A.x-w[0].x)),H=Math.max(Math.abs(O.y-w[0].y),Math.abs(A.y-w[0].y));L>=H?(E=(O.x+A.x)/2,b=w[0].y):(E=w[0].x,b=(O.y+A.y)/2)}return[[e,{x:h.x+S.x,y:h.y+S.y},...w,{x:p.x+_.x,y:p.y+_.y},n],E,b,j,M]}function iP(e,t,n,s){const i=Math.min(Mb(e,t)/2,Mb(t,n)/2,s),{x:a,y:l}=t;if(e.x===a&&a===n.x||e.y===l&&l===n.y)return`L${a} ${l}`;if(e.y===l){const p=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${a+i*p},${l}Q ${a},${l} ${a},${l+i*f}`}const u=e.x<n.x?1:-1,h=e.y<n.y?-1:1;return`L ${a},${l+i*h}Q ${a},${l} ${a+i*u},${l}`}function Bv({sourceX:e,sourceY:t,sourcePosition:n=De.Bottom,targetX:s,targetY:i,targetPosition:a=De.Top,borderRadius:l=5,centerX:u,centerY:h,offset:p=20}){const[f,g,v,w,E]=oP({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:i},targetPosition:a,center:{x:u,y:h},offset:p});return[f.reduce((S,_,N)=>{let C="";return N>0&&N<f.length-1?C=iP(f[N-1],_,f[N+1],l):C=`${N===0?"M":"L"}${_.x} ${_.y}`,S+=C,S},""),g,v,w,E]}const Gu=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,sourcePosition:g=De.Bottom,targetPosition:v=De.Top,markerEnd:w,markerStart:E,pathOptions:b,interactionWidth:S})=>{const[_,N,C]=Bv({sourceX:e,sourceY:t,sourcePosition:g,targetX:n,targetY:s,targetPosition:v,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset});return de.createElement(jl,{path:_,labelX:N,labelY:C,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:w,markerStart:E,interactionWidth:S})});Gu.displayName="SmoothStepEdge";const Sw=k.memo(e=>{var t;return de.createElement(Gu,{...e,pathOptions:k.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});Sw.displayName="StepEdge";function aP({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[i,a,l,u]=vj({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,i,a,l,u]}const Nw=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:v,interactionWidth:w})=>{const[E,b,S]=aP({sourceX:e,sourceY:t,targetX:n,targetY:s});return de.createElement(jl,{path:E,labelX:b,labelY:S,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:v,interactionWidth:w})});Nw.displayName="StraightEdge";function ru(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ib({pos:e,x1:t,y1:n,x2:s,y2:i,c:a}){switch(e){case De.Left:return[t-ru(t-s,a),n];case De.Right:return[t+ru(s-t,a),n];case De.Top:return[t,n-ru(n-i,a)];case De.Bottom:return[t,n+ru(i-n,a)]}}function bj({sourceX:e,sourceY:t,sourcePosition:n=De.Bottom,targetX:s,targetY:i,targetPosition:a=De.Top,curvature:l=.25}){const[u,h]=Ib({pos:n,x1:e,y1:t,x2:s,y2:i,c:l}),[p,f]=Ib({pos:a,x1:s,y1:i,x2:e,y2:t,c:l}),[g,v,w,E]=wj({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:u,sourceControlY:h,targetControlX:p,targetControlY:f});return[`M${e},${t} C${u},${h} ${p},${f} ${s},${i}`,g,v,w,E]}const Mu=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=De.Bottom,targetPosition:a=De.Top,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:E,pathOptions:b,interactionWidth:S})=>{const[_,N,C]=bj({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:a,curvature:b==null?void 0:b.curvature});return de.createElement(jl,{path:_,labelX:N,labelY:C,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:E,interactionWidth:S})});Mu.displayName="BezierEdge";const Ew=k.createContext(null),lP=Ew.Provider;Ew.Consumer;const cP=()=>k.useContext(Ew),uP=e=>"id"in e&&"source"in e&&"target"in e,dP=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,Uv=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,fP=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),hP=(e,t)=>{if(!e.source||!e.target)return t;let n;return uP(e)?n={...e}:n={...e,id:dP(e)},fP(n,t)?t:t.concat(n)},Wv=({x:e,y:t},[n,s,i],a,[l,u])=>{const h={x:(e-n)/i,y:(t-s)/i};return a?{x:l*Math.round(h.x/l),y:u*Math.round(h.y/u)}:h},kj=({x:e,y:t},[n,s,i])=>({x:e*i+n,y:t*i+s}),_o=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],s=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-s};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-s}:i}},Vu=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,i)=>{const{x:a,y:l}=_o(i,t).positionAbsolute;return pj(s,yl({x:a,y:l,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return mj(n)},_j=(e,t,[n,s,i]=[0,0,1],a=!1,l=!1,u=[0,0])=>{const h={x:(t.x-n)/i,y:(t.y-s)/i,width:t.width/i,height:t.height/i},p=[];return e.forEach(f=>{const{width:g,height:v,selectable:w=!0,hidden:E=!1}=f;if(l&&!w||E)return!1;const{positionAbsolute:b}=_o(f,u),S={x:b.x,y:b.y,width:g||0,height:v||0},_=Fv(h,S),N=typeof g>"u"||typeof v>"u"||g===null||v===null,C=a&&_>0,j=(g||0)*(v||0);(N||C||_>=j||f.dragging)&&p.push(f)}),p},Sj=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},Nj=(e,t,n,s,i,a=.1)=>{const l=t/(e.width*(1+a)),u=n/(e.height*(1+a)),h=Math.min(l,u),p=Wi(h,s,i),f=e.x+e.width/2,g=e.y+e.height/2,v=t/2-f*p,w=n/2-g*p;return{x:v,y:w,zoom:p}},yo=(e,t=0)=>e.transition().duration(t);function Ob(e,t,n,s){return(t[n]||[]).reduce((i,a)=>{var l,u;return`${e.id}-${a.id}-${n}`!==s&&i.push({id:a.id||null,type:n,nodeId:e.id,x:(((l=e.positionAbsolute)==null?void 0:l.x)??0)+a.x+a.width/2,y:(((u=e.positionAbsolute)==null?void 0:u.y)??0)+a.y+a.height/2}),i},[])}function pP(e,t,n,s,i,a){const{x:l,y:u}=Is(e),p=t.elementsFromPoint(l,u).find(E=>E.classList.contains("react-flow__handle"));if(p){const E=p.getAttribute("data-nodeid");if(E){const b=Cw(void 0,p),S=p.getAttribute("data-handleid"),_=a({nodeId:E,id:S,type:b});if(_){const N=i.find(C=>C.nodeId===E&&C.type===b&&C.id===S);return{handle:{id:S,type:b,nodeId:E,x:(N==null?void 0:N.x)||n.x,y:(N==null?void 0:N.y)||n.y},validHandleResult:_}}}}let f=[],g=1/0;if(i.forEach(E=>{const b=Math.sqrt((E.x-n.x)**2+(E.y-n.y)**2);if(b<=s){const S=a(E);b<=g&&(b<g?f=[{handle:E,validHandleResult:S}]:b===g&&f.push({handle:E,validHandleResult:S}),g=b)}}),!f.length)return{handle:null,validHandleResult:Ej()};if(f.length===1)return f[0];const v=f.some(({validHandleResult:E})=>E.isValid),w=f.some(({handle:E})=>E.type==="target");return f.find(({handle:E,validHandleResult:b})=>w?E.type==="target":v?b.isValid:!0)||f[0]}const mP={source:null,target:null,sourceHandle:null,targetHandle:null},Ej=()=>({handleDomNode:null,isValid:!1,connection:mP,endHandle:null});function Cj(e,t,n,s,i,a,l){const u=i==="target",h=l.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),p={...Ej(),handleDomNode:h};if(h){const f=Cw(void 0,h),g=h.getAttribute("data-nodeid"),v=h.getAttribute("data-handleid"),w=h.classList.contains("connectable"),E=h.classList.contains("connectableend"),b={source:u?g:n,sourceHandle:u?v:s,target:u?n:g,targetHandle:u?s:v};p.connection=b,w&&E&&(t===No.Strict?u&&f==="source"||!u&&f==="target":g!==n||v!==s)&&(p.endHandle={nodeId:g,handleId:v,type:f},p.isValid=a(b))}return p}function gP({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((i,a)=>{if(a[Ct]){const{handleBounds:l}=a[Ct];let u=[],h=[];l&&(u=Ob(a,l,"source",`${t}-${n}-${s}`),h=Ob(a,l,"target",`${t}-${n}-${s}`)),i.push(...u,...h)}return i},[])}function Cw(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function eh(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function yP(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function jj({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:i,getState:a,setState:l,isValidConnection:u,edgeUpdaterType:h,onReconnectEnd:p}){const f=hj(e.target),{connectionMode:g,domNode:v,autoPanOnConnect:w,connectionRadius:E,onConnectStart:b,panBy:S,getNodes:_,cancelConnection:N}=a();let C=0,j;const{x:M,y:P}=Is(e),I=f==null?void 0:f.elementFromPoint(M,P),F=Cw(h,I),O=v==null?void 0:v.getBoundingClientRect();if(!O||!F)return;let A,L=Is(e,O),H=!1,X=null,R=!1,K=null;const G=gP({nodes:_(),nodeId:n,handleId:t,handleType:F}),ne=()=>{if(!w)return;const[ee,$]=fj(L,O);S({x:ee,y:$}),C=requestAnimationFrame(ne)};l({connectionPosition:L,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:F,connectionStartHandle:{nodeId:n,handleId:t,type:F},connectionEndHandle:null}),b==null||b(e,{nodeId:n,handleId:t,handleType:F});function Q(ee){const{transform:$}=a();L=Is(ee,O);const{handle:Y,validHandleResult:ue}=pP(ee,f,Wv(L,$,!1,[1,1]),E,G,z=>Cj(z,g,n,t,i?"target":"source",u,f));if(j=Y,H||(ne(),H=!0),K=ue.handleDomNode,X=ue.connection,R=ue.isValid,l({connectionPosition:j&&R?kj({x:j.x,y:j.y},$):L,connectionStatus:yP(!!j,R),connectionEndHandle:ue.endHandle}),!j&&!R&&!K)return eh(A);X.source!==X.target&&K&&(eh(A),A=K,K.classList.add("connecting","react-flow__handle-connecting"),K.classList.toggle("valid",R),K.classList.toggle("react-flow__handle-valid",R))}function W(ee){var $,Y;(j||K)&&X&&R&&(s==null||s(X)),(Y=($=a()).onConnectEnd)==null||Y.call($,ee),h&&(p==null||p(ee)),eh(A),N(),cancelAnimationFrame(C),H=!1,R=!1,X=null,K=null,f.removeEventListener("mousemove",Q),f.removeEventListener("mouseup",W),f.removeEventListener("touchmove",Q),f.removeEventListener("touchend",W)}f.addEventListener("mousemove",Q),f.addEventListener("mouseup",W),f.addEventListener("touchmove",Q),f.addEventListener("touchend",W)}const Pb=()=>!0,vP=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),wP=(e,t,n)=>s=>{const{connectionStartHandle:i,connectionEndHandle:a,connectionClickStartHandle:l}=s;return{connecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n||(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n,clickConnecting:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n}},Tj=k.forwardRef(({type:e="source",position:t=De.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:l,onConnect:u,children:h,className:p,onMouseDown:f,onTouchStart:g,...v},w)=>{var O,A;const E=l||null,b=e==="target",S=Mt(),_=cP(),{connectOnClick:N,noPanClassName:C}=at(vP,Lt),{connecting:j,clickConnecting:M}=at(wP(_,E,e),Lt);_||(A=(O=S.getState()).onError)==null||A.call(O,"010",es.error010());const P=L=>{const{defaultEdgeOptions:H,onConnect:X,hasDefaultEdges:R}=S.getState(),K={...H,...L};if(R){const{edges:G,setEdges:ne}=S.getState();ne(hP(K,G))}X==null||X(K),u==null||u(K)},I=L=>{if(!_)return;const H=yj(L);i&&(H&&L.button===0||!H)&&jj({event:L,handleId:E,nodeId:_,onConnect:P,isTarget:b,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||Pb}),H?f==null||f(L):g==null||g(L)},F=L=>{const{onClickConnectStart:H,onClickConnectEnd:X,connectionClickStartHandle:R,connectionMode:K,isValidConnection:G}=S.getState();if(!_||!R&&!i)return;if(!R){H==null||H(L,{nodeId:_,handleId:E,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:_,type:e,handleId:E}});return}const ne=hj(L.target),Q=n||G||Pb,{connection:W,isValid:ee}=Cj({nodeId:_,id:E,type:e},K,R.nodeId,R.handleId||null,R.type,Q,ne);ee&&P(W),X==null||X(L),S.setState({connectionClickStartHandle:null})};return de.createElement("div",{"data-handleid":E,"data-nodeid":_,"data-handlepos":t,"data-id":`${_}-${E}-${e}`,className:Ht(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",C,p,{source:!b,target:b,connectable:s,connectablestart:i,connectableend:a,connecting:M,connectionindicator:s&&(i&&!j||a&&j)}]),onMouseDown:I,onTouchStart:I,onClick:N?F:void 0,ref:w,...v},h)});Tj.displayName="Handle";var Hi=k.memo(Tj);const Rj=({data:e,isConnectable:t,targetPosition:n=De.Top,sourcePosition:s=De.Bottom})=>de.createElement(de.Fragment,null,de.createElement(Hi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,de.createElement(Hi,{type:"source",position:s,isConnectable:t}));Rj.displayName="DefaultNode";var Hv=k.memo(Rj);const Aj=({data:e,isConnectable:t,sourcePosition:n=De.Bottom})=>de.createElement(de.Fragment,null,e==null?void 0:e.label,de.createElement(Hi,{type:"source",position:n,isConnectable:t}));Aj.displayName="InputNode";var Mj=k.memo(Aj);const Ij=({data:e,isConnectable:t,targetPosition:n=De.Top})=>de.createElement(de.Fragment,null,de.createElement(Hi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);Ij.displayName="OutputNode";var Oj=k.memo(Ij);const jw=()=>null;jw.displayName="GroupNode";const xP=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),su=e=>e.id;function bP(e,t){return Lt(e.selectedNodes.map(su),t.selectedNodes.map(su))&&Lt(e.selectedEdges.map(su),t.selectedEdges.map(su))}const Pj=k.memo(({onSelectionChange:e})=>{const t=Mt(),{selectedNodes:n,selectedEdges:s}=at(xP,bP);return k.useEffect(()=>{const i={nodes:n,edges:s};e==null||e(i),t.getState().onSelectionChange.forEach(a=>a(i))},[n,s,e]),null});Pj.displayName="SelectionListener";const kP=e=>!!e.onSelectionChange;function _P({onSelectionChange:e}){const t=at(kP);return e||t?de.createElement(Pj,{onSelectionChange:e}):null}const SP=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 Ni(e,t){k.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Ze(e,t,n){k.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const NP=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:i,onConnectStart:a,onConnectEnd:l,onClickConnectStart:u,onClickConnectEnd:h,nodesDraggable:p,nodesConnectable:f,nodesFocusable:g,edgesFocusable:v,edgesUpdatable:w,elevateNodesOnSelect:E,minZoom:b,maxZoom:S,nodeExtent:_,onNodesChange:N,onEdgesChange:C,elementsSelectable:j,connectionMode:M,snapGrid:P,snapToGrid:I,translateExtent:F,connectOnClick:O,defaultEdgeOptions:A,fitView:L,fitViewOptions:H,onNodesDelete:X,onEdgesDelete:R,onNodeDrag:K,onNodeDragStart:G,onNodeDragStop:ne,onSelectionDrag:Q,onSelectionDragStart:W,onSelectionDragStop:ee,noPanClassName:$,nodeOrigin:Y,rfId:ue,autoPanOnConnect:z,autoPanOnNodeDrag:D,onError:J,connectionRadius:V,isValidConnection:ae,nodeDragThreshold:he})=>{const{setNodes:ye,setEdges:_e,setDefaultNodesAndEdges:Ve,setMinZoom:Be,setMaxZoom:qe,setTranslateExtent:Se,setNodeExtent:ce,reset:be}=at(SP,Lt),ke=Mt();return k.useEffect(()=>{const Ye=s==null?void 0:s.map(dt=>({...dt,...A}));return Ve(n,Ye),()=>{be()}},[]),Ze("defaultEdgeOptions",A,ke.setState),Ze("connectionMode",M,ke.setState),Ze("onConnect",i,ke.setState),Ze("onConnectStart",a,ke.setState),Ze("onConnectEnd",l,ke.setState),Ze("onClickConnectStart",u,ke.setState),Ze("onClickConnectEnd",h,ke.setState),Ze("nodesDraggable",p,ke.setState),Ze("nodesConnectable",f,ke.setState),Ze("nodesFocusable",g,ke.setState),Ze("edgesFocusable",v,ke.setState),Ze("edgesUpdatable",w,ke.setState),Ze("elementsSelectable",j,ke.setState),Ze("elevateNodesOnSelect",E,ke.setState),Ze("snapToGrid",I,ke.setState),Ze("snapGrid",P,ke.setState),Ze("onNodesChange",N,ke.setState),Ze("onEdgesChange",C,ke.setState),Ze("connectOnClick",O,ke.setState),Ze("fitViewOnInit",L,ke.setState),Ze("fitViewOnInitOptions",H,ke.setState),Ze("onNodesDelete",X,ke.setState),Ze("onEdgesDelete",R,ke.setState),Ze("onNodeDrag",K,ke.setState),Ze("onNodeDragStart",G,ke.setState),Ze("onNodeDragStop",ne,ke.setState),Ze("onSelectionDrag",Q,ke.setState),Ze("onSelectionDragStart",W,ke.setState),Ze("onSelectionDragStop",ee,ke.setState),Ze("noPanClassName",$,ke.setState),Ze("nodeOrigin",Y,ke.setState),Ze("rfId",ue,ke.setState),Ze("autoPanOnConnect",z,ke.setState),Ze("autoPanOnNodeDrag",D,ke.setState),Ze("onError",J,ke.setState),Ze("connectionRadius",V,ke.setState),Ze("isValidConnection",ae,ke.setState),Ze("nodeDragThreshold",he,ke.setState),Ni(e,ye),Ni(t,_e),Ni(b,Be),Ni(S,qe),Ni(F,Se),Ni(_,ce),null},$b={display:"none"},EP={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},$j="react-flow__node-desc",Lj="react-flow__edge-desc",CP="react-flow__aria-live",jP=e=>e.ariaLiveMessage;function TP({rfId:e}){const t=at(jP);return de.createElement("div",{id:`${CP}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:EP},t)}function RP({rfId:e,disableKeyboardA11y:t}){return de.createElement(de.Fragment,null,de.createElement("div",{id:`${$j}-${e}`,style:$b},"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."," "),de.createElement("div",{id:`${Lj}-${e}`,style:$b},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&de.createElement(TP,{rfId:e}))}var wl=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=k.useState(!1),i=k.useRef(!1),a=k.useRef(new Set([])),[l,u]=k.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.split("+")),f=p.reduce((g,v)=>g.concat(...v),[]);return[p,f]}return[[],[]]},[e]);return k.useEffect(()=>{const h=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||h;if(e!==null){const f=w=>{if(i.current=w.ctrlKey||w.metaKey||w.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&zv(w))return!1;const b=qb(w.code,u);a.current.add(w[b]),Lb(l,a.current,!1)&&(w.preventDefault(),s(!0))},g=w=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&zv(w))return!1;const b=qb(w.code,u);Lb(l,a.current,!0)?(s(!1),a.current.clear()):a.current.delete(w[b]),w.key==="Meta"&&a.current.clear(),i.current=!1},v=()=>{a.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",f),p==null||p.addEventListener("keyup",g),window.addEventListener("blur",v),()=>{p==null||p.removeEventListener("keydown",f),p==null||p.removeEventListener("keyup",g),window.removeEventListener("blur",v)}}},[e,s]),n};function Lb(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(i=>t.has(i)))}function qb(e,t){return t.includes(e)?"code":"key"}function qj(e,t,n,s){var u,h;const i=e.parentNode||e.parentId;if(!i)return n;const a=t.get(i),l=_o(a,s);return qj(a,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:(((u=a[Ct])==null?void 0:u.z)??0)>(n.z??0)?((h=a[Ct])==null?void 0:h.z)??0:n.z??0},s)}function Dj(e,t,n){e.forEach(s=>{var a;const i=s.parentNode||s.parentId;if(i&&!e.has(i))throw new Error(`Parent node ${i} not found`);if(i||n!=null&&n[s.id]){const{x:l,y:u,z:h}=qj(s,e,{...s.position,z:((a=s[Ct])==null?void 0:a.z)??0},t);s.positionAbsolute={x:l,y:u},s[Ct].z=h,n!=null&&n[s.id]&&(s[Ct].isParent=!0)}})}function th(e,t,n,s){const i=new Map,a={},l=s?1e3:0;return e.forEach(u=>{var w;const h=(Dn(u.zIndex)?u.zIndex:0)+(u.selected?l:0),p=t.get(u.id),f={...u,positionAbsolute:{x:u.position.x,y:u.position.y}},g=u.parentNode||u.parentId;g&&(a[g]=!0);const v=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==u.type;Object.defineProperty(f,Ct,{enumerable:!1,value:{handleBounds:v||(w=p==null?void 0:p[Ct])==null?void 0:w.handleBounds,z:h}}),i.set(u.id,f)}),Dj(i,n,a),i}function Fj(e,t={}){const{getNodes:n,width:s,height:i,minZoom:a,maxZoom:l,d3Zoom:u,d3Selection:h,fitViewOnInitDone:p,fitViewOnInit:f,nodeOrigin:g}=e(),v=t.initial&&!p&&f;if(u&&h&&(v||!t.initial)){const E=n().filter(S=>{var N;const _=t.includeHiddenNodes?S.width&&S.height:!S.hidden;return(N=t.nodes)!=null&&N.length?_&&t.nodes.some(C=>C.id===S.id):_}),b=E.every(S=>S.width&&S.height);if(E.length>0&&b){const S=Vu(E,g),{x:_,y:N,zoom:C}=Nj(S,s,i,t.minZoom??a,t.maxZoom??l,t.padding??.1),j=Zr.translate(_,N).scale(C);return typeof t.duration=="number"&&t.duration>0?u.transform(yo(h,t.duration),j):u.transform(h,j),!0}}return!1}function AP(e,t){return e.forEach(n=>{const s=t.get(n.id);s&&t.set(s.id,{...s,[Ct]:s[Ct],selected:n.selected})}),new Map(t)}function MP(e,t){return t.map(n=>{const s=e.find(i=>i.id===n.id);return s&&(n.selected=s.selected),n})}function ou({changedNodes:e,changedEdges:t,get:n,set:s}){const{nodeInternals:i,edges:a,onNodesChange:l,onEdgesChange:u,hasDefaultNodes:h,hasDefaultEdges:p}=n();e!=null&&e.length&&(h&&s({nodeInternals:AP(e,i)}),l==null||l(e)),t!=null&&t.length&&(p&&s({edges:MP(t,a)}),u==null||u(t))}const Ei=()=>{},IP={zoomIn:Ei,zoomOut:Ei,zoomTo:Ei,getZoom:()=>1,setViewport:Ei,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ei,fitBounds:Ei,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},OP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),PP=()=>{const e=Mt(),{d3Zoom:t,d3Selection:n}=at(OP,Lt);return k.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(yo(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(yo(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,a)=>t.scaleTo(yo(n,a==null?void 0:a.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,a)=>{const[l,u,h]=e.getState().transform,p=Zr.translate(i.x??l,i.y??u).scale(i.zoom??h);t.transform(yo(n,a==null?void 0:a.duration),p)},getViewport:()=>{const[i,a,l]=e.getState().transform;return{x:i,y:a,zoom:l}},fitView:i=>Fj(e.getState,i),setCenter:(i,a,l)=>{const{width:u,height:h,maxZoom:p}=e.getState(),f=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:p,g=u/2-i*f,v=h/2-a*f,w=Zr.translate(g,v).scale(f);t.transform(yo(n,l==null?void 0:l.duration),w)},fitBounds:(i,a)=>{const{width:l,height:u,minZoom:h,maxZoom:p}=e.getState(),{x:f,y:g,zoom:v}=Nj(i,l,u,h,p,(a==null?void 0:a.padding)??.1),w=Zr.translate(f,g).scale(v);t.transform(yo(n,a==null?void 0:a.duration),w)},project:i=>{const{transform:a,snapToGrid:l,snapGrid:u}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Wv(i,a,l,u)},screenToFlowPosition:i=>{const{transform:a,snapToGrid:l,snapGrid:u,domNode:h}=e.getState();if(!h)return i;const{x:p,y:f}=h.getBoundingClientRect(),g={x:i.x-p,y:i.y-f};return Wv(g,a,l,u)},flowToScreenPosition:i=>{const{transform:a,domNode:l}=e.getState();if(!l)return i;const{x:u,y:h}=l.getBoundingClientRect(),p=kj(i,a);return{x:p.x+u,y:p.y+h}},viewportInitialized:!0}:IP,[t,n])};function Tl(){const e=PP(),t=Mt(),n=k.useCallback(()=>t.getState().getNodes().map(b=>({...b})),[]),s=k.useCallback(b=>t.getState().nodeInternals.get(b),[]),i=k.useCallback(()=>{const{edges:b=[]}=t.getState();return b.map(S=>({...S}))},[]),a=k.useCallback(b=>{const{edges:S=[]}=t.getState();return S.find(_=>_.id===b)},[]),l=k.useCallback(b=>{const{getNodes:S,setNodes:_,hasDefaultNodes:N,onNodesChange:C}=t.getState(),j=S(),M=typeof b=="function"?b(j):b;if(N)_(M);else if(C){const P=M.length===0?j.map(I=>({type:"remove",id:I.id})):M.map(I=>({item:I,type:"reset"}));C(P)}},[]),u=k.useCallback(b=>{const{edges:S=[],setEdges:_,hasDefaultEdges:N,onEdgesChange:C}=t.getState(),j=typeof b=="function"?b(S):b;if(N)_(j);else if(C){const M=j.length===0?S.map(P=>({type:"remove",id:P.id})):j.map(P=>({item:P,type:"reset"}));C(M)}},[]),h=k.useCallback(b=>{const S=Array.isArray(b)?b:[b],{getNodes:_,setNodes:N,hasDefaultNodes:C,onNodesChange:j}=t.getState();if(C){const P=[..._(),...S];N(P)}else if(j){const M=S.map(P=>({item:P,type:"add"}));j(M)}},[]),p=k.useCallback(b=>{const S=Array.isArray(b)?b:[b],{edges:_=[],setEdges:N,hasDefaultEdges:C,onEdgesChange:j}=t.getState();if(C)N([..._,...S]);else if(j){const M=S.map(P=>({item:P,type:"add"}));j(M)}},[]),f=k.useCallback(()=>{const{getNodes:b,edges:S=[],transform:_}=t.getState(),[N,C,j]=_;return{nodes:b().map(M=>({...M})),edges:S.map(M=>({...M})),viewport:{x:N,y:C,zoom:j}}},[]),g=k.useCallback(({nodes:b,edges:S})=>{const{nodeInternals:_,getNodes:N,edges:C,hasDefaultNodes:j,hasDefaultEdges:M,onNodesDelete:P,onEdgesDelete:I,onNodesChange:F,onEdgesChange:O}=t.getState(),A=(b||[]).map(K=>K.id),L=(S||[]).map(K=>K.id),H=N().reduce((K,G)=>{const ne=G.parentNode||G.parentId,Q=!A.includes(G.id)&&ne&&K.find(ee=>ee.id===ne);return(typeof G.deletable=="boolean"?G.deletable:!0)&&(A.includes(G.id)||Q)&&K.push(G),K},[]),X=C.filter(K=>typeof K.deletable=="boolean"?K.deletable:!0),R=X.filter(K=>L.includes(K.id));if(H||R){const K=Sj(H,X),G=[...R,...K],ne=G.reduce((Q,W)=>(Q.includes(W.id)||Q.push(W.id),Q),[]);if((M||j)&&(M&&t.setState({edges:C.filter(Q=>!ne.includes(Q.id))}),j&&(H.forEach(Q=>{_.delete(Q.id)}),t.setState({nodeInternals:new Map(_)}))),ne.length>0&&(I==null||I(G),O&&O(ne.map(Q=>({id:Q,type:"remove"})))),H.length>0&&(P==null||P(H),F)){const Q=H.map(W=>({id:W.id,type:"remove"}));F(Q)}}},[]),v=k.useCallback(b=>{const S=tP(b),_=S?null:t.getState().nodeInternals.get(b.id);return!S&&!_?[null,null,S]:[S?b:Tb(_),_,S]},[]),w=k.useCallback((b,S=!0,_)=>{const[N,C,j]=v(b);return N?(_||t.getState().getNodes()).filter(M=>{if(!j&&(M.id===C.id||!M.positionAbsolute))return!1;const P=Tb(M),I=Fv(P,N);return S&&I>0||I>=N.width*N.height}):[]},[]),E=k.useCallback((b,S,_=!0)=>{const[N]=v(b);if(!N)return!1;const C=Fv(N,S);return _&&C>0||C>=N.width*N.height},[]);return k.useMemo(()=>({...e,getNodes:n,getNode:s,getEdges:i,getEdge:a,setNodes:l,setEdges:u,addNodes:h,addEdges:p,toObject:f,deleteElements:g,getIntersectingNodes:w,isNodeIntersecting:E}),[e,n,s,i,a,l,u,h,p,f,g,w,E])}const $P={actInsideInputWithModifier:!1};var LP=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Mt(),{deleteElements:s}=Tl(),i=wl(e,$P),a=wl(t);k.useEffect(()=>{if(i){const{edges:l,getNodes:u}=n.getState(),h=u().filter(f=>f.selected),p=l.filter(f=>f.selected);s({nodes:h,edges:p}),n.setState({nodesSelectionActive:!1})}},[i]),k.useEffect(()=>{n.setState({multiSelectionActive:a})},[a])};function qP(e){const t=Mt();k.useEffect(()=>{let n;const s=()=>{var a,l;if(!e.current)return;const i=bw(e.current);(i.height===0||i.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",es.error004())),t.setState({width:i.width||500,height:i.height||500})};return s(),window.addEventListener("resize",s),e.current&&(n=new ResizeObserver(()=>s()),n.observe(e.current)),()=>{window.removeEventListener("resize",s),n&&e.current&&n.unobserve(e.current)}},[])}const Tw={position:"absolute",width:"100%",height:"100%",top:0,left:0},DP=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,iu=e=>({x:e.x,y:e.y,zoom:e.k}),Ci=(e,t)=>e.target.closest(`.${t}`),Db=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Fb=e=>{const t=e.ctrlKey&&Ru()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},FP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),zP=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:l=!1,panOnScrollSpeed:u=.5,panOnScrollMode:h=bo.Free,zoomOnDoubleClick:p=!0,elementsSelectable:f,panOnDrag:g=!0,defaultViewport:v,translateExtent:w,minZoom:E,maxZoom:b,zoomActivationKeyCode:S,preventScrolling:_=!0,children:N,noWheelClassName:C,noPanClassName:j})=>{const M=k.useRef(),P=Mt(),I=k.useRef(!1),F=k.useRef(!1),O=k.useRef(null),A=k.useRef({x:0,y:0,zoom:0}),{d3Zoom:L,d3Selection:H,d3ZoomHandler:X,userSelectionActive:R}=at(FP,Lt),K=wl(S),G=k.useRef(0),ne=k.useRef(!1),Q=k.useRef();return qP(O),k.useEffect(()=>{if(O.current){const W=O.current.getBoundingClientRect(),ee=uj().scaleExtent([E,b]).translateExtent(w),$=qn(O.current).call(ee),Y=Zr.translate(v.x,v.y).scale(Wi(v.zoom,E,b)),ue=[[0,0],[W.width,W.height]],z=ee.constrain()(Y,ue,w);ee.transform($,z),ee.wheelDelta(Fb),P.setState({d3Zoom:ee,d3Selection:$,d3ZoomHandler:$.on("wheel.zoom"),transform:[z.x,z.y,z.k],domNode:O.current.closest(".react-flow")})}},[]),k.useEffect(()=>{H&&L&&(l&&!K&&!R?H.on("wheel.zoom",W=>{if(Ci(W,C))return!1;W.preventDefault(),W.stopImmediatePropagation();const ee=H.property("__zoom").k||1;if(W.ctrlKey&&a){const ae=ir(W),he=Fb(W),ye=ee*Math.pow(2,he);L.scaleTo(H,ye,ae,W);return}const $=W.deltaMode===1?20:1;let Y=h===bo.Vertical?0:W.deltaX*$,ue=h===bo.Horizontal?0:W.deltaY*$;!Ru()&&W.shiftKey&&h!==bo.Vertical&&(Y=W.deltaY*$,ue=0),L.translateBy(H,-(Y/ee)*u,-(ue/ee)*u,{internal:!0});const z=iu(H.property("__zoom")),{onViewportChangeStart:D,onViewportChange:J,onViewportChangeEnd:V}=P.getState();clearTimeout(Q.current),ne.current||(ne.current=!0,t==null||t(W,z),D==null||D(z)),ne.current&&(e==null||e(W,z),J==null||J(z),Q.current=setTimeout(()=>{n==null||n(W,z),V==null||V(z),ne.current=!1},150))},{passive:!1}):typeof X<"u"&&H.on("wheel.zoom",function(W,ee){if(!_&&W.type==="wheel"&&!W.ctrlKey||Ci(W,C))return null;W.preventDefault(),X.call(this,W,ee)},{passive:!1}))},[R,l,h,H,L,X,K,a,_,C,t,e,n]),k.useEffect(()=>{L&&L.on("start",W=>{var Y,ue;if(!W.sourceEvent||W.sourceEvent.internal)return null;G.current=(Y=W.sourceEvent)==null?void 0:Y.button;const{onViewportChangeStart:ee}=P.getState(),$=iu(W.transform);I.current=!0,A.current=$,((ue=W.sourceEvent)==null?void 0:ue.type)==="mousedown"&&P.setState({paneDragging:!0}),ee==null||ee($),t==null||t(W.sourceEvent,$)})},[L,t]),k.useEffect(()=>{L&&(R&&!I.current?L.on("zoom",null):R||L.on("zoom",W=>{var $;const{onViewportChange:ee}=P.getState();if(P.setState({transform:[W.transform.x,W.transform.y,W.transform.k]}),F.current=!!(s&&Db(g,G.current??0)),(e||ee)&&!(($=W.sourceEvent)!=null&&$.internal)){const Y=iu(W.transform);ee==null||ee(Y),e==null||e(W.sourceEvent,Y)}}))},[R,L,e,g,s]),k.useEffect(()=>{L&&L.on("end",W=>{if(!W.sourceEvent||W.sourceEvent.internal)return null;const{onViewportChangeEnd:ee}=P.getState();if(I.current=!1,P.setState({paneDragging:!1}),s&&Db(g,G.current??0)&&!F.current&&s(W.sourceEvent),F.current=!1,(n||ee)&&DP(A.current,W.transform)){const $=iu(W.transform);A.current=$,clearTimeout(M.current),M.current=setTimeout(()=>{ee==null||ee($),n==null||n(W.sourceEvent,$)},l?150:0)}})},[L,l,g,n,s]),k.useEffect(()=>{L&&L.filter(W=>{const ee=K||i,$=a&&W.ctrlKey;if((g===!0||Array.isArray(g)&&g.includes(1))&&W.button===1&&W.type==="mousedown"&&(Ci(W,"react-flow__node")||Ci(W,"react-flow__edge")))return!0;if(!g&&!ee&&!l&&!p&&!a||R||!p&&W.type==="dblclick"||Ci(W,C)&&W.type==="wheel"||Ci(W,j)&&(W.type!=="wheel"||l&&W.type==="wheel"&&!K)||!a&&W.ctrlKey&&W.type==="wheel"||!ee&&!l&&!$&&W.type==="wheel"||!g&&(W.type==="mousedown"||W.type==="touchstart")||Array.isArray(g)&&!g.includes(W.button)&&W.type==="mousedown")return!1;const Y=Array.isArray(g)&&g.includes(W.button)||!W.button||W.button<=1;return(!W.ctrlKey||W.type==="wheel")&&Y})},[R,L,i,a,l,p,g,f,K]),de.createElement("div",{className:"react-flow__renderer",ref:O,style:Tw},N)},BP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function UP(){const{userSelectionActive:e,userSelectionRect:t}=at(BP,Lt);return e&&t?de.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 zb(e,t){const n=t.parentNode||t.parentId,s=e.find(i=>i.id===n);if(s){const i=t.position.x+t.width-s.width,a=t.position.y+t.height-s.height;if(i>0||a>0||t.position.x<0||t.position.y<0){if(s.style={...s.style},s.style.width=s.style.width??s.width,s.style.height=s.style.height??s.height,i>0&&(s.style.width+=i),a>0&&(s.style.height+=a),t.position.x<0){const l=Math.abs(t.position.x);s.position.x=s.position.x-l,s.style.width+=l,t.position.x=0}if(t.position.y<0){const l=Math.abs(t.position.y);s.position.y=s.position.y-l,s.style.height+=l,t.position.y=0}s.width=s.style.width,s.height=s.style.height}}}function WP(e,t){if(e.some(s=>s.type==="reset"))return e.filter(s=>s.type==="reset").map(s=>s.item);const n=e.filter(s=>s.type==="add").map(s=>s.item);return t.reduce((s,i)=>{const a=e.filter(u=>u.id===i.id);if(a.length===0)return s.push(i),s;const l={...i};for(const u of a)if(u)switch(u.type){case"select":{l.selected=u.selected;break}case"position":{typeof u.position<"u"&&(l.position=u.position),typeof u.positionAbsolute<"u"&&(l.positionAbsolute=u.positionAbsolute),typeof u.dragging<"u"&&(l.dragging=u.dragging),l.expandParent&&zb(s,l);break}case"dimensions":{typeof u.dimensions<"u"&&(l.width=u.dimensions.width,l.height=u.dimensions.height),typeof u.updateStyle<"u"&&(l.style={...l.style||{},...u.dimensions}),typeof u.resizing=="boolean"&&(l.resizing=u.resizing),l.expandParent&&zb(s,l);break}case"remove":return s}return s.push(l),s},n)}function HP(e,t){return WP(e,t)}const As=(e,t)=>({id:e,type:"select",selected:t});function Ii(e,t){return e.reduce((n,s)=>{const i=t.includes(s.id);return!s.selected&&i?(s.selected=!0,n.push(As(s.id,!0))):s.selected&&!i&&(s.selected=!1,n.push(As(s.id,!1))),n},[])}const nh=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},GP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),zj=k.memo(({isSelecting:e,selectionMode:t=vl.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:l,onPaneScroll:u,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:f,children:g})=>{const v=k.useRef(null),w=Mt(),E=k.useRef(0),b=k.useRef(0),S=k.useRef(),{userSelectionActive:_,elementsSelectable:N,dragging:C}=at(GP,Lt),j=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),E.current=0,b.current=0},M=X=>{a==null||a(X),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},P=X=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){X.preventDefault();return}l==null||l(X)},I=u?X=>u(X):void 0,F=X=>{const{resetSelectedElements:R,domNode:K}=w.getState();if(S.current=K==null?void 0:K.getBoundingClientRect(),!N||!e||X.button!==0||X.target!==v.current||!S.current)return;const{x:G,y:ne}=Is(X,S.current);R(),w.setState({userSelectionRect:{width:0,height:0,startX:G,startY:ne,x:G,y:ne}}),s==null||s(X)},O=X=>{const{userSelectionRect:R,nodeInternals:K,edges:G,transform:ne,onNodesChange:Q,onEdgesChange:W,nodeOrigin:ee,getNodes:$}=w.getState();if(!e||!S.current||!R)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const Y=Is(X,S.current),ue=R.startX??0,z=R.startY??0,D={...R,x:Y.x<ue?Y.x:ue,y:Y.y<z?Y.y:z,width:Math.abs(Y.x-ue),height:Math.abs(Y.y-z)},J=$(),V=_j(K,D,ne,t===vl.Partial,!0,ee),ae=Sj(V,G).map(ye=>ye.id),he=V.map(ye=>ye.id);if(E.current!==he.length){E.current=he.length;const ye=Ii(J,he);ye.length&&(Q==null||Q(ye))}if(b.current!==ae.length){b.current=ae.length;const ye=Ii(G,ae);ye.length&&(W==null||W(ye))}w.setState({userSelectionRect:D})},A=X=>{if(X.button!==0)return;const{userSelectionRect:R}=w.getState();!_&&R&&X.target===v.current&&(M==null||M(X)),w.setState({nodesSelectionActive:E.current>0}),j(),i==null||i(X)},L=X=>{_&&(w.setState({nodesSelectionActive:E.current>0}),i==null||i(X)),j()},H=N&&(e||_);return de.createElement("div",{className:Ht(["react-flow__pane",{dragging:C,selection:e}]),onClick:H?void 0:nh(M,v),onContextMenu:nh(P,v),onWheel:nh(I,v),onMouseEnter:H?void 0:h,onMouseDown:H?F:void 0,onMouseMove:H?O:p,onMouseUp:H?A:void 0,onMouseLeave:H?L:f,ref:v,style:Tw},g,de.createElement(UP,null))});zj.displayName="Pane";function Bj(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:Bj(s,t):!1}function Bb(e,t,n){let s=e;do{if(s!=null&&s.matches(t))return!0;if(s===n.current)return!1;s=s.parentElement}while(s);return!1}function VP(e,t,n,s){return Array.from(e.values()).filter(i=>(i.selected||i.id===s)&&(!i.parentNode||i.parentId||!Bj(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var a,l;return{id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((a=i.positionAbsolute)==null?void 0:a.x)??0),y:n.y-(((l=i.positionAbsolute)==null?void 0:l.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode||i.parentId,parentId:i.parentNode||i.parentId,width:i.width,height:i.height,expandParent:i.expandParent}})}function YP(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function Uj(e,t,n,s,i=[0,0],a){const l=YP(e,e.extent||s);let u=l;const h=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(h&&e.width&&e.height){const g=n.get(h),{x:v,y:w}=_o(g,i).positionAbsolute;u=g&&Dn(v)&&Dn(w)&&Dn(g.width)&&Dn(g.height)?[[v+e.width*i[0],w+e.height*i[1]],[v+g.width-e.width+e.width*i[0],w+g.height-e.height+e.height*i[1]]]:u}else a==null||a("005",es.error005()),u=l;else if(e.extent&&h&&e.extent!=="parent"){const g=n.get(h),{x:v,y:w}=_o(g,i).positionAbsolute;u=[[e.extent[0][0]+v,e.extent[0][1]+w],[e.extent[1][0]+v,e.extent[1][1]+w]]}let p={x:0,y:0};if(h){const g=n.get(h);p=_o(g,i).positionAbsolute}const f=u&&u!=="parent"?kw(t,u):t;return{position:{x:f.x-p.x,y:f.y-p.y},positionAbsolute:f}}function rh({nodeId:e,dragItems:t,nodeInternals:n}){const s=t.map(i=>({...n.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?s.find(i=>i.id===e):s[0],s]}const Ub=(e,t,n,s)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const a=Array.from(i),l=t.getBoundingClientRect(),u={x:l.width*s[0],y:l.height*s[1]};return a.map(h=>{const p=h.getBoundingClientRect();return{id:h.getAttribute("data-handleid"),position:h.getAttribute("data-handlepos"),x:(p.left-l.left-u.x)/n,y:(p.top-l.top-u.y)/n,...bw(h)}})};function Ja(e,t,n){return n===void 0?n:s=>{const i=t().nodeInternals.get(e);i&&n(s,{...i})}}function Gv({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:l,nodeInternals:u,onError:h}=t.getState(),p=u.get(e);if(!p){h==null||h("012",es.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&l)&&(a({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var f;return(f=s==null?void 0:s.current)==null?void 0:f.blur()})):i([e])}function KP(){const e=Mt();return k.useCallback(({sourceEvent:n})=>{const{transform:s,snapGrid:i,snapToGrid:a}=e.getState(),l=n.touches?n.touches[0].clientX:n.clientX,u=n.touches?n.touches[0].clientY:n.clientY,h={x:(l-s[0])/s[2],y:(u-s[1])/s[2]};return{xSnapped:a?i[0]*Math.round(h.x/i[0]):h.x,ySnapped:a?i[1]*Math.round(h.y/i[1]):h.y,...h}},[])}function sh(e){return(t,n,s)=>e==null?void 0:e(t,s)}function Wj({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:i,isSelectable:a,selectNodesOnDrag:l}){const u=Mt(),[h,p]=k.useState(!1),f=k.useRef([]),g=k.useRef({x:null,y:null}),v=k.useRef(0),w=k.useRef(null),E=k.useRef({x:0,y:0}),b=k.useRef(null),S=k.useRef(!1),_=k.useRef(!1),N=k.useRef(!1),C=KP();return k.useEffect(()=>{if(e!=null&&e.current){const j=qn(e.current),M=({x:F,y:O})=>{const{nodeInternals:A,onNodeDrag:L,onSelectionDrag:H,updateNodePositions:X,nodeExtent:R,snapGrid:K,snapToGrid:G,nodeOrigin:ne,onError:Q}=u.getState();g.current={x:F,y:O};let W=!1,ee={x:0,y:0,x2:0,y2:0};if(f.current.length>1&&R){const Y=Vu(f.current,ne);ee=yl(Y)}if(f.current=f.current.map(Y=>{const ue={x:F-Y.distance.x,y:O-Y.distance.y};G&&(ue.x=K[0]*Math.round(ue.x/K[0]),ue.y=K[1]*Math.round(ue.y/K[1]));const z=[[R[0][0],R[0][1]],[R[1][0],R[1][1]]];f.current.length>1&&R&&!Y.extent&&(z[0][0]=Y.positionAbsolute.x-ee.x+R[0][0],z[1][0]=Y.positionAbsolute.x+(Y.width??0)-ee.x2+R[1][0],z[0][1]=Y.positionAbsolute.y-ee.y+R[0][1],z[1][1]=Y.positionAbsolute.y+(Y.height??0)-ee.y2+R[1][1]);const D=Uj(Y,ue,A,z,ne,Q);return W=W||Y.position.x!==D.position.x||Y.position.y!==D.position.y,Y.position=D.position,Y.positionAbsolute=D.positionAbsolute,Y}),!W)return;X(f.current,!0,!0),p(!0);const $=i?L:sh(H);if($&&b.current){const[Y,ue]=rh({nodeId:i,dragItems:f.current,nodeInternals:A});$(b.current,Y,ue)}},P=()=>{if(!w.current)return;const[F,O]=fj(E.current,w.current);if(F!==0||O!==0){const{transform:A,panBy:L}=u.getState();g.current.x=(g.current.x??0)-F/A[2],g.current.y=(g.current.y??0)-O/A[2],L({x:F,y:O})&&M(g.current)}v.current=requestAnimationFrame(P)},I=F=>{var ne;const{nodeInternals:O,multiSelectionActive:A,nodesDraggable:L,unselectNodesAndEdges:H,onNodeDragStart:X,onSelectionDragStart:R}=u.getState();_.current=!0;const K=i?X:sh(R);(!l||!a)&&!A&&i&&((ne=O.get(i))!=null&&ne.selected||H()),i&&a&&l&&Gv({id:i,store:u,nodeRef:e});const G=C(F);if(g.current=G,f.current=VP(O,L,G,i),K&&f.current){const[Q,W]=rh({nodeId:i,dragItems:f.current,nodeInternals:O});K(F.sourceEvent,Q,W)}};if(t)j.on(".drag",null);else{const F=oI().on("start",O=>{const{domNode:A,nodeDragThreshold:L}=u.getState();L===0&&I(O),N.current=!1;const H=C(O);g.current=H,w.current=(A==null?void 0:A.getBoundingClientRect())||null,E.current=Is(O.sourceEvent,w.current)}).on("drag",O=>{var X,R;const A=C(O),{autoPanOnNodeDrag:L,nodeDragThreshold:H}=u.getState();if(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1&&(N.current=!0),!N.current){if(!S.current&&_.current&&L&&(S.current=!0,P()),!_.current){const K=A.xSnapped-(((X=g==null?void 0:g.current)==null?void 0:X.x)??0),G=A.ySnapped-(((R=g==null?void 0:g.current)==null?void 0:R.y)??0);Math.sqrt(K*K+G*G)>H&&I(O)}(g.current.x!==A.xSnapped||g.current.y!==A.ySnapped)&&f.current&&_.current&&(b.current=O.sourceEvent,E.current=Is(O.sourceEvent,w.current),M(A))}}).on("end",O=>{if(!(!_.current||N.current)&&(p(!1),S.current=!1,_.current=!1,cancelAnimationFrame(v.current),f.current)){const{updateNodePositions:A,nodeInternals:L,onNodeDragStop:H,onSelectionDragStop:X}=u.getState(),R=i?H:sh(X);if(A(f.current,!1,!1),R){const[K,G]=rh({nodeId:i,dragItems:f.current,nodeInternals:L});R(O.sourceEvent,K,G)}}}).filter(O=>{const A=O.target;return!O.button&&(!n||!Bb(A,`.${n}`,e))&&(!s||Bb(A,s,e))});return j.call(F),()=>{j.on(".drag",null)}}}},[e,t,n,s,a,u,i,l,C]),h}function Hj(){const e=Mt();return k.useCallback(n=>{const{nodeInternals:s,nodeExtent:i,updateNodePositions:a,getNodes:l,snapToGrid:u,snapGrid:h,onError:p,nodesDraggable:f}=e.getState(),g=l().filter(N=>N.selected&&(N.draggable||f&&typeof N.draggable>"u")),v=u?h[0]:5,w=u?h[1]:5,E=n.isShiftPressed?4:1,b=n.x*v*E,S=n.y*w*E,_=g.map(N=>{if(N.positionAbsolute){const C={x:N.positionAbsolute.x+b,y:N.positionAbsolute.y+S};u&&(C.x=h[0]*Math.round(C.x/h[0]),C.y=h[1]*Math.round(C.y/h[1]));const{positionAbsolute:j,position:M}=Uj(N,C,s,i,void 0,p);N.position=M,N.positionAbsolute=j}return N});a(_,!0,!1)},[])}const qi={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var el=e=>{const t=({id:n,type:s,data:i,xPos:a,yPos:l,xPosOrigin:u,yPosOrigin:h,selected:p,onClick:f,onMouseEnter:g,onMouseMove:v,onMouseLeave:w,onContextMenu:E,onDoubleClick:b,style:S,className:_,isDraggable:N,isSelectable:C,isConnectable:j,isFocusable:M,selectNodesOnDrag:P,sourcePosition:I,targetPosition:F,hidden:O,resizeObserver:A,dragHandle:L,zIndex:H,isParent:X,noDragClassName:R,noPanClassName:K,initialized:G,disableKeyboardA11y:ne,ariaLabel:Q,rfId:W,hasHandleBounds:ee})=>{const $=Mt(),Y=k.useRef(null),ue=k.useRef(null),z=k.useRef(I),D=k.useRef(F),J=k.useRef(s),V=C||N||f||g||v||w,ae=Hj(),he=Ja(n,$.getState,g),ye=Ja(n,$.getState,v),_e=Ja(n,$.getState,w),Ve=Ja(n,$.getState,E),Be=Ja(n,$.getState,b),qe=be=>{const{nodeDragThreshold:ke}=$.getState();if(C&&(!P||!N||ke>0)&&Gv({id:n,store:$,nodeRef:Y}),f){const Ye=$.getState().nodeInternals.get(n);Ye&&f(be,{...Ye})}},Se=be=>{if(!zv(be)&&!ne)if(gj.includes(be.key)&&C){const ke=be.key==="Escape";Gv({id:n,store:$,unselect:ke,nodeRef:Y})}else N&&p&&Object.prototype.hasOwnProperty.call(qi,be.key)&&($.setState({ariaLiveMessage:`Moved selected node ${be.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~l}`}),ae({x:qi[be.key].x,y:qi[be.key].y,isShiftPressed:be.shiftKey}))};k.useEffect(()=>()=>{ue.current&&(A==null||A.unobserve(ue.current),ue.current=null)},[]),k.useEffect(()=>{if(Y.current&&!O){const be=Y.current;(!G||!ee||ue.current!==be)&&(ue.current&&(A==null||A.unobserve(ue.current)),A==null||A.observe(be),ue.current=be)}},[O,G,ee]),k.useEffect(()=>{const be=J.current!==s,ke=z.current!==I,Ye=D.current!==F;Y.current&&(be||ke||Ye)&&(be&&(J.current=s),ke&&(z.current=I),Ye&&(D.current=F),$.getState().updateNodeDimensions([{id:n,nodeElement:Y.current,forceUpdate:!0}]))},[n,s,I,F]);const ce=Wj({nodeRef:Y,disabled:O||!N,noDragClassName:R,handleSelector:L,nodeId:n,isSelectable:C,selectNodesOnDrag:P});return O?null:de.createElement("div",{className:Ht(["react-flow__node",`react-flow__node-${s}`,{[K]:N},_,{selected:p,selectable:C,parent:X,dragging:ce}]),ref:Y,style:{zIndex:H,transform:`translate(${u}px,${h}px)`,pointerEvents:V?"all":"none",visibility:G?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:he,onMouseMove:ye,onMouseLeave:_e,onContextMenu:Ve,onClick:qe,onDoubleClick:Be,onKeyDown:M?Se:void 0,tabIndex:M?0:void 0,role:M?"button":void 0,"aria-describedby":ne?void 0:`${$j}-${W}`,"aria-label":Q},de.createElement(lP,{value:n},de.createElement(e,{id:n,data:i,type:s,xPos:a,yPos:l,selected:p,isConnectable:j,sourcePosition:I,targetPosition:F,dragging:ce,dragHandle:L,zIndex:H})))};return t.displayName="NodeWrapper",k.memo(t)};const XP=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Vu(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function QP({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=Mt(),{width:i,height:a,x:l,y:u,transformString:h,userSelectionActive:p}=at(XP,Lt),f=Hj(),g=k.useRef(null);if(k.useEffect(()=>{var E;n||(E=g.current)==null||E.focus({preventScroll:!0})},[n]),Wj({nodeRef:g}),p||!i||!a)return null;const v=e?E=>{const b=s.getState().getNodes().filter(S=>S.selected);e(E,b)}:void 0,w=E=>{Object.prototype.hasOwnProperty.call(qi,E.key)&&f({x:qi[E.key].x,y:qi[E.key].y,isShiftPressed:E.shiftKey})};return de.createElement("div",{className:Ht(["react-flow__nodesselection","react-flow__container",t]),style:{transform:h}},de.createElement("div",{ref:g,className:"react-flow__nodesselection-rect",onContextMenu:v,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:i,height:a,top:u,left:l}}))}var ZP=k.memo(QP);const JP=e=>e.nodesSelectionActive,Gj=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:l,deleteKeyCode:u,onMove:h,onMoveStart:p,onMoveEnd:f,selectionKeyCode:g,selectionOnDrag:v,selectionMode:w,onSelectionStart:E,onSelectionEnd:b,multiSelectionKeyCode:S,panActivationKeyCode:_,zoomActivationKeyCode:N,elementsSelectable:C,zoomOnScroll:j,zoomOnPinch:M,panOnScroll:P,panOnScrollSpeed:I,panOnScrollMode:F,zoomOnDoubleClick:O,panOnDrag:A,defaultViewport:L,translateExtent:H,minZoom:X,maxZoom:R,preventScrolling:K,onSelectionContextMenu:G,noWheelClassName:ne,noPanClassName:Q,disableKeyboardA11y:W})=>{const ee=at(JP),$=wl(g),Y=wl(_),ue=Y||A,z=Y||P,D=$||v&&ue!==!0;return LP({deleteKeyCode:u,multiSelectionKeyCode:S}),de.createElement(zP,{onMove:h,onMoveStart:p,onMoveEnd:f,onPaneContextMenu:a,elementsSelectable:C,zoomOnScroll:j,zoomOnPinch:M,panOnScroll:z,panOnScrollSpeed:I,panOnScrollMode:F,zoomOnDoubleClick:O,panOnDrag:!$&&ue,defaultViewport:L,translateExtent:H,minZoom:X,maxZoom:R,zoomActivationKeyCode:N,preventScrolling:K,noWheelClassName:ne,noPanClassName:Q},de.createElement(zj,{onSelectionStart:E,onSelectionEnd:b,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:l,panOnDrag:ue,isSelecting:!!D,selectionMode:w},e,ee&&de.createElement(ZP,{onSelectionContextMenu:G,noPanClassName:Q,disableKeyboardA11y:W})))};Gj.displayName="FlowRenderer";var e$=k.memo(Gj);function t$(e){return at(k.useCallback(n=>e?_j(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function n$(e){const t={input:el(e.input||Mj),default:el(e.default||Hv),output:el(e.output||Oj),group:el(e.group||jw)},n={},s=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,a)=>(i[a]=el(e[a]||Hv),i),n);return{...t,...s}}const r$=({x:e,y:t,width:n,height:s,origin:i})=>!n||!s?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-s*i[1]},s$=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),Vj=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:i,updateNodeDimensions:a,onError:l}=at(s$,Lt),u=t$(e.onlyRenderVisibleElements),h=k.useRef(),p=k.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const f=new ResizeObserver(g=>{const v=g.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));a(v)});return h.current=f,f},[]);return k.useEffect(()=>()=>{var f;(f=h==null?void 0:h.current)==null||f.disconnect()},[]),de.createElement("div",{className:"react-flow__nodes",style:Tw},u.map(f=>{var M,P,I;let g=f.type||"default";e.nodeTypes[g]||(l==null||l("003",es.error003(g)),g="default");const v=e.nodeTypes[g]||e.nodeTypes.default,w=!!(f.draggable||t&&typeof f.draggable>"u"),E=!!(f.selectable||i&&typeof f.selectable>"u"),b=!!(f.connectable||n&&typeof f.connectable>"u"),S=!!(f.focusable||s&&typeof f.focusable>"u"),_=e.nodeExtent?kw(f.positionAbsolute,e.nodeExtent):f.positionAbsolute,N=(_==null?void 0:_.x)??0,C=(_==null?void 0:_.y)??0,j=r$({x:N,y:C,width:f.width??0,height:f.height??0,origin:e.nodeOrigin});return de.createElement(v,{key:f.id,id:f.id,className:f.className,style:f.style,type:g,data:f.data,sourcePosition:f.sourcePosition||De.Bottom,targetPosition:f.targetPosition||De.Top,hidden:f.hidden,xPos:N,yPos:C,xPosOrigin:j.x,yPosOrigin:j.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!f.selected,isDraggable:w,isSelectable:E,isConnectable:b,isFocusable:S,resizeObserver:p,dragHandle:f.dragHandle,zIndex:((M=f[Ct])==null?void 0:M.z)??0,isParent:!!((P=f[Ct])!=null&&P.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!f.width&&!!f.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:f.ariaLabel,hasHandleBounds:!!((I=f[Ct])!=null&&I.handleBounds)})}))};Vj.displayName="NodeRenderer";var o$=k.memo(Vj);const i$=(e,t,n)=>n===De.Left?e-t:n===De.Right?e+t:e,a$=(e,t,n)=>n===De.Top?e-t:n===De.Bottom?e+t:e,Wb="react-flow__edgeupdater",Hb=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:i,onMouseEnter:a,onMouseOut:l,type:u})=>de.createElement("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:l,className:Ht([Wb,`${Wb}-${u}`]),cx:i$(t,s,e),cy:a$(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),l$=()=>!0;var ji=e=>{const t=({id:n,className:s,type:i,data:a,onClick:l,onEdgeDoubleClick:u,selected:h,animated:p,label:f,labelStyle:g,labelShowBg:v,labelBgStyle:w,labelBgPadding:E,labelBgBorderRadius:b,style:S,source:_,target:N,sourceX:C,sourceY:j,targetX:M,targetY:P,sourcePosition:I,targetPosition:F,elementsSelectable:O,hidden:A,sourceHandleId:L,targetHandleId:H,onContextMenu:X,onMouseEnter:R,onMouseMove:K,onMouseLeave:G,reconnectRadius:ne,onReconnect:Q,onReconnectStart:W,onReconnectEnd:ee,markerEnd:$,markerStart:Y,rfId:ue,ariaLabel:z,isFocusable:D,isReconnectable:J,pathOptions:V,interactionWidth:ae,disableKeyboardA11y:he})=>{const ye=k.useRef(null),[_e,Ve]=k.useState(!1),[Be,qe]=k.useState(!1),Se=Mt(),ce=k.useMemo(()=>`url('#${Uv(Y,ue)}')`,[Y,ue]),be=k.useMemo(()=>`url('#${Uv($,ue)}')`,[$,ue]);if(A)return null;const ke=Pe=>{var Ie;const{edges:$e,addSelectedEdges:Te,unselectNodesAndEdges:Xe,multiSelectionActive:jt}=Se.getState(),ot=$e.find(xt=>xt.id===n);ot&&(O&&(Se.setState({nodesSelectionActive:!1}),ot.selected&&jt?(Xe({nodes:[],edges:[ot]}),(Ie=ye.current)==null||Ie.blur()):Te([n])),l&&l(Pe,ot))},Ye=Za(n,Se.getState,u),dt=Za(n,Se.getState,X),lt=Za(n,Se.getState,R),pe=Za(n,Se.getState,K),me=Za(n,Se.getState,G),Me=(Pe,$e)=>{if(Pe.button!==0)return;const{edges:Te,isValidConnection:Xe}=Se.getState(),jt=$e?N:_,ot=($e?H:L)||null,Ie=$e?"target":"source",xt=Xe||l$,ft=$e,gt=Te.find(En=>En.id===n);qe(!0),W==null||W(Pe,gt,Ie);const Nn=En=>{qe(!1),ee==null||ee(En,gt,Ie)};jj({event:Pe,handleId:ot,nodeId:jt,onConnect:En=>Q==null?void 0:Q(gt,En),isTarget:ft,getState:Se.getState,setState:Se.setState,isValidConnection:xt,edgeUpdaterType:Ie,onReconnectEnd:Nn})},He=Pe=>Me(Pe,!0),ct=Pe=>Me(Pe,!1),je=()=>Ve(!0),Ge=()=>Ve(!1),Ke=!O&&!l,se=Pe=>{var $e;if(!he&&gj.includes(Pe.key)&&O){const{unselectNodesAndEdges:Te,addSelectedEdges:Xe,edges:jt}=Se.getState();Pe.key==="Escape"?(($e=ye.current)==null||$e.blur(),Te({edges:[jt.find(Ie=>Ie.id===n)]})):Xe([n])}};return de.createElement("g",{className:Ht(["react-flow__edge",`react-flow__edge-${i}`,s,{selected:h,animated:p,inactive:Ke,updating:_e}]),onClick:ke,onDoubleClick:Ye,onContextMenu:dt,onMouseEnter:lt,onMouseMove:pe,onMouseLeave:me,onKeyDown:D?se:void 0,tabIndex:D?0:void 0,role:D?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":z===null?void 0:z||`Edge from ${_} to ${N}`,"aria-describedby":D?`${Lj}-${ue}`:void 0,ref:ye},!Be&&de.createElement(e,{id:n,source:_,target:N,selected:h,animated:p,label:f,labelStyle:g,labelShowBg:v,labelBgStyle:w,labelBgPadding:E,labelBgBorderRadius:b,data:a,style:S,sourceX:C,sourceY:j,targetX:M,targetY:P,sourcePosition:I,targetPosition:F,sourceHandleId:L,targetHandleId:H,markerStart:ce,markerEnd:be,pathOptions:V,interactionWidth:ae}),J&&de.createElement(de.Fragment,null,(J==="source"||J===!0)&&de.createElement(Hb,{position:I,centerX:C,centerY:j,radius:ne,onMouseDown:He,onMouseEnter:je,onMouseOut:Ge,type:"source"}),(J==="target"||J===!0)&&de.createElement(Hb,{position:F,centerX:M,centerY:P,radius:ne,onMouseDown:ct,onMouseEnter:je,onMouseOut:Ge,type:"target"})))};return t.displayName="EdgeWrapper",k.memo(t)};function c$(e){const t={default:ji(e.default||Mu),straight:ji(e.bezier||Nw),step:ji(e.step||Sw),smoothstep:ji(e.step||Gu),simplebezier:ji(e.simplebezier||_w)},n={},s=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,a)=>(i[a]=ji(e[a]||Mu),i),n);return{...t,...s}}function Gb(e,t,n=null){const s=((n==null?void 0:n.x)||0)+t.x,i=((n==null?void 0:n.y)||0)+t.y,a=(n==null?void 0:n.width)||t.width,l=(n==null?void 0:n.height)||t.height;switch(e){case De.Top:return{x:s+a/2,y:i};case De.Right:return{x:s+a,y:i+l/2};case De.Bottom:return{x:s+a/2,y:i+l};case De.Left:return{x:s,y:i+l/2}}}function Vb(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const u$=(e,t,n,s,i,a)=>{const l=Gb(n,e,t),u=Gb(a,s,i);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y}};function d$({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:s,targetWidth:i,targetHeight:a,width:l,height:u,transform:h}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+s,t.y+a)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const f=yl({x:(0-h[0])/h[2],y:(0-h[1])/h[2],width:l/h[2],height:u/h[2]}),g=Math.max(0,Math.min(f.x2,p.x2)-Math.max(f.x,p.x)),v=Math.max(0,Math.min(f.y2,p.y2)-Math.max(f.y,p.y));return Math.ceil(g*v)>0}function Yb(e){var s,i,a,l,u;const t=((s=e==null?void 0:e[Ct])==null?void 0:s.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)<"u"&&typeof((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.y)<"u";return[{x:((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.x)||0,y:((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const f$=[{level:0,isMaxLevel:!0,edges:[]}];function h$(e,t,n=!1){let s=-1;const i=e.reduce((l,u)=>{var f,g;const h=Dn(u.zIndex);let p=h?u.zIndex:0;if(n){const v=t.get(u.target),w=t.get(u.source),E=u.selected||(v==null?void 0:v.selected)||(w==null?void 0:w.selected),b=Math.max(((f=w==null?void 0:w[Ct])==null?void 0:f.z)||0,((g=v==null?void 0:v[Ct])==null?void 0:g.z)||0,1e3);p=(h?u.zIndex:0)+(E?b:0)}return l[p]?l[p].push(u):l[p]=[u],s=p>s?p:s,l},{}),a=Object.entries(i).map(([l,u])=>{const h=+l;return{edges:u,level:h,isMaxLevel:h===s}});return a.length===0?f$:a}function p$(e,t,n){const s=at(k.useCallback(i=>e?i.edges.filter(a=>{const l=t.get(a.source),u=t.get(a.target);return(l==null?void 0:l.width)&&(l==null?void 0:l.height)&&(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&d$({sourcePos:l.positionAbsolute||{x:0,y:0},targetPos:u.positionAbsolute||{x:0,y:0},sourceWidth:l.width,sourceHeight:l.height,targetWidth:u.width,targetHeight:u.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return h$(s,t,n)}const m$=({color:e="none",strokeWidth:t=1})=>de.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),g$=({color:e="none",strokeWidth:t=1})=>de.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Kb={[Au.Arrow]:m$,[Au.ArrowClosed]:g$};function y$(e){const t=Mt();return k.useMemo(()=>{var i,a;return Object.prototype.hasOwnProperty.call(Kb,e)?Kb[e]:((a=(i=t.getState()).onError)==null||a.call(i,"009",es.error009(e)),null)},[e])}const v$=({id:e,type:t,color:n,width:s=12.5,height:i=12.5,markerUnits:a="strokeWidth",strokeWidth:l,orient:u="auto-start-reverse"})=>{const h=y$(t);return h?de.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:u,refX:"0",refY:"0"},de.createElement(h,{color:n,strokeWidth:l})):null},w$=({defaultColor:e,rfId:t})=>n=>{const s=[];return n.edges.reduce((i,a)=>([a.markerStart,a.markerEnd].forEach(l=>{if(l&&typeof l=="object"){const u=Uv(l,t);s.includes(u)||(i.push({id:u,color:l.color||e,...l}),s.push(u))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))},Yj=({defaultColor:e,rfId:t})=>{const n=at(k.useCallback(w$({defaultColor:e,rfId:t}),[e,t]),(s,i)=>!(s.length!==i.length||s.some((a,l)=>a.id!==i[l].id)));return de.createElement("defs",null,n.map(s=>de.createElement(v$,{id:s.id,key:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient})))};Yj.displayName="MarkerDefinitions";var x$=k.memo(Yj);const b$=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}),Kj=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:i,noPanClassName:a,onEdgeContextMenu:l,onEdgeMouseEnter:u,onEdgeMouseMove:h,onEdgeMouseLeave:p,onEdgeClick:f,onEdgeDoubleClick:g,onReconnect:v,onReconnectStart:w,onReconnectEnd:E,reconnectRadius:b,children:S,disableKeyboardA11y:_})=>{const{edgesFocusable:N,edgesUpdatable:C,elementsSelectable:j,width:M,height:P,connectionMode:I,nodeInternals:F,onError:O}=at(b$,Lt),A=p$(t,F,n);return M?de.createElement(de.Fragment,null,A.map(({level:L,edges:H,isMaxLevel:X})=>de.createElement("svg",{key:L,style:{zIndex:L},width:M,height:P,className:"react-flow__edges react-flow__container"},X&&de.createElement(x$,{defaultColor:e,rfId:s}),de.createElement("g",null,H.map(R=>{const[K,G,ne]=Yb(F.get(R.source)),[Q,W,ee]=Yb(F.get(R.target));if(!ne||!ee)return null;let $=R.type||"default";i[$]||(O==null||O("011",es.error011($)),$="default");const Y=i[$]||i.default,ue=I===No.Strict?W.target:(W.target??[]).concat(W.source??[]),z=Vb(G.source,R.sourceHandle),D=Vb(ue,R.targetHandle),J=(z==null?void 0:z.position)||De.Bottom,V=(D==null?void 0:D.position)||De.Top,ae=!!(R.focusable||N&&typeof R.focusable>"u"),he=R.reconnectable||R.updatable,ye=typeof v<"u"&&(he||C&&typeof he>"u");if(!z||!D)return O==null||O("008",es.error008(z,R)),null;const{sourceX:_e,sourceY:Ve,targetX:Be,targetY:qe}=u$(K,z,J,Q,D,V);return de.createElement(Y,{key:R.id,id:R.id,className:Ht([R.className,a]),type:$,data:R.data,selected:!!R.selected,animated:!!R.animated,hidden:!!R.hidden,label:R.label,labelStyle:R.labelStyle,labelShowBg:R.labelShowBg,labelBgStyle:R.labelBgStyle,labelBgPadding:R.labelBgPadding,labelBgBorderRadius:R.labelBgBorderRadius,style:R.style,source:R.source,target:R.target,sourceHandleId:R.sourceHandle,targetHandleId:R.targetHandle,markerEnd:R.markerEnd,markerStart:R.markerStart,sourceX:_e,sourceY:Ve,targetX:Be,targetY:qe,sourcePosition:J,targetPosition:V,elementsSelectable:j,onContextMenu:l,onMouseEnter:u,onMouseMove:h,onMouseLeave:p,onClick:f,onEdgeDoubleClick:g,onReconnect:v,onReconnectStart:w,onReconnectEnd:E,reconnectRadius:b,rfId:s,ariaLabel:R.ariaLabel,isFocusable:ae,isReconnectable:ye,pathOptions:"pathOptions"in R?R.pathOptions:void 0,interactionWidth:R.interactionWidth,disableKeyboardA11y:_})})))),S):null};Kj.displayName="EdgeRenderer";var k$=k.memo(Kj);const _$=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function S$({children:e}){const t=at(_$);return de.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function N$(e){const t=Tl(),n=k.useRef(!1);k.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const E$={[De.Left]:De.Right,[De.Right]:De.Left,[De.Top]:De.Bottom,[De.Bottom]:De.Top},Xj=({nodeId:e,handleType:t,style:n,type:s=Ms.Bezier,CustomComponent:i,connectionStatus:a})=>{var P,I,F;const{fromNode:l,handleId:u,toX:h,toY:p,connectionMode:f}=at(k.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]),Lt),g=(P=l==null?void 0:l[Ct])==null?void 0:P.handleBounds;let v=g==null?void 0:g[t];if(f===No.Loose&&(v=v||(g==null?void 0:g[t==="source"?"target":"source"])),!l||!v)return null;const w=u?v.find(O=>O.id===u):v[0],E=w?w.x+w.width/2:(l.width??0)/2,b=w?w.y+w.height/2:l.height??0,S=(((I=l.positionAbsolute)==null?void 0:I.x)??0)+E,_=(((F=l.positionAbsolute)==null?void 0:F.y)??0)+b,N=w==null?void 0:w.position,C=N?E$[N]:null;if(!N||!C)return null;if(i)return de.createElement(i,{connectionLineType:s,connectionLineStyle:n,fromNode:l,fromHandle:w,fromX:S,fromY:_,toX:h,toY:p,fromPosition:N,toPosition:C,connectionStatus:a});let j="";const M={sourceX:S,sourceY:_,sourcePosition:N,targetX:h,targetY:p,targetPosition:C};return s===Ms.Bezier?[j]=bj(M):s===Ms.Step?[j]=Bv({...M,borderRadius:0}):s===Ms.SmoothStep?[j]=Bv(M):s===Ms.SimpleBezier?[j]=xj(M):j=`M${S},${_} ${h},${p}`,de.createElement("path",{d:j,fill:"none",className:"react-flow__connection-path",style:n})};Xj.displayName="ConnectionLine";const C$=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function j$({containerStyle:e,style:t,type:n,component:s}){const{nodeId:i,handleType:a,nodesConnectable:l,width:u,height:h,connectionStatus:p}=at(C$,Lt);return!(i&&a&&u&&l)?null:de.createElement("svg",{style:e,width:u,height:h,className:"react-flow__edges react-flow__connectionline react-flow__container"},de.createElement("g",{className:Ht(["react-flow__connection",p])},de.createElement(Xj,{nodeId:i,handleType:a,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function Xb(e,t){return k.useRef(null),Mt(),k.useMemo(()=>t(e),[e])}const Qj=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:i,onInit:a,onNodeClick:l,onEdgeClick:u,onNodeDoubleClick:h,onEdgeDoubleClick:p,onNodeMouseEnter:f,onNodeMouseMove:g,onNodeMouseLeave:v,onNodeContextMenu:w,onSelectionContextMenu:E,onSelectionStart:b,onSelectionEnd:S,connectionLineType:_,connectionLineStyle:N,connectionLineComponent:C,connectionLineContainerStyle:j,selectionKeyCode:M,selectionOnDrag:P,selectionMode:I,multiSelectionKeyCode:F,panActivationKeyCode:O,zoomActivationKeyCode:A,deleteKeyCode:L,onlyRenderVisibleElements:H,elementsSelectable:X,selectNodesOnDrag:R,defaultViewport:K,translateExtent:G,minZoom:ne,maxZoom:Q,preventScrolling:W,defaultMarkerColor:ee,zoomOnScroll:$,zoomOnPinch:Y,panOnScroll:ue,panOnScrollSpeed:z,panOnScrollMode:D,zoomOnDoubleClick:J,panOnDrag:V,onPaneClick:ae,onPaneMouseEnter:he,onPaneMouseMove:ye,onPaneMouseLeave:_e,onPaneScroll:Ve,onPaneContextMenu:Be,onEdgeContextMenu:qe,onEdgeMouseEnter:Se,onEdgeMouseMove:ce,onEdgeMouseLeave:be,onReconnect:ke,onReconnectStart:Ye,onReconnectEnd:dt,reconnectRadius:lt,noDragClassName:pe,noWheelClassName:me,noPanClassName:Me,elevateEdgesOnSelect:He,disableKeyboardA11y:ct,nodeOrigin:je,nodeExtent:Ge,rfId:Ke})=>{const se=Xb(e,n$),Pe=Xb(t,c$);return N$(a),de.createElement(e$,{onPaneClick:ae,onPaneMouseEnter:he,onPaneMouseMove:ye,onPaneMouseLeave:_e,onPaneContextMenu:Be,onPaneScroll:Ve,deleteKeyCode:L,selectionKeyCode:M,selectionOnDrag:P,selectionMode:I,onSelectionStart:b,onSelectionEnd:S,multiSelectionKeyCode:F,panActivationKeyCode:O,zoomActivationKeyCode:A,elementsSelectable:X,onMove:n,onMoveStart:s,onMoveEnd:i,zoomOnScroll:$,zoomOnPinch:Y,zoomOnDoubleClick:J,panOnScroll:ue,panOnScrollSpeed:z,panOnScrollMode:D,panOnDrag:V,defaultViewport:K,translateExtent:G,minZoom:ne,maxZoom:Q,onSelectionContextMenu:E,preventScrolling:W,noDragClassName:pe,noWheelClassName:me,noPanClassName:Me,disableKeyboardA11y:ct},de.createElement(S$,null,de.createElement(k$,{edgeTypes:Pe,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:H,onEdgeContextMenu:qe,onEdgeMouseEnter:Se,onEdgeMouseMove:ce,onEdgeMouseLeave:be,onReconnect:ke,onReconnectStart:Ye,onReconnectEnd:dt,reconnectRadius:lt,defaultMarkerColor:ee,noPanClassName:Me,elevateEdgesOnSelect:!!He,disableKeyboardA11y:ct,rfId:Ke},de.createElement(j$,{style:N,type:_,component:C,containerStyle:j})),de.createElement("div",{className:"react-flow__edgelabel-renderer"}),de.createElement(o$,{nodeTypes:se,onNodeClick:l,onNodeDoubleClick:h,onNodeMouseEnter:f,onNodeMouseMove:g,onNodeMouseLeave:v,onNodeContextMenu:w,selectNodesOnDrag:R,onlyRenderVisibleElements:H,noPanClassName:Me,noDragClassName:pe,disableKeyboardA11y:ct,nodeOrigin:je,nodeExtent:Ge,rfId:Ke})))};Qj.displayName="GraphView";var T$=k.memo(Qj);const Vv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ts={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:Vv,nodeExtent:Vv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:No.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:nP,isValidConnection:void 0},R$=()=>y2((e,t)=>({...Ts,setNodes:n=>{const{nodeInternals:s,nodeOrigin:i,elevateNodesOnSelect:a}=t();e({nodeInternals:th(n,s,i,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:s={}}=t();e({edges:n.map(i=>({...s,...i}))})},setDefaultNodesAndEdges:(n,s)=>{const i=typeof n<"u",a=typeof s<"u",l=i?th(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:l,edges:a?s:[],hasDefaultNodes:i,hasDefaultEdges:a})},updateNodeDimensions:n=>{const{onNodesChange:s,nodeInternals:i,fitViewOnInit:a,fitViewOnInitDone:l,fitViewOnInitOptions:u,domNode:h,nodeOrigin:p}=t(),f=h==null?void 0:h.querySelector(".react-flow__viewport");if(!f)return;const g=window.getComputedStyle(f),{m22:v}=new window.DOMMatrixReadOnly(g.transform),w=n.reduce((b,S)=>{const _=i.get(S.id);if(_!=null&&_.hidden)i.set(_.id,{..._,[Ct]:{..._[Ct],handleBounds:void 0}});else if(_){const N=bw(S.nodeElement);!!(N.width&&N.height&&(_.width!==N.width||_.height!==N.height||S.forceUpdate))&&(i.set(_.id,{..._,[Ct]:{..._[Ct],handleBounds:{source:Ub(".source",S.nodeElement,v,p),target:Ub(".target",S.nodeElement,v,p)}},...N}),b.push({id:_.id,type:"dimensions",dimensions:N}))}return b},[]);Dj(i,p);const E=l||a&&!l&&Fj(t,{initial:!0,...u});e({nodeInternals:new Map(i),fitViewOnInitDone:E}),(w==null?void 0:w.length)>0&&(s==null||s(w))},updateNodePositions:(n,s=!0,i=!1)=>{const{triggerNodeChanges:a}=t(),l=n.map(u=>{const h={id:u.id,type:"position",dragging:i};return s&&(h.positionAbsolute=u.positionAbsolute,h.position=u.position),h});a(l)},triggerNodeChanges:n=>{const{onNodesChange:s,nodeInternals:i,hasDefaultNodes:a,nodeOrigin:l,getNodes:u,elevateNodesOnSelect:h}=t();if(n!=null&&n.length){if(a){const p=HP(n,u()),f=th(p,i,l,h);e({nodeInternals:f})}s==null||s(n)}},addSelectedNodes:n=>{const{multiSelectionActive:s,edges:i,getNodes:a}=t();let l,u=null;s?l=n.map(h=>As(h,!0)):(l=Ii(a(),n),u=Ii(i,[])),ou({changedNodes:l,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:s,edges:i,getNodes:a}=t();let l,u=null;s?l=n.map(h=>As(h,!0)):(l=Ii(i,n),u=Ii(a(),[])),ou({changedNodes:u,changedEdges:l,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:s}={})=>{const{edges:i,getNodes:a}=t(),l=n||a(),u=s||i,h=l.map(f=>(f.selected=!1,As(f.id,!1))),p=u.map(f=>As(f.id,!1));ou({changedNodes:h,changedEdges:p,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:s,maxZoom:i}=t();s==null||s.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:s,minZoom:i}=t();s==null||s.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{var s;(s=t().d3Zoom)==null||s.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:s}=t(),a=s().filter(u=>u.selected).map(u=>As(u.id,!1)),l=n.filter(u=>u.selected).map(u=>As(u.id,!1));ou({changedNodes:a,changedEdges:l,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(i=>{i.positionAbsolute=kw(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:i,height:a,d3Zoom:l,d3Selection:u,translateExtent:h}=t();if(!l||!u||!n.x&&!n.y)return!1;const p=Zr.translate(s[0]+n.x,s[1]+n.y).scale(s[2]),f=[[0,0],[i,a]],g=l==null?void 0:l.constrain()(p,f,h);return l.transform(u,g),s[0]!==g.x||s[1]!==g.y||s[2]!==g.k},cancelConnection:()=>e({connectionNodeId:Ts.connectionNodeId,connectionHandleId:Ts.connectionHandleId,connectionHandleType:Ts.connectionHandleType,connectionStatus:Ts.connectionStatus,connectionStartHandle:Ts.connectionStartHandle,connectionEndHandle:Ts.connectionEndHandle}),reset:()=>e({...Ts})}),Object.is),Rw=({children:e})=>{const t=k.useRef(null);return t.current||(t.current=R$()),de.createElement(KO,{value:t.current},e)};Rw.displayName="ReactFlowProvider";const Zj=({children:e})=>k.useContext(Hu)?de.createElement(de.Fragment,null,e):de.createElement(Rw,null,e);Zj.displayName="ReactFlowWrapper";const A$={input:Mj,default:Hv,output:Oj,group:jw},M$={default:Mu,straight:Nw,step:Sw,smoothstep:Gu,simplebezier:_w},I$=[0,0],O$=[15,15],P$={x:0,y:0,zoom:1},$$={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},Jj=k.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:i,nodeTypes:a=A$,edgeTypes:l=M$,onNodeClick:u,onEdgeClick:h,onInit:p,onMove:f,onMoveStart:g,onMoveEnd:v,onConnect:w,onConnectStart:E,onConnectEnd:b,onClickConnectStart:S,onClickConnectEnd:_,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:j,onNodeContextMenu:M,onNodeDoubleClick:P,onNodeDragStart:I,onNodeDrag:F,onNodeDragStop:O,onNodesDelete:A,onEdgesDelete:L,onSelectionChange:H,onSelectionDragStart:X,onSelectionDrag:R,onSelectionDragStop:K,onSelectionContextMenu:G,onSelectionStart:ne,onSelectionEnd:Q,connectionMode:W=No.Strict,connectionLineType:ee=Ms.Bezier,connectionLineStyle:$,connectionLineComponent:Y,connectionLineContainerStyle:ue,deleteKeyCode:z="Backspace",selectionKeyCode:D="Shift",selectionOnDrag:J=!1,selectionMode:V=vl.Full,panActivationKeyCode:ae="Space",multiSelectionKeyCode:he=Ru()?"Meta":"Control",zoomActivationKeyCode:ye=Ru()?"Meta":"Control",snapToGrid:_e=!1,snapGrid:Ve=O$,onlyRenderVisibleElements:Be=!1,selectNodesOnDrag:qe=!0,nodesDraggable:Se,nodesConnectable:ce,nodesFocusable:be,nodeOrigin:ke=I$,edgesFocusable:Ye,edgesUpdatable:dt,elementsSelectable:lt,defaultViewport:pe=P$,minZoom:me=.5,maxZoom:Me=2,translateExtent:He=Vv,preventScrolling:ct=!0,nodeExtent:je,defaultMarkerColor:Ge="#b1b1b7",zoomOnScroll:Ke=!0,zoomOnPinch:se=!0,panOnScroll:Pe=!1,panOnScrollSpeed:$e=.5,panOnScrollMode:Te=bo.Free,zoomOnDoubleClick:Xe=!0,panOnDrag:jt=!0,onPaneClick:ot,onPaneMouseEnter:Ie,onPaneMouseMove:xt,onPaneMouseLeave:ft,onPaneScroll:gt,onPaneContextMenu:Nn,children:Bn,onEdgeContextMenu:En,onEdgeDoubleClick:Ro,onEdgeMouseEnter:mn,onEdgeMouseMove:Ao,onEdgeMouseLeave:Mo,onEdgeUpdate:Bt,onEdgeUpdateStart:Rr,onEdgeUpdateEnd:Un,onReconnect:Ls,onReconnectStart:Ar,onReconnectEnd:Io,reconnectRadius:pr=10,edgeUpdaterRadius:Mr=10,onNodesChange:mr,onEdgesChange:rs,noDragClassName:Oo="nodrag",noWheelClassName:Po="nowheel",noPanClassName:$o="nopan",fitView:Cn=!1,fitViewOptions:Lo,connectOnClick:Ir=!0,attributionPosition:qo,proOptions:Wn,defaultEdgeOptions:Do,elevateNodesOnSelect:qs=!0,elevateEdgesOnSelect:Ds=!1,disableKeyboardA11y:Fo=!1,autoPanOnConnect:zo=!0,autoPanOnNodeDrag:it=!0,connectionRadius:sa=20,isValidConnection:ss,onError:Gt,style:Hn,id:Bo,nodeDragThreshold:os,...bt},sn)=>{const Gn=Bo||"1";return de.createElement("div",{...bt,style:{...Hn,...$$},ref:sn,className:Ht(["react-flow",i]),"data-testid":"rf__wrapper",id:Bo},de.createElement(Zj,null,de.createElement(T$,{onInit:p,onMove:f,onMoveStart:g,onMoveEnd:v,onNodeClick:u,onEdgeClick:h,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:j,onNodeContextMenu:M,onNodeDoubleClick:P,nodeTypes:a,edgeTypes:l,connectionLineType:ee,connectionLineStyle:$,connectionLineComponent:Y,connectionLineContainerStyle:ue,selectionKeyCode:D,selectionOnDrag:J,selectionMode:V,deleteKeyCode:z,multiSelectionKeyCode:he,panActivationKeyCode:ae,zoomActivationKeyCode:ye,onlyRenderVisibleElements:Be,selectNodesOnDrag:qe,defaultViewport:pe,translateExtent:He,minZoom:me,maxZoom:Me,preventScrolling:ct,zoomOnScroll:Ke,zoomOnPinch:se,zoomOnDoubleClick:Xe,panOnScroll:Pe,panOnScrollSpeed:$e,panOnScrollMode:Te,panOnDrag:jt,onPaneClick:ot,onPaneMouseEnter:Ie,onPaneMouseMove:xt,onPaneMouseLeave:ft,onPaneScroll:gt,onPaneContextMenu:Nn,onSelectionContextMenu:G,onSelectionStart:ne,onSelectionEnd:Q,onEdgeContextMenu:En,onEdgeDoubleClick:Ro,onEdgeMouseEnter:mn,onEdgeMouseMove:Ao,onEdgeMouseLeave:Mo,onReconnect:Ls??Bt,onReconnectStart:Ar??Rr,onReconnectEnd:Io??Un,reconnectRadius:pr??Mr,defaultMarkerColor:Ge,noDragClassName:Oo,noWheelClassName:Po,noPanClassName:$o,elevateEdgesOnSelect:Ds,rfId:Gn,disableKeyboardA11y:Fo,nodeOrigin:ke,nodeExtent:je}),de.createElement(NP,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:w,onConnectStart:E,onConnectEnd:b,onClickConnectStart:S,onClickConnectEnd:_,nodesDraggable:Se,nodesConnectable:ce,nodesFocusable:be,edgesFocusable:Ye,edgesUpdatable:dt,elementsSelectable:lt,elevateNodesOnSelect:qs,minZoom:me,maxZoom:Me,nodeExtent:je,onNodesChange:mr,onEdgesChange:rs,snapToGrid:_e,snapGrid:Ve,connectionMode:W,translateExtent:He,connectOnClick:Ir,defaultEdgeOptions:Do,fitView:Cn,fitViewOptions:Lo,onNodesDelete:A,onEdgesDelete:L,onNodeDragStart:I,onNodeDrag:F,onNodeDragStop:O,onSelectionDrag:R,onSelectionDragStart:X,onSelectionDragStop:K,noPanClassName:$o,nodeOrigin:ke,rfId:Gn,autoPanOnConnect:zo,autoPanOnNodeDrag:it,onError:Gt,connectionRadius:sa,isValidConnection:ss,nodeDragThreshold:os}),de.createElement(_P,{onSelectionChange:H}),Bn,de.createElement(QO,{proOptions:Wn,position:qo}),de.createElement(RP,{rfId:Gn,disableKeyboardA11y:Fo})))});Jj.displayName="ReactFlow";const L$=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function eT(){return at(L$,Lt)}const tT=({id:e,x:t,y:n,width:s,height:i,style:a,color:l,strokeColor:u,strokeWidth:h,className:p,borderRadius:f,shapeRendering:g,onClick:v,selected:w})=>{const{background:E,backgroundColor:b}=a||{},S=l||E||b;return de.createElement("rect",{className:Ht(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:f,ry:f,width:s,height:i,fill:S,stroke:u,strokeWidth:h,shapeRendering:g,onClick:v?_=>v(_,e):void 0})};tT.displayName="MiniMapNode";var q$=k.memo(tT);const D$=e=>e.nodeOrigin,F$=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),oh=e=>e instanceof Function?e:()=>e;function z$({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:a=q$,onClick:l}){const u=at(F$,Lt),h=at(D$),p=oh(t),f=oh(e),g=oh(n),v=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return de.createElement(de.Fragment,null,u.map(w=>{const{x:E,y:b}=_o(w,h).positionAbsolute;return de.createElement(a,{key:w.id,x:E,y:b,width:w.width,height:w.height,style:w.style,selected:w.selected,className:g(w),color:p(w),borderRadius:s,strokeColor:f(w),strokeWidth:i,shapeRendering:v,onClick:l,id:w.id})}))}var B$=k.memo(z$);const U$=200,W$=150,H$=e=>{const t=e.getNodes(),n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:t.length>0?eP(Vu(t,e.nodeOrigin),n):n,rfId:e.rfId}},G$="react-flow__minimap-desc";function nT({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:s="#e2e2e2",nodeClassName:i="",nodeBorderRadius:a=5,nodeStrokeWidth:l=2,nodeComponent:u,maskColor:h="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:f=1,position:g="bottom-right",onClick:v,onNodeClick:w,pannable:E=!1,zoomable:b=!1,ariaLabel:S="React Flow mini map",inversePan:_=!1,zoomStep:N=10,offsetScale:C=5}){const j=Mt(),M=k.useRef(null),{boundingRect:P,viewBB:I,rfId:F}=at(H$,Lt),O=(e==null?void 0:e.width)??U$,A=(e==null?void 0:e.height)??W$,L=P.width/O,H=P.height/A,X=Math.max(L,H),R=X*O,K=X*A,G=C*X,ne=P.x-(R-P.width)/2-G,Q=P.y-(K-P.height)/2-G,W=R+G*2,ee=K+G*2,$=`${G$}-${F}`,Y=k.useRef(0);Y.current=X,k.useEffect(()=>{if(M.current){const D=qn(M.current),J=he=>{const{transform:ye,d3Selection:_e,d3Zoom:Ve}=j.getState();if(he.sourceEvent.type!=="wheel"||!_e||!Ve)return;const Be=-he.sourceEvent.deltaY*(he.sourceEvent.deltaMode===1?.05:he.sourceEvent.deltaMode?1:.002)*N,qe=ye[2]*Math.pow(2,Be);Ve.scaleTo(_e,qe)},V=he=>{const{transform:ye,d3Selection:_e,d3Zoom:Ve,translateExtent:Be,width:qe,height:Se}=j.getState();if(he.sourceEvent.type!=="mousemove"||!_e||!Ve)return;const ce=Y.current*Math.max(1,ye[2])*(_?-1:1),be={x:ye[0]-he.sourceEvent.movementX*ce,y:ye[1]-he.sourceEvent.movementY*ce},ke=[[0,0],[qe,Se]],Ye=Zr.translate(be.x,be.y).scale(ye[2]),dt=Ve.constrain()(Ye,ke,Be);Ve.transform(_e,dt)},ae=uj().on("zoom",E?V:null).on("zoom.wheel",b?J:null);return D.call(ae),()=>{D.on("zoom",null)}}},[E,b,_,N]);const ue=v?D=>{const J=ir(D);v(D,{x:J[0],y:J[1]})}:void 0,z=w?(D,J)=>{const V=j.getState().nodeInternals.get(J);w(D,V)}:void 0;return de.createElement(xw,{position:g,style:e,className:Ht(["react-flow__minimap",t]),"data-testid":"rf__minimap"},de.createElement("svg",{width:O,height:A,viewBox:`${ne} ${Q} ${W} ${ee}`,role:"img","aria-labelledby":$,ref:M,onClick:ue},S&&de.createElement("title",{id:$},S),de.createElement(B$,{onClick:z,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:l,nodeComponent:u}),de.createElement("path",{className:"react-flow__minimap-mask",d:`M${ne-G},${Q-G}h${W+G*2}v${ee+G*2}h${-W-G*2}z
|
|
57
|
-
M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fill:h,fillRule:"evenodd",stroke:p,strokeWidth:f,pointerEvents:"none"})))}nT.displayName="MiniMap";var V$=k.memo(nT);function Y$(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},de.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function K$(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},de.createElement("path",{d:"M0 0h32v4.2H0z"}))}function X$(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},de.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 Q$(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},de.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 Z$(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},de.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 Er=({children:e,className:t,...n})=>de.createElement("button",{type:"button",className:Ht(["react-flow__controls-button",t]),...n},e);Er.displayName="ControlButton";const J$=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),rT=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:l,onFitView:u,onInteractiveChange:h,className:p,children:f,position:g="bottom-left"})=>{const v=Mt(),[w,E]=k.useState(!1),{isInteractive:b,minZoomReached:S,maxZoomReached:_}=at(J$,Lt),{zoomIn:N,zoomOut:C,fitView:j}=Tl();if(k.useEffect(()=>{E(!0)},[]),!w)return null;const M=()=>{N(),a==null||a()},P=()=>{C(),l==null||l()},I=()=>{j(i),u==null||u()},F=()=>{v.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),h==null||h(!b)};return de.createElement(xw,{className:Ht(["react-flow__controls",p]),position:g,style:e,"data-testid":"rf__controls"},t&&de.createElement(de.Fragment,null,de.createElement(Er,{onClick:M,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:_},de.createElement(Y$,null)),de.createElement(Er,{onClick:P,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},de.createElement(K$,null))),n&&de.createElement(Er,{className:"react-flow__controls-fitview",onClick:I,title:"fit view","aria-label":"fit view"},de.createElement(X$,null)),s&&de.createElement(Er,{className:"react-flow__controls-interactive",onClick:F,title:"toggle interactivity","aria-label":"toggle interactivity"},b?de.createElement(Z$,null):de.createElement(Q$,null)),f)};rT.displayName="Controls";var eL=k.memo(rT),ur;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ur||(ur={}));function tL({color:e,dimensions:t,lineWidth:n}){return de.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function nL({color:e,radius:t}){return de.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const rL={[ur.Dots]:"#91919a",[ur.Lines]:"#eee",[ur.Cross]:"#e2e2e2"},sL={[ur.Dots]:1,[ur.Lines]:1,[ur.Cross]:6},oL=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function sT({id:e,variant:t=ur.Dots,gap:n=20,size:s,lineWidth:i=1,offset:a=2,color:l,style:u,className:h}){const p=k.useRef(null),{transform:f,patternId:g}=at(oL,Lt),v=l||rL[t],w=s||sL[t],E=t===ur.Dots,b=t===ur.Cross,S=Array.isArray(n)?n:[n,n],_=[S[0]*f[2]||1,S[1]*f[2]||1],N=w*f[2],C=b?[N,N]:_,j=E?[N/a,N/a]:[C[0]/a,C[1]/a];return de.createElement("svg",{className:Ht(["react-flow__background",h]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},de.createElement("pattern",{id:g+e,x:f[0]%_[0],y:f[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`},E?de.createElement(nL,{color:v,radius:N/a}):de.createElement(tL,{dimensions:C,color:v,lineWidth:i})),de.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${g+e})`}))}sT.displayName="Background";var iL=k.memo(sT);const aL=["us-gov","global","apac","us","eu","jp","au"],lL=new RegExp(`^(?:(?:${aL.join("|")})\\.)?anthropic\\.`,"i");function Rl(e){return e.replace(lL,"")}const cL=["command","cmd","file_path","path","url","pattern","notebook_path"],Qb=120,ih=e=>e.length>Qb?`${e.slice(0,Qb-1)}…`:e;function uL(e){if(typeof e=="string")return e.trim()?ih(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of cL){const s=t[n];if(typeof s=="string"&&s.trim())return ih(s.trim());if(Array.isArray(s)&&s.length>0&&s.every(i=>typeof i=="string")){const i=s.join(" ").trim();if(i)return ih(i)}}return null}function oT(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function Aw(e){const t=e.cache_creation,n=t&&typeof t=="object"?t:e,s=n.ephemeral_1h_input_tokens,i=n.ephemeral_5m_input_tokens;return typeof s!="number"&&typeof i!="number"?{}:{cacheCreate1hTokens:Number(s??0),cacheCreate5mTokens:Number(i??0)}}function dL(e){const t=Aw(e),n={inputTokens:Number(e.input_tokens??0),outputTokens:Number(e.output_tokens??0),cacheReadTokens:Number(e.cache_read_input_tokens??e.cached_input_tokens??0),cacheCreateTokens:Number(e.cache_creation_input_tokens??e.cache_write_input_tokens??0),cacheCreate1hTokens:t.cacheCreate1hTokens,cacheCreate5mTokens:t.cacheCreate5mTokens};return typeof e.reasoning_output_tokens=="number"&&(n.reasoningOutputTokens=Number(e.reasoning_output_tokens)),n}function fL(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,s]of Object.entries(e))!n||!s||typeof s!="object"||(t[n]=dL(s));return Object.keys(t).length?t:void 0}function iT(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.input_tokens=="number"||typeof n.output_tokens=="number"||typeof n.cache_read_input_tokens=="number"||typeof n.cache_creation_input_tokens=="number")return{inputTokens:Number(n.input_tokens??0),outputTokens:Number(n.output_tokens??0),cacheReadTokens:Number(n.cache_read_input_tokens??0),cacheCreateTokens:Number(n.cache_creation_input_tokens??0),...Aw(n)};for(const s of Object.values(n)){const i=iT(s,t+1);if(i)return i}return null}const hL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function aT(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&hL.test(Rl(n.model)))return n.model;for(const s of Object.values(n)){const i=aT(s,t+1);if(i)return i}return null}function Yv(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function Os(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function Zb(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Al(e,t){return`${e}::${t}`}function Iu(e){return e.agent_type??e.subagent_type??"subagent"}function ul(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function Oi(e,t,n,s){const i=t;let a=e.agents.get(i);return a||(a={id:i,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:s,usage:oT()},e.agents.set(i,a),a)}function lT(e,t,n,s){const i=Al(t,n),a=e.agents.get(i);if(!a)return null;!a.cwd&&s.cwd&&(a.cwd=s.cwd,a.cwdBasename=Os(s.cwd));const l=Iu(s);return l&&(a.label==="subagent"||!a.label)&&(a.label=l),a}function pL(e,t,n){const s=t.session_id??"unknown",i=ul(t);if(i){const h=lT(e,s,i,t);if(h)return h}const a=e.activeSubagentStack.get(s),l=a&&a.length>0?a[a.length-1]:null;if(l){const h=e.agents.get(Al(s,l));if(h)return!h.cwd&&t.cwd&&(h.cwd=t.cwd,h.cwdBasename=Os(t.cwd)),h}const u=Oi(e,s,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=Os(t.cwd)),u.label==="session"&&t.cwd&&(u.label=Os(t.cwd)??"session"),u}function mL(e,t,n,s,i){const a=Al(t,n),l=Oi(e,t,i,!0);let u=e.agents.get(a);if(u){!u.cwd&&s.cwd&&(u.cwd=s.cwd,u.cwdBasename=Os(s.cwd));const h=Iu(s);return h&&(u.label==="subagent"||!u.label)&&(u.label=h),u}return u={id:a,sessionId:t,label:Iu(s),kind:"subagent",parentId:l.id,state:"active",startedAt:i,tools:[],prompts:[],cwd:s.cwd,cwdBasename:Os(s.cwd),toolCount:0,childCount:0,usage:oT()},e.agents.set(a,u),l.childCount+=1,u}function gL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function yL(e,t,n){const s=e.activeSubagentStack.get(t);if(s){for(let i=s.length-1;i>=0;i--)if(s[i]===n){s.splice(i,1);break}s.length===0&&e.activeSubagentStack.delete(t)}}function au(e,t=80){if(e==null)return"";if(typeof e=="string")return e.length>t?e.slice(0,t-1)+"…":e;try{const n=JSON.stringify(e);return n.length>t?n.slice(0,t-1)+"…":n}catch{return String(e)}}const Jb=200,vL=25;function wL(e,t){const n=t.tools;if(n.length>Jb){const s=n.splice(0,n.length-Jb);for(const i of s)e.toolIndex.get(i.id)===i&&(e.toolIndex.delete(i.id),e.toolOwner.delete(i.id))}for(let s=n.length-vL-1;s>=0;s--){const i=n[s];if(i.trimmed)break;i.input=void 0,i.response=void 0,i.trimmed=!0}}function xL(e,t,n){const s=e.toolIndex.get(n);if(s)return s;for(let i=t.tools.length-1;i>=0;i--)if(t.tools[i].id===n)return t.tools[i];return null}const e1=2e3;function bL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const i=e.prompts[s];if(i.at<t-e1)return!1;if(i.text===n&&i.at<=t+e1)return!0}return!1}function cT(e,t){for(const n of t.tools)e.toolIndex.get(n.id)===n&&e.toolIndex.delete(n.id),e.toolOwner.get(n.id)===t.id&&e.toolOwner.delete(n.id)}function Ml(e,t){return t&&(e.revision+=1),t}function kL(e,t,n,s){if(e.agents.size<=n)return!1;const i=p=>p.state==="done"&&p.endedAt!=null&&t-p.endedAt>s,a=[],l=new Map;for(const[p,f]of e.agents){if(f.parentId!=null){const g=l.get(f.parentId);g?g.push(p):l.set(f.parentId,[p])}i(f)&&a.push({id:p,endedAt:f.endedAt})}if(a.length===0)return!1;a.sort((p,f)=>p.endedAt-f.endedAt);let u=0;const h=p=>{const f=e.agents.get(p);f&&(cT(e,f),e.agents.delete(p),u++)};for(const p of a){if(e.agents.size<=n)break;if(!e.agents.has(p.id))continue;const f=(l.get(p.id)??[]).map(g=>e.agents.get(g)).filter(g=>g!=null);if(!f.some(g=>!i(g))){for(const g of f)h(g.id);h(p.id)}}return Ml(e,u>0)}function _L(e,t,n,s){const i=new Map;for(const[p,f]of e.agents){let g=i.get(f.sessionId);g||(g={ids:[],endedAt:0,live:!1,closed:!1},i.set(f.sessionId,g)),g.ids.push(p),f.kind==="root"&&f.closedAt!=null&&(g.closed=!0),f.state==="done"&&f.endedAt!=null?g.endedAt=Math.max(g.endedAt,f.endedAt):g.live=!0}const a=[...i.values()].filter(p=>!p.live&&p.endedAt>0&&t-p.endedAt>s).sort((p,f)=>p.closed===f.closed?p.endedAt-f.endedAt:p.closed?-1:1);let u=[...i.values()].filter(p=>!p.live).length-n;if(u<=0)return!1;let h=!1;for(const p of a){if(u<=0)break;for(const f of p.ids){const g=e.agents.get(f);g&&cT(e,g),e.agents.delete(f)}u--,h=!0}return Ml(e,h)}function SL(e,t){const n=t==null?void 0:t.payload,s=n==null?void 0:n.hook_event_name;if(s!=="PostToolUse"&&s!=="PostToolUseFailure")return!1;const i=n==null?void 0:n.tool_use_id;return typeof i=="string"&&i.length>0&&e.toolIndex.has(i)}function NL(e){let t=!1;for(const n of e.agents.values())for(const s of n.tools)s.endedAt!=null||s.outcomeGap||(s.outcomeGap=!0,t=!0);return Ml(e,t)}function EL(e,t,n){let s=!1;for(const i of e.agents.values()){if(i.provider==="codex")continue;const a=e.agents.get(i.sessionId),l=(a==null?void 0:a.lastEventAt)??(a==null?void 0:a.startedAt);for(const u of i.tools){const h=Math.max(u.startedAt,l??u.startedAt);u.endedAt==null&&t-h>n&&(u.endedAt=h,u.ok=!1,u.errorPreview=u.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(u.id),e.toolOwner.delete(u.id),s=!0)}}return Ml(e,s)}const t1=90*6e4;function CL(e,t,n){let s=!1;for(const i of e.agents.values()){if(i.kind!=="root")continue;const a=i.lastEventAt??i.startedAt;if(!(t-a<=n)){i.waiting&&(i.waiting=null,s=!0),i.closedAt==null&&(i.closedAt=a),i.state==="active"&&(i.state="done",i.endedAt=a,i.reaped=!0,s=!0);for(const l of e.agents.values())l.sessionId!==i.sessionId||l.kind==="root"||l.state!=="active"||(l.state="done",l.endedAt=a,s=!0);e.activeSubagentStack.delete(i.sessionId)}}return Ml(e,s)}function jL(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const TL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed"]);function RL(e,t){let n=null;for(const s of e.toolIndex.values()){const i=s.agentId?e.agents.get(s.agentId):void 0;!i||i.sessionId!==t||(!n||s.startedAt>n.startedAt)&&(n=s)}return n}const AL=3e4;function ML(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>AL)&&!(e.startedAt>t))return{name:e.name,preview:uL(e.input)??""}}function IL(e,t,n,s,i){if(n!=="permission")return{kind:n,message:s,since:i};const a=RL(e,t),l={kind:n,message:s,since:i};a!=null&&a.explicitSubagentId&&(l.subagentId=a.explicitSubagentId);const u=ML(a,i);return u&&(l.tool=u),l}function OL(e,t,n){if(e.kind==="idle")return!0;const s=ul(t);return s==null?!0:e.subagentId!=null&&Al(n,s)===e.subagentId}function n1(e,t){const n=t.epoch??null;if(n!==null&&n!==e.seqEpoch)e.seqEpoch=n,e.lastSeq=0;else if(t.seq<=e.lastSeq)return e;const s=t.payload??{},i=t.receivedAt,a=s.hook_event_name??"Unknown";if(a==="__clear")return{...Yv(),lastSeq:t.seq,seqEpoch:e.seqEpoch,revision:e.revision+1};e.totalEvents+=1,e.lastSeq=t.seq,e.revision+=1;const l=s.session_id??"unknown";if(!TL.has(a)){const f=e.agents.get(l);f!=null&&f.waiting&&OL(f.waiting,s,l)&&(f.waiting=null)}const u=e.agents.get(l);if(u&&i>(u.lastEventAt??0)&&(u.lastEventAt=i,u.reaped&&(u.reaped=!1,u.state="active",u.endedAt=void 0,u.closedAt=void 0)),typeof s.model_context_window=="number"&&s.model_context_window>0){const f=e.agents.get(l);f&&(f.contextWindow=s.model_context_window)}if(typeof s.approval_policy=="string"&&s.approval_policy){const f=e.agents.get(l);f&&(f.approvalPolicy=s.approval_policy)}if(typeof s.context_tokens=="number"&&s.context_tokens>=0){const f=e.agents.get(l);f&&(f.context={...f.context??Zb(),currentContextTokens:s.context_tokens})}if(a==="ModelObserved"){const f=typeof s.model=="string"?s.model:null;if(f){const v=e.agents.get(l);v&&(v.model=f)}const g=s.subagentModels;if(g&&typeof g=="object")for(const[v,w]of Object.entries(g)){if(typeof w!="string")continue;const E=`${l}::${v}`,b=e.agents.get(E);b&&(b.model=w)}return e}if(a==="ContextObserved"){const f=s.context??null;if(f){const g=e.agents.get(l);if(g){const v=g.context??Zb(),w=(b,S)=>typeof f[b]=="number"?f[b]:S,E=Array.isArray(f.memoryFiles)?f.memoryFiles:Array.isArray(f.claudeMdFiles)?f.claudeMdFiles:null;g.context={msgsUser:w("msgsUser",v.msgsUser),msgsAssistant:w("msgsAssistant",v.msgsAssistant),toolUses:w("toolUses",v.toolUses),toolResults:w("toolResults",v.toolResults),systemReminders:w("systemReminders",v.systemReminders),currentContextTokens:w("currentContextTokens",v.currentContextTokens),memoryFiles:E??v.memoryFiles}}}return e}if(a==="SessionNamed"){const f=e.agents.get(l);if(f){const g=typeof s.sessionName=="string"?s.sessionName.trim():"",v=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";g&&(f.sessionName=g),v&&(f.sessionTitle=v);const w=f.sessionName??"";f.sessionTitle&&w&&f.sessionTitle.toLowerCase()===w.toLowerCase()&&(f.sessionTitle=void 0)}return e}if(a==="UsageObserved"){const f=s.usage??null;if(f){const g=e.agents.get(l);if(g){g.usage.inputTokens=Number(f.input_tokens??0),g.usage.outputTokens=Number(f.output_tokens??0),g.usage.cacheReadTokens=Number(f.cache_read_input_tokens??f.cached_input_tokens??0),g.usage.cacheCreateTokens=Number(f.cache_creation_input_tokens??f.cache_write_input_tokens??0);const v=Aw(f);g.usage.cacheCreate1hTokens=v.cacheCreate1hTokens,g.usage.cacheCreate5mTokens=v.cacheCreate5mTokens,typeof f.reasoning_output_tokens=="number"&&(g.usage.reasoningOutputTokens=Number(f.reasoning_output_tokens)),g.usageByModel=fL(s.usageByModel)}}return e}const h=pL(e,s,i);h.provider||(h.provider=s.provider==="codex"?"codex":"claude");const p=aT(s);switch(p&&(h.model=p),a){case"SessionStart":{const f=Oi(e,l,i,!1);f.synthetic=!1,f.state="active",f.closedAt=void 0,f.startedAt=f.startedAt||i,!f.cwd&&s.cwd&&(f.cwd=s.cwd,f.cwdBasename=Os(s.cwd)),f.label==="session"&&s.cwd&&(f.label=Os(s.cwd)??"session");break}case"UserPromptSubmit":{for(const v of e.agents.values())v.sessionId===l&&v.kind==="subagent"&&v.state==="done"&&v.exitAt==null&&v.endedAt!=null&&v.endedAt<i&&(v.exitAt=i);const f=Oi(e,l,i,!1);f.state="active",f.endedAt=void 0,f.closedAt=void 0,f.exitAt=void 0;const g=(typeof s.prompt=="string"?s.prompt:typeof s.message=="string"?s.message:"")??"";g&&!bL(f,i,g)&&(f.prompts.push({at:i,text:g}),f.firstPrompt||(f.firstPrompt=au(g,120)));break}case"PreToolUse":{const f=s.tool_use_id?xL(e,h,s.tool_use_id):null;if(f){s.tool_name&&f.name==="?"&&(f.name=s.tool_name),f.endedAt==null&&!f.trimmed&&s.tool_input!==void 0&&(f.input=s.tool_input,f.inputPreview=au(s.tool_input));break}const g=s.tool_use_id??`${h.id}:${h.toolCount}`,v=ul(s),w={id:g,name:s.tool_name??"?",input:s.tool_input,inputPreview:au(s.tool_input),agentId:h.id,explicitSubagentId:v?Al(l,v):void 0,startedAt:i};h.tools.push(w),h.toolCount+=1,h.state="active",e.toolIndex.set(g,w),e.toolOwner.set(g,h.id),wL(e,h);break}case"PostToolUse":case"PostToolUseFailure":{const f=s.tool_use_id;if(!f)break;let g=e.toolIndex.get(f),v=!1;if(!g)for(const E of e.agents.values()){const b=E.tools.find(S=>S.id===f);if(b){g=b,v=!0;break}}if(!g||g.outcomeApplied)break;g.outcomeApplied=!0,g.outcomeGap=void 0,g.endedAt=i,g.ok=a==="PostToolUse",g.trimmed||(g.response=s.tool_response),a==="PostToolUseFailure"?g.errorPreview=au(s.tool_response):v&&(g.errorPreview=void 0);const w=iT(s.tool_response);w&&(g.usage=w),e.toolIndex.delete(f),e.toolOwner.delete(f);break}case"SubagentStart":{const f=ul(s);if(!f)break;const g=mL(e,l,f,s,i);g.state="active",g.startedAt=g.startedAt||i,g.exitAt=void 0,g.endedAt=void 0;const v=Iu(s);v&&(g.label=v),gL(e,l,f);break}case"SubagentStop":{const f=ul(s);if(!f)break;const g=lT(e,l,f,s);if(!g)break;g.state="done",g.endedAt=i,yL(e,l,f);break}case"Stop":case"SessionEnd":{const f=Oi(e,l,i,!1);f.state="done",f.endedAt=i,a==="SessionEnd"&&(f.closedAt=i),e.activeSubagentStack.delete(l);break}case"Notification":{const f=jL(s.notification_type);if(!f)break;const g=Oi(e,l,i,!1),v=typeof s.message=="string"?s.message:"",w=g.waiting;g.waiting=w&&w.kind===f&&w.message===v?{...w,since:Math.min(w.since,i)}:IL(e,l,f,v,i);break}}return e}function Mw(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return Math.abs(t)%360}const PL={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},$L=[{match:/^claude[-_](fable|mythos)[-_]5[-_.]1\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:10,output:50,cacheRead:.25,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_](fable|mythos)[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_]opus[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]sonnet[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:PL},{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 LL(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function Qi(e,t=Date.now()){if(!e)return null;const n=Rl(e);for(const s of $L)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function uT(e,t){const n=Math.max(0,e.cacheCreate1hTokens??0),s=Math.max(0,e.cacheCreate5mTokens??0),i=Math.max(0,e.cacheCreateTokens-n-s),a=s+i,l=t.cacheWrite1h??t.cacheWrite;return{tokens5m:a,tokens1h:n,usd5m:a*t.cacheWrite/1e6,usd1h:n*l/1e6}}function dT(e,t,n=Date.now()){if(!LL(t))return e.inputTokens;const s=Qi(t,n),i=((s==null?void 0:s.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-i)}function Iw(e,t,n=Date.now()){const s=Qi(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const i=dT(e,t,n)*s.input/1e6,a=e.outputTokens*s.output/1e6,l=e.cacheReadTokens*s.cacheRead/1e6,u=uT(e,s),h=u.usd5m+u.usd1h;return{input:i,output:a,cacheRead:l,cacheWrite:h,total:i+a+l+h}}const r1=2e5,qL=1e6,DL=[/\[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],FL=[{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 zL(e){if(!e)return r1;const t=Rl(e);for(const n of DL)if(n.test(t))return qL;for(const n of FL)if(n.match.test(t))return n.window;return r1}function fT(e,t){return typeof e=="number"&&e>0?e:zL(t)}const Mi="not priced";function tt(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 Ow(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${tt(s)}/min`:`${tt(n*3600)}/hr`}function BL(e,t){const n={inputTokens:e.inputTokens+t.inputTokens,outputTokens:e.outputTokens+t.outputTokens,cacheReadTokens:e.cacheReadTokens+t.cacheReadTokens,cacheCreateTokens:e.cacheCreateTokens+t.cacheCreateTokens};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0||t.cacheCreate1hTokens!==void 0||t.cacheCreate5mTokens!==void 0)&&(n.cacheCreate1hTokens=(e.cacheCreate1hTokens??0)+(t.cacheCreate1hTokens??0),n.cacheCreate5mTokens=(e.cacheCreate5mTokens??0)+(t.cacheCreate5mTokens??0)),(e.reasoningOutputTokens!==void 0||t.reasoningOutputTokens!==void 0)&&(n.reasoningOutputTokens=(e.reasoningOutputTokens??0)+(t.reasoningOutputTokens??0)),n}function UL(e,t){let n=0,s=0,i=0,a=0,l=0,u=0;for(const g of t)n+=g.inputTokens,s+=g.outputTokens,i+=g.cacheReadTokens,a+=g.cacheCreateTokens,l+=g.cacheCreate1hTokens??0,u+=g.cacheCreate5mTokens??0;const h=(g,v)=>Math.max(0,g-v),p={inputTokens:h(e.inputTokens,n),outputTokens:h(e.outputTokens,s),cacheReadTokens:h(e.cacheReadTokens,i),cacheCreateTokens:h(e.cacheCreateTokens,a)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=h(e.cacheCreate1hTokens??0,l),p.cacheCreate5mTokens=h(e.cacheCreate5mTokens??0,u)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function Il(e){const t=e.usageByModel,n=t?Object.keys(t):[];if(!t||n.length===0)return[{model:e.model,usage:e.usage}];const s=n.map(a=>({model:a,usage:t[a]})),i=UL(e.usage,s.map(a=>a.usage));if(i){const a=s.findIndex(l=>l.model===e.model);a>=0?s[a]={model:s[a].model,usage:BL(s[a].usage,i)}:s.push({model:e.model,usage:i})}return s}function kn(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const s of Il(e)){const i=Iw(s.usage,s.model,t);n.input+=i.input,n.output+=i.output,n.cacheRead+=i.cacheRead,n.cacheWrite+=i.cacheWrite,n.total+=i.total}return n}function Kv(e,t=Date.now()){let n=0;for(const s of Il(e))Qi(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function hT(e){const t=[];for(const n of Il(e)){if(!n.model||t.includes(n.model))continue;const s=n.usage;s.inputTokens+s.outputTokens+s.cacheReadTokens+s.cacheCreateTokens<=0||t.push(n.model)}return t}function pT(e){return hT(e).filter(t=>t!==e.model)}const WL=new Set(["untrusted","on-request","on-failure"]);function HL(e){return typeof e!="string"||!e?null:WL.has(e)?!0:e==="never"?!1:null}function GL(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=HL(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."}
|
|
56
|
+
*/var ib;function lM(){if(ib)return Vf;ib=1;var e=Nl(),t=aM();function n(p,f){return p===f&&(p!==0||1/p===1/f)||p!==p&&f!==f}var s=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,a=e.useRef,l=e.useEffect,u=e.useMemo,h=e.useDebugValue;return Vf.useSyncExternalStoreWithSelector=function(p,f,g,v,w){var E=a(null);if(E.current===null){var b={hasValue:!1,value:null};E.current=b}else b=E.current;E=u(function(){function _(P){if(!N){if(N=!0,C=P,P=v(P),w!==void 0&&b.hasValue){var I=b.value;if(w(I,P))return j=I}return j=P}if(I=j,s(C,P))return I;var F=v(P);return w!==void 0&&w(I,F)?(C=P,I):(C=P,j=F)}var N=!1,C,j,M=g===void 0?null:g;return[function(){return _(f())},M===null?void 0:function(){return _(M())}]},[f,g,v,w]);var S=i(p,E[0],E[1]);return l(function(){b.hasValue=!0,b.value=S},[S]),h(S),S},Vf}var ab;function cM(){return ab||(ab=1,Gf.exports=lM()),Gf.exports}var uM=cM();const dM=fw(uM),fM={},lb=e=>{let t;const n=new Set,s=(f,g)=>{const v=typeof f=="function"?f(t):f;if(!Object.is(v,t)){const w=t;t=g??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(E=>E(t,w))}},i=()=>t,h={setState:s,getState:i,getInitialState:()=>p,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(fM?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},p=t=e(s,i,h);return h},hM=e=>e?lb(e):lb,{useDebugValue:pM}=de,{useSyncExternalStoreWithSelector:mM}=dM,gM=e=>e;function $C(e,t=gM,n){const s=mM(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return pM(s),s}const cb=(e,t)=>{const n=hM(e),s=(i,a=t)=>$C(n,i,a);return Object.assign(s,n),s},yM=(e,t)=>e?cb(e,t):cb;function Lt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,i]of e)if(!Object.is(i,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}var vM={value:()=>{}};function zu(){for(var e=0,t=arguments.length,n={},s;e<t;++e){if(!(s=arguments[e]+"")||s in n||/[\s.]/.test(s))throw new Error("illegal type: "+s);n[s]=[]}return new yu(n)}function yu(e){this._=e}function wM(e,t){return e.trim().split(/^|\s+/).map(function(n){var s="",i=n.indexOf(".");if(i>=0&&(s=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}yu.prototype=zu.prototype={constructor:yu,on:function(e,t){var n=this._,s=wM(e+"",n),i,a=-1,l=s.length;if(arguments.length<2){for(;++a<l;)if((i=(e=s[a]).type)&&(i=xM(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<l;)if(i=(e=s[a]).type)n[i]=ub(n[i],e.name,t);else if(t==null)for(i in n)n[i]=ub(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new yu(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),s=0,i,a;s<i;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],s=0,i=a.length;s<i;++s)a[s].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var s=this._[e],i=0,a=s.length;i<a;++i)s[i].value.apply(t,n)}};function xM(e,t){for(var n=0,s=e.length,i;n<s;++n)if((i=e[n]).name===t)return i.value}function ub(e,t,n){for(var s=0,i=e.length;s<i;++s)if(e[s].name===t){e[s]=vM,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var Mv="http://www.w3.org/1999/xhtml";const db={svg:"http://www.w3.org/2000/svg",xhtml:Mv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Bu(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),db.hasOwnProperty(t)?{space:db[t],local:e}:e}function bM(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Mv&&t.documentElement.namespaceURI===Mv?t.createElement(e):t.createElementNS(n,e)}}function kM(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function LC(e){var t=Bu(e);return(t.local?kM:bM)(t)}function _M(){}function hw(e){return e==null?_M:function(){return this.querySelector(e)}}function SM(e){typeof e!="function"&&(e=hw(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var a=t[i],l=a.length,u=s[i]=new Array(l),h,p,f=0;f<l;++f)(h=a[f])&&(p=e.call(h,h.__data__,f,a))&&("__data__"in h&&(p.__data__=h.__data__),u[f]=p);return new _n(s,this._parents)}function NM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function EM(){return[]}function qC(e){return e==null?EM:function(){return this.querySelectorAll(e)}}function CM(e){return function(){return NM(e.apply(this,arguments))}}function jM(e){typeof e=="function"?e=CM(e):e=qC(e);for(var t=this._groups,n=t.length,s=[],i=[],a=0;a<n;++a)for(var l=t[a],u=l.length,h,p=0;p<u;++p)(h=l[p])&&(s.push(e.call(h,h.__data__,p,l)),i.push(h));return new _n(s,i)}function DC(e){return function(){return this.matches(e)}}function FC(e){return function(t){return t.matches(e)}}var TM=Array.prototype.find;function RM(e){return function(){return TM.call(this.children,e)}}function AM(){return this.firstElementChild}function MM(e){return this.select(e==null?AM:RM(typeof e=="function"?e:FC(e)))}var IM=Array.prototype.filter;function OM(){return Array.from(this.children)}function PM(e){return function(){return IM.call(this.children,e)}}function $M(e){return this.selectAll(e==null?OM:PM(typeof e=="function"?e:FC(e)))}function LM(e){typeof e!="function"&&(e=DC(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var a=t[i],l=a.length,u=s[i]=[],h,p=0;p<l;++p)(h=a[p])&&e.call(h,h.__data__,p,a)&&u.push(h);return new _n(s,this._parents)}function zC(e){return new Array(e.length)}function qM(){return new _n(this._enter||this._groups.map(zC),this._parents)}function Su(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Su.prototype={constructor:Su,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 DM(e){return function(){return e}}function FM(e,t,n,s,i,a){for(var l=0,u,h=t.length,p=a.length;l<p;++l)(u=t[l])?(u.__data__=a[l],s[l]=u):n[l]=new Su(e,a[l]);for(;l<h;++l)(u=t[l])&&(i[l]=u)}function zM(e,t,n,s,i,a,l){var u,h,p=new Map,f=t.length,g=a.length,v=new Array(f),w;for(u=0;u<f;++u)(h=t[u])&&(v[u]=w=l.call(h,h.__data__,u,t)+"",p.has(w)?i[u]=h:p.set(w,h));for(u=0;u<g;++u)w=l.call(e,a[u],u,a)+"",(h=p.get(w))?(s[u]=h,h.__data__=a[u],p.delete(w)):n[u]=new Su(e,a[u]);for(u=0;u<f;++u)(h=t[u])&&p.get(v[u])===h&&(i[u]=h)}function BM(e){return e.__data__}function UM(e,t){if(!arguments.length)return Array.from(this,BM);var n=t?zM:FM,s=this._parents,i=this._groups;typeof e!="function"&&(e=DM(e));for(var a=i.length,l=new Array(a),u=new Array(a),h=new Array(a),p=0;p<a;++p){var f=s[p],g=i[p],v=g.length,w=WM(e.call(f,f&&f.__data__,p,s)),E=w.length,b=u[p]=new Array(E),S=l[p]=new Array(E),_=h[p]=new Array(v);n(f,g,b,S,_,w,t);for(var N=0,C=0,j,M;N<E;++N)if(j=b[N]){for(N>=C&&(C=N+1);!(M=S[C])&&++C<E;);j._next=M||null}}return l=new _n(l,s),l._enter=u,l._exit=h,l}function WM(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function HM(){return new _n(this._exit||this._groups.map(zC),this._parents)}function GM(e,t,n){var s=this.enter(),i=this,a=this.exit();return typeof e=="function"?(s=e(s),s&&(s=s.selection())):s=s.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?a.remove():n(a),s&&i?s.merge(i).order():i}function VM(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,i=n.length,a=s.length,l=Math.min(i,a),u=new Array(i),h=0;h<l;++h)for(var p=n[h],f=s[h],g=p.length,v=u[h]=new Array(g),w,E=0;E<g;++E)(w=p[E]||f[E])&&(v[E]=w);for(;h<i;++h)u[h]=n[h];return new _n(u,this._parents)}function YM(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var s=e[t],i=s.length-1,a=s[i],l;--i>=0;)(l=s[i])&&(a&&l.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(l,a),a=l);return this}function KM(e){e||(e=XM);function t(g,v){return g&&v?e(g.__data__,v.__data__):!g-!v}for(var n=this._groups,s=n.length,i=new Array(s),a=0;a<s;++a){for(var l=n[a],u=l.length,h=i[a]=new Array(u),p,f=0;f<u;++f)(p=l[f])&&(h[f]=p);h.sort(t)}return new _n(i,this._parents).order()}function XM(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function QM(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ZM(){return Array.from(this)}function JM(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],i=0,a=s.length;i<a;++i){var l=s[i];if(l)return l}return null}function e2(){let e=0;for(const t of this)++e;return e}function t2(){return!this.node()}function n2(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var i=t[n],a=0,l=i.length,u;a<l;++a)(u=i[a])&&e.call(u,u.__data__,a,i);return this}function r2(e){return function(){this.removeAttribute(e)}}function s2(e){return function(){this.removeAttributeNS(e.space,e.local)}}function o2(e,t){return function(){this.setAttribute(e,t)}}function i2(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function a2(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function l2(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function c2(e,t){var n=Bu(e);if(arguments.length<2){var s=this.node();return n.local?s.getAttributeNS(n.space,n.local):s.getAttribute(n)}return this.each((t==null?n.local?s2:r2:typeof t=="function"?n.local?l2:a2:n.local?i2:o2)(n,t))}function BC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function u2(e){return function(){this.style.removeProperty(e)}}function d2(e,t,n){return function(){this.style.setProperty(e,t,n)}}function f2(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function h2(e,t,n){return arguments.length>1?this.each((t==null?u2:typeof t=="function"?f2:d2)(e,t,n??"")):Bi(this.node(),e)}function Bi(e,t){return e.style.getPropertyValue(t)||BC(e).getComputedStyle(e,null).getPropertyValue(t)}function p2(e){return function(){delete this[e]}}function m2(e,t){return function(){this[e]=t}}function g2(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function y2(e,t){return arguments.length>1?this.each((t==null?p2:typeof t=="function"?g2:m2)(e,t)):this.node()[e]}function UC(e){return e.trim().split(/^|\s+/)}function pw(e){return e.classList||new WC(e)}function WC(e){this._node=e,this._names=UC(e.getAttribute("class")||"")}WC.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 HC(e,t){for(var n=pw(e),s=-1,i=t.length;++s<i;)n.add(t[s])}function GC(e,t){for(var n=pw(e),s=-1,i=t.length;++s<i;)n.remove(t[s])}function v2(e){return function(){HC(this,e)}}function w2(e){return function(){GC(this,e)}}function x2(e,t){return function(){(t.apply(this,arguments)?HC:GC)(this,e)}}function b2(e,t){var n=UC(e+"");if(arguments.length<2){for(var s=pw(this.node()),i=-1,a=n.length;++i<a;)if(!s.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?x2:t?v2:w2)(n,t))}function k2(){this.textContent=""}function _2(e){return function(){this.textContent=e}}function S2(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function N2(e){return arguments.length?this.each(e==null?k2:(typeof e=="function"?S2:_2)(e)):this.node().textContent}function E2(){this.innerHTML=""}function C2(e){return function(){this.innerHTML=e}}function j2(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function T2(e){return arguments.length?this.each(e==null?E2:(typeof e=="function"?j2:C2)(e)):this.node().innerHTML}function R2(){this.nextSibling&&this.parentNode.appendChild(this)}function A2(){return this.each(R2)}function M2(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function I2(){return this.each(M2)}function O2(e){var t=typeof e=="function"?e:LC(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function P2(){return null}function $2(e,t){var n=typeof e=="function"?e:LC(e),s=t==null?P2:typeof t=="function"?t:hw(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function L2(){var e=this.parentNode;e&&e.removeChild(this)}function q2(){return this.each(L2)}function D2(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function F2(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function z2(e){return this.select(e?F2:D2)}function B2(e){return arguments.length?this.property("__data__",e):this.node().__data__}function U2(e){return function(t){e.call(this,t,this.__data__)}}function W2(e){return e.trim().split(/^|\s+/).map(function(t){var n="",s=t.indexOf(".");return s>=0&&(n=t.slice(s+1),t=t.slice(0,s)),{type:t,name:n}})}function H2(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++s]=a;++s?t.length=s:delete this.__on}}}function G2(e,t,n){return function(){var s=this.__on,i,a=U2(t);if(s){for(var l=0,u=s.length;l<u;++l)if((i=s[l]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},s?s.push(i):this.__on=[i]}}function V2(e,t,n){var s=W2(e+""),i,a=s.length,l;if(arguments.length<2){var u=this.node().__on;if(u){for(var h=0,p=u.length,f;h<p;++h)for(i=0,f=u[h];i<a;++i)if((l=s[i]).type===f.type&&l.name===f.name)return f.value}return}for(u=t?G2:H2,i=0;i<a;++i)this.each(u(s[i],t,n));return this}function VC(e,t,n){var s=BC(e),i=s.CustomEvent;typeof i=="function"?i=new i(t,n):(i=s.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Y2(e,t){return function(){return VC(this,e,t)}}function K2(e,t){return function(){return VC(this,e,t.apply(this,arguments))}}function X2(e,t){return this.each((typeof t=="function"?K2:Y2)(e,t))}function*Q2(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],i=0,a=s.length,l;i<a;++i)(l=s[i])&&(yield l)}var YC=[null];function _n(e,t){this._groups=e,this._parents=t}function El(){return new _n([[document.documentElement]],YC)}function Z2(){return this}_n.prototype=El.prototype={constructor:_n,select:SM,selectAll:jM,selectChild:MM,selectChildren:$M,filter:LM,data:UM,enter:qM,exit:HM,join:GM,merge:VM,selection:Z2,order:YM,sort:KM,call:QM,nodes:ZM,node:JM,size:e2,empty:t2,each:n2,attr:c2,style:h2,property:y2,classed:b2,text:N2,html:T2,raise:A2,lower:I2,append:O2,insert:$2,remove:q2,clone:z2,datum:B2,on:V2,dispatch:X2,[Symbol.iterator]:Q2};function qn(e){return typeof e=="string"?new _n([[document.querySelector(e)]],[document.documentElement]):new _n([[e]],YC)}function J2(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ir(e,t){if(e=J2(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var s=n.createSVGPoint();return s.x=e.clientX,s.y=e.clientY,s=s.matrixTransform(t.getScreenCTM().inverse()),[s.x,s.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const eI={passive:!1},fl={capture:!0,passive:!1};function Xf(e){e.stopImmediatePropagation()}function Li(e){e.preventDefault(),e.stopImmediatePropagation()}function KC(e){var t=e.document.documentElement,n=qn(e).on("dragstart.drag",Li,fl);"onselectstart"in t?n.on("selectstart.drag",Li,fl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function XC(e,t){var n=e.document.documentElement,s=qn(e).on("dragstart.drag",null);t&&(s.on("click.drag",Li,fl),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in n?s.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Zc=e=>()=>e;function Iv(e,{sourceEvent:t,subject:n,target:s,identifier:i,active:a,x:l,y:u,dx:h,dy:p,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:f}})}Iv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function tI(e){return!e.ctrlKey&&!e.button}function nI(){return this.parentNode}function rI(e,t){return t??{x:e.x,y:e.y}}function sI(){return navigator.maxTouchPoints||"ontouchstart"in this}function oI(){var e=tI,t=nI,n=rI,s=sI,i={},a=zu("start","drag","end"),l=0,u,h,p,f,g=0;function v(j){j.on("mousedown.drag",w).filter(s).on("touchstart.drag",S).on("touchmove.drag",_,eI).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(j,M){if(!(f||!e.call(this,j,M))){var P=C(this,t.call(this,j,M),j,M,"mouse");P&&(qn(j.view).on("mousemove.drag",E,fl).on("mouseup.drag",b,fl),KC(j.view),Xf(j),p=!1,u=j.clientX,h=j.clientY,P("start",j))}}function E(j){if(Li(j),!p){var M=j.clientX-u,P=j.clientY-h;p=M*M+P*P>g}i.mouse("drag",j)}function b(j){qn(j.view).on("mousemove.drag mouseup.drag",null),XC(j.view,p),Li(j),i.mouse("end",j)}function S(j,M){if(e.call(this,j,M)){var P=j.changedTouches,I=t.call(this,j,M),F=P.length,O,A;for(O=0;O<F;++O)(A=C(this,I,j,M,P[O].identifier,P[O]))&&(Xf(j),A("start",j,P[O]))}}function _(j){var M=j.changedTouches,P=M.length,I,F;for(I=0;I<P;++I)(F=i[M[I].identifier])&&(Li(j),F("drag",j,M[I]))}function N(j){var M=j.changedTouches,P=M.length,I,F;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),I=0;I<P;++I)(F=i[M[I].identifier])&&(Xf(j),F("end",j,M[I]))}function C(j,M,P,I,F,O){var A=a.copy(),L=ir(O||P,M),H,X,R;if((R=n.call(j,new Iv("beforestart",{sourceEvent:P,target:v,identifier:F,active:l,x:L[0],y:L[1],dx:0,dy:0,dispatch:A}),I))!=null)return H=R.x-L[0]||0,X=R.y-L[1]||0,function K(G,ne,Q){var W=L,ee;switch(G){case"start":i[F]=K,ee=l++;break;case"end":delete i[F],--l;case"drag":L=ir(Q||ne,M),ee=l;break}A.call(G,j,new Iv(G,{sourceEvent:ne,subject:R,target:v,identifier:F,active:ee,x:L[0]+H,y:L[1]+X,dx:L[0]-W[0],dy:L[1]-W[1],dispatch:A}),I)}}return v.filter=function(j){return arguments.length?(e=typeof j=="function"?j:Zc(!!j),v):e},v.container=function(j){return arguments.length?(t=typeof j=="function"?j:Zc(j),v):t},v.subject=function(j){return arguments.length?(n=typeof j=="function"?j:Zc(j),v):n},v.touchable=function(j){return arguments.length?(s=typeof j=="function"?j:Zc(!!j),v):s},v.on=function(){var j=a.on.apply(a,arguments);return j===a?v:j},v.clickDistance=function(j){return arguments.length?(g=(j=+j)*j,v):Math.sqrt(g)},v}function mw(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function QC(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function Cl(){}var hl=.7,Nu=1/hl,qi="\\s*([+-]?\\d+)\\s*",pl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Cr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",iI=/^#([0-9a-f]{3,8})$/,aI=new RegExp(`^rgb\\(${qi},${qi},${qi}\\)$`),lI=new RegExp(`^rgb\\(${Cr},${Cr},${Cr}\\)$`),cI=new RegExp(`^rgba\\(${qi},${qi},${qi},${pl}\\)$`),uI=new RegExp(`^rgba\\(${Cr},${Cr},${Cr},${pl}\\)$`),dI=new RegExp(`^hsl\\(${pl},${Cr},${Cr}\\)$`),fI=new RegExp(`^hsla\\(${pl},${Cr},${Cr},${pl}\\)$`),fb={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};mw(Cl,ml,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:hb,formatHex:hb,formatHex8:hI,formatHsl:pI,formatRgb:pb,toString:pb});function hb(){return this.rgb().formatHex()}function hI(){return this.rgb().formatHex8()}function pI(){return ZC(this).formatHsl()}function pb(){return this.rgb().formatRgb()}function ml(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=iI.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?mb(t):n===3?new hn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Jc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Jc(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=aI.exec(e))?new hn(t[1],t[2],t[3],1):(t=lI.exec(e))?new hn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=cI.exec(e))?Jc(t[1],t[2],t[3],t[4]):(t=uI.exec(e))?Jc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=dI.exec(e))?vb(t[1],t[2]/100,t[3]/100,1):(t=fI.exec(e))?vb(t[1],t[2]/100,t[3]/100,t[4]):fb.hasOwnProperty(e)?mb(fb[e]):e==="transparent"?new hn(NaN,NaN,NaN,0):null}function mb(e){return new hn(e>>16&255,e>>8&255,e&255,1)}function Jc(e,t,n,s){return s<=0&&(e=t=n=NaN),new hn(e,t,n,s)}function mI(e){return e instanceof Cl||(e=ml(e)),e?(e=e.rgb(),new hn(e.r,e.g,e.b,e.opacity)):new hn}function Ov(e,t,n,s){return arguments.length===1?mI(e):new hn(e,t,n,s??1)}function hn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}mw(hn,Ov,QC(Cl,{brighter(e){return e=e==null?Nu:Math.pow(Nu,e),new hn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?hl:Math.pow(hl,e),new hn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new hn(_o(this.r),_o(this.g),_o(this.b),Eu(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:gb,formatHex:gb,formatHex8:gI,formatRgb:yb,toString:yb}));function gb(){return`#${bo(this.r)}${bo(this.g)}${bo(this.b)}`}function gI(){return`#${bo(this.r)}${bo(this.g)}${bo(this.b)}${bo((isNaN(this.opacity)?1:this.opacity)*255)}`}function yb(){const e=Eu(this.opacity);return`${e===1?"rgb(":"rgba("}${_o(this.r)}, ${_o(this.g)}, ${_o(this.b)}${e===1?")":`, ${e})`}`}function Eu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function _o(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function bo(e){return e=_o(e),(e<16?"0":"")+e.toString(16)}function vb(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ar(e,t,n,s)}function ZC(e){if(e instanceof ar)return new ar(e.h,e.s,e.l,e.opacity);if(e instanceof Cl||(e=ml(e)),!e)return new ar;if(e instanceof ar)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,i=Math.min(t,n,s),a=Math.max(t,n,s),l=NaN,u=a-i,h=(a+i)/2;return u?(t===a?l=(n-s)/u+(n<s)*6:n===a?l=(s-t)/u+2:l=(t-n)/u+4,u/=h<.5?a+i:2-a-i,l*=60):u=h>0&&h<1?0:l,new ar(l,u,h,e.opacity)}function yI(e,t,n,s){return arguments.length===1?ZC(e):new ar(e,t,n,s??1)}function ar(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}mw(ar,yI,QC(Cl,{brighter(e){return e=e==null?Nu:Math.pow(Nu,e),new ar(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?hl:Math.pow(hl,e),new ar(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,s=n+(n<.5?n:1-n)*t,i=2*n-s;return new hn(Qf(e>=240?e-240:e+120,i,s),Qf(e,i,s),Qf(e<120?e+240:e-120,i,s),this.opacity)},clamp(){return new ar(wb(this.h),eu(this.s),eu(this.l),Eu(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=Eu(this.opacity);return`${e===1?"hsl(":"hsla("}${wb(this.h)}, ${eu(this.s)*100}%, ${eu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function wb(e){return e=(e||0)%360,e<0?e+360:e}function eu(e){return Math.max(0,Math.min(1,e||0))}function Qf(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const JC=e=>()=>e;function vI(e,t){return function(n){return e+n*t}}function wI(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function xI(e){return(e=+e)==1?ej:function(t,n){return n-t?wI(t,n,e):JC(isNaN(t)?n:t)}}function ej(e,t){var n=t-e;return n?vI(e,n):JC(isNaN(e)?t:e)}const xb=(function e(t){var n=xI(t);function s(i,a){var l=n((i=Ov(i)).r,(a=Ov(a)).r),u=n(i.g,a.g),h=n(i.b,a.b),p=ej(i.opacity,a.opacity);return function(f){return i.r=l(f),i.g=u(f),i.b=h(f),i.opacity=p(f),i+""}}return s.gamma=e,s})(1);function As(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Pv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Zf=new RegExp(Pv.source,"g");function bI(e){return function(){return e}}function kI(e){return function(t){return e(t)+""}}function _I(e,t){var n=Pv.lastIndex=Zf.lastIndex=0,s,i,a,l=-1,u=[],h=[];for(e=e+"",t=t+"";(s=Pv.exec(e))&&(i=Zf.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),u[l]?u[l]+=a:u[++l]=a),(s=s[0])===(i=i[0])?u[l]?u[l]+=i:u[++l]=i:(u[++l]=null,h.push({i:l,x:As(s,i)})),n=Zf.lastIndex;return n<t.length&&(a=t.slice(n),u[l]?u[l]+=a:u[++l]=a),u.length<2?h[0]?kI(h[0].x):bI(t):(t=h.length,function(p){for(var f=0,g;f<t;++f)u[(g=h[f]).i]=g.x(p);return u.join("")})}var bb=180/Math.PI,$v={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function tj(e,t,n,s,i,a){var l,u,h;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(h=e*n+t*s)&&(n-=e*h,s-=t*h),(u=Math.sqrt(n*n+s*s))&&(n/=u,s/=u,h/=u),e*s<t*n&&(e=-e,t=-t,h=-h,l=-l),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*bb,skewX:Math.atan(h)*bb,scaleX:l,scaleY:u}}var tu;function SI(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?$v:tj(t.a,t.b,t.c,t.d,t.e,t.f)}function NI(e){return e==null||(tu||(tu=document.createElementNS("http://www.w3.org/2000/svg","g")),tu.setAttribute("transform",e),!(e=tu.transform.baseVal.consolidate()))?$v:(e=e.matrix,tj(e.a,e.b,e.c,e.d,e.e,e.f))}function nj(e,t,n,s){function i(p){return p.length?p.pop()+" ":""}function a(p,f,g,v,w,E){if(p!==g||f!==v){var b=w.push("translate(",null,t,null,n);E.push({i:b-4,x:As(p,g)},{i:b-2,x:As(f,v)})}else(g||v)&&w.push("translate("+g+t+v+n)}function l(p,f,g,v){p!==f?(p-f>180?f+=360:f-p>180&&(p+=360),v.push({i:g.push(i(g)+"rotate(",null,s)-2,x:As(p,f)})):f&&g.push(i(g)+"rotate("+f+s)}function u(p,f,g,v){p!==f?v.push({i:g.push(i(g)+"skewX(",null,s)-2,x:As(p,f)}):f&&g.push(i(g)+"skewX("+f+s)}function h(p,f,g,v,w,E){if(p!==g||f!==v){var b=w.push(i(w)+"scale(",null,",",null,")");E.push({i:b-4,x:As(p,g)},{i:b-2,x:As(f,v)})}else(g!==1||v!==1)&&w.push(i(w)+"scale("+g+","+v+")")}return function(p,f){var g=[],v=[];return p=e(p),f=e(f),a(p.translateX,p.translateY,f.translateX,f.translateY,g,v),l(p.rotate,f.rotate,g,v),u(p.skewX,f.skewX,g,v),h(p.scaleX,p.scaleY,f.scaleX,f.scaleY,g,v),p=f=null,function(w){for(var E=-1,b=v.length,S;++E<b;)g[(S=v[E]).i]=S.x(w);return g.join("")}}}var EI=nj(SI,"px, ","px)","deg)"),CI=nj(NI,", ",")",")"),jI=1e-12;function kb(e){return((e=Math.exp(e))+1/e)/2}function TI(e){return((e=Math.exp(e))-1/e)/2}function RI(e){return((e=Math.exp(2*e))-1)/(e+1)}const AI=(function e(t,n,s){function i(a,l){var u=a[0],h=a[1],p=a[2],f=l[0],g=l[1],v=l[2],w=f-u,E=g-h,b=w*w+E*E,S,_;if(b<jI)_=Math.log(v/p)/t,S=function(I){return[u+I*w,h+I*E,p*Math.exp(t*I*_)]};else{var N=Math.sqrt(b),C=(v*v-p*p+s*b)/(2*p*n*N),j=(v*v-p*p-s*b)/(2*v*n*N),M=Math.log(Math.sqrt(C*C+1)-C),P=Math.log(Math.sqrt(j*j+1)-j);_=(P-M)/t,S=function(I){var F=I*_,O=kb(M),A=p/(n*N)*(O*RI(t*F+M)-TI(M));return[u+A*w,h+A*E,p*O/kb(t*F+M)]}}return S.duration=_*1e3*t/Math.SQRT2,S}return i.rho=function(a){var l=Math.max(.001,+a),u=l*l,h=u*u;return e(l,u,h)},i})(Math.SQRT2,2,4);var Ui=0,ol=0,Xa=0,rj=1e3,Cu,il,ju=0,No=0,Uu=0,gl=typeof performance=="object"&&performance.now?performance:Date,sj=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function gw(){return No||(sj(MI),No=gl.now()+Uu)}function MI(){No=0}function Tu(){this._call=this._time=this._next=null}Tu.prototype=oj.prototype={constructor:Tu,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?gw():+n)+(t==null?0:+t),!this._next&&il!==this&&(il?il._next=this:Cu=this,il=this),this._call=e,this._time=n,Lv()},stop:function(){this._call&&(this._call=null,this._time=1/0,Lv())}};function oj(e,t,n){var s=new Tu;return s.restart(e,t,n),s}function II(){gw(),++Ui;for(var e=Cu,t;e;)(t=No-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ui}function _b(){No=(ju=gl.now())+Uu,Ui=ol=0;try{II()}finally{Ui=0,PI(),No=0}}function OI(){var e=gl.now(),t=e-ju;t>rj&&(Uu-=t,ju=e)}function PI(){for(var e,t=Cu,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Cu=n);il=e,Lv(s)}function Lv(e){if(!Ui){ol&&(ol=clearTimeout(ol));var t=e-No;t>24?(e<1/0&&(ol=setTimeout(_b,e-gl.now()-Uu)),Xa&&(Xa=clearInterval(Xa))):(Xa||(ju=gl.now(),Xa=setInterval(OI,rj)),Ui=1,sj(_b))}}function Sb(e,t,n){var s=new Tu;return t=t==null?0:+t,s.restart(i=>{s.stop(),e(i+t)},t,n),s}var $I=zu("start","end","cancel","interrupt"),LI=[],ij=0,Nb=1,qv=2,vu=3,Eb=4,Dv=5,wu=6;function Wu(e,t,n,s,i,a){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;qI(e,n,{name:t,index:s,group:i,on:$I,tween:LI,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:ij})}function yw(e,t){var n=fr(e,t);if(n.state>ij)throw new Error("too late; already scheduled");return n}function jr(e,t){var n=fr(e,t);if(n.state>vu)throw new Error("too late; already running");return n}function fr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function qI(e,t,n){var s=e.__transition,i;s[t]=n,n.timer=oj(a,0,n.time);function a(p){n.state=Nb,n.timer.restart(l,n.delay,n.time),n.delay<=p&&l(p-n.delay)}function l(p){var f,g,v,w;if(n.state!==Nb)return h();for(f in s)if(w=s[f],w.name===n.name){if(w.state===vu)return Sb(l);w.state===Eb?(w.state=wu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete s[f]):+f<t&&(w.state=wu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete s[f])}if(Sb(function(){n.state===vu&&(n.state=Eb,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=qv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===qv){for(n.state=vu,i=new Array(v=n.tween.length),f=0,g=-1;f<v;++f)(w=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(i[++g]=w);i.length=g+1}}function u(p){for(var f=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(h),n.state=Dv,1),g=-1,v=i.length;++g<v;)i[g].call(e,f);n.state===Dv&&(n.on.call("end",e,e.__data__,n.index,n.group),h())}function h(){n.state=wu,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function xu(e,t){var n=e.__transition,s,i,a=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((s=n[l]).name!==t){a=!1;continue}i=s.state>qv&&s.state<Dv,s.state=wu,s.timer.stop(),s.on.call(i?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[l]}a&&delete e.__transition}}function DI(e){return this.each(function(){xu(this,e)})}function FI(e,t){var n,s;return function(){var i=jr(this,e),a=i.tween;if(a!==n){s=n=a;for(var l=0,u=s.length;l<u;++l)if(s[l].name===t){s=s.slice(),s.splice(l,1);break}}i.tween=s}}function zI(e,t,n){var s,i;if(typeof n!="function")throw new Error;return function(){var a=jr(this,e),l=a.tween;if(l!==s){i=(s=l).slice();for(var u={name:t,value:n},h=0,p=i.length;h<p;++h)if(i[h].name===t){i[h]=u;break}h===p&&i.push(u)}a.tween=i}}function BI(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=fr(this.node(),n).tween,i=0,a=s.length,l;i<a;++i)if((l=s[i]).name===e)return l.value;return null}return this.each((t==null?FI:zI)(n,e,t))}function vw(e,t,n){var s=e._id;return e.each(function(){var i=jr(this,s);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return fr(i,s).value[t]}}function aj(e,t){var n;return(typeof t=="number"?As:t instanceof ml?xb:(n=ml(t))?(t=n,xb):_I)(e,t)}function UI(e){return function(){this.removeAttribute(e)}}function WI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function HI(e,t,n){var s,i=n+"",a;return function(){var l=this.getAttribute(e);return l===i?null:l===s?a:a=t(s=l,n)}}function GI(e,t,n){var s,i=n+"",a;return function(){var l=this.getAttributeNS(e.space,e.local);return l===i?null:l===s?a:a=t(s=l,n)}}function VI(e,t,n){var s,i,a;return function(){var l,u=n(this),h;return u==null?void this.removeAttribute(e):(l=this.getAttribute(e),h=u+"",l===h?null:l===s&&h===i?a:(i=h,a=t(s=l,u)))}}function YI(e,t,n){var s,i,a;return function(){var l,u=n(this),h;return u==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),h=u+"",l===h?null:l===s&&h===i?a:(i=h,a=t(s=l,u)))}}function KI(e,t){var n=Bu(e),s=n==="transform"?CI:aj;return this.attrTween(e,typeof t=="function"?(n.local?YI:VI)(n,s,vw(this,"attr."+e,t)):t==null?(n.local?WI:UI)(n):(n.local?GI:HI)(n,s,t))}function XI(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function QI(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function ZI(e,t){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&QI(e,a)),n}return i._value=t,i}function JI(e,t){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&XI(e,a)),n}return i._value=t,i}function eO(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var s=Bu(e);return this.tween(n,(s.local?ZI:JI)(s,t))}function tO(e,t){return function(){yw(this,e).delay=+t.apply(this,arguments)}}function nO(e,t){return t=+t,function(){yw(this,e).delay=t}}function rO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?tO:nO)(t,e)):fr(this.node(),t).delay}function sO(e,t){return function(){jr(this,e).duration=+t.apply(this,arguments)}}function oO(e,t){return t=+t,function(){jr(this,e).duration=t}}function iO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?sO:oO)(t,e)):fr(this.node(),t).duration}function aO(e,t){if(typeof t!="function")throw new Error;return function(){jr(this,e).ease=t}}function lO(e){var t=this._id;return arguments.length?this.each(aO(t,e)):fr(this.node(),t).ease}function cO(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;jr(this,e).ease=n}}function uO(e){if(typeof e!="function")throw new Error;return this.each(cO(this._id,e))}function dO(e){typeof e!="function"&&(e=DC(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var a=t[i],l=a.length,u=s[i]=[],h,p=0;p<l;++p)(h=a[p])&&e.call(h,h.__data__,p,a)&&u.push(h);return new es(s,this._parents,this._name,this._id)}function fO(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,i=n.length,a=Math.min(s,i),l=new Array(s),u=0;u<a;++u)for(var h=t[u],p=n[u],f=h.length,g=l[u]=new Array(f),v,w=0;w<f;++w)(v=h[w]||p[w])&&(g[w]=v);for(;u<s;++u)l[u]=t[u];return new es(l,this._parents,this._name,this._id)}function hO(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function pO(e,t,n){var s,i,a=hO(t)?yw:jr;return function(){var l=a(this,e),u=l.on;u!==s&&(i=(s=u).copy()).on(t,n),l.on=i}}function mO(e,t){var n=this._id;return arguments.length<2?fr(this.node(),n).on.on(e):this.each(pO(n,e,t))}function gO(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function yO(){return this.on("end.remove",gO(this._id))}function vO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=hw(e));for(var s=this._groups,i=s.length,a=new Array(i),l=0;l<i;++l)for(var u=s[l],h=u.length,p=a[l]=new Array(h),f,g,v=0;v<h;++v)(f=u[v])&&(g=e.call(f,f.__data__,v,u))&&("__data__"in f&&(g.__data__=f.__data__),p[v]=g,Wu(p[v],t,n,v,p,fr(f,n)));return new es(a,this._parents,t,n)}function wO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=qC(e));for(var s=this._groups,i=s.length,a=[],l=[],u=0;u<i;++u)for(var h=s[u],p=h.length,f,g=0;g<p;++g)if(f=h[g]){for(var v=e.call(f,f.__data__,g,h),w,E=fr(f,n),b=0,S=v.length;b<S;++b)(w=v[b])&&Wu(w,t,n,b,v,E);a.push(v),l.push(f)}return new es(a,l,t,n)}var xO=El.prototype.constructor;function bO(){return new xO(this._groups,this._parents)}function kO(e,t){var n,s,i;return function(){var a=Bi(this,e),l=(this.style.removeProperty(e),Bi(this,e));return a===l?null:a===n&&l===s?i:i=t(n=a,s=l)}}function lj(e){return function(){this.style.removeProperty(e)}}function _O(e,t,n){var s,i=n+"",a;return function(){var l=Bi(this,e);return l===i?null:l===s?a:a=t(s=l,n)}}function SO(e,t,n){var s,i,a;return function(){var l=Bi(this,e),u=n(this),h=u+"";return u==null&&(h=u=(this.style.removeProperty(e),Bi(this,e))),l===h?null:l===s&&h===i?a:(i=h,a=t(s=l,u))}}function NO(e,t){var n,s,i,a="style."+t,l="end."+a,u;return function(){var h=jr(this,e),p=h.on,f=h.value[a]==null?u||(u=lj(t)):void 0;(p!==n||i!==f)&&(s=(n=p).copy()).on(l,i=f),h.on=s}}function EO(e,t,n){var s=(e+="")=="transform"?EI:aj;return t==null?this.styleTween(e,kO(e,s)).on("end.style."+e,lj(e)):typeof t=="function"?this.styleTween(e,SO(e,s,vw(this,"style."+e,t))).each(NO(this._id,e)):this.styleTween(e,_O(e,s,t),n).on("end.style."+e,null)}function CO(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function jO(e,t,n){var s,i;function a(){var l=t.apply(this,arguments);return l!==i&&(s=(i=l)&&CO(e,l,n)),s}return a._value=t,a}function TO(e,t,n){var s="style."+(e+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(t==null)return this.tween(s,null);if(typeof t!="function")throw new Error;return this.tween(s,jO(e,t,n??""))}function RO(e){return function(){this.textContent=e}}function AO(e){return function(){var t=e(this);this.textContent=t??""}}function MO(e){return this.tween("text",typeof e=="function"?AO(vw(this,"text",e)):RO(e==null?"":e+""))}function IO(e){return function(t){this.textContent=e.call(this,t)}}function OO(e){var t,n;function s(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&IO(i)),t}return s._value=e,s}function PO(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,OO(e))}function $O(){for(var e=this._name,t=this._id,n=cj(),s=this._groups,i=s.length,a=0;a<i;++a)for(var l=s[a],u=l.length,h,p=0;p<u;++p)if(h=l[p]){var f=fr(h,t);Wu(h,e,n,p,l,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new es(s,this._parents,e,n)}function LO(){var e,t,n=this,s=n._id,i=n.size();return new Promise(function(a,l){var u={value:l},h={value:function(){--i===0&&a()}};n.each(function(){var p=jr(this,s),f=p.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(h)),p.on=t}),i===0&&a()})}var qO=0;function es(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function cj(){return++qO}var Xr=El.prototype;es.prototype={constructor:es,select:vO,selectAll:wO,selectChild:Xr.selectChild,selectChildren:Xr.selectChildren,filter:dO,merge:fO,selection:bO,transition:$O,call:Xr.call,nodes:Xr.nodes,node:Xr.node,size:Xr.size,empty:Xr.empty,each:Xr.each,on:mO,attr:KI,attrTween:eO,style:EO,styleTween:TO,text:MO,textTween:PO,remove:yO,tween:BI,delay:rO,duration:iO,ease:lO,easeVarying:uO,end:LO,[Symbol.iterator]:Xr[Symbol.iterator]};function DO(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var FO={time:null,delay:0,duration:250,ease:DO};function zO(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function BO(e){var t,n;e instanceof es?(t=e._id,e=e._name):(t=cj(),(n=FO).time=gw(),e=e==null?null:e+"");for(var s=this._groups,i=s.length,a=0;a<i;++a)for(var l=s[a],u=l.length,h,p=0;p<u;++p)(h=l[p])&&Wu(h,e,t,p,l,n||zO(h,t));return new es(s,this._parents,e,t)}El.prototype.interrupt=DI;El.prototype.transition=BO;const nu=e=>()=>e;function UO(e,{sourceEvent:t,target:n,transform:s,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:i}})}function Zr(e,t,n){this.k=e,this.x=t,this.y=n}Zr.prototype={constructor:Zr,scale:function(e){return e===1?this:new Zr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Zr(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 Jr=new Zr(1,0,0);Zr.prototype;function Jf(e){e.stopImmediatePropagation()}function Qa(e){e.preventDefault(),e.stopImmediatePropagation()}function WO(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function HO(){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 Cb(){return this.__zoom||Jr}function GO(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function VO(){return navigator.maxTouchPoints||"ontouchstart"in this}function YO(e,t,n){var s=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i),l>a?(a+l)/2:Math.min(0,a)||Math.max(0,l))}function uj(){var e=WO,t=HO,n=YO,s=GO,i=VO,a=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,h=AI,p=zu("start","zoom","end"),f,g,v,w=500,E=150,b=0,S=10;function _(R){R.property("__zoom",Cb).on("wheel.zoom",F,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",L).on("touchmove.zoom",H).on("touchend.zoom touchcancel.zoom",X).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(R,K,G,ne){var Q=R.selection?R.selection():R;Q.property("__zoom",Cb),R!==Q?M(R,K,G,ne):Q.interrupt().each(function(){P(this,arguments).event(ne).start().zoom(null,typeof K=="function"?K.apply(this,arguments):K).end()})},_.scaleBy=function(R,K,G,ne){_.scaleTo(R,function(){var Q=this.__zoom.k,W=typeof K=="function"?K.apply(this,arguments):K;return Q*W},G,ne)},_.scaleTo=function(R,K,G,ne){_.transform(R,function(){var Q=t.apply(this,arguments),W=this.__zoom,ee=G==null?j(Q):typeof G=="function"?G.apply(this,arguments):G,$=W.invert(ee),Y=typeof K=="function"?K.apply(this,arguments):K;return n(C(N(W,Y),ee,$),Q,l)},G,ne)},_.translateBy=function(R,K,G,ne){_.transform(R,function(){return n(this.__zoom.translate(typeof K=="function"?K.apply(this,arguments):K,typeof G=="function"?G.apply(this,arguments):G),t.apply(this,arguments),l)},null,ne)},_.translateTo=function(R,K,G,ne,Q){_.transform(R,function(){var W=t.apply(this,arguments),ee=this.__zoom,$=ne==null?j(W):typeof ne=="function"?ne.apply(this,arguments):ne;return n(Jr.translate($[0],$[1]).scale(ee.k).translate(typeof K=="function"?-K.apply(this,arguments):-K,typeof G=="function"?-G.apply(this,arguments):-G),W,l)},ne,Q)};function N(R,K){return K=Math.max(a[0],Math.min(a[1],K)),K===R.k?R:new Zr(K,R.x,R.y)}function C(R,K,G){var ne=K[0]-G[0]*R.k,Q=K[1]-G[1]*R.k;return ne===R.x&&Q===R.y?R:new Zr(R.k,ne,Q)}function j(R){return[(+R[0][0]+ +R[1][0])/2,(+R[0][1]+ +R[1][1])/2]}function M(R,K,G,ne){R.on("start.zoom",function(){P(this,arguments).event(ne).start()}).on("interrupt.zoom end.zoom",function(){P(this,arguments).event(ne).end()}).tween("zoom",function(){var Q=this,W=arguments,ee=P(Q,W).event(ne),$=t.apply(Q,W),Y=G==null?j($):typeof G=="function"?G.apply(Q,W):G,ue=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),z=Q.__zoom,D=typeof K=="function"?K.apply(Q,W):K,J=h(z.invert(Y).concat(ue/z.k),D.invert(Y).concat(ue/D.k));return function(V){if(V===1)V=D;else{var ae=J(V),he=ue/ae[2];V=new Zr(he,Y[0]-ae[0]*he,Y[1]-ae[1]*he)}ee.zoom(null,V)}})}function P(R,K,G){return!G&&R.__zooming||new I(R,K)}function I(R,K){this.that=R,this.args=K,this.active=0,this.sourceEvent=null,this.extent=t.apply(R,K),this.taps=0}I.prototype={event:function(R){return R&&(this.sourceEvent=R),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(R,K){return this.mouse&&R!=="mouse"&&(this.mouse[1]=K.invert(this.mouse[0])),this.touch0&&R!=="touch"&&(this.touch0[1]=K.invert(this.touch0[0])),this.touch1&&R!=="touch"&&(this.touch1[1]=K.invert(this.touch1[0])),this.that.__zoom=K,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(R){var K=qn(this.that).datum();p.call(R,this.that,new UO(R,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:p}),K)}};function F(R,...K){if(!e.apply(this,arguments))return;var G=P(this,K).event(R),ne=this.__zoom,Q=Math.max(a[0],Math.min(a[1],ne.k*Math.pow(2,s.apply(this,arguments)))),W=ir(R);if(G.wheel)(G.mouse[0][0]!==W[0]||G.mouse[0][1]!==W[1])&&(G.mouse[1]=ne.invert(G.mouse[0]=W)),clearTimeout(G.wheel);else{if(ne.k===Q)return;G.mouse=[W,ne.invert(W)],xu(this),G.start()}Qa(R),G.wheel=setTimeout(ee,E),G.zoom("mouse",n(C(N(ne,Q),G.mouse[0],G.mouse[1]),G.extent,l));function ee(){G.wheel=null,G.end()}}function O(R,...K){if(v||!e.apply(this,arguments))return;var G=R.currentTarget,ne=P(this,K,!0).event(R),Q=qn(R.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",ue,!0),W=ir(R,G),ee=R.clientX,$=R.clientY;KC(R.view),Jf(R),ne.mouse=[W,this.__zoom.invert(W)],xu(this),ne.start();function Y(z){if(Qa(z),!ne.moved){var D=z.clientX-ee,J=z.clientY-$;ne.moved=D*D+J*J>b}ne.event(z).zoom("mouse",n(C(ne.that.__zoom,ne.mouse[0]=ir(z,G),ne.mouse[1]),ne.extent,l))}function ue(z){Q.on("mousemove.zoom mouseup.zoom",null),XC(z.view,ne.moved),Qa(z),ne.event(z).end()}}function A(R,...K){if(e.apply(this,arguments)){var G=this.__zoom,ne=ir(R.changedTouches?R.changedTouches[0]:R,this),Q=G.invert(ne),W=G.k*(R.shiftKey?.5:2),ee=n(C(N(G,W),ne,Q),t.apply(this,K),l);Qa(R),u>0?qn(this).transition().duration(u).call(M,ee,ne,R):qn(this).call(_.transform,ee,ne,R)}}function L(R,...K){if(e.apply(this,arguments)){var G=R.touches,ne=G.length,Q=P(this,K,R.changedTouches.length===ne).event(R),W,ee,$,Y;for(Jf(R),ee=0;ee<ne;++ee)$=G[ee],Y=ir($,this),Y=[Y,this.__zoom.invert(Y),$.identifier],Q.touch0?!Q.touch1&&Q.touch0[2]!==Y[2]&&(Q.touch1=Y,Q.taps=0):(Q.touch0=Y,W=!0,Q.taps=1+!!f);f&&(f=clearTimeout(f)),W&&(Q.taps<2&&(g=Y[0],f=setTimeout(function(){f=null},w)),xu(this),Q.start())}}function H(R,...K){if(this.__zooming){var G=P(this,K).event(R),ne=R.changedTouches,Q=ne.length,W,ee,$,Y;for(Qa(R),W=0;W<Q;++W)ee=ne[W],$=ir(ee,this),G.touch0&&G.touch0[2]===ee.identifier?G.touch0[0]=$:G.touch1&&G.touch1[2]===ee.identifier&&(G.touch1[0]=$);if(ee=G.that.__zoom,G.touch1){var ue=G.touch0[0],z=G.touch0[1],D=G.touch1[0],J=G.touch1[1],V=(V=D[0]-ue[0])*V+(V=D[1]-ue[1])*V,ae=(ae=J[0]-z[0])*ae+(ae=J[1]-z[1])*ae;ee=N(ee,Math.sqrt(V/ae)),$=[(ue[0]+D[0])/2,(ue[1]+D[1])/2],Y=[(z[0]+J[0])/2,(z[1]+J[1])/2]}else if(G.touch0)$=G.touch0[0],Y=G.touch0[1];else return;G.zoom("touch",n(C(ee,$,Y),G.extent,l))}}function X(R,...K){if(this.__zooming){var G=P(this,K).event(R),ne=R.changedTouches,Q=ne.length,W,ee;for(Jf(R),v&&clearTimeout(v),v=setTimeout(function(){v=null},w),W=0;W<Q;++W)ee=ne[W],G.touch0&&G.touch0[2]===ee.identifier?delete G.touch0:G.touch1&&G.touch1[2]===ee.identifier&&delete G.touch1;if(G.touch1&&!G.touch0&&(G.touch0=G.touch1,delete G.touch1),G.touch0)G.touch0[1]=this.__zoom.invert(G.touch0[0]);else if(G.end(),G.taps===2&&(ee=ir(ee,this),Math.hypot(g[0]-ee[0],g[1]-ee[1])<S)){var $=qn(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return _.wheelDelta=function(R){return arguments.length?(s=typeof R=="function"?R:nu(+R),_):s},_.filter=function(R){return arguments.length?(e=typeof R=="function"?R:nu(!!R),_):e},_.touchable=function(R){return arguments.length?(i=typeof R=="function"?R:nu(!!R),_):i},_.extent=function(R){return arguments.length?(t=typeof R=="function"?R:nu([[+R[0][0],+R[0][1]],[+R[1][0],+R[1][1]]]),_):t},_.scaleExtent=function(R){return arguments.length?(a[0]=+R[0],a[1]=+R[1],_):[a[0],a[1]]},_.translateExtent=function(R){return arguments.length?(l[0][0]=+R[0][0],l[1][0]=+R[1][0],l[0][1]=+R[0][1],l[1][1]=+R[1][1],_):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},_.constrain=function(R){return arguments.length?(n=R,_):n},_.duration=function(R){return arguments.length?(u=+R,_):u},_.interpolate=function(R){return arguments.length?(h=R,_):h},_.on=function(){var R=p.on.apply(p,arguments);return R===p?_:R},_.clickDistance=function(R){return arguments.length?(b=(R=+R)*R,_):Math.sqrt(b)},_.tapDistance=function(R){return arguments.length?(S=+R,_):S},_}var ww=PC();const Hu=k.createContext(null),KO=Hu.Provider,ts={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.`},dj=ts.error001();function at(e,t){const n=k.useContext(Hu);if(n===null)throw new Error(dj);return $C(n,e,t)}const Mt=()=>{const e=k.useContext(Hu);if(e===null)throw new Error(dj);return k.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},XO=e=>e.userSelectionActive?"none":"all";function xw({position:e,children:t,className:n,style:s,...i}){const a=at(XO),l=`${e}`.split("-");return de.createElement("div",{className:Ht(["react-flow__panel",n,...l]),style:{...s,pointerEvents:a},...i},t)}function QO({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:de.createElement(xw,{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"},de.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const ZO=({x:e,y:t,label:n,labelStyle:s={},labelShowBg:i=!0,labelBgStyle:a={},labelBgPadding:l=[2,4],labelBgBorderRadius:u=2,children:h,className:p,...f})=>{const g=k.useRef(null),[v,w]=k.useState({x:0,y:0,width:0,height:0}),E=Ht(["react-flow__edge-textwrapper",p]);return k.useEffect(()=>{if(g.current){const b=g.current.getBBox();w({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),typeof n>"u"||!n?null:de.createElement("g",{transform:`translate(${e-v.width/2} ${t-v.height/2})`,className:E,visibility:v.width?"visible":"hidden",...f},i&&de.createElement("rect",{width:v.width+2*l[0],x:-l[0],y:-l[1],height:v.height+2*l[1],className:"react-flow__edge-textbg",style:a,rx:u,ry:u}),de.createElement("text",{className:"react-flow__edge-text",y:v.height/2,dy:"0.3em",ref:g,style:s},n),h)};var JO=k.memo(ZO);const bw=e=>({width:e.offsetWidth,height:e.offsetHeight}),Wi=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),kw=(e={x:0,y:0},t)=>({x:Wi(e.x,t[0][0],t[1][0]),y:Wi(e.y,t[0][1],t[1][1])}),jb=(e,t,n)=>e<t?Wi(Math.abs(e-t),1,50)/50:e>n?-Wi(Math.abs(e-n),1,50)/50:0,fj=(e,t)=>{const n=jb(e.x,35,t.width-35)*20,s=jb(e.y,35,t.height-35)*20;return[n,s]},hj=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},pj=(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)}),yl=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),mj=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Tb=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),eP=(e,t)=>mj(pj(yl(e),yl(t))),Fv=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},tP=e=>Dn(e.width)&&Dn(e.height)&&Dn(e.x)&&Dn(e.y),Dn=e=>!isNaN(e)&&isFinite(e),Ct=Symbol.for("internals"),gj=["Enter"," ","Escape"],nP=(e,t)=>{},rP=e=>"nativeEvent"in e;function zv(e){var i,a;const t=rP(e)?e.nativeEvent:e,n=((a=(i=t.composedPath)==null?void 0:i.call(t))==null?void 0:a[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const yj=e=>"clientX"in e,Os=(e,t)=>{var a,l;const n=yj(e),s=n?e.clientX:(a=e.touches)==null?void 0:a[0].clientX,i=n?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},Ru=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},jl=({id:e,path:t,labelX:n,labelY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:v,interactionWidth:w=20})=>de.createElement(de.Fragment,null,de.createElement("path",{id:e,style:f,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:g,markerStart:v}),w&&de.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),i&&Dn(n)&&Dn(s)?de.createElement(JO,{x:n,y:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p}):null);jl.displayName="BaseEdge";function Za(e,t,n){return n===void 0?n:s=>{const i=t().edges.find(a=>a.id===e);i&&n(s,{...i})}}function vj({sourceX:e,sourceY:t,targetX:n,targetY:s}){const i=Math.abs(n-e)/2,a=n<e?n+i:n-i,l=Math.abs(s-t)/2,u=s<t?s+l:s-l;return[a,u,i,l]}function wj({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:u}){const h=e*.125+i*.375+l*.375+n*.125,p=t*.125+a*.375+u*.375+s*.125,f=Math.abs(h-e),g=Math.abs(p-t);return[h,p,f,g]}var Eo;(function(e){e.Strict="strict",e.Loose="loose"})(Eo||(Eo={}));var ko;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ko||(ko={}));var vl;(function(e){e.Partial="partial",e.Full="full"})(vl||(vl={}));var Is;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Is||(Is={}));var Au;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Au||(Au={}));var De;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(De||(De={}));function Rb({pos:e,x1:t,y1:n,x2:s,y2:i}){return e===De.Left||e===De.Right?[.5*(t+s),n]:[t,.5*(n+i)]}function xj({sourceX:e,sourceY:t,sourcePosition:n=De.Bottom,targetX:s,targetY:i,targetPosition:a=De.Top}){const[l,u]=Rb({pos:n,x1:e,y1:t,x2:s,y2:i}),[h,p]=Rb({pos:a,x1:s,y1:i,x2:e,y2:t}),[f,g,v,w]=wj({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:l,sourceControlY:u,targetControlX:h,targetControlY:p});return[`M${e},${t} C${l},${u} ${h},${p} ${s},${i}`,f,g,v,w]}const _w=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=De.Bottom,targetPosition:a=De.Top,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:E,interactionWidth:b})=>{const[S,_,N]=xj({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:a});return de.createElement(jl,{path:S,labelX:_,labelY:N,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:E,interactionWidth:b})});_w.displayName="SimpleBezierEdge";const Ab={[De.Left]:{x:-1,y:0},[De.Right]:{x:1,y:0},[De.Top]:{x:0,y:-1},[De.Bottom]:{x:0,y:1}},sP=({source:e,sourcePosition:t=De.Bottom,target:n})=>t===De.Left||t===De.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Mb=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function oP({source:e,sourcePosition:t=De.Bottom,target:n,targetPosition:s=De.Top,center:i,offset:a}){const l=Ab[t],u=Ab[s],h={x:e.x+l.x*a,y:e.y+l.y*a},p={x:n.x+u.x*a,y:n.y+u.y*a},f=sP({source:h,sourcePosition:t,target:p}),g=f.x!==0?"x":"y",v=f[g];let w=[],E,b;const S={x:0,y:0},_={x:0,y:0},[N,C,j,M]=vj({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[g]*u[g]===-1){E=i.x??N,b=i.y??C;const I=[{x:E,y:h.y},{x:E,y:p.y}],F=[{x:h.x,y:b},{x:p.x,y:b}];l[g]===v?w=g==="x"?I:F:w=g==="x"?F:I}else{const I=[{x:h.x,y:p.y}],F=[{x:p.x,y:h.y}];if(g==="x"?w=l.x===v?F:I:w=l.y===v?I:F,t===s){const X=Math.abs(e[g]-n[g]);if(X<=a){const R=Math.min(a-1,a-X);l[g]===v?S[g]=(h[g]>e[g]?-1:1)*R:_[g]=(p[g]>n[g]?-1:1)*R}}if(t!==s){const X=g==="x"?"y":"x",R=l[g]===u[X],K=h[X]>p[X],G=h[X]<p[X];(l[g]===1&&(!R&&K||R&&G)||l[g]!==1&&(!R&&G||R&&K))&&(w=g==="x"?I:F)}const O={x:h.x+S.x,y:h.y+S.y},A={x:p.x+_.x,y:p.y+_.y},L=Math.max(Math.abs(O.x-w[0].x),Math.abs(A.x-w[0].x)),H=Math.max(Math.abs(O.y-w[0].y),Math.abs(A.y-w[0].y));L>=H?(E=(O.x+A.x)/2,b=w[0].y):(E=w[0].x,b=(O.y+A.y)/2)}return[[e,{x:h.x+S.x,y:h.y+S.y},...w,{x:p.x+_.x,y:p.y+_.y},n],E,b,j,M]}function iP(e,t,n,s){const i=Math.min(Mb(e,t)/2,Mb(t,n)/2,s),{x:a,y:l}=t;if(e.x===a&&a===n.x||e.y===l&&l===n.y)return`L${a} ${l}`;if(e.y===l){const p=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${a+i*p},${l}Q ${a},${l} ${a},${l+i*f}`}const u=e.x<n.x?1:-1,h=e.y<n.y?-1:1;return`L ${a},${l+i*h}Q ${a},${l} ${a+i*u},${l}`}function Bv({sourceX:e,sourceY:t,sourcePosition:n=De.Bottom,targetX:s,targetY:i,targetPosition:a=De.Top,borderRadius:l=5,centerX:u,centerY:h,offset:p=20}){const[f,g,v,w,E]=oP({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:i},targetPosition:a,center:{x:u,y:h},offset:p});return[f.reduce((S,_,N)=>{let C="";return N>0&&N<f.length-1?C=iP(f[N-1],_,f[N+1],l):C=`${N===0?"M":"L"}${_.x} ${_.y}`,S+=C,S},""),g,v,w,E]}const Gu=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,sourcePosition:g=De.Bottom,targetPosition:v=De.Top,markerEnd:w,markerStart:E,pathOptions:b,interactionWidth:S})=>{const[_,N,C]=Bv({sourceX:e,sourceY:t,sourcePosition:g,targetX:n,targetY:s,targetPosition:v,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset});return de.createElement(jl,{path:_,labelX:N,labelY:C,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:w,markerStart:E,interactionWidth:S})});Gu.displayName="SmoothStepEdge";const Sw=k.memo(e=>{var t;return de.createElement(Gu,{...e,pathOptions:k.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});Sw.displayName="StepEdge";function aP({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[i,a,l,u]=vj({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,i,a,l,u]}const Nw=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:v,interactionWidth:w})=>{const[E,b,S]=aP({sourceX:e,sourceY:t,targetX:n,targetY:s});return de.createElement(jl,{path:E,labelX:b,labelY:S,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:v,interactionWidth:w})});Nw.displayName="StraightEdge";function ru(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ib({pos:e,x1:t,y1:n,x2:s,y2:i,c:a}){switch(e){case De.Left:return[t-ru(t-s,a),n];case De.Right:return[t+ru(s-t,a),n];case De.Top:return[t,n-ru(n-i,a)];case De.Bottom:return[t,n+ru(i-n,a)]}}function bj({sourceX:e,sourceY:t,sourcePosition:n=De.Bottom,targetX:s,targetY:i,targetPosition:a=De.Top,curvature:l=.25}){const[u,h]=Ib({pos:n,x1:e,y1:t,x2:s,y2:i,c:l}),[p,f]=Ib({pos:a,x1:s,y1:i,x2:e,y2:t,c:l}),[g,v,w,E]=wj({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:u,sourceControlY:h,targetControlX:p,targetControlY:f});return[`M${e},${t} C${u},${h} ${p},${f} ${s},${i}`,g,v,w,E]}const Mu=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=De.Bottom,targetPosition:a=De.Top,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:E,pathOptions:b,interactionWidth:S})=>{const[_,N,C]=bj({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:a,curvature:b==null?void 0:b.curvature});return de.createElement(jl,{path:_,labelX:N,labelY:C,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:E,interactionWidth:S})});Mu.displayName="BezierEdge";const Ew=k.createContext(null),lP=Ew.Provider;Ew.Consumer;const cP=()=>k.useContext(Ew),uP=e=>"id"in e&&"source"in e&&"target"in e,dP=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,Uv=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,fP=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),hP=(e,t)=>{if(!e.source||!e.target)return t;let n;return uP(e)?n={...e}:n={...e,id:dP(e)},fP(n,t)?t:t.concat(n)},Wv=({x:e,y:t},[n,s,i],a,[l,u])=>{const h={x:(e-n)/i,y:(t-s)/i};return a?{x:l*Math.round(h.x/l),y:u*Math.round(h.y/u)}:h},kj=({x:e,y:t},[n,s,i])=>({x:e*i+n,y:t*i+s}),So=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],s=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-s};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-s}:i}},Vu=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,i)=>{const{x:a,y:l}=So(i,t).positionAbsolute;return pj(s,yl({x:a,y:l,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return mj(n)},_j=(e,t,[n,s,i]=[0,0,1],a=!1,l=!1,u=[0,0])=>{const h={x:(t.x-n)/i,y:(t.y-s)/i,width:t.width/i,height:t.height/i},p=[];return e.forEach(f=>{const{width:g,height:v,selectable:w=!0,hidden:E=!1}=f;if(l&&!w||E)return!1;const{positionAbsolute:b}=So(f,u),S={x:b.x,y:b.y,width:g||0,height:v||0},_=Fv(h,S),N=typeof g>"u"||typeof v>"u"||g===null||v===null,C=a&&_>0,j=(g||0)*(v||0);(N||C||_>=j||f.dragging)&&p.push(f)}),p},Sj=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},Nj=(e,t,n,s,i,a=.1)=>{const l=t/(e.width*(1+a)),u=n/(e.height*(1+a)),h=Math.min(l,u),p=Wi(h,s,i),f=e.x+e.width/2,g=e.y+e.height/2,v=t/2-f*p,w=n/2-g*p;return{x:v,y:w,zoom:p}},vo=(e,t=0)=>e.transition().duration(t);function Ob(e,t,n,s){return(t[n]||[]).reduce((i,a)=>{var l,u;return`${e.id}-${a.id}-${n}`!==s&&i.push({id:a.id||null,type:n,nodeId:e.id,x:(((l=e.positionAbsolute)==null?void 0:l.x)??0)+a.x+a.width/2,y:(((u=e.positionAbsolute)==null?void 0:u.y)??0)+a.y+a.height/2}),i},[])}function pP(e,t,n,s,i,a){const{x:l,y:u}=Os(e),p=t.elementsFromPoint(l,u).find(E=>E.classList.contains("react-flow__handle"));if(p){const E=p.getAttribute("data-nodeid");if(E){const b=Cw(void 0,p),S=p.getAttribute("data-handleid"),_=a({nodeId:E,id:S,type:b});if(_){const N=i.find(C=>C.nodeId===E&&C.type===b&&C.id===S);return{handle:{id:S,type:b,nodeId:E,x:(N==null?void 0:N.x)||n.x,y:(N==null?void 0:N.y)||n.y},validHandleResult:_}}}}let f=[],g=1/0;if(i.forEach(E=>{const b=Math.sqrt((E.x-n.x)**2+(E.y-n.y)**2);if(b<=s){const S=a(E);b<=g&&(b<g?f=[{handle:E,validHandleResult:S}]:b===g&&f.push({handle:E,validHandleResult:S}),g=b)}}),!f.length)return{handle:null,validHandleResult:Ej()};if(f.length===1)return f[0];const v=f.some(({validHandleResult:E})=>E.isValid),w=f.some(({handle:E})=>E.type==="target");return f.find(({handle:E,validHandleResult:b})=>w?E.type==="target":v?b.isValid:!0)||f[0]}const mP={source:null,target:null,sourceHandle:null,targetHandle:null},Ej=()=>({handleDomNode:null,isValid:!1,connection:mP,endHandle:null});function Cj(e,t,n,s,i,a,l){const u=i==="target",h=l.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),p={...Ej(),handleDomNode:h};if(h){const f=Cw(void 0,h),g=h.getAttribute("data-nodeid"),v=h.getAttribute("data-handleid"),w=h.classList.contains("connectable"),E=h.classList.contains("connectableend"),b={source:u?g:n,sourceHandle:u?v:s,target:u?n:g,targetHandle:u?s:v};p.connection=b,w&&E&&(t===Eo.Strict?u&&f==="source"||!u&&f==="target":g!==n||v!==s)&&(p.endHandle={nodeId:g,handleId:v,type:f},p.isValid=a(b))}return p}function gP({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((i,a)=>{if(a[Ct]){const{handleBounds:l}=a[Ct];let u=[],h=[];l&&(u=Ob(a,l,"source",`${t}-${n}-${s}`),h=Ob(a,l,"target",`${t}-${n}-${s}`)),i.push(...u,...h)}return i},[])}function Cw(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function eh(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function yP(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function jj({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:i,getState:a,setState:l,isValidConnection:u,edgeUpdaterType:h,onReconnectEnd:p}){const f=hj(e.target),{connectionMode:g,domNode:v,autoPanOnConnect:w,connectionRadius:E,onConnectStart:b,panBy:S,getNodes:_,cancelConnection:N}=a();let C=0,j;const{x:M,y:P}=Os(e),I=f==null?void 0:f.elementFromPoint(M,P),F=Cw(h,I),O=v==null?void 0:v.getBoundingClientRect();if(!O||!F)return;let A,L=Os(e,O),H=!1,X=null,R=!1,K=null;const G=gP({nodes:_(),nodeId:n,handleId:t,handleType:F}),ne=()=>{if(!w)return;const[ee,$]=fj(L,O);S({x:ee,y:$}),C=requestAnimationFrame(ne)};l({connectionPosition:L,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:F,connectionStartHandle:{nodeId:n,handleId:t,type:F},connectionEndHandle:null}),b==null||b(e,{nodeId:n,handleId:t,handleType:F});function Q(ee){const{transform:$}=a();L=Os(ee,O);const{handle:Y,validHandleResult:ue}=pP(ee,f,Wv(L,$,!1,[1,1]),E,G,z=>Cj(z,g,n,t,i?"target":"source",u,f));if(j=Y,H||(ne(),H=!0),K=ue.handleDomNode,X=ue.connection,R=ue.isValid,l({connectionPosition:j&&R?kj({x:j.x,y:j.y},$):L,connectionStatus:yP(!!j,R),connectionEndHandle:ue.endHandle}),!j&&!R&&!K)return eh(A);X.source!==X.target&&K&&(eh(A),A=K,K.classList.add("connecting","react-flow__handle-connecting"),K.classList.toggle("valid",R),K.classList.toggle("react-flow__handle-valid",R))}function W(ee){var $,Y;(j||K)&&X&&R&&(s==null||s(X)),(Y=($=a()).onConnectEnd)==null||Y.call($,ee),h&&(p==null||p(ee)),eh(A),N(),cancelAnimationFrame(C),H=!1,R=!1,X=null,K=null,f.removeEventListener("mousemove",Q),f.removeEventListener("mouseup",W),f.removeEventListener("touchmove",Q),f.removeEventListener("touchend",W)}f.addEventListener("mousemove",Q),f.addEventListener("mouseup",W),f.addEventListener("touchmove",Q),f.addEventListener("touchend",W)}const Pb=()=>!0,vP=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),wP=(e,t,n)=>s=>{const{connectionStartHandle:i,connectionEndHandle:a,connectionClickStartHandle:l}=s;return{connecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n||(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n,clickConnecting:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n}},Tj=k.forwardRef(({type:e="source",position:t=De.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:l,onConnect:u,children:h,className:p,onMouseDown:f,onTouchStart:g,...v},w)=>{var O,A;const E=l||null,b=e==="target",S=Mt(),_=cP(),{connectOnClick:N,noPanClassName:C}=at(vP,Lt),{connecting:j,clickConnecting:M}=at(wP(_,E,e),Lt);_||(A=(O=S.getState()).onError)==null||A.call(O,"010",ts.error010());const P=L=>{const{defaultEdgeOptions:H,onConnect:X,hasDefaultEdges:R}=S.getState(),K={...H,...L};if(R){const{edges:G,setEdges:ne}=S.getState();ne(hP(K,G))}X==null||X(K),u==null||u(K)},I=L=>{if(!_)return;const H=yj(L);i&&(H&&L.button===0||!H)&&jj({event:L,handleId:E,nodeId:_,onConnect:P,isTarget:b,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||Pb}),H?f==null||f(L):g==null||g(L)},F=L=>{const{onClickConnectStart:H,onClickConnectEnd:X,connectionClickStartHandle:R,connectionMode:K,isValidConnection:G}=S.getState();if(!_||!R&&!i)return;if(!R){H==null||H(L,{nodeId:_,handleId:E,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:_,type:e,handleId:E}});return}const ne=hj(L.target),Q=n||G||Pb,{connection:W,isValid:ee}=Cj({nodeId:_,id:E,type:e},K,R.nodeId,R.handleId||null,R.type,Q,ne);ee&&P(W),X==null||X(L),S.setState({connectionClickStartHandle:null})};return de.createElement("div",{"data-handleid":E,"data-nodeid":_,"data-handlepos":t,"data-id":`${_}-${E}-${e}`,className:Ht(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",C,p,{source:!b,target:b,connectable:s,connectablestart:i,connectableend:a,connecting:M,connectionindicator:s&&(i&&!j||a&&j)}]),onMouseDown:I,onTouchStart:I,onClick:N?F:void 0,ref:w,...v},h)});Tj.displayName="Handle";var Hi=k.memo(Tj);const Rj=({data:e,isConnectable:t,targetPosition:n=De.Top,sourcePosition:s=De.Bottom})=>de.createElement(de.Fragment,null,de.createElement(Hi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,de.createElement(Hi,{type:"source",position:s,isConnectable:t}));Rj.displayName="DefaultNode";var Hv=k.memo(Rj);const Aj=({data:e,isConnectable:t,sourcePosition:n=De.Bottom})=>de.createElement(de.Fragment,null,e==null?void 0:e.label,de.createElement(Hi,{type:"source",position:n,isConnectable:t}));Aj.displayName="InputNode";var Mj=k.memo(Aj);const Ij=({data:e,isConnectable:t,targetPosition:n=De.Top})=>de.createElement(de.Fragment,null,de.createElement(Hi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);Ij.displayName="OutputNode";var Oj=k.memo(Ij);const jw=()=>null;jw.displayName="GroupNode";const xP=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),su=e=>e.id;function bP(e,t){return Lt(e.selectedNodes.map(su),t.selectedNodes.map(su))&&Lt(e.selectedEdges.map(su),t.selectedEdges.map(su))}const Pj=k.memo(({onSelectionChange:e})=>{const t=Mt(),{selectedNodes:n,selectedEdges:s}=at(xP,bP);return k.useEffect(()=>{const i={nodes:n,edges:s};e==null||e(i),t.getState().onSelectionChange.forEach(a=>a(i))},[n,s,e]),null});Pj.displayName="SelectionListener";const kP=e=>!!e.onSelectionChange;function _P({onSelectionChange:e}){const t=at(kP);return e||t?de.createElement(Pj,{onSelectionChange:e}):null}const SP=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 Ei(e,t){k.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Ze(e,t,n){k.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const NP=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:i,onConnectStart:a,onConnectEnd:l,onClickConnectStart:u,onClickConnectEnd:h,nodesDraggable:p,nodesConnectable:f,nodesFocusable:g,edgesFocusable:v,edgesUpdatable:w,elevateNodesOnSelect:E,minZoom:b,maxZoom:S,nodeExtent:_,onNodesChange:N,onEdgesChange:C,elementsSelectable:j,connectionMode:M,snapGrid:P,snapToGrid:I,translateExtent:F,connectOnClick:O,defaultEdgeOptions:A,fitView:L,fitViewOptions:H,onNodesDelete:X,onEdgesDelete:R,onNodeDrag:K,onNodeDragStart:G,onNodeDragStop:ne,onSelectionDrag:Q,onSelectionDragStart:W,onSelectionDragStop:ee,noPanClassName:$,nodeOrigin:Y,rfId:ue,autoPanOnConnect:z,autoPanOnNodeDrag:D,onError:J,connectionRadius:V,isValidConnection:ae,nodeDragThreshold:he})=>{const{setNodes:ye,setEdges:_e,setDefaultNodesAndEdges:Ve,setMinZoom:Be,setMaxZoom:qe,setTranslateExtent:Se,setNodeExtent:ce,reset:be}=at(SP,Lt),ke=Mt();return k.useEffect(()=>{const Ye=s==null?void 0:s.map(dt=>({...dt,...A}));return Ve(n,Ye),()=>{be()}},[]),Ze("defaultEdgeOptions",A,ke.setState),Ze("connectionMode",M,ke.setState),Ze("onConnect",i,ke.setState),Ze("onConnectStart",a,ke.setState),Ze("onConnectEnd",l,ke.setState),Ze("onClickConnectStart",u,ke.setState),Ze("onClickConnectEnd",h,ke.setState),Ze("nodesDraggable",p,ke.setState),Ze("nodesConnectable",f,ke.setState),Ze("nodesFocusable",g,ke.setState),Ze("edgesFocusable",v,ke.setState),Ze("edgesUpdatable",w,ke.setState),Ze("elementsSelectable",j,ke.setState),Ze("elevateNodesOnSelect",E,ke.setState),Ze("snapToGrid",I,ke.setState),Ze("snapGrid",P,ke.setState),Ze("onNodesChange",N,ke.setState),Ze("onEdgesChange",C,ke.setState),Ze("connectOnClick",O,ke.setState),Ze("fitViewOnInit",L,ke.setState),Ze("fitViewOnInitOptions",H,ke.setState),Ze("onNodesDelete",X,ke.setState),Ze("onEdgesDelete",R,ke.setState),Ze("onNodeDrag",K,ke.setState),Ze("onNodeDragStart",G,ke.setState),Ze("onNodeDragStop",ne,ke.setState),Ze("onSelectionDrag",Q,ke.setState),Ze("onSelectionDragStart",W,ke.setState),Ze("onSelectionDragStop",ee,ke.setState),Ze("noPanClassName",$,ke.setState),Ze("nodeOrigin",Y,ke.setState),Ze("rfId",ue,ke.setState),Ze("autoPanOnConnect",z,ke.setState),Ze("autoPanOnNodeDrag",D,ke.setState),Ze("onError",J,ke.setState),Ze("connectionRadius",V,ke.setState),Ze("isValidConnection",ae,ke.setState),Ze("nodeDragThreshold",he,ke.setState),Ei(e,ye),Ei(t,_e),Ei(b,Be),Ei(S,qe),Ei(F,Se),Ei(_,ce),null},$b={display:"none"},EP={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},$j="react-flow__node-desc",Lj="react-flow__edge-desc",CP="react-flow__aria-live",jP=e=>e.ariaLiveMessage;function TP({rfId:e}){const t=at(jP);return de.createElement("div",{id:`${CP}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:EP},t)}function RP({rfId:e,disableKeyboardA11y:t}){return de.createElement(de.Fragment,null,de.createElement("div",{id:`${$j}-${e}`,style:$b},"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."," "),de.createElement("div",{id:`${Lj}-${e}`,style:$b},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&de.createElement(TP,{rfId:e}))}var wl=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=k.useState(!1),i=k.useRef(!1),a=k.useRef(new Set([])),[l,u]=k.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.split("+")),f=p.reduce((g,v)=>g.concat(...v),[]);return[p,f]}return[[],[]]},[e]);return k.useEffect(()=>{const h=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||h;if(e!==null){const f=w=>{if(i.current=w.ctrlKey||w.metaKey||w.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&zv(w))return!1;const b=qb(w.code,u);a.current.add(w[b]),Lb(l,a.current,!1)&&(w.preventDefault(),s(!0))},g=w=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&zv(w))return!1;const b=qb(w.code,u);Lb(l,a.current,!0)?(s(!1),a.current.clear()):a.current.delete(w[b]),w.key==="Meta"&&a.current.clear(),i.current=!1},v=()=>{a.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",f),p==null||p.addEventListener("keyup",g),window.addEventListener("blur",v),()=>{p==null||p.removeEventListener("keydown",f),p==null||p.removeEventListener("keyup",g),window.removeEventListener("blur",v)}}},[e,s]),n};function Lb(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(i=>t.has(i)))}function qb(e,t){return t.includes(e)?"code":"key"}function qj(e,t,n,s){var u,h;const i=e.parentNode||e.parentId;if(!i)return n;const a=t.get(i),l=So(a,s);return qj(a,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:(((u=a[Ct])==null?void 0:u.z)??0)>(n.z??0)?((h=a[Ct])==null?void 0:h.z)??0:n.z??0},s)}function Dj(e,t,n){e.forEach(s=>{var a;const i=s.parentNode||s.parentId;if(i&&!e.has(i))throw new Error(`Parent node ${i} not found`);if(i||n!=null&&n[s.id]){const{x:l,y:u,z:h}=qj(s,e,{...s.position,z:((a=s[Ct])==null?void 0:a.z)??0},t);s.positionAbsolute={x:l,y:u},s[Ct].z=h,n!=null&&n[s.id]&&(s[Ct].isParent=!0)}})}function th(e,t,n,s){const i=new Map,a={},l=s?1e3:0;return e.forEach(u=>{var w;const h=(Dn(u.zIndex)?u.zIndex:0)+(u.selected?l:0),p=t.get(u.id),f={...u,positionAbsolute:{x:u.position.x,y:u.position.y}},g=u.parentNode||u.parentId;g&&(a[g]=!0);const v=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==u.type;Object.defineProperty(f,Ct,{enumerable:!1,value:{handleBounds:v||(w=p==null?void 0:p[Ct])==null?void 0:w.handleBounds,z:h}}),i.set(u.id,f)}),Dj(i,n,a),i}function Fj(e,t={}){const{getNodes:n,width:s,height:i,minZoom:a,maxZoom:l,d3Zoom:u,d3Selection:h,fitViewOnInitDone:p,fitViewOnInit:f,nodeOrigin:g}=e(),v=t.initial&&!p&&f;if(u&&h&&(v||!t.initial)){const E=n().filter(S=>{var N;const _=t.includeHiddenNodes?S.width&&S.height:!S.hidden;return(N=t.nodes)!=null&&N.length?_&&t.nodes.some(C=>C.id===S.id):_}),b=E.every(S=>S.width&&S.height);if(E.length>0&&b){const S=Vu(E,g),{x:_,y:N,zoom:C}=Nj(S,s,i,t.minZoom??a,t.maxZoom??l,t.padding??.1),j=Jr.translate(_,N).scale(C);return typeof t.duration=="number"&&t.duration>0?u.transform(vo(h,t.duration),j):u.transform(h,j),!0}}return!1}function AP(e,t){return e.forEach(n=>{const s=t.get(n.id);s&&t.set(s.id,{...s,[Ct]:s[Ct],selected:n.selected})}),new Map(t)}function MP(e,t){return t.map(n=>{const s=e.find(i=>i.id===n.id);return s&&(n.selected=s.selected),n})}function ou({changedNodes:e,changedEdges:t,get:n,set:s}){const{nodeInternals:i,edges:a,onNodesChange:l,onEdgesChange:u,hasDefaultNodes:h,hasDefaultEdges:p}=n();e!=null&&e.length&&(h&&s({nodeInternals:AP(e,i)}),l==null||l(e)),t!=null&&t.length&&(p&&s({edges:MP(t,a)}),u==null||u(t))}const Ci=()=>{},IP={zoomIn:Ci,zoomOut:Ci,zoomTo:Ci,getZoom:()=>1,setViewport:Ci,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ci,fitBounds:Ci,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},OP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),PP=()=>{const e=Mt(),{d3Zoom:t,d3Selection:n}=at(OP,Lt);return k.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(vo(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(vo(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,a)=>t.scaleTo(vo(n,a==null?void 0:a.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,a)=>{const[l,u,h]=e.getState().transform,p=Jr.translate(i.x??l,i.y??u).scale(i.zoom??h);t.transform(vo(n,a==null?void 0:a.duration),p)},getViewport:()=>{const[i,a,l]=e.getState().transform;return{x:i,y:a,zoom:l}},fitView:i=>Fj(e.getState,i),setCenter:(i,a,l)=>{const{width:u,height:h,maxZoom:p}=e.getState(),f=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:p,g=u/2-i*f,v=h/2-a*f,w=Jr.translate(g,v).scale(f);t.transform(vo(n,l==null?void 0:l.duration),w)},fitBounds:(i,a)=>{const{width:l,height:u,minZoom:h,maxZoom:p}=e.getState(),{x:f,y:g,zoom:v}=Nj(i,l,u,h,p,(a==null?void 0:a.padding)??.1),w=Jr.translate(f,g).scale(v);t.transform(vo(n,a==null?void 0:a.duration),w)},project:i=>{const{transform:a,snapToGrid:l,snapGrid:u}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Wv(i,a,l,u)},screenToFlowPosition:i=>{const{transform:a,snapToGrid:l,snapGrid:u,domNode:h}=e.getState();if(!h)return i;const{x:p,y:f}=h.getBoundingClientRect(),g={x:i.x-p,y:i.y-f};return Wv(g,a,l,u)},flowToScreenPosition:i=>{const{transform:a,domNode:l}=e.getState();if(!l)return i;const{x:u,y:h}=l.getBoundingClientRect(),p=kj(i,a);return{x:p.x+u,y:p.y+h}},viewportInitialized:!0}:IP,[t,n])};function Tl(){const e=PP(),t=Mt(),n=k.useCallback(()=>t.getState().getNodes().map(b=>({...b})),[]),s=k.useCallback(b=>t.getState().nodeInternals.get(b),[]),i=k.useCallback(()=>{const{edges:b=[]}=t.getState();return b.map(S=>({...S}))},[]),a=k.useCallback(b=>{const{edges:S=[]}=t.getState();return S.find(_=>_.id===b)},[]),l=k.useCallback(b=>{const{getNodes:S,setNodes:_,hasDefaultNodes:N,onNodesChange:C}=t.getState(),j=S(),M=typeof b=="function"?b(j):b;if(N)_(M);else if(C){const P=M.length===0?j.map(I=>({type:"remove",id:I.id})):M.map(I=>({item:I,type:"reset"}));C(P)}},[]),u=k.useCallback(b=>{const{edges:S=[],setEdges:_,hasDefaultEdges:N,onEdgesChange:C}=t.getState(),j=typeof b=="function"?b(S):b;if(N)_(j);else if(C){const M=j.length===0?S.map(P=>({type:"remove",id:P.id})):j.map(P=>({item:P,type:"reset"}));C(M)}},[]),h=k.useCallback(b=>{const S=Array.isArray(b)?b:[b],{getNodes:_,setNodes:N,hasDefaultNodes:C,onNodesChange:j}=t.getState();if(C){const P=[..._(),...S];N(P)}else if(j){const M=S.map(P=>({item:P,type:"add"}));j(M)}},[]),p=k.useCallback(b=>{const S=Array.isArray(b)?b:[b],{edges:_=[],setEdges:N,hasDefaultEdges:C,onEdgesChange:j}=t.getState();if(C)N([..._,...S]);else if(j){const M=S.map(P=>({item:P,type:"add"}));j(M)}},[]),f=k.useCallback(()=>{const{getNodes:b,edges:S=[],transform:_}=t.getState(),[N,C,j]=_;return{nodes:b().map(M=>({...M})),edges:S.map(M=>({...M})),viewport:{x:N,y:C,zoom:j}}},[]),g=k.useCallback(({nodes:b,edges:S})=>{const{nodeInternals:_,getNodes:N,edges:C,hasDefaultNodes:j,hasDefaultEdges:M,onNodesDelete:P,onEdgesDelete:I,onNodesChange:F,onEdgesChange:O}=t.getState(),A=(b||[]).map(K=>K.id),L=(S||[]).map(K=>K.id),H=N().reduce((K,G)=>{const ne=G.parentNode||G.parentId,Q=!A.includes(G.id)&&ne&&K.find(ee=>ee.id===ne);return(typeof G.deletable=="boolean"?G.deletable:!0)&&(A.includes(G.id)||Q)&&K.push(G),K},[]),X=C.filter(K=>typeof K.deletable=="boolean"?K.deletable:!0),R=X.filter(K=>L.includes(K.id));if(H||R){const K=Sj(H,X),G=[...R,...K],ne=G.reduce((Q,W)=>(Q.includes(W.id)||Q.push(W.id),Q),[]);if((M||j)&&(M&&t.setState({edges:C.filter(Q=>!ne.includes(Q.id))}),j&&(H.forEach(Q=>{_.delete(Q.id)}),t.setState({nodeInternals:new Map(_)}))),ne.length>0&&(I==null||I(G),O&&O(ne.map(Q=>({id:Q,type:"remove"})))),H.length>0&&(P==null||P(H),F)){const Q=H.map(W=>({id:W.id,type:"remove"}));F(Q)}}},[]),v=k.useCallback(b=>{const S=tP(b),_=S?null:t.getState().nodeInternals.get(b.id);return!S&&!_?[null,null,S]:[S?b:Tb(_),_,S]},[]),w=k.useCallback((b,S=!0,_)=>{const[N,C,j]=v(b);return N?(_||t.getState().getNodes()).filter(M=>{if(!j&&(M.id===C.id||!M.positionAbsolute))return!1;const P=Tb(M),I=Fv(P,N);return S&&I>0||I>=N.width*N.height}):[]},[]),E=k.useCallback((b,S,_=!0)=>{const[N]=v(b);if(!N)return!1;const C=Fv(N,S);return _&&C>0||C>=N.width*N.height},[]);return k.useMemo(()=>({...e,getNodes:n,getNode:s,getEdges:i,getEdge:a,setNodes:l,setEdges:u,addNodes:h,addEdges:p,toObject:f,deleteElements:g,getIntersectingNodes:w,isNodeIntersecting:E}),[e,n,s,i,a,l,u,h,p,f,g,w,E])}const $P={actInsideInputWithModifier:!1};var LP=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Mt(),{deleteElements:s}=Tl(),i=wl(e,$P),a=wl(t);k.useEffect(()=>{if(i){const{edges:l,getNodes:u}=n.getState(),h=u().filter(f=>f.selected),p=l.filter(f=>f.selected);s({nodes:h,edges:p}),n.setState({nodesSelectionActive:!1})}},[i]),k.useEffect(()=>{n.setState({multiSelectionActive:a})},[a])};function qP(e){const t=Mt();k.useEffect(()=>{let n;const s=()=>{var a,l;if(!e.current)return;const i=bw(e.current);(i.height===0||i.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",ts.error004())),t.setState({width:i.width||500,height:i.height||500})};return s(),window.addEventListener("resize",s),e.current&&(n=new ResizeObserver(()=>s()),n.observe(e.current)),()=>{window.removeEventListener("resize",s),n&&e.current&&n.unobserve(e.current)}},[])}const Tw={position:"absolute",width:"100%",height:"100%",top:0,left:0},DP=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,iu=e=>({x:e.x,y:e.y,zoom:e.k}),ji=(e,t)=>e.target.closest(`.${t}`),Db=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Fb=e=>{const t=e.ctrlKey&&Ru()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},FP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),zP=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:l=!1,panOnScrollSpeed:u=.5,panOnScrollMode:h=ko.Free,zoomOnDoubleClick:p=!0,elementsSelectable:f,panOnDrag:g=!0,defaultViewport:v,translateExtent:w,minZoom:E,maxZoom:b,zoomActivationKeyCode:S,preventScrolling:_=!0,children:N,noWheelClassName:C,noPanClassName:j})=>{const M=k.useRef(),P=Mt(),I=k.useRef(!1),F=k.useRef(!1),O=k.useRef(null),A=k.useRef({x:0,y:0,zoom:0}),{d3Zoom:L,d3Selection:H,d3ZoomHandler:X,userSelectionActive:R}=at(FP,Lt),K=wl(S),G=k.useRef(0),ne=k.useRef(!1),Q=k.useRef();return qP(O),k.useEffect(()=>{if(O.current){const W=O.current.getBoundingClientRect(),ee=uj().scaleExtent([E,b]).translateExtent(w),$=qn(O.current).call(ee),Y=Jr.translate(v.x,v.y).scale(Wi(v.zoom,E,b)),ue=[[0,0],[W.width,W.height]],z=ee.constrain()(Y,ue,w);ee.transform($,z),ee.wheelDelta(Fb),P.setState({d3Zoom:ee,d3Selection:$,d3ZoomHandler:$.on("wheel.zoom"),transform:[z.x,z.y,z.k],domNode:O.current.closest(".react-flow")})}},[]),k.useEffect(()=>{H&&L&&(l&&!K&&!R?H.on("wheel.zoom",W=>{if(ji(W,C))return!1;W.preventDefault(),W.stopImmediatePropagation();const ee=H.property("__zoom").k||1;if(W.ctrlKey&&a){const ae=ir(W),he=Fb(W),ye=ee*Math.pow(2,he);L.scaleTo(H,ye,ae,W);return}const $=W.deltaMode===1?20:1;let Y=h===ko.Vertical?0:W.deltaX*$,ue=h===ko.Horizontal?0:W.deltaY*$;!Ru()&&W.shiftKey&&h!==ko.Vertical&&(Y=W.deltaY*$,ue=0),L.translateBy(H,-(Y/ee)*u,-(ue/ee)*u,{internal:!0});const z=iu(H.property("__zoom")),{onViewportChangeStart:D,onViewportChange:J,onViewportChangeEnd:V}=P.getState();clearTimeout(Q.current),ne.current||(ne.current=!0,t==null||t(W,z),D==null||D(z)),ne.current&&(e==null||e(W,z),J==null||J(z),Q.current=setTimeout(()=>{n==null||n(W,z),V==null||V(z),ne.current=!1},150))},{passive:!1}):typeof X<"u"&&H.on("wheel.zoom",function(W,ee){if(!_&&W.type==="wheel"&&!W.ctrlKey||ji(W,C))return null;W.preventDefault(),X.call(this,W,ee)},{passive:!1}))},[R,l,h,H,L,X,K,a,_,C,t,e,n]),k.useEffect(()=>{L&&L.on("start",W=>{var Y,ue;if(!W.sourceEvent||W.sourceEvent.internal)return null;G.current=(Y=W.sourceEvent)==null?void 0:Y.button;const{onViewportChangeStart:ee}=P.getState(),$=iu(W.transform);I.current=!0,A.current=$,((ue=W.sourceEvent)==null?void 0:ue.type)==="mousedown"&&P.setState({paneDragging:!0}),ee==null||ee($),t==null||t(W.sourceEvent,$)})},[L,t]),k.useEffect(()=>{L&&(R&&!I.current?L.on("zoom",null):R||L.on("zoom",W=>{var $;const{onViewportChange:ee}=P.getState();if(P.setState({transform:[W.transform.x,W.transform.y,W.transform.k]}),F.current=!!(s&&Db(g,G.current??0)),(e||ee)&&!(($=W.sourceEvent)!=null&&$.internal)){const Y=iu(W.transform);ee==null||ee(Y),e==null||e(W.sourceEvent,Y)}}))},[R,L,e,g,s]),k.useEffect(()=>{L&&L.on("end",W=>{if(!W.sourceEvent||W.sourceEvent.internal)return null;const{onViewportChangeEnd:ee}=P.getState();if(I.current=!1,P.setState({paneDragging:!1}),s&&Db(g,G.current??0)&&!F.current&&s(W.sourceEvent),F.current=!1,(n||ee)&&DP(A.current,W.transform)){const $=iu(W.transform);A.current=$,clearTimeout(M.current),M.current=setTimeout(()=>{ee==null||ee($),n==null||n(W.sourceEvent,$)},l?150:0)}})},[L,l,g,n,s]),k.useEffect(()=>{L&&L.filter(W=>{const ee=K||i,$=a&&W.ctrlKey;if((g===!0||Array.isArray(g)&&g.includes(1))&&W.button===1&&W.type==="mousedown"&&(ji(W,"react-flow__node")||ji(W,"react-flow__edge")))return!0;if(!g&&!ee&&!l&&!p&&!a||R||!p&&W.type==="dblclick"||ji(W,C)&&W.type==="wheel"||ji(W,j)&&(W.type!=="wheel"||l&&W.type==="wheel"&&!K)||!a&&W.ctrlKey&&W.type==="wheel"||!ee&&!l&&!$&&W.type==="wheel"||!g&&(W.type==="mousedown"||W.type==="touchstart")||Array.isArray(g)&&!g.includes(W.button)&&W.type==="mousedown")return!1;const Y=Array.isArray(g)&&g.includes(W.button)||!W.button||W.button<=1;return(!W.ctrlKey||W.type==="wheel")&&Y})},[R,L,i,a,l,p,g,f,K]),de.createElement("div",{className:"react-flow__renderer",ref:O,style:Tw},N)},BP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function UP(){const{userSelectionActive:e,userSelectionRect:t}=at(BP,Lt);return e&&t?de.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 zb(e,t){const n=t.parentNode||t.parentId,s=e.find(i=>i.id===n);if(s){const i=t.position.x+t.width-s.width,a=t.position.y+t.height-s.height;if(i>0||a>0||t.position.x<0||t.position.y<0){if(s.style={...s.style},s.style.width=s.style.width??s.width,s.style.height=s.style.height??s.height,i>0&&(s.style.width+=i),a>0&&(s.style.height+=a),t.position.x<0){const l=Math.abs(t.position.x);s.position.x=s.position.x-l,s.style.width+=l,t.position.x=0}if(t.position.y<0){const l=Math.abs(t.position.y);s.position.y=s.position.y-l,s.style.height+=l,t.position.y=0}s.width=s.style.width,s.height=s.style.height}}}function WP(e,t){if(e.some(s=>s.type==="reset"))return e.filter(s=>s.type==="reset").map(s=>s.item);const n=e.filter(s=>s.type==="add").map(s=>s.item);return t.reduce((s,i)=>{const a=e.filter(u=>u.id===i.id);if(a.length===0)return s.push(i),s;const l={...i};for(const u of a)if(u)switch(u.type){case"select":{l.selected=u.selected;break}case"position":{typeof u.position<"u"&&(l.position=u.position),typeof u.positionAbsolute<"u"&&(l.positionAbsolute=u.positionAbsolute),typeof u.dragging<"u"&&(l.dragging=u.dragging),l.expandParent&&zb(s,l);break}case"dimensions":{typeof u.dimensions<"u"&&(l.width=u.dimensions.width,l.height=u.dimensions.height),typeof u.updateStyle<"u"&&(l.style={...l.style||{},...u.dimensions}),typeof u.resizing=="boolean"&&(l.resizing=u.resizing),l.expandParent&&zb(s,l);break}case"remove":return s}return s.push(l),s},n)}function HP(e,t){return WP(e,t)}const Ms=(e,t)=>({id:e,type:"select",selected:t});function Oi(e,t){return e.reduce((n,s)=>{const i=t.includes(s.id);return!s.selected&&i?(s.selected=!0,n.push(Ms(s.id,!0))):s.selected&&!i&&(s.selected=!1,n.push(Ms(s.id,!1))),n},[])}const nh=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},GP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),zj=k.memo(({isSelecting:e,selectionMode:t=vl.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:l,onPaneScroll:u,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:f,children:g})=>{const v=k.useRef(null),w=Mt(),E=k.useRef(0),b=k.useRef(0),S=k.useRef(),{userSelectionActive:_,elementsSelectable:N,dragging:C}=at(GP,Lt),j=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),E.current=0,b.current=0},M=X=>{a==null||a(X),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},P=X=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){X.preventDefault();return}l==null||l(X)},I=u?X=>u(X):void 0,F=X=>{const{resetSelectedElements:R,domNode:K}=w.getState();if(S.current=K==null?void 0:K.getBoundingClientRect(),!N||!e||X.button!==0||X.target!==v.current||!S.current)return;const{x:G,y:ne}=Os(X,S.current);R(),w.setState({userSelectionRect:{width:0,height:0,startX:G,startY:ne,x:G,y:ne}}),s==null||s(X)},O=X=>{const{userSelectionRect:R,nodeInternals:K,edges:G,transform:ne,onNodesChange:Q,onEdgesChange:W,nodeOrigin:ee,getNodes:$}=w.getState();if(!e||!S.current||!R)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const Y=Os(X,S.current),ue=R.startX??0,z=R.startY??0,D={...R,x:Y.x<ue?Y.x:ue,y:Y.y<z?Y.y:z,width:Math.abs(Y.x-ue),height:Math.abs(Y.y-z)},J=$(),V=_j(K,D,ne,t===vl.Partial,!0,ee),ae=Sj(V,G).map(ye=>ye.id),he=V.map(ye=>ye.id);if(E.current!==he.length){E.current=he.length;const ye=Oi(J,he);ye.length&&(Q==null||Q(ye))}if(b.current!==ae.length){b.current=ae.length;const ye=Oi(G,ae);ye.length&&(W==null||W(ye))}w.setState({userSelectionRect:D})},A=X=>{if(X.button!==0)return;const{userSelectionRect:R}=w.getState();!_&&R&&X.target===v.current&&(M==null||M(X)),w.setState({nodesSelectionActive:E.current>0}),j(),i==null||i(X)},L=X=>{_&&(w.setState({nodesSelectionActive:E.current>0}),i==null||i(X)),j()},H=N&&(e||_);return de.createElement("div",{className:Ht(["react-flow__pane",{dragging:C,selection:e}]),onClick:H?void 0:nh(M,v),onContextMenu:nh(P,v),onWheel:nh(I,v),onMouseEnter:H?void 0:h,onMouseDown:H?F:void 0,onMouseMove:H?O:p,onMouseUp:H?A:void 0,onMouseLeave:H?L:f,ref:v,style:Tw},g,de.createElement(UP,null))});zj.displayName="Pane";function Bj(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:Bj(s,t):!1}function Bb(e,t,n){let s=e;do{if(s!=null&&s.matches(t))return!0;if(s===n.current)return!1;s=s.parentElement}while(s);return!1}function VP(e,t,n,s){return Array.from(e.values()).filter(i=>(i.selected||i.id===s)&&(!i.parentNode||i.parentId||!Bj(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var a,l;return{id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((a=i.positionAbsolute)==null?void 0:a.x)??0),y:n.y-(((l=i.positionAbsolute)==null?void 0:l.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode||i.parentId,parentId:i.parentNode||i.parentId,width:i.width,height:i.height,expandParent:i.expandParent}})}function YP(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function Uj(e,t,n,s,i=[0,0],a){const l=YP(e,e.extent||s);let u=l;const h=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(h&&e.width&&e.height){const g=n.get(h),{x:v,y:w}=So(g,i).positionAbsolute;u=g&&Dn(v)&&Dn(w)&&Dn(g.width)&&Dn(g.height)?[[v+e.width*i[0],w+e.height*i[1]],[v+g.width-e.width+e.width*i[0],w+g.height-e.height+e.height*i[1]]]:u}else a==null||a("005",ts.error005()),u=l;else if(e.extent&&h&&e.extent!=="parent"){const g=n.get(h),{x:v,y:w}=So(g,i).positionAbsolute;u=[[e.extent[0][0]+v,e.extent[0][1]+w],[e.extent[1][0]+v,e.extent[1][1]+w]]}let p={x:0,y:0};if(h){const g=n.get(h);p=So(g,i).positionAbsolute}const f=u&&u!=="parent"?kw(t,u):t;return{position:{x:f.x-p.x,y:f.y-p.y},positionAbsolute:f}}function rh({nodeId:e,dragItems:t,nodeInternals:n}){const s=t.map(i=>({...n.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?s.find(i=>i.id===e):s[0],s]}const Ub=(e,t,n,s)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const a=Array.from(i),l=t.getBoundingClientRect(),u={x:l.width*s[0],y:l.height*s[1]};return a.map(h=>{const p=h.getBoundingClientRect();return{id:h.getAttribute("data-handleid"),position:h.getAttribute("data-handlepos"),x:(p.left-l.left-u.x)/n,y:(p.top-l.top-u.y)/n,...bw(h)}})};function Ja(e,t,n){return n===void 0?n:s=>{const i=t().nodeInternals.get(e);i&&n(s,{...i})}}function Gv({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:l,nodeInternals:u,onError:h}=t.getState(),p=u.get(e);if(!p){h==null||h("012",ts.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&l)&&(a({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var f;return(f=s==null?void 0:s.current)==null?void 0:f.blur()})):i([e])}function KP(){const e=Mt();return k.useCallback(({sourceEvent:n})=>{const{transform:s,snapGrid:i,snapToGrid:a}=e.getState(),l=n.touches?n.touches[0].clientX:n.clientX,u=n.touches?n.touches[0].clientY:n.clientY,h={x:(l-s[0])/s[2],y:(u-s[1])/s[2]};return{xSnapped:a?i[0]*Math.round(h.x/i[0]):h.x,ySnapped:a?i[1]*Math.round(h.y/i[1]):h.y,...h}},[])}function sh(e){return(t,n,s)=>e==null?void 0:e(t,s)}function Wj({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:i,isSelectable:a,selectNodesOnDrag:l}){const u=Mt(),[h,p]=k.useState(!1),f=k.useRef([]),g=k.useRef({x:null,y:null}),v=k.useRef(0),w=k.useRef(null),E=k.useRef({x:0,y:0}),b=k.useRef(null),S=k.useRef(!1),_=k.useRef(!1),N=k.useRef(!1),C=KP();return k.useEffect(()=>{if(e!=null&&e.current){const j=qn(e.current),M=({x:F,y:O})=>{const{nodeInternals:A,onNodeDrag:L,onSelectionDrag:H,updateNodePositions:X,nodeExtent:R,snapGrid:K,snapToGrid:G,nodeOrigin:ne,onError:Q}=u.getState();g.current={x:F,y:O};let W=!1,ee={x:0,y:0,x2:0,y2:0};if(f.current.length>1&&R){const Y=Vu(f.current,ne);ee=yl(Y)}if(f.current=f.current.map(Y=>{const ue={x:F-Y.distance.x,y:O-Y.distance.y};G&&(ue.x=K[0]*Math.round(ue.x/K[0]),ue.y=K[1]*Math.round(ue.y/K[1]));const z=[[R[0][0],R[0][1]],[R[1][0],R[1][1]]];f.current.length>1&&R&&!Y.extent&&(z[0][0]=Y.positionAbsolute.x-ee.x+R[0][0],z[1][0]=Y.positionAbsolute.x+(Y.width??0)-ee.x2+R[1][0],z[0][1]=Y.positionAbsolute.y-ee.y+R[0][1],z[1][1]=Y.positionAbsolute.y+(Y.height??0)-ee.y2+R[1][1]);const D=Uj(Y,ue,A,z,ne,Q);return W=W||Y.position.x!==D.position.x||Y.position.y!==D.position.y,Y.position=D.position,Y.positionAbsolute=D.positionAbsolute,Y}),!W)return;X(f.current,!0,!0),p(!0);const $=i?L:sh(H);if($&&b.current){const[Y,ue]=rh({nodeId:i,dragItems:f.current,nodeInternals:A});$(b.current,Y,ue)}},P=()=>{if(!w.current)return;const[F,O]=fj(E.current,w.current);if(F!==0||O!==0){const{transform:A,panBy:L}=u.getState();g.current.x=(g.current.x??0)-F/A[2],g.current.y=(g.current.y??0)-O/A[2],L({x:F,y:O})&&M(g.current)}v.current=requestAnimationFrame(P)},I=F=>{var ne;const{nodeInternals:O,multiSelectionActive:A,nodesDraggable:L,unselectNodesAndEdges:H,onNodeDragStart:X,onSelectionDragStart:R}=u.getState();_.current=!0;const K=i?X:sh(R);(!l||!a)&&!A&&i&&((ne=O.get(i))!=null&&ne.selected||H()),i&&a&&l&&Gv({id:i,store:u,nodeRef:e});const G=C(F);if(g.current=G,f.current=VP(O,L,G,i),K&&f.current){const[Q,W]=rh({nodeId:i,dragItems:f.current,nodeInternals:O});K(F.sourceEvent,Q,W)}};if(t)j.on(".drag",null);else{const F=oI().on("start",O=>{const{domNode:A,nodeDragThreshold:L}=u.getState();L===0&&I(O),N.current=!1;const H=C(O);g.current=H,w.current=(A==null?void 0:A.getBoundingClientRect())||null,E.current=Os(O.sourceEvent,w.current)}).on("drag",O=>{var X,R;const A=C(O),{autoPanOnNodeDrag:L,nodeDragThreshold:H}=u.getState();if(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1&&(N.current=!0),!N.current){if(!S.current&&_.current&&L&&(S.current=!0,P()),!_.current){const K=A.xSnapped-(((X=g==null?void 0:g.current)==null?void 0:X.x)??0),G=A.ySnapped-(((R=g==null?void 0:g.current)==null?void 0:R.y)??0);Math.sqrt(K*K+G*G)>H&&I(O)}(g.current.x!==A.xSnapped||g.current.y!==A.ySnapped)&&f.current&&_.current&&(b.current=O.sourceEvent,E.current=Os(O.sourceEvent,w.current),M(A))}}).on("end",O=>{if(!(!_.current||N.current)&&(p(!1),S.current=!1,_.current=!1,cancelAnimationFrame(v.current),f.current)){const{updateNodePositions:A,nodeInternals:L,onNodeDragStop:H,onSelectionDragStop:X}=u.getState(),R=i?H:sh(X);if(A(f.current,!1,!1),R){const[K,G]=rh({nodeId:i,dragItems:f.current,nodeInternals:L});R(O.sourceEvent,K,G)}}}).filter(O=>{const A=O.target;return!O.button&&(!n||!Bb(A,`.${n}`,e))&&(!s||Bb(A,s,e))});return j.call(F),()=>{j.on(".drag",null)}}}},[e,t,n,s,a,u,i,l,C]),h}function Hj(){const e=Mt();return k.useCallback(n=>{const{nodeInternals:s,nodeExtent:i,updateNodePositions:a,getNodes:l,snapToGrid:u,snapGrid:h,onError:p,nodesDraggable:f}=e.getState(),g=l().filter(N=>N.selected&&(N.draggable||f&&typeof N.draggable>"u")),v=u?h[0]:5,w=u?h[1]:5,E=n.isShiftPressed?4:1,b=n.x*v*E,S=n.y*w*E,_=g.map(N=>{if(N.positionAbsolute){const C={x:N.positionAbsolute.x+b,y:N.positionAbsolute.y+S};u&&(C.x=h[0]*Math.round(C.x/h[0]),C.y=h[1]*Math.round(C.y/h[1]));const{positionAbsolute:j,position:M}=Uj(N,C,s,i,void 0,p);N.position=M,N.positionAbsolute=j}return N});a(_,!0,!1)},[])}const Di={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var el=e=>{const t=({id:n,type:s,data:i,xPos:a,yPos:l,xPosOrigin:u,yPosOrigin:h,selected:p,onClick:f,onMouseEnter:g,onMouseMove:v,onMouseLeave:w,onContextMenu:E,onDoubleClick:b,style:S,className:_,isDraggable:N,isSelectable:C,isConnectable:j,isFocusable:M,selectNodesOnDrag:P,sourcePosition:I,targetPosition:F,hidden:O,resizeObserver:A,dragHandle:L,zIndex:H,isParent:X,noDragClassName:R,noPanClassName:K,initialized:G,disableKeyboardA11y:ne,ariaLabel:Q,rfId:W,hasHandleBounds:ee})=>{const $=Mt(),Y=k.useRef(null),ue=k.useRef(null),z=k.useRef(I),D=k.useRef(F),J=k.useRef(s),V=C||N||f||g||v||w,ae=Hj(),he=Ja(n,$.getState,g),ye=Ja(n,$.getState,v),_e=Ja(n,$.getState,w),Ve=Ja(n,$.getState,E),Be=Ja(n,$.getState,b),qe=be=>{const{nodeDragThreshold:ke}=$.getState();if(C&&(!P||!N||ke>0)&&Gv({id:n,store:$,nodeRef:Y}),f){const Ye=$.getState().nodeInternals.get(n);Ye&&f(be,{...Ye})}},Se=be=>{if(!zv(be)&&!ne)if(gj.includes(be.key)&&C){const ke=be.key==="Escape";Gv({id:n,store:$,unselect:ke,nodeRef:Y})}else N&&p&&Object.prototype.hasOwnProperty.call(Di,be.key)&&($.setState({ariaLiveMessage:`Moved selected node ${be.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~l}`}),ae({x:Di[be.key].x,y:Di[be.key].y,isShiftPressed:be.shiftKey}))};k.useEffect(()=>()=>{ue.current&&(A==null||A.unobserve(ue.current),ue.current=null)},[]),k.useEffect(()=>{if(Y.current&&!O){const be=Y.current;(!G||!ee||ue.current!==be)&&(ue.current&&(A==null||A.unobserve(ue.current)),A==null||A.observe(be),ue.current=be)}},[O,G,ee]),k.useEffect(()=>{const be=J.current!==s,ke=z.current!==I,Ye=D.current!==F;Y.current&&(be||ke||Ye)&&(be&&(J.current=s),ke&&(z.current=I),Ye&&(D.current=F),$.getState().updateNodeDimensions([{id:n,nodeElement:Y.current,forceUpdate:!0}]))},[n,s,I,F]);const ce=Wj({nodeRef:Y,disabled:O||!N,noDragClassName:R,handleSelector:L,nodeId:n,isSelectable:C,selectNodesOnDrag:P});return O?null:de.createElement("div",{className:Ht(["react-flow__node",`react-flow__node-${s}`,{[K]:N},_,{selected:p,selectable:C,parent:X,dragging:ce}]),ref:Y,style:{zIndex:H,transform:`translate(${u}px,${h}px)`,pointerEvents:V?"all":"none",visibility:G?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:he,onMouseMove:ye,onMouseLeave:_e,onContextMenu:Ve,onClick:qe,onDoubleClick:Be,onKeyDown:M?Se:void 0,tabIndex:M?0:void 0,role:M?"button":void 0,"aria-describedby":ne?void 0:`${$j}-${W}`,"aria-label":Q},de.createElement(lP,{value:n},de.createElement(e,{id:n,data:i,type:s,xPos:a,yPos:l,selected:p,isConnectable:j,sourcePosition:I,targetPosition:F,dragging:ce,dragHandle:L,zIndex:H})))};return t.displayName="NodeWrapper",k.memo(t)};const XP=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Vu(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function QP({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=Mt(),{width:i,height:a,x:l,y:u,transformString:h,userSelectionActive:p}=at(XP,Lt),f=Hj(),g=k.useRef(null);if(k.useEffect(()=>{var E;n||(E=g.current)==null||E.focus({preventScroll:!0})},[n]),Wj({nodeRef:g}),p||!i||!a)return null;const v=e?E=>{const b=s.getState().getNodes().filter(S=>S.selected);e(E,b)}:void 0,w=E=>{Object.prototype.hasOwnProperty.call(Di,E.key)&&f({x:Di[E.key].x,y:Di[E.key].y,isShiftPressed:E.shiftKey})};return de.createElement("div",{className:Ht(["react-flow__nodesselection","react-flow__container",t]),style:{transform:h}},de.createElement("div",{ref:g,className:"react-flow__nodesselection-rect",onContextMenu:v,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:i,height:a,top:u,left:l}}))}var ZP=k.memo(QP);const JP=e=>e.nodesSelectionActive,Gj=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:l,deleteKeyCode:u,onMove:h,onMoveStart:p,onMoveEnd:f,selectionKeyCode:g,selectionOnDrag:v,selectionMode:w,onSelectionStart:E,onSelectionEnd:b,multiSelectionKeyCode:S,panActivationKeyCode:_,zoomActivationKeyCode:N,elementsSelectable:C,zoomOnScroll:j,zoomOnPinch:M,panOnScroll:P,panOnScrollSpeed:I,panOnScrollMode:F,zoomOnDoubleClick:O,panOnDrag:A,defaultViewport:L,translateExtent:H,minZoom:X,maxZoom:R,preventScrolling:K,onSelectionContextMenu:G,noWheelClassName:ne,noPanClassName:Q,disableKeyboardA11y:W})=>{const ee=at(JP),$=wl(g),Y=wl(_),ue=Y||A,z=Y||P,D=$||v&&ue!==!0;return LP({deleteKeyCode:u,multiSelectionKeyCode:S}),de.createElement(zP,{onMove:h,onMoveStart:p,onMoveEnd:f,onPaneContextMenu:a,elementsSelectable:C,zoomOnScroll:j,zoomOnPinch:M,panOnScroll:z,panOnScrollSpeed:I,panOnScrollMode:F,zoomOnDoubleClick:O,panOnDrag:!$&&ue,defaultViewport:L,translateExtent:H,minZoom:X,maxZoom:R,zoomActivationKeyCode:N,preventScrolling:K,noWheelClassName:ne,noPanClassName:Q},de.createElement(zj,{onSelectionStart:E,onSelectionEnd:b,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:l,panOnDrag:ue,isSelecting:!!D,selectionMode:w},e,ee&&de.createElement(ZP,{onSelectionContextMenu:G,noPanClassName:Q,disableKeyboardA11y:W})))};Gj.displayName="FlowRenderer";var e$=k.memo(Gj);function t$(e){return at(k.useCallback(n=>e?_j(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function n$(e){const t={input:el(e.input||Mj),default:el(e.default||Hv),output:el(e.output||Oj),group:el(e.group||jw)},n={},s=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,a)=>(i[a]=el(e[a]||Hv),i),n);return{...t,...s}}const r$=({x:e,y:t,width:n,height:s,origin:i})=>!n||!s?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-s*i[1]},s$=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),Vj=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:i,updateNodeDimensions:a,onError:l}=at(s$,Lt),u=t$(e.onlyRenderVisibleElements),h=k.useRef(),p=k.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const f=new ResizeObserver(g=>{const v=g.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));a(v)});return h.current=f,f},[]);return k.useEffect(()=>()=>{var f;(f=h==null?void 0:h.current)==null||f.disconnect()},[]),de.createElement("div",{className:"react-flow__nodes",style:Tw},u.map(f=>{var M,P,I;let g=f.type||"default";e.nodeTypes[g]||(l==null||l("003",ts.error003(g)),g="default");const v=e.nodeTypes[g]||e.nodeTypes.default,w=!!(f.draggable||t&&typeof f.draggable>"u"),E=!!(f.selectable||i&&typeof f.selectable>"u"),b=!!(f.connectable||n&&typeof f.connectable>"u"),S=!!(f.focusable||s&&typeof f.focusable>"u"),_=e.nodeExtent?kw(f.positionAbsolute,e.nodeExtent):f.positionAbsolute,N=(_==null?void 0:_.x)??0,C=(_==null?void 0:_.y)??0,j=r$({x:N,y:C,width:f.width??0,height:f.height??0,origin:e.nodeOrigin});return de.createElement(v,{key:f.id,id:f.id,className:f.className,style:f.style,type:g,data:f.data,sourcePosition:f.sourcePosition||De.Bottom,targetPosition:f.targetPosition||De.Top,hidden:f.hidden,xPos:N,yPos:C,xPosOrigin:j.x,yPosOrigin:j.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!f.selected,isDraggable:w,isSelectable:E,isConnectable:b,isFocusable:S,resizeObserver:p,dragHandle:f.dragHandle,zIndex:((M=f[Ct])==null?void 0:M.z)??0,isParent:!!((P=f[Ct])!=null&&P.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!f.width&&!!f.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:f.ariaLabel,hasHandleBounds:!!((I=f[Ct])!=null&&I.handleBounds)})}))};Vj.displayName="NodeRenderer";var o$=k.memo(Vj);const i$=(e,t,n)=>n===De.Left?e-t:n===De.Right?e+t:e,a$=(e,t,n)=>n===De.Top?e-t:n===De.Bottom?e+t:e,Wb="react-flow__edgeupdater",Hb=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:i,onMouseEnter:a,onMouseOut:l,type:u})=>de.createElement("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:l,className:Ht([Wb,`${Wb}-${u}`]),cx:i$(t,s,e),cy:a$(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),l$=()=>!0;var Ti=e=>{const t=({id:n,className:s,type:i,data:a,onClick:l,onEdgeDoubleClick:u,selected:h,animated:p,label:f,labelStyle:g,labelShowBg:v,labelBgStyle:w,labelBgPadding:E,labelBgBorderRadius:b,style:S,source:_,target:N,sourceX:C,sourceY:j,targetX:M,targetY:P,sourcePosition:I,targetPosition:F,elementsSelectable:O,hidden:A,sourceHandleId:L,targetHandleId:H,onContextMenu:X,onMouseEnter:R,onMouseMove:K,onMouseLeave:G,reconnectRadius:ne,onReconnect:Q,onReconnectStart:W,onReconnectEnd:ee,markerEnd:$,markerStart:Y,rfId:ue,ariaLabel:z,isFocusable:D,isReconnectable:J,pathOptions:V,interactionWidth:ae,disableKeyboardA11y:he})=>{const ye=k.useRef(null),[_e,Ve]=k.useState(!1),[Be,qe]=k.useState(!1),Se=Mt(),ce=k.useMemo(()=>`url('#${Uv(Y,ue)}')`,[Y,ue]),be=k.useMemo(()=>`url('#${Uv($,ue)}')`,[$,ue]);if(A)return null;const ke=Pe=>{var Ie;const{edges:$e,addSelectedEdges:Te,unselectNodesAndEdges:Xe,multiSelectionActive:jt}=Se.getState(),ot=$e.find(xt=>xt.id===n);ot&&(O&&(Se.setState({nodesSelectionActive:!1}),ot.selected&&jt?(Xe({nodes:[],edges:[ot]}),(Ie=ye.current)==null||Ie.blur()):Te([n])),l&&l(Pe,ot))},Ye=Za(n,Se.getState,u),dt=Za(n,Se.getState,X),lt=Za(n,Se.getState,R),pe=Za(n,Se.getState,K),me=Za(n,Se.getState,G),Me=(Pe,$e)=>{if(Pe.button!==0)return;const{edges:Te,isValidConnection:Xe}=Se.getState(),jt=$e?N:_,ot=($e?H:L)||null,Ie=$e?"target":"source",xt=Xe||l$,ft=$e,gt=Te.find(En=>En.id===n);qe(!0),W==null||W(Pe,gt,Ie);const Nn=En=>{qe(!1),ee==null||ee(En,gt,Ie)};jj({event:Pe,handleId:ot,nodeId:jt,onConnect:En=>Q==null?void 0:Q(gt,En),isTarget:ft,getState:Se.getState,setState:Se.setState,isValidConnection:xt,edgeUpdaterType:Ie,onReconnectEnd:Nn})},He=Pe=>Me(Pe,!0),ct=Pe=>Me(Pe,!1),je=()=>Ve(!0),Ge=()=>Ve(!1),Ke=!O&&!l,se=Pe=>{var $e;if(!he&&gj.includes(Pe.key)&&O){const{unselectNodesAndEdges:Te,addSelectedEdges:Xe,edges:jt}=Se.getState();Pe.key==="Escape"?(($e=ye.current)==null||$e.blur(),Te({edges:[jt.find(Ie=>Ie.id===n)]})):Xe([n])}};return de.createElement("g",{className:Ht(["react-flow__edge",`react-flow__edge-${i}`,s,{selected:h,animated:p,inactive:Ke,updating:_e}]),onClick:ke,onDoubleClick:Ye,onContextMenu:dt,onMouseEnter:lt,onMouseMove:pe,onMouseLeave:me,onKeyDown:D?se:void 0,tabIndex:D?0:void 0,role:D?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":z===null?void 0:z||`Edge from ${_} to ${N}`,"aria-describedby":D?`${Lj}-${ue}`:void 0,ref:ye},!Be&&de.createElement(e,{id:n,source:_,target:N,selected:h,animated:p,label:f,labelStyle:g,labelShowBg:v,labelBgStyle:w,labelBgPadding:E,labelBgBorderRadius:b,data:a,style:S,sourceX:C,sourceY:j,targetX:M,targetY:P,sourcePosition:I,targetPosition:F,sourceHandleId:L,targetHandleId:H,markerStart:ce,markerEnd:be,pathOptions:V,interactionWidth:ae}),J&&de.createElement(de.Fragment,null,(J==="source"||J===!0)&&de.createElement(Hb,{position:I,centerX:C,centerY:j,radius:ne,onMouseDown:He,onMouseEnter:je,onMouseOut:Ge,type:"source"}),(J==="target"||J===!0)&&de.createElement(Hb,{position:F,centerX:M,centerY:P,radius:ne,onMouseDown:ct,onMouseEnter:je,onMouseOut:Ge,type:"target"})))};return t.displayName="EdgeWrapper",k.memo(t)};function c$(e){const t={default:Ti(e.default||Mu),straight:Ti(e.bezier||Nw),step:Ti(e.step||Sw),smoothstep:Ti(e.step||Gu),simplebezier:Ti(e.simplebezier||_w)},n={},s=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,a)=>(i[a]=Ti(e[a]||Mu),i),n);return{...t,...s}}function Gb(e,t,n=null){const s=((n==null?void 0:n.x)||0)+t.x,i=((n==null?void 0:n.y)||0)+t.y,a=(n==null?void 0:n.width)||t.width,l=(n==null?void 0:n.height)||t.height;switch(e){case De.Top:return{x:s+a/2,y:i};case De.Right:return{x:s+a,y:i+l/2};case De.Bottom:return{x:s+a/2,y:i+l};case De.Left:return{x:s,y:i+l/2}}}function Vb(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const u$=(e,t,n,s,i,a)=>{const l=Gb(n,e,t),u=Gb(a,s,i);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y}};function d$({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:s,targetWidth:i,targetHeight:a,width:l,height:u,transform:h}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+s,t.y+a)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const f=yl({x:(0-h[0])/h[2],y:(0-h[1])/h[2],width:l/h[2],height:u/h[2]}),g=Math.max(0,Math.min(f.x2,p.x2)-Math.max(f.x,p.x)),v=Math.max(0,Math.min(f.y2,p.y2)-Math.max(f.y,p.y));return Math.ceil(g*v)>0}function Yb(e){var s,i,a,l,u;const t=((s=e==null?void 0:e[Ct])==null?void 0:s.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)<"u"&&typeof((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.y)<"u";return[{x:((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.x)||0,y:((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const f$=[{level:0,isMaxLevel:!0,edges:[]}];function h$(e,t,n=!1){let s=-1;const i=e.reduce((l,u)=>{var f,g;const h=Dn(u.zIndex);let p=h?u.zIndex:0;if(n){const v=t.get(u.target),w=t.get(u.source),E=u.selected||(v==null?void 0:v.selected)||(w==null?void 0:w.selected),b=Math.max(((f=w==null?void 0:w[Ct])==null?void 0:f.z)||0,((g=v==null?void 0:v[Ct])==null?void 0:g.z)||0,1e3);p=(h?u.zIndex:0)+(E?b:0)}return l[p]?l[p].push(u):l[p]=[u],s=p>s?p:s,l},{}),a=Object.entries(i).map(([l,u])=>{const h=+l;return{edges:u,level:h,isMaxLevel:h===s}});return a.length===0?f$:a}function p$(e,t,n){const s=at(k.useCallback(i=>e?i.edges.filter(a=>{const l=t.get(a.source),u=t.get(a.target);return(l==null?void 0:l.width)&&(l==null?void 0:l.height)&&(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&d$({sourcePos:l.positionAbsolute||{x:0,y:0},targetPos:u.positionAbsolute||{x:0,y:0},sourceWidth:l.width,sourceHeight:l.height,targetWidth:u.width,targetHeight:u.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return h$(s,t,n)}const m$=({color:e="none",strokeWidth:t=1})=>de.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),g$=({color:e="none",strokeWidth:t=1})=>de.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Kb={[Au.Arrow]:m$,[Au.ArrowClosed]:g$};function y$(e){const t=Mt();return k.useMemo(()=>{var i,a;return Object.prototype.hasOwnProperty.call(Kb,e)?Kb[e]:((a=(i=t.getState()).onError)==null||a.call(i,"009",ts.error009(e)),null)},[e])}const v$=({id:e,type:t,color:n,width:s=12.5,height:i=12.5,markerUnits:a="strokeWidth",strokeWidth:l,orient:u="auto-start-reverse"})=>{const h=y$(t);return h?de.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:u,refX:"0",refY:"0"},de.createElement(h,{color:n,strokeWidth:l})):null},w$=({defaultColor:e,rfId:t})=>n=>{const s=[];return n.edges.reduce((i,a)=>([a.markerStart,a.markerEnd].forEach(l=>{if(l&&typeof l=="object"){const u=Uv(l,t);s.includes(u)||(i.push({id:u,color:l.color||e,...l}),s.push(u))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))},Yj=({defaultColor:e,rfId:t})=>{const n=at(k.useCallback(w$({defaultColor:e,rfId:t}),[e,t]),(s,i)=>!(s.length!==i.length||s.some((a,l)=>a.id!==i[l].id)));return de.createElement("defs",null,n.map(s=>de.createElement(v$,{id:s.id,key:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient})))};Yj.displayName="MarkerDefinitions";var x$=k.memo(Yj);const b$=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}),Kj=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:i,noPanClassName:a,onEdgeContextMenu:l,onEdgeMouseEnter:u,onEdgeMouseMove:h,onEdgeMouseLeave:p,onEdgeClick:f,onEdgeDoubleClick:g,onReconnect:v,onReconnectStart:w,onReconnectEnd:E,reconnectRadius:b,children:S,disableKeyboardA11y:_})=>{const{edgesFocusable:N,edgesUpdatable:C,elementsSelectable:j,width:M,height:P,connectionMode:I,nodeInternals:F,onError:O}=at(b$,Lt),A=p$(t,F,n);return M?de.createElement(de.Fragment,null,A.map(({level:L,edges:H,isMaxLevel:X})=>de.createElement("svg",{key:L,style:{zIndex:L},width:M,height:P,className:"react-flow__edges react-flow__container"},X&&de.createElement(x$,{defaultColor:e,rfId:s}),de.createElement("g",null,H.map(R=>{const[K,G,ne]=Yb(F.get(R.source)),[Q,W,ee]=Yb(F.get(R.target));if(!ne||!ee)return null;let $=R.type||"default";i[$]||(O==null||O("011",ts.error011($)),$="default");const Y=i[$]||i.default,ue=I===Eo.Strict?W.target:(W.target??[]).concat(W.source??[]),z=Vb(G.source,R.sourceHandle),D=Vb(ue,R.targetHandle),J=(z==null?void 0:z.position)||De.Bottom,V=(D==null?void 0:D.position)||De.Top,ae=!!(R.focusable||N&&typeof R.focusable>"u"),he=R.reconnectable||R.updatable,ye=typeof v<"u"&&(he||C&&typeof he>"u");if(!z||!D)return O==null||O("008",ts.error008(z,R)),null;const{sourceX:_e,sourceY:Ve,targetX:Be,targetY:qe}=u$(K,z,J,Q,D,V);return de.createElement(Y,{key:R.id,id:R.id,className:Ht([R.className,a]),type:$,data:R.data,selected:!!R.selected,animated:!!R.animated,hidden:!!R.hidden,label:R.label,labelStyle:R.labelStyle,labelShowBg:R.labelShowBg,labelBgStyle:R.labelBgStyle,labelBgPadding:R.labelBgPadding,labelBgBorderRadius:R.labelBgBorderRadius,style:R.style,source:R.source,target:R.target,sourceHandleId:R.sourceHandle,targetHandleId:R.targetHandle,markerEnd:R.markerEnd,markerStart:R.markerStart,sourceX:_e,sourceY:Ve,targetX:Be,targetY:qe,sourcePosition:J,targetPosition:V,elementsSelectable:j,onContextMenu:l,onMouseEnter:u,onMouseMove:h,onMouseLeave:p,onClick:f,onEdgeDoubleClick:g,onReconnect:v,onReconnectStart:w,onReconnectEnd:E,reconnectRadius:b,rfId:s,ariaLabel:R.ariaLabel,isFocusable:ae,isReconnectable:ye,pathOptions:"pathOptions"in R?R.pathOptions:void 0,interactionWidth:R.interactionWidth,disableKeyboardA11y:_})})))),S):null};Kj.displayName="EdgeRenderer";var k$=k.memo(Kj);const _$=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function S$({children:e}){const t=at(_$);return de.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function N$(e){const t=Tl(),n=k.useRef(!1);k.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const E$={[De.Left]:De.Right,[De.Right]:De.Left,[De.Top]:De.Bottom,[De.Bottom]:De.Top},Xj=({nodeId:e,handleType:t,style:n,type:s=Is.Bezier,CustomComponent:i,connectionStatus:a})=>{var P,I,F;const{fromNode:l,handleId:u,toX:h,toY:p,connectionMode:f}=at(k.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]),Lt),g=(P=l==null?void 0:l[Ct])==null?void 0:P.handleBounds;let v=g==null?void 0:g[t];if(f===Eo.Loose&&(v=v||(g==null?void 0:g[t==="source"?"target":"source"])),!l||!v)return null;const w=u?v.find(O=>O.id===u):v[0],E=w?w.x+w.width/2:(l.width??0)/2,b=w?w.y+w.height/2:l.height??0,S=(((I=l.positionAbsolute)==null?void 0:I.x)??0)+E,_=(((F=l.positionAbsolute)==null?void 0:F.y)??0)+b,N=w==null?void 0:w.position,C=N?E$[N]:null;if(!N||!C)return null;if(i)return de.createElement(i,{connectionLineType:s,connectionLineStyle:n,fromNode:l,fromHandle:w,fromX:S,fromY:_,toX:h,toY:p,fromPosition:N,toPosition:C,connectionStatus:a});let j="";const M={sourceX:S,sourceY:_,sourcePosition:N,targetX:h,targetY:p,targetPosition:C};return s===Is.Bezier?[j]=bj(M):s===Is.Step?[j]=Bv({...M,borderRadius:0}):s===Is.SmoothStep?[j]=Bv(M):s===Is.SimpleBezier?[j]=xj(M):j=`M${S},${_} ${h},${p}`,de.createElement("path",{d:j,fill:"none",className:"react-flow__connection-path",style:n})};Xj.displayName="ConnectionLine";const C$=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function j$({containerStyle:e,style:t,type:n,component:s}){const{nodeId:i,handleType:a,nodesConnectable:l,width:u,height:h,connectionStatus:p}=at(C$,Lt);return!(i&&a&&u&&l)?null:de.createElement("svg",{style:e,width:u,height:h,className:"react-flow__edges react-flow__connectionline react-flow__container"},de.createElement("g",{className:Ht(["react-flow__connection",p])},de.createElement(Xj,{nodeId:i,handleType:a,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function Xb(e,t){return k.useRef(null),Mt(),k.useMemo(()=>t(e),[e])}const Qj=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:i,onInit:a,onNodeClick:l,onEdgeClick:u,onNodeDoubleClick:h,onEdgeDoubleClick:p,onNodeMouseEnter:f,onNodeMouseMove:g,onNodeMouseLeave:v,onNodeContextMenu:w,onSelectionContextMenu:E,onSelectionStart:b,onSelectionEnd:S,connectionLineType:_,connectionLineStyle:N,connectionLineComponent:C,connectionLineContainerStyle:j,selectionKeyCode:M,selectionOnDrag:P,selectionMode:I,multiSelectionKeyCode:F,panActivationKeyCode:O,zoomActivationKeyCode:A,deleteKeyCode:L,onlyRenderVisibleElements:H,elementsSelectable:X,selectNodesOnDrag:R,defaultViewport:K,translateExtent:G,minZoom:ne,maxZoom:Q,preventScrolling:W,defaultMarkerColor:ee,zoomOnScroll:$,zoomOnPinch:Y,panOnScroll:ue,panOnScrollSpeed:z,panOnScrollMode:D,zoomOnDoubleClick:J,panOnDrag:V,onPaneClick:ae,onPaneMouseEnter:he,onPaneMouseMove:ye,onPaneMouseLeave:_e,onPaneScroll:Ve,onPaneContextMenu:Be,onEdgeContextMenu:qe,onEdgeMouseEnter:Se,onEdgeMouseMove:ce,onEdgeMouseLeave:be,onReconnect:ke,onReconnectStart:Ye,onReconnectEnd:dt,reconnectRadius:lt,noDragClassName:pe,noWheelClassName:me,noPanClassName:Me,elevateEdgesOnSelect:He,disableKeyboardA11y:ct,nodeOrigin:je,nodeExtent:Ge,rfId:Ke})=>{const se=Xb(e,n$),Pe=Xb(t,c$);return N$(a),de.createElement(e$,{onPaneClick:ae,onPaneMouseEnter:he,onPaneMouseMove:ye,onPaneMouseLeave:_e,onPaneContextMenu:Be,onPaneScroll:Ve,deleteKeyCode:L,selectionKeyCode:M,selectionOnDrag:P,selectionMode:I,onSelectionStart:b,onSelectionEnd:S,multiSelectionKeyCode:F,panActivationKeyCode:O,zoomActivationKeyCode:A,elementsSelectable:X,onMove:n,onMoveStart:s,onMoveEnd:i,zoomOnScroll:$,zoomOnPinch:Y,zoomOnDoubleClick:J,panOnScroll:ue,panOnScrollSpeed:z,panOnScrollMode:D,panOnDrag:V,defaultViewport:K,translateExtent:G,minZoom:ne,maxZoom:Q,onSelectionContextMenu:E,preventScrolling:W,noDragClassName:pe,noWheelClassName:me,noPanClassName:Me,disableKeyboardA11y:ct},de.createElement(S$,null,de.createElement(k$,{edgeTypes:Pe,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:H,onEdgeContextMenu:qe,onEdgeMouseEnter:Se,onEdgeMouseMove:ce,onEdgeMouseLeave:be,onReconnect:ke,onReconnectStart:Ye,onReconnectEnd:dt,reconnectRadius:lt,defaultMarkerColor:ee,noPanClassName:Me,elevateEdgesOnSelect:!!He,disableKeyboardA11y:ct,rfId:Ke},de.createElement(j$,{style:N,type:_,component:C,containerStyle:j})),de.createElement("div",{className:"react-flow__edgelabel-renderer"}),de.createElement(o$,{nodeTypes:se,onNodeClick:l,onNodeDoubleClick:h,onNodeMouseEnter:f,onNodeMouseMove:g,onNodeMouseLeave:v,onNodeContextMenu:w,selectNodesOnDrag:R,onlyRenderVisibleElements:H,noPanClassName:Me,noDragClassName:pe,disableKeyboardA11y:ct,nodeOrigin:je,nodeExtent:Ge,rfId:Ke})))};Qj.displayName="GraphView";var T$=k.memo(Qj);const Vv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Rs={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:Vv,nodeExtent:Vv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Eo.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:nP,isValidConnection:void 0},R$=()=>yM((e,t)=>({...Rs,setNodes:n=>{const{nodeInternals:s,nodeOrigin:i,elevateNodesOnSelect:a}=t();e({nodeInternals:th(n,s,i,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:s={}}=t();e({edges:n.map(i=>({...s,...i}))})},setDefaultNodesAndEdges:(n,s)=>{const i=typeof n<"u",a=typeof s<"u",l=i?th(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:l,edges:a?s:[],hasDefaultNodes:i,hasDefaultEdges:a})},updateNodeDimensions:n=>{const{onNodesChange:s,nodeInternals:i,fitViewOnInit:a,fitViewOnInitDone:l,fitViewOnInitOptions:u,domNode:h,nodeOrigin:p}=t(),f=h==null?void 0:h.querySelector(".react-flow__viewport");if(!f)return;const g=window.getComputedStyle(f),{m22:v}=new window.DOMMatrixReadOnly(g.transform),w=n.reduce((b,S)=>{const _=i.get(S.id);if(_!=null&&_.hidden)i.set(_.id,{..._,[Ct]:{..._[Ct],handleBounds:void 0}});else if(_){const N=bw(S.nodeElement);!!(N.width&&N.height&&(_.width!==N.width||_.height!==N.height||S.forceUpdate))&&(i.set(_.id,{..._,[Ct]:{..._[Ct],handleBounds:{source:Ub(".source",S.nodeElement,v,p),target:Ub(".target",S.nodeElement,v,p)}},...N}),b.push({id:_.id,type:"dimensions",dimensions:N}))}return b},[]);Dj(i,p);const E=l||a&&!l&&Fj(t,{initial:!0,...u});e({nodeInternals:new Map(i),fitViewOnInitDone:E}),(w==null?void 0:w.length)>0&&(s==null||s(w))},updateNodePositions:(n,s=!0,i=!1)=>{const{triggerNodeChanges:a}=t(),l=n.map(u=>{const h={id:u.id,type:"position",dragging:i};return s&&(h.positionAbsolute=u.positionAbsolute,h.position=u.position),h});a(l)},triggerNodeChanges:n=>{const{onNodesChange:s,nodeInternals:i,hasDefaultNodes:a,nodeOrigin:l,getNodes:u,elevateNodesOnSelect:h}=t();if(n!=null&&n.length){if(a){const p=HP(n,u()),f=th(p,i,l,h);e({nodeInternals:f})}s==null||s(n)}},addSelectedNodes:n=>{const{multiSelectionActive:s,edges:i,getNodes:a}=t();let l,u=null;s?l=n.map(h=>Ms(h,!0)):(l=Oi(a(),n),u=Oi(i,[])),ou({changedNodes:l,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:s,edges:i,getNodes:a}=t();let l,u=null;s?l=n.map(h=>Ms(h,!0)):(l=Oi(i,n),u=Oi(a(),[])),ou({changedNodes:u,changedEdges:l,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:s}={})=>{const{edges:i,getNodes:a}=t(),l=n||a(),u=s||i,h=l.map(f=>(f.selected=!1,Ms(f.id,!1))),p=u.map(f=>Ms(f.id,!1));ou({changedNodes:h,changedEdges:p,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:s,maxZoom:i}=t();s==null||s.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:s,minZoom:i}=t();s==null||s.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{var s;(s=t().d3Zoom)==null||s.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:s}=t(),a=s().filter(u=>u.selected).map(u=>Ms(u.id,!1)),l=n.filter(u=>u.selected).map(u=>Ms(u.id,!1));ou({changedNodes:a,changedEdges:l,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(i=>{i.positionAbsolute=kw(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:i,height:a,d3Zoom:l,d3Selection:u,translateExtent:h}=t();if(!l||!u||!n.x&&!n.y)return!1;const p=Jr.translate(s[0]+n.x,s[1]+n.y).scale(s[2]),f=[[0,0],[i,a]],g=l==null?void 0:l.constrain()(p,f,h);return l.transform(u,g),s[0]!==g.x||s[1]!==g.y||s[2]!==g.k},cancelConnection:()=>e({connectionNodeId:Rs.connectionNodeId,connectionHandleId:Rs.connectionHandleId,connectionHandleType:Rs.connectionHandleType,connectionStatus:Rs.connectionStatus,connectionStartHandle:Rs.connectionStartHandle,connectionEndHandle:Rs.connectionEndHandle}),reset:()=>e({...Rs})}),Object.is),Rw=({children:e})=>{const t=k.useRef(null);return t.current||(t.current=R$()),de.createElement(KO,{value:t.current},e)};Rw.displayName="ReactFlowProvider";const Zj=({children:e})=>k.useContext(Hu)?de.createElement(de.Fragment,null,e):de.createElement(Rw,null,e);Zj.displayName="ReactFlowWrapper";const A$={input:Mj,default:Hv,output:Oj,group:jw},M$={default:Mu,straight:Nw,step:Sw,smoothstep:Gu,simplebezier:_w},I$=[0,0],O$=[15,15],P$={x:0,y:0,zoom:1},$$={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},Jj=k.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:i,nodeTypes:a=A$,edgeTypes:l=M$,onNodeClick:u,onEdgeClick:h,onInit:p,onMove:f,onMoveStart:g,onMoveEnd:v,onConnect:w,onConnectStart:E,onConnectEnd:b,onClickConnectStart:S,onClickConnectEnd:_,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:j,onNodeContextMenu:M,onNodeDoubleClick:P,onNodeDragStart:I,onNodeDrag:F,onNodeDragStop:O,onNodesDelete:A,onEdgesDelete:L,onSelectionChange:H,onSelectionDragStart:X,onSelectionDrag:R,onSelectionDragStop:K,onSelectionContextMenu:G,onSelectionStart:ne,onSelectionEnd:Q,connectionMode:W=Eo.Strict,connectionLineType:ee=Is.Bezier,connectionLineStyle:$,connectionLineComponent:Y,connectionLineContainerStyle:ue,deleteKeyCode:z="Backspace",selectionKeyCode:D="Shift",selectionOnDrag:J=!1,selectionMode:V=vl.Full,panActivationKeyCode:ae="Space",multiSelectionKeyCode:he=Ru()?"Meta":"Control",zoomActivationKeyCode:ye=Ru()?"Meta":"Control",snapToGrid:_e=!1,snapGrid:Ve=O$,onlyRenderVisibleElements:Be=!1,selectNodesOnDrag:qe=!0,nodesDraggable:Se,nodesConnectable:ce,nodesFocusable:be,nodeOrigin:ke=I$,edgesFocusable:Ye,edgesUpdatable:dt,elementsSelectable:lt,defaultViewport:pe=P$,minZoom:me=.5,maxZoom:Me=2,translateExtent:He=Vv,preventScrolling:ct=!0,nodeExtent:je,defaultMarkerColor:Ge="#b1b1b7",zoomOnScroll:Ke=!0,zoomOnPinch:se=!0,panOnScroll:Pe=!1,panOnScrollSpeed:$e=.5,panOnScrollMode:Te=ko.Free,zoomOnDoubleClick:Xe=!0,panOnDrag:jt=!0,onPaneClick:ot,onPaneMouseEnter:Ie,onPaneMouseMove:xt,onPaneMouseLeave:ft,onPaneScroll:gt,onPaneContextMenu:Nn,children:Bn,onEdgeContextMenu:En,onEdgeDoubleClick:Ao,onEdgeMouseEnter:mn,onEdgeMouseMove:Mo,onEdgeMouseLeave:Io,onEdgeUpdate:Bt,onEdgeUpdateStart:Rr,onEdgeUpdateEnd:Un,onReconnect:qs,onReconnectStart:Ar,onReconnectEnd:Oo,reconnectRadius:pr=10,edgeUpdaterRadius:Mr=10,onNodesChange:mr,onEdgesChange:ss,noDragClassName:Po="nodrag",noWheelClassName:$o="nowheel",noPanClassName:Lo="nopan",fitView:Cn=!1,fitViewOptions:qo,connectOnClick:Ir=!0,attributionPosition:Do,proOptions:Wn,defaultEdgeOptions:Fo,elevateNodesOnSelect:Ds=!0,elevateEdgesOnSelect:Fs=!1,disableKeyboardA11y:zo=!1,autoPanOnConnect:Bo=!0,autoPanOnNodeDrag:it=!0,connectionRadius:sa=20,isValidConnection:os,onError:Gt,style:Hn,id:Uo,nodeDragThreshold:is,...bt},sn)=>{const Gn=Uo||"1";return de.createElement("div",{...bt,style:{...Hn,...$$},ref:sn,className:Ht(["react-flow",i]),"data-testid":"rf__wrapper",id:Uo},de.createElement(Zj,null,de.createElement(T$,{onInit:p,onMove:f,onMoveStart:g,onMoveEnd:v,onNodeClick:u,onEdgeClick:h,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:j,onNodeContextMenu:M,onNodeDoubleClick:P,nodeTypes:a,edgeTypes:l,connectionLineType:ee,connectionLineStyle:$,connectionLineComponent:Y,connectionLineContainerStyle:ue,selectionKeyCode:D,selectionOnDrag:J,selectionMode:V,deleteKeyCode:z,multiSelectionKeyCode:he,panActivationKeyCode:ae,zoomActivationKeyCode:ye,onlyRenderVisibleElements:Be,selectNodesOnDrag:qe,defaultViewport:pe,translateExtent:He,minZoom:me,maxZoom:Me,preventScrolling:ct,zoomOnScroll:Ke,zoomOnPinch:se,zoomOnDoubleClick:Xe,panOnScroll:Pe,panOnScrollSpeed:$e,panOnScrollMode:Te,panOnDrag:jt,onPaneClick:ot,onPaneMouseEnter:Ie,onPaneMouseMove:xt,onPaneMouseLeave:ft,onPaneScroll:gt,onPaneContextMenu:Nn,onSelectionContextMenu:G,onSelectionStart:ne,onSelectionEnd:Q,onEdgeContextMenu:En,onEdgeDoubleClick:Ao,onEdgeMouseEnter:mn,onEdgeMouseMove:Mo,onEdgeMouseLeave:Io,onReconnect:qs??Bt,onReconnectStart:Ar??Rr,onReconnectEnd:Oo??Un,reconnectRadius:pr??Mr,defaultMarkerColor:Ge,noDragClassName:Po,noWheelClassName:$o,noPanClassName:Lo,elevateEdgesOnSelect:Fs,rfId:Gn,disableKeyboardA11y:zo,nodeOrigin:ke,nodeExtent:je}),de.createElement(NP,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:w,onConnectStart:E,onConnectEnd:b,onClickConnectStart:S,onClickConnectEnd:_,nodesDraggable:Se,nodesConnectable:ce,nodesFocusable:be,edgesFocusable:Ye,edgesUpdatable:dt,elementsSelectable:lt,elevateNodesOnSelect:Ds,minZoom:me,maxZoom:Me,nodeExtent:je,onNodesChange:mr,onEdgesChange:ss,snapToGrid:_e,snapGrid:Ve,connectionMode:W,translateExtent:He,connectOnClick:Ir,defaultEdgeOptions:Fo,fitView:Cn,fitViewOptions:qo,onNodesDelete:A,onEdgesDelete:L,onNodeDragStart:I,onNodeDrag:F,onNodeDragStop:O,onSelectionDrag:R,onSelectionDragStart:X,onSelectionDragStop:K,noPanClassName:Lo,nodeOrigin:ke,rfId:Gn,autoPanOnConnect:Bo,autoPanOnNodeDrag:it,onError:Gt,connectionRadius:sa,isValidConnection:os,nodeDragThreshold:is}),de.createElement(_P,{onSelectionChange:H}),Bn,de.createElement(QO,{proOptions:Wn,position:Do}),de.createElement(RP,{rfId:Gn,disableKeyboardA11y:zo})))});Jj.displayName="ReactFlow";const L$=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function eT(){return at(L$,Lt)}const tT=({id:e,x:t,y:n,width:s,height:i,style:a,color:l,strokeColor:u,strokeWidth:h,className:p,borderRadius:f,shapeRendering:g,onClick:v,selected:w})=>{const{background:E,backgroundColor:b}=a||{},S=l||E||b;return de.createElement("rect",{className:Ht(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:f,ry:f,width:s,height:i,fill:S,stroke:u,strokeWidth:h,shapeRendering:g,onClick:v?_=>v(_,e):void 0})};tT.displayName="MiniMapNode";var q$=k.memo(tT);const D$=e=>e.nodeOrigin,F$=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),oh=e=>e instanceof Function?e:()=>e;function z$({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:a=q$,onClick:l}){const u=at(F$,Lt),h=at(D$),p=oh(t),f=oh(e),g=oh(n),v=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return de.createElement(de.Fragment,null,u.map(w=>{const{x:E,y:b}=So(w,h).positionAbsolute;return de.createElement(a,{key:w.id,x:E,y:b,width:w.width,height:w.height,style:w.style,selected:w.selected,className:g(w),color:p(w),borderRadius:s,strokeColor:f(w),strokeWidth:i,shapeRendering:v,onClick:l,id:w.id})}))}var B$=k.memo(z$);const U$=200,W$=150,H$=e=>{const t=e.getNodes(),n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:t.length>0?eP(Vu(t,e.nodeOrigin),n):n,rfId:e.rfId}},G$="react-flow__minimap-desc";function nT({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:s="#e2e2e2",nodeClassName:i="",nodeBorderRadius:a=5,nodeStrokeWidth:l=2,nodeComponent:u,maskColor:h="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:f=1,position:g="bottom-right",onClick:v,onNodeClick:w,pannable:E=!1,zoomable:b=!1,ariaLabel:S="React Flow mini map",inversePan:_=!1,zoomStep:N=10,offsetScale:C=5}){const j=Mt(),M=k.useRef(null),{boundingRect:P,viewBB:I,rfId:F}=at(H$,Lt),O=(e==null?void 0:e.width)??U$,A=(e==null?void 0:e.height)??W$,L=P.width/O,H=P.height/A,X=Math.max(L,H),R=X*O,K=X*A,G=C*X,ne=P.x-(R-P.width)/2-G,Q=P.y-(K-P.height)/2-G,W=R+G*2,ee=K+G*2,$=`${G$}-${F}`,Y=k.useRef(0);Y.current=X,k.useEffect(()=>{if(M.current){const D=qn(M.current),J=he=>{const{transform:ye,d3Selection:_e,d3Zoom:Ve}=j.getState();if(he.sourceEvent.type!=="wheel"||!_e||!Ve)return;const Be=-he.sourceEvent.deltaY*(he.sourceEvent.deltaMode===1?.05:he.sourceEvent.deltaMode?1:.002)*N,qe=ye[2]*Math.pow(2,Be);Ve.scaleTo(_e,qe)},V=he=>{const{transform:ye,d3Selection:_e,d3Zoom:Ve,translateExtent:Be,width:qe,height:Se}=j.getState();if(he.sourceEvent.type!=="mousemove"||!_e||!Ve)return;const ce=Y.current*Math.max(1,ye[2])*(_?-1:1),be={x:ye[0]-he.sourceEvent.movementX*ce,y:ye[1]-he.sourceEvent.movementY*ce},ke=[[0,0],[qe,Se]],Ye=Jr.translate(be.x,be.y).scale(ye[2]),dt=Ve.constrain()(Ye,ke,Be);Ve.transform(_e,dt)},ae=uj().on("zoom",E?V:null).on("zoom.wheel",b?J:null);return D.call(ae),()=>{D.on("zoom",null)}}},[E,b,_,N]);const ue=v?D=>{const J=ir(D);v(D,{x:J[0],y:J[1]})}:void 0,z=w?(D,J)=>{const V=j.getState().nodeInternals.get(J);w(D,V)}:void 0;return de.createElement(xw,{position:g,style:e,className:Ht(["react-flow__minimap",t]),"data-testid":"rf__minimap"},de.createElement("svg",{width:O,height:A,viewBox:`${ne} ${Q} ${W} ${ee}`,role:"img","aria-labelledby":$,ref:M,onClick:ue},S&&de.createElement("title",{id:$},S),de.createElement(B$,{onClick:z,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:l,nodeComponent:u}),de.createElement("path",{className:"react-flow__minimap-mask",d:`M${ne-G},${Q-G}h${W+G*2}v${ee+G*2}h${-W-G*2}z
|
|
57
|
+
M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fill:h,fillRule:"evenodd",stroke:p,strokeWidth:f,pointerEvents:"none"})))}nT.displayName="MiniMap";var V$=k.memo(nT);function Y$(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},de.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function K$(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},de.createElement("path",{d:"M0 0h32v4.2H0z"}))}function X$(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},de.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 Q$(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},de.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 Z$(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},de.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 Er=({children:e,className:t,...n})=>de.createElement("button",{type:"button",className:Ht(["react-flow__controls-button",t]),...n},e);Er.displayName="ControlButton";const J$=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),rT=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:l,onFitView:u,onInteractiveChange:h,className:p,children:f,position:g="bottom-left"})=>{const v=Mt(),[w,E]=k.useState(!1),{isInteractive:b,minZoomReached:S,maxZoomReached:_}=at(J$,Lt),{zoomIn:N,zoomOut:C,fitView:j}=Tl();if(k.useEffect(()=>{E(!0)},[]),!w)return null;const M=()=>{N(),a==null||a()},P=()=>{C(),l==null||l()},I=()=>{j(i),u==null||u()},F=()=>{v.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),h==null||h(!b)};return de.createElement(xw,{className:Ht(["react-flow__controls",p]),position:g,style:e,"data-testid":"rf__controls"},t&&de.createElement(de.Fragment,null,de.createElement(Er,{onClick:M,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:_},de.createElement(Y$,null)),de.createElement(Er,{onClick:P,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},de.createElement(K$,null))),n&&de.createElement(Er,{className:"react-flow__controls-fitview",onClick:I,title:"fit view","aria-label":"fit view"},de.createElement(X$,null)),s&&de.createElement(Er,{className:"react-flow__controls-interactive",onClick:F,title:"toggle interactivity","aria-label":"toggle interactivity"},b?de.createElement(Z$,null):de.createElement(Q$,null)),f)};rT.displayName="Controls";var eL=k.memo(rT),ur;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ur||(ur={}));function tL({color:e,dimensions:t,lineWidth:n}){return de.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function nL({color:e,radius:t}){return de.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const rL={[ur.Dots]:"#91919a",[ur.Lines]:"#eee",[ur.Cross]:"#e2e2e2"},sL={[ur.Dots]:1,[ur.Lines]:1,[ur.Cross]:6},oL=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function sT({id:e,variant:t=ur.Dots,gap:n=20,size:s,lineWidth:i=1,offset:a=2,color:l,style:u,className:h}){const p=k.useRef(null),{transform:f,patternId:g}=at(oL,Lt),v=l||rL[t],w=s||sL[t],E=t===ur.Dots,b=t===ur.Cross,S=Array.isArray(n)?n:[n,n],_=[S[0]*f[2]||1,S[1]*f[2]||1],N=w*f[2],C=b?[N,N]:_,j=E?[N/a,N/a]:[C[0]/a,C[1]/a];return de.createElement("svg",{className:Ht(["react-flow__background",h]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},de.createElement("pattern",{id:g+e,x:f[0]%_[0],y:f[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`},E?de.createElement(nL,{color:v,radius:N/a}):de.createElement(tL,{dimensions:C,color:v,lineWidth:i})),de.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${g+e})`}))}sT.displayName="Background";var iL=k.memo(sT);const aL=["us-gov","global","apac","us","eu","jp","au"],lL=new RegExp(`^(?:(?:${aL.join("|")})\\.)?anthropic\\.`,"i");function Rl(e){return e.replace(lL,"")}const cL=["command","cmd","file_path","path","url","pattern","notebook_path"],Qb=120,ih=e=>e.length>Qb?`${e.slice(0,Qb-1)}…`:e;function uL(e){if(typeof e=="string")return e.trim()?ih(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of cL){const s=t[n];if(typeof s=="string"&&s.trim())return ih(s.trim());if(Array.isArray(s)&&s.length>0&&s.every(i=>typeof i=="string")){const i=s.join(" ").trim();if(i)return ih(i)}}return null}function oT(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function Aw(e){const t=e.cache_creation,n=t&&typeof t=="object"?t:e,s=n.ephemeral_1h_input_tokens,i=n.ephemeral_5m_input_tokens;return typeof s!="number"&&typeof i!="number"?{}:{cacheCreate1hTokens:Number(s??0),cacheCreate5mTokens:Number(i??0)}}function dL(e){const t=Aw(e),n={inputTokens:Number(e.input_tokens??0),outputTokens:Number(e.output_tokens??0),cacheReadTokens:Number(e.cache_read_input_tokens??e.cached_input_tokens??0),cacheCreateTokens:Number(e.cache_creation_input_tokens??e.cache_write_input_tokens??0),cacheCreate1hTokens:t.cacheCreate1hTokens,cacheCreate5mTokens:t.cacheCreate5mTokens};return typeof e.reasoning_output_tokens=="number"&&(n.reasoningOutputTokens=Number(e.reasoning_output_tokens)),n}function fL(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,s]of Object.entries(e))!n||!s||typeof s!="object"||(t[n]=dL(s));return Object.keys(t).length?t:void 0}function iT(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.input_tokens=="number"||typeof n.output_tokens=="number"||typeof n.cache_read_input_tokens=="number"||typeof n.cache_creation_input_tokens=="number")return{inputTokens:Number(n.input_tokens??0),outputTokens:Number(n.output_tokens??0),cacheReadTokens:Number(n.cache_read_input_tokens??0),cacheCreateTokens:Number(n.cache_creation_input_tokens??0),...Aw(n)};for(const s of Object.values(n)){const i=iT(s,t+1);if(i)return i}return null}const hL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function aT(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&hL.test(Rl(n.model)))return n.model;for(const s of Object.values(n)){const i=aT(s,t+1);if(i)return i}return null}function Yv(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function Ps(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function Zb(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Al(e,t){return`${e}::${t}`}function Iu(e){return e.agent_type??e.subagent_type??"subagent"}function ul(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function Pi(e,t,n,s){const i=t;let a=e.agents.get(i);return a||(a={id:i,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:s,usage:oT()},e.agents.set(i,a),a)}function lT(e,t,n,s){const i=Al(t,n),a=e.agents.get(i);if(!a)return null;!a.cwd&&s.cwd&&(a.cwd=s.cwd,a.cwdBasename=Ps(s.cwd));const l=Iu(s);return l&&(a.label==="subagent"||!a.label)&&(a.label=l),a}function pL(e,t,n){const s=t.session_id??"unknown",i=ul(t);if(i){const h=lT(e,s,i,t);if(h)return h}const a=e.activeSubagentStack.get(s),l=a&&a.length>0?a[a.length-1]:null;if(l){const h=e.agents.get(Al(s,l));if(h)return!h.cwd&&t.cwd&&(h.cwd=t.cwd,h.cwdBasename=Ps(t.cwd)),h}const u=Pi(e,s,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=Ps(t.cwd)),u.label==="session"&&t.cwd&&(u.label=Ps(t.cwd)??"session"),u}function mL(e,t,n,s,i){const a=Al(t,n),l=Pi(e,t,i,!0);let u=e.agents.get(a);if(u){!u.cwd&&s.cwd&&(u.cwd=s.cwd,u.cwdBasename=Ps(s.cwd));const h=Iu(s);return h&&(u.label==="subagent"||!u.label)&&(u.label=h),u}return u={id:a,sessionId:t,label:Iu(s),kind:"subagent",parentId:l.id,state:"active",startedAt:i,tools:[],prompts:[],cwd:s.cwd,cwdBasename:Ps(s.cwd),toolCount:0,childCount:0,usage:oT()},e.agents.set(a,u),l.childCount+=1,u}function gL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function yL(e,t,n){const s=e.activeSubagentStack.get(t);if(s){for(let i=s.length-1;i>=0;i--)if(s[i]===n){s.splice(i,1);break}s.length===0&&e.activeSubagentStack.delete(t)}}function au(e,t=80){if(e==null)return"";if(typeof e=="string")return e.length>t?e.slice(0,t-1)+"…":e;try{const n=JSON.stringify(e);return n.length>t?n.slice(0,t-1)+"…":n}catch{return String(e)}}const Jb=200,vL=25;function wL(e,t){const n=t.tools;if(n.length>Jb){const s=n.splice(0,n.length-Jb);for(const i of s)e.toolIndex.get(i.id)===i&&(e.toolIndex.delete(i.id),e.toolOwner.delete(i.id))}for(let s=n.length-vL-1;s>=0;s--){const i=n[s];if(i.trimmed)break;i.input=void 0,i.response=void 0,i.trimmed=!0}}function xL(e,t,n){const s=e.toolIndex.get(n);if(s)return s;for(let i=t.tools.length-1;i>=0;i--)if(t.tools[i].id===n)return t.tools[i];return null}const e1=2e3;function bL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const i=e.prompts[s];if(i.at<t-e1)return!1;if(i.text===n&&i.at<=t+e1)return!0}return!1}function cT(e,t){for(const n of t.tools)e.toolIndex.get(n.id)===n&&e.toolIndex.delete(n.id),e.toolOwner.get(n.id)===t.id&&e.toolOwner.delete(n.id)}function Ml(e,t){return t&&(e.revision+=1),t}function kL(e,t,n,s){if(e.agents.size<=n)return!1;const i=p=>p.state==="done"&&p.endedAt!=null&&t-p.endedAt>s,a=[],l=new Map;for(const[p,f]of e.agents){if(f.parentId!=null){const g=l.get(f.parentId);g?g.push(p):l.set(f.parentId,[p])}i(f)&&a.push({id:p,endedAt:f.endedAt})}if(a.length===0)return!1;a.sort((p,f)=>p.endedAt-f.endedAt);let u=0;const h=p=>{const f=e.agents.get(p);f&&(cT(e,f),e.agents.delete(p),u++)};for(const p of a){if(e.agents.size<=n)break;if(!e.agents.has(p.id))continue;const f=(l.get(p.id)??[]).map(g=>e.agents.get(g)).filter(g=>g!=null);if(!f.some(g=>!i(g))){for(const g of f)h(g.id);h(p.id)}}return Ml(e,u>0)}function _L(e,t,n,s){const i=new Map;for(const[p,f]of e.agents){let g=i.get(f.sessionId);g||(g={ids:[],endedAt:0,live:!1,closed:!1},i.set(f.sessionId,g)),g.ids.push(p),f.kind==="root"&&f.closedAt!=null&&(g.closed=!0),f.state==="done"&&f.endedAt!=null?g.endedAt=Math.max(g.endedAt,f.endedAt):g.live=!0}const a=[...i.values()].filter(p=>!p.live&&p.endedAt>0&&t-p.endedAt>s).sort((p,f)=>p.closed===f.closed?p.endedAt-f.endedAt:p.closed?-1:1);let u=[...i.values()].filter(p=>!p.live).length-n;if(u<=0)return!1;let h=!1;for(const p of a){if(u<=0)break;for(const f of p.ids){const g=e.agents.get(f);g&&cT(e,g),e.agents.delete(f)}u--,h=!0}return Ml(e,h)}function SL(e,t){const n=t==null?void 0:t.payload,s=n==null?void 0:n.hook_event_name;if(s!=="PostToolUse"&&s!=="PostToolUseFailure")return!1;const i=n==null?void 0:n.tool_use_id;return typeof i=="string"&&i.length>0&&e.toolIndex.has(i)}function NL(e){let t=!1;for(const n of e.agents.values())for(const s of n.tools)s.endedAt!=null||s.outcomeGap||(s.outcomeGap=!0,t=!0);return Ml(e,t)}function EL(e,t,n){let s=!1;for(const i of e.agents.values()){if(i.provider==="codex")continue;const a=e.agents.get(i.sessionId),l=(a==null?void 0:a.lastEventAt)??(a==null?void 0:a.startedAt);for(const u of i.tools){const h=Math.max(u.startedAt,l??u.startedAt);u.endedAt==null&&t-h>n&&(u.endedAt=h,u.ok=!1,u.errorPreview=u.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(u.id),e.toolOwner.delete(u.id),s=!0)}}return Ml(e,s)}const t1=90*6e4;function CL(e,t,n){let s=!1;for(const i of e.agents.values()){if(i.kind!=="root")continue;const a=i.lastEventAt??i.startedAt;if(!(t-a<=n)){i.waiting&&(i.waiting=null,s=!0),i.closedAt==null&&(i.closedAt=a),i.state==="active"&&(i.state="done",i.endedAt=a,i.reaped=!0,s=!0);for(const l of e.agents.values())l.sessionId!==i.sessionId||l.kind==="root"||l.state!=="active"||(l.state="done",l.endedAt=a,s=!0);e.activeSubagentStack.delete(i.sessionId)}}return Ml(e,s)}function jL(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const TL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed"]);function RL(e,t){let n=null;for(const s of e.toolIndex.values()){const i=s.agentId?e.agents.get(s.agentId):void 0;!i||i.sessionId!==t||(!n||s.startedAt>n.startedAt)&&(n=s)}return n}const AL=3e4;function ML(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>AL)&&!(e.startedAt>t))return{name:e.name,preview:uL(e.input)??""}}function IL(e,t,n,s,i){if(n!=="permission")return{kind:n,message:s,since:i};const a=RL(e,t),l={kind:n,message:s,since:i};a!=null&&a.explicitSubagentId&&(l.subagentId=a.explicitSubagentId);const u=ML(a,i);return u&&(l.tool=u),l}function OL(e,t,n){if(e.kind==="idle")return!0;const s=ul(t);return s==null?!0:e.subagentId!=null&&Al(n,s)===e.subagentId}function n1(e,t){const n=t.epoch??null;if(n!==null&&n!==e.seqEpoch)e.seqEpoch=n,e.lastSeq=0;else if(t.seq<=e.lastSeq)return e;const s=t.payload??{},i=t.receivedAt,a=s.hook_event_name??"Unknown";if(a==="__clear")return{...Yv(),lastSeq:t.seq,seqEpoch:e.seqEpoch,revision:e.revision+1};e.totalEvents+=1,e.lastSeq=t.seq,e.revision+=1;const l=s.session_id??"unknown";if(!TL.has(a)){const f=e.agents.get(l);f!=null&&f.waiting&&OL(f.waiting,s,l)&&(f.waiting=null)}const u=e.agents.get(l);if(u&&i>(u.lastEventAt??0)&&(u.lastEventAt=i,u.reaped&&(u.reaped=!1,u.state="active",u.endedAt=void 0,u.closedAt=void 0)),typeof s.model_context_window=="number"&&s.model_context_window>0){const f=e.agents.get(l);f&&(f.contextWindow=s.model_context_window)}if(typeof s.approval_policy=="string"&&s.approval_policy){const f=e.agents.get(l);f&&(f.approvalPolicy=s.approval_policy)}if(typeof s.context_tokens=="number"&&s.context_tokens>=0){const f=e.agents.get(l);f&&(f.context={...f.context??Zb(),currentContextTokens:s.context_tokens})}if(a==="ModelObserved"){const f=typeof s.model=="string"?s.model:null;if(f){const v=e.agents.get(l);v&&(v.model=f)}const g=s.subagentModels;if(g&&typeof g=="object")for(const[v,w]of Object.entries(g)){if(typeof w!="string")continue;const E=`${l}::${v}`,b=e.agents.get(E);b&&(b.model=w)}return e}if(a==="ContextObserved"){const f=s.context??null;if(f){const g=e.agents.get(l);if(g){const v=g.context??Zb(),w=(b,S)=>typeof f[b]=="number"?f[b]:S,E=Array.isArray(f.memoryFiles)?f.memoryFiles:Array.isArray(f.claudeMdFiles)?f.claudeMdFiles:null;g.context={msgsUser:w("msgsUser",v.msgsUser),msgsAssistant:w("msgsAssistant",v.msgsAssistant),toolUses:w("toolUses",v.toolUses),toolResults:w("toolResults",v.toolResults),systemReminders:w("systemReminders",v.systemReminders),currentContextTokens:w("currentContextTokens",v.currentContextTokens),memoryFiles:E??v.memoryFiles}}}return e}if(a==="SessionNamed"){const f=e.agents.get(l);if(f){const g=typeof s.sessionName=="string"?s.sessionName.trim():"",v=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";g&&(f.sessionName=g),v&&(f.sessionTitle=v);const w=f.sessionName??"";f.sessionTitle&&w&&f.sessionTitle.toLowerCase()===w.toLowerCase()&&(f.sessionTitle=void 0)}return e}if(a==="UsageObserved"){const f=s.usage??null;if(f){const g=e.agents.get(l);if(g){g.usage.inputTokens=Number(f.input_tokens??0),g.usage.outputTokens=Number(f.output_tokens??0),g.usage.cacheReadTokens=Number(f.cache_read_input_tokens??f.cached_input_tokens??0),g.usage.cacheCreateTokens=Number(f.cache_creation_input_tokens??f.cache_write_input_tokens??0);const v=Aw(f);g.usage.cacheCreate1hTokens=v.cacheCreate1hTokens,g.usage.cacheCreate5mTokens=v.cacheCreate5mTokens,typeof f.reasoning_output_tokens=="number"&&(g.usage.reasoningOutputTokens=Number(f.reasoning_output_tokens)),g.usageByModel=fL(s.usageByModel)}}return e}const h=pL(e,s,i);h.provider||(h.provider=s.provider==="codex"?"codex":"claude");const p=aT(s);switch(p&&(h.model=p),a){case"SessionStart":{const f=Pi(e,l,i,!1);f.synthetic=!1,f.state="active",f.closedAt=void 0,f.startedAt=f.startedAt||i,!f.cwd&&s.cwd&&(f.cwd=s.cwd,f.cwdBasename=Ps(s.cwd)),f.label==="session"&&s.cwd&&(f.label=Ps(s.cwd)??"session");break}case"UserPromptSubmit":{for(const v of e.agents.values())v.sessionId===l&&v.kind==="subagent"&&v.state==="done"&&v.exitAt==null&&v.endedAt!=null&&v.endedAt<i&&(v.exitAt=i);const f=Pi(e,l,i,!1);f.state="active",f.endedAt=void 0,f.closedAt=void 0,f.exitAt=void 0;const g=(typeof s.prompt=="string"?s.prompt:typeof s.message=="string"?s.message:"")??"";g&&!bL(f,i,g)&&(f.prompts.push({at:i,text:g}),f.firstPrompt||(f.firstPrompt=au(g,120)));break}case"PreToolUse":{const f=s.tool_use_id?xL(e,h,s.tool_use_id):null;if(f){s.tool_name&&f.name==="?"&&(f.name=s.tool_name),f.endedAt==null&&!f.trimmed&&s.tool_input!==void 0&&(f.input=s.tool_input,f.inputPreview=au(s.tool_input));break}const g=s.tool_use_id??`${h.id}:${h.toolCount}`,v=ul(s),w={id:g,name:s.tool_name??"?",input:s.tool_input,inputPreview:au(s.tool_input),agentId:h.id,explicitSubagentId:v?Al(l,v):void 0,startedAt:i};h.tools.push(w),h.toolCount+=1,h.state="active",e.toolIndex.set(g,w),e.toolOwner.set(g,h.id),wL(e,h);break}case"PostToolUse":case"PostToolUseFailure":{const f=s.tool_use_id;if(!f)break;let g=e.toolIndex.get(f),v=!1;if(!g)for(const E of e.agents.values()){const b=E.tools.find(S=>S.id===f);if(b){g=b,v=!0;break}}if(!g||g.outcomeApplied)break;g.outcomeApplied=!0,g.outcomeGap=void 0,g.endedAt=i,g.ok=a==="PostToolUse",g.trimmed||(g.response=s.tool_response),a==="PostToolUseFailure"?g.errorPreview=au(s.tool_response):v&&(g.errorPreview=void 0);const w=iT(s.tool_response);w&&(g.usage=w),e.toolIndex.delete(f),e.toolOwner.delete(f);break}case"SubagentStart":{const f=ul(s);if(!f)break;const g=mL(e,l,f,s,i);g.state="active",g.startedAt=g.startedAt||i,g.exitAt=void 0,g.endedAt=void 0;const v=Iu(s);v&&(g.label=v),gL(e,l,f);break}case"SubagentStop":{const f=ul(s);if(!f)break;const g=lT(e,l,f,s);if(!g)break;g.state="done",g.endedAt=i,yL(e,l,f);break}case"Stop":case"SessionEnd":{const f=Pi(e,l,i,!1);f.state="done",f.endedAt=i,a==="SessionEnd"&&(f.closedAt=i),e.activeSubagentStack.delete(l);break}case"Notification":{const f=jL(s.notification_type);if(!f)break;const g=Pi(e,l,i,!1),v=typeof s.message=="string"?s.message:"",w=g.waiting;g.waiting=w&&w.kind===f&&w.message===v?{...w,since:Math.min(w.since,i)}:IL(e,l,f,v,i);break}}return e}function Mw(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return Math.abs(t)%360}const PL={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},$L=[{match:/^claude[-_](fable|mythos)[-_]5[-_.]1\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:10,output:50,cacheRead:.25,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_](fable|mythos)[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_]opus[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]sonnet[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:PL},{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 LL(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function Qi(e,t=Date.now()){if(!e)return null;const n=Rl(e);for(const s of $L)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function uT(e,t){const n=Math.max(0,e.cacheCreate1hTokens??0),s=Math.max(0,e.cacheCreate5mTokens??0),i=Math.max(0,e.cacheCreateTokens-n-s),a=s+i,l=t.cacheWrite1h??t.cacheWrite;return{tokens5m:a,tokens1h:n,usd5m:a*t.cacheWrite/1e6,usd1h:n*l/1e6}}function dT(e,t,n=Date.now()){if(!LL(t))return e.inputTokens;const s=Qi(t,n),i=((s==null?void 0:s.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-i)}function Iw(e,t,n=Date.now()){const s=Qi(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const i=dT(e,t,n)*s.input/1e6,a=e.outputTokens*s.output/1e6,l=e.cacheReadTokens*s.cacheRead/1e6,u=uT(e,s),h=u.usd5m+u.usd1h;return{input:i,output:a,cacheRead:l,cacheWrite:h,total:i+a+l+h}}const r1=2e5,qL=1e6,DL=[/\[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],FL=[{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 zL(e){if(!e)return r1;const t=Rl(e);for(const n of DL)if(n.test(t))return qL;for(const n of FL)if(n.match.test(t))return n.window;return r1}function fT(e,t){return typeof e=="number"&&e>0?e:zL(t)}const Ii="not priced";function tt(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 Ow(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${tt(s)}/min`:`${tt(n*3600)}/hr`}function BL(e,t){const n={inputTokens:e.inputTokens+t.inputTokens,outputTokens:e.outputTokens+t.outputTokens,cacheReadTokens:e.cacheReadTokens+t.cacheReadTokens,cacheCreateTokens:e.cacheCreateTokens+t.cacheCreateTokens};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0||t.cacheCreate1hTokens!==void 0||t.cacheCreate5mTokens!==void 0)&&(n.cacheCreate1hTokens=(e.cacheCreate1hTokens??0)+(t.cacheCreate1hTokens??0),n.cacheCreate5mTokens=(e.cacheCreate5mTokens??0)+(t.cacheCreate5mTokens??0)),(e.reasoningOutputTokens!==void 0||t.reasoningOutputTokens!==void 0)&&(n.reasoningOutputTokens=(e.reasoningOutputTokens??0)+(t.reasoningOutputTokens??0)),n}function UL(e,t){let n=0,s=0,i=0,a=0,l=0,u=0;for(const g of t)n+=g.inputTokens,s+=g.outputTokens,i+=g.cacheReadTokens,a+=g.cacheCreateTokens,l+=g.cacheCreate1hTokens??0,u+=g.cacheCreate5mTokens??0;const h=(g,v)=>Math.max(0,g-v),p={inputTokens:h(e.inputTokens,n),outputTokens:h(e.outputTokens,s),cacheReadTokens:h(e.cacheReadTokens,i),cacheCreateTokens:h(e.cacheCreateTokens,a)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=h(e.cacheCreate1hTokens??0,l),p.cacheCreate5mTokens=h(e.cacheCreate5mTokens??0,u)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function Il(e){const t=e.usageByModel,n=t?Object.keys(t):[];if(!t||n.length===0)return[{model:e.model,usage:e.usage}];const s=n.map(a=>({model:a,usage:t[a]})),i=UL(e.usage,s.map(a=>a.usage));if(i){const a=s.findIndex(l=>l.model===e.model);a>=0?s[a]={model:s[a].model,usage:BL(s[a].usage,i)}:s.push({model:e.model,usage:i})}return s}function kn(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const s of Il(e)){const i=Iw(s.usage,s.model,t);n.input+=i.input,n.output+=i.output,n.cacheRead+=i.cacheRead,n.cacheWrite+=i.cacheWrite,n.total+=i.total}return n}function Kv(e,t=Date.now()){let n=0;for(const s of Il(e))Qi(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function hT(e){const t=[];for(const n of Il(e)){if(!n.model||t.includes(n.model))continue;const s=n.usage;s.inputTokens+s.outputTokens+s.cacheReadTokens+s.cacheCreateTokens<=0||t.push(n.model)}return t}function pT(e){return hT(e).filter(t=>t!==e.model)}const WL=new Set(["untrusted","on-request","on-failure"]);function HL(e){return typeof e!="string"||!e?null:WL.has(e)?!0:e==="never"?!1:null}function GL(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=HL(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
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 s1(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function
|
|
60
|
-
Likely on: ${n}`:t}function XL(e,t,n,s=!0){if(!s)return[];if(n)return[];const i=[];for(const a of e){if(!Ol(a.waiting))continue;const l=Ku(a.id,a.waiting);t.has(l)||i.push({key:l,title:a.label,body:KL(a.waiting),sessionId:a.id})}return i}function QL(e,t,n){const s=new Set;for(const a of e)s.add(Ku(a.id,a.waiting));const i=new Set;for(const a of n)s.has(a)&&i.add(a);for(const a of t)i.add(a.key);return i}function o1(e){return new Set(e.map(t=>Ku(t.id,t.waiting)))}function ZL(e,t){return e!==t}function JL(e,t){return t&&e==="default"}function At(e){return
|
|
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 s1(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function $s(e){const t=Rl(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const i=s1(n[1]),a=n[2].replace(/[-_]/g,".");return`${i} ${a}`}const s=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(s){const i=s[1].replace(/[-_]/g,"."),a=s[2].split(/[-_]/).filter(Boolean).map(s1);return[`GPT-${i}`,...a].join(" ")}return e}function Yu(e){const t=Rl(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function Ol(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function VL(e){const t=[];for(const n of e)n.kind==="root"&&Ol(n.waiting)&&t.push({id:n.id,label:n.label,waiting:n.waiting});return t.sort((n,s)=>n.waiting.since-s.waiting.since)}function YL(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function Ku(e,t){return`${e}@${t.since}`}function mT(e,t){if(!e.tool)return null;const{name:n,preview:s}=e.tool,i=new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i").test(t);return s?i?s:`${n} · ${s}`:i?null:n}function KL(e){const t=e.message||"Needs your permission",n=mT(e,t);return n?`${t}
|
|
60
|
+
Likely on: ${n}`:t}function XL(e,t,n,s=!0){if(!s)return[];if(n)return[];const i=[];for(const a of e){if(!Ol(a.waiting))continue;const l=Ku(a.id,a.waiting);t.has(l)||i.push({key:l,title:a.label,body:KL(a.waiting),sessionId:a.id})}return i}function QL(e,t,n){const s=new Set;for(const a of e)s.add(Ku(a.id,a.waiting));const i=new Set;for(const a of n)s.has(a)&&i.add(a);for(const a of t)i.add(a.key);return i}function o1(e){return new Set(e.map(t=>Ku(t.id,t.waiting)))}function ZL(e,t){return e!==t}function JL(e,t){return t&&e==="default"}function At(e){const t=Math.round(e);return t<1e3?`${t}`:t<1e6?`${(t/1e3).toFixed(1)}k`:t<1e9?`${(t/1e6).toFixed(2)}M`:`${(t/1e9).toFixed(2)}B`}function Ou(e,t,n){const s=(t??n)-e;if(s<1e3)return`${Math.max(0,s)}ms`;const i=Math.floor(s/1e3);if(i<60)return`${i}s`;const a=Math.floor(i/60),l=i%60;return`${a}m ${String(l).padStart(2,"0")}s`}function gT(e,t){if(e.endedAt==null)return t;const n=e.endedAt-e.startedAt;return n<1e3?`${n}ms`:`${(n/1e3).toFixed(2)}s`}function yT(e,t){const n=typeof e=="string"?e.trim():"",s=typeof t=="string"?t.trim():"";return{face:n||s||void 0,tooltip:s||n||void 0}}const e3=1,vT=-1;function t3(){const e=[];let t=0;function n(){let s;for(const i of e)(!s||i.layer>s.layer||i.layer===s.layer&&i.seq>s.seq)&&(s=i);return s}return{push(s,i=0){const a={dismiss:s,layer:i,seq:t++};return e.push(a),()=>{const l=e.indexOf(a);l!==-1&&e.splice(l,1)}},dismissTop(){const s=n();return s?(s.dismiss(),!0):!1},isTop(s){const i=n();return i!=null&&i.dismiss===s},depth(){return e.length},topIsPanel(){const s=n();return s!=null&&s.layer===vT}}}const Fi=t3();function n3(e){return e.overlayOpen&&!e.panelOnTop?"dismiss":e.typing?"blur":e.overlayOpen?"dismiss":"clear-selection"}function i1(e){return String(e.tagName??"").toUpperCase()==="BODY"}function r3(e,t){return!e||!e.isConnected||i1(e)?!1:t==null||i1(t)}const a1="a[href], button, input, select, textarea, [tabindex]";function s3(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function o3(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function i3({count:e,index:t,shiftKey:n}){return e<=0?{kind:"hold"}:t<0||t>=e?{kind:"focus",index:n?e-1:0}:!n&&t===e-1?{kind:"focus",index:0}:n&&t===0?{kind:"focus",index:e-1}:{kind:"allow"}}function Pw(e){return e.ctrlKey||e.metaKey||e.altKey}const a3=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),l3=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),c3=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function wT(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function $w(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=wT(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!a3.has(String(e.type??"text").toLowerCase())}function u3(e){if(!e)return!1;if($w(e)||l3.has(wT(e)))return!0;const t=typeof e.role=="string"?e.role.trim().toLowerCase():"";return t!==""&&t.split(/\s+/).some(n=>c3.has(n))}function d3({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function xT(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(a1))return s3({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&o3({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(a1)!=null})}):[]}function f3(e,t){const n=xT(e);if(!t||!e.contains(t)||n.includes(t))return n;const s=n.findIndex(i=>(t.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return s===-1?[...n,t]:[...n.slice(0,s),t,...n.slice(s)]}function Sn(e,t={}){const{focusRef:n,layer:s}=t,i=k.useRef(null),a=k.useRef(e);a.current=e;const l=k.useRef(null);l.current===null&&(l.current=()=>a.current());const u=l.current;return k.useEffect(()=>Fi.push(u,s),[u,s]),k.useEffect(()=>{var p;const h=document.activeElement;return(p=(n==null?void 0:n.current)??xT(i.current)[0])==null||p.focus(),()=>{r3(h,document.activeElement)&&h.focus()}},[]),k.useEffect(()=>{const h=p=>{var b;if(p.key!=="Tab"||Pw(p))return;const f=i.current;if(!f)return;const g=document.activeElement;if(!(g!=null&&f.contains(g))&&!Fi.isTop(u))return;const w=f3(f,g),E=i3({count:w.length,index:g?w.indexOf(g):-1,shiftKey:p.shiftKey});E.kind!=="allow"&&(p.preventDefault(),E.kind==="focus"&&((b=w[E.index])==null||b.focus()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[u]),i}function h3(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 Ln(e){return e.toLocaleString()}function p3(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const m3=60;function g3(e,t=m3){if(e.length<=t)return e;const n=e.slice(e.length-(t-1)),s=n.search(/[/\\]/);return"…"+(s===-1?n:n.slice(s))}function y3({agent:e,onClose:t}){var v;const n=k.useRef(null),s=Sn(t,{focusRef:n}),i=e.context,a=e.usage,l=(i==null?void 0:i.currentContextTokens)??0,u=fT(e.contextWindow,e.model),h=Math.min(100,l/u*100),p=kn(e),f=a.inputTokens+a.cacheReadTokens+a.cacheCreateTokens,g=h3(e.provider);return d.jsx("div",{className:"ctx-modal-backdrop",onClick:t,role:"presentation",children:d.jsxs("div",{ref:s,className:"ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[d.jsxs("header",{className:"ctx-modal-head",children:[d.jsxs("div",{children:[d.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),d.jsx("div",{className:"ctx-modal-sub",children:g.subtitle})]}),d.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),d.jsxs("section",{className:"ctx-window-row",children:[d.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(h),children:d.jsx("div",{className:"ctx-window-fill",style:{width:`${h}%`}})}),d.jsxs("div",{className:"ctx-window-meta",children:[d.jsxs("span",{className:"ctx-window-pct",children:[h.toFixed(1),"%"]}),d.jsxs("span",{children:[Ln(l)," / ",Ln(u)," tok (",g.windowScope,")"]})]})]}),d.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),d.jsxs("div",{className:"ctx-grid",children:[d.jsx(or,{label:"input tokens",val:Ln(a.inputTokens)}),d.jsx(or,{label:"output tokens",val:Ln(a.outputTokens)}),d.jsx(or,{label:"cache reads",val:Ln(a.cacheReadTokens)}),d.jsx(or,{label:"cache writes",val:Ln(a.cacheCreateTokens)}),d.jsx(or,{label:"cumulative total",val:Ln(f)}),d.jsx(or,{label:"estimated cost",val:tt(p.total),accent:!0})]}),d.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),g.compositionCounted?d.jsxs("div",{className:"ctx-grid",children:[d.jsx(or,{label:"user messages",val:Ln((i==null?void 0:i.msgsUser)??0)}),d.jsx(or,{label:"assistant messages",val:Ln((i==null?void 0:i.msgsAssistant)??0)}),d.jsx(or,{label:"tool uses",val:Ln((i==null?void 0:i.toolUses)??0)}),d.jsx(or,{label:"tool results",val:Ln((i==null?void 0:i.toolResults)??0)}),d.jsx(or,{label:"system-reminders",val:Ln((i==null?void 0:i.systemReminders)??0)})]}):d.jsx("div",{className:"ctx-empty",children:g.compositionUncounted}),d.jsx("h3",{className:"ctx-section-title",children:g.memoryHeading}),(((v=i==null?void 0:i.memoryFiles)==null?void 0:v.length)??0)===0?d.jsx("div",{className:"ctx-empty",children:g.memoryEmpty}):d.jsx("ul",{className:"ctx-md-list",children:i.memoryFiles.map(w=>d.jsxs("li",{children:[d.jsx("span",{className:"ctx-md-path",title:w.path,children:g3(w.path)}),d.jsx("span",{className:"ctx-md-size",children:p3(w.bytes)})]},w.path))})]})})}function or({label:e,val:t,accent:n}){return d.jsxs("div",{className:`ctx-row${n?" accent":""}`,children:[d.jsx("span",{className:"ctx-row-label",children:e}),d.jsx("span",{className:"ctx-row-val",children:t})]})}function v3({currentContextTokens:e,modelId:t,contextWindow:n,size:s=26,onClick:i}){const a=fT(n,t),l=Math.min(1,e/a),u=s/2-3,h=s/2,p=2*Math.PI*u,f=p*l,g=l>.9?"var(--err)":l>.7?"var(--inflight)":"var(--accent)";return d.jsx("button",{type:"button",className:"ctx-donut",onClick:i,title:`context: ${e.toLocaleString()} / ${a.toLocaleString()} (${(l*100).toFixed(1)}%)`,"aria-label":"Show context breakdown",children:d.jsxs("svg",{width:s,height:s,viewBox:`0 0 ${s} ${s}`,children:[d.jsx("circle",{cx:h,cy:h,r:u,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),d.jsx("circle",{cx:h,cy:h,r:u,stroke:g,strokeWidth:"2.5",fill:"none",strokeDasharray:`${f} ${p-f}`,strokeDashoffset:p/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),d.jsx("text",{x:h,y:h+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(l*100)})]})})}function l1(e,t){const n=Qi(t);if(!n)return`model: ${t}
|
|
61
61
|
no published rate in this build — the tokens are counted, the dollars are not`;const s=f=>f.toLocaleString(),i=f=>`$${f}/MTok`,a=Iw(e,t),l=uT(e,n),u=l.tokens1h>0?[`cache w5m${s(l.tokens5m).padStart(14)} × ${i(n.cacheWrite).padEnd(11)} = ${tt(l.usd5m)}`,`cache w1h${s(l.tokens1h).padStart(14)} × ${i(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${tt(l.usd1h)}`]:[`cache w ${s(l.tokens5m).padStart(14)} × ${i(n.cacheWrite).padEnd(11)} = ${tt(l.usd5m)}`],h=dT(e,t),p=h===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${s(h).padStart(14)} × ${i(n.input).padEnd(11)} = ${tt(a.input)}`,`output ${s(e.outputTokens).padStart(14)} × ${i(n.output).padEnd(11)} = ${tt(a.output)}`,`cache r ${s(e.cacheReadTokens).padStart(14)} × ${i(n.cacheRead).padEnd(11)} = ${tt(a.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${tt(a.total)}`].join(`
|
|
62
62
|
`)}function c1(e){const t=Il(e);return t.length<=1?l1(e.usage,e.model):[...t.map(n=>l1(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${tt(kn(e).total)}`].join(`
|
|
63
63
|
`)}function w3({data:e,selected:t}){var v;const n=e.now??Date.now(),s=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),i=e.tools.filter(w=>!w.endedAt).length,a=Mw(e.sessionId),l=((v=e.context)==null?void 0:v.currentContextTokens)??0,u=e.kind==="root"&&l>0,h=e.sessionTitle?e.cwd?`${e.cwd}
|
|
64
64
|
${e.sessionTitle}`:e.sessionTitle:e.cwd,p=pT(e),f=p.length>0?`${e.model}
|
|
65
65
|
spend on this card also covers:
|
|
66
66
|
${p.join(`
|
|
67
|
-
`)}`:e.model,g=yT(e.sessionName,e.sessionTitle);return d.jsxs("div",{className:s,style:{"--session-hue":a},children:[d.jsx("span",{className:"accent-stripe"}),d.jsx(Hi,{type:"target",position:De.Left,style:{background:"transparent",border:"none"}}),d.jsxs("div",{className:"head",children:[d.jsxs("div",{className:"title",children:[d.jsx(x3,{state:e.state}),d.jsx("span",{className:"label",title:h,children:e.label}),e.synthetic&&d.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"})]}),d.jsxs("div",{className:"head-right",children:[u&&e.onOpenContext&&d.jsx(v3,{currentContextTokens:l,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),d.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:Ou(e.startedAt,e.endedAt,n)})]})]}),d.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&d.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?d.jsxs("span",{className:"model-chip","data-family":Yu(e.model),title:f,children:[
|
|
67
|
+
`)}`:e.model,g=yT(e.sessionName,e.sessionTitle);return d.jsxs("div",{className:s,style:{"--session-hue":a},children:[d.jsx("span",{className:"accent-stripe"}),d.jsx(Hi,{type:"target",position:De.Left,style:{background:"transparent",border:"none"}}),d.jsxs("div",{className:"head",children:[d.jsxs("div",{className:"title",children:[d.jsx(x3,{state:e.state}),d.jsx("span",{className:"label",title:h,children:e.label}),e.synthetic&&d.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"})]}),d.jsxs("div",{className:"head-right",children:[u&&e.onOpenContext&&d.jsx(v3,{currentContextTokens:l,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),d.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:Ou(e.startedAt,e.endedAt,n)})]})]}),d.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&d.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?d.jsxs("span",{className:"model-chip","data-family":Yu(e.model),title:f,children:[$s(e.model),p.length>0?` +${p.length}`:""]}):e.provider==="codex"?d.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&g.face&&d.jsx("div",{className:"session-name",title:g.tooltip,children:g.face}),e.waiting&&d.jsx(_3,{waiting:e.waiting,now:n}),(()=>{const w=GL(e);return w?d.jsxs("div",{className:"approval-blind-row",title:w.detail,children:[d.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),d.jsx("span",{className:"approval-blind-said",children:w.label})]}):null})(),e.tools.length>0&&d.jsx(S3,{tools:e.tools,now:n}),d.jsxs("div",{className:"meta",children:[d.jsxs("span",{children:[d.jsx("b",{children:e.toolCount})," tools"]}),i>0&&d.jsxs("span",{className:"inflight-meta",children:[d.jsx("b",{children:i})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&d.jsxs("span",{className:"tokens-meta",title:`in:${e.usage.inputTokens} out:${e.usage.outputTokens} cache-r:${e.usage.cacheReadTokens} cache-c:${e.usage.cacheCreateTokens}${(e.usage.reasoningOutputTokens??0)>0?` reasoning:${e.usage.reasoningOutputTokens}`:""}`,children:[d.jsx("b",{children:At(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const w=Qi(e.model),E=kn(e),b=Kv(e);if(!w&&E.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:d.jsx("span",{className:"cost-unpriced",title:c1(e),children:Ii});if(E.total<=0)return null;const S=Math.max(0,((e.endedAt??n)-e.startedAt)/1e3),_=e.state==="active"?Ow(E.total,S):null,N=c1(e)+(_?`
|
|
68
68
|
burn: ${_}`:"");return d.jsxs("span",{className:"cost-meta",title:N,children:[d.jsxs("b",{children:[tt(E.total),b>0?"+":""]}),_&&d.jsx("span",{className:"cost-rate",children:_})]})})()]}),d.jsx(Hi,{type:"source",position:De.Right,style:{background:"transparent",border:"none"}})]})}function Pu(e){return e==="active"?"live":e==="done"?"done":"err"}function x3({state:e}){return d.jsx("span",{className:`state-pill state-${e}`,children:Pu(e)})}function xl(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function b3(e,t){const n=mT(e,t);return n?`Likely on: ${n}`:null}function k3(e){return e.kind==="idle"?"Your turn":xl(e)}function _3({waiting:e,now:t}){const n=Ol(e),s=xl(e);return d.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${s}
|
|
69
69
|
Blocked for ${Ou(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?d.jsx("span",{className:"ap-pulse","aria-hidden":!0}):d.jsx("span",{className:"waiting-dot","aria-hidden":!0}),d.jsx("span",{className:"waiting-said",children:k3(e)}),d.jsx("b",{children:Ou(e.since,void 0,t)})]})}function S3({tools:e,now:t}){const a=new Array(24).fill(0);let l=0;for(const E of e){const b=t-E.startedAt;if(b<0||b>=6e4)continue;const S=23-Math.floor(b/2500);S>=0&&S<24&&(a[S]+=1,l+=1)}const u=Math.max(1,...a),h=Math.max(0,...a),p=132,f=14,g=p/24,v=h/(2500/1e3),w=l===0?"no tool calls in the last 60s":`${l} tool calls in last 60s · peak ${v.toFixed(1)}/s`;return d.jsxs("div",{className:"tool-spark-row",title:w,children:[d.jsx("svg",{className:"tool-spark",width:p,height:f,viewBox:`0 0 ${p} ${f}`,"aria-hidden":!0,children:a.map((E,b)=>{const S=E===0?1.5:Math.max(1.5,E/u*f),_=b===23&&E>0,C=`tool-spark-bar${E>0?" active":""}${_?" latest":""}`;return d.jsx("rect",{x:b*g+.4,y:f-S,width:Math.max(.5,g-1),height:S,rx:.8,className:C},b)})}),d.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function u1(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function N3({tool:e,onClose:t}){const n=Sn(t),s=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return d.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:d.jsxs("div",{ref:n,className:"modal",onClick:i=>i.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:`status-dot ${s}`,"aria-hidden":!0}),d.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),d.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("span",{className:"modal-dur",children:gT(e,"in-flight…")}),d.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),d.jsxs("section",{className:"modal-body",children:[e.trimmed&&d.jsx("div",{className:"modal-section",children:d.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),d.jsxs("div",{className:"modal-section",children:[d.jsx("h4",{children:"Input"}),d.jsx("pre",{children:u1(e.input??e.inputPreview)})]}),d.jsxs("div",{className:"modal-section",children:[d.jsxs("h4",{children:["Response ",s==="err"&&d.jsx("span",{className:"err-tag",children:"error"})]}),d.jsx("pre",{children:e.endedAt==null?"(waiting…)":u1(e.response??e.errorPreview)})]})]})]})})}const lu=18,d1=26,E3=12;function C3(e){return j3(e.nodeInternals.values())}function j3(e){const t=new Map;for(const i of e){if(i.type!=="agent")continue;const a=i.data;if(!(a!=null&&a.sessionId)||a.exitAt!=null||i.width==null||i.height==null)continue;const l=i.position.x,u=i.position.y,h=l+i.width,p=u+i.height,f=t.get(a.sessionId);f?(f.minX=Math.min(f.minX,l),f.minY=Math.min(f.minY,u),f.maxX=Math.max(f.maxX,h),f.maxY=Math.max(f.maxY,p),a.kind==="root"&&(f.label=h1(a)??f.label),a.kind==="root"&&(f.name=p1(a))):t.set(a.sessionId,{minX:l,minY:u,maxX:h,maxY:p,label:h1(a)??a.sessionId,name:p1(a)})}const n=new Map;for(const i of t.values())n.set(i.label,(n.get(i.label)??0)+1);const s=[];for(const[i,a]of t){const l=(n.get(a.label)??0)>1;s.push({sessionId:i,...M3(a.label,a.name,i,l),x:a.minX-lu,y:a.minY-lu-d1,w:a.maxX-a.minX+lu*2,h:a.maxY-a.minY+lu*2+d1})}return s}const Xv=" · ",T3=32,R3=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function f1(e){return R3.test(e)?2:1}function A3(e,t=T3){const n=[...e];let s=0;for(const l of n)s+=f1(l);if(s<=t)return e;const i=[];let a=0;for(const l of n){const u=f1(l);if(a+u>t-1)break;i.push(l),a+=u}for(;i.length&&/[\s\-_.:/]/.test(i[i.length-1]);)i.pop();return`${i.join("")}…`}function M3(e,t,n,s){const i=(t==null?void 0:t.trim())??"",a=s?I3(n):void 0,l=[e,i||void 0,a].filter(Boolean);return{label:e,name:i?A3(i):void 0,shortId:a,fullLabel:l.join(Xv)}}function I3(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function h1(e){if(e.kind==="root")return e.label}function p1(e){if(e.kind==="root")return yT(e.sessionName,e.sessionTitle).face}function O3({onFit:e}){const{x:t,y:n,zoom:s}=eT(),i=Tl(),a=at(C3,P3);if(a.length<=1)return null;const l=h=>{try{const p=i.getNodes().filter(f=>{const g=f.data;return(g==null?void 0:g.sessionId)===h});if(p.length===0)return;i.fitView({padding:.3,duration:500,nodes:p}),e==null||e()}catch{}},u={transform:`translate(${t}px, ${n}px) scale(${s})`};return d.jsx("div",{className:"session-clusters",style:u,children:a.map(h=>{const p=Mw(h.sessionId),f={position:"absolute",left:h.x,top:h.y,width:h.w,height:h.h,"--session-hue":p},g={position:"absolute",left:h.x+16,top:h.y-E3,transform:`scale(${Math.min(1,s)/(s||1)})`,transformOrigin:"left top","--session-hue":p};return d.jsxs(de.Fragment,{children:[d.jsx("div",{className:"cluster-card",style:f,"aria-hidden":!0}),d.jsxs("button",{type:"button",className:"cluster-label",style:g,title:`Fit view to ${h.fullLabel}
|
|
70
70
|
drag the wrapper to move the whole session`,onClick:()=>l(h.sessionId),children:[h.label,h.name?d.jsxs(d.Fragment,{children:[Xv,d.jsx("span",{className:"cluster-label-name",children:h.name})]}):null,h.shortId?Xv+h.shortId:null]})]},h.sessionId)})})}function P3(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],i=t[n];if(s.sessionId!==i.sessionId||s.label!==i.label||s.name!==i.name||s.shortId!==i.shortId||s.fullLabel!==i.fullLabel||s.x!==i.x||s.y!==i.y||s.w!==i.w||s.h!==i.h)return!1}return!0}function $3({data:e}){return d.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const Pl={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"}},L3=Object.fromEntries(Object.entries(Pl).map(([e,t])=>[e,t.category])),q3=Object.fromEntries(Object.entries(Pl).map(([e,t])=>[e,t.emoji])),D3=Object.fromEntries(Object.entries(Pl).map(([e,t])=>[e,t.label])),F3=new Set(Object.keys(Pl)),z3=new Set(Object.entries(Pl).filter(([,e])=>e.shell).map(([e])=>e)),m1={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",...L3};function bT(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(m1,e)?m1[e]:"other"}const B3=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,U3=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function W3(e){if(typeof e!="string"||!e)return null;const t=B3.exec(e);if(t){const s=H3(t[2]);if(s.trim())return s}const n=U3.exec(e);return n?n[1]:null}function H3(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
|
|
71
|
-
`:n==="r"?"\r":n==="t"?" ":n)}const kT=600,G3=4,V3=36,Qv=16,Y3=60,K3=6,g1=220,y1=96,X3=28,v1={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:"📡",...q3};function w1(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(v1,e)?v1[e]:"✨"}const x1={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 _T(e){if(!e)return null;let t=e.trim();if(!t)return null;const n=t.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(n)return _T(n[1]);for(;;){const a=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!a)break;t=t.slice(a[0].length)}t=t.replace(/^sudo(?:\s+-\S+)*\s+/,""),t=t.replace(/^(?:time|nohup|xargs)\s+/,"");const s=t.match(/^([^\s|;&<>(]+)/);if(!s)return null;let i=s[1];return i=i.replace(/^.*[/\\]/,""),i=i.replace(/\.(exe|cmd|bat|ps1)$/i,""),i||null}function Q3(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=W3(t.script);if(n)return n}if(typeof t.cmd=="string")return t.cmd;if(typeof t.command=="string")return t.command;if(Array.isArray(t.command)&&t.command.every(n=>typeof n=="string")){const n=t.command;if(/powershell|cmd|bash|sh(\.exe)?$/i.test(n[0]??"")){const s=n.findIndex(i=>/^(-Command|-c)$/i.test(i));if(s>=0&&s+1<n.length)return n[s+1]}return n.join(" ")}return typeof t.script=="string"?t.script:null}const Z3=new Set(["Bash","PowerShell",...z3]),J3=F3;function eq(e,t){return J3.has(e)||e.startsWith("mcp__")?Math.max(y1,34+t.length*7.5):y1}function tq(e,t){if(!Z3.has(e))return null;const n=Q3(t);if(!n)return null;const s=_T(n);return s?{emoji:Object.hasOwn(x1,s)?x1[s]:"⚙️",label:s,category:"shell",detail:n}:null}const nq=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),b1={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:"🗄️"},k1={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 rq(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function sq(e){const t=e.toLowerCase();if(Object.hasOwn(k1,t))return k1[t];if(t.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(t))return"🧪";const n=t.lastIndexOf(".");if(n>0&&n<t.length-1){const s=t.slice(n+1);if(Object.hasOwn(b1,s))return b1[s]}return"📄"}function oq(e,t){if(!t||typeof t!="object")return null;const n=t;if(e==="apply_patch"&&typeof n.patch=="string"){const s=n.patch.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m);return s?s[1].trim():null}return typeof n.file_path=="string"?n.file_path:typeof n.notebook_path=="string"?n.notebook_path:typeof n.path=="string"?n.path:e==="Glob"&&typeof n.pattern=="string"?n.pattern:null}function iq(e,t){if(!nq.has(e))return null;const n=oq(e,t);if(!n)return null;const s=rq(n);return s?{emoji:e==="LS"?"📂":sq(s),label:s,category:"file",detail:n}:null}const _1={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 Lw(e){if(!e.startsWith("mcp__"))return null;const t=e.slice(5),n=t.indexOf("__");return n<=0?{server:t,method:""}:{server:t.slice(0,n),method:t.slice(n+2)}}function aq(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return Math.abs(t)%360}function ST(e){const t=e.toLowerCase();return Object.hasOwn(_1,t)?_1[t]:void 0}function lq(e,t){const n=Lw(e);if(!n)return null;const{server:s,method:i}=n;if(!i)return null;const a=ST(s);return{emoji:(a==null?void 0:a.emoji)??"🔌",label:i,category:"mcp",detail:a?`${a.name} · ${i}`:`${s} · ${i}`}}function cq(e,t){return tq(e,t)??iq(e,t)??lq(e)}const S1=D3;function NT(e){const t=Lw(e);if(t){const s=ST(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:t.server,hue:aq(t.server)}}const n=Object.hasOwn(S1,e)?S1[e]:"";return n?{emoji:w1(e),label:n}:{emoji:w1(e),label:e}}function uq(e){let t=null,n="";for(const s of e){const i=Lw(s);if(i){if(!i.server)return null;if(t===null)t=i.server,n=s;else if(i.server!==t)return null}}return t===null?null:NT(n)}function dq(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function fq(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/kT)}function hq(e,t){const n=[],s=new Set;for(let i=e.length-1;i>=0&&n.length<t;i--){const a=e[i];s.has(a.id)||(s.add(a.id),n.push(a))}return n.reverse()}function pq(e,t,n,s,i,a){const l=[];for(const u of e.values()){if(!t.has(u.id)||u.exitAt!=null&&a-u.exitAt>kT)continue;const h=s.get(u.id)??n.get(u.id);if(!h)continue;const p=hq(u.tools,G3);if(p.length===0)continue;const f=u.exitAt??null,g=i.get(u.id),v=Math.max((g==null?void 0:g.width)??g1,g1),w=(g==null?void 0:g.height)??130,E=h.x,b=h.y,S=E+v,_=b+w/2;p.forEach((N,C)=>{const j=C*V3,M=E+v+Y3,P=b+K3+j,I=fq(a,f),F=N.inputPreview??"",O=dq(N),A=I<.999,L=NT(N.name);l.push({id:`${u.id}::${N.id}`,toolId:N.id,agentId:u.id,toolName:N.name,name:L.label,emoji:L.emoji,status:O,category:bT(N.name),mcpHue:L.hue,inputPreview:F,fade:I,fading:A,worldX:M,worldY:P,anchorX:S,anchorY:_,spawnDx:S-M,spawnDy:_-(P+Qv)});const H=cq(N.name,N.input);if(H){const X=eq(N.name,L.label),R=M+X+X3,K=P,G=M+X,ne=P+Qv;l.push({id:`sub:${u.id}::${N.id}`,toolId:N.id,agentId:u.id,toolName:N.name,name:H.label,emoji:H.emoji,isSub:!0,status:O,category:H.category,inputPreview:H.detail??F,fade:I,fading:A,worldX:R,worldY:K,anchorX:G,anchorY:ne,spawnDx:G-R,spawnDy:0})}})}return l}function mq({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:i,spotlight:a,hiddenCategories:l,now:u,onOpenTool:h}){const p=pq(e,t,n,s,i,u),f=l&&l.size>0?p.filter(g=>!l.has(g.category)):p;return d.jsx(gq,{bursts:f,spotlight:a,onOpenTool:h})}function gq({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:i,zoom:a}=eT();return d.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[d.jsx("svg",{className:"tool-bursts-svg",children:e.map(l=>{const u=l.anchorX*a+s,h=l.anchorY*a+i,p=(l.worldX+6)*a+s,f=(l.worldY+Qv)*a+i,g=u+(p-u)*.55,v=t!=null&&!t.has(l.agentId),w=l.fade*(v?.14:1);return d.jsx("path",{d:`M ${u} ${h} Q ${g} ${h}, ${p} ${f}`,className:`tool-conn status-${l.status}${l.fading?" fading":""}`,opacity:w},`l:${l.id}`)})}),e.map(l=>{const u=l.worldX*a+s,h=l.worldY*a+i,p={left:`${u}px`,top:`${h}px`,transform:`scale(${a})`,transformOrigin:"left top","--spawn-dx":`${l.spawnDx}px`,"--spawn-dy":`${l.spawnDy}px`},f=l.isSub?`${l.toolName} · ${l.name}`:l.toolName,g=l.inputPreview?`${f} · ${l.inputPreview}`:f,v=n!=null,w=l.mcpHue!=null?{"--mcp-hue":l.mcpHue}:{},b=t!=null&&!t.has(l.agentId)?" dim":"";return d.jsx("div",{className:"tool-burst-wrap",style:p,children:d.jsxs("div",{className:`tool-burst cat-${l.category}${l.mcpHue!=null?" mcp-hue":""} status-${l.status}${l.fading?" fading":""}${v?" clickable":""}${l.isSub?" sub":""}${b}`,style:w,title:g,onClick:v?()=>n(l.toolId):void 0,children:[d.jsx("span",{className:"tb-emoji",children:l.emoji}),d.jsx("span",{className:"tb-name",children:l.name}),l.status==="inflight"&&d.jsx("span",{className:"tb-spin"}),l.status==="done"&&d.jsx("span",{className:"tb-mark done",children:"✓"}),l.status==="err"&&d.jsx("span",{className:"tb-mark err",children:"×"})]})},l.id)})]})}function yq(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,s=0,i=0,a=0;for(const l of e){const u=kn(l);t.input+=u.input,t.output+=u.output,t.cacheRead+=u.cacheRead,t.cacheWrite+=u.cacheWrite,t.total+=u.total,n+=l.usage.inputTokens,s+=l.usage.outputTokens,i+=l.usage.cacheReadTokens,a+=l.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:s,cacheReadTokens:i,cacheCreateTokens:a,sum:n+s}}const vq="spend on this board",wq="on this board",N1=`Everything on the board right now, and only that.
|
|
71
|
+
`:n==="r"?"\r":n==="t"?" ":n)}const kT=600,G3=4,V3=36,Qv=16,Y3=60,K3=6,g1=220,y1=96,X3=28,v1={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:"📡",...q3};function w1(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(v1,e)?v1[e]:"✨"}const x1={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 _T(e){if(!e)return null;let t=e.trim();if(!t)return null;const n=t.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(n)return _T(n[1]);for(;;){const a=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!a)break;t=t.slice(a[0].length)}t=t.replace(/^sudo(?:\s+-\S+)*\s+/,""),t=t.replace(/^(?:time|nohup|xargs)\s+/,"");const s=t.match(/^([^\s|;&<>(]+)/);if(!s)return null;let i=s[1];return i=i.replace(/^.*[/\\]/,""),i=i.replace(/\.(exe|cmd|bat|ps1)$/i,""),i||null}function Q3(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=W3(t.script);if(n)return n}if(typeof t.cmd=="string")return t.cmd;if(typeof t.command=="string")return t.command;if(Array.isArray(t.command)&&t.command.every(n=>typeof n=="string")){const n=t.command;if(/powershell|cmd|bash|sh(\.exe)?$/i.test(n[0]??"")){const s=n.findIndex(i=>/^(-Command|-c)$/i.test(i));if(s>=0&&s+1<n.length)return n[s+1]}return n.join(" ")}return typeof t.script=="string"?t.script:null}const Z3=new Set(["Bash","PowerShell",...z3]),J3=F3;function e4(e,t){return J3.has(e)||e.startsWith("mcp__")?Math.max(y1,34+t.length*7.5):y1}function t4(e,t){if(!Z3.has(e))return null;const n=Q3(t);if(!n)return null;const s=_T(n);return s?{emoji:Object.hasOwn(x1,s)?x1[s]:"⚙️",label:s,category:"shell",detail:n}:null}const n4=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),b1={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:"🗄️"},k1={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 r4(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function s4(e){const t=e.toLowerCase();if(Object.hasOwn(k1,t))return k1[t];if(t.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(t))return"🧪";const n=t.lastIndexOf(".");if(n>0&&n<t.length-1){const s=t.slice(n+1);if(Object.hasOwn(b1,s))return b1[s]}return"📄"}function o4(e,t){if(!t||typeof t!="object")return null;const n=t;if(e==="apply_patch"&&typeof n.patch=="string"){const s=n.patch.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m);return s?s[1].trim():null}return typeof n.file_path=="string"?n.file_path:typeof n.notebook_path=="string"?n.notebook_path:typeof n.path=="string"?n.path:e==="Glob"&&typeof n.pattern=="string"?n.pattern:null}function i4(e,t){if(!n4.has(e))return null;const n=o4(e,t);if(!n)return null;const s=r4(n);return s?{emoji:e==="LS"?"📂":s4(s),label:s,category:"file",detail:n}:null}const _1={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 Lw(e){if(!e.startsWith("mcp__"))return null;const t=e.slice(5),n=t.indexOf("__");return n<=0?{server:t,method:""}:{server:t.slice(0,n),method:t.slice(n+2)}}function a4(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return Math.abs(t)%360}function ST(e){const t=e.toLowerCase();return Object.hasOwn(_1,t)?_1[t]:void 0}function l4(e,t){const n=Lw(e);if(!n)return null;const{server:s,method:i}=n;if(!i)return null;const a=ST(s);return{emoji:(a==null?void 0:a.emoji)??"🔌",label:i,category:"mcp",detail:a?`${a.name} · ${i}`:`${s} · ${i}`}}function c4(e,t){return t4(e,t)??i4(e,t)??l4(e)}const S1=D3;function NT(e){const t=Lw(e);if(t){const s=ST(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:t.server,hue:a4(t.server)}}const n=Object.hasOwn(S1,e)?S1[e]:"";return n?{emoji:w1(e),label:n}:{emoji:w1(e),label:e}}function u4(e){let t=null,n="";for(const s of e){const i=Lw(s);if(i){if(!i.server)return null;if(t===null)t=i.server,n=s;else if(i.server!==t)return null}}return t===null?null:NT(n)}function d4(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function f4(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/kT)}function h4(e,t){const n=[],s=new Set;for(let i=e.length-1;i>=0&&n.length<t;i--){const a=e[i];s.has(a.id)||(s.add(a.id),n.push(a))}return n.reverse()}function p4(e,t,n,s,i,a){const l=[];for(const u of e.values()){if(!t.has(u.id)||u.exitAt!=null&&a-u.exitAt>kT)continue;const h=s.get(u.id)??n.get(u.id);if(!h)continue;const p=h4(u.tools,G3);if(p.length===0)continue;const f=u.exitAt??null,g=i.get(u.id),v=Math.max((g==null?void 0:g.width)??g1,g1),w=(g==null?void 0:g.height)??130,E=h.x,b=h.y,S=E+v,_=b+w/2;p.forEach((N,C)=>{const j=C*V3,M=E+v+Y3,P=b+K3+j,I=f4(a,f),F=N.inputPreview??"",O=d4(N),A=I<.999,L=NT(N.name);l.push({id:`${u.id}::${N.id}`,toolId:N.id,agentId:u.id,toolName:N.name,name:L.label,emoji:L.emoji,status:O,category:bT(N.name),mcpHue:L.hue,inputPreview:F,fade:I,fading:A,worldX:M,worldY:P,anchorX:S,anchorY:_,spawnDx:S-M,spawnDy:_-(P+Qv)});const H=c4(N.name,N.input);if(H){const X=e4(N.name,L.label),R=M+X+X3,K=P,G=M+X,ne=P+Qv;l.push({id:`sub:${u.id}::${N.id}`,toolId:N.id,agentId:u.id,toolName:N.name,name:H.label,emoji:H.emoji,isSub:!0,status:O,category:H.category,inputPreview:H.detail??F,fade:I,fading:A,worldX:R,worldY:K,anchorX:G,anchorY:ne,spawnDx:G-R,spawnDy:0})}})}return l}function m4({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:i,spotlight:a,hiddenCategories:l,now:u,onOpenTool:h}){const p=p4(e,t,n,s,i,u),f=l&&l.size>0?p.filter(g=>!l.has(g.category)):p;return d.jsx(g4,{bursts:f,spotlight:a,onOpenTool:h})}function g4({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:i,zoom:a}=eT();return d.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[d.jsx("svg",{className:"tool-bursts-svg",children:e.map(l=>{const u=l.anchorX*a+s,h=l.anchorY*a+i,p=(l.worldX+6)*a+s,f=(l.worldY+Qv)*a+i,g=u+(p-u)*.55,v=t!=null&&!t.has(l.agentId),w=l.fade*(v?.14:1);return d.jsx("path",{d:`M ${u} ${h} Q ${g} ${h}, ${p} ${f}`,className:`tool-conn status-${l.status}${l.fading?" fading":""}`,opacity:w},`l:${l.id}`)})}),e.map(l=>{const u=l.worldX*a+s,h=l.worldY*a+i,p={left:`${u}px`,top:`${h}px`,transform:`scale(${a})`,transformOrigin:"left top","--spawn-dx":`${l.spawnDx}px`,"--spawn-dy":`${l.spawnDy}px`},f=l.isSub?`${l.toolName} · ${l.name}`:l.toolName,g=l.inputPreview?`${f} · ${l.inputPreview}`:f,v=n!=null,w=l.mcpHue!=null?{"--mcp-hue":l.mcpHue}:{},b=t!=null&&!t.has(l.agentId)?" dim":"";return d.jsx("div",{className:"tool-burst-wrap",style:p,children:d.jsxs("div",{className:`tool-burst cat-${l.category}${l.mcpHue!=null?" mcp-hue":""} status-${l.status}${l.fading?" fading":""}${v?" clickable":""}${l.isSub?" sub":""}${b}`,style:w,title:g,onClick:v?()=>n(l.toolId):void 0,children:[d.jsx("span",{className:"tb-emoji",children:l.emoji}),d.jsx("span",{className:"tb-name",children:l.name}),l.status==="inflight"&&d.jsx("span",{className:"tb-spin"}),l.status==="done"&&d.jsx("span",{className:"tb-mark done",children:"✓"}),l.status==="err"&&d.jsx("span",{className:"tb-mark err",children:"×"})]})},l.id)})]})}function y4(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,s=0,i=0,a=0;for(const l of e){const u=kn(l);t.input+=u.input,t.output+=u.output,t.cacheRead+=u.cacheRead,t.cacheWrite+=u.cacheWrite,t.total+=u.total,n+=l.usage.inputTokens,s+=l.usage.outputTokens,i+=l.usage.cacheReadTokens,a+=l.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:s,cacheReadTokens:i,cacheCreateTokens:a,sum:n+s}}const v4="spend on this board",w4="on this board",N1=`Everything on the board right now, and only that.
|
|
72
72
|
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.
|
|
73
|
-
Press H for the totals ccusage reads off the logs on disk, which do not forget.`,ET="session spend";function qw({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const s=(a,l,u)=>{if(a<=0)return null;const h=a/n*100;return d.jsx("span",{className:`cb-seg ${l}`,style:{width:`${h}%`},title:`${u}: ${tt(a)} (${h.toFixed(0)}%)`},l)},i=t==="lg";return d.jsxs("div",{className:i?"cost-bar cost-bar-lg":"cost-bar",role:"img","aria-label":"Cost breakdown",children:[s(e.input,"cb-input","input"),s(e.output,"cb-output","output"),s(e.cacheRead,"cb-cache-r","cache read"),s(e.cacheWrite,"cb-cache-w","cache write")]})}function
|
|
74
|
-
`),children:["waiting ",C1(h.waiting.since,void 0,t),h.waiting.tool&&d.jsxs("span",{className:"sl-waiting-tool",children:[" · ",h.waiting.tool.name]})]}):d.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:C1(h.startedAt,h.state==="active"?void 0:h.lastActivity,t)})]})]})]},h.sessionId)})]})]})}const Sq=e=>1-Math.pow(1-e,5),CT=420;function Nq(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||e===t)return!1;const n=Math.abs(t-e);if(n<1)return!1;const s=Math.max(Math.abs(e),Math.abs(t));return s===0||n/s>=.005}function Eq(e,t,n,s=CT){return n>=s?t:n<=0?e:e+(t-e)*Sq(n/s)}function Cq(e,t,n,s={}){const i=s.now??(()=>performance.now()),a=s.raf??(w=>requestAnimationFrame(w)),l=s.cancel??(w=>cancelAnimationFrame(w)),u=s.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),h=s.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(u()||h()||!Nq(e,t))return n(t),()=>{};const p=i();let f=0,g=!0;const v=()=>{if(!g)return;const w=i()-p;n(Eq(e,t,w)),w<CT&&(f=a(v))};return f=a(v),()=>{g=!1,f&&l(f)}}const Zv={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function j1(e,t){const n=new Map;for(const s of e){if(s.kind!=="root"||!s.sessionId)continue;const i=kn(s,t);n.set(s.sessionId,{cost:i.total,inputTokens:s.usage.inputTokens,outputTokens:s.usage.outputTokens,cacheReadTokens:s.usage.cacheReadTokens,cacheCreateTokens:s.usage.cacheCreateTokens})}return n}function jq(e,t){if(!e)return Zv;const n={...Zv};for(const[s,i]of t){const a=e.get(s);if(!a)continue;const l={cost:i.cost-a.cost,inputTokens:i.inputTokens-a.inputTokens,outputTokens:i.outputTokens-a.outputTokens,cacheReadTokens:i.cacheReadTokens-a.cacheReadTokens,cacheCreateTokens:i.cacheCreateTokens-a.cacheCreateTokens};l.cost<0||l.inputTokens<0||l.outputTokens<0||l.cost===0&&l.inputTokens===0&&l.outputTokens===0&&l.cacheReadTokens===0&&l.cacheCreateTokens===0||(n.cost+=l.cost,n.inputTokens+=Math.max(0,l.inputTokens),n.outputTokens+=Math.max(0,l.outputTokens),n.cacheReadTokens+=Math.max(0,l.cacheReadTokens),n.cacheCreateTokens+=Math.max(0,l.cacheCreateTokens),n.sessions+=1)}return n}function Jv(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const Xu=[{key:"today",label:"today",noun:"today",hint:"Since midnight, on this machine's clock."},{key:"month",label:"month",noun:"this month",hint:"Since the 1st of this calendar month — not the last 30 days."},{key:"all",label:"all",noun:"all time",hint:"Every transcript on disk, back to 2020."}];function Tq(e,t,n=Xu.length){return n<=0?null:e==="ArrowRight"||e==="ArrowDown"?(t+1)%n:e==="ArrowLeft"||e==="ArrowUp"?(t-1+n)%n:e==="Home"?0:e==="End"?n-1:null}function Rq(e,t=new Date){return e==="today"?Jv(1,t):e==="month"?Jv(t.getDate(),t):"20200101"}const bn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,bu=e=>typeof e=="string"?e:"";function jT(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const s of t){const i=Array.isArray(s==null?void 0:s.modelBreakdowns)?s.modelBreakdowns:[];for(const a of i){const l=bu(a==null?void 0:a.modelName);if(!l)continue;let u=n.get(l);u||(u={model:l,cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,get tokens(){return this.inputTokens+this.outputTokens+this.cacheReadTokens+this.cacheCreateTokens}},n.set(l,u)),u.cost+=bn(a==null?void 0:a.cost),u.inputTokens+=bn(a==null?void 0:a.inputTokens),u.outputTokens+=bn(a==null?void 0:a.outputTokens),u.cacheReadTokens+=bn(a==null?void 0:a.cacheReadTokens),u.cacheCreateTokens+=bn(a==null?void 0:a.cacheCreationTokens)}}return[...n.values()].sort((s,i)=>i.cost-s.cost||i.tokens-s.tokens)}function Aq(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const i of n){const a=bu(i==null?void 0:i.period);if(!a)continue;const l=i==null?void 0:i.metadata,u=typeof(l==null?void 0:l.lastActivity)=="string"?Date.parse(l.lastActivity):NaN;s.push({sessionId:a,label:t.get(a)??null,agent:bu(i==null?void 0:i.agent)||"claude",cost:bn(i==null?void 0:i.totalCost),tokens:bn(i==null?void 0:i.totalTokens),models:Array.isArray(i==null?void 0:i.modelsUsed)?i.modelsUsed.map(bu).filter(Boolean):[],lastActivityMs:Number.isFinite(u)?u:null})}return s.sort((i,a)=>a.cost-i.cost||a.tokens-i.tokens)}function TT(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const h=bn(t.cacheReadTokens),p=bn(t.cacheCreationTokens),f=bn(t.inputTokens),g=bn(t.outputTokens);return{cost:bn(t.totalCost),inputTokens:f,outputTokens:g,cacheReadTokens:h,cacheCreateTokens:p,tokens:bn(t.totalTokens)||f+g+h+p}}const n=jT(e),s=h=>n.reduce((p,f)=>p+h(f),0),i=s(h=>h.inputTokens),a=s(h=>h.outputTokens),l=s(h=>h.cacheReadTokens),u=s(h=>h.cacheCreateTokens);return{cost:s(h=>h.cost),inputTokens:i,outputTokens:a,cacheReadTokens:l,cacheCreateTokens:u,tokens:i+a+l+u}}function Mq(e,t){return{data:(e==null?void 0:e.data)??null,shown:(e==null?void 0:e.period)??null,stale:e!=null&&e.period!==t,baseline:(e==null?void 0:e.baseline)??null}}function Iq(e,t){var n;return((n=Xu.find(s=>s.key===(e??t)))==null?void 0:n.noun)??"today"}function Oq(e,t,n){const s=e!=null,i=TT(e);return{fromRange:s,cost:s?i.cost+n.cost:t.cost.total,inputTokens:s?i.inputTokens+n.inputTokens:t.inputTokens,outputTokens:s?i.outputTokens+n.outputTokens:t.outputTokens,cacheReadTokens:s?i.cacheReadTokens+n.cacheReadTokens:t.cacheReadTokens,cacheCreateTokens:s?i.cacheCreateTokens+n.cacheCreateTokens:t.cacheCreateTokens,hasCost:s?i.cost>0:t.cost.total>0,tokenSum:s?i.tokens:t.sum,showCostBar:!s}}const Pq="1",T1="agent-dag.schema",$q=["agent-dag.layout","agent-dag.viewport"];function Zi(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function Lq(e,t=Pq){let n=null;try{n=e.getItem(T1)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const i of $q)try{e.getItem(i)!==null&&(e.removeItem(i),s.push(i))}catch{}try{e.setItem(T1,t)}catch{}return s}const zt="ccdeck";function RT(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 ew(e){return RT(Math.floor(e/1e3))}function AT(e,t){const n=e-t;if(n<=0)return null;const s=Math.floor(n/86400),i=Math.floor(n%86400/3600),a=Math.floor(n%3600/60);return s>0?`${s}d ${i}h`:i>0?`${i}h ${a}m`:`${a}m`}function qq(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Dq(e,t,n){const s=new Date(e),i=ew(t-e);return{label:qq(s,new Date(t))?i:`${i} · ${s.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:s.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function MT(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function IT(e){return e==null}const tw="self";function lr(e,t=!1){const n=MT(e?tw:null,tw);return{disabled:t||n.disabled,"aria-busy":n.busy}}function cr(e){return IT(e?tw:null)}function Fq(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function zq(e){return e==null||e==="BODY"||e==="HTML"}const OT="agent-dag.usagePeriod";function Bq(){const e=Zi(OT);return Xu.some(t=>t.key===e)?e:"today"}function Uq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(OT,e)}catch{}}const PT="agent-dag.usageSessionsOpen";function Wq(){return Zi(PT)==="1"}function Hq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(PT,e?"1":"0")}catch{}}function R1(e,t){if(!e)return null;const n=t-Math.floor(e/1e3);return n<10?"just now":n<60?`${n}s ago`:n<3600?`${Math.floor(n/60)}m ago`:`${Math.floor(n/3600)}h ago`}function Gq(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 ah="__unknown__";function Vq(e,t,n,s){const i=Math.max(0,t-s),a=Math.max(0,n-i);if(a<120)return null;const l=Math.min(100,a/n*100),u=e-l;if(Math.abs(u)<3)return{label:"on pace",color:"var(--ok)",expectedPct:l,isDeficit:!1};if(u>0){const h=100-e,p=a>0?e/a:0,f=p>0?h/p:1/0,g={label:`${Math.round(u)}% ahead`,color:"var(--warn)",expectedPct:l,isDeficit:!0};if(f<i&&f<86400){const v=Math.floor(f/3600),w=Math.floor(f%3600/60);g.runsOutIn=v>0?`${v}h ${w}m`:`${w}m`}return g}return{label:`${Math.round(-u)}% reserve`,color:"var(--ok)",expectedPct:l,isDeficit:!1}}function go({pct:e,label:t,reset:n,resetAt:s,windowSec:i,limitReached:a,nowSec:l}){const u=Math.min(100,Math.max(0,e)),p=a||u>=90?"var(--err)":u>=70?"var(--warn)":"var(--accent)",f=u===0?"< 1%":`${u}%`,g=u===0?2:u,v=s?AT(s,l):null,w=s&&i?Vq(u,s,i,l):null;return d.jsxs("div",{className:"qb-row",children:[d.jsxs("div",{className:"qb-meta",children:[d.jsxs("span",{className:"qb-label",children:[t,a&&d.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),d.jsx("span",{className:"qb-pct",style:{color:p},children:f})]}),d.jsxs("div",{className:"qb-track",children:[d.jsx("div",{className:"qb-fill",style:{width:`${g}%`,background:p,opacity:u===0?.4:1}}),w&&d.jsx("div",{className:"qb-pace-marker",style:{left:`${w.expectedPct}%`,background:w.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(w.expectedPct)}% by now`})]}),d.jsxs("div",{className:"qb-reset-row",children:[v?d.jsxs("span",{className:"qb-reset",children:["resets in ",v]}):n?d.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,w&&d.jsx("span",{className:"qb-pace",style:{color:w.color},children:w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label})]})]})}const Yq=6e4;function Kq(e){const[t,n]=k.useState(null),[s,i]=k.useState(!1),a=k.useRef(null),l=k.useRef(!1),u=async(p=!1)=>{if(!(p&&!cr(l.current))){p&&(l.current=!0,i(!0));try{const g=await fetch(p?"/api/quota?refresh=1":"/api/quota");g.ok&&n(await g.json())}catch{}finally{p&&(l.current=!1,i(!1))}}};return k.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),Yq),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&u(!0)}}}function Xq(e){switch(e){case"no_subscription":return"This install signs in with an API key (or Bedrock/Vertex), which is billed per token and has no session window.";case"rate_limited":return"Anthropic asked the deck to wait — it will retry on its own.";case"waiting":return"Waiting for the next allowed read — or click ↻.";default:return"Run /usage in a claude session, then click ↻"}}function Qq(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 $T=6e4,A1=6e4;function Zq(e){const[t,n]=k.useState(null),[s,i]=k.useState(!1),a=k.useRef(null),l=k.useRef(!1),u=async(p=!1)=>{if(!(p&&!cr(l.current))){p&&(l.current=!0,i(!0));try{const g=await fetch(p?"/api/codex-quota?refresh=1":"/api/codex-quota");g.ok&&n(await g.json())}catch{}finally{p&&(l.current=!1,i(!1))}}};return k.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),$T),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&u(!0)}}}function Jq(e){const[t,n]=k.useState(null),s=k.useRef(null),i=async()=>{try{const a=await fetch("/api/codex-usage");a.ok&&n(await a.json())}catch{}};return k.useEffect(()=>{if(e)return i(),s.current=window.setInterval(i,$T),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function e4(e,t,n){const[s,i]=k.useState(null),[a,l]=k.useState(!1),[u,h]=k.useState(0),p=k.useRef(0);k.useEffect(()=>{const g=()=>document.visibilityState==="visible",v=()=>{g()&&h(b=>b+1)},w=window.setInterval(v,A1),E=()=>{g()&&Date.now()-p.current>=A1&&h(b=>b+1)};return document.addEventListener("visibilitychange",E),()=>{window.clearInterval(w),document.removeEventListener("visibilitychange",E)}},[]);const f=k.useRef(t);return k.useEffect(()=>{let g=!0;const v=t!==f.current;f.current=t;const w=e,E=Rq(w);return l(!0),fetch(`/api/ccusage?since=${E}${v?"&refresh=1":""}`).then(b=>b.ok?b.json():null).then(b=>{!g||!(b!=null&&b.ok)||(p.current=Date.now(),i({period:w,data:b,baseline:n()}))}).catch(()=>{}).finally(()=>{g&&l(!1)}),()=>{g=!1}},[e,t,u]),{...Mq(s,e),loading:a}}function tl(e){const[t,n]=k.useState(e),s=k.useRef(e),i=k.useRef(!0);return k.useEffect(()=>{s.current=t},[t]),k.useEffect(()=>{if(i.current){i.current=!1,s.current=e,n(e);return}return Cq(s.current,e,l=>{s.current=l,n(l)})},[e]),t}function t4({state:e,now:t,providers:n,onClose:s}){var dt,lt;const{quota:i,loading:a,refresh:l}=Kq(n.claude),{data:u,loading:h,refresh:p}=Zq(n.codex),{data:f}=Jq(n.codex),[g,v]=k.useState(()=>Math.floor(Date.now()/1e3));k.useEffect(()=>{const pe=window.setInterval(()=>v(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(pe)},[]);const{byModel:w,totalCost:E,totalTokens:b,burnRate:S}=k.useMemo(()=>{const pe=new Map;for(const Ge of e.agents.values())for(const Ke of Il(Ge)){const se=Ke.model??ah,Pe=Iw(Ke.usage,Ke.model),$e=pe.get(se);$e?($e.inputTokens+=Ke.usage.inputTokens,$e.outputTokens+=Ke.usage.outputTokens,$e.cacheReadTokens+=Ke.usage.cacheReadTokens,$e.cacheCreateTokens+=Ke.usage.cacheCreateTokens,$e.cost.total+=Pe.total,$e.cost.input+=Pe.input,$e.cost.output+=Pe.output,$e.cost.cacheRead+=Pe.cacheRead,$e.cost.cacheWrite+=Pe.cacheWrite,$e.agentCount++):pe.set(se,{model:se,inputTokens:Ke.usage.inputTokens,outputTokens:Ke.usage.outputTokens,cacheReadTokens:Ke.usage.cacheReadTokens,cacheCreateTokens:Ke.usage.cacheCreateTokens,cost:{...Pe},agentCount:1,priced:Qi(Ke.model)!=null})}const me=Array.from(pe.values()).sort((Ge,Ke)=>Ke.cost.total-Ge.cost.total||Ke.inputTokens+Ke.outputTokens-(Ge.inputTokens+Ge.outputTokens));let Me=0,He=0;for(const Ge of e.agents.values()){if(Ge.state!=="active")continue;const Ke=kn(Ge);Me+=Ke.total,He=Math.max(He,((Ge.endedAt??t)-Ge.startedAt)/1e3)}const ct=He>0?Ow(Me,He):null,je=yq(e.agents.values());return{byModel:me,totalCost:je.cost,totalTokens:je,burnRate:ct}},[e,e.revision,t]),_=k.useMemo(()=>{const pe=[];for(const me of e.agents.values()){if(me.kind!=="root")continue;let Me=kn(me).total,He=me.usage.inputTokens,ct=me.usage.outputTokens,je=Kv(me);for(const Ge of e.agents.values())Ge.sessionId!==me.sessionId||Ge.kind==="root"||(Me+=kn(Ge).total,He+=Ge.usage.inputTokens,ct+=Ge.usage.outputTokens,je+=Kv(Ge));pe.push({sessionId:me.sessionId,label:me.label||me.cwdBasename||"session",state:me.state,cost:Me,inputTokens:He,outputTokens:ct,unpricedTokens:je})}return pe.sort((me,Me)=>Me.cost-me.cost||Me.inputTokens+Me.outputTokens-(me.inputTokens+me.outputTokens)).slice(0,12)},[e,e.revision]),[N,C]=k.useState(Bq);k.useEffect(()=>{Uq(N)},[N]);const[j,M]=k.useState(Wq);k.useEffect(()=>{Hq(j)},[j]);const P=k.useRef([]),[I,F]=k.useState(0),O=k.useRef(()=>new Map);O.current=()=>j1(e.agents.values(),t);const A=k.useCallback(()=>O.current(),[]),{data:L,shown:H,stale:X,baseline:R}=e4(N,I,A),K=L!=null,G=k.useMemo(()=>{const pe=new Map;for(const me of e.agents.values()){if(me.kind!=="root"||!me.sessionId)continue;const Me=me.label||me.cwdBasename;Me&&pe.set(me.sessionId,Me)}return pe},[e,e.revision]),ne=k.useMemo(()=>{const pe=new Map;for(const me of e.agents.values())me.kind!=="root"||!me.sessionId||pe.set(me.sessionId,me.state);return pe},[e,e.revision]),Q=k.useMemo(()=>K?jT(L):[],[L,K]),W=k.useMemo(()=>{if(!K)return[];const pe=Aq(L,G).slice(0,12),me=new Map;for(const Me of pe)Me.label&&me.set(Me.label,(me.get(Me.label)??0)+1);return pe.map(Me=>Me.label&&(me.get(Me.label)??0)>1?{...Me,label:`${Me.label} ${Me.sessionId.slice(0,4)}`}:Me)},[L,K,G]),ee=k.useMemo(()=>TT(L),[L]),$=Iq(H,N),Y=X?" up-stale":"",ue=k.useMemo(()=>K?jq(R,j1(e.agents.values(),t)):Zv,[e,e.revision,R,K,t]),z=Oq(L,{...b,cost:E},ue),D=z.hasCost,J=z.tokenSum,V=tl(z.cost),ae=tl(z.inputTokens),he=tl(z.outputTokens),ye=tl(z.cacheReadTokens),_e=tl(z.cacheCreateTokens),Ve=w.filter(pe=>pe.cost.total>0||pe.inputTokens+pe.outputTokens>0),Be=_.filter(pe=>pe.cost>0||pe.inputTokens+pe.outputTokens>0),qe=K?Q.some(pe=>pe.cost<=0&&pe.tokens>0):Ve.some(pe=>!pe.priced),Se=a||h,ce=R1(i==null?void 0:i.fetchedAt,g),be=R1(u==null?void 0:u.fetchedAt,g),ke=()=>{l(),p(),F(pe=>pe+1)},Ye=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return d.jsxs("aside",{className:"usage-panel",id:"usage-panel","aria-label":"Usage",children:[d.jsxs("div",{className:"up-header",children:[d.jsx("h2",{children:"Usage"}),S&&d.jsx("span",{className:"up-rate",children:S}),d.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&d.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:ke,...lr(Se),"aria-label":Ye,title:Ye,children:Se?"…":"↻"}),d.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:s,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&d.jsxs("section",{className:"up-section up-quota-section",children:[d.jsxs("h3",{className:"up-section-title",children:["Claude quota",ce&&!a&&d.jsx("span",{className:"up-section-age",title:Gq(i==null?void 0:i.source),children:ce})]}),i!=null&&i.ok?d.jsxs("div",{className:"up-quota-bars",children:[i.session5hPct!=null&&d.jsx(go,{label:"5-hour window",pct:i.session5hPct,reset:i.session5hReset,resetAt:i.session5hResetAt,windowSec:i.session5hWindowSec,nowSec:g}),i.week7dPct!=null&&d.jsx(go,{label:"7-day window",pct:i.week7dPct,reset:i.week7dReset,resetAt:i.week7dResetAt,windowSec:i.week7dWindowSec,nowSec:g}),i.weekSonnetPct!=null&&d.jsx(go,{label:"Sonnet (7d)",pct:i.weekSonnetPct,nowSec:g}),i.weekOpusPct!=null&&d.jsx(go,{label:"Opus (7d)",pct:i.weekOpusPct,nowSec:g})]}):(i==null?void 0:i.ok)===!1?d.jsxs("div",{className:"up-quota-na",children:[d.jsx("span",{children:i.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),d.jsx("span",{className:"up-quota-hint",children:Xq(i.reason)})]}):d.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&d.jsxs("section",{className:"up-section up-quota-section",children:[d.jsxs("h3",{className:"up-section-title",children:["Codex quota",(u==null?void 0:u.ok)&&u.planLabel&&d.jsx("span",{className:"up-plan-badge",children:u.planLabel}),be&&!h&&d.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:be})]}),u!=null&&u.ok?d.jsxs("div",{className:"up-quota-bars",children:[(dt=u.windows)==null?void 0:dt.map(pe=>d.jsx(go,{label:pe.label,pct:pe.pct,reset:pe.reset??void 0,resetAt:pe.resetAt??void 0,windowSec:pe.windowSec??void 0,limitReached:u.limitReached&&pe.pct>=100,nowSec:g},pe.id)),(lt=u.extraWindows)==null?void 0:lt.map(pe=>d.jsx(go,{label:pe.label,pct:pe.pct,reset:pe.reset??void 0,resetAt:pe.resetAt??void 0,windowSec:pe.windowSec??void 0,nowSec:g},pe.id)),u.creditLimit&&d.jsx(go,{label:`spend cap · $${Math.round(u.creditLimit.used)} of $${Math.round(u.creditLimit.limit)}`,pct:u.creditLimit.usedPct,reset:u.creditLimit.reset??void 0,resetAt:u.creditLimit.resetAt??void 0,limitReached:u.spendControlReached,nowSec:g}),u.creditsBalance&&!u.creditsUnlimited&&d.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",u.creditsBalance,u.overageReached&&" · overage limit reached"]}),u.creditsUnlimited&&d.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),u.resetCredits&&u.resetCredits.availableCount>0&&d.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${zt} only reports them`,children:[u.resetCredits.availableCount," rate-limit reset",u.resetCredits.availableCount!==1?"s":""," available",u.resetCredits.nextExpiryAt&&` · expires ${new Date(u.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),u.promo&&d.jsx("div",{className:"up-quota-sub",children:u.promo}),u.partial&&d.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(u==null?void 0:u.ok)===!1?d.jsxs("div",{className:"up-quota-na",children:[d.jsx("span",{children:"Quota unavailable."}),d.jsx("span",{className:"up-quota-hint",children:Qq(u.reason)})]}):d.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(f==null?void 0:f.ok)&&f.window7d&&f.window7d.sessionCount>0&&d.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${f.window5h?`
|
|
75
|
-
last 5h: ${At(f.window5h.totalTokens)} tokens · ${f.window5h.sessionCount} session${f.window5h.sessionCount!==1?"s":""}`:""}`,children:[At(f.window7d.totalTokens)," tokens · ",f.window7d.sessionCount," session",f.window7d.sessionCount!==1?"s":""," (7d)"]})]}),K&&d.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period",onKeyDown:pe=>{var He;const me=P.current.indexOf(pe.target);if(me<0)return;const Me=
|
|
73
|
+
Press H for the totals ccusage reads off the logs on disk, which do not forget.`,ET="session spend";function qw({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const s=(a,l,u)=>{if(a<=0)return null;const h=a/n*100;return d.jsx("span",{className:`cb-seg ${l}`,style:{width:`${h}%`},title:`${u}: ${tt(a)} (${h.toFixed(0)}%)`},l)},i=t==="lg";return d.jsxs("div",{className:i?"cost-bar cost-bar-lg":"cost-bar",role:"img","aria-label":"Cost breakdown",children:[s(e.input,"cb-input","input"),s(e.output,"cb-output","output"),s(e.cacheRead,"cb-cache-r","cache read"),s(e.cacheWrite,"cb-cache-w","cache write")]})}function x4({state:e,sessionId:t,onClose:n}){const s=k.useMemo(()=>b4(e,t),[e,t]),i=k.useRef(null),a=Sn(n,{focusRef:i});return s?d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:a,className:"modal session-summary",onClick:l=>l.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[d.jsxs("div",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),d.jsx("span",{id:"ss-title",className:"modal-tool-name",title:s.cwd??s.sessionId,children:s.label}),d.jsxs("span",{className:"modal-tool-id",children:["· ",s.sessionId.slice(0,8)]})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("span",{className:"modal-dur",title:"Total wall time",children:s.durationLabel}),d.jsx("button",{type:"button",ref:i,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),d.jsxs("div",{className:"modal-body",children:[d.jsxs("section",{className:"ss-hero",children:[d.jsxs("div",{className:"ss-hero-left",children:[d.jsx("div",{className:"ss-cost-label",children:ET}),d.jsx("div",{className:"ss-cost",children:tt(s.cost.total)}),s.modelChips.length>0&&d.jsx("div",{className:"ss-models",children:s.modelChips.map(l=>d.jsx("span",{className:"model-chip","data-family":Yu(l),title:l,children:$s(l)},l))})]}),d.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&d.jsxs(d.Fragment,{children:[d.jsx(qw,{cost:s.cost,size:"lg"}),d.jsxs("div",{className:"ss-cost-legend",children:[d.jsxs("span",{className:"ssl ssl-in",children:["input ",d.jsx("b",{children:tt(s.cost.input)})]}),d.jsxs("span",{className:"ssl ssl-out",children:["output ",d.jsx("b",{children:tt(s.cost.output)})]}),d.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",d.jsx("b",{children:tt(s.cost.cacheRead)})]}),d.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",d.jsx("b",{children:tt(s.cost.cacheWrite)})]})]})]})})]}),d.jsxs("section",{className:"ss-stats",children:[d.jsx(Ri,{label:"agents",value:s.agentCount}),d.jsx(Ri,{label:"subagents",value:s.subagentCount}),d.jsx(Ri,{label:"tool calls",value:s.toolCount}),d.jsx(Ri,{label:"prompts",value:s.promptCount}),d.jsx(Ri,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&d.jsx(Ri,{label:"errors",value:s.errCount,tone:"err"})]}),s.topTools.length>0&&d.jsxs("section",{className:"modal-section",children:[d.jsx("h4",{children:"Most-used tools"}),d.jsx("div",{className:"ss-top-tools",children:s.topTools.map(([l,u])=>d.jsxs("div",{className:"ss-tt",children:[d.jsx("span",{className:"ss-tt-name",children:l}),d.jsx("span",{className:"ss-tt-bar",children:d.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/s.topTools[0][1]*100}%`}})}),d.jsx("span",{className:"ss-tt-count",children:u})]},l))})]}),s.firstPrompt&&d.jsxs("section",{className:"modal-section",children:[d.jsx("h4",{children:"Opening prompt"}),d.jsx("div",{className:"ss-prompt",children:s.firstPrompt})]})]})]})}):null}function Ri({label:e,value:t,tone:n}){return d.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[d.jsx("div",{className:"ss-stat-value",children:t}),d.jsx("div",{className:"ss-stat-label",children:e})]})}function b4(e,t){const n=e.agents.get(t);if(!n)return null;const s=[];for(const C of e.agents.values())C.sessionId===t&&s.push(C);if(s.length===0)return null;const i={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},a=new Set,l=new Map;let u=0,h=0,p=0,f=0,g=0,v,w=1/0,E=0;for(const C of s){const j=kn(C);i.input+=j.input,i.output+=j.output,i.cacheRead+=j.cacheRead,i.cacheWrite+=j.cacheWrite,i.total+=j.total;for(const M of hT(C))a.add(M);C.model&&a.add(C.model),C.kind==="subagent"&&g++,h+=C.prompts.length,!v&&C.prompts.length>0&&(v=C.prompts[0].text),p+=C.usage.inputTokens+C.usage.outputTokens,u+=C.toolCount,w=Math.min(w,C.startedAt),E=Math.max(E,C.endedAt??Date.now());for(const M of C.tools)l.set(M.name,(l.get(M.name)??0)+1),M.ok===!1&&f++}const b=Math.max(0,E-w),S=Math.floor(b/1e3),_=S<60?`${S}s`:S<3600?`${Math.floor(S/60)}m ${String(S%60).padStart(2,"0")}s`:`${Math.floor(S/3600)}h ${Math.floor(S%3600/60)}m`,N=Array.from(l.entries()).sort((C,j)=>j[1]-C[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:_,cost:i,modelChips:Array.from(a),agentCount:s.length,subagentCount:g,toolCount:u,promptCount:h,tokensSum:p,errCount:f,topTools:N,firstPrompt:v}}function E1(e){return e.waiting?Ol(e.waiting)?0:1:e.state==="active"?2:3}function k4(e,t){const n=[];for(const s of e.agents.values()){if(s.kind!=="root")continue;let i=s.toolCount,a=kn(s).total,l=s.endedAt??s.startedAt;for(const u of e.agents.values()){if(u.sessionId!==s.sessionId||u.kind==="root")continue;i+=u.toolCount,a+=kn(u).total;const h=u.endedAt??u.startedAt;h>l&&(l=h)}n.push({sessionId:s.sessionId,label:s.label||s.cwdBasename||"session",cwdBasename:s.cwdBasename,state:s.state,waiting:s.waiting,modelId:s.model,toolCount:i,cost:a,startedAt:s.startedAt,lastActivity:l})}return n.sort((s,i)=>{const a=E1(s),l=E1(i);return a!==l?a-l:s.waiting&&i.waiting?s.waiting.since-i.waiting.since:i.lastActivity-s.lastActivity}),n}function C1(e,t,n){const s=(t??n)-e;if(s<1e3)return"<1s";const i=Math.floor(s/1e3);if(i<60)return`${i}s`;const a=Math.floor(i/60);return a<60?`${a}m`:`${Math.floor(a/60)}h ${a%60}m`}function _4({state:e,now:t,selectedIds:n,onSelect:s,onClose:i}){const a=k.useMemo(()=>k4(e),[e,e.revision,t]),l=a.filter(h=>h.state==="active").length,u=a.filter(h=>Ol(h.waiting)).length;return d.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[d.jsxs("div",{className:"sl-header",children:[d.jsxs("h2",{children:["Sessions ",d.jsx("span",{className:"sl-count",children:a.length})]}),u>0&&d.jsxs("span",{className:"sl-waiting-count",children:[u," waiting"]}),l>0&&d.jsxs("span",{className:"sl-live-count",children:[l," live"]}),d.jsx("button",{className:"glyph-btn sl-close",onClick:i,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),d.jsxs("div",{className:"sl-rows",children:[a.length===0&&d.jsx("div",{className:"sl-empty",children:"No sessions yet."}),a.map(h=>{const p=n.has(h.sessionId);return d.jsxs("button",{type:"button",className:`sl-row state-${h.state}${p?" selected":""}`,onClick:()=>s(h.sessionId),title:`Focus ${h.label}`,children:[d.jsx("span",{className:`sl-dot state-${h.state}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:Pu(h.state)}),d.jsxs("div",{className:"sl-row-body",children:[d.jsxs("div",{className:"sl-row-head",children:[d.jsx("span",{className:"sl-label",children:h.label}),h.modelId&&d.jsx("span",{className:"model-chip","data-family":Yu(h.modelId),title:h.modelId,children:$s(h.modelId)})]}),d.jsxs("div",{className:"sl-row-meta",children:[d.jsxs("span",{title:"tool calls",children:[d.jsx("b",{children:h.toolCount})," tools"]}),h.cost>0&&d.jsx("span",{className:"sl-cost",title:ET,children:d.jsx("b",{children:tt(h.cost)})}),h.waiting?d.jsxs("span",{className:"sl-waiting",title:[xl(h.waiting),b3(h.waiting,xl(h.waiting)),`Blocked since ${new Date(h.waiting.since).toLocaleTimeString()} · started ${new Date(h.startedAt).toLocaleString()}`].filter(Boolean).join(`
|
|
74
|
+
`),children:["waiting ",C1(h.waiting.since,void 0,t),h.waiting.tool&&d.jsxs("span",{className:"sl-waiting-tool",children:[" · ",h.waiting.tool.name]})]}):d.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:C1(h.startedAt,h.state==="active"?void 0:h.lastActivity,t)})]})]})]},h.sessionId)})]})]})}const S4=e=>1-Math.pow(1-e,5),CT=420;function N4(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||e===t)return!1;const n=Math.abs(t-e);if(n<1)return!1;const s=Math.max(Math.abs(e),Math.abs(t));return s===0||n/s>=.005}function E4(e,t,n,s=CT){return n>=s?t:n<=0?e:e+(t-e)*S4(n/s)}function C4(e,t,n,s={}){const i=s.now??(()=>performance.now()),a=s.raf??(w=>requestAnimationFrame(w)),l=s.cancel??(w=>cancelAnimationFrame(w)),u=s.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),h=s.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(u()||h()||!N4(e,t))return n(t),()=>{};const p=i();let f=0,g=!0;const v=()=>{if(!g)return;const w=i()-p;n(E4(e,t,w)),w<CT&&(f=a(v))};return f=a(v),()=>{g=!1,f&&l(f)}}const Zv={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function j1(e,t){const n=new Map;for(const s of e){if(s.kind!=="root"||!s.sessionId)continue;const i=kn(s,t);n.set(s.sessionId,{cost:i.total,inputTokens:s.usage.inputTokens,outputTokens:s.usage.outputTokens,cacheReadTokens:s.usage.cacheReadTokens,cacheCreateTokens:s.usage.cacheCreateTokens})}return n}function j4(e,t){if(!e)return Zv;const n={...Zv};for(const[s,i]of t){const a=e.get(s);if(!a)continue;const l={cost:i.cost-a.cost,inputTokens:i.inputTokens-a.inputTokens,outputTokens:i.outputTokens-a.outputTokens,cacheReadTokens:i.cacheReadTokens-a.cacheReadTokens,cacheCreateTokens:i.cacheCreateTokens-a.cacheCreateTokens};l.cost<0||l.inputTokens<0||l.outputTokens<0||l.cost===0&&l.inputTokens===0&&l.outputTokens===0&&l.cacheReadTokens===0&&l.cacheCreateTokens===0||(n.cost+=l.cost,n.inputTokens+=Math.max(0,l.inputTokens),n.outputTokens+=Math.max(0,l.outputTokens),n.cacheReadTokens+=Math.max(0,l.cacheReadTokens),n.cacheCreateTokens+=Math.max(0,l.cacheCreateTokens),n.sessions+=1)}return n}function Jv(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const Xu=[{key:"today",label:"today",noun:"today",hint:"Since midnight, on this machine's clock."},{key:"month",label:"month",noun:"this month",hint:"Since the 1st of this calendar month — not the last 30 days."},{key:"all",label:"all",noun:"all time",hint:"Every transcript on disk, back to 2020."}];function T4(e,t,n=Xu.length){return n<=0?null:e==="ArrowRight"||e==="ArrowDown"?(t+1)%n:e==="ArrowLeft"||e==="ArrowUp"?(t-1+n)%n:e==="Home"?0:e==="End"?n-1:null}function R4(e,t=new Date){return e==="today"?Jv(1,t):e==="month"?Jv(t.getDate(),t):"20200101"}const bn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,bu=e=>typeof e=="string"?e:"";function jT(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const s of t){const i=Array.isArray(s==null?void 0:s.modelBreakdowns)?s.modelBreakdowns:[];for(const a of i){const l=bu(a==null?void 0:a.modelName);if(!l)continue;let u=n.get(l);u||(u={model:l,cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,get tokens(){return this.inputTokens+this.outputTokens+this.cacheReadTokens+this.cacheCreateTokens}},n.set(l,u)),u.cost+=bn(a==null?void 0:a.cost),u.inputTokens+=bn(a==null?void 0:a.inputTokens),u.outputTokens+=bn(a==null?void 0:a.outputTokens),u.cacheReadTokens+=bn(a==null?void 0:a.cacheReadTokens),u.cacheCreateTokens+=bn(a==null?void 0:a.cacheCreationTokens)}}return[...n.values()].sort((s,i)=>i.cost-s.cost||i.tokens-s.tokens)}function A4(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const i of n){const a=bu(i==null?void 0:i.period);if(!a)continue;const l=i==null?void 0:i.metadata,u=typeof(l==null?void 0:l.lastActivity)=="string"?Date.parse(l.lastActivity):NaN;s.push({sessionId:a,label:t.get(a)??null,agent:bu(i==null?void 0:i.agent)||"claude",cost:bn(i==null?void 0:i.totalCost),tokens:bn(i==null?void 0:i.totalTokens),models:Array.isArray(i==null?void 0:i.modelsUsed)?i.modelsUsed.map(bu).filter(Boolean):[],lastActivityMs:Number.isFinite(u)?u:null})}return s.sort((i,a)=>a.cost-i.cost||a.tokens-i.tokens)}function TT(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const h=bn(t.cacheReadTokens),p=bn(t.cacheCreationTokens),f=bn(t.inputTokens),g=bn(t.outputTokens);return{cost:bn(t.totalCost),inputTokens:f,outputTokens:g,cacheReadTokens:h,cacheCreateTokens:p,tokens:bn(t.totalTokens)||f+g+h+p}}const n=jT(e),s=h=>n.reduce((p,f)=>p+h(f),0),i=s(h=>h.inputTokens),a=s(h=>h.outputTokens),l=s(h=>h.cacheReadTokens),u=s(h=>h.cacheCreateTokens);return{cost:s(h=>h.cost),inputTokens:i,outputTokens:a,cacheReadTokens:l,cacheCreateTokens:u,tokens:i+a+l+u}}function M4(e,t){return{data:(e==null?void 0:e.data)??null,shown:(e==null?void 0:e.period)??null,stale:e!=null&&e.period!==t,baseline:(e==null?void 0:e.baseline)??null}}function I4(e,t){var n;return((n=Xu.find(s=>s.key===(e??t)))==null?void 0:n.noun)??"today"}function O4(e,t,n){const s=e!=null,i=TT(e);return{fromRange:s,cost:s?i.cost+n.cost:t.cost.total,inputTokens:s?i.inputTokens+n.inputTokens:t.inputTokens,outputTokens:s?i.outputTokens+n.outputTokens:t.outputTokens,cacheReadTokens:s?i.cacheReadTokens+n.cacheReadTokens:t.cacheReadTokens,cacheCreateTokens:s?i.cacheCreateTokens+n.cacheCreateTokens:t.cacheCreateTokens,hasCost:s?i.cost>0:t.cost.total>0,tokenSum:s?i.tokens:t.sum,showCostBar:!s}}const P4="1",T1="agent-dag.schema",$4=["agent-dag.layout","agent-dag.viewport"];function Zi(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function L4(e,t=P4){let n=null;try{n=e.getItem(T1)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const i of $4)try{e.getItem(i)!==null&&(e.removeItem(i),s.push(i))}catch{}try{e.setItem(T1,t)}catch{}return s}const zt="ccdeck";function RT(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 ew(e){return RT(Math.floor(e/1e3))}function AT(e,t){const n=e-t;if(n<=0)return null;const s=Math.floor(n/86400),i=Math.floor(n%86400/3600),a=Math.floor(n%3600/60);return s>0?`${s}d ${i}h`:i>0?`${i}h ${a}m`:`${a}m`}function q4(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function D4(e,t,n){const s=new Date(e),i=ew(t-e);return{label:q4(s,new Date(t))?i:`${i} · ${s.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:s.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function MT(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function IT(e){return e==null}const tw="self";function lr(e,t=!1){const n=MT(e?tw:null,tw);return{disabled:t||n.disabled,"aria-busy":n.busy}}function cr(e){return IT(e?tw:null)}function F4(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function z4(e){return e==null||e==="BODY"||e==="HTML"}const OT="agent-dag.usagePeriod";function B4(){const e=Zi(OT);return Xu.some(t=>t.key===e)?e:"today"}function U4(e){if(!(typeof window>"u"))try{window.localStorage.setItem(OT,e)}catch{}}const PT="agent-dag.usageSessionsOpen";function W4(){return Zi(PT)==="1"}function H4(e){if(!(typeof window>"u"))try{window.localStorage.setItem(PT,e?"1":"0")}catch{}}function R1(e,t){if(!e)return null;const n=t-Math.floor(e/1e3);return n<10?"just now":n<60?`${n}s ago`:n<3600?`${Math.floor(n/60)}m ago`:`${Math.floor(n/3600)}h ago`}function G4(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 ah="__unknown__";function V4(e,t,n,s){const i=Math.max(0,t-s),a=Math.max(0,n-i);if(a<120)return null;const l=Math.min(100,a/n*100),u=e-l;if(Math.abs(u)<3)return{label:"on pace",color:"var(--ok)",expectedPct:l,isDeficit:!1};if(u>0){const h=100-e,p=a>0?e/a:0,f=p>0?h/p:1/0,g={label:`${Math.round(u)}% ahead`,color:"var(--warn)",expectedPct:l,isDeficit:!0};if(f<i&&f<86400){const v=Math.floor(f/3600),w=Math.floor(f%3600/60);g.runsOutIn=v>0?`${v}h ${w}m`:`${w}m`}return g}return{label:`${Math.round(-u)}% reserve`,color:"var(--ok)",expectedPct:l,isDeficit:!1}}function yo({pct:e,label:t,reset:n,resetAt:s,windowSec:i,limitReached:a,nowSec:l}){const u=Math.min(100,Math.max(0,e)),p=a||u>=90?"var(--err)":u>=70?"var(--warn)":"var(--accent)",f=u===0?"< 1%":`${u}%`,g=u===0?2:u,v=s?AT(s,l):null,w=s&&i?V4(u,s,i,l):null;return d.jsxs("div",{className:"qb-row",children:[d.jsxs("div",{className:"qb-meta",children:[d.jsxs("span",{className:"qb-label",children:[t,a&&d.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),d.jsx("span",{className:"qb-pct",style:{color:p},children:f})]}),d.jsxs("div",{className:"qb-track",children:[d.jsx("div",{className:"qb-fill",style:{width:`${g}%`,background:p,opacity:u===0?.4:1}}),w&&d.jsx("div",{className:"qb-pace-marker",style:{left:`${w.expectedPct}%`,background:w.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(w.expectedPct)}% by now`})]}),d.jsxs("div",{className:"qb-reset-row",children:[v?d.jsxs("span",{className:"qb-reset",children:["resets in ",v]}):n?d.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,w&&d.jsx("span",{className:"qb-pace",style:{color:w.color},children:w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label})]})]})}const Y4=6e4;function K4(e){const[t,n]=k.useState(null),[s,i]=k.useState(!1),a=k.useRef(null),l=k.useRef(!1),u=async(p=!1)=>{if(!(p&&!cr(l.current))){p&&(l.current=!0,i(!0));try{const g=await fetch(p?"/api/quota?refresh=1":"/api/quota");g.ok&&n(await g.json())}catch{}finally{p&&(l.current=!1,i(!1))}}};return k.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),Y4),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&u(!0)}}}function X4(e){switch(e){case"no_subscription":return"This install signs in with an API key (or Bedrock/Vertex), which is billed per token and has no session window.";case"rate_limited":return"Anthropic asked the deck to wait — it will retry on its own.";case"waiting":return"Waiting for the next allowed read — or click ↻.";default:return"Run /usage in a claude session, then click ↻"}}function Q4(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 $T=6e4,A1=6e4;function Z4(e){const[t,n]=k.useState(null),[s,i]=k.useState(!1),a=k.useRef(null),l=k.useRef(!1),u=async(p=!1)=>{if(!(p&&!cr(l.current))){p&&(l.current=!0,i(!0));try{const g=await fetch(p?"/api/codex-quota?refresh=1":"/api/codex-quota");g.ok&&n(await g.json())}catch{}finally{p&&(l.current=!1,i(!1))}}};return k.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),$T),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&u(!0)}}}function J4(e){const[t,n]=k.useState(null),s=k.useRef(null),i=async()=>{try{const a=await fetch("/api/codex-usage");a.ok&&n(await a.json())}catch{}};return k.useEffect(()=>{if(e)return i(),s.current=window.setInterval(i,$T),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function eq(e,t,n){const[s,i]=k.useState(null),[a,l]=k.useState(!1),[u,h]=k.useState(0),p=k.useRef(0);k.useEffect(()=>{const g=()=>document.visibilityState==="visible",v=()=>{g()&&h(b=>b+1)},w=window.setInterval(v,A1),E=()=>{g()&&Date.now()-p.current>=A1&&h(b=>b+1)};return document.addEventListener("visibilitychange",E),()=>{window.clearInterval(w),document.removeEventListener("visibilitychange",E)}},[]);const f=k.useRef(t);return k.useEffect(()=>{let g=!0;const v=t!==f.current;f.current=t;const w=e,E=R4(w);return l(!0),fetch(`/api/ccusage?since=${E}${v?"&refresh=1":""}`).then(b=>b.ok?b.json():null).then(b=>{!g||!(b!=null&&b.ok)||(p.current=Date.now(),i({period:w,data:b,baseline:n()}))}).catch(()=>{}).finally(()=>{g&&l(!1)}),()=>{g=!1}},[e,t,u]),{...M4(s,e),loading:a}}function tl(e){const[t,n]=k.useState(e),s=k.useRef(e),i=k.useRef(!0);return k.useEffect(()=>{s.current=t},[t]),k.useEffect(()=>{if(i.current){i.current=!1,s.current=e,n(e);return}return C4(s.current,e,l=>{s.current=l,n(l)})},[e]),t}function tq({state:e,now:t,providers:n,onClose:s}){var dt,lt;const{quota:i,loading:a,refresh:l}=K4(n.claude),{data:u,loading:h,refresh:p}=Z4(n.codex),{data:f}=J4(n.codex),[g,v]=k.useState(()=>Math.floor(Date.now()/1e3));k.useEffect(()=>{const pe=window.setInterval(()=>v(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(pe)},[]);const{byModel:w,totalCost:E,totalTokens:b,burnRate:S}=k.useMemo(()=>{const pe=new Map;for(const Ge of e.agents.values())for(const Ke of Il(Ge)){const se=Ke.model??ah,Pe=Iw(Ke.usage,Ke.model),$e=pe.get(se);$e?($e.inputTokens+=Ke.usage.inputTokens,$e.outputTokens+=Ke.usage.outputTokens,$e.cacheReadTokens+=Ke.usage.cacheReadTokens,$e.cacheCreateTokens+=Ke.usage.cacheCreateTokens,$e.cost.total+=Pe.total,$e.cost.input+=Pe.input,$e.cost.output+=Pe.output,$e.cost.cacheRead+=Pe.cacheRead,$e.cost.cacheWrite+=Pe.cacheWrite,$e.agentCount++):pe.set(se,{model:se,inputTokens:Ke.usage.inputTokens,outputTokens:Ke.usage.outputTokens,cacheReadTokens:Ke.usage.cacheReadTokens,cacheCreateTokens:Ke.usage.cacheCreateTokens,cost:{...Pe},agentCount:1,priced:Qi(Ke.model)!=null})}const me=Array.from(pe.values()).sort((Ge,Ke)=>Ke.cost.total-Ge.cost.total||Ke.inputTokens+Ke.outputTokens-(Ge.inputTokens+Ge.outputTokens));let Me=0,He=0;for(const Ge of e.agents.values()){if(Ge.state!=="active")continue;const Ke=kn(Ge);Me+=Ke.total,He=Math.max(He,((Ge.endedAt??t)-Ge.startedAt)/1e3)}const ct=He>0?Ow(Me,He):null,je=y4(e.agents.values());return{byModel:me,totalCost:je.cost,totalTokens:je,burnRate:ct}},[e,e.revision,t]),_=k.useMemo(()=>{const pe=[];for(const me of e.agents.values()){if(me.kind!=="root")continue;let Me=kn(me).total,He=me.usage.inputTokens,ct=me.usage.outputTokens,je=Kv(me);for(const Ge of e.agents.values())Ge.sessionId!==me.sessionId||Ge.kind==="root"||(Me+=kn(Ge).total,He+=Ge.usage.inputTokens,ct+=Ge.usage.outputTokens,je+=Kv(Ge));pe.push({sessionId:me.sessionId,label:me.label||me.cwdBasename||"session",state:me.state,cost:Me,inputTokens:He,outputTokens:ct,unpricedTokens:je})}return pe.sort((me,Me)=>Me.cost-me.cost||Me.inputTokens+Me.outputTokens-(me.inputTokens+me.outputTokens)).slice(0,12)},[e,e.revision]),[N,C]=k.useState(B4);k.useEffect(()=>{U4(N)},[N]);const[j,M]=k.useState(W4);k.useEffect(()=>{H4(j)},[j]);const P=k.useRef([]),[I,F]=k.useState(0),O=k.useRef(()=>new Map);O.current=()=>j1(e.agents.values(),t);const A=k.useCallback(()=>O.current(),[]),{data:L,shown:H,stale:X,baseline:R}=eq(N,I,A),K=L!=null,G=k.useMemo(()=>{const pe=new Map;for(const me of e.agents.values()){if(me.kind!=="root"||!me.sessionId)continue;const Me=me.label||me.cwdBasename;Me&&pe.set(me.sessionId,Me)}return pe},[e,e.revision]),ne=k.useMemo(()=>{const pe=new Map;for(const me of e.agents.values())me.kind!=="root"||!me.sessionId||pe.set(me.sessionId,me.state);return pe},[e,e.revision]),Q=k.useMemo(()=>K?jT(L):[],[L,K]),W=k.useMemo(()=>{if(!K)return[];const pe=A4(L,G).slice(0,12),me=new Map;for(const Me of pe)Me.label&&me.set(Me.label,(me.get(Me.label)??0)+1);return pe.map(Me=>Me.label&&(me.get(Me.label)??0)>1?{...Me,label:`${Me.label} ${Me.sessionId.slice(0,4)}`}:Me)},[L,K,G]),ee=k.useMemo(()=>TT(L),[L]),$=I4(H,N),Y=X?" up-stale":"",ue=k.useMemo(()=>K?j4(R,j1(e.agents.values(),t)):Zv,[e,e.revision,R,K,t]),z=O4(L,{...b,cost:E},ue),D=z.hasCost,J=z.tokenSum,V=tl(z.cost),ae=tl(z.inputTokens),he=tl(z.outputTokens),ye=tl(z.cacheReadTokens),_e=tl(z.cacheCreateTokens),Ve=w.filter(pe=>pe.cost.total>0||pe.inputTokens+pe.outputTokens>0),Be=_.filter(pe=>pe.cost>0||pe.inputTokens+pe.outputTokens>0),qe=K?Q.some(pe=>pe.cost<=0&&pe.tokens>0):Ve.some(pe=>!pe.priced),Se=a||h,ce=R1(i==null?void 0:i.fetchedAt,g),be=R1(u==null?void 0:u.fetchedAt,g),ke=()=>{l(),p(),F(pe=>pe+1)},Ye=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return d.jsxs("aside",{className:"usage-panel",id:"usage-panel","aria-label":"Usage",children:[d.jsxs("div",{className:"up-header",children:[d.jsx("h2",{children:"Usage"}),S&&d.jsx("span",{className:"up-rate",children:S}),d.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&d.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:ke,...lr(Se),"aria-label":Ye,title:Ye,children:Se?"…":"↻"}),d.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:s,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&d.jsxs("section",{className:"up-section up-quota-section",children:[d.jsxs("h3",{className:"up-section-title",children:["Claude quota",ce&&!a&&d.jsx("span",{className:"up-section-age",title:G4(i==null?void 0:i.source),children:ce})]}),i!=null&&i.ok?d.jsxs("div",{className:"up-quota-bars",children:[i.session5hPct!=null&&d.jsx(yo,{label:"5-hour window",pct:i.session5hPct,reset:i.session5hReset,resetAt:i.session5hResetAt,windowSec:i.session5hWindowSec,nowSec:g}),i.week7dPct!=null&&d.jsx(yo,{label:"7-day window",pct:i.week7dPct,reset:i.week7dReset,resetAt:i.week7dResetAt,windowSec:i.week7dWindowSec,nowSec:g}),i.weekSonnetPct!=null&&d.jsx(yo,{label:"Sonnet (7d)",pct:i.weekSonnetPct,nowSec:g}),i.weekOpusPct!=null&&d.jsx(yo,{label:"Opus (7d)",pct:i.weekOpusPct,nowSec:g})]}):(i==null?void 0:i.ok)===!1?d.jsxs("div",{className:"up-quota-na",children:[d.jsx("span",{children:i.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),d.jsx("span",{className:"up-quota-hint",children:X4(i.reason)})]}):d.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&d.jsxs("section",{className:"up-section up-quota-section",children:[d.jsxs("h3",{className:"up-section-title",children:["Codex quota",(u==null?void 0:u.ok)&&u.planLabel&&d.jsx("span",{className:"up-plan-badge",children:u.planLabel}),be&&!h&&d.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:be})]}),u!=null&&u.ok?d.jsxs("div",{className:"up-quota-bars",children:[(dt=u.windows)==null?void 0:dt.map(pe=>d.jsx(yo,{label:pe.label,pct:pe.pct,reset:pe.reset??void 0,resetAt:pe.resetAt??void 0,windowSec:pe.windowSec??void 0,limitReached:u.limitReached&&pe.pct>=100,nowSec:g},pe.id)),(lt=u.extraWindows)==null?void 0:lt.map(pe=>d.jsx(yo,{label:pe.label,pct:pe.pct,reset:pe.reset??void 0,resetAt:pe.resetAt??void 0,windowSec:pe.windowSec??void 0,nowSec:g},pe.id)),u.creditLimit&&d.jsx(yo,{label:`spend cap · $${Math.round(u.creditLimit.used)} of $${Math.round(u.creditLimit.limit)}`,pct:u.creditLimit.usedPct,reset:u.creditLimit.reset??void 0,resetAt:u.creditLimit.resetAt??void 0,limitReached:u.spendControlReached,nowSec:g}),u.creditsBalance&&!u.creditsUnlimited&&d.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",u.creditsBalance,u.overageReached&&" · overage limit reached"]}),u.creditsUnlimited&&d.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),u.resetCredits&&u.resetCredits.availableCount>0&&d.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${zt} only reports them`,children:[u.resetCredits.availableCount," rate-limit reset",u.resetCredits.availableCount!==1?"s":""," available",u.resetCredits.nextExpiryAt&&` · expires ${new Date(u.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),u.promo&&d.jsx("div",{className:"up-quota-sub",children:u.promo}),u.partial&&d.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(u==null?void 0:u.ok)===!1?d.jsxs("div",{className:"up-quota-na",children:[d.jsx("span",{children:"Quota unavailable."}),d.jsx("span",{className:"up-quota-hint",children:Q4(u.reason)})]}):d.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(f==null?void 0:f.ok)&&f.window7d&&f.window7d.sessionCount>0&&d.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${f.window5h?`
|
|
75
|
+
last 5h: ${At(f.window5h.totalTokens)} tokens · ${f.window5h.sessionCount} session${f.window5h.sessionCount!==1?"s":""}`:""}`,children:[At(f.window7d.totalTokens)," tokens · ",f.window7d.sessionCount," session",f.window7d.sessionCount!==1?"s":""," (7d)"]})]}),K&&d.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period",onKeyDown:pe=>{var He;const me=P.current.indexOf(pe.target);if(me<0)return;const Me=T4(pe.key,me);Me!==null&&(pe.preventDefault(),(He=P.current[Me])==null||He.focus())},children:Xu.map((pe,me)=>d.jsx("button",{type:"button",ref:Me=>{P.current[me]=Me},tabIndex:N===pe.key?0:-1,"aria-pressed":N===pe.key,title:pe.hint,className:"uh-range-btn",onClick:()=>C(pe.key),children:pe.label},pe.key))}),J>0?d.jsxs(d.Fragment,{children:[D&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:`up-total${Y}`,title:K?void 0:N1,children:[d.jsx("span",{className:"up-total-value",children:tt(V)}),d.jsx("span",{className:"up-total-label",children:K?$:v4})]}),z.showCostBar&&d.jsx(qw,{cost:E})]}),d.jsxs("div",{className:`up-tokens-row${Y}`,title:K?void 0:N1,children:[d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"in"}),At(ae)]}),d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"out"}),At(he)]}),z.cacheReadTokens>0&&d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"cache r"}),At(ye)]}),z.cacheCreateTokens>0&&d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"cache c"}),At(_e)]}),!D&&d.jsx("span",{className:"up-tok up-scope",children:w4})]}),(K?Q.length:Ve.length)>0&&d.jsxs("section",{className:`up-section${Y}`,children:[d.jsx("h3",{className:"up-section-title",children:"By model"}),d.jsxs("table",{className:"up-table",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{children:"Model"}),d.jsx("th",{children:"Tokens"}),d.jsx("th",{children:"Cost"})]})}),d.jsx("tbody",{children:K?Q.map(pe=>d.jsxs("tr",{children:[d.jsx("td",{className:"up-model-name",title:pe.model,children:$s(pe.model)}),d.jsx("td",{className:"up-num",children:At(pe.tokens)}),pe.cost>0?d.jsx("td",{className:"up-num up-cost-val",children:tt(pe.cost)}):d.jsx("td",{className:"up-num up-unpriced",children:Ii})]},pe.model)):Ve.map(pe=>d.jsxs("tr",{children:[d.jsx("td",{className:"up-model-name",title:pe.model===ah?"no model reported yet":pe.model,children:pe.model===ah?"unknown":$s(pe.model)}),d.jsx("td",{className:"up-num",children:At(pe.inputTokens+pe.outputTokens)}),pe.priced?d.jsx("td",{className:"up-num up-cost-val",children:tt(pe.cost.total)}):d.jsx("td",{className:"up-num up-unpriced",children:Ii})]},pe.model))})]})]}),K&&W.length===0&&ee.tokens>0&&d.jsxs("section",{className:"up-section",children:[d.jsx("h3",{className:"up-section-title",children:"By session"}),d.jsxs("div",{className:"up-hint",children:["No session is dated ",$," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(K?W.length:Be.length)>0&&(()=>{const pe=K?W.length:Be.length;return d.jsxs("section",{className:`up-section${Y}`,children:[d.jsx("h3",{className:"up-section-title",children:d.jsxs("button",{type:"button",className:"up-disclose","aria-expanded":j,"aria-controls":"up-sessions",title:j?"Hide the per-session breakdown":`Show the per-session breakdown — ${pe} session${pe===1?"":"s"}`,onClick:()=>M(me=>!me),children:["By session",K&&d.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${$}, each showing what that session has cost since it started.
|
|
76
76
|
A session that began earlier brings its whole total with it, so these rows can add up to more than the figure above.`,children:["active ",$]}),d.jsx("svg",{className:"up-chev",width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:d.jsx("path",{d:"M2.2 3.6 5 6.4 7.8 3.6"})})]})}),d.jsxs("div",{className:"up-sessions",id:"up-sessions",hidden:!j,children:[K&&W.map(me=>{const Me=ne.get(me.sessionId);return d.jsxs("div",{className:"up-session-row",children:[Me?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:`sl-dot state-${Me}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:Pu(Me)})]}):d.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),d.jsx("span",{className:`up-session-label${me.label?"":" up-session-id"}`,title:me.label?`${me.label}
|
|
77
|
-
${me.sessionId}`:me.sessionId,children:me.label??me.sessionId.slice(0,8)}),d.jsx("span",{className:"up-session-tokens",children:At(me.tokens)}),me.cost>0?d.jsx("span",{className:"up-session-cost",title:me.models.join(", ")||void 0,children:tt(me.cost)}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Mi})]},me.sessionId)}),!K&&Be.map(me=>d.jsxs("div",{className:"up-session-row",children:[d.jsx("span",{className:`sl-dot state-${me.state}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:Pu(me.state)}),d.jsx("span",{className:"up-session-label",children:me.label}),d.jsx("span",{className:"up-session-tokens",children:At(me.inputTokens+me.outputTokens)}),me.cost>0?d.jsxs("span",{className:"up-session-cost",title:me.unpricedTokens>0?`${At(me.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[tt(me.cost),me.unpricedTokens>0?"+":""]}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Mi})]},me.sessionId))]})]})})(),qe&&d.jsxs("div",{className:"up-hint",children:["“",Mi,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):d.jsx("div",{className:"up-empty",children:K?d.jsxs(d.Fragment,{children:["No usage ",$,".",d.jsx("br",{}),"Try a longer period."]}):d.jsxs(d.Fragment,{children:["No usage data yet.",d.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}const vt={l:30,r:6,t:6,b:2},Qu=104,n4=64;function vo(e,t=100,n=Qu){const s=n-vt.t-vt.b;return vt.t+s*(1-Math.max(0,Math.min(t,e))/t)}function r4(e,t,n,s=100,i=Qu){if(!e.length)return"";const a=e[e.length-1].t-e[0].t,l=p=>{const f=t-vt.l-vt.r;return vt.l+(a>0?f*(p-e[0].t)/a:f/2)};let u="",h=null;for(const p of e){const f=h&&p.t-h.t<=n*2?"L":"M";u+=`${f}${l(p.t).toFixed(1)} ${vo(p.v,s,i).toFixed(1)}`,h=p}return u}function s4(e,t,n,s=100,i=Qu){if(e.length<2)return"";const a=i-vt.b,l=e[e.length-1].t-e[0].t,u=t-vt.l-vt.r,h=v=>vt.l+(l>0?u*(v-e[0].t)/l:u/2);let p="",f=[];const g=()=>{if(f.length>=2){let v=`M${h(f[0].t).toFixed(1)} ${a}`;for(const w of f)v+=`L${h(w.t).toFixed(1)} ${vo(w.v,s,i).toFixed(1)}`;p+=`${v}L${h(f[f.length-1].t).toFixed(1)} ${a}Z`}f=[]};for(const v of e)f.length&&v.t-f[f.length-1].t>n*2&&g(),f.push(v);return g(),p}function o4(e){return e.length?{now:e[e.length-1].v,peak:e.reduce((t,n)=>Math.max(t,n.v),e[0].v)}:{now:null,peak:null}}function i4(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function a4(e,t,n=s=>dl(s)){const s=e.filter(l=>l.v>0);if(!e.length)return null;if(!s.length)return"never held back";const i=s.length*(t/6e4),a=s[s.length-1];return`held back for ${i===1?"1 minute":`${i} minutes`}, last at ${n(a.t)}`}function dl(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function LT(e,t){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<1)return"less than a minute";if(n<60)return`${n} minute${n===1?"":"s"}`;const s=Math.floor(n/60),i=n%60;return i?`${s}h ${i}m`:`${s}h`}function l4({group:e,title:t,onClose:n}){const s=Sn(n),[i,a]=k.useState(null);k.useEffect(()=>{let p=!0;const f=async()=>{try{const v=await fetch(`/api/system/history?group=${e}`);if(!v.ok)return;const w=await v.json();p&&(w!=null&&w.ok)&&a(w)}catch{}};f();const g=window.setInterval(f,2e4);return()=>{p=!1,window.clearInterval(g)}},[e]);const l=(i==null?void 0:i.series)??[],[u,h]=k.useMemo(()=>{let p=1/0,f=0;for(const g of l)g.points.length&&(p=Math.min(p,g.points[0].t),f=Math.max(f,g.points[g.points.length-1].t));return[Number.isFinite(p)?Math.max(p,(i==null?void 0:i.sinceMs)??0):(i==null?void 0:i.sinceMs)??0,f]},[l,i==null?void 0:i.sinceMs]);return ww.createPortal(d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:s,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[d.jsxs("div",{className:"modal-head",children:[d.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),i&&u>0&&d.jsxs("span",{className:"hist-since",children:["since ",dl(u)," · ",LT(u,h||Date.now())]}),d.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),d.jsx("div",{className:"hist-body",children:i==null?d.jsx("p",{className:"hist-empty",children:"Reading…"}):l.length===0?d.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):l.map(p=>d.jsx(c4,{series:p,stepMs:i.stepMs},p.label))})]})}),document.body)}function c4({series:e,stepMs:t}){const n=k.useRef(null),[s,i]=k.useState(560),[a,l]=k.useState(null);k.useEffect(()=>{const I=n.current;if(!I||typeof ResizeObserver>"u")return;const F=new ResizeObserver(([O])=>i(Math.max(160,O.contentRect.width)));return F.observe(I),()=>F.disconnect()},[]);const{points:u,unit:h,warnAt:p,critAt:f,label:g,top:v,restsAtZero:w}=e,E=w?n4:Qu,{now:b,peak:S}=o4(u),_=h==="C"?"°C":h,N=g==="Throttling"?a4(u,t):null,C=a!=null?u[a]:null,j=u.length>1?u[u.length-1].t-u[0].t:0,M=I=>{const F=s-vt.l-vt.r;return vt.l+(j>0?F*(I-u[0].t)/j:F/2)},P=I=>{if(u.length<2)return;const F=I.currentTarget.getBoundingClientRect(),O=(I.clientX-F.left-vt.l)/Math.max(1,F.width-vt.l-vt.r),A=u[0].t+j*Math.max(0,Math.min(1,O));let L=0;for(let H=1;H<u.length;H++)Math.abs(u[H].t-A)<Math.abs(u[L].t-A)&&(L=H);l(L)};return d.jsxs("section",{className:"hist-series","aria-label":`${g} history`,children:[d.jsxs("div",{className:"hist-head",children:[d.jsx("span",{className:"hist-label",children:g}),d.jsxs("span",{className:"hist-stats",children:[b!=null&&d.jsxs(d.Fragment,{children:[d.jsx("b",{children:b}),d.jsxs("span",{children:[_," now"]})]}),S!=null&&d.jsxs(d.Fragment,{children:[d.jsx("b",{className:i4(S,p,f),children:S}),d.jsxs("span",{children:[_," peak"]})]})]})]}),d.jsx("div",{className:"hist-plot",ref:n,children:d.jsxs("svg",{className:"hist-chart",width:"100%",height:E,viewBox:`0 0 ${s} ${E}`,preserveAspectRatio:"none",role:"img","aria-label":b==null?`${g}: nothing measured yet`:`${g}: ${b}${_} now, peak ${S}${_}, over ${LT(u[0].t,u[u.length-1].t)}`,onPointerMove:P,onPointerLeave:()=>l(null),children:[[["warn",p],["hot",f]].map(([I,F])=>F==null||F>v?null:d.jsxs("g",{children:[d.jsx("line",{className:`hist-rule ${I}`,x1:vt.l,x2:s-vt.r,y1:vo(F,v,E),y2:vo(F,v,E)}),d.jsx("text",{className:`hist-rule-tag ${I}`,x:2,y:vo(F,v,E)+3,children:F})]},I)),d.jsx("line",{className:"hist-floor",x1:vt.l,x2:s-vt.r,y1:E-vt.b,y2:E-vt.b}),d.jsx("path",{className:"hist-area",d:s4(u,s,t,v,E)}),d.jsx("path",{className:"hist-line",d:r4(u,s,t,v,E)}),u.length===1&&d.jsx("circle",{className:"hist-dot",cx:M(u[0].t),cy:vo(u[0].v,v,E),r:3}),C&&d.jsxs("g",{children:[d.jsx("line",{className:"hist-cross",x1:M(C.t),x2:M(C.t),y1:vt.t,y2:E-vt.b}),d.jsx("circle",{className:"hist-dot",cx:M(C.t),cy:vo(C.v,v,E),r:3})]})]})}),d.jsx("div",{className:"hist-axis",children:C?d.jsxs("span",{className:"hist-at",children:[dl(C.t)," — ",d.jsx("b",{children:C.v}),_]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:u.length?dl(u[0].t):""}),d.jsx("span",{children:u.length?dl(u[u.length-1].t):""})]})}),N&&d.jsx("div",{className:"hist-note",children:N})]})}function u4({procs:e,total:t,onClose:n}){const s=Sn(n),[i,a]=k.useState(qT),l=nw(e,i);return ww.createPortal(d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:s,className:"modal pl-modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[d.jsxs("div",{className:"modal-head",children:[d.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),d.jsxs("span",{className:"pl-count",children:[l.length," of ",t," running"]}),d.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),d.jsx("div",{className:"pl-body",children:l.length===0?d.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):d.jsxs("table",{className:"sd-procs pl-table",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx(Fi,{col:"cpu",label:"cpu",sort:i,onSort:a}),d.jsx(Fi,{col:"mem",label:"mem",sort:i,onSort:a}),d.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),d.jsx(Fi,{col:"name",label:"process",sort:i,onSort:a})]})}),d.jsx("tbody",{children:l.map(u=>d.jsxs("tr",{children:[d.jsx("td",{className:"sd-num",children:u.cpu==null?"—":u.cpu.toFixed(0)}),d.jsx("td",{className:"sd-num sd-dim",children:u.mem.toFixed(1)}),d.jsx("td",{className:"sd-num sd-dim pl-pid",children:u.pid}),d.jsx("td",{className:"pl-name",children:u.name})]},u.pid))})]})}),d.jsx("div",{className:"pl-foot",children:"The busiest by processor and by memory, refreshed every four seconds. Not every process on the machine."})]})}),document.body)}const d4=3e3,f4=4e3,lh=20,nl=36,Ri=8,h4=8,qT={key:"cpu",dir:"desc",rank:"cpu"};function p4(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"?"asc":"desc",rank:t==="name"?e.rank:t}}function nw(e,t){const n=t.dir==="asc"?1:-1,s=(i,a)=>{if(t.key==="name")return n*i.name.localeCompare(a.name,void 0,{sensitivity:"base"});const l=t.key==="cpu"?i.cpu:i.mem,u=t.key==="cpu"?a.cpu:a.mem;return l==null||u==null?l==null?u==null?0:1:-1:n*(l-u)};return[...e].sort((i,a)=>s(i,a)||(a.cpu??-1)-(i.cpu??-1)||a.mem-i.mem||i.pid-a.pid)}function m4(e,t,n=h4){const s=nw(e,{key:t.rank,dir:"desc",rank:t.rank});return nw(s.slice(0,n),t)}function g4(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}function y4(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function v4(e,t,n=Date.now()){const s=Math.max(0,Math.min(100,100-e));return{pct:s,value:`${s}%`,tone:s===0?"calm":s>=30?"hot":"warn",note:s>0?`CPU held to ${e}% of full speed to cool down`:t?`at full speed · held to ${100-t.peak}% ${w4(t.lastMs,n)}`:"running at full speed, and never held back"}}function w4(e,t=Date.now()){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<2)return"just now";if(n<60)return`${n} minutes ago`;const s=Math.floor(n/60);return s===1?"an hour ago":`${s} hours ago`}const DT="agent-dag.systemPanelOpen";function x4(){return Zi(DT)==="1"}function b4(e){if(!(typeof window>"u"))try{window.localStorage.setItem(DT,e?"1":"0")}catch{}}function wo(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 k4(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),s=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${s}m`:`${s}m`}function _4(){const[e,t]=k.useState(null),n=k.useRef(null);return k.useEffect(()=>{let s=!0;const i=async()=>{if(document.visibilityState!=="hidden")try{const h=await fetch("/api/system");if(!h.ok)return;const p=await h.json();s&&(p!=null&&p.ok)&&t(p)}catch{}},a=()=>{n.current==null&&(i(),n.current=window.setInterval(i,d4))},l=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},u=()=>{if(document.visibilityState==="hidden"){l();return}a(),i()};return a(),document.addEventListener("visibilitychange",u),()=>{s=!1,l(),document.removeEventListener("visibilitychange",u)}},[]),e}function S4(e){const[t,n]=k.useState(null);return k.useEffect(()=>{let s=!0;const i=async()=>{if(document.visibilityState!=="hidden")try{const l=await fetch("/api/system/processes");if(!l.ok)return;const u=await l.json();s&&(u!=null&&u.ok)&&n({procs:u.procs??[],total:u.total??0})}catch{}};i();const a=window.setInterval(i,f4);return()=>{s=!1,window.clearInterval(a)}},[e]),t}function N4({usageOpen:e=!1}){const t=_4(),[n,s]=k.useState(x4);k.useEffect(()=>{b4(n)},[n]);const i=k.useRef(null),a=k.useRef(null);if(k.useEffect(()=>{if(n)return Di.push(()=>{var _,N;const S=((_=a.current)==null?void 0:_.contains(document.activeElement))??!1;s(!1),S&&((N=i.current)==null||N.focus())},vT)},[n]),!t||t.cpu==null||!t.memory)return d.jsx("span",{className:"sysmeter idle",title:"Sampling this machine…",children:d.jsx("span",{className:"sm-box","aria-hidden":!0,children:d.jsxs("span",{className:"sm-graphic",children:[d.jsx("svg",{className:"sm-spark",width:nl,height:Ri,viewBox:`0 0 ${nl} ${Ri}`}),d.jsx("span",{className:"sm-ram"})]})})});const{cpu:l,cpuHistory:u,cores:h,memory:p,loadavg:f}=t,g=p.usedPct>=90,v=u.slice(-lh),w=lh-v.length,E=nl/lh,b=[`CPU ${l.toFixed(0)}% of ${h} cores`,f?`load ${f[0]} · ${f[1]} · ${f[2]} (1m · 5m · 15m)`:null,`Memory ${wo(p.total-p.available)} of ${wo(p.total)} used`,"","Click for detail. This machine, not this session."].filter(S=>S!==null).join(`
|
|
78
|
-
`);return d.jsxs("span",{className:"sysmeter-wrap",children:[d.jsxs("button",{type:"button",ref:i,className:"sysmeter",title:b,"aria-label":"Toggle machine detail","aria-expanded":n,"aria-controls":n?"system-panel":void 0,onClick:()=>s(S=>!S),children:[d.jsxs("span",{className:"sm-box","aria-hidden":!0,children:[d.jsxs("span",{className:"sm-graphic",children:[d.jsx("svg",{className:"sm-spark",width:nl,height:Ri,viewBox:`0 0 ${nl} ${Ri}`,children:v.map((S,_)=>{const N=w+_,C=Math.max(1,S/100*Ri),j=.32+.68*((_+1)/v.length);return d.jsx("rect",{x:N*E,y:Ri-C,width:Math.max(.8,E-.7),height:C,rx:.5,fill:"var(--accent)",opacity:j},N)})}),d.jsx("span",{className:"sm-ram",children:d.jsx("span",{className:`sm-ram-fill${g?" warn":""}`,style:{transform:`scaleX(${Math.max(2,p.usedPct)/100})`}})})]}),d.jsxs("span",{className:"sm-read",children:[d.jsx("b",{children:l.toFixed(0)}),d.jsx("i",{children:"·"}),d.jsx("b",{children:p.usedPct.toFixed(0)})]})]}),d.jsxs("span",{className:"sm-sr",children:["CPU ",l.toFixed(0)," percent, memory ",p.usedPct.toFixed(0)," percent used"]})]}),n&&d.jsx(E4,{sys:t,usageOpen:e,panelRef:a,onClose:()=>{var S;s(!1),(S=i.current)==null||S.focus()}})]})}function E4({sys:e,usageOpen:t,panelRef:n,onClose:s}){const i=S4(!0),{memory:a,swap:l,perCore:u,loadavg:h,cores:p,uptimeSec:f,platform:g,thermal:v}=e,w=a?a.total-a.available:0,E=g==="win32"?"Commit":"Swap",b=l&&l.total>0?l.used/l.total*100:0;return d.jsxs("aside",{ref:n,className:`sysdetail${t?" shifted":""}`,id:"system-panel","aria-label":"Machine detail",children:[d.jsxs("div",{className:"sd-head",children:[d.jsx("span",{className:"sd-title",children:"This machine"}),d.jsxs("span",{className:"sd-sub",children:["up ",k4(f)," · ",p," cores"]}),d.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:s,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),u&&u.length>0&&d.jsx("div",{className:"sd-section",role:"group","aria-label":"Cores",children:d.jsx(ku,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:d.jsx("div",{className:"sd-cores",style:{"--n":u.length},children:u.map((S,_)=>d.jsx("span",{className:"sd-core",title:`core ${_+1}: ${S}%`,children:d.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,S)/100})`}})},_))})})}),d.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:d.jsxs(ku,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[a&&d.jsx($u,{label:"Physical",value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:wo(w)})," of ",wo(a.total)]}),pct:a.usedPct,tone:a.usedPct>=90?"warn":"calm",note:`${wo(a.available)} available`}),l&&l.total>0&&d.jsx($u,{label:E,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:wo(l.used)})," of ",wo(l.total)]}),pct:b,tone:b>=90?"warn":"calm",note:b>=50?"paging to disk":void 0})]})}),h&&d.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:d.jsxs(ku,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[d.jsx("div",{className:"sd-load",children:h.map((S,_)=>d.jsxs("span",{className:`sd-load-item${S>p?" over":""}`,children:[d.jsx("b",{children:S.toFixed(2)}),d.jsx("span",{children:["1m","5m","15m"][_]})]},_))}),d.jsx("div",{className:"sd-note",children:h[0]>p?`${(h[0]/p).toFixed(1)}× more work queued than cores to run it`:`within ${p} cores`})]})}),d.jsx(C4,{thermal:v}),d.jsx(j4,{read:i})]})}function ku({group:e,title:t,action:n,label:s,children:i}){const[a,l]=k.useState(!1);return d.jsxs(d.Fragment,{children:[d.jsxs("button",{type:"button",className:"sd-open",onClick:()=>l(!0),title:n,"aria-label":n,children:[d.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[s," ",d.jsx("i",{className:"sd-row-more",children:"›"})]}),i]}),a&&d.jsx(l4,{group:e,title:t,onClose:()=>l(!1)})]})}function C4({thermal:e}){if(!e)return null;const t=e.throttle?v4(e.throttle.speedLimit,e.heldBack):null;return d.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:d.jsxs(ku,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>d.jsx($u,{label:n.label,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:y4(n.celsius,n.warnAt,n.critAt)},n.label)),t&&d.jsx($u,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function j4({read:e}){const[t,n]=k.useState(qT),[s,i]=k.useState(!1),a=(e==null?void 0:e.procs)??null;return d.jsxs("div",{className:"sd-section",role:"group","aria-label":"Busiest processes",children:[d.jsxs("div",{className:"sd-hrow",children:[d.jsx("div",{className:"sd-h","aria-hidden":!0,children:"Busiest processes"}),a!=null&&a.length>0&&d.jsxs("button",{type:"button",className:"sd-all",onClick:()=>i(!0),title:"Show every process the deck is watching","aria-label":"Show every process the deck is watching",children:["more ",d.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]})]}),s&&e&&d.jsx(u4,{procs:e.procs,total:e.total,onClose:()=>i(!1)}),a==null?d.jsx("div",{className:"sd-note",children:"reading…"}):a.length===0?d.jsx("div",{className:"sd-note",children:"Could not read the process list on this platform."}):d.jsxs("table",{className:"sd-procs",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx(Fi,{col:"cpu",label:"cpu",sort:t,onSort:n}),d.jsx(Fi,{col:"mem",label:"mem",sort:t,onSort:n}),d.jsx(Fi,{col:"name",label:"process",sort:t,onSort:n})]})}),d.jsx("tbody",{children:m4(a,t).map(l=>d.jsxs("tr",{children:[d.jsx("td",{className:"sd-num",children:l.cpu==null?"—":l.cpu.toFixed(0)}),d.jsx("td",{className:"sd-num sd-dim",children:l.mem.toFixed(1)}),d.jsx("td",{className:"sd-proc-name",title:`pid ${l.pid}`,children:l.name})]},l.pid))})]})]})}function Fi({col:e,label:t,sort:n,onSort:s}){const i=g4(n,e);return d.jsx("th",{scope:"col","aria-sort":i,children:d.jsxs("button",{type:"button",className:"sd-sort",title:`Sort by ${t}`,onClick:()=>s(p4(n,e)),children:[t,d.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}function $u({label:e,value:t,pct:n,tone:s="calm",note:i}){return d.jsxs("div",{className:"sd-row",children:[d.jsxs("div",{className:"sd-row-head",children:[d.jsx("span",{className:"sd-row-label",children:e}),d.jsx("span",{className:"sd-row-val",children:t})]}),d.jsx("span",{className:"sd-track",children:d.jsx("span",{className:`sd-fill${s==="calm"?"":` ${s}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}})}),i&&d.jsx("div",{className:"sd-note",children:i})]})}const M1=18,T4=1100,Ai=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},R4=Array.from({length:M1},(e,t)=>{const n=-72+144*t/(M1-1)+(Ai(t,1)-.5)*9,s=(n-90)*(Math.PI/180),i=(54+32*Math.cos(n*Math.PI/180))*(.74+Ai(t,2)*.52);return{dx:Math.cos(s)*i,dy:Math.sin(s)*i,rot:(t%2?1:-1)*(100+Ai(t,3)*260),delay:Math.round(Ai(t,4)*90),dur:760+Math.round(Ai(t,5)*260),scale:.8+Ai(t,6)*.45,hue:t%4,round:t%3===0}});function I1({anchor:e}){var i;const[t,n]=k.useState(null),s=typeof window<"u"&&((i=window.matchMedia)==null?void 0:i.call(window,"(prefers-reduced-motion: reduce)").matches);return k.useEffect(()=>{if(s)return;const a=e.current;if(!a)return;const l=a.getBoundingClientRect();n({x:l.left+l.width/2,y:l.top+l.height/2});const u=window.setTimeout(()=>n(null),T4);return()=>window.clearTimeout(u)},[e,s]),s||!t?null:ww.createPortal(d.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:R4.map((a,l)=>d.jsx("span",{className:`confetti-bit${a.round?" round":""}`,"data-hue":a.hue,style:{"--dx":`${a.dx.toFixed(1)}px`,"--dy":`${a.dy.toFixed(1)}px`,"--rot":`${a.rot}deg`,"--s":a.scale.toFixed(2),animationDelay:`${a.delay}ms`,animationDuration:`${a.dur}ms, ${a.dur}ms`}},l))}),document.body)}const FT=new Set(["awaiting_url","awaiting_code","registering"]);function A4(e){return e!=null&&FT.has(e)}function zT(e){return e!=null&&e!=="done"&&!FT.has(e)}const M4="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",I4="the sign-in did not complete";function O4({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?M4:I4)}}const P4="done";function $4(){let e=!1;return{shouldAnnounce(t){return t!==P4?(e=!1,!1):e?!1:(e=!0,!0)}}}function Dw(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const L4={already_running:"a sign-in is already in progress",no_url:"the claude CLI did not offer a sign-in link — is it installed?",not_waiting:"that sign-in is no longer waiting for a code",not_prompted:"the CLI has not asked for a code yet",code_rejected:"that code was not accepted — copy it again from the browser",no_verdict:"the claude CLI has not answered — try the code again",empty_code:"paste the code from the browser first",login_failed:"the code was not accepted",no_identity:"signed in, but the CLI still reports nobody logged in",add_failed:"signed in, but claude-swap could not record the account",not_a_share:"that does not look like a shared account — it should start with ccdeck2:",corrupt:"that share is incomplete — copy the whole thing",wrong_version:`that share was made by a newer ${zt}`,expired:"that share has expired — make a new one",import_failed:"claude-swap refused the import",unreadable_export:"claude-swap wrote something this deck could not read — try again, and upgrade it if this repeats",mixed_versions:"claude-swap changed format part-way through — try again",nothing_to_share:"none of those accounts could be exported",too_many:"that is more accounts than one share can carry",not_in_bundle:"that account is not in this share",bad_value:"an alias can only use letters, numbers, spaces, dots, dashes and underscores, up to 64 characters, and cannot start with a dash",bad_email:"that does not look like an email address — it cannot contain spaces or start with a dash"},q4={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"},D4=`claude-swap could not read the login keychain — start ${zt} from a Terminal window rather than a background service`;function rw(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(Gi(e)))return D4;const n=Dw(q4,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function Gi(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const F4={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"},z4="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 B4(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const U4="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",W4="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",H4=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),G4=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,V4=/[\\/]_npx[\\/]/i,Y4=`the copy of ccusage ${zt} installed for itself`;function K4(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function X4(e,t){const n=Q4(e,t),s=K4(e);switch(e==null?void 0:e.stage){case"npx":return s?`ccusage failed on both of its paths. The managed install failed first — ${s} — and the deck then fell back to npx, where ${rl(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${rl(n)}`;case"managed":return`${Y4} failed to run: ${rl(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${rl(n)}`:`the ccusage this deck found on your PATH failed to run: ${rl(n)}`;default:return n}}const rl=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function Q4(e,t){const n=Gi(e);if(H4(n)){if(V4.test(n))return W4;if(G4.test(n))return U4}if(B4(n))return z4;const s=Dw(F4,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function Pi(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&zT(e.state))return e.error;const n=Dw(L4,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function Z4(e,t,n){if(n<=0||Pw(e))return{kind:"pass"};const s=t>=0&&t<n?t:-1;switch(e.key){case"ArrowRight":return{kind:"select",index:s===-1?0:(s+1)%n};case"ArrowLeft":return{kind:"select",index:s===-1?n-1:(s-1+n)%n};case"Home":return{kind:"select",index:0};case"End":return{kind:"select",index:n-1};default:return{kind:"pass"}}}function BT(e,t){const n=Math.round(e/1e3)-t;return n<=0?{text:"expired",tone:"gone"}:n<60?{text:`expires in ${n}s`,tone:"soon"}:{text:`expires in ${Math.round(n/60)}m`,tone:"ok"}}function J4(e){const t=new Map;for(const n of e){const s=(n.email??"").trim().toLowerCase();s&&t.set(s,(t.get(s)??0)+1)}return e.map(n=>{const s=(n.email??"").trim(),i=n.alias||s||`account ${n.num}`,a=[];return n.alias&&s&&a.push(s),s&&(t.get(s.toLowerCase())??0)>1&&a.push(n.org||`slot ${n.num}`),{num:n.num,label:i,sub:a.length?a.join(" · "):null}})}function eD(e){return e<=0?"Nothing picked yet.":e===1?"1 account — its sign-in token will be on your clipboard.":`${e} accounts — ${e} sign-in tokens will be on your clipboard.`}function tD(e){switch(e){case"imported":return"imported";case"healed":return"dead token replaced";case"updated":return"updated";case"present":return"already here";default:return"not imported"}}function nD(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(f=>f.state===p).length,s=[],i=n("imported");i&&s.push(`${i} of ${t} imported`);const a=n("healed");a&&s.push(`${a} had a dead token replaced`);const l=n("updated");l&&s.push(`${l} updated`);const u=n("present");u&&s.push(`${u} already here`);const h=n("failed");return h&&s.push(`${h} did not arrive`),`${s.join(", ")}.`}const rD=1500,cu=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],O1="aa-panel",P1=e=>`aa-tab-${e}`;async function sl(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const sw=de.forwardRef((e,t)=>d.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[d.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),d.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));sw.displayName="SuccessMark";function sD({onClose:e,onChanged:t}){const[n,s]=k.useState("login"),[i,a]=k.useState(null),[l,u]=k.useState(""),[h,p]=k.useState(""),[f,g]=k.useState(!1),[v,w]=k.useState(null),[E,b]=k.useState(null),[S,_]=k.useState(null),[N,C]=k.useState(null),j=k.useRef(""),M=k.useRef(!1),P=k.useRef(!1),I=k.useRef(null),F=k.useRef(null),O=k.useRef(null),A=k.useRef(null),L=k.useRef([]),H=k.useRef(!1),X=k.useCallback(()=>{M.current&&sl({action:"login-cancel"}).catch(()=>{}),e()},[e]),R=Sn(X,{focusRef:O}),K=k.useCallback(async()=>{if(!cr(P.current))return;P.current=!0,g(!0),w(null),M.current=!0;const D=await sl({action:"login"}).catch(()=>null);if(P.current=!1,g(!1),!(D!=null&&D.ok)){w(Pi(D,"could not start the sign-in"));return}a(D)},[]);k.useEffect(()=>{if(!A4(i==null?void 0:i.state))return;const D=window.setInterval(async()=>{try{const J=await fetch("/api/claude-accounts/login");J.ok&&a(await J.json())}catch{}},rD);return()=>window.clearInterval(D)},[i]);const G=k.useRef(t);G.current=t;const ne=k.useState($4)[0];k.useEffect(()=>{var D;(i==null?void 0:i.state)==="awaiting_code"&&((D=I.current)==null||D.focus()),ne.shouldAnnounce(i==null?void 0:i.state)&&G.current()},[i==null?void 0:i.state,ne]),k.useEffect(()=>{var D;n==="paste"&&!H.current&&((D=F.current)==null||D.focus()),H.current=!1},[n]);const Q=k.useCallback(D=>{var V;const J=Z4(D,cu.findIndex(ae=>ae.id===n),cu.length);J.kind!=="pass"&&(D.preventDefault(),H.current=!0,s(cu[J.index].id),(V=L.current[J.index])==null||V.focus())},[n]),W=k.useCallback(async()=>{var J;if(!cr(P.current))return;P.current=!0,g(!0),w(null);const D=await sl({action:"login-code",code:l}).catch(()=>null);if(P.current=!1,g(!1),!(D!=null&&D.ok)){w(Pi(D,"the code was not accepted")),D!=null&&D.state&&a(D),(J=I.current)==null||J.select();return}u(""),a(D)},[l,i]),ee=k.useCallback(async()=>{if(!cr(P.current))return;P.current=!0,g(!0),w(null);const D=await sl({action:"import",blob:h}).catch(()=>null);if(P.current=!1,g(!1),!(D!=null&&D.ok)){w(Pi(D,"the import failed"));return}j.current=h,p(""),C(null),b(D.results??[]),t()},[h,t]),$=k.useCallback(async D=>{const J=`${D.email}|${D.org??""}`;if(!cr(P.current)||!j.current)return;P.current=!0,g(!0),_(J),C(null);const V=await sl({action:"import",blob:j.current,force:!0,only:{email:D.email,org:D.org??""}}).catch(()=>null);if(P.current=!1,g(!1),_(null),!(V!=null&&V.ok)){C({key:J,text:Pi(V,"that account could not be updated")});return}const ae=(V.results??[])[0];ae&&b(he=>he&&he.map(ye=>`${ye.email}|${ye.org??""}`===J?ae:ye)),t()},[t]),Y=(i==null?void 0:i.state)==="done"?i.account:null,ue=zT(i==null?void 0:i.state)||!!(v&&M.current&&!f),z=O4({state:i==null?void 0:i.state,serverError:i==null?void 0:i.error,localError:v});return d.jsx("div",{className:"modal-backdrop",onClick:X,role:"presentation",children:d.jsxs("div",{ref:R,className:"modal aa-modal",onClick:D=>D.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:Q,children:cu.map((D,J)=>d.jsx("button",{type:"button",role:"tab",id:P1(D.id),ref:V=>{L.current[J]=V},"aria-selected":n===D.id,"aria-controls":O1,tabIndex:n===D.id?0:-1,className:`aa-tab${n===D.id?" on":""}`,onClick:()=>{H.current=!1,s(D.id)},children:D.label},D.id))})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:X,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsx("section",{className:"modal-body aa-body",id:O1,role:"tabpanel","aria-labelledby":P1(n),children:n==="login"?Y?d.jsxs("div",{className:"aa-done",children:[d.jsx(sw,{ref:A}),d.jsx(I1,{anchor:A}),d.jsx("h4",{children:Y.added?`Account ${Y.num} added`:"Credentials refreshed"}),d.jsxs("p",{className:"aa-note",children:[d.jsx("strong",{children:Y.email}),Y.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),d.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(i==null?void 0:i.state)==="awaiting_code"||(i==null?void 0:i.state)==="registering"?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:"1 · Approve in the browser"}),d.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),d.jsx("a",{className:"aa-link",href:i.url??"#",target:"_blank",rel:"noreferrer noopener",children:i.url})]}),d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),d.jsx("p",{className:"aa-note",children:"It usually finishes on its own — if the page says you are all set, there is nothing to do here."}),d.jsxs("div",{className:"aa-field",children:[d.jsx("input",{ref:I,type:"text",value:l,onChange:D=>u(D.target.value),onKeyDown:D=>{D.key==="Enter"&&l.trim()&&!f&&W()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:i.state==="registering"}),d.jsx("button",{type:"button",className:"btn primary",...lr(f,!l.trim()||i.state==="registering"),onClick:W,children:i.state==="registering"?"registering…":"Continue"})]}),(v||i.error)&&d.jsx("p",{className:"aa-err",children:v??i.error}),d.jsx("p",{className:"aa-note",children:"The code goes straight to the claude CLI on this machine. It is never stored or sent anywhere else."})]})]}):ue?d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:z.title}),d.jsx("p",{className:"aa-err",children:z.message}),d.jsx("button",{type:"button",className:"btn",onClick:()=>{M.current=!1,a(null),w(null),K()},children:"Try again"})]}):f||M.current?d.jsx("div",{className:"aa-step",children:d.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):d.jsxs("div",{className:"aa-step aa-primer",children:[d.jsx("h4",{children:"Sign in to Anthropic"}),d.jsx("p",{className:"aa-note",children:"Opens a browser tab where you approve the sign-in. It normally completes by itself; only if the page hands you a code does it need pasting back here. claude-swap records the account when it completes, and the account you are using now stays active."}),d.jsx("div",{className:"aa-actions",children:d.jsx("button",{type:"button",ref:O,className:"btn primary",onClick:K,children:"Open the sign-in page"})})]}):E?(()=>{const D=E.filter(J=>J.state==="imported").length;return d.jsxs("div",{className:"aa-done",children:[d.jsx(sw,{ref:A}),D>0&&d.jsx(I1,{anchor:A}),d.jsx("h4",{children:nD(E)}),E.length>0&&d.jsx("ul",{className:"aa-results",children:E.map(J=>{const V=`${J.email}|${J.org??""}`;return d.jsxs("li",{className:`aa-result ${J.state}`,children:[d.jsx("span",{className:"aa-result-who",children:J.email||(J.num?`slot ${J.num}`:"an account")}),d.jsx("span",{className:"aa-result-what",children:tD(J.state)}),J.state==="present"&&d.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":S===V,title:`Overwrite the stored login for ${J.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>$(J),children:S===V?"updating…":"update anyway"}),(N==null?void 0:N.key)===V&&d.jsx("span",{className:"aa-result-err",children:N.text})]},V)})}),d.jsxs("p",{className:"aa-note",children:["Nothing changed on the deck you copied this from. An account already here is left as it is, unless its stored login was dead or you pressed",d.jsx("strong",{children:" update anyway"}),"."]}),d.jsxs("div",{className:"aa-actions",children:[d.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),d.jsx("button",{type:"button",className:"btn",onClick:()=>{j.current="",C(null),b(null)},children:"Import another"})]})]})})():d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:"Paste an account shared from another deck"}),d.jsxs("div",{className:"aa-field",children:[d.jsx("input",{ref:F,type:"text",value:h,onChange:D=>p(D.target.value),onKeyDown:D=>{D.key==="Enter"&&h.trim()&&!f&&ee()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),d.jsx("button",{type:"button",className:"btn primary",...lr(f,!h.trim()),onClick:ee,children:f?"importing…":"Import"})]}),v&&d.jsx("p",{className:"aa-err",children:v}),d.jsxs("p",{className:"aa-note",children:["Use ",d.jsx("strong",{children:"share"})," on one account in the other deck, or ",d.jsx("strong",{children:"↗"})," above its list to send several at once. A share carries a live login for every account in it and expires ten minutes after it is made."]})]})})]})})}async function oD(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const iD=1800;function aD({accounts:e,onClose:t,copyText:n}){const[s,i]=k.useState([]),[a,l]=k.useState(null),[u,h]=k.useState(!1),[p,f]=k.useState(null),[g,v]=k.useState(!1),[w,E]=k.useState(()=>Math.floor(Date.now()/1e3)),b=k.useRef(null),S=k.useRef(!1),_=Sn(t,{focusRef:b});k.useEffect(()=>{if(!a)return;E(Math.floor(Date.now()/1e3));const A=window.setInterval(()=>E(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(A)},[a]);const N=J4(e),C=e.filter(A=>!s.includes(A.num)).map(A=>A.num),j=C.length===e.length,M=A=>i(L=>L.includes(A)?L.filter(H=>H!==A):[...L,A]),P=k.useCallback(async()=>{if(!cr(S.current)||!C.length)return;S.current=!0,h(!0),f(null),v(!1);const A=await oD({action:"share",accounts:C}).catch(()=>null);if(S.current=!1,h(!1),!(A!=null&&A.ok)){f(Pi(A,"the share could not be made"));return}l({blob:A.blob,expiresAt:A.expiresAt,shared:A.shared??[],failed:A.failed??[]})},[e,C]),I=a?BT(a.expiresAt,w):null,F=(I==null?void 0:I.tone)==="gone",O=(a==null?void 0:a.shared.length)??0;return d.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:d.jsxs("div",{ref:_,className:"modal sa-modal",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("h3",{children:"Share accounts"})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsx("section",{className:"modal-body sa-body",children:a?d.jsxs("div",{className:"sa-step",children:[d.jsx("h4",{children:F?"This share has expired":O===1?"1 account, ready to paste":`${O} accounts, ready to paste`}),d.jsx("code",{className:`ap-share-blob${F?" sa-dead":""}`,children:a.blob}),d.jsxs("div",{className:"ap-share-foot",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",ref:b,onClick:async()=>{if(F){l(null),P();return}await n(a.blob)&&(v(!0),window.setTimeout(()=>v(!1),iD))},children:F?"make a new share":g?"copied":`copy ${O===1?"the share":"all "+O}`}),d.jsxs("span",{className:"ap-manage-hint",title:"This text is the sign-in for every account in it. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the logins themselves are in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign those accounts out and back in.",children:[d.jsx("span",{className:"ap-share-warn",children:O===1?"this is the password":`this is ${O} passwords`})," · ",d.jsx("span",{className:`ap-share-expiry ${I==null?void 0:I.tone}`,children:I==null?void 0:I.text})]})]}),a.failed.length>0&&d.jsxs("div",{className:"sa-failed",role:"alert",children:[d.jsx("p",{className:"sa-failed-head",children:a.failed.length===1?"One account is not in this bundle:":`${a.failed.length} accounts are not in this bundle:`}),d.jsx("ul",{className:"sa-list",children:a.failed.map(A=>{var H;const L=!!(A.email&&((H=A.detail)!=null&&H.includes(A.email)));return d.jsxs("li",{children:[!L&&d.jsx("span",{className:"sa-who",children:A.email||`account ${A.num}`}),d.jsx("span",{className:"sa-why",children:A.detail||"could not be exported"})]},`${A.num}-${A.email}`)})})]}),d.jsx("p",{className:"sa-note",children:F?d.jsx(d.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):d.jsxs(d.Fragment,{children:["Paste it into the other deck with ",d.jsx("strong",{children:"+"})," → ",d.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),d.jsxs("div",{className:"sa-actions",children:[d.jsx("button",{type:"button",className:"btn",onClick:()=>{l(null),v(!1)},children:"Pick again"}),d.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?d.jsxs("div",{className:"sa-step",children:[d.jsx("h4",{children:"Nothing to share"}),d.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",d.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),d.jsx("div",{className:"sa-actions",children:d.jsx("button",{type:"button",className:"btn primary",ref:b,onClick:t,children:"Close"})})]}):d.jsxs("div",{className:"sa-step",children:[d.jsxs("h4",{children:["Which accounts go to the other ",zt,"?"]}),d.jsx("p",{className:`sa-count${C.length?"":" empty"}`,children:eD(C.length)}),d.jsx("ul",{className:"sa-list sa-pick",children:N.map(A=>d.jsx("li",{children:d.jsxs("label",{className:"sa-row",children:[d.jsx("input",{type:"checkbox",checked:C.includes(A.num),onChange:()=>M(A.num)}),d.jsx("span",{className:"sa-who",children:A.label}),A.sub&&d.jsx("span",{className:"sa-sub",children:A.sub})]})},A.num))}),p&&d.jsx("p",{className:"aa-err",children:p}),d.jsxs("div",{className:"sa-actions",children:[d.jsx("button",{type:"button",className:"btn",onClick:()=>i(j?e.map(A=>A.num):[]),children:j?"Clear all":"Select all"}),d.jsx("button",{type:"button",className:"btn primary",ref:b,...lr(u,!C.length),onClick:P,children:u?"making the share…":C.length===0?"Share":C.length===1?"Share 1 account":`Share ${C.length} accounts`})]})]})})]})})}function lD(e,t){const n=new Set(e),s=e.length?Math.max(...e):0;return[...new Set([...e,s+1])].sort((i,a)=>i-a).map(i=>{const a=i===t?"here":n.has(i)?"swap":"free";return{slot:i,kind:a,label:a==="here"?`slot ${i}`:`slot ${i} · ${a}`}})}function cD(e,t,n){if(!(n!=null&&n.ok))return null;const s=Number.isInteger(n.to)?n.to:null;if(s==null)return{menuFor:null,confirmRemove:null,shareFor:null,swapNote:null};const i=n.swapped===!0&&s!==t;return{menuFor:e.menuFor===t?s:i&&e.menuFor===s?t:e.menuFor,confirmRemove:null,shareFor:null,swapNote:i?{at:s,displaced:t}:null}}function uD(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function dD(e,t,n){var i;const s=((i=e.find(a=>a.slot===t))==null?void 0:i.kind)??"here";return s==="swap"?{label:"swap",done:"swapped",sends:!0,swaps:!0,title:`Send this account to slot ${t}. That slot is taken, so the two accounts trade places and the one standing there moves to slot ${n}.`}:s==="free"?{label:"move",done:"moved",sends:!0,swaps:!1,title:`Send this account to slot ${t}. That slot is empty, so no other account moves.`}:{label:"move",done:"here",sends:!1,swaps:!1,title:`This account already holds slot ${n}.`}}function fD(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 $1(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function L1(e){const t=e.filter(u=>!$1(u)),n=e.filter(u=>$1(u)),s=t.length?t:n,i=t.length?n:[],a=s.reduce((u,h)=>u&&u.pct>=h.pct?u:h,null);let l=null;for(const u of i)a&&u.pct<=a.pct||(!l||u.pct>l.pct)&&(l=u);return{shown:s,rest:i,fuller:l,peak:l??a}}function hD(e,t,n){return e<1?null:t?"fewer":n?`${n.label} ${Math.round(n.pct)}%`:`${e} more`}function pD(e,t,n,s){const i=e==null?"No usage has been collected for this account yet.":`${Math.round(e)}% left on ${t??"the window that runs out first"}, which is the one that runs out first.`,a=n===1?"the other window":`the other ${n} windows`;return`${i} ${s?"Hide":"Show"} ${a}.`}const mD="\0";function Fw(e){const t=typeof e.email=="string"?e.email.trim():"";if(!t)return`slot:${e.num}`;const n=typeof e.org=="string"?e.org.trim():"";return`acct:${t}${mD}${n}`}function gD(e,t){const n=Fw(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function yD(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(Fw)),s=e.filter(i=>n.has(i));return s.length===e.length?e:s}const vD=64;function wD(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const xD=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function q1(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function bD(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=Gi(t.body);return{text:rw(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function D1(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 F1=15e3,kD=8e3,ch=1800,_D=3e4,SD=[70,80,85,90,95];function z1(e,t){return RT(t-Math.floor(e/1e3))}function ND(e,t){if(!e)return"";const n=Math.floor(e/1e3)-t;return n<=0?" · due":n<60?` · next in ${n}s`:` · next in ${Math.round(n/60)}m`}function ED(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 B1({lane:e,nowSec:t}){const n=Math.min(100,Math.max(0,e.pct)),s=n>=90?"var(--err)":n>=70?"var(--warn)":"var(--accent)",i=e.resetAt?AT(e.resetAt,t):null;return d.jsxs("div",{className:"ap-lane",children:[d.jsx("span",{className:"ap-lane-label",children:e.label}),d.jsx("div",{className:"ap-lane-track",children:d.jsx("div",{className:"ap-lane-fill",style:{width:`${n===0?1.5:n}%`,background:s,opacity:n===0?.4:1}})}),d.jsxs("span",{className:"ap-lane-pct",style:{color:s},children:[n,"%"]}),d.jsx("span",{className:"ap-lane-reset",children:i?`resets ${i}`:""})]})}async function U1(e){var n;let t=!1;try{t=await Promise.race([((n=navigator.clipboard)==null?void 0:n.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(s=>window.setTimeout(()=>s(!1),500))])}catch{t=!1}if(t)return!0;try{const s=document.createElement("textarea");s.value=e,s.setAttribute("readonly",""),s.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(s),s.select(),t=document.execCommand("copy"),s.remove()}catch{t=!1}return t}function CD({onClose:e}){var He,ct,je,Ge,Ke;const[t,n]=k.useState(null),[s,i]=k.useState(null),[a,l]=k.useState(null),[u,h]=k.useState(!1),[p,f]=k.useState(null),[g,v]=k.useState(()=>Math.floor(Date.now()/1e3)),w=k.useRef(null),[E,b]=k.useState(null),[S,_]=k.useState(!1),[N,C]=k.useState(""),[j,M]=k.useState(null),[P,I]=k.useState(null),[F,O]=k.useState(null),[A,L]=k.useState(!1),[H,X]=k.useState(!1),[R,K]=k.useState(null),[G,ne]=k.useState(null),[Q,W]=k.useState(null),[ee,$]=k.useState(null),[Y,ue]=k.useState(!1),[z,D]=k.useState([]),J=k.useRef(null),V=k.useCallback(se=>IT(J.current)?(J.current=se,l(se),!0):!1,[]),ae=k.useCallback(()=>{J.current=null,l(null)},[]),he=(se,Pe=!1)=>{const $e=MT(a,se);return{disabled:$e.disabled,"aria-busy":$e.busy||Pe}},ye=k.useCallback(se=>{window.requestAnimationFrame(()=>{var Pe;if(zq(((Pe=document.activeElement)==null?void 0:Pe.tagName)??null))for(const $e of Fq(se)){const Te=document.querySelector($e);if(Te){Te.focus();return}}})},[]),_e=k.useCallback(async(se=!1)=>{se&&h(!0);const Pe=new AbortController,$e=window.setTimeout(()=>Pe.abort(),_D);try{const[Te,Xe]=await Promise.all([fetch(`/api/claude-accounts${se?"?refresh=1":""}`,{signal:Pe.signal}),fetch("/api/cswap-auto",{signal:Pe.signal})]);if(Te.ok){const ot=await Te.json();n(ot),D(Ie=>yD(Ie,ot.accounts))}Xe.ok&&i(await Xe.json());const jt=bD([await q1(Te),await q1(Xe)]);f(ot=>D1(ot,jt))}catch{f(Te=>D1(Te,xD))}finally{window.clearTimeout($e),se&&h(!1)}},[]),Ve=k.useCallback(async(se,Pe)=>{if(!V(Pe))return null;f(null);try{const Te=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(se)})).json().catch(()=>null);return Te!=null&&Te.ok||f({text:rw(Te,"command failed"),raw:Gi(Te)}),Te}catch{return f({text:"server unreachable"}),null}finally{ae()}},[V,ae]),Be=k.useCallback(async(se,Pe)=>{if(!V(Pe))return null;f(null);try{const Te=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(se)})).json().catch(()=>null);return Te!=null&&Te.ok||f({text:Pi(Te,"command failed")}),Te}catch{return f({text:"server unreachable"}),null}finally{ae()}},[V,ae]);k.useEffect(()=>(_e(!0),w.current=window.setInterval(()=>_e(!1),F1),()=>{w.current!=null&&window.clearInterval(w.current)}),[_e]),k.useEffect(()=>{const se=window.setInterval(()=>v(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(se)},[]);const qe=((He=s==null?void 0:s.settings["autoswitch.threshold"])==null?void 0:He.value)??"90",Se=ee??qe,ce=fD(Se,qe),be=(ct=t==null?void 0:t.accounts)==null?void 0:ct.find(se=>se.active),ke=((je=L1((be==null?void 0:be.lanes)??[]).peak)==null?void 0:je.pct)??null,Ye=ke!=null&&ke>=Number(qe)-15,dt=async se=>{if(V(`switch-${se}`)){f(null);try{const $e=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:se})})).json().catch(()=>null);$e!=null&&$e.ok||f({text:rw($e,"the switch failed"),raw:Gi($e)}),await _e(!0)}catch{f({text:"server unreachable"})}finally{ae(),ye(se)}}},lt=async(se,Pe)=>{const{commit:$e,alias:Te}=wD(N,Pe);if($e){const Xe=await Be({action:"alias",account:se,alias:Te},`alias-${se}`);if(await _e(!0),!(Xe!=null&&Xe.ok))return;C(Te)}M(se),window.setTimeout(()=>M(Xe=>Xe===se?null:Xe),ch)},pe=async(se,Pe)=>{const $e=await Be({action:"move",account:se,slot:Pe},`move-${se}`),Te=cD({menuFor:E,shareFor:(F==null?void 0:F.num)??null},se,$e);if(await _e(!0),Te){b(Te.menuFor),I(Te.confirmRemove),Te.shareFor==null&&(O(null),X(!1)),K(Te.swapNote);const Xe=Te.swapNote;Xe&&window.setTimeout(()=>K(jt=>jt===Xe?null:jt),kD),ne(null),ye(Te.menuFor)}return $e},me=async(se,Pe,$e)=>{if($e.sends){const Te=await pe(se,Pe);if(!(Te!=null&&Te.ok))return}W(se),window.setTimeout(()=>W(Te=>Te===se?null:Te),ch)},Me=async(se,Pe)=>{if(Pe.sends){const $e=await Ve({action:"setting",key:"autoswitch.threshold",value:se},"threshold");if(await _e(!0),!($e!=null&&$e.ok))return;$(null)}ue(!0),window.setTimeout(()=>ue(!1),ch)};return d.jsxs("aside",{className:"accounts-panel",id:"accounts-panel","aria-label":"Claude accounts",children:[d.jsxs("div",{className:"ap-header",children:[d.jsx("h2",{children:"Accounts"}),d.jsxs("div",{className:"ap-header-right",children:[d.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>_(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:"+"}),(((Ge=t==null?void 0:t.accounts)==null?void 0:Ge.length)??0)>0&&d.jsx("button",{type:"button",className:"glyph-btn ap-share-set",onClick:()=>L(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${zt} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:"↗"}),d.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>_e(!0),...he("reload",u),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:u?"…":"↻"}),d.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:"×"})]})]}),t==null?p?d.jsxs("div",{className:"ap-empty",role:"alert",children:[d.jsx("span",{title:p.raw||void 0,children:p.text}),d.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",F1/1e3," seconds."]}),d.jsx("button",{type:"button",className:"ap-fix",disabled:u,onClick:()=>_e(!0),children:u?"trying…":"try again"})]}):d.jsx("div",{className:"ap-empty",children:"Checking…"}):t.ok?d.jsxs(d.Fragment,{children:[(Ke=t.accounts)==null?void 0:Ke.map(se=>{const{shown:Pe,rest:$e,fuller:Te,peak:Xe}=L1(se.lanes),jt=z.includes(Fw(se)),ot=hD($e.length,jt,Te);return d.jsxs("div",{className:`ap-account${se.active?" active":""}`,children:[d.jsxs("div",{className:"ap-account-head",children:[d.jsx("span",{className:"ap-num",children:se.num}),se.alias&&d.jsx("span",{className:"ap-alias",title:se.alias,children:se.alias}),d.jsx("span",{className:"ap-email",title:se.email??void 0,children:se.email}),d.jsx("button",{type:"button",id:`ap-more-${se.num}`,className:`ap-more${E===se.num?" on":""}`,"aria-label":`Manage account ${se.num}`,"aria-expanded":E===se.num,"aria-controls":E===se.num?`ap-manage-${se.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{b(E===se.num?null:se.num),C(se.alias??""),I(null),O(null),X(!1),K(null),M(null),ne(null),W(null)},children:"⋯"}),se.active&&d.jsx("span",{className:"ap-badge-active",children:"active"}),se.disabled&&d.jsx("span",{className:"ap-badge-held",children:"held out"}),!se.active&&!se.disabled&&d.jsx("button",{type:"button",className:"ap-manage-btn ap-switch",...he(`switch-${se.num}`),onClick:()=>dt(se.num),title:`Switch to ${se.alias??se.email}`,children:a===`switch-${se.num}`?"…":"switch"})]}),d.jsx("div",{className:"ap-lanes",id:`ap-lanes-${se.num}`,children:Pe.length?d.jsxs(d.Fragment,{children:[Pe.map(Ie=>d.jsx(B1,{lane:Ie,nowSec:g},Ie.id)),jt&&$e.map(Ie=>d.jsx(B1,{lane:Ie,nowSec:g},Ie.id))]}):d.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),d.jsxs("div",{className:"ap-meta",children:[se.staleCopy&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"ap-stale-copy",title:"The deck can still see this account — its live usage is being read — but claude-swap's own stored copy of the login was rejected, so these numbers stopped updating. Resume re-captures the copy from the login you already have.",children:"numbers paused"}),d.jsx("button",{type:"button",className:"ap-fix",...he("recapture"),onClick:async()=>{const Ie=await Be({action:"recapture"},"recapture");Ie!=null&&Ie.ok&&_e(!0)},title:"Re-capture this account's stored credentials from the login you already have. No sign-in, no switch.",children:a==="recapture"?"resuming…":"resume"})]}),se.error&&(()=>{const Ie=ED(se.error);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"ap-err",title:Ie.hint,children:Ie.text}),Ie.fixable&&d.jsx("button",{type:"button",className:"ap-fix",onClick:()=>_(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),ot&&d.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":jt,"aria-controls":`ap-lanes-${se.num}`,title:pD(se.headroom,(Xe==null?void 0:Xe.label)??null,$e.length,jt),onClick:()=>D(Ie=>gD(Ie,se)),children:ot}),(((s==null?void 0:s.enabled)||(s==null?void 0:s.external))&&!se.active||se.disabled)&&d.jsx("button",{type:"button",className:"ap-rotate",...he(`rot-${se.num}`),onClick:()=>Ve({action:"account",account:se.num,enabled:se.disabled},`rot-${se.num}`).then(()=>_e(!0)),title:se.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:se.disabled?"put back":"hold out"}),se.fetchedAt?d.jsxs("span",{className:`ap-age${se.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 ",z1(se.fetchedAt,g),ND(se.nextAt,g)]}):d.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),E===se.num&&d.jsxs("div",{className:"ap-manage",id:`ap-manage-${se.num}`,role:"group","aria-label":`Manage account ${se.num}`,children:[d.jsxs("div",{className:"ap-manage-name",children:[d.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${se.num}`,children:"Alias"}),d.jsx("input",{id:`ap-alias-${se.num}`,className:"ap-manage-input",type:"text",value:N,onChange:Ie=>C(Ie.target.value),onKeyDown:Ie=>{Ie.key==="Enter"&<(se.num,se.alias)},maxLength:vD,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),d.jsx("button",{type:"button",className:"ap-manage-btn",...he(`alias-${se.num}`),onClick:()=>lt(se.num,se.alias),title:"A short name to show instead of the email",children:j===se.num?"saved":"save"})]}),(()=>{const Ie=lD((t.accounts??[]).map(gt=>gt.num),se.num),xt=uD(Ie,G,se.num),ft=dD(Ie,xt,se.num);return d.jsxs("div",{className:"ap-manage-slot",children:[d.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${se.num}`,children:"Slot"}),d.jsx("span",{className:"ap-field",children:d.jsx("select",{id:`ap-slot-${se.num}`,value:String(xt),...he(`move-${se.num}`),onChange:gt=>ne(Number(gt.target.value)),children:Ie.map(gt=>d.jsx("option",{value:gt.slot,children:gt.label},gt.slot))})}),d.jsx("button",{type:"button",className:"ap-manage-btn",...he(`move-${se.num}`),title:ft.title,onClick:()=>me(se.num,xt,ft),children:Q===se.num?ft.done:ft.label})]})})(),d.jsxs("div",{className:"ap-manage-acts",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",...he(`share-${se.num}`),title:`Copy this account to another ${zt}. Anyone who has the text can use the account — treat it as the password. The other deck stops accepting it after 10 minutes; that does not make an escaped copy safe.`,onClick:async()=>{X(!1);const Ie=await Be({action:"share",account:se.num},`share-${se.num}`);Ie!=null&&Ie.ok&&O({num:se.num,blob:Ie.blob,expiresAt:Ie.expiresAt})},children:"share"}),d.jsx("button",{type:"button",className:`ap-manage-btn danger${P===se.num?" armed":""}`,...he(`rm-${se.num}`),title:P===se.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(P!==se.num){I(se.num),window.setTimeout(()=>I(Ie=>Ie===se.num?null:Ie),4e3);return}I(null),Be({action:"remove",account:se.num},`rm-${se.num}`).then(()=>{b(null),_e(!0),ye(null)})},children:P===se.num?"confirm":"remove"})]}),(R==null?void 0:R.at)===se.num&&(()=>{var ft;const Ie=(ft=t.accounts)==null?void 0:ft.find(gt=>gt.num===R.displaced),xt=(Ie==null?void 0:Ie.alias)??(Ie==null?void 0:Ie.email)??"the account that was there";return d.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${R.at} was taken, so the two accounts traded places: ${xt} now holds slot ${R.displaced}.`,children:["swapped with slot ",R.displaced]})})(),(F==null?void 0:F.num)===se.num&&(()=>{const Ie=BT(F.expiresAt,g),xt=Ie.tone==="gone";return d.jsxs("div",{className:`ap-share${xt?" expired":""}`,children:[d.jsx("code",{className:"ap-share-blob",children:F.blob}),d.jsxs("div",{className:"ap-share-foot",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",...he(`share-${se.num}`),onClick:async()=>{if(xt){X(!1);const ft=await Be({action:"share",account:se.num},`share-${se.num}`);ft!=null&&ft.ok&&O({num:se.num,blob:ft.blob,expiresAt:ft.expiresAt});return}await U1(F.blob)&&(X(!0),window.setTimeout(()=>X(!1),1800))},children:xt?"make a new share":H?"copied":"copy"}),d.jsxs("span",{className:"ap-manage-hint",title:"This text is the account's password. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the login itself is in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign the account out and back in.",children:[d.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",d.jsx("span",{className:`ap-share-expiry ${Ie.tone}`,children:Ie.text})]})]})]})})()]})]},se.num)}),(s==null?void 0:s.ok)&&d.jsxs("div",{className:"ap-auto",children:[d.jsxs("div",{className:"ap-auto-head",children:[d.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),d.jsxs("span",{className:"ap-auto-ctl",children:[ke!=null&&d.jsxs("span",{className:`ap-auto-now${Ye?" near":""}`,children:[Math.round(ke),"%"]}),d.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:d.jsx("select",{"aria-label":"Switch threshold",value:Se,...he("threshold"),onChange:se=>$(se.target.value),children:SD.map(se=>d.jsxs("option",{value:se,children:[se,"%"]},se))})}),d.jsx("button",{type:"button",className:"ap-manage-btn",...he("threshold"),title:ce.title,onClick:()=>Me(Se,ce),children:Y?ce.done:ce.label}),d.jsxs("button",{type:"button",className:`ap-auto-state${s.enabled?" live":""}`,role:"switch","aria-checked":s.enabled,"aria-label":"Auto-switch",...he("enable"),onClick:()=>Ve({action:"enable",enabled:!s.enabled},"enable").then(()=>_e(!0)),title:s.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:[d.jsx("i",{className:s.enabled?"ap-pulse":"ap-dot","aria-hidden":!0}),s.enabled?"on":"off"]})]})]}),s.external&&d.jsxs("p",{className:"ap-auto-note",children:[d.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",d.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",s.enabled?" — this toggle takes over when you stop it.":"."]}),s.lastTick&&d.jsx("div",{className:"ap-auto-foot",children:d.jsxs("span",{className:"ap-auto-result",children:["checked ",z1(s.lastTick.at,g)]})})]}),p&&d.jsxs("div",{className:"ap-failure",role:"alert",children:[d.jsx("span",{className:"ap-failure-text",title:p.raw||void 0,children:p.text}),d.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),d.jsx("p",{className:"ap-footnote",title:"Anthropic's usage endpoint allows roughly 28–30 requests per hour per account, shared by every tool on this machine — polling it from here would rate-limit your account. So the deck never fetches: it asks claude-swap to collect while this panel is open, at most once every three minutes, and claude-swap decides whether that touches the network at all.",children:"These numbers only update while this panel is open."})]}):d.jsx("div",{className:"ap-empty",children:t.reason==="no_cswap"?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"claude-swap isn't installed."}),d.jsx("span",{className:"ap-hint",children:"This panel reads the account store claude-swap keeps — without it there is nothing to show. It is a separate tool, published on PyPI, so it does not come with this package."}),t.hint&&d.jsx("code",{className:"ap-cmd",children:t.hint}),d.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",d.jsx("strong",{children:"+"})," button above."]})]}):t.reason==="no_accounts"?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"No accounts added yet."}),d.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",d.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Couldn't read the account store."}),d.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",t.reason?` (${t.reason})`:"","."]})]})}),S&&d.jsx(sD,{onClose:()=>_(!1),onChanged:()=>_e(!0)}),A&&d.jsx(aD,{accounts:((t==null?void 0:t.accounts)??[]).map(se=>({num:se.num,email:se.email,alias:se.alias,org:se.org})),onClose:()=>L(!1),copyText:U1})]})}const jD=3e4;function TD({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function RD({bundle:e,running:t,pending:n,lastTried:s}){return t?TD({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function AD(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function MD({asked:e,reported:t}){return t?t!==e:!1}function ID(e){const t=e.thresholdMs??jD;return!e.enabled||e.kind!=="restart"||!e.canRestart||!e.noticeOpen?{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}}async function UT(e,t=500){var s;if(!e)return!1;let n=!1;try{n=await Promise.race([((s=navigator.clipboard)==null?void 0:s.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(i=>window.setTimeout(()=>i(!1),t))])}catch{n=!1}if(n)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(),n=document.execCommand("copy"),i.remove()}catch{n=!1}return n}function OD(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function PD(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.decks!="number"||typeof t.mine!="boolean")return null;const n=t.owner&&typeof t.owner=="object"?t.owner.port:null;return{path:typeof t.path=="string"&&t.path!==""?t.path:null,decks:t.decks,mine:t.mine,ownerPort:typeof n=="number"?n:null}}function $D(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function LD(e,t){const n=$D(e),s=n?`removes ${n} on the canvas`:null,i=u=>`This ${s?`${s} and ${u}`:u}`;if(!t)return{note:`${i("deletes the event log on disk")} — the file a restarted deck replays to rebuild what you see, and the file every deck on this machine shares unless one was told otherwise. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};if(!t.path)return{note:`${i("leaves nothing on disk — this deck keeps no event log")}. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};if(!t.mine){const u=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,h=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{note:`${i(`leaves the event log alone: ${u}${h}`)}. Clearing here empties this canvas only — restart this deck and the log replays back onto it. Layout, pins and selection go with it.`,confirm:"Clear this canvas"}}if(t.decks<=1)return{note:`${i("deletes this deck's event log")} — the file a restarted deck replays to rebuild what you see. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};const a=t.decks-1,l=a===1?"That deck keeps what is on its canvas until it restarts, and then it is gone there too.":"Those decks keep what is on their canvases until they restart, and then it is gone there too.";return{note:`${i(`deletes the event log ${a===1?"1 other running deck shares":`${a} other running decks share`} with this one`)} — every session recorded in it, not just the ones drawn here. ${l} This cannot be undone.`,confirm:"Clear everything"}}function qD({agentCount:e,onConfirm:t,onCancel:n}){const s=k.useRef(null),i=Sn(n,{focusRef:s,layer:e3}),[a,l]=k.useState(null);k.useEffect(()=>{let p=!1;return fetch("/api/clear").then(f=>f.ok?f.json():null).then(f=>{p||l(PD(f))}).catch(()=>{}),()=>{p=!0}},[]);const{note:u,confirm:h}=LD(e,a);return d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:i,className:"modal clear-confirm",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:"status-dot err","aria-hidden":!0}),d.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),d.jsxs("section",{className:"modal-body",children:[d.jsx("p",{className:"modal-note",children:u}),d.jsxs("div",{className:"cc-actions",children:[d.jsx("button",{type:"button",ref:s,className:"btn",onClick:n,children:"Cancel"}),d.jsx("button",{type:"button",className:"btn danger",onClick:t,children:h})]})]})]})})}const DD="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.",FD=[{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:"D",action:"detail panel",binds:["d","D"]},{cap:"H",action:"usage history",binds:["h","H"]},{cap:"A",action:"Claude accounts, where Claude Code is installed",binds:["a","A"]},{cap:"?",action:"this sheet",binds:["?"]}]},{title:"Settings",rows:[{cap:"M",action:"sound on or off",binds:["m","M"]},{cap:"T",action:"light or dark theme",binds:["t","T"]}]},{title:"Focus and selection",rows:[{cap:"Tab",action:"reach the agent cards",binds:[]},{cap:"Enter",action:"select the focused card",binds:["Enter"]},{cap:"Shift + Enter",action:"add the focused card to the selection",binds:["Enter"]},{cap:"Esc",action:"close what is open, deselect, release focus",binds:["Escape"]}]},{title:"Mouse",rows:[{cap:"drag",action:"move a node, and pin it where you dropped it",binds:[]},{cap:"shift-click",action:"add an agent to the selection",binds:[]},{cap:"click",action:"the topbar speaker opens volume and sound settings",binds:[]}]}];function zD({onClose:e}){const t=Sn(e);return d.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:t,className:"modal key-help",onClick:n=>n.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsxs("section",{className:"modal-body",children:[d.jsx("p",{className:"modal-note",children:DD}),d.jsx("div",{className:"shortcuts",children:FD.map(n=>d.jsxs(k.Fragment,{children:[d.jsx("h3",{className:"kh-group",children:n.title}),n.rows.map(s=>d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:s.cap}),d.jsx("span",{children:s.action})]},`${n.title}:${s.cap}:${s.action}`))]},n.title))})]})]})})}const BD=["done","needs-input"],UD=[{id:"two",label:"Two notes",notes:[{at:0,hz:740,ms:90},{at:.085,hz:440,ms:150}]},{id:"arc",label:"Descent",notes:[{at:0,hz:988,ms:80},{at:.07,hz:659,ms:80},{at:.14,hz:440,ms:160}]},{id:"tap",label:"Double tap",notes:[{at:0,hz:740,ms:55},{at:.055,hz:740,ms:55},{at:.165,hz:440,ms:150}]},{id:"chord",label:"Chord",trim:.7,notes:[{at:0,hz:988,ms:110},{at:0,hz:740,ms:110},{at:.1,hz:440,ms:170}]},{id:"bell",label:"Bell",type:"triangle",notes:[{at:0,hz:740,ms:120},{at:.11,hz:440,ms:260}]},{id:"blip",label:"Blip",type:"square",trim:.7,notes:[{at:0,hz:740,ms:55},{at:.06,hz:440,ms:90}]}],WD=[{id:"two",label:"Two notes",notes:[{at:0,hz:440,ms:90},{at:.085,hz:740,ms:150}]},{id:"arc",label:"Ascent",notes:[{at:0,hz:440,ms:80},{at:.07,hz:659,ms:80},{at:.14,hz:988,ms:160}]},{id:"tap",label:"Double tap",notes:[{at:0,hz:440,ms:55},{at:.055,hz:440,ms:55},{at:.165,hz:740,ms:150}]},{id:"chord",label:"Chord",trim:.7,notes:[{at:0,hz:440,ms:110},{at:.1,hz:740,ms:170},{at:.1,hz:988,ms:170}]},{id:"bell",label:"Bell",type:"triangle",notes:[{at:0,hz:440,ms:120},{at:.11,hz:740,ms:260}]},{id:"blip",label:"Blip",type:"square",trim:.7,notes:[{at:0,hz:440,ms:55},{at:.06,hz:740,ms:90}]}],zw={done:UD,"needs-input":WD},Vi="two";function ow(e,t){const n=zw[e];return n.find(s=>s.id===t)??n.find(s=>s.id===Vi)??n[0]}function WT(e,t){return zw[e].some(s=>s.id===t)?t:Vi}ow("done",Vi).notes,ow("needs-input",Vi).notes;const W1=.04,HD=.24,_u=0,Lu=100,iw=5,bl=50;function kl(e){if(!Number.isFinite(e))return bl;const t=Math.round(e/iw)*iw;return Math.min(Lu,Math.max(_u,t))}function GD(e){if(e==null)return bl;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?kl(Number(t)):bl}function VD(e){const t=kl(e),n=W1+(HD-W1)*(t/Lu);return Math.round(n*1e4)/1e4}function YD(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(VD(e)*s*1e4)/1e4}const KD=160,XD="agent-dag.soundLevel.done",QD="agent-dag.soundLevel.needs-input",ZD="agent-dag.soundFigure.done",JD="agent-dag.soundFigure.needs-input",HT={done:XD,"needs-input":QD},GT={done:ZD,"needs-input":JD},aw={done:{level:bl,figure:Vi},"needs-input":{level:bl,figure:Vi}};function e5(e){const t=n=>({level:GD(e(HT[n])),figure:WT(n,e(GT[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const t5={Stop:"done",Notification:"needs-input"};function n5(e,t){var s;if(t)return null;const n=(s=e==null?void 0:e.payload)==null?void 0:s.hook_event_name;return typeof n!="string"?null:t5[n]??null}function r5(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null,s=!1;const i=()=>e.enabled()?s&&(n==null?void 0:n.state)==="running"?"ready":"locked":"off",a=()=>{var h;return(h=e.onState)==null?void 0:h.call(e,i())};function l(){var h;if(!(!t||s))try{n=n??new t,(h=n.resume)==null||h.call(n).then(a,()=>{}),s=!0,a()}catch{}}function u(h,p=!1){var E;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const f=(((E=e.prefs)==null?void 0:E.call(e))??aw)[h]??aw[h],g=ow(h,f.figure),v=YD(f.level,g),w=n.currentTime;for(const b of g.notes){const S=n.createOscillator(),_=n.createGain();S.type=g.type??"sine",S.frequency.value=b.hz;const N=w+b.at,C=N+b.ms/1e3;_.gain.setValueAtTime(1e-4,N),_.gain.exponentialRampToValueAtTime(v,N+.012),_.gain.exponentialRampToValueAtTime(1e-4,C),S.connect(_).connect(n.destination),S.start(N),S.stop(C+.02)}return!0}return{unlock:l,play:u,state:i,get context(){return n}}}const s5="Notify me when a session needs my attention.",o5="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",H1="Get notified when you're away from this tab.";function i5(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:H1};case"default":return{status:null,ask:!0,ok:!1,note:H1};case"denied":return{status:"Blocked",ask:!1,ok:!1,note:"Your browser is blocking them; only its own site settings can undo that. You'll still be told once this tab is closed."};default:return{status:"Unavailable",ask:!1,ok:!1,note:"This browser cannot show them. You'll still be told once this tab is closed."}}}const G1={done:"Turn finished","needs-input":"Claude is asking"},a5={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function l5({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:i,onFigure:a,onPreview:l,openerRef:u,notifyOn:h,onToggleNotify:p,notifyVetoed:f,notifyPermission:g,onAskNotify:v}){const w=i5(g),E=h&&!f,b=Sn(e),S=k.useRef(e);return S.current=e,k.useEffect(()=>{const _=N=>{var j,M;const C=N.target;C&&((j=b.current)!=null&&j.contains(C)||(M=u.current)!=null&&M.contains(C)||S.current())};return window.addEventListener("pointerdown",_,!0),()=>window.removeEventListener("pointerdown",_,!0)},[b,u]),d.jsxs("div",{ref:b,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[d.jsxs("div",{className:"sm-switches",children:[d.jsxs("label",{className:"sm-switch",children:[d.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),d.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-labelledby":"sm-sound-label",className:"sm-toggle",onClick:n,title:"A tone when a turn finishes, and when Claude asks for something",children:d.jsx("span",{className:"sm-toggle-knob"})})]}),d.jsxs("div",{className:"sm-setting",children:[d.jsxs("label",{className:"sm-switch",children:[d.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications"}),d.jsx("button",{type:"button",role:"switch","aria-checked":h,"aria-labelledby":"sm-notify-label",className:"sm-toggle",onClick:p,title:"A system notification when a session blocks on you",children:d.jsx("span",{className:"sm-toggle-knob"})})]}),d.jsx("p",{className:"sm-note",children:f?o5:s5})]})]}),E&&d.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[d.jsxs("div",{className:"sm-channel-head",children:[d.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),w.ask?d.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:v,children:"Enable"}):d.jsxs("span",{className:"sm-channel-state","data-ok":w.ok||void 0,children:[w.ok&&d.jsx("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:d.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),w.status]})]}),d.jsx("p",{className:"sm-note",children:w.note})]}),!t&&d.jsx("span",{id:"sm-preview-note",className:"vis-hidden",children:"Plays even when Sounds is off, so you can set a tone before turning sounds back on."}),d.jsx("div",{className:"sm-tones",children:BD.map(_=>{const N=s[_],C=`sm-level-${_}`,j=`sm-figure-${_}`;return d.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${_}`,children:[d.jsxs("div",{className:"sm-tone-head",children:[d.jsx("h3",{className:"sm-tone-name",id:`sm-name-${_}`,children:G1[_]}),d.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>l(_),"aria-label":`Hear the ${G1[_].toLowerCase()} tone`,title:t?"Play this tone now, at what it is set to":"Plays even when Sounds is off","aria-describedby":t?void 0:"sm-preview-note",children:[d.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:d.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),d.jsxs("div",{className:"sm-row",children:[d.jsx("label",{htmlFor:C,children:"Volume"}),d.jsx("input",{id:C,type:"range",min:_u,max:Lu,step:iw,value:N.level,onChange:M=>i(_,Number(M.target.value)),style:{"--sm-level":`${(N.level-_u)/(Lu-_u)*100}%`}}),d.jsxs("span",{className:"sm-read",children:[N.level,"%"]})]}),d.jsxs("div",{className:"sm-row",children:[d.jsx("label",{htmlFor:j,children:"Tone"}),d.jsx("select",{id:j,className:"sm-select",value:N.figure,onChange:M=>a(_,M.target.value),children:zw[_].map(M=>d.jsx("option",{value:M.id,children:M.label},M.id))})]}),d.jsx("p",{className:"sm-note",children:a5[_]})]},_)})}),d.jsxs("p",{className:"sm-foot",children:[d.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const c5={"//":["What a user would NOTICE. One key per version that has something to say,","and no key at all for a version that has nothing — which is most of them.","","The rule this file exists to serve: before every release, ask 'what would a","user notice?' and write the answer here. 'Nothing user-visible' is a valid","and expected answer, and it is spelled by adding no key. A release with no","key shows no modal, and that silence is what keeps the modal worth reading","on the day it is not silent.","","What belongs here: something that changed on the user's machine or under","their hands — a hook written to or removed from settings.json, a default","that flipped, a control that moved or went away, a stored preference that","changed meaning. What does not: bounds, races, assertions that could not","fire, anything that is invisible when it is correct.","","Write it for the person running the deck, not for the person reading the","diff. `title` is the sentence they scan; `body` is what they need in order","to act on it, or to stop worrying about it.","","Keys are versions exactly as package.json spells them. A key that is not a","version, or an entry missing either field, fails the suite rather than","being quietly dropped — see src/web/__tests__/release-notes-file.test.ts.","Ordering here is for humans; the deck sorts by version itself.","","A title may open with an emoji, and if it does, put exactly ONE space after","it. Not two: the dialog gives a leading emoji its own optical gap, because","a colour glyph is drawn edge to edge inside its advance and one word space","after one reads as none. A second space here would be a lie in the data","about a defect in the type, and the suite refuses both it and no space at","all."],"3.11.0":[{title:"🗂 The session list waits to be asked for",body:`**BY SESSION in the Usage panel now starts collapsed.** It is the one block in that panel with no ceiling — every other section is two or three rows, or a model table bounded by the models that exist — and it was the reason the panel scrolled at all. Shut, the whole panel is one screen: quota, period, money, models. Press the heading to open it, and it stays open; ccdeck remembers your answer from then on.
|
|
77
|
+
${me.sessionId}`:me.sessionId,children:me.label??me.sessionId.slice(0,8)}),d.jsx("span",{className:"up-session-tokens",children:At(me.tokens)}),me.cost>0?d.jsx("span",{className:"up-session-cost",title:me.models.join(", ")||void 0,children:tt(me.cost)}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Ii})]},me.sessionId)}),!K&&Be.map(me=>d.jsxs("div",{className:"up-session-row",children:[d.jsx("span",{className:`sl-dot state-${me.state}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:Pu(me.state)}),d.jsx("span",{className:"up-session-label",children:me.label}),d.jsx("span",{className:"up-session-tokens",children:At(me.inputTokens+me.outputTokens)}),me.cost>0?d.jsxs("span",{className:"up-session-cost",title:me.unpricedTokens>0?`${At(me.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[tt(me.cost),me.unpricedTokens>0?"+":""]}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Ii})]},me.sessionId))]})]})})(),qe&&d.jsxs("div",{className:"up-hint",children:["“",Ii,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):d.jsx("div",{className:"up-empty",children:K?d.jsxs(d.Fragment,{children:["No usage ",$,".",d.jsx("br",{}),"Try a longer period."]}):d.jsxs(d.Fragment,{children:["No usage data yet.",d.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}const vt={l:30,r:6,t:6,b:2},Qu=104,nq=64;function wo(e,t=100,n=Qu){const s=n-vt.t-vt.b;return vt.t+s*(1-Math.max(0,Math.min(t,e))/t)}function rq(e,t,n,s=100,i=Qu){if(!e.length)return"";const a=e[e.length-1].t-e[0].t,l=p=>{const f=t-vt.l-vt.r;return vt.l+(a>0?f*(p-e[0].t)/a:f/2)};let u="",h=null;for(const p of e){const f=h&&p.t-h.t<=n*2?"L":"M";u+=`${f}${l(p.t).toFixed(1)} ${wo(p.v,s,i).toFixed(1)}`,h=p}return u}function sq(e,t,n,s=100,i=Qu){if(e.length<2)return"";const a=i-vt.b,l=e[e.length-1].t-e[0].t,u=t-vt.l-vt.r,h=v=>vt.l+(l>0?u*(v-e[0].t)/l:u/2);let p="",f=[];const g=()=>{if(f.length>=2){let v=`M${h(f[0].t).toFixed(1)} ${a}`;for(const w of f)v+=`L${h(w.t).toFixed(1)} ${wo(w.v,s,i).toFixed(1)}`;p+=`${v}L${h(f[f.length-1].t).toFixed(1)} ${a}Z`}f=[]};for(const v of e)f.length&&v.t-f[f.length-1].t>n*2&&g(),f.push(v);return g(),p}function oq(e){return e.length?{now:e[e.length-1].v,peak:e.reduce((t,n)=>Math.max(t,n.v),e[0].v)}:{now:null,peak:null}}function iq(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function aq(e,t,n=s=>dl(s)){const s=e.filter(l=>l.v>0);if(!e.length)return null;if(!s.length)return"never held back";const i=s.length*(t/6e4),a=s[s.length-1];return`held back for ${i===1?"1 minute":`${i} minutes`}, last at ${n(a.t)}`}function dl(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function LT(e,t){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<1)return"less than a minute";if(n<60)return`${n} minute${n===1?"":"s"}`;const s=Math.floor(n/60),i=n%60;return i?`${s}h ${i}m`:`${s}h`}function lq({group:e,title:t,onClose:n}){const s=Sn(n),[i,a]=k.useState(null);k.useEffect(()=>{let p=!0;const f=async()=>{try{const v=await fetch(`/api/system/history?group=${e}`);if(!v.ok)return;const w=await v.json();p&&(w!=null&&w.ok)&&a(w)}catch{}};f();const g=window.setInterval(f,2e4);return()=>{p=!1,window.clearInterval(g)}},[e]);const l=(i==null?void 0:i.series)??[],[u,h]=k.useMemo(()=>{let p=1/0,f=0;for(const g of l)g.points.length&&(p=Math.min(p,g.points[0].t),f=Math.max(f,g.points[g.points.length-1].t));return[Number.isFinite(p)?Math.max(p,(i==null?void 0:i.sinceMs)??0):(i==null?void 0:i.sinceMs)??0,f]},[l,i==null?void 0:i.sinceMs]);return ww.createPortal(d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:s,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[d.jsxs("div",{className:"modal-head",children:[d.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),i&&u>0&&d.jsxs("span",{className:"hist-since",children:["since ",dl(u)," · ",LT(u,h||Date.now())]}),d.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),d.jsx("div",{className:"hist-body",children:i==null?d.jsx("p",{className:"hist-empty",children:"Reading…"}):l.length===0?d.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):l.map(p=>d.jsx(cq,{series:p,stepMs:i.stepMs},p.label))})]})}),document.body)}function cq({series:e,stepMs:t}){const n=k.useRef(null),[s,i]=k.useState(560),[a,l]=k.useState(null);k.useEffect(()=>{const I=n.current;if(!I||typeof ResizeObserver>"u")return;const F=new ResizeObserver(([O])=>i(Math.max(160,O.contentRect.width)));return F.observe(I),()=>F.disconnect()},[]);const{points:u,unit:h,warnAt:p,critAt:f,label:g,top:v,restsAtZero:w}=e,E=w?nq:Qu,{now:b,peak:S}=oq(u),_=h==="C"?"°C":h,N=g==="Throttling"?aq(u,t):null,C=a!=null?u[a]:null,j=u.length>1?u[u.length-1].t-u[0].t:0,M=I=>{const F=s-vt.l-vt.r;return vt.l+(j>0?F*(I-u[0].t)/j:F/2)},P=I=>{if(u.length<2)return;const F=I.currentTarget.getBoundingClientRect(),O=(I.clientX-F.left-vt.l)/Math.max(1,F.width-vt.l-vt.r),A=u[0].t+j*Math.max(0,Math.min(1,O));let L=0;for(let H=1;H<u.length;H++)Math.abs(u[H].t-A)<Math.abs(u[L].t-A)&&(L=H);l(L)};return d.jsxs("section",{className:"hist-series","aria-label":`${g} history`,children:[d.jsxs("div",{className:"hist-head",children:[d.jsx("span",{className:"hist-label",children:g}),d.jsxs("span",{className:"hist-stats",children:[b!=null&&d.jsxs(d.Fragment,{children:[d.jsx("b",{children:b}),d.jsxs("span",{children:[_," now"]})]}),S!=null&&d.jsxs(d.Fragment,{children:[d.jsx("b",{className:iq(S,p,f),children:S}),d.jsxs("span",{children:[_," peak"]})]})]})]}),d.jsx("div",{className:"hist-plot",ref:n,children:d.jsxs("svg",{className:"hist-chart",width:"100%",height:E,viewBox:`0 0 ${s} ${E}`,preserveAspectRatio:"none",role:"img","aria-label":b==null?`${g}: nothing measured yet`:`${g}: ${b}${_} now, peak ${S}${_}, over ${LT(u[0].t,u[u.length-1].t)}`,onPointerMove:P,onPointerLeave:()=>l(null),children:[[["warn",p],["hot",f]].map(([I,F])=>F==null||F>v?null:d.jsxs("g",{children:[d.jsx("line",{className:`hist-rule ${I}`,x1:vt.l,x2:s-vt.r,y1:wo(F,v,E),y2:wo(F,v,E)}),d.jsx("text",{className:`hist-rule-tag ${I}`,x:2,y:wo(F,v,E)+3,children:F})]},I)),d.jsx("line",{className:"hist-floor",x1:vt.l,x2:s-vt.r,y1:E-vt.b,y2:E-vt.b}),d.jsx("path",{className:"hist-area",d:sq(u,s,t,v,E)}),d.jsx("path",{className:"hist-line",d:rq(u,s,t,v,E)}),u.length===1&&d.jsx("circle",{className:"hist-dot",cx:M(u[0].t),cy:wo(u[0].v,v,E),r:3}),C&&d.jsxs("g",{children:[d.jsx("line",{className:"hist-cross",x1:M(C.t),x2:M(C.t),y1:vt.t,y2:E-vt.b}),d.jsx("circle",{className:"hist-dot",cx:M(C.t),cy:wo(C.v,v,E),r:3})]})]})}),d.jsx("div",{className:"hist-axis",children:C?d.jsxs("span",{className:"hist-at",children:[dl(C.t)," — ",d.jsx("b",{children:C.v}),_]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:u.length?dl(u[0].t):""}),d.jsx("span",{children:u.length?dl(u[u.length-1].t):""})]})}),N&&d.jsx("div",{className:"hist-note",children:N})]})}function uq(e){if(e==null||!Number.isFinite(e)||e<0)return"—";if(e<1024)return`${Math.round(e)} B`;const t=["KB","MB","GB","TB"];let n=e/1024,s=0;for(;n>=1024&&s<t.length-1;)n/=1024,s++;return`${n>=100?n.toFixed(0):n.toFixed(1)} ${t[s]}`}function dq(e){return e==null||!Number.isFinite(e)||e<0?"—":e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h`:`${Math.floor(e/86400)}d`}function fq({procs:e,total:t,onClose:n}){const s=Sn(n),[i,a]=k.useState(qT),l=nw(e,i);return ww.createPortal(d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:s,className:"modal pl-modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[d.jsxs("div",{className:"modal-head",children:[d.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),d.jsxs("span",{className:"pl-count",children:[l.length," of ",t," running"]}),d.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),d.jsx("div",{className:"pl-body",children:l.length===0?d.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):d.jsxs("table",{className:"sd-procs pl-table",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx(Qr,{col:"cpu",label:"cpu",sort:i,onSort:a}),d.jsx(Qr,{col:"rss",label:"memory",sort:i,onSort:a}),d.jsx(Qr,{col:"threads",label:"threads",sort:i,onSort:a}),d.jsx(Qr,{col:"uptime",label:"up",sort:i,onSort:a}),d.jsx(Qr,{col:"user",label:"user",sort:i,onSort:a}),d.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),d.jsx(Qr,{col:"name",label:"process",sort:i,onSort:a})]})}),d.jsx("tbody",{children:l.map(u=>d.jsxs("tr",{children:[d.jsx("td",{className:"sd-num",children:u.cpu==null?"—":u.cpu.toFixed(0)}),d.jsx("td",{className:"sd-num sd-dim",title:`${u.mem.toFixed(1)}% of installed memory`,children:uq(u.rssBytes)}),d.jsx("td",{className:"sd-num sd-dim",children:u.threads??"—"}),d.jsx("td",{className:"sd-num sd-dim",children:dq(u.uptimeSec)}),d.jsx("td",{className:"sd-dim pl-user",children:u.user??"—"}),d.jsx("td",{className:"sd-num sd-dim pl-pid",children:u.pid}),d.jsxs("td",{className:"pl-name",children:[u.name,u.cmd&&d.jsxs("span",{className:"pl-cmd",title:u.cmd,children:[" ",u.cmd]})]})]},u.pid))})]})}),d.jsxs("div",{className:"pl-foot",children:["The busiest by processor and by memory, refreshed every four seconds. Not every process on the machine. Memory is resident set size, which is what ",d.jsx("code",{children:"ps"})," and Task Manager report; macOS Activity Monitor shows a different figure. Command lines have anything secret-shaped removed, which is a filter and not a guarantee."]})]})}),document.body)}const hq=3e3,pq=4e3,lh=20,nl=36,Ai=8,mq=8,qT={key:"cpu",dir:"desc",rank:"cpu"},gq={cpu:"cpu",mem:"mem",rss:"mem"};function yq(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc",rank:gq[t]??e.rank}}function nw(e,t){const n=t.dir==="asc"?1:-1,s=a=>t.key==="cpu"?a.cpu:t.key==="mem"?a.mem:t.key==="rss"?a.rssBytes:t.key==="threads"?a.threads:a.uptimeSec,i=(a,l)=>{if(t.key==="name")return n*a.name.localeCompare(l.name,void 0,{sensitivity:"base"});if(t.key==="user"){const p=a.user??"",f=l.user??"";return!p||!f?p===f?0:p?-1:1:n*p.localeCompare(f,void 0,{sensitivity:"base"})}const u=s(a),h=s(l);return u==null||h==null?u==null?h==null?0:1:-1:n*(u-h)};return[...e].sort((a,l)=>i(a,l)||(l.cpu??-1)-(a.cpu??-1)||l.mem-a.mem||a.pid-l.pid)}function vq(e,t,n=mq){const s=nw(e,{key:t.rank,dir:"desc",rank:t.rank});return nw(s.slice(0,n),t)}function wq(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}function xq(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function bq(e,t,n=Date.now()){const s=Math.max(0,Math.min(100,100-e));return{pct:s,value:`${s}%`,tone:s===0?"calm":s>=30?"hot":"warn",note:s>0?`CPU held to ${e}% of full speed to cool down`:t?`at full speed · held to ${100-t.peak}% ${kq(t.lastMs,n)}`:"running at full speed, and never held back"}}function kq(e,t=Date.now()){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<2)return"just now";if(n<60)return`${n} minutes ago`;const s=Math.floor(n/60);return s===1?"an hour ago":`${s} hours ago`}const DT="agent-dag.systemPanelOpen";function _q(){return Zi(DT)==="1"}function Sq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(DT,e?"1":"0")}catch{}}function xo(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 Nq(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),s=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${s}m`:`${s}m`}function Eq(){const[e,t]=k.useState(null),n=k.useRef(null);return k.useEffect(()=>{let s=!0;const i=async()=>{if(document.visibilityState!=="hidden")try{const h=await fetch("/api/system");if(!h.ok)return;const p=await h.json();s&&(p!=null&&p.ok)&&t(p)}catch{}},a=()=>{n.current==null&&(i(),n.current=window.setInterval(i,hq))},l=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},u=()=>{if(document.visibilityState==="hidden"){l();return}a(),i()};return a(),document.addEventListener("visibilitychange",u),()=>{s=!1,l(),document.removeEventListener("visibilitychange",u)}},[]),e}function Cq(e,t=!1){const[n,s]=k.useState(null);return k.useEffect(()=>{let i=!0;const a=async()=>{if(document.visibilityState!=="hidden")try{const u=await fetch(`/api/system/processes${t?"?detail=1":""}`);if(!u.ok)return;const h=await u.json();i&&(h!=null&&h.ok)&&s({procs:h.procs??[],total:h.total??0})}catch{}};a();const l=window.setInterval(a,pq);return()=>{i=!1,window.clearInterval(l)}},[e,t]),n}function jq({usageOpen:e=!1}){const t=Eq(),[n,s]=k.useState(_q);k.useEffect(()=>{Sq(n)},[n]);const i=k.useRef(null),a=k.useRef(null);if(k.useEffect(()=>{if(n)return Fi.push(()=>{var _,N;const S=((_=a.current)==null?void 0:_.contains(document.activeElement))??!1;s(!1),S&&((N=i.current)==null||N.focus())},vT)},[n]),!t||t.cpu==null||!t.memory)return d.jsx("span",{className:"sysmeter idle",title:"Sampling this machine…",children:d.jsx("span",{className:"sm-box","aria-hidden":!0,children:d.jsxs("span",{className:"sm-graphic",children:[d.jsx("svg",{className:"sm-spark",width:nl,height:Ai,viewBox:`0 0 ${nl} ${Ai}`}),d.jsx("span",{className:"sm-ram"})]})})});const{cpu:l,cpuHistory:u,cores:h,memory:p,loadavg:f}=t,g=p.usedPct>=90,v=u.slice(-lh),w=lh-v.length,E=nl/lh,b=[`CPU ${l.toFixed(0)}% of ${h} cores`,f?`load ${f[0]} · ${f[1]} · ${f[2]} (1m · 5m · 15m)`:null,`Memory ${xo(p.total-p.available)} of ${xo(p.total)} used`,"","Click for detail. This machine, not this session."].filter(S=>S!==null).join(`
|
|
78
|
+
`);return d.jsxs("span",{className:"sysmeter-wrap",children:[d.jsxs("button",{type:"button",ref:i,className:"sysmeter",title:b,"aria-label":"Toggle machine detail","aria-expanded":n,"aria-controls":n?"system-panel":void 0,onClick:()=>s(S=>!S),children:[d.jsxs("span",{className:"sm-box","aria-hidden":!0,children:[d.jsxs("span",{className:"sm-graphic",children:[d.jsx("svg",{className:"sm-spark",width:nl,height:Ai,viewBox:`0 0 ${nl} ${Ai}`,children:v.map((S,_)=>{const N=w+_,C=Math.max(1,S/100*Ai),j=.32+.68*((_+1)/v.length);return d.jsx("rect",{x:N*E,y:Ai-C,width:Math.max(.8,E-.7),height:C,rx:.5,fill:"var(--accent)",opacity:j},N)})}),d.jsx("span",{className:"sm-ram",children:d.jsx("span",{className:`sm-ram-fill${g?" warn":""}`,style:{transform:`scaleX(${Math.max(2,p.usedPct)/100})`}})})]}),d.jsxs("span",{className:"sm-read",children:[d.jsx("b",{children:l.toFixed(0)}),d.jsx("i",{children:"·"}),d.jsx("b",{children:p.usedPct.toFixed(0)})]})]}),d.jsxs("span",{className:"sm-sr",children:["CPU ",l.toFixed(0)," percent, memory ",p.usedPct.toFixed(0)," percent used"]})]}),n&&d.jsx(Tq,{sys:t,usageOpen:e,panelRef:a,onClose:()=>{var S;s(!1),(S=i.current)==null||S.focus()}})]})}function Tq({sys:e,usageOpen:t,panelRef:n,onClose:s}){const[i,a]=k.useState(!1),l=Cq(!0,i),{memory:u,swap:h,perCore:p,loadavg:f,cores:g,uptimeSec:v,platform:w,thermal:E}=e,b=u?u.total-u.available:0,S=w==="win32"?"Commit":"Swap",_=h&&h.total>0?h.used/h.total*100:0;return d.jsxs("aside",{ref:n,className:`sysdetail${t?" shifted":""}`,id:"system-panel","aria-label":"Machine detail",children:[d.jsxs("div",{className:"sd-head",children:[d.jsx("span",{className:"sd-title",children:"This machine"}),d.jsxs("span",{className:"sd-sub",children:["up ",Nq(v)," · ",g," cores"]}),d.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:s,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),p&&p.length>0&&d.jsx("div",{className:"sd-section",role:"group","aria-label":"Cores",children:d.jsx(ku,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:d.jsx("div",{className:"sd-cores",style:{"--n":p.length},children:p.map((N,C)=>d.jsx("span",{className:"sd-core",title:`core ${C+1}: ${N}%`,children:d.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,N)/100})`}})},C))})})}),d.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:d.jsxs(ku,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[u&&d.jsx($u,{label:"Physical",value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:xo(b)})," of ",xo(u.total)]}),pct:u.usedPct,tone:u.usedPct>=90?"warn":"calm",note:`${xo(u.available)} available`}),h&&h.total>0&&d.jsx($u,{label:S,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:xo(h.used)})," of ",xo(h.total)]}),pct:_,tone:_>=90?"warn":"calm",note:_>=50?"paging to disk":void 0})]})}),f&&d.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:d.jsxs(ku,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[d.jsx("div",{className:"sd-load",children:f.map((N,C)=>d.jsxs("span",{className:`sd-load-item${N>g?" over":""}`,children:[d.jsx("b",{children:N.toFixed(2)}),d.jsx("span",{children:["1m","5m","15m"][C]})]},C))}),d.jsx("div",{className:"sd-note",children:f[0]>g?`${(f[0]/g).toFixed(1)}× more work queued than cores to run it`:`within ${g} cores`})]})}),d.jsx(Rq,{thermal:E}),d.jsx(Aq,{read:l,all:i,setAll:a})]})}function ku({group:e,title:t,action:n,label:s,children:i}){const[a,l]=k.useState(!1);return d.jsxs(d.Fragment,{children:[d.jsxs("button",{type:"button",className:"sd-open",onClick:()=>l(!0),title:n,"aria-label":n,children:[d.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[s," ",d.jsx("i",{className:"sd-row-more",children:"›"})]}),i]}),a&&d.jsx(lq,{group:e,title:t,onClose:()=>l(!1)})]})}function Rq({thermal:e}){if(!e)return null;const t=e.throttle?bq(e.throttle.speedLimit,e.heldBack):null;return d.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:d.jsxs(ku,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>d.jsx($u,{label:n.label,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:xq(n.celsius,n.warnAt,n.critAt)},n.label)),t&&d.jsx($u,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function Aq({read:e,all:t,setAll:n}){const[s,i]=k.useState(qT),a=(e==null?void 0:e.procs)??null;return d.jsxs("div",{className:"sd-section",role:"group","aria-label":"Busiest processes",children:[d.jsxs("div",{className:"sd-hrow",children:[d.jsx("div",{className:"sd-h","aria-hidden":!0,children:"Busiest processes"}),a!=null&&a.length>0&&d.jsxs("button",{type:"button",className:"sd-all",onClick:()=>n(!0),title:"Show every process the deck is watching","aria-label":"Show every process the deck is watching",children:["more ",d.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]})]}),t&&e&&d.jsx(fq,{procs:e.procs,total:e.total,onClose:()=>n(!1)}),a==null?d.jsx("div",{className:"sd-note",children:"reading…"}):a.length===0?d.jsx("div",{className:"sd-note",children:"Could not read the process list on this platform."}):d.jsxs("table",{className:"sd-procs",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx(Qr,{col:"cpu",label:"cpu",sort:s,onSort:i}),d.jsx(Qr,{col:"mem",label:"mem",sort:s,onSort:i}),d.jsx(Qr,{col:"name",label:"process",sort:s,onSort:i})]})}),d.jsx("tbody",{children:vq(a,s).map(l=>d.jsxs("tr",{children:[d.jsx("td",{className:"sd-num",children:l.cpu==null?"—":l.cpu.toFixed(0)}),d.jsx("td",{className:"sd-num sd-dim",children:l.mem.toFixed(1)}),d.jsx("td",{className:"sd-proc-name",title:`pid ${l.pid}`,children:l.name})]},l.pid))})]})]})}function Qr({col:e,label:t,sort:n,onSort:s}){const i=wq(n,e);return d.jsx("th",{scope:"col","aria-sort":i,children:d.jsxs("button",{type:"button",className:"sd-sort",title:`Sort by ${t}`,onClick:()=>s(yq(n,e)),children:[t,d.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}function $u({label:e,value:t,pct:n,tone:s="calm",note:i}){return d.jsxs("div",{className:"sd-row",children:[d.jsxs("div",{className:"sd-row-head",children:[d.jsx("span",{className:"sd-row-label",children:e}),d.jsx("span",{className:"sd-row-val",children:t})]}),d.jsx("span",{className:"sd-track",children:d.jsx("span",{className:`sd-fill${s==="calm"?"":` ${s}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}})}),i&&d.jsx("div",{className:"sd-note",children:i})]})}const M1=18,Mq=1100,Mi=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},Iq=Array.from({length:M1},(e,t)=>{const n=-72+144*t/(M1-1)+(Mi(t,1)-.5)*9,s=(n-90)*(Math.PI/180),i=(54+32*Math.cos(n*Math.PI/180))*(.74+Mi(t,2)*.52);return{dx:Math.cos(s)*i,dy:Math.sin(s)*i,rot:(t%2?1:-1)*(100+Mi(t,3)*260),delay:Math.round(Mi(t,4)*90),dur:760+Math.round(Mi(t,5)*260),scale:.8+Mi(t,6)*.45,hue:t%4,round:t%3===0}});function I1({anchor:e}){var i;const[t,n]=k.useState(null),s=typeof window<"u"&&((i=window.matchMedia)==null?void 0:i.call(window,"(prefers-reduced-motion: reduce)").matches);return k.useEffect(()=>{if(s)return;const a=e.current;if(!a)return;const l=a.getBoundingClientRect();n({x:l.left+l.width/2,y:l.top+l.height/2});const u=window.setTimeout(()=>n(null),Mq);return()=>window.clearTimeout(u)},[e,s]),s||!t?null:ww.createPortal(d.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:Iq.map((a,l)=>d.jsx("span",{className:`confetti-bit${a.round?" round":""}`,"data-hue":a.hue,style:{"--dx":`${a.dx.toFixed(1)}px`,"--dy":`${a.dy.toFixed(1)}px`,"--rot":`${a.rot}deg`,"--s":a.scale.toFixed(2),animationDelay:`${a.delay}ms`,animationDuration:`${a.dur}ms, ${a.dur}ms`}},l))}),document.body)}const FT=new Set(["awaiting_url","awaiting_code","registering"]);function Oq(e){return e!=null&&FT.has(e)}function zT(e){return e!=null&&e!=="done"&&!FT.has(e)}const Pq="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",$q="the sign-in did not complete";function Lq({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?Pq:$q)}}const qq="done";function Dq(){let e=!1;return{shouldAnnounce(t){return t!==qq?(e=!1,!1):e?!1:(e=!0,!0)}}}function Dw(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const Fq={already_running:"a sign-in is already in progress",no_url:"the claude CLI did not offer a sign-in link — is it installed?",not_waiting:"that sign-in is no longer waiting for a code",not_prompted:"the CLI has not asked for a code yet",code_rejected:"that code was not accepted — copy it again from the browser",no_verdict:"the claude CLI has not answered — try the code again",empty_code:"paste the code from the browser first",login_failed:"the code was not accepted",no_identity:"signed in, but the CLI still reports nobody logged in",add_failed:"signed in, but claude-swap could not record the account",not_a_share:"that does not look like a shared account — it should start with ccdeck2:",corrupt:"that share is incomplete — copy the whole thing",wrong_version:`that share was made by a newer ${zt}`,expired:"that share has expired — make a new one",import_failed:"claude-swap refused the import",unreadable_export:"claude-swap wrote something this deck could not read — try again, and upgrade it if this repeats",mixed_versions:"claude-swap changed format part-way through — try again",nothing_to_share:"none of those accounts could be exported",too_many:"that is more accounts than one share can carry",not_in_bundle:"that account is not in this share",bad_value:"an alias can only use letters, numbers, spaces, dots, dashes and underscores, up to 64 characters, and cannot start with a dash",bad_email:"that does not look like an email address — it cannot contain spaces or start with a dash"},zq={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"},Bq=`claude-swap could not read the login keychain — start ${zt} from a Terminal window rather than a background service`;function rw(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(Gi(e)))return Bq;const n=Dw(zq,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function Gi(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const Uq={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"},Wq="ccusage could not be started — npx is not on this deck's PATH. Install Node's npm/npx, or put ccusage on PATH yourself";function Hq(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const Gq="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",Vq="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",Yq=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),Kq=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,Xq=/[\\/]_npx[\\/]/i,Qq=`the copy of ccusage ${zt} installed for itself`;function Zq(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function Jq(e,t){const n=eD(e,t),s=Zq(e);switch(e==null?void 0:e.stage){case"npx":return s?`ccusage failed on both of its paths. The managed install failed first — ${s} — and the deck then fell back to npx, where ${rl(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${rl(n)}`;case"managed":return`${Qq} failed to run: ${rl(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${rl(n)}`:`the ccusage this deck found on your PATH failed to run: ${rl(n)}`;default:return n}}const rl=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function eD(e,t){const n=Gi(e);if(Yq(n)){if(Xq.test(n))return Vq;if(Kq.test(n))return Gq}if(Hq(n))return Wq;const s=Dw(Uq,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function $i(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&zT(e.state))return e.error;const n=Dw(Fq,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function tD(e,t,n){if(n<=0||Pw(e))return{kind:"pass"};const s=t>=0&&t<n?t:-1;switch(e.key){case"ArrowRight":return{kind:"select",index:s===-1?0:(s+1)%n};case"ArrowLeft":return{kind:"select",index:s===-1?n-1:(s-1+n)%n};case"Home":return{kind:"select",index:0};case"End":return{kind:"select",index:n-1};default:return{kind:"pass"}}}function BT(e,t){const n=Math.round(e/1e3)-t;return n<=0?{text:"expired",tone:"gone"}:n<60?{text:`expires in ${n}s`,tone:"soon"}:{text:`expires in ${Math.round(n/60)}m`,tone:"ok"}}function nD(e){const t=new Map;for(const n of e){const s=(n.email??"").trim().toLowerCase();s&&t.set(s,(t.get(s)??0)+1)}return e.map(n=>{const s=(n.email??"").trim(),i=n.alias||s||`account ${n.num}`,a=[];return n.alias&&s&&a.push(s),s&&(t.get(s.toLowerCase())??0)>1&&a.push(n.org||`slot ${n.num}`),{num:n.num,label:i,sub:a.length?a.join(" · "):null}})}function rD(e){return e<=0?"Nothing picked yet.":e===1?"1 account — its sign-in token will be on your clipboard.":`${e} accounts — ${e} sign-in tokens will be on your clipboard.`}function sD(e){switch(e){case"imported":return"imported";case"healed":return"dead token replaced";case"updated":return"updated";case"present":return"already here";default:return"not imported"}}function oD(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(f=>f.state===p).length,s=[],i=n("imported");i&&s.push(`${i} of ${t} imported`);const a=n("healed");a&&s.push(`${a} had a dead token replaced`);const l=n("updated");l&&s.push(`${l} updated`);const u=n("present");u&&s.push(`${u} already here`);const h=n("failed");return h&&s.push(`${h} did not arrive`),`${s.join(", ")}.`}const iD=1500,cu=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],O1="aa-panel",P1=e=>`aa-tab-${e}`;async function sl(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const sw=de.forwardRef((e,t)=>d.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[d.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),d.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));sw.displayName="SuccessMark";function aD({onClose:e,onChanged:t}){const[n,s]=k.useState("login"),[i,a]=k.useState(null),[l,u]=k.useState(""),[h,p]=k.useState(""),[f,g]=k.useState(!1),[v,w]=k.useState(null),[E,b]=k.useState(null),[S,_]=k.useState(null),[N,C]=k.useState(null),j=k.useRef(""),M=k.useRef(!1),P=k.useRef(!1),I=k.useRef(null),F=k.useRef(null),O=k.useRef(null),A=k.useRef(null),L=k.useRef([]),H=k.useRef(!1),X=k.useCallback(()=>{M.current&&sl({action:"login-cancel"}).catch(()=>{}),e()},[e]),R=Sn(X,{focusRef:O}),K=k.useCallback(async()=>{if(!cr(P.current))return;P.current=!0,g(!0),w(null),M.current=!0;const D=await sl({action:"login"}).catch(()=>null);if(P.current=!1,g(!1),!(D!=null&&D.ok)){w($i(D,"could not start the sign-in"));return}a(D)},[]);k.useEffect(()=>{if(!Oq(i==null?void 0:i.state))return;const D=window.setInterval(async()=>{try{const J=await fetch("/api/claude-accounts/login");J.ok&&a(await J.json())}catch{}},iD);return()=>window.clearInterval(D)},[i]);const G=k.useRef(t);G.current=t;const ne=k.useState(Dq)[0];k.useEffect(()=>{var D;(i==null?void 0:i.state)==="awaiting_code"&&((D=I.current)==null||D.focus()),ne.shouldAnnounce(i==null?void 0:i.state)&&G.current()},[i==null?void 0:i.state,ne]),k.useEffect(()=>{var D;n==="paste"&&!H.current&&((D=F.current)==null||D.focus()),H.current=!1},[n]);const Q=k.useCallback(D=>{var V;const J=tD(D,cu.findIndex(ae=>ae.id===n),cu.length);J.kind!=="pass"&&(D.preventDefault(),H.current=!0,s(cu[J.index].id),(V=L.current[J.index])==null||V.focus())},[n]),W=k.useCallback(async()=>{var J;if(!cr(P.current))return;P.current=!0,g(!0),w(null);const D=await sl({action:"login-code",code:l}).catch(()=>null);if(P.current=!1,g(!1),!(D!=null&&D.ok)){w($i(D,"the code was not accepted")),D!=null&&D.state&&a(D),(J=I.current)==null||J.select();return}u(""),a(D)},[l,i]),ee=k.useCallback(async()=>{if(!cr(P.current))return;P.current=!0,g(!0),w(null);const D=await sl({action:"import",blob:h}).catch(()=>null);if(P.current=!1,g(!1),!(D!=null&&D.ok)){w($i(D,"the import failed"));return}j.current=h,p(""),C(null),b(D.results??[]),t()},[h,t]),$=k.useCallback(async D=>{const J=`${D.email}|${D.org??""}`;if(!cr(P.current)||!j.current)return;P.current=!0,g(!0),_(J),C(null);const V=await sl({action:"import",blob:j.current,force:!0,only:{email:D.email,org:D.org??""}}).catch(()=>null);if(P.current=!1,g(!1),_(null),!(V!=null&&V.ok)){C({key:J,text:$i(V,"that account could not be updated")});return}const ae=(V.results??[])[0];ae&&b(he=>he&&he.map(ye=>`${ye.email}|${ye.org??""}`===J?ae:ye)),t()},[t]),Y=(i==null?void 0:i.state)==="done"?i.account:null,ue=zT(i==null?void 0:i.state)||!!(v&&M.current&&!f),z=Lq({state:i==null?void 0:i.state,serverError:i==null?void 0:i.error,localError:v});return d.jsx("div",{className:"modal-backdrop",onClick:X,role:"presentation",children:d.jsxs("div",{ref:R,className:"modal aa-modal",onClick:D=>D.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:Q,children:cu.map((D,J)=>d.jsx("button",{type:"button",role:"tab",id:P1(D.id),ref:V=>{L.current[J]=V},"aria-selected":n===D.id,"aria-controls":O1,tabIndex:n===D.id?0:-1,className:`aa-tab${n===D.id?" on":""}`,onClick:()=>{H.current=!1,s(D.id)},children:D.label},D.id))})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:X,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsx("section",{className:"modal-body aa-body",id:O1,role:"tabpanel","aria-labelledby":P1(n),children:n==="login"?Y?d.jsxs("div",{className:"aa-done",children:[d.jsx(sw,{ref:A}),d.jsx(I1,{anchor:A}),d.jsx("h4",{children:Y.added?`Account ${Y.num} added`:"Credentials refreshed"}),d.jsxs("p",{className:"aa-note",children:[d.jsx("strong",{children:Y.email}),Y.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),d.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(i==null?void 0:i.state)==="awaiting_code"||(i==null?void 0:i.state)==="registering"?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:"1 · Approve in the browser"}),d.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),d.jsx("a",{className:"aa-link",href:i.url??"#",target:"_blank",rel:"noreferrer noopener",children:i.url})]}),d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),d.jsx("p",{className:"aa-note",children:"It usually finishes on its own — if the page says you are all set, there is nothing to do here."}),d.jsxs("div",{className:"aa-field",children:[d.jsx("input",{ref:I,type:"text",value:l,onChange:D=>u(D.target.value),onKeyDown:D=>{D.key==="Enter"&&l.trim()&&!f&&W()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:i.state==="registering"}),d.jsx("button",{type:"button",className:"btn primary",...lr(f,!l.trim()||i.state==="registering"),onClick:W,children:i.state==="registering"?"registering…":"Continue"})]}),(v||i.error)&&d.jsx("p",{className:"aa-err",children:v??i.error}),d.jsx("p",{className:"aa-note",children:"The code goes straight to the claude CLI on this machine. It is never stored or sent anywhere else."})]})]}):ue?d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:z.title}),d.jsx("p",{className:"aa-err",children:z.message}),d.jsx("button",{type:"button",className:"btn",onClick:()=>{M.current=!1,a(null),w(null),K()},children:"Try again"})]}):f||M.current?d.jsx("div",{className:"aa-step",children:d.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):d.jsxs("div",{className:"aa-step aa-primer",children:[d.jsx("h4",{children:"Sign in to Anthropic"}),d.jsx("p",{className:"aa-note",children:"Opens a browser tab where you approve the sign-in. It normally completes by itself; only if the page hands you a code does it need pasting back here. claude-swap records the account when it completes, and the account you are using now stays active."}),d.jsx("div",{className:"aa-actions",children:d.jsx("button",{type:"button",ref:O,className:"btn primary",onClick:K,children:"Open the sign-in page"})})]}):E?(()=>{const D=E.filter(J=>J.state==="imported").length;return d.jsxs("div",{className:"aa-done",children:[d.jsx(sw,{ref:A}),D>0&&d.jsx(I1,{anchor:A}),d.jsx("h4",{children:oD(E)}),E.length>0&&d.jsx("ul",{className:"aa-results",children:E.map(J=>{const V=`${J.email}|${J.org??""}`;return d.jsxs("li",{className:`aa-result ${J.state}`,children:[d.jsx("span",{className:"aa-result-who",children:J.email||(J.num?`slot ${J.num}`:"an account")}),d.jsx("span",{className:"aa-result-what",children:sD(J.state)}),J.state==="present"&&d.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":S===V,title:`Overwrite the stored login for ${J.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>$(J),children:S===V?"updating…":"update anyway"}),(N==null?void 0:N.key)===V&&d.jsx("span",{className:"aa-result-err",children:N.text})]},V)})}),d.jsxs("p",{className:"aa-note",children:["Nothing changed on the deck you copied this from. An account already here is left as it is, unless its stored login was dead or you pressed",d.jsx("strong",{children:" update anyway"}),"."]}),d.jsxs("div",{className:"aa-actions",children:[d.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),d.jsx("button",{type:"button",className:"btn",onClick:()=>{j.current="",C(null),b(null)},children:"Import another"})]})]})})():d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:"Paste an account shared from another deck"}),d.jsxs("div",{className:"aa-field",children:[d.jsx("input",{ref:F,type:"text",value:h,onChange:D=>p(D.target.value),onKeyDown:D=>{D.key==="Enter"&&h.trim()&&!f&&ee()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),d.jsx("button",{type:"button",className:"btn primary",...lr(f,!h.trim()),onClick:ee,children:f?"importing…":"Import"})]}),v&&d.jsx("p",{className:"aa-err",children:v}),d.jsxs("p",{className:"aa-note",children:["Use ",d.jsx("strong",{children:"share"})," on one account in the other deck, or ",d.jsx("strong",{children:"↗"})," above its list to send several at once. A share carries a live login for every account in it and expires ten minutes after it is made."]})]})})]})})}async function lD(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const cD=1800;function uD({accounts:e,onClose:t,copyText:n}){const[s,i]=k.useState([]),[a,l]=k.useState(null),[u,h]=k.useState(!1),[p,f]=k.useState(null),[g,v]=k.useState(!1),[w,E]=k.useState(()=>Math.floor(Date.now()/1e3)),b=k.useRef(null),S=k.useRef(!1),_=Sn(t,{focusRef:b});k.useEffect(()=>{if(!a)return;E(Math.floor(Date.now()/1e3));const A=window.setInterval(()=>E(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(A)},[a]);const N=nD(e),C=e.filter(A=>!s.includes(A.num)).map(A=>A.num),j=C.length===e.length,M=A=>i(L=>L.includes(A)?L.filter(H=>H!==A):[...L,A]),P=k.useCallback(async()=>{if(!cr(S.current)||!C.length)return;S.current=!0,h(!0),f(null),v(!1);const A=await lD({action:"share",accounts:C}).catch(()=>null);if(S.current=!1,h(!1),!(A!=null&&A.ok)){f($i(A,"the share could not be made"));return}l({blob:A.blob,expiresAt:A.expiresAt,shared:A.shared??[],failed:A.failed??[]})},[e,C]),I=a?BT(a.expiresAt,w):null,F=(I==null?void 0:I.tone)==="gone",O=(a==null?void 0:a.shared.length)??0;return d.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:d.jsxs("div",{ref:_,className:"modal sa-modal",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("h3",{children:"Share accounts"})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsx("section",{className:"modal-body sa-body",children:a?d.jsxs("div",{className:"sa-step",children:[d.jsx("h4",{children:F?"This share has expired":O===1?"1 account, ready to paste":`${O} accounts, ready to paste`}),d.jsx("code",{className:`ap-share-blob${F?" sa-dead":""}`,children:a.blob}),d.jsxs("div",{className:"ap-share-foot",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",ref:b,onClick:async()=>{if(F){l(null),P();return}await n(a.blob)&&(v(!0),window.setTimeout(()=>v(!1),cD))},children:F?"make a new share":g?"copied":`copy ${O===1?"the share":"all "+O}`}),d.jsxs("span",{className:"ap-manage-hint",title:"This text is the sign-in for every account in it. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the logins themselves are in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign those accounts out and back in.",children:[d.jsx("span",{className:"ap-share-warn",children:O===1?"this is the password":`this is ${O} passwords`})," · ",d.jsx("span",{className:`ap-share-expiry ${I==null?void 0:I.tone}`,children:I==null?void 0:I.text})]})]}),a.failed.length>0&&d.jsxs("div",{className:"sa-failed",role:"alert",children:[d.jsx("p",{className:"sa-failed-head",children:a.failed.length===1?"One account is not in this bundle:":`${a.failed.length} accounts are not in this bundle:`}),d.jsx("ul",{className:"sa-list",children:a.failed.map(A=>{var H;const L=!!(A.email&&((H=A.detail)!=null&&H.includes(A.email)));return d.jsxs("li",{children:[!L&&d.jsx("span",{className:"sa-who",children:A.email||`account ${A.num}`}),d.jsx("span",{className:"sa-why",children:A.detail||"could not be exported"})]},`${A.num}-${A.email}`)})})]}),d.jsx("p",{className:"sa-note",children:F?d.jsx(d.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):d.jsxs(d.Fragment,{children:["Paste it into the other deck with ",d.jsx("strong",{children:"+"})," → ",d.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),d.jsxs("div",{className:"sa-actions",children:[d.jsx("button",{type:"button",className:"btn",onClick:()=>{l(null),v(!1)},children:"Pick again"}),d.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?d.jsxs("div",{className:"sa-step",children:[d.jsx("h4",{children:"Nothing to share"}),d.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",d.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),d.jsx("div",{className:"sa-actions",children:d.jsx("button",{type:"button",className:"btn primary",ref:b,onClick:t,children:"Close"})})]}):d.jsxs("div",{className:"sa-step",children:[d.jsxs("h4",{children:["Which accounts go to the other ",zt,"?"]}),d.jsx("p",{className:`sa-count${C.length?"":" empty"}`,children:rD(C.length)}),d.jsx("ul",{className:"sa-list sa-pick",children:N.map(A=>d.jsx("li",{children:d.jsxs("label",{className:"sa-row",children:[d.jsx("input",{type:"checkbox",checked:C.includes(A.num),onChange:()=>M(A.num)}),d.jsx("span",{className:"sa-who",children:A.label}),A.sub&&d.jsx("span",{className:"sa-sub",children:A.sub})]})},A.num))}),p&&d.jsx("p",{className:"aa-err",children:p}),d.jsxs("div",{className:"sa-actions",children:[d.jsx("button",{type:"button",className:"btn",onClick:()=>i(j?e.map(A=>A.num):[]),children:j?"Clear all":"Select all"}),d.jsx("button",{type:"button",className:"btn primary",ref:b,...lr(u,!C.length),onClick:P,children:u?"making the share…":C.length===0?"Share":C.length===1?"Share 1 account":`Share ${C.length} accounts`})]})]})})]})})}function dD(e,t){const n=new Set(e),s=e.length?Math.max(...e):0;return[...new Set([...e,s+1])].sort((i,a)=>i-a).map(i=>{const a=i===t?"here":n.has(i)?"swap":"free";return{slot:i,kind:a,label:a==="here"?`slot ${i}`:`slot ${i} · ${a}`}})}function fD(e,t,n){if(!(n!=null&&n.ok))return null;const s=Number.isInteger(n.to)?n.to:null;if(s==null)return{menuFor:null,confirmRemove:null,shareFor:null,swapNote:null};const i=n.swapped===!0&&s!==t;return{menuFor:e.menuFor===t?s:i&&e.menuFor===s?t:e.menuFor,confirmRemove:null,shareFor:null,swapNote:i?{at:s,displaced:t}:null}}function hD(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function pD(e,t,n){var i;const s=((i=e.find(a=>a.slot===t))==null?void 0:i.kind)??"here";return s==="swap"?{label:"swap",done:"swapped",sends:!0,swaps:!0,title:`Send this account to slot ${t}. That slot is taken, so the two accounts trade places and the one standing there moves to slot ${n}.`}:s==="free"?{label:"move",done:"moved",sends:!0,swaps:!1,title:`Send this account to slot ${t}. That slot is empty, so no other account moves.`}:{label:"move",done:"here",sends:!1,swaps:!1,title:`This account already holds slot ${n}.`}}function mD(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 $1(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function L1(e){const t=e.filter(u=>!$1(u)),n=e.filter(u=>$1(u)),s=t.length?t:n,i=t.length?n:[],a=s.reduce((u,h)=>u&&u.pct>=h.pct?u:h,null);let l=null;for(const u of i)a&&u.pct<=a.pct||(!l||u.pct>l.pct)&&(l=u);return{shown:s,rest:i,fuller:l,peak:l??a}}function gD(e,t,n){return e<1?null:t?"fewer":n?`${n.label} ${Math.round(n.pct)}%`:`${e} more`}function yD(e,t,n,s){const i=e==null?"No usage has been collected for this account yet.":`${Math.round(e)}% left on ${t??"the window that runs out first"}, which is the one that runs out first.`,a=n===1?"the other window":`the other ${n} windows`;return`${i} ${s?"Hide":"Show"} ${a}.`}const vD="\0";function Fw(e){const t=typeof e.email=="string"?e.email.trim():"";if(!t)return`slot:${e.num}`;const n=typeof e.org=="string"?e.org.trim():"";return`acct:${t}${vD}${n}`}function wD(e,t){const n=Fw(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function xD(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(Fw)),s=e.filter(i=>n.has(i));return s.length===e.length?e:s}const bD=64;function kD(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const _D=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function q1(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function SD(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=Gi(t.body);return{text:rw(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function D1(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 F1=15e3,ND=8e3,ch=1800,ED=3e4,CD=[70,80,85,90,95];function z1(e,t){return RT(t-Math.floor(e/1e3))}function jD(e,t){if(!e)return"";const n=Math.floor(e/1e3)-t;return n<=0?" · due":n<60?` · next in ${n}s`:` · next in ${Math.round(n/60)}m`}function TD(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 B1({lane:e,nowSec:t}){const n=Math.min(100,Math.max(0,e.pct)),s=n>=90?"var(--err)":n>=70?"var(--warn)":"var(--accent)",i=e.resetAt?AT(e.resetAt,t):null;return d.jsxs("div",{className:"ap-lane",children:[d.jsx("span",{className:"ap-lane-label",children:e.label}),d.jsx("div",{className:"ap-lane-track",children:d.jsx("div",{className:"ap-lane-fill",style:{width:`${n===0?1.5:n}%`,background:s,opacity:n===0?.4:1}})}),d.jsxs("span",{className:"ap-lane-pct",style:{color:s},children:[n,"%"]}),d.jsx("span",{className:"ap-lane-reset",children:i?`resets ${i}`:""})]})}async function U1(e){var n;let t=!1;try{t=await Promise.race([((n=navigator.clipboard)==null?void 0:n.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(s=>window.setTimeout(()=>s(!1),500))])}catch{t=!1}if(t)return!0;try{const s=document.createElement("textarea");s.value=e,s.setAttribute("readonly",""),s.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(s),s.select(),t=document.execCommand("copy"),s.remove()}catch{t=!1}return t}function RD({onClose:e}){var He,ct,je,Ge,Ke;const[t,n]=k.useState(null),[s,i]=k.useState(null),[a,l]=k.useState(null),[u,h]=k.useState(!1),[p,f]=k.useState(null),[g,v]=k.useState(()=>Math.floor(Date.now()/1e3)),w=k.useRef(null),[E,b]=k.useState(null),[S,_]=k.useState(!1),[N,C]=k.useState(""),[j,M]=k.useState(null),[P,I]=k.useState(null),[F,O]=k.useState(null),[A,L]=k.useState(!1),[H,X]=k.useState(!1),[R,K]=k.useState(null),[G,ne]=k.useState(null),[Q,W]=k.useState(null),[ee,$]=k.useState(null),[Y,ue]=k.useState(!1),[z,D]=k.useState([]),J=k.useRef(null),V=k.useCallback(se=>IT(J.current)?(J.current=se,l(se),!0):!1,[]),ae=k.useCallback(()=>{J.current=null,l(null)},[]),he=(se,Pe=!1)=>{const $e=MT(a,se);return{disabled:$e.disabled,"aria-busy":$e.busy||Pe}},ye=k.useCallback(se=>{window.requestAnimationFrame(()=>{var Pe;if(z4(((Pe=document.activeElement)==null?void 0:Pe.tagName)??null))for(const $e of F4(se)){const Te=document.querySelector($e);if(Te){Te.focus();return}}})},[]),_e=k.useCallback(async(se=!1)=>{se&&h(!0);const Pe=new AbortController,$e=window.setTimeout(()=>Pe.abort(),ED);try{const[Te,Xe]=await Promise.all([fetch(`/api/claude-accounts${se?"?refresh=1":""}`,{signal:Pe.signal}),fetch("/api/cswap-auto",{signal:Pe.signal})]);if(Te.ok){const ot=await Te.json();n(ot),D(Ie=>xD(Ie,ot.accounts))}Xe.ok&&i(await Xe.json());const jt=SD([await q1(Te),await q1(Xe)]);f(ot=>D1(ot,jt))}catch{f(Te=>D1(Te,_D))}finally{window.clearTimeout($e),se&&h(!1)}},[]),Ve=k.useCallback(async(se,Pe)=>{if(!V(Pe))return null;f(null);try{const Te=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(se)})).json().catch(()=>null);return Te!=null&&Te.ok||f({text:rw(Te,"command failed"),raw:Gi(Te)}),Te}catch{return f({text:"server unreachable"}),null}finally{ae()}},[V,ae]),Be=k.useCallback(async(se,Pe)=>{if(!V(Pe))return null;f(null);try{const Te=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(se)})).json().catch(()=>null);return Te!=null&&Te.ok||f({text:$i(Te,"command failed")}),Te}catch{return f({text:"server unreachable"}),null}finally{ae()}},[V,ae]);k.useEffect(()=>(_e(!0),w.current=window.setInterval(()=>_e(!1),F1),()=>{w.current!=null&&window.clearInterval(w.current)}),[_e]),k.useEffect(()=>{const se=window.setInterval(()=>v(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(se)},[]);const qe=((He=s==null?void 0:s.settings["autoswitch.threshold"])==null?void 0:He.value)??"90",Se=ee??qe,ce=mD(Se,qe),be=(ct=t==null?void 0:t.accounts)==null?void 0:ct.find(se=>se.active),ke=((je=L1((be==null?void 0:be.lanes)??[]).peak)==null?void 0:je.pct)??null,Ye=ke!=null&&ke>=Number(qe)-15,dt=async se=>{if(V(`switch-${se}`)){f(null);try{const $e=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:se})})).json().catch(()=>null);$e!=null&&$e.ok||f({text:rw($e,"the switch failed"),raw:Gi($e)}),await _e(!0)}catch{f({text:"server unreachable"})}finally{ae(),ye(se)}}},lt=async(se,Pe)=>{const{commit:$e,alias:Te}=kD(N,Pe);if($e){const Xe=await Be({action:"alias",account:se,alias:Te},`alias-${se}`);if(await _e(!0),!(Xe!=null&&Xe.ok))return;C(Te)}M(se),window.setTimeout(()=>M(Xe=>Xe===se?null:Xe),ch)},pe=async(se,Pe)=>{const $e=await Be({action:"move",account:se,slot:Pe},`move-${se}`),Te=fD({menuFor:E,shareFor:(F==null?void 0:F.num)??null},se,$e);if(await _e(!0),Te){b(Te.menuFor),I(Te.confirmRemove),Te.shareFor==null&&(O(null),X(!1)),K(Te.swapNote);const Xe=Te.swapNote;Xe&&window.setTimeout(()=>K(jt=>jt===Xe?null:jt),ND),ne(null),ye(Te.menuFor)}return $e},me=async(se,Pe,$e)=>{if($e.sends){const Te=await pe(se,Pe);if(!(Te!=null&&Te.ok))return}W(se),window.setTimeout(()=>W(Te=>Te===se?null:Te),ch)},Me=async(se,Pe)=>{if(Pe.sends){const $e=await Ve({action:"setting",key:"autoswitch.threshold",value:se},"threshold");if(await _e(!0),!($e!=null&&$e.ok))return;$(null)}ue(!0),window.setTimeout(()=>ue(!1),ch)};return d.jsxs("aside",{className:"accounts-panel",id:"accounts-panel","aria-label":"Claude accounts",children:[d.jsxs("div",{className:"ap-header",children:[d.jsx("h2",{children:"Accounts"}),d.jsxs("div",{className:"ap-header-right",children:[d.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>_(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:"+"}),(((Ge=t==null?void 0:t.accounts)==null?void 0:Ge.length)??0)>0&&d.jsx("button",{type:"button",className:"glyph-btn ap-share-set",onClick:()=>L(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${zt} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:"↗"}),d.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>_e(!0),...he("reload",u),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:u?"…":"↻"}),d.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:"×"})]})]}),t==null?p?d.jsxs("div",{className:"ap-empty",role:"alert",children:[d.jsx("span",{title:p.raw||void 0,children:p.text}),d.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",F1/1e3," seconds."]}),d.jsx("button",{type:"button",className:"ap-fix",disabled:u,onClick:()=>_e(!0),children:u?"trying…":"try again"})]}):d.jsx("div",{className:"ap-empty",children:"Checking…"}):t.ok?d.jsxs(d.Fragment,{children:[(Ke=t.accounts)==null?void 0:Ke.map(se=>{const{shown:Pe,rest:$e,fuller:Te,peak:Xe}=L1(se.lanes),jt=z.includes(Fw(se)),ot=gD($e.length,jt,Te);return d.jsxs("div",{className:`ap-account${se.active?" active":""}`,children:[d.jsxs("div",{className:"ap-account-head",children:[d.jsx("span",{className:"ap-num",children:se.num}),se.alias&&d.jsx("span",{className:"ap-alias",title:se.alias,children:se.alias}),d.jsx("span",{className:"ap-email",title:se.email??void 0,children:se.email}),d.jsx("button",{type:"button",id:`ap-more-${se.num}`,className:`ap-more${E===se.num?" on":""}`,"aria-label":`Manage account ${se.num}`,"aria-expanded":E===se.num,"aria-controls":E===se.num?`ap-manage-${se.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{b(E===se.num?null:se.num),C(se.alias??""),I(null),O(null),X(!1),K(null),M(null),ne(null),W(null)},children:"⋯"}),se.active&&d.jsx("span",{className:"ap-badge-active",children:"active"}),se.disabled&&d.jsx("span",{className:"ap-badge-held",children:"held out"}),!se.active&&!se.disabled&&d.jsx("button",{type:"button",className:"ap-manage-btn ap-switch",...he(`switch-${se.num}`),onClick:()=>dt(se.num),title:`Switch to ${se.alias??se.email}`,children:a===`switch-${se.num}`?"…":"switch"})]}),d.jsx("div",{className:"ap-lanes",id:`ap-lanes-${se.num}`,children:Pe.length?d.jsxs(d.Fragment,{children:[Pe.map(Ie=>d.jsx(B1,{lane:Ie,nowSec:g},Ie.id)),jt&&$e.map(Ie=>d.jsx(B1,{lane:Ie,nowSec:g},Ie.id))]}):d.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),d.jsxs("div",{className:"ap-meta",children:[se.staleCopy&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"ap-stale-copy",title:"The deck can still see this account — its live usage is being read — but claude-swap's own stored copy of the login was rejected, so these numbers stopped updating. Resume re-captures the copy from the login you already have.",children:"numbers paused"}),d.jsx("button",{type:"button",className:"ap-fix",...he("recapture"),onClick:async()=>{const Ie=await Be({action:"recapture"},"recapture");Ie!=null&&Ie.ok&&_e(!0)},title:"Re-capture this account's stored credentials from the login you already have. No sign-in, no switch.",children:a==="recapture"?"resuming…":"resume"})]}),se.error&&(()=>{const Ie=TD(se.error);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"ap-err",title:Ie.hint,children:Ie.text}),Ie.fixable&&d.jsx("button",{type:"button",className:"ap-fix",onClick:()=>_(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),ot&&d.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":jt,"aria-controls":`ap-lanes-${se.num}`,title:yD(se.headroom,(Xe==null?void 0:Xe.label)??null,$e.length,jt),onClick:()=>D(Ie=>wD(Ie,se)),children:ot}),(((s==null?void 0:s.enabled)||(s==null?void 0:s.external))&&!se.active||se.disabled)&&d.jsx("button",{type:"button",className:"ap-rotate",...he(`rot-${se.num}`),onClick:()=>Ve({action:"account",account:se.num,enabled:se.disabled},`rot-${se.num}`).then(()=>_e(!0)),title:se.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:se.disabled?"put back":"hold out"}),se.fetchedAt?d.jsxs("span",{className:`ap-age${se.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 ",z1(se.fetchedAt,g),jD(se.nextAt,g)]}):d.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),E===se.num&&d.jsxs("div",{className:"ap-manage",id:`ap-manage-${se.num}`,role:"group","aria-label":`Manage account ${se.num}`,children:[d.jsxs("div",{className:"ap-manage-name",children:[d.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${se.num}`,children:"Alias"}),d.jsx("input",{id:`ap-alias-${se.num}`,className:"ap-manage-input",type:"text",value:N,onChange:Ie=>C(Ie.target.value),onKeyDown:Ie=>{Ie.key==="Enter"&<(se.num,se.alias)},maxLength:bD,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),d.jsx("button",{type:"button",className:"ap-manage-btn",...he(`alias-${se.num}`),onClick:()=>lt(se.num,se.alias),title:"A short name to show instead of the email",children:j===se.num?"saved":"save"})]}),(()=>{const Ie=dD((t.accounts??[]).map(gt=>gt.num),se.num),xt=hD(Ie,G,se.num),ft=pD(Ie,xt,se.num);return d.jsxs("div",{className:"ap-manage-slot",children:[d.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${se.num}`,children:"Slot"}),d.jsx("span",{className:"ap-field",children:d.jsx("select",{id:`ap-slot-${se.num}`,value:String(xt),...he(`move-${se.num}`),onChange:gt=>ne(Number(gt.target.value)),children:Ie.map(gt=>d.jsx("option",{value:gt.slot,children:gt.label},gt.slot))})}),d.jsx("button",{type:"button",className:"ap-manage-btn",...he(`move-${se.num}`),title:ft.title,onClick:()=>me(se.num,xt,ft),children:Q===se.num?ft.done:ft.label})]})})(),d.jsxs("div",{className:"ap-manage-acts",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",...he(`share-${se.num}`),title:`Copy this account to another ${zt}. Anyone who has the text can use the account — treat it as the password. The other deck stops accepting it after 10 minutes; that does not make an escaped copy safe.`,onClick:async()=>{X(!1);const Ie=await Be({action:"share",account:se.num},`share-${se.num}`);Ie!=null&&Ie.ok&&O({num:se.num,blob:Ie.blob,expiresAt:Ie.expiresAt})},children:"share"}),d.jsx("button",{type:"button",className:`ap-manage-btn danger${P===se.num?" armed":""}`,...he(`rm-${se.num}`),title:P===se.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(P!==se.num){I(se.num),window.setTimeout(()=>I(Ie=>Ie===se.num?null:Ie),4e3);return}I(null),Be({action:"remove",account:se.num},`rm-${se.num}`).then(()=>{b(null),_e(!0),ye(null)})},children:P===se.num?"confirm":"remove"})]}),(R==null?void 0:R.at)===se.num&&(()=>{var ft;const Ie=(ft=t.accounts)==null?void 0:ft.find(gt=>gt.num===R.displaced),xt=(Ie==null?void 0:Ie.alias)??(Ie==null?void 0:Ie.email)??"the account that was there";return d.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${R.at} was taken, so the two accounts traded places: ${xt} now holds slot ${R.displaced}.`,children:["swapped with slot ",R.displaced]})})(),(F==null?void 0:F.num)===se.num&&(()=>{const Ie=BT(F.expiresAt,g),xt=Ie.tone==="gone";return d.jsxs("div",{className:`ap-share${xt?" expired":""}`,children:[d.jsx("code",{className:"ap-share-blob",children:F.blob}),d.jsxs("div",{className:"ap-share-foot",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",...he(`share-${se.num}`),onClick:async()=>{if(xt){X(!1);const ft=await Be({action:"share",account:se.num},`share-${se.num}`);ft!=null&&ft.ok&&O({num:se.num,blob:ft.blob,expiresAt:ft.expiresAt});return}await U1(F.blob)&&(X(!0),window.setTimeout(()=>X(!1),1800))},children:xt?"make a new share":H?"copied":"copy"}),d.jsxs("span",{className:"ap-manage-hint",title:"This text is the account's password. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the login itself is in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign the account out and back in.",children:[d.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",d.jsx("span",{className:`ap-share-expiry ${Ie.tone}`,children:Ie.text})]})]})]})})()]})]},se.num)}),(s==null?void 0:s.ok)&&d.jsxs("div",{className:"ap-auto",children:[d.jsxs("div",{className:"ap-auto-head",children:[d.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),d.jsxs("span",{className:"ap-auto-ctl",children:[ke!=null&&d.jsxs("span",{className:`ap-auto-now${Ye?" near":""}`,children:[Math.round(ke),"%"]}),d.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:d.jsx("select",{"aria-label":"Switch threshold",value:Se,...he("threshold"),onChange:se=>$(se.target.value),children:CD.map(se=>d.jsxs("option",{value:se,children:[se,"%"]},se))})}),d.jsx("button",{type:"button",className:"ap-manage-btn",...he("threshold"),title:ce.title,onClick:()=>Me(Se,ce),children:Y?ce.done:ce.label}),d.jsxs("button",{type:"button",className:`ap-auto-state${s.enabled?" live":""}`,role:"switch","aria-checked":s.enabled,"aria-label":"Auto-switch",...he("enable"),onClick:()=>Ve({action:"enable",enabled:!s.enabled},"enable").then(()=>_e(!0)),title:s.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:[d.jsx("i",{className:s.enabled?"ap-pulse":"ap-dot","aria-hidden":!0}),s.enabled?"on":"off"]})]})]}),s.external&&d.jsxs("p",{className:"ap-auto-note",children:[d.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",d.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",s.enabled?" — this toggle takes over when you stop it.":"."]}),s.lastTick&&d.jsx("div",{className:"ap-auto-foot",children:d.jsxs("span",{className:"ap-auto-result",children:["checked ",z1(s.lastTick.at,g)]})})]}),p&&d.jsxs("div",{className:"ap-failure",role:"alert",children:[d.jsx("span",{className:"ap-failure-text",title:p.raw||void 0,children:p.text}),d.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),d.jsx("p",{className:"ap-footnote",title:"Anthropic's usage endpoint allows roughly 28–30 requests per hour per account, shared by every tool on this machine — polling it from here would rate-limit your account. So the deck never fetches: it asks claude-swap to collect while this panel is open, at most once every three minutes, and claude-swap decides whether that touches the network at all.",children:"These numbers only update while this panel is open."})]}):d.jsx("div",{className:"ap-empty",children:t.reason==="no_cswap"?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"claude-swap isn't installed."}),d.jsx("span",{className:"ap-hint",children:"This panel reads the account store claude-swap keeps — without it there is nothing to show. It is a separate tool, published on PyPI, so it does not come with this package."}),t.hint&&d.jsx("code",{className:"ap-cmd",children:t.hint}),d.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",d.jsx("strong",{children:"+"})," button above."]})]}):t.reason==="no_accounts"?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"No accounts added yet."}),d.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",d.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Couldn't read the account store."}),d.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",t.reason?` (${t.reason})`:"","."]})]})}),S&&d.jsx(aD,{onClose:()=>_(!1),onChanged:()=>_e(!0)}),A&&d.jsx(uD,{accounts:((t==null?void 0:t.accounts)??[]).map(se=>({num:se.num,email:se.email,alias:se.alias,org:se.org})),onClose:()=>L(!1),copyText:U1})]})}const AD=3e4;function MD({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function ID({bundle:e,running:t,pending:n,lastTried:s}){return t?MD({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function OD(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function PD({asked:e,reported:t}){return t?t!==e:!1}function $D(e){const t=e.thresholdMs??AD;return!e.enabled||e.kind!=="restart"||!e.canRestart||!e.noticeOpen?{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}}async function UT(e,t=500){var s;if(!e)return!1;let n=!1;try{n=await Promise.race([((s=navigator.clipboard)==null?void 0:s.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(i=>window.setTimeout(()=>i(!1),t))])}catch{n=!1}if(n)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(),n=document.execCommand("copy"),i.remove()}catch{n=!1}return n}function LD(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function qD(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.decks!="number"||typeof t.mine!="boolean")return null;const n=t.owner&&typeof t.owner=="object"?t.owner.port:null;return{path:typeof t.path=="string"&&t.path!==""?t.path:null,decks:t.decks,mine:t.mine,ownerPort:typeof n=="number"?n:null}}function DD(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function FD(e,t){const n=DD(e),s=n?`removes ${n} on the canvas`:null,i=u=>`This ${s?`${s} and ${u}`:u}`;if(!t)return{note:`${i("deletes the event log on disk")} — the file a restarted deck replays to rebuild what you see, and the file every deck on this machine shares unless one was told otherwise. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};if(!t.path)return{note:`${i("leaves nothing on disk — this deck keeps no event log")}. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};if(!t.mine){const u=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,h=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{note:`${i(`leaves the event log alone: ${u}${h}`)}. Clearing here empties this canvas only — restart this deck and the log replays back onto it. Layout, pins and selection go with it.`,confirm:"Clear this canvas"}}if(t.decks<=1)return{note:`${i("deletes this deck's event log")} — the file a restarted deck replays to rebuild what you see. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};const a=t.decks-1,l=a===1?"That deck keeps what is on its canvas until it restarts, and then it is gone there too.":"Those decks keep what is on their canvases until they restart, and then it is gone there too.";return{note:`${i(`deletes the event log ${a===1?"1 other running deck shares":`${a} other running decks share`} with this one`)} — every session recorded in it, not just the ones drawn here. ${l} This cannot be undone.`,confirm:"Clear everything"}}function zD({agentCount:e,onConfirm:t,onCancel:n}){const s=k.useRef(null),i=Sn(n,{focusRef:s,layer:e3}),[a,l]=k.useState(null);k.useEffect(()=>{let p=!1;return fetch("/api/clear").then(f=>f.ok?f.json():null).then(f=>{p||l(qD(f))}).catch(()=>{}),()=>{p=!0}},[]);const{note:u,confirm:h}=FD(e,a);return d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:i,className:"modal clear-confirm",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:"status-dot err","aria-hidden":!0}),d.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),d.jsxs("section",{className:"modal-body",children:[d.jsx("p",{className:"modal-note",children:u}),d.jsxs("div",{className:"cc-actions",children:[d.jsx("button",{type:"button",ref:s,className:"btn",onClick:n,children:"Cancel"}),d.jsx("button",{type:"button",className:"btn danger",onClick:t,children:h})]})]})]})})}const BD="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.",UD=[{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:"D",action:"detail panel",binds:["d","D"]},{cap:"H",action:"usage history",binds:["h","H"]},{cap:"A",action:"Claude accounts, where Claude Code is installed",binds:["a","A"]},{cap:"?",action:"this sheet",binds:["?"]}]},{title:"Settings",rows:[{cap:"M",action:"sound on or off",binds:["m","M"]},{cap:"T",action:"light or dark theme",binds:["t","T"]}]},{title:"Focus and selection",rows:[{cap:"Tab",action:"reach the agent cards",binds:[]},{cap:"Enter",action:"select the focused card",binds:["Enter"]},{cap:"Shift + Enter",action:"add the focused card to the selection",binds:["Enter"]},{cap:"Esc",action:"close what is open, deselect, release focus",binds:["Escape"]}]},{title:"Mouse",rows:[{cap:"drag",action:"move a node, and pin it where you dropped it",binds:[]},{cap:"shift-click",action:"add an agent to the selection",binds:[]},{cap:"click",action:"the topbar speaker opens volume and sound settings",binds:[]}]}];function WD({onClose:e}){const t=Sn(e);return d.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:t,className:"modal key-help",onClick:n=>n.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsxs("section",{className:"modal-body",children:[d.jsx("p",{className:"modal-note",children:BD}),d.jsx("div",{className:"shortcuts",children:UD.map(n=>d.jsxs(k.Fragment,{children:[d.jsx("h3",{className:"kh-group",children:n.title}),n.rows.map(s=>d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:s.cap}),d.jsx("span",{children:s.action})]},`${n.title}:${s.cap}:${s.action}`))]},n.title))})]})]})})}const HD=["done","needs-input"],GD=[{id:"two",label:"Two notes",notes:[{at:0,hz:740,ms:90},{at:.085,hz:440,ms:150}]},{id:"arc",label:"Descent",notes:[{at:0,hz:988,ms:80},{at:.07,hz:659,ms:80},{at:.14,hz:440,ms:160}]},{id:"tap",label:"Double tap",notes:[{at:0,hz:740,ms:55},{at:.055,hz:740,ms:55},{at:.165,hz:440,ms:150}]},{id:"chord",label:"Chord",trim:.7,notes:[{at:0,hz:988,ms:110},{at:0,hz:740,ms:110},{at:.1,hz:440,ms:170}]},{id:"bell",label:"Bell",type:"triangle",notes:[{at:0,hz:740,ms:120},{at:.11,hz:440,ms:260}]},{id:"blip",label:"Blip",type:"square",trim:.7,notes:[{at:0,hz:740,ms:55},{at:.06,hz:440,ms:90}]}],VD=[{id:"two",label:"Two notes",notes:[{at:0,hz:440,ms:90},{at:.085,hz:740,ms:150}]},{id:"arc",label:"Ascent",notes:[{at:0,hz:440,ms:80},{at:.07,hz:659,ms:80},{at:.14,hz:988,ms:160}]},{id:"tap",label:"Double tap",notes:[{at:0,hz:440,ms:55},{at:.055,hz:440,ms:55},{at:.165,hz:740,ms:150}]},{id:"chord",label:"Chord",trim:.7,notes:[{at:0,hz:440,ms:110},{at:.1,hz:740,ms:170},{at:.1,hz:988,ms:170}]},{id:"bell",label:"Bell",type:"triangle",notes:[{at:0,hz:440,ms:120},{at:.11,hz:740,ms:260}]},{id:"blip",label:"Blip",type:"square",trim:.7,notes:[{at:0,hz:440,ms:55},{at:.06,hz:740,ms:90}]}],zw={done:GD,"needs-input":VD},Vi="two";function ow(e,t){const n=zw[e];return n.find(s=>s.id===t)??n.find(s=>s.id===Vi)??n[0]}function WT(e,t){return zw[e].some(s=>s.id===t)?t:Vi}ow("done",Vi).notes,ow("needs-input",Vi).notes;const W1=.04,YD=.24,_u=0,Lu=100,iw=5,bl=50;function kl(e){if(!Number.isFinite(e))return bl;const t=Math.round(e/iw)*iw;return Math.min(Lu,Math.max(_u,t))}function KD(e){if(e==null)return bl;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?kl(Number(t)):bl}function XD(e){const t=kl(e),n=W1+(YD-W1)*(t/Lu);return Math.round(n*1e4)/1e4}function QD(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(XD(e)*s*1e4)/1e4}const ZD=160,JD="agent-dag.soundLevel.done",e5="agent-dag.soundLevel.needs-input",t5="agent-dag.soundFigure.done",n5="agent-dag.soundFigure.needs-input",HT={done:JD,"needs-input":e5},GT={done:t5,"needs-input":n5},aw={done:{level:bl,figure:Vi},"needs-input":{level:bl,figure:Vi}};function r5(e){const t=n=>({level:KD(e(HT[n])),figure:WT(n,e(GT[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const s5={Stop:"done",Notification:"needs-input"};function o5(e,t){var s;if(t)return null;const n=(s=e==null?void 0:e.payload)==null?void 0:s.hook_event_name;return typeof n!="string"?null:s5[n]??null}function i5(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null,s=!1;const i=()=>e.enabled()?s&&(n==null?void 0:n.state)==="running"?"ready":"locked":"off",a=()=>{var h;return(h=e.onState)==null?void 0:h.call(e,i())};function l(){var h;if(!(!t||s))try{n=n??new t,(h=n.resume)==null||h.call(n).then(a,()=>{}),s=!0,a()}catch{}}function u(h,p=!1){var E;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const f=(((E=e.prefs)==null?void 0:E.call(e))??aw)[h]??aw[h],g=ow(h,f.figure),v=QD(f.level,g),w=n.currentTime;for(const b of g.notes){const S=n.createOscillator(),_=n.createGain();S.type=g.type??"sine",S.frequency.value=b.hz;const N=w+b.at,C=N+b.ms/1e3;_.gain.setValueAtTime(1e-4,N),_.gain.exponentialRampToValueAtTime(v,N+.012),_.gain.exponentialRampToValueAtTime(1e-4,C),S.connect(_).connect(n.destination),S.start(N),S.stop(C+.02)}return!0}return{unlock:l,play:u,state:i,get context(){return n}}}const a5="Notify me when a session needs my attention.",l5="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",H1="Get notified when you're away from this tab.";function c5(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:H1};case"default":return{status:null,ask:!0,ok:!1,note:H1};case"denied":return{status:"Blocked",ask:!1,ok:!1,note:"Your browser is blocking them; only its own site settings can undo that. You'll still be told once this tab is closed."};default:return{status:"Unavailable",ask:!1,ok:!1,note:"This browser cannot show them. You'll still be told once this tab is closed."}}}const G1={done:"Turn finished","needs-input":"Claude is asking"},u5={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function d5({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:i,onFigure:a,onPreview:l,openerRef:u,notifyOn:h,onToggleNotify:p,notifyVetoed:f,notifyPermission:g,onAskNotify:v}){const w=c5(g),E=h&&!f,b=Sn(e),S=k.useRef(e);return S.current=e,k.useEffect(()=>{const _=N=>{var j,M;const C=N.target;C&&((j=b.current)!=null&&j.contains(C)||(M=u.current)!=null&&M.contains(C)||S.current())};return window.addEventListener("pointerdown",_,!0),()=>window.removeEventListener("pointerdown",_,!0)},[b,u]),d.jsxs("div",{ref:b,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[d.jsxs("div",{className:"sm-switches",children:[d.jsxs("label",{className:"sm-switch",children:[d.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),d.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-labelledby":"sm-sound-label",className:"sm-toggle",onClick:n,title:"A tone when a turn finishes, and when Claude asks for something",children:d.jsx("span",{className:"sm-toggle-knob"})})]}),d.jsxs("div",{className:"sm-setting",children:[d.jsxs("label",{className:"sm-switch",children:[d.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications"}),d.jsx("button",{type:"button",role:"switch","aria-checked":h,"aria-labelledby":"sm-notify-label",className:"sm-toggle",onClick:p,title:"A system notification when a session blocks on you",children:d.jsx("span",{className:"sm-toggle-knob"})})]}),d.jsx("p",{className:"sm-note",children:f?l5:a5})]})]}),E&&d.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[d.jsxs("div",{className:"sm-channel-head",children:[d.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),w.ask?d.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:v,children:"Enable"}):d.jsxs("span",{className:"sm-channel-state","data-ok":w.ok||void 0,children:[w.ok&&d.jsx("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:d.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),w.status]})]}),d.jsx("p",{className:"sm-note",children:w.note})]}),!t&&d.jsx("span",{id:"sm-preview-note",className:"vis-hidden",children:"Plays even when Sounds is off, so you can set a tone before turning sounds back on."}),d.jsx("div",{className:"sm-tones",children:HD.map(_=>{const N=s[_],C=`sm-level-${_}`,j=`sm-figure-${_}`;return d.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${_}`,children:[d.jsxs("div",{className:"sm-tone-head",children:[d.jsx("h3",{className:"sm-tone-name",id:`sm-name-${_}`,children:G1[_]}),d.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>l(_),"aria-label":`Hear the ${G1[_].toLowerCase()} tone`,title:t?"Play this tone now, at what it is set to":"Plays even when Sounds is off","aria-describedby":t?void 0:"sm-preview-note",children:[d.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:d.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),d.jsxs("div",{className:"sm-row",children:[d.jsx("label",{htmlFor:C,children:"Volume"}),d.jsx("input",{id:C,type:"range",min:_u,max:Lu,step:iw,value:N.level,onChange:M=>i(_,Number(M.target.value)),style:{"--sm-level":`${(N.level-_u)/(Lu-_u)*100}%`}}),d.jsxs("span",{className:"sm-read",children:[N.level,"%"]})]}),d.jsxs("div",{className:"sm-row",children:[d.jsx("label",{htmlFor:j,children:"Tone"}),d.jsx("select",{id:j,className:"sm-select",value:N.figure,onChange:M=>a(_,M.target.value),children:zw[_].map(M=>d.jsx("option",{value:M.id,children:M.label},M.id))})]}),d.jsx("p",{className:"sm-note",children:u5[_]})]},_)})}),d.jsxs("p",{className:"sm-foot",children:[d.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const f5={"//":["What a user would NOTICE. One key per version that has something to say,","and no key at all for a version that has nothing — which is most of them.","","The rule this file exists to serve: before every release, ask 'what would a","user notice?' and write the answer here. 'Nothing user-visible' is a valid","and expected answer, and it is spelled by adding no key. A release with no","key shows no modal, and that silence is what keeps the modal worth reading","on the day it is not silent.","","What belongs here: something that changed on the user's machine or under","their hands — a hook written to or removed from settings.json, a default","that flipped, a control that moved or went away, a stored preference that","changed meaning. What does not: bounds, races, assertions that could not","fire, anything that is invisible when it is correct.","","Write it for the person running the deck, not for the person reading the","diff. `title` is the sentence they scan; `body` is what they need in order","to act on it, or to stop worrying about it.","","Keys are versions exactly as package.json spells them. A key that is not a","version, or an entry missing either field, fails the suite rather than","being quietly dropped — see src/web/__tests__/release-notes-file.test.ts.","Ordering here is for humans; the deck sorts by version itself.","","A title may open with an emoji, and if it does, put exactly ONE space after","it. Not two: the dialog gives a leading emoji its own optical gap, because","a colour glyph is drawn edge to edge inside its advance and one word space","after one reads as none. A second space here would be a lie in the data","about a defect in the type, and the suite refuses both it and no space at","all."],"3.12.0":[{title:"🔍 Busiest processes tells you which one",body:"The list could say what was eating the machine and not **which** of nine identical `Google Chrome Helper` rows was the headless Chrome you left running. It now shows the arguments after the name — `--type=renderer` beside one, `serve admin-portal --port 44440` beside a node — and four columns it did not have: **memory in MB and GB** instead of a percentage, **threads**, **how long it has been up**, and **user**. Every column sorts; press its heading.\n\n**Command lines have anything secret-shaped removed before they leave your machine** — the value of any flag whose name says token, password, key or secret, the password in a URL, and the shapes that identify themselves. It is a filter and not a guarantee: a secret that looks like an ordinary word looks like an ordinary word. The reading happens only while this modal is open, so a deck whose process list you never open never reads a command line at all.\n\n**Memory is resident set size** — what `ps` and Windows Task Manager report. On macOS this is *not* the number Activity Monitor shows in its Memory column; that one is the physical footprint, and on the machine this was built on the two disagree by up to fourteen times on the same process. No unprivileged command reports the footprint quickly, so the deck shows the figure that means the same thing on all three platforms and says which one it is.\n\n**There is no Ports column**, and the reason is the same kind of honesty: Mach ports do not exist on Linux, are not what Windows calls a handle, and on macOS the only way to count them takes four seconds — against a list that refreshes every four."},{title:"🔢 A token count that stays a whole number",body:"Switching the Usage panel from **month** to **today** counted down smoothly and then, for a fraction of a second, showed something like `in 594.3268260610639` where a token count belongs.\n\nThe count was never wrong; the printing was. The figures animate between two readings, so the formatter is handed a fraction on most of its frames — every size above a thousand was already rounded and the one below it was not."}],"3.11.0":[{title:"🗂 The session list waits to be asked for",body:`**BY SESSION in the Usage panel now starts collapsed.** It is the one block in that panel with no ceiling — every other section is two or three rows, or a model table bounded by the models that exist — and it was the reason the panel scrolled at all. Shut, the whole panel is one screen: quota, period, money, models. Press the heading to open it, and it stays open; ccdeck remembers your answer from then on.
|
|
79
79
|
|
|
80
80
|
The count of what is behind it is on the heading's tooltip, so collapsing it does not hide how much there is.
|
|
81
81
|
|
|
@@ -213,15 +213,15 @@ The two lists are separate on purpose, so you can never end up with both tones s
|
|
|
213
213
|
|
|
214
214
|
M still turns the sound on and off from anywhere.`},{title:"✨ This box is new",body:`After an update, the deck tells you what changed — once, and only when there is something worth telling. Most updates have nothing to say and you will see nothing at all.
|
|
215
215
|
|
|
216
|
-
Click the version at the top of the deck to read it again whenever you like.`}],"1.45.0":[{title:"🔕 The deck no longer puts anything in your settings.json",body:"It used to add a hook there so Claude Code would play a sound when a turn ended. That entry is removed the first time you start this version, and any sound hook you wrote yourself is put back exactly where you had it. Nothing else in that file is touched. The deck makes the sound itself now — which is also why you finally hear one when a Codex turn ends, not just a Claude one."}]},Bw="agent-dag.releaseNotesSeen";function V1(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function Yi(e,t){const n=V1(e),s=V1(t);for(let i=0;i<Math.max(n.length,s.length);i++){const a=(n[i]??0)-(s[i]??0);if(a!==0)return a<0?-1:1}return 0}function Ki(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function u5(e){if(!e||typeof e!="object")return!1;const{title:t,body:n}=e;return typeof t=="string"&&t.trim()!==""&&typeof n=="string"&&n.trim()!==""}function d5(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!Ki(n)||!Array.isArray(s))continue;const i=s.filter(u5);i.length&&t.push({version:n,notes:i})}return t.sort((n,s)=>Yi(s.version,n.version))}const Y1=d5(c5);function VT(e,t,n){return e.filter(s=>Yi(s.version,n)<=0&&(t===null||Yi(s.version,t)>0))}function f5(e,t){return e.filter(n=>Yi(n.version,t)===0)}function h5(e){if(!e.length)return"";const t=e[0].version,n=e[e.length-1].version;return t===n?`v${t}`:`v${n} – v${t}`}function p5({since:e,running:t,entries:n,firstRun:s}){if(!n.length)return"Nothing in this build has anything to report yet. Most releases do not, which is the point.";if(e!==null){const l=n.length===1?"one release":`${n.length} releases`;return`You were last caught up at v${e}. Since then ${l} changed something you would notice. Clicking the version in the topbar brings this back.`}if(s&&Ki(t))return`The deck has not run in this browser before, so this is what v${t} — the release you have — changed. Earlier releases are not repeated here; clicking the version in the topbar brings all of them back.`;const i=n[0].version;if(!Ki(t))return"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.";const a=Yi(i,t);return a<0?`v${t} — the release you are running — changed nothing you would notice, which most releases do not. Below is the last release that did, and everything before it, newest first.`:a>0?"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.":`You are running v${t}, and this is what it changed — and everything before it, newest first. Most releases have nothing here, which is why the deck stays quiet about them.`}const m5=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function g5(e){const t=m5.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function y5(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function v5(e){if(!e)return null;let t=null;try{t=e.getItem(Bw)}catch{return null}return Ki(t)?t:null}function w5(e){if(!e)return!1;try{return e.getItem(Bw),!0}catch{return!1}}function x5(e,t){if(!e)return!1;try{return e.setItem(Bw,t),!0}catch{return!1}}function b5({stored:e,running:t,notes:n,remembers:s=!0}){if(!Ki(t))return{show:[],record:null,reason:"no-version"};if(!Ki(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const l=f5(n,t);return l.length?{show:l,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const i=Yi(e,t);if(i===0)return{show:[],record:null,reason:"seen"};if(i>0)return{show:[],record:null,reason:"ahead"};const a=VT(n,e,t);return a.length?{show:a,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function k5({entries:e,since:t,running:n,firstRun:s,onClose:i}){const a=Sn(i),l=h5(e);return d.jsx("div",{className:"modal-backdrop",onClick:i,role:"presentation",children:d.jsxs("div",{ref:a,className:"modal release-notes",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),l&&d.jsx("span",{className:"modal-tool-id",children:l})]}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:i,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsxs("section",{className:"modal-body",children:[d.jsx("p",{className:"modal-note",children:p5({since:t,running:n,firstRun:s,entries:e})}),e.map(u=>d.jsxs("section",{className:"modal-section",children:[d.jsxs("h3",{className:"rn-version",children:["v",u.version]}),d.jsx("ul",{className:"rn-notes",children:u.notes.map((h,p)=>{const{icon:f,rest:g}=g5(h.title);return d.jsxs("li",{className:"rn-note",children:[d.jsxs("p",{className:"rn-note-title",children:[f&&d.jsx("span",{className:"rn-note-icon",children:f}),g]}),d.jsx("p",{className:"rn-note-body",children:h.body})]},p)})})]},u.version))]})]})})}function _5(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function S5(e,t,n){var l;if(e.length===0)return null;const s=_5(e),i=t?s.findIndex(u=>u.id===t):-1,a=i===-1?n===1?0:s.length-1:(i+n+s.length)%s.length;return((l=s[a])==null?void 0:l.id)??null}const N5=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function E5(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:N5.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const C5=new Set(["","BODY","HTML","#DOCUMENT"]);function j5(e){return!e||$w(e)?!1:!C5.has(String(e.tagName??"").toUpperCase())}function uu(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function T5(e,t){let n=!1;for(const i of e)if(!t.has(i)){n=!0;break}if(!n)return e;const s=new Set;for(const i of e)t.has(i)&&s.add(i);return s}function R5(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`);return t}function A5(e,t){if(!t||!e.agents.get(t))return null;const s=new Set([t]);let i=t;for(;i;){const l=e.agents.get(i);if(!(l!=null&&l.parentId)||s.has(l.parentId))break;s.add(l.parentId),i=l.parentId}let a=!0;for(;a;){a=!1;for(const l of e.agents.values())l.parentId&&s.has(l.parentId)&&!s.has(l.id)&&(s.add(l.id),a=!0)}return s}function M5(e,t){const n=new Set;for(const s of t){const i=A5(e,s);if(i)for(const a of i)n.add(a)}return n.size>0?n:null}function YT(e,t,n){return!t.has(e)||n.has(e)}function I5(e,t,n,s){return!t.has(e)&&YT(e,n,s)}function O5(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function P5(e,t,n,s){n.set(e,t),s.delete(e)}const $5=40,L5=120;function q5(e,t){let n=null,s=0,i=Number.NEGATIVE_INFINITY;const a=()=>{n=null,i=t.now(),e()},l=()=>{n!=null&&(t.clearTimeout(n),n=null)},u=(h,p,f)=>{if(n!=null){if(s<=h)return;l()}const g=Math.min(f,Math.max(0,h-p));s=h,n=t.setTimeout(a,g)};return{live(h=$5){const p=t.now(),f=Math.max(i+h,p);if(f<=p){l(),a();return}u(f,p,h)},replay(h=L5){l(),s=t.now()+h,n=t.setTimeout(a,h)},flush(){l(),a()},cancel(){l()}}}const D5=1e3;function F5(e={}){const t=Math.max(1,Math.floor(e.limit??D5)),n=e.protect;let s=!1,i=[],a=new Set,l=0,u=0,h=null;return{get paused(){return s},get size(){return i.length},get dropped(){return l},get overflowed(){return l>0},get through(){return u},accept(p){const f=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,g=(p==null?void 0:p.epoch)??null,v=g!==null&&g!==h;v&&(h=g,u=0);const w=f!==null&&!v&&f<=u;if(f!==null&&f>u&&(u=f),!s)return!0;if(w)return!1;if(i.push(p),n!=null&&n(p)&&a.add(p),i.length>t){let E=0;if(a.size<i.length)for(;a.has(i[E]);)E++;const[b]=i.splice(E,1);a.delete(b),l++}return!1},setPaused(p){if(s=p,p)return[];const f=i;return i=[],a=new Set,l=0,f}}}const KT="agent-dag.theme";function z5(e){return e==="light"?"light":"dark"}function B5(){return z5(Zi(KT))}function U5({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${zt}`:zt,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const du={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function fu(e,t){const i=l=>`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"${l}/>`;return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${t==="waiting"?`<circle cx="16" cy="16" r="14.5" fill="${e}"/>`:t==="offline"?i(` stroke-dasharray="${56.5485.toFixed(2)} ${18.8495.toFixed(2)}" transform="rotate(-58 16 16)"`):i("")+(t==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const W5=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(fu(du.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(fu(du.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(fu(du.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(fu(du.idle,"idle"))}`}),H5="No sessions are waiting for you.";function G5(e){if(e.length===0)return"";const[t,...n]=e;if(n.length===0)return`${t.label} is waiting for your permission.`;const s=`${n.length} more session${n.length===1?"":"s"}`;return`${t.label} and ${s} are waiting for your permission.`}function V5(e,t){return t!==""?t:e===""?"":H5}function Y5(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function K5(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 X5(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const K1={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function Uw(e){const t=e.toLowerCase();return Object.hasOwn(K1,t)?K1[t]:t?t[0].toUpperCase()+t.slice(1):""}function Q5(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function Z5(e,t=[]){const n=t.length?Q5(t.map(Uw)):X5(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function J5(e){const t=e.claude?{provider:"claude",watching:!0,spans:[{text:"Claude Code sends its events through a hook in "},{text:"~/.claude/settings.json",code:!0},{text:" — or in "},{text:"$CLAUDE_CONFIG_DIR/settings.json",code:!0},{text:" when you have that set — which the deck installs on first run."}]}:{provider:"claude",watching:!1,spans:[{text:"Claude Code capture is off: no Claude Code was found on this machine, or the deck was started with "},{text:"--no-claude",code:!0},{text:"."}]},n=e.codex?{provider:"codex",watching:!0,spans:[{text:"Codex installs nothing and needs no trust prompt — the deck reads "},{text:"~/.codex/sessions/",code:!0},{text:" itself, so an empty canvas means no rollout has been written there yet, or that "},{text:"$CODEX_HOME",code:!0},{text:" points at a different tree."}]}:{provider:"codex",watching:!1,spans:[{text:"Codex capture is off: no "},{text:"~/.codex/",code:!0},{text:" was found — set "},{text:"$CODEX_HOME",code:!0},{text:" if yours lives elsewhere — or the deck was started with "},{text:"--no-codex",code:!0},{text:"."}]};return[t,n]}function eF(e,t){const n=t.prefs??aw,s=kl(n.done.level),i=kl(n["needs-input"].level),a=s===i?`${s}%`:`${s}% and ${i}%`,l=t.on?`Sound: on at ${a} — a tone when a turn finishes, another when Claude asks for you (M)`:"Sound: off — press M, or use the switch in here, for a tone when a turn finishes (M)",u=e.codex?`
|
|
216
|
+
Click the version at the top of the deck to read it again whenever you like.`}],"1.45.0":[{title:"🔕 The deck no longer puts anything in your settings.json",body:"It used to add a hook there so Claude Code would play a sound when a turn ended. That entry is removed the first time you start this version, and any sound hook you wrote yourself is put back exactly where you had it. Nothing else in that file is touched. The deck makes the sound itself now — which is also why you finally hear one when a Codex turn ends, not just a Claude one."}]},Bw="agent-dag.releaseNotesSeen";function V1(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function Yi(e,t){const n=V1(e),s=V1(t);for(let i=0;i<Math.max(n.length,s.length);i++){const a=(n[i]??0)-(s[i]??0);if(a!==0)return a<0?-1:1}return 0}function Ki(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function h5(e){if(!e||typeof e!="object")return!1;const{title:t,body:n}=e;return typeof t=="string"&&t.trim()!==""&&typeof n=="string"&&n.trim()!==""}function p5(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!Ki(n)||!Array.isArray(s))continue;const i=s.filter(h5);i.length&&t.push({version:n,notes:i})}return t.sort((n,s)=>Yi(s.version,n.version))}const Y1=p5(f5);function VT(e,t,n){return e.filter(s=>Yi(s.version,n)<=0&&(t===null||Yi(s.version,t)>0))}function m5(e,t){return e.filter(n=>Yi(n.version,t)===0)}function g5(e){if(!e.length)return"";const t=e[0].version,n=e[e.length-1].version;return t===n?`v${t}`:`v${n} – v${t}`}function y5({since:e,running:t,entries:n,firstRun:s}){if(!n.length)return"Nothing in this build has anything to report yet. Most releases do not, which is the point.";if(e!==null){const l=n.length===1?"one release":`${n.length} releases`;return`You were last caught up at v${e}. Since then ${l} changed something you would notice. Clicking the version in the topbar brings this back.`}if(s&&Ki(t))return`The deck has not run in this browser before, so this is what v${t} — the release you have — changed. Earlier releases are not repeated here; clicking the version in the topbar brings all of them back.`;const i=n[0].version;if(!Ki(t))return"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.";const a=Yi(i,t);return a<0?`v${t} — the release you are running — changed nothing you would notice, which most releases do not. Below is the last release that did, and everything before it, newest first.`:a>0?"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.":`You are running v${t}, and this is what it changed — and everything before it, newest first. Most releases have nothing here, which is why the deck stays quiet about them.`}const v5=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function w5(e){const t=v5.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function x5(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function b5(e){if(!e)return null;let t=null;try{t=e.getItem(Bw)}catch{return null}return Ki(t)?t:null}function k5(e){if(!e)return!1;try{return e.getItem(Bw),!0}catch{return!1}}function _5(e,t){if(!e)return!1;try{return e.setItem(Bw,t),!0}catch{return!1}}function S5({stored:e,running:t,notes:n,remembers:s=!0}){if(!Ki(t))return{show:[],record:null,reason:"no-version"};if(!Ki(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const l=m5(n,t);return l.length?{show:l,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const i=Yi(e,t);if(i===0)return{show:[],record:null,reason:"seen"};if(i>0)return{show:[],record:null,reason:"ahead"};const a=VT(n,e,t);return a.length?{show:a,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function N5({entries:e,since:t,running:n,firstRun:s,onClose:i}){const a=Sn(i),l=g5(e);return d.jsx("div",{className:"modal-backdrop",onClick:i,role:"presentation",children:d.jsxs("div",{ref:a,className:"modal release-notes",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),l&&d.jsx("span",{className:"modal-tool-id",children:l})]}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:i,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsxs("section",{className:"modal-body",children:[d.jsx("p",{className:"modal-note",children:y5({since:t,running:n,firstRun:s,entries:e})}),e.map(u=>d.jsxs("section",{className:"modal-section",children:[d.jsxs("h3",{className:"rn-version",children:["v",u.version]}),d.jsx("ul",{className:"rn-notes",children:u.notes.map((h,p)=>{const{icon:f,rest:g}=w5(h.title);return d.jsxs("li",{className:"rn-note",children:[d.jsxs("p",{className:"rn-note-title",children:[f&&d.jsx("span",{className:"rn-note-icon",children:f}),g]}),d.jsx("p",{className:"rn-note-body",children:h.body})]},p)})})]},u.version))]})]})})}function E5(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function C5(e,t,n){var l;if(e.length===0)return null;const s=E5(e),i=t?s.findIndex(u=>u.id===t):-1,a=i===-1?n===1?0:s.length-1:(i+n+s.length)%s.length;return((l=s[a])==null?void 0:l.id)??null}const j5=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function T5(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:j5.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const R5=new Set(["","BODY","HTML","#DOCUMENT"]);function A5(e){return!e||$w(e)?!1:!R5.has(String(e.tagName??"").toUpperCase())}function uu(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function M5(e,t){let n=!1;for(const i of e)if(!t.has(i)){n=!0;break}if(!n)return e;const s=new Set;for(const i of e)t.has(i)&&s.add(i);return s}function I5(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`);return t}function O5(e,t){if(!t||!e.agents.get(t))return null;const s=new Set([t]);let i=t;for(;i;){const l=e.agents.get(i);if(!(l!=null&&l.parentId)||s.has(l.parentId))break;s.add(l.parentId),i=l.parentId}let a=!0;for(;a;){a=!1;for(const l of e.agents.values())l.parentId&&s.has(l.parentId)&&!s.has(l.id)&&(s.add(l.id),a=!0)}return s}function P5(e,t){const n=new Set;for(const s of t){const i=O5(e,s);if(i)for(const a of i)n.add(a)}return n.size>0?n:null}function YT(e,t,n){return!t.has(e)||n.has(e)}function $5(e,t,n,s){return!t.has(e)&&YT(e,n,s)}function L5(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function q5(e,t,n,s){n.set(e,t),s.delete(e)}const D5=40,F5=120;function z5(e,t){let n=null,s=0,i=Number.NEGATIVE_INFINITY;const a=()=>{n=null,i=t.now(),e()},l=()=>{n!=null&&(t.clearTimeout(n),n=null)},u=(h,p,f)=>{if(n!=null){if(s<=h)return;l()}const g=Math.min(f,Math.max(0,h-p));s=h,n=t.setTimeout(a,g)};return{live(h=D5){const p=t.now(),f=Math.max(i+h,p);if(f<=p){l(),a();return}u(f,p,h)},replay(h=F5){l(),s=t.now()+h,n=t.setTimeout(a,h)},flush(){l(),a()},cancel(){l()}}}const B5=1e3;function U5(e={}){const t=Math.max(1,Math.floor(e.limit??B5)),n=e.protect;let s=!1,i=[],a=new Set,l=0,u=0,h=null;return{get paused(){return s},get size(){return i.length},get dropped(){return l},get overflowed(){return l>0},get through(){return u},accept(p){const f=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,g=(p==null?void 0:p.epoch)??null,v=g!==null&&g!==h;v&&(h=g,u=0);const w=f!==null&&!v&&f<=u;if(f!==null&&f>u&&(u=f),!s)return!0;if(w)return!1;if(i.push(p),n!=null&&n(p)&&a.add(p),i.length>t){let E=0;if(a.size<i.length)for(;a.has(i[E]);)E++;const[b]=i.splice(E,1);a.delete(b),l++}return!1},setPaused(p){if(s=p,p)return[];const f=i;return i=[],a=new Set,l=0,f}}}const KT="agent-dag.theme";function W5(e){return e==="light"?"light":"dark"}function H5(){return W5(Zi(KT))}function G5({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${zt}`:zt,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const du={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function fu(e,t){const i=l=>`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"${l}/>`;return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${t==="waiting"?`<circle cx="16" cy="16" r="14.5" fill="${e}"/>`:t==="offline"?i(` stroke-dasharray="${56.5485.toFixed(2)} ${18.8495.toFixed(2)}" transform="rotate(-58 16 16)"`):i("")+(t==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const V5=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(fu(du.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(fu(du.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(fu(du.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(fu(du.idle,"idle"))}`}),Y5="No sessions are waiting for you.";function K5(e){if(e.length===0)return"";const[t,...n]=e;if(n.length===0)return`${t.label} is waiting for your permission.`;const s=`${n.length} more session${n.length===1?"":"s"}`;return`${t.label} and ${s} are waiting for your permission.`}function X5(e,t){return t!==""?t:e===""?"":Y5}function Q5(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function Z5(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 J5(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const K1={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function Uw(e){const t=e.toLowerCase();return Object.hasOwn(K1,t)?K1[t]:t?t[0].toUpperCase()+t.slice(1):""}function eF(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function tF(e,t=[]){const n=t.length?eF(t.map(Uw)):J5(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function nF(e){const t=e.claude?{provider:"claude",watching:!0,spans:[{text:"Claude Code sends its events through a hook in "},{text:"~/.claude/settings.json",code:!0},{text:" — or in "},{text:"$CLAUDE_CONFIG_DIR/settings.json",code:!0},{text:" when you have that set — which the deck installs on first run."}]}:{provider:"claude",watching:!1,spans:[{text:"Claude Code capture is off: no Claude Code was found on this machine, or the deck was started with "},{text:"--no-claude",code:!0},{text:"."}]},n=e.codex?{provider:"codex",watching:!0,spans:[{text:"Codex installs nothing and needs no trust prompt — the deck reads "},{text:"~/.codex/sessions/",code:!0},{text:" itself, so an empty canvas means no rollout has been written there yet, or that "},{text:"$CODEX_HOME",code:!0},{text:" points at a different tree."}]}:{provider:"codex",watching:!1,spans:[{text:"Codex capture is off: no "},{text:"~/.codex/",code:!0},{text:" was found — set "},{text:"$CODEX_HOME",code:!0},{text:" if yours lives elsewhere — or the deck was started with "},{text:"--no-codex",code:!0},{text:"."}]};return[t,n]}function rF(e,t){const n=t.prefs??aw,s=kl(n.done.level),i=kl(n["needs-input"].level),a=s===i?`${s}%`:`${s}% and ${i}%`,l=t.on?`Sound: on at ${a} — a tone when a turn finishes, another when Claude asks for you (M)`:"Sound: off — press M, or use the switch in here, for a tone when a turn finishes (M)",u=e.codex?`
|
|
217
217
|
|
|
218
218
|
Both CLIs get the finish tone. The second tone — Claude is waiting for you — has no Codex equivalent to fire on, so it only ever plays for Claude Code.`:"",h=t.on&&t.locked?`
|
|
219
219
|
|
|
220
220
|
Waiting for a click: this browser plays no sound until the page has been used at least once. Anything you press unlocks it.`:"";return l+u+h+`
|
|
221
221
|
|
|
222
|
-
Click to set the volume and the sound of each tone, and to hear either one.`}function XT(e){const t=new Map;for(const n of e)for(const s of n.agents??[]){if(!s||typeof s.agent!="string"||s.agent==="")continue;const i=t.get(s.agent)??{id:s.agent,cost:0,tokens:0};i.cost+=Number.isFinite(s.totalCost)?s.totalCost:0,i.tokens+=Number.isFinite(s.totalTokens)?s.totalTokens:0,t.set(s.agent,i)}return[...t.values()].sort((n,s)=>s.cost-n.cost||n.id.localeCompare(s.id))}function tF(e){const t=XT([{agents:e}]);return t.length<2?null:t.map(n=>`${Uw(n.id)} ${tt(n.cost)}`).join(" · ")}function X1(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 nF(e,t){if(!(t>0)||!(e>0))return"0%";const n=e/t*100;return n<.1?"<0.1%":`${n.toFixed(1)}%`}function hu(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 rF=[7,14,30,90];function sF(e){const[t,n]=k.useState(null),[s,i]=k.useState(!1),a=k.useState(Y5)[0],l=k.useRef(!1),u=(h=!1)=>{if(h&&!cr(l.current))return;const p=a.begin();l.current=h;const f=e;i(!0);const v=`/api/ccusage?since=${Jv(f)}${h?"&refresh=1":""}`;fetch(v).then(w=>w.json()).then(w=>{p()&&n({range:f,resp:w})}).catch(()=>{p()&&n({range:f,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{p()&&(l.current=!1,i(!1))})};return k.useEffect(()=>(u(!1),()=>a.cancel()),[e]),{landed:t,loading:s,reload:()=>u(!0)}}function oF({onClose:e,providers:t}){var F;const[n,s]=k.useState(30),[i,a]=k.useState(null),{landed:l,loading:u,reload:h}=sF(n),p=k.useRef(null),f=Sn(e,{focusRef:p}),g=K5({loading:u,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((F=l.resp.days)==null?void 0:F.length)??0}}),v=g.phase==="chart"?l.resp.days??[]:[],w=k.useMemo(()=>v.reduce((O,A)=>Math.max(O,A.totalCost),0),[v]),E=k.useRef(null);k.useLayoutEffect(()=>{const O=E.current;O&&(O.scrollLeft=O.scrollWidth)},[v]);const{totalCost:b,totalTok:S,inOut:_,cacheRead:N,modelCosts:C}=k.useMemo(()=>{let O=0,A=0,L=0,H=0;const X=new Map;for(const R of v){O+=R.totalCost,A+=R.totalTokens,L+=R.inputTokens+R.outputTokens,H+=R.cacheReadTokens;for(const K of R.modelBreakdowns)X.set(K.modelName,(X.get(K.modelName)??0)+K.cost)}return{totalCost:O,totalTok:A,inOut:L,cacheRead:H,modelCosts:X}},[v]),j=k.useMemo(()=>Array.from(C.entries()).sort((O,A)=>A[1]-O[1]),[C]),M=k.useMemo(()=>XT(v),[v]),P=M.length>1,I=i?v.find(O=>O.period===i)??null:null;return d.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:f,className:"uh-modal",onClick:O=>O.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[d.jsxs("header",{className:"uh-head",children:[d.jsxs("div",{className:"uh-titlewrap",children:[d.jsx("div",{className:"uh-title",children:"Usage history"}),d.jsx("div",{className:"uh-sub",children:Z5(t,M.map(O=>O.id))})]}),d.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:rF.map(O=>d.jsxs("button",{type:"button","aria-pressed":n===O,className:"uh-range-btn",onClick:()=>{s(O),a(null)},children:[O,"d"]},O))}),d.jsx("button",{className:"glyph-btn uh-reload",onClick:h,...lr(u),title:"Re-run ccusage","aria-label":"Reload",children:u?"…":"↻"}),d.jsx("button",{ref:p,className:"glyph-btn uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),g.phase==="busy"?d.jsx("div",{className:"uh-status","aria-busy":"true",children:l?"running ccusage…":"running ccusage… (first run downloads the package)"}):g.phase==="error"?d.jsxs("div",{className:"uh-status uh-err",title:Gi(l.resp)||void 0,children:[X4(l.resp,"ccusage did not report usage"),d.jsx("div",{children:d.jsx("button",{className:"btn uh-retry",onClick:h,...lr(u),children:u?"trying…":"Try again"})})]}):g.phase==="empty"?d.jsx("div",{className:`uh-status${g.stale?" uh-stale":""}`,"aria-busy":g.stale||void 0,children:"no usage in this range"}):d.jsxs("div",{className:g.stale?"uh-stale":void 0,"aria-busy":g.stale||void 0,children:[d.jsxs("div",{className:"uh-totals",children:[d.jsx(pu,{label:"total cost",val:tt(b),accent:!0}),d.jsx(pu,{label:"tokens",val:At(S)}),d.jsx(pu,{label:"input+output",val:At(_)}),d.jsx(pu,{label:"cache reads",val:At(N)})]}),P&&d.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[d.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:M.map(O=>d.jsx("span",{className:"uh-agent-seg",style:{width:`${b>0?O.cost/b*100:0}%`,background:X1(O.id)}},O.id))}),d.jsx("div",{className:"uh-agent-keys",children:M.map(O=>d.jsxs("span",{className:"uh-agent-key",title:`${O.id} · ${At(O.tokens)} tokens`,children:[d.jsx("span",{className:"uh-legend-dot",style:{background:X1(O.id)}}),Uw(O.id),d.jsx("span",{className:"uh-agent-cost",children:tt(O.cost)}),d.jsx("span",{className:"uh-agent-share",children:nF(O.cost,b)})]},O.id))})]}),d.jsx("div",{ref:E,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:v.map(O=>{const A=w>0?O.totalCost/w*100:0,L=O.period===i,H=`${O.period}, ${tt(O.totalCost)}`;return d.jsxs("button",{className:`uh-bar-col${L?" sel":""}`,onClick:()=>a(L?null:O.period),"aria-pressed":L,"aria-label":H,title:`${O.period} · ${tt(O.totalCost)}`,style:{flexBasis:`${100/v.length}%`},children:[d.jsx("div",{className:"uh-bar",style:{height:`${Math.max(A,O.totalCost>0?2:0)}%`},children:O.modelBreakdowns.slice().sort((X,R)=>R.cost-X.cost).map(X=>{const R=O.totalCost>0?X.cost/O.totalCost*100:0;return d.jsx("div",{className:"uh-bar-seg",style:{height:`${R}%`,background:hu(X.modelName)}},X.modelName)})}),d.jsx("span",{className:"uh-bar-label",children:O.period.slice(5)})]},O.period)})}),d.jsx("div",{className:"uh-legend",children:j.map(([O,A])=>d.jsxs("span",{className:"uh-legend-item",title:O,children:[d.jsx("span",{className:"uh-legend-dot",style:{background:hu(O)}}),Ps(O)," ",d.jsx("span",{className:"uh-legend-cost",children:tt(A)})]},O))}),I&&d.jsxs("div",{className:"uh-detail",children:[d.jsxs("div",{className:"uh-detail-head",children:[d.jsx("span",{className:"uh-detail-date",children:I.period}),d.jsx("span",{className:"uh-detail-cost",children:tt(I.totalCost)}),(()=>{var L,H;const A=tF(I.agents)??((H=(L=I.metadata)==null?void 0:L.agents)!=null&&H.length?I.metadata.agents.join(" · "):null);return A?d.jsx("span",{className:"uh-detail-agents",title:A,children:A}):null})()]}),d.jsxs("div",{className:"uh-detail-mini",children:[d.jsx(mu,{label:"input",val:At(I.inputTokens)}),d.jsx(mu,{label:"output",val:At(I.outputTokens)}),d.jsx(mu,{label:"cache write",val:At(I.cacheCreationTokens)}),d.jsx(mu,{label:"cache read",val:At(I.cacheReadTokens)})]}),d.jsx("div",{className:"uh-detail-models",children:I.modelBreakdowns.slice().sort((O,A)=>A.cost-O.cost).map(O=>{const A=I.totalCost>0?O.cost/I.totalCost*100:0;return d.jsxs("div",{className:"uh-model-row",title:O.modelName,children:[d.jsxs("span",{className:"uh-model-name",children:[d.jsx("span",{className:"uh-legend-dot",style:{background:hu(O.modelName)}}),d.jsx("span",{className:"uh-model-label",children:Ps(O.modelName)})]}),d.jsx("span",{className:"uh-model-bar",children:d.jsx("span",{className:"uh-model-bar-fill",style:{width:`${A}%`,background:hu(O.modelName)}})}),d.jsx("span",{className:"uh-model-cost",children:tt(O.cost)})]},O.modelName)})})]})]})]})})}function pu({label:e,val:t,accent:n}){return d.jsxs("div",{className:"uh-stat",children:[d.jsx("span",{className:`uh-stat-val${n?" accent":""}`,children:t}),d.jsx("span",{className:"uh-stat-label",children:e})]})}function mu({label:e,val:t}){return d.jsxs("div",{className:"uh-ministat",children:[d.jsx("span",{className:"uh-ministat-val",children:t}),d.jsx("span",{className:"uh-ministat-label",children:e})]})}function iF(e){const t=/^#?([0-9a-f]{6})$/i.exec((e??"").trim());if(!t)return!1;const n=parseInt(t[1],16),s=[n>>16&255,n>>8&255,n&255].map(i=>{const a=i/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)});return .2126*s[0]+.7152*s[1]+.0722*s[2]>.5}const Q1=1e4,aF=12e3;function lF({browsers:e,findings:t,watching:n,palette:s,now:i=()=>Date.now()}){const a=k.useRef(null),l=k.useRef(null);return l.current={browsers:e,findings:t,watching:n},k.useEffect(()=>{var w;const u=a.current;if(!u)return;const h=u.getContext("2d");if(!h)return;const p=((w=window.matchMedia)==null?void 0:w.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let f=0,g=!1;const v=()=>{var ne;if(g)return;const E=l.current;if(!E)return;const{browsers:b,findings:S,watching:_}=E,N=s["--accent"]||"#7dd3fc",C=s["--line"]||"#1f2229",j=s["--text-dim"]||"#6e727c",M=iF(s["--bg"]),P=M?42:26,I=M?.85:.65,F=i(),O=Math.min(window.devicePixelRatio||1,2),A=u.clientWidth,L=u.clientHeight;(u.width!==A*O||u.height!==L*O)&&(u.width=A*O,u.height=L*O),h.setTransform(O,0,0,O,0,0),h.clearRect(0,0,A,L);const H=A/2,X=L/2,R=Math.min(A,L)/2-6;h.strokeStyle=C,h.lineWidth=1,h.globalAlpha=M?1:.9;for(const Q of[.4,.7,1])h.beginPath(),h.arc(H,X,R*Q,0,Math.PI*2),h.stroke();h.beginPath(),h.moveTo(H-R,X),h.lineTo(H+R,X),h.moveTo(H,X-R),h.lineTo(H,X+R),h.stroke(),h.globalAlpha=1;const G=(_&&!p?F%Q1/Q1:0)*Math.PI*2-Math.PI/2;if(_){const Q=(ne=h.createConicGradient)==null?void 0:ne.call(h,G-.85,H,X);Q&&(Q.addColorStop(0,"transparent"),Q.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${N} ${P}%, transparent)`),Q.addColorStop(1,"transparent"),h.fillStyle=Q,h.beginPath(),h.moveTo(H,X),h.arc(H,X,R,G-.85,G),h.closePath(),h.fill()),h.strokeStyle=N,h.globalAlpha=I,h.beginPath(),h.moveTo(H,X),h.lineTo(H+Math.cos(G)*R,X+Math.sin(G)*R),h.stroke(),h.globalAlpha=1}b.forEach((Q,W)=>{const ee=W/Math.max(b.length,1)*Math.PI*2-Math.PI/2,$=Q.lastReadMs===null?1:Math.min(1,(F-Q.lastReadMs)/12e4),Y=R*(.42+$*.5),ue=H+Math.cos(ee)*Y,z=X+Math.sin(ee)*Y,D=Math.abs((G-ee+Math.PI*3)%(Math.PI*2)-Math.PI),J=_?Math.max(0,1-D/.55):0;h.beginPath(),h.arc(ue,z,3+J*1.6,0,Math.PI*2),h.fillStyle=Q.running?N:j,h.globalAlpha=Q.running?.55+J*.45:.35,h.fill(),h.globalAlpha=1});for(const Q of S){const W=(F-Q.atMs)/aF;if(W<0||W>1)continue;const $=Math.max(0,b.findIndex(z=>z.key===Q.browser))/Math.max(b.length,1)*Math.PI*2-Math.PI/2,Y=H+Math.cos($)*R*.6,ue=X+Math.sin($)*R*.6;h.beginPath(),h.arc(Y,ue,4+W*22,0,Math.PI*2),h.strokeStyle=N,h.globalAlpha=(1-W)*.8,h.lineWidth=1.5,h.stroke(),h.globalAlpha=1}f=requestAnimationFrame(v)};return v(),()=>{g=!0,cancelAnimationFrame(f)}},[i,s]),d.jsx("canvas",{ref:a,className:"bw-radar",role:"img","aria-label":n?`Watching ${e.length} browser${e.length===1?"":"s"}`:"Not watching"})}const Z1="agent-dag.browserWatch.seenMs";function cF(e,t){return e.filter(n=>n.startMs>t)}function uF(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function dF(e){const t=Math.ceil(e/1e3),n=Math.floor(t/60),s=t%60;return n>0?`${n}m ${s}s`:`${s}s`}function QT(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function J1(e,t){return t?{kind:"saving",word:"Saving",detail:""}:e.settings.enabled?{kind:"on",word:"Watching",detail:""}:{kind:"off",word:"Paused",detail:"nothing new is recorded"}}function fF(e,t){return e.map(n=>({key:n.key,name:n.name,running:n.running,visits:t.filter(s=>s.browser===n.key).reduce((s,i)=>s+i.programVisits,0)}))}function hF(e,t){if(e===null)return null;const n=Math.max(0,Math.round((t-e)/1e3));if(n<5)return"just now";if(n<60)return`${n} sec ago`;const s=Math.round(n/60);return s<60?`${s} min ago`:`${Math.round(s/60)} hr ago`}function pF(e){const t=e.profiles.filter(s=>s.degraded);if(t.length>0){const s=t[0],i=t.length-1;return{kind:"unreadable",text:`${s.name}/${s.profile} could not be read — ${s.reason??"no reason given"}`+(i>0?`, and ${i} more`:"")+". The watch continues on the profiles it can read."}}const n=QT(e.browsers);return n.length===0?{kind:"no-profiles",text:"No browser on this machine has a profile to read. Open one of the browsers below once and it will be watched from then on."}:n.some(s=>s.running)?null:{kind:"none-running",text:"No watched browser is running, so nothing can be navigated right now. Their history is still read, and anything found while they were open is still here."}}function mF(e){const t=n=>new Date(n).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1});return e.count===1||e.endMs-e.startMs<6e4?t(e.startMs):`${t(e.startMs)} → ${t(e.endMs)}`}function gF(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function ek(e){const t=Math.round((e.endMs-e.startMs)/6e4);return t<1?"":`${t} min`}function yF({onClose:e,onSeen:t,onWatching:n,palette:s}){const i=Sn(e),[a,l]=k.useState(null),[u,h]=k.useState(null),[p,f]=k.useState(null),[g,v]=k.useState(!1),w=k.useRef(!1),[E,b]=k.useState(null),[S,_]=k.useState(null),[N,C]=k.useState(!1),j=k.useRef(!1),[M,P]=k.useState(!1),[I,F]=k.useState(!1),[O,A]=k.useState(!1),[L,H]=k.useState(!1),[X,R]=k.useState(!1),[K,G]=k.useState(()=>Date.now());k.useEffect(()=>{const V=setInterval(()=>G(Date.now()),1e3);return()=>clearInterval(V)},[]);const ne=k.useCallback(async V=>{var ae,he;if(!(V&&!cr(w.current))){w.current=V,v(!0);try{const ye=await fetch(`/api/browser-watch${V?"?refresh=1":""}`);if(!ye.ok)throw new Error(`the deck answered ${ye.status}`);const _e=await ye.json();l(_e),j.current||b(((ae=_e==null?void 0:_e.settings)==null?void 0:ae.quietMinutes)??15),n(((he=_e==null?void 0:_e.settings)==null?void 0:he.enabled)===!0),h(null)}catch(ye){h(ye instanceof Error?ye.message:String(ye))}finally{w.current=!1,v(!1)}}},[n]);k.useEffect(()=>{ne(!1)},[ne]),k.useEffect(()=>{const V=setInterval(()=>{ne(!1)},1e4);return()=>clearInterval(V)},[ne]);const Q=k.useCallback(async V=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:V.host,startMs:V.startMs})})}finally{await ne(!1)}},[ne]),W=k.useCallback(async V=>{j.current=!0,C(!0);try{const ae=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(V)});if(!ae.ok)throw new Error(`the deck answered ${ae.status}`);await ne(!1),f(null)}catch(ae){f(ae instanceof Error?ae.message:String(ae))}finally{j.current=!1,C(!1)}},[ne]),ee=k.useRef(t);ee.current=t,k.useEffect(()=>()=>ee.current(Date.now()),[]);const $=k.useMemo(()=>{const V=[];for(const ae of(a==null?void 0:a.episodes)??[]){const he=gF(ae.startMs),ye=V[V.length-1];ye&&ye.label===he?ye.episodes.push(ae):V.push({label:he,episodes:[ae]})}return V},[a]),Y=QT(a==null?void 0:a.browsers),ue=((a==null?void 0:a.browsers)??[]).filter(V=>!(V.installed&&V.profiles>0)),z=a?pF(a):null,D=Y.reduce((V,ae)=>V+ae.profiles,0),J=a?uF(a.coverage.lastHumanMs,a.coverage.quietMs,K):null;return d.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:i,className:"modal bw-modal",onClick:V=>V.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"bw-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:"modal-tool-name",id:"bw-title",children:"Browser watch"}),d.jsx("span",{className:"modal-tool-id",children:a?`${D} ${D===1?"profile":"profiles"} · local only`:"local only"})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("button",{className:"glyph-btn",onClick:()=>void ne(!0),...lr(g),"aria-label":"Re-read every profile now",title:"Re-read every profile now",children:g?"…":"↻"}),d.jsx("button",{className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),d.jsxs("div",{className:"modal-body bw-body",children:[!a&&!u&&d.jsxs("div",{className:"bw-loading",children:[d.jsx("span",{className:"bw-loading-bar","aria-hidden":!0}),d.jsx("p",{children:"Reading each browser's history. The first look copies the file, which takes a moment."})]}),u&&d.jsx("div",{className:"bw-state",children:d.jsxs("div",{className:"bw-row err",children:[d.jsx("span",{className:"bw-dot","aria-hidden":!0}),d.jsx("span",{className:"bw-row-label",children:"Could not read"}),d.jsx("span",{className:"bw-row-detail",children:u})]})}),a&&z&&d.jsx("p",{className:`bw-trouble ${z.kind}`,role:"status",children:z.text}),a&&d.jsxs("div",{className:"bw-work",children:[d.jsxs("aside",{className:"bw-side",children:[d.jsxs("section",{className:"bw-sec",children:[d.jsxs("h4",{className:"bw-sec-head",children:["Activity overview",d.jsx("button",{className:"bw-help",onClick:()=>A(V=>!V),"aria-expanded":O,"aria-label":"What the sweep and the dots mean",children:"?"})]}),d.jsxs("div",{className:"bw-glance",children:[d.jsx(lF,{browsers:Y.map(V=>{var ae;return{key:V.key,name:V.name,running:V.running,lastReadMs:((ae=a.profiles.find(he=>he.browser===V.key))==null?void 0:ae.lastWrittenMs)??null}}),findings:a.episodes.slice(0,6).map(V=>({browser:V.browser??null,atMs:V.endMs})),watching:a.settings.enabled,palette:s}),d.jsx("ul",{className:"bw-counts",children:fF(Y,a.profiles).map(V=>d.jsxs("li",{children:[d.jsx("span",{className:"bw-count-n",children:V.visits.toLocaleString("en-US")}),d.jsx("span",{className:"bw-count-of",children:V.name})]},V.key))})]}),d.jsx("p",{className:"bw-since",children:"Pages a program opened, since this deck started"}),a.coverage.checkedMs>0&&d.jsxs("p",{className:"bw-since",children:["Last checked ",hF(a.coverage.checkedMs,K),a.coverage.checks>0&&d.jsxs(d.Fragment,{children:[" · ",a.coverage.checks.toLocaleString("en-US")," ",a.coverage.checks===1?"check":"checks"]})]}),J!==null&&d.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",dF(J)]}),O&&d.jsxs("dl",{className:"bw-key",children:[d.jsx("dt",{children:"Sweep"}),d.jsx("dd",{children:"one poll of every watched profile"}),d.jsx("dt",{children:"Dot"}),d.jsx("dd",{children:"a browser, further out the longer since it last wrote history"}),d.jsx("dt",{children:"Ring"}),d.jsx("dd",{children:"a finding, leaving the browser it came from"})]})]}),d.jsxs("section",{className:"bw-sec",children:[d.jsxs("h4",{className:"bw-sec-head",children:["Watched profiles",d.jsx("button",{className:"bw-help",onClick:()=>H(V=>!V),"aria-expanded":L,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),L&&d.jsxs("dl",{className:"bw-key",children:[d.jsx("dt",{children:"Running"}),d.jsx("dd",{children:"the browser has a process on this machine right now"}),d.jsx("dt",{children:"Connected"}),d.jsx("dd",{children:"an open connection to an address Anthropic's relay uses — which it shares with claude.ai, so an open tab looks the same as an agent channel"})]}),d.jsx("ul",{className:"bw-profiles",children:Y.map(V=>d.jsxs("li",{children:[d.jsx("span",{className:`bw-prof-dot${V.running?" on":""}`,"aria-hidden":!0}),d.jsx("span",{className:"bw-prof-name",children:V.name}),d.jsx("span",{className:"bw-prof-state",children:V.running?"running":"idle"}),V.running&&V.relay.state==="live"&&d.jsx("span",{className:"bw-relay",children:"connected to Anthropic"})]},V.key))}),ue.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>R(V=>!V),"aria-expanded":X,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:X?"▾":"▸"})," ",ue.length," not watched"]}),X&&d.jsxs("p",{className:"bw-rest",children:[ue.map(V=>V.name).join(", ")," — not installed, or installed and never opened, so there is no history to read."]})]})]}),a.relay&&d.jsx(vF,{relay:a.relay})]}),d.jsxs("div",{className:"bw-main",children:[d.jsxs("section",{className:"bw-findings",children:[d.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Findings",a.episodes.length>0&&d.jsxs("span",{className:"bw-feed-count",children:[a.episodes.length," ",a.episodes.length===1?"episode":"episodes"]})]}),d.jsx("div",{className:"bw-eps",children:$.length===0?d.jsxs("div",{className:"bw-empty",children:[d.jsx("p",{className:"bw-empty-head",children:"Nothing found yet"}),d.jsxs("p",{className:"bw-empty-note",children:["An episode lands here when a program opens pages in a browser nobody has touched for"," ",a.settings.quietMinutes," ",a.settings.quietMinutes===1?"minute":"minutes",". On most machines that is rare, so an empty list is the ordinary result rather than a sign something is wrong."]}),!a.settings.enabled&&d.jsx("p",{className:"bw-empty-note",children:"Watching is off, so this shows only what this deck has seen since it started. Anything an earlier run recorded comes back when you switch it on."})]}):$.map(V=>d.jsxs("div",{className:"bw-day",children:[d.jsx("h4",{className:"bw-sec-head",children:V.label}),V.episodes.map(ae=>{const he=`${ae.host}-${ae.startMs}`,ye=S===he;return d.jsxs("div",{className:`bw-ep${ye?" open":""}`,children:[d.jsxs("div",{className:"bw-ep-row",children:[d.jsxs("button",{className:"bw-ep-head",onClick:()=>_(ye?null:he),"aria-expanded":ye,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:ye?"▾":"▸"}),d.jsx("span",{className:"bw-ep-host",children:ae.host}),d.jsxs("span",{className:"bw-ep-meta",children:[mF(ae),ek(ae)&&d.jsxs(d.Fragment,{children:[" · ",ek(ae)]})]}),d.jsxs("span",{className:"bw-ep-count",children:[ae.count," ",ae.count===1?"page":"pages"]})]}),d.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>void Q(ae),"aria-label":`Dismiss ${ae.host}`,title:"Dismiss — it leaves this list for good, and stays in the log file",children:"×"})]}),ye&&d.jsx("ul",{className:"bw-urls",children:ae.urls.map((_e,Ve)=>d.jsxs("li",{children:[d.jsx("span",{className:"bw-url-time",children:new Date(_e.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),d.jsx("span",{className:"bw-url",children:_e.url})]},`${_e.url}-${_e.timeMs}-${Ve}`))})]},he)})]},V.label))})]}),d.jsxs("section",{className:"bw-feed",children:[d.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Live activity",d.jsxs("span",{className:"bw-feed-count",children:[a.log.length," ",a.log.length===1?"event":"events"]})]}),d.jsx("p",{className:"bw-since bw-feed-note",children:"Pages you opened yourself — counted to run the rule, never written down. Addresses appear under Findings, and only for pages a program opened."}),d.jsx("div",{className:"bw-log","aria-live":"polite","aria-relevant":"additions",children:a.log.length===0?d.jsx("p",{className:"bw-note",children:"The deck writes a line here each time it looks at a profile."}):a.log.map(V=>d.jsxs("div",{className:`bw-log-line ${V.level}${V.parts?"":" sys"}`,children:[d.jsx("span",{className:"bw-log-time",children:new Date(V.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),V.parts?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"bw-log-browser",children:V.parts.browser}),d.jsx("span",{className:"bw-log-profile",title:V.parts.profile,children:V.parts.profile}),d.jsxs("span",{className:"bw-log-value",children:[V.parts.value,V.parts.flagged>0&&d.jsxs("span",{className:"bw-log-flag",children:[" · ",V.parts.flagged," flagged"]})]})]}):d.jsx("span",{className:"bw-log-sys",children:V.text})]},`${V.atMs}-${V.level}-${V.text}`))})]})]})]}),a&&M&&d.jsxs("div",{className:"bw-settings",children:[d.jsxs("label",{title:"A program opening a page counts as a finding only if nobody had touched the browser for this long. Shorter catches more and reports more of your own work; longer is quieter.",children:[d.jsx("span",{children:"Nobody browsing for"}),d.jsxs("select",{value:E??a.settings.quietMinutes,onChange:V=>{b(Number(V.target.value)),W({quietMinutes:Number(V.target.value)})},children:[d.jsx("option",{value:1,children:"1 min"}),d.jsx("option",{value:5,children:"5 min"}),d.jsx("option",{value:15,children:"15 min"}),d.jsx("option",{value:30,children:"30 min"}),d.jsx("option",{value:60,children:"60 min"})]})]}),d.jsxs("label",{children:[d.jsx("span",{children:"When it finds one"}),d.jsx("select",{value:a.settings.reaction,onChange:V=>void W({reaction:V.target.value}),disabled:!a.settings.enabled,title:a.settings.enabled?"What to do besides writing it down.":"Turn watching on to arm a reaction.",children:(a.reactions??["notify"]).map(V=>d.jsx("option",{value:V,children:V==="notify"?"notify me":V==="close-tab"?"close the tab":"quit the browser"},V))})]}),d.jsxs("div",{className:"bw-settings-note",children:[d.jsxs("p",{children:["Chrome marks a navigation that came from an extension or a command rather than from a click. These are the ones that happened while nobody had touched the browser for the time above. ",d.jsx("strong",{children:"Usually that is your own agent doing what you asked."})]}),d.jsxs("button",{className:"bw-why",onClick:()=>F(V=>!V),"aria-expanded":I,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:I?"▾":"▸"})," What Browser Watch can access"]}),I&&d.jsxs("dl",{className:"bw-access",children:[d.jsx("dt",{children:"Reads"}),d.jsxs("dd",{children:["A copy of each browser's own history database — the live file is locked while the browser holds it. Only rows newer than the moment this deck started:"," ",new Date(a.coverage.startedMs).toLocaleString(),"."]}),d.jsx("dt",{children:"Keeps"}),d.jsxs("dd",{children:["Only while the switch is on, and only the episodes it flagged — never your ordinary browsing. In ",d.jsx("code",{className:"bw-path",children:a.coverage.logPath}),", with every address written in full so you can check it yourself."]}),d.jsx("dt",{children:"Sends"}),d.jsx("dd",{children:"Nothing. No part of this reads or writes over the network; the deck serves on 127.0.0.1 and this panel talks only to it."}),d.jsx("dt",{children:"Never reads"}),d.jsx("dd",{children:"Anything from before this deck started, cookies, saved passwords, page contents, or any browser profile with no history file."})]})]})]}),p&&d.jsx("div",{className:"bw-state bw-write-err",role:"alert",children:d.jsxs("div",{className:"bw-row err",children:[d.jsx("span",{className:"bw-dot","aria-hidden":!0}),d.jsx("span",{className:"bw-row-label",children:"Could not save that setting"}),d.jsxs("span",{className:"bw-row-detail",children:[p," — the switches below show what is stored, not what you pressed."]}),d.jsx("button",{className:"glyph-btn bw-write-err-x",onClick:()=>f(null),"aria-label":"Dismiss",title:"Dismiss",children:"×"})]})}),a&&d.jsxs("footer",{className:"bw-status",children:[d.jsx("span",{className:`bw-mode-dot${a.settings.enabled?" on":""}`,"aria-hidden":!0}),d.jsx("span",{className:"bw-mode-word",children:J1(a,N).word},J1(a,N).kind),d.jsx("span",{className:"bw-status-text",children:a.coverage.archived===0?a.settings.enabled?"No episodes recorded yet":"No episodes on disk":`${a.coverage.archived} ${a.coverage.archived===1?"episode":"episodes"} on disk`}),d.jsx("button",{className:`glyph-btn bw-gear${M?" on":""}`,onClick:()=>P(V=>!V),"aria-expanded":M,"aria-label":"Settings",title:"Settings",children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":!0,children:[d.jsx("circle",{cx:"7",cy:"7",r:"2.1"}),d.jsx("path",{d:"M7 1.2v1.6M7 11.2v1.6M1.2 7h1.6M11.2 7h1.6M2.9 2.9l1.1 1.1M10 10l1.1 1.1M11.1 2.9L10 4M4 10l-1.1 1.1"})]})}),d.jsxs("label",{className:"bw-switch",htmlFor:"bw-enabled",children:[d.jsx("span",{className:"bw-switch-label",id:"bw-enabled-label",children:"Watch browser activity"}),d.jsx("button",{id:"bw-enabled",type:"button",role:"switch","aria-checked":a.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"bw-toggle",onClick:()=>void W({enabled:!a.settings.enabled}),title:a.settings.enabled?"On — every episode it finds is written down, so the list outlives the browsing history being cleared":"Off — showing only what this deck has seen since it started. Anything an earlier run archived is hidden until you switch back on, and nothing new is kept",children:d.jsx("span",{className:"bw-toggle-knob"})})]})]})]})]})})}function vF({relay:e}){const[t,n]=k.useState(!1),[s,i]=k.useState(!1),a=e.killswitch.blocked?"unblock":"block",l=e.command[a],u=k.useCallback(async()=>{await UT(l.command)&&(i(!0),window.setTimeout(()=>i(!1),1600))},[l.command]),h=e.profiles.filter(f=>{var g;return(g=f.report)==null?void 0:g.present}),p=e.profiles.filter(f=>f.report===null);return d.jsxs("section",{className:"bw-sec",children:[d.jsx("h4",{className:"bw-sec-head",children:"Remote control"}),d.jsx("p",{className:`bw-rc-verdict ${e.verdict}`,role:"status",children:e.verdict==="exposed"?"Claude in Chrome is live here, so any Claude Code session signed in to your Anthropic account can drive this browser — from any machine, with no prompt on this one.":e.verdict==="protected"?`The relay is black-holed in ${e.hostsPath}, so no new connection to it can be made from this machine.`:"Claude in Chrome is not installed and enabled in any profile here, so there is nothing for the relay to drive."}),e.killswitch.foreign.length>0&&d.jsxs("p",{className:"bw-rc-foreign",children:["Another entry for this host is already in ",e.hostsPath,", and ccdeck will not touch it:",e.killswitch.foreign.map(f=>d.jsx("code",{className:"bw-path",children:f},f))]}),d.jsxs("button",{className:"bw-why",onClick:()=>n(f=>!f),"aria-expanded":t,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:t?"▾":"▸"})," ",e.verdict==="protected"?"How to undo the block":"What it can reach, and how to stop it"]}),t&&d.jsxs("div",{className:"bw-rc-body",children:[h.length>0&&d.jsx("dl",{className:"bw-key",children:h.map(f=>d.jsxs(k.Fragment,{children:[d.jsxs("dt",{children:[f.name,f.profile==="Default"?"":` · ${f.profile}`]}),d.jsxs("dd",{children:[f.report.enabled?"enabled":"installed but switched off",f.report.allUrls?", can act on every site":", limited to the sites it was granted",f.report.sensitiveApis.length>0&&d.jsxs(d.Fragment,{children:[" — ",f.report.sensitiveApis.join(", ")]})]})]},`${f.browser}/${f.profile}`))}),p.length>0&&d.jsxs("p",{className:"bw-rc-note",children:[p.map(f=>f.name).join(", ")," — its settings file could not be read, so nothing is claimed about it either way."]}),!e.hostsRead&&d.jsxs("p",{className:"bw-rc-note",children:[e.hostsPath," could not be read, so whether the relay is already blocked is unknown."]}),h.some(f=>f.report.allUrls)&&d.jsxs("p",{className:"bw-rc-note",children:["Narrowing the sites in ",d.jsx("code",{className:"bw-path",children:"chrome://extensions"})," does not change this: the grant is held at the browser level and the per-site list is enforced inside the extension, by the extension."]}),d.jsxs("div",{className:"bw-rc-cmd",children:[d.jsx("code",{children:l.command}),d.jsx("button",{className:"btn bw-rc-copy",onClick:u,children:s?"Copied":"Copy"})]}),d.jsx("p",{className:"bw-rc-note",children:l.note})]})]})}function Ww(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 uh,tk;function wF(){if(tk)return uh;tk=1;function e(){this.__data__=[],this.size=0}return uh=e,uh}var dh,nk;function Ji(){if(nk)return dh;nk=1;function e(t,n){return t===n||t!==t&&n!==n}return dh=e,dh}var fh,rk;function Zu(){if(rk)return fh;rk=1;var e=Ji();function t(n,s){for(var i=n.length;i--;)if(e(n[i][0],s))return i;return-1}return fh=t,fh}var hh,sk;function xF(){if(sk)return hh;sk=1;var e=Zu(),t=Array.prototype,n=t.splice;function s(i){var a=this.__data__,l=e(a,i);if(l<0)return!1;var u=a.length-1;return l==u?a.pop():n.call(a,l,1),--this.size,!0}return hh=s,hh}var ph,ok;function bF(){if(ok)return ph;ok=1;var e=Zu();function t(n){var s=this.__data__,i=e(s,n);return i<0?void 0:s[i][1]}return ph=t,ph}var mh,ik;function kF(){if(ik)return mh;ik=1;var e=Zu();function t(n){return e(this.__data__,n)>-1}return mh=t,mh}var gh,ak;function _F(){if(ak)return gh;ak=1;var e=Zu();function t(n,s){var i=this.__data__,a=e(i,n);return a<0?(++this.size,i.push([n,s])):i[a][1]=s,this}return gh=t,gh}var yh,lk;function Ju(){if(lk)return yh;lk=1;var e=wF(),t=xF(),n=bF(),s=kF(),i=_F();function a(l){var u=-1,h=l==null?0:l.length;for(this.clear();++u<h;){var p=l[u];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=i,yh=a,yh}var vh,ck;function SF(){if(ck)return vh;ck=1;var e=Ju();function t(){this.__data__=new e,this.size=0}return vh=t,vh}var wh,uk;function NF(){if(uk)return wh;uk=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return wh=e,wh}var xh,dk;function EF(){if(dk)return xh;dk=1;function e(t){return this.__data__.get(t)}return xh=e,xh}var bh,fk;function CF(){if(fk)return bh;fk=1;function e(t){return this.__data__.has(t)}return bh=e,bh}var kh,hk;function ZT(){if(hk)return kh;hk=1;var e=typeof Xc=="object"&&Xc&&Xc.Object===Object&&Xc;return kh=e,kh}var _h,pk;function hr(){if(pk)return _h;pk=1;var e=ZT(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return _h=n,_h}var Sh,mk;function ea(){if(mk)return Sh;mk=1;var e=hr(),t=e.Symbol;return Sh=t,Sh}var Nh,gk;function jF(){if(gk)return Nh;gk=1;var e=ea(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,i=e?e.toStringTag:void 0;function a(l){var u=n.call(l,i),h=l[i];try{l[i]=void 0;var p=!0}catch{}var f=s.call(l);return p&&(u?l[i]=h:delete l[i]),f}return Nh=a,Nh}var Eh,yk;function TF(){if(yk)return Eh;yk=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return Eh=n,Eh}var Ch,vk;function Eo(){if(vk)return Ch;vk=1;var e=ea(),t=jF(),n=TF(),s="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?i:s:a&&a in Object(u)?t(u):n(u)}return Ch=l,Ch}var jh,wk;function Fn(){if(wk)return jh;wk=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return jh=e,jh}var Th,xk;function $l(){if(xk)return Th;xk=1;var e=Eo(),t=Fn(),n="[object AsyncFunction]",s="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function l(u){if(!t(u))return!1;var h=e(u);return h==s||h==i||h==n||h==a}return Th=l,Th}var Rh,bk;function RF(){if(bk)return Rh;bk=1;var e=hr(),t=e["__core-js_shared__"];return Rh=t,Rh}var Ah,kk;function AF(){if(kk)return Ah;kk=1;var e=RF(),t=(function(){var s=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""})();function n(s){return!!t&&t in s}return Ah=n,Ah}var Mh,_k;function JT(){if(_k)return Mh;_k=1;var e=Function.prototype,t=e.toString;function n(s){if(s!=null){try{return t.call(s)}catch{}try{return s+""}catch{}}return""}return Mh=n,Mh}var Ih,Sk;function MF(){if(Sk)return Ih;Sk=1;var e=$l(),t=AF(),n=Fn(),s=JT(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,h=l.toString,p=u.hasOwnProperty,f=RegExp("^"+h.call(p).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(v){if(!n(v)||t(v))return!1;var w=e(v)?f:a;return w.test(s(v))}return Ih=g,Ih}var Oh,Nk;function IF(){if(Nk)return Oh;Nk=1;function e(t,n){return t==null?void 0:t[n]}return Oh=e,Oh}var Ph,Ek;function Co(){if(Ek)return Ph;Ek=1;var e=MF(),t=IF();function n(s,i){var a=t(s,i);return e(a)?a:void 0}return Ph=n,Ph}var $h,Ck;function Hw(){if(Ck)return $h;Ck=1;var e=Co(),t=hr(),n=e(t,"Map");return $h=n,$h}var Lh,jk;function ed(){if(jk)return Lh;jk=1;var e=Co(),t=e(Object,"create");return Lh=t,Lh}var qh,Tk;function OF(){if(Tk)return qh;Tk=1;var e=ed();function t(){this.__data__=e?e(null):{},this.size=0}return qh=t,qh}var Dh,Rk;function PF(){if(Rk)return Dh;Rk=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Dh=e,Dh}var Fh,Ak;function $F(){if(Ak)return Fh;Ak=1;var e=ed(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function i(a){var l=this.__data__;if(e){var u=l[a];return u===t?void 0:u}return s.call(l,a)?l[a]:void 0}return Fh=i,Fh}var zh,Mk;function LF(){if(Mk)return zh;Mk=1;var e=ed(),t=Object.prototype,n=t.hasOwnProperty;function s(i){var a=this.__data__;return e?a[i]!==void 0:n.call(a,i)}return zh=s,zh}var Bh,Ik;function qF(){if(Ik)return Bh;Ik=1;var e=ed(),t="__lodash_hash_undefined__";function n(s,i){var a=this.__data__;return this.size+=this.has(s)?0:1,a[s]=e&&i===void 0?t:i,this}return Bh=n,Bh}var Uh,Ok;function DF(){if(Ok)return Uh;Ok=1;var e=OF(),t=PF(),n=$F(),s=LF(),i=qF();function a(l){var u=-1,h=l==null?0:l.length;for(this.clear();++u<h;){var p=l[u];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=i,Uh=a,Uh}var Wh,Pk;function FF(){if(Pk)return Wh;Pk=1;var e=DF(),t=Ju(),n=Hw();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Wh=s,Wh}var Hh,$k;function zF(){if($k)return Hh;$k=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Hh=e,Hh}var Gh,Lk;function td(){if(Lk)return Gh;Lk=1;var e=zF();function t(n,s){var i=n.__data__;return e(s)?i[typeof s=="string"?"string":"hash"]:i.map}return Gh=t,Gh}var Vh,qk;function BF(){if(qk)return Vh;qk=1;var e=td();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return Vh=t,Vh}var Yh,Dk;function UF(){if(Dk)return Yh;Dk=1;var e=td();function t(n){return e(this,n).get(n)}return Yh=t,Yh}var Kh,Fk;function WF(){if(Fk)return Kh;Fk=1;var e=td();function t(n){return e(this,n).has(n)}return Kh=t,Kh}var Xh,zk;function HF(){if(zk)return Xh;zk=1;var e=td();function t(n,s){var i=e(this,n),a=i.size;return i.set(n,s),this.size+=i.size==a?0:1,this}return Xh=t,Xh}var Qh,Bk;function Gw(){if(Bk)return Qh;Bk=1;var e=FF(),t=BF(),n=UF(),s=WF(),i=HF();function a(l){var u=-1,h=l==null?0:l.length;for(this.clear();++u<h;){var p=l[u];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=i,Qh=a,Qh}var Zh,Uk;function GF(){if(Uk)return Zh;Uk=1;var e=Ju(),t=Hw(),n=Gw(),s=200;function i(a,l){var u=this.__data__;if(u instanceof e){var h=u.__data__;if(!t||h.length<s-1)return h.push([a,l]),this.size=++u.size,this;u=this.__data__=new n(h)}return u.set(a,l),this.size=u.size,this}return Zh=i,Zh}var Jh,Wk;function nd(){if(Wk)return Jh;Wk=1;var e=Ju(),t=SF(),n=NF(),s=EF(),i=CF(),a=GF();function l(u){var h=this.__data__=new e(u);this.size=h.size}return l.prototype.clear=t,l.prototype.delete=n,l.prototype.get=s,l.prototype.has=i,l.prototype.set=a,Jh=l,Jh}var ep,Hk;function Vw(){if(Hk)return ep;Hk=1;function e(t,n){for(var s=-1,i=t==null?0:t.length;++s<i&&n(t[s],s,t)!==!1;);return t}return ep=e,ep}var tp,Gk;function eR(){if(Gk)return tp;Gk=1;var e=Co(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return tp=t,tp}var np,Vk;function rd(){if(Vk)return np;Vk=1;var e=eR();function t(n,s,i){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[s]=i}return np=t,np}var rp,Yk;function sd(){if(Yk)return rp;Yk=1;var e=rd(),t=Ji(),n=Object.prototype,s=n.hasOwnProperty;function i(a,l,u){var h=a[l];(!(s.call(a,l)&&t(h,u))||u===void 0&&!(l in a))&&e(a,l,u)}return rp=i,rp}var sp,Kk;function Ll(){if(Kk)return sp;Kk=1;var e=sd(),t=rd();function n(s,i,a,l){var u=!a;a||(a={});for(var h=-1,p=i.length;++h<p;){var f=i[h],g=l?l(a[f],s[f],f,a,s):void 0;g===void 0&&(g=s[f]),u?t(a,f,g):e(a,f,g)}return a}return sp=n,sp}var op,Xk;function VF(){if(Xk)return op;Xk=1;function e(t,n){for(var s=-1,i=Array(t);++s<t;)i[s]=n(s);return i}return op=e,op}var ip,Qk;function Tr(){if(Qk)return ip;Qk=1;function e(t){return t!=null&&typeof t=="object"}return ip=e,ip}var ap,Zk;function YF(){if(Zk)return ap;Zk=1;var e=Eo(),t=Tr(),n="[object Arguments]";function s(i){return t(i)&&e(i)==n}return ap=s,ap}var lp,Jk;function ql(){if(Jk)return lp;Jk=1;var e=YF(),t=Tr(),n=Object.prototype,s=n.hasOwnProperty,i=n.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(l){return t(l)&&s.call(l,"callee")&&!i.call(l,"callee")};return lp=a,lp}var cp,e_;function It(){if(e_)return cp;e_=1;var e=Array.isArray;return cp=e,cp}var al={exports:{}},up,t_;function KF(){if(t_)return up;t_=1;function e(){return!1}return up=e,up}al.exports;var n_;function ta(){return n_||(n_=1,(function(e,t){var n=hr(),s=KF(),i=t&&!t.nodeType&&t,a=i&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===i,u=l?n.Buffer:void 0,h=u?u.isBuffer:void 0,p=h||s;e.exports=p})(al,al.exports)),al.exports}var dp,r_;function od(){if(r_)return dp;r_=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,i){var a=typeof s;return i=i??e,!!i&&(a=="number"||a!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<i}return dp=n,dp}var fp,s_;function Yw(){if(s_)return fp;s_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return fp=t,fp}var hp,o_;function XF(){if(o_)return hp;o_=1;var e=Eo(),t=Yw(),n=Tr(),s="[object Arguments]",i="[object Array]",a="[object Boolean]",l="[object Date]",u="[object Error]",h="[object Function]",p="[object Map]",f="[object Number]",g="[object Object]",v="[object RegExp]",w="[object Set]",E="[object String]",b="[object WeakMap]",S="[object ArrayBuffer]",_="[object DataView]",N="[object Float32Array]",C="[object Float64Array]",j="[object Int8Array]",M="[object Int16Array]",P="[object Int32Array]",I="[object Uint8Array]",F="[object Uint8ClampedArray]",O="[object Uint16Array]",A="[object Uint32Array]",L={};L[N]=L[C]=L[j]=L[M]=L[P]=L[I]=L[F]=L[O]=L[A]=!0,L[s]=L[i]=L[S]=L[a]=L[_]=L[l]=L[u]=L[h]=L[p]=L[f]=L[g]=L[v]=L[w]=L[E]=L[b]=!1;function H(X){return n(X)&&t(X.length)&&!!L[e(X)]}return hp=H,hp}var pp,i_;function id(){if(i_)return pp;i_=1;function e(t){return function(n){return t(n)}}return pp=e,pp}var ll={exports:{}};ll.exports;var a_;function Kw(){return a_||(a_=1,(function(e,t){var n=ZT(),s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===s,l=a&&n.process,u=(function(){try{var h=i&&i.require&&i.require("util").types;return h||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(ll,ll.exports)),ll.exports}var mp,l_;function Dl(){if(l_)return mp;l_=1;var e=XF(),t=id(),n=Kw(),s=n&&n.isTypedArray,i=s?t(s):e;return mp=i,mp}var gp,c_;function tR(){if(c_)return gp;c_=1;var e=VF(),t=ql(),n=It(),s=ta(),i=od(),a=Dl(),l=Object.prototype,u=l.hasOwnProperty;function h(p,f){var g=n(p),v=!g&&t(p),w=!g&&!v&&s(p),E=!g&&!v&&!w&&a(p),b=g||v||w||E,S=b?e(p.length,String):[],_=S.length;for(var N in p)(f||u.call(p,N))&&!(b&&(N=="length"||w&&(N=="offset"||N=="parent")||E&&(N=="buffer"||N=="byteLength"||N=="byteOffset")||i(N,_)))&&S.push(N);return S}return gp=h,gp}var yp,u_;function ad(){if(u_)return yp;u_=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,i=typeof s=="function"&&s.prototype||e;return n===i}return yp=t,yp}var vp,d_;function nR(){if(d_)return vp;d_=1;function e(t,n){return function(s){return t(n(s))}}return vp=e,vp}var wp,f_;function QF(){if(f_)return wp;f_=1;var e=nR(),t=e(Object.keys,Object);return wp=t,wp}var xp,h_;function Xw(){if(h_)return xp;h_=1;var e=ad(),t=QF(),n=Object.prototype,s=n.hasOwnProperty;function i(a){if(!e(a))return t(a);var l=[];for(var u in Object(a))s.call(a,u)&&u!="constructor"&&l.push(u);return l}return xp=i,xp}var bp,p_;function ts(){if(p_)return bp;p_=1;var e=$l(),t=Yw();function n(s){return s!=null&&t(s.length)&&!e(s)}return bp=n,bp}var kp,m_;function $s(){if(m_)return kp;m_=1;var e=tR(),t=Xw(),n=ts();function s(i){return n(i)?e(i):t(i)}return kp=s,kp}var _p,g_;function ZF(){if(g_)return _p;g_=1;var e=Ll(),t=$s();function n(s,i){return s&&e(i,t(i),s)}return _p=n,_p}var Sp,y_;function JF(){if(y_)return Sp;y_=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return Sp=e,Sp}var Np,v_;function e6(){if(v_)return Np;v_=1;var e=Fn(),t=ad(),n=JF(),s=Object.prototype,i=s.hasOwnProperty;function a(l){if(!e(l))return n(l);var u=t(l),h=[];for(var p in l)p=="constructor"&&(u||!i.call(l,p))||h.push(p);return h}return Np=a,Np}var Ep,w_;function jo(){if(w_)return Ep;w_=1;var e=tR(),t=e6(),n=ts();function s(i){return n(i)?e(i,!0):t(i)}return Ep=s,Ep}var Cp,x_;function t6(){if(x_)return Cp;x_=1;var e=Ll(),t=jo();function n(s,i){return s&&e(i,t(i),s)}return Cp=n,Cp}var cl={exports:{}};cl.exports;var b_;function rR(){return b_||(b_=1,(function(e,t){var n=hr(),s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===s,l=a?n.Buffer:void 0,u=l?l.allocUnsafe:void 0;function h(p,f){if(f)return p.slice();var g=p.length,v=u?u(g):new p.constructor(g);return p.copy(v),v}e.exports=h})(cl,cl.exports)),cl.exports}var jp,k_;function sR(){if(k_)return jp;k_=1;function e(t,n){var s=-1,i=t.length;for(n||(n=Array(i));++s<i;)n[s]=t[s];return n}return jp=e,jp}var Tp,__;function oR(){if(__)return Tp;__=1;function e(t,n){for(var s=-1,i=t==null?0:t.length,a=0,l=[];++s<i;){var u=t[s];n(u,s,t)&&(l[a++]=u)}return l}return Tp=e,Tp}var Rp,S_;function iR(){if(S_)return Rp;S_=1;function e(){return[]}return Rp=e,Rp}var Ap,N_;function Qw(){if(N_)return Ap;N_=1;var e=oR(),t=iR(),n=Object.prototype,s=n.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(l){return l==null?[]:(l=Object(l),e(i(l),function(u){return s.call(l,u)}))}:t;return Ap=a,Ap}var Mp,E_;function n6(){if(E_)return Mp;E_=1;var e=Ll(),t=Qw();function n(s,i){return e(s,t(s),i)}return Mp=n,Mp}var Ip,C_;function Zw(){if(C_)return Ip;C_=1;function e(t,n){for(var s=-1,i=n.length,a=t.length;++s<i;)t[a+s]=n[s];return t}return Ip=e,Ip}var Op,j_;function ld(){if(j_)return Op;j_=1;var e=nR(),t=e(Object.getPrototypeOf,Object);return Op=t,Op}var Pp,T_;function aR(){if(T_)return Pp;T_=1;var e=Zw(),t=ld(),n=Qw(),s=iR(),i=Object.getOwnPropertySymbols,a=i?function(l){for(var u=[];l;)e(u,n(l)),l=t(l);return u}:s;return Pp=a,Pp}var $p,R_;function r6(){if(R_)return $p;R_=1;var e=Ll(),t=aR();function n(s,i){return e(s,t(s),i)}return $p=n,$p}var Lp,A_;function lR(){if(A_)return Lp;A_=1;var e=Zw(),t=It();function n(s,i,a){var l=i(s);return t(s)?l:e(l,a(s))}return Lp=n,Lp}var qp,M_;function cR(){if(M_)return qp;M_=1;var e=lR(),t=Qw(),n=$s();function s(i){return e(i,n,t)}return qp=s,qp}var Dp,I_;function s6(){if(I_)return Dp;I_=1;var e=lR(),t=aR(),n=jo();function s(i){return e(i,n,t)}return Dp=s,Dp}var Fp,O_;function o6(){if(O_)return Fp;O_=1;var e=Co(),t=hr(),n=e(t,"DataView");return Fp=n,Fp}var zp,P_;function i6(){if(P_)return zp;P_=1;var e=Co(),t=hr(),n=e(t,"Promise");return zp=n,zp}var Bp,$_;function uR(){if($_)return Bp;$_=1;var e=Co(),t=hr(),n=e(t,"Set");return Bp=n,Bp}var Up,L_;function a6(){if(L_)return Up;L_=1;var e=Co(),t=hr(),n=e(t,"WeakMap");return Up=n,Up}var Wp,q_;function na(){if(q_)return Wp;q_=1;var e=o6(),t=Hw(),n=i6(),s=uR(),i=a6(),a=Eo(),l=JT(),u="[object Map]",h="[object Object]",p="[object Promise]",f="[object Set]",g="[object WeakMap]",v="[object DataView]",w=l(e),E=l(t),b=l(n),S=l(s),_=l(i),N=a;return(e&&N(new e(new ArrayBuffer(1)))!=v||t&&N(new t)!=u||n&&N(n.resolve())!=p||s&&N(new s)!=f||i&&N(new i)!=g)&&(N=function(C){var j=a(C),M=j==h?C.constructor:void 0,P=M?l(M):"";if(P)switch(P){case w:return v;case E:return u;case b:return p;case S:return f;case _:return g}return j}),Wp=N,Wp}var Hp,D_;function l6(){if(D_)return Hp;D_=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s){var i=s.length,a=new s.constructor(i);return i&&typeof s[0]=="string"&&t.call(s,"index")&&(a.index=s.index,a.input=s.input),a}return Hp=n,Hp}var Gp,F_;function dR(){if(F_)return Gp;F_=1;var e=hr(),t=e.Uint8Array;return Gp=t,Gp}var Vp,z_;function Jw(){if(z_)return Vp;z_=1;var e=dR();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return Vp=t,Vp}var Yp,B_;function c6(){if(B_)return Yp;B_=1;var e=Jw();function t(n,s){var i=s?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.byteLength)}return Yp=t,Yp}var Kp,U_;function u6(){if(U_)return Kp;U_=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return Kp=t,Kp}var Xp,W_;function d6(){if(W_)return Xp;W_=1;var e=ea(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(i){return n?Object(n.call(i)):{}}return Xp=s,Xp}var Qp,H_;function fR(){if(H_)return Qp;H_=1;var e=Jw();function t(n,s){var i=s?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.length)}return Qp=t,Qp}var Zp,G_;function f6(){if(G_)return Zp;G_=1;var e=Jw(),t=c6(),n=u6(),s=d6(),i=fR(),a="[object Boolean]",l="[object Date]",u="[object Map]",h="[object Number]",p="[object RegExp]",f="[object Set]",g="[object String]",v="[object Symbol]",w="[object ArrayBuffer]",E="[object DataView]",b="[object Float32Array]",S="[object Float64Array]",_="[object Int8Array]",N="[object Int16Array]",C="[object Int32Array]",j="[object Uint8Array]",M="[object Uint8ClampedArray]",P="[object Uint16Array]",I="[object Uint32Array]";function F(O,A,L){var H=O.constructor;switch(A){case w:return e(O);case a:case l:return new H(+O);case E:return t(O,L);case b:case S:case _:case N:case C:case j:case M:case P:case I:return i(O,L);case u:return new H;case h:case g:return new H(O);case p:return n(O);case f:return new H;case v:return s(O)}}return Zp=F,Zp}var Jp,V_;function hR(){if(V_)return Jp;V_=1;var e=Fn(),t=Object.create,n=(function(){function s(){}return function(i){if(!e(i))return{};if(t)return t(i);s.prototype=i;var a=new s;return s.prototype=void 0,a}})();return Jp=n,Jp}var em,Y_;function pR(){if(Y_)return em;Y_=1;var e=hR(),t=ld(),n=ad();function s(i){return typeof i.constructor=="function"&&!n(i)?e(t(i)):{}}return em=s,em}var tm,K_;function h6(){if(K_)return tm;K_=1;var e=na(),t=Tr(),n="[object Map]";function s(i){return t(i)&&e(i)==n}return tm=s,tm}var nm,X_;function p6(){if(X_)return nm;X_=1;var e=h6(),t=id(),n=Kw(),s=n&&n.isMap,i=s?t(s):e;return nm=i,nm}var rm,Q_;function m6(){if(Q_)return rm;Q_=1;var e=na(),t=Tr(),n="[object Set]";function s(i){return t(i)&&e(i)==n}return rm=s,rm}var sm,Z_;function g6(){if(Z_)return sm;Z_=1;var e=m6(),t=id(),n=Kw(),s=n&&n.isSet,i=s?t(s):e;return sm=i,sm}var om,J_;function mR(){if(J_)return om;J_=1;var e=nd(),t=Vw(),n=sd(),s=ZF(),i=t6(),a=rR(),l=sR(),u=n6(),h=r6(),p=cR(),f=s6(),g=na(),v=l6(),w=f6(),E=pR(),b=It(),S=ta(),_=p6(),N=Fn(),C=g6(),j=$s(),M=jo(),P=1,I=2,F=4,O="[object Arguments]",A="[object Array]",L="[object Boolean]",H="[object Date]",X="[object Error]",R="[object Function]",K="[object GeneratorFunction]",G="[object Map]",ne="[object Number]",Q="[object Object]",W="[object RegExp]",ee="[object Set]",$="[object String]",Y="[object Symbol]",ue="[object WeakMap]",z="[object ArrayBuffer]",D="[object DataView]",J="[object Float32Array]",V="[object Float64Array]",ae="[object Int8Array]",he="[object Int16Array]",ye="[object Int32Array]",_e="[object Uint8Array]",Ve="[object Uint8ClampedArray]",Be="[object Uint16Array]",qe="[object Uint32Array]",Se={};Se[O]=Se[A]=Se[z]=Se[D]=Se[L]=Se[H]=Se[J]=Se[V]=Se[ae]=Se[he]=Se[ye]=Se[G]=Se[ne]=Se[Q]=Se[W]=Se[ee]=Se[$]=Se[Y]=Se[_e]=Se[Ve]=Se[Be]=Se[qe]=!0,Se[X]=Se[R]=Se[ue]=!1;function ce(be,ke,Ye,dt,lt,pe){var me,Me=ke&P,He=ke&I,ct=ke&F;if(Ye&&(me=lt?Ye(be,dt,lt,pe):Ye(be)),me!==void 0)return me;if(!N(be))return be;var je=b(be);if(je){if(me=v(be),!Me)return l(be,me)}else{var Ge=g(be),Ke=Ge==R||Ge==K;if(S(be))return a(be,Me);if(Ge==Q||Ge==O||Ke&&!lt){if(me=He||Ke?{}:E(be),!Me)return He?h(be,i(me,be)):u(be,s(me,be))}else{if(!Se[Ge])return lt?be:{};me=w(be,Ge,Me)}}pe||(pe=new e);var se=pe.get(be);if(se)return se;pe.set(be,me),C(be)?be.forEach(function(Te){me.add(ce(Te,ke,Ye,Te,be,pe))}):_(be)&&be.forEach(function(Te,Xe){me.set(Xe,ce(Te,ke,Ye,Xe,be,pe))});var Pe=ct?He?f:p:He?M:j,$e=je?void 0:Pe(be);return t($e||be,function(Te,Xe){$e&&(Xe=Te,Te=be[Xe]),n(me,Xe,ce(Te,ke,Ye,Xe,be,pe))}),me}return om=ce,om}var im,eS;function y6(){if(eS)return im;eS=1;var e=mR(),t=4;function n(s){return e(s,t)}return im=n,im}var am,tS;function e0(){if(tS)return am;tS=1;function e(t){return function(){return t}}return am=e,am}var lm,nS;function v6(){if(nS)return lm;nS=1;function e(t){return function(n,s,i){for(var a=-1,l=Object(n),u=i(n),h=u.length;h--;){var p=u[t?h:++a];if(s(l[p],p,l)===!1)break}return n}}return lm=e,lm}var cm,rS;function t0(){if(rS)return cm;rS=1;var e=v6(),t=e();return cm=t,cm}var um,sS;function n0(){if(sS)return um;sS=1;var e=t0(),t=$s();function n(s,i){return s&&e(s,i,t)}return um=n,um}var dm,oS;function w6(){if(oS)return dm;oS=1;var e=ts();function t(n,s){return function(i,a){if(i==null)return i;if(!e(i))return n(i,a);for(var l=i.length,u=s?l:-1,h=Object(i);(s?u--:++u<l)&&a(h[u],u,h)!==!1;);return i}}return dm=t,dm}var fm,iS;function cd(){if(iS)return fm;iS=1;var e=n0(),t=w6(),n=t(e);return fm=n,fm}var hm,aS;function To(){if(aS)return hm;aS=1;function e(t){return t}return hm=e,hm}var pm,lS;function gR(){if(lS)return pm;lS=1;var e=To();function t(n){return typeof n=="function"?n:e}return pm=t,pm}var mm,cS;function yR(){if(cS)return mm;cS=1;var e=Vw(),t=cd(),n=gR(),s=It();function i(a,l){var u=s(a)?e:t;return u(a,n(l))}return mm=i,mm}var gm,uS;function vR(){return uS||(uS=1,gm=yR()),gm}var ym,dS;function x6(){if(dS)return ym;dS=1;var e=cd();function t(n,s){var i=[];return e(n,function(a,l,u){s(a,l,u)&&i.push(a)}),i}return ym=t,ym}var vm,fS;function b6(){if(fS)return vm;fS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return vm=t,vm}var wm,hS;function k6(){if(hS)return wm;hS=1;function e(t){return this.__data__.has(t)}return wm=e,wm}var xm,pS;function wR(){if(pS)return xm;pS=1;var e=Gw(),t=b6(),n=k6();function s(i){var a=-1,l=i==null?0:i.length;for(this.__data__=new e;++a<l;)this.add(i[a])}return s.prototype.add=s.prototype.push=t,s.prototype.has=n,xm=s,xm}var bm,mS;function _6(){if(mS)return bm;mS=1;function e(t,n){for(var s=-1,i=t==null?0:t.length;++s<i;)if(n(t[s],s,t))return!0;return!1}return bm=e,bm}var km,gS;function xR(){if(gS)return km;gS=1;function e(t,n){return t.has(n)}return km=e,km}var _m,yS;function bR(){if(yS)return _m;yS=1;var e=wR(),t=_6(),n=xR(),s=1,i=2;function a(l,u,h,p,f,g){var v=h&s,w=l.length,E=u.length;if(w!=E&&!(v&&E>w))return!1;var b=g.get(l),S=g.get(u);if(b&&S)return b==u&&S==l;var _=-1,N=!0,C=h&i?new e:void 0;for(g.set(l,u),g.set(u,l);++_<w;){var j=l[_],M=u[_];if(p)var P=v?p(M,j,_,u,l,g):p(j,M,_,l,u,g);if(P!==void 0){if(P)continue;N=!1;break}if(C){if(!t(u,function(I,F){if(!n(C,F)&&(j===I||f(j,I,h,p,g)))return C.push(F)})){N=!1;break}}else if(!(j===M||f(j,M,h,p,g))){N=!1;break}}return g.delete(l),g.delete(u),N}return _m=a,_m}var Sm,vS;function S6(){if(vS)return Sm;vS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(i,a){s[++n]=[a,i]}),s}return Sm=e,Sm}var Nm,wS;function r0(){if(wS)return Nm;wS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(i){s[++n]=i}),s}return Nm=e,Nm}var Em,xS;function N6(){if(xS)return Em;xS=1;var e=ea(),t=dR(),n=Ji(),s=bR(),i=S6(),a=r0(),l=1,u=2,h="[object Boolean]",p="[object Date]",f="[object Error]",g="[object Map]",v="[object Number]",w="[object RegExp]",E="[object Set]",b="[object String]",S="[object Symbol]",_="[object ArrayBuffer]",N="[object DataView]",C=e?e.prototype:void 0,j=C?C.valueOf:void 0;function M(P,I,F,O,A,L,H){switch(F){case N:if(P.byteLength!=I.byteLength||P.byteOffset!=I.byteOffset)return!1;P=P.buffer,I=I.buffer;case _:return!(P.byteLength!=I.byteLength||!L(new t(P),new t(I)));case h:case p:case v:return n(+P,+I);case f:return P.name==I.name&&P.message==I.message;case w:case b:return P==I+"";case g:var X=i;case E:var R=O&l;if(X||(X=a),P.size!=I.size&&!R)return!1;var K=H.get(P);if(K)return K==I;O|=u,H.set(P,I);var G=s(X(P),X(I),O,A,L,H);return H.delete(P),G;case S:if(j)return j.call(P)==j.call(I)}return!1}return Em=M,Em}var Cm,bS;function E6(){if(bS)return Cm;bS=1;var e=cR(),t=1,n=Object.prototype,s=n.hasOwnProperty;function i(a,l,u,h,p,f){var g=u&t,v=e(a),w=v.length,E=e(l),b=E.length;if(w!=b&&!g)return!1;for(var S=w;S--;){var _=v[S];if(!(g?_ in l:s.call(l,_)))return!1}var N=f.get(a),C=f.get(l);if(N&&C)return N==l&&C==a;var j=!0;f.set(a,l),f.set(l,a);for(var M=g;++S<w;){_=v[S];var P=a[_],I=l[_];if(h)var F=g?h(I,P,_,l,a,f):h(P,I,_,a,l,f);if(!(F===void 0?P===I||p(P,I,u,h,f):F)){j=!1;break}M||(M=_=="constructor")}if(j&&!M){var O=a.constructor,A=l.constructor;O!=A&&"constructor"in a&&"constructor"in l&&!(typeof O=="function"&&O instanceof O&&typeof A=="function"&&A instanceof A)&&(j=!1)}return f.delete(a),f.delete(l),j}return Cm=i,Cm}var jm,kS;function C6(){if(kS)return jm;kS=1;var e=nd(),t=bR(),n=N6(),s=E6(),i=na(),a=It(),l=ta(),u=Dl(),h=1,p="[object Arguments]",f="[object Array]",g="[object Object]",v=Object.prototype,w=v.hasOwnProperty;function E(b,S,_,N,C,j){var M=a(b),P=a(S),I=M?f:i(b),F=P?f:i(S);I=I==p?g:I,F=F==p?g:F;var O=I==g,A=F==g,L=I==F;if(L&&l(b)){if(!l(S))return!1;M=!0,O=!1}if(L&&!O)return j||(j=new e),M||u(b)?t(b,S,_,N,C,j):n(b,S,I,_,N,C,j);if(!(_&h)){var H=O&&w.call(b,"__wrapped__"),X=A&&w.call(S,"__wrapped__");if(H||X){var R=H?b.value():b,K=X?S.value():S;return j||(j=new e),C(R,K,_,N,j)}}return L?(j||(j=new e),s(b,S,_,N,C,j)):!1}return jm=E,jm}var Tm,_S;function kR(){if(_S)return Tm;_S=1;var e=C6(),t=Tr();function n(s,i,a,l,u){return s===i?!0:s==null||i==null||!t(s)&&!t(i)?s!==s&&i!==i:e(s,i,a,l,n,u)}return Tm=n,Tm}var Rm,SS;function j6(){if(SS)return Rm;SS=1;var e=nd(),t=kR(),n=1,s=2;function i(a,l,u,h){var p=u.length,f=p,g=!h;if(a==null)return!f;for(a=Object(a);p--;){var v=u[p];if(g&&v[2]?v[1]!==a[v[0]]:!(v[0]in a))return!1}for(;++p<f;){v=u[p];var w=v[0],E=a[w],b=v[1];if(g&&v[2]){if(E===void 0&&!(w in a))return!1}else{var S=new e;if(h)var _=h(E,b,w,a,l,S);if(!(_===void 0?t(b,E,n|s,h,S):_))return!1}}return!0}return Rm=i,Rm}var Am,NS;function _R(){if(NS)return Am;NS=1;var e=Fn();function t(n){return n===n&&!e(n)}return Am=t,Am}var Mm,ES;function T6(){if(ES)return Mm;ES=1;var e=_R(),t=$s();function n(s){for(var i=t(s),a=i.length;a--;){var l=i[a],u=s[l];i[a]=[l,u,e(u)]}return i}return Mm=n,Mm}var Im,CS;function SR(){if(CS)return Im;CS=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return Im=e,Im}var Om,jS;function R6(){if(jS)return Om;jS=1;var e=j6(),t=T6(),n=SR();function s(i){var a=t(i);return a.length==1&&a[0][2]?n(a[0][0],a[0][1]):function(l){return l===i||e(l,i,a)}}return Om=s,Om}var Pm,TS;function ra(){if(TS)return Pm;TS=1;var e=Eo(),t=Tr(),n="[object Symbol]";function s(i){return typeof i=="symbol"||t(i)&&e(i)==n}return Pm=s,Pm}var $m,RS;function s0(){if(RS)return $m;RS=1;var e=It(),t=ra(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function i(a,l){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:s.test(a)||!n.test(a)||l!=null&&a in Object(l)}return $m=i,$m}var Lm,AS;function A6(){if(AS)return Lm;AS=1;var e=Gw(),t="Expected a function";function n(s,i){if(typeof s!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var l=arguments,u=i?i.apply(this,l):l[0],h=a.cache;if(h.has(u))return h.get(u);var p=s.apply(this,l);return a.cache=h.set(u,p)||h,p};return a.cache=new(n.Cache||e),a}return n.Cache=e,Lm=n,Lm}var qm,MS;function M6(){if(MS)return qm;MS=1;var e=A6(),t=500;function n(s){var i=e(s,function(l){return a.size===t&&a.clear(),l}),a=i.cache;return i}return qm=n,qm}var Dm,IS;function I6(){if(IS)return Dm;IS=1;var e=M6(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,s=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(l,u,h,p){a.push(h?p.replace(n,"$1"):u||l)}),a});return Dm=s,Dm}var Fm,OS;function ud(){if(OS)return Fm;OS=1;function e(t,n){for(var s=-1,i=t==null?0:t.length,a=Array(i);++s<i;)a[s]=n(t[s],s,t);return a}return Fm=e,Fm}var zm,PS;function O6(){if(PS)return zm;PS=1;var e=ea(),t=ud(),n=It(),s=ra(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function l(u){if(typeof u=="string")return u;if(n(u))return t(u,l)+"";if(s(u))return a?a.call(u):"";var h=u+"";return h=="0"&&1/u==-1/0?"-0":h}return zm=l,zm}var Bm,$S;function NR(){if($S)return Bm;$S=1;var e=O6();function t(n){return n==null?"":e(n)}return Bm=t,Bm}var Um,LS;function dd(){if(LS)return Um;LS=1;var e=It(),t=s0(),n=I6(),s=NR();function i(a,l){return e(a)?a:t(a,l)?[a]:n(s(a))}return Um=i,Um}var Wm,qS;function Fl(){if(qS)return Wm;qS=1;var e=ra();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return Wm=t,Wm}var Hm,DS;function fd(){if(DS)return Hm;DS=1;var e=dd(),t=Fl();function n(s,i){i=e(i,s);for(var a=0,l=i.length;s!=null&&a<l;)s=s[t(i[a++])];return a&&a==l?s:void 0}return Hm=n,Hm}var Gm,FS;function P6(){if(FS)return Gm;FS=1;var e=fd();function t(n,s,i){var a=n==null?void 0:e(n,s);return a===void 0?i:a}return Gm=t,Gm}var Vm,zS;function $6(){if(zS)return Vm;zS=1;function e(t,n){return t!=null&&n in Object(t)}return Vm=e,Vm}var Ym,BS;function ER(){if(BS)return Ym;BS=1;var e=dd(),t=ql(),n=It(),s=od(),i=Yw(),a=Fl();function l(u,h,p){h=e(h,u);for(var f=-1,g=h.length,v=!1;++f<g;){var w=a(h[f]);if(!(v=u!=null&&p(u,w)))break;u=u[w]}return v||++f!=g?v:(g=u==null?0:u.length,!!g&&i(g)&&s(w,g)&&(n(u)||t(u)))}return Ym=l,Ym}var Km,US;function CR(){if(US)return Km;US=1;var e=$6(),t=ER();function n(s,i){return s!=null&&t(s,i,e)}return Km=n,Km}var Xm,WS;function L6(){if(WS)return Xm;WS=1;var e=kR(),t=P6(),n=CR(),s=s0(),i=_R(),a=SR(),l=Fl(),u=1,h=2;function p(f,g){return s(f)&&i(g)?a(l(f),g):function(v){var w=t(v,f);return w===void 0&&w===g?n(v,f):e(g,w,u|h)}}return Xm=p,Xm}var Qm,HS;function jR(){if(HS)return Qm;HS=1;function e(t){return function(n){return n==null?void 0:n[t]}}return Qm=e,Qm}var Zm,GS;function q6(){if(GS)return Zm;GS=1;var e=fd();function t(n){return function(s){return e(s,n)}}return Zm=t,Zm}var Jm,VS;function D6(){if(VS)return Jm;VS=1;var e=jR(),t=q6(),n=s0(),s=Fl();function i(a){return n(a)?e(s(a)):t(a)}return Jm=i,Jm}var eg,YS;function ns(){if(YS)return eg;YS=1;var e=R6(),t=L6(),n=To(),s=It(),i=D6();function a(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?s(l)?t(l[0],l[1]):e(l):i(l)}return eg=a,eg}var tg,KS;function TR(){if(KS)return tg;KS=1;var e=oR(),t=x6(),n=ns(),s=It();function i(a,l){var u=s(a)?e:t;return u(a,n(l,3))}return tg=i,tg}var ng,XS;function F6(){if(XS)return ng;XS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,i){return s!=null&&t.call(s,i)}return ng=n,ng}var rg,QS;function RR(){if(QS)return rg;QS=1;var e=F6(),t=ER();function n(s,i){return s!=null&&t(s,i,e)}return rg=n,rg}var sg,ZS;function z6(){if(ZS)return sg;ZS=1;var e=Xw(),t=na(),n=ql(),s=It(),i=ts(),a=ta(),l=ad(),u=Dl(),h="[object Map]",p="[object Set]",f=Object.prototype,g=f.hasOwnProperty;function v(w){if(w==null)return!0;if(i(w)&&(s(w)||typeof w=="string"||typeof w.splice=="function"||a(w)||u(w)||n(w)))return!w.length;var E=t(w);if(E==h||E==p)return!w.size;if(l(w))return!e(w).length;for(var b in w)if(g.call(w,b))return!1;return!0}return sg=v,sg}var og,JS;function AR(){if(JS)return og;JS=1;function e(t){return t===void 0}return og=e,og}var ig,eN;function MR(){if(eN)return ig;eN=1;var e=cd(),t=ts();function n(s,i){var a=-1,l=t(s)?Array(s.length):[];return e(s,function(u,h,p){l[++a]=i(u,h,p)}),l}return ig=n,ig}var ag,tN;function IR(){if(tN)return ag;tN=1;var e=ud(),t=ns(),n=MR(),s=It();function i(a,l){var u=s(a)?e:n;return u(a,t(l,3))}return ag=i,ag}var lg,nN;function B6(){if(nN)return lg;nN=1;function e(t,n,s,i){var a=-1,l=t==null?0:t.length;for(i&&l&&(s=t[++a]);++a<l;)s=n(s,t[a],a,t);return s}return lg=e,lg}var cg,rN;function U6(){if(rN)return cg;rN=1;function e(t,n,s,i,a){return a(t,function(l,u,h){s=i?(i=!1,l):n(s,l,u,h)}),s}return cg=e,cg}var ug,sN;function OR(){if(sN)return ug;sN=1;var e=B6(),t=cd(),n=ns(),s=U6(),i=It();function a(l,u,h){var p=i(l)?e:s,f=arguments.length<3;return p(l,n(u,4),h,f,t)}return ug=a,ug}var dg,oN;function W6(){if(oN)return dg;oN=1;var e=Eo(),t=It(),n=Tr(),s="[object String]";function i(a){return typeof a=="string"||!t(a)&&n(a)&&e(a)==s}return dg=i,dg}var fg,iN;function H6(){if(iN)return fg;iN=1;var e=jR(),t=e("length");return fg=t,fg}var hg,aN;function G6(){if(aN)return hg;aN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",i=t+n+s,a="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+i+a+"]");function h(p){return u.test(p)}return hg=h,hg}var pg,lN;function V6(){if(lN)return pg;lN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",i=t+n+s,a="\\ufe0e\\ufe0f",l="["+e+"]",u="["+i+"]",h="\\ud83c[\\udffb-\\udfff]",p="(?:"+u+"|"+h+")",f="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",v="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",E=p+"?",b="["+a+"]?",S="(?:"+w+"(?:"+[f,g,v].join("|")+")"+b+E+")*",_=b+E+S,N="(?:"+[f+u+"?",u,g,v,l].join("|")+")",C=RegExp(h+"(?="+h+")|"+N+_,"g");function j(M){for(var P=C.lastIndex=0;C.test(M);)++P;return P}return pg=j,pg}var mg,cN;function Y6(){if(cN)return mg;cN=1;var e=H6(),t=G6(),n=V6();function s(i){return t(i)?n(i):e(i)}return mg=s,mg}var gg,uN;function K6(){if(uN)return gg;uN=1;var e=Xw(),t=na(),n=ts(),s=W6(),i=Y6(),a="[object Map]",l="[object Set]";function u(h){if(h==null)return 0;if(n(h))return s(h)?i(h):h.length;var p=t(h);return p==a||p==l?h.size:e(h).length}return gg=u,gg}var yg,dN;function X6(){if(dN)return yg;dN=1;var e=Vw(),t=hR(),n=n0(),s=ns(),i=ld(),a=It(),l=ta(),u=$l(),h=Fn(),p=Dl();function f(g,v,w){var E=a(g),b=E||l(g)||p(g);if(v=s(v,4),w==null){var S=g&&g.constructor;b?w=E?new S:[]:h(g)?w=u(S)?t(i(g)):{}:w={}}return(b?e:n)(g,function(_,N,C){return v(w,_,N,C)}),w}return yg=f,yg}var vg,fN;function Q6(){if(fN)return vg;fN=1;var e=ea(),t=ql(),n=It(),s=e?e.isConcatSpreadable:void 0;function i(a){return n(a)||t(a)||!!(s&&a&&a[s])}return vg=i,vg}var wg,hN;function o0(){if(hN)return wg;hN=1;var e=Zw(),t=Q6();function n(s,i,a,l,u){var h=-1,p=s.length;for(a||(a=t),u||(u=[]);++h<p;){var f=s[h];i>0&&a(f)?i>1?n(f,i-1,a,l,u):e(u,f):l||(u[u.length]=f)}return u}return wg=n,wg}var xg,pN;function Z6(){if(pN)return xg;pN=1;function e(t,n,s){switch(s.length){case 0:return t.call(n);case 1:return t.call(n,s[0]);case 2:return t.call(n,s[0],s[1]);case 3:return t.call(n,s[0],s[1],s[2])}return t.apply(n,s)}return xg=e,xg}var bg,mN;function PR(){if(mN)return bg;mN=1;var e=Z6(),t=Math.max;function n(s,i,a){return i=t(i===void 0?s.length-1:i,0),function(){for(var l=arguments,u=-1,h=t(l.length-i,0),p=Array(h);++u<h;)p[u]=l[i+u];u=-1;for(var f=Array(i+1);++u<i;)f[u]=l[u];return f[i]=a(p),e(s,this,f)}}return bg=n,bg}var kg,gN;function J6(){if(gN)return kg;gN=1;var e=e0(),t=eR(),n=To(),s=t?function(i,a){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:n;return kg=s,kg}var _g,yN;function ez(){if(yN)return _g;yN=1;var e=800,t=16,n=Date.now;function s(i){var a=0,l=0;return function(){var u=n(),h=t-(u-l);if(l=u,h>0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return _g=s,_g}var Sg,vN;function $R(){if(vN)return Sg;vN=1;var e=J6(),t=ez(),n=t(e);return Sg=n,Sg}var Ng,wN;function hd(){if(wN)return Ng;wN=1;var e=To(),t=PR(),n=$R();function s(i,a){return n(t(i,a,e),i+"")}return Ng=s,Ng}var Eg,xN;function LR(){if(xN)return Eg;xN=1;function e(t,n,s,i){for(var a=t.length,l=s+(i?1:-1);i?l--:++l<a;)if(n(t[l],l,t))return l;return-1}return Eg=e,Eg}var Cg,bN;function tz(){if(bN)return Cg;bN=1;function e(t){return t!==t}return Cg=e,Cg}var jg,kN;function nz(){if(kN)return jg;kN=1;function e(t,n,s){for(var i=s-1,a=t.length;++i<a;)if(t[i]===n)return i;return-1}return jg=e,jg}var Tg,_N;function rz(){if(_N)return Tg;_N=1;var e=LR(),t=tz(),n=nz();function s(i,a,l){return a===a?n(i,a,l):e(i,t,l)}return Tg=s,Tg}var Rg,SN;function sz(){if(SN)return Rg;SN=1;var e=rz();function t(n,s){var i=n==null?0:n.length;return!!i&&e(n,s,0)>-1}return Rg=t,Rg}var Ag,NN;function oz(){if(NN)return Ag;NN=1;function e(t,n,s){for(var i=-1,a=t==null?0:t.length;++i<a;)if(s(n,t[i]))return!0;return!1}return Ag=e,Ag}var Mg,EN;function iz(){if(EN)return Mg;EN=1;function e(){}return Mg=e,Mg}var Ig,CN;function az(){if(CN)return Ig;CN=1;var e=uR(),t=iz(),n=r0(),s=1/0,i=e&&1/n(new e([,-0]))[1]==s?function(a){return new e(a)}:t;return Ig=i,Ig}var Og,jN;function lz(){if(jN)return Og;jN=1;var e=wR(),t=sz(),n=oz(),s=xR(),i=az(),a=r0(),l=200;function u(h,p,f){var g=-1,v=t,w=h.length,E=!0,b=[],S=b;if(f)E=!1,v=n;else if(w>=l){var _=p?null:i(h);if(_)return a(_);E=!1,v=s,S=new e}else S=p?[]:b;e:for(;++g<w;){var N=h[g],C=p?p(N):N;if(N=f||N!==0?N:0,E&&C===C){for(var j=S.length;j--;)if(S[j]===C)continue e;p&&S.push(C),b.push(N)}else v(S,C,f)||(S!==b&&S.push(C),b.push(N))}return b}return Og=u,Og}var Pg,TN;function qR(){if(TN)return Pg;TN=1;var e=ts(),t=Tr();function n(s){return t(s)&&e(s)}return Pg=n,Pg}var $g,RN;function cz(){if(RN)return $g;RN=1;var e=o0(),t=hd(),n=lz(),s=qR(),i=t(function(a){return n(e(a,1,s,!0))});return $g=i,$g}var Lg,AN;function uz(){if(AN)return Lg;AN=1;var e=ud();function t(n,s){return e(s,function(i){return n[i]})}return Lg=t,Lg}var qg,MN;function DR(){if(MN)return qg;MN=1;var e=uz(),t=$s();function n(s){return s==null?[]:e(s,t(s))}return qg=n,qg}var Dg,IN;function zn(){if(IN)return Dg;IN=1;var e;if(typeof Ww=="function")try{e={clone:y6(),constant:e0(),each:vR(),filter:TR(),has:RR(),isArray:It(),isEmpty:z6(),isFunction:$l(),isUndefined:AR(),keys:$s(),map:IR(),reduce:OR(),size:K6(),transform:X6(),union:cz(),values:DR()}}catch{}return e||(e=window._),Dg=e,Dg}var Fg,ON;function i0(){if(ON)return Fg;ON=1;var e=zn();Fg=i;var t="\0",n="\0",s="";function i(f){this._isDirected=e.has(f,"directed")?f.directed:!0,this._isMultigraph=e.has(f,"multigraph")?f.multigraph:!1,this._isCompound=e.has(f,"compound")?f.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(f){return this._label=f,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultNodeLabelFn=f,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return e.keys(this._nodes)},i.prototype.sources=function(){var f=this;return e.filter(this.nodes(),function(g){return e.isEmpty(f._in[g])})},i.prototype.sinks=function(){var f=this;return e.filter(this.nodes(),function(g){return e.isEmpty(f._out[g])})},i.prototype.setNodes=function(f,g){var v=arguments,w=this;return e.each(f,function(E){v.length>1?w.setNode(E,g):w.setNode(E)}),this},i.prototype.setNode=function(f,g){return e.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=g),this):(this._nodes[f]=arguments.length>1?g:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=n,this._children[f]={},this._children[n][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},i.prototype.node=function(f){return this._nodes[f]},i.prototype.hasNode=function(f){return e.has(this._nodes,f)},i.prototype.removeNode=function(f){var g=this;if(e.has(this._nodes,f)){var v=function(w){g.removeEdge(g._edgeObjs[w])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],e.each(this.children(f),function(w){g.setParent(w)}),delete this._children[f]),e.each(e.keys(this._in[f]),v),delete this._in[f],delete this._preds[f],e.each(e.keys(this._out[f]),v),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},i.prototype.setParent=function(f,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(g))g=n;else{g+="";for(var v=g;!e.isUndefined(v);v=this.parent(v))if(v===f)throw new Error("Setting "+g+" as parent of "+f+" would create a cycle");this.setNode(g)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=g,this._children[g][f]=!0,this},i.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},i.prototype.parent=function(f){if(this._isCompound){var g=this._parent[f];if(g!==n)return g}},i.prototype.children=function(f){if(e.isUndefined(f)&&(f=n),this._isCompound){var g=this._children[f];if(g)return e.keys(g)}else{if(f===n)return this.nodes();if(this.hasNode(f))return[]}},i.prototype.predecessors=function(f){var g=this._preds[f];if(g)return e.keys(g)},i.prototype.successors=function(f){var g=this._sucs[f];if(g)return e.keys(g)},i.prototype.neighbors=function(f){var g=this.predecessors(f);if(g)return e.union(g,this.successors(f))},i.prototype.isLeaf=function(f){var g;return this.isDirected()?g=this.successors(f):g=this.neighbors(f),g.length===0},i.prototype.filterNodes=function(f){var g=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});g.setGraph(this.graph());var v=this;e.each(this._nodes,function(b,S){f(S)&&g.setNode(S,b)}),e.each(this._edgeObjs,function(b){g.hasNode(b.v)&&g.hasNode(b.w)&&g.setEdge(b,v.edge(b))});var w={};function E(b){var S=v.parent(b);return S===void 0||g.hasNode(S)?(w[b]=S,S):S in w?w[S]:E(S)}return this._isCompound&&e.each(g.nodes(),function(b){g.setParent(b,E(b))}),g},i.prototype.setDefaultEdgeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultEdgeLabelFn=f,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(f,g){var v=this,w=arguments;return e.reduce(f,function(E,b){return w.length>1?v.setEdge(E,b,g):v.setEdge(E,b),b}),this},i.prototype.setEdge=function(){var f,g,v,w,E=!1,b=arguments[0];typeof b=="object"&&b!==null&&"v"in b?(f=b.v,g=b.w,v=b.name,arguments.length===2&&(w=arguments[1],E=!0)):(f=b,g=arguments[1],v=arguments[3],arguments.length>2&&(w=arguments[2],E=!0)),f=""+f,g=""+g,e.isUndefined(v)||(v=""+v);var S=u(this._isDirected,f,g,v);if(e.has(this._edgeLabels,S))return E&&(this._edgeLabels[S]=w),this;if(!e.isUndefined(v)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(g),this._edgeLabels[S]=E?w:this._defaultEdgeLabelFn(f,g,v);var _=h(this._isDirected,f,g,v);return f=_.v,g=_.w,Object.freeze(_),this._edgeObjs[S]=_,a(this._preds[g],f),a(this._sucs[f],g),this._in[g][S]=_,this._out[f][S]=_,this._edgeCount++,this},i.prototype.edge=function(f,g,v){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,v);return this._edgeLabels[w]},i.prototype.hasEdge=function(f,g,v){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,v);return e.has(this._edgeLabels,w)},i.prototype.removeEdge=function(f,g,v){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,v),E=this._edgeObjs[w];return E&&(f=E.v,g=E.w,delete this._edgeLabels[w],delete this._edgeObjs[w],l(this._preds[g],f),l(this._sucs[f],g),delete this._in[g][w],delete this._out[f][w],this._edgeCount--),this},i.prototype.inEdges=function(f,g){var v=this._in[f];if(v){var w=e.values(v);return g?e.filter(w,function(E){return E.v===g}):w}},i.prototype.outEdges=function(f,g){var v=this._out[f];if(v){var w=e.values(v);return g?e.filter(w,function(E){return E.w===g}):w}},i.prototype.nodeEdges=function(f,g){var v=this.inEdges(f,g);if(v)return v.concat(this.outEdges(f,g))};function a(f,g){f[g]?f[g]++:f[g]=1}function l(f,g){--f[g]||delete f[g]}function u(f,g,v,w){var E=""+g,b=""+v;if(!f&&E>b){var S=E;E=b,b=S}return E+s+b+s+(e.isUndefined(w)?t:w)}function h(f,g,v,w){var E=""+g,b=""+v;if(!f&&E>b){var S=E;E=b,b=S}var _={v:E,w:b};return w&&(_.name=w),_}function p(f,g){return u(f,g.v,g.w,g.name)}return Fg}var zg,PN;function dz(){return PN||(PN=1,zg="2.1.8"),zg}var Bg,$N;function fz(){return $N||($N=1,Bg={Graph:i0(),version:dz()}),Bg}var Ug,LN;function hz(){if(LN)return Ug;LN=1;var e=zn(),t=i0();Ug={write:n,read:a};function n(l){var u={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:s(l),edges:i(l)};return e.isUndefined(l.graph())||(u.value=e.clone(l.graph())),u}function s(l){return e.map(l.nodes(),function(u){var h=l.node(u),p=l.parent(u),f={v:u};return e.isUndefined(h)||(f.value=h),e.isUndefined(p)||(f.parent=p),f})}function i(l){return e.map(l.edges(),function(u){var h=l.edge(u),p={v:u.v,w:u.w};return e.isUndefined(u.name)||(p.name=u.name),e.isUndefined(h)||(p.value=h),p})}function a(l){var u=new t(l.options).setGraph(l.value);return e.each(l.nodes,function(h){u.setNode(h.v,h.value),h.parent&&u.setParent(h.v,h.parent)}),e.each(l.edges,function(h){u.setEdge({v:h.v,w:h.w,name:h.name},h.value)}),u}return Ug}var Wg,qN;function pz(){if(qN)return Wg;qN=1;var e=zn();Wg=t;function t(n){var s={},i=[],a;function l(u){e.has(s,u)||(s[u]=!0,a.push(u),e.each(n.successors(u),l),e.each(n.predecessors(u),l))}return e.each(n.nodes(),function(u){a=[],l(u),a.length&&i.push(a)}),i}return Wg}var Hg,DN;function FR(){if(DN)return Hg;DN=1;var e=zn();Hg=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var s=this._keyIndices[n];if(s!==void 0)return this._arr[s].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,s){var i=this._keyIndices;if(n=String(n),!e.has(i,n)){var a=this._arr,l=a.length;return i[n]=l,a.push({key:n,priority:s}),this._decrease(l),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,s){var i=this._keyIndices[n];if(s>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[i].priority+" New: "+s);this._arr[i].priority=s,this._decrease(i)},t.prototype._heapify=function(n){var s=this._arr,i=2*n,a=i+1,l=n;i<s.length&&(l=s[i].priority<s[l].priority?i:l,a<s.length&&(l=s[a].priority<s[l].priority?a:l),l!==n&&(this._swap(n,l),this._heapify(l)))},t.prototype._decrease=function(n){for(var s=this._arr,i=s[n].priority,a;n!==0&&(a=n>>1,!(s[a].priority<i));)this._swap(n,a),n=a},t.prototype._swap=function(n,s){var i=this._arr,a=this._keyIndices,l=i[n],u=i[s];i[n]=u,i[s]=l,a[u.key]=n,a[l.key]=s},Hg}var Gg,FN;function zR(){if(FN)return Gg;FN=1;var e=zn(),t=FR();Gg=s;var n=e.constant(1);function s(a,l,u,h){return i(a,String(l),u||n,h||function(p){return a.outEdges(p)})}function i(a,l,u,h){var p={},f=new t,g,v,w=function(E){var b=E.v!==g?E.v:E.w,S=p[b],_=u(E),N=v.distance+_;if(_<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+E+" Weight: "+_);N<S.distance&&(S.distance=N,S.predecessor=g,f.decrease(b,N))};for(a.nodes().forEach(function(E){var b=E===l?0:Number.POSITIVE_INFINITY;p[E]={distance:b},f.add(E,b)});f.size()>0&&(g=f.removeMin(),v=p[g],v.distance!==Number.POSITIVE_INFINITY);)h(g).forEach(w);return p}return Gg}var Vg,zN;function mz(){if(zN)return Vg;zN=1;var e=zR(),t=zn();Vg=n;function n(s,i,a){return t.transform(s.nodes(),function(l,u){l[u]=e(s,u,i,a)},{})}return Vg}var Yg,BN;function BR(){if(BN)return Yg;BN=1;var e=zn();Yg=t;function t(n){var s=0,i=[],a={},l=[];function u(h){var p=a[h]={onStack:!0,lowlink:s,index:s++};if(i.push(h),n.successors(h).forEach(function(v){e.has(a,v)?a[v].onStack&&(p.lowlink=Math.min(p.lowlink,a[v].index)):(u(v),p.lowlink=Math.min(p.lowlink,a[v].lowlink))}),p.lowlink===p.index){var f=[],g;do g=i.pop(),a[g].onStack=!1,f.push(g);while(h!==g);l.push(f)}}return n.nodes().forEach(function(h){e.has(a,h)||u(h)}),l}return Yg}var Kg,UN;function gz(){if(UN)return Kg;UN=1;var e=zn(),t=BR();Kg=n;function n(s){return e.filter(t(s),function(i){return i.length>1||i.length===1&&s.hasEdge(i[0],i[0])})}return Kg}var Xg,WN;function yz(){if(WN)return Xg;WN=1;var e=zn();Xg=n;var t=e.constant(1);function n(i,a,l){return s(i,a||t,l||function(u){return i.outEdges(u)})}function s(i,a,l){var u={},h=i.nodes();return h.forEach(function(p){u[p]={},u[p][p]={distance:0},h.forEach(function(f){p!==f&&(u[p][f]={distance:Number.POSITIVE_INFINITY})}),l(p).forEach(function(f){var g=f.v===p?f.w:f.v,v=a(f);u[p][g]={distance:v,predecessor:p}})}),h.forEach(function(p){var f=u[p];h.forEach(function(g){var v=u[g];h.forEach(function(w){var E=v[p],b=f[w],S=v[w],_=E.distance+b.distance;_<S.distance&&(S.distance=_,S.predecessor=b.predecessor)})})}),u}return Xg}var Qg,HN;function UR(){if(HN)return Qg;HN=1;var e=zn();Qg=t,t.CycleException=n;function t(s){var i={},a={},l=[];function u(h){if(e.has(a,h))throw new n;e.has(i,h)||(a[h]=!0,i[h]=!0,e.each(s.predecessors(h),u),delete a[h],l.push(h))}if(e.each(s.sinks(),u),e.size(i)!==s.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,Qg}var Zg,GN;function vz(){if(GN)return Zg;GN=1;var e=UR();Zg=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return Zg}var Jg,VN;function WR(){if(VN)return Jg;VN=1;var e=zn();Jg=t;function t(s,i,a){e.isArray(i)||(i=[i]);var l=(s.isDirected()?s.successors:s.neighbors).bind(s),u=[],h={};return e.each(i,function(p){if(!s.hasNode(p))throw new Error("Graph does not have node: "+p);n(s,p,a==="post",h,l,u)}),u}function n(s,i,a,l,u,h){e.has(l,i)||(l[i]=!0,a||h.push(i),e.each(u(i),function(p){n(s,p,a,l,u,h)}),a&&h.push(i))}return Jg}var ey,YN;function wz(){if(YN)return ey;YN=1;var e=WR();ey=t;function t(n,s){return e(n,s,"post")}return ey}var ty,KN;function xz(){if(KN)return ty;KN=1;var e=WR();ty=t;function t(n,s){return e(n,s,"pre")}return ty}var ny,XN;function bz(){if(XN)return ny;XN=1;var e=zn(),t=i0(),n=FR();ny=s;function s(i,a){var l=new t,u={},h=new n,p;function f(v){var w=v.v===p?v.w:v.v,E=h.priority(w);if(E!==void 0){var b=a(v);b<E&&(u[w]=p,h.decrease(w,b))}}if(i.nodeCount()===0)return l;e.each(i.nodes(),function(v){h.add(v,Number.POSITIVE_INFINITY),l.setNode(v)}),h.decrease(i.nodes()[0],0);for(var g=!1;h.size()>0;){if(p=h.removeMin(),e.has(u,p))l.setEdge(p,u[p]);else{if(g)throw new Error("Input graph is not connected: "+i);g=!0}i.nodeEdges(p).forEach(f)}return l}return ny}var ry,QN;function kz(){return QN||(QN=1,ry={components:pz(),dijkstra:zR(),dijkstraAll:mz(),findCycles:gz(),floydWarshall:yz(),isAcyclic:vz(),postorder:wz(),preorder:xz(),prim:bz(),tarjan:BR(),topsort:UR()}),ry}var sy,ZN;function _z(){if(ZN)return sy;ZN=1;var e=fz();return sy={Graph:e.Graph,json:hz(),alg:kz(),version:e.version},sy}var oy,JN;function dr(){if(JN)return oy;JN=1;var e;if(typeof Ww=="function")try{e=_z()}catch{}return e||(e=window.graphlib),oy=e,oy}var iy,eE;function Sz(){if(eE)return iy;eE=1;var e=mR(),t=1,n=4;function s(i){return e(i,t|n)}return iy=s,iy}var ay,tE;function pd(){if(tE)return ay;tE=1;var e=Ji(),t=ts(),n=od(),s=Fn();function i(a,l,u){if(!s(u))return!1;var h=typeof l;return(h=="number"?t(u)&&n(l,u.length):h=="string"&&l in u)?e(u[l],a):!1}return ay=i,ay}var ly,nE;function Nz(){if(nE)return ly;nE=1;var e=hd(),t=Ji(),n=pd(),s=jo(),i=Object.prototype,a=i.hasOwnProperty,l=e(function(u,h){u=Object(u);var p=-1,f=h.length,g=f>2?h[2]:void 0;for(g&&n(h[0],h[1],g)&&(f=1);++p<f;)for(var v=h[p],w=s(v),E=-1,b=w.length;++E<b;){var S=w[E],_=u[S];(_===void 0||t(_,i[S])&&!a.call(u,S))&&(u[S]=v[S])}return u});return ly=l,ly}var cy,rE;function Ez(){if(rE)return cy;rE=1;var e=ns(),t=ts(),n=$s();function s(i){return function(a,l,u){var h=Object(a);if(!t(a)){var p=e(l,3);a=n(a),l=function(g){return p(h[g],g,h)}}var f=i(a,l,u);return f>-1?h[p?a[f]:f]:void 0}}return cy=s,cy}var uy,sE;function Cz(){if(sE)return uy;sE=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return uy=t,uy}var dy,oE;function jz(){if(oE)return dy;oE=1;var e=Cz(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return dy=n,dy}var fy,iE;function Tz(){if(iE)return fy;iE=1;var e=jz(),t=Fn(),n=ra(),s=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function h(p){if(typeof p=="number")return p;if(n(p))return s;if(t(p)){var f=typeof p.valueOf=="function"?p.valueOf():p;p=t(f)?f+"":f}if(typeof p!="string")return p===0?p:+p;p=e(p);var g=a.test(p);return g||l.test(p)?u(p.slice(2),g?2:8):i.test(p)?s:+p}return fy=h,fy}var hy,aE;function HR(){if(aE)return hy;aE=1;var e=Tz(),t=1/0,n=17976931348623157e292;function s(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var a=i<0?-1:1;return a*n}return i===i?i:0}return hy=s,hy}var py,lE;function Rz(){if(lE)return py;lE=1;var e=HR();function t(n){var s=e(n),i=s%1;return s===s?i?s-i:s:0}return py=t,py}var my,cE;function Az(){if(cE)return my;cE=1;var e=LR(),t=ns(),n=Rz(),s=Math.max;function i(a,l,u){var h=a==null?0:a.length;if(!h)return-1;var p=u==null?0:n(u);return p<0&&(p=s(h+p,0)),e(a,t(l,3),p)}return my=i,my}var gy,uE;function Mz(){if(uE)return gy;uE=1;var e=Ez(),t=Az(),n=e(t);return gy=n,gy}var yy,dE;function GR(){if(dE)return yy;dE=1;var e=o0();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return yy=t,yy}var vy,fE;function Iz(){if(fE)return vy;fE=1;var e=t0(),t=gR(),n=jo();function s(i,a){return i==null?i:e(i,t(a),n)}return vy=s,vy}var wy,hE;function Oz(){if(hE)return wy;hE=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return wy=e,wy}var xy,pE;function Pz(){if(pE)return xy;pE=1;var e=rd(),t=n0(),n=ns();function s(i,a){var l={};return a=n(a,3),t(i,function(u,h,p){e(l,h,a(u,h,p))}),l}return xy=s,xy}var by,mE;function a0(){if(mE)return by;mE=1;var e=ra();function t(n,s,i){for(var a=-1,l=n.length;++a<l;){var u=n[a],h=s(u);if(h!=null&&(p===void 0?h===h&&!e(h):i(h,p)))var p=h,f=u}return f}return by=t,by}var ky,gE;function $z(){if(gE)return ky;gE=1;function e(t,n){return t>n}return ky=e,ky}var _y,yE;function Lz(){if(yE)return _y;yE=1;var e=a0(),t=$z(),n=To();function s(i){return i&&i.length?e(i,n,t):void 0}return _y=s,_y}var Sy,vE;function VR(){if(vE)return Sy;vE=1;var e=rd(),t=Ji();function n(s,i,a){(a!==void 0&&!t(s[i],a)||a===void 0&&!(i in s))&&e(s,i,a)}return Sy=n,Sy}var Ny,wE;function qz(){if(wE)return Ny;wE=1;var e=Eo(),t=ld(),n=Tr(),s="[object Object]",i=Function.prototype,a=Object.prototype,l=i.toString,u=a.hasOwnProperty,h=l.call(Object);function p(f){if(!n(f)||e(f)!=s)return!1;var g=t(f);if(g===null)return!0;var v=u.call(g,"constructor")&&g.constructor;return typeof v=="function"&&v instanceof v&&l.call(v)==h}return Ny=p,Ny}var Ey,xE;function YR(){if(xE)return Ey;xE=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return Ey=e,Ey}var Cy,bE;function Dz(){if(bE)return Cy;bE=1;var e=Ll(),t=jo();function n(s){return e(s,t(s))}return Cy=n,Cy}var jy,kE;function Fz(){if(kE)return jy;kE=1;var e=VR(),t=rR(),n=fR(),s=sR(),i=pR(),a=ql(),l=It(),u=qR(),h=ta(),p=$l(),f=Fn(),g=qz(),v=Dl(),w=YR(),E=Dz();function b(S,_,N,C,j,M,P){var I=w(S,N),F=w(_,N),O=P.get(F);if(O){e(S,N,O);return}var A=M?M(I,F,N+"",S,_,P):void 0,L=A===void 0;if(L){var H=l(F),X=!H&&h(F),R=!H&&!X&&v(F);A=F,H||X||R?l(I)?A=I:u(I)?A=s(I):X?(L=!1,A=t(F,!0)):R?(L=!1,A=n(F,!0)):A=[]:g(F)||a(F)?(A=I,a(I)?A=E(I):(!f(I)||p(I))&&(A=i(F))):L=!1}L&&(P.set(F,A),j(A,F,C,M,P),P.delete(F)),e(S,N,A)}return jy=b,jy}var Ty,_E;function zz(){if(_E)return Ty;_E=1;var e=nd(),t=VR(),n=t0(),s=Fz(),i=Fn(),a=jo(),l=YR();function u(h,p,f,g,v){h!==p&&n(p,function(w,E){if(v||(v=new e),i(w))s(h,p,E,f,u,g,v);else{var b=g?g(l(h,E),w,E+"",h,p,v):void 0;b===void 0&&(b=w),t(h,E,b)}},a)}return Ty=u,Ty}var Ry,SE;function Bz(){if(SE)return Ry;SE=1;var e=hd(),t=pd();function n(s){return e(function(i,a){var l=-1,u=a.length,h=u>1?a[u-1]:void 0,p=u>2?a[2]:void 0;for(h=s.length>3&&typeof h=="function"?(u--,h):void 0,p&&t(a[0],a[1],p)&&(h=u<3?void 0:h,u=1),i=Object(i);++l<u;){var f=a[l];f&&s(i,f,l,h)}return i})}return Ry=n,Ry}var Ay,NE;function Uz(){if(NE)return Ay;NE=1;var e=zz(),t=Bz(),n=t(function(s,i,a){e(s,i,a)});return Ay=n,Ay}var My,EE;function KR(){if(EE)return My;EE=1;function e(t,n){return t<n}return My=e,My}var Iy,CE;function Wz(){if(CE)return Iy;CE=1;var e=a0(),t=KR(),n=To();function s(i){return i&&i.length?e(i,n,t):void 0}return Iy=s,Iy}var Oy,jE;function Hz(){if(jE)return Oy;jE=1;var e=a0(),t=ns(),n=KR();function s(i,a){return i&&i.length?e(i,t(a,2),n):void 0}return Oy=s,Oy}var Py,TE;function Gz(){if(TE)return Py;TE=1;var e=hr(),t=function(){return e.Date.now()};return Py=t,Py}var $y,RE;function Vz(){if(RE)return $y;RE=1;var e=sd(),t=dd(),n=od(),s=Fn(),i=Fl();function a(l,u,h,p){if(!s(l))return l;u=t(u,l);for(var f=-1,g=u.length,v=g-1,w=l;w!=null&&++f<g;){var E=i(u[f]),b=h;if(E==="__proto__"||E==="constructor"||E==="prototype")return l;if(f!=v){var S=w[E];b=p?p(S,E,w):void 0,b===void 0&&(b=s(S)?S:n(u[f+1])?[]:{})}e(w,E,b),w=w[E]}return l}return $y=a,$y}var Ly,AE;function Yz(){if(AE)return Ly;AE=1;var e=fd(),t=Vz(),n=dd();function s(i,a,l){for(var u=-1,h=a.length,p={};++u<h;){var f=a[u],g=e(i,f);l(g,f)&&t(p,n(f,i),g)}return p}return Ly=s,Ly}var qy,ME;function Kz(){if(ME)return qy;ME=1;var e=Yz(),t=CR();function n(s,i){return e(s,i,function(a,l){return t(s,l)})}return qy=n,qy}var Dy,IE;function Xz(){if(IE)return Dy;IE=1;var e=GR(),t=PR(),n=$R();function s(i){return n(t(i,void 0,e),i+"")}return Dy=s,Dy}var Fy,OE;function Qz(){if(OE)return Fy;OE=1;var e=Kz(),t=Xz(),n=t(function(s,i){return s==null?{}:e(s,i)});return Fy=n,Fy}var zy,PE;function Zz(){if(PE)return zy;PE=1;var e=Math.ceil,t=Math.max;function n(s,i,a,l){for(var u=-1,h=t(e((i-s)/(a||1)),0),p=Array(h);h--;)p[l?h:++u]=s,s+=a;return p}return zy=n,zy}var By,$E;function Jz(){if($E)return By;$E=1;var e=Zz(),t=pd(),n=HR();function s(i){return function(a,l,u){return u&&typeof u!="number"&&t(a,l,u)&&(l=u=void 0),a=n(a),l===void 0?(l=a,a=0):l=n(l),u=u===void 0?a<l?1:-1:n(u),e(a,l,u,i)}}return By=s,By}var Uy,LE;function eB(){if(LE)return Uy;LE=1;var e=Jz(),t=e();return Uy=t,Uy}var Wy,qE;function tB(){if(qE)return Wy;qE=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return Wy=e,Wy}var Hy,DE;function nB(){if(DE)return Hy;DE=1;var e=ra();function t(n,s){if(n!==s){var i=n!==void 0,a=n===null,l=n===n,u=e(n),h=s!==void 0,p=s===null,f=s===s,g=e(s);if(!p&&!g&&!u&&n>s||u&&h&&f&&!p&&!g||a&&h&&f||!i&&f||!l)return 1;if(!a&&!u&&!g&&n<s||g&&i&&l&&!a&&!u||p&&i&&l||!h&&l||!f)return-1}return 0}return Hy=t,Hy}var Gy,FE;function rB(){if(FE)return Gy;FE=1;var e=nB();function t(n,s,i){for(var a=-1,l=n.criteria,u=s.criteria,h=l.length,p=i.length;++a<h;){var f=e(l[a],u[a]);if(f){if(a>=p)return f;var g=i[a];return f*(g=="desc"?-1:1)}}return n.index-s.index}return Gy=t,Gy}var Vy,zE;function sB(){if(zE)return Vy;zE=1;var e=ud(),t=fd(),n=ns(),s=MR(),i=tB(),a=id(),l=rB(),u=To(),h=It();function p(f,g,v){g.length?g=e(g,function(b){return h(b)?function(S){return t(S,b.length===1?b[0]:b)}:b}):g=[u];var w=-1;g=e(g,a(n));var E=s(f,function(b,S,_){var N=e(g,function(C){return C(b)});return{criteria:N,index:++w,value:b}});return i(E,function(b,S){return l(b,S,v)})}return Vy=p,Vy}var Yy,BE;function oB(){if(BE)return Yy;BE=1;var e=o0(),t=sB(),n=hd(),s=pd(),i=n(function(a,l){if(a==null)return[];var u=l.length;return u>1&&s(a,l[0],l[1])?l=[]:u>2&&s(l[0],l[1],l[2])&&(l=[l[0]]),t(a,e(l,1),[])});return Yy=i,Yy}var Ky,UE;function iB(){if(UE)return Ky;UE=1;var e=NR(),t=0;function n(s){var i=++t;return e(s)+i}return Ky=n,Ky}var Xy,WE;function aB(){if(WE)return Xy;WE=1;function e(t,n,s){for(var i=-1,a=t.length,l=n.length,u={};++i<a;){var h=i<l?n[i]:void 0;s(u,t[i],h)}return u}return Xy=e,Xy}var Qy,HE;function lB(){if(HE)return Qy;HE=1;var e=sd(),t=aB();function n(s,i){return t(s||[],i||[],e)}return Qy=n,Qy}var Zy,GE;function wt(){if(GE)return Zy;GE=1;var e;if(typeof Ww=="function")try{e={cloneDeep:Sz(),constant:e0(),defaults:Nz(),each:vR(),filter:TR(),find:Mz(),flatten:GR(),forEach:yR(),forIn:Iz(),has:RR(),isUndefined:AR(),last:Oz(),map:IR(),mapValues:Pz(),max:Lz(),merge:Uz(),min:Wz(),minBy:Hz(),now:Gz(),pick:Qz(),range:eB(),reduce:OR(),sortBy:oB(),uniqueId:iB(),values:DR(),zipObject:lB()}}catch{}return e||(e=window._),Zy=e,Zy}var Jy,VE;function cB(){if(VE)return Jy;VE=1,Jy=e;function e(){var s={};s._next=s._prev=s,this._sentinel=s}e.prototype.dequeue=function(){var s=this._sentinel,i=s._prev;if(i!==s)return t(i),i},e.prototype.enqueue=function(s){var i=this._sentinel;s._prev&&s._next&&t(s),s._next=i._next,i._next._prev=s,i._next=s,s._prev=i},e.prototype.toString=function(){for(var s=[],i=this._sentinel,a=i._prev;a!==i;)s.push(JSON.stringify(a,n)),a=a._prev;return"["+s.join(", ")+"]"};function t(s){s._prev._next=s._next,s._next._prev=s._prev,delete s._next,delete s._prev}function n(s,i){if(s!=="_next"&&s!=="_prev")return i}return Jy}var ev,YE;function uB(){if(YE)return ev;YE=1;var e=wt(),t=dr().Graph,n=cB();ev=i;var s=e.constant(1);function i(p,f){if(p.nodeCount()<=1)return[];var g=u(p,f||s),v=a(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(v,function(w){return p.outEdges(w.v,w.w)}),!0)}function a(p,f,g){for(var v=[],w=f[f.length-1],E=f[0],b;p.nodeCount();){for(;b=E.dequeue();)l(p,f,g,b);for(;b=w.dequeue();)l(p,f,g,b);if(p.nodeCount()){for(var S=f.length-2;S>0;--S)if(b=f[S].dequeue(),b){v=v.concat(l(p,f,g,b,!0));break}}}return v}function l(p,f,g,v,w){var E=w?[]:void 0;return e.forEach(p.inEdges(v.v),function(b){var S=p.edge(b),_=p.node(b.v);w&&E.push({v:b.v,w:b.w}),_.out-=S,h(f,g,_)}),e.forEach(p.outEdges(v.v),function(b){var S=p.edge(b),_=b.w,N=p.node(_);N.in-=S,h(f,g,N)}),p.removeNode(v.v),E}function u(p,f){var g=new t,v=0,w=0;e.forEach(p.nodes(),function(S){g.setNode(S,{v:S,in:0,out:0})}),e.forEach(p.edges(),function(S){var _=g.edge(S.v,S.w)||0,N=f(S),C=_+N;g.setEdge(S.v,S.w,C),w=Math.max(w,g.node(S.v).out+=N),v=Math.max(v,g.node(S.w).in+=N)});var E=e.range(w+v+3).map(function(){return new n}),b=v+1;return e.forEach(g.nodes(),function(S){h(E,b,g.node(S))}),{graph:g,buckets:E,zeroIdx:b}}function h(p,f,g){g.out?g.in?p[g.out-g.in+f].enqueue(g):p[p.length-1].enqueue(g):p[0].enqueue(g)}return ev}var tv,KE;function dB(){if(KE)return tv;KE=1;var e=wt(),t=uB();tv={run:n,undo:i};function n(a){var l=a.graph().acyclicer==="greedy"?t(a,u(a)):s(a);e.forEach(l,function(h){var p=a.edge(h);a.removeEdge(h),p.forwardName=h.name,p.reversed=!0,a.setEdge(h.w,h.v,p,e.uniqueId("rev"))});function u(h){return function(p){return h.edge(p).weight}}}function s(a){var l=[],u={},h={};function p(f){e.has(h,f)||(h[f]=!0,u[f]=!0,e.forEach(a.outEdges(f),function(g){e.has(u,g.w)?l.push(g):p(g.w)}),delete u[f])}return e.forEach(a.nodes(),p),l}function i(a){e.forEach(a.edges(),function(l){var u=a.edge(l);if(u.reversed){a.removeEdge(l);var h=u.forwardName;delete u.reversed,delete u.forwardName,a.setEdge(l.w,l.v,u,h)}})}return tv}var nv,XE;function pn(){if(XE)return nv;XE=1;var e=wt(),t=dr().Graph;nv={addDummyNode:n,simplify:s,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:l,intersectRect:u,buildLayerMatrix:h,normalizeRanks:p,removeEmptyRanks:f,addBorderNode:g,maxRank:v,partition:w,time:E,notime:b};function n(S,_,N,C){var j;do j=e.uniqueId(C);while(S.hasNode(j));return N.dummy=_,S.setNode(j,N),j}function s(S){var _=new t().setGraph(S.graph());return e.forEach(S.nodes(),function(N){_.setNode(N,S.node(N))}),e.forEach(S.edges(),function(N){var C=_.edge(N.v,N.w)||{weight:0,minlen:1},j=S.edge(N);_.setEdge(N.v,N.w,{weight:C.weight+j.weight,minlen:Math.max(C.minlen,j.minlen)})}),_}function i(S){var _=new t({multigraph:S.isMultigraph()}).setGraph(S.graph());return e.forEach(S.nodes(),function(N){S.children(N).length||_.setNode(N,S.node(N))}),e.forEach(S.edges(),function(N){_.setEdge(N,S.edge(N))}),_}function a(S){var _=e.map(S.nodes(),function(N){var C={};return e.forEach(S.outEdges(N),function(j){C[j.w]=(C[j.w]||0)+S.edge(j).weight}),C});return e.zipObject(S.nodes(),_)}function l(S){var _=e.map(S.nodes(),function(N){var C={};return e.forEach(S.inEdges(N),function(j){C[j.v]=(C[j.v]||0)+S.edge(j).weight}),C});return e.zipObject(S.nodes(),_)}function u(S,_){var N=S.x,C=S.y,j=_.x-N,M=_.y-C,P=S.width/2,I=S.height/2;if(!j&&!M)throw new Error("Not possible to find intersection inside of the rectangle");var F,O;return Math.abs(M)*P>Math.abs(j)*I?(M<0&&(I=-I),F=I*j/M,O=I):(j<0&&(P=-P),F=P,O=P*M/j),{x:N+F,y:C+O}}function h(S){var _=e.map(e.range(v(S)+1),function(){return[]});return e.forEach(S.nodes(),function(N){var C=S.node(N),j=C.rank;e.isUndefined(j)||(_[j][C.order]=N)}),_}function p(S){var _=e.min(e.map(S.nodes(),function(N){return S.node(N).rank}));e.forEach(S.nodes(),function(N){var C=S.node(N);e.has(C,"rank")&&(C.rank-=_)})}function f(S){var _=e.min(e.map(S.nodes(),function(M){return S.node(M).rank})),N=[];e.forEach(S.nodes(),function(M){var P=S.node(M).rank-_;N[P]||(N[P]=[]),N[P].push(M)});var C=0,j=S.graph().nodeRankFactor;e.forEach(N,function(M,P){e.isUndefined(M)&&P%j!==0?--C:C&&e.forEach(M,function(I){S.node(I).rank+=C})})}function g(S,_,N,C){var j={width:0,height:0};return arguments.length>=4&&(j.rank=N,j.order=C),n(S,"border",j,_)}function v(S){return e.max(e.map(S.nodes(),function(_){var N=S.node(_).rank;if(!e.isUndefined(N))return N}))}function w(S,_){var N={lhs:[],rhs:[]};return e.forEach(S,function(C){_(C)?N.lhs.push(C):N.rhs.push(C)}),N}function E(S,_){var N=e.now();try{return _()}finally{console.log(S+" time: "+(e.now()-N)+"ms")}}function b(S,_){return _()}return nv}var rv,QE;function fB(){if(QE)return rv;QE=1;var e=wt(),t=pn();rv={run:n,undo:i};function n(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(l){s(a,l)})}function s(a,l){var u=l.v,h=a.node(u).rank,p=l.w,f=a.node(p).rank,g=l.name,v=a.edge(l),w=v.labelRank;if(f!==h+1){a.removeEdge(l);var E,b,S;for(S=0,++h;h<f;++S,++h)v.points=[],b={width:0,height:0,edgeLabel:v,edgeObj:l,rank:h},E=t.addDummyNode(a,"edge",b,"_d"),h===w&&(b.width=v.width,b.height=v.height,b.dummy="edge-label",b.labelpos=v.labelpos),a.setEdge(u,E,{weight:v.weight},g),S===0&&a.graph().dummyChains.push(E),u=E;a.setEdge(u,p,{weight:v.weight},g)}}function i(a){e.forEach(a.graph().dummyChains,function(l){var u=a.node(l),h=u.edgeLabel,p;for(a.setEdge(u.edgeObj,h);u.dummy;)p=a.successors(l)[0],a.removeNode(l),h.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(h.x=u.x,h.y=u.y,h.width=u.width,h.height=u.height),l=p,u=a.node(l)})}return rv}var sv,ZE;function qu(){if(ZE)return sv;ZE=1;var e=wt();sv={longestPath:t,slack:n};function t(s){var i={};function a(l){var u=s.node(l);if(e.has(i,l))return u.rank;i[l]=!0;var h=e.min(e.map(s.outEdges(l),function(p){return a(p.w)-s.edge(p).minlen}));return(h===Number.POSITIVE_INFINITY||h===void 0||h===null)&&(h=0),u.rank=h}e.forEach(s.sources(),a)}function n(s,i){return s.node(i.w).rank-s.node(i.v).rank-s.edge(i).minlen}return sv}var ov,JE;function XR(){if(JE)return ov;JE=1;var e=wt(),t=dr().Graph,n=qu().slack;ov=s;function s(u){var h=new t({directed:!1}),p=u.nodes()[0],f=u.nodeCount();h.setNode(p,{});for(var g,v;i(h,u)<f;)g=a(h,u),v=h.hasNode(g.v)?n(u,g):-n(u,g),l(h,u,v);return h}function i(u,h){function p(f){e.forEach(h.nodeEdges(f),function(g){var v=g.v,w=f===v?g.w:v;!u.hasNode(w)&&!n(h,g)&&(u.setNode(w,{}),u.setEdge(f,w,{}),p(w))})}return e.forEach(u.nodes(),p),u.nodeCount()}function a(u,h){return e.minBy(h.edges(),function(p){if(u.hasNode(p.v)!==u.hasNode(p.w))return n(h,p)})}function l(u,h,p){e.forEach(u.nodes(),function(f){h.node(f).rank+=p})}return ov}var iv,eC;function hB(){if(eC)return iv;eC=1;var e=wt(),t=XR(),n=qu().slack,s=qu().longestPath,i=dr().alg.preorder,a=dr().alg.postorder,l=pn().simplify;iv=u,u.initLowLimValues=g,u.initCutValues=h,u.calcCutValue=f,u.leaveEdge=w,u.enterEdge=E,u.exchangeEdges=b;function u(C){C=l(C),s(C);var j=t(C);g(j),h(j,C);for(var M,P;M=w(j);)P=E(j,C,M),b(j,C,M,P)}function h(C,j){var M=a(C,C.nodes());M=M.slice(0,M.length-1),e.forEach(M,function(P){p(C,j,P)})}function p(C,j,M){var P=C.node(M),I=P.parent;C.edge(M,I).cutvalue=f(C,j,M)}function f(C,j,M){var P=C.node(M),I=P.parent,F=!0,O=j.edge(M,I),A=0;return O||(F=!1,O=j.edge(I,M)),A=O.weight,e.forEach(j.nodeEdges(M),function(L){var H=L.v===M,X=H?L.w:L.v;if(X!==I){var R=H===F,K=j.edge(L).weight;if(A+=R?K:-K,_(C,M,X)){var G=C.edge(M,X).cutvalue;A+=R?-G:G}}}),A}function g(C,j){arguments.length<2&&(j=C.nodes()[0]),v(C,{},1,j)}function v(C,j,M,P,I){var F=M,O=C.node(P);return j[P]=!0,e.forEach(C.neighbors(P),function(A){e.has(j,A)||(M=v(C,j,M,A,P))}),O.low=F,O.lim=M++,I?O.parent=I:delete O.parent,M}function w(C){return e.find(C.edges(),function(j){return C.edge(j).cutvalue<0})}function E(C,j,M){var P=M.v,I=M.w;j.hasEdge(P,I)||(P=M.w,I=M.v);var F=C.node(P),O=C.node(I),A=F,L=!1;F.lim>O.lim&&(A=O,L=!0);var H=e.filter(j.edges(),function(X){return L===N(C,C.node(X.v),A)&&L!==N(C,C.node(X.w),A)});return e.minBy(H,function(X){return n(j,X)})}function b(C,j,M,P){var I=M.v,F=M.w;C.removeEdge(I,F),C.setEdge(P.v,P.w,{}),g(C),h(C,j),S(C,j)}function S(C,j){var M=e.find(C.nodes(),function(I){return!j.node(I).parent}),P=i(C,M);P=P.slice(1),e.forEach(P,function(I){var F=C.node(I).parent,O=j.edge(I,F),A=!1;O||(O=j.edge(F,I),A=!0),j.node(I).rank=j.node(F).rank+(A?O.minlen:-O.minlen)})}function _(C,j,M){return C.hasEdge(j,M)}function N(C,j,M){return M.low<=j.lim&&j.lim<=M.lim}return iv}var av,tC;function pB(){if(tC)return av;tC=1;var e=qu(),t=e.longestPath,n=XR(),s=hB();av=i;function i(h){switch(h.graph().ranker){case"network-simplex":u(h);break;case"tight-tree":l(h);break;case"longest-path":a(h);break;default:u(h)}}var a=t;function l(h){t(h),n(h)}function u(h){s(h)}return av}var lv,nC;function mB(){if(nC)return lv;nC=1;var e=wt();lv=t;function t(i){var a=s(i);e.forEach(i.graph().dummyChains,function(l){for(var u=i.node(l),h=u.edgeObj,p=n(i,a,h.v,h.w),f=p.path,g=p.lca,v=0,w=f[v],E=!0;l!==h.w;){if(u=i.node(l),E){for(;(w=f[v])!==g&&i.node(w).maxRank<u.rank;)v++;w===g&&(E=!1)}if(!E){for(;v<f.length-1&&i.node(w=f[v+1]).minRank<=u.rank;)v++;w=f[v]}i.setParent(l,w),l=i.successors(l)[0]}})}function n(i,a,l,u){var h=[],p=[],f=Math.min(a[l].low,a[u].low),g=Math.max(a[l].lim,a[u].lim),v,w;v=l;do v=i.parent(v),h.push(v);while(v&&(a[v].low>f||g>a[v].lim));for(w=v,v=u;(v=i.parent(v))!==w;)p.push(v);return{path:h.concat(p.reverse()),lca:w}}function s(i){var a={},l=0;function u(h){var p=l;e.forEach(i.children(h),u),a[h]={low:p,lim:l++}}return e.forEach(i.children(),u),a}return lv}var cv,rC;function gB(){if(rC)return cv;rC=1;var e=wt(),t=pn();cv={run:n,cleanup:l};function n(u){var h=t.addDummyNode(u,"root",{},"_root"),p=i(u),f=e.max(e.values(p))-1,g=2*f+1;u.graph().nestingRoot=h,e.forEach(u.edges(),function(w){u.edge(w).minlen*=g});var v=a(u)+1;e.forEach(u.children(),function(w){s(u,h,g,v,f,p,w)}),u.graph().nodeRankFactor=g}function s(u,h,p,f,g,v,w){var E=u.children(w);if(!E.length){w!==h&&u.setEdge(h,w,{weight:0,minlen:p});return}var b=t.addBorderNode(u,"_bt"),S=t.addBorderNode(u,"_bb"),_=u.node(w);u.setParent(b,w),_.borderTop=b,u.setParent(S,w),_.borderBottom=S,e.forEach(E,function(N){s(u,h,p,f,g,v,N);var C=u.node(N),j=C.borderTop?C.borderTop:N,M=C.borderBottom?C.borderBottom:N,P=C.borderTop?f:2*f,I=j!==M?1:g-v[w]+1;u.setEdge(b,j,{weight:P,minlen:I,nestingEdge:!0}),u.setEdge(M,S,{weight:P,minlen:I,nestingEdge:!0})}),u.parent(w)||u.setEdge(h,b,{weight:0,minlen:g+v[w]})}function i(u){var h={};function p(f,g){var v=u.children(f);v&&v.length&&e.forEach(v,function(w){p(w,g+1)}),h[f]=g}return e.forEach(u.children(),function(f){p(f,1)}),h}function a(u){return e.reduce(u.edges(),function(h,p){return h+u.edge(p).weight},0)}function l(u){var h=u.graph();u.removeNode(h.nestingRoot),delete h.nestingRoot,e.forEach(u.edges(),function(p){var f=u.edge(p);f.nestingEdge&&u.removeEdge(p)})}return cv}var uv,sC;function yB(){if(sC)return uv;sC=1;var e=wt(),t=pn();uv=n;function n(i){function a(l){var u=i.children(l),h=i.node(l);if(u.length&&e.forEach(u,a),e.has(h,"minRank")){h.borderLeft=[],h.borderRight=[];for(var p=h.minRank,f=h.maxRank+1;p<f;++p)s(i,"borderLeft","_bl",l,h,p),s(i,"borderRight","_br",l,h,p)}}e.forEach(i.children(),a)}function s(i,a,l,u,h,p){var f={width:0,height:0,rank:p,borderType:a},g=h[a][p-1],v=t.addDummyNode(i,"border",f,l);h[a][p]=v,i.setParent(v,u),g&&i.setEdge(g,v,{weight:1})}return uv}var dv,oC;function vB(){if(oC)return dv;oC=1;var e=wt();dv={adjust:t,undo:n};function t(p){var f=p.graph().rankdir.toLowerCase();(f==="lr"||f==="rl")&&s(p)}function n(p){var f=p.graph().rankdir.toLowerCase();(f==="bt"||f==="rl")&&a(p),(f==="lr"||f==="rl")&&(u(p),s(p))}function s(p){e.forEach(p.nodes(),function(f){i(p.node(f))}),e.forEach(p.edges(),function(f){i(p.edge(f))})}function i(p){var f=p.width;p.width=p.height,p.height=f}function a(p){e.forEach(p.nodes(),function(f){l(p.node(f))}),e.forEach(p.edges(),function(f){var g=p.edge(f);e.forEach(g.points,l),e.has(g,"y")&&l(g)})}function l(p){p.y=-p.y}function u(p){e.forEach(p.nodes(),function(f){h(p.node(f))}),e.forEach(p.edges(),function(f){var g=p.edge(f);e.forEach(g.points,h),e.has(g,"x")&&h(g)})}function h(p){var f=p.x;p.x=p.y,p.y=f}return dv}var fv,iC;function wB(){if(iC)return fv;iC=1;var e=wt();fv=t;function t(n){var s={},i=e.filter(n.nodes(),function(p){return!n.children(p).length}),a=e.max(e.map(i,function(p){return n.node(p).rank})),l=e.map(e.range(a+1),function(){return[]});function u(p){if(!e.has(s,p)){s[p]=!0;var f=n.node(p);l[f.rank].push(p),e.forEach(n.successors(p),u)}}var h=e.sortBy(i,function(p){return n.node(p).rank});return e.forEach(h,u),l}return fv}var hv,aC;function xB(){if(aC)return hv;aC=1;var e=wt();hv=t;function t(s,i){for(var a=0,l=1;l<i.length;++l)a+=n(s,i[l-1],i[l]);return a}function n(s,i,a){for(var l=e.zipObject(a,e.map(a,function(v,w){return w})),u=e.flatten(e.map(i,function(v){return e.sortBy(e.map(s.outEdges(v),function(w){return{pos:l[w.w],weight:s.edge(w).weight}}),"pos")}),!0),h=1;h<a.length;)h<<=1;var p=2*h-1;h-=1;var f=e.map(new Array(p),function(){return 0}),g=0;return e.forEach(u.forEach(function(v){var w=v.pos+h;f[w]+=v.weight;for(var E=0;w>0;)w%2&&(E+=f[w+1]),w=w-1>>1,f[w]+=v.weight;g+=v.weight*E})),g}return hv}var pv,lC;function bB(){if(lC)return pv;lC=1;var e=wt();pv=t;function t(n,s){return e.map(s,function(i){var a=n.inEdges(i);if(a.length){var l=e.reduce(a,function(u,h){var p=n.edge(h),f=n.node(h.v);return{sum:u.sum+p.weight*f.order,weight:u.weight+p.weight}},{sum:0,weight:0});return{v:i,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:i}})}return pv}var mv,cC;function kB(){if(cC)return mv;cC=1;var e=wt();mv=t;function t(i,a){var l={};e.forEach(i,function(h,p){var f=l[h.v]={indegree:0,in:[],out:[],vs:[h.v],i:p};e.isUndefined(h.barycenter)||(f.barycenter=h.barycenter,f.weight=h.weight)}),e.forEach(a.edges(),function(h){var p=l[h.v],f=l[h.w];!e.isUndefined(p)&&!e.isUndefined(f)&&(f.indegree++,p.out.push(l[h.w]))});var u=e.filter(l,function(h){return!h.indegree});return n(u)}function n(i){var a=[];function l(p){return function(f){f.merged||(e.isUndefined(f.barycenter)||e.isUndefined(p.barycenter)||f.barycenter>=p.barycenter)&&s(p,f)}}function u(p){return function(f){f.in.push(p),--f.indegree===0&&i.push(f)}}for(;i.length;){var h=i.pop();a.push(h),e.forEach(h.in.reverse(),l(h)),e.forEach(h.out,u(h))}return e.map(e.filter(a,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function s(i,a){var l=0,u=0;i.weight&&(l+=i.barycenter*i.weight,u+=i.weight),a.weight&&(l+=a.barycenter*a.weight,u+=a.weight),i.vs=a.vs.concat(i.vs),i.barycenter=l/u,i.weight=u,i.i=Math.min(a.i,i.i),a.merged=!0}return mv}var gv,uC;function _B(){if(uC)return gv;uC=1;var e=wt(),t=pn();gv=n;function n(a,l){var u=t.partition(a,function(b){return e.has(b,"barycenter")}),h=u.lhs,p=e.sortBy(u.rhs,function(b){return-b.i}),f=[],g=0,v=0,w=0;h.sort(i(!!l)),w=s(f,p,w),e.forEach(h,function(b){w+=b.vs.length,f.push(b.vs),g+=b.barycenter*b.weight,v+=b.weight,w=s(f,p,w)});var E={vs:e.flatten(f,!0)};return v&&(E.barycenter=g/v,E.weight=v),E}function s(a,l,u){for(var h;l.length&&(h=e.last(l)).i<=u;)l.pop(),a.push(h.vs),u++;return u}function i(a){return function(l,u){return l.barycenter<u.barycenter?-1:l.barycenter>u.barycenter?1:a?u.i-l.i:l.i-u.i}}return gv}var yv,dC;function SB(){if(dC)return yv;dC=1;var e=wt(),t=bB(),n=kB(),s=_B();yv=i;function i(u,h,p,f){var g=u.children(h),v=u.node(h),w=v?v.borderLeft:void 0,E=v?v.borderRight:void 0,b={};w&&(g=e.filter(g,function(M){return M!==w&&M!==E}));var S=t(u,g);e.forEach(S,function(M){if(u.children(M.v).length){var P=i(u,M.v,p,f);b[M.v]=P,e.has(P,"barycenter")&&l(M,P)}});var _=n(S,p);a(_,b);var N=s(_,f);if(w&&(N.vs=e.flatten([w,N.vs,E],!0),u.predecessors(w).length)){var C=u.node(u.predecessors(w)[0]),j=u.node(u.predecessors(E)[0]);e.has(N,"barycenter")||(N.barycenter=0,N.weight=0),N.barycenter=(N.barycenter*N.weight+C.order+j.order)/(N.weight+2),N.weight+=2}return N}function a(u,h){e.forEach(u,function(p){p.vs=e.flatten(p.vs.map(function(f){return h[f]?h[f].vs:f}),!0)})}function l(u,h){e.isUndefined(u.barycenter)?(u.barycenter=h.barycenter,u.weight=h.weight):(u.barycenter=(u.barycenter*u.weight+h.barycenter*h.weight)/(u.weight+h.weight),u.weight+=h.weight)}return yv}var vv,fC;function NB(){if(fC)return vv;fC=1;var e=wt(),t=dr().Graph;vv=n;function n(i,a,l){var u=s(i),h=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(p){return i.node(p)});return e.forEach(i.nodes(),function(p){var f=i.node(p),g=i.parent(p);(f.rank===a||f.minRank<=a&&a<=f.maxRank)&&(h.setNode(p),h.setParent(p,g||u),e.forEach(i[l](p),function(v){var w=v.v===p?v.w:v.v,E=h.edge(w,p),b=e.isUndefined(E)?0:E.weight;h.setEdge(w,p,{weight:i.edge(v).weight+b})}),e.has(f,"minRank")&&h.setNode(p,{borderLeft:f.borderLeft[a],borderRight:f.borderRight[a]}))}),h}function s(i){for(var a;i.hasNode(a=e.uniqueId("_root")););return a}return vv}var wv,hC;function EB(){if(hC)return wv;hC=1;var e=wt();wv=t;function t(n,s,i){var a={},l;e.forEach(i,function(u){for(var h=n.parent(u),p,f;h;){if(p=n.parent(h),p?(f=a[p],a[p]=h):(f=l,l=h),f&&f!==h){s.setEdge(f,h);return}h=p}})}return wv}var xv,pC;function CB(){if(pC)return xv;pC=1;var e=wt(),t=wB(),n=xB(),s=SB(),i=NB(),a=EB(),l=dr().Graph,u=pn();xv=h;function h(v){var w=u.maxRank(v),E=p(v,e.range(1,w+1),"inEdges"),b=p(v,e.range(w-1,-1,-1),"outEdges"),S=t(v);g(v,S);for(var _=Number.POSITIVE_INFINITY,N,C=0,j=0;j<4;++C,++j){f(C%2?E:b,C%4>=2),S=u.buildLayerMatrix(v);var M=n(v,S);M<_&&(j=0,N=e.cloneDeep(S),_=M)}g(v,N)}function p(v,w,E){return e.map(w,function(b){return i(v,b,E)})}function f(v,w){var E=new l;e.forEach(v,function(b){var S=b.graph().root,_=s(b,S,E,w);e.forEach(_.vs,function(N,C){b.node(N).order=C}),a(b,E,_.vs)})}function g(v,w){e.forEach(w,function(E){e.forEach(E,function(b,S){v.node(b).order=S})})}return xv}var bv,mC;function jB(){if(mC)return bv;mC=1;var e=wt(),t=dr().Graph,n=pn();bv={positionX:E,findType1Conflicts:s,findType2Conflicts:i,addConflict:l,hasConflict:u,verticalAlignment:h,horizontalCompaction:p,alignCoordinates:v,findSmallestWidthAlignment:g,balance:w};function s(_,N){var C={};function j(M,P){var I=0,F=0,O=M.length,A=e.last(P);return e.forEach(P,function(L,H){var X=a(_,L),R=X?_.node(X).order:O;(X||L===A)&&(e.forEach(P.slice(F,H+1),function(K){e.forEach(_.predecessors(K),function(G){var ne=_.node(G),Q=ne.order;(Q<I||R<Q)&&!(ne.dummy&&_.node(K).dummy)&&l(C,G,K)})}),F=H+1,I=R)}),P}return e.reduce(N,j),C}function i(_,N){var C={};function j(P,I,F,O,A){var L;e.forEach(e.range(I,F),function(H){L=P[H],_.node(L).dummy&&e.forEach(_.predecessors(L),function(X){var R=_.node(X);R.dummy&&(R.order<O||R.order>A)&&l(C,X,L)})})}function M(P,I){var F=-1,O,A=0;return e.forEach(I,function(L,H){if(_.node(L).dummy==="border"){var X=_.predecessors(L);X.length&&(O=_.node(X[0]).order,j(I,A,H,F,O),A=H,F=O)}j(I,A,I.length,O,P.length)}),I}return e.reduce(N,M),C}function a(_,N){if(_.node(N).dummy)return e.find(_.predecessors(N),function(C){return _.node(C).dummy})}function l(_,N,C){if(N>C){var j=N;N=C,C=j}var M=_[N];M||(_[N]=M={}),M[C]=!0}function u(_,N,C){if(N>C){var j=N;N=C,C=j}return e.has(_[N],C)}function h(_,N,C,j){var M={},P={},I={};return e.forEach(N,function(F){e.forEach(F,function(O,A){M[O]=O,P[O]=O,I[O]=A})}),e.forEach(N,function(F){var O=-1;e.forEach(F,function(A){var L=j(A);if(L.length){L=e.sortBy(L,function(G){return I[G]});for(var H=(L.length-1)/2,X=Math.floor(H),R=Math.ceil(H);X<=R;++X){var K=L[X];P[A]===A&&O<I[K]&&!u(C,A,K)&&(P[K]=A,P[A]=M[A]=M[K],O=I[K])}}})}),{root:M,align:P}}function p(_,N,C,j,M){var P={},I=f(_,N,C,M),F=M?"borderLeft":"borderRight";function O(H,X){for(var R=I.nodes(),K=R.pop(),G={};K;)G[K]?H(K):(G[K]=!0,R.push(K),R=R.concat(X(K))),K=R.pop()}function A(H){P[H]=I.inEdges(H).reduce(function(X,R){return Math.max(X,P[R.v]+I.edge(R))},0)}function L(H){var X=I.outEdges(H).reduce(function(K,G){return Math.min(K,P[G.w]-I.edge(G))},Number.POSITIVE_INFINITY),R=_.node(H);X!==Number.POSITIVE_INFINITY&&R.borderType!==F&&(P[H]=Math.max(P[H],X))}return O(A,I.predecessors.bind(I)),O(L,I.successors.bind(I)),e.forEach(j,function(H){P[H]=P[C[H]]}),P}function f(_,N,C,j){var M=new t,P=_.graph(),I=b(P.nodesep,P.edgesep,j);return e.forEach(N,function(F){var O;e.forEach(F,function(A){var L=C[A];if(M.setNode(L),O){var H=C[O],X=M.edge(H,L);M.setEdge(H,L,Math.max(I(_,A,O),X||0))}O=A})}),M}function g(_,N){return e.minBy(e.values(N),function(C){var j=Number.NEGATIVE_INFINITY,M=Number.POSITIVE_INFINITY;return e.forIn(C,function(P,I){var F=S(_,I)/2;j=Math.max(P+F,j),M=Math.min(P-F,M)}),j-M})}function v(_,N){var C=e.values(N),j=e.min(C),M=e.max(C);e.forEach(["u","d"],function(P){e.forEach(["l","r"],function(I){var F=P+I,O=_[F],A;if(O!==N){var L=e.values(O);A=I==="l"?j-e.min(L):M-e.max(L),A&&(_[F]=e.mapValues(O,function(H){return H+A}))}})})}function w(_,N){return e.mapValues(_.ul,function(C,j){if(N)return _[N.toLowerCase()][j];var M=e.sortBy(e.map(_,j));return(M[1]+M[2])/2})}function E(_){var N=n.buildLayerMatrix(_),C=e.merge(s(_,N),i(_,N)),j={},M;e.forEach(["u","d"],function(I){M=I==="u"?N:e.values(N).reverse(),e.forEach(["l","r"],function(F){F==="r"&&(M=e.map(M,function(H){return e.values(H).reverse()}));var O=(I==="u"?_.predecessors:_.successors).bind(_),A=h(_,M,C,O),L=p(_,M,A.root,A.align,F==="r");F==="r"&&(L=e.mapValues(L,function(H){return-H})),j[I+F]=L})});var P=g(_,j);return v(j,P),w(j,_.graph().align)}function b(_,N,C){return function(j,M,P){var I=j.node(M),F=j.node(P),O=0,A;if(O+=I.width/2,e.has(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":A=-I.width/2;break;case"r":A=I.width/2;break}if(A&&(O+=C?A:-A),A=0,O+=(I.dummy?N:_)/2,O+=(F.dummy?N:_)/2,O+=F.width/2,e.has(F,"labelpos"))switch(F.labelpos.toLowerCase()){case"l":A=F.width/2;break;case"r":A=-F.width/2;break}return A&&(O+=C?A:-A),A=0,O}}function S(_,N){return _.node(N).width}return bv}var kv,gC;function TB(){if(gC)return kv;gC=1;var e=wt(),t=pn(),n=jB().positionX;kv=s;function s(a){a=t.asNonCompoundGraph(a),i(a),e.forEach(n(a),function(l,u){a.node(u).x=l})}function i(a){var l=t.buildLayerMatrix(a),u=a.graph().ranksep,h=0;e.forEach(l,function(p){var f=e.max(e.map(p,function(g){return a.node(g).height}));e.forEach(p,function(g){a.node(g).y=h+f/2}),h+=f+u})}return kv}var _v,yC;function RB(){if(yC)return _v;yC=1;var e=wt(),t=dB(),n=fB(),s=pB(),i=pn().normalizeRanks,a=mB(),l=pn().removeEmptyRanks,u=gB(),h=yB(),p=vB(),f=CB(),g=TB(),v=pn(),w=dr().Graph;_v=E;function E(z,D){var J=D&&D.debugTiming?v.time:v.notime;J("layout",function(){var V=J(" buildLayoutGraph",function(){return O(z)});J(" runLayout",function(){b(V,J)}),J(" updateInputGraph",function(){S(z,V)})})}function b(z,D){D(" makeSpaceForEdgeLabels",function(){A(z)}),D(" removeSelfEdges",function(){W(z)}),D(" acyclic",function(){t.run(z)}),D(" nestingGraph.run",function(){u.run(z)}),D(" rank",function(){s(v.asNonCompoundGraph(z))}),D(" injectEdgeLabelProxies",function(){L(z)}),D(" removeEmptyRanks",function(){l(z)}),D(" nestingGraph.cleanup",function(){u.cleanup(z)}),D(" normalizeRanks",function(){i(z)}),D(" assignRankMinMax",function(){H(z)}),D(" removeEdgeLabelProxies",function(){X(z)}),D(" normalize.run",function(){n.run(z)}),D(" parentDummyChains",function(){a(z)}),D(" addBorderSegments",function(){h(z)}),D(" order",function(){f(z)}),D(" insertSelfEdges",function(){ee(z)}),D(" adjustCoordinateSystem",function(){p.adjust(z)}),D(" position",function(){g(z)}),D(" positionSelfEdges",function(){$(z)}),D(" removeBorderNodes",function(){Q(z)}),D(" normalize.undo",function(){n.undo(z)}),D(" fixupEdgeLabelCoords",function(){G(z)}),D(" undoCoordinateSystem",function(){p.undo(z)}),D(" translateGraph",function(){R(z)}),D(" assignNodeIntersects",function(){K(z)}),D(" reversePoints",function(){ne(z)}),D(" acyclic.undo",function(){t.undo(z)})}function S(z,D){e.forEach(z.nodes(),function(J){var V=z.node(J),ae=D.node(J);V&&(V.x=ae.x,V.y=ae.y,D.children(J).length&&(V.width=ae.width,V.height=ae.height))}),e.forEach(z.edges(),function(J){var V=z.edge(J),ae=D.edge(J);V.points=ae.points,e.has(ae,"x")&&(V.x=ae.x,V.y=ae.y)}),z.graph().width=D.graph().width,z.graph().height=D.graph().height}var _=["nodesep","edgesep","ranksep","marginx","marginy"],N={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},C=["acyclicer","ranker","rankdir","align"],j=["width","height"],M={width:0,height:0},P=["minlen","weight","width","height","labeloffset"],I={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},F=["labelpos"];function O(z){var D=new w({multigraph:!0,compound:!0}),J=ue(z.graph());return D.setGraph(e.merge({},N,Y(J,_),e.pick(J,C))),e.forEach(z.nodes(),function(V){var ae=ue(z.node(V));D.setNode(V,e.defaults(Y(ae,j),M)),D.setParent(V,z.parent(V))}),e.forEach(z.edges(),function(V){var ae=ue(z.edge(V));D.setEdge(V,e.merge({},I,Y(ae,P),e.pick(ae,F)))}),D}function A(z){var D=z.graph();D.ranksep/=2,e.forEach(z.edges(),function(J){var V=z.edge(J);V.minlen*=2,V.labelpos.toLowerCase()!=="c"&&(D.rankdir==="TB"||D.rankdir==="BT"?V.width+=V.labeloffset:V.height+=V.labeloffset)})}function L(z){e.forEach(z.edges(),function(D){var J=z.edge(D);if(J.width&&J.height){var V=z.node(D.v),ae=z.node(D.w),he={rank:(ae.rank-V.rank)/2+V.rank,e:D};v.addDummyNode(z,"edge-proxy",he,"_ep")}})}function H(z){var D=0;e.forEach(z.nodes(),function(J){var V=z.node(J);V.borderTop&&(V.minRank=z.node(V.borderTop).rank,V.maxRank=z.node(V.borderBottom).rank,D=e.max(D,V.maxRank))}),z.graph().maxRank=D}function X(z){e.forEach(z.nodes(),function(D){var J=z.node(D);J.dummy==="edge-proxy"&&(z.edge(J.e).labelRank=J.rank,z.removeNode(D))})}function R(z){var D=Number.POSITIVE_INFINITY,J=0,V=Number.POSITIVE_INFINITY,ae=0,he=z.graph(),ye=he.marginx||0,_e=he.marginy||0;function Ve(Be){var qe=Be.x,Se=Be.y,ce=Be.width,be=Be.height;D=Math.min(D,qe-ce/2),J=Math.max(J,qe+ce/2),V=Math.min(V,Se-be/2),ae=Math.max(ae,Se+be/2)}e.forEach(z.nodes(),function(Be){Ve(z.node(Be))}),e.forEach(z.edges(),function(Be){var qe=z.edge(Be);e.has(qe,"x")&&Ve(qe)}),D-=ye,V-=_e,e.forEach(z.nodes(),function(Be){var qe=z.node(Be);qe.x-=D,qe.y-=V}),e.forEach(z.edges(),function(Be){var qe=z.edge(Be);e.forEach(qe.points,function(Se){Se.x-=D,Se.y-=V}),e.has(qe,"x")&&(qe.x-=D),e.has(qe,"y")&&(qe.y-=V)}),he.width=J-D+ye,he.height=ae-V+_e}function K(z){e.forEach(z.edges(),function(D){var J=z.edge(D),V=z.node(D.v),ae=z.node(D.w),he,ye;J.points?(he=J.points[0],ye=J.points[J.points.length-1]):(J.points=[],he=ae,ye=V),J.points.unshift(v.intersectRect(V,he)),J.points.push(v.intersectRect(ae,ye))})}function G(z){e.forEach(z.edges(),function(D){var J=z.edge(D);if(e.has(J,"x"))switch((J.labelpos==="l"||J.labelpos==="r")&&(J.width-=J.labeloffset),J.labelpos){case"l":J.x-=J.width/2+J.labeloffset;break;case"r":J.x+=J.width/2+J.labeloffset;break}})}function ne(z){e.forEach(z.edges(),function(D){var J=z.edge(D);J.reversed&&J.points.reverse()})}function Q(z){e.forEach(z.nodes(),function(D){if(z.children(D).length){var J=z.node(D),V=z.node(J.borderTop),ae=z.node(J.borderBottom),he=z.node(e.last(J.borderLeft)),ye=z.node(e.last(J.borderRight));J.width=Math.abs(ye.x-he.x),J.height=Math.abs(ae.y-V.y),J.x=he.x+J.width/2,J.y=V.y+J.height/2}}),e.forEach(z.nodes(),function(D){z.node(D).dummy==="border"&&z.removeNode(D)})}function W(z){e.forEach(z.edges(),function(D){if(D.v===D.w){var J=z.node(D.v);J.selfEdges||(J.selfEdges=[]),J.selfEdges.push({e:D,label:z.edge(D)}),z.removeEdge(D)}})}function ee(z){var D=v.buildLayerMatrix(z);e.forEach(D,function(J){var V=0;e.forEach(J,function(ae,he){var ye=z.node(ae);ye.order=he+V,e.forEach(ye.selfEdges,function(_e){v.addDummyNode(z,"selfedge",{width:_e.label.width,height:_e.label.height,rank:ye.rank,order:he+ ++V,e:_e.e,label:_e.label},"_se")}),delete ye.selfEdges})})}function $(z){e.forEach(z.nodes(),function(D){var J=z.node(D);if(J.dummy==="selfedge"){var V=z.node(J.e.v),ae=V.x+V.width/2,he=V.y,ye=J.x-ae,_e=V.height/2;z.setEdge(J.e,J.label),z.removeNode(D),J.label.points=[{x:ae+2*ye/3,y:he-_e},{x:ae+5*ye/6,y:he-_e},{x:ae+ye,y:he},{x:ae+5*ye/6,y:he+_e},{x:ae+2*ye/3,y:he+_e}],J.label.x=J.x,J.label.y=J.y}})}function Y(z,D){return e.mapValues(e.pick(z,D),Number)}function ue(z){var D={};return e.forEach(z,function(J,V){D[V.toLowerCase()]=J}),D}return _v}var Sv,vC;function AB(){if(vC)return Sv;vC=1;var e=wt(),t=pn(),n=dr().Graph;Sv={debugOrdering:s};function s(i){var a=t.buildLayerMatrix(i),l=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(i.nodes(),function(u){l.setNode(u,{label:u}),l.setParent(u,"layer"+i.node(u).rank)}),e.forEach(i.edges(),function(u){l.setEdge(u.v,u.w,{},u.name)}),e.forEach(a,function(u,h){var p="layer"+h;l.setNode(p,{rank:"same"}),e.reduce(u,function(f,g){return l.setEdge(f,g,{style:"invis"}),g})}),l}return Sv}var Nv,wC;function MB(){return wC||(wC=1,Nv="0.8.5"),Nv}var Ev,xC;function IB(){return xC||(xC=1,Ev={graphlib:dr(),layout:RB(),debug:AB(),util:{time:pn().time,notime:pn().notime},version:MB()}),Ev}var OB=IB();const bC=fw(OB),Xi=240,Du=130,zi=74,md=72,kC=zi+md;function PB(e,t){var s;let n=Xi;for(const i of e)n=Math.max(n,((s=t.get(i.id))==null?void 0:s.width)??Xi);return n}const QR=420,$B=2;function _l(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function LB(e,t){return((t==null?void 0:t.get(e))??0)>0?QR:0}function qB(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function Sl(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??Xi)+LB(e,n),h:Math.max((s==null?void 0:s.height)??Du,qB(e,n))}}function DB(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function FB(e,t,n,s,i,a){const l=new bC.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(_=>!i.has(_)),h=new Set(u);for(const _ of u){const{w:N,h:C}=Sl(_,s,a);l.setNode(_,{width:N,height:C})}for(const _ of t)h.has(_.source)&&h.has(_.target)&&l.setEdge(_.source,_.target);bC.layout(l);const p=new Map;let f=1/0,g=1/0,v=-1/0,w=-1/0;for(const _ of u){const N=l.node(_);if(!N)continue;const C=s.get(_),j=(C==null?void 0:C.width)??Xi,M=(C==null?void 0:C.height)??Du,P=Sl(_,s,a),I=N.x-P.w/2,F=N.y-P.h/2;p.set(_,{x:I,y:F}),I<f&&(f=I),F<g&&(g=F),I+j>v&&(v=I+j),F+M>w&&(w=F+M)}if(Number.isFinite(f)&&Number.isFinite(g))for(const[_,N]of p)p.set(_,{x:N.x-f,y:N.y-g});const E=Number.isFinite(v)?v-f:0,b=Number.isFinite(w)?w-g:0;let S=null;for(const _ of e){const N=i.get(_);if(!N)continue;const C=s.get(_),j=(C==null?void 0:C.width)??Xi,M=(C==null?void 0:C.height)??Du;S=S===null?{minX:N.x,minY:N.y,maxX:N.x+j,maxY:N.y+M}:{minX:Math.min(S.minX,N.x),minY:Math.min(S.minY,N.y),maxX:Math.max(S.maxX,N.x+j),maxY:Math.max(S.maxY,N.y+M)}}return{positions:p,width:E,height:b,pinnedBox:S}}function zB(e,t,n={}){const s=n.direction??"LR",i=n.pinned??new Map,a=n.measured??new Map,l=n.lanes,u=new Map;for(const _ of e){const N=_l(_),C=u.get(N);C?C.push(_.id):u.set(N,[_.id])}const p=Array.from(u.keys()).sort().map(_=>({sid:_,...FB(u.get(_),t,s,a,i,l)})),f=PB(e,a),g=n.availableHeight&&n.availableHeight>0?n.availableHeight:Number.POSITIVE_INFINITY,v=_=>{const N=[[]];let C=0;for(const j of p)N.length<_&&C>0&&C+j.height>g&&(N.push([]),C=0),N[N.length-1].push(j),C+=j.height+kC;return N},w=_=>_.reduce((N,C)=>Math.max(N,C.width),0)+QR;let E=v(n.availableWidth?$B:1);E.length>1&&E.reduce((N,C)=>N+w(C),0)+f*(E.length-1)>(n.availableWidth??0)&&(E=v(1));const b=new Map;let S=0;for(const _ of E){const N=w(_);let C=0;for(const{positions:j,height:M,pinnedBox:P}of _){for(const[F,O]of j)b.set(F,{x:O.x+S,y:O.y+C});let I=C+M;P&&P.maxY>I&&P.minX<S+N&&S<P.maxX&&(I=P.maxY),C=I+kC}S+=N+f}return e.map(_=>{const N=i.get(_.id);if(N)return{..._,position:N};const C=b.get(_.id);return C?{..._,position:C}:_})}function BB(e,t,n,s,i){const l=zi+md,u=60,h=w=>Sl(w,s,i),p=new Map(e.map(w=>[w.id,_l(w)])),f=[],g=e.map(w=>({id:w.id,pos:n.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,E)=>w.pos.y-E.pos.y||w.pos.x-E.pos.x||w.id.localeCompare(E.id)),v=[];for(const{id:w,pos:E}of g){const{w:b,h:S}=h(w),_=p.get(w)??"_default";if(n.has(w)){f.push({x:E.x,y:E.y,w:b,h:S,sid:_});continue}let N=E.y;for(let C=0;C<f.length+1;C++){const j=f.find(M=>{const P=M.sid===_?24:u,I=M.sid===_?24:l;return E.x<M.x+M.w+P&&M.x<E.x+b+P&&N<M.y+M.h+I&&M.y<N+S+I});if(!j)break;N=j.y+j.h+(j.sid===_?24:l)}N!==E.y&&(t.set(w,{x:E.x,y:N}),v.push(w)),f.push({x:E.x,y:N,w:b,h:S,sid:_})}return v}function UB(e,t,n,s,i,a){const l=b=>Sl(b,s,a),u=b=>n.get(b)??t.get(b),h=new Map;for(const b of e){if(!u(b.id))continue;const S=_l(b),_=h.get(S);_?_.push(b):h.set(S,[b])}const p=new Set;for(const[b,S]of h)S.every(_=>i.has(_.id)&&!n.has(_.id))&&p.add(b);const f=new Map,g=[];for(const b of e){const S=u(b.id);if(!S)continue;const{w:_,h:N}=l(b.id),C=_l(b);p.has(C)?(f.get(C)??f.set(C,[]).get(C)).push(b):g.push({x:S.x,y:S.y,w:_,h:N})}if(f.size===0)return[];const v=zi+md,w=(b,S,_,N)=>g.some(C=>b<C.x+C.w+zi&&C.x<b+_+zi&&S<C.y+C.h+v&&C.y<S+N+v),E=[];for(const b of[...f.keys()].sort()){const S=f.get(b);let _=1/0,N=1/0,C=-1/0,j=-1/0;for(const L of S){const H=u(L.id),{w:X,h:R}=l(L.id);_=Math.min(_,H.x),N=Math.min(N,H.y),C=Math.max(C,H.x+X),j=Math.max(j,H.y+R)}const M=C-_,P=j-N,I=[...new Set(g.map(L=>Math.round(L.x)))].sort((L,H)=>L-H),F=I.length?I:[_],O=[0,...g.map(L=>L.y+L.h+v)].sort((L,H)=>L-H);let A=null;e:for(const L of F)for(const H of O){if(H>=N)break;if(!w(L,H,M,P)){A={x:L,y:H};break e}}if(A){const L=A.x-_,H=A.y-N;for(const X of S){const R=u(X.id);t.set(X.id,{x:R.x+L,y:R.y+H})}E.push(b)}for(const L of S){const H=u(L.id),{w:X,h:R}=l(L.id);g.push({x:H.x,y:H.y,w:X,h:R})}}return E}function WB(e,t,n,s,i,a=!1,l){const p=zi+md+1,f=8,g=1.75,v=200,w=.7,E=.01,b=A=>Sl(A,s,l),S=A=>n.get(A)??t.get(A),_=new Map;for(const A of e){if(!S(A.id))continue;const L=_l(A),H=_.get(L);H?H.push(A):_.set(L,[A])}const N=[],C=new Set,j=new Set,M=i.size===0;for(const A of[..._.keys()].sort()){const L=_.get(A);let H=1/0,X=1/0,R=-1/0,K=-1/0,G=!1;for(const ee of L){const $=S(ee.id),{w:Y,h:ue}=b(ee.id);H=Math.min(H,$.x),X=Math.min(X,$.y),R=Math.max(R,$.x+Y),K=Math.max(K,$.y+ue),n.has(ee.id)&&(G=!0)}const ne=R-H,Q=K-X;j.add(A);const W=i.get(A);W&&(ne>W.w+f||Q>W.h+f)&&C.add(A),i.set(A,{w:ne,h:Q}),N.push({sid:A,members:L.map(ee=>ee.id),x:H,y:X,w:ne,h:Q,anchored:G,mass:1})}for(const A of[...i.keys()])j.has(A)||i.delete(A);if(a||M)return[];let P=!1;for(let A=0;A<N.length&&!P;A++)for(let L=A+1;L<N.length;L++){const H=N[A],X=N[L];if(!(H.anchored&&X.anchored)&&Math.abs(H.x+H.w/2-(X.x+X.w/2))<(H.w+X.w)/2+61&&Math.abs(H.y+H.h/2-(X.y+X.h/2))<(H.h+X.h)/2+p){P=!0;break}}if(C.size===0&&!P)return[];if(C.size>0)for(const A of N)C.has(A.sid)&&(A.mass=8);else for(const A of N)A.mass=Math.max(1,A.w*A.h/(Xi*Du));const I=new Map(N.map(A=>[A.sid,A.x])),F=new Map(N.map(A=>[A.sid,A.y]));for(let A=0;A<v;A++){const L=new Map,H=new Map;let X=0;for(let R=0;R<N.length;R++)for(let K=R+1;K<N.length;K++){const G=N[R],ne=N[K];if(G.anchored&&ne.anchored)continue;const Q=G.x+G.w/2,W=G.y+G.h/2,ee=ne.x+ne.w/2,$=ne.y+ne.h/2,Y=(G.w+ne.w)/2+61-Math.abs(Q-ee),ue=(G.h+ne.h)/2+p-Math.abs(W-$);if(Y<=0||ue<=0)continue;const z=(me,Me)=>!me.anchored&&!(Me<0&&me.x<=0),D=(me,Me)=>!me.anchored&&!(Me<0&&me.y<=0),J=(me,Me,He)=>{const ct=me===Me,je=ct?G.sid<ne.sid?-1:1:Math.sign(me-Me);return He(G,je)||He(ne,-je)?je:ct&&(He(G,-je)||He(ne,je))?-je:0},V=J(Q,ee,z),ae=J(W,$,D),he=V!==0,ye=ae!==0;if(!he&&!ye)continue;const _e=he&&(!ye||Y*g<ue),[Ve,Be,qe,Se]=_e?[V,Y,L,z]:[ae,ue,H,D],ce=Se(G,Ve),be=Se(ne,-Ve),ke=G.mass,Ye=ne.mass,dt=ce?be?Ye/(ke+Ye):1:0,lt=be?ce?ke/(ke+Ye):1:0,pe=Be*w;qe.set(G.sid,(qe.get(G.sid)??0)+Ve*pe*dt),qe.set(ne.sid,(qe.get(ne.sid)??0)-Ve*pe*lt),X+=pe}for(const R of N)R.anchored||(R.x=Math.max(0,R.x+(L.get(R.sid)??0)),R.y=Math.max(0,R.y+(H.get(R.sid)??0)));if(X<E)break}const O=[];for(const A of N){const L=A.x-I.get(A.sid),H=A.y-F.get(A.sid);if(!(Math.abs(L)<1&&Math.abs(H)<1)){for(const X of A.members){if(n.has(X))continue;const R=t.get(X);R&&t.set(X,{x:R.x+L,y:R.y+H})}O.push(A.sid)}}return O}const HB=600;function lw(e,t){return!(e.exitAt!=null&&t-e.exitAt>HB||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function GB(e,t){const n=new Set;for(const s of e.agents.values())lw(s,t)&&n.add(s.id);return n}function VB(e,t,n=0){return e.right+n>t.left&&e.left-n<t.right&&e.bottom+n>t.top&&e.top-n<t.bottom}function YB(e,t,n=0){if(!e)return!1;for(const s of t)if(VB(e,s,n))return!0;return!1}const ZR="sessionGroup";function KB(e,t){var s;if(e.type===ZR)return"transparent";const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const JR=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function _C(e){const t={};for(const n of JR)t[n]=e(n);return t}function XB(e){return t=>e[t]??""}function QB(e,t){return JR.every(n=>e[n]===t[n])}function ZB(e){const t=new Set(e.pins),n=new Map,s=new Map;for(const[i,a]of e.positions)n.set(i,a),t.has(i)&&s.set(i,a);return{positions:n,pinned:s}}const JB=1200,e8=1e3;function SC(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<JB?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<e8}function Cv({durationMs:e,documentHidden:t}){return t?!1:Number.isFinite(e)&&e>0}function t8(e,t,n){const s=e.x*t.zoom+t.x,i=e.y*t.zoom+t.y,a=(e.x+e.width)*t.zoom+t.x,l=(e.y+e.height)*t.zoom+t.y;return a>0&&s<n.width&&l>0&&i<n.height}function n8({pane:e,viewport:t,boxes:n}){if(!e||!(e.width>0)||!(e.height>0)||!Number.isFinite(t.zoom)||t.zoom<=0||!Number.isFinite(t.x)||!Number.isFinite(t.y))return!1;let s=!1;for(const i of n)if(s=!0,t8(i,t,e))return!1;return s}const r8="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",jv="click for what's new";function s8(e){if(e.checkDisabled)return`${r8} · ${jv}`;if(e.checking)return`Asking npm for the newest release… · ${jv}`;const t=e.latest?`npm has v${e.latest}`:e.latestPending?`npm's latest tag names v${e.latestPending}, which it cannot serve yet`:"npm not reached yet",n=e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${t}${n} · re-checked periodically · ${jv}, and to check npm now`}function o8(e){const t=`Version v${e.running}, show what's new`;return e.checkDisabled?`${t} — update checks are off`:e.checking?`${t} — checking npm for a newer release`:`${t} and check npm for a newer release`}function i8(e){const t=e.kind==="restart"?`v${e.to} is installed and waiting for a restart`:`v${e.to} is available on npm`,n=e.open?"show what's new":"show what's new and the notice";return`Version v${e.from}, ${t} — ${n}`}function a8(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 cw={kind:"assumed",claude:!0,codex:!0};function l8(e){if(!e||typeof e!="object")return cw;const t=e.providers;if(!t||typeof t!="object")return cw;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function Fu(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const NC=99;function c8(e){const t=Math.max(0,Math.floor(e));return t>NC?`${NC}+`:String(t)}const u8="Pause the canvas";function d8(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 — ${Fu(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)":`${Fu(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function f8(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 eA="paused · full",h8=(e,t)=>t>0?eA:e>0?`paused · ${c8(e)}`:"paused";function p8(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:h8(e.held,t),widest:eA,title:t>0?`Connected — the pause is full at ${Fu(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${Fu(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",resting:!0,label:"live",widest:"live",title:"Receiving events"}:{tone:"dead",resting:!1,label:"offline",widest:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}function EC(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const m8={agent:w3,sessionGroup:$3},tA="react-flow__node";function CC(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,tA))===!0}function g8(e){try{const t=document.querySelector(`.${tA}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const y8=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),v8=420,gu=18,w8=200,x8=5*6e4,b8=6,k8=2*6e4,jC=400,l0="agent-dag.layout",c0="agent-dag.viewport",nA="agent-dag.summariesDismissed",rA="agent-dag.sessionListOpen",sA="agent-dag.detailOpen",oA="agent-dag.usagePanelOpen",TC="agent-dag.accountsPanelOpen",Tv="agent-dag.versionNoticeDismissed",RC="agent-dag.oldNameNoticeDismissed",_8=15*6e4,Rv={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:"},AC="agent-dag.autoRestart",MC="agent-dag.bundleReloadedFor";function S8(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(rA)==="1"}catch{return!1}}function N8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(rA,e?"1":"0")}catch{}}function E8(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(sA)==="1"}catch{return!1}}function C8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(sA,e?"1":"0")}catch{}}function j8(){const e=Zi(oA);return e===null?!0:e==="1"}function T8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(oA,e?"1":"0")}catch{}}function R8(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(nA);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t.filter(n=>typeof n=="string"):[])}catch{return new Set}}function IC(e){if(!(typeof window>"u"))try{const t=Array.from(e),n=t.length>200?t.slice(-200):t;window.localStorage.setItem(nA,JSON.stringify(n))}catch{}}function A8(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(l0);if(!t)return e;const n=JSON.parse(t);if(!("v"in n)){const i=Object.entries(n).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number");return{positions:i,pins:i.map(([a])=>a)}}return{positions:Object.entries(n.positions??{}).filter(([,i])=>i&&typeof i.x=="number"&&typeof i.y=="number"),pins:Array.isArray(n.pins)?n.pins:[]}}catch{return e}}function Av(e,t){if(!(typeof window>"u"))try{const n={};for(const[s,i]of e)n[s]=i;for(const[s,i]of t)n[s]=i;window.localStorage.setItem(l0,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function M8(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(c0);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 I8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(c0,JSON.stringify(e))}catch{}}function OC(){if(!(typeof window>"u")){try{window.localStorage.removeItem(l0)}catch{}try{window.localStorage.removeItem(c0)}catch{}}}function O8(e,t){const n=e.agents.get(t);if(!n)return;const s=[];for(const f of e.agents.values())f.sessionId===t&&s.push(f);const i={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,label:n.label,cwd:n.cwd,startedAt:n.startedAt,endedAt:n.endedAt,model:n.model,agents:s.map(f=>({id:f.id,kind:f.kind,label:f.label,parentId:f.parentId,state:f.state,startedAt:f.startedAt,endedAt:f.endedAt,model:f.model,cwd:f.cwd,usage:f.usage,prompts:f.prompts,tools:f.tools.map(g=>({id:g.id,name:g.name,inputPreview:g.inputPreview,startedAt:g.startedAt,endedAt:g.endedAt,ok:g.ok,errorPreview:g.errorPreview,usage:g.usage}))}))},a=JSON.stringify(i,null,2),l=new Blob([a],{type:"application/json"}),u=URL.createObjectURL(l),h=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");h.href=u,h.download=`${zt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(u),1e3)}const uw={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},dw={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},iA=bT;function P8(e,t,n,s,i,a,l,u,h,p,f,g,v,w,E,b,S,_){const N=[],C=[];for(const A of e.agents.values()){if(!S.has(A.id))continue;const L=A.exitAt!=null,H=b!=null&&!b.has(A.id),X=[L?"rf-exiting":"",H?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,R=a.get(A.id);if(N.push({id:A.id,type:"agent",position:{x:0,y:0},data:{...A,now:t,onOpenContext:_},className:X,...R?{width:R.width,height:R.height}:null}),A.parentId&&S.has(A.parentId)){const K=Mw(A.sessionId),G=L,ne=E.size>0&&(E.has(A.id)||E.has(A.parentId)),Q=b!=null&&!b.has(A.id)&&!b.has(A.parentId),W=A.state==="active"?2:1.5,ee=ne?W+1.5:W,$=G?.2:Q?.12:1,Y=["sess-edge",A.state==="active"?"sess-live":"sess-idle",G?"rf-edge-exiting":"",ne?"rf-edge-selected":""].filter(Boolean).join(" ");C.push({id:`e:${A.parentId}->${A.id}`,source:A.parentId,target:A.id,animated:(A.state==="active"||ne)&&!G,type:"smoothstep",style:{"--session-hue":K,strokeWidth:ee,opacity:$,transition:"var(--edge-transition)"},className:Y})}}const j=new Map;for(const A of e.agents.values())A.tools.length>0&&j.set(A.id,Math.min(4,A.tools.length));const M=`${v}#lanes:${DB(j)}`,P=N.filter(A=>I5(A.id,i,f,g));if(P.length>0||M!==w.current){if(P.length>0){const A=zB(N,C,{direction:"LR",pinned:i,measured:a,availableWidth:n,availableHeight:s,lanes:j});for(const L of A)YT(L.id,f,g)&&P5(L.id,L.position,f,g);UB(N,f,i,a,new Set(P.map(L=>L.id)),j)}BB(N,f,i,a,j),w.current=M}const I=WB(N,f,i,a,l,!h||p,j);I.length>0&&u(I),uu(f,e.agents),uu(g,e.agents),uu(i,e.agents),uu(a,R5(e.agents.values()));const F=[];let O=!1;for(const A of N){let L=i.get(A.id)??f.get(A.id);L||(L=O5(A.id,f,g),O=!0),F.push({...A,position:L})}return O&&(w.current=""),{nodes:F,edges:C}}function $8(){return d.jsx(Rw,{children:d.jsx(L8,{})})}function L8(){var Sa,Na,Ea,Ca;const e=Tl(),t=Mt(),n=k.useState(Yv)[0],s=k.useRef(n),[,i]=k.useState(0),a=k.useCallback(()=>i(q=>q+1),[]),[l,u]=k.useState(()=>new Set),[h,p]=k.useState(null),[f,g]=k.useState(null),v=k.useCallback((q,U)=>{u(ie=>{if(!U)return new Set([q]);const fe=new Set(ie);return fe.has(q)?fe.delete(q):fe.add(q),fe}),p(ie=>U&&ie===q?ie:q)},[]),w=k.useCallback(()=>{u(new Set),p(null)},[]),[E,b]=k.useState(null),[S,_]=k.useState(null),N=k.useCallback(q=>_(q),[]),[C,j]=k.useState(!1),[M,P]=k.useState(!1),I=k.useState(R8)[0],[F,O]=k.useState(S8);k.useEffect(()=>{N8(F)},[F]);const[A,L]=k.useState(E8);k.useEffect(()=>{C8(A)},[A]);const[H,X]=k.useState(j8);k.useEffect(()=>{T8(H)},[H]);const[R,K]=k.useState(()=>{try{const q=window.localStorage.getItem(TC);return q===null?!0:q==="1"}catch{return!0}});k.useEffect(()=>{try{window.localStorage.setItem(TC,R?"1":"0")}catch{}},[R]);const[G,ne]=k.useState(null);k.useEffect(()=>{let q=null;try{q=localStorage.getItem("agent-dag.sound")}catch{}ne(q===null?!0:q==="on")},[]);const Q=k.useCallback(()=>{ne(q=>{var ie;const U=q!==!0;try{localStorage.setItem("agent-dag.sound",U?"on":"off")}catch{}return U&&((ie=_e.current)==null||ie.unlock()),U})},[]),W=k.useCallback(q=>{Q()},[Q]),ee=k.useRef(W);ee.current=W;const $=k.useRef(G);$.current=G;const[Y,ue]=k.useState(()=>e5(Zi)),z=k.useRef(Y);z.current=Y;const D=k.useRef(null),J=k.useCallback((q,U=!1)=>{var ie,fe;if((ie=_e.current)==null||ie.unlock(),D.current!==null&&clearTimeout(D.current),D.current=null,!U){(fe=_e.current)==null||fe.play(q,!0);return}D.current=setTimeout(()=>{var Ee;D.current=null,(Ee=_e.current)==null||Ee.play(q,!0)},KD)},[]),V=k.useCallback((q,U)=>{ue(ie=>{const fe={level:kl(U.level??ie[q].level),figure:WT(q,U.figure??ie[q].figure)};try{localStorage.setItem(HT[q],String(fe.level)),localStorage.setItem(GT[q],fe.figure)}catch{}return{...ie,[q]:fe}}),J(q,!0)},[J]);k.useEffect(()=>()=>{D.current!==null&&clearTimeout(D.current)},[]);const[ae,he]=k.useState(!1),ye=k.useRef(null),_e=k.useRef(null),[Ve,Be]=k.useState("locked");k.useEffect(()=>{const q=r5({enabled:()=>$.current===!0,prefs:()=>z.current,onState:Be});_e.current=q,Be(q.state());const U=()=>q.unlock();return window.addEventListener("pointerdown",U,{once:!0,capture:!0}),window.addEventListener("keydown",U,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",U,{capture:!0}),window.removeEventListener("keydown",U,{capture:!0})}},[]);const[qe,Se]=k.useState(!1),[ce,be]=k.useState(null),[ke,Ye]=k.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(Tv)??""}catch{return""}}),[dt,lt]=k.useState(!1),pe=k.useRef(0),[me,Me]=k.useState(!1),He=k.useCallback((q=!1)=>(q&&(pe.current=Date.now(),Me(!0)),fetch(q?"/api/version?refresh=1":"/api/version").then(U=>U.ok?U.json():null).then(U=>{U&&be(U)}).catch(()=>{}).finally(()=>{q&&Me(!1)})),[]),ct=k.useCallback(()=>{He(Date.now()-pe.current>=_8)},[He]);k.useEffect(()=>{He();const q=window.setInterval(ct,5*6e4),U=()=>{document.visibilityState==="visible"&&ct()};return document.addEventListener("visibilitychange",U),()=>{window.clearInterval(q),document.removeEventListener("visibilitychange",U)}},[He,ct]),k.useEffect(()=>{qe&&He()},[qe,He]);const je=(ce==null?void 0:ce.notice)??null,[Ge,Ke]=k.useState(null),se=k.useRef(!1);k.useEffect(()=>{if(se.current)return;const q=y5(),U=v5(q),ie=b5({stored:U,running:(ce==null?void 0:ce.running)??null,notes:Y1,remembers:w5(q)});ie.reason!=="no-version"&&(se.current=!0,ie.record&&x5(q,ie.record),ie.show.length&&Ke({entries:ie.show,since:U,firstRun:ie.reason==="welcome"}))},[ce==null?void 0:ce.running]);const Pe=(ce==null?void 0:ce.running)??"3.11.0",$e=k.useMemo(()=>VT(Y1,null,Pe),[Pe]),Te=k.useCallback(()=>{Ke({entries:$e,since:null,firstRun:!1})},[$e]),[Xe,jt]=k.useState(null),[ot,Ie]=k.useState(cw);k.useEffect(()=>{let q=!1;return fetch("/api/health").then(U=>U.ok?U.json():null).then(U=>{q||(Ie(l8(U)),!(!U||typeof U.workspace!="string")&&jt(U.workspace))}).catch(()=>{}),()=>{q=!0}},[qe]);const xt=k.useRef(ot);xt.current=ot;const ft=je?`${je.kind}:${je.to}`:"",gt=je!=null&&ke!==ft,Nn=k.useCallback(()=>{Ye("");try{window.localStorage.setItem(Tv,"")}catch{}},[]),Bn=k.useCallback(()=>{if(je){Ye(ft);try{window.localStorage.setItem(Tv,ft)}catch{}}},[je,ft]),[En,Ro]=k.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(RC)??""}catch{return""}}),mn=ce!=null&&ce.invokedAs&&ce.invokedAs!==zt?ce.invokedAs:null,Ao=mn!=null&&En!==mn,Mo=k.useCallback(()=>{if(mn){Ro(mn);try{window.localStorage.setItem(RC,mn)}catch{}}},[mn]),Bt=((Sa=ce==null?void 0:ce.upgrade)==null?void 0:Sa.state)??"idle",Rr=AD(ce==null?void 0:ce.upgrade),Un=k.useRef(!1),Ls=k.useCallback(async()=>{if(cr(Un.current||Bt==="running")){Un.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await He(),Un.current=!1}},[Bt,He]);k.useEffect(()=>{if(Bt!=="running")return;const q=window.setInterval(He,3e3);return()=>window.clearInterval(q)},[Bt,He]);const Ar=k.useCallback(async()=>{const q=ce==null?void 0:ce.command;!q||!await UT(q)||(lt(!0),window.setTimeout(()=>lt(!1),1600))},[ce==null?void 0:ce.command]),Io=k.useCallback(()=>{O(q=>(q||K(!1),!q))},[]),pr=k.useCallback(()=>{K(q=>(q||O(!1),!q))},[]),[Mr,mr]=k.useState(!1),[rs,Oo]=k.useState(!1),[Po,$o]=k.useState(()=>{try{return Number(localStorage.getItem(Z1))||0}catch{return 0}}),[Cn,Lo]=k.useState([]),[Ir,qo]=k.useState(!1);k.useEffect(()=>{let q=!0;const U=()=>{fetch("/api/browser-watch?live=0").then(fe=>fe.ok?fe.json():null).then(fe=>{var Ee;!q||!(fe!=null&&fe.ok)||(Lo(fe.episodes??[]),qo(((Ee=fe.settings)==null?void 0:Ee.enabled)===!0))}).catch(()=>{})};U();const ie=setInterval(U,5*6e4);return()=>{q=!1,clearInterval(ie)}},[]);const Wn=k.useMemo(()=>cF(Cn,Po).length,[Cn,Po]),[Do,qs]=k.useState(0),Ds=k.useRef(null),[Fo,zo]=k.useState(!1),it=k.useRef(null),[sa,ss]=k.useState(0),Gt=k.useState(()=>F5({protect:q=>SL(s.current,q)}))[0],[Hn,Bo]=k.useState(!1),os=k.useCallback(()=>{const q=Gt.paused&&Gt.dropped>0,U=Gt.setPaused(!Gt.paused);q&&NL(s.current);for(const ie of U)s.current=n1(s.current,ie);Bo(Gt.paused)},[Gt]),[bt,sn]=k.useState(Date.now()),[Gn,gn]=k.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(AC)!=="0"}catch{return!0}}),gd=k.useCallback(()=>{gn(q=>{const U=!q;try{window.localStorage.setItem(AC,U?"1":"0")}catch{}return U})},[]),[Or,Uo]=k.useState(!1),[Wo,Ho]=k.useState("restart"),[is,Fs]=k.useState(null),as=k.useRef(!1),zl=k.useRef(null),Go=k.useRef(0),zs=k.useCallback(async q=>{if(!cr(as.current))return;const U=(q==null?void 0:q.upgrade)===!0;as.current=!0,zl.current=Rr;const ie=++Go.current;Ho(U?"npx":"restart"),Uo(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(je==null?void 0:je.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:U})})}catch{}window.setTimeout(()=>{if(Go.current===ie&&as.current){as.current=!1,Uo(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},U?18e4:3e4)},[je==null?void 0:je.to,Rr]),Vo=k.useRef(null);k.useEffect(()=>{let q=!1;for(const ie of s.current.agents.values())if(ie.state==="active"){q=!0;break}const U=ID({enabled:Gn,kind:je==null?void 0:je.kind,canRestart:(ce==null?void 0:ce.canRestart)===!0,noticeOpen:gt,busy:q,idleSince:Vo.current,now:bt});Vo.current=U.idleSince,U.restart&&zs()},[Gn,je==null?void 0:je.kind,ce==null?void 0:ce.canRestart,gt,bt,zs]),k.useEffect(()=>{const q=ce==null?void 0:ce.running;let U=null,ie=null;try{U=window.sessionStorage.getItem("agent-dag.restartPending"),ie=window.sessionStorage.getItem(MC)}catch{return}const fe=RD({bundle:"3.11.0",running:q,pending:U,lastTried:ie});if(fe==="reload"){try{window.sessionStorage.setItem(MC,q??"")}catch{return}window.location.reload();return}if(fe!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}as.current=!1,Uo(!1),Fs(q??null);const Ee=window.setTimeout(()=>Fs(null),6e3);return()=>window.clearTimeout(Ee)},[ce==null?void 0:ce.running]),k.useEffect(()=>{if(Or&&MD({asked:zl.current,reported:Rr})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}as.current=!1,Uo(!1)}},[Or,Rr]);const ls=k.useState(()=>ZB(A8()))[0],Zt=k.useRef(ls.pinned),cs=k.useRef(null),Je=k.useState(()=>M8())[0],[Yo,Bl]=k.useState(()=>new Set),[Pr,oa]=k.useState(B5),[Vn,Ul]=k.useState(()=>_C(EC)),Ko=k.useMemo(()=>XB(Vn),[Vn]),Xo=k.useCallback(q=>KB(q,Ko),[Ko]),gr=k.useMemo(()=>({background:Vn["--panel"],border:`1px solid ${Vn["--line"]}`,borderRadius:8}),[Vn]),[Yn,yr]=k.useState(!1);k.useEffect(()=>{document.documentElement.dataset.theme=Pr;try{window.localStorage.setItem(KT,Pr)}catch{}Ul(q=>{const U=_C(EC);return QB(q,U)?q:U})},[Pr]);const yn=k.useCallback((q,U)=>{if(Cv({durationMs:U,documentHidden:document.hidden})){e.setViewport(q,{duration:U});return}const{d3Zoom:ie,d3Selection:fe}=t.getState(),Ee=fe==null?void 0:fe.property("__zoom");if(ie&&fe&&Ee&&Ee.k>0&&q.zoom>0){ie.transform(fe,Ee.scale(q.zoom/Ee.k).translate((q.x-Ee.x)/q.zoom,(q.y-Ee.y)/q.zoom));return}e.setViewport(q,{duration:0})},[e,t]),Kn=k.useRef(null);k.useEffect(()=>{if(!Je)return;const q=window.setTimeout(()=>{try{yn(Je,0)}catch{}jn.current=Date.now()},60);return()=>window.clearTimeout(q)},[yn,Je]);const Xn=k.useRef(!0);k.useEffect(()=>{const q=new EventSource("/events"),U=q5(a,{now:()=>Date.now(),setTimeout:(ie,fe)=>window.setTimeout(ie,fe),clearTimeout:ie=>window.clearTimeout(ie)});return q.addEventListener("open",()=>{Se(!0),yr(!0)}),q.addEventListener("error",()=>Se(!1)),q.addEventListener("replay-end",()=>{Xn.current=!1,U.flush()}),q.addEventListener("hook",ie=>{var fe;try{const Ee=JSON.parse(ie.data);if(!Gt.accept(Ee))return;s.current=n1(s.current,Ee);const Re=Ee.replay===!0||Xn.current||Date.now()-Ee.receivedAt>3e4;Re?U.replay():U.live();const Ue=n5(Ee,Re);Ue&&((fe=_e.current)==null||fe.play(Ue))}catch{}}),()=>{q.close(),U.cancel()}},[a]),k.useEffect(()=>{const q=setInterval(()=>{const U=Date.now();sn(U);let ie=EL(s.current,U,t1);CL(s.current,U,t1)&&(ie=!0),kL(s.current,U,w8,x8)&&(ie=!0),_L(s.current,U,b8,k8)&&(ie=!0),u(fe=>T5(fe,s.current.agents)),p(fe=>fe!=null&&!s.current.agents.has(fe)?null:fe),_(fe=>fe!=null&&!s.current.agents.has(fe)?null:fe),b(fe=>fe!=null&&!s.current.agents.has(fe)?null:fe),ie&&a()},250);return()=>clearInterval(q)},[a]);const ia=k.useRef(null),jn=k.useRef(0),Bs=420,Tn=k.useCallback((q=500)=>{try{const Re=document.querySelector(".canvas-wrap"),Ue=Array.from(document.querySelectorAll(".react-flow__node")).filter(Nt=>Nt.offsetWidth>0);if(!Re||Ue.length===0)return;const nt=Re.getBoundingClientRect(),ut=e.getViewport();if(!Number.isFinite(ut.zoom)||ut.zoom<=0)return;const et=Nt=>(Nt-nt.left-ut.x)/ut.zoom,Vt=Nt=>(Nt-nt.top-ut.y)/ut.zoom,to=Ue.map(Nt=>Nt.getBoundingClientRect()),no=Math.min(...to.map(Nt=>et(Nt.left))),oc=Math.max(...to.map(Nt=>et(Nt.right))),ja=Math.min(...to.map(Nt=>Vt(Nt.top))),ic=Math.max(...to.map(Nt=>Vt(Nt.bottom))),Ta=oc-no,ii=ic-ja;if(!(Ta>0&&ii>0))return;const ms=Math.max(.2,Math.min(1,(nt.width-160)/(Ta+Bs)*.86,(nt.height-160)/ii*.86)),on={x:80-no*ms,y:Math.max(80,(nt.height-ii*ms)/2)-ja*ms,zoom:ms};yn(on,q),jn.current=Date.now(),Kn.current=Cv({durationMs:q,documentHidden:document.hidden})?{target:on,until:Date.now()+q+60}:null,window.setTimeout(()=>{var Nt;try{((Nt=Kn.current)==null?void 0:Nt.target)===on&&(Kn.current=null);const ai=e.getViewport();(Math.abs(ai.zoom-ms)>.01||Math.abs(ai.x-on.x)>2)&&yn(on,0)}catch{}},q+60)}catch{}},[e,yn]);k.useEffect(()=>{const q=()=>{if(!document.hidden)return;const U=Kn.current;if(Kn.current=null,!(!U||Date.now()>U.until)){try{yn(U.target,0)}catch{}jn.current=Date.now()}};return document.addEventListener("visibilitychange",q),()=>document.removeEventListener("visibilitychange",q)},[yn]);const Qo=k.useRef(""),us=k.useRef(null),aa=k.useRef(0),Zo=k.useCallback(()=>{aa.current=Date.now()},[]),$r=k.useRef(null),ds=k.useRef(0),vr=k.useCallback(()=>{ds.current=Date.now()},[]),Us=k.useCallback(q=>({hasSourceEvent:!!q,at:Date.now(),lastDeckFitAt:jn.current,lastCanvasInputAt:ds.current}),[]),la="agent-dag.autoFitDisabled",Wl=k.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(la)==="1"}catch{return!1}})[0],wr=k.useRef(Wl),[Ws,Jo]=k.useState(Wl),ei=k.useCallback(()=>{if(!wr.current){wr.current=!0,Jo(!0);try{window.localStorage.setItem(la,"1")}catch{}}},[]),xr=k.useCallback(()=>{wr.current=!1,Jo(!1);try{window.localStorage.removeItem(la)}catch{}Tn(400)},[e,Tn]);k.useEffect(()=>{const q=setInterval(()=>{if(wr.current||Date.now()-aa.current<800)return;const U=s.current,ie=Date.now(),fe=[];for(const Re of U.agents.values())lw(Re,ie)&&fe.push({id:Re.id});if(fe.length===0)return;const Ee=[];for(const{id:Re}of fe){const Ue=Qn.current.get(Re),nt=Zt.current.get(Re)??Ot.current.get(Re);!Ue||!nt||Ee.push({x:nt.x,y:nt.y,width:Ue.width,height:Ue.height})}n8({pane:$r.current,viewport:e.getViewport(),boxes:Ee})&&Tn(600)},1500);return()=>clearInterval(q)},[e]);const Hs=k.useRef(!1),Qn=k.useRef(new Map),ca=k.useRef(0),ti=k.useCallback(q=>{const U=Qn.current;let ie=!1;for(const fe of q.nodeInternals.values()){const Ee=fe.width,Re=fe.height;if(Ee==null||Re==null)continue;const Ue=U.get(fe.id);Ue?(Math.abs(Ue.height-Re)>4||Math.abs(Ue.width-Ee)>4)&&(U.set(fe.id,{width:Ee,height:Re}),ie=!0):(U.set(fe.id,{width:Ee,height:Re}),ie=!0)}return ie&&(ca.current+=1),ca.current},[]),Gs=at(ti),[ua,Jt]=k.useState(0);k.useEffect(()=>{let q=0;const U=()=>{const fe=Qn.current;let Ee=!1;for(const Re of document.querySelectorAll(".react-flow__node[data-id]")){const Ue=Re.getAttribute("data-id");if(!Ue)continue;const nt=Re.offsetWidth,ut=Re.offsetHeight;if(!nt||!ut)continue;const et=fe.get(Ue);(!et||Math.abs(et.width-nt)>4||Math.abs(et.height-ut)>4)&&(fe.set(Ue,{width:nt,height:ut}),Ee=!0)}Ee&&Jt(Re=>Re+1)};if(Hs.current)return;let ie=0;return document.visibilityState==="hidden"?ie=window.setTimeout(U,32):q=requestAnimationFrame(U),()=>{cancelAnimationFrame(q),window.clearTimeout(ie)}});const Ot=k.useRef(ls.positions),da=k.useRef(new Set),Lr=k.useRef(""),fs=k.useMemo(()=>{const q=[];for(const U of s.current.agents.values())lw(U,bt)&&q.push(U.id+(U.parentId?`>${U.parentId}`:""));return q.sort(),`${q.join("|")}#sv${Gs}.${ua}`},[s.current,s.current.revision,bt,Gs,ua]),qr=k.useRef(null);k.useEffect(()=>(qr.current!=null&&window.clearTimeout(qr.current),qr.current=window.setTimeout(()=>{Av(Ot.current,Zt.current)},1500),()=>{qr.current!=null&&window.clearTimeout(qr.current)}),[fs]),k.useEffect(()=>{if(Qo.current===fs)return;const q=Qo.current;if(Qo.current=fs,!q||wr.current)return;Date.now()-jn.current>1200&&Tn(400),ia.current&&window.clearTimeout(ia.current),ia.current=window.setTimeout(()=>{wr.current||Tn(500)},280)},[fs,e,Tn]);const Vs=k.useMemo(()=>M5(s.current,l),[s.current,s.current.revision,l]),Dr=k.useMemo(()=>GB(s.current,bt),[s.current,s.current.revision,bt]),Ys=k.useRef(null),[Ks,Hl]=k.useState({w:0,h:0});k.useEffect(()=>{const q=Ys.current;if(!q||typeof ResizeObserver>"u")return;const U=new ResizeObserver(ie=>{var Ee;const fe=(Ee=ie[0])==null?void 0:Ee.contentRect;fe&&($r.current={width:fe.width,height:fe.height},Hl(Re=>Math.abs(Re.w-fe.width)>40||Math.abs(Re.h-fe.height)>40?{w:fe.width,h:fe.height}:Re))});return U.observe(q),$r.current={width:q.clientWidth,height:q.clientHeight},Hl({w:q.clientWidth,h:q.clientHeight}),()=>U.disconnect()},[]);const yd=k.useCallback(q=>{var ie,fe;const U=q.target;!(U!=null&&U.closest)||U.closest(y8)!==q.currentTarget||(q.preventDefault(),(fe=(ie=document.activeElement)==null?void 0:ie.blur)==null||fe.call(ie))},[]),vd=k.useRef(new Map),[ni,wd]=k.useState(!1);k.useEffect(()=>{const q=window.setTimeout(()=>wd(!0),2500);return()=>window.clearTimeout(q)},[]);const[xd,fa]=k.useState(!1),br=k.useRef(null),[ha,pa]=k.useState(!1),bd=k.useCallback(()=>{br.current&&(window.clearTimeout(br.current),br.current=null),fa(!1)},[]),kd=k.useCallback(q=>{q.length!==0&&queueMicrotask(()=>{fa(!0),br.current&&window.clearTimeout(br.current),br.current=window.setTimeout(()=>fa(!1),v8+80)})},[]);k.useEffect(()=>()=>{br.current&&window.clearTimeout(br.current)},[]);const Gl=Ks.w>0?Ks.w*.92:0,Vl=Ks.h>0?Ks.h:0,{nodes:Rn,edges:_d}=k.useMemo(()=>P8(s.current,bt,Gl,Vl,Zt.current,Qn.current,vd.current,kd,ni,ha,Ot.current,da.current,fs,Lr,l,Vs,Dr,N),[s.current,s.current.revision,bt,Gl,Vl,ni,ha,fs,l,Vs,Dr,N,Do]),Yl=k.useMemo(()=>{const q=new Map;for(const ie of Rn){const fe=ie.data;if(!(fe!=null&&fe.sessionId)||fe.exitAt!=null)continue;const Ee=ie.width,Re=ie.height;if(Ee==null||Re==null)continue;const Ue=ie.position.x,nt=ie.position.y,ut=Ue+Ee,et=nt+Re,Vt=q.get(fe.sessionId);Vt?(Vt.minX=Math.min(Vt.minX,Ue),Vt.minY=Math.min(Vt.minY,nt),Vt.maxX=Math.max(Vt.maxX,ut),Vt.maxY=Math.max(Vt.maxY,et)):q.set(fe.sessionId,{minX:Ue,minY:nt,maxX:ut,maxY:et})}const U=[];for(const[ie,fe]of q){const Ee=fe.maxX-fe.minX+gu*2,Re=fe.maxY-fe.minY+gu*2;U.push({id:`group:${ie}`,type:ZR,position:{x:fe.minX-gu,y:fe.minY-gu},data:{sessionId:ie,w:Ee,h:Re},width:Ee,height:Re,style:{width:Ee,height:Re},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return U},[Rn,bt]),Sd=k.useMemo(()=>{const q=[...Yl,...Rn],U=it.current;return!U||U.size===0?q:q.map(ie=>{const fe=U.get(ie.id);return fe?{...ie,position:fe}:ie})},[Yl,Rn,sa]),Xs=k.useMemo(()=>{const q=new Set;for(const U of s.current.agents.values())for(const ie of U.tools)q.add(iA(ie.name));return Object.keys(uw).filter(U=>q.has(U))},[s.current,s.current.revision]);k.useEffect(()=>{if(Xs.length<=1){zo(!1);return}let q=0;const U=()=>{const ie=Ds.current;if(ie&&!document.hidden){const fe=ie.getBoundingClientRect(),Ee=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Ue=>Ue.getBoundingClientRect()),Re=YB(fe,Ee,8);zo(Ue=>Ue===Re?Ue:Re)}q=window.setTimeout(U,300)};return U(),()=>window.clearTimeout(q)},[Xs.length]);const Nd=k.useCallback(q=>{Bl(U=>{const ie=new Set(U);return ie.has(q)?ie.delete(q):ie.add(q),ie})},[]),en=h?s.current.agents.get(h):null,ma=f?Array.from(s.current.agents.values()).flatMap(q=>q.tools).find(q=>q.id===f)??null:null,Kl=k.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=Yv(),Zt.current.clear(),Qn.current.clear(),Ot.current.clear(),Lr.current="",OC(),w(),a()},[a,w]),Xl=k.useRef(C);Xl.current=C;const Ql=k.useRef(M);Ql.current=M;const ga=k.useRef(!1);ga.current=ma!=null||Mr||S!=null||E!=null||rs||M||Ge!=null;const hs=k.useCallback(q=>{const U=OD(q,{confirmOpen:Xl.current,modalOpen:ga.current});U==="confirm"?j(!0):U==="clear"&&(j(!1),Kl())},[Kl]),Fr=k.useCallback(()=>{Zt.current.clear(),Ot.current.clear(),Lr.current="",OC(),a(),window.setTimeout(()=>Tn(500),80)},[a,e,Tn]),Zl=k.useCallback(()=>Tn(500),[Tn]),Qs=k.useRef(Rn);Qs.current=Rn;const ya=k.useRef(h);ya.current=h;const ri=k.useCallback(q=>{const U=Qs.current,ie=S5(U.map(Re=>({id:Re.id,x:Re.position.x,y:Re.position.y})),ya.current,q),fe=ie?U.find(Re=>Re.id===ie):void 0;if(!fe)return;const Ee=CC(document.activeElement);v(fe.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[fe]})}catch{}jn.current=Date.now(),Ee&&g8(fe.id)},30)},[v,e]),si=k.useCallback(q=>{v(q,!1),window.setTimeout(()=>{try{const U=Qs.current.find(ie=>ie.id===q);U&&e.fitView({padding:.3,duration:500,nodes:[U]}),jn.current=Date.now()}catch{}},60)},[v,e]);k.useEffect(()=>{const q=U=>{var nt,ut;const ie=U.target,fe={tagName:ie==null?void 0:ie.tagName,isContentEditable:ie==null?void 0:ie.isContentEditable,role:(nt=ie==null?void 0:ie.getAttribute)==null?void 0:nt.call(ie,"role"),type:ie==null?void 0:ie.type};if(U.key==="Escape"){const et=n3({overlayOpen:Di.depth()>0,panelOnTop:Di.topIsPanel(),typing:$w(fe)});et==="dismiss"?Di.dismissTop():et==="blur"?ie==null||ie.blur():(j5(fe)&&(ie==null||ie.blur()),w());return}if(Pw(U))return;const Ee=CC(ie)?(ut=ie==null?void 0:ie.getAttribute)==null?void 0:ut.call(ie,"data-id"):null,Re=Ee&&Qs.current.some(et=>et.id===Ee)?Ee:null,Ue=E5(U,Re);if(Ue.kind==="activate"){U.preventDefault(),v(Ue.nodeId,Ue.additive);return}Ue.kind!=="node"&&(Ue.nodeId==null&&u3(fe)||d3({key:U.key,modalOpen:ga.current,sheetOpen:Ql.current})||(U.key===" "&&(U.preventDefault(),os()),(U.key==="c"||U.key==="C")&&hs("shortcut"),(U.key==="r"||U.key==="R")&&Fr(),(U.key==="f"||U.key==="F")&&Zl(),(U.key==="l"||U.key==="L")&&Io(),(U.key==="d"||U.key==="D")&&L(et=>!et),(U.key==="h"||U.key==="H")&&mr(et=>!et),(U.key==="u"||U.key==="U")&&X(et=>!et),(U.key==="a"||U.key==="A")&&xt.current.claude&&pr(),(U.key==="j"||U.key==="J")&&ri(1),(U.key==="k"||U.key==="K")&&ri(-1),(U.key==="t"||U.key==="T")&&oa(et=>et==="dark"?"light":"dark"),(U.key==="m"||U.key==="M")&&xt.current.claude&&$.current!==null&&ee.current(U.shiftKey),U.key==="?"&&P(et=>!et)))};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[hs,Fr,Zl,w,v,ri,os]);const va=s.current.agents.size,kt=k.useMemo(()=>VL(s.current.agents.values()),[s.current,s.current.revision]),Jl=k.useMemo(()=>YL(s.current.agents.values()),[s.current,s.current.revision]),ec=k.useRef(null);k.useEffect(()=>{const q=U5({waiting:kt.length,running:Jl,connected:qe}),U=ec.current;if(ec.current=q,(U==null?void 0:U.title)!==q.title&&(document.title=q.title),(U==null?void 0:U.icon)!==q.icon){const ie=document.querySelector('link[rel="icon"]');ie&&(ie.href=W5[q.icon])}},[kt.length,Jl,qe]);const[Ed,tc]=k.useState(""),wa=G5(kt);k.useEffect(()=>{tc(q=>V5(q,wa))},[wa]);const[Zn,Zs]=k.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[zr,ps]=k.useState(null),[Cd,nc]=k.useState(!1),[Jn,Js]=k.useState(!0),[rc,xa]=k.useState(!1);k.useEffect(()=>{let q=!0;return fetch("/api/prefs").then(U=>U.ok?U.json():null).then(U=>{var ie;!q||!(U!=null&&U.ok)||(Js(((ie=U.prefs)==null?void 0:ie.notifications)!==!1),xa(U.notificationsVetoed===!0))}).catch(()=>{}),()=>{q=!1}},[]);const ba=k.useRef(()=>{}),jd=k.useCallback(()=>{const q=!Jn;Js(q),q&&typeof Notification<"u"&&Notification.permission==="default"&&ba.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:q})}).then(U=>U.ok?U.json():null).then(U=>{var ie;U!=null&&U.ok&&(Js(((ie=U.prefs)==null?void 0:ie.notifications)!==!1),xa(U.notificationsVetoed===!0))}).catch(()=>{})},[Jn]),sc=typeof Notification<"u",ka=JL(Zn,sc);k.useEffect(()=>{ka&&Jn&&kt.length>0&&nc(!0)},[ka,Jn,kt.length]),k.useEffect(()=>{if(!zr)return;const U=setTimeout(()=>ps(null),zr==="blocked"?8e3:4e3);return()=>clearTimeout(U)},[zr]);const _a=k.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(q=>{const U=q;Zs(U),U==="granted"?ps("on"):U==="denied"&&ps("blocked")})},[]);ba.current=_a;const oi=k.useRef(new Set),tn=k.useRef(null),eo=kt.map(q=>Ku(q.id,q.waiting)).join("|");return k.useEffect(()=>{ZL(tn.current,Zn)&&(tn.current=Zn,oi.current=o1(kt))},[Zn]),k.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||tn.current===null)return;const q=typeof document>"u"||!document.hidden,U=XL(kt,oi.current,q,Jn);for(const ie of U)try{const fe=new Notification(ie.title,{body:ie.body,tag:ie.key});fe.onclick=()=>{window.focus(),si(ie.sessionId),fe.close()}}catch{}oi.current=q?o1(kt):QL(kt,U,oi.current)},[eo]),d.jsxs("div",{className:"app",children:[d.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),d.jsxs("header",{className:"topbar",children:[d.jsxs("div",{className:"readout",children:[d.jsxs("div",{className:"brand",children:[d.jsx("span",{className:"logo"}),d.jsx("h1",{children:zt}),je?d.jsxs("button",{type:"button",className:"v stale",onClick:()=>{Te(),Nn()},"aria-haspopup":"dialog","aria-label":i8({...je,open:gt}),title:je.kind==="restart"?`Running v${je.from}; v${je.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${je.from}; v${je.to} is on npm · click for what's new`,children:["v",je.from,d.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const q={running:Pe,latest:ce==null?void 0:ce.latest,latestPending:ce==null?void 0:ce.latestPending,checkedAgo:ce!=null&&ce.checkedAt?ew(bt-ce.checkedAt):null,checkDisabled:ce==null?void 0:ce.checkDisabled,checking:me};return d.jsxs("button",{type:"button",className:me?"v checking":"v",onClick:()=>{Te(),He(!0)},"aria-busy":me||void 0,"aria-haspopup":"dialog","aria-label":o8(q),title:s8(q),children:["v",q.running]})})()]}),d.jsxs("span",{className:"status",children:[(()=>{const q=p8({connected:qe,paused:Hn,held:Gt.size,dropped:Gt.dropped});return q.resting?null:d.jsx("span",{className:`pill ${q.tone}`,title:q.title,children:d.jsxs("span",{className:"pill-box",children:[d.jsx("span",{className:"pill-widest","aria-hidden":!0,children:q.widest}),d.jsx("span",{className:"pill-label",children:q.label})]})})})(),d.jsx(N4,{usageOpen:H})]}),d.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Ed}),kt.length>0&&d.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>si(kt[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
|
|
222
|
+
Click to set the volume and the sound of each tone, and to hear either one.`}function XT(e){const t=new Map;for(const n of e)for(const s of n.agents??[]){if(!s||typeof s.agent!="string"||s.agent==="")continue;const i=t.get(s.agent)??{id:s.agent,cost:0,tokens:0};i.cost+=Number.isFinite(s.totalCost)?s.totalCost:0,i.tokens+=Number.isFinite(s.totalTokens)?s.totalTokens:0,t.set(s.agent,i)}return[...t.values()].sort((n,s)=>s.cost-n.cost||n.id.localeCompare(s.id))}function sF(e){const t=XT([{agents:e}]);return t.length<2?null:t.map(n=>`${Uw(n.id)} ${tt(n.cost)}`).join(" · ")}function X1(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 oF(e,t){if(!(t>0)||!(e>0))return"0%";const n=e/t*100;return n<.1?"<0.1%":`${n.toFixed(1)}%`}function hu(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 iF=[7,14,30,90];function aF(e){const[t,n]=k.useState(null),[s,i]=k.useState(!1),a=k.useState(Q5)[0],l=k.useRef(!1),u=(h=!1)=>{if(h&&!cr(l.current))return;const p=a.begin();l.current=h;const f=e;i(!0);const v=`/api/ccusage?since=${Jv(f)}${h?"&refresh=1":""}`;fetch(v).then(w=>w.json()).then(w=>{p()&&n({range:f,resp:w})}).catch(()=>{p()&&n({range:f,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{p()&&(l.current=!1,i(!1))})};return k.useEffect(()=>(u(!1),()=>a.cancel()),[e]),{landed:t,loading:s,reload:()=>u(!0)}}function lF({onClose:e,providers:t}){var F;const[n,s]=k.useState(30),[i,a]=k.useState(null),{landed:l,loading:u,reload:h}=aF(n),p=k.useRef(null),f=Sn(e,{focusRef:p}),g=Z5({loading:u,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((F=l.resp.days)==null?void 0:F.length)??0}}),v=g.phase==="chart"?l.resp.days??[]:[],w=k.useMemo(()=>v.reduce((O,A)=>Math.max(O,A.totalCost),0),[v]),E=k.useRef(null);k.useLayoutEffect(()=>{const O=E.current;O&&(O.scrollLeft=O.scrollWidth)},[v]);const{totalCost:b,totalTok:S,inOut:_,cacheRead:N,modelCosts:C}=k.useMemo(()=>{let O=0,A=0,L=0,H=0;const X=new Map;for(const R of v){O+=R.totalCost,A+=R.totalTokens,L+=R.inputTokens+R.outputTokens,H+=R.cacheReadTokens;for(const K of R.modelBreakdowns)X.set(K.modelName,(X.get(K.modelName)??0)+K.cost)}return{totalCost:O,totalTok:A,inOut:L,cacheRead:H,modelCosts:X}},[v]),j=k.useMemo(()=>Array.from(C.entries()).sort((O,A)=>A[1]-O[1]),[C]),M=k.useMemo(()=>XT(v),[v]),P=M.length>1,I=i?v.find(O=>O.period===i)??null:null;return d.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:f,className:"uh-modal",onClick:O=>O.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[d.jsxs("header",{className:"uh-head",children:[d.jsxs("div",{className:"uh-titlewrap",children:[d.jsx("div",{className:"uh-title",children:"Usage history"}),d.jsx("div",{className:"uh-sub",children:tF(t,M.map(O=>O.id))})]}),d.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:iF.map(O=>d.jsxs("button",{type:"button","aria-pressed":n===O,className:"uh-range-btn",onClick:()=>{s(O),a(null)},children:[O,"d"]},O))}),d.jsx("button",{className:"glyph-btn uh-reload",onClick:h,...lr(u),title:"Re-run ccusage","aria-label":"Reload",children:u?"…":"↻"}),d.jsx("button",{ref:p,className:"glyph-btn uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),g.phase==="busy"?d.jsx("div",{className:"uh-status","aria-busy":"true",children:l?"running ccusage…":"running ccusage… (first run downloads the package)"}):g.phase==="error"?d.jsxs("div",{className:"uh-status uh-err",title:Gi(l.resp)||void 0,children:[Jq(l.resp,"ccusage did not report usage"),d.jsx("div",{children:d.jsx("button",{className:"btn uh-retry",onClick:h,...lr(u),children:u?"trying…":"Try again"})})]}):g.phase==="empty"?d.jsx("div",{className:`uh-status${g.stale?" uh-stale":""}`,"aria-busy":g.stale||void 0,children:"no usage in this range"}):d.jsxs("div",{className:g.stale?"uh-stale":void 0,"aria-busy":g.stale||void 0,children:[d.jsxs("div",{className:"uh-totals",children:[d.jsx(pu,{label:"total cost",val:tt(b),accent:!0}),d.jsx(pu,{label:"tokens",val:At(S)}),d.jsx(pu,{label:"input+output",val:At(_)}),d.jsx(pu,{label:"cache reads",val:At(N)})]}),P&&d.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[d.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:M.map(O=>d.jsx("span",{className:"uh-agent-seg",style:{width:`${b>0?O.cost/b*100:0}%`,background:X1(O.id)}},O.id))}),d.jsx("div",{className:"uh-agent-keys",children:M.map(O=>d.jsxs("span",{className:"uh-agent-key",title:`${O.id} · ${At(O.tokens)} tokens`,children:[d.jsx("span",{className:"uh-legend-dot",style:{background:X1(O.id)}}),Uw(O.id),d.jsx("span",{className:"uh-agent-cost",children:tt(O.cost)}),d.jsx("span",{className:"uh-agent-share",children:oF(O.cost,b)})]},O.id))})]}),d.jsx("div",{ref:E,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:v.map(O=>{const A=w>0?O.totalCost/w*100:0,L=O.period===i,H=`${O.period}, ${tt(O.totalCost)}`;return d.jsxs("button",{className:`uh-bar-col${L?" sel":""}`,onClick:()=>a(L?null:O.period),"aria-pressed":L,"aria-label":H,title:`${O.period} · ${tt(O.totalCost)}`,style:{flexBasis:`${100/v.length}%`},children:[d.jsx("div",{className:"uh-bar",style:{height:`${Math.max(A,O.totalCost>0?2:0)}%`},children:O.modelBreakdowns.slice().sort((X,R)=>R.cost-X.cost).map(X=>{const R=O.totalCost>0?X.cost/O.totalCost*100:0;return d.jsx("div",{className:"uh-bar-seg",style:{height:`${R}%`,background:hu(X.modelName)}},X.modelName)})}),d.jsx("span",{className:"uh-bar-label",children:O.period.slice(5)})]},O.period)})}),d.jsx("div",{className:"uh-legend",children:j.map(([O,A])=>d.jsxs("span",{className:"uh-legend-item",title:O,children:[d.jsx("span",{className:"uh-legend-dot",style:{background:hu(O)}}),$s(O)," ",d.jsx("span",{className:"uh-legend-cost",children:tt(A)})]},O))}),I&&d.jsxs("div",{className:"uh-detail",children:[d.jsxs("div",{className:"uh-detail-head",children:[d.jsx("span",{className:"uh-detail-date",children:I.period}),d.jsx("span",{className:"uh-detail-cost",children:tt(I.totalCost)}),(()=>{var L,H;const A=sF(I.agents)??((H=(L=I.metadata)==null?void 0:L.agents)!=null&&H.length?I.metadata.agents.join(" · "):null);return A?d.jsx("span",{className:"uh-detail-agents",title:A,children:A}):null})()]}),d.jsxs("div",{className:"uh-detail-mini",children:[d.jsx(mu,{label:"input",val:At(I.inputTokens)}),d.jsx(mu,{label:"output",val:At(I.outputTokens)}),d.jsx(mu,{label:"cache write",val:At(I.cacheCreationTokens)}),d.jsx(mu,{label:"cache read",val:At(I.cacheReadTokens)})]}),d.jsx("div",{className:"uh-detail-models",children:I.modelBreakdowns.slice().sort((O,A)=>A.cost-O.cost).map(O=>{const A=I.totalCost>0?O.cost/I.totalCost*100:0;return d.jsxs("div",{className:"uh-model-row",title:O.modelName,children:[d.jsxs("span",{className:"uh-model-name",children:[d.jsx("span",{className:"uh-legend-dot",style:{background:hu(O.modelName)}}),d.jsx("span",{className:"uh-model-label",children:$s(O.modelName)})]}),d.jsx("span",{className:"uh-model-bar",children:d.jsx("span",{className:"uh-model-bar-fill",style:{width:`${A}%`,background:hu(O.modelName)}})}),d.jsx("span",{className:"uh-model-cost",children:tt(O.cost)})]},O.modelName)})})]})]})]})})}function pu({label:e,val:t,accent:n}){return d.jsxs("div",{className:"uh-stat",children:[d.jsx("span",{className:`uh-stat-val${n?" accent":""}`,children:t}),d.jsx("span",{className:"uh-stat-label",children:e})]})}function mu({label:e,val:t}){return d.jsxs("div",{className:"uh-ministat",children:[d.jsx("span",{className:"uh-ministat-val",children:t}),d.jsx("span",{className:"uh-ministat-label",children:e})]})}function cF(e){const t=/^#?([0-9a-f]{6})$/i.exec((e??"").trim());if(!t)return!1;const n=parseInt(t[1],16),s=[n>>16&255,n>>8&255,n&255].map(i=>{const a=i/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)});return .2126*s[0]+.7152*s[1]+.0722*s[2]>.5}const Q1=1e4,uF=12e3;function dF({browsers:e,findings:t,watching:n,palette:s,now:i=()=>Date.now()}){const a=k.useRef(null),l=k.useRef(null);return l.current={browsers:e,findings:t,watching:n},k.useEffect(()=>{var w;const u=a.current;if(!u)return;const h=u.getContext("2d");if(!h)return;const p=((w=window.matchMedia)==null?void 0:w.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let f=0,g=!1;const v=()=>{var ne;if(g)return;const E=l.current;if(!E)return;const{browsers:b,findings:S,watching:_}=E,N=s["--accent"]||"#7dd3fc",C=s["--line"]||"#1f2229",j=s["--text-dim"]||"#6e727c",M=cF(s["--bg"]),P=M?42:26,I=M?.85:.65,F=i(),O=Math.min(window.devicePixelRatio||1,2),A=u.clientWidth,L=u.clientHeight;(u.width!==A*O||u.height!==L*O)&&(u.width=A*O,u.height=L*O),h.setTransform(O,0,0,O,0,0),h.clearRect(0,0,A,L);const H=A/2,X=L/2,R=Math.min(A,L)/2-6;h.strokeStyle=C,h.lineWidth=1,h.globalAlpha=M?1:.9;for(const Q of[.4,.7,1])h.beginPath(),h.arc(H,X,R*Q,0,Math.PI*2),h.stroke();h.beginPath(),h.moveTo(H-R,X),h.lineTo(H+R,X),h.moveTo(H,X-R),h.lineTo(H,X+R),h.stroke(),h.globalAlpha=1;const G=(_&&!p?F%Q1/Q1:0)*Math.PI*2-Math.PI/2;if(_){const Q=(ne=h.createConicGradient)==null?void 0:ne.call(h,G-.85,H,X);Q&&(Q.addColorStop(0,"transparent"),Q.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${N} ${P}%, transparent)`),Q.addColorStop(1,"transparent"),h.fillStyle=Q,h.beginPath(),h.moveTo(H,X),h.arc(H,X,R,G-.85,G),h.closePath(),h.fill()),h.strokeStyle=N,h.globalAlpha=I,h.beginPath(),h.moveTo(H,X),h.lineTo(H+Math.cos(G)*R,X+Math.sin(G)*R),h.stroke(),h.globalAlpha=1}b.forEach((Q,W)=>{const ee=W/Math.max(b.length,1)*Math.PI*2-Math.PI/2,$=Q.lastReadMs===null?1:Math.min(1,(F-Q.lastReadMs)/12e4),Y=R*(.42+$*.5),ue=H+Math.cos(ee)*Y,z=X+Math.sin(ee)*Y,D=Math.abs((G-ee+Math.PI*3)%(Math.PI*2)-Math.PI),J=_?Math.max(0,1-D/.55):0;h.beginPath(),h.arc(ue,z,3+J*1.6,0,Math.PI*2),h.fillStyle=Q.running?N:j,h.globalAlpha=Q.running?.55+J*.45:.35,h.fill(),h.globalAlpha=1});for(const Q of S){const W=(F-Q.atMs)/uF;if(W<0||W>1)continue;const $=Math.max(0,b.findIndex(z=>z.key===Q.browser))/Math.max(b.length,1)*Math.PI*2-Math.PI/2,Y=H+Math.cos($)*R*.6,ue=X+Math.sin($)*R*.6;h.beginPath(),h.arc(Y,ue,4+W*22,0,Math.PI*2),h.strokeStyle=N,h.globalAlpha=(1-W)*.8,h.lineWidth=1.5,h.stroke(),h.globalAlpha=1}f=requestAnimationFrame(v)};return v(),()=>{g=!0,cancelAnimationFrame(f)}},[i,s]),d.jsx("canvas",{ref:a,className:"bw-radar",role:"img","aria-label":n?`Watching ${e.length} browser${e.length===1?"":"s"}`:"Not watching"})}const Z1="agent-dag.browserWatch.seenMs";function fF(e,t){return e.filter(n=>n.startMs>t)}function hF(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function pF(e){const t=Math.ceil(e/1e3),n=Math.floor(t/60),s=t%60;return n>0?`${n}m ${s}s`:`${s}s`}function QT(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function J1(e,t){return t?{kind:"saving",word:"Saving",detail:""}:e.settings.enabled?{kind:"on",word:"Watching",detail:""}:{kind:"off",word:"Paused",detail:"nothing new is recorded"}}function mF(e,t){return e.map(n=>({key:n.key,name:n.name,running:n.running,visits:t.filter(s=>s.browser===n.key).reduce((s,i)=>s+i.programVisits,0)}))}function gF(e,t){if(e===null)return null;const n=Math.max(0,Math.round((t-e)/1e3));if(n<5)return"just now";if(n<60)return`${n} sec ago`;const s=Math.round(n/60);return s<60?`${s} min ago`:`${Math.round(s/60)} hr ago`}function yF(e){const t=e.profiles.filter(s=>s.degraded);if(t.length>0){const s=t[0],i=t.length-1;return{kind:"unreadable",text:`${s.name}/${s.profile} could not be read — ${s.reason??"no reason given"}`+(i>0?`, and ${i} more`:"")+". The watch continues on the profiles it can read."}}const n=QT(e.browsers);return n.length===0?{kind:"no-profiles",text:"No browser on this machine has a profile to read. Open one of the browsers below once and it will be watched from then on."}:n.some(s=>s.running)?null:{kind:"none-running",text:"No watched browser is running, so nothing can be navigated right now. Their history is still read, and anything found while they were open is still here."}}function vF(e){const t=n=>new Date(n).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1});return e.count===1||e.endMs-e.startMs<6e4?t(e.startMs):`${t(e.startMs)} → ${t(e.endMs)}`}function wF(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function ek(e){const t=Math.round((e.endMs-e.startMs)/6e4);return t<1?"":`${t} min`}function xF({onClose:e,onSeen:t,onWatching:n,palette:s}){const i=Sn(e),[a,l]=k.useState(null),[u,h]=k.useState(null),[p,f]=k.useState(null),[g,v]=k.useState(!1),w=k.useRef(!1),[E,b]=k.useState(null),[S,_]=k.useState(null),[N,C]=k.useState(!1),j=k.useRef(!1),[M,P]=k.useState(!1),[I,F]=k.useState(!1),[O,A]=k.useState(!1),[L,H]=k.useState(!1),[X,R]=k.useState(!1),[K,G]=k.useState(()=>Date.now());k.useEffect(()=>{const V=setInterval(()=>G(Date.now()),1e3);return()=>clearInterval(V)},[]);const ne=k.useCallback(async V=>{var ae,he;if(!(V&&!cr(w.current))){w.current=V,v(!0);try{const ye=await fetch(`/api/browser-watch${V?"?refresh=1":""}`);if(!ye.ok)throw new Error(`the deck answered ${ye.status}`);const _e=await ye.json();l(_e),j.current||b(((ae=_e==null?void 0:_e.settings)==null?void 0:ae.quietMinutes)??15),n(((he=_e==null?void 0:_e.settings)==null?void 0:he.enabled)===!0),h(null)}catch(ye){h(ye instanceof Error?ye.message:String(ye))}finally{w.current=!1,v(!1)}}},[n]);k.useEffect(()=>{ne(!1)},[ne]),k.useEffect(()=>{const V=setInterval(()=>{ne(!1)},1e4);return()=>clearInterval(V)},[ne]);const Q=k.useCallback(async V=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:V.host,startMs:V.startMs})})}finally{await ne(!1)}},[ne]),W=k.useCallback(async V=>{j.current=!0,C(!0);try{const ae=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(V)});if(!ae.ok)throw new Error(`the deck answered ${ae.status}`);await ne(!1),f(null)}catch(ae){f(ae instanceof Error?ae.message:String(ae))}finally{j.current=!1,C(!1)}},[ne]),ee=k.useRef(t);ee.current=t,k.useEffect(()=>()=>ee.current(Date.now()),[]);const $=k.useMemo(()=>{const V=[];for(const ae of(a==null?void 0:a.episodes)??[]){const he=wF(ae.startMs),ye=V[V.length-1];ye&&ye.label===he?ye.episodes.push(ae):V.push({label:he,episodes:[ae]})}return V},[a]),Y=QT(a==null?void 0:a.browsers),ue=((a==null?void 0:a.browsers)??[]).filter(V=>!(V.installed&&V.profiles>0)),z=a?yF(a):null,D=Y.reduce((V,ae)=>V+ae.profiles,0),J=a?hF(a.coverage.lastHumanMs,a.coverage.quietMs,K):null;return d.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:i,className:"modal bw-modal",onClick:V=>V.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"bw-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:"modal-tool-name",id:"bw-title",children:"Browser watch"}),d.jsx("span",{className:"modal-tool-id",children:a?`${D} ${D===1?"profile":"profiles"} · local only`:"local only"})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("button",{className:"glyph-btn",onClick:()=>void ne(!0),...lr(g),"aria-label":"Re-read every profile now",title:"Re-read every profile now",children:g?"…":"↻"}),d.jsx("button",{className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),d.jsxs("div",{className:"modal-body bw-body",children:[!a&&!u&&d.jsxs("div",{className:"bw-loading",children:[d.jsx("span",{className:"bw-loading-bar","aria-hidden":!0}),d.jsx("p",{children:"Reading each browser's history. The first look copies the file, which takes a moment."})]}),u&&d.jsx("div",{className:"bw-state",children:d.jsxs("div",{className:"bw-row err",children:[d.jsx("span",{className:"bw-dot","aria-hidden":!0}),d.jsx("span",{className:"bw-row-label",children:"Could not read"}),d.jsx("span",{className:"bw-row-detail",children:u})]})}),a&&z&&d.jsx("p",{className:`bw-trouble ${z.kind}`,role:"status",children:z.text}),a&&d.jsxs("div",{className:"bw-work",children:[d.jsxs("aside",{className:"bw-side",children:[d.jsxs("section",{className:"bw-sec",children:[d.jsxs("h4",{className:"bw-sec-head",children:["Activity overview",d.jsx("button",{className:"bw-help",onClick:()=>A(V=>!V),"aria-expanded":O,"aria-label":"What the sweep and the dots mean",children:"?"})]}),d.jsxs("div",{className:"bw-glance",children:[d.jsx(dF,{browsers:Y.map(V=>{var ae;return{key:V.key,name:V.name,running:V.running,lastReadMs:((ae=a.profiles.find(he=>he.browser===V.key))==null?void 0:ae.lastWrittenMs)??null}}),findings:a.episodes.slice(0,6).map(V=>({browser:V.browser??null,atMs:V.endMs})),watching:a.settings.enabled,palette:s}),d.jsx("ul",{className:"bw-counts",children:mF(Y,a.profiles).map(V=>d.jsxs("li",{children:[d.jsx("span",{className:"bw-count-n",children:V.visits.toLocaleString("en-US")}),d.jsx("span",{className:"bw-count-of",children:V.name})]},V.key))})]}),d.jsx("p",{className:"bw-since",children:"Pages a program opened, since this deck started"}),a.coverage.checkedMs>0&&d.jsxs("p",{className:"bw-since",children:["Last checked ",gF(a.coverage.checkedMs,K),a.coverage.checks>0&&d.jsxs(d.Fragment,{children:[" · ",a.coverage.checks.toLocaleString("en-US")," ",a.coverage.checks===1?"check":"checks"]})]}),J!==null&&d.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",pF(J)]}),O&&d.jsxs("dl",{className:"bw-key",children:[d.jsx("dt",{children:"Sweep"}),d.jsx("dd",{children:"one poll of every watched profile"}),d.jsx("dt",{children:"Dot"}),d.jsx("dd",{children:"a browser, further out the longer since it last wrote history"}),d.jsx("dt",{children:"Ring"}),d.jsx("dd",{children:"a finding, leaving the browser it came from"})]})]}),d.jsxs("section",{className:"bw-sec",children:[d.jsxs("h4",{className:"bw-sec-head",children:["Watched profiles",d.jsx("button",{className:"bw-help",onClick:()=>H(V=>!V),"aria-expanded":L,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),L&&d.jsxs("dl",{className:"bw-key",children:[d.jsx("dt",{children:"Running"}),d.jsx("dd",{children:"the browser has a process on this machine right now"}),d.jsx("dt",{children:"Connected"}),d.jsx("dd",{children:"an open connection to an address Anthropic's relay uses — which it shares with claude.ai, so an open tab looks the same as an agent channel"})]}),d.jsx("ul",{className:"bw-profiles",children:Y.map(V=>d.jsxs("li",{children:[d.jsx("span",{className:`bw-prof-dot${V.running?" on":""}`,"aria-hidden":!0}),d.jsx("span",{className:"bw-prof-name",children:V.name}),d.jsx("span",{className:"bw-prof-state",children:V.running?"running":"idle"}),V.running&&V.relay.state==="live"&&d.jsx("span",{className:"bw-relay",children:"connected to Anthropic"})]},V.key))}),ue.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>R(V=>!V),"aria-expanded":X,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:X?"▾":"▸"})," ",ue.length," not watched"]}),X&&d.jsxs("p",{className:"bw-rest",children:[ue.map(V=>V.name).join(", ")," — not installed, or installed and never opened, so there is no history to read."]})]})]}),a.relay&&d.jsx(bF,{relay:a.relay})]}),d.jsxs("div",{className:"bw-main",children:[d.jsxs("section",{className:"bw-findings",children:[d.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Findings",a.episodes.length>0&&d.jsxs("span",{className:"bw-feed-count",children:[a.episodes.length," ",a.episodes.length===1?"episode":"episodes"]})]}),d.jsx("div",{className:"bw-eps",children:$.length===0?d.jsxs("div",{className:"bw-empty",children:[d.jsx("p",{className:"bw-empty-head",children:"Nothing found yet"}),d.jsxs("p",{className:"bw-empty-note",children:["An episode lands here when a program opens pages in a browser nobody has touched for"," ",a.settings.quietMinutes," ",a.settings.quietMinutes===1?"minute":"minutes",". On most machines that is rare, so an empty list is the ordinary result rather than a sign something is wrong."]}),!a.settings.enabled&&d.jsx("p",{className:"bw-empty-note",children:"Watching is off, so this shows only what this deck has seen since it started. Anything an earlier run recorded comes back when you switch it on."})]}):$.map(V=>d.jsxs("div",{className:"bw-day",children:[d.jsx("h4",{className:"bw-sec-head",children:V.label}),V.episodes.map(ae=>{const he=`${ae.host}-${ae.startMs}`,ye=S===he;return d.jsxs("div",{className:`bw-ep${ye?" open":""}`,children:[d.jsxs("div",{className:"bw-ep-row",children:[d.jsxs("button",{className:"bw-ep-head",onClick:()=>_(ye?null:he),"aria-expanded":ye,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:ye?"▾":"▸"}),d.jsx("span",{className:"bw-ep-host",children:ae.host}),d.jsxs("span",{className:"bw-ep-meta",children:[vF(ae),ek(ae)&&d.jsxs(d.Fragment,{children:[" · ",ek(ae)]})]}),d.jsxs("span",{className:"bw-ep-count",children:[ae.count," ",ae.count===1?"page":"pages"]})]}),d.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>void Q(ae),"aria-label":`Dismiss ${ae.host}`,title:"Dismiss — it leaves this list for good, and stays in the log file",children:"×"})]}),ye&&d.jsx("ul",{className:"bw-urls",children:ae.urls.map((_e,Ve)=>d.jsxs("li",{children:[d.jsx("span",{className:"bw-url-time",children:new Date(_e.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),d.jsx("span",{className:"bw-url",children:_e.url})]},`${_e.url}-${_e.timeMs}-${Ve}`))})]},he)})]},V.label))})]}),d.jsxs("section",{className:"bw-feed",children:[d.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Live activity",d.jsxs("span",{className:"bw-feed-count",children:[a.log.length," ",a.log.length===1?"event":"events"]})]}),d.jsx("p",{className:"bw-since bw-feed-note",children:"Pages you opened yourself — counted to run the rule, never written down. Addresses appear under Findings, and only for pages a program opened."}),d.jsx("div",{className:"bw-log","aria-live":"polite","aria-relevant":"additions",children:a.log.length===0?d.jsx("p",{className:"bw-note",children:"The deck writes a line here each time it looks at a profile."}):a.log.map(V=>d.jsxs("div",{className:`bw-log-line ${V.level}${V.parts?"":" sys"}`,children:[d.jsx("span",{className:"bw-log-time",children:new Date(V.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),V.parts?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"bw-log-browser",children:V.parts.browser}),d.jsx("span",{className:"bw-log-profile",title:V.parts.profile,children:V.parts.profile}),d.jsxs("span",{className:"bw-log-value",children:[V.parts.value,V.parts.flagged>0&&d.jsxs("span",{className:"bw-log-flag",children:[" · ",V.parts.flagged," flagged"]})]})]}):d.jsx("span",{className:"bw-log-sys",children:V.text})]},`${V.atMs}-${V.level}-${V.text}`))})]})]})]}),a&&M&&d.jsxs("div",{className:"bw-settings",children:[d.jsxs("label",{title:"A program opening a page counts as a finding only if nobody had touched the browser for this long. Shorter catches more and reports more of your own work; longer is quieter.",children:[d.jsx("span",{children:"Nobody browsing for"}),d.jsxs("select",{value:E??a.settings.quietMinutes,onChange:V=>{b(Number(V.target.value)),W({quietMinutes:Number(V.target.value)})},children:[d.jsx("option",{value:1,children:"1 min"}),d.jsx("option",{value:5,children:"5 min"}),d.jsx("option",{value:15,children:"15 min"}),d.jsx("option",{value:30,children:"30 min"}),d.jsx("option",{value:60,children:"60 min"})]})]}),d.jsxs("label",{children:[d.jsx("span",{children:"When it finds one"}),d.jsx("select",{value:a.settings.reaction,onChange:V=>void W({reaction:V.target.value}),disabled:!a.settings.enabled,title:a.settings.enabled?"What to do besides writing it down.":"Turn watching on to arm a reaction.",children:(a.reactions??["notify"]).map(V=>d.jsx("option",{value:V,children:V==="notify"?"notify me":V==="close-tab"?"close the tab":"quit the browser"},V))})]}),d.jsxs("div",{className:"bw-settings-note",children:[d.jsxs("p",{children:["Chrome marks a navigation that came from an extension or a command rather than from a click. These are the ones that happened while nobody had touched the browser for the time above. ",d.jsx("strong",{children:"Usually that is your own agent doing what you asked."})]}),d.jsxs("button",{className:"bw-why",onClick:()=>F(V=>!V),"aria-expanded":I,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:I?"▾":"▸"})," What Browser Watch can access"]}),I&&d.jsxs("dl",{className:"bw-access",children:[d.jsx("dt",{children:"Reads"}),d.jsxs("dd",{children:["A copy of each browser's own history database — the live file is locked while the browser holds it. Only rows newer than the moment this deck started:"," ",new Date(a.coverage.startedMs).toLocaleString(),"."]}),d.jsx("dt",{children:"Keeps"}),d.jsxs("dd",{children:["Only while the switch is on, and only the episodes it flagged — never your ordinary browsing. In ",d.jsx("code",{className:"bw-path",children:a.coverage.logPath}),", with every address written in full so you can check it yourself."]}),d.jsx("dt",{children:"Sends"}),d.jsx("dd",{children:"Nothing. No part of this reads or writes over the network; the deck serves on 127.0.0.1 and this panel talks only to it."}),d.jsx("dt",{children:"Never reads"}),d.jsx("dd",{children:"Anything from before this deck started, cookies, saved passwords, page contents, or any browser profile with no history file."})]})]})]}),p&&d.jsx("div",{className:"bw-state bw-write-err",role:"alert",children:d.jsxs("div",{className:"bw-row err",children:[d.jsx("span",{className:"bw-dot","aria-hidden":!0}),d.jsx("span",{className:"bw-row-label",children:"Could not save that setting"}),d.jsxs("span",{className:"bw-row-detail",children:[p," — the switches below show what is stored, not what you pressed."]}),d.jsx("button",{className:"glyph-btn bw-write-err-x",onClick:()=>f(null),"aria-label":"Dismiss",title:"Dismiss",children:"×"})]})}),a&&d.jsxs("footer",{className:"bw-status",children:[d.jsx("span",{className:`bw-mode-dot${a.settings.enabled?" on":""}`,"aria-hidden":!0}),d.jsx("span",{className:"bw-mode-word",children:J1(a,N).word},J1(a,N).kind),d.jsx("span",{className:"bw-status-text",children:a.coverage.archived===0?a.settings.enabled?"No episodes recorded yet":"No episodes on disk":`${a.coverage.archived} ${a.coverage.archived===1?"episode":"episodes"} on disk`}),d.jsx("button",{className:`glyph-btn bw-gear${M?" on":""}`,onClick:()=>P(V=>!V),"aria-expanded":M,"aria-label":"Settings",title:"Settings",children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":!0,children:[d.jsx("circle",{cx:"7",cy:"7",r:"2.1"}),d.jsx("path",{d:"M7 1.2v1.6M7 11.2v1.6M1.2 7h1.6M11.2 7h1.6M2.9 2.9l1.1 1.1M10 10l1.1 1.1M11.1 2.9L10 4M4 10l-1.1 1.1"})]})}),d.jsxs("label",{className:"bw-switch",htmlFor:"bw-enabled",children:[d.jsx("span",{className:"bw-switch-label",id:"bw-enabled-label",children:"Watch browser activity"}),d.jsx("button",{id:"bw-enabled",type:"button",role:"switch","aria-checked":a.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"bw-toggle",onClick:()=>void W({enabled:!a.settings.enabled}),title:a.settings.enabled?"On — every episode it finds is written down, so the list outlives the browsing history being cleared":"Off — showing only what this deck has seen since it started. Anything an earlier run archived is hidden until you switch back on, and nothing new is kept",children:d.jsx("span",{className:"bw-toggle-knob"})})]})]})]})]})})}function bF({relay:e}){const[t,n]=k.useState(!1),[s,i]=k.useState(!1),a=e.killswitch.blocked?"unblock":"block",l=e.command[a],u=k.useCallback(async()=>{await UT(l.command)&&(i(!0),window.setTimeout(()=>i(!1),1600))},[l.command]),h=e.profiles.filter(f=>{var g;return(g=f.report)==null?void 0:g.present}),p=e.profiles.filter(f=>f.report===null);return d.jsxs("section",{className:"bw-sec",children:[d.jsx("h4",{className:"bw-sec-head",children:"Remote control"}),d.jsx("p",{className:`bw-rc-verdict ${e.verdict}`,role:"status",children:e.verdict==="exposed"?"Claude in Chrome is live here, so any Claude Code session signed in to your Anthropic account can drive this browser — from any machine, with no prompt on this one.":e.verdict==="protected"?`The relay is black-holed in ${e.hostsPath}, so no new connection to it can be made from this machine.`:"Claude in Chrome is not installed and enabled in any profile here, so there is nothing for the relay to drive."}),e.killswitch.foreign.length>0&&d.jsxs("p",{className:"bw-rc-foreign",children:["Another entry for this host is already in ",e.hostsPath,", and ccdeck will not touch it:",e.killswitch.foreign.map(f=>d.jsx("code",{className:"bw-path",children:f},f))]}),d.jsxs("button",{className:"bw-why",onClick:()=>n(f=>!f),"aria-expanded":t,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:t?"▾":"▸"})," ",e.verdict==="protected"?"How to undo the block":"What it can reach, and how to stop it"]}),t&&d.jsxs("div",{className:"bw-rc-body",children:[h.length>0&&d.jsx("dl",{className:"bw-key",children:h.map(f=>d.jsxs(k.Fragment,{children:[d.jsxs("dt",{children:[f.name,f.profile==="Default"?"":` · ${f.profile}`]}),d.jsxs("dd",{children:[f.report.enabled?"enabled":"installed but switched off",f.report.allUrls?", can act on every site":", limited to the sites it was granted",f.report.sensitiveApis.length>0&&d.jsxs(d.Fragment,{children:[" — ",f.report.sensitiveApis.join(", ")]})]})]},`${f.browser}/${f.profile}`))}),p.length>0&&d.jsxs("p",{className:"bw-rc-note",children:[p.map(f=>f.name).join(", ")," — its settings file could not be read, so nothing is claimed about it either way."]}),!e.hostsRead&&d.jsxs("p",{className:"bw-rc-note",children:[e.hostsPath," could not be read, so whether the relay is already blocked is unknown."]}),h.some(f=>f.report.allUrls)&&d.jsxs("p",{className:"bw-rc-note",children:["Narrowing the sites in ",d.jsx("code",{className:"bw-path",children:"chrome://extensions"})," does not change this: the grant is held at the browser level and the per-site list is enforced inside the extension, by the extension."]}),d.jsxs("div",{className:"bw-rc-cmd",children:[d.jsx("code",{children:l.command}),d.jsx("button",{className:"btn bw-rc-copy",onClick:u,children:s?"Copied":"Copy"})]}),d.jsx("p",{className:"bw-rc-note",children:l.note})]})]})}function Ww(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 uh,tk;function kF(){if(tk)return uh;tk=1;function e(){this.__data__=[],this.size=0}return uh=e,uh}var dh,nk;function Ji(){if(nk)return dh;nk=1;function e(t,n){return t===n||t!==t&&n!==n}return dh=e,dh}var fh,rk;function Zu(){if(rk)return fh;rk=1;var e=Ji();function t(n,s){for(var i=n.length;i--;)if(e(n[i][0],s))return i;return-1}return fh=t,fh}var hh,sk;function _F(){if(sk)return hh;sk=1;var e=Zu(),t=Array.prototype,n=t.splice;function s(i){var a=this.__data__,l=e(a,i);if(l<0)return!1;var u=a.length-1;return l==u?a.pop():n.call(a,l,1),--this.size,!0}return hh=s,hh}var ph,ok;function SF(){if(ok)return ph;ok=1;var e=Zu();function t(n){var s=this.__data__,i=e(s,n);return i<0?void 0:s[i][1]}return ph=t,ph}var mh,ik;function NF(){if(ik)return mh;ik=1;var e=Zu();function t(n){return e(this.__data__,n)>-1}return mh=t,mh}var gh,ak;function EF(){if(ak)return gh;ak=1;var e=Zu();function t(n,s){var i=this.__data__,a=e(i,n);return a<0?(++this.size,i.push([n,s])):i[a][1]=s,this}return gh=t,gh}var yh,lk;function Ju(){if(lk)return yh;lk=1;var e=kF(),t=_F(),n=SF(),s=NF(),i=EF();function a(l){var u=-1,h=l==null?0:l.length;for(this.clear();++u<h;){var p=l[u];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=i,yh=a,yh}var vh,ck;function CF(){if(ck)return vh;ck=1;var e=Ju();function t(){this.__data__=new e,this.size=0}return vh=t,vh}var wh,uk;function jF(){if(uk)return wh;uk=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return wh=e,wh}var xh,dk;function TF(){if(dk)return xh;dk=1;function e(t){return this.__data__.get(t)}return xh=e,xh}var bh,fk;function RF(){if(fk)return bh;fk=1;function e(t){return this.__data__.has(t)}return bh=e,bh}var kh,hk;function ZT(){if(hk)return kh;hk=1;var e=typeof Xc=="object"&&Xc&&Xc.Object===Object&&Xc;return kh=e,kh}var _h,pk;function hr(){if(pk)return _h;pk=1;var e=ZT(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return _h=n,_h}var Sh,mk;function ea(){if(mk)return Sh;mk=1;var e=hr(),t=e.Symbol;return Sh=t,Sh}var Nh,gk;function AF(){if(gk)return Nh;gk=1;var e=ea(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,i=e?e.toStringTag:void 0;function a(l){var u=n.call(l,i),h=l[i];try{l[i]=void 0;var p=!0}catch{}var f=s.call(l);return p&&(u?l[i]=h:delete l[i]),f}return Nh=a,Nh}var Eh,yk;function MF(){if(yk)return Eh;yk=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return Eh=n,Eh}var Ch,vk;function Co(){if(vk)return Ch;vk=1;var e=ea(),t=AF(),n=MF(),s="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?i:s:a&&a in Object(u)?t(u):n(u)}return Ch=l,Ch}var jh,wk;function Fn(){if(wk)return jh;wk=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return jh=e,jh}var Th,xk;function $l(){if(xk)return Th;xk=1;var e=Co(),t=Fn(),n="[object AsyncFunction]",s="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function l(u){if(!t(u))return!1;var h=e(u);return h==s||h==i||h==n||h==a}return Th=l,Th}var Rh,bk;function IF(){if(bk)return Rh;bk=1;var e=hr(),t=e["__core-js_shared__"];return Rh=t,Rh}var Ah,kk;function OF(){if(kk)return Ah;kk=1;var e=IF(),t=(function(){var s=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""})();function n(s){return!!t&&t in s}return Ah=n,Ah}var Mh,_k;function JT(){if(_k)return Mh;_k=1;var e=Function.prototype,t=e.toString;function n(s){if(s!=null){try{return t.call(s)}catch{}try{return s+""}catch{}}return""}return Mh=n,Mh}var Ih,Sk;function PF(){if(Sk)return Ih;Sk=1;var e=$l(),t=OF(),n=Fn(),s=JT(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,h=l.toString,p=u.hasOwnProperty,f=RegExp("^"+h.call(p).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(v){if(!n(v)||t(v))return!1;var w=e(v)?f:a;return w.test(s(v))}return Ih=g,Ih}var Oh,Nk;function $F(){if(Nk)return Oh;Nk=1;function e(t,n){return t==null?void 0:t[n]}return Oh=e,Oh}var Ph,Ek;function jo(){if(Ek)return Ph;Ek=1;var e=PF(),t=$F();function n(s,i){var a=t(s,i);return e(a)?a:void 0}return Ph=n,Ph}var $h,Ck;function Hw(){if(Ck)return $h;Ck=1;var e=jo(),t=hr(),n=e(t,"Map");return $h=n,$h}var Lh,jk;function ed(){if(jk)return Lh;jk=1;var e=jo(),t=e(Object,"create");return Lh=t,Lh}var qh,Tk;function LF(){if(Tk)return qh;Tk=1;var e=ed();function t(){this.__data__=e?e(null):{},this.size=0}return qh=t,qh}var Dh,Rk;function qF(){if(Rk)return Dh;Rk=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Dh=e,Dh}var Fh,Ak;function DF(){if(Ak)return Fh;Ak=1;var e=ed(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function i(a){var l=this.__data__;if(e){var u=l[a];return u===t?void 0:u}return s.call(l,a)?l[a]:void 0}return Fh=i,Fh}var zh,Mk;function FF(){if(Mk)return zh;Mk=1;var e=ed(),t=Object.prototype,n=t.hasOwnProperty;function s(i){var a=this.__data__;return e?a[i]!==void 0:n.call(a,i)}return zh=s,zh}var Bh,Ik;function zF(){if(Ik)return Bh;Ik=1;var e=ed(),t="__lodash_hash_undefined__";function n(s,i){var a=this.__data__;return this.size+=this.has(s)?0:1,a[s]=e&&i===void 0?t:i,this}return Bh=n,Bh}var Uh,Ok;function BF(){if(Ok)return Uh;Ok=1;var e=LF(),t=qF(),n=DF(),s=FF(),i=zF();function a(l){var u=-1,h=l==null?0:l.length;for(this.clear();++u<h;){var p=l[u];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=i,Uh=a,Uh}var Wh,Pk;function UF(){if(Pk)return Wh;Pk=1;var e=BF(),t=Ju(),n=Hw();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Wh=s,Wh}var Hh,$k;function WF(){if($k)return Hh;$k=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Hh=e,Hh}var Gh,Lk;function td(){if(Lk)return Gh;Lk=1;var e=WF();function t(n,s){var i=n.__data__;return e(s)?i[typeof s=="string"?"string":"hash"]:i.map}return Gh=t,Gh}var Vh,qk;function HF(){if(qk)return Vh;qk=1;var e=td();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return Vh=t,Vh}var Yh,Dk;function GF(){if(Dk)return Yh;Dk=1;var e=td();function t(n){return e(this,n).get(n)}return Yh=t,Yh}var Kh,Fk;function VF(){if(Fk)return Kh;Fk=1;var e=td();function t(n){return e(this,n).has(n)}return Kh=t,Kh}var Xh,zk;function YF(){if(zk)return Xh;zk=1;var e=td();function t(n,s){var i=e(this,n),a=i.size;return i.set(n,s),this.size+=i.size==a?0:1,this}return Xh=t,Xh}var Qh,Bk;function Gw(){if(Bk)return Qh;Bk=1;var e=UF(),t=HF(),n=GF(),s=VF(),i=YF();function a(l){var u=-1,h=l==null?0:l.length;for(this.clear();++u<h;){var p=l[u];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=i,Qh=a,Qh}var Zh,Uk;function KF(){if(Uk)return Zh;Uk=1;var e=Ju(),t=Hw(),n=Gw(),s=200;function i(a,l){var u=this.__data__;if(u instanceof e){var h=u.__data__;if(!t||h.length<s-1)return h.push([a,l]),this.size=++u.size,this;u=this.__data__=new n(h)}return u.set(a,l),this.size=u.size,this}return Zh=i,Zh}var Jh,Wk;function nd(){if(Wk)return Jh;Wk=1;var e=Ju(),t=CF(),n=jF(),s=TF(),i=RF(),a=KF();function l(u){var h=this.__data__=new e(u);this.size=h.size}return l.prototype.clear=t,l.prototype.delete=n,l.prototype.get=s,l.prototype.has=i,l.prototype.set=a,Jh=l,Jh}var ep,Hk;function Vw(){if(Hk)return ep;Hk=1;function e(t,n){for(var s=-1,i=t==null?0:t.length;++s<i&&n(t[s],s,t)!==!1;);return t}return ep=e,ep}var tp,Gk;function eR(){if(Gk)return tp;Gk=1;var e=jo(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return tp=t,tp}var np,Vk;function rd(){if(Vk)return np;Vk=1;var e=eR();function t(n,s,i){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[s]=i}return np=t,np}var rp,Yk;function sd(){if(Yk)return rp;Yk=1;var e=rd(),t=Ji(),n=Object.prototype,s=n.hasOwnProperty;function i(a,l,u){var h=a[l];(!(s.call(a,l)&&t(h,u))||u===void 0&&!(l in a))&&e(a,l,u)}return rp=i,rp}var sp,Kk;function Ll(){if(Kk)return sp;Kk=1;var e=sd(),t=rd();function n(s,i,a,l){var u=!a;a||(a={});for(var h=-1,p=i.length;++h<p;){var f=i[h],g=l?l(a[f],s[f],f,a,s):void 0;g===void 0&&(g=s[f]),u?t(a,f,g):e(a,f,g)}return a}return sp=n,sp}var op,Xk;function XF(){if(Xk)return op;Xk=1;function e(t,n){for(var s=-1,i=Array(t);++s<t;)i[s]=n(s);return i}return op=e,op}var ip,Qk;function Tr(){if(Qk)return ip;Qk=1;function e(t){return t!=null&&typeof t=="object"}return ip=e,ip}var ap,Zk;function QF(){if(Zk)return ap;Zk=1;var e=Co(),t=Tr(),n="[object Arguments]";function s(i){return t(i)&&e(i)==n}return ap=s,ap}var lp,Jk;function ql(){if(Jk)return lp;Jk=1;var e=QF(),t=Tr(),n=Object.prototype,s=n.hasOwnProperty,i=n.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(l){return t(l)&&s.call(l,"callee")&&!i.call(l,"callee")};return lp=a,lp}var cp,e_;function It(){if(e_)return cp;e_=1;var e=Array.isArray;return cp=e,cp}var al={exports:{}},up,t_;function ZF(){if(t_)return up;t_=1;function e(){return!1}return up=e,up}al.exports;var n_;function ta(){return n_||(n_=1,(function(e,t){var n=hr(),s=ZF(),i=t&&!t.nodeType&&t,a=i&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===i,u=l?n.Buffer:void 0,h=u?u.isBuffer:void 0,p=h||s;e.exports=p})(al,al.exports)),al.exports}var dp,r_;function od(){if(r_)return dp;r_=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,i){var a=typeof s;return i=i??e,!!i&&(a=="number"||a!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<i}return dp=n,dp}var fp,s_;function Yw(){if(s_)return fp;s_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return fp=t,fp}var hp,o_;function JF(){if(o_)return hp;o_=1;var e=Co(),t=Yw(),n=Tr(),s="[object Arguments]",i="[object Array]",a="[object Boolean]",l="[object Date]",u="[object Error]",h="[object Function]",p="[object Map]",f="[object Number]",g="[object Object]",v="[object RegExp]",w="[object Set]",E="[object String]",b="[object WeakMap]",S="[object ArrayBuffer]",_="[object DataView]",N="[object Float32Array]",C="[object Float64Array]",j="[object Int8Array]",M="[object Int16Array]",P="[object Int32Array]",I="[object Uint8Array]",F="[object Uint8ClampedArray]",O="[object Uint16Array]",A="[object Uint32Array]",L={};L[N]=L[C]=L[j]=L[M]=L[P]=L[I]=L[F]=L[O]=L[A]=!0,L[s]=L[i]=L[S]=L[a]=L[_]=L[l]=L[u]=L[h]=L[p]=L[f]=L[g]=L[v]=L[w]=L[E]=L[b]=!1;function H(X){return n(X)&&t(X.length)&&!!L[e(X)]}return hp=H,hp}var pp,i_;function id(){if(i_)return pp;i_=1;function e(t){return function(n){return t(n)}}return pp=e,pp}var ll={exports:{}};ll.exports;var a_;function Kw(){return a_||(a_=1,(function(e,t){var n=ZT(),s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===s,l=a&&n.process,u=(function(){try{var h=i&&i.require&&i.require("util").types;return h||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(ll,ll.exports)),ll.exports}var mp,l_;function Dl(){if(l_)return mp;l_=1;var e=JF(),t=id(),n=Kw(),s=n&&n.isTypedArray,i=s?t(s):e;return mp=i,mp}var gp,c_;function tR(){if(c_)return gp;c_=1;var e=XF(),t=ql(),n=It(),s=ta(),i=od(),a=Dl(),l=Object.prototype,u=l.hasOwnProperty;function h(p,f){var g=n(p),v=!g&&t(p),w=!g&&!v&&s(p),E=!g&&!v&&!w&&a(p),b=g||v||w||E,S=b?e(p.length,String):[],_=S.length;for(var N in p)(f||u.call(p,N))&&!(b&&(N=="length"||w&&(N=="offset"||N=="parent")||E&&(N=="buffer"||N=="byteLength"||N=="byteOffset")||i(N,_)))&&S.push(N);return S}return gp=h,gp}var yp,u_;function ad(){if(u_)return yp;u_=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,i=typeof s=="function"&&s.prototype||e;return n===i}return yp=t,yp}var vp,d_;function nR(){if(d_)return vp;d_=1;function e(t,n){return function(s){return t(n(s))}}return vp=e,vp}var wp,f_;function e6(){if(f_)return wp;f_=1;var e=nR(),t=e(Object.keys,Object);return wp=t,wp}var xp,h_;function Xw(){if(h_)return xp;h_=1;var e=ad(),t=e6(),n=Object.prototype,s=n.hasOwnProperty;function i(a){if(!e(a))return t(a);var l=[];for(var u in Object(a))s.call(a,u)&&u!="constructor"&&l.push(u);return l}return xp=i,xp}var bp,p_;function ns(){if(p_)return bp;p_=1;var e=$l(),t=Yw();function n(s){return s!=null&&t(s.length)&&!e(s)}return bp=n,bp}var kp,m_;function Ls(){if(m_)return kp;m_=1;var e=tR(),t=Xw(),n=ns();function s(i){return n(i)?e(i):t(i)}return kp=s,kp}var _p,g_;function t6(){if(g_)return _p;g_=1;var e=Ll(),t=Ls();function n(s,i){return s&&e(i,t(i),s)}return _p=n,_p}var Sp,y_;function n6(){if(y_)return Sp;y_=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return Sp=e,Sp}var Np,v_;function r6(){if(v_)return Np;v_=1;var e=Fn(),t=ad(),n=n6(),s=Object.prototype,i=s.hasOwnProperty;function a(l){if(!e(l))return n(l);var u=t(l),h=[];for(var p in l)p=="constructor"&&(u||!i.call(l,p))||h.push(p);return h}return Np=a,Np}var Ep,w_;function To(){if(w_)return Ep;w_=1;var e=tR(),t=r6(),n=ns();function s(i){return n(i)?e(i,!0):t(i)}return Ep=s,Ep}var Cp,x_;function s6(){if(x_)return Cp;x_=1;var e=Ll(),t=To();function n(s,i){return s&&e(i,t(i),s)}return Cp=n,Cp}var cl={exports:{}};cl.exports;var b_;function rR(){return b_||(b_=1,(function(e,t){var n=hr(),s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===s,l=a?n.Buffer:void 0,u=l?l.allocUnsafe:void 0;function h(p,f){if(f)return p.slice();var g=p.length,v=u?u(g):new p.constructor(g);return p.copy(v),v}e.exports=h})(cl,cl.exports)),cl.exports}var jp,k_;function sR(){if(k_)return jp;k_=1;function e(t,n){var s=-1,i=t.length;for(n||(n=Array(i));++s<i;)n[s]=t[s];return n}return jp=e,jp}var Tp,__;function oR(){if(__)return Tp;__=1;function e(t,n){for(var s=-1,i=t==null?0:t.length,a=0,l=[];++s<i;){var u=t[s];n(u,s,t)&&(l[a++]=u)}return l}return Tp=e,Tp}var Rp,S_;function iR(){if(S_)return Rp;S_=1;function e(){return[]}return Rp=e,Rp}var Ap,N_;function Qw(){if(N_)return Ap;N_=1;var e=oR(),t=iR(),n=Object.prototype,s=n.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(l){return l==null?[]:(l=Object(l),e(i(l),function(u){return s.call(l,u)}))}:t;return Ap=a,Ap}var Mp,E_;function o6(){if(E_)return Mp;E_=1;var e=Ll(),t=Qw();function n(s,i){return e(s,t(s),i)}return Mp=n,Mp}var Ip,C_;function Zw(){if(C_)return Ip;C_=1;function e(t,n){for(var s=-1,i=n.length,a=t.length;++s<i;)t[a+s]=n[s];return t}return Ip=e,Ip}var Op,j_;function ld(){if(j_)return Op;j_=1;var e=nR(),t=e(Object.getPrototypeOf,Object);return Op=t,Op}var Pp,T_;function aR(){if(T_)return Pp;T_=1;var e=Zw(),t=ld(),n=Qw(),s=iR(),i=Object.getOwnPropertySymbols,a=i?function(l){for(var u=[];l;)e(u,n(l)),l=t(l);return u}:s;return Pp=a,Pp}var $p,R_;function i6(){if(R_)return $p;R_=1;var e=Ll(),t=aR();function n(s,i){return e(s,t(s),i)}return $p=n,$p}var Lp,A_;function lR(){if(A_)return Lp;A_=1;var e=Zw(),t=It();function n(s,i,a){var l=i(s);return t(s)?l:e(l,a(s))}return Lp=n,Lp}var qp,M_;function cR(){if(M_)return qp;M_=1;var e=lR(),t=Qw(),n=Ls();function s(i){return e(i,n,t)}return qp=s,qp}var Dp,I_;function a6(){if(I_)return Dp;I_=1;var e=lR(),t=aR(),n=To();function s(i){return e(i,n,t)}return Dp=s,Dp}var Fp,O_;function l6(){if(O_)return Fp;O_=1;var e=jo(),t=hr(),n=e(t,"DataView");return Fp=n,Fp}var zp,P_;function c6(){if(P_)return zp;P_=1;var e=jo(),t=hr(),n=e(t,"Promise");return zp=n,zp}var Bp,$_;function uR(){if($_)return Bp;$_=1;var e=jo(),t=hr(),n=e(t,"Set");return Bp=n,Bp}var Up,L_;function u6(){if(L_)return Up;L_=1;var e=jo(),t=hr(),n=e(t,"WeakMap");return Up=n,Up}var Wp,q_;function na(){if(q_)return Wp;q_=1;var e=l6(),t=Hw(),n=c6(),s=uR(),i=u6(),a=Co(),l=JT(),u="[object Map]",h="[object Object]",p="[object Promise]",f="[object Set]",g="[object WeakMap]",v="[object DataView]",w=l(e),E=l(t),b=l(n),S=l(s),_=l(i),N=a;return(e&&N(new e(new ArrayBuffer(1)))!=v||t&&N(new t)!=u||n&&N(n.resolve())!=p||s&&N(new s)!=f||i&&N(new i)!=g)&&(N=function(C){var j=a(C),M=j==h?C.constructor:void 0,P=M?l(M):"";if(P)switch(P){case w:return v;case E:return u;case b:return p;case S:return f;case _:return g}return j}),Wp=N,Wp}var Hp,D_;function d6(){if(D_)return Hp;D_=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s){var i=s.length,a=new s.constructor(i);return i&&typeof s[0]=="string"&&t.call(s,"index")&&(a.index=s.index,a.input=s.input),a}return Hp=n,Hp}var Gp,F_;function dR(){if(F_)return Gp;F_=1;var e=hr(),t=e.Uint8Array;return Gp=t,Gp}var Vp,z_;function Jw(){if(z_)return Vp;z_=1;var e=dR();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return Vp=t,Vp}var Yp,B_;function f6(){if(B_)return Yp;B_=1;var e=Jw();function t(n,s){var i=s?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.byteLength)}return Yp=t,Yp}var Kp,U_;function h6(){if(U_)return Kp;U_=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return Kp=t,Kp}var Xp,W_;function p6(){if(W_)return Xp;W_=1;var e=ea(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(i){return n?Object(n.call(i)):{}}return Xp=s,Xp}var Qp,H_;function fR(){if(H_)return Qp;H_=1;var e=Jw();function t(n,s){var i=s?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.length)}return Qp=t,Qp}var Zp,G_;function m6(){if(G_)return Zp;G_=1;var e=Jw(),t=f6(),n=h6(),s=p6(),i=fR(),a="[object Boolean]",l="[object Date]",u="[object Map]",h="[object Number]",p="[object RegExp]",f="[object Set]",g="[object String]",v="[object Symbol]",w="[object ArrayBuffer]",E="[object DataView]",b="[object Float32Array]",S="[object Float64Array]",_="[object Int8Array]",N="[object Int16Array]",C="[object Int32Array]",j="[object Uint8Array]",M="[object Uint8ClampedArray]",P="[object Uint16Array]",I="[object Uint32Array]";function F(O,A,L){var H=O.constructor;switch(A){case w:return e(O);case a:case l:return new H(+O);case E:return t(O,L);case b:case S:case _:case N:case C:case j:case M:case P:case I:return i(O,L);case u:return new H;case h:case g:return new H(O);case p:return n(O);case f:return new H;case v:return s(O)}}return Zp=F,Zp}var Jp,V_;function hR(){if(V_)return Jp;V_=1;var e=Fn(),t=Object.create,n=(function(){function s(){}return function(i){if(!e(i))return{};if(t)return t(i);s.prototype=i;var a=new s;return s.prototype=void 0,a}})();return Jp=n,Jp}var em,Y_;function pR(){if(Y_)return em;Y_=1;var e=hR(),t=ld(),n=ad();function s(i){return typeof i.constructor=="function"&&!n(i)?e(t(i)):{}}return em=s,em}var tm,K_;function g6(){if(K_)return tm;K_=1;var e=na(),t=Tr(),n="[object Map]";function s(i){return t(i)&&e(i)==n}return tm=s,tm}var nm,X_;function y6(){if(X_)return nm;X_=1;var e=g6(),t=id(),n=Kw(),s=n&&n.isMap,i=s?t(s):e;return nm=i,nm}var rm,Q_;function v6(){if(Q_)return rm;Q_=1;var e=na(),t=Tr(),n="[object Set]";function s(i){return t(i)&&e(i)==n}return rm=s,rm}var sm,Z_;function w6(){if(Z_)return sm;Z_=1;var e=v6(),t=id(),n=Kw(),s=n&&n.isSet,i=s?t(s):e;return sm=i,sm}var om,J_;function mR(){if(J_)return om;J_=1;var e=nd(),t=Vw(),n=sd(),s=t6(),i=s6(),a=rR(),l=sR(),u=o6(),h=i6(),p=cR(),f=a6(),g=na(),v=d6(),w=m6(),E=pR(),b=It(),S=ta(),_=y6(),N=Fn(),C=w6(),j=Ls(),M=To(),P=1,I=2,F=4,O="[object Arguments]",A="[object Array]",L="[object Boolean]",H="[object Date]",X="[object Error]",R="[object Function]",K="[object GeneratorFunction]",G="[object Map]",ne="[object Number]",Q="[object Object]",W="[object RegExp]",ee="[object Set]",$="[object String]",Y="[object Symbol]",ue="[object WeakMap]",z="[object ArrayBuffer]",D="[object DataView]",J="[object Float32Array]",V="[object Float64Array]",ae="[object Int8Array]",he="[object Int16Array]",ye="[object Int32Array]",_e="[object Uint8Array]",Ve="[object Uint8ClampedArray]",Be="[object Uint16Array]",qe="[object Uint32Array]",Se={};Se[O]=Se[A]=Se[z]=Se[D]=Se[L]=Se[H]=Se[J]=Se[V]=Se[ae]=Se[he]=Se[ye]=Se[G]=Se[ne]=Se[Q]=Se[W]=Se[ee]=Se[$]=Se[Y]=Se[_e]=Se[Ve]=Se[Be]=Se[qe]=!0,Se[X]=Se[R]=Se[ue]=!1;function ce(be,ke,Ye,dt,lt,pe){var me,Me=ke&P,He=ke&I,ct=ke&F;if(Ye&&(me=lt?Ye(be,dt,lt,pe):Ye(be)),me!==void 0)return me;if(!N(be))return be;var je=b(be);if(je){if(me=v(be),!Me)return l(be,me)}else{var Ge=g(be),Ke=Ge==R||Ge==K;if(S(be))return a(be,Me);if(Ge==Q||Ge==O||Ke&&!lt){if(me=He||Ke?{}:E(be),!Me)return He?h(be,i(me,be)):u(be,s(me,be))}else{if(!Se[Ge])return lt?be:{};me=w(be,Ge,Me)}}pe||(pe=new e);var se=pe.get(be);if(se)return se;pe.set(be,me),C(be)?be.forEach(function(Te){me.add(ce(Te,ke,Ye,Te,be,pe))}):_(be)&&be.forEach(function(Te,Xe){me.set(Xe,ce(Te,ke,Ye,Xe,be,pe))});var Pe=ct?He?f:p:He?M:j,$e=je?void 0:Pe(be);return t($e||be,function(Te,Xe){$e&&(Xe=Te,Te=be[Xe]),n(me,Xe,ce(Te,ke,Ye,Xe,be,pe))}),me}return om=ce,om}var im,eS;function x6(){if(eS)return im;eS=1;var e=mR(),t=4;function n(s){return e(s,t)}return im=n,im}var am,tS;function e0(){if(tS)return am;tS=1;function e(t){return function(){return t}}return am=e,am}var lm,nS;function b6(){if(nS)return lm;nS=1;function e(t){return function(n,s,i){for(var a=-1,l=Object(n),u=i(n),h=u.length;h--;){var p=u[t?h:++a];if(s(l[p],p,l)===!1)break}return n}}return lm=e,lm}var cm,rS;function t0(){if(rS)return cm;rS=1;var e=b6(),t=e();return cm=t,cm}var um,sS;function n0(){if(sS)return um;sS=1;var e=t0(),t=Ls();function n(s,i){return s&&e(s,i,t)}return um=n,um}var dm,oS;function k6(){if(oS)return dm;oS=1;var e=ns();function t(n,s){return function(i,a){if(i==null)return i;if(!e(i))return n(i,a);for(var l=i.length,u=s?l:-1,h=Object(i);(s?u--:++u<l)&&a(h[u],u,h)!==!1;);return i}}return dm=t,dm}var fm,iS;function cd(){if(iS)return fm;iS=1;var e=n0(),t=k6(),n=t(e);return fm=n,fm}var hm,aS;function Ro(){if(aS)return hm;aS=1;function e(t){return t}return hm=e,hm}var pm,lS;function gR(){if(lS)return pm;lS=1;var e=Ro();function t(n){return typeof n=="function"?n:e}return pm=t,pm}var mm,cS;function yR(){if(cS)return mm;cS=1;var e=Vw(),t=cd(),n=gR(),s=It();function i(a,l){var u=s(a)?e:t;return u(a,n(l))}return mm=i,mm}var gm,uS;function vR(){return uS||(uS=1,gm=yR()),gm}var ym,dS;function _6(){if(dS)return ym;dS=1;var e=cd();function t(n,s){var i=[];return e(n,function(a,l,u){s(a,l,u)&&i.push(a)}),i}return ym=t,ym}var vm,fS;function S6(){if(fS)return vm;fS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return vm=t,vm}var wm,hS;function N6(){if(hS)return wm;hS=1;function e(t){return this.__data__.has(t)}return wm=e,wm}var xm,pS;function wR(){if(pS)return xm;pS=1;var e=Gw(),t=S6(),n=N6();function s(i){var a=-1,l=i==null?0:i.length;for(this.__data__=new e;++a<l;)this.add(i[a])}return s.prototype.add=s.prototype.push=t,s.prototype.has=n,xm=s,xm}var bm,mS;function E6(){if(mS)return bm;mS=1;function e(t,n){for(var s=-1,i=t==null?0:t.length;++s<i;)if(n(t[s],s,t))return!0;return!1}return bm=e,bm}var km,gS;function xR(){if(gS)return km;gS=1;function e(t,n){return t.has(n)}return km=e,km}var _m,yS;function bR(){if(yS)return _m;yS=1;var e=wR(),t=E6(),n=xR(),s=1,i=2;function a(l,u,h,p,f,g){var v=h&s,w=l.length,E=u.length;if(w!=E&&!(v&&E>w))return!1;var b=g.get(l),S=g.get(u);if(b&&S)return b==u&&S==l;var _=-1,N=!0,C=h&i?new e:void 0;for(g.set(l,u),g.set(u,l);++_<w;){var j=l[_],M=u[_];if(p)var P=v?p(M,j,_,u,l,g):p(j,M,_,l,u,g);if(P!==void 0){if(P)continue;N=!1;break}if(C){if(!t(u,function(I,F){if(!n(C,F)&&(j===I||f(j,I,h,p,g)))return C.push(F)})){N=!1;break}}else if(!(j===M||f(j,M,h,p,g))){N=!1;break}}return g.delete(l),g.delete(u),N}return _m=a,_m}var Sm,vS;function C6(){if(vS)return Sm;vS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(i,a){s[++n]=[a,i]}),s}return Sm=e,Sm}var Nm,wS;function r0(){if(wS)return Nm;wS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(i){s[++n]=i}),s}return Nm=e,Nm}var Em,xS;function j6(){if(xS)return Em;xS=1;var e=ea(),t=dR(),n=Ji(),s=bR(),i=C6(),a=r0(),l=1,u=2,h="[object Boolean]",p="[object Date]",f="[object Error]",g="[object Map]",v="[object Number]",w="[object RegExp]",E="[object Set]",b="[object String]",S="[object Symbol]",_="[object ArrayBuffer]",N="[object DataView]",C=e?e.prototype:void 0,j=C?C.valueOf:void 0;function M(P,I,F,O,A,L,H){switch(F){case N:if(P.byteLength!=I.byteLength||P.byteOffset!=I.byteOffset)return!1;P=P.buffer,I=I.buffer;case _:return!(P.byteLength!=I.byteLength||!L(new t(P),new t(I)));case h:case p:case v:return n(+P,+I);case f:return P.name==I.name&&P.message==I.message;case w:case b:return P==I+"";case g:var X=i;case E:var R=O&l;if(X||(X=a),P.size!=I.size&&!R)return!1;var K=H.get(P);if(K)return K==I;O|=u,H.set(P,I);var G=s(X(P),X(I),O,A,L,H);return H.delete(P),G;case S:if(j)return j.call(P)==j.call(I)}return!1}return Em=M,Em}var Cm,bS;function T6(){if(bS)return Cm;bS=1;var e=cR(),t=1,n=Object.prototype,s=n.hasOwnProperty;function i(a,l,u,h,p,f){var g=u&t,v=e(a),w=v.length,E=e(l),b=E.length;if(w!=b&&!g)return!1;for(var S=w;S--;){var _=v[S];if(!(g?_ in l:s.call(l,_)))return!1}var N=f.get(a),C=f.get(l);if(N&&C)return N==l&&C==a;var j=!0;f.set(a,l),f.set(l,a);for(var M=g;++S<w;){_=v[S];var P=a[_],I=l[_];if(h)var F=g?h(I,P,_,l,a,f):h(P,I,_,a,l,f);if(!(F===void 0?P===I||p(P,I,u,h,f):F)){j=!1;break}M||(M=_=="constructor")}if(j&&!M){var O=a.constructor,A=l.constructor;O!=A&&"constructor"in a&&"constructor"in l&&!(typeof O=="function"&&O instanceof O&&typeof A=="function"&&A instanceof A)&&(j=!1)}return f.delete(a),f.delete(l),j}return Cm=i,Cm}var jm,kS;function R6(){if(kS)return jm;kS=1;var e=nd(),t=bR(),n=j6(),s=T6(),i=na(),a=It(),l=ta(),u=Dl(),h=1,p="[object Arguments]",f="[object Array]",g="[object Object]",v=Object.prototype,w=v.hasOwnProperty;function E(b,S,_,N,C,j){var M=a(b),P=a(S),I=M?f:i(b),F=P?f:i(S);I=I==p?g:I,F=F==p?g:F;var O=I==g,A=F==g,L=I==F;if(L&&l(b)){if(!l(S))return!1;M=!0,O=!1}if(L&&!O)return j||(j=new e),M||u(b)?t(b,S,_,N,C,j):n(b,S,I,_,N,C,j);if(!(_&h)){var H=O&&w.call(b,"__wrapped__"),X=A&&w.call(S,"__wrapped__");if(H||X){var R=H?b.value():b,K=X?S.value():S;return j||(j=new e),C(R,K,_,N,j)}}return L?(j||(j=new e),s(b,S,_,N,C,j)):!1}return jm=E,jm}var Tm,_S;function kR(){if(_S)return Tm;_S=1;var e=R6(),t=Tr();function n(s,i,a,l,u){return s===i?!0:s==null||i==null||!t(s)&&!t(i)?s!==s&&i!==i:e(s,i,a,l,n,u)}return Tm=n,Tm}var Rm,SS;function A6(){if(SS)return Rm;SS=1;var e=nd(),t=kR(),n=1,s=2;function i(a,l,u,h){var p=u.length,f=p,g=!h;if(a==null)return!f;for(a=Object(a);p--;){var v=u[p];if(g&&v[2]?v[1]!==a[v[0]]:!(v[0]in a))return!1}for(;++p<f;){v=u[p];var w=v[0],E=a[w],b=v[1];if(g&&v[2]){if(E===void 0&&!(w in a))return!1}else{var S=new e;if(h)var _=h(E,b,w,a,l,S);if(!(_===void 0?t(b,E,n|s,h,S):_))return!1}}return!0}return Rm=i,Rm}var Am,NS;function _R(){if(NS)return Am;NS=1;var e=Fn();function t(n){return n===n&&!e(n)}return Am=t,Am}var Mm,ES;function M6(){if(ES)return Mm;ES=1;var e=_R(),t=Ls();function n(s){for(var i=t(s),a=i.length;a--;){var l=i[a],u=s[l];i[a]=[l,u,e(u)]}return i}return Mm=n,Mm}var Im,CS;function SR(){if(CS)return Im;CS=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return Im=e,Im}var Om,jS;function I6(){if(jS)return Om;jS=1;var e=A6(),t=M6(),n=SR();function s(i){var a=t(i);return a.length==1&&a[0][2]?n(a[0][0],a[0][1]):function(l){return l===i||e(l,i,a)}}return Om=s,Om}var Pm,TS;function ra(){if(TS)return Pm;TS=1;var e=Co(),t=Tr(),n="[object Symbol]";function s(i){return typeof i=="symbol"||t(i)&&e(i)==n}return Pm=s,Pm}var $m,RS;function s0(){if(RS)return $m;RS=1;var e=It(),t=ra(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function i(a,l){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:s.test(a)||!n.test(a)||l!=null&&a in Object(l)}return $m=i,$m}var Lm,AS;function O6(){if(AS)return Lm;AS=1;var e=Gw(),t="Expected a function";function n(s,i){if(typeof s!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var l=arguments,u=i?i.apply(this,l):l[0],h=a.cache;if(h.has(u))return h.get(u);var p=s.apply(this,l);return a.cache=h.set(u,p)||h,p};return a.cache=new(n.Cache||e),a}return n.Cache=e,Lm=n,Lm}var qm,MS;function P6(){if(MS)return qm;MS=1;var e=O6(),t=500;function n(s){var i=e(s,function(l){return a.size===t&&a.clear(),l}),a=i.cache;return i}return qm=n,qm}var Dm,IS;function $6(){if(IS)return Dm;IS=1;var e=P6(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,s=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(l,u,h,p){a.push(h?p.replace(n,"$1"):u||l)}),a});return Dm=s,Dm}var Fm,OS;function ud(){if(OS)return Fm;OS=1;function e(t,n){for(var s=-1,i=t==null?0:t.length,a=Array(i);++s<i;)a[s]=n(t[s],s,t);return a}return Fm=e,Fm}var zm,PS;function L6(){if(PS)return zm;PS=1;var e=ea(),t=ud(),n=It(),s=ra(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function l(u){if(typeof u=="string")return u;if(n(u))return t(u,l)+"";if(s(u))return a?a.call(u):"";var h=u+"";return h=="0"&&1/u==-1/0?"-0":h}return zm=l,zm}var Bm,$S;function NR(){if($S)return Bm;$S=1;var e=L6();function t(n){return n==null?"":e(n)}return Bm=t,Bm}var Um,LS;function dd(){if(LS)return Um;LS=1;var e=It(),t=s0(),n=$6(),s=NR();function i(a,l){return e(a)?a:t(a,l)?[a]:n(s(a))}return Um=i,Um}var Wm,qS;function Fl(){if(qS)return Wm;qS=1;var e=ra();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return Wm=t,Wm}var Hm,DS;function fd(){if(DS)return Hm;DS=1;var e=dd(),t=Fl();function n(s,i){i=e(i,s);for(var a=0,l=i.length;s!=null&&a<l;)s=s[t(i[a++])];return a&&a==l?s:void 0}return Hm=n,Hm}var Gm,FS;function q6(){if(FS)return Gm;FS=1;var e=fd();function t(n,s,i){var a=n==null?void 0:e(n,s);return a===void 0?i:a}return Gm=t,Gm}var Vm,zS;function D6(){if(zS)return Vm;zS=1;function e(t,n){return t!=null&&n in Object(t)}return Vm=e,Vm}var Ym,BS;function ER(){if(BS)return Ym;BS=1;var e=dd(),t=ql(),n=It(),s=od(),i=Yw(),a=Fl();function l(u,h,p){h=e(h,u);for(var f=-1,g=h.length,v=!1;++f<g;){var w=a(h[f]);if(!(v=u!=null&&p(u,w)))break;u=u[w]}return v||++f!=g?v:(g=u==null?0:u.length,!!g&&i(g)&&s(w,g)&&(n(u)||t(u)))}return Ym=l,Ym}var Km,US;function CR(){if(US)return Km;US=1;var e=D6(),t=ER();function n(s,i){return s!=null&&t(s,i,e)}return Km=n,Km}var Xm,WS;function F6(){if(WS)return Xm;WS=1;var e=kR(),t=q6(),n=CR(),s=s0(),i=_R(),a=SR(),l=Fl(),u=1,h=2;function p(f,g){return s(f)&&i(g)?a(l(f),g):function(v){var w=t(v,f);return w===void 0&&w===g?n(v,f):e(g,w,u|h)}}return Xm=p,Xm}var Qm,HS;function jR(){if(HS)return Qm;HS=1;function e(t){return function(n){return n==null?void 0:n[t]}}return Qm=e,Qm}var Zm,GS;function z6(){if(GS)return Zm;GS=1;var e=fd();function t(n){return function(s){return e(s,n)}}return Zm=t,Zm}var Jm,VS;function B6(){if(VS)return Jm;VS=1;var e=jR(),t=z6(),n=s0(),s=Fl();function i(a){return n(a)?e(s(a)):t(a)}return Jm=i,Jm}var eg,YS;function rs(){if(YS)return eg;YS=1;var e=I6(),t=F6(),n=Ro(),s=It(),i=B6();function a(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?s(l)?t(l[0],l[1]):e(l):i(l)}return eg=a,eg}var tg,KS;function TR(){if(KS)return tg;KS=1;var e=oR(),t=_6(),n=rs(),s=It();function i(a,l){var u=s(a)?e:t;return u(a,n(l,3))}return tg=i,tg}var ng,XS;function U6(){if(XS)return ng;XS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,i){return s!=null&&t.call(s,i)}return ng=n,ng}var rg,QS;function RR(){if(QS)return rg;QS=1;var e=U6(),t=ER();function n(s,i){return s!=null&&t(s,i,e)}return rg=n,rg}var sg,ZS;function W6(){if(ZS)return sg;ZS=1;var e=Xw(),t=na(),n=ql(),s=It(),i=ns(),a=ta(),l=ad(),u=Dl(),h="[object Map]",p="[object Set]",f=Object.prototype,g=f.hasOwnProperty;function v(w){if(w==null)return!0;if(i(w)&&(s(w)||typeof w=="string"||typeof w.splice=="function"||a(w)||u(w)||n(w)))return!w.length;var E=t(w);if(E==h||E==p)return!w.size;if(l(w))return!e(w).length;for(var b in w)if(g.call(w,b))return!1;return!0}return sg=v,sg}var og,JS;function AR(){if(JS)return og;JS=1;function e(t){return t===void 0}return og=e,og}var ig,eN;function MR(){if(eN)return ig;eN=1;var e=cd(),t=ns();function n(s,i){var a=-1,l=t(s)?Array(s.length):[];return e(s,function(u,h,p){l[++a]=i(u,h,p)}),l}return ig=n,ig}var ag,tN;function IR(){if(tN)return ag;tN=1;var e=ud(),t=rs(),n=MR(),s=It();function i(a,l){var u=s(a)?e:n;return u(a,t(l,3))}return ag=i,ag}var lg,nN;function H6(){if(nN)return lg;nN=1;function e(t,n,s,i){var a=-1,l=t==null?0:t.length;for(i&&l&&(s=t[++a]);++a<l;)s=n(s,t[a],a,t);return s}return lg=e,lg}var cg,rN;function G6(){if(rN)return cg;rN=1;function e(t,n,s,i,a){return a(t,function(l,u,h){s=i?(i=!1,l):n(s,l,u,h)}),s}return cg=e,cg}var ug,sN;function OR(){if(sN)return ug;sN=1;var e=H6(),t=cd(),n=rs(),s=G6(),i=It();function a(l,u,h){var p=i(l)?e:s,f=arguments.length<3;return p(l,n(u,4),h,f,t)}return ug=a,ug}var dg,oN;function V6(){if(oN)return dg;oN=1;var e=Co(),t=It(),n=Tr(),s="[object String]";function i(a){return typeof a=="string"||!t(a)&&n(a)&&e(a)==s}return dg=i,dg}var fg,iN;function Y6(){if(iN)return fg;iN=1;var e=jR(),t=e("length");return fg=t,fg}var hg,aN;function K6(){if(aN)return hg;aN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",i=t+n+s,a="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+i+a+"]");function h(p){return u.test(p)}return hg=h,hg}var pg,lN;function X6(){if(lN)return pg;lN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",i=t+n+s,a="\\ufe0e\\ufe0f",l="["+e+"]",u="["+i+"]",h="\\ud83c[\\udffb-\\udfff]",p="(?:"+u+"|"+h+")",f="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",v="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",E=p+"?",b="["+a+"]?",S="(?:"+w+"(?:"+[f,g,v].join("|")+")"+b+E+")*",_=b+E+S,N="(?:"+[f+u+"?",u,g,v,l].join("|")+")",C=RegExp(h+"(?="+h+")|"+N+_,"g");function j(M){for(var P=C.lastIndex=0;C.test(M);)++P;return P}return pg=j,pg}var mg,cN;function Q6(){if(cN)return mg;cN=1;var e=Y6(),t=K6(),n=X6();function s(i){return t(i)?n(i):e(i)}return mg=s,mg}var gg,uN;function Z6(){if(uN)return gg;uN=1;var e=Xw(),t=na(),n=ns(),s=V6(),i=Q6(),a="[object Map]",l="[object Set]";function u(h){if(h==null)return 0;if(n(h))return s(h)?i(h):h.length;var p=t(h);return p==a||p==l?h.size:e(h).length}return gg=u,gg}var yg,dN;function J6(){if(dN)return yg;dN=1;var e=Vw(),t=hR(),n=n0(),s=rs(),i=ld(),a=It(),l=ta(),u=$l(),h=Fn(),p=Dl();function f(g,v,w){var E=a(g),b=E||l(g)||p(g);if(v=s(v,4),w==null){var S=g&&g.constructor;b?w=E?new S:[]:h(g)?w=u(S)?t(i(g)):{}:w={}}return(b?e:n)(g,function(_,N,C){return v(w,_,N,C)}),w}return yg=f,yg}var vg,fN;function ez(){if(fN)return vg;fN=1;var e=ea(),t=ql(),n=It(),s=e?e.isConcatSpreadable:void 0;function i(a){return n(a)||t(a)||!!(s&&a&&a[s])}return vg=i,vg}var wg,hN;function o0(){if(hN)return wg;hN=1;var e=Zw(),t=ez();function n(s,i,a,l,u){var h=-1,p=s.length;for(a||(a=t),u||(u=[]);++h<p;){var f=s[h];i>0&&a(f)?i>1?n(f,i-1,a,l,u):e(u,f):l||(u[u.length]=f)}return u}return wg=n,wg}var xg,pN;function tz(){if(pN)return xg;pN=1;function e(t,n,s){switch(s.length){case 0:return t.call(n);case 1:return t.call(n,s[0]);case 2:return t.call(n,s[0],s[1]);case 3:return t.call(n,s[0],s[1],s[2])}return t.apply(n,s)}return xg=e,xg}var bg,mN;function PR(){if(mN)return bg;mN=1;var e=tz(),t=Math.max;function n(s,i,a){return i=t(i===void 0?s.length-1:i,0),function(){for(var l=arguments,u=-1,h=t(l.length-i,0),p=Array(h);++u<h;)p[u]=l[i+u];u=-1;for(var f=Array(i+1);++u<i;)f[u]=l[u];return f[i]=a(p),e(s,this,f)}}return bg=n,bg}var kg,gN;function nz(){if(gN)return kg;gN=1;var e=e0(),t=eR(),n=Ro(),s=t?function(i,a){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:n;return kg=s,kg}var _g,yN;function rz(){if(yN)return _g;yN=1;var e=800,t=16,n=Date.now;function s(i){var a=0,l=0;return function(){var u=n(),h=t-(u-l);if(l=u,h>0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return _g=s,_g}var Sg,vN;function $R(){if(vN)return Sg;vN=1;var e=nz(),t=rz(),n=t(e);return Sg=n,Sg}var Ng,wN;function hd(){if(wN)return Ng;wN=1;var e=Ro(),t=PR(),n=$R();function s(i,a){return n(t(i,a,e),i+"")}return Ng=s,Ng}var Eg,xN;function LR(){if(xN)return Eg;xN=1;function e(t,n,s,i){for(var a=t.length,l=s+(i?1:-1);i?l--:++l<a;)if(n(t[l],l,t))return l;return-1}return Eg=e,Eg}var Cg,bN;function sz(){if(bN)return Cg;bN=1;function e(t){return t!==t}return Cg=e,Cg}var jg,kN;function oz(){if(kN)return jg;kN=1;function e(t,n,s){for(var i=s-1,a=t.length;++i<a;)if(t[i]===n)return i;return-1}return jg=e,jg}var Tg,_N;function iz(){if(_N)return Tg;_N=1;var e=LR(),t=sz(),n=oz();function s(i,a,l){return a===a?n(i,a,l):e(i,t,l)}return Tg=s,Tg}var Rg,SN;function az(){if(SN)return Rg;SN=1;var e=iz();function t(n,s){var i=n==null?0:n.length;return!!i&&e(n,s,0)>-1}return Rg=t,Rg}var Ag,NN;function lz(){if(NN)return Ag;NN=1;function e(t,n,s){for(var i=-1,a=t==null?0:t.length;++i<a;)if(s(n,t[i]))return!0;return!1}return Ag=e,Ag}var Mg,EN;function cz(){if(EN)return Mg;EN=1;function e(){}return Mg=e,Mg}var Ig,CN;function uz(){if(CN)return Ig;CN=1;var e=uR(),t=cz(),n=r0(),s=1/0,i=e&&1/n(new e([,-0]))[1]==s?function(a){return new e(a)}:t;return Ig=i,Ig}var Og,jN;function dz(){if(jN)return Og;jN=1;var e=wR(),t=az(),n=lz(),s=xR(),i=uz(),a=r0(),l=200;function u(h,p,f){var g=-1,v=t,w=h.length,E=!0,b=[],S=b;if(f)E=!1,v=n;else if(w>=l){var _=p?null:i(h);if(_)return a(_);E=!1,v=s,S=new e}else S=p?[]:b;e:for(;++g<w;){var N=h[g],C=p?p(N):N;if(N=f||N!==0?N:0,E&&C===C){for(var j=S.length;j--;)if(S[j]===C)continue e;p&&S.push(C),b.push(N)}else v(S,C,f)||(S!==b&&S.push(C),b.push(N))}return b}return Og=u,Og}var Pg,TN;function qR(){if(TN)return Pg;TN=1;var e=ns(),t=Tr();function n(s){return t(s)&&e(s)}return Pg=n,Pg}var $g,RN;function fz(){if(RN)return $g;RN=1;var e=o0(),t=hd(),n=dz(),s=qR(),i=t(function(a){return n(e(a,1,s,!0))});return $g=i,$g}var Lg,AN;function hz(){if(AN)return Lg;AN=1;var e=ud();function t(n,s){return e(s,function(i){return n[i]})}return Lg=t,Lg}var qg,MN;function DR(){if(MN)return qg;MN=1;var e=hz(),t=Ls();function n(s){return s==null?[]:e(s,t(s))}return qg=n,qg}var Dg,IN;function zn(){if(IN)return Dg;IN=1;var e;if(typeof Ww=="function")try{e={clone:x6(),constant:e0(),each:vR(),filter:TR(),has:RR(),isArray:It(),isEmpty:W6(),isFunction:$l(),isUndefined:AR(),keys:Ls(),map:IR(),reduce:OR(),size:Z6(),transform:J6(),union:fz(),values:DR()}}catch{}return e||(e=window._),Dg=e,Dg}var Fg,ON;function i0(){if(ON)return Fg;ON=1;var e=zn();Fg=i;var t="\0",n="\0",s="";function i(f){this._isDirected=e.has(f,"directed")?f.directed:!0,this._isMultigraph=e.has(f,"multigraph")?f.multigraph:!1,this._isCompound=e.has(f,"compound")?f.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(f){return this._label=f,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultNodeLabelFn=f,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return e.keys(this._nodes)},i.prototype.sources=function(){var f=this;return e.filter(this.nodes(),function(g){return e.isEmpty(f._in[g])})},i.prototype.sinks=function(){var f=this;return e.filter(this.nodes(),function(g){return e.isEmpty(f._out[g])})},i.prototype.setNodes=function(f,g){var v=arguments,w=this;return e.each(f,function(E){v.length>1?w.setNode(E,g):w.setNode(E)}),this},i.prototype.setNode=function(f,g){return e.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=g),this):(this._nodes[f]=arguments.length>1?g:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=n,this._children[f]={},this._children[n][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},i.prototype.node=function(f){return this._nodes[f]},i.prototype.hasNode=function(f){return e.has(this._nodes,f)},i.prototype.removeNode=function(f){var g=this;if(e.has(this._nodes,f)){var v=function(w){g.removeEdge(g._edgeObjs[w])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],e.each(this.children(f),function(w){g.setParent(w)}),delete this._children[f]),e.each(e.keys(this._in[f]),v),delete this._in[f],delete this._preds[f],e.each(e.keys(this._out[f]),v),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},i.prototype.setParent=function(f,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(g))g=n;else{g+="";for(var v=g;!e.isUndefined(v);v=this.parent(v))if(v===f)throw new Error("Setting "+g+" as parent of "+f+" would create a cycle");this.setNode(g)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=g,this._children[g][f]=!0,this},i.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},i.prototype.parent=function(f){if(this._isCompound){var g=this._parent[f];if(g!==n)return g}},i.prototype.children=function(f){if(e.isUndefined(f)&&(f=n),this._isCompound){var g=this._children[f];if(g)return e.keys(g)}else{if(f===n)return this.nodes();if(this.hasNode(f))return[]}},i.prototype.predecessors=function(f){var g=this._preds[f];if(g)return e.keys(g)},i.prototype.successors=function(f){var g=this._sucs[f];if(g)return e.keys(g)},i.prototype.neighbors=function(f){var g=this.predecessors(f);if(g)return e.union(g,this.successors(f))},i.prototype.isLeaf=function(f){var g;return this.isDirected()?g=this.successors(f):g=this.neighbors(f),g.length===0},i.prototype.filterNodes=function(f){var g=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});g.setGraph(this.graph());var v=this;e.each(this._nodes,function(b,S){f(S)&&g.setNode(S,b)}),e.each(this._edgeObjs,function(b){g.hasNode(b.v)&&g.hasNode(b.w)&&g.setEdge(b,v.edge(b))});var w={};function E(b){var S=v.parent(b);return S===void 0||g.hasNode(S)?(w[b]=S,S):S in w?w[S]:E(S)}return this._isCompound&&e.each(g.nodes(),function(b){g.setParent(b,E(b))}),g},i.prototype.setDefaultEdgeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultEdgeLabelFn=f,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(f,g){var v=this,w=arguments;return e.reduce(f,function(E,b){return w.length>1?v.setEdge(E,b,g):v.setEdge(E,b),b}),this},i.prototype.setEdge=function(){var f,g,v,w,E=!1,b=arguments[0];typeof b=="object"&&b!==null&&"v"in b?(f=b.v,g=b.w,v=b.name,arguments.length===2&&(w=arguments[1],E=!0)):(f=b,g=arguments[1],v=arguments[3],arguments.length>2&&(w=arguments[2],E=!0)),f=""+f,g=""+g,e.isUndefined(v)||(v=""+v);var S=u(this._isDirected,f,g,v);if(e.has(this._edgeLabels,S))return E&&(this._edgeLabels[S]=w),this;if(!e.isUndefined(v)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(g),this._edgeLabels[S]=E?w:this._defaultEdgeLabelFn(f,g,v);var _=h(this._isDirected,f,g,v);return f=_.v,g=_.w,Object.freeze(_),this._edgeObjs[S]=_,a(this._preds[g],f),a(this._sucs[f],g),this._in[g][S]=_,this._out[f][S]=_,this._edgeCount++,this},i.prototype.edge=function(f,g,v){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,v);return this._edgeLabels[w]},i.prototype.hasEdge=function(f,g,v){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,v);return e.has(this._edgeLabels,w)},i.prototype.removeEdge=function(f,g,v){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,v),E=this._edgeObjs[w];return E&&(f=E.v,g=E.w,delete this._edgeLabels[w],delete this._edgeObjs[w],l(this._preds[g],f),l(this._sucs[f],g),delete this._in[g][w],delete this._out[f][w],this._edgeCount--),this},i.prototype.inEdges=function(f,g){var v=this._in[f];if(v){var w=e.values(v);return g?e.filter(w,function(E){return E.v===g}):w}},i.prototype.outEdges=function(f,g){var v=this._out[f];if(v){var w=e.values(v);return g?e.filter(w,function(E){return E.w===g}):w}},i.prototype.nodeEdges=function(f,g){var v=this.inEdges(f,g);if(v)return v.concat(this.outEdges(f,g))};function a(f,g){f[g]?f[g]++:f[g]=1}function l(f,g){--f[g]||delete f[g]}function u(f,g,v,w){var E=""+g,b=""+v;if(!f&&E>b){var S=E;E=b,b=S}return E+s+b+s+(e.isUndefined(w)?t:w)}function h(f,g,v,w){var E=""+g,b=""+v;if(!f&&E>b){var S=E;E=b,b=S}var _={v:E,w:b};return w&&(_.name=w),_}function p(f,g){return u(f,g.v,g.w,g.name)}return Fg}var zg,PN;function pz(){return PN||(PN=1,zg="2.1.8"),zg}var Bg,$N;function mz(){return $N||($N=1,Bg={Graph:i0(),version:pz()}),Bg}var Ug,LN;function gz(){if(LN)return Ug;LN=1;var e=zn(),t=i0();Ug={write:n,read:a};function n(l){var u={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:s(l),edges:i(l)};return e.isUndefined(l.graph())||(u.value=e.clone(l.graph())),u}function s(l){return e.map(l.nodes(),function(u){var h=l.node(u),p=l.parent(u),f={v:u};return e.isUndefined(h)||(f.value=h),e.isUndefined(p)||(f.parent=p),f})}function i(l){return e.map(l.edges(),function(u){var h=l.edge(u),p={v:u.v,w:u.w};return e.isUndefined(u.name)||(p.name=u.name),e.isUndefined(h)||(p.value=h),p})}function a(l){var u=new t(l.options).setGraph(l.value);return e.each(l.nodes,function(h){u.setNode(h.v,h.value),h.parent&&u.setParent(h.v,h.parent)}),e.each(l.edges,function(h){u.setEdge({v:h.v,w:h.w,name:h.name},h.value)}),u}return Ug}var Wg,qN;function yz(){if(qN)return Wg;qN=1;var e=zn();Wg=t;function t(n){var s={},i=[],a;function l(u){e.has(s,u)||(s[u]=!0,a.push(u),e.each(n.successors(u),l),e.each(n.predecessors(u),l))}return e.each(n.nodes(),function(u){a=[],l(u),a.length&&i.push(a)}),i}return Wg}var Hg,DN;function FR(){if(DN)return Hg;DN=1;var e=zn();Hg=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var s=this._keyIndices[n];if(s!==void 0)return this._arr[s].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,s){var i=this._keyIndices;if(n=String(n),!e.has(i,n)){var a=this._arr,l=a.length;return i[n]=l,a.push({key:n,priority:s}),this._decrease(l),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,s){var i=this._keyIndices[n];if(s>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[i].priority+" New: "+s);this._arr[i].priority=s,this._decrease(i)},t.prototype._heapify=function(n){var s=this._arr,i=2*n,a=i+1,l=n;i<s.length&&(l=s[i].priority<s[l].priority?i:l,a<s.length&&(l=s[a].priority<s[l].priority?a:l),l!==n&&(this._swap(n,l),this._heapify(l)))},t.prototype._decrease=function(n){for(var s=this._arr,i=s[n].priority,a;n!==0&&(a=n>>1,!(s[a].priority<i));)this._swap(n,a),n=a},t.prototype._swap=function(n,s){var i=this._arr,a=this._keyIndices,l=i[n],u=i[s];i[n]=u,i[s]=l,a[u.key]=n,a[l.key]=s},Hg}var Gg,FN;function zR(){if(FN)return Gg;FN=1;var e=zn(),t=FR();Gg=s;var n=e.constant(1);function s(a,l,u,h){return i(a,String(l),u||n,h||function(p){return a.outEdges(p)})}function i(a,l,u,h){var p={},f=new t,g,v,w=function(E){var b=E.v!==g?E.v:E.w,S=p[b],_=u(E),N=v.distance+_;if(_<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+E+" Weight: "+_);N<S.distance&&(S.distance=N,S.predecessor=g,f.decrease(b,N))};for(a.nodes().forEach(function(E){var b=E===l?0:Number.POSITIVE_INFINITY;p[E]={distance:b},f.add(E,b)});f.size()>0&&(g=f.removeMin(),v=p[g],v.distance!==Number.POSITIVE_INFINITY);)h(g).forEach(w);return p}return Gg}var Vg,zN;function vz(){if(zN)return Vg;zN=1;var e=zR(),t=zn();Vg=n;function n(s,i,a){return t.transform(s.nodes(),function(l,u){l[u]=e(s,u,i,a)},{})}return Vg}var Yg,BN;function BR(){if(BN)return Yg;BN=1;var e=zn();Yg=t;function t(n){var s=0,i=[],a={},l=[];function u(h){var p=a[h]={onStack:!0,lowlink:s,index:s++};if(i.push(h),n.successors(h).forEach(function(v){e.has(a,v)?a[v].onStack&&(p.lowlink=Math.min(p.lowlink,a[v].index)):(u(v),p.lowlink=Math.min(p.lowlink,a[v].lowlink))}),p.lowlink===p.index){var f=[],g;do g=i.pop(),a[g].onStack=!1,f.push(g);while(h!==g);l.push(f)}}return n.nodes().forEach(function(h){e.has(a,h)||u(h)}),l}return Yg}var Kg,UN;function wz(){if(UN)return Kg;UN=1;var e=zn(),t=BR();Kg=n;function n(s){return e.filter(t(s),function(i){return i.length>1||i.length===1&&s.hasEdge(i[0],i[0])})}return Kg}var Xg,WN;function xz(){if(WN)return Xg;WN=1;var e=zn();Xg=n;var t=e.constant(1);function n(i,a,l){return s(i,a||t,l||function(u){return i.outEdges(u)})}function s(i,a,l){var u={},h=i.nodes();return h.forEach(function(p){u[p]={},u[p][p]={distance:0},h.forEach(function(f){p!==f&&(u[p][f]={distance:Number.POSITIVE_INFINITY})}),l(p).forEach(function(f){var g=f.v===p?f.w:f.v,v=a(f);u[p][g]={distance:v,predecessor:p}})}),h.forEach(function(p){var f=u[p];h.forEach(function(g){var v=u[g];h.forEach(function(w){var E=v[p],b=f[w],S=v[w],_=E.distance+b.distance;_<S.distance&&(S.distance=_,S.predecessor=b.predecessor)})})}),u}return Xg}var Qg,HN;function UR(){if(HN)return Qg;HN=1;var e=zn();Qg=t,t.CycleException=n;function t(s){var i={},a={},l=[];function u(h){if(e.has(a,h))throw new n;e.has(i,h)||(a[h]=!0,i[h]=!0,e.each(s.predecessors(h),u),delete a[h],l.push(h))}if(e.each(s.sinks(),u),e.size(i)!==s.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,Qg}var Zg,GN;function bz(){if(GN)return Zg;GN=1;var e=UR();Zg=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return Zg}var Jg,VN;function WR(){if(VN)return Jg;VN=1;var e=zn();Jg=t;function t(s,i,a){e.isArray(i)||(i=[i]);var l=(s.isDirected()?s.successors:s.neighbors).bind(s),u=[],h={};return e.each(i,function(p){if(!s.hasNode(p))throw new Error("Graph does not have node: "+p);n(s,p,a==="post",h,l,u)}),u}function n(s,i,a,l,u,h){e.has(l,i)||(l[i]=!0,a||h.push(i),e.each(u(i),function(p){n(s,p,a,l,u,h)}),a&&h.push(i))}return Jg}var ey,YN;function kz(){if(YN)return ey;YN=1;var e=WR();ey=t;function t(n,s){return e(n,s,"post")}return ey}var ty,KN;function _z(){if(KN)return ty;KN=1;var e=WR();ty=t;function t(n,s){return e(n,s,"pre")}return ty}var ny,XN;function Sz(){if(XN)return ny;XN=1;var e=zn(),t=i0(),n=FR();ny=s;function s(i,a){var l=new t,u={},h=new n,p;function f(v){var w=v.v===p?v.w:v.v,E=h.priority(w);if(E!==void 0){var b=a(v);b<E&&(u[w]=p,h.decrease(w,b))}}if(i.nodeCount()===0)return l;e.each(i.nodes(),function(v){h.add(v,Number.POSITIVE_INFINITY),l.setNode(v)}),h.decrease(i.nodes()[0],0);for(var g=!1;h.size()>0;){if(p=h.removeMin(),e.has(u,p))l.setEdge(p,u[p]);else{if(g)throw new Error("Input graph is not connected: "+i);g=!0}i.nodeEdges(p).forEach(f)}return l}return ny}var ry,QN;function Nz(){return QN||(QN=1,ry={components:yz(),dijkstra:zR(),dijkstraAll:vz(),findCycles:wz(),floydWarshall:xz(),isAcyclic:bz(),postorder:kz(),preorder:_z(),prim:Sz(),tarjan:BR(),topsort:UR()}),ry}var sy,ZN;function Ez(){if(ZN)return sy;ZN=1;var e=mz();return sy={Graph:e.Graph,json:gz(),alg:Nz(),version:e.version},sy}var oy,JN;function dr(){if(JN)return oy;JN=1;var e;if(typeof Ww=="function")try{e=Ez()}catch{}return e||(e=window.graphlib),oy=e,oy}var iy,eE;function Cz(){if(eE)return iy;eE=1;var e=mR(),t=1,n=4;function s(i){return e(i,t|n)}return iy=s,iy}var ay,tE;function pd(){if(tE)return ay;tE=1;var e=Ji(),t=ns(),n=od(),s=Fn();function i(a,l,u){if(!s(u))return!1;var h=typeof l;return(h=="number"?t(u)&&n(l,u.length):h=="string"&&l in u)?e(u[l],a):!1}return ay=i,ay}var ly,nE;function jz(){if(nE)return ly;nE=1;var e=hd(),t=Ji(),n=pd(),s=To(),i=Object.prototype,a=i.hasOwnProperty,l=e(function(u,h){u=Object(u);var p=-1,f=h.length,g=f>2?h[2]:void 0;for(g&&n(h[0],h[1],g)&&(f=1);++p<f;)for(var v=h[p],w=s(v),E=-1,b=w.length;++E<b;){var S=w[E],_=u[S];(_===void 0||t(_,i[S])&&!a.call(u,S))&&(u[S]=v[S])}return u});return ly=l,ly}var cy,rE;function Tz(){if(rE)return cy;rE=1;var e=rs(),t=ns(),n=Ls();function s(i){return function(a,l,u){var h=Object(a);if(!t(a)){var p=e(l,3);a=n(a),l=function(g){return p(h[g],g,h)}}var f=i(a,l,u);return f>-1?h[p?a[f]:f]:void 0}}return cy=s,cy}var uy,sE;function Rz(){if(sE)return uy;sE=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return uy=t,uy}var dy,oE;function Az(){if(oE)return dy;oE=1;var e=Rz(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return dy=n,dy}var fy,iE;function Mz(){if(iE)return fy;iE=1;var e=Az(),t=Fn(),n=ra(),s=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function h(p){if(typeof p=="number")return p;if(n(p))return s;if(t(p)){var f=typeof p.valueOf=="function"?p.valueOf():p;p=t(f)?f+"":f}if(typeof p!="string")return p===0?p:+p;p=e(p);var g=a.test(p);return g||l.test(p)?u(p.slice(2),g?2:8):i.test(p)?s:+p}return fy=h,fy}var hy,aE;function HR(){if(aE)return hy;aE=1;var e=Mz(),t=1/0,n=17976931348623157e292;function s(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var a=i<0?-1:1;return a*n}return i===i?i:0}return hy=s,hy}var py,lE;function Iz(){if(lE)return py;lE=1;var e=HR();function t(n){var s=e(n),i=s%1;return s===s?i?s-i:s:0}return py=t,py}var my,cE;function Oz(){if(cE)return my;cE=1;var e=LR(),t=rs(),n=Iz(),s=Math.max;function i(a,l,u){var h=a==null?0:a.length;if(!h)return-1;var p=u==null?0:n(u);return p<0&&(p=s(h+p,0)),e(a,t(l,3),p)}return my=i,my}var gy,uE;function Pz(){if(uE)return gy;uE=1;var e=Tz(),t=Oz(),n=e(t);return gy=n,gy}var yy,dE;function GR(){if(dE)return yy;dE=1;var e=o0();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return yy=t,yy}var vy,fE;function $z(){if(fE)return vy;fE=1;var e=t0(),t=gR(),n=To();function s(i,a){return i==null?i:e(i,t(a),n)}return vy=s,vy}var wy,hE;function Lz(){if(hE)return wy;hE=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return wy=e,wy}var xy,pE;function qz(){if(pE)return xy;pE=1;var e=rd(),t=n0(),n=rs();function s(i,a){var l={};return a=n(a,3),t(i,function(u,h,p){e(l,h,a(u,h,p))}),l}return xy=s,xy}var by,mE;function a0(){if(mE)return by;mE=1;var e=ra();function t(n,s,i){for(var a=-1,l=n.length;++a<l;){var u=n[a],h=s(u);if(h!=null&&(p===void 0?h===h&&!e(h):i(h,p)))var p=h,f=u}return f}return by=t,by}var ky,gE;function Dz(){if(gE)return ky;gE=1;function e(t,n){return t>n}return ky=e,ky}var _y,yE;function Fz(){if(yE)return _y;yE=1;var e=a0(),t=Dz(),n=Ro();function s(i){return i&&i.length?e(i,n,t):void 0}return _y=s,_y}var Sy,vE;function VR(){if(vE)return Sy;vE=1;var e=rd(),t=Ji();function n(s,i,a){(a!==void 0&&!t(s[i],a)||a===void 0&&!(i in s))&&e(s,i,a)}return Sy=n,Sy}var Ny,wE;function zz(){if(wE)return Ny;wE=1;var e=Co(),t=ld(),n=Tr(),s="[object Object]",i=Function.prototype,a=Object.prototype,l=i.toString,u=a.hasOwnProperty,h=l.call(Object);function p(f){if(!n(f)||e(f)!=s)return!1;var g=t(f);if(g===null)return!0;var v=u.call(g,"constructor")&&g.constructor;return typeof v=="function"&&v instanceof v&&l.call(v)==h}return Ny=p,Ny}var Ey,xE;function YR(){if(xE)return Ey;xE=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return Ey=e,Ey}var Cy,bE;function Bz(){if(bE)return Cy;bE=1;var e=Ll(),t=To();function n(s){return e(s,t(s))}return Cy=n,Cy}var jy,kE;function Uz(){if(kE)return jy;kE=1;var e=VR(),t=rR(),n=fR(),s=sR(),i=pR(),a=ql(),l=It(),u=qR(),h=ta(),p=$l(),f=Fn(),g=zz(),v=Dl(),w=YR(),E=Bz();function b(S,_,N,C,j,M,P){var I=w(S,N),F=w(_,N),O=P.get(F);if(O){e(S,N,O);return}var A=M?M(I,F,N+"",S,_,P):void 0,L=A===void 0;if(L){var H=l(F),X=!H&&h(F),R=!H&&!X&&v(F);A=F,H||X||R?l(I)?A=I:u(I)?A=s(I):X?(L=!1,A=t(F,!0)):R?(L=!1,A=n(F,!0)):A=[]:g(F)||a(F)?(A=I,a(I)?A=E(I):(!f(I)||p(I))&&(A=i(F))):L=!1}L&&(P.set(F,A),j(A,F,C,M,P),P.delete(F)),e(S,N,A)}return jy=b,jy}var Ty,_E;function Wz(){if(_E)return Ty;_E=1;var e=nd(),t=VR(),n=t0(),s=Uz(),i=Fn(),a=To(),l=YR();function u(h,p,f,g,v){h!==p&&n(p,function(w,E){if(v||(v=new e),i(w))s(h,p,E,f,u,g,v);else{var b=g?g(l(h,E),w,E+"",h,p,v):void 0;b===void 0&&(b=w),t(h,E,b)}},a)}return Ty=u,Ty}var Ry,SE;function Hz(){if(SE)return Ry;SE=1;var e=hd(),t=pd();function n(s){return e(function(i,a){var l=-1,u=a.length,h=u>1?a[u-1]:void 0,p=u>2?a[2]:void 0;for(h=s.length>3&&typeof h=="function"?(u--,h):void 0,p&&t(a[0],a[1],p)&&(h=u<3?void 0:h,u=1),i=Object(i);++l<u;){var f=a[l];f&&s(i,f,l,h)}return i})}return Ry=n,Ry}var Ay,NE;function Gz(){if(NE)return Ay;NE=1;var e=Wz(),t=Hz(),n=t(function(s,i,a){e(s,i,a)});return Ay=n,Ay}var My,EE;function KR(){if(EE)return My;EE=1;function e(t,n){return t<n}return My=e,My}var Iy,CE;function Vz(){if(CE)return Iy;CE=1;var e=a0(),t=KR(),n=Ro();function s(i){return i&&i.length?e(i,n,t):void 0}return Iy=s,Iy}var Oy,jE;function Yz(){if(jE)return Oy;jE=1;var e=a0(),t=rs(),n=KR();function s(i,a){return i&&i.length?e(i,t(a,2),n):void 0}return Oy=s,Oy}var Py,TE;function Kz(){if(TE)return Py;TE=1;var e=hr(),t=function(){return e.Date.now()};return Py=t,Py}var $y,RE;function Xz(){if(RE)return $y;RE=1;var e=sd(),t=dd(),n=od(),s=Fn(),i=Fl();function a(l,u,h,p){if(!s(l))return l;u=t(u,l);for(var f=-1,g=u.length,v=g-1,w=l;w!=null&&++f<g;){var E=i(u[f]),b=h;if(E==="__proto__"||E==="constructor"||E==="prototype")return l;if(f!=v){var S=w[E];b=p?p(S,E,w):void 0,b===void 0&&(b=s(S)?S:n(u[f+1])?[]:{})}e(w,E,b),w=w[E]}return l}return $y=a,$y}var Ly,AE;function Qz(){if(AE)return Ly;AE=1;var e=fd(),t=Xz(),n=dd();function s(i,a,l){for(var u=-1,h=a.length,p={};++u<h;){var f=a[u],g=e(i,f);l(g,f)&&t(p,n(f,i),g)}return p}return Ly=s,Ly}var qy,ME;function Zz(){if(ME)return qy;ME=1;var e=Qz(),t=CR();function n(s,i){return e(s,i,function(a,l){return t(s,l)})}return qy=n,qy}var Dy,IE;function Jz(){if(IE)return Dy;IE=1;var e=GR(),t=PR(),n=$R();function s(i){return n(t(i,void 0,e),i+"")}return Dy=s,Dy}var Fy,OE;function eB(){if(OE)return Fy;OE=1;var e=Zz(),t=Jz(),n=t(function(s,i){return s==null?{}:e(s,i)});return Fy=n,Fy}var zy,PE;function tB(){if(PE)return zy;PE=1;var e=Math.ceil,t=Math.max;function n(s,i,a,l){for(var u=-1,h=t(e((i-s)/(a||1)),0),p=Array(h);h--;)p[l?h:++u]=s,s+=a;return p}return zy=n,zy}var By,$E;function nB(){if($E)return By;$E=1;var e=tB(),t=pd(),n=HR();function s(i){return function(a,l,u){return u&&typeof u!="number"&&t(a,l,u)&&(l=u=void 0),a=n(a),l===void 0?(l=a,a=0):l=n(l),u=u===void 0?a<l?1:-1:n(u),e(a,l,u,i)}}return By=s,By}var Uy,LE;function rB(){if(LE)return Uy;LE=1;var e=nB(),t=e();return Uy=t,Uy}var Wy,qE;function sB(){if(qE)return Wy;qE=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return Wy=e,Wy}var Hy,DE;function oB(){if(DE)return Hy;DE=1;var e=ra();function t(n,s){if(n!==s){var i=n!==void 0,a=n===null,l=n===n,u=e(n),h=s!==void 0,p=s===null,f=s===s,g=e(s);if(!p&&!g&&!u&&n>s||u&&h&&f&&!p&&!g||a&&h&&f||!i&&f||!l)return 1;if(!a&&!u&&!g&&n<s||g&&i&&l&&!a&&!u||p&&i&&l||!h&&l||!f)return-1}return 0}return Hy=t,Hy}var Gy,FE;function iB(){if(FE)return Gy;FE=1;var e=oB();function t(n,s,i){for(var a=-1,l=n.criteria,u=s.criteria,h=l.length,p=i.length;++a<h;){var f=e(l[a],u[a]);if(f){if(a>=p)return f;var g=i[a];return f*(g=="desc"?-1:1)}}return n.index-s.index}return Gy=t,Gy}var Vy,zE;function aB(){if(zE)return Vy;zE=1;var e=ud(),t=fd(),n=rs(),s=MR(),i=sB(),a=id(),l=iB(),u=Ro(),h=It();function p(f,g,v){g.length?g=e(g,function(b){return h(b)?function(S){return t(S,b.length===1?b[0]:b)}:b}):g=[u];var w=-1;g=e(g,a(n));var E=s(f,function(b,S,_){var N=e(g,function(C){return C(b)});return{criteria:N,index:++w,value:b}});return i(E,function(b,S){return l(b,S,v)})}return Vy=p,Vy}var Yy,BE;function lB(){if(BE)return Yy;BE=1;var e=o0(),t=aB(),n=hd(),s=pd(),i=n(function(a,l){if(a==null)return[];var u=l.length;return u>1&&s(a,l[0],l[1])?l=[]:u>2&&s(l[0],l[1],l[2])&&(l=[l[0]]),t(a,e(l,1),[])});return Yy=i,Yy}var Ky,UE;function cB(){if(UE)return Ky;UE=1;var e=NR(),t=0;function n(s){var i=++t;return e(s)+i}return Ky=n,Ky}var Xy,WE;function uB(){if(WE)return Xy;WE=1;function e(t,n,s){for(var i=-1,a=t.length,l=n.length,u={};++i<a;){var h=i<l?n[i]:void 0;s(u,t[i],h)}return u}return Xy=e,Xy}var Qy,HE;function dB(){if(HE)return Qy;HE=1;var e=sd(),t=uB();function n(s,i){return t(s||[],i||[],e)}return Qy=n,Qy}var Zy,GE;function wt(){if(GE)return Zy;GE=1;var e;if(typeof Ww=="function")try{e={cloneDeep:Cz(),constant:e0(),defaults:jz(),each:vR(),filter:TR(),find:Pz(),flatten:GR(),forEach:yR(),forIn:$z(),has:RR(),isUndefined:AR(),last:Lz(),map:IR(),mapValues:qz(),max:Fz(),merge:Gz(),min:Vz(),minBy:Yz(),now:Kz(),pick:eB(),range:rB(),reduce:OR(),sortBy:lB(),uniqueId:cB(),values:DR(),zipObject:dB()}}catch{}return e||(e=window._),Zy=e,Zy}var Jy,VE;function fB(){if(VE)return Jy;VE=1,Jy=e;function e(){var s={};s._next=s._prev=s,this._sentinel=s}e.prototype.dequeue=function(){var s=this._sentinel,i=s._prev;if(i!==s)return t(i),i},e.prototype.enqueue=function(s){var i=this._sentinel;s._prev&&s._next&&t(s),s._next=i._next,i._next._prev=s,i._next=s,s._prev=i},e.prototype.toString=function(){for(var s=[],i=this._sentinel,a=i._prev;a!==i;)s.push(JSON.stringify(a,n)),a=a._prev;return"["+s.join(", ")+"]"};function t(s){s._prev._next=s._next,s._next._prev=s._prev,delete s._next,delete s._prev}function n(s,i){if(s!=="_next"&&s!=="_prev")return i}return Jy}var ev,YE;function hB(){if(YE)return ev;YE=1;var e=wt(),t=dr().Graph,n=fB();ev=i;var s=e.constant(1);function i(p,f){if(p.nodeCount()<=1)return[];var g=u(p,f||s),v=a(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(v,function(w){return p.outEdges(w.v,w.w)}),!0)}function a(p,f,g){for(var v=[],w=f[f.length-1],E=f[0],b;p.nodeCount();){for(;b=E.dequeue();)l(p,f,g,b);for(;b=w.dequeue();)l(p,f,g,b);if(p.nodeCount()){for(var S=f.length-2;S>0;--S)if(b=f[S].dequeue(),b){v=v.concat(l(p,f,g,b,!0));break}}}return v}function l(p,f,g,v,w){var E=w?[]:void 0;return e.forEach(p.inEdges(v.v),function(b){var S=p.edge(b),_=p.node(b.v);w&&E.push({v:b.v,w:b.w}),_.out-=S,h(f,g,_)}),e.forEach(p.outEdges(v.v),function(b){var S=p.edge(b),_=b.w,N=p.node(_);N.in-=S,h(f,g,N)}),p.removeNode(v.v),E}function u(p,f){var g=new t,v=0,w=0;e.forEach(p.nodes(),function(S){g.setNode(S,{v:S,in:0,out:0})}),e.forEach(p.edges(),function(S){var _=g.edge(S.v,S.w)||0,N=f(S),C=_+N;g.setEdge(S.v,S.w,C),w=Math.max(w,g.node(S.v).out+=N),v=Math.max(v,g.node(S.w).in+=N)});var E=e.range(w+v+3).map(function(){return new n}),b=v+1;return e.forEach(g.nodes(),function(S){h(E,b,g.node(S))}),{graph:g,buckets:E,zeroIdx:b}}function h(p,f,g){g.out?g.in?p[g.out-g.in+f].enqueue(g):p[p.length-1].enqueue(g):p[0].enqueue(g)}return ev}var tv,KE;function pB(){if(KE)return tv;KE=1;var e=wt(),t=hB();tv={run:n,undo:i};function n(a){var l=a.graph().acyclicer==="greedy"?t(a,u(a)):s(a);e.forEach(l,function(h){var p=a.edge(h);a.removeEdge(h),p.forwardName=h.name,p.reversed=!0,a.setEdge(h.w,h.v,p,e.uniqueId("rev"))});function u(h){return function(p){return h.edge(p).weight}}}function s(a){var l=[],u={},h={};function p(f){e.has(h,f)||(h[f]=!0,u[f]=!0,e.forEach(a.outEdges(f),function(g){e.has(u,g.w)?l.push(g):p(g.w)}),delete u[f])}return e.forEach(a.nodes(),p),l}function i(a){e.forEach(a.edges(),function(l){var u=a.edge(l);if(u.reversed){a.removeEdge(l);var h=u.forwardName;delete u.reversed,delete u.forwardName,a.setEdge(l.w,l.v,u,h)}})}return tv}var nv,XE;function pn(){if(XE)return nv;XE=1;var e=wt(),t=dr().Graph;nv={addDummyNode:n,simplify:s,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:l,intersectRect:u,buildLayerMatrix:h,normalizeRanks:p,removeEmptyRanks:f,addBorderNode:g,maxRank:v,partition:w,time:E,notime:b};function n(S,_,N,C){var j;do j=e.uniqueId(C);while(S.hasNode(j));return N.dummy=_,S.setNode(j,N),j}function s(S){var _=new t().setGraph(S.graph());return e.forEach(S.nodes(),function(N){_.setNode(N,S.node(N))}),e.forEach(S.edges(),function(N){var C=_.edge(N.v,N.w)||{weight:0,minlen:1},j=S.edge(N);_.setEdge(N.v,N.w,{weight:C.weight+j.weight,minlen:Math.max(C.minlen,j.minlen)})}),_}function i(S){var _=new t({multigraph:S.isMultigraph()}).setGraph(S.graph());return e.forEach(S.nodes(),function(N){S.children(N).length||_.setNode(N,S.node(N))}),e.forEach(S.edges(),function(N){_.setEdge(N,S.edge(N))}),_}function a(S){var _=e.map(S.nodes(),function(N){var C={};return e.forEach(S.outEdges(N),function(j){C[j.w]=(C[j.w]||0)+S.edge(j).weight}),C});return e.zipObject(S.nodes(),_)}function l(S){var _=e.map(S.nodes(),function(N){var C={};return e.forEach(S.inEdges(N),function(j){C[j.v]=(C[j.v]||0)+S.edge(j).weight}),C});return e.zipObject(S.nodes(),_)}function u(S,_){var N=S.x,C=S.y,j=_.x-N,M=_.y-C,P=S.width/2,I=S.height/2;if(!j&&!M)throw new Error("Not possible to find intersection inside of the rectangle");var F,O;return Math.abs(M)*P>Math.abs(j)*I?(M<0&&(I=-I),F=I*j/M,O=I):(j<0&&(P=-P),F=P,O=P*M/j),{x:N+F,y:C+O}}function h(S){var _=e.map(e.range(v(S)+1),function(){return[]});return e.forEach(S.nodes(),function(N){var C=S.node(N),j=C.rank;e.isUndefined(j)||(_[j][C.order]=N)}),_}function p(S){var _=e.min(e.map(S.nodes(),function(N){return S.node(N).rank}));e.forEach(S.nodes(),function(N){var C=S.node(N);e.has(C,"rank")&&(C.rank-=_)})}function f(S){var _=e.min(e.map(S.nodes(),function(M){return S.node(M).rank})),N=[];e.forEach(S.nodes(),function(M){var P=S.node(M).rank-_;N[P]||(N[P]=[]),N[P].push(M)});var C=0,j=S.graph().nodeRankFactor;e.forEach(N,function(M,P){e.isUndefined(M)&&P%j!==0?--C:C&&e.forEach(M,function(I){S.node(I).rank+=C})})}function g(S,_,N,C){var j={width:0,height:0};return arguments.length>=4&&(j.rank=N,j.order=C),n(S,"border",j,_)}function v(S){return e.max(e.map(S.nodes(),function(_){var N=S.node(_).rank;if(!e.isUndefined(N))return N}))}function w(S,_){var N={lhs:[],rhs:[]};return e.forEach(S,function(C){_(C)?N.lhs.push(C):N.rhs.push(C)}),N}function E(S,_){var N=e.now();try{return _()}finally{console.log(S+" time: "+(e.now()-N)+"ms")}}function b(S,_){return _()}return nv}var rv,QE;function mB(){if(QE)return rv;QE=1;var e=wt(),t=pn();rv={run:n,undo:i};function n(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(l){s(a,l)})}function s(a,l){var u=l.v,h=a.node(u).rank,p=l.w,f=a.node(p).rank,g=l.name,v=a.edge(l),w=v.labelRank;if(f!==h+1){a.removeEdge(l);var E,b,S;for(S=0,++h;h<f;++S,++h)v.points=[],b={width:0,height:0,edgeLabel:v,edgeObj:l,rank:h},E=t.addDummyNode(a,"edge",b,"_d"),h===w&&(b.width=v.width,b.height=v.height,b.dummy="edge-label",b.labelpos=v.labelpos),a.setEdge(u,E,{weight:v.weight},g),S===0&&a.graph().dummyChains.push(E),u=E;a.setEdge(u,p,{weight:v.weight},g)}}function i(a){e.forEach(a.graph().dummyChains,function(l){var u=a.node(l),h=u.edgeLabel,p;for(a.setEdge(u.edgeObj,h);u.dummy;)p=a.successors(l)[0],a.removeNode(l),h.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(h.x=u.x,h.y=u.y,h.width=u.width,h.height=u.height),l=p,u=a.node(l)})}return rv}var sv,ZE;function qu(){if(ZE)return sv;ZE=1;var e=wt();sv={longestPath:t,slack:n};function t(s){var i={};function a(l){var u=s.node(l);if(e.has(i,l))return u.rank;i[l]=!0;var h=e.min(e.map(s.outEdges(l),function(p){return a(p.w)-s.edge(p).minlen}));return(h===Number.POSITIVE_INFINITY||h===void 0||h===null)&&(h=0),u.rank=h}e.forEach(s.sources(),a)}function n(s,i){return s.node(i.w).rank-s.node(i.v).rank-s.edge(i).minlen}return sv}var ov,JE;function XR(){if(JE)return ov;JE=1;var e=wt(),t=dr().Graph,n=qu().slack;ov=s;function s(u){var h=new t({directed:!1}),p=u.nodes()[0],f=u.nodeCount();h.setNode(p,{});for(var g,v;i(h,u)<f;)g=a(h,u),v=h.hasNode(g.v)?n(u,g):-n(u,g),l(h,u,v);return h}function i(u,h){function p(f){e.forEach(h.nodeEdges(f),function(g){var v=g.v,w=f===v?g.w:v;!u.hasNode(w)&&!n(h,g)&&(u.setNode(w,{}),u.setEdge(f,w,{}),p(w))})}return e.forEach(u.nodes(),p),u.nodeCount()}function a(u,h){return e.minBy(h.edges(),function(p){if(u.hasNode(p.v)!==u.hasNode(p.w))return n(h,p)})}function l(u,h,p){e.forEach(u.nodes(),function(f){h.node(f).rank+=p})}return ov}var iv,eC;function gB(){if(eC)return iv;eC=1;var e=wt(),t=XR(),n=qu().slack,s=qu().longestPath,i=dr().alg.preorder,a=dr().alg.postorder,l=pn().simplify;iv=u,u.initLowLimValues=g,u.initCutValues=h,u.calcCutValue=f,u.leaveEdge=w,u.enterEdge=E,u.exchangeEdges=b;function u(C){C=l(C),s(C);var j=t(C);g(j),h(j,C);for(var M,P;M=w(j);)P=E(j,C,M),b(j,C,M,P)}function h(C,j){var M=a(C,C.nodes());M=M.slice(0,M.length-1),e.forEach(M,function(P){p(C,j,P)})}function p(C,j,M){var P=C.node(M),I=P.parent;C.edge(M,I).cutvalue=f(C,j,M)}function f(C,j,M){var P=C.node(M),I=P.parent,F=!0,O=j.edge(M,I),A=0;return O||(F=!1,O=j.edge(I,M)),A=O.weight,e.forEach(j.nodeEdges(M),function(L){var H=L.v===M,X=H?L.w:L.v;if(X!==I){var R=H===F,K=j.edge(L).weight;if(A+=R?K:-K,_(C,M,X)){var G=C.edge(M,X).cutvalue;A+=R?-G:G}}}),A}function g(C,j){arguments.length<2&&(j=C.nodes()[0]),v(C,{},1,j)}function v(C,j,M,P,I){var F=M,O=C.node(P);return j[P]=!0,e.forEach(C.neighbors(P),function(A){e.has(j,A)||(M=v(C,j,M,A,P))}),O.low=F,O.lim=M++,I?O.parent=I:delete O.parent,M}function w(C){return e.find(C.edges(),function(j){return C.edge(j).cutvalue<0})}function E(C,j,M){var P=M.v,I=M.w;j.hasEdge(P,I)||(P=M.w,I=M.v);var F=C.node(P),O=C.node(I),A=F,L=!1;F.lim>O.lim&&(A=O,L=!0);var H=e.filter(j.edges(),function(X){return L===N(C,C.node(X.v),A)&&L!==N(C,C.node(X.w),A)});return e.minBy(H,function(X){return n(j,X)})}function b(C,j,M,P){var I=M.v,F=M.w;C.removeEdge(I,F),C.setEdge(P.v,P.w,{}),g(C),h(C,j),S(C,j)}function S(C,j){var M=e.find(C.nodes(),function(I){return!j.node(I).parent}),P=i(C,M);P=P.slice(1),e.forEach(P,function(I){var F=C.node(I).parent,O=j.edge(I,F),A=!1;O||(O=j.edge(F,I),A=!0),j.node(I).rank=j.node(F).rank+(A?O.minlen:-O.minlen)})}function _(C,j,M){return C.hasEdge(j,M)}function N(C,j,M){return M.low<=j.lim&&j.lim<=M.lim}return iv}var av,tC;function yB(){if(tC)return av;tC=1;var e=qu(),t=e.longestPath,n=XR(),s=gB();av=i;function i(h){switch(h.graph().ranker){case"network-simplex":u(h);break;case"tight-tree":l(h);break;case"longest-path":a(h);break;default:u(h)}}var a=t;function l(h){t(h),n(h)}function u(h){s(h)}return av}var lv,nC;function vB(){if(nC)return lv;nC=1;var e=wt();lv=t;function t(i){var a=s(i);e.forEach(i.graph().dummyChains,function(l){for(var u=i.node(l),h=u.edgeObj,p=n(i,a,h.v,h.w),f=p.path,g=p.lca,v=0,w=f[v],E=!0;l!==h.w;){if(u=i.node(l),E){for(;(w=f[v])!==g&&i.node(w).maxRank<u.rank;)v++;w===g&&(E=!1)}if(!E){for(;v<f.length-1&&i.node(w=f[v+1]).minRank<=u.rank;)v++;w=f[v]}i.setParent(l,w),l=i.successors(l)[0]}})}function n(i,a,l,u){var h=[],p=[],f=Math.min(a[l].low,a[u].low),g=Math.max(a[l].lim,a[u].lim),v,w;v=l;do v=i.parent(v),h.push(v);while(v&&(a[v].low>f||g>a[v].lim));for(w=v,v=u;(v=i.parent(v))!==w;)p.push(v);return{path:h.concat(p.reverse()),lca:w}}function s(i){var a={},l=0;function u(h){var p=l;e.forEach(i.children(h),u),a[h]={low:p,lim:l++}}return e.forEach(i.children(),u),a}return lv}var cv,rC;function wB(){if(rC)return cv;rC=1;var e=wt(),t=pn();cv={run:n,cleanup:l};function n(u){var h=t.addDummyNode(u,"root",{},"_root"),p=i(u),f=e.max(e.values(p))-1,g=2*f+1;u.graph().nestingRoot=h,e.forEach(u.edges(),function(w){u.edge(w).minlen*=g});var v=a(u)+1;e.forEach(u.children(),function(w){s(u,h,g,v,f,p,w)}),u.graph().nodeRankFactor=g}function s(u,h,p,f,g,v,w){var E=u.children(w);if(!E.length){w!==h&&u.setEdge(h,w,{weight:0,minlen:p});return}var b=t.addBorderNode(u,"_bt"),S=t.addBorderNode(u,"_bb"),_=u.node(w);u.setParent(b,w),_.borderTop=b,u.setParent(S,w),_.borderBottom=S,e.forEach(E,function(N){s(u,h,p,f,g,v,N);var C=u.node(N),j=C.borderTop?C.borderTop:N,M=C.borderBottom?C.borderBottom:N,P=C.borderTop?f:2*f,I=j!==M?1:g-v[w]+1;u.setEdge(b,j,{weight:P,minlen:I,nestingEdge:!0}),u.setEdge(M,S,{weight:P,minlen:I,nestingEdge:!0})}),u.parent(w)||u.setEdge(h,b,{weight:0,minlen:g+v[w]})}function i(u){var h={};function p(f,g){var v=u.children(f);v&&v.length&&e.forEach(v,function(w){p(w,g+1)}),h[f]=g}return e.forEach(u.children(),function(f){p(f,1)}),h}function a(u){return e.reduce(u.edges(),function(h,p){return h+u.edge(p).weight},0)}function l(u){var h=u.graph();u.removeNode(h.nestingRoot),delete h.nestingRoot,e.forEach(u.edges(),function(p){var f=u.edge(p);f.nestingEdge&&u.removeEdge(p)})}return cv}var uv,sC;function xB(){if(sC)return uv;sC=1;var e=wt(),t=pn();uv=n;function n(i){function a(l){var u=i.children(l),h=i.node(l);if(u.length&&e.forEach(u,a),e.has(h,"minRank")){h.borderLeft=[],h.borderRight=[];for(var p=h.minRank,f=h.maxRank+1;p<f;++p)s(i,"borderLeft","_bl",l,h,p),s(i,"borderRight","_br",l,h,p)}}e.forEach(i.children(),a)}function s(i,a,l,u,h,p){var f={width:0,height:0,rank:p,borderType:a},g=h[a][p-1],v=t.addDummyNode(i,"border",f,l);h[a][p]=v,i.setParent(v,u),g&&i.setEdge(g,v,{weight:1})}return uv}var dv,oC;function bB(){if(oC)return dv;oC=1;var e=wt();dv={adjust:t,undo:n};function t(p){var f=p.graph().rankdir.toLowerCase();(f==="lr"||f==="rl")&&s(p)}function n(p){var f=p.graph().rankdir.toLowerCase();(f==="bt"||f==="rl")&&a(p),(f==="lr"||f==="rl")&&(u(p),s(p))}function s(p){e.forEach(p.nodes(),function(f){i(p.node(f))}),e.forEach(p.edges(),function(f){i(p.edge(f))})}function i(p){var f=p.width;p.width=p.height,p.height=f}function a(p){e.forEach(p.nodes(),function(f){l(p.node(f))}),e.forEach(p.edges(),function(f){var g=p.edge(f);e.forEach(g.points,l),e.has(g,"y")&&l(g)})}function l(p){p.y=-p.y}function u(p){e.forEach(p.nodes(),function(f){h(p.node(f))}),e.forEach(p.edges(),function(f){var g=p.edge(f);e.forEach(g.points,h),e.has(g,"x")&&h(g)})}function h(p){var f=p.x;p.x=p.y,p.y=f}return dv}var fv,iC;function kB(){if(iC)return fv;iC=1;var e=wt();fv=t;function t(n){var s={},i=e.filter(n.nodes(),function(p){return!n.children(p).length}),a=e.max(e.map(i,function(p){return n.node(p).rank})),l=e.map(e.range(a+1),function(){return[]});function u(p){if(!e.has(s,p)){s[p]=!0;var f=n.node(p);l[f.rank].push(p),e.forEach(n.successors(p),u)}}var h=e.sortBy(i,function(p){return n.node(p).rank});return e.forEach(h,u),l}return fv}var hv,aC;function _B(){if(aC)return hv;aC=1;var e=wt();hv=t;function t(s,i){for(var a=0,l=1;l<i.length;++l)a+=n(s,i[l-1],i[l]);return a}function n(s,i,a){for(var l=e.zipObject(a,e.map(a,function(v,w){return w})),u=e.flatten(e.map(i,function(v){return e.sortBy(e.map(s.outEdges(v),function(w){return{pos:l[w.w],weight:s.edge(w).weight}}),"pos")}),!0),h=1;h<a.length;)h<<=1;var p=2*h-1;h-=1;var f=e.map(new Array(p),function(){return 0}),g=0;return e.forEach(u.forEach(function(v){var w=v.pos+h;f[w]+=v.weight;for(var E=0;w>0;)w%2&&(E+=f[w+1]),w=w-1>>1,f[w]+=v.weight;g+=v.weight*E})),g}return hv}var pv,lC;function SB(){if(lC)return pv;lC=1;var e=wt();pv=t;function t(n,s){return e.map(s,function(i){var a=n.inEdges(i);if(a.length){var l=e.reduce(a,function(u,h){var p=n.edge(h),f=n.node(h.v);return{sum:u.sum+p.weight*f.order,weight:u.weight+p.weight}},{sum:0,weight:0});return{v:i,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:i}})}return pv}var mv,cC;function NB(){if(cC)return mv;cC=1;var e=wt();mv=t;function t(i,a){var l={};e.forEach(i,function(h,p){var f=l[h.v]={indegree:0,in:[],out:[],vs:[h.v],i:p};e.isUndefined(h.barycenter)||(f.barycenter=h.barycenter,f.weight=h.weight)}),e.forEach(a.edges(),function(h){var p=l[h.v],f=l[h.w];!e.isUndefined(p)&&!e.isUndefined(f)&&(f.indegree++,p.out.push(l[h.w]))});var u=e.filter(l,function(h){return!h.indegree});return n(u)}function n(i){var a=[];function l(p){return function(f){f.merged||(e.isUndefined(f.barycenter)||e.isUndefined(p.barycenter)||f.barycenter>=p.barycenter)&&s(p,f)}}function u(p){return function(f){f.in.push(p),--f.indegree===0&&i.push(f)}}for(;i.length;){var h=i.pop();a.push(h),e.forEach(h.in.reverse(),l(h)),e.forEach(h.out,u(h))}return e.map(e.filter(a,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function s(i,a){var l=0,u=0;i.weight&&(l+=i.barycenter*i.weight,u+=i.weight),a.weight&&(l+=a.barycenter*a.weight,u+=a.weight),i.vs=a.vs.concat(i.vs),i.barycenter=l/u,i.weight=u,i.i=Math.min(a.i,i.i),a.merged=!0}return mv}var gv,uC;function EB(){if(uC)return gv;uC=1;var e=wt(),t=pn();gv=n;function n(a,l){var u=t.partition(a,function(b){return e.has(b,"barycenter")}),h=u.lhs,p=e.sortBy(u.rhs,function(b){return-b.i}),f=[],g=0,v=0,w=0;h.sort(i(!!l)),w=s(f,p,w),e.forEach(h,function(b){w+=b.vs.length,f.push(b.vs),g+=b.barycenter*b.weight,v+=b.weight,w=s(f,p,w)});var E={vs:e.flatten(f,!0)};return v&&(E.barycenter=g/v,E.weight=v),E}function s(a,l,u){for(var h;l.length&&(h=e.last(l)).i<=u;)l.pop(),a.push(h.vs),u++;return u}function i(a){return function(l,u){return l.barycenter<u.barycenter?-1:l.barycenter>u.barycenter?1:a?u.i-l.i:l.i-u.i}}return gv}var yv,dC;function CB(){if(dC)return yv;dC=1;var e=wt(),t=SB(),n=NB(),s=EB();yv=i;function i(u,h,p,f){var g=u.children(h),v=u.node(h),w=v?v.borderLeft:void 0,E=v?v.borderRight:void 0,b={};w&&(g=e.filter(g,function(M){return M!==w&&M!==E}));var S=t(u,g);e.forEach(S,function(M){if(u.children(M.v).length){var P=i(u,M.v,p,f);b[M.v]=P,e.has(P,"barycenter")&&l(M,P)}});var _=n(S,p);a(_,b);var N=s(_,f);if(w&&(N.vs=e.flatten([w,N.vs,E],!0),u.predecessors(w).length)){var C=u.node(u.predecessors(w)[0]),j=u.node(u.predecessors(E)[0]);e.has(N,"barycenter")||(N.barycenter=0,N.weight=0),N.barycenter=(N.barycenter*N.weight+C.order+j.order)/(N.weight+2),N.weight+=2}return N}function a(u,h){e.forEach(u,function(p){p.vs=e.flatten(p.vs.map(function(f){return h[f]?h[f].vs:f}),!0)})}function l(u,h){e.isUndefined(u.barycenter)?(u.barycenter=h.barycenter,u.weight=h.weight):(u.barycenter=(u.barycenter*u.weight+h.barycenter*h.weight)/(u.weight+h.weight),u.weight+=h.weight)}return yv}var vv,fC;function jB(){if(fC)return vv;fC=1;var e=wt(),t=dr().Graph;vv=n;function n(i,a,l){var u=s(i),h=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(p){return i.node(p)});return e.forEach(i.nodes(),function(p){var f=i.node(p),g=i.parent(p);(f.rank===a||f.minRank<=a&&a<=f.maxRank)&&(h.setNode(p),h.setParent(p,g||u),e.forEach(i[l](p),function(v){var w=v.v===p?v.w:v.v,E=h.edge(w,p),b=e.isUndefined(E)?0:E.weight;h.setEdge(w,p,{weight:i.edge(v).weight+b})}),e.has(f,"minRank")&&h.setNode(p,{borderLeft:f.borderLeft[a],borderRight:f.borderRight[a]}))}),h}function s(i){for(var a;i.hasNode(a=e.uniqueId("_root")););return a}return vv}var wv,hC;function TB(){if(hC)return wv;hC=1;var e=wt();wv=t;function t(n,s,i){var a={},l;e.forEach(i,function(u){for(var h=n.parent(u),p,f;h;){if(p=n.parent(h),p?(f=a[p],a[p]=h):(f=l,l=h),f&&f!==h){s.setEdge(f,h);return}h=p}})}return wv}var xv,pC;function RB(){if(pC)return xv;pC=1;var e=wt(),t=kB(),n=_B(),s=CB(),i=jB(),a=TB(),l=dr().Graph,u=pn();xv=h;function h(v){var w=u.maxRank(v),E=p(v,e.range(1,w+1),"inEdges"),b=p(v,e.range(w-1,-1,-1),"outEdges"),S=t(v);g(v,S);for(var _=Number.POSITIVE_INFINITY,N,C=0,j=0;j<4;++C,++j){f(C%2?E:b,C%4>=2),S=u.buildLayerMatrix(v);var M=n(v,S);M<_&&(j=0,N=e.cloneDeep(S),_=M)}g(v,N)}function p(v,w,E){return e.map(w,function(b){return i(v,b,E)})}function f(v,w){var E=new l;e.forEach(v,function(b){var S=b.graph().root,_=s(b,S,E,w);e.forEach(_.vs,function(N,C){b.node(N).order=C}),a(b,E,_.vs)})}function g(v,w){e.forEach(w,function(E){e.forEach(E,function(b,S){v.node(b).order=S})})}return xv}var bv,mC;function AB(){if(mC)return bv;mC=1;var e=wt(),t=dr().Graph,n=pn();bv={positionX:E,findType1Conflicts:s,findType2Conflicts:i,addConflict:l,hasConflict:u,verticalAlignment:h,horizontalCompaction:p,alignCoordinates:v,findSmallestWidthAlignment:g,balance:w};function s(_,N){var C={};function j(M,P){var I=0,F=0,O=M.length,A=e.last(P);return e.forEach(P,function(L,H){var X=a(_,L),R=X?_.node(X).order:O;(X||L===A)&&(e.forEach(P.slice(F,H+1),function(K){e.forEach(_.predecessors(K),function(G){var ne=_.node(G),Q=ne.order;(Q<I||R<Q)&&!(ne.dummy&&_.node(K).dummy)&&l(C,G,K)})}),F=H+1,I=R)}),P}return e.reduce(N,j),C}function i(_,N){var C={};function j(P,I,F,O,A){var L;e.forEach(e.range(I,F),function(H){L=P[H],_.node(L).dummy&&e.forEach(_.predecessors(L),function(X){var R=_.node(X);R.dummy&&(R.order<O||R.order>A)&&l(C,X,L)})})}function M(P,I){var F=-1,O,A=0;return e.forEach(I,function(L,H){if(_.node(L).dummy==="border"){var X=_.predecessors(L);X.length&&(O=_.node(X[0]).order,j(I,A,H,F,O),A=H,F=O)}j(I,A,I.length,O,P.length)}),I}return e.reduce(N,M),C}function a(_,N){if(_.node(N).dummy)return e.find(_.predecessors(N),function(C){return _.node(C).dummy})}function l(_,N,C){if(N>C){var j=N;N=C,C=j}var M=_[N];M||(_[N]=M={}),M[C]=!0}function u(_,N,C){if(N>C){var j=N;N=C,C=j}return e.has(_[N],C)}function h(_,N,C,j){var M={},P={},I={};return e.forEach(N,function(F){e.forEach(F,function(O,A){M[O]=O,P[O]=O,I[O]=A})}),e.forEach(N,function(F){var O=-1;e.forEach(F,function(A){var L=j(A);if(L.length){L=e.sortBy(L,function(G){return I[G]});for(var H=(L.length-1)/2,X=Math.floor(H),R=Math.ceil(H);X<=R;++X){var K=L[X];P[A]===A&&O<I[K]&&!u(C,A,K)&&(P[K]=A,P[A]=M[A]=M[K],O=I[K])}}})}),{root:M,align:P}}function p(_,N,C,j,M){var P={},I=f(_,N,C,M),F=M?"borderLeft":"borderRight";function O(H,X){for(var R=I.nodes(),K=R.pop(),G={};K;)G[K]?H(K):(G[K]=!0,R.push(K),R=R.concat(X(K))),K=R.pop()}function A(H){P[H]=I.inEdges(H).reduce(function(X,R){return Math.max(X,P[R.v]+I.edge(R))},0)}function L(H){var X=I.outEdges(H).reduce(function(K,G){return Math.min(K,P[G.w]-I.edge(G))},Number.POSITIVE_INFINITY),R=_.node(H);X!==Number.POSITIVE_INFINITY&&R.borderType!==F&&(P[H]=Math.max(P[H],X))}return O(A,I.predecessors.bind(I)),O(L,I.successors.bind(I)),e.forEach(j,function(H){P[H]=P[C[H]]}),P}function f(_,N,C,j){var M=new t,P=_.graph(),I=b(P.nodesep,P.edgesep,j);return e.forEach(N,function(F){var O;e.forEach(F,function(A){var L=C[A];if(M.setNode(L),O){var H=C[O],X=M.edge(H,L);M.setEdge(H,L,Math.max(I(_,A,O),X||0))}O=A})}),M}function g(_,N){return e.minBy(e.values(N),function(C){var j=Number.NEGATIVE_INFINITY,M=Number.POSITIVE_INFINITY;return e.forIn(C,function(P,I){var F=S(_,I)/2;j=Math.max(P+F,j),M=Math.min(P-F,M)}),j-M})}function v(_,N){var C=e.values(N),j=e.min(C),M=e.max(C);e.forEach(["u","d"],function(P){e.forEach(["l","r"],function(I){var F=P+I,O=_[F],A;if(O!==N){var L=e.values(O);A=I==="l"?j-e.min(L):M-e.max(L),A&&(_[F]=e.mapValues(O,function(H){return H+A}))}})})}function w(_,N){return e.mapValues(_.ul,function(C,j){if(N)return _[N.toLowerCase()][j];var M=e.sortBy(e.map(_,j));return(M[1]+M[2])/2})}function E(_){var N=n.buildLayerMatrix(_),C=e.merge(s(_,N),i(_,N)),j={},M;e.forEach(["u","d"],function(I){M=I==="u"?N:e.values(N).reverse(),e.forEach(["l","r"],function(F){F==="r"&&(M=e.map(M,function(H){return e.values(H).reverse()}));var O=(I==="u"?_.predecessors:_.successors).bind(_),A=h(_,M,C,O),L=p(_,M,A.root,A.align,F==="r");F==="r"&&(L=e.mapValues(L,function(H){return-H})),j[I+F]=L})});var P=g(_,j);return v(j,P),w(j,_.graph().align)}function b(_,N,C){return function(j,M,P){var I=j.node(M),F=j.node(P),O=0,A;if(O+=I.width/2,e.has(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":A=-I.width/2;break;case"r":A=I.width/2;break}if(A&&(O+=C?A:-A),A=0,O+=(I.dummy?N:_)/2,O+=(F.dummy?N:_)/2,O+=F.width/2,e.has(F,"labelpos"))switch(F.labelpos.toLowerCase()){case"l":A=F.width/2;break;case"r":A=-F.width/2;break}return A&&(O+=C?A:-A),A=0,O}}function S(_,N){return _.node(N).width}return bv}var kv,gC;function MB(){if(gC)return kv;gC=1;var e=wt(),t=pn(),n=AB().positionX;kv=s;function s(a){a=t.asNonCompoundGraph(a),i(a),e.forEach(n(a),function(l,u){a.node(u).x=l})}function i(a){var l=t.buildLayerMatrix(a),u=a.graph().ranksep,h=0;e.forEach(l,function(p){var f=e.max(e.map(p,function(g){return a.node(g).height}));e.forEach(p,function(g){a.node(g).y=h+f/2}),h+=f+u})}return kv}var _v,yC;function IB(){if(yC)return _v;yC=1;var e=wt(),t=pB(),n=mB(),s=yB(),i=pn().normalizeRanks,a=vB(),l=pn().removeEmptyRanks,u=wB(),h=xB(),p=bB(),f=RB(),g=MB(),v=pn(),w=dr().Graph;_v=E;function E(z,D){var J=D&&D.debugTiming?v.time:v.notime;J("layout",function(){var V=J(" buildLayoutGraph",function(){return O(z)});J(" runLayout",function(){b(V,J)}),J(" updateInputGraph",function(){S(z,V)})})}function b(z,D){D(" makeSpaceForEdgeLabels",function(){A(z)}),D(" removeSelfEdges",function(){W(z)}),D(" acyclic",function(){t.run(z)}),D(" nestingGraph.run",function(){u.run(z)}),D(" rank",function(){s(v.asNonCompoundGraph(z))}),D(" injectEdgeLabelProxies",function(){L(z)}),D(" removeEmptyRanks",function(){l(z)}),D(" nestingGraph.cleanup",function(){u.cleanup(z)}),D(" normalizeRanks",function(){i(z)}),D(" assignRankMinMax",function(){H(z)}),D(" removeEdgeLabelProxies",function(){X(z)}),D(" normalize.run",function(){n.run(z)}),D(" parentDummyChains",function(){a(z)}),D(" addBorderSegments",function(){h(z)}),D(" order",function(){f(z)}),D(" insertSelfEdges",function(){ee(z)}),D(" adjustCoordinateSystem",function(){p.adjust(z)}),D(" position",function(){g(z)}),D(" positionSelfEdges",function(){$(z)}),D(" removeBorderNodes",function(){Q(z)}),D(" normalize.undo",function(){n.undo(z)}),D(" fixupEdgeLabelCoords",function(){G(z)}),D(" undoCoordinateSystem",function(){p.undo(z)}),D(" translateGraph",function(){R(z)}),D(" assignNodeIntersects",function(){K(z)}),D(" reversePoints",function(){ne(z)}),D(" acyclic.undo",function(){t.undo(z)})}function S(z,D){e.forEach(z.nodes(),function(J){var V=z.node(J),ae=D.node(J);V&&(V.x=ae.x,V.y=ae.y,D.children(J).length&&(V.width=ae.width,V.height=ae.height))}),e.forEach(z.edges(),function(J){var V=z.edge(J),ae=D.edge(J);V.points=ae.points,e.has(ae,"x")&&(V.x=ae.x,V.y=ae.y)}),z.graph().width=D.graph().width,z.graph().height=D.graph().height}var _=["nodesep","edgesep","ranksep","marginx","marginy"],N={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},C=["acyclicer","ranker","rankdir","align"],j=["width","height"],M={width:0,height:0},P=["minlen","weight","width","height","labeloffset"],I={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},F=["labelpos"];function O(z){var D=new w({multigraph:!0,compound:!0}),J=ue(z.graph());return D.setGraph(e.merge({},N,Y(J,_),e.pick(J,C))),e.forEach(z.nodes(),function(V){var ae=ue(z.node(V));D.setNode(V,e.defaults(Y(ae,j),M)),D.setParent(V,z.parent(V))}),e.forEach(z.edges(),function(V){var ae=ue(z.edge(V));D.setEdge(V,e.merge({},I,Y(ae,P),e.pick(ae,F)))}),D}function A(z){var D=z.graph();D.ranksep/=2,e.forEach(z.edges(),function(J){var V=z.edge(J);V.minlen*=2,V.labelpos.toLowerCase()!=="c"&&(D.rankdir==="TB"||D.rankdir==="BT"?V.width+=V.labeloffset:V.height+=V.labeloffset)})}function L(z){e.forEach(z.edges(),function(D){var J=z.edge(D);if(J.width&&J.height){var V=z.node(D.v),ae=z.node(D.w),he={rank:(ae.rank-V.rank)/2+V.rank,e:D};v.addDummyNode(z,"edge-proxy",he,"_ep")}})}function H(z){var D=0;e.forEach(z.nodes(),function(J){var V=z.node(J);V.borderTop&&(V.minRank=z.node(V.borderTop).rank,V.maxRank=z.node(V.borderBottom).rank,D=e.max(D,V.maxRank))}),z.graph().maxRank=D}function X(z){e.forEach(z.nodes(),function(D){var J=z.node(D);J.dummy==="edge-proxy"&&(z.edge(J.e).labelRank=J.rank,z.removeNode(D))})}function R(z){var D=Number.POSITIVE_INFINITY,J=0,V=Number.POSITIVE_INFINITY,ae=0,he=z.graph(),ye=he.marginx||0,_e=he.marginy||0;function Ve(Be){var qe=Be.x,Se=Be.y,ce=Be.width,be=Be.height;D=Math.min(D,qe-ce/2),J=Math.max(J,qe+ce/2),V=Math.min(V,Se-be/2),ae=Math.max(ae,Se+be/2)}e.forEach(z.nodes(),function(Be){Ve(z.node(Be))}),e.forEach(z.edges(),function(Be){var qe=z.edge(Be);e.has(qe,"x")&&Ve(qe)}),D-=ye,V-=_e,e.forEach(z.nodes(),function(Be){var qe=z.node(Be);qe.x-=D,qe.y-=V}),e.forEach(z.edges(),function(Be){var qe=z.edge(Be);e.forEach(qe.points,function(Se){Se.x-=D,Se.y-=V}),e.has(qe,"x")&&(qe.x-=D),e.has(qe,"y")&&(qe.y-=V)}),he.width=J-D+ye,he.height=ae-V+_e}function K(z){e.forEach(z.edges(),function(D){var J=z.edge(D),V=z.node(D.v),ae=z.node(D.w),he,ye;J.points?(he=J.points[0],ye=J.points[J.points.length-1]):(J.points=[],he=ae,ye=V),J.points.unshift(v.intersectRect(V,he)),J.points.push(v.intersectRect(ae,ye))})}function G(z){e.forEach(z.edges(),function(D){var J=z.edge(D);if(e.has(J,"x"))switch((J.labelpos==="l"||J.labelpos==="r")&&(J.width-=J.labeloffset),J.labelpos){case"l":J.x-=J.width/2+J.labeloffset;break;case"r":J.x+=J.width/2+J.labeloffset;break}})}function ne(z){e.forEach(z.edges(),function(D){var J=z.edge(D);J.reversed&&J.points.reverse()})}function Q(z){e.forEach(z.nodes(),function(D){if(z.children(D).length){var J=z.node(D),V=z.node(J.borderTop),ae=z.node(J.borderBottom),he=z.node(e.last(J.borderLeft)),ye=z.node(e.last(J.borderRight));J.width=Math.abs(ye.x-he.x),J.height=Math.abs(ae.y-V.y),J.x=he.x+J.width/2,J.y=V.y+J.height/2}}),e.forEach(z.nodes(),function(D){z.node(D).dummy==="border"&&z.removeNode(D)})}function W(z){e.forEach(z.edges(),function(D){if(D.v===D.w){var J=z.node(D.v);J.selfEdges||(J.selfEdges=[]),J.selfEdges.push({e:D,label:z.edge(D)}),z.removeEdge(D)}})}function ee(z){var D=v.buildLayerMatrix(z);e.forEach(D,function(J){var V=0;e.forEach(J,function(ae,he){var ye=z.node(ae);ye.order=he+V,e.forEach(ye.selfEdges,function(_e){v.addDummyNode(z,"selfedge",{width:_e.label.width,height:_e.label.height,rank:ye.rank,order:he+ ++V,e:_e.e,label:_e.label},"_se")}),delete ye.selfEdges})})}function $(z){e.forEach(z.nodes(),function(D){var J=z.node(D);if(J.dummy==="selfedge"){var V=z.node(J.e.v),ae=V.x+V.width/2,he=V.y,ye=J.x-ae,_e=V.height/2;z.setEdge(J.e,J.label),z.removeNode(D),J.label.points=[{x:ae+2*ye/3,y:he-_e},{x:ae+5*ye/6,y:he-_e},{x:ae+ye,y:he},{x:ae+5*ye/6,y:he+_e},{x:ae+2*ye/3,y:he+_e}],J.label.x=J.x,J.label.y=J.y}})}function Y(z,D){return e.mapValues(e.pick(z,D),Number)}function ue(z){var D={};return e.forEach(z,function(J,V){D[V.toLowerCase()]=J}),D}return _v}var Sv,vC;function OB(){if(vC)return Sv;vC=1;var e=wt(),t=pn(),n=dr().Graph;Sv={debugOrdering:s};function s(i){var a=t.buildLayerMatrix(i),l=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(i.nodes(),function(u){l.setNode(u,{label:u}),l.setParent(u,"layer"+i.node(u).rank)}),e.forEach(i.edges(),function(u){l.setEdge(u.v,u.w,{},u.name)}),e.forEach(a,function(u,h){var p="layer"+h;l.setNode(p,{rank:"same"}),e.reduce(u,function(f,g){return l.setEdge(f,g,{style:"invis"}),g})}),l}return Sv}var Nv,wC;function PB(){return wC||(wC=1,Nv="0.8.5"),Nv}var Ev,xC;function $B(){return xC||(xC=1,Ev={graphlib:dr(),layout:IB(),debug:OB(),util:{time:pn().time,notime:pn().notime},version:PB()}),Ev}var LB=$B();const bC=fw(LB),Xi=240,Du=130,zi=74,md=72,kC=zi+md;function qB(e,t){var s;let n=Xi;for(const i of e)n=Math.max(n,((s=t.get(i.id))==null?void 0:s.width)??Xi);return n}const QR=420,DB=2;function _l(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function FB(e,t){return((t==null?void 0:t.get(e))??0)>0?QR:0}function zB(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function Sl(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??Xi)+FB(e,n),h:Math.max((s==null?void 0:s.height)??Du,zB(e,n))}}function BB(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function UB(e,t,n,s,i,a){const l=new bC.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(_=>!i.has(_)),h=new Set(u);for(const _ of u){const{w:N,h:C}=Sl(_,s,a);l.setNode(_,{width:N,height:C})}for(const _ of t)h.has(_.source)&&h.has(_.target)&&l.setEdge(_.source,_.target);bC.layout(l);const p=new Map;let f=1/0,g=1/0,v=-1/0,w=-1/0;for(const _ of u){const N=l.node(_);if(!N)continue;const C=s.get(_),j=(C==null?void 0:C.width)??Xi,M=(C==null?void 0:C.height)??Du,P=Sl(_,s,a),I=N.x-P.w/2,F=N.y-P.h/2;p.set(_,{x:I,y:F}),I<f&&(f=I),F<g&&(g=F),I+j>v&&(v=I+j),F+M>w&&(w=F+M)}if(Number.isFinite(f)&&Number.isFinite(g))for(const[_,N]of p)p.set(_,{x:N.x-f,y:N.y-g});const E=Number.isFinite(v)?v-f:0,b=Number.isFinite(w)?w-g:0;let S=null;for(const _ of e){const N=i.get(_);if(!N)continue;const C=s.get(_),j=(C==null?void 0:C.width)??Xi,M=(C==null?void 0:C.height)??Du;S=S===null?{minX:N.x,minY:N.y,maxX:N.x+j,maxY:N.y+M}:{minX:Math.min(S.minX,N.x),minY:Math.min(S.minY,N.y),maxX:Math.max(S.maxX,N.x+j),maxY:Math.max(S.maxY,N.y+M)}}return{positions:p,width:E,height:b,pinnedBox:S}}function WB(e,t,n={}){const s=n.direction??"LR",i=n.pinned??new Map,a=n.measured??new Map,l=n.lanes,u=new Map;for(const _ of e){const N=_l(_),C=u.get(N);C?C.push(_.id):u.set(N,[_.id])}const p=Array.from(u.keys()).sort().map(_=>({sid:_,...UB(u.get(_),t,s,a,i,l)})),f=qB(e,a),g=n.availableHeight&&n.availableHeight>0?n.availableHeight:Number.POSITIVE_INFINITY,v=_=>{const N=[[]];let C=0;for(const j of p)N.length<_&&C>0&&C+j.height>g&&(N.push([]),C=0),N[N.length-1].push(j),C+=j.height+kC;return N},w=_=>_.reduce((N,C)=>Math.max(N,C.width),0)+QR;let E=v(n.availableWidth?DB:1);E.length>1&&E.reduce((N,C)=>N+w(C),0)+f*(E.length-1)>(n.availableWidth??0)&&(E=v(1));const b=new Map;let S=0;for(const _ of E){const N=w(_);let C=0;for(const{positions:j,height:M,pinnedBox:P}of _){for(const[F,O]of j)b.set(F,{x:O.x+S,y:O.y+C});let I=C+M;P&&P.maxY>I&&P.minX<S+N&&S<P.maxX&&(I=P.maxY),C=I+kC}S+=N+f}return e.map(_=>{const N=i.get(_.id);if(N)return{..._,position:N};const C=b.get(_.id);return C?{..._,position:C}:_})}function HB(e,t,n,s,i){const l=zi+md,u=60,h=w=>Sl(w,s,i),p=new Map(e.map(w=>[w.id,_l(w)])),f=[],g=e.map(w=>({id:w.id,pos:n.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,E)=>w.pos.y-E.pos.y||w.pos.x-E.pos.x||w.id.localeCompare(E.id)),v=[];for(const{id:w,pos:E}of g){const{w:b,h:S}=h(w),_=p.get(w)??"_default";if(n.has(w)){f.push({x:E.x,y:E.y,w:b,h:S,sid:_});continue}let N=E.y;for(let C=0;C<f.length+1;C++){const j=f.find(M=>{const P=M.sid===_?24:u,I=M.sid===_?24:l;return E.x<M.x+M.w+P&&M.x<E.x+b+P&&N<M.y+M.h+I&&M.y<N+S+I});if(!j)break;N=j.y+j.h+(j.sid===_?24:l)}N!==E.y&&(t.set(w,{x:E.x,y:N}),v.push(w)),f.push({x:E.x,y:N,w:b,h:S,sid:_})}return v}function GB(e,t,n,s,i,a){const l=b=>Sl(b,s,a),u=b=>n.get(b)??t.get(b),h=new Map;for(const b of e){if(!u(b.id))continue;const S=_l(b),_=h.get(S);_?_.push(b):h.set(S,[b])}const p=new Set;for(const[b,S]of h)S.every(_=>i.has(_.id)&&!n.has(_.id))&&p.add(b);const f=new Map,g=[];for(const b of e){const S=u(b.id);if(!S)continue;const{w:_,h:N}=l(b.id),C=_l(b);p.has(C)?(f.get(C)??f.set(C,[]).get(C)).push(b):g.push({x:S.x,y:S.y,w:_,h:N})}if(f.size===0)return[];const v=zi+md,w=(b,S,_,N)=>g.some(C=>b<C.x+C.w+zi&&C.x<b+_+zi&&S<C.y+C.h+v&&C.y<S+N+v),E=[];for(const b of[...f.keys()].sort()){const S=f.get(b);let _=1/0,N=1/0,C=-1/0,j=-1/0;for(const L of S){const H=u(L.id),{w:X,h:R}=l(L.id);_=Math.min(_,H.x),N=Math.min(N,H.y),C=Math.max(C,H.x+X),j=Math.max(j,H.y+R)}const M=C-_,P=j-N,I=[...new Set(g.map(L=>Math.round(L.x)))].sort((L,H)=>L-H),F=I.length?I:[_],O=[0,...g.map(L=>L.y+L.h+v)].sort((L,H)=>L-H);let A=null;e:for(const L of F)for(const H of O){if(H>=N)break;if(!w(L,H,M,P)){A={x:L,y:H};break e}}if(A){const L=A.x-_,H=A.y-N;for(const X of S){const R=u(X.id);t.set(X.id,{x:R.x+L,y:R.y+H})}E.push(b)}for(const L of S){const H=u(L.id),{w:X,h:R}=l(L.id);g.push({x:H.x,y:H.y,w:X,h:R})}}return E}function VB(e,t,n,s,i,a=!1,l){const p=zi+md+1,f=8,g=1.75,v=200,w=.7,E=.01,b=A=>Sl(A,s,l),S=A=>n.get(A)??t.get(A),_=new Map;for(const A of e){if(!S(A.id))continue;const L=_l(A),H=_.get(L);H?H.push(A):_.set(L,[A])}const N=[],C=new Set,j=new Set,M=i.size===0;for(const A of[..._.keys()].sort()){const L=_.get(A);let H=1/0,X=1/0,R=-1/0,K=-1/0,G=!1;for(const ee of L){const $=S(ee.id),{w:Y,h:ue}=b(ee.id);H=Math.min(H,$.x),X=Math.min(X,$.y),R=Math.max(R,$.x+Y),K=Math.max(K,$.y+ue),n.has(ee.id)&&(G=!0)}const ne=R-H,Q=K-X;j.add(A);const W=i.get(A);W&&(ne>W.w+f||Q>W.h+f)&&C.add(A),i.set(A,{w:ne,h:Q}),N.push({sid:A,members:L.map(ee=>ee.id),x:H,y:X,w:ne,h:Q,anchored:G,mass:1})}for(const A of[...i.keys()])j.has(A)||i.delete(A);if(a||M)return[];let P=!1;for(let A=0;A<N.length&&!P;A++)for(let L=A+1;L<N.length;L++){const H=N[A],X=N[L];if(!(H.anchored&&X.anchored)&&Math.abs(H.x+H.w/2-(X.x+X.w/2))<(H.w+X.w)/2+61&&Math.abs(H.y+H.h/2-(X.y+X.h/2))<(H.h+X.h)/2+p){P=!0;break}}if(C.size===0&&!P)return[];if(C.size>0)for(const A of N)C.has(A.sid)&&(A.mass=8);else for(const A of N)A.mass=Math.max(1,A.w*A.h/(Xi*Du));const I=new Map(N.map(A=>[A.sid,A.x])),F=new Map(N.map(A=>[A.sid,A.y]));for(let A=0;A<v;A++){const L=new Map,H=new Map;let X=0;for(let R=0;R<N.length;R++)for(let K=R+1;K<N.length;K++){const G=N[R],ne=N[K];if(G.anchored&&ne.anchored)continue;const Q=G.x+G.w/2,W=G.y+G.h/2,ee=ne.x+ne.w/2,$=ne.y+ne.h/2,Y=(G.w+ne.w)/2+61-Math.abs(Q-ee),ue=(G.h+ne.h)/2+p-Math.abs(W-$);if(Y<=0||ue<=0)continue;const z=(me,Me)=>!me.anchored&&!(Me<0&&me.x<=0),D=(me,Me)=>!me.anchored&&!(Me<0&&me.y<=0),J=(me,Me,He)=>{const ct=me===Me,je=ct?G.sid<ne.sid?-1:1:Math.sign(me-Me);return He(G,je)||He(ne,-je)?je:ct&&(He(G,-je)||He(ne,je))?-je:0},V=J(Q,ee,z),ae=J(W,$,D),he=V!==0,ye=ae!==0;if(!he&&!ye)continue;const _e=he&&(!ye||Y*g<ue),[Ve,Be,qe,Se]=_e?[V,Y,L,z]:[ae,ue,H,D],ce=Se(G,Ve),be=Se(ne,-Ve),ke=G.mass,Ye=ne.mass,dt=ce?be?Ye/(ke+Ye):1:0,lt=be?ce?ke/(ke+Ye):1:0,pe=Be*w;qe.set(G.sid,(qe.get(G.sid)??0)+Ve*pe*dt),qe.set(ne.sid,(qe.get(ne.sid)??0)-Ve*pe*lt),X+=pe}for(const R of N)R.anchored||(R.x=Math.max(0,R.x+(L.get(R.sid)??0)),R.y=Math.max(0,R.y+(H.get(R.sid)??0)));if(X<E)break}const O=[];for(const A of N){const L=A.x-I.get(A.sid),H=A.y-F.get(A.sid);if(!(Math.abs(L)<1&&Math.abs(H)<1)){for(const X of A.members){if(n.has(X))continue;const R=t.get(X);R&&t.set(X,{x:R.x+L,y:R.y+H})}O.push(A.sid)}}return O}const YB=600;function lw(e,t){return!(e.exitAt!=null&&t-e.exitAt>YB||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function KB(e,t){const n=new Set;for(const s of e.agents.values())lw(s,t)&&n.add(s.id);return n}function XB(e,t,n=0){return e.right+n>t.left&&e.left-n<t.right&&e.bottom+n>t.top&&e.top-n<t.bottom}function QB(e,t,n=0){if(!e)return!1;for(const s of t)if(XB(e,s,n))return!0;return!1}const ZR="sessionGroup";function ZB(e,t){var s;if(e.type===ZR)return"transparent";const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const JR=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function _C(e){const t={};for(const n of JR)t[n]=e(n);return t}function JB(e){return t=>e[t]??""}function e8(e,t){return JR.every(n=>e[n]===t[n])}function t8(e){const t=new Set(e.pins),n=new Map,s=new Map;for(const[i,a]of e.positions)n.set(i,a),t.has(i)&&s.set(i,a);return{positions:n,pinned:s}}const n8=1200,r8=1e3;function SC(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<n8?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<r8}function Cv({durationMs:e,documentHidden:t}){return t?!1:Number.isFinite(e)&&e>0}function s8(e,t,n){const s=e.x*t.zoom+t.x,i=e.y*t.zoom+t.y,a=(e.x+e.width)*t.zoom+t.x,l=(e.y+e.height)*t.zoom+t.y;return a>0&&s<n.width&&l>0&&i<n.height}function o8({pane:e,viewport:t,boxes:n}){if(!e||!(e.width>0)||!(e.height>0)||!Number.isFinite(t.zoom)||t.zoom<=0||!Number.isFinite(t.x)||!Number.isFinite(t.y))return!1;let s=!1;for(const i of n)if(s=!0,s8(i,t,e))return!1;return s}const i8="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",jv="click for what's new";function a8(e){if(e.checkDisabled)return`${i8} · ${jv}`;if(e.checking)return`Asking npm for the newest release… · ${jv}`;const t=e.latest?`npm has v${e.latest}`:e.latestPending?`npm's latest tag names v${e.latestPending}, which it cannot serve yet`:"npm not reached yet",n=e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${t}${n} · re-checked periodically · ${jv}, and to check npm now`}function l8(e){const t=`Version v${e.running}, show what's new`;return e.checkDisabled?`${t} — update checks are off`:e.checking?`${t} — checking npm for a newer release`:`${t} and check npm for a newer release`}function c8(e){const t=e.kind==="restart"?`v${e.to} is installed and waiting for a restart`:`v${e.to} is available on npm`,n=e.open?"show what's new":"show what's new and the notice";return`Version v${e.from}, ${t} — ${n}`}function u8(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 cw={kind:"assumed",claude:!0,codex:!0};function d8(e){if(!e||typeof e!="object")return cw;const t=e.providers;if(!t||typeof t!="object")return cw;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function Fu(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const NC=99;function f8(e){const t=Math.max(0,Math.floor(e));return t>NC?`${NC}+`:String(t)}const h8="Pause the canvas";function p8(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 — ${Fu(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)":`${Fu(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function m8(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 eA="paused · full",g8=(e,t)=>t>0?eA:e>0?`paused · ${f8(e)}`:"paused";function y8(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:g8(e.held,t),widest:eA,title:t>0?`Connected — the pause is full at ${Fu(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${Fu(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",resting:!0,label:"live",widest:"live",title:"Receiving events"}:{tone:"dead",resting:!1,label:"offline",widest:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}function EC(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const v8={agent:w3,sessionGroup:$3},tA="react-flow__node";function CC(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,tA))===!0}function w8(e){try{const t=document.querySelector(`.${tA}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const x8=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),b8=420,gu=18,k8=200,_8=5*6e4,S8=6,N8=2*6e4,jC=400,l0="agent-dag.layout",c0="agent-dag.viewport",nA="agent-dag.summariesDismissed",rA="agent-dag.sessionListOpen",sA="agent-dag.detailOpen",oA="agent-dag.usagePanelOpen",TC="agent-dag.accountsPanelOpen",Tv="agent-dag.versionNoticeDismissed",RC="agent-dag.oldNameNoticeDismissed",E8=15*6e4,Rv={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:"},AC="agent-dag.autoRestart",MC="agent-dag.bundleReloadedFor";function C8(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(rA)==="1"}catch{return!1}}function j8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(rA,e?"1":"0")}catch{}}function T8(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(sA)==="1"}catch{return!1}}function R8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(sA,e?"1":"0")}catch{}}function A8(){const e=Zi(oA);return e===null?!0:e==="1"}function M8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(oA,e?"1":"0")}catch{}}function I8(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(nA);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t.filter(n=>typeof n=="string"):[])}catch{return new Set}}function IC(e){if(!(typeof window>"u"))try{const t=Array.from(e),n=t.length>200?t.slice(-200):t;window.localStorage.setItem(nA,JSON.stringify(n))}catch{}}function O8(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(l0);if(!t)return e;const n=JSON.parse(t);if(!("v"in n)){const i=Object.entries(n).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number");return{positions:i,pins:i.map(([a])=>a)}}return{positions:Object.entries(n.positions??{}).filter(([,i])=>i&&typeof i.x=="number"&&typeof i.y=="number"),pins:Array.isArray(n.pins)?n.pins:[]}}catch{return e}}function Av(e,t){if(!(typeof window>"u"))try{const n={};for(const[s,i]of e)n[s]=i;for(const[s,i]of t)n[s]=i;window.localStorage.setItem(l0,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function P8(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(c0);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 $8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(c0,JSON.stringify(e))}catch{}}function OC(){if(!(typeof window>"u")){try{window.localStorage.removeItem(l0)}catch{}try{window.localStorage.removeItem(c0)}catch{}}}function L8(e,t){const n=e.agents.get(t);if(!n)return;const s=[];for(const f of e.agents.values())f.sessionId===t&&s.push(f);const i={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,label:n.label,cwd:n.cwd,startedAt:n.startedAt,endedAt:n.endedAt,model:n.model,agents:s.map(f=>({id:f.id,kind:f.kind,label:f.label,parentId:f.parentId,state:f.state,startedAt:f.startedAt,endedAt:f.endedAt,model:f.model,cwd:f.cwd,usage:f.usage,prompts:f.prompts,tools:f.tools.map(g=>({id:g.id,name:g.name,inputPreview:g.inputPreview,startedAt:g.startedAt,endedAt:g.endedAt,ok:g.ok,errorPreview:g.errorPreview,usage:g.usage}))}))},a=JSON.stringify(i,null,2),l=new Blob([a],{type:"application/json"}),u=URL.createObjectURL(l),h=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");h.href=u,h.download=`${zt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(u),1e3)}const uw={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},dw={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},iA=bT;function q8(e,t,n,s,i,a,l,u,h,p,f,g,v,w,E,b,S,_){const N=[],C=[];for(const A of e.agents.values()){if(!S.has(A.id))continue;const L=A.exitAt!=null,H=b!=null&&!b.has(A.id),X=[L?"rf-exiting":"",H?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,R=a.get(A.id);if(N.push({id:A.id,type:"agent",position:{x:0,y:0},data:{...A,now:t,onOpenContext:_},className:X,...R?{width:R.width,height:R.height}:null}),A.parentId&&S.has(A.parentId)){const K=Mw(A.sessionId),G=L,ne=E.size>0&&(E.has(A.id)||E.has(A.parentId)),Q=b!=null&&!b.has(A.id)&&!b.has(A.parentId),W=A.state==="active"?2:1.5,ee=ne?W+1.5:W,$=G?.2:Q?.12:1,Y=["sess-edge",A.state==="active"?"sess-live":"sess-idle",G?"rf-edge-exiting":"",ne?"rf-edge-selected":""].filter(Boolean).join(" ");C.push({id:`e:${A.parentId}->${A.id}`,source:A.parentId,target:A.id,animated:(A.state==="active"||ne)&&!G,type:"smoothstep",style:{"--session-hue":K,strokeWidth:ee,opacity:$,transition:"var(--edge-transition)"},className:Y})}}const j=new Map;for(const A of e.agents.values())A.tools.length>0&&j.set(A.id,Math.min(4,A.tools.length));const M=`${v}#lanes:${BB(j)}`,P=N.filter(A=>$5(A.id,i,f,g));if(P.length>0||M!==w.current){if(P.length>0){const A=WB(N,C,{direction:"LR",pinned:i,measured:a,availableWidth:n,availableHeight:s,lanes:j});for(const L of A)YT(L.id,f,g)&&q5(L.id,L.position,f,g);GB(N,f,i,a,new Set(P.map(L=>L.id)),j)}HB(N,f,i,a,j),w.current=M}const I=VB(N,f,i,a,l,!h||p,j);I.length>0&&u(I),uu(f,e.agents),uu(g,e.agents),uu(i,e.agents),uu(a,I5(e.agents.values()));const F=[];let O=!1;for(const A of N){let L=i.get(A.id)??f.get(A.id);L||(L=L5(A.id,f,g),O=!0),F.push({...A,position:L})}return O&&(w.current=""),{nodes:F,edges:C}}function D8(){return d.jsx(Rw,{children:d.jsx(F8,{})})}function F8(){var Sa,Na,Ea,Ca;const e=Tl(),t=Mt(),n=k.useState(Yv)[0],s=k.useRef(n),[,i]=k.useState(0),a=k.useCallback(()=>i(q=>q+1),[]),[l,u]=k.useState(()=>new Set),[h,p]=k.useState(null),[f,g]=k.useState(null),v=k.useCallback((q,U)=>{u(ie=>{if(!U)return new Set([q]);const fe=new Set(ie);return fe.has(q)?fe.delete(q):fe.add(q),fe}),p(ie=>U&&ie===q?ie:q)},[]),w=k.useCallback(()=>{u(new Set),p(null)},[]),[E,b]=k.useState(null),[S,_]=k.useState(null),N=k.useCallback(q=>_(q),[]),[C,j]=k.useState(!1),[M,P]=k.useState(!1),I=k.useState(I8)[0],[F,O]=k.useState(C8);k.useEffect(()=>{j8(F)},[F]);const[A,L]=k.useState(T8);k.useEffect(()=>{R8(A)},[A]);const[H,X]=k.useState(A8);k.useEffect(()=>{M8(H)},[H]);const[R,K]=k.useState(()=>{try{const q=window.localStorage.getItem(TC);return q===null?!0:q==="1"}catch{return!0}});k.useEffect(()=>{try{window.localStorage.setItem(TC,R?"1":"0")}catch{}},[R]);const[G,ne]=k.useState(null);k.useEffect(()=>{let q=null;try{q=localStorage.getItem("agent-dag.sound")}catch{}ne(q===null?!0:q==="on")},[]);const Q=k.useCallback(()=>{ne(q=>{var ie;const U=q!==!0;try{localStorage.setItem("agent-dag.sound",U?"on":"off")}catch{}return U&&((ie=_e.current)==null||ie.unlock()),U})},[]),W=k.useCallback(q=>{Q()},[Q]),ee=k.useRef(W);ee.current=W;const $=k.useRef(G);$.current=G;const[Y,ue]=k.useState(()=>r5(Zi)),z=k.useRef(Y);z.current=Y;const D=k.useRef(null),J=k.useCallback((q,U=!1)=>{var ie,fe;if((ie=_e.current)==null||ie.unlock(),D.current!==null&&clearTimeout(D.current),D.current=null,!U){(fe=_e.current)==null||fe.play(q,!0);return}D.current=setTimeout(()=>{var Ee;D.current=null,(Ee=_e.current)==null||Ee.play(q,!0)},ZD)},[]),V=k.useCallback((q,U)=>{ue(ie=>{const fe={level:kl(U.level??ie[q].level),figure:WT(q,U.figure??ie[q].figure)};try{localStorage.setItem(HT[q],String(fe.level)),localStorage.setItem(GT[q],fe.figure)}catch{}return{...ie,[q]:fe}}),J(q,!0)},[J]);k.useEffect(()=>()=>{D.current!==null&&clearTimeout(D.current)},[]);const[ae,he]=k.useState(!1),ye=k.useRef(null),_e=k.useRef(null),[Ve,Be]=k.useState("locked");k.useEffect(()=>{const q=i5({enabled:()=>$.current===!0,prefs:()=>z.current,onState:Be});_e.current=q,Be(q.state());const U=()=>q.unlock();return window.addEventListener("pointerdown",U,{once:!0,capture:!0}),window.addEventListener("keydown",U,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",U,{capture:!0}),window.removeEventListener("keydown",U,{capture:!0})}},[]);const[qe,Se]=k.useState(!1),[ce,be]=k.useState(null),[ke,Ye]=k.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(Tv)??""}catch{return""}}),[dt,lt]=k.useState(!1),pe=k.useRef(0),[me,Me]=k.useState(!1),He=k.useCallback((q=!1)=>(q&&(pe.current=Date.now(),Me(!0)),fetch(q?"/api/version?refresh=1":"/api/version").then(U=>U.ok?U.json():null).then(U=>{U&&be(U)}).catch(()=>{}).finally(()=>{q&&Me(!1)})),[]),ct=k.useCallback(()=>{He(Date.now()-pe.current>=E8)},[He]);k.useEffect(()=>{He();const q=window.setInterval(ct,5*6e4),U=()=>{document.visibilityState==="visible"&&ct()};return document.addEventListener("visibilitychange",U),()=>{window.clearInterval(q),document.removeEventListener("visibilitychange",U)}},[He,ct]),k.useEffect(()=>{qe&&He()},[qe,He]);const je=(ce==null?void 0:ce.notice)??null,[Ge,Ke]=k.useState(null),se=k.useRef(!1);k.useEffect(()=>{if(se.current)return;const q=x5(),U=b5(q),ie=S5({stored:U,running:(ce==null?void 0:ce.running)??null,notes:Y1,remembers:k5(q)});ie.reason!=="no-version"&&(se.current=!0,ie.record&&_5(q,ie.record),ie.show.length&&Ke({entries:ie.show,since:U,firstRun:ie.reason==="welcome"}))},[ce==null?void 0:ce.running]);const Pe=(ce==null?void 0:ce.running)??"3.12.0",$e=k.useMemo(()=>VT(Y1,null,Pe),[Pe]),Te=k.useCallback(()=>{Ke({entries:$e,since:null,firstRun:!1})},[$e]),[Xe,jt]=k.useState(null),[ot,Ie]=k.useState(cw);k.useEffect(()=>{let q=!1;return fetch("/api/health").then(U=>U.ok?U.json():null).then(U=>{q||(Ie(d8(U)),!(!U||typeof U.workspace!="string")&&jt(U.workspace))}).catch(()=>{}),()=>{q=!0}},[qe]);const xt=k.useRef(ot);xt.current=ot;const ft=je?`${je.kind}:${je.to}`:"",gt=je!=null&&ke!==ft,Nn=k.useCallback(()=>{Ye("");try{window.localStorage.setItem(Tv,"")}catch{}},[]),Bn=k.useCallback(()=>{if(je){Ye(ft);try{window.localStorage.setItem(Tv,ft)}catch{}}},[je,ft]),[En,Ao]=k.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(RC)??""}catch{return""}}),mn=ce!=null&&ce.invokedAs&&ce.invokedAs!==zt?ce.invokedAs:null,Mo=mn!=null&&En!==mn,Io=k.useCallback(()=>{if(mn){Ao(mn);try{window.localStorage.setItem(RC,mn)}catch{}}},[mn]),Bt=((Sa=ce==null?void 0:ce.upgrade)==null?void 0:Sa.state)??"idle",Rr=OD(ce==null?void 0:ce.upgrade),Un=k.useRef(!1),qs=k.useCallback(async()=>{if(cr(Un.current||Bt==="running")){Un.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await He(),Un.current=!1}},[Bt,He]);k.useEffect(()=>{if(Bt!=="running")return;const q=window.setInterval(He,3e3);return()=>window.clearInterval(q)},[Bt,He]);const Ar=k.useCallback(async()=>{const q=ce==null?void 0:ce.command;!q||!await UT(q)||(lt(!0),window.setTimeout(()=>lt(!1),1600))},[ce==null?void 0:ce.command]),Oo=k.useCallback(()=>{O(q=>(q||K(!1),!q))},[]),pr=k.useCallback(()=>{K(q=>(q||O(!1),!q))},[]),[Mr,mr]=k.useState(!1),[ss,Po]=k.useState(!1),[$o,Lo]=k.useState(()=>{try{return Number(localStorage.getItem(Z1))||0}catch{return 0}}),[Cn,qo]=k.useState([]),[Ir,Do]=k.useState(!1);k.useEffect(()=>{let q=!0;const U=()=>{fetch("/api/browser-watch?live=0").then(fe=>fe.ok?fe.json():null).then(fe=>{var Ee;!q||!(fe!=null&&fe.ok)||(qo(fe.episodes??[]),Do(((Ee=fe.settings)==null?void 0:Ee.enabled)===!0))}).catch(()=>{})};U();const ie=setInterval(U,5*6e4);return()=>{q=!1,clearInterval(ie)}},[]);const Wn=k.useMemo(()=>fF(Cn,$o).length,[Cn,$o]),[Fo,Ds]=k.useState(0),Fs=k.useRef(null),[zo,Bo]=k.useState(!1),it=k.useRef(null),[sa,os]=k.useState(0),Gt=k.useState(()=>U5({protect:q=>SL(s.current,q)}))[0],[Hn,Uo]=k.useState(!1),is=k.useCallback(()=>{const q=Gt.paused&&Gt.dropped>0,U=Gt.setPaused(!Gt.paused);q&&NL(s.current);for(const ie of U)s.current=n1(s.current,ie);Uo(Gt.paused)},[Gt]),[bt,sn]=k.useState(Date.now()),[Gn,gn]=k.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(AC)!=="0"}catch{return!0}}),gd=k.useCallback(()=>{gn(q=>{const U=!q;try{window.localStorage.setItem(AC,U?"1":"0")}catch{}return U})},[]),[Or,Wo]=k.useState(!1),[Ho,Go]=k.useState("restart"),[as,zs]=k.useState(null),ls=k.useRef(!1),zl=k.useRef(null),Vo=k.useRef(0),Bs=k.useCallback(async q=>{if(!cr(ls.current))return;const U=(q==null?void 0:q.upgrade)===!0;ls.current=!0,zl.current=Rr;const ie=++Vo.current;Go(U?"npx":"restart"),Wo(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(je==null?void 0:je.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:U})})}catch{}window.setTimeout(()=>{if(Vo.current===ie&&ls.current){ls.current=!1,Wo(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},U?18e4:3e4)},[je==null?void 0:je.to,Rr]),Yo=k.useRef(null);k.useEffect(()=>{let q=!1;for(const ie of s.current.agents.values())if(ie.state==="active"){q=!0;break}const U=$D({enabled:Gn,kind:je==null?void 0:je.kind,canRestart:(ce==null?void 0:ce.canRestart)===!0,noticeOpen:gt,busy:q,idleSince:Yo.current,now:bt});Yo.current=U.idleSince,U.restart&&Bs()},[Gn,je==null?void 0:je.kind,ce==null?void 0:ce.canRestart,gt,bt,Bs]),k.useEffect(()=>{const q=ce==null?void 0:ce.running;let U=null,ie=null;try{U=window.sessionStorage.getItem("agent-dag.restartPending"),ie=window.sessionStorage.getItem(MC)}catch{return}const fe=ID({bundle:"3.12.0",running:q,pending:U,lastTried:ie});if(fe==="reload"){try{window.sessionStorage.setItem(MC,q??"")}catch{return}window.location.reload();return}if(fe!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}ls.current=!1,Wo(!1),zs(q??null);const Ee=window.setTimeout(()=>zs(null),6e3);return()=>window.clearTimeout(Ee)},[ce==null?void 0:ce.running]),k.useEffect(()=>{if(Or&&PD({asked:zl.current,reported:Rr})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}ls.current=!1,Wo(!1)}},[Or,Rr]);const cs=k.useState(()=>t8(O8()))[0],Zt=k.useRef(cs.pinned),us=k.useRef(null),Je=k.useState(()=>P8())[0],[Ko,Bl]=k.useState(()=>new Set),[Pr,oa]=k.useState(H5),[Vn,Ul]=k.useState(()=>_C(EC)),Xo=k.useMemo(()=>JB(Vn),[Vn]),Qo=k.useCallback(q=>ZB(q,Xo),[Xo]),gr=k.useMemo(()=>({background:Vn["--panel"],border:`1px solid ${Vn["--line"]}`,borderRadius:8}),[Vn]),[Yn,yr]=k.useState(!1);k.useEffect(()=>{document.documentElement.dataset.theme=Pr;try{window.localStorage.setItem(KT,Pr)}catch{}Ul(q=>{const U=_C(EC);return e8(q,U)?q:U})},[Pr]);const yn=k.useCallback((q,U)=>{if(Cv({durationMs:U,documentHidden:document.hidden})){e.setViewport(q,{duration:U});return}const{d3Zoom:ie,d3Selection:fe}=t.getState(),Ee=fe==null?void 0:fe.property("__zoom");if(ie&&fe&&Ee&&Ee.k>0&&q.zoom>0){ie.transform(fe,Ee.scale(q.zoom/Ee.k).translate((q.x-Ee.x)/q.zoom,(q.y-Ee.y)/q.zoom));return}e.setViewport(q,{duration:0})},[e,t]),Kn=k.useRef(null);k.useEffect(()=>{if(!Je)return;const q=window.setTimeout(()=>{try{yn(Je,0)}catch{}jn.current=Date.now()},60);return()=>window.clearTimeout(q)},[yn,Je]);const Xn=k.useRef(!0);k.useEffect(()=>{const q=new EventSource("/events"),U=z5(a,{now:()=>Date.now(),setTimeout:(ie,fe)=>window.setTimeout(ie,fe),clearTimeout:ie=>window.clearTimeout(ie)});return q.addEventListener("open",()=>{Se(!0),yr(!0)}),q.addEventListener("error",()=>Se(!1)),q.addEventListener("replay-end",()=>{Xn.current=!1,U.flush()}),q.addEventListener("hook",ie=>{var fe;try{const Ee=JSON.parse(ie.data);if(!Gt.accept(Ee))return;s.current=n1(s.current,Ee);const Re=Ee.replay===!0||Xn.current||Date.now()-Ee.receivedAt>3e4;Re?U.replay():U.live();const Ue=o5(Ee,Re);Ue&&((fe=_e.current)==null||fe.play(Ue))}catch{}}),()=>{q.close(),U.cancel()}},[a]),k.useEffect(()=>{const q=setInterval(()=>{const U=Date.now();sn(U);let ie=EL(s.current,U,t1);CL(s.current,U,t1)&&(ie=!0),kL(s.current,U,k8,_8)&&(ie=!0),_L(s.current,U,S8,N8)&&(ie=!0),u(fe=>M5(fe,s.current.agents)),p(fe=>fe!=null&&!s.current.agents.has(fe)?null:fe),_(fe=>fe!=null&&!s.current.agents.has(fe)?null:fe),b(fe=>fe!=null&&!s.current.agents.has(fe)?null:fe),ie&&a()},250);return()=>clearInterval(q)},[a]);const ia=k.useRef(null),jn=k.useRef(0),Us=420,Tn=k.useCallback((q=500)=>{try{const Re=document.querySelector(".canvas-wrap"),Ue=Array.from(document.querySelectorAll(".react-flow__node")).filter(Nt=>Nt.offsetWidth>0);if(!Re||Ue.length===0)return;const nt=Re.getBoundingClientRect(),ut=e.getViewport();if(!Number.isFinite(ut.zoom)||ut.zoom<=0)return;const et=Nt=>(Nt-nt.left-ut.x)/ut.zoom,Vt=Nt=>(Nt-nt.top-ut.y)/ut.zoom,no=Ue.map(Nt=>Nt.getBoundingClientRect()),ro=Math.min(...no.map(Nt=>et(Nt.left))),oc=Math.max(...no.map(Nt=>et(Nt.right))),ja=Math.min(...no.map(Nt=>Vt(Nt.top))),ic=Math.max(...no.map(Nt=>Vt(Nt.bottom))),Ta=oc-ro,ai=ic-ja;if(!(Ta>0&&ai>0))return;const gs=Math.max(.2,Math.min(1,(nt.width-160)/(Ta+Us)*.86,(nt.height-160)/ai*.86)),on={x:80-ro*gs,y:Math.max(80,(nt.height-ai*gs)/2)-ja*gs,zoom:gs};yn(on,q),jn.current=Date.now(),Kn.current=Cv({durationMs:q,documentHidden:document.hidden})?{target:on,until:Date.now()+q+60}:null,window.setTimeout(()=>{var Nt;try{((Nt=Kn.current)==null?void 0:Nt.target)===on&&(Kn.current=null);const li=e.getViewport();(Math.abs(li.zoom-gs)>.01||Math.abs(li.x-on.x)>2)&&yn(on,0)}catch{}},q+60)}catch{}},[e,yn]);k.useEffect(()=>{const q=()=>{if(!document.hidden)return;const U=Kn.current;if(Kn.current=null,!(!U||Date.now()>U.until)){try{yn(U.target,0)}catch{}jn.current=Date.now()}};return document.addEventListener("visibilitychange",q),()=>document.removeEventListener("visibilitychange",q)},[yn]);const Zo=k.useRef(""),ds=k.useRef(null),aa=k.useRef(0),Jo=k.useCallback(()=>{aa.current=Date.now()},[]),$r=k.useRef(null),fs=k.useRef(0),vr=k.useCallback(()=>{fs.current=Date.now()},[]),Ws=k.useCallback(q=>({hasSourceEvent:!!q,at:Date.now(),lastDeckFitAt:jn.current,lastCanvasInputAt:fs.current}),[]),la="agent-dag.autoFitDisabled",Wl=k.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(la)==="1"}catch{return!1}})[0],wr=k.useRef(Wl),[Hs,ei]=k.useState(Wl),ti=k.useCallback(()=>{if(!wr.current){wr.current=!0,ei(!0);try{window.localStorage.setItem(la,"1")}catch{}}},[]),xr=k.useCallback(()=>{wr.current=!1,ei(!1);try{window.localStorage.removeItem(la)}catch{}Tn(400)},[e,Tn]);k.useEffect(()=>{const q=setInterval(()=>{if(wr.current||Date.now()-aa.current<800)return;const U=s.current,ie=Date.now(),fe=[];for(const Re of U.agents.values())lw(Re,ie)&&fe.push({id:Re.id});if(fe.length===0)return;const Ee=[];for(const{id:Re}of fe){const Ue=Qn.current.get(Re),nt=Zt.current.get(Re)??Ot.current.get(Re);!Ue||!nt||Ee.push({x:nt.x,y:nt.y,width:Ue.width,height:Ue.height})}o8({pane:$r.current,viewport:e.getViewport(),boxes:Ee})&&Tn(600)},1500);return()=>clearInterval(q)},[e]);const Gs=k.useRef(!1),Qn=k.useRef(new Map),ca=k.useRef(0),ni=k.useCallback(q=>{const U=Qn.current;let ie=!1;for(const fe of q.nodeInternals.values()){const Ee=fe.width,Re=fe.height;if(Ee==null||Re==null)continue;const Ue=U.get(fe.id);Ue?(Math.abs(Ue.height-Re)>4||Math.abs(Ue.width-Ee)>4)&&(U.set(fe.id,{width:Ee,height:Re}),ie=!0):(U.set(fe.id,{width:Ee,height:Re}),ie=!0)}return ie&&(ca.current+=1),ca.current},[]),Vs=at(ni),[ua,Jt]=k.useState(0);k.useEffect(()=>{let q=0;const U=()=>{const fe=Qn.current;let Ee=!1;for(const Re of document.querySelectorAll(".react-flow__node[data-id]")){const Ue=Re.getAttribute("data-id");if(!Ue)continue;const nt=Re.offsetWidth,ut=Re.offsetHeight;if(!nt||!ut)continue;const et=fe.get(Ue);(!et||Math.abs(et.width-nt)>4||Math.abs(et.height-ut)>4)&&(fe.set(Ue,{width:nt,height:ut}),Ee=!0)}Ee&&Jt(Re=>Re+1)};if(Gs.current)return;let ie=0;return document.visibilityState==="hidden"?ie=window.setTimeout(U,32):q=requestAnimationFrame(U),()=>{cancelAnimationFrame(q),window.clearTimeout(ie)}});const Ot=k.useRef(cs.positions),da=k.useRef(new Set),Lr=k.useRef(""),hs=k.useMemo(()=>{const q=[];for(const U of s.current.agents.values())lw(U,bt)&&q.push(U.id+(U.parentId?`>${U.parentId}`:""));return q.sort(),`${q.join("|")}#sv${Vs}.${ua}`},[s.current,s.current.revision,bt,Vs,ua]),qr=k.useRef(null);k.useEffect(()=>(qr.current!=null&&window.clearTimeout(qr.current),qr.current=window.setTimeout(()=>{Av(Ot.current,Zt.current)},1500),()=>{qr.current!=null&&window.clearTimeout(qr.current)}),[hs]),k.useEffect(()=>{if(Zo.current===hs)return;const q=Zo.current;if(Zo.current=hs,!q||wr.current)return;Date.now()-jn.current>1200&&Tn(400),ia.current&&window.clearTimeout(ia.current),ia.current=window.setTimeout(()=>{wr.current||Tn(500)},280)},[hs,e,Tn]);const Ys=k.useMemo(()=>P5(s.current,l),[s.current,s.current.revision,l]),Dr=k.useMemo(()=>KB(s.current,bt),[s.current,s.current.revision,bt]),Ks=k.useRef(null),[Xs,Hl]=k.useState({w:0,h:0});k.useEffect(()=>{const q=Ks.current;if(!q||typeof ResizeObserver>"u")return;const U=new ResizeObserver(ie=>{var Ee;const fe=(Ee=ie[0])==null?void 0:Ee.contentRect;fe&&($r.current={width:fe.width,height:fe.height},Hl(Re=>Math.abs(Re.w-fe.width)>40||Math.abs(Re.h-fe.height)>40?{w:fe.width,h:fe.height}:Re))});return U.observe(q),$r.current={width:q.clientWidth,height:q.clientHeight},Hl({w:q.clientWidth,h:q.clientHeight}),()=>U.disconnect()},[]);const yd=k.useCallback(q=>{var ie,fe;const U=q.target;!(U!=null&&U.closest)||U.closest(x8)!==q.currentTarget||(q.preventDefault(),(fe=(ie=document.activeElement)==null?void 0:ie.blur)==null||fe.call(ie))},[]),vd=k.useRef(new Map),[ri,wd]=k.useState(!1);k.useEffect(()=>{const q=window.setTimeout(()=>wd(!0),2500);return()=>window.clearTimeout(q)},[]);const[xd,fa]=k.useState(!1),br=k.useRef(null),[ha,pa]=k.useState(!1),bd=k.useCallback(()=>{br.current&&(window.clearTimeout(br.current),br.current=null),fa(!1)},[]),kd=k.useCallback(q=>{q.length!==0&&queueMicrotask(()=>{fa(!0),br.current&&window.clearTimeout(br.current),br.current=window.setTimeout(()=>fa(!1),b8+80)})},[]);k.useEffect(()=>()=>{br.current&&window.clearTimeout(br.current)},[]);const Gl=Xs.w>0?Xs.w*.92:0,Vl=Xs.h>0?Xs.h:0,{nodes:Rn,edges:_d}=k.useMemo(()=>q8(s.current,bt,Gl,Vl,Zt.current,Qn.current,vd.current,kd,ri,ha,Ot.current,da.current,hs,Lr,l,Ys,Dr,N),[s.current,s.current.revision,bt,Gl,Vl,ri,ha,hs,l,Ys,Dr,N,Fo]),Yl=k.useMemo(()=>{const q=new Map;for(const ie of Rn){const fe=ie.data;if(!(fe!=null&&fe.sessionId)||fe.exitAt!=null)continue;const Ee=ie.width,Re=ie.height;if(Ee==null||Re==null)continue;const Ue=ie.position.x,nt=ie.position.y,ut=Ue+Ee,et=nt+Re,Vt=q.get(fe.sessionId);Vt?(Vt.minX=Math.min(Vt.minX,Ue),Vt.minY=Math.min(Vt.minY,nt),Vt.maxX=Math.max(Vt.maxX,ut),Vt.maxY=Math.max(Vt.maxY,et)):q.set(fe.sessionId,{minX:Ue,minY:nt,maxX:ut,maxY:et})}const U=[];for(const[ie,fe]of q){const Ee=fe.maxX-fe.minX+gu*2,Re=fe.maxY-fe.minY+gu*2;U.push({id:`group:${ie}`,type:ZR,position:{x:fe.minX-gu,y:fe.minY-gu},data:{sessionId:ie,w:Ee,h:Re},width:Ee,height:Re,style:{width:Ee,height:Re},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return U},[Rn,bt]),Sd=k.useMemo(()=>{const q=[...Yl,...Rn],U=it.current;return!U||U.size===0?q:q.map(ie=>{const fe=U.get(ie.id);return fe?{...ie,position:fe}:ie})},[Yl,Rn,sa]),Qs=k.useMemo(()=>{const q=new Set;for(const U of s.current.agents.values())for(const ie of U.tools)q.add(iA(ie.name));return Object.keys(uw).filter(U=>q.has(U))},[s.current,s.current.revision]);k.useEffect(()=>{if(Qs.length<=1){Bo(!1);return}let q=0;const U=()=>{const ie=Fs.current;if(ie&&!document.hidden){const fe=ie.getBoundingClientRect(),Ee=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Ue=>Ue.getBoundingClientRect()),Re=QB(fe,Ee,8);Bo(Ue=>Ue===Re?Ue:Re)}q=window.setTimeout(U,300)};return U(),()=>window.clearTimeout(q)},[Qs.length]);const Nd=k.useCallback(q=>{Bl(U=>{const ie=new Set(U);return ie.has(q)?ie.delete(q):ie.add(q),ie})},[]),en=h?s.current.agents.get(h):null,ma=f?Array.from(s.current.agents.values()).flatMap(q=>q.tools).find(q=>q.id===f)??null:null,Kl=k.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=Yv(),Zt.current.clear(),Qn.current.clear(),Ot.current.clear(),Lr.current="",OC(),w(),a()},[a,w]),Xl=k.useRef(C);Xl.current=C;const Ql=k.useRef(M);Ql.current=M;const ga=k.useRef(!1);ga.current=ma!=null||Mr||S!=null||E!=null||ss||M||Ge!=null;const ps=k.useCallback(q=>{const U=LD(q,{confirmOpen:Xl.current,modalOpen:ga.current});U==="confirm"?j(!0):U==="clear"&&(j(!1),Kl())},[Kl]),Fr=k.useCallback(()=>{Zt.current.clear(),Ot.current.clear(),Lr.current="",OC(),a(),window.setTimeout(()=>Tn(500),80)},[a,e,Tn]),Zl=k.useCallback(()=>Tn(500),[Tn]),Zs=k.useRef(Rn);Zs.current=Rn;const ya=k.useRef(h);ya.current=h;const si=k.useCallback(q=>{const U=Zs.current,ie=C5(U.map(Re=>({id:Re.id,x:Re.position.x,y:Re.position.y})),ya.current,q),fe=ie?U.find(Re=>Re.id===ie):void 0;if(!fe)return;const Ee=CC(document.activeElement);v(fe.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[fe]})}catch{}jn.current=Date.now(),Ee&&w8(fe.id)},30)},[v,e]),oi=k.useCallback(q=>{v(q,!1),window.setTimeout(()=>{try{const U=Zs.current.find(ie=>ie.id===q);U&&e.fitView({padding:.3,duration:500,nodes:[U]}),jn.current=Date.now()}catch{}},60)},[v,e]);k.useEffect(()=>{const q=U=>{var nt,ut;const ie=U.target,fe={tagName:ie==null?void 0:ie.tagName,isContentEditable:ie==null?void 0:ie.isContentEditable,role:(nt=ie==null?void 0:ie.getAttribute)==null?void 0:nt.call(ie,"role"),type:ie==null?void 0:ie.type};if(U.key==="Escape"){const et=n3({overlayOpen:Fi.depth()>0,panelOnTop:Fi.topIsPanel(),typing:$w(fe)});et==="dismiss"?Fi.dismissTop():et==="blur"?ie==null||ie.blur():(A5(fe)&&(ie==null||ie.blur()),w());return}if(Pw(U))return;const Ee=CC(ie)?(ut=ie==null?void 0:ie.getAttribute)==null?void 0:ut.call(ie,"data-id"):null,Re=Ee&&Zs.current.some(et=>et.id===Ee)?Ee:null,Ue=T5(U,Re);if(Ue.kind==="activate"){U.preventDefault(),v(Ue.nodeId,Ue.additive);return}Ue.kind!=="node"&&(Ue.nodeId==null&&u3(fe)||d3({key:U.key,modalOpen:ga.current,sheetOpen:Ql.current})||(U.key===" "&&(U.preventDefault(),is()),(U.key==="c"||U.key==="C")&&ps("shortcut"),(U.key==="r"||U.key==="R")&&Fr(),(U.key==="f"||U.key==="F")&&Zl(),(U.key==="l"||U.key==="L")&&Oo(),(U.key==="d"||U.key==="D")&&L(et=>!et),(U.key==="h"||U.key==="H")&&mr(et=>!et),(U.key==="u"||U.key==="U")&&X(et=>!et),(U.key==="a"||U.key==="A")&&xt.current.claude&&pr(),(U.key==="j"||U.key==="J")&&si(1),(U.key==="k"||U.key==="K")&&si(-1),(U.key==="t"||U.key==="T")&&oa(et=>et==="dark"?"light":"dark"),(U.key==="m"||U.key==="M")&&xt.current.claude&&$.current!==null&&ee.current(U.shiftKey),U.key==="?"&&P(et=>!et)))};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[ps,Fr,Zl,w,v,si,is]);const va=s.current.agents.size,kt=k.useMemo(()=>VL(s.current.agents.values()),[s.current,s.current.revision]),Jl=k.useMemo(()=>YL(s.current.agents.values()),[s.current,s.current.revision]),ec=k.useRef(null);k.useEffect(()=>{const q=G5({waiting:kt.length,running:Jl,connected:qe}),U=ec.current;if(ec.current=q,(U==null?void 0:U.title)!==q.title&&(document.title=q.title),(U==null?void 0:U.icon)!==q.icon){const ie=document.querySelector('link[rel="icon"]');ie&&(ie.href=V5[q.icon])}},[kt.length,Jl,qe]);const[Ed,tc]=k.useState(""),wa=K5(kt);k.useEffect(()=>{tc(q=>X5(q,wa))},[wa]);const[Zn,Js]=k.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[zr,ms]=k.useState(null),[Cd,nc]=k.useState(!1),[Jn,eo]=k.useState(!0),[rc,xa]=k.useState(!1);k.useEffect(()=>{let q=!0;return fetch("/api/prefs").then(U=>U.ok?U.json():null).then(U=>{var ie;!q||!(U!=null&&U.ok)||(eo(((ie=U.prefs)==null?void 0:ie.notifications)!==!1),xa(U.notificationsVetoed===!0))}).catch(()=>{}),()=>{q=!1}},[]);const ba=k.useRef(()=>{}),jd=k.useCallback(()=>{const q=!Jn;eo(q),q&&typeof Notification<"u"&&Notification.permission==="default"&&ba.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:q})}).then(U=>U.ok?U.json():null).then(U=>{var ie;U!=null&&U.ok&&(eo(((ie=U.prefs)==null?void 0:ie.notifications)!==!1),xa(U.notificationsVetoed===!0))}).catch(()=>{})},[Jn]),sc=typeof Notification<"u",ka=JL(Zn,sc);k.useEffect(()=>{ka&&Jn&&kt.length>0&&nc(!0)},[ka,Jn,kt.length]),k.useEffect(()=>{if(!zr)return;const U=setTimeout(()=>ms(null),zr==="blocked"?8e3:4e3);return()=>clearTimeout(U)},[zr]);const _a=k.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(q=>{const U=q;Js(U),U==="granted"?ms("on"):U==="denied"&&ms("blocked")})},[]);ba.current=_a;const ii=k.useRef(new Set),tn=k.useRef(null),to=kt.map(q=>Ku(q.id,q.waiting)).join("|");return k.useEffect(()=>{ZL(tn.current,Zn)&&(tn.current=Zn,ii.current=o1(kt))},[Zn]),k.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||tn.current===null)return;const q=typeof document>"u"||!document.hidden,U=XL(kt,ii.current,q,Jn);for(const ie of U)try{const fe=new Notification(ie.title,{body:ie.body,tag:ie.key});fe.onclick=()=>{window.focus(),oi(ie.sessionId),fe.close()}}catch{}ii.current=q?o1(kt):QL(kt,U,ii.current)},[to]),d.jsxs("div",{className:"app",children:[d.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),d.jsxs("header",{className:"topbar",children:[d.jsxs("div",{className:"readout",children:[d.jsxs("div",{className:"brand",children:[d.jsx("span",{className:"logo"}),d.jsx("h1",{children:zt}),je?d.jsxs("button",{type:"button",className:"v stale",onClick:()=>{Te(),Nn()},"aria-haspopup":"dialog","aria-label":c8({...je,open:gt}),title:je.kind==="restart"?`Running v${je.from}; v${je.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${je.from}; v${je.to} is on npm · click for what's new`,children:["v",je.from,d.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const q={running:Pe,latest:ce==null?void 0:ce.latest,latestPending:ce==null?void 0:ce.latestPending,checkedAgo:ce!=null&&ce.checkedAt?ew(bt-ce.checkedAt):null,checkDisabled:ce==null?void 0:ce.checkDisabled,checking:me};return d.jsxs("button",{type:"button",className:me?"v checking":"v",onClick:()=>{Te(),He(!0)},"aria-busy":me||void 0,"aria-haspopup":"dialog","aria-label":l8(q),title:a8(q),children:["v",q.running]})})()]}),d.jsxs("span",{className:"status",children:[(()=>{const q=y8({connected:qe,paused:Hn,held:Gt.size,dropped:Gt.dropped});return q.resting?null:d.jsx("span",{className:`pill ${q.tone}`,title:q.title,children:d.jsxs("span",{className:"pill-box",children:[d.jsx("span",{className:"pill-widest","aria-hidden":!0,children:q.widest}),d.jsx("span",{className:"pill-label",children:q.label})]})})})(),d.jsx(jq,{usageOpen:H})]}),d.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Ed}),kt.length>0&&d.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>oi(kt[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
|
|
223
223
|
${kt.map(q=>` ${q.label}: ${xl(q.waiting)} (${ew(bt-q.waiting.since)})`).join(`
|
|
224
|
-
`)}`,"aria-label":`${kt.length} session${kt.length===1?"":"s"} waiting for you`,children:[d.jsx("span",{className:"ap-pulse","aria-hidden":!0}),d.jsx("b",{children:kt.length})," waiting"]}),Cd&&ka&&Jn&&d.jsx("button",{type:"button",className:"notify-ask",onClick:_a,title:"Get a system notification when a session blocks on you, so the deck can reach you with this tab in the background",children:"notify me"}),zr&&d.jsx("span",{className:zr==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:zr==="on"?"The deck will raise a system notification when a session blocks on you and this tab is in the background":"Notifications are blocked for this page. Only your browser can undo that — its site settings for this address",children:zr==="on"?"notifications on":"notifications blocked"})]}),en&&(()=>{const q=kn(en),U=Math.max(0,((en.endedAt??bt)-en.startedAt)/1e3),ie=en.state==="active"?Ow(q.total,U):null,fe=l.size-1;return d.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${en.label}`,onClick:()=>{try{const Ee=Rn.find(Re=>Re.id===en.id);Ee&&e.fitView({padding:.35,duration:500,nodes:[Ee]}),jn.current=Date.now()}catch{}},children:[d.jsx("span",{className:`state-pill state-${en.state}`,children:en.state==="active"?"live":en.state}),d.jsx("span",{className:"selected-label",children:en.label}),q.total>0&&d.jsxs("span",{className:"selected-cost",children:[tt(q.total),ie?d.jsxs("span",{className:"selected-rate",children:[" · ",ie]}):null]}),fe>0&&d.jsxs("span",{className:"selected-extra",children:["+",fe]}),d.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:Ee=>{Ee.stopPropagation(),w()},children:"×"})]})})(),d.jsxs("div",{className:"actions",children:[d.jsxs("div",{className:"action-run",children:[d.jsx("button",{className:"btn icon-btn",onClick:Io,title:`${F?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":F,"aria-controls":F?"session-list":void 0,children:"☰"}),d.jsx("button",{className:"btn icon-btn",onClick:()=>X(q=>!q),title:`${H?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":H,"aria-controls":H?"usage-panel":void 0,children:"$"}),ot.claude&&d.jsx("button",{className:"btn icon-btn",onClick:pr,title:`${R?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":R,"aria-controls":R?"accounts-panel":void 0,children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[d.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),d.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),d.jsx("button",{className:"btn icon-btn",onClick:()=>mr(q=>!q),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[d.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),d.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),d.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),d.jsxs("button",{className:`btn icon-btn bw-btn${Wn>0?" has-findings":Ir?" watching":""}`,onClick:()=>Oo(q=>!q),title:Ir?"Browser watch — watching; the deck is keeping its own copy":"Browser watch — not watching; reading the browser's history live","aria-label":`Browser watch, ${Ir?"watching":"not watching"}`+(Wn>0?`, ${Wn} unread`:""),"aria-haspopup":"dialog",children:[d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":!0,children:[d.jsx("path",{d:"M0.9 7s2.2-4 6.1-4 6.1 4 6.1 4-2.2 4-6.1 4S0.9 7 0.9 7Z"}),Ir||Wn>0?d.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):d.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),Wn>0&&d.jsx("span",{className:"bw-badge","aria-hidden":!0,children:Wn})]})]}),d.jsxs("div",{className:"action-run",children:[ot.claude&&G!==null&&d.jsxs("div",{className:"sound-slot",children:[d.jsx("button",{ref:ye,className:"btn icon-btn",onClick:()=>he(q=>!q),...lr(!1),title:eF(ot,{on:G===!0,locked:Ve==="locked",prefs:Y}),"aria-label":"Sound settings","aria-haspopup":"dialog","aria-expanded":ae,"aria-controls":ae?"sound-menu":void 0,children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[d.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),G?d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),d.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M10 5.6l2.6 2.8"}),d.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),ae&&d.jsx(l5,{onClose:()=>he(!1),soundOn:G===!0,onToggleSound:Q,prefs:Y,onLevel:(q,U)=>V(q,{level:U}),onFigure:(q,U)=>V(q,{figure:U}),onPreview:q=>J(q),notifyOn:Jn,onToggleNotify:jd,notifyVetoed:rc,notifyPermission:sc?Zn:"unsupported",onAskNotify:_a,openerRef:ye})]}),d.jsx("button",{className:"btn icon-btn",onClick:()=>oa(q=>q==="dark"?"light":"dark"),title:`Switch to ${Pr==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:Pr==="dark"?"☀":"☾"})]})]})]}),is?d.jsxs("div",{className:"ver-banner done",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:["Restarted — now running v",is,"."]}),d.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Yn&&!qe?d.jsxs("div",{className:"conn-banner",role:"alert",children:[d.jsx("span",{className:"conn-dot"}),Or?Wo==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${zt}…`:(()=>{const q=f8({connected:qe,paused:Hn});return d.jsxs(d.Fragment,{children:[`Lost connection to the ${zt} server. Reconnecting…`,q&&d.jsx("span",{className:"conn-sub",children:q})]})})()]}):gt&&je?d.jsxs("div",{className:`ver-banner ${je.kind}`,role:"status",children:[d.jsx("span",{className:"ver-dot"}),je.kind==="restart"?d.jsxs(d.Fragment,{children:[d.jsxs("strong",{children:["v",je.to," is installed — this deck still runs v",je.from,"."]}),ce!=null&&ce.canRestart?d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"ver-act",onClick:()=>zs(),...lr(Or),title:"Stop this process and bring it back on the same port. The canvas replays from the event log.",children:Or?"restarting…":"Restart now"}),d.jsxs("button",{type:"button",className:`ver-auto${Gn?" on":""}`,role:"switch","aria-checked":Gn,onClick:gd,title:Gn?"Restarts on its own once nothing has been running for 30 seconds. Click to require a click instead.":"Only restarts when you click. Click to let it restart itself while idle.",children:[d.jsx("i",{"aria-hidden":!0}),"auto when idle"]})]}):d.jsx("span",{className:"ver-sub",title:"Node loads every module once, at startup. An upgrade replaces the files on disk but not the code already in memory, so this process keeps running the old version until it is restarted.",children:"Restart it to pick up the new code."})]}):d.jsxs(d.Fragment,{children:[d.jsxs("strong",{children:[zt," v",je.to," is out — you are on v",je.from,"."]}),(ce==null?void 0:ce.upgradeMode)==="install"&&Bt!=="failed"&&d.jsx("button",{type:"button",className:"ver-act",onClick:Ls,...lr(Bt==="running",Bt==="done"),title:`Runs ${((Na=ce==null?void 0:ce.upgrade)==null?void 0:Na.command)??(ce==null?void 0:ce.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Bt==="running"?"installing…":Bt==="done"?"installed":"Update now"}),(ce==null?void 0:ce.upgradeMode)==="npx"&&(ce==null?void 0:ce.canRestart)&&d.jsx("button",{type:"button",className:"ver-act",onClick:()=>zs({upgrade:!0}),...lr(Or),title:`Runs ${ce==null?void 0:ce.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Or?"fetching…":Bt==="failed"?"Retry update":"Update & restart"}),Bt==="failed"?d.jsxs("span",{className:"ver-sub fail",title:((Ea=ce==null?void 0:ce.upgrade)==null?void 0:Ea.error)??"",children:[(ce==null?void 0:ce.upgradeMode)==="npx"?"update failed":"install failed",": ",((Ca=ce==null?void 0:ce.upgrade)==null?void 0:Ca.error)??"unknown error"," — run it yourself:"]}):(ce==null?void 0:ce.upgradeMode)==="npx"?d.jsx("span",{className:"ver-sub",children:ce!=null&&ce.canRestart?"npx cannot upgrade in place, so the deck re-runs:":Rv.npx}):ce!=null&&ce.upgradeBlocked?d.jsx("span",{className:"ver-sub",children:Object.hasOwn(Rv,ce.upgradeBlocked)?Rv[ce.upgradeBlocked]:"cannot install from here"}):null,d.jsxs("button",{type:"button",className:"ver-cmd",onClick:Ar,title:"Copy to clipboard",children:[d.jsx("code",{children:ce==null?void 0:ce.command}),d.jsx("span",{className:"ver-cmd-hint",children:dt?"copied":"copy"})]})]}),d.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Bn,children:"×"})]}):Ao&&mn?d.jsxs("div",{className:"ver-banner",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:[mn," still works — the deck is called ",zt," now."]}),ce!=null&&ce.renameFix?d.jsx("span",{className:"ver-sub",children:ce.renameFix}):null,d.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Mo,children:"×"})]}):null,H&&d.jsx(t4,{state:s.current,now:bt,providers:ot,onClose:()=>X(!1)}),R&&ot.claude&&d.jsx(CD,{onClose:()=>K(!1)}),F&&d.jsx(_q,{state:s.current,now:bt,selectedIds:l,onSelect:si,onClose:()=>O(!1)}),d.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${xd?" bubbling":""}${ha?" dragging-any":""}`,ref:Ys,onMouseDownCapture:yd,onPointerDownCapture:vr,onPointerUpCapture:vr,onWheelCapture:vr,children:[va===0&&d.jsx(q8,{live:qe,everConnected:Yn,providers:ot,workspace:Xe}),(Xs.length>1||Yo.size>0)&&d.jsx("div",{ref:Ds,className:`cat-filter-bar${Fo?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:Xs.map(q=>{const U=Yo.has(q);return d.jsxs("button",{type:"button",className:`cat-filter${U?" off":""}`,onClick:()=>Nd(q),"aria-pressed":!U,title:`${U?"Show":"Hide"} ${dw[q]} tools`,children:[d.jsx("span",{className:"cat-emoji",children:uw[q]}),d.jsx("span",{className:"cat-name",children:dw[q]})]},q)})}),d.jsxs(Jj,{nodes:Sd,edges:_d,nodeTypes:m8,fitView:!Je,fitViewOptions:{padding:.25,duration:Cv({durationMs:jC,documentHidden:document.hidden})?jC:0},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(q,U)=>{if(U.type==="sessionGroup"){w();return}v(U.id,q.shiftKey)},onPaneClick:()=>w(),onMoveStart:q=>{SC(Us(q))&&ei()},onMove:(q,U)=>{Zo(),SC(Us(q))&&ei(),us.current&&window.clearTimeout(us.current),us.current=window.setTimeout(()=>I8(U),250)},onNodeDragStart:(q,U)=>{var ie;if(bd(),Hs.current=!0,it.current=new Map,pa(!0),Zo(),ei(),U.type==="sessionGroup"){const fe=(ie=U.data)==null?void 0:ie.sessionId,Ee=new Map;if(fe)for(const Re of Rn){const Ue=Re.data;(Ue==null?void 0:Ue.sessionId)===fe&&Ee.set(Re.id,{x:Re.position.x,y:Re.position.y})}cs.current={start:{x:U.position.x,y:U.position.y},members:Ee};return}Zt.current.set(U.id,{x:U.position.x,y:U.position.y})},onNodeDrag:(q,U)=>{var ie;if(Zo(),U.type==="sessionGroup"){const fe=cs.current;if(!fe)return;const Ee=U.position.x-fe.start.x,Re=U.position.y-fe.start.y;for(const[nt,ut]of fe.members){const et={x:ut.x+Ee,y:ut.y+Re};Zt.current.set(nt,et),Ot.current.set(nt,et)}const Ue=it.current;if(Ue){for(const[nt,ut]of fe.members)Ue.set(nt,{x:ut.x+Ee,y:ut.y+Re});Ue.set(U.id,{x:U.position.x,y:U.position.y})}ss(nt=>nt+1);return}Zt.current.set(U.id,{x:U.position.x,y:U.position.y}),Ot.current.set(U.id,{x:U.position.x,y:U.position.y}),(ie=it.current)==null||ie.set(U.id,{x:U.position.x,y:U.position.y}),ss(fe=>fe+1)},onNodeDragStop:(q,U)=>{if(Zo(),Hs.current=!1,it.current=null,pa(!1),qs(ie=>ie+1),U.type==="sessionGroup"){const ie=cs.current;if(ie){const fe=U.position.x-ie.start.x,Ee=U.position.y-ie.start.y;for(const[Re,Ue]of ie.members){const nt={x:Ue.x+fe,y:Ue.y+Ee};Zt.current.set(Re,nt),Ot.current.set(Re,nt)}}cs.current=null,Av(Ot.current,Zt.current),qs(fe=>fe+1);return}Zt.current.set(U.id,{x:U.position.x,y:U.position.y}),Ot.current.set(U.id,{x:U.position.x,y:U.position.y}),Av(Ot.current,Zt.current)},children:[d.jsx(iL,{gap:28,size:1,color:Vn["--grid-line"]}),d.jsx(O3,{onFit:()=>{jn.current=Date.now()}}),d.jsx(mq,{agents:s.current.agents,visibleAgentIds:Dr,positions:Ot.current,pinned:Zt.current,measured:Qn.current,spotlight:Vs,hiddenCategories:Yo,now:bt,onOpenTool:g}),d.jsxs(eL,{showInteractive:!1,children:[d.jsx(Er,{onClick:xr,title:Ws?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:Ws?{color:"var(--accent)"}:void 0,children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),d.jsx(Er,{onClick:os,title:d8({paused:Hn,held:Gt.size,dropped:Gt.dropped}),"aria-label":u8,"aria-pressed":Hn,children:d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:d.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),d.jsx(Er,{onClick:Fr,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),d.jsx(Er,{onClick:()=>hs("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),d.jsx("path",{d:"M9 6.2V4.4a1.6 1.6 0 0 1 1.6-1.6h2.8a1.6 1.6 0 0 1 1.6 1.6v1.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),d.jsx("path",{d:"M17.4 6.4 16.7 20a2 2 0 0 1-2 1.9H9.3a2 2 0 0 1-2-1.9L6.6 6.4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),d.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),d.jsx(Er,{onClick:()=>P(q=>!q),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("path",{d:"M8.6 8.4a3.5 3.5 0 1 1 4.6 3.35c-.85.3-1.2 1-1.2 1.85v1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),d.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),d.jsx(V$,{zoomable:!0,pannable:!0,nodeColor:Xo,nodeStrokeWidth:2,maskColor:Vn["--minimap-mask"],style:gr})]})]}),A&&en?d.jsxs("aside",{className:"detail","aria-label":"Detail",children:[d.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>L(!1),children:"×"}),d.jsx(F8,{agent:en,now:bt,onOpenTool:g,onShowSummary:q=>{I.has(q)&&(I.delete(q),IC(I)),b(q)},onExportSession:q=>O8(s.current,q)})]}):null,ma&&d.jsx(N3,{tool:ma,onClose:()=>g(null)}),Mr&&d.jsx(oF,{providers:ot,onClose:()=>mr(!1)}),rs&&d.jsx(yF,{onClose:()=>Oo(!1),onSeen:q=>{$o(q);try{localStorage.setItem(Z1,String(q))}catch{}},onWatching:qo,palette:Vn}),S&&(()=>{const q=s.current.agents.get(S);return q?d.jsx(y3,{agent:q,onClose:()=>_(null)}):null})(),E&&d.jsx(xq,{state:s.current,sessionId:E,onClose:()=>{I.add(E),IC(I),b(null)}}),Ge&&d.jsx(k5,{entries:Ge.entries,since:Ge.since,firstRun:Ge.firstRun,running:Pe,onClose:()=>Ke(null)}),M&&d.jsx(zD,{onClose:()=>P(!1)}),C&&d.jsx(qD,{agentCount:va,onConfirm:()=>hs("confirmation"),onCancel:()=>j(!1)})]})}function q8({live:e,everConnected:t,providers:n,workspace:s}){const i=!e;return d.jsxs("div",{className:"empty-hero",children:[d.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[d.jsx("div",{className:"core"}),d.jsxs("div",{className:"orbit r1",children:[d.jsx("span",{className:"dot"}),d.jsx("span",{className:"dot b"})]}),d.jsxs("div",{className:"orbit r2",children:[d.jsx("span",{className:"dot"}),d.jsx("span",{className:"dot b"})]}),d.jsxs("div",{className:"orbit r3",children:[d.jsx("span",{className:"dot"}),d.jsx("span",{className:"dot b"})]})]}),i?d.jsxs(d.Fragment,{children:[d.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),d.jsxs("p",{children:["The browser cannot reach ",d.jsx("code",{children:"/events"}),". Check that",d.jsx("code",{children:zt})," is still running in your terminal, then this page will resume automatically."]})]}):D8(n,s)]})}function D8(e,t){const n=a8(t);return d.jsxs(d.Fragment,{children:[d.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?d.jsxs("p",{children:[n.lead," ",d.jsx("code",{children:n.workspace}),n.tail]}):d.jsxs("p",{children:["Run ",d.jsx("code",{children:"claude"})," or ",d.jsx("code",{children:"codex"})," in any folder. As soon as a session sends an event, a node appears here and grows as subagents fork and tools are called."]}),d.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",d.jsx("code",{children:zt})," is running."]}),J5(e).map(s=>d.jsx("p",{className:"hint-row",children:s.spans.map((i,a)=>i.code?d.jsx("code",{children:i.text},a):d.jsx("span",{children:i.text},a))},s.provider))]})}function F8({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:i}){const a=Ou(e.startedAt,e.endedAt,t),l=kn(e),u=l.total>0,h=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const E of e.tools){const b=iA(E.name);p.set(b,(p.get(b)??0)+1)}const f=e.tools.filter(E=>E.ok===!1).length,g=e.tools.filter(E=>!E.endedAt).length,v=Array.from(p.entries()).sort((E,b)=>b[1]-E[1]),w=p.has("mcp")?uq(e.tools.map(E=>E.name)):null;return d.jsxs(d.Fragment,{children:[d.jsxs("header",{className:"detail-hero",children:[d.jsxs("div",{className:"hero-line",children:[d.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),d.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),d.jsxs("div",{className:"hero-meta",children:[d.jsx("span",{className:"hero-meta-item",children:e.kind}),d.jsx("span",{className:"hero-sep",children:"·"}),d.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:a}),e.model&&(()=>{const E=pT(e);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"hero-sep",children:"·"}),d.jsxs("span",{className:"model-chip","data-family":Yu(e.model),title:E.length>0?`${e.model}
|
|
224
|
+
`)}`,"aria-label":`${kt.length} session${kt.length===1?"":"s"} waiting for you`,children:[d.jsx("span",{className:"ap-pulse","aria-hidden":!0}),d.jsx("b",{children:kt.length})," waiting"]}),Cd&&ka&&Jn&&d.jsx("button",{type:"button",className:"notify-ask",onClick:_a,title:"Get a system notification when a session blocks on you, so the deck can reach you with this tab in the background",children:"notify me"}),zr&&d.jsx("span",{className:zr==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:zr==="on"?"The deck will raise a system notification when a session blocks on you and this tab is in the background":"Notifications are blocked for this page. Only your browser can undo that — its site settings for this address",children:zr==="on"?"notifications on":"notifications blocked"})]}),en&&(()=>{const q=kn(en),U=Math.max(0,((en.endedAt??bt)-en.startedAt)/1e3),ie=en.state==="active"?Ow(q.total,U):null,fe=l.size-1;return d.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${en.label}`,onClick:()=>{try{const Ee=Rn.find(Re=>Re.id===en.id);Ee&&e.fitView({padding:.35,duration:500,nodes:[Ee]}),jn.current=Date.now()}catch{}},children:[d.jsx("span",{className:`state-pill state-${en.state}`,children:en.state==="active"?"live":en.state}),d.jsx("span",{className:"selected-label",children:en.label}),q.total>0&&d.jsxs("span",{className:"selected-cost",children:[tt(q.total),ie?d.jsxs("span",{className:"selected-rate",children:[" · ",ie]}):null]}),fe>0&&d.jsxs("span",{className:"selected-extra",children:["+",fe]}),d.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:Ee=>{Ee.stopPropagation(),w()},children:"×"})]})})(),d.jsxs("div",{className:"actions",children:[d.jsxs("div",{className:"action-run",children:[d.jsx("button",{className:"btn icon-btn",onClick:Oo,title:`${F?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":F,"aria-controls":F?"session-list":void 0,children:"☰"}),d.jsx("button",{className:"btn icon-btn",onClick:()=>X(q=>!q),title:`${H?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":H,"aria-controls":H?"usage-panel":void 0,children:"$"}),ot.claude&&d.jsx("button",{className:"btn icon-btn",onClick:pr,title:`${R?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":R,"aria-controls":R?"accounts-panel":void 0,children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[d.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),d.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),d.jsx("button",{className:"btn icon-btn",onClick:()=>mr(q=>!q),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[d.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),d.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),d.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),d.jsxs("button",{className:`btn icon-btn bw-btn${Wn>0?" has-findings":Ir?" watching":""}`,onClick:()=>Po(q=>!q),title:Ir?"Browser watch — watching; the deck is keeping its own copy":"Browser watch — not watching; reading the browser's history live","aria-label":`Browser watch, ${Ir?"watching":"not watching"}`+(Wn>0?`, ${Wn} unread`:""),"aria-haspopup":"dialog",children:[d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":!0,children:[d.jsx("path",{d:"M0.9 7s2.2-4 6.1-4 6.1 4 6.1 4-2.2 4-6.1 4S0.9 7 0.9 7Z"}),Ir||Wn>0?d.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):d.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),Wn>0&&d.jsx("span",{className:"bw-badge","aria-hidden":!0,children:Wn})]})]}),d.jsxs("div",{className:"action-run",children:[ot.claude&&G!==null&&d.jsxs("div",{className:"sound-slot",children:[d.jsx("button",{ref:ye,className:"btn icon-btn",onClick:()=>he(q=>!q),...lr(!1),title:rF(ot,{on:G===!0,locked:Ve==="locked",prefs:Y}),"aria-label":"Sound settings","aria-haspopup":"dialog","aria-expanded":ae,"aria-controls":ae?"sound-menu":void 0,children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[d.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),G?d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),d.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M10 5.6l2.6 2.8"}),d.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),ae&&d.jsx(d5,{onClose:()=>he(!1),soundOn:G===!0,onToggleSound:Q,prefs:Y,onLevel:(q,U)=>V(q,{level:U}),onFigure:(q,U)=>V(q,{figure:U}),onPreview:q=>J(q),notifyOn:Jn,onToggleNotify:jd,notifyVetoed:rc,notifyPermission:sc?Zn:"unsupported",onAskNotify:_a,openerRef:ye})]}),d.jsx("button",{className:"btn icon-btn",onClick:()=>oa(q=>q==="dark"?"light":"dark"),title:`Switch to ${Pr==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:Pr==="dark"?"☀":"☾"})]})]})]}),as?d.jsxs("div",{className:"ver-banner done",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:["Restarted — now running v",as,"."]}),d.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Yn&&!qe?d.jsxs("div",{className:"conn-banner",role:"alert",children:[d.jsx("span",{className:"conn-dot"}),Or?Ho==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${zt}…`:(()=>{const q=m8({connected:qe,paused:Hn});return d.jsxs(d.Fragment,{children:[`Lost connection to the ${zt} server. Reconnecting…`,q&&d.jsx("span",{className:"conn-sub",children:q})]})})()]}):gt&&je?d.jsxs("div",{className:`ver-banner ${je.kind}`,role:"status",children:[d.jsx("span",{className:"ver-dot"}),je.kind==="restart"?d.jsxs(d.Fragment,{children:[d.jsxs("strong",{children:["v",je.to," is installed — this deck still runs v",je.from,"."]}),ce!=null&&ce.canRestart?d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"ver-act",onClick:()=>Bs(),...lr(Or),title:"Stop this process and bring it back on the same port. The canvas replays from the event log.",children:Or?"restarting…":"Restart now"}),d.jsxs("button",{type:"button",className:`ver-auto${Gn?" on":""}`,role:"switch","aria-checked":Gn,onClick:gd,title:Gn?"Restarts on its own once nothing has been running for 30 seconds. Click to require a click instead.":"Only restarts when you click. Click to let it restart itself while idle.",children:[d.jsx("i",{"aria-hidden":!0}),"auto when idle"]})]}):d.jsx("span",{className:"ver-sub",title:"Node loads every module once, at startup. An upgrade replaces the files on disk but not the code already in memory, so this process keeps running the old version until it is restarted.",children:"Restart it to pick up the new code."})]}):d.jsxs(d.Fragment,{children:[d.jsxs("strong",{children:[zt," v",je.to," is out — you are on v",je.from,"."]}),(ce==null?void 0:ce.upgradeMode)==="install"&&Bt!=="failed"&&d.jsx("button",{type:"button",className:"ver-act",onClick:qs,...lr(Bt==="running",Bt==="done"),title:`Runs ${((Na=ce==null?void 0:ce.upgrade)==null?void 0:Na.command)??(ce==null?void 0:ce.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Bt==="running"?"installing…":Bt==="done"?"installed":"Update now"}),(ce==null?void 0:ce.upgradeMode)==="npx"&&(ce==null?void 0:ce.canRestart)&&d.jsx("button",{type:"button",className:"ver-act",onClick:()=>Bs({upgrade:!0}),...lr(Or),title:`Runs ${ce==null?void 0:ce.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Or?"fetching…":Bt==="failed"?"Retry update":"Update & restart"}),Bt==="failed"?d.jsxs("span",{className:"ver-sub fail",title:((Ea=ce==null?void 0:ce.upgrade)==null?void 0:Ea.error)??"",children:[(ce==null?void 0:ce.upgradeMode)==="npx"?"update failed":"install failed",": ",((Ca=ce==null?void 0:ce.upgrade)==null?void 0:Ca.error)??"unknown error"," — run it yourself:"]}):(ce==null?void 0:ce.upgradeMode)==="npx"?d.jsx("span",{className:"ver-sub",children:ce!=null&&ce.canRestart?"npx cannot upgrade in place, so the deck re-runs:":Rv.npx}):ce!=null&&ce.upgradeBlocked?d.jsx("span",{className:"ver-sub",children:Object.hasOwn(Rv,ce.upgradeBlocked)?Rv[ce.upgradeBlocked]:"cannot install from here"}):null,d.jsxs("button",{type:"button",className:"ver-cmd",onClick:Ar,title:"Copy to clipboard",children:[d.jsx("code",{children:ce==null?void 0:ce.command}),d.jsx("span",{className:"ver-cmd-hint",children:dt?"copied":"copy"})]})]}),d.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Bn,children:"×"})]}):Mo&&mn?d.jsxs("div",{className:"ver-banner",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:[mn," still works — the deck is called ",zt," now."]}),ce!=null&&ce.renameFix?d.jsx("span",{className:"ver-sub",children:ce.renameFix}):null,d.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Io,children:"×"})]}):null,H&&d.jsx(tq,{state:s.current,now:bt,providers:ot,onClose:()=>X(!1)}),R&&ot.claude&&d.jsx(RD,{onClose:()=>K(!1)}),F&&d.jsx(_4,{state:s.current,now:bt,selectedIds:l,onSelect:oi,onClose:()=>O(!1)}),d.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${xd?" bubbling":""}${ha?" dragging-any":""}`,ref:Ks,onMouseDownCapture:yd,onPointerDownCapture:vr,onPointerUpCapture:vr,onWheelCapture:vr,children:[va===0&&d.jsx(z8,{live:qe,everConnected:Yn,providers:ot,workspace:Xe}),(Qs.length>1||Ko.size>0)&&d.jsx("div",{ref:Fs,className:`cat-filter-bar${zo?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:Qs.map(q=>{const U=Ko.has(q);return d.jsxs("button",{type:"button",className:`cat-filter${U?" off":""}`,onClick:()=>Nd(q),"aria-pressed":!U,title:`${U?"Show":"Hide"} ${dw[q]} tools`,children:[d.jsx("span",{className:"cat-emoji",children:uw[q]}),d.jsx("span",{className:"cat-name",children:dw[q]})]},q)})}),d.jsxs(Jj,{nodes:Sd,edges:_d,nodeTypes:v8,fitView:!Je,fitViewOptions:{padding:.25,duration:Cv({durationMs:jC,documentHidden:document.hidden})?jC:0},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(q,U)=>{if(U.type==="sessionGroup"){w();return}v(U.id,q.shiftKey)},onPaneClick:()=>w(),onMoveStart:q=>{SC(Ws(q))&&ti()},onMove:(q,U)=>{Jo(),SC(Ws(q))&&ti(),ds.current&&window.clearTimeout(ds.current),ds.current=window.setTimeout(()=>$8(U),250)},onNodeDragStart:(q,U)=>{var ie;if(bd(),Gs.current=!0,it.current=new Map,pa(!0),Jo(),ti(),U.type==="sessionGroup"){const fe=(ie=U.data)==null?void 0:ie.sessionId,Ee=new Map;if(fe)for(const Re of Rn){const Ue=Re.data;(Ue==null?void 0:Ue.sessionId)===fe&&Ee.set(Re.id,{x:Re.position.x,y:Re.position.y})}us.current={start:{x:U.position.x,y:U.position.y},members:Ee};return}Zt.current.set(U.id,{x:U.position.x,y:U.position.y})},onNodeDrag:(q,U)=>{var ie;if(Jo(),U.type==="sessionGroup"){const fe=us.current;if(!fe)return;const Ee=U.position.x-fe.start.x,Re=U.position.y-fe.start.y;for(const[nt,ut]of fe.members){const et={x:ut.x+Ee,y:ut.y+Re};Zt.current.set(nt,et),Ot.current.set(nt,et)}const Ue=it.current;if(Ue){for(const[nt,ut]of fe.members)Ue.set(nt,{x:ut.x+Ee,y:ut.y+Re});Ue.set(U.id,{x:U.position.x,y:U.position.y})}os(nt=>nt+1);return}Zt.current.set(U.id,{x:U.position.x,y:U.position.y}),Ot.current.set(U.id,{x:U.position.x,y:U.position.y}),(ie=it.current)==null||ie.set(U.id,{x:U.position.x,y:U.position.y}),os(fe=>fe+1)},onNodeDragStop:(q,U)=>{if(Jo(),Gs.current=!1,it.current=null,pa(!1),Ds(ie=>ie+1),U.type==="sessionGroup"){const ie=us.current;if(ie){const fe=U.position.x-ie.start.x,Ee=U.position.y-ie.start.y;for(const[Re,Ue]of ie.members){const nt={x:Ue.x+fe,y:Ue.y+Ee};Zt.current.set(Re,nt),Ot.current.set(Re,nt)}}us.current=null,Av(Ot.current,Zt.current),Ds(fe=>fe+1);return}Zt.current.set(U.id,{x:U.position.x,y:U.position.y}),Ot.current.set(U.id,{x:U.position.x,y:U.position.y}),Av(Ot.current,Zt.current)},children:[d.jsx(iL,{gap:28,size:1,color:Vn["--grid-line"]}),d.jsx(O3,{onFit:()=>{jn.current=Date.now()}}),d.jsx(m4,{agents:s.current.agents,visibleAgentIds:Dr,positions:Ot.current,pinned:Zt.current,measured:Qn.current,spotlight:Ys,hiddenCategories:Ko,now:bt,onOpenTool:g}),d.jsxs(eL,{showInteractive:!1,children:[d.jsx(Er,{onClick:xr,title:Hs?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:Hs?{color:"var(--accent)"}:void 0,children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),d.jsx(Er,{onClick:is,title:p8({paused:Hn,held:Gt.size,dropped:Gt.dropped}),"aria-label":h8,"aria-pressed":Hn,children:d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:d.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),d.jsx(Er,{onClick:Fr,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),d.jsx(Er,{onClick:()=>ps("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),d.jsx("path",{d:"M9 6.2V4.4a1.6 1.6 0 0 1 1.6-1.6h2.8a1.6 1.6 0 0 1 1.6 1.6v1.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),d.jsx("path",{d:"M17.4 6.4 16.7 20a2 2 0 0 1-2 1.9H9.3a2 2 0 0 1-2-1.9L6.6 6.4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),d.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),d.jsx(Er,{onClick:()=>P(q=>!q),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("path",{d:"M8.6 8.4a3.5 3.5 0 1 1 4.6 3.35c-.85.3-1.2 1-1.2 1.85v1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),d.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),d.jsx(V$,{zoomable:!0,pannable:!0,nodeColor:Qo,nodeStrokeWidth:2,maskColor:Vn["--minimap-mask"],style:gr})]})]}),A&&en?d.jsxs("aside",{className:"detail","aria-label":"Detail",children:[d.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>L(!1),children:"×"}),d.jsx(U8,{agent:en,now:bt,onOpenTool:g,onShowSummary:q=>{I.has(q)&&(I.delete(q),IC(I)),b(q)},onExportSession:q=>L8(s.current,q)})]}):null,ma&&d.jsx(N3,{tool:ma,onClose:()=>g(null)}),Mr&&d.jsx(lF,{providers:ot,onClose:()=>mr(!1)}),ss&&d.jsx(xF,{onClose:()=>Po(!1),onSeen:q=>{Lo(q);try{localStorage.setItem(Z1,String(q))}catch{}},onWatching:Do,palette:Vn}),S&&(()=>{const q=s.current.agents.get(S);return q?d.jsx(y3,{agent:q,onClose:()=>_(null)}):null})(),E&&d.jsx(x4,{state:s.current,sessionId:E,onClose:()=>{I.add(E),IC(I),b(null)}}),Ge&&d.jsx(N5,{entries:Ge.entries,since:Ge.since,firstRun:Ge.firstRun,running:Pe,onClose:()=>Ke(null)}),M&&d.jsx(WD,{onClose:()=>P(!1)}),C&&d.jsx(zD,{agentCount:va,onConfirm:()=>ps("confirmation"),onCancel:()=>j(!1)})]})}function z8({live:e,everConnected:t,providers:n,workspace:s}){const i=!e;return d.jsxs("div",{className:"empty-hero",children:[d.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[d.jsx("div",{className:"core"}),d.jsxs("div",{className:"orbit r1",children:[d.jsx("span",{className:"dot"}),d.jsx("span",{className:"dot b"})]}),d.jsxs("div",{className:"orbit r2",children:[d.jsx("span",{className:"dot"}),d.jsx("span",{className:"dot b"})]}),d.jsxs("div",{className:"orbit r3",children:[d.jsx("span",{className:"dot"}),d.jsx("span",{className:"dot b"})]})]}),i?d.jsxs(d.Fragment,{children:[d.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),d.jsxs("p",{children:["The browser cannot reach ",d.jsx("code",{children:"/events"}),". Check that",d.jsx("code",{children:zt})," is still running in your terminal, then this page will resume automatically."]})]}):B8(n,s)]})}function B8(e,t){const n=u8(t);return d.jsxs(d.Fragment,{children:[d.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?d.jsxs("p",{children:[n.lead," ",d.jsx("code",{children:n.workspace}),n.tail]}):d.jsxs("p",{children:["Run ",d.jsx("code",{children:"claude"})," or ",d.jsx("code",{children:"codex"})," in any folder. As soon as a session sends an event, a node appears here and grows as subagents fork and tools are called."]}),d.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",d.jsx("code",{children:zt})," is running."]}),nF(e).map(s=>d.jsx("p",{className:"hint-row",children:s.spans.map((i,a)=>i.code?d.jsx("code",{children:i.text},a):d.jsx("span",{children:i.text},a))},s.provider))]})}function U8({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:i}){const a=Ou(e.startedAt,e.endedAt,t),l=kn(e),u=l.total>0,h=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const E of e.tools){const b=iA(E.name);p.set(b,(p.get(b)??0)+1)}const f=e.tools.filter(E=>E.ok===!1).length,g=e.tools.filter(E=>!E.endedAt).length,v=Array.from(p.entries()).sort((E,b)=>b[1]-E[1]),w=p.has("mcp")?u4(e.tools.map(E=>E.name)):null;return d.jsxs(d.Fragment,{children:[d.jsxs("header",{className:"detail-hero",children:[d.jsxs("div",{className:"hero-line",children:[d.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),d.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),d.jsxs("div",{className:"hero-meta",children:[d.jsx("span",{className:"hero-meta-item",children:e.kind}),d.jsx("span",{className:"hero-sep",children:"·"}),d.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:a}),e.model&&(()=>{const E=pT(e);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"hero-sep",children:"·"}),d.jsxs("span",{className:"model-chip","data-family":Yu(e.model),title:E.length>0?`${e.model}
|
|
225
225
|
spend on this panel also covers:
|
|
226
226
|
${E.join(`
|
|
227
|
-
`)}`:e.model,children:[
|
|
227
|
+
`)}`:e.model,children:[$s(e.model),E.length>0?` +${E.length}`:""]})]})})()]}),u&&d.jsxs("div",{className:"hero-cost",children:[d.jsxs("div",{className:"hero-cost-headline",children:[d.jsx("span",{className:"hero-cost-value",children:tt(l.total)}),d.jsx("span",{className:"hero-cost-label",children:"spend"})]}),d.jsx(qw,{cost:l})]}),d.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&s&&d.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>s(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),i&&d.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>i(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),e.tools.length>0&&d.jsxs("section",{className:"detail-section",children:[d.jsx("h3",{children:"Activity"}),d.jsxs("div",{className:"activity-row",children:[d.jsxs("div",{className:"activity-counters",children:[d.jsxs("span",{className:"ac-item",children:[d.jsx("b",{children:e.toolCount})," calls"]}),g>0&&d.jsxs("span",{className:"ac-item ac-live",children:[d.jsx("b",{children:g})," live"]}),f>0&&d.jsxs("span",{className:"ac-item ac-err",children:[d.jsx("b",{children:f})," err"]})]}),d.jsx("div",{className:"cat-strip",children:v.map(([E,b])=>{const S=E==="mcp"?w:null,_=S==null?void 0:S.hue,N=`${b} ${dw[E]} call${b===1?"":"s"}`;return d.jsxs("span",{className:`cat-chip cat-${E}${_!=null?" mcp-hue":""}`,style:_!=null?{"--mcp-hue":_}:void 0,title:S?`${N}, all to ${S.label}`:N,children:[d.jsx("span",{className:"cat-emoji",children:uw[E]}),d.jsx("span",{className:"cat-count",children:b}),S&&d.jsx("span",{className:"cat-server",children:S.label})]},E)})})]})]}),h>0&&d.jsxs("section",{className:"detail-section",children:[d.jsx("h3",{children:"Tokens"}),d.jsxs("div",{className:"tokens-grid",children:[d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"in"}),d.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"out"}),d.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"cache r"}),d.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"cache c"}),d.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),d.jsxs("section",{className:"detail-section",children:[d.jsx("h3",{children:"Identity"}),d.jsxs("div",{children:[e.cwd&&d.jsxs("div",{className:"row",children:[d.jsx("span",{className:"k",children:"cwd"}),d.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),d.jsxs("div",{className:"row",children:[d.jsx("span",{className:"k",children:"session"}),d.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&d.jsxs("div",{className:"row",children:[d.jsx("span",{className:"k",children:"parent"}),d.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&d.jsxs("section",{className:"detail-section",children:[d.jsxs("h3",{children:["Prompts ",d.jsx("span",{className:"section-count",children:e.prompts.length})]}),d.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((E,b)=>{const S=D4(E.at,t);return d.jsxs("div",{className:"prompt-entry",children:[d.jsx("div",{className:"prompt-time",title:S.title,children:S.label}),d.jsx("div",{className:"prompt-text",children:E.text})]},b)})})]}),d.jsxs("section",{className:"detail-section",children:[d.jsxs("h3",{children:["Tool calls ",d.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&d.jsx("div",{className:"empty",children:"No tool calls yet."}),d.jsx("div",{children:e.tools.slice().reverse().map(E=>d.jsx(H8,{t:E,onClick:()=>n(E.id)},E.id))})]})]})}const W8={inflight:"in-flight",done:"done",err:"error"};function H8({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=gT(e,"…");return d.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[d.jsxs("span",{className:"name",children:[d.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:W8[n]}),e.name]}),d.jsx("span",{style:{color:"var(--muted)"},children:s})]})}try{L4(window.localStorage)}catch{}const G8=oM.createRoot(document.getElementById("root"));G8.render(d.jsx(D8,{}));
|