aicodeswitch 5.2.11 → 5.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,799 @@
1
+ var sR=Object.defineProperty;var cR=(e,t,n)=>t in e?sR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Uu=(e,t,n)=>cR(e,typeof t!="symbol"?t+"":t,n);function uR(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(e,i,a.get?a:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();var Wl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ss(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var IP={exports:{}},Pp={},NP={exports:{}},Ge={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var iu=Symbol.for("react.element"),dR=Symbol.for("react.portal"),fR=Symbol.for("react.fragment"),pR=Symbol.for("react.strict_mode"),hR=Symbol.for("react.profiler"),mR=Symbol.for("react.provider"),gR=Symbol.for("react.context"),vR=Symbol.for("react.forward_ref"),yR=Symbol.for("react.suspense"),xR=Symbol.for("react.memo"),bR=Symbol.for("react.lazy"),x1=Symbol.iterator;function wR(e){return e===null||typeof e!="object"?null:(e=x1&&e[x1]||e["@@iterator"],typeof e=="function"?e:null)}var _P={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},MP=Object.assign,RP={};function cs(e,t,n){this.props=e,this.context=t,this.refs=RP,this.updater=n||_P}cs.prototype.isReactComponent={};cs.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};cs.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function DP(){}DP.prototype=cs.prototype;function zy(e,t,n){this.props=e,this.context=t,this.refs=RP,this.updater=n||_P}var $y=zy.prototype=new DP;$y.constructor=zy;MP($y,cs.prototype);$y.isPureReactComponent=!0;var b1=Array.isArray,LP=Object.prototype.hasOwnProperty,By={current:null},zP={key:!0,ref:!0,__self:!0,__source:!0};function $P(e,t,n){var r,i={},a=null,l=null;if(t!=null)for(r in t.ref!==void 0&&(l=t.ref),t.key!==void 0&&(a=""+t.key),t)LP.call(t,r)&&!zP.hasOwnProperty(r)&&(i[r]=t[r]);var s=arguments.length-2;if(s===1)i.children=n;else if(1<s){for(var c=Array(s),u=0;u<s;u++)c[u]=arguments[u+2];i.children=c}if(e&&e.defaultProps)for(r in s=e.defaultProps,s)i[r]===void 0&&(i[r]=s[r]);return{$$typeof:iu,type:e,key:a,ref:l,props:i,_owner:By.current}}function jR(e,t){return{$$typeof:iu,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Fy(e){return typeof e=="object"&&e!==null&&e.$$typeof===iu}function SR(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var w1=/\/+/g;function om(e,t){return typeof e=="object"&&e!==null&&e.key!=null?SR(""+e.key):t.toString(36)}function Nd(e,t,n,r,i){var a=typeof e;(a==="undefined"||a==="boolean")&&(e=null);var l=!1;if(e===null)l=!0;else switch(a){case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case iu:case dR:l=!0}}if(l)return l=e,i=i(l),e=r===""?"."+om(l,0):r,b1(i)?(n="",e!=null&&(n=e.replace(w1,"$&/")+"/"),Nd(i,t,n,"",function(u){return u})):i!=null&&(Fy(i)&&(i=jR(i,n+(!i.key||l&&l.key===i.key?"":(""+i.key).replace(w1,"$&/")+"/")+e)),t.push(i)),1;if(l=0,r=r===""?".":r+":",b1(e))for(var s=0;s<e.length;s++){a=e[s];var c=r+om(a,s);l+=Nd(a,t,n,c,i)}else if(c=wR(e),typeof c=="function")for(e=c.call(e),s=0;!(a=e.next()).done;)a=a.value,c=r+om(a,s++),l+=Nd(a,t,n,c,i);else if(a==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return l}function Wu(e,t,n){if(e==null)return e;var r=[],i=0;return Nd(e,r,"","",function(a){return t.call(n,a,i++)}),r}function kR(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Hn={current:null},_d={transition:null},CR={ReactCurrentDispatcher:Hn,ReactCurrentBatchConfig:_d,ReactCurrentOwner:By};function BP(){throw Error("act(...) is not supported in production builds of React.")}Ge.Children={map:Wu,forEach:function(e,t,n){Wu(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Wu(e,function(){t++}),t},toArray:function(e){return Wu(e,function(t){return t})||[]},only:function(e){if(!Fy(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ge.Component=cs;Ge.Fragment=fR;Ge.Profiler=hR;Ge.PureComponent=zy;Ge.StrictMode=pR;Ge.Suspense=yR;Ge.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=CR;Ge.act=BP;Ge.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=MP({},e.props),i=e.key,a=e.ref,l=e._owner;if(t!=null){if(t.ref!==void 0&&(a=t.ref,l=By.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(c in t)LP.call(t,c)&&!zP.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&s!==void 0?s[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){s=Array(c);for(var u=0;u<c;u++)s[u]=arguments[u+2];r.children=s}return{$$typeof:iu,type:e.type,key:i,ref:a,props:r,_owner:l}};Ge.createContext=function(e){return e={$$typeof:gR,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:mR,_context:e},e.Consumer=e};Ge.createElement=$P;Ge.createFactory=function(e){var t=$P.bind(null,e);return t.type=e,t};Ge.createRef=function(){return{current:null}};Ge.forwardRef=function(e){return{$$typeof:vR,render:e}};Ge.isValidElement=Fy;Ge.lazy=function(e){return{$$typeof:bR,_payload:{_status:-1,_result:e},_init:kR}};Ge.memo=function(e,t){return{$$typeof:xR,type:e,compare:t===void 0?null:t}};Ge.startTransition=function(e){var t=_d.transition;_d.transition={};try{e()}finally{_d.transition=t}};Ge.unstable_act=BP;Ge.useCallback=function(e,t){return Hn.current.useCallback(e,t)};Ge.useContext=function(e){return Hn.current.useContext(e)};Ge.useDebugValue=function(){};Ge.useDeferredValue=function(e){return Hn.current.useDeferredValue(e)};Ge.useEffect=function(e,t){return Hn.current.useEffect(e,t)};Ge.useId=function(){return Hn.current.useId()};Ge.useImperativeHandle=function(e,t,n){return Hn.current.useImperativeHandle(e,t,n)};Ge.useInsertionEffect=function(e,t){return Hn.current.useInsertionEffect(e,t)};Ge.useLayoutEffect=function(e,t){return Hn.current.useLayoutEffect(e,t)};Ge.useMemo=function(e,t){return Hn.current.useMemo(e,t)};Ge.useReducer=function(e,t,n){return Hn.current.useReducer(e,t,n)};Ge.useRef=function(e){return Hn.current.useRef(e)};Ge.useState=function(e){return Hn.current.useState(e)};Ge.useSyncExternalStore=function(e,t,n){return Hn.current.useSyncExternalStore(e,t,n)};Ge.useTransition=function(){return Hn.current.useTransition()};Ge.version="18.3.1";NP.exports=Ge;var h=NP.exports;const FP=ss(h),UP=uR({__proto__:null,default:FP},[h]);/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var PR=h,ER=Symbol.for("react.element"),TR=Symbol.for("react.fragment"),OR=Object.prototype.hasOwnProperty,AR=PR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,IR={key:!0,ref:!0,__self:!0,__source:!0};function WP(e,t,n){var r,i={},a=null,l=null;n!==void 0&&(a=""+n),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(l=t.ref);for(r in t)OR.call(t,r)&&!IR.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:ER,type:e,key:a,ref:l,props:i,_owner:AR.current}}Pp.Fragment=TR;Pp.jsx=WP;Pp.jsxs=WP;IP.exports=Pp;var o=IP.exports,jg={},KP={exports:{}},vr={},HP={exports:{}},VP={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */(function(e){function t(M,B){var k=M.length;M.push(B);e:for(;0<k;){var L=k-1>>>1,Q=M[L];if(0<i(Q,B))M[L]=B,M[k]=Q,k=L;else break e}}function n(M){return M.length===0?null:M[0]}function r(M){if(M.length===0)return null;var B=M[0],k=M.pop();if(k!==B){M[0]=k;e:for(var L=0,Q=M.length,T=Q>>>1;L<T;){var ce=2*(L+1)-1,ve=M[ce],X=ce+1,oe=M[X];if(0>i(ve,k))X<Q&&0>i(oe,ve)?(M[L]=oe,M[X]=k,L=X):(M[L]=ve,M[ce]=k,L=ce);else if(X<Q&&0>i(oe,k))M[L]=oe,M[X]=k,L=X;else break e}}return B}function i(M,B){var k=M.sortIndex-B.sortIndex;return k!==0?k:M.id-B.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,s=l.now();e.unstable_now=function(){return l.now()-s}}var c=[],u=[],f=1,d=null,p=3,m=!1,g=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(M){for(var B=n(u);B!==null;){if(B.callback===null)r(u);else if(B.startTime<=M)r(u),B.sortIndex=B.expirationTime,t(c,B);else break;B=n(u)}}function S(M){if(y=!1,w(M),!g)if(n(c)!==null)g=!0,F(C);else{var B=n(u);B!==null&&K(S,B.startTime-M)}}function C(M,B){g=!1,y&&(y=!1,v(O),O=-1),m=!0;var k=p;try{for(w(B),d=n(c);d!==null&&(!(d.expirationTime>B)||M&&!N());){var L=d.callback;if(typeof L=="function"){d.callback=null,p=d.priorityLevel;var Q=L(d.expirationTime<=B);B=e.unstable_now(),typeof Q=="function"?d.callback=Q:d===n(c)&&r(c),w(B)}else r(c);d=n(c)}if(d!==null)var T=!0;else{var ce=n(u);ce!==null&&K(S,ce.startTime-B),T=!1}return T}finally{d=null,p=k,m=!1}}var j=!1,E=null,O=-1,R=5,A=-1;function N(){return!(e.unstable_now()-A<R)}function _(){if(E!==null){var M=e.unstable_now();A=M;var B=!0;try{B=E(!0,M)}finally{B?q():(j=!1,E=null)}}else j=!1}var q;if(typeof b=="function")q=function(){b(_)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,I=W.port2;W.port1.onmessage=_,q=function(){I.postMessage(null)}}else q=function(){x(_,0)};function F(M){E=M,j||(j=!0,q())}function K(M,B){O=x(function(){M(e.unstable_now())},B)}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(M){M.callback=null},e.unstable_continueExecution=function(){g||m||(g=!0,F(C))},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(M){switch(p){case 1:case 2:case 3:var B=3;break;default:B=p}var k=p;p=B;try{return M()}finally{p=k}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(M,B){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var k=p;p=M;try{return B()}finally{p=k}},e.unstable_scheduleCallback=function(M,B,k){var L=e.unstable_now();switch(typeof k=="object"&&k!==null?(k=k.delay,k=typeof k=="number"&&0<k?L+k:L):k=L,M){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=k+Q,M={id:f++,callback:B,priorityLevel:M,startTime:k,expirationTime:Q,sortIndex:-1},k>L?(M.sortIndex=k,t(u,M),n(c)===null&&M===n(u)&&(y?(v(O),O=-1):y=!0,K(S,k-L))):(M.sortIndex=Q,t(c,M),g||m||(g=!0,F(C))),M},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(M){var B=p;return function(){var k=p;p=B;try{return M.apply(this,arguments)}finally{p=k}}}})(VP);HP.exports=VP;var NR=HP.exports;/**
26
+ * @license React
27
+ * react-dom.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var _R=h,hr=NR;function pe(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var qP=new Set,bc={};function Wo(e,t){Kl(e,t),Kl(e+"Capture",t)}function Kl(e,t){for(bc[e]=t,e=0;e<t.length;e++)qP.add(t[e])}var Fi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Sg=Object.prototype.hasOwnProperty,MR=/^[: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]*$/,j1={},S1={};function RR(e){return Sg.call(S1,e)?!0:Sg.call(j1,e)?!1:MR.test(e)?S1[e]=!0:(j1[e]=!0,!1)}function DR(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function LR(e,t,n,r){if(t===null||typeof t>"u"||DR(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Vn(e,t,n,r,i,a,l){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=l}var kn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){kn[e]=new Vn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];kn[t]=new Vn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){kn[e]=new Vn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){kn[e]=new Vn(e,2,!1,e,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(e){kn[e]=new Vn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){kn[e]=new Vn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){kn[e]=new Vn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){kn[e]=new Vn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){kn[e]=new Vn(e,5,!1,e.toLowerCase(),null,!1,!1)});var Uy=/[\-:]([a-z])/g;function Wy(e){return e[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(e){var t=e.replace(Uy,Wy);kn[t]=new Vn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Uy,Wy);kn[t]=new Vn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Uy,Wy);kn[t]=new Vn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){kn[e]=new Vn(e,1,!1,e.toLowerCase(),null,!1,!1)});kn.xlinkHref=new Vn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){kn[e]=new Vn(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ky(e,t,n,r){var i=kn.hasOwnProperty(t)?kn[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(LR(t,n,i,r)&&(n=null),r||i===null?RR(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Gi=_R.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ku=Symbol.for("react.element"),hl=Symbol.for("react.portal"),ml=Symbol.for("react.fragment"),Hy=Symbol.for("react.strict_mode"),kg=Symbol.for("react.profiler"),YP=Symbol.for("react.provider"),GP=Symbol.for("react.context"),Vy=Symbol.for("react.forward_ref"),Cg=Symbol.for("react.suspense"),Pg=Symbol.for("react.suspense_list"),qy=Symbol.for("react.memo"),ua=Symbol.for("react.lazy"),XP=Symbol.for("react.offscreen"),k1=Symbol.iterator;function Os(e){return e===null||typeof e!="object"?null:(e=k1&&e[k1]||e["@@iterator"],typeof e=="function"?e:null)}var Lt=Object.assign,lm;function Xs(e){if(lm===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);lm=t&&t[1]||""}return`
34
+ `+lm+e}var sm=!1;function cm(e,t){if(!e||sm)return"";sm=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var i=u.stack.split(`
35
+ `),a=r.stack.split(`
36
+ `),l=i.length-1,s=a.length-1;1<=l&&0<=s&&i[l]!==a[s];)s--;for(;1<=l&&0<=s;l--,s--)if(i[l]!==a[s]){if(l!==1||s!==1)do if(l--,s--,0>s||i[l]!==a[s]){var c=`
37
+ `+i[l].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=l&&0<=s);break}}}finally{sm=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Xs(e):""}function zR(e){switch(e.tag){case 5:return Xs(e.type);case 16:return Xs("Lazy");case 13:return Xs("Suspense");case 19:return Xs("SuspenseList");case 0:case 2:case 15:return e=cm(e.type,!1),e;case 11:return e=cm(e.type.render,!1),e;case 1:return e=cm(e.type,!0),e;default:return""}}function Eg(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ml:return"Fragment";case hl:return"Portal";case kg:return"Profiler";case Hy:return"StrictMode";case Cg:return"Suspense";case Pg:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case GP:return(e.displayName||"Context")+".Consumer";case YP:return(e._context.displayName||"Context")+".Provider";case Vy:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case qy:return t=e.displayName||null,t!==null?t:Eg(e.type)||"Memo";case ua:t=e._payload,e=e._init;try{return Eg(e(t))}catch{}}return null}function $R(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Eg(t);case 8:return t===Hy?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Na(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function QP(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function BR(e){var t=QP(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(l){r=""+l,a.call(this,l)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(l){r=""+l},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Hu(e){e._valueTracker||(e._valueTracker=BR(e))}function JP(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=QP(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Qd(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Tg(e,t){var n=t.checked;return Lt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function C1(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Na(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function ZP(e,t){t=t.checked,t!=null&&Ky(e,"checked",t,!1)}function Og(e,t){ZP(e,t);var n=Na(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ag(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ag(e,t.type,Na(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function P1(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Ag(e,t,n){(t!=="number"||Qd(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Qs=Array.isArray;function Nl(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Na(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Ig(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(pe(91));return Lt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function E1(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(pe(92));if(Qs(n)){if(1<n.length)throw Error(pe(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Na(n)}}function eE(e,t){var n=Na(t.value),r=Na(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function T1(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function tE(e){switch(e){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 Ng(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?tE(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Vu,nE=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Vu=Vu||document.createElement("div"),Vu.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Vu.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function wc(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ic={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},FR=["Webkit","ms","Moz","O"];Object.keys(ic).forEach(function(e){FR.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ic[t]=ic[e]})});function rE(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ic.hasOwnProperty(e)&&ic[e]?(""+t).trim():t+"px"}function iE(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=rE(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var UR=Lt({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 _g(e,t){if(t){if(UR[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(pe(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(pe(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(pe(61))}if(t.style!=null&&typeof t.style!="object")throw Error(pe(62))}}function Mg(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Rg=null;function Yy(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Dg=null,_l=null,Ml=null;function O1(e){if(e=lu(e)){if(typeof Dg!="function")throw Error(pe(280));var t=e.stateNode;t&&(t=Ip(t),Dg(e.stateNode,e.type,t))}}function aE(e){_l?Ml?Ml.push(e):Ml=[e]:_l=e}function oE(){if(_l){var e=_l,t=Ml;if(Ml=_l=null,O1(e),t)for(e=0;e<t.length;e++)O1(t[e])}}function lE(e,t){return e(t)}function sE(){}var um=!1;function cE(e,t,n){if(um)return e(t,n);um=!0;try{return lE(e,t,n)}finally{um=!1,(_l!==null||Ml!==null)&&(sE(),oE())}}function jc(e,t){var n=e.stateNode;if(n===null)return null;var r=Ip(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(pe(231,t,typeof n));return n}var Lg=!1;if(Fi)try{var As={};Object.defineProperty(As,"passive",{get:function(){Lg=!0}}),window.addEventListener("test",As,As),window.removeEventListener("test",As,As)}catch{Lg=!1}function WR(e,t,n,r,i,a,l,s,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(f){this.onError(f)}}var ac=!1,Jd=null,Zd=!1,zg=null,KR={onError:function(e){ac=!0,Jd=e}};function HR(e,t,n,r,i,a,l,s,c){ac=!1,Jd=null,WR.apply(KR,arguments)}function VR(e,t,n,r,i,a,l,s,c){if(HR.apply(this,arguments),ac){if(ac){var u=Jd;ac=!1,Jd=null}else throw Error(pe(198));Zd||(Zd=!0,zg=u)}}function Ko(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function uE(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function A1(e){if(Ko(e)!==e)throw Error(pe(188))}function qR(e){var t=e.alternate;if(!t){if(t=Ko(e),t===null)throw Error(pe(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return A1(i),e;if(a===r)return A1(i),t;a=a.sibling}throw Error(pe(188))}if(n.return!==r.return)n=i,r=a;else{for(var l=!1,s=i.child;s;){if(s===n){l=!0,n=i,r=a;break}if(s===r){l=!0,r=i,n=a;break}s=s.sibling}if(!l){for(s=a.child;s;){if(s===n){l=!0,n=a,r=i;break}if(s===r){l=!0,r=a,n=i;break}s=s.sibling}if(!l)throw Error(pe(189))}}if(n.alternate!==r)throw Error(pe(190))}if(n.tag!==3)throw Error(pe(188));return n.stateNode.current===n?e:t}function dE(e){return e=qR(e),e!==null?fE(e):null}function fE(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=fE(e);if(t!==null)return t;e=e.sibling}return null}var pE=hr.unstable_scheduleCallback,I1=hr.unstable_cancelCallback,YR=hr.unstable_shouldYield,GR=hr.unstable_requestPaint,qt=hr.unstable_now,XR=hr.unstable_getCurrentPriorityLevel,Gy=hr.unstable_ImmediatePriority,hE=hr.unstable_UserBlockingPriority,ef=hr.unstable_NormalPriority,QR=hr.unstable_LowPriority,mE=hr.unstable_IdlePriority,Ep=null,mi=null;function JR(e){if(mi&&typeof mi.onCommitFiberRoot=="function")try{mi.onCommitFiberRoot(Ep,e,void 0,(e.current.flags&128)===128)}catch{}}var Vr=Math.clz32?Math.clz32:tD,ZR=Math.log,eD=Math.LN2;function tD(e){return e>>>=0,e===0?32:31-(ZR(e)/eD|0)|0}var qu=64,Yu=4194304;function Js(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function tf(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,l=n&268435455;if(l!==0){var s=l&~i;s!==0?r=Js(s):(a&=l,a!==0&&(r=Js(a)))}else l=n&~i,l!==0?r=Js(l):a!==0&&(r=Js(a));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,a=t&-t,i>=a||i===16&&(a&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Vr(t),i=1<<n,r|=e[n],t&=~i;return r}function nD(e,t){switch(e){case 1:case 2:case 4:return t+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 t+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 rD(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var l=31-Vr(a),s=1<<l,c=i[l];c===-1?(!(s&n)||s&r)&&(i[l]=nD(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function $g(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function gE(){var e=qu;return qu<<=1,!(qu&4194240)&&(qu=64),e}function dm(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function au(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Vr(t),e[t]=n}function iD(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-Vr(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Xy(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Vr(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var pt=0;function vE(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var yE,Qy,xE,bE,wE,Bg=!1,Gu=[],wa=null,ja=null,Sa=null,Sc=new Map,kc=new Map,ha=[],aD="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 N1(e,t){switch(e){case"focusin":case"focusout":wa=null;break;case"dragenter":case"dragleave":ja=null;break;case"mouseover":case"mouseout":Sa=null;break;case"pointerover":case"pointerout":Sc.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":kc.delete(t.pointerId)}}function Is(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=lu(t),t!==null&&Qy(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function oD(e,t,n,r,i){switch(t){case"focusin":return wa=Is(wa,e,t,n,r,i),!0;case"dragenter":return ja=Is(ja,e,t,n,r,i),!0;case"mouseover":return Sa=Is(Sa,e,t,n,r,i),!0;case"pointerover":var a=i.pointerId;return Sc.set(a,Is(Sc.get(a)||null,e,t,n,r,i)),!0;case"gotpointercapture":return a=i.pointerId,kc.set(a,Is(kc.get(a)||null,e,t,n,r,i)),!0}return!1}function jE(e){var t=po(e.target);if(t!==null){var n=Ko(t);if(n!==null){if(t=n.tag,t===13){if(t=uE(n),t!==null){e.blockedOn=t,wE(e.priority,function(){xE(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Md(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Fg(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Rg=r,n.target.dispatchEvent(r),Rg=null}else return t=lu(n),t!==null&&Qy(t),e.blockedOn=n,!1;t.shift()}return!0}function _1(e,t,n){Md(e)&&n.delete(t)}function lD(){Bg=!1,wa!==null&&Md(wa)&&(wa=null),ja!==null&&Md(ja)&&(ja=null),Sa!==null&&Md(Sa)&&(Sa=null),Sc.forEach(_1),kc.forEach(_1)}function Ns(e,t){e.blockedOn===t&&(e.blockedOn=null,Bg||(Bg=!0,hr.unstable_scheduleCallback(hr.unstable_NormalPriority,lD)))}function Cc(e){function t(i){return Ns(i,e)}if(0<Gu.length){Ns(Gu[0],e);for(var n=1;n<Gu.length;n++){var r=Gu[n];r.blockedOn===e&&(r.blockedOn=null)}}for(wa!==null&&Ns(wa,e),ja!==null&&Ns(ja,e),Sa!==null&&Ns(Sa,e),Sc.forEach(t),kc.forEach(t),n=0;n<ha.length;n++)r=ha[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<ha.length&&(n=ha[0],n.blockedOn===null);)jE(n),n.blockedOn===null&&ha.shift()}var Rl=Gi.ReactCurrentBatchConfig,nf=!0;function sD(e,t,n,r){var i=pt,a=Rl.transition;Rl.transition=null;try{pt=1,Jy(e,t,n,r)}finally{pt=i,Rl.transition=a}}function cD(e,t,n,r){var i=pt,a=Rl.transition;Rl.transition=null;try{pt=4,Jy(e,t,n,r)}finally{pt=i,Rl.transition=a}}function Jy(e,t,n,r){if(nf){var i=Fg(e,t,n,r);if(i===null)wm(e,t,r,rf,n),N1(e,r);else if(oD(i,e,t,n,r))r.stopPropagation();else if(N1(e,r),t&4&&-1<aD.indexOf(e)){for(;i!==null;){var a=lu(i);if(a!==null&&yE(a),a=Fg(e,t,n,r),a===null&&wm(e,t,r,rf,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else wm(e,t,r,null,n)}}var rf=null;function Fg(e,t,n,r){if(rf=null,e=Yy(r),e=po(e),e!==null)if(t=Ko(e),t===null)e=null;else if(n=t.tag,n===13){if(e=uE(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return rf=e,null}function SE(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(XR()){case Gy:return 1;case hE:return 4;case ef:case QR:return 16;case mE:return 536870912;default:return 16}default:return 16}}var va=null,Zy=null,Rd=null;function kE(){if(Rd)return Rd;var e,t=Zy,n=t.length,r,i="value"in va?va.value:va.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var l=n-e;for(r=1;r<=l&&t[n-r]===i[a-r];r++);return Rd=i.slice(e,1<r?1-r:void 0)}function Dd(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Xu(){return!0}function M1(){return!1}function yr(e){function t(n,r,i,a,l){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=a,this.target=l,this.currentTarget=null;for(var s in e)e.hasOwnProperty(s)&&(n=e[s],this[s]=n?n(a):a[s]);return this.isDefaultPrevented=(a.defaultPrevented!=null?a.defaultPrevented:a.returnValue===!1)?Xu:M1,this.isPropagationStopped=M1,this}return Lt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Xu)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Xu)},persist:function(){},isPersistent:Xu}),t}var us={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ex=yr(us),ou=Lt({},us,{view:0,detail:0}),uD=yr(ou),fm,pm,_s,Tp=Lt({},ou,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:tx,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==_s&&(_s&&e.type==="mousemove"?(fm=e.screenX-_s.screenX,pm=e.screenY-_s.screenY):pm=fm=0,_s=e),fm)},movementY:function(e){return"movementY"in e?e.movementY:pm}}),R1=yr(Tp),dD=Lt({},Tp,{dataTransfer:0}),fD=yr(dD),pD=Lt({},ou,{relatedTarget:0}),hm=yr(pD),hD=Lt({},us,{animationName:0,elapsedTime:0,pseudoElement:0}),mD=yr(hD),gD=Lt({},us,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),vD=yr(gD),yD=Lt({},us,{data:0}),D1=yr(yD),xD={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},bD={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"},wD={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function jD(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=wD[e])?!!t[e]:!1}function tx(){return jD}var SD=Lt({},ou,{key:function(e){if(e.key){var t=xD[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Dd(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?bD[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:tx,charCode:function(e){return e.type==="keypress"?Dd(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Dd(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),kD=yr(SD),CD=Lt({},Tp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),L1=yr(CD),PD=Lt({},ou,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:tx}),ED=yr(PD),TD=Lt({},us,{propertyName:0,elapsedTime:0,pseudoElement:0}),OD=yr(TD),AD=Lt({},Tp,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),ID=yr(AD),ND=[9,13,27,32],nx=Fi&&"CompositionEvent"in window,oc=null;Fi&&"documentMode"in document&&(oc=document.documentMode);var _D=Fi&&"TextEvent"in window&&!oc,CE=Fi&&(!nx||oc&&8<oc&&11>=oc),z1=" ",$1=!1;function PE(e,t){switch(e){case"keyup":return ND.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function EE(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var gl=!1;function MD(e,t){switch(e){case"compositionend":return EE(t);case"keypress":return t.which!==32?null:($1=!0,z1);case"textInput":return e=t.data,e===z1&&$1?null:e;default:return null}}function RD(e,t){if(gl)return e==="compositionend"||!nx&&PE(e,t)?(e=kE(),Rd=Zy=va=null,gl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return CE&&t.locale!=="ko"?null:t.data;default:return null}}var DD={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 B1(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!DD[e.type]:t==="textarea"}function TE(e,t,n,r){aE(r),t=af(t,"onChange"),0<t.length&&(n=new ex("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var lc=null,Pc=null;function LD(e){$E(e,0)}function Op(e){var t=xl(e);if(JP(t))return e}function zD(e,t){if(e==="change")return t}var OE=!1;if(Fi){var mm;if(Fi){var gm="oninput"in document;if(!gm){var F1=document.createElement("div");F1.setAttribute("oninput","return;"),gm=typeof F1.oninput=="function"}mm=gm}else mm=!1;OE=mm&&(!document.documentMode||9<document.documentMode)}function U1(){lc&&(lc.detachEvent("onpropertychange",AE),Pc=lc=null)}function AE(e){if(e.propertyName==="value"&&Op(Pc)){var t=[];TE(t,Pc,e,Yy(e)),cE(LD,t)}}function $D(e,t,n){e==="focusin"?(U1(),lc=t,Pc=n,lc.attachEvent("onpropertychange",AE)):e==="focusout"&&U1()}function BD(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Op(Pc)}function FD(e,t){if(e==="click")return Op(t)}function UD(e,t){if(e==="input"||e==="change")return Op(t)}function WD(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Yr=typeof Object.is=="function"?Object.is:WD;function Ec(e,t){if(Yr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Sg.call(t,i)||!Yr(e[i],t[i]))return!1}return!0}function W1(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function K1(e,t){var n=W1(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=W1(n)}}function IE(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?IE(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function NE(){for(var e=window,t=Qd();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Qd(e.document)}return t}function rx(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function KD(e){var t=NE(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&IE(n.ownerDocument.documentElement,n)){if(r!==null&&rx(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=K1(n,a);var l=K1(n,r);i&&l&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==l.node||e.focusOffset!==l.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(l.node,l.offset)):(t.setEnd(l.node,l.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var HD=Fi&&"documentMode"in document&&11>=document.documentMode,vl=null,Ug=null,sc=null,Wg=!1;function H1(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Wg||vl==null||vl!==Qd(r)||(r=vl,"selectionStart"in r&&rx(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),sc&&Ec(sc,r)||(sc=r,r=af(Ug,"onSelect"),0<r.length&&(t=new ex("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=vl)))}function Qu(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var yl={animationend:Qu("Animation","AnimationEnd"),animationiteration:Qu("Animation","AnimationIteration"),animationstart:Qu("Animation","AnimationStart"),transitionend:Qu("Transition","TransitionEnd")},vm={},_E={};Fi&&(_E=document.createElement("div").style,"AnimationEvent"in window||(delete yl.animationend.animation,delete yl.animationiteration.animation,delete yl.animationstart.animation),"TransitionEvent"in window||delete yl.transitionend.transition);function Ap(e){if(vm[e])return vm[e];if(!yl[e])return e;var t=yl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in _E)return vm[e]=t[n];return e}var ME=Ap("animationend"),RE=Ap("animationiteration"),DE=Ap("animationstart"),LE=Ap("transitionend"),zE=new Map,V1="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 za(e,t){zE.set(e,t),Wo(t,[e])}for(var ym=0;ym<V1.length;ym++){var xm=V1[ym],VD=xm.toLowerCase(),qD=xm[0].toUpperCase()+xm.slice(1);za(VD,"on"+qD)}za(ME,"onAnimationEnd");za(RE,"onAnimationIteration");za(DE,"onAnimationStart");za("dblclick","onDoubleClick");za("focusin","onFocus");za("focusout","onBlur");za(LE,"onTransitionEnd");Kl("onMouseEnter",["mouseout","mouseover"]);Kl("onMouseLeave",["mouseout","mouseover"]);Kl("onPointerEnter",["pointerout","pointerover"]);Kl("onPointerLeave",["pointerout","pointerover"]);Wo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Wo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Wo("onBeforeInput",["compositionend","keypress","textInput","paste"]);Wo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Wo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Wo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Zs="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(" "),YD=new Set("cancel close invalid load scroll toggle".split(" ").concat(Zs));function q1(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,VR(r,t,void 0,e),e.currentTarget=null}function $E(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var a=void 0;if(t)for(var l=r.length-1;0<=l;l--){var s=r[l],c=s.instance,u=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break e;q1(i,s,u),a=c}else for(l=0;l<r.length;l++){if(s=r[l],c=s.instance,u=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break e;q1(i,s,u),a=c}}}if(Zd)throw e=zg,Zd=!1,zg=null,e}function kt(e,t){var n=t[Yg];n===void 0&&(n=t[Yg]=new Set);var r=e+"__bubble";n.has(r)||(BE(t,e,2,!1),n.add(r))}function bm(e,t,n){var r=0;t&&(r|=4),BE(n,e,r,t)}var Ju="_reactListening"+Math.random().toString(36).slice(2);function Tc(e){if(!e[Ju]){e[Ju]=!0,qP.forEach(function(n){n!=="selectionchange"&&(YD.has(n)||bm(n,!1,e),bm(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ju]||(t[Ju]=!0,bm("selectionchange",!1,t))}}function BE(e,t,n,r){switch(SE(t)){case 1:var i=sD;break;case 4:i=cD;break;default:i=Jy}n=i.bind(null,t,n,e),i=void 0,!Lg||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function wm(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var l=r.tag;if(l===3||l===4){var s=r.stateNode.containerInfo;if(s===i||s.nodeType===8&&s.parentNode===i)break;if(l===4)for(l=r.return;l!==null;){var c=l.tag;if((c===3||c===4)&&(c=l.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;l=l.return}for(;s!==null;){if(l=po(s),l===null)return;if(c=l.tag,c===5||c===6){r=a=l;continue e}s=s.parentNode}}r=r.return}cE(function(){var u=a,f=Yy(n),d=[];e:{var p=zE.get(e);if(p!==void 0){var m=ex,g=e;switch(e){case"keypress":if(Dd(n)===0)break e;case"keydown":case"keyup":m=kD;break;case"focusin":g="focus",m=hm;break;case"focusout":g="blur",m=hm;break;case"beforeblur":case"afterblur":m=hm;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=R1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=fD;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=ED;break;case ME:case RE:case DE:m=mD;break;case LE:m=OD;break;case"scroll":m=uD;break;case"wheel":m=ID;break;case"copy":case"cut":case"paste":m=vD;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=L1}var y=(t&4)!==0,x=!y&&e==="scroll",v=y?p!==null?p+"Capture":null:p;y=[];for(var b=u,w;b!==null;){w=b;var S=w.stateNode;if(w.tag===5&&S!==null&&(w=S,v!==null&&(S=jc(b,v),S!=null&&y.push(Oc(b,S,w)))),x)break;b=b.return}0<y.length&&(p=new m(p,g,null,n,f),d.push({event:p,listeners:y}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",p&&n!==Rg&&(g=n.relatedTarget||n.fromElement)&&(po(g)||g[Ui]))break e;if((m||p)&&(p=f.window===f?f:(p=f.ownerDocument)?p.defaultView||p.parentWindow:window,m?(g=n.relatedTarget||n.toElement,m=u,g=g?po(g):null,g!==null&&(x=Ko(g),g!==x||g.tag!==5&&g.tag!==6)&&(g=null)):(m=null,g=u),m!==g)){if(y=R1,S="onMouseLeave",v="onMouseEnter",b="mouse",(e==="pointerout"||e==="pointerover")&&(y=L1,S="onPointerLeave",v="onPointerEnter",b="pointer"),x=m==null?p:xl(m),w=g==null?p:xl(g),p=new y(S,b+"leave",m,n,f),p.target=x,p.relatedTarget=w,S=null,po(f)===u&&(y=new y(v,b+"enter",g,n,f),y.target=w,y.relatedTarget=x,S=y),x=S,m&&g)t:{for(y=m,v=g,b=0,w=y;w;w=tl(w))b++;for(w=0,S=v;S;S=tl(S))w++;for(;0<b-w;)y=tl(y),b--;for(;0<w-b;)v=tl(v),w--;for(;b--;){if(y===v||v!==null&&y===v.alternate)break t;y=tl(y),v=tl(v)}y=null}else y=null;m!==null&&Y1(d,p,m,y,!1),g!==null&&x!==null&&Y1(d,x,g,y,!0)}}e:{if(p=u?xl(u):window,m=p.nodeName&&p.nodeName.toLowerCase(),m==="select"||m==="input"&&p.type==="file")var C=zD;else if(B1(p))if(OE)C=UD;else{C=BD;var j=$D}else(m=p.nodeName)&&m.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(C=FD);if(C&&(C=C(e,u))){TE(d,C,n,f);break e}j&&j(e,p,u),e==="focusout"&&(j=p._wrapperState)&&j.controlled&&p.type==="number"&&Ag(p,"number",p.value)}switch(j=u?xl(u):window,e){case"focusin":(B1(j)||j.contentEditable==="true")&&(vl=j,Ug=u,sc=null);break;case"focusout":sc=Ug=vl=null;break;case"mousedown":Wg=!0;break;case"contextmenu":case"mouseup":case"dragend":Wg=!1,H1(d,n,f);break;case"selectionchange":if(HD)break;case"keydown":case"keyup":H1(d,n,f)}var E;if(nx)e:{switch(e){case"compositionstart":var O="onCompositionStart";break e;case"compositionend":O="onCompositionEnd";break e;case"compositionupdate":O="onCompositionUpdate";break e}O=void 0}else gl?PE(e,n)&&(O="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(O="onCompositionStart");O&&(CE&&n.locale!=="ko"&&(gl||O!=="onCompositionStart"?O==="onCompositionEnd"&&gl&&(E=kE()):(va=f,Zy="value"in va?va.value:va.textContent,gl=!0)),j=af(u,O),0<j.length&&(O=new D1(O,e,null,n,f),d.push({event:O,listeners:j}),E?O.data=E:(E=EE(n),E!==null&&(O.data=E)))),(E=_D?MD(e,n):RD(e,n))&&(u=af(u,"onBeforeInput"),0<u.length&&(f=new D1("onBeforeInput","beforeinput",null,n,f),d.push({event:f,listeners:u}),f.data=E))}$E(d,t)})}function Oc(e,t,n){return{instance:e,listener:t,currentTarget:n}}function af(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=jc(e,n),a!=null&&r.unshift(Oc(e,a,i)),a=jc(e,t),a!=null&&r.push(Oc(e,a,i))),e=e.return}return r}function tl(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Y1(e,t,n,r,i){for(var a=t._reactName,l=[];n!==null&&n!==r;){var s=n,c=s.alternate,u=s.stateNode;if(c!==null&&c===r)break;s.tag===5&&u!==null&&(s=u,i?(c=jc(n,a),c!=null&&l.unshift(Oc(n,c,s))):i||(c=jc(n,a),c!=null&&l.push(Oc(n,c,s)))),n=n.return}l.length!==0&&e.push({event:t,listeners:l})}var GD=/\r\n?/g,XD=/\u0000|\uFFFD/g;function G1(e){return(typeof e=="string"?e:""+e).replace(GD,`
38
+ `).replace(XD,"")}function Zu(e,t,n){if(t=G1(t),G1(e)!==t&&n)throw Error(pe(425))}function of(){}var Kg=null,Hg=null;function Vg(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var qg=typeof setTimeout=="function"?setTimeout:void 0,QD=typeof clearTimeout=="function"?clearTimeout:void 0,X1=typeof Promise=="function"?Promise:void 0,JD=typeof queueMicrotask=="function"?queueMicrotask:typeof X1<"u"?function(e){return X1.resolve(null).then(e).catch(ZD)}:qg;function ZD(e){setTimeout(function(){throw e})}function jm(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),Cc(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);Cc(t)}function ka(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Q1(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var ds=Math.random().toString(36).slice(2),di="__reactFiber$"+ds,Ac="__reactProps$"+ds,Ui="__reactContainer$"+ds,Yg="__reactEvents$"+ds,eL="__reactListeners$"+ds,tL="__reactHandles$"+ds;function po(e){var t=e[di];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ui]||n[di]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Q1(e);e!==null;){if(n=e[di])return n;e=Q1(e)}return t}e=n,n=e.parentNode}return null}function lu(e){return e=e[di]||e[Ui],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function xl(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(pe(33))}function Ip(e){return e[Ac]||null}var Gg=[],bl=-1;function $a(e){return{current:e}}function Et(e){0>bl||(e.current=Gg[bl],Gg[bl]=null,bl--)}function wt(e,t){bl++,Gg[bl]=e.current,e.current=t}var _a={},_n=$a(_a),tr=$a(!1),Oo=_a;function Hl(e,t){var n=e.type.contextTypes;if(!n)return _a;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function nr(e){return e=e.childContextTypes,e!=null}function lf(){Et(tr),Et(_n)}function J1(e,t,n){if(_n.current!==_a)throw Error(pe(168));wt(_n,t),wt(tr,n)}function FE(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(pe(108,$R(e)||"Unknown",i));return Lt({},n,r)}function sf(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||_a,Oo=_n.current,wt(_n,e),wt(tr,tr.current),!0}function Z1(e,t,n){var r=e.stateNode;if(!r)throw Error(pe(169));n?(e=FE(e,t,Oo),r.__reactInternalMemoizedMergedChildContext=e,Et(tr),Et(_n),wt(_n,e)):Et(tr),wt(tr,n)}var Ii=null,Np=!1,Sm=!1;function UE(e){Ii===null?Ii=[e]:Ii.push(e)}function nL(e){Np=!0,UE(e)}function Ba(){if(!Sm&&Ii!==null){Sm=!0;var e=0,t=pt;try{var n=Ii;for(pt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Ii=null,Np=!1}catch(i){throw Ii!==null&&(Ii=Ii.slice(e+1)),pE(Gy,Ba),i}finally{pt=t,Sm=!1}}return null}var wl=[],jl=0,cf=null,uf=0,Cr=[],Pr=0,Ao=null,Mi=1,Ri="";function oo(e,t){wl[jl++]=uf,wl[jl++]=cf,cf=e,uf=t}function WE(e,t,n){Cr[Pr++]=Mi,Cr[Pr++]=Ri,Cr[Pr++]=Ao,Ao=e;var r=Mi;e=Ri;var i=32-Vr(r)-1;r&=~(1<<i),n+=1;var a=32-Vr(t)+i;if(30<a){var l=i-i%5;a=(r&(1<<l)-1).toString(32),r>>=l,i-=l,Mi=1<<32-Vr(t)+i|n<<i|r,Ri=a+e}else Mi=1<<a|n<<i|r,Ri=e}function ix(e){e.return!==null&&(oo(e,1),WE(e,1,0))}function ax(e){for(;e===cf;)cf=wl[--jl],wl[jl]=null,uf=wl[--jl],wl[jl]=null;for(;e===Ao;)Ao=Cr[--Pr],Cr[Pr]=null,Ri=Cr[--Pr],Cr[Pr]=null,Mi=Cr[--Pr],Cr[Pr]=null}var fr=null,cr=null,At=!1,Ur=null;function KE(e,t){var n=Tr(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function ew(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,fr=e,cr=ka(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,fr=e,cr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Ao!==null?{id:Mi,overflow:Ri}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Tr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,fr=e,cr=null,!0):!1;default:return!1}}function Xg(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Qg(e){if(At){var t=cr;if(t){var n=t;if(!ew(e,t)){if(Xg(e))throw Error(pe(418));t=ka(n.nextSibling);var r=fr;t&&ew(e,t)?KE(r,n):(e.flags=e.flags&-4097|2,At=!1,fr=e)}}else{if(Xg(e))throw Error(pe(418));e.flags=e.flags&-4097|2,At=!1,fr=e}}}function tw(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;fr=e}function ed(e){if(e!==fr)return!1;if(!At)return tw(e),At=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Vg(e.type,e.memoizedProps)),t&&(t=cr)){if(Xg(e))throw HE(),Error(pe(418));for(;t;)KE(e,t),t=ka(t.nextSibling)}if(tw(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(pe(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){cr=ka(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}cr=null}}else cr=fr?ka(e.stateNode.nextSibling):null;return!0}function HE(){for(var e=cr;e;)e=ka(e.nextSibling)}function Vl(){cr=fr=null,At=!1}function ox(e){Ur===null?Ur=[e]:Ur.push(e)}var rL=Gi.ReactCurrentBatchConfig;function Ms(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(pe(309));var r=n.stateNode}if(!r)throw Error(pe(147,e));var i=r,a=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===a?t.ref:(t=function(l){var s=i.refs;l===null?delete s[a]:s[a]=l},t._stringRef=a,t)}if(typeof e!="string")throw Error(pe(284));if(!n._owner)throw Error(pe(290,e))}return e}function td(e,t){throw e=Object.prototype.toString.call(t),Error(pe(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function nw(e){var t=e._init;return t(e._payload)}function VE(e){function t(v,b){if(e){var w=v.deletions;w===null?(v.deletions=[b],v.flags|=16):w.push(b)}}function n(v,b){if(!e)return null;for(;b!==null;)t(v,b),b=b.sibling;return null}function r(v,b){for(v=new Map;b!==null;)b.key!==null?v.set(b.key,b):v.set(b.index,b),b=b.sibling;return v}function i(v,b){return v=Ta(v,b),v.index=0,v.sibling=null,v}function a(v,b,w){return v.index=w,e?(w=v.alternate,w!==null?(w=w.index,w<b?(v.flags|=2,b):w):(v.flags|=2,b)):(v.flags|=1048576,b)}function l(v){return e&&v.alternate===null&&(v.flags|=2),v}function s(v,b,w,S){return b===null||b.tag!==6?(b=Am(w,v.mode,S),b.return=v,b):(b=i(b,w),b.return=v,b)}function c(v,b,w,S){var C=w.type;return C===ml?f(v,b,w.props.children,S,w.key):b!==null&&(b.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===ua&&nw(C)===b.type)?(S=i(b,w.props),S.ref=Ms(v,b,w),S.return=v,S):(S=Wd(w.type,w.key,w.props,null,v.mode,S),S.ref=Ms(v,b,w),S.return=v,S)}function u(v,b,w,S){return b===null||b.tag!==4||b.stateNode.containerInfo!==w.containerInfo||b.stateNode.implementation!==w.implementation?(b=Im(w,v.mode,S),b.return=v,b):(b=i(b,w.children||[]),b.return=v,b)}function f(v,b,w,S,C){return b===null||b.tag!==7?(b=So(w,v.mode,S,C),b.return=v,b):(b=i(b,w),b.return=v,b)}function d(v,b,w){if(typeof b=="string"&&b!==""||typeof b=="number")return b=Am(""+b,v.mode,w),b.return=v,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Ku:return w=Wd(b.type,b.key,b.props,null,v.mode,w),w.ref=Ms(v,null,b),w.return=v,w;case hl:return b=Im(b,v.mode,w),b.return=v,b;case ua:var S=b._init;return d(v,S(b._payload),w)}if(Qs(b)||Os(b))return b=So(b,v.mode,w,null),b.return=v,b;td(v,b)}return null}function p(v,b,w,S){var C=b!==null?b.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return C!==null?null:s(v,b,""+w,S);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Ku:return w.key===C?c(v,b,w,S):null;case hl:return w.key===C?u(v,b,w,S):null;case ua:return C=w._init,p(v,b,C(w._payload),S)}if(Qs(w)||Os(w))return C!==null?null:f(v,b,w,S,null);td(v,w)}return null}function m(v,b,w,S,C){if(typeof S=="string"&&S!==""||typeof S=="number")return v=v.get(w)||null,s(b,v,""+S,C);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Ku:return v=v.get(S.key===null?w:S.key)||null,c(b,v,S,C);case hl:return v=v.get(S.key===null?w:S.key)||null,u(b,v,S,C);case ua:var j=S._init;return m(v,b,w,j(S._payload),C)}if(Qs(S)||Os(S))return v=v.get(w)||null,f(b,v,S,C,null);td(b,S)}return null}function g(v,b,w,S){for(var C=null,j=null,E=b,O=b=0,R=null;E!==null&&O<w.length;O++){E.index>O?(R=E,E=null):R=E.sibling;var A=p(v,E,w[O],S);if(A===null){E===null&&(E=R);break}e&&E&&A.alternate===null&&t(v,E),b=a(A,b,O),j===null?C=A:j.sibling=A,j=A,E=R}if(O===w.length)return n(v,E),At&&oo(v,O),C;if(E===null){for(;O<w.length;O++)E=d(v,w[O],S),E!==null&&(b=a(E,b,O),j===null?C=E:j.sibling=E,j=E);return At&&oo(v,O),C}for(E=r(v,E);O<w.length;O++)R=m(E,v,O,w[O],S),R!==null&&(e&&R.alternate!==null&&E.delete(R.key===null?O:R.key),b=a(R,b,O),j===null?C=R:j.sibling=R,j=R);return e&&E.forEach(function(N){return t(v,N)}),At&&oo(v,O),C}function y(v,b,w,S){var C=Os(w);if(typeof C!="function")throw Error(pe(150));if(w=C.call(w),w==null)throw Error(pe(151));for(var j=C=null,E=b,O=b=0,R=null,A=w.next();E!==null&&!A.done;O++,A=w.next()){E.index>O?(R=E,E=null):R=E.sibling;var N=p(v,E,A.value,S);if(N===null){E===null&&(E=R);break}e&&E&&N.alternate===null&&t(v,E),b=a(N,b,O),j===null?C=N:j.sibling=N,j=N,E=R}if(A.done)return n(v,E),At&&oo(v,O),C;if(E===null){for(;!A.done;O++,A=w.next())A=d(v,A.value,S),A!==null&&(b=a(A,b,O),j===null?C=A:j.sibling=A,j=A);return At&&oo(v,O),C}for(E=r(v,E);!A.done;O++,A=w.next())A=m(E,v,O,A.value,S),A!==null&&(e&&A.alternate!==null&&E.delete(A.key===null?O:A.key),b=a(A,b,O),j===null?C=A:j.sibling=A,j=A);return e&&E.forEach(function(_){return t(v,_)}),At&&oo(v,O),C}function x(v,b,w,S){if(typeof w=="object"&&w!==null&&w.type===ml&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Ku:e:{for(var C=w.key,j=b;j!==null;){if(j.key===C){if(C=w.type,C===ml){if(j.tag===7){n(v,j.sibling),b=i(j,w.props.children),b.return=v,v=b;break e}}else if(j.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===ua&&nw(C)===j.type){n(v,j.sibling),b=i(j,w.props),b.ref=Ms(v,j,w),b.return=v,v=b;break e}n(v,j);break}else t(v,j);j=j.sibling}w.type===ml?(b=So(w.props.children,v.mode,S,w.key),b.return=v,v=b):(S=Wd(w.type,w.key,w.props,null,v.mode,S),S.ref=Ms(v,b,w),S.return=v,v=S)}return l(v);case hl:e:{for(j=w.key;b!==null;){if(b.key===j)if(b.tag===4&&b.stateNode.containerInfo===w.containerInfo&&b.stateNode.implementation===w.implementation){n(v,b.sibling),b=i(b,w.children||[]),b.return=v,v=b;break e}else{n(v,b);break}else t(v,b);b=b.sibling}b=Im(w,v.mode,S),b.return=v,v=b}return l(v);case ua:return j=w._init,x(v,b,j(w._payload),S)}if(Qs(w))return g(v,b,w,S);if(Os(w))return y(v,b,w,S);td(v,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,b!==null&&b.tag===6?(n(v,b.sibling),b=i(b,w),b.return=v,v=b):(n(v,b),b=Am(w,v.mode,S),b.return=v,v=b),l(v)):n(v,b)}return x}var ql=VE(!0),qE=VE(!1),df=$a(null),ff=null,Sl=null,lx=null;function sx(){lx=Sl=ff=null}function cx(e){var t=df.current;Et(df),e._currentValue=t}function Jg(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Dl(e,t){ff=e,lx=Sl=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Jn=!0),e.firstContext=null)}function Nr(e){var t=e._currentValue;if(lx!==e)if(e={context:e,memoizedValue:t,next:null},Sl===null){if(ff===null)throw Error(pe(308));Sl=e,ff.dependencies={lanes:0,firstContext:e}}else Sl=Sl.next=e;return t}var ho=null;function ux(e){ho===null?ho=[e]:ho.push(e)}function YE(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,ux(t)):(n.next=i.next,i.next=n),t.interleaved=n,Wi(e,r)}function Wi(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var da=!1;function dx(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function GE(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function zi(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ca(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,tt&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Wi(e,n)}return i=r.interleaved,i===null?(t.next=t,ux(r)):(t.next=i.next,i.next=t),r.interleaved=t,Wi(e,n)}function Ld(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xy(e,n)}}function rw(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var l={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=l:a=a.next=l,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function pf(e,t,n,r){var i=e.updateQueue;da=!1;var a=i.firstBaseUpdate,l=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,u=c.next;c.next=null,l===null?a=u:l.next=u,l=c;var f=e.alternate;f!==null&&(f=f.updateQueue,s=f.lastBaseUpdate,s!==l&&(s===null?f.firstBaseUpdate=u:s.next=u,f.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;l=0,f=u=c=null,s=a;do{var p=s.lane,m=s.eventTime;if((r&p)===p){f!==null&&(f=f.next={eventTime:m,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var g=e,y=s;switch(p=t,m=n,y.tag){case 1:if(g=y.payload,typeof g=="function"){d=g.call(m,d,p);break e}d=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=y.payload,p=typeof g=="function"?g.call(m,d,p):g,p==null)break e;d=Lt({},d,p);break e;case 2:da=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,p=i.effects,p===null?i.effects=[s]:p.push(s))}else m={eventTime:m,lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},f===null?(u=f=m,c=d):f=f.next=m,l|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(f===null&&(c=d),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=f,t=i.shared.interleaved,t!==null){i=t;do l|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);No|=l,e.lanes=l,e.memoizedState=d}}function iw(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(pe(191,i));i.call(r)}}}var su={},gi=$a(su),Ic=$a(su),Nc=$a(su);function mo(e){if(e===su)throw Error(pe(174));return e}function fx(e,t){switch(wt(Nc,t),wt(Ic,e),wt(gi,su),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ng(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ng(t,e)}Et(gi),wt(gi,t)}function Yl(){Et(gi),Et(Ic),Et(Nc)}function XE(e){mo(Nc.current);var t=mo(gi.current),n=Ng(t,e.type);t!==n&&(wt(Ic,e),wt(gi,n))}function px(e){Ic.current===e&&(Et(gi),Et(Ic))}var Mt=$a(0);function hf(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var km=[];function hx(){for(var e=0;e<km.length;e++)km[e]._workInProgressVersionPrimary=null;km.length=0}var zd=Gi.ReactCurrentDispatcher,Cm=Gi.ReactCurrentBatchConfig,Io=0,Rt=null,on=null,hn=null,mf=!1,cc=!1,_c=0,iL=0;function Pn(){throw Error(pe(321))}function mx(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Yr(e[n],t[n]))return!1;return!0}function gx(e,t,n,r,i,a){if(Io=a,Rt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,zd.current=e===null||e.memoizedState===null?sL:cL,e=n(r,i),cc){a=0;do{if(cc=!1,_c=0,25<=a)throw Error(pe(301));a+=1,hn=on=null,t.updateQueue=null,zd.current=uL,e=n(r,i)}while(cc)}if(zd.current=gf,t=on!==null&&on.next!==null,Io=0,hn=on=Rt=null,mf=!1,t)throw Error(pe(300));return e}function vx(){var e=_c!==0;return _c=0,e}function si(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return hn===null?Rt.memoizedState=hn=e:hn=hn.next=e,hn}function _r(){if(on===null){var e=Rt.alternate;e=e!==null?e.memoizedState:null}else e=on.next;var t=hn===null?Rt.memoizedState:hn.next;if(t!==null)hn=t,on=e;else{if(e===null)throw Error(pe(310));on=e,e={memoizedState:on.memoizedState,baseState:on.baseState,baseQueue:on.baseQueue,queue:on.queue,next:null},hn===null?Rt.memoizedState=hn=e:hn=hn.next=e}return hn}function Mc(e,t){return typeof t=="function"?t(e):t}function Pm(e){var t=_r(),n=t.queue;if(n===null)throw Error(pe(311));n.lastRenderedReducer=e;var r=on,i=r.baseQueue,a=n.pending;if(a!==null){if(i!==null){var l=i.next;i.next=a.next,a.next=l}r.baseQueue=i=a,n.pending=null}if(i!==null){a=i.next,r=r.baseState;var s=l=null,c=null,u=a;do{var f=u.lane;if((Io&f)===f)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var d={lane:f,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(s=c=d,l=r):c=c.next=d,Rt.lanes|=f,No|=f}u=u.next}while(u!==null&&u!==a);c===null?l=r:c.next=s,Yr(r,t.memoizedState)||(Jn=!0),t.memoizedState=r,t.baseState=l,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do a=i.lane,Rt.lanes|=a,No|=a,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Em(e){var t=_r(),n=t.queue;if(n===null)throw Error(pe(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var l=i=i.next;do a=e(a,l.action),l=l.next;while(l!==i);Yr(a,t.memoizedState)||(Jn=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function QE(){}function JE(e,t){var n=Rt,r=_r(),i=t(),a=!Yr(r.memoizedState,i);if(a&&(r.memoizedState=i,Jn=!0),r=r.queue,yx(t2.bind(null,n,r,e),[e]),r.getSnapshot!==t||a||hn!==null&&hn.memoizedState.tag&1){if(n.flags|=2048,Rc(9,e2.bind(null,n,r,i,t),void 0,null),gn===null)throw Error(pe(349));Io&30||ZE(n,t,i)}return i}function ZE(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Rt.updateQueue,t===null?(t={lastEffect:null,stores:null},Rt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function e2(e,t,n,r){t.value=n,t.getSnapshot=r,n2(t)&&r2(e)}function t2(e,t,n){return n(function(){n2(t)&&r2(e)})}function n2(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Yr(e,n)}catch{return!0}}function r2(e){var t=Wi(e,1);t!==null&&qr(t,e,1,-1)}function aw(e){var t=si();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Mc,lastRenderedState:e},t.queue=e,e=e.dispatch=lL.bind(null,Rt,e),[t.memoizedState,e]}function Rc(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Rt.updateQueue,t===null?(t={lastEffect:null,stores:null},Rt.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function i2(){return _r().memoizedState}function $d(e,t,n,r){var i=si();Rt.flags|=e,i.memoizedState=Rc(1|t,n,void 0,r===void 0?null:r)}function _p(e,t,n,r){var i=_r();r=r===void 0?null:r;var a=void 0;if(on!==null){var l=on.memoizedState;if(a=l.destroy,r!==null&&mx(r,l.deps)){i.memoizedState=Rc(t,n,a,r);return}}Rt.flags|=e,i.memoizedState=Rc(1|t,n,a,r)}function ow(e,t){return $d(8390656,8,e,t)}function yx(e,t){return _p(2048,8,e,t)}function a2(e,t){return _p(4,2,e,t)}function o2(e,t){return _p(4,4,e,t)}function l2(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function s2(e,t,n){return n=n!=null?n.concat([e]):null,_p(4,4,l2.bind(null,t,e),n)}function xx(){}function c2(e,t){var n=_r();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&mx(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function u2(e,t){var n=_r();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&mx(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function d2(e,t,n){return Io&21?(Yr(n,t)||(n=gE(),Rt.lanes|=n,No|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Jn=!0),e.memoizedState=n)}function aL(e,t){var n=pt;pt=n!==0&&4>n?n:4,e(!0);var r=Cm.transition;Cm.transition={};try{e(!1),t()}finally{pt=n,Cm.transition=r}}function f2(){return _r().memoizedState}function oL(e,t,n){var r=Ea(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},p2(e))h2(t,n);else if(n=YE(e,t,n,r),n!==null){var i=Un();qr(n,e,r,i),m2(n,t,r)}}function lL(e,t,n){var r=Ea(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(p2(e))h2(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var l=t.lastRenderedState,s=a(l,n);if(i.hasEagerState=!0,i.eagerState=s,Yr(s,l)){var c=t.interleaved;c===null?(i.next=i,ux(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=YE(e,t,i,r),n!==null&&(i=Un(),qr(n,e,r,i),m2(n,t,r))}}function p2(e){var t=e.alternate;return e===Rt||t!==null&&t===Rt}function h2(e,t){cc=mf=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function m2(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xy(e,n)}}var gf={readContext:Nr,useCallback:Pn,useContext:Pn,useEffect:Pn,useImperativeHandle:Pn,useInsertionEffect:Pn,useLayoutEffect:Pn,useMemo:Pn,useReducer:Pn,useRef:Pn,useState:Pn,useDebugValue:Pn,useDeferredValue:Pn,useTransition:Pn,useMutableSource:Pn,useSyncExternalStore:Pn,useId:Pn,unstable_isNewReconciler:!1},sL={readContext:Nr,useCallback:function(e,t){return si().memoizedState=[e,t===void 0?null:t],e},useContext:Nr,useEffect:ow,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,$d(4194308,4,l2.bind(null,t,e),n)},useLayoutEffect:function(e,t){return $d(4194308,4,e,t)},useInsertionEffect:function(e,t){return $d(4,2,e,t)},useMemo:function(e,t){var n=si();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=si();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=oL.bind(null,Rt,e),[r.memoizedState,e]},useRef:function(e){var t=si();return e={current:e},t.memoizedState=e},useState:aw,useDebugValue:xx,useDeferredValue:function(e){return si().memoizedState=e},useTransition:function(){var e=aw(!1),t=e[0];return e=aL.bind(null,e[1]),si().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Rt,i=si();if(At){if(n===void 0)throw Error(pe(407));n=n()}else{if(n=t(),gn===null)throw Error(pe(349));Io&30||ZE(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,ow(t2.bind(null,r,a,e),[e]),r.flags|=2048,Rc(9,e2.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=si(),t=gn.identifierPrefix;if(At){var n=Ri,r=Mi;n=(r&~(1<<32-Vr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=_c++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=iL++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},cL={readContext:Nr,useCallback:c2,useContext:Nr,useEffect:yx,useImperativeHandle:s2,useInsertionEffect:a2,useLayoutEffect:o2,useMemo:u2,useReducer:Pm,useRef:i2,useState:function(){return Pm(Mc)},useDebugValue:xx,useDeferredValue:function(e){var t=_r();return d2(t,on.memoizedState,e)},useTransition:function(){var e=Pm(Mc)[0],t=_r().memoizedState;return[e,t]},useMutableSource:QE,useSyncExternalStore:JE,useId:f2,unstable_isNewReconciler:!1},uL={readContext:Nr,useCallback:c2,useContext:Nr,useEffect:yx,useImperativeHandle:s2,useInsertionEffect:a2,useLayoutEffect:o2,useMemo:u2,useReducer:Em,useRef:i2,useState:function(){return Em(Mc)},useDebugValue:xx,useDeferredValue:function(e){var t=_r();return on===null?t.memoizedState=e:d2(t,on.memoizedState,e)},useTransition:function(){var e=Em(Mc)[0],t=_r().memoizedState;return[e,t]},useMutableSource:QE,useSyncExternalStore:JE,useId:f2,unstable_isNewReconciler:!1};function $r(e,t){if(e&&e.defaultProps){t=Lt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Zg(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Lt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Mp={isMounted:function(e){return(e=e._reactInternals)?Ko(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Un(),i=Ea(e),a=zi(r,i);a.payload=t,n!=null&&(a.callback=n),t=Ca(e,a,i),t!==null&&(qr(t,e,i,r),Ld(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Un(),i=Ea(e),a=zi(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=Ca(e,a,i),t!==null&&(qr(t,e,i,r),Ld(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Un(),r=Ea(e),i=zi(n,r);i.tag=2,t!=null&&(i.callback=t),t=Ca(e,i,r),t!==null&&(qr(t,e,r,n),Ld(t,e,r))}};function lw(e,t,n,r,i,a,l){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,a,l):t.prototype&&t.prototype.isPureReactComponent?!Ec(n,r)||!Ec(i,a):!0}function g2(e,t,n){var r=!1,i=_a,a=t.contextType;return typeof a=="object"&&a!==null?a=Nr(a):(i=nr(t)?Oo:_n.current,r=t.contextTypes,a=(r=r!=null)?Hl(e,i):_a),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Mp,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function sw(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Mp.enqueueReplaceState(t,t.state,null)}function ev(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},dx(e);var a=t.contextType;typeof a=="object"&&a!==null?i.context=Nr(a):(a=nr(t)?Oo:_n.current,i.context=Hl(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a=="function"&&(Zg(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&Mp.enqueueReplaceState(i,i.state,null),pf(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Gl(e,t){try{var n="",r=t;do n+=zR(r),r=r.return;while(r);var i=n}catch(a){i=`
39
+ Error generating stack: `+a.message+`
40
+ `+a.stack}return{value:e,source:t,stack:i,digest:null}}function Tm(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function tv(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var dL=typeof WeakMap=="function"?WeakMap:Map;function v2(e,t,n){n=zi(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){yf||(yf=!0,dv=r),tv(e,t)},n}function y2(e,t,n){n=zi(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){tv(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch=="function"&&(n.callback=function(){tv(e,t),typeof r!="function"&&(Pa===null?Pa=new Set([this]):Pa.add(this));var l=t.stack;this.componentDidCatch(t.value,{componentStack:l!==null?l:""})}),n}function cw(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new dL;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=CL.bind(null,e,t,n),t.then(e,e))}function uw(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function dw(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=zi(-1,1),t.tag=2,Ca(n,t,1))),n.lanes|=1),e)}var fL=Gi.ReactCurrentOwner,Jn=!1;function $n(e,t,n,r){t.child=e===null?qE(t,null,n,r):ql(t,e.child,n,r)}function fw(e,t,n,r,i){n=n.render;var a=t.ref;return Dl(t,i),r=gx(e,t,n,r,a,i),n=vx(),e!==null&&!Jn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Ki(e,t,i)):(At&&n&&ix(t),t.flags|=1,$n(e,t,r,i),t.child)}function pw(e,t,n,r,i){if(e===null){var a=n.type;return typeof a=="function"&&!Ex(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,x2(e,t,a,r,i)):(e=Wd(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!(e.lanes&i)){var l=a.memoizedProps;if(n=n.compare,n=n!==null?n:Ec,n(l,r)&&e.ref===t.ref)return Ki(e,t,i)}return t.flags|=1,e=Ta(a,r),e.ref=t.ref,e.return=t,t.child=e}function x2(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Ec(a,r)&&e.ref===t.ref)if(Jn=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Jn=!0);else return t.lanes=e.lanes,Ki(e,t,i)}return nv(e,t,n,r,i)}function b2(e,t,n){var r=t.pendingProps,i=r.children,a=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},wt(Cl,lr),lr|=n;else{if(!(n&1073741824))return e=a!==null?a.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,wt(Cl,lr),lr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a!==null?a.baseLanes:n,wt(Cl,lr),lr|=r}else a!==null?(r=a.baseLanes|n,t.memoizedState=null):r=n,wt(Cl,lr),lr|=r;return $n(e,t,i,n),t.child}function w2(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function nv(e,t,n,r,i){var a=nr(n)?Oo:_n.current;return a=Hl(t,a),Dl(t,i),n=gx(e,t,n,r,a,i),r=vx(),e!==null&&!Jn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Ki(e,t,i)):(At&&r&&ix(t),t.flags|=1,$n(e,t,n,i),t.child)}function hw(e,t,n,r,i){if(nr(n)){var a=!0;sf(t)}else a=!1;if(Dl(t,i),t.stateNode===null)Bd(e,t),g2(t,n,r),ev(t,n,r,i),r=!0;else if(e===null){var l=t.stateNode,s=t.memoizedProps;l.props=s;var c=l.context,u=n.contextType;typeof u=="object"&&u!==null?u=Nr(u):(u=nr(n)?Oo:_n.current,u=Hl(t,u));var f=n.getDerivedStateFromProps,d=typeof f=="function"||typeof l.getSnapshotBeforeUpdate=="function";d||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(s!==r||c!==u)&&sw(t,l,r,u),da=!1;var p=t.memoizedState;l.state=p,pf(t,r,l,i),c=t.memoizedState,s!==r||p!==c||tr.current||da?(typeof f=="function"&&(Zg(t,n,f,r),c=t.memoizedState),(s=da||lw(t,n,s,r,p,c,u))?(d||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount()),typeof l.componentDidMount=="function"&&(t.flags|=4194308)):(typeof l.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),l.props=r,l.state=c,l.context=u,r=s):(typeof l.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{l=t.stateNode,GE(e,t),s=t.memoizedProps,u=t.type===t.elementType?s:$r(t.type,s),l.props=u,d=t.pendingProps,p=l.context,c=n.contextType,typeof c=="object"&&c!==null?c=Nr(c):(c=nr(n)?Oo:_n.current,c=Hl(t,c));var m=n.getDerivedStateFromProps;(f=typeof m=="function"||typeof l.getSnapshotBeforeUpdate=="function")||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(s!==d||p!==c)&&sw(t,l,r,c),da=!1,p=t.memoizedState,l.state=p,pf(t,r,l,i);var g=t.memoizedState;s!==d||p!==g||tr.current||da?(typeof m=="function"&&(Zg(t,n,m,r),g=t.memoizedState),(u=da||lw(t,n,u,r,p,g,c)||!1)?(f||typeof l.UNSAFE_componentWillUpdate!="function"&&typeof l.componentWillUpdate!="function"||(typeof l.componentWillUpdate=="function"&&l.componentWillUpdate(r,g,c),typeof l.UNSAFE_componentWillUpdate=="function"&&l.UNSAFE_componentWillUpdate(r,g,c)),typeof l.componentDidUpdate=="function"&&(t.flags|=4),typeof l.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof l.componentDidUpdate!="function"||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),l.props=r,l.state=g,l.context=c,r=u):(typeof l.componentDidUpdate!="function"||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return rv(e,t,n,r,a,i)}function rv(e,t,n,r,i,a){w2(e,t);var l=(t.flags&128)!==0;if(!r&&!l)return i&&Z1(t,n,!1),Ki(e,t,a);r=t.stateNode,fL.current=t;var s=l&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&l?(t.child=ql(t,e.child,null,a),t.child=ql(t,null,s,a)):$n(e,t,s,a),t.memoizedState=r.state,i&&Z1(t,n,!0),t.child}function j2(e){var t=e.stateNode;t.pendingContext?J1(e,t.pendingContext,t.pendingContext!==t.context):t.context&&J1(e,t.context,!1),fx(e,t.containerInfo)}function mw(e,t,n,r,i){return Vl(),ox(i),t.flags|=256,$n(e,t,n,r),t.child}var iv={dehydrated:null,treeContext:null,retryLane:0};function av(e){return{baseLanes:e,cachePool:null,transitions:null}}function S2(e,t,n){var r=t.pendingProps,i=Mt.current,a=!1,l=(t.flags&128)!==0,s;if((s=l)||(s=e!==null&&e.memoizedState===null?!1:(i&2)!==0),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),wt(Mt,i&1),e===null)return Qg(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(l=r.children,e=r.fallback,a?(r=t.mode,a=t.child,l={mode:"hidden",children:l},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=l):a=Lp(l,r,0,null),e=So(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=av(n),t.memoizedState=iv,e):bx(t,l));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return pL(e,t,l,r,s,i,n);if(a){a=r.fallback,l=t.mode,i=e.child,s=i.sibling;var c={mode:"hidden",children:r.children};return!(l&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Ta(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s!==null?a=Ta(s,a):(a=So(a,l,n,null),a.flags|=2),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,l=e.child.memoizedState,l=l===null?av(n):{baseLanes:l.baseLanes|n,cachePool:null,transitions:l.transitions},a.memoizedState=l,a.childLanes=e.childLanes&~n,t.memoizedState=iv,r}return a=e.child,e=a.sibling,r=Ta(a,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function bx(e,t){return t=Lp({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function nd(e,t,n,r){return r!==null&&ox(r),ql(t,e.child,null,n),e=bx(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function pL(e,t,n,r,i,a,l){if(n)return t.flags&256?(t.flags&=-257,r=Tm(Error(pe(422))),nd(e,t,l,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(a=r.fallback,i=t.mode,r=Lp({mode:"visible",children:r.children},i,0,null),a=So(a,i,l,null),a.flags|=2,r.return=t,a.return=t,r.sibling=a,t.child=r,t.mode&1&&ql(t,e.child,null,l),t.child.memoizedState=av(l),t.memoizedState=iv,a);if(!(t.mode&1))return nd(e,t,l,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var s=r.dgst;return r=s,a=Error(pe(419)),r=Tm(a,r,void 0),nd(e,t,l,r)}if(s=(l&e.childLanes)!==0,Jn||s){if(r=gn,r!==null){switch(l&-l){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|l)?0:i,i!==0&&i!==a.retryLane&&(a.retryLane=i,Wi(e,i),qr(r,e,i,-1))}return Px(),r=Tm(Error(pe(421))),nd(e,t,l,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=PL.bind(null,e),i._reactRetry=t,null):(e=a.treeContext,cr=ka(i.nextSibling),fr=t,At=!0,Ur=null,e!==null&&(Cr[Pr++]=Mi,Cr[Pr++]=Ri,Cr[Pr++]=Ao,Mi=e.id,Ri=e.overflow,Ao=t),t=bx(t,r.children),t.flags|=4096,t)}function gw(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Jg(e.return,t,n)}function Om(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function k2(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if($n(e,t,r.children,n),r=Mt.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&gw(e,n,t);else if(e.tag===19)gw(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(wt(Mt,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&hf(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Om(t,!1,i,n,a);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&hf(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Om(t,!0,n,null,a);break;case"together":Om(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Bd(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ki(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),No|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(pe(153));if(t.child!==null){for(e=t.child,n=Ta(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ta(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function hL(e,t,n){switch(t.tag){case 3:j2(t),Vl();break;case 5:XE(t);break;case 1:nr(t.type)&&sf(t);break;case 4:fx(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;wt(df,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(wt(Mt,Mt.current&1),t.flags|=128,null):n&t.child.childLanes?S2(e,t,n):(wt(Mt,Mt.current&1),e=Ki(e,t,n),e!==null?e.sibling:null);wt(Mt,Mt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return k2(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),wt(Mt,Mt.current),r)break;return null;case 22:case 23:return t.lanes=0,b2(e,t,n)}return Ki(e,t,n)}var C2,ov,P2,E2;C2=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};ov=function(){};P2=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,mo(gi.current);var a=null;switch(n){case"input":i=Tg(e,i),r=Tg(e,r),a=[];break;case"select":i=Lt({},i,{value:void 0}),r=Lt({},r,{value:void 0}),a=[];break;case"textarea":i=Ig(e,i),r=Ig(e,r),a=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=of)}_g(n,r);var l;n=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var s=i[u];for(l in s)s.hasOwnProperty(l)&&(n||(n={}),n[l]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(bc.hasOwnProperty(u)?a||(a=[]):(a=a||[]).push(u,null));for(u in r){var c=r[u];if(s=i!=null?i[u]:void 0,r.hasOwnProperty(u)&&c!==s&&(c!=null||s!=null))if(u==="style")if(s){for(l in s)!s.hasOwnProperty(l)||c&&c.hasOwnProperty(l)||(n||(n={}),n[l]="");for(l in c)c.hasOwnProperty(l)&&s[l]!==c[l]&&(n||(n={}),n[l]=c[l])}else n||(a||(a=[]),a.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,s=s?s.__html:void 0,c!=null&&s!==c&&(a=a||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(a=a||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(bc.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&kt("scroll",e),a||s===c||(a=[])):(a=a||[]).push(u,c))}n&&(a=a||[]).push("style",n);var u=a;(t.updateQueue=u)&&(t.flags|=4)}};E2=function(e,t,n,r){n!==r&&(t.flags|=4)};function Rs(e,t){if(!At)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function En(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function mL(e,t,n){var r=t.pendingProps;switch(ax(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return En(t),null;case 1:return nr(t.type)&&lf(),En(t),null;case 3:return r=t.stateNode,Yl(),Et(tr),Et(_n),hx(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(ed(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ur!==null&&(hv(Ur),Ur=null))),ov(e,t),En(t),null;case 5:px(t);var i=mo(Nc.current);if(n=t.type,e!==null&&t.stateNode!=null)P2(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(pe(166));return En(t),null}if(e=mo(gi.current),ed(t)){r=t.stateNode,n=t.type;var a=t.memoizedProps;switch(r[di]=t,r[Ac]=a,e=(t.mode&1)!==0,n){case"dialog":kt("cancel",r),kt("close",r);break;case"iframe":case"object":case"embed":kt("load",r);break;case"video":case"audio":for(i=0;i<Zs.length;i++)kt(Zs[i],r);break;case"source":kt("error",r);break;case"img":case"image":case"link":kt("error",r),kt("load",r);break;case"details":kt("toggle",r);break;case"input":C1(r,a),kt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!a.multiple},kt("invalid",r);break;case"textarea":E1(r,a),kt("invalid",r)}_g(n,a),i=null;for(var l in a)if(a.hasOwnProperty(l)){var s=a[l];l==="children"?typeof s=="string"?r.textContent!==s&&(a.suppressHydrationWarning!==!0&&Zu(r.textContent,s,e),i=["children",s]):typeof s=="number"&&r.textContent!==""+s&&(a.suppressHydrationWarning!==!0&&Zu(r.textContent,s,e),i=["children",""+s]):bc.hasOwnProperty(l)&&s!=null&&l==="onScroll"&&kt("scroll",r)}switch(n){case"input":Hu(r),P1(r,a,!0);break;case"textarea":Hu(r),T1(r);break;case"select":case"option":break;default:typeof a.onClick=="function"&&(r.onclick=of)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{l=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=tE(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=l.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=l.createElement(n,{is:r.is}):(e=l.createElement(n),n==="select"&&(l=e,r.multiple?l.multiple=!0:r.size&&(l.size=r.size))):e=l.createElementNS(e,n),e[di]=t,e[Ac]=r,C2(e,t,!1,!1),t.stateNode=e;e:{switch(l=Mg(n,r),n){case"dialog":kt("cancel",e),kt("close",e),i=r;break;case"iframe":case"object":case"embed":kt("load",e),i=r;break;case"video":case"audio":for(i=0;i<Zs.length;i++)kt(Zs[i],e);i=r;break;case"source":kt("error",e),i=r;break;case"img":case"image":case"link":kt("error",e),kt("load",e),i=r;break;case"details":kt("toggle",e),i=r;break;case"input":C1(e,r),i=Tg(e,r),kt("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=Lt({},r,{value:void 0}),kt("invalid",e);break;case"textarea":E1(e,r),i=Ig(e,r),kt("invalid",e);break;default:i=r}_g(n,i),s=i;for(a in s)if(s.hasOwnProperty(a)){var c=s[a];a==="style"?iE(e,c):a==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&nE(e,c)):a==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&wc(e,c):typeof c=="number"&&wc(e,""+c):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(bc.hasOwnProperty(a)?c!=null&&a==="onScroll"&&kt("scroll",e):c!=null&&Ky(e,a,c,l))}switch(n){case"input":Hu(e),P1(e,r,!1);break;case"textarea":Hu(e),T1(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Na(r.value));break;case"select":e.multiple=!!r.multiple,a=r.value,a!=null?Nl(e,!!r.multiple,a,!1):r.defaultValue!=null&&Nl(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=of)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return En(t),null;case 6:if(e&&t.stateNode!=null)E2(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(pe(166));if(n=mo(Nc.current),mo(gi.current),ed(t)){if(r=t.stateNode,n=t.memoizedProps,r[di]=t,(a=r.nodeValue!==n)&&(e=fr,e!==null))switch(e.tag){case 3:Zu(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Zu(r.nodeValue,n,(e.mode&1)!==0)}a&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[di]=t,t.stateNode=r}return En(t),null;case 13:if(Et(Mt),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(At&&cr!==null&&t.mode&1&&!(t.flags&128))HE(),Vl(),t.flags|=98560,a=!1;else if(a=ed(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(pe(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(pe(317));a[di]=t}else Vl(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;En(t),a=!1}else Ur!==null&&(hv(Ur),Ur=null),a=!0;if(!a)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Mt.current&1?sn===0&&(sn=3):Px())),t.updateQueue!==null&&(t.flags|=4),En(t),null);case 4:return Yl(),ov(e,t),e===null&&Tc(t.stateNode.containerInfo),En(t),null;case 10:return cx(t.type._context),En(t),null;case 17:return nr(t.type)&&lf(),En(t),null;case 19:if(Et(Mt),a=t.memoizedState,a===null)return En(t),null;if(r=(t.flags&128)!==0,l=a.rendering,l===null)if(r)Rs(a,!1);else{if(sn!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(l=hf(e),l!==null){for(t.flags|=128,Rs(a,!1),r=l.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)a=n,e=r,a.flags&=14680066,l=a.alternate,l===null?(a.childLanes=0,a.lanes=e,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=l.childLanes,a.lanes=l.lanes,a.child=l.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=l.memoizedProps,a.memoizedState=l.memoizedState,a.updateQueue=l.updateQueue,a.type=l.type,e=l.dependencies,a.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return wt(Mt,Mt.current&1|2),t.child}e=e.sibling}a.tail!==null&&qt()>Xl&&(t.flags|=128,r=!0,Rs(a,!1),t.lanes=4194304)}else{if(!r)if(e=hf(l),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Rs(a,!0),a.tail===null&&a.tailMode==="hidden"&&!l.alternate&&!At)return En(t),null}else 2*qt()-a.renderingStartTime>Xl&&n!==1073741824&&(t.flags|=128,r=!0,Rs(a,!1),t.lanes=4194304);a.isBackwards?(l.sibling=t.child,t.child=l):(n=a.last,n!==null?n.sibling=l:t.child=l,a.last=l)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=qt(),t.sibling=null,n=Mt.current,wt(Mt,r?n&1|2:n&1),t):(En(t),null);case 22:case 23:return Cx(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?lr&1073741824&&(En(t),t.subtreeFlags&6&&(t.flags|=8192)):En(t),null;case 24:return null;case 25:return null}throw Error(pe(156,t.tag))}function gL(e,t){switch(ax(t),t.tag){case 1:return nr(t.type)&&lf(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Yl(),Et(tr),Et(_n),hx(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return px(t),null;case 13:if(Et(Mt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(pe(340));Vl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Et(Mt),null;case 4:return Yl(),null;case 10:return cx(t.type._context),null;case 22:case 23:return Cx(),null;case 24:return null;default:return null}}var rd=!1,An=!1,vL=typeof WeakSet=="function"?WeakSet:Set,Se=null;function kl(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Wt(e,t,r)}else n.current=null}function lv(e,t,n){try{n()}catch(r){Wt(e,t,r)}}var vw=!1;function yL(e,t){if(Kg=nf,e=NE(),rx(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var l=0,s=-1,c=-1,u=0,f=0,d=e,p=null;t:for(;;){for(var m;d!==n||i!==0&&d.nodeType!==3||(s=l+i),d!==a||r!==0&&d.nodeType!==3||(c=l+r),d.nodeType===3&&(l+=d.nodeValue.length),(m=d.firstChild)!==null;)p=d,d=m;for(;;){if(d===e)break t;if(p===n&&++u===i&&(s=l),p===a&&++f===r&&(c=l),(m=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=m}n=s===-1||c===-1?null:{start:s,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Hg={focusedElem:e,selectionRange:n},nf=!1,Se=t;Se!==null;)if(t=Se,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Se=e;else for(;Se!==null;){t=Se;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var y=g.memoizedProps,x=g.memoizedState,v=t.stateNode,b=v.getSnapshotBeforeUpdate(t.elementType===t.type?y:$r(t.type,y),x);v.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(pe(163))}}catch(S){Wt(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,Se=e;break}Se=t.return}return g=vw,vw=!1,g}function uc(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&lv(t,n,a)}i=i.next}while(i!==r)}}function Rp(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function sv(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function T2(e){var t=e.alternate;t!==null&&(e.alternate=null,T2(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[di],delete t[Ac],delete t[Yg],delete t[eL],delete t[tL])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function O2(e){return e.tag===5||e.tag===3||e.tag===4}function yw(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||O2(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function cv(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=of));else if(r!==4&&(e=e.child,e!==null))for(cv(e,t,n),e=e.sibling;e!==null;)cv(e,t,n),e=e.sibling}function uv(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(uv(e,t,n),e=e.sibling;e!==null;)uv(e,t,n),e=e.sibling}var wn=null,Fr=!1;function oa(e,t,n){for(n=n.child;n!==null;)A2(e,t,n),n=n.sibling}function A2(e,t,n){if(mi&&typeof mi.onCommitFiberUnmount=="function")try{mi.onCommitFiberUnmount(Ep,n)}catch{}switch(n.tag){case 5:An||kl(n,t);case 6:var r=wn,i=Fr;wn=null,oa(e,t,n),wn=r,Fr=i,wn!==null&&(Fr?(e=wn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):wn.removeChild(n.stateNode));break;case 18:wn!==null&&(Fr?(e=wn,n=n.stateNode,e.nodeType===8?jm(e.parentNode,n):e.nodeType===1&&jm(e,n),Cc(e)):jm(wn,n.stateNode));break;case 4:r=wn,i=Fr,wn=n.stateNode.containerInfo,Fr=!0,oa(e,t,n),wn=r,Fr=i;break;case 0:case 11:case 14:case 15:if(!An&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,l=a.destroy;a=a.tag,l!==void 0&&(a&2||a&4)&&lv(n,t,l),i=i.next}while(i!==r)}oa(e,t,n);break;case 1:if(!An&&(kl(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){Wt(n,t,s)}oa(e,t,n);break;case 21:oa(e,t,n);break;case 22:n.mode&1?(An=(r=An)||n.memoizedState!==null,oa(e,t,n),An=r):oa(e,t,n);break;default:oa(e,t,n)}}function xw(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new vL),t.forEach(function(r){var i=EL.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function zr(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var a=e,l=t,s=l;e:for(;s!==null;){switch(s.tag){case 5:wn=s.stateNode,Fr=!1;break e;case 3:wn=s.stateNode.containerInfo,Fr=!0;break e;case 4:wn=s.stateNode.containerInfo,Fr=!0;break e}s=s.return}if(wn===null)throw Error(pe(160));A2(a,l,i),wn=null,Fr=!1;var c=i.alternate;c!==null&&(c.return=null),i.return=null}catch(u){Wt(i,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)I2(t,e),t=t.sibling}function I2(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(zr(t,e),ni(e),r&4){try{uc(3,e,e.return),Rp(3,e)}catch(y){Wt(e,e.return,y)}try{uc(5,e,e.return)}catch(y){Wt(e,e.return,y)}}break;case 1:zr(t,e),ni(e),r&512&&n!==null&&kl(n,n.return);break;case 5:if(zr(t,e),ni(e),r&512&&n!==null&&kl(n,n.return),e.flags&32){var i=e.stateNode;try{wc(i,"")}catch(y){Wt(e,e.return,y)}}if(r&4&&(i=e.stateNode,i!=null)){var a=e.memoizedProps,l=n!==null?n.memoizedProps:a,s=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{s==="input"&&a.type==="radio"&&a.name!=null&&ZP(i,a),Mg(s,l);var u=Mg(s,a);for(l=0;l<c.length;l+=2){var f=c[l],d=c[l+1];f==="style"?iE(i,d):f==="dangerouslySetInnerHTML"?nE(i,d):f==="children"?wc(i,d):Ky(i,f,d,u)}switch(s){case"input":Og(i,a);break;case"textarea":eE(i,a);break;case"select":var p=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!a.multiple;var m=a.value;m!=null?Nl(i,!!a.multiple,m,!1):p!==!!a.multiple&&(a.defaultValue!=null?Nl(i,!!a.multiple,a.defaultValue,!0):Nl(i,!!a.multiple,a.multiple?[]:"",!1))}i[Ac]=a}catch(y){Wt(e,e.return,y)}}break;case 6:if(zr(t,e),ni(e),r&4){if(e.stateNode===null)throw Error(pe(162));i=e.stateNode,a=e.memoizedProps;try{i.nodeValue=a}catch(y){Wt(e,e.return,y)}}break;case 3:if(zr(t,e),ni(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Cc(t.containerInfo)}catch(y){Wt(e,e.return,y)}break;case 4:zr(t,e),ni(e);break;case 13:zr(t,e),ni(e),i=e.child,i.flags&8192&&(a=i.memoizedState!==null,i.stateNode.isHidden=a,!a||i.alternate!==null&&i.alternate.memoizedState!==null||(Sx=qt())),r&4&&xw(e);break;case 22:if(f=n!==null&&n.memoizedState!==null,e.mode&1?(An=(u=An)||f,zr(t,e),An=u):zr(t,e),ni(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!f&&e.mode&1)for(Se=e,f=e.child;f!==null;){for(d=Se=f;Se!==null;){switch(p=Se,m=p.child,p.tag){case 0:case 11:case 14:case 15:uc(4,p,p.return);break;case 1:kl(p,p.return);var g=p.stateNode;if(typeof g.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(y){Wt(r,n,y)}}break;case 5:kl(p,p.return);break;case 22:if(p.memoizedState!==null){ww(d);continue}}m!==null?(m.return=p,Se=m):ww(d)}f=f.sibling}e:for(f=null,d=e;;){if(d.tag===5){if(f===null){f=d;try{i=d.stateNode,u?(a=i.style,typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"):(s=d.stateNode,c=d.memoizedProps.style,l=c!=null&&c.hasOwnProperty("display")?c.display:null,s.style.display=rE("display",l))}catch(y){Wt(e,e.return,y)}}}else if(d.tag===6){if(f===null)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(y){Wt(e,e.return,y)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;f===d&&(f=null),d=d.return}f===d&&(f=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:zr(t,e),ni(e),r&4&&xw(e);break;case 21:break;default:zr(t,e),ni(e)}}function ni(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(O2(n)){var r=n;break e}n=n.return}throw Error(pe(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(wc(i,""),r.flags&=-33);var a=yw(e);uv(e,a,i);break;case 3:case 4:var l=r.stateNode.containerInfo,s=yw(e);cv(e,s,l);break;default:throw Error(pe(161))}}catch(c){Wt(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function xL(e,t,n){Se=e,N2(e)}function N2(e,t,n){for(var r=(e.mode&1)!==0;Se!==null;){var i=Se,a=i.child;if(i.tag===22&&r){var l=i.memoizedState!==null||rd;if(!l){var s=i.alternate,c=s!==null&&s.memoizedState!==null||An;s=rd;var u=An;if(rd=l,(An=c)&&!u)for(Se=i;Se!==null;)l=Se,c=l.child,l.tag===22&&l.memoizedState!==null?jw(i):c!==null?(c.return=l,Se=c):jw(i);for(;a!==null;)Se=a,N2(a),a=a.sibling;Se=i,rd=s,An=u}bw(e)}else i.subtreeFlags&8772&&a!==null?(a.return=i,Se=a):bw(e)}}function bw(e){for(;Se!==null;){var t=Se;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:An||Rp(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!An)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:$r(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var a=t.updateQueue;a!==null&&iw(t,a,r);break;case 3:var l=t.updateQueue;if(l!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}iw(t,l,n)}break;case 5:var s=t.stateNode;if(n===null&&t.flags&4){n=s;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var f=u.memoizedState;if(f!==null){var d=f.dehydrated;d!==null&&Cc(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(pe(163))}An||t.flags&512&&sv(t)}catch(p){Wt(t,t.return,p)}}if(t===e){Se=null;break}if(n=t.sibling,n!==null){n.return=t.return,Se=n;break}Se=t.return}}function ww(e){for(;Se!==null;){var t=Se;if(t===e){Se=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Se=n;break}Se=t.return}}function jw(e){for(;Se!==null;){var t=Se;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Rp(4,t)}catch(c){Wt(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(c){Wt(t,i,c)}}var a=t.return;try{sv(t)}catch(c){Wt(t,a,c)}break;case 5:var l=t.return;try{sv(t)}catch(c){Wt(t,l,c)}}}catch(c){Wt(t,t.return,c)}if(t===e){Se=null;break}var s=t.sibling;if(s!==null){s.return=t.return,Se=s;break}Se=t.return}}var bL=Math.ceil,vf=Gi.ReactCurrentDispatcher,wx=Gi.ReactCurrentOwner,Ir=Gi.ReactCurrentBatchConfig,tt=0,gn=null,Zt=null,Sn=0,lr=0,Cl=$a(0),sn=0,Dc=null,No=0,Dp=0,jx=0,dc=null,Qn=null,Sx=0,Xl=1/0,Ai=null,yf=!1,dv=null,Pa=null,id=!1,ya=null,xf=0,fc=0,fv=null,Fd=-1,Ud=0;function Un(){return tt&6?qt():Fd!==-1?Fd:Fd=qt()}function Ea(e){return e.mode&1?tt&2&&Sn!==0?Sn&-Sn:rL.transition!==null?(Ud===0&&(Ud=gE()),Ud):(e=pt,e!==0||(e=window.event,e=e===void 0?16:SE(e.type)),e):1}function qr(e,t,n,r){if(50<fc)throw fc=0,fv=null,Error(pe(185));au(e,n,r),(!(tt&2)||e!==gn)&&(e===gn&&(!(tt&2)&&(Dp|=n),sn===4&&ma(e,Sn)),rr(e,r),n===1&&tt===0&&!(t.mode&1)&&(Xl=qt()+500,Np&&Ba()))}function rr(e,t){var n=e.callbackNode;rD(e,t);var r=tf(e,e===gn?Sn:0);if(r===0)n!==null&&I1(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&I1(n),t===1)e.tag===0?nL(Sw.bind(null,e)):UE(Sw.bind(null,e)),JD(function(){!(tt&6)&&Ba()}),n=null;else{switch(vE(r)){case 1:n=Gy;break;case 4:n=hE;break;case 16:n=ef;break;case 536870912:n=mE;break;default:n=ef}n=B2(n,_2.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function _2(e,t){if(Fd=-1,Ud=0,tt&6)throw Error(pe(327));var n=e.callbackNode;if(Ll()&&e.callbackNode!==n)return null;var r=tf(e,e===gn?Sn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=bf(e,r);else{t=r;var i=tt;tt|=2;var a=R2();(gn!==e||Sn!==t)&&(Ai=null,Xl=qt()+500,jo(e,t));do try{SL();break}catch(s){M2(e,s)}while(!0);sx(),vf.current=a,tt=i,Zt!==null?t=0:(gn=null,Sn=0,t=sn)}if(t!==0){if(t===2&&(i=$g(e),i!==0&&(r=i,t=pv(e,i))),t===1)throw n=Dc,jo(e,0),ma(e,r),rr(e,qt()),n;if(t===6)ma(e,r);else{if(i=e.current.alternate,!(r&30)&&!wL(i)&&(t=bf(e,r),t===2&&(a=$g(e),a!==0&&(r=a,t=pv(e,a))),t===1))throw n=Dc,jo(e,0),ma(e,r),rr(e,qt()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(pe(345));case 2:lo(e,Qn,Ai);break;case 3:if(ma(e,r),(r&130023424)===r&&(t=Sx+500-qt(),10<t)){if(tf(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){Un(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=qg(lo.bind(null,e,Qn,Ai),t);break}lo(e,Qn,Ai);break;case 4:if(ma(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var l=31-Vr(r);a=1<<l,l=t[l],l>i&&(i=l),r&=~a}if(r=i,r=qt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*bL(r/1960))-r,10<r){e.timeoutHandle=qg(lo.bind(null,e,Qn,Ai),r);break}lo(e,Qn,Ai);break;case 5:lo(e,Qn,Ai);break;default:throw Error(pe(329))}}}return rr(e,qt()),e.callbackNode===n?_2.bind(null,e):null}function pv(e,t){var n=dc;return e.current.memoizedState.isDehydrated&&(jo(e,t).flags|=256),e=bf(e,t),e!==2&&(t=Qn,Qn=n,t!==null&&hv(t)),e}function hv(e){Qn===null?Qn=e:Qn.push.apply(Qn,e)}function wL(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Yr(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function ma(e,t){for(t&=~jx,t&=~Dp,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Vr(t),r=1<<n;e[n]=-1,t&=~r}}function Sw(e){if(tt&6)throw Error(pe(327));Ll();var t=tf(e,0);if(!(t&1))return rr(e,qt()),null;var n=bf(e,t);if(e.tag!==0&&n===2){var r=$g(e);r!==0&&(t=r,n=pv(e,r))}if(n===1)throw n=Dc,jo(e,0),ma(e,t),rr(e,qt()),n;if(n===6)throw Error(pe(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,lo(e,Qn,Ai),rr(e,qt()),null}function kx(e,t){var n=tt;tt|=1;try{return e(t)}finally{tt=n,tt===0&&(Xl=qt()+500,Np&&Ba())}}function _o(e){ya!==null&&ya.tag===0&&!(tt&6)&&Ll();var t=tt;tt|=1;var n=Ir.transition,r=pt;try{if(Ir.transition=null,pt=1,e)return e()}finally{pt=r,Ir.transition=n,tt=t,!(tt&6)&&Ba()}}function Cx(){lr=Cl.current,Et(Cl)}function jo(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,QD(n)),Zt!==null)for(n=Zt.return;n!==null;){var r=n;switch(ax(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&lf();break;case 3:Yl(),Et(tr),Et(_n),hx();break;case 5:px(r);break;case 4:Yl();break;case 13:Et(Mt);break;case 19:Et(Mt);break;case 10:cx(r.type._context);break;case 22:case 23:Cx()}n=n.return}if(gn=e,Zt=e=Ta(e.current,null),Sn=lr=t,sn=0,Dc=null,jx=Dp=No=0,Qn=dc=null,ho!==null){for(t=0;t<ho.length;t++)if(n=ho[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var l=a.next;a.next=i,r.next=l}n.pending=r}ho=null}return e}function M2(e,t){do{var n=Zt;try{if(sx(),zd.current=gf,mf){for(var r=Rt.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}mf=!1}if(Io=0,hn=on=Rt=null,cc=!1,_c=0,wx.current=null,n===null||n.return===null){sn=1,Dc=t,Zt=null;break}e:{var a=e,l=n.return,s=n,c=t;if(t=Sn,s.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,f=s,d=f.tag;if(!(f.mode&1)&&(d===0||d===11||d===15)){var p=f.alternate;p?(f.updateQueue=p.updateQueue,f.memoizedState=p.memoizedState,f.lanes=p.lanes):(f.updateQueue=null,f.memoizedState=null)}var m=uw(l);if(m!==null){m.flags&=-257,dw(m,l,s,a,t),m.mode&1&&cw(a,u,t),t=m,c=u;var g=t.updateQueue;if(g===null){var y=new Set;y.add(c),t.updateQueue=y}else g.add(c);break e}else{if(!(t&1)){cw(a,u,t),Px();break e}c=Error(pe(426))}}else if(At&&s.mode&1){var x=uw(l);if(x!==null){!(x.flags&65536)&&(x.flags|=256),dw(x,l,s,a,t),ox(Gl(c,s));break e}}a=c=Gl(c,s),sn!==4&&(sn=2),dc===null?dc=[a]:dc.push(a),a=l;do{switch(a.tag){case 3:a.flags|=65536,t&=-t,a.lanes|=t;var v=v2(a,c,t);rw(a,v);break e;case 1:s=c;var b=a.type,w=a.stateNode;if(!(a.flags&128)&&(typeof b.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Pa===null||!Pa.has(w)))){a.flags|=65536,t&=-t,a.lanes|=t;var S=y2(a,s,t);rw(a,S);break e}}a=a.return}while(a!==null)}L2(n)}catch(C){t=C,Zt===n&&n!==null&&(Zt=n=n.return);continue}break}while(!0)}function R2(){var e=vf.current;return vf.current=gf,e===null?gf:e}function Px(){(sn===0||sn===3||sn===2)&&(sn=4),gn===null||!(No&268435455)&&!(Dp&268435455)||ma(gn,Sn)}function bf(e,t){var n=tt;tt|=2;var r=R2();(gn!==e||Sn!==t)&&(Ai=null,jo(e,t));do try{jL();break}catch(i){M2(e,i)}while(!0);if(sx(),tt=n,vf.current=r,Zt!==null)throw Error(pe(261));return gn=null,Sn=0,sn}function jL(){for(;Zt!==null;)D2(Zt)}function SL(){for(;Zt!==null&&!YR();)D2(Zt)}function D2(e){var t=$2(e.alternate,e,lr);e.memoizedProps=e.pendingProps,t===null?L2(e):Zt=t,wx.current=null}function L2(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=gL(n,t),n!==null){n.flags&=32767,Zt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{sn=6,Zt=null;return}}else if(n=mL(n,t,lr),n!==null){Zt=n;return}if(t=t.sibling,t!==null){Zt=t;return}Zt=t=e}while(t!==null);sn===0&&(sn=5)}function lo(e,t,n){var r=pt,i=Ir.transition;try{Ir.transition=null,pt=1,kL(e,t,n,r)}finally{Ir.transition=i,pt=r}return null}function kL(e,t,n,r){do Ll();while(ya!==null);if(tt&6)throw Error(pe(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(pe(177));e.callbackNode=null,e.callbackPriority=0;var a=n.lanes|n.childLanes;if(iD(e,a),e===gn&&(Zt=gn=null,Sn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||id||(id=!0,B2(ef,function(){return Ll(),null})),a=(n.flags&15990)!==0,n.subtreeFlags&15990||a){a=Ir.transition,Ir.transition=null;var l=pt;pt=1;var s=tt;tt|=4,wx.current=null,yL(e,n),I2(n,e),KD(Hg),nf=!!Kg,Hg=Kg=null,e.current=n,xL(n),GR(),tt=s,pt=l,Ir.transition=a}else e.current=n;if(id&&(id=!1,ya=e,xf=i),a=e.pendingLanes,a===0&&(Pa=null),JR(n.stateNode),rr(e,qt()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(yf)throw yf=!1,e=dv,dv=null,e;return xf&1&&e.tag!==0&&Ll(),a=e.pendingLanes,a&1?e===fv?fc++:(fc=0,fv=e):fc=0,Ba(),null}function Ll(){if(ya!==null){var e=vE(xf),t=Ir.transition,n=pt;try{if(Ir.transition=null,pt=16>e?16:e,ya===null)var r=!1;else{if(e=ya,ya=null,xf=0,tt&6)throw Error(pe(331));var i=tt;for(tt|=4,Se=e.current;Se!==null;){var a=Se,l=a.child;if(Se.flags&16){var s=a.deletions;if(s!==null){for(var c=0;c<s.length;c++){var u=s[c];for(Se=u;Se!==null;){var f=Se;switch(f.tag){case 0:case 11:case 15:uc(8,f,a)}var d=f.child;if(d!==null)d.return=f,Se=d;else for(;Se!==null;){f=Se;var p=f.sibling,m=f.return;if(T2(f),f===u){Se=null;break}if(p!==null){p.return=m,Se=p;break}Se=m}}}var g=a.alternate;if(g!==null){var y=g.child;if(y!==null){g.child=null;do{var x=y.sibling;y.sibling=null,y=x}while(y!==null)}}Se=a}}if(a.subtreeFlags&2064&&l!==null)l.return=a,Se=l;else e:for(;Se!==null;){if(a=Se,a.flags&2048)switch(a.tag){case 0:case 11:case 15:uc(9,a,a.return)}var v=a.sibling;if(v!==null){v.return=a.return,Se=v;break e}Se=a.return}}var b=e.current;for(Se=b;Se!==null;){l=Se;var w=l.child;if(l.subtreeFlags&2064&&w!==null)w.return=l,Se=w;else e:for(l=b;Se!==null;){if(s=Se,s.flags&2048)try{switch(s.tag){case 0:case 11:case 15:Rp(9,s)}}catch(C){Wt(s,s.return,C)}if(s===l){Se=null;break e}var S=s.sibling;if(S!==null){S.return=s.return,Se=S;break e}Se=s.return}}if(tt=i,Ba(),mi&&typeof mi.onPostCommitFiberRoot=="function")try{mi.onPostCommitFiberRoot(Ep,e)}catch{}r=!0}return r}finally{pt=n,Ir.transition=t}}return!1}function kw(e,t,n){t=Gl(n,t),t=v2(e,t,1),e=Ca(e,t,1),t=Un(),e!==null&&(au(e,1,t),rr(e,t))}function Wt(e,t,n){if(e.tag===3)kw(e,e,n);else for(;t!==null;){if(t.tag===3){kw(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Pa===null||!Pa.has(r))){e=Gl(n,e),e=y2(t,e,1),t=Ca(t,e,1),e=Un(),t!==null&&(au(t,1,e),rr(t,e));break}}t=t.return}}function CL(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Un(),e.pingedLanes|=e.suspendedLanes&n,gn===e&&(Sn&n)===n&&(sn===4||sn===3&&(Sn&130023424)===Sn&&500>qt()-Sx?jo(e,0):jx|=n),rr(e,t)}function z2(e,t){t===0&&(e.mode&1?(t=Yu,Yu<<=1,!(Yu&130023424)&&(Yu=4194304)):t=1);var n=Un();e=Wi(e,t),e!==null&&(au(e,t,n),rr(e,n))}function PL(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),z2(e,n)}function EL(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(pe(314))}r!==null&&r.delete(t),z2(e,n)}var $2;$2=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||tr.current)Jn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Jn=!1,hL(e,t,n);Jn=!!(e.flags&131072)}else Jn=!1,At&&t.flags&1048576&&WE(t,uf,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Bd(e,t),e=t.pendingProps;var i=Hl(t,_n.current);Dl(t,n),i=gx(null,t,r,e,i,n);var a=vx();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,nr(r)?(a=!0,sf(t)):a=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,dx(t),i.updater=Mp,t.stateNode=i,i._reactInternals=t,ev(t,r,e,n),t=rv(null,t,r,!0,a,n)):(t.tag=0,At&&a&&ix(t),$n(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Bd(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=OL(r),e=$r(r,e),i){case 0:t=nv(null,t,r,e,n);break e;case 1:t=hw(null,t,r,e,n);break e;case 11:t=fw(null,t,r,e,n);break e;case 14:t=pw(null,t,r,$r(r.type,e),n);break e}throw Error(pe(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:$r(r,i),nv(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:$r(r,i),hw(e,t,r,i,n);case 3:e:{if(j2(t),e===null)throw Error(pe(387));r=t.pendingProps,a=t.memoizedState,i=a.element,GE(e,t),pf(t,r,null,n);var l=t.memoizedState;if(r=l.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:l.cache,pendingSuspenseBoundaries:l.pendingSuspenseBoundaries,transitions:l.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){i=Gl(Error(pe(423)),t),t=mw(e,t,r,n,i);break e}else if(r!==i){i=Gl(Error(pe(424)),t),t=mw(e,t,r,n,i);break e}else for(cr=ka(t.stateNode.containerInfo.firstChild),fr=t,At=!0,Ur=null,n=qE(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Vl(),r===i){t=Ki(e,t,n);break e}$n(e,t,r,n)}t=t.child}return t;case 5:return XE(t),e===null&&Qg(t),r=t.type,i=t.pendingProps,a=e!==null?e.memoizedProps:null,l=i.children,Vg(r,i)?l=null:a!==null&&Vg(r,a)&&(t.flags|=32),w2(e,t),$n(e,t,l,n),t.child;case 6:return e===null&&Qg(t),null;case 13:return S2(e,t,n);case 4:return fx(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ql(t,null,r,n):$n(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:$r(r,i),fw(e,t,r,i,n);case 7:return $n(e,t,t.pendingProps,n),t.child;case 8:return $n(e,t,t.pendingProps.children,n),t.child;case 12:return $n(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,a=t.memoizedProps,l=i.value,wt(df,r._currentValue),r._currentValue=l,a!==null)if(Yr(a.value,l)){if(a.children===i.children&&!tr.current){t=Ki(e,t,n);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var s=a.dependencies;if(s!==null){l=a.child;for(var c=s.firstContext;c!==null;){if(c.context===r){if(a.tag===1){c=zi(-1,n&-n),c.tag=2;var u=a.updateQueue;if(u!==null){u=u.shared;var f=u.pending;f===null?c.next=c:(c.next=f.next,f.next=c),u.pending=c}}a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Jg(a.return,n,t),s.lanes|=n;break}c=c.next}}else if(a.tag===10)l=a.type===t.type?null:a.child;else if(a.tag===18){if(l=a.return,l===null)throw Error(pe(341));l.lanes|=n,s=l.alternate,s!==null&&(s.lanes|=n),Jg(l,n,t),l=a.sibling}else l=a.child;if(l!==null)l.return=a;else for(l=a;l!==null;){if(l===t){l=null;break}if(a=l.sibling,a!==null){a.return=l.return,l=a;break}l=l.return}a=l}$n(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Dl(t,n),i=Nr(i),r=r(i),t.flags|=1,$n(e,t,r,n),t.child;case 14:return r=t.type,i=$r(r,t.pendingProps),i=$r(r.type,i),pw(e,t,r,i,n);case 15:return x2(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:$r(r,i),Bd(e,t),t.tag=1,nr(r)?(e=!0,sf(t)):e=!1,Dl(t,n),g2(t,r,i),ev(t,r,i,n),rv(null,t,r,!0,e,n);case 19:return k2(e,t,n);case 22:return b2(e,t,n)}throw Error(pe(156,t.tag))};function B2(e,t){return pE(e,t)}function TL(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Tr(e,t,n,r){return new TL(e,t,n,r)}function Ex(e){return e=e.prototype,!(!e||!e.isReactComponent)}function OL(e){if(typeof e=="function")return Ex(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Vy)return 11;if(e===qy)return 14}return 2}function Ta(e,t){var n=e.alternate;return n===null?(n=Tr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Wd(e,t,n,r,i,a){var l=2;if(r=e,typeof e=="function")Ex(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case ml:return So(n.children,i,a,t);case Hy:l=8,i|=8;break;case kg:return e=Tr(12,n,t,i|2),e.elementType=kg,e.lanes=a,e;case Cg:return e=Tr(13,n,t,i),e.elementType=Cg,e.lanes=a,e;case Pg:return e=Tr(19,n,t,i),e.elementType=Pg,e.lanes=a,e;case XP:return Lp(n,i,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case YP:l=10;break e;case GP:l=9;break e;case Vy:l=11;break e;case qy:l=14;break e;case ua:l=16,r=null;break e}throw Error(pe(130,e==null?e:typeof e,""))}return t=Tr(l,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function So(e,t,n,r){return e=Tr(7,e,r,t),e.lanes=n,e}function Lp(e,t,n,r){return e=Tr(22,e,r,t),e.elementType=XP,e.lanes=n,e.stateNode={isHidden:!1},e}function Am(e,t,n){return e=Tr(6,e,null,t),e.lanes=n,e}function Im(e,t,n){return t=Tr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function AL(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=dm(0),this.expirationTimes=dm(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dm(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Tx(e,t,n,r,i,a,l,s,c){return e=new AL(e,t,n,s,c),t===1?(t=1,a===!0&&(t|=8)):t=0,a=Tr(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},dx(a),e}function IL(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:hl,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function F2(e){if(!e)return _a;e=e._reactInternals;e:{if(Ko(e)!==e||e.tag!==1)throw Error(pe(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(nr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(pe(171))}if(e.tag===1){var n=e.type;if(nr(n))return FE(e,n,t)}return t}function U2(e,t,n,r,i,a,l,s,c){return e=Tx(n,r,!0,e,i,a,l,s,c),e.context=F2(null),n=e.current,r=Un(),i=Ea(n),a=zi(r,i),a.callback=t??null,Ca(n,a,i),e.current.lanes=i,au(e,i,r),rr(e,r),e}function zp(e,t,n,r){var i=t.current,a=Un(),l=Ea(i);return n=F2(n),t.context===null?t.context=n:t.pendingContext=n,t=zi(a,l),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Ca(i,t,l),e!==null&&(qr(e,i,l,a),Ld(e,i,l)),l}function wf(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Cw(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Ox(e,t){Cw(e,t),(e=e.alternate)&&Cw(e,t)}function NL(){return null}var W2=typeof reportError=="function"?reportError:function(e){console.error(e)};function Ax(e){this._internalRoot=e}$p.prototype.render=Ax.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(pe(409));zp(e,t,null,null)};$p.prototype.unmount=Ax.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;_o(function(){zp(null,e,null,null)}),t[Ui]=null}};function $p(e){this._internalRoot=e}$p.prototype.unstable_scheduleHydration=function(e){if(e){var t=bE();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ha.length&&t!==0&&t<ha[n].priority;n++);ha.splice(n,0,e),n===0&&jE(e)}};function Ix(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Bp(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Pw(){}function _L(e,t,n,r,i){if(i){if(typeof r=="function"){var a=r;r=function(){var u=wf(l);a.call(u)}}var l=U2(t,r,e,0,null,!1,!1,"",Pw);return e._reactRootContainer=l,e[Ui]=l.current,Tc(e.nodeType===8?e.parentNode:e),_o(),l}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var s=r;r=function(){var u=wf(c);s.call(u)}}var c=Tx(e,0,!1,null,null,!1,!1,"",Pw);return e._reactRootContainer=c,e[Ui]=c.current,Tc(e.nodeType===8?e.parentNode:e),_o(function(){zp(t,c,n,r)}),c}function Fp(e,t,n,r,i){var a=n._reactRootContainer;if(a){var l=a;if(typeof i=="function"){var s=i;i=function(){var c=wf(l);s.call(c)}}zp(t,l,e,i)}else l=_L(n,t,e,i,r);return wf(l)}yE=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Js(t.pendingLanes);n!==0&&(Xy(t,n|1),rr(t,qt()),!(tt&6)&&(Xl=qt()+500,Ba()))}break;case 13:_o(function(){var r=Wi(e,1);if(r!==null){var i=Un();qr(r,e,1,i)}}),Ox(e,1)}};Qy=function(e){if(e.tag===13){var t=Wi(e,134217728);if(t!==null){var n=Un();qr(t,e,134217728,n)}Ox(e,134217728)}};xE=function(e){if(e.tag===13){var t=Ea(e),n=Wi(e,t);if(n!==null){var r=Un();qr(n,e,t,r)}Ox(e,t)}};bE=function(){return pt};wE=function(e,t){var n=pt;try{return pt=e,t()}finally{pt=n}};Dg=function(e,t,n){switch(t){case"input":if(Og(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=Ip(r);if(!i)throw Error(pe(90));JP(r),Og(r,i)}}}break;case"textarea":eE(e,n);break;case"select":t=n.value,t!=null&&Nl(e,!!n.multiple,t,!1)}};lE=kx;sE=_o;var ML={usingClientEntryPoint:!1,Events:[lu,xl,Ip,aE,oE,kx]},Ds={findFiberByHostInstance:po,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},RL={bundleType:Ds.bundleType,version:Ds.version,rendererPackageName:Ds.rendererPackageName,rendererConfig:Ds.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Gi.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=dE(e),e===null?null:e.stateNode},findFiberByHostInstance:Ds.findFiberByHostInstance||NL,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 ad=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ad.isDisabled&&ad.supportsFiber)try{Ep=ad.inject(RL),mi=ad}catch{}}vr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ML;vr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ix(t))throw Error(pe(200));return IL(e,t,null,n)};vr.createRoot=function(e,t){if(!Ix(e))throw Error(pe(299));var n=!1,r="",i=W2;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=Tx(e,1,!1,null,null,n,!1,r,i),e[Ui]=t.current,Tc(e.nodeType===8?e.parentNode:e),new Ax(t)};vr.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(pe(188)):(e=Object.keys(e).join(","),Error(pe(268,e)));return e=dE(t),e=e===null?null:e.stateNode,e};vr.flushSync=function(e){return _o(e)};vr.hydrate=function(e,t,n){if(!Bp(t))throw Error(pe(200));return Fp(null,e,t,!0,n)};vr.hydrateRoot=function(e,t,n){if(!Ix(e))throw Error(pe(405));var r=n!=null&&n.hydratedSources||null,i=!1,a="",l=W2;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onRecoverableError!==void 0&&(l=n.onRecoverableError)),t=U2(t,null,e,1,n??null,i,!1,a,l),e[Ui]=t.current,Tc(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new $p(t)};vr.render=function(e,t,n){if(!Bp(t))throw Error(pe(200));return Fp(null,e,t,!1,n)};vr.unmountComponentAtNode=function(e){if(!Bp(e))throw Error(pe(40));return e._reactRootContainer?(_o(function(){Fp(null,null,e,!1,function(){e._reactRootContainer=null,e[Ui]=null})}),!0):!1};vr.unstable_batchedUpdates=kx;vr.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Bp(n))throw Error(pe(200));if(e==null||e._reactInternals===void 0)throw Error(pe(38));return Fp(e,t,n,!1,r)};vr.version="18.3.1-next-f1338f8080-20240426";function K2(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(K2)}catch(e){console.error(e)}}K2(),KP.exports=vr;var Up=KP.exports,Ew=Up;jg.createRoot=Ew.createRoot,jg.hydrateRoot=Ew.hydrateRoot;/**
41
+ * @remix-run/router v1.23.3
42
+ *
43
+ * Copyright (c) Remix Software Inc.
44
+ *
45
+ * This source code is licensed under the MIT license found in the
46
+ * LICENSE.md file in the root directory of this source tree.
47
+ *
48
+ * @license MIT
49
+ */function Lc(){return Lc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Lc.apply(null,arguments)}var xa;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(xa||(xa={}));const Tw="popstate";function DL(e){e===void 0&&(e={});function t(i,a){let{pathname:l="/",search:s="",hash:c=""}=Ho(i.location.hash.substr(1));return!l.startsWith("/")&&!l.startsWith(".")&&(l="/"+l),mv("",{pathname:l,search:s,hash:c},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function n(i,a){let l=i.document.querySelector("base"),s="";if(l&&l.getAttribute("href")){let c=i.location.href,u=c.indexOf("#");s=u===-1?c:c.slice(0,u)}return s+"#"+(typeof a=="string"?a:jf(a))}function r(i,a){Wp(i.pathname.charAt(0)==="/","relative pathnames are not supported in hash history.push("+JSON.stringify(a)+")")}return zL(t,n,r,e)}function Dt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Wp(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function LL(){return Math.random().toString(36).substr(2,8)}function Ow(e,t){return{usr:e.state,key:e.key,idx:t}}function mv(e,t,n,r){return n===void 0&&(n=null),Lc({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Ho(t):t,{state:n,key:t&&t.key||r||LL()})}function jf(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Ho(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function zL(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:a=!1}=r,l=i.history,s=xa.Pop,c=null,u=f();u==null&&(u=0,l.replaceState(Lc({},l.state,{idx:u}),""));function f(){return(l.state||{idx:null}).idx}function d(){s=xa.Pop;let x=f(),v=x==null?null:x-u;u=x,c&&c({action:s,location:y.location,delta:v})}function p(x,v){s=xa.Push;let b=mv(y.location,x,v);n&&n(b,x),u=f()+1;let w=Ow(b,u),S=y.createHref(b);try{l.pushState(w,"",S)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;i.location.assign(S)}a&&c&&c({action:s,location:y.location,delta:1})}function m(x,v){s=xa.Replace;let b=mv(y.location,x,v);n&&n(b,x),u=f();let w=Ow(b,u),S=y.createHref(b);l.replaceState(w,"",S),a&&c&&c({action:s,location:y.location,delta:0})}function g(x){let v=i.location.origin!=="null"?i.location.origin:i.location.href,b=typeof x=="string"?x:jf(x);return b=b.replace(/ $/,"%20"),Dt(v,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,v)}let y={get action(){return s},get location(){return e(i,l)},listen(x){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(Tw,d),c=x,()=>{i.removeEventListener(Tw,d),c=null}},createHref(x){return t(i,x)},createURL:g,encodeLocation(x){let v=g(x);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:p,replace:m,go(x){return l.go(x)}};return y}var Aw;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Aw||(Aw={}));function $L(e,t,n){return n===void 0&&(n="/"),BL(e,t,n)}function BL(e,t,n,r){let i=typeof t=="string"?Ho(t):t,a=Ql(i.pathname||"/",n);if(a==null)return null;let l=H2(e);FL(l);let s=null,c=JL(a);for(let u=0;s==null&&u<l.length;++u)s=XL(l[u],c);return s}function H2(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");let i=(a,l,s)=>{let c={relativePath:s===void 0?a.path||"":s,caseSensitive:a.caseSensitive===!0,childrenIndex:l,route:a};c.relativePath.startsWith("/")&&(Dt(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=Oa([r,c.relativePath]),f=n.concat(c);a.children&&a.children.length>0&&(Dt(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),H2(a.children,t,f,u)),!(a.path==null&&!a.index)&&t.push({path:u,score:YL(u,a.index),routesMeta:f})};return e.forEach((a,l)=>{var s;if(a.path===""||!((s=a.path)!=null&&s.includes("?")))i(a,l);else for(let c of V2(a.path))i(a,l,c)}),t}function V2(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return i?[a,""]:[a];let l=V2(r.join("/")),s=[];return s.push(...l.map(c=>c===""?a:[a,c].join("/"))),i&&s.push(...l),s.map(c=>e.startsWith("/")&&c===""?"/":c)}function FL(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:GL(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const UL=/^:[\w-]+$/,WL=3,KL=2,HL=1,VL=10,qL=-2,Iw=e=>e==="*";function YL(e,t){let n=e.split("/"),r=n.length;return n.some(Iw)&&(r+=qL),t&&(r+=KL),n.filter(i=>!Iw(i)).reduce((i,a)=>i+(UL.test(a)?WL:a===""?HL:VL),r)}function GL(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function XL(e,t,n){let{routesMeta:r}=e,i={},a="/",l=[];for(let s=0;s<r.length;++s){let c=r[s],u=s===r.length-1,f=a==="/"?t:t.slice(a.length)||"/",d=gv({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},f),p=c.route;if(!d)return null;Object.assign(i,d.params),l.push({params:i,pathname:Oa([a,d.pathname]),pathnameBase:rz(Oa([a,d.pathnameBase])),route:p}),d.pathnameBase!=="/"&&(a=Oa([a,d.pathnameBase]))}return l}function gv(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=QL(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],l=a.replace(/(.)\/+$/,"$1"),s=i.slice(1);return{params:r.reduce((u,f,d)=>{let{paramName:p,isOptional:m}=f;if(p==="*"){let y=s[d]||"";l=a.slice(0,a.length-y.length).replace(/(.)\/+$/,"$1")}const g=s[d];return m&&!g?u[p]=void 0:u[p]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:a,pathnameBase:l,pattern:e}}function QL(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Wp(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,s,c)=>(r.push({paramName:s,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function JL(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Wp(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Ql(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const ZL=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ez=e=>ZL.test(e);function tz(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?Ho(e):e,a;if(n)if(ez(n))a=n;else{if(n.includes("//")){let l=n;n=q2(n),Wp(!1,"Pathnames cannot have embedded double slashes - normalizing "+(l+" -> "+n))}n.startsWith("/")?a=Nw(n.substring(1),"/"):a=Nw(n,t)}else a=t;return{pathname:a,search:iz(r),hash:az(i)}}function Nw(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Nm(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function nz(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Nx(e,t){let n=nz(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function _x(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=Ho(e):(i=Lc({},e),Dt(!i.pathname||!i.pathname.includes("?"),Nm("?","pathname","search",i)),Dt(!i.pathname||!i.pathname.includes("#"),Nm("#","pathname","hash",i)),Dt(!i.search||!i.search.includes("#"),Nm("#","search","hash",i)));let a=e===""||i.pathname==="",l=a?"/":i.pathname,s;if(l==null)s=n;else{let d=t.length-1;if(!r&&l.startsWith("..")){let p=l.split("/");for(;p[0]==="..";)p.shift(),d-=1;i.pathname=p.join("/")}s=d>=0?t[d]:"/"}let c=tz(i,s),u=l&&l!=="/"&&l.endsWith("/"),f=(a||l===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||f)&&(c.pathname+="/"),c}const q2=e=>e.replace(/\/\/+/g,"/"),Oa=e=>q2(e.join("/")),rz=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),iz=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,az=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function oz(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Y2=["post","put","patch","delete"];new Set(Y2);const lz=["get",...Y2];new Set(lz);/**
50
+ * React Router v6.30.4
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */function zc(){return zc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zc.apply(null,arguments)}const Kp=h.createContext(null),G2=h.createContext(null),Xi=h.createContext(null),Hp=h.createContext(null),Qi=h.createContext({outlet:null,matches:[],isDataRoute:!1}),X2=h.createContext(null);function sz(e,t){let{relative:n}=t===void 0?{}:t;fs()||Dt(!1);let{basename:r,navigator:i}=h.useContext(Xi),{hash:a,pathname:l,search:s}=qp(e,{relative:n}),c=l;return r!=="/"&&(c=l==="/"?r:Oa([r,l])),i.createHref({pathname:c,search:s,hash:a})}function fs(){return h.useContext(Hp)!=null}function ps(){return fs()||Dt(!1),h.useContext(Hp).location}function Q2(e){h.useContext(Xi).static||h.useLayoutEffect(e)}function Vp(){let{isDataRoute:e}=h.useContext(Qi);return e?jz():cz()}function cz(){fs()||Dt(!1);let e=h.useContext(Kp),{basename:t,future:n,navigator:r}=h.useContext(Xi),{matches:i}=h.useContext(Qi),{pathname:a}=ps(),l=JSON.stringify(Nx(i,n.v7_relativeSplatPath)),s=h.useRef(!1);return Q2(()=>{s.current=!0}),h.useCallback(function(u,f){if(f===void 0&&(f={}),!s.current)return;if(typeof u=="number"){r.go(u);return}let d=_x(u,JSON.parse(l),a,f.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:Oa([t,d.pathname])),(f.replace?r.replace:r.push)(d,f.state,f)},[t,r,l,a,e])}function uz(){let{matches:e}=h.useContext(Qi),t=e[e.length-1];return t?t.params:{}}function qp(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=h.useContext(Xi),{matches:i}=h.useContext(Qi),{pathname:a}=ps(),l=JSON.stringify(Nx(i,r.v7_relativeSplatPath));return h.useMemo(()=>_x(e,JSON.parse(l),a,n==="path"),[e,l,a,n])}function dz(e,t){return fz(e,t)}function fz(e,t,n,r){fs()||Dt(!1);let{navigator:i}=h.useContext(Xi),{matches:a}=h.useContext(Qi),l=a[a.length-1],s=l?l.params:{};l&&l.pathname;let c=l?l.pathnameBase:"/";l&&l.route;let u=ps(),f;if(t){var d;let x=typeof t=="string"?Ho(t):t;c==="/"||(d=x.pathname)!=null&&d.startsWith(c)||Dt(!1),f=x}else f=u;let p=f.pathname||"/",m=p;if(c!=="/"){let x=c.replace(/^\//,"").split("/");m="/"+p.replace(/^\//,"").split("/").slice(x.length).join("/")}let g=$L(e,{pathname:m}),y=vz(g&&g.map(x=>Object.assign({},x,{params:Object.assign({},s,x.params),pathname:Oa([c,i.encodeLocation?i.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?c:Oa([c,i.encodeLocation?i.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),a,n,r);return t&&y?h.createElement(Hp.Provider,{value:{location:zc({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:xa.Pop}},y):y}function pz(){let e=wz(),t=oz(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},t),n?h.createElement("pre",{style:i},n):null,null)}const hz=h.createElement(pz,null);class mz extends h.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?h.createElement(Qi.Provider,{value:this.props.routeContext},h.createElement(X2.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function gz(e){let{routeContext:t,match:n,children:r}=e,i=h.useContext(Kp);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),h.createElement(Qi.Provider,{value:t},r)}function vz(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var a;if(!n)return null;if(n.errors)e=n.matches;else if((a=r)!=null&&a.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let l=e,s=(i=n)==null?void 0:i.errors;if(s!=null){let f=l.findIndex(d=>d.route.id&&(s==null?void 0:s[d.route.id])!==void 0);f>=0||Dt(!1),l=l.slice(0,Math.min(l.length,f+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let f=0;f<l.length;f++){let d=l[f];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(u=f),d.route.id){let{loaderData:p,errors:m}=n,g=d.route.loader&&p[d.route.id]===void 0&&(!m||m[d.route.id]===void 0);if(d.route.lazy||g){c=!0,u>=0?l=l.slice(0,u+1):l=[l[0]];break}}}return l.reduceRight((f,d,p)=>{let m,g=!1,y=null,x=null;n&&(m=s&&d.route.id?s[d.route.id]:void 0,y=d.route.errorElement||hz,c&&(u<0&&p===0?(Sz("route-fallback"),g=!0,x=null):u===p&&(g=!0,x=d.route.hydrateFallbackElement||null)));let v=t.concat(l.slice(0,p+1)),b=()=>{let w;return m?w=y:g?w=x:d.route.Component?w=h.createElement(d.route.Component,null):d.route.element?w=d.route.element:w=f,h.createElement(gz,{match:d,routeContext:{outlet:f,matches:v,isDataRoute:n!=null},children:w})};return n&&(d.route.ErrorBoundary||d.route.errorElement||p===0)?h.createElement(mz,{location:n.location,revalidation:n.revalidation,component:y,error:m,children:b(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):b()},null)}var J2=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(J2||{}),Z2=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Z2||{});function yz(e){let t=h.useContext(Kp);return t||Dt(!1),t}function xz(e){let t=h.useContext(G2);return t||Dt(!1),t}function bz(e){let t=h.useContext(Qi);return t||Dt(!1),t}function eT(e){let t=bz(),n=t.matches[t.matches.length-1];return n.route.id||Dt(!1),n.route.id}function wz(){var e;let t=h.useContext(X2),n=xz(),r=eT();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function jz(){let{router:e}=yz(J2.UseNavigateStable),t=eT(Z2.UseNavigateStable),n=h.useRef(!1);return Q2(()=>{n.current=!0}),h.useCallback(function(i,a){a===void 0&&(a={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,zc({fromRouteId:t},a)))},[e,t])}const _w={};function Sz(e,t,n){_w[e]||(_w[e]=!0)}function kz(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function od(e){let{to:t,replace:n,state:r,relative:i}=e;fs()||Dt(!1);let{future:a,static:l}=h.useContext(Xi),{matches:s}=h.useContext(Qi),{pathname:c}=ps(),u=Vp(),f=_x(t,Nx(s,a.v7_relativeSplatPath),c,i==="path"),d=JSON.stringify(f);return h.useEffect(()=>u(JSON.parse(d),{replace:n,state:r,relative:i}),[u,d,i,n,r]),null}function Gn(e){Dt(!1)}function Cz(e){let{basename:t="/",children:n=null,location:r,navigationType:i=xa.Pop,navigator:a,static:l=!1,future:s}=e;fs()&&Dt(!1);let c=t.replace(/^\/*/,"/"),u=h.useMemo(()=>({basename:c,navigator:a,static:l,future:zc({v7_relativeSplatPath:!1},s)}),[c,s,a,l]);typeof r=="string"&&(r=Ho(r));let{pathname:f="/",search:d="",hash:p="",state:m=null,key:g="default"}=r,y=h.useMemo(()=>{let x=Ql(f,c);return x==null?null:{location:{pathname:x,search:d,hash:p,state:m,key:g},navigationType:i}},[c,f,d,p,m,g,i]);return y==null?null:h.createElement(Xi.Provider,{value:u},h.createElement(Hp.Provider,{children:n,value:y}))}function Pz(e){let{children:t,location:n}=e;return dz(vv(t),n)}new Promise(()=>{});function vv(e,t){t===void 0&&(t=[]);let n=[];return h.Children.forEach(e,(r,i)=>{if(!h.isValidElement(r))return;let a=[...t,i];if(r.type===h.Fragment){n.push.apply(n,vv(r.props.children,a));return}r.type!==Gn&&Dt(!1),!r.props.index||!r.props.children||Dt(!1);let l={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(l.children=vv(r.props.children,a)),n.push(l)}),n}/**
59
+ * React Router DOM v6.30.4
60
+ *
61
+ * Copyright (c) Remix Software Inc.
62
+ *
63
+ * This source code is licensed under the MIT license found in the
64
+ * LICENSE.md file in the root directory of this source tree.
65
+ *
66
+ * @license MIT
67
+ */function Sf(){return Sf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Sf.apply(null,arguments)}function tT(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Ez(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Tz(e,t){return e.button===0&&(!t||t==="_self")&&!Ez(e)}const Oz=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Az=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],Iz="6";try{window.__reactRouterVersion=Iz}catch{}const Nz=h.createContext({isTransitioning:!1}),_z="startTransition",Mw=UP[_z];function Mz(e){let{basename:t,children:n,future:r,window:i}=e,a=h.useRef();a.current==null&&(a.current=DL({window:i,v5Compat:!0}));let l=a.current,[s,c]=h.useState({action:l.action,location:l.location}),{v7_startTransition:u}=r||{},f=h.useCallback(d=>{u&&Mw?Mw(()=>c(d)):c(d)},[c,u]);return h.useLayoutEffect(()=>l.listen(f),[l,f]),h.useEffect(()=>kz(r),[r]),h.createElement(Cz,{basename:t,children:n,location:s.location,navigationType:s.action,navigator:l,future:r})}const Rz=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Dz=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Lz=h.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:a,replace:l,state:s,target:c,to:u,preventScrollReset:f,viewTransition:d}=t,p=tT(t,Oz),{basename:m}=h.useContext(Xi),g,y=!1;if(typeof u=="string"&&Dz.test(u)&&(g=u,Rz))try{let w=new URL(window.location.href),S=u.startsWith("//")?new URL(w.protocol+u):new URL(u),C=Ql(S.pathname,m);S.origin===w.origin&&C!=null?u=C+S.search+S.hash:y=!0}catch{}let x=sz(u,{relative:i}),v=$z(u,{replace:l,state:s,target:c,preventScrollReset:f,relative:i,viewTransition:d});function b(w){r&&r(w),w.defaultPrevented||v(w)}return h.createElement("a",Sf({},p,{href:g||x,onClick:y||a?r:b,ref:n,target:c}))}),ri=h.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:i=!1,className:a="",end:l=!1,style:s,to:c,viewTransition:u,children:f}=t,d=tT(t,Az),p=qp(c,{relative:d.relative}),m=ps(),g=h.useContext(G2),{navigator:y,basename:x}=h.useContext(Xi),v=g!=null&&Bz(p)&&u===!0,b=y.encodeLocation?y.encodeLocation(p).pathname:p.pathname,w=m.pathname,S=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;i||(w=w.toLowerCase(),S=S?S.toLowerCase():null,b=b.toLowerCase()),S&&x&&(S=Ql(S,x)||S);const C=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let j=w===b||!l&&w.startsWith(b)&&w.charAt(C)==="/",E=S!=null&&(S===b||!l&&S.startsWith(b)&&S.charAt(b.length)==="/"),O={isActive:j,isPending:E,isTransitioning:v},R=j?r:void 0,A;typeof a=="function"?A=a(O):A=[a,j?"active":null,E?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let N=typeof s=="function"?s(O):s;return h.createElement(Lz,Sf({},d,{"aria-current":R,className:A,ref:n,style:N,to:c,viewTransition:u}),typeof f=="function"?f(O):f)});var yv;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(yv||(yv={}));var Rw;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Rw||(Rw={}));function zz(e){let t=h.useContext(Kp);return t||Dt(!1),t}function $z(e,t){let{target:n,replace:r,state:i,preventScrollReset:a,relative:l,viewTransition:s}=t===void 0?{}:t,c=Vp(),u=ps(),f=qp(e,{relative:l});return h.useCallback(d=>{if(Tz(d,n)){d.preventDefault();let p=r!==void 0?r:jf(u)===jf(f);c(e,{replace:p,state:i,preventScrollReset:a,relative:l,viewTransition:s})}},[u,c,f,r,i,n,e,a,l,s])}function Bz(e,t){t===void 0&&(t={});let n=h.useContext(Nz);n==null&&Dt(!1);let{basename:r}=zz(yv.useViewTransitionState),i=qp(e,{relative:t.relative});if(!n.isTransitioning)return!1;let a=Ql(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=Ql(n.nextLocation.pathname,r)||n.nextLocation.pathname;return gv(i.pathname,l)!=null||gv(i.pathname,a)!=null}function Fz(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Uz=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Wz=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Kz={};function Dw(e,t){return(Kz.jsx?Wz:Uz).test(e)}const Hz=/[ \t\n\f\r]/g;function Vz(e){return typeof e=="object"?e.type==="text"?Lw(e.value):!1:Lw(e)}function Lw(e){return e.replace(Hz,"")===""}class cu{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}cu.prototype.normal={};cu.prototype.property={};cu.prototype.space=void 0;function nT(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new cu(n,r,t)}function xv(e){return e.toLowerCase()}class ar{constructor(t,n){this.attribute=n,this.property=t}}ar.prototype.attribute="";ar.prototype.booleanish=!1;ar.prototype.boolean=!1;ar.prototype.commaOrSpaceSeparated=!1;ar.prototype.commaSeparated=!1;ar.prototype.defined=!1;ar.prototype.mustUseProperty=!1;ar.prototype.number=!1;ar.prototype.overloadedBoolean=!1;ar.prototype.property="";ar.prototype.spaceSeparated=!1;ar.prototype.space=void 0;let qz=0;const $e=Vo(),Jt=Vo(),bv=Vo(),he=Vo(),vt=Vo(),ko=Vo(),or=Vo();function Vo(){return 2**++qz}const wv=Object.freeze(Object.defineProperty({__proto__:null,boolean:$e,booleanish:Jt,commaOrSpaceSeparated:or,commaSeparated:ko,number:he,overloadedBoolean:bv,spaceSeparated:vt},Symbol.toStringTag,{value:"Module"})),_m=Object.keys(wv);class Mx extends ar{constructor(t,n,r,i){let a=-1;if(super(t,n),zw(this,"space",i),typeof r=="number")for(;++a<_m.length;){const l=_m[a];zw(this,_m[a],(r&wv[l])===wv[l])}}}Mx.prototype.defined=!0;function zw(e,t,n){n&&(e[t]=n)}function hs(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const a=new Mx(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[xv(r)]=r,n[xv(a.attribute)]=r}return new cu(t,n,e.space)}const rT=hs({properties:{ariaActiveDescendant:null,ariaAtomic:Jt,ariaAutoComplete:null,ariaBusy:Jt,ariaChecked:Jt,ariaColCount:he,ariaColIndex:he,ariaColSpan:he,ariaControls:vt,ariaCurrent:null,ariaDescribedBy:vt,ariaDetails:null,ariaDisabled:Jt,ariaDropEffect:vt,ariaErrorMessage:null,ariaExpanded:Jt,ariaFlowTo:vt,ariaGrabbed:Jt,ariaHasPopup:null,ariaHidden:Jt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:vt,ariaLevel:he,ariaLive:null,ariaModal:Jt,ariaMultiLine:Jt,ariaMultiSelectable:Jt,ariaOrientation:null,ariaOwns:vt,ariaPlaceholder:null,ariaPosInSet:he,ariaPressed:Jt,ariaReadOnly:Jt,ariaRelevant:null,ariaRequired:Jt,ariaRoleDescription:vt,ariaRowCount:he,ariaRowIndex:he,ariaRowSpan:he,ariaSelected:Jt,ariaSetSize:he,ariaSort:null,ariaValueMax:he,ariaValueMin:he,ariaValueNow:he,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function iT(e,t){return t in e?e[t]:t}function aT(e,t){return iT(e,t.toLowerCase())}const Yz=hs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ko,acceptCharset:vt,accessKey:vt,action:null,allow:null,allowFullScreen:$e,allowPaymentRequest:$e,allowUserMedia:$e,alpha:$e,alt:null,as:null,async:$e,autoCapitalize:null,autoComplete:vt,autoFocus:$e,autoPlay:$e,blocking:vt,capture:null,charSet:null,checked:$e,cite:null,className:vt,closedBy:null,colorSpace:null,cols:he,colSpan:he,command:null,commandFor:null,content:null,contentEditable:Jt,controls:$e,controlsList:vt,coords:he|ko,crossOrigin:null,data:null,dateTime:null,decoding:null,default:$e,defer:$e,dir:null,dirName:null,disabled:$e,download:bv,draggable:Jt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:$e,formTarget:null,headers:vt,height:he,hidden:bv,high:he,href:null,hrefLang:null,htmlFor:vt,httpEquiv:vt,id:null,imageSizes:null,imageSrcSet:null,inert:$e,inputMode:null,integrity:null,is:null,isMap:$e,itemId:null,itemProp:vt,itemRef:vt,itemScope:$e,itemType:vt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:$e,low:he,manifest:null,max:null,maxLength:he,media:null,method:null,min:null,minLength:he,multiple:$e,muted:$e,name:null,nonce:null,noModule:$e,noValidate:$e,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:$e,optimum:he,pattern:null,ping:vt,placeholder:null,playsInline:$e,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:$e,referrerPolicy:null,rel:vt,required:$e,reversed:$e,rows:he,rowSpan:he,sandbox:vt,scope:null,scoped:$e,seamless:$e,selected:$e,shadowRootClonable:$e,shadowRootCustomElementRegistry:$e,shadowRootDelegatesFocus:$e,shadowRootMode:null,shadowRootSerializable:$e,shape:null,size:he,sizes:null,slot:null,span:he,spellCheck:Jt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:he,step:null,style:null,tabIndex:he,target:null,title:null,translate:null,type:null,typeMustMatch:$e,useMap:null,value:Jt,width:he,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:vt,axis:null,background:null,bgColor:null,border:he,borderColor:null,bottomMargin:he,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:$e,declare:$e,event:null,face:null,frame:null,frameBorder:null,hSpace:he,leftMargin:he,link:null,longDesc:null,lowSrc:null,marginHeight:he,marginWidth:he,noResize:$e,noHref:$e,noShade:$e,noWrap:$e,object:null,profile:null,prompt:null,rev:null,rightMargin:he,rules:null,scheme:null,scrolling:Jt,standby:null,summary:null,text:null,topMargin:he,valueType:null,version:null,vAlign:null,vLink:null,vSpace:he,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:$e,disablePictureInPicture:$e,disableRemotePlayback:$e,exportParts:ko,part:vt,prefix:null,property:null,results:he,security:null,unselectable:null},space:"html",transform:aT}),Gz=hs({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:or,accentHeight:he,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:he,amplitude:he,arabicForm:null,ascent:he,attributeName:null,attributeType:null,azimuth:he,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:he,by:null,calcMode:null,capHeight:he,className:vt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:he,diffuseConstant:he,direction:null,display:null,dur:null,divisor:he,dominantBaseline:null,download:$e,dx:null,dy:null,edgeMode:null,editable:null,elevation:he,enableBackground:null,end:null,event:null,exponent:he,externalResourcesRequired:null,fill:null,fillOpacity:he,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ko,g2:ko,glyphName:ko,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:he,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:he,horizOriginX:he,horizOriginY:he,id:null,ideographic:he,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:he,k:he,k1:he,k2:he,k3:he,k4:he,kernelMatrix:or,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:he,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:he,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:he,overlineThickness:he,paintOrder:null,panose1:null,path:null,pathLength:he,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:vt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:he,pointsAtY:he,pointsAtZ:he,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:or,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:or,rev:or,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:or,requiredFeatures:or,requiredFonts:or,requiredFormats:or,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:he,specularExponent:he,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:he,strikethroughThickness:he,string:null,stroke:null,strokeDashArray:or,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:he,strokeOpacity:he,strokeWidth:null,style:null,surfaceScale:he,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:or,tabIndex:he,tableValues:null,target:null,targetX:he,targetY:he,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:or,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:he,underlineThickness:he,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:he,values:null,vAlphabetic:he,vMathematical:he,vectorEffect:null,vHanging:he,vIdeographic:he,version:null,vertAdvY:he,vertOriginX:he,vertOriginY:he,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:he,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:iT}),oT=hs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),lT=hs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:aT}),sT=hs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Xz={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Qz=/[A-Z]/g,$w=/-[a-z]/g,Jz=/^data[-\w.:]+$/i;function Zz(e,t){const n=xv(t);let r=t,i=ar;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Jz.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace($w,t4);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!$w.test(a)){let l=a.replace(Qz,e4);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=Mx}return new i(r,t)}function e4(e){return"-"+e.toLowerCase()}function t4(e){return e.charAt(1).toUpperCase()}const n4=nT([rT,Yz,oT,lT,sT],"html"),Rx=nT([rT,Gz,oT,lT,sT],"svg");function r4(e){return e.join(" ").trim()}var Dx={},Bw=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i4=/\n/g,a4=/^\s*/,o4=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l4=/^:\s*/,s4=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c4=/^[;\s]*/,u4=/^\s+|\s+$/g,d4=`
68
+ `,Fw="/",Uw="*",fo="",f4="comment",p4="declaration";function h4(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(g){var y=g.match(i4);y&&(n+=y.length);var x=g.lastIndexOf(d4);r=~x?g.length-x:r+g.length}function a(){var g={line:n,column:r};return function(y){return y.position=new l(g),u(),y}}function l(g){this.start=g,this.end={line:n,column:r},this.source=t.source}l.prototype.content=e;function s(g){var y=new Error(t.source+":"+n+":"+r+": "+g);if(y.reason=g,y.filename=t.source,y.line=n,y.column=r,y.source=e,!t.silent)throw y}function c(g){var y=g.exec(e);if(y){var x=y[0];return i(x),e=e.slice(x.length),y}}function u(){c(a4)}function f(g){var y;for(g=g||[];y=d();)y!==!1&&g.push(y);return g}function d(){var g=a();if(!(Fw!=e.charAt(0)||Uw!=e.charAt(1))){for(var y=2;fo!=e.charAt(y)&&(Uw!=e.charAt(y)||Fw!=e.charAt(y+1));)++y;if(y+=2,fo===e.charAt(y-1))return s("End of comment missing");var x=e.slice(2,y-2);return r+=2,i(x),e=e.slice(y),r+=2,g({type:f4,comment:x})}}function p(){var g=a(),y=c(o4);if(y){if(d(),!c(l4))return s("property missing ':'");var x=c(s4),v=g({type:p4,property:Ww(y[0].replace(Bw,fo)),value:x?Ww(x[0].replace(Bw,fo)):fo});return c(c4),v}}function m(){var g=[];f(g);for(var y;y=p();)y!==!1&&(g.push(y),f(g));return g}return u(),m()}function Ww(e){return e?e.replace(u4,fo):fo}var m4=h4,g4=Wl&&Wl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Dx,"__esModule",{value:!0});Dx.default=y4;const v4=g4(m4);function y4(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,v4.default)(e),i=typeof t=="function";return r.forEach(a=>{if(a.type!=="declaration")return;const{property:l,value:s}=a;i?t(l,s,a):s&&(n=n||{},n[l]=s)}),n}var Yp={};Object.defineProperty(Yp,"__esModule",{value:!0});Yp.camelCase=void 0;var x4=/^--[a-zA-Z0-9_-]+$/,b4=/-([a-z])/g,w4=/^[^-]+$/,j4=/^-(webkit|moz|ms|o|khtml)-/,S4=/^-(ms)-/,k4=function(e){return!e||w4.test(e)||x4.test(e)},C4=function(e,t){return t.toUpperCase()},Kw=function(e,t){return"".concat(t,"-")},P4=function(e,t){return t===void 0&&(t={}),k4(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(S4,Kw):e=e.replace(j4,Kw),e.replace(b4,C4))};Yp.camelCase=P4;var E4=Wl&&Wl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},T4=E4(Dx),O4=Yp;function jv(e,t){var n={};return!e||typeof e!="string"||(0,T4.default)(e,function(r,i){r&&i&&(n[(0,O4.camelCase)(r,t)]=i)}),n}jv.default=jv;var A4=jv;const I4=ss(A4),cT=uT("end"),Lx=uT("start");function uT(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function N4(e){const t=Lx(e),n=cT(e);if(t&&n)return{start:t,end:n}}function pc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Hw(e.position):"start"in e||"end"in e?Hw(e):"line"in e||"column"in e?Sv(e):""}function Sv(e){return Vw(e&&e.line)+":"+Vw(e&&e.column)}function Hw(e){return Sv(e&&e.start)+"-"+Sv(e&&e.end)}function Vw(e){return e&&typeof e=="number"?e:1}class Rn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",a={},l=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?i=t:!a.cause&&t&&(l=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?a.ruleId=r:(a.source=r.slice(0,c),a.ruleId=r.slice(c+1))}if(!a.place&&a.ancestors&&a.ancestors){const c=a.ancestors[a.ancestors.length-1];c&&(a.place=c.position)}const s=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=s?s.line:void 0,this.name=pc(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=l&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Rn.prototype.file="";Rn.prototype.name="";Rn.prototype.reason="";Rn.prototype.message="";Rn.prototype.stack="";Rn.prototype.column=void 0;Rn.prototype.line=void 0;Rn.prototype.ancestors=void 0;Rn.prototype.cause=void 0;Rn.prototype.fatal=void 0;Rn.prototype.place=void 0;Rn.prototype.ruleId=void 0;Rn.prototype.source=void 0;const zx={}.hasOwnProperty,_4=new Map,M4=/[A-Z]/g,R4=new Set(["table","tbody","thead","tfoot","tr"]),D4=new Set(["td","th"]),dT="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function L4(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=H4(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=K4(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Rx:n4,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=fT(i,e,void 0);return a&&typeof a!="string"?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function fT(e,t,n){if(t.type==="element")return z4(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return $4(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return F4(e,t,n);if(t.type==="mdxjsEsm")return B4(e,t);if(t.type==="root")return U4(e,t,n);if(t.type==="text")return W4(e,t)}function z4(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Rx,e.schema=i),e.ancestors.push(t);const a=hT(e,t.tagName,!1),l=V4(e,t);let s=Bx(e,t);return R4.has(t.tagName)&&(s=s.filter(function(c){return typeof c=="string"?!Vz(c):!0})),pT(e,l,a,t),$x(l,s),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function $4(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}$c(e,t.position)}function B4(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);$c(e,t.position)}function F4(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Rx,e.schema=i),e.ancestors.push(t);const a=t.name===null?e.Fragment:hT(e,t.name,!0),l=q4(e,t),s=Bx(e,t);return pT(e,l,a,t),$x(l,s),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function U4(e,t,n){const r={};return $x(r,Bx(e,t)),e.create(t,e.Fragment,r,n)}function W4(e,t){return t.value}function pT(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function $x(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function K4(e,t,n){return r;function r(i,a,l,s){const u=Array.isArray(l.children)?n:t;return s?u(a,l,s):u(a,l)}}function H4(e,t){return n;function n(r,i,a,l){const s=Array.isArray(a.children),c=Lx(r);return t(i,a,l,s,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function V4(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&zx.call(t.properties,i)){const a=Y4(e,i,t.properties[i]);if(a){const[l,s]=a;e.tableCellAlignToStyle&&l==="align"&&typeof s=="string"&&D4.has(t.tagName)?r=s:n[l]=s}}if(r){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function q4(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const l=a.expression;l.type;const s=l.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else $c(e,t.position);else{const i=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const s=r.value.data.estree.body[0];s.type,a=e.evaluater.evaluateExpression(s.expression)}else $c(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Bx(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:_4;for(;++r<t.children.length;){const a=t.children[r];let l;if(e.passKeys){const c=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(c){const u=i.get(c)||0;l=c+"-"+u,i.set(c,u+1)}}const s=fT(e,a,l);s!==void 0&&n.push(s)}return n}function Y4(e,t,n){const r=Zz(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Fz(n):r4(n)),r.property==="style"){let i=typeof n=="object"?n:G4(e,String(n));return e.stylePropertyNameCase==="css"&&(i=X4(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?Xz[r.property]||r.property:r.attribute,n]}}function G4(e,t){try{return I4(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Rn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=dT+"#cannot-parse-style-attribute",i}}function hT(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let a=-1,l;for(;++a<i.length;){const s=Dw(i[a])?{type:"Identifier",name:i[a]}:{type:"Literal",value:i[a]};l=l?{type:"MemberExpression",object:l,property:s,computed:!!(a&&s.type==="Literal"),optional:!1}:s}r=l}else r=Dw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return zx.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);$c(e)}function $c(e,t){const n=new Rn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=dT+"#cannot-handle-mdx-estrees-without-createevaluater",n}function X4(e){const t={};let n;for(n in e)zx.call(e,n)&&(t[Q4(n)]=e[n]);return t}function Q4(e){let t=e.replace(M4,J4);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function J4(e){return"-"+e.toLowerCase()}const Mm={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Z4={};function e$(e,t){const n=Z4,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return mT(e,r,i)}function mT(e,t,n){if(t$(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return qw(e.children,t,n)}return Array.isArray(e)?qw(e,t,n):""}function qw(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=mT(e[i],t,n);return r.join("")}function t$(e){return!!(e&&typeof e=="object")}const Yw=document.createElement("i");function Fx(e){const t="&"+e+";";Yw.innerHTML=t;const n=Yw.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function xi(e,t,n,r){const i=e.length;let a=0,l;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);a<r.length;)l=r.slice(a,a+1e4),l.unshift(t,0),e.splice(...l),a+=1e4,t+=1e4}function Er(e,t){return e.length>0?(xi(e,e.length,0,t),e):t}const Gw={}.hasOwnProperty;function n$(e){const t={};let n=-1;for(;++n<e.length;)r$(t,e[n]);return t}function r$(e,t){let n;for(n in t){const i=(Gw.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let l;if(a)for(l in a){Gw.call(i,l)||(i[l]=[]);const s=a[l];i$(i[l],Array.isArray(s)?s:s?[s]:[])}}}function i$(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);xi(e,0,0,r)}function gT(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function zl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const fi=Fa(/[A-Za-z]/),ur=Fa(/[\dA-Za-z]/),a$=Fa(/[#-'*+\--9=?A-Z^-~]/);function kv(e){return e!==null&&(e<32||e===127)}const Cv=Fa(/\d/),o$=Fa(/[\dA-Fa-f]/),l$=Fa(/[!-/:-@[-`{-~]/);function Me(e){return e!==null&&e<-2}function ir(e){return e!==null&&(e<0||e===32)}function lt(e){return e===-2||e===-1||e===32}const s$=Fa(new RegExp("\\p{P}|\\p{S}","u")),c$=Fa(/\s/);function Fa(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ms(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const a=e.charCodeAt(n);let l="";if(a===37&&ur(e.charCodeAt(n+1))&&ur(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(l=String.fromCharCode(a));else if(a>55295&&a<57344){const s=e.charCodeAt(n+1);a<56320&&s>56319&&s<57344?(l=String.fromCharCode(a,s),i=1):l="�"}else l=String.fromCharCode(a);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+i+1,l=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function jt(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let a=0;return l;function l(c){return lt(c)?(e.enter(n),s(c)):t(c)}function s(c){return lt(c)&&a++<i?(e.consume(c),s):(e.exit(n),t(c))}}const u$={tokenize:d$};function d$(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),jt(e,t,"linePrefix")}function i(s){return e.enter("paragraph"),a(s)}function a(s){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,l(s)}function l(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return Me(s)?(e.consume(s),e.exit("chunkText"),a):(e.consume(s),l)}}const f$={tokenize:p$},Xw={tokenize:h$};function p$(e){const t=this,n=[];let r=0,i,a,l;return s;function s(w){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,c,u)(w)}return u(w)}function c(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&b();const S=t.events.length;let C=S,j;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){j=t.events[C][1].end;break}v(r);let E=S;for(;E<t.events.length;)t.events[E][1].end={...j},E++;return xi(t.events,C+1,0,t.events.slice(S)),t.events.length=E,u(w)}return s(w)}function u(w){if(r===n.length){if(!i)return p(w);if(i.currentConstruct&&i.currentConstruct.concrete)return g(w);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Xw,f,d)(w)}function f(w){return i&&b(),v(r),p(w)}function d(w){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,g(w)}function p(w){return t.containerState={},e.attempt(Xw,m,g)(w)}function m(w){return r++,n.push([t.currentConstruct,t.containerState]),p(w)}function g(w){if(w===null){i&&b(),v(0),e.consume(w);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:a}),y(w)}function y(w){if(w===null){x(e.exit("chunkFlow"),!0),v(0),e.consume(w);return}return Me(w)?(e.consume(w),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,s):(e.consume(w),y)}function x(w,S){const C=t.sliceStream(w);if(S&&C.push(null),w.previous=a,a&&(a.next=w),a=w,i.defineSkip(w.start),i.write(C),t.parser.lazy[w.start.line]){let j=i.events.length;for(;j--;)if(i.events[j][1].start.offset<l&&(!i.events[j][1].end||i.events[j][1].end.offset>l))return;const E=t.events.length;let O=E,R,A;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){if(R){A=t.events[O][1].end;break}R=!0}for(v(r),j=E;j<t.events.length;)t.events[j][1].end={...A},j++;xi(t.events,O+1,0,t.events.slice(E)),t.events.length=j}}function v(w){let S=n.length;for(;S-- >w;){const C=n[S];t.containerState=C[1],C[0].exit.call(t,e)}n.length=w}function b(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function h$(e,t,n){return jt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Qw(e){if(e===null||ir(e)||c$(e))return 1;if(s$(e))return 2}function Ux(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const Pv={name:"attention",resolveAll:m$,tokenize:g$};function m$(e,t){let n=-1,r,i,a,l,s,c,u,f;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},p={...e[n][1].start};Jw(d,-c),Jw(p,c),l={type:c>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},s={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},a={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?"strong":"emphasis",start:{...l.start},end:{...s.end}},e[r][1].end={...l.start},e[n][1].start={...s.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Er(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Er(u,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",a,t]]),u=Er(u,Ux(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Er(u,[["exit",a,t],["enter",s,t],["exit",s,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(f=2,u=Er(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):f=0,xi(e,r-1,n-r+3,u),n=r+u.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function g$(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Qw(r);let a;return l;function l(c){return a=c,e.enter("attentionSequence"),s(c)}function s(c){if(c===a)return e.consume(c),s;const u=e.exit("attentionSequence"),f=Qw(c),d=!f||f===2&&i||n.includes(c),p=!i||i===2&&f||n.includes(r);return u._open=!!(a===42?d:d&&(i||!p)),u._close=!!(a===42?p:p&&(f||!d)),t(c)}}function Jw(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const v$={name:"autolink",tokenize:y$};function y$(e,t,n){let r=0;return i;function i(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(m){return fi(m)?(e.consume(m),l):m===64?n(m):u(m)}function l(m){return m===43||m===45||m===46||ur(m)?(r=1,s(m)):u(m)}function s(m){return m===58?(e.consume(m),r=0,c):(m===43||m===45||m===46||ur(m))&&r++<32?(e.consume(m),s):(r=0,u(m))}function c(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||kv(m)?n(m):(e.consume(m),c)}function u(m){return m===64?(e.consume(m),f):a$(m)?(e.consume(m),u):n(m)}function f(m){return ur(m)?d(m):n(m)}function d(m){return m===46?(e.consume(m),r=0,f):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):p(m)}function p(m){if((m===45||ur(m))&&r++<63){const g=m===45?p:d;return e.consume(m),g}return n(m)}}const Gp={partial:!0,tokenize:x$};function x$(e,t,n){return r;function r(a){return lt(a)?jt(e,i,"linePrefix")(a):i(a)}function i(a){return a===null||Me(a)?t(a):n(a)}}const vT={continuation:{tokenize:w$},exit:j$,name:"blockQuote",tokenize:b$};function b$(e,t,n){const r=this;return i;function i(l){if(l===62){const s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),a}return n(l)}function a(l){return lt(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function w$(e,t,n){const r=this;return i;function i(l){return lt(l)?jt(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):a(l)}function a(l){return e.attempt(vT,t,n)(l)}}function j$(e){e.exit("blockQuote")}const yT={name:"characterEscape",tokenize:S$};function S$(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),i}function i(a){return l$(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const xT={name:"characterReference",tokenize:k$};function k$(e,t,n){const r=this;let i=0,a,l;return s;function s(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),c}function c(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),a=31,l=ur,f(d))}function u(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,l=o$,f):(e.enter("characterReferenceValue"),a=7,l=Cv,f(d))}function f(d){if(d===59&&i){const p=e.exit("characterReferenceValue");return l===ur&&!Fx(r.sliceSerialize(p))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(d)&&i++<a?(e.consume(d),f):n(d)}}const Zw={partial:!0,tokenize:P$},ej={concrete:!0,name:"codeFenced",tokenize:C$};function C$(e,t,n){const r=this,i={partial:!0,tokenize:C};let a=0,l=0,s;return c;function c(j){return u(j)}function u(j){const E=r.events[r.events.length-1];return a=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,s=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),f(j)}function f(j){return j===s?(l++,e.consume(j),f):l<3?n(j):(e.exit("codeFencedFenceSequence"),lt(j)?jt(e,d,"whitespace")(j):d(j))}function d(j){return j===null||Me(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(Zw,y,S)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(j))}function p(j){return j===null||Me(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(j)):lt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),jt(e,m,"whitespace")(j)):j===96&&j===s?n(j):(e.consume(j),p)}function m(j){return j===null||Me(j)?d(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(j))}function g(j){return j===null||Me(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(j)):j===96&&j===s?n(j):(e.consume(j),g)}function y(j){return e.attempt(i,S,x)(j)}function x(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),v}function v(j){return a>0&&lt(j)?jt(e,b,"linePrefix",a+1)(j):b(j)}function b(j){return j===null||Me(j)?e.check(Zw,y,S)(j):(e.enter("codeFlowValue"),w(j))}function w(j){return j===null||Me(j)?(e.exit("codeFlowValue"),b(j)):(e.consume(j),w)}function S(j){return e.exit("codeFenced"),t(j)}function C(j,E,O){let R=0;return A;function A(I){return j.enter("lineEnding"),j.consume(I),j.exit("lineEnding"),N}function N(I){return j.enter("codeFencedFence"),lt(I)?jt(j,_,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):_(I)}function _(I){return I===s?(j.enter("codeFencedFenceSequence"),q(I)):O(I)}function q(I){return I===s?(R++,j.consume(I),q):R>=l?(j.exit("codeFencedFenceSequence"),lt(I)?jt(j,W,"whitespace")(I):W(I)):O(I)}function W(I){return I===null||Me(I)?(j.exit("codeFencedFence"),E(I)):O(I)}}}function P$(e,t,n){const r=this;return i;function i(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const Rm={name:"codeIndented",tokenize:T$},E$={partial:!0,tokenize:O$};function T$(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),jt(e,a,"linePrefix",5)(u)}function a(u){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?l(u):n(u)}function l(u){return u===null?c(u):Me(u)?e.attempt(E$,l,c)(u):(e.enter("codeFlowValue"),s(u))}function s(u){return u===null||Me(u)?(e.exit("codeFlowValue"),l(u)):(e.consume(u),s)}function c(u){return e.exit("codeIndented"),t(u)}}function O$(e,t,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):Me(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):jt(e,a,"linePrefix",5)(l)}function a(l){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(l):Me(l)?i(l):n(l)}}const A$={name:"codeText",previous:N$,resolve:I$,tokenize:_$};function I$(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function N$(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _$(e,t,n){let r=0,i,a;return l;function l(d){return e.enter("codeText"),e.enter("codeTextSequence"),s(d)}function s(d){return d===96?(e.consume(d),r++,s):(e.exit("codeTextSequence"),c(d))}function c(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),c):d===96?(a=e.enter("codeTextSequence"),i=0,f(d)):Me(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(d))}function u(d){return d===null||d===32||d===96||Me(d)?(e.exit("codeTextData"),c(d)):(e.consume(d),u)}function f(d){return d===96?(e.consume(d),i++,f):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(a.type="codeTextData",u(d))}}class M${constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ls(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ls(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ls(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Ls(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ls(this.left,n.reverse())}}}function Ls(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function bT(e){const t={};let n=-1,r,i,a,l,s,c,u;const f=new M$(e);for(;++n<f.length;){for(;n in t;)n=t[n];if(r=f.get(n),n&&r[1].type==="chunkFlow"&&f.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type==="lineEndingBlank"&&(a+=2),a<c.length&&c[a][1].type==="content"))for(;++a<c.length&&c[a][1].type!=="content";)c[a][1].type==="chunkText"&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,R$(f,n)),n=t[n],u=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(l=f.get(a),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(f.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=a);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...f.get(i)[1].start},s=f.slice(i,n),s.unshift(r),f.splice(i,n-i+1,s))}}return xi(e,0,Number.POSITIVE_INFINITY,f.slice(0)),!u}function R$(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const a=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const s=l.events,c=[],u={};let f,d,p=-1,m=n,g=0,y=0;const x=[y];for(;m;){for(;e.get(++i)[1]!==m;);a.push(i),m._tokenizer||(f=r.sliceStream(m),m.next||f.push(null),d&&l.defineSkip(m.start),m._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(f),m._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),d=m,m=m.next}for(m=n;++p<s.length;)s[p][0]==="exit"&&s[p-1][0]==="enter"&&s[p][1].type===s[p-1][1].type&&s[p][1].start.line!==s[p][1].end.line&&(y=p+1,x.push(y),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(l.events=[],m?(m._tokenizer=void 0,m.previous=void 0):x.pop(),p=x.length;p--;){const v=s.slice(x[p],x[p+1]),b=a.pop();c.push([b,b+v.length-1]),e.splice(b,2,v)}for(c.reverse(),p=-1;++p<c.length;)u[g+c[p][0]]=g+c[p][1],g+=c[p][1]-c[p][0]-1;return u}const D$={resolve:z$,tokenize:$$},L$={partial:!0,tokenize:B$};function z$(e){return bT(e),e}function $$(e,t){let n;return r;function r(s){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(s)}function i(s){return s===null?a(s):Me(s)?e.check(L$,l,a)(s):(e.consume(s),i)}function a(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function l(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function B$(e,t,n){const r=this;return i;function i(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),jt(e,a,"linePrefix")}function a(l){if(l===null||Me(l))return n(l);const s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function wT(e,t,n,r,i,a,l,s,c){const u=c||Number.POSITIVE_INFINITY;let f=0;return d;function d(v){return v===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(v),e.exit(a),p):v===null||v===32||v===41||kv(v)?n(v):(e.enter(r),e.enter(l),e.enter(s),e.enter("chunkString",{contentType:"string"}),y(v))}function p(v){return v===62?(e.enter(a),e.consume(v),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),m(v))}function m(v){return v===62?(e.exit("chunkString"),e.exit(s),p(v)):v===null||v===60||Me(v)?n(v):(e.consume(v),v===92?g:m)}function g(v){return v===60||v===62||v===92?(e.consume(v),m):m(v)}function y(v){return!f&&(v===null||v===41||ir(v))?(e.exit("chunkString"),e.exit(s),e.exit(l),e.exit(r),t(v)):f<u&&v===40?(e.consume(v),f++,y):v===41?(e.consume(v),f--,y):v===null||v===32||v===40||kv(v)?n(v):(e.consume(v),v===92?x:y)}function x(v){return v===40||v===41||v===92?(e.consume(v),y):y(v)}}function jT(e,t,n,r,i,a){const l=this;let s=0,c;return u;function u(m){return e.enter(r),e.enter(i),e.consume(m),e.exit(i),e.enter(a),f}function f(m){return s>999||m===null||m===91||m===93&&!c||m===94&&!s&&"_hiddenFootnoteSupport"in l.parser.constructs?n(m):m===93?(e.exit(a),e.enter(i),e.consume(m),e.exit(i),e.exit(r),t):Me(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),f):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===null||m===91||m===93||Me(m)||s++>999?(e.exit("chunkString"),f(m)):(e.consume(m),c||(c=!lt(m)),m===92?p:d)}function p(m){return m===91||m===92||m===93?(e.consume(m),s++,d):d(m)}}function ST(e,t,n,r,i,a){let l;return s;function s(p){return p===34||p===39||p===40?(e.enter(r),e.enter(i),e.consume(p),e.exit(i),l=p===40?41:p,c):n(p)}function c(p){return p===l?(e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):(e.enter(a),u(p))}function u(p){return p===l?(e.exit(a),c(l)):p===null?n(p):Me(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),jt(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===l||p===null||Me(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?d:f)}function d(p){return p===l||p===92?(e.consume(p),f):f(p)}}function hc(e,t){let n;return r;function r(i){return Me(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):lt(i)?jt(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const F$={name:"definition",tokenize:W$},U$={partial:!0,tokenize:K$};function W$(e,t,n){const r=this;let i;return a;function a(m){return e.enter("definition"),l(m)}function l(m){return jT.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function s(m){return i=zl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),c):n(m)}function c(m){return ir(m)?hc(e,u)(m):u(m)}function u(m){return wT(e,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function f(m){return e.attempt(U$,d,d)(m)}function d(m){return lt(m)?jt(e,p,"whitespace")(m):p(m)}function p(m){return m===null||Me(m)?(e.exit("definition"),r.parser.defined.push(i),t(m)):n(m)}}function K$(e,t,n){return r;function r(s){return ir(s)?hc(e,i)(s):n(s)}function i(s){return ST(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function a(s){return lt(s)?jt(e,l,"whitespace")(s):l(s)}function l(s){return s===null||Me(s)?t(s):n(s)}}const H$={name:"hardBreakEscape",tokenize:V$};function V$(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return Me(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const q$={name:"headingAtx",resolve:Y$,tokenize:G$};function Y$(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},xi(e,r,n-r+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function G$(e,t,n){let r=0;return i;function i(f){return e.enter("atxHeading"),a(f)}function a(f){return e.enter("atxHeadingSequence"),l(f)}function l(f){return f===35&&r++<6?(e.consume(f),l):f===null||ir(f)?(e.exit("atxHeadingSequence"),s(f)):n(f)}function s(f){return f===35?(e.enter("atxHeadingSequence"),c(f)):f===null||Me(f)?(e.exit("atxHeading"),t(f)):lt(f)?jt(e,s,"whitespace")(f):(e.enter("atxHeadingText"),u(f))}function c(f){return f===35?(e.consume(f),c):(e.exit("atxHeadingSequence"),s(f))}function u(f){return f===null||f===35||ir(f)?(e.exit("atxHeadingText"),s(f)):(e.consume(f),u)}}const X$=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],tj=["pre","script","style","textarea"],Q$={concrete:!0,name:"htmlFlow",resolveTo:e6,tokenize:t6},J$={partial:!0,tokenize:r6},Z$={partial:!0,tokenize:n6};function e6(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function t6(e,t,n){const r=this;let i,a,l,s,c;return u;function u(T){return f(T)}function f(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),d}function d(T){return T===33?(e.consume(T),p):T===47?(e.consume(T),a=!0,y):T===63?(e.consume(T),i=3,r.interrupt?t:k):fi(T)?(e.consume(T),l=String.fromCharCode(T),x):n(T)}function p(T){return T===45?(e.consume(T),i=2,m):T===91?(e.consume(T),i=5,s=0,g):fi(T)?(e.consume(T),i=4,r.interrupt?t:k):n(T)}function m(T){return T===45?(e.consume(T),r.interrupt?t:k):n(T)}function g(T){const ce="CDATA[";return T===ce.charCodeAt(s++)?(e.consume(T),s===ce.length?r.interrupt?t:_:g):n(T)}function y(T){return fi(T)?(e.consume(T),l=String.fromCharCode(T),x):n(T)}function x(T){if(T===null||T===47||T===62||ir(T)){const ce=T===47,ve=l.toLowerCase();return!ce&&!a&&tj.includes(ve)?(i=1,r.interrupt?t(T):_(T)):X$.includes(l.toLowerCase())?(i=6,ce?(e.consume(T),v):r.interrupt?t(T):_(T)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(T):a?b(T):w(T))}return T===45||ur(T)?(e.consume(T),l+=String.fromCharCode(T),x):n(T)}function v(T){return T===62?(e.consume(T),r.interrupt?t:_):n(T)}function b(T){return lt(T)?(e.consume(T),b):A(T)}function w(T){return T===47?(e.consume(T),A):T===58||T===95||fi(T)?(e.consume(T),S):lt(T)?(e.consume(T),w):A(T)}function S(T){return T===45||T===46||T===58||T===95||ur(T)?(e.consume(T),S):C(T)}function C(T){return T===61?(e.consume(T),j):lt(T)?(e.consume(T),C):w(T)}function j(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(e.consume(T),c=T,E):lt(T)?(e.consume(T),j):O(T)}function E(T){return T===c?(e.consume(T),c=null,R):T===null||Me(T)?n(T):(e.consume(T),E)}function O(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||ir(T)?C(T):(e.consume(T),O)}function R(T){return T===47||T===62||lt(T)?w(T):n(T)}function A(T){return T===62?(e.consume(T),N):n(T)}function N(T){return T===null||Me(T)?_(T):lt(T)?(e.consume(T),N):n(T)}function _(T){return T===45&&i===2?(e.consume(T),F):T===60&&i===1?(e.consume(T),K):T===62&&i===4?(e.consume(T),L):T===63&&i===3?(e.consume(T),k):T===93&&i===5?(e.consume(T),B):Me(T)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(J$,Q,q)(T)):T===null||Me(T)?(e.exit("htmlFlowData"),q(T)):(e.consume(T),_)}function q(T){return e.check(Z$,W,Q)(T)}function W(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),I}function I(T){return T===null||Me(T)?q(T):(e.enter("htmlFlowData"),_(T))}function F(T){return T===45?(e.consume(T),k):_(T)}function K(T){return T===47?(e.consume(T),l="",M):_(T)}function M(T){if(T===62){const ce=l.toLowerCase();return tj.includes(ce)?(e.consume(T),L):_(T)}return fi(T)&&l.length<8?(e.consume(T),l+=String.fromCharCode(T),M):_(T)}function B(T){return T===93?(e.consume(T),k):_(T)}function k(T){return T===62?(e.consume(T),L):T===45&&i===2?(e.consume(T),k):_(T)}function L(T){return T===null||Me(T)?(e.exit("htmlFlowData"),Q(T)):(e.consume(T),L)}function Q(T){return e.exit("htmlFlow"),t(T)}}function n6(e,t,n){const r=this;return i;function i(l){return Me(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):n(l)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function r6(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Gp,t,n)}}const i6={name:"htmlText",tokenize:a6};function a6(e,t,n){const r=this;let i,a,l;return s;function s(k){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(k),c}function c(k){return k===33?(e.consume(k),u):k===47?(e.consume(k),C):k===63?(e.consume(k),w):fi(k)?(e.consume(k),O):n(k)}function u(k){return k===45?(e.consume(k),f):k===91?(e.consume(k),a=0,g):fi(k)?(e.consume(k),b):n(k)}function f(k){return k===45?(e.consume(k),m):n(k)}function d(k){return k===null?n(k):k===45?(e.consume(k),p):Me(k)?(l=d,K(k)):(e.consume(k),d)}function p(k){return k===45?(e.consume(k),m):d(k)}function m(k){return k===62?F(k):k===45?p(k):d(k)}function g(k){const L="CDATA[";return k===L.charCodeAt(a++)?(e.consume(k),a===L.length?y:g):n(k)}function y(k){return k===null?n(k):k===93?(e.consume(k),x):Me(k)?(l=y,K(k)):(e.consume(k),y)}function x(k){return k===93?(e.consume(k),v):y(k)}function v(k){return k===62?F(k):k===93?(e.consume(k),v):y(k)}function b(k){return k===null||k===62?F(k):Me(k)?(l=b,K(k)):(e.consume(k),b)}function w(k){return k===null?n(k):k===63?(e.consume(k),S):Me(k)?(l=w,K(k)):(e.consume(k),w)}function S(k){return k===62?F(k):w(k)}function C(k){return fi(k)?(e.consume(k),j):n(k)}function j(k){return k===45||ur(k)?(e.consume(k),j):E(k)}function E(k){return Me(k)?(l=E,K(k)):lt(k)?(e.consume(k),E):F(k)}function O(k){return k===45||ur(k)?(e.consume(k),O):k===47||k===62||ir(k)?R(k):n(k)}function R(k){return k===47?(e.consume(k),F):k===58||k===95||fi(k)?(e.consume(k),A):Me(k)?(l=R,K(k)):lt(k)?(e.consume(k),R):F(k)}function A(k){return k===45||k===46||k===58||k===95||ur(k)?(e.consume(k),A):N(k)}function N(k){return k===61?(e.consume(k),_):Me(k)?(l=N,K(k)):lt(k)?(e.consume(k),N):R(k)}function _(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),i=k,q):Me(k)?(l=_,K(k)):lt(k)?(e.consume(k),_):(e.consume(k),W)}function q(k){return k===i?(e.consume(k),i=void 0,I):k===null?n(k):Me(k)?(l=q,K(k)):(e.consume(k),q)}function W(k){return k===null||k===34||k===39||k===60||k===61||k===96?n(k):k===47||k===62||ir(k)?R(k):(e.consume(k),W)}function I(k){return k===47||k===62||ir(k)?R(k):n(k)}function F(k){return k===62?(e.consume(k),e.exit("htmlTextData"),e.exit("htmlText"),t):n(k)}function K(k){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),M}function M(k){return lt(k)?jt(e,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):B(k)}function B(k){return e.enter("htmlTextData"),l(k)}}const Wx={name:"labelEnd",resolveAll:c6,resolveTo:u6,tokenize:d6},o6={tokenize:f6},l6={tokenize:p6},s6={tokenize:h6};function c6(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&xi(e,0,e.length,n),e}function u6(e,t){let n=e.length,r=0,i,a,l,s;for(;n--;)if(i=e[n][1],a){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(a=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(l=n);const c={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[a][1].start},end:{...e[l][1].end}},f={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[l-2][1].start}};return s=[["enter",c,t],["enter",u,t]],s=Er(s,e.slice(a+1,a+r+3)),s=Er(s,[["enter",f,t]]),s=Er(s,Ux(t.parser.constructs.insideSpan.null,e.slice(a+r+4,l-3),t)),s=Er(s,[["exit",f,t],e[l-2],e[l-1],["exit",u,t]]),s=Er(s,e.slice(l+1)),s=Er(s,[["exit",c,t]]),xi(e,a,e.length,s),e}function d6(e,t,n){const r=this;let i=r.events.length,a,l;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(p){return a?a._inactive?d(p):(l=r.parser.defined.includes(zl(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(o6,f,l?f:d)(p):p===91?e.attempt(l6,f,l?u:d)(p):l?f(p):d(p)}function u(p){return e.attempt(s6,f,d)(p)}function f(p){return t(p)}function d(p){return a._balanced=!0,n(p)}}function f6(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),i}function i(d){return ir(d)?hc(e,a)(d):a(d)}function a(d){return d===41?f(d):wT(e,l,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function l(d){return ir(d)?hc(e,c)(d):f(d)}function s(d){return n(d)}function c(d){return d===34||d===39||d===40?ST(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):f(d)}function u(d){return ir(d)?hc(e,f)(d):f(d)}function f(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function p6(e,t,n){const r=this;return i;function i(s){return jT.call(r,e,a,l,"reference","referenceMarker","referenceString")(s)}function a(s){return r.parser.defined.includes(zl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function l(s){return n(s)}}function h6(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),i}function i(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const m6={name:"labelStartImage",resolveAll:Wx.resolveAll,tokenize:g6};function g6(e,t,n){const r=this;return i;function i(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),a}function a(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),l):n(s)}function l(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const v6={name:"labelStartLink",resolveAll:Wx.resolveAll,tokenize:y6};function y6(e,t,n){const r=this;return i;function i(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),a}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const Dm={name:"lineEnding",tokenize:x6};function x6(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),jt(e,t,"linePrefix")}}const Kd={name:"thematicBreak",tokenize:b6};function b6(e,t,n){let r=0,i;return a;function a(u){return e.enter("thematicBreak"),l(u)}function l(u){return i=u,s(u)}function s(u){return u===i?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||Me(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===i?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),lt(u)?jt(e,s,"whitespace")(u):s(u))}}const Xn={continuation:{tokenize:k6},exit:P6,name:"list",tokenize:S6},w6={partial:!0,tokenize:E6},j6={partial:!0,tokenize:C6};function S6(e,t,n){const r=this,i=r.events[r.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return s;function s(m){const g=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:Cv(m)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(Kd,n,u)(m):u(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(m)}return n(m)}function c(m){return Cv(m)&&++l<10?(e.consume(m),c):(!r.interrupt||l<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):n(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(Gp,r.interrupt?n:f,e.attempt(w6,p,d))}function f(m){return r.containerState.initialBlankLine=!0,a++,p(m)}function d(m){return lt(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),p):n(m)}function p(m){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function k6(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Gp,i,a);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,jt(e,t,"listItemIndent",r.containerState.size+1)(s)}function a(s){return r.containerState.furtherBlankLines||!lt(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(j6,t,l)(s))}function l(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,jt(e,e.attempt(Xn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function C6(e,t,n){const r=this;return jt(e,i,"listItemIndent",r.containerState.size+1);function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(a):n(a)}}function P6(e){e.exit(this.containerState.type)}function E6(e,t,n){const r=this;return jt(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){const l=r.events[r.events.length-1];return!lt(a)&&l&&l[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const nj={name:"setextUnderline",resolveTo:T6,tokenize:O6};function T6(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",l,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function O6(e,t,n){const r=this;let i;return a;function a(u){let f=r.events.length,d;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){d=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),i=u,l(u)):n(u)}function l(u){return e.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===i?(e.consume(u),s):(e.exit("setextHeadingLineSequence"),lt(u)?jt(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Me(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const A6={tokenize:I6};function I6(e){const t=this,n=e.attempt(Gp,r,e.attempt(this.parser.constructs.flowInitial,i,jt(e,e.attempt(this.parser.constructs.flow,i,e.attempt(D$,i)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const N6={resolveAll:CT()},_6=kT("string"),M6=kT("text");function kT(e){return{resolveAll:CT(e==="text"?R6:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],a=n.attempt(i,l,s);return l;function l(f){return u(f)?a(f):s(f)}function s(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),c}function c(f){return u(f)?(n.exit("data"),a(f)):(n.consume(f),c)}function u(f){if(f===null)return!0;const d=i[f];let p=-1;if(d)for(;++p<d.length;){const m=d[p];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function CT(e){return t;function t(n,r){let i=-1,a;for(;++i<=n.length;)a===void 0?n[i]&&n[i][1].type==="data"&&(a=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==a+2&&(n[a][1].end=n[i-1][1].end,n.splice(a+2,i-a-2),i=a+2),a=void 0);return e?e(n,r):n}}function R6(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let a=i.length,l=-1,s=0,c;for(;a--;){const u=i[a];if(typeof u=="string"){for(l=u.length;u.charCodeAt(l-1)===32;)s++,l--;if(l)break;l=-1}else if(u===-2)c=!0,s++;else if(u!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){const u={type:n===e.length||c||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?l:r.start._bufferIndex+l,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const D6={42:Xn,43:Xn,45:Xn,48:Xn,49:Xn,50:Xn,51:Xn,52:Xn,53:Xn,54:Xn,55:Xn,56:Xn,57:Xn,62:vT},L6={91:F$},z6={[-2]:Rm,[-1]:Rm,32:Rm},$6={35:q$,42:Kd,45:[nj,Kd],60:Q$,61:nj,95:Kd,96:ej,126:ej},B6={38:xT,92:yT},F6={[-5]:Dm,[-4]:Dm,[-3]:Dm,33:m6,38:xT,42:Pv,60:[v$,i6],91:v6,92:[H$,yT],93:Wx,95:Pv,96:A$},U6={null:[Pv,N6]},W6={null:[42,95]},K6={null:[]},H6=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:W6,contentInitial:L6,disable:K6,document:D6,flow:$6,flowInitial:z6,insideSpan:U6,string:B6,text:F6},Symbol.toStringTag,{value:"Module"}));function V6(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},a=[];let l=[],s=[];const c={attempt:E(C),check:E(j),consume:b,enter:w,exit:S,interrupt:E(j,{interrupt:!0})},u={code:null,containerState:{},defineSkip:y,events:[],now:g,parser:e,previous:null,sliceSerialize:p,sliceStream:m,write:d};let f=t.tokenize.call(u,c);return t.resolveAll&&a.push(t),u;function d(N){return l=Er(l,N),x(),l[l.length-1]!==null?[]:(O(t,0),u.events=Ux(a,u.events,u),u.events)}function p(N,_){return Y6(m(N),_)}function m(N){return q6(l,N)}function g(){const{_bufferIndex:N,_index:_,line:q,column:W,offset:I}=r;return{_bufferIndex:N,_index:_,line:q,column:W,offset:I}}function y(N){i[N.line]=N.column,A()}function x(){let N;for(;r._index<l.length;){const _=l[r._index];if(typeof _=="string")for(N=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===N&&r._bufferIndex<_.length;)v(_.charCodeAt(r._bufferIndex));else v(_)}}function v(N){f=f(N)}function b(N){Me(N)?(r.line++,r.column=1,r.offset+=N===-3?2:1,A()):N!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=N}function w(N,_){const q=_||{};return q.type=N,q.start=g(),u.events.push(["enter",q,u]),s.push(q),q}function S(N){const _=s.pop();return _.end=g(),u.events.push(["exit",_,u]),_}function C(N,_){O(N,_.from)}function j(N,_){_.restore()}function E(N,_){return q;function q(W,I,F){let K,M,B,k;return Array.isArray(W)?Q(W):"tokenize"in W?Q([W]):L(W);function L(X){return oe;function oe(fe){const te=fe!==null&&X[fe],Z=fe!==null&&X.null,se=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(Z)?Z:Z?[Z]:[]];return Q(se)(fe)}}function Q(X){return K=X,M=0,X.length===0?F:T(X[M])}function T(X){return oe;function oe(fe){return k=R(),B=X,X.partial||(u.currentConstruct=X),X.name&&u.parser.constructs.disable.null.includes(X.name)?ve():X.tokenize.call(_?Object.assign(Object.create(u),_):u,c,ce,ve)(fe)}}function ce(X){return N(B,k),I}function ve(X){return k.restore(),++M<K.length?T(K[M]):F}}}function O(N,_){N.resolveAll&&!a.includes(N)&&a.push(N),N.resolve&&xi(u.events,_,u.events.length-_,N.resolve(u.events.slice(_),u)),N.resolveTo&&(u.events=N.resolveTo(u.events,u))}function R(){const N=g(),_=u.previous,q=u.currentConstruct,W=u.events.length,I=Array.from(s);return{from:W,restore:F};function F(){r=N,u.previous=_,u.currentConstruct=q,u.events.length=W,s=I,A()}}function A(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function q6(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex;let l;if(n===i)l=[e[n].slice(r,a)];else{if(l=e.slice(n,i),r>-1){const s=l[0];typeof s=="string"?l[0]=s.slice(r):l.shift()}a>0&&l.push(e[i].slice(0,a))}return l}function Y6(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const a=e[n];let l;if(typeof a=="string")l=a;else switch(a){case-5:{l="\r";break}case-4:{l=`
69
+ `;break}case-3:{l=`\r
70
+ `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&i)continue;l=" ";break}default:l=String.fromCharCode(a)}i=a===-2,r.push(l)}return r.join("")}function G6(e){const r={constructs:n$([H6,...(e||{}).extensions||[]]),content:i(u$),defined:[],document:i(f$),flow:i(A6),lazy:{},string:i(_6),text:i(M6)};return r;function i(a){return l;function l(s){return V6(r,a,s)}}}function X6(e){for(;!bT(e););return e}const rj=/[\0\t\n\r]/g;function Q6(){let e=1,t="",n=!0,r;return i;function i(a,l,s){const c=[];let u,f,d,p,m;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),d=0,t="",n&&(a.charCodeAt(0)===65279&&d++,n=void 0);d<a.length;){if(rj.lastIndex=d,u=rj.exec(a),p=u&&u.index!==void 0?u.index:a.length,m=a.charCodeAt(p),!u){t=a.slice(d);break}if(m===10&&d===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),d<p&&(c.push(a.slice(d,p)),e+=p-d),m){case 0:{c.push(65533),e++;break}case 9:{for(f=Math.ceil(e/4)*4,c.push(-2);e++<f;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}d=p+1}return s&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const J6=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Z6(e){return e.replace(J6,e3)}function e3(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),a=i===120||i===88;return gT(n.slice(a?2:1),a?16:10)}return Fx(n)||e}const PT={}.hasOwnProperty;function t3(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),n3(n)(X6(G6(n).document().write(Q6()(e,t,!0))))}function n3(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Be),autolinkProtocol:R,autolinkEmail:R,atxHeading:a(_e),blockQuote:a(Z),characterEscape:R,characterReference:R,codeFenced:a(se),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:a(se,l),codeText:a(re,l),codeTextData:R,data:R,codeFlowValue:R,definition:a(Oe),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:a(ne),hardBreakEscape:a(Re),hardBreakTrailing:a(Re),htmlFlow:a(Fe,l),htmlFlowData:R,htmlText:a(Fe,l),htmlTextData:R,image:a(rt),label:l,link:a(Be),listItem:a(ye),listItemValue:p,listOrdered:a(qe,d),listUnordered:a(qe),paragraph:a(Ee),reference:T,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:a(_e),strong:a(ze),thematicBreak:a(ee)},exit:{atxHeading:c(),atxHeadingSequence:C,autolink:c(),autolinkEmail:te,autolinkProtocol:fe,blockQuote:c(),characterEscapeValue:A,characterReferenceMarkerHexadecimal:ve,characterReferenceMarkerNumeric:ve,characterReferenceValue:X,characterReference:oe,codeFenced:c(x),codeFencedFence:y,codeFencedFenceInfo:m,codeFencedFenceMeta:g,codeFlowValue:A,codeIndented:c(v),codeText:c(I),codeTextData:A,data:A,definition:c(),definitionDestinationString:S,definitionLabelString:b,definitionTitleString:w,emphasis:c(),hardBreakEscape:c(_),hardBreakTrailing:c(_),htmlFlow:c(q),htmlFlowData:A,htmlText:c(W),htmlTextData:A,image:c(K),label:B,labelText:M,lineEnding:N,link:c(F),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ce,resourceDestinationString:k,resourceTitleString:L,resource:Q,setextHeading:c(O),setextHeadingLineSequence:E,setextHeadingText:j,strong:c(),thematicBreak:c()}};ET(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Y){let le={type:"root",children:[]};const D={stack:[le],tokenStack:[],config:t,enter:s,exit:u,buffer:l,resume:f,data:n},de=[];let me=-1;for(;++me<Y.length;)if(Y[me][1].type==="listOrdered"||Y[me][1].type==="listUnordered")if(Y[me][0]==="enter")de.push(me);else{const Te=de.pop();me=i(Y,Te,me)}for(me=-1;++me<Y.length;){const Te=t[Y[me][0]];PT.call(Te,Y[me][1].type)&&Te[Y[me][1].type].call(Object.assign({sliceSerialize:Y[me][2].sliceSerialize},D),Y[me][1])}if(D.tokenStack.length>0){const Te=D.tokenStack[D.tokenStack.length-1];(Te[1]||ij).call(D,void 0,Te[0])}for(le.position={start:la(Y.length>0?Y[0][1].start:{line:1,column:1,offset:0}),end:la(Y.length>0?Y[Y.length-2][1].end:{line:1,column:1,offset:0})},me=-1;++me<t.transforms.length;)le=t.transforms[me](le)||le;return le}function i(Y,le,D){let de=le-1,me=-1,Te=!1,Pe,De,Le,Ve;for(;++de<=D;){const We=Y[de];switch(We[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{We[0]==="enter"?me++:me--,Ve=void 0;break}case"lineEndingBlank":{We[0]==="enter"&&(Pe&&!Ve&&!me&&!Le&&(Le=de),Ve=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ve=void 0}if(!me&&We[0]==="enter"&&We[1].type==="listItemPrefix"||me===-1&&We[0]==="exit"&&(We[1].type==="listUnordered"||We[1].type==="listOrdered")){if(Pe){let Qe=de;for(De=void 0;Qe--;){const ut=Y[Qe];if(ut[1].type==="lineEnding"||ut[1].type==="lineEndingBlank"){if(ut[0]==="exit")continue;De&&(Y[De][1].type="lineEndingBlank",Te=!0),ut[1].type="lineEnding",De=Qe}else if(!(ut[1].type==="linePrefix"||ut[1].type==="blockQuotePrefix"||ut[1].type==="blockQuotePrefixWhitespace"||ut[1].type==="blockQuoteMarker"||ut[1].type==="listItemIndent"))break}Le&&(!De||Le<De)&&(Pe._spread=!0),Pe.end=Object.assign({},De?Y[De][1].start:We[1].end),Y.splice(De||de,0,["exit",Pe,We[2]]),de++,D++}if(We[1].type==="listItemPrefix"){const Qe={type:"listItem",_spread:!1,start:Object.assign({},We[1].start),end:void 0};Pe=Qe,Y.splice(de,0,["enter",Qe,We[2]]),de++,D++,Le=void 0,Ve=!0}}}return Y[le][1]._spread=Te,D}function a(Y,le){return D;function D(de){s.call(this,Y(de),de),le&&le.call(this,de)}}function l(){this.stack.push({type:"fragment",children:[]})}function s(Y,le,D){this.stack[this.stack.length-1].children.push(Y),this.stack.push(Y),this.tokenStack.push([le,D||void 0]),Y.position={start:la(le.start),end:void 0}}function c(Y){return le;function le(D){Y&&Y.call(this,D),u.call(this,D)}}function u(Y,le){const D=this.stack.pop(),de=this.tokenStack.pop();if(de)de[0].type!==Y.type&&(le?le.call(this,Y,de[0]):(de[1]||ij).call(this,Y,de[0]));else throw new Error("Cannot close `"+Y.type+"` ("+pc({start:Y.start,end:Y.end})+"): it’s not open");D.position.end=la(Y.end)}function f(){return e$(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function p(Y){if(this.data.expectingFirstListItemValue){const le=this.stack[this.stack.length-2];le.start=Number.parseInt(this.sliceSerialize(Y),10),this.data.expectingFirstListItemValue=void 0}}function m(){const Y=this.resume(),le=this.stack[this.stack.length-1];le.lang=Y}function g(){const Y=this.resume(),le=this.stack[this.stack.length-1];le.meta=Y}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const Y=this.resume(),le=this.stack[this.stack.length-1];le.value=Y.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const Y=this.resume(),le=this.stack[this.stack.length-1];le.value=Y.replace(/(\r?\n|\r)$/g,"")}function b(Y){const le=this.resume(),D=this.stack[this.stack.length-1];D.label=le,D.identifier=zl(this.sliceSerialize(Y)).toLowerCase()}function w(){const Y=this.resume(),le=this.stack[this.stack.length-1];le.title=Y}function S(){const Y=this.resume(),le=this.stack[this.stack.length-1];le.url=Y}function C(Y){const le=this.stack[this.stack.length-1];if(!le.depth){const D=this.sliceSerialize(Y).length;le.depth=D}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function E(Y){const le=this.stack[this.stack.length-1];le.depth=this.sliceSerialize(Y).codePointAt(0)===61?1:2}function O(){this.data.setextHeadingSlurpLineEnding=void 0}function R(Y){const D=this.stack[this.stack.length-1].children;let de=D[D.length-1];(!de||de.type!=="text")&&(de=ht(),de.position={start:la(Y.start),end:void 0},D.push(de)),this.stack.push(de)}function A(Y){const le=this.stack.pop();le.value+=this.sliceSerialize(Y),le.position.end=la(Y.end)}function N(Y){const le=this.stack[this.stack.length-1];if(this.data.atHardBreak){const D=le.children[le.children.length-1];D.position.end=la(Y.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(le.type)&&(R.call(this,Y),A.call(this,Y))}function _(){this.data.atHardBreak=!0}function q(){const Y=this.resume(),le=this.stack[this.stack.length-1];le.value=Y}function W(){const Y=this.resume(),le=this.stack[this.stack.length-1];le.value=Y}function I(){const Y=this.resume(),le=this.stack[this.stack.length-1];le.value=Y}function F(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const le=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=le,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function K(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const le=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=le,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function M(Y){const le=this.sliceSerialize(Y),D=this.stack[this.stack.length-2];D.label=Z6(le),D.identifier=zl(le).toLowerCase()}function B(){const Y=this.stack[this.stack.length-1],le=this.resume(),D=this.stack[this.stack.length-1];if(this.data.inReference=!0,D.type==="link"){const de=Y.children;D.children=de}else D.alt=le}function k(){const Y=this.resume(),le=this.stack[this.stack.length-1];le.url=Y}function L(){const Y=this.resume(),le=this.stack[this.stack.length-1];le.title=Y}function Q(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function ce(Y){const le=this.resume(),D=this.stack[this.stack.length-1];D.label=le,D.identifier=zl(this.sliceSerialize(Y)).toLowerCase(),this.data.referenceType="full"}function ve(Y){this.data.characterReferenceType=Y.type}function X(Y){const le=this.sliceSerialize(Y),D=this.data.characterReferenceType;let de;D?(de=gT(le,D==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):de=Fx(le);const me=this.stack[this.stack.length-1];me.value+=de}function oe(Y){const le=this.stack.pop();le.position.end=la(Y.end)}function fe(Y){A.call(this,Y);const le=this.stack[this.stack.length-1];le.url=this.sliceSerialize(Y)}function te(Y){A.call(this,Y);const le=this.stack[this.stack.length-1];le.url="mailto:"+this.sliceSerialize(Y)}function Z(){return{type:"blockquote",children:[]}}function se(){return{type:"code",lang:null,meta:null,value:""}}function re(){return{type:"inlineCode",value:""}}function Oe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ne(){return{type:"emphasis",children:[]}}function _e(){return{type:"heading",depth:0,children:[]}}function Re(){return{type:"break"}}function Fe(){return{type:"html",value:""}}function rt(){return{type:"image",title:null,url:"",alt:null}}function Be(){return{type:"link",title:null,url:"",children:[]}}function qe(Y){return{type:"list",ordered:Y.type==="listOrdered",start:null,spread:Y._spread,children:[]}}function ye(Y){return{type:"listItem",spread:Y._spread,checked:null,children:[]}}function Ee(){return{type:"paragraph",children:[]}}function ze(){return{type:"strong",children:[]}}function ht(){return{type:"text",value:""}}function ee(){return{type:"thematicBreak"}}}function la(e){return{line:e.line,column:e.column,offset:e.offset}}function ET(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?ET(e,r):r3(e,r)}}function r3(e,t){let n;for(n in t)if(PT.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function ij(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+pc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+pc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+pc({start:t.start,end:t.end})+") is still open")}function i3(e){const t=this;t.parser=n;function n(r){return t3(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function a3(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function o3(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
71
+ `}]}function l3(e,t){const n=t.value?t.value+`
72
+ `:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(t,a),a}function s3(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function c3(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function u3(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=ms(r.toLowerCase()),a=e.footnoteOrder.indexOf(r);let l,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),l=e.footnoteOrder.length):l=a+1,s+=1,e.footnoteCounts.set(r,s);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function d3(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function f3(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function TT(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),a=i[0];a&&a.type==="text"?a.value="["+a.value:i.unshift({type:"text",value:"["});const l=i[i.length-1];return l&&l.type==="text"?l.value+=r:i.push({type:"text",value:r}),i}function p3(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return TT(e,t);const i={src:ms(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const a={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function h3(e,t){const n={src:ms(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function m3(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function g3(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return TT(e,t);const i={href:ms(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const a={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function v3(e,t){const n={href:ms(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function y3(e,t,n){const r=e.all(t),i=n?x3(n):OT(t),a={},l=[];if(typeof t.checked=="boolean"){const f=r[0];let d;f&&f.type==="element"&&f.tagName==="p"?d=f:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let s=-1;for(;++s<r.length;){const f=r[s];(i||s!==0||f.type!=="element"||f.tagName!=="p")&&l.push({type:"text",value:`
73
+ `}),f.type==="element"&&f.tagName==="p"&&!i?l.push(...f.children):l.push(f)}const c=r[r.length-1];c&&(i||c.type!=="element"||c.tagName!=="p")&&l.push({type:"text",value:`
74
+ `});const u={type:"element",tagName:"li",properties:a,children:l};return e.patch(t,u),e.applyData(t,u)}function x3(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=OT(n[r])}return t}function OT(e){const t=e.spread;return t??e.children.length>1}function b3(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const l=r[i];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const a={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function w3(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function j3(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function S3(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function k3(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),i.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},s=Lx(t.children[1]),c=cT(t.children[t.children.length-1]);s&&c&&(l.position={start:s,end:c}),i.push(l)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function C3(e,t,n){const r=n?n.children:void 0,a=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,s=l?l.length:t.children.length;let c=-1;const u=[];for(;++c<s;){const d=t.children[c],p={},m=l?l[c]:void 0;m&&(p.align=m);let g={type:"element",tagName:a,properties:p,children:[]};d&&(g.children=e.all(d),e.patch(d,g),g=e.applyData(d,g)),u.push(g)}const f={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,f),e.applyData(t,f)}function P3(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const aj=9,oj=32;function E3(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const a=[];for(;r;)a.push(lj(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(lj(t.slice(i),i>0,!1)),a.join("")}function lj(e,t,n){let r=0,i=e.length;if(t){let a=e.codePointAt(r);for(;a===aj||a===oj;)r++,a=e.codePointAt(r)}if(n){let a=e.codePointAt(i-1);for(;a===aj||a===oj;)i--,a=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function T3(e,t){const n={type:"text",value:E3(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function O3(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const A3={blockquote:a3,break:o3,code:l3,delete:s3,emphasis:c3,footnoteReference:u3,heading:d3,html:f3,imageReference:p3,image:h3,inlineCode:m3,linkReference:g3,link:v3,listItem:y3,list:b3,paragraph:w3,root:j3,strong:S3,table:k3,tableCell:P3,tableRow:C3,text:T3,thematicBreak:O3,toml:ld,yaml:ld,definition:ld,footnoteDefinition:ld};function ld(){}const AT=-1,Xp=0,mc=1,kf=2,Kx=3,Hx=4,Vx=5,qx=6,IT=7,NT=8,I3=typeof self=="object"?self:globalThis,sj=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new I3[e](t)},N3=(e,t)=>{const n=(i,a)=>(e.set(a,i),i),r=i=>{if(e.has(i))return e.get(i);const[a,l]=t[i];switch(a){case Xp:case AT:return n(l,i);case mc:{const s=n([],i);for(const c of l)s.push(r(c));return s}case kf:{const s=n({},i);for(const[c,u]of l)s[r(c)]=r(u);return s}case Kx:return n(new Date(l),i);case Hx:{const{source:s,flags:c}=l;return n(new RegExp(s,c),i)}case Vx:{const s=n(new Map,i);for(const[c,u]of l)s.set(r(c),r(u));return s}case qx:{const s=n(new Set,i);for(const c of l)s.add(r(c));return s}case IT:{const{name:s,message:c}=l;return n(sj(s,c),i)}case NT:return n(BigInt(l),i);case"BigInt":return n(Object(BigInt(l)),i);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:s}=new Uint8Array(l);return n(new DataView(s),l)}}return n(sj(a,l),i)};return r},cj=e=>N3(new Map,e)(0),nl="",{toString:_3}={},{keys:M3}=Object,zs=e=>{const t=typeof e;if(t!=="object"||!e)return[Xp,t];const n=_3.call(e).slice(8,-1);switch(n){case"Array":return[mc,nl];case"Object":return[kf,nl];case"Date":return[Kx,nl];case"RegExp":return[Hx,nl];case"Map":return[Vx,nl];case"Set":return[qx,nl];case"DataView":return[mc,n]}return n.includes("Array")?[mc,n]:n.includes("Error")?[IT,n]:[kf,n]},sd=([e,t])=>e===Xp&&(t==="function"||t==="symbol"),R3=(e,t,n,r)=>{const i=(l,s)=>{const c=r.push(l)-1;return n.set(s,c),c},a=l=>{if(n.has(l))return n.get(l);let[s,c]=zs(l);switch(s){case Xp:{let f=l;switch(c){case"bigint":s=NT,f=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);f=null;break;case"undefined":return i([AT],l)}return i([s,f],l)}case mc:{if(c){let p=l;return c==="DataView"?p=new Uint8Array(l.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(l)),i([c,[...p]],l)}const f=[],d=i([s,f],l);for(const p of l)f.push(a(p));return d}case kf:{if(c)switch(c){case"BigInt":return i([c,l.toString()],l);case"Boolean":case"Number":case"String":return i([c,l.valueOf()],l)}if(t&&"toJSON"in l)return a(l.toJSON());const f=[],d=i([s,f],l);for(const p of M3(l))(e||!sd(zs(l[p])))&&f.push([a(p),a(l[p])]);return d}case Kx:return i([s,l.toISOString()],l);case Hx:{const{source:f,flags:d}=l;return i([s,{source:f,flags:d}],l)}case Vx:{const f=[],d=i([s,f],l);for(const[p,m]of l)(e||!(sd(zs(p))||sd(zs(m))))&&f.push([a(p),a(m)]);return d}case qx:{const f=[],d=i([s,f],l);for(const p of l)(e||!sd(zs(p)))&&f.push(a(p));return d}}const{message:u}=l;return i([s,{name:c,message:u}],l)};return a},uj=(e,{json:t,lossy:n}={})=>{const r=[];return R3(!(t||n),!!t,new Map,r)(e),r},Cf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?cj(uj(e,t)):structuredClone(e):(e,t)=>cj(uj(e,t));function D3(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function L3(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function z3(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||D3,r=e.options.footnoteBackLabel||L3,i=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const f=e.all(u),d=String(u.identifier).toUpperCase(),p=ms(d.toLowerCase());let m=0;const g=[],y=e.footnoteCounts.get(d);for(;y!==void 0&&++m<=y;){g.length>0&&g.push({type:"text",value:" "});let b=typeof n=="string"?n:n(c,m);typeof b=="string"&&(b={type:"text",value:b}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,m),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const x=f[f.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const b=x.children[x.children.length-1];b&&b.type==="text"?b.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...g)}else f.push(...g);const v={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(f,!0)};e.patch(u,v),s.push(v)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Cf(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
75
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:`
76
+ `}]}}const _T=function(e){if(e==null)return U3;if(typeof e=="function")return Qp(e);if(typeof e=="object")return Array.isArray(e)?$3(e):B3(e);if(typeof e=="string")return F3(e);throw new Error("Expected function, string, or object as test")};function $3(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=_T(e[n]);return Qp(r);function r(...i){let a=-1;for(;++a<t.length;)if(t[a].apply(this,i))return!0;return!1}}function B3(e){const t=e;return Qp(n);function n(r){const i=r;let a;for(a in e)if(i[a]!==t[a])return!1;return!0}}function F3(e){return Qp(t);function t(n){return n&&n.type===e}}function Qp(e){return t;function t(n,r,i){return!!(W3(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function U3(){return!0}function W3(e){return e!==null&&typeof e=="object"&&"type"in e}const MT=[],K3=!0,dj=!1,H3="skip";function V3(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const a=_T(i),l=r?-1:1;s(e,void 0,[])();function s(c,u,f){const d=c&&typeof c=="object"?c:{};if(typeof d.type=="string"){const m=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(m?"<"+m+">":""))+")"})}return p;function p(){let m=MT,g,y,x;if((!t||a(c,u,f[f.length-1]||void 0))&&(m=q3(n(c,f)),m[0]===dj))return m;if("children"in c&&c.children){const v=c;if(v.children&&m[0]!==H3)for(y=(r?v.children.length:-1)+l,x=f.concat(v);y>-1&&y<v.children.length;){const b=v.children[y];if(g=s(b,y,x)(),g[0]===dj)return g;y=typeof g[1]=="number"?g[1]:y+l}}return m}}}function q3(e){return Array.isArray(e)?e:typeof e=="number"?[K3,e]:e==null?MT:[e]}function RT(e,t,n,r){let i,a,l;typeof t=="function"&&typeof n!="function"?(a=void 0,l=t,i=n):(a=t,l=n,i=r),V3(e,a,s,i);function s(c,u){const f=u[u.length-1],d=f?f.children.indexOf(c):void 0;return l(c,d,f)}}const Ev={}.hasOwnProperty,Y3={};function G3(e,t){const n=t||Y3,r=new Map,i=new Map,a=new Map,l={...A3,...n.handlers},s={all:u,applyData:Q3,definitionById:r,footnoteById:i,footnoteCounts:a,footnoteOrder:[],handlers:l,one:c,options:n,patch:X3,wrap:Z3};return RT(e,function(f){if(f.type==="definition"||f.type==="footnoteDefinition"){const d=f.type==="definition"?r:i,p=String(f.identifier).toUpperCase();d.has(p)||d.set(p,f)}}),s;function c(f,d){const p=f.type,m=s.handlers[p];if(Ev.call(s.handlers,p)&&m)return m(s,f,d);if(s.options.passThrough&&s.options.passThrough.includes(p)){if("children"in f){const{children:y,...x}=f,v=Cf(x);return v.children=s.all(f),v}return Cf(f)}return(s.options.unknownHandler||J3)(s,f,d)}function u(f){const d=[];if("children"in f){const p=f.children;let m=-1;for(;++m<p.length;){const g=s.one(p[m],f);if(g){if(m&&p[m-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=fj(g.value)),!Array.isArray(g)&&g.type==="element")){const y=g.children[0];y&&y.type==="text"&&(y.value=fj(y.value))}Array.isArray(g)?d.push(...g):d.push(g)}}}return d}}function X3(e,t){e.position&&(t.position=N4(e))}function Q3(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,a=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&a&&Object.assign(n.properties,Cf(a)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function J3(e,t){const n=t.data||{},r="value"in t&&!(Ev.call(n,"hProperties")||Ev.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Z3(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
77
+ `});++r<e.length;)r&&n.push({type:"text",value:`
78
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
79
+ `}),n}function fj(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function pj(e,t){const n=G3(e,t),r=n.one(e,void 0),i=z3(n),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&a.children.push({type:"text",value:`
80
+ `},i),a}function eB(e,t){return e&&"run"in e?async function(n,r){const i=pj(n,{file:r,...t});await e.run(i,r)}:function(n,r){return pj(n,{file:r,...e||t})}}function hj(e){if(e)throw e}var Hd=Object.prototype.hasOwnProperty,DT=Object.prototype.toString,mj=Object.defineProperty,gj=Object.getOwnPropertyDescriptor,vj=function(t){return typeof Array.isArray=="function"?Array.isArray(t):DT.call(t)==="[object Array]"},yj=function(t){if(!t||DT.call(t)!=="[object Object]")return!1;var n=Hd.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Hd.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Hd.call(t,i)},xj=function(t,n){mj&&n.name==="__proto__"?mj(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},bj=function(t,n){if(n==="__proto__")if(Hd.call(t,n)){if(gj)return gj(t,n).value}else return;return t[n]},tB=function e(){var t,n,r,i,a,l,s=arguments[0],c=1,u=arguments.length,f=!1;for(typeof s=="boolean"&&(f=s,s=arguments[1]||{},c=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)r=bj(s,n),i=bj(t,n),s!==i&&(f&&i&&(yj(i)||(a=vj(i)))?(a?(a=!1,l=r&&vj(r)?r:[]):l=r&&yj(r)?r:{},xj(s,{name:n,newValue:e(f,l,i)})):typeof i<"u"&&xj(s,{name:n,newValue:i}));return s};const Lm=ss(tB);function Tv(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function nB(){const e=[],t={run:n,use:r};return t;function n(...i){let a=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);s(null,...i);function s(c,...u){const f=e[++a];let d=-1;if(c){l(c);return}for(;++d<i.length;)(u[d]===null||u[d]===void 0)&&(u[d]=i[d]);i=u,f?rB(f,s)(...u):l(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function rB(e,t){let n;return r;function r(...l){const s=e.length>l.length;let c;s&&l.push(i);try{c=e.apply(this,l)}catch(u){const f=u;if(s&&n)throw f;return i(f)}s||(c&&c.then&&typeof c.then=="function"?c.then(a,i):c instanceof Error?i(c):a(c))}function i(l,...s){n||(n=!0,t(l,...s))}function a(l){i(null,l)}}const ci={basename:iB,dirname:aB,extname:oB,join:lB,sep:"/"};function iB(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');uu(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else l<0&&(a=!0,l=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function aB(e){if(uu(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function oB(e){uu(e);let t=e.length,n=-1,r=0,i=-1,a=0,l;for(;t--;){const s=e.codePointAt(t);if(s===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function lB(...e){let t=-1,n;for(;++t<e.length;)uu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":sB(n)}function sB(e){uu(e);const t=e.codePointAt(0)===47;let n=cB(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function cB(e,t){let n="",r=0,i=-1,a=0,l=-1,s,c;for(;++l<=e.length;){if(l<e.length)s=e.codePointAt(l);else{if(s===47)break;s=47}if(s===47){if(!(i===l-1||a===1))if(i!==l-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),i=l,a=0;continue}}else if(n.length>0){n="",r=0,i=l,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,l):n=e.slice(i+1,l),r=l-i-1;i=l,a=0}else s===46&&a>-1?a++:a=-1}return n}function uu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const uB={cwd:dB};function dB(){return"/"}function Ov(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function fB(e){if(typeof e=="string")e=new URL(e);else if(!Ov(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return pB(e)}function pB(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const zm=["history","path","basename","stem","extname","dirname"];class LT{constructor(t){let n;t?Ov(t)?n={path:t}:typeof t=="string"||hB(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":uB.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<zm.length;){const a=zm[r];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let i;for(i in n)zm.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?ci.basename(this.path):void 0}set basename(t){Bm(t,"basename"),$m(t,"basename"),this.path=ci.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ci.dirname(this.path):void 0}set dirname(t){wj(this.basename,"dirname"),this.path=ci.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ci.extname(this.path):void 0}set extname(t){if($m(t,"extname"),wj(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ci.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ov(t)&&(t=fB(t)),Bm(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ci.basename(this.path,this.extname):void 0}set stem(t){Bm(t,"stem"),$m(t,"stem"),this.path=ci.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Rn(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function $m(e,t){if(e&&e.includes(ci.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ci.sep+"`")}function Bm(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function wj(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function hB(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const mB=function(e){const r=this.constructor.prototype,i=r[e],a=function(){return i.apply(a,arguments)};return Object.setPrototypeOf(a,r),a},gB={}.hasOwnProperty;class Yx extends mB{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=nB()}copy(){const t=new Yx;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Lm(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Wm("data",this.frozen),this.namespace[t]=n,this):gB.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Wm("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=cd(t),r=this.parser||this.Parser;return Fm("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Fm("process",this.parser||this.Parser),Um("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(a,l){const s=cd(t),c=r.parse(s);r.run(c,s,function(f,d,p){if(f||!d||!p)return u(f);const m=d,g=r.stringify(m,p);xB(g)?p.value=g:p.result=g,u(f,p)});function u(f,d){f||!d?l(f):a?a(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),Fm("processSync",this.parser||this.Parser),Um("processSync",this.compiler||this.Compiler),this.process(t,i),Sj("processSync","process",n),r;function i(a,l){n=!0,hj(a),r=l}}run(t,n,r){jj(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?a(void 0,r):new Promise(a);function a(l,s){const c=cd(n);i.run(t,c,u);function u(f,d,p){const m=d||t;f?s(f):l?l(m):r(void 0,m,p)}}}runSync(t,n){let r=!1,i;return this.run(t,n,a),Sj("runSync","run",r),i;function a(l,s){hj(l),i=s,r=!0}}stringify(t,n){this.freeze();const r=cd(n),i=this.compiler||this.Compiler;return Um("stringify",i),jj(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Wm("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?s(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[f,...d]=u;c(f,d)}else l(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function l(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(u.plugins),u.settings&&(i.settings=Lm(!0,i.settings,u.settings))}function s(u){let f=-1;if(u!=null)if(Array.isArray(u))for(;++f<u.length;){const d=u[f];a(d)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,f){let d=-1,p=-1;for(;++d<r.length;)if(r[d][0]===u){p=d;break}if(p===-1)r.push([u,...f]);else if(f.length>0){let[m,...g]=f;const y=r[p][1];Tv(y)&&Tv(m)&&(m=Lm(!0,y,m)),r[p]=[u,m,...g]}}}}const vB=new Yx().freeze();function Fm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Um(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Wm(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function jj(e){if(!Tv(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Sj(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function cd(e){return yB(e)?e:new LT(e)}function yB(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function xB(e){return typeof e=="string"||bB(e)}function bB(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const wB="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",kj=[],Cj={allowDangerousHtml:!0},jB=/^(https?|ircs?|mailto|xmpp)$/i,SB=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function gc(e){const t=kB(e),n=CB(e);return PB(t.runSync(t.parse(n),n),e)}function kB(e){const t=e.rehypePlugins||kj,n=e.remarkPlugins||kj,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Cj}:Cj;return vB().use(i3).use(n).use(eB,r).use(t)}function CB(e){const t=e.children||"",n=new LT;return typeof t=="string"&&(n.value=t),n}function PB(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,l=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||EB;for(const f of SB)Object.hasOwn(t,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+wB+f.id,void 0);return RT(e,u),L4(e,{Fragment:o.Fragment,components:i,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function u(f,d,p){if(f.type==="raw"&&p&&typeof d=="number")return l?p.children.splice(d,1):p.children[d]={type:"text",value:f.value},d;if(f.type==="element"){let m;for(m in Mm)if(Object.hasOwn(Mm,m)&&Object.hasOwn(f.properties,m)){const g=f.properties[m],y=Mm[m];(y===null||y.includes(f.tagName))&&(f.properties[m]=c(String(g||""),m,f))}}if(f.type==="element"){let m=n?!n.includes(f.tagName):a?a.includes(f.tagName):!1;if(!m&&r&&typeof d=="number"&&(m=!r(f,d,p)),m&&p&&typeof d=="number")return s&&f.children?p.children.splice(d,1,...f.children):p.children.splice(d,1),d}}}function EB(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||jB.test(e.slice(0,t))?e:""}const ie=(e,t)=>{if(!t)return e;const n=new URLSearchParams;Object.entries(t).forEach(([i,a])=>{a!=null&&a!==""&&n.set(i,String(a))});const r=n.toString();return r?`${e}?${r}`:e},ae=async(e,t={})=>{const n=localStorage.getItem("auth_token"),r=await fetch(e,{...t,headers:{"Content-Type":"application/json",...n?{"Access-Token":n}:{},...t.headers||{}}});if(!r.ok){if(r.status===401){localStorage.removeItem("auth_token");const s=await r.text(),c=new Error(s||r.statusText);throw c.status=401,c}const a=await r.text();let l=null;try{const s=JSON.parse(a);s.error&&(l=s.error)}catch{}throw new Error(l||a||r.statusText)}return r.status===204?void 0:(r.headers.get("content-type")||"").includes("application/json")?r.json():r.text()},V={getAuthStatus:()=>ae(ie("/api/auth/status")),login:e=>ae(ie("/api/auth/login"),{method:"POST",body:JSON.stringify({authCode:e})}),checkVersion:()=>ae(ie("/api/version/check")),getVendors:()=>ae(ie("/api/vendors")),createVendor:e=>ae(ie("/api/vendors"),{method:"POST",body:JSON.stringify(e)}),updateVendor:(e,t)=>ae(ie(`/api/vendors/${e}`),{method:"PUT",body:JSON.stringify(t)}),deleteVendor:e=>ae(ie(`/api/vendors/${e}`),{method:"DELETE"}),getAPIServices:e=>ae(ie("/api/services",e?{vendorId:e}:void 0)),createAPIService:e=>ae(ie("/api/services"),{method:"POST",body:JSON.stringify(e)}),updateAPIService:(e,t)=>ae(ie(`/api/services/${e}`),{method:"PUT",body:JSON.stringify(t)}),deleteAPIService:e=>ae(ie(`/api/services/${e}`),{method:"DELETE"}),getRoutes:()=>ae(ie("/api/routes")),createRoute:e=>ae(ie("/api/routes"),{method:"POST",body:JSON.stringify(e)}),updateRoute:(e,t)=>ae(ie(`/api/routes/${e}`),{method:"PUT",body:JSON.stringify(t)}),deleteRoute:e=>ae(ie(`/api/routes/${e}`),{method:"DELETE"}),getToolBindings:()=>ae(ie("/api/tool-bindings")),activateToolRoute:(e,t)=>ae(ie("/api/tool-bindings/activate"),{method:"POST",body:JSON.stringify({tool:e,routeId:t})}),deactivateToolRoute:e=>ae(ie("/api/tool-bindings/deactivate"),{method:"POST",body:JSON.stringify({tool:e})}),getRules:e=>ae(ie("/api/rules",e?{routeId:e}:void 0)),createRule:e=>ae(ie("/api/rules"),{method:"POST",body:JSON.stringify(e)}),updateRule:(e,t)=>ae(ie(`/api/rules/${e}`),{method:"PUT",body:JSON.stringify(t)}),deleteRule:e=>ae(ie(`/api/rules/${e}`),{method:"DELETE"}),resetRuleTokens:e=>ae(ie(`/api/rules/${e}/reset-tokens`),{method:"PUT"}),resetRuleRequests:e=>ae(ie(`/api/rules/${e}/reset-requests`),{method:"PUT"}),clearRuleBlacklist:e=>ae(ie(`/api/rules/${e}/clear-blacklist`),{method:"PUT"}),toggleRuleDisable:e=>ae(ie(`/api/rules/${e}/toggle-disable`),{method:"PUT"}),clearRuleStatus:e=>ae(ie(`/api/rules/${e}/clear-status`),{method:"POST"}),getRuleStatuses:()=>ae(ie("/api/rules/status")),getRulesBlacklistStatus:e=>ae(ie(`/api/rules/${e}/blacklist-status`)),getLogs:(e,t)=>ae(ie("/api/logs",{limit:e,offset:t})),clearLogs:()=>ae(ie("/api/logs"),{method:"DELETE"}),getErrorLogs:(e,t)=>ae(ie("/api/error-logs",{limit:e,offset:t})),clearErrorLogs:()=>ae(ie("/api/error-logs"),{method:"DELETE"}),getLogsCount:()=>ae(ie("/api/logs/count")),getErrorLogsCount:()=>ae(ie("/api/error-logs/count")),searchLogs:(e,t,n)=>ae(ie("/api/logs/search",{query:e,limit:t,offset:n})),searchLogsCount:e=>ae(ie("/api/logs/search/count",{query:e})),searchErrorLogs:(e,t,n)=>ae(ie("/api/error-logs/search",{query:e,limit:t,offset:n})),searchErrorLogsCount:e=>ae(ie("/api/error-logs/search/count",{query:e})),getStatistics:(e=30)=>ae(ie("/api/statistics",{days:e})),resetStatistics:()=>ae(ie("/api/statistics"),{method:"DELETE"}),getPerformanceServicesOverview:()=>ae(ie("/api/performance/services-overview")),getPerformanceVendors:()=>ae(ie("/api/performance/vendors")),getPerformanceVendor:e=>ae(ie(`/api/performance/vendors/${e}`)),getPerformanceService:e=>ae(ie(`/api/performance/services/${e}`)),getPerformanceModel:(e,t)=>ae(ie(`/api/performance/services/${e}/models/${encodeURIComponent(t)}`)),getConfig:()=>ae(ie("/api/config")),updateConfig:e=>ae(ie("/api/config"),{method:"PUT",body:JSON.stringify(e)}),exportData:async e=>(await ae(ie("/api/export"),{method:"POST",body:JSON.stringify({password:e})})).data,previewImportData:(e,t)=>ae(ie("/api/import/preview"),{method:"POST",body:JSON.stringify({encryptedData:e,password:t})}),importData:(e,t)=>ae(ie("/api/import"),{method:"POST",body:JSON.stringify({encryptedData:e,password:t})}),writeClaudeConfig:(e,t,n)=>ae(ie("/api/write-config/claude"),{method:"POST",body:JSON.stringify({enableAgentTeams:e,enableBypassPermissionsSupport:t,permissionsDefaultMode:n})}),writeCodexConfig:e=>ae(ie("/api/write-config/codex"),{method:"POST",body:JSON.stringify({modelReasoningEffort:e})}),restoreClaudeConfig:()=>ae(ie("/api/restore-config/claude"),{method:"POST"}),restoreCodexConfig:()=>ae(ie("/api/restore-config/codex"),{method:"POST"}),updateClaudeAgentTeams:e=>ae(ie("/api/update-claude-agent-teams"),{method:"POST",body:JSON.stringify({enableAgentTeams:e})}),updateClaudeBypassPermissionsSupport:e=>ae(ie("/api/update-claude-bypass-permissions-support"),{method:"POST",body:JSON.stringify({enableBypassPermissionsSupport:e})}),updateCodexReasoningEffort:e=>ae(ie("/api/update-codex-reasoning-effort"),{method:"POST",body:JSON.stringify({modelReasoningEffort:e})}),checkClaudeBackup:()=>ae(ie("/api/check-backup/claude")),checkCodexBackup:()=>ae(ie("/api/check-backup/codex")),checkClaudeVersion:()=>ae(ie("/api/tools/status")),getClaudeConfigStatus:()=>ae(ie("/api/config-status/claude")),getCodexConfigStatus:()=>ae(ie("/api/config-status/codex")),getSessions:(e,t)=>ae(ie("/api/sessions",{limit:e,offset:t})),getSessionsCount:()=>ae(ie("/api/sessions/count")),getSession:e=>ae(ie(`/api/sessions/${e}`)),getSessionLogs:(e,t)=>ae(ie(`/api/sessions/${e}/logs`,{limit:t})),deleteSession:e=>ae(ie(`/api/sessions/${e}`),{method:"DELETE"}),clearSessions:()=>ae(ie("/api/sessions"),{method:"DELETE"}),cleanupSessions:(e,t)=>ae(ie("/api/sessions/cleanup"),{method:"POST",body:JSON.stringify({beforeDays:e,onlyLogs:t})}),getRecommendVendorsMarkdown:()=>ae(ie("/api/docs/recommend-vendors")),getReadmeMarkdown:()=>ae(ie("/api/docs/readme")),getInstalledSkills:()=>ae(ie("/api/skills/installed")),searchSkills:e=>ae(ie("/api/skills/search"),{method:"POST",body:JSON.stringify({query:e})}),getSkillDetails:e=>ae(ie(`/api/skills/${e}/details`)),installSkill:(e,t)=>ae(ie("/api/skills/install"),{method:"POST",body:JSON.stringify({skillId:e.id,name:e.name,description:e.description,tags:e.tags,...t?{targetType:t}:{},githubUrl:e.url})}),enableSkill:(e,t)=>ae(ie(`/api/skills/${e}/enable`),{method:"POST",body:JSON.stringify({targetType:t})}),disableSkill:(e,t)=>ae(ie(`/api/skills/${e}/disable`),{method:"POST",body:JSON.stringify({targetType:t})}),deleteSkill:e=>ae(ie(`/api/skills/${e}`),{method:"DELETE"}),createLocalSkill:e=>ae(ie("/api/skills/create-local"),{method:"POST",body:JSON.stringify(e)}),getUpgradeMarkdown:()=>ae(ie("/api/docs/upgrade")),getUpgrade:()=>ae(ie("/api/upgrade")),acknowledgeUpgrade:()=>ae(ie("/api/upgrade/ack"),{method:"POST"}),getToolsStatus:()=>ae(ie("/api/tools/status")),getMCPs:()=>ae(ie("/api/mcps")),getMCP:e=>ae(ie(`/api/mcps/${e}`)),createMCP:e=>ae(ie("/api/mcps"),{method:"POST",body:JSON.stringify(e)}),updateMCP:(e,t)=>ae(ie(`/api/mcps/${e}`),{method:"PUT",body:JSON.stringify(t)}),deleteMCP:e=>ae(ie(`/api/mcps/${e}`),{method:"DELETE"}),bindSessionRoute:(e,t)=>ae(ie(`/api/sessions/${e}/bind-route`),{method:"PUT",body:JSON.stringify({routeId:t})}),unbindSessionRoute:e=>ae(ie(`/api/sessions/${e}/bind-route`),{method:"DELETE"}),getBoundSessions:e=>ae(ie(`/api/routes/${e}/bound-sessions`)),migrationPreview:(e,t)=>ae(ie(`/api/sessions/${e}/migration-preview`),{method:"POST",body:JSON.stringify(t)}),migrateSession:(e,t)=>ae(ie(`/api/sessions/${e}/migrate`),{method:"POST",body:JSON.stringify(t)}),migrateLaunch:(e,t)=>ae(ie(`/api/sessions/${e}/migrate-launch`),{method:"POST",body:JSON.stringify(t)}),getApiPathBindings:()=>ae(ie("/api/api-path-bindings")),updateApiPathBindings:(e,t)=>ae(ie("/api/api-path-bindings"),{method:"PUT",body:JSON.stringify({bindings:e,models:t})}),installTool:(e,t)=>{var u;console.log("[API Client] 开始安装工具:",e);const n=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host,i=`${n}//${r}/api/tools/install`;console.log("[API Client] 连接 WebSocket:",i);let a=null;try{a=new WebSocket(i)}catch(f){return console.error("[API Client] 创建 WebSocket 失败:",f),(u=t.onError)==null||u.call(t,"创建 WebSocket 连接失败"),()=>{}}a.onopen=()=>{console.log("[API Client] WebSocket 连接已建立"),a==null||a.send(JSON.stringify({type:"install",tool:e}))},a.onmessage=f=>{var d,p,m,g,y,x,v,b,w;try{const S=JSON.parse(f.data);switch(console.log("[API Client] 收到消息:",S.type),S.type){case"start":console.log("[API Client] 安装开始:",S.data),(d=t.onStdout)==null||d.call(t,`
81
+ ========== 开始安装 ${S.data.tool} ==========
82
+ `),(p=t.onStdout)==null||p.call(t,`操作系统: ${S.data.os}
83
+ `),(m=t.onStdout)==null||m.call(t,`执行命令: ${S.data.command}
84
+ `),(g=t.onStdout)==null||g.call(t,`子进程已创建 (PID: ${S.data.pid})
85
+ `),(y=t.onStdout)==null||y.call(t,`等待 npm 输出...
86
+
87
+ `);break;case"stdout":(x=t.onStdout)==null||x.call(t,S.data);break;case"stderr":(v=t.onStderr)==null||v.call(t,S.data);break;case"close":console.log("[API Client] 安装完成:",S.data),(b=t.onClose)==null||b.call(t,S.data.code,S.data.success),setTimeout(()=>{a==null||a.close()},1e3);break;case"error":console.error("[API Client] 安装错误:",S.data),(w=t.onError)==null||w.call(t,S.data);break}}catch(S){console.error("[API Client] 解析消息失败:",S,f.data)}},a.onclose=f=>{var d;console.log("[API Client] WebSocket 连接关闭:",f.code,f.reason),f.wasClean||(d=t.onError)==null||d.call(t,"连接意外关闭")},a.onerror=f=>{var d;console.error("[API Client] WebSocket 错误:",f),(d=t.onError)==null||d.call(t,"WebSocket 连接错误")};const l=()=>{console.log("[API Client] 清理 WebSocket 连接"),a&&(a.close(),a=null)},s=f=>{a&&a.readyState===WebSocket.OPEN?(a.send(JSON.stringify({type:"input",data:f})),console.log("[API Client] 发送输入:",f.slice(0,10))):console.warn("[API Client] WebSocket 未连接,无法发送输入")},c=l;return c.sendInput=s,c},getAccessKeys:e=>ae(ie("/api/access-keys",e)),createAccessKey:e=>ae(ie("/api/access-keys"),{method:"POST",body:JSON.stringify(e)}),getAccessKey:e=>ae(ie(`/api/access-keys/${e}`)),updateAccessKey:(e,t)=>ae(ie(`/api/access-keys/${e}`),{method:"PUT",body:JSON.stringify(t)}),deleteAccessKey:e=>ae(ie(`/api/access-keys/${e}`),{method:"DELETE"}),regenerateAccessKey:e=>ae(ie(`/api/access-keys/${e}/regenerate`),{method:"POST"}),batchUpdateAccessKeyStatus:(e,t)=>ae(ie("/api/access-keys/batch/status"),{method:"PUT",body:JSON.stringify({keyIds:e,status:t})}),batchBindAccessKeyPolicy:(e,t)=>ae(ie("/api/access-keys/batch/policy"),{method:"PUT",body:JSON.stringify({keyIds:e,policyId:t})}),batchDeleteAccessKeys:e=>ae(ie("/api/access-keys/batch"),{method:"DELETE",body:JSON.stringify({keyIds:e})}),getAccessKeyUsage:e=>ae(ie(`/api/access-keys/${e}/usage`)),getAccessKeyUsageTrend:(e,t)=>ae(ie(`/api/access-keys/${e}/usage/trend`,{days:t})),getAccessKeyLogs:(e,t)=>ae(ie(`/api/access-keys/${e}/logs`,t)),getAccessKeySessions:(e,t)=>ae(ie(`/api/access-keys/${e}/sessions`,t)),getAccessKeySession:(e,t)=>ae(ie(`/api/access-keys/${e}/sessions/${t}`)),getAccessKeySessionLogs:(e,t,n)=>ae(ie(`/api/access-keys/${e}/sessions/${t}/logs`,{limit:n})),deleteAccessKeySession:(e,t)=>ae(ie(`/api/access-keys/${e}/sessions/${t}`),{method:"DELETE"}),clearAccessKeySessions:e=>ae(ie(`/api/access-keys/${e}/sessions`),{method:"DELETE"}),getAccessKeyGuide:(e,t,n)=>ae(ie(`/api/access-keys/${e}/guide`,{host:t,port:n})),writeAccessKeyToLocal:(e,t)=>ae(ie(`/api/access-keys/${e}/write-local`),{method:"POST",body:JSON.stringify({targets:t})}),getWriteLocalRecords:()=>ae(ie("/api/write-local-records")),getPolicies:()=>ae(ie("/api/policies")),createPolicy:e=>ae(ie("/api/policies"),{method:"POST",body:JSON.stringify(e)}),getPolicy:e=>ae(ie(`/api/policies/${e}`)),updatePolicy:(e,t)=>ae(ie(`/api/policies/${e}`),{method:"PUT",body:JSON.stringify(t)}),deletePolicy:e=>ae(ie(`/api/policies/${e}`),{method:"DELETE"}),duplicatePolicy:e=>ae(ie(`/api/policies/${e}/duplicate`),{method:"POST"}),getPolicyKeys:e=>ae(ie(`/api/policies/${e}/keys`)),getPolicyTemplates:()=>ae(ie("/api/policies/templates")),getAccessKeyRanking:e=>ae(ie("/api/statistics/access-keys",e)),getQuotaAlerts:()=>ae(ie("/api/statistics/quota-alerts")),lanScan:()=>ae(ie("/api/lan/scan")),lanDiscover:(e,t)=>{const n=`http://${e}:${t}/api/lan/discover`;return fetch(n,{signal:AbortSignal.timeout(3e3)}).then(r=>{if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.json()})},lanSync:e=>ae(ie("/api/lan/sync"),{method:"POST",body:JSON.stringify(e)})};var et=(e=>(e.AUTH_TOKEN="authorization",e.API_KEY="x-api-key",e.G_API_KEY="x-goog-api-key",e))(et||{});const Tn={aicodingbus:{name:"AICodingBus",description:"AICodingBus 是一个Token共享平台,用户可以在平台上分享和交换Token。",tags:["官方推荐"],link:"https://aicodingbus.24x7.to/",apiBaseUrl:"https://aicodingbus.24x7.to",authType:et.AUTH_TOKEN,services:[{name:"Claude 标准接口",sourceType:"claude",apiUrl:"https://aicodingbus.24x7.to",models:""},{name:"Chat Completions 标准接口",sourceType:"openai-chat",apiUrl:"https://aicodingbus.24x7.to/v1/chat/completions",models:""},{name:"Responses 标准接口",sourceType:"openai",apiUrl:"https://aicodingbus.24x7.to",models:""}],sortedGroup:-1},minimax:{name:"Minimax",description:"国内优秀的大模型",link:"https://platform.minimaxi.com/subscribe/coding-plan?code=G6xKj7L4YN&source=link",authType:et.AUTH_TOKEN,services:[{name:"Claude 标准接口 | Coding Plan",sourceType:"claude",apiUrl:"https://api.minimaxi.com/anthropic",models:"MiniMax-M2.5, MiniMax-M2.7"},{name:"Chat Completions 标准接口(支持Coding Plan的API Key)",sourceType:"openai-chat",apiUrl:"https://api.minimaxi.com/v1/chat/completions",models:"MiniMax-M2.5, MiniMax-M2.7"}]},glm:{name:"GLM",description:"国内优秀的大模型",link:"https://www.bigmodel.cn/invite?icode=kgOTGFRH%2Ftc5Xkyu5N0wHOnfet45IvM%2BqDogImfeLyI%3D",authType:et.AUTH_TOKEN,services:[{name:"Claude 标准接口 | Coding Plan",sourceType:"claude",apiUrl:"https://open.bigmodel.cn/api/anthropic",models:"glm-5.1, glm-5, glm-4.7, glm-4.5-air",modelLimits:{"glm-5.1":131072,"glm-5":131072,"glm-4.7":131072,"glm-4.5-air":98304}},{name:"Chat Completions 标准接口 | Coding Plan",sourceType:"openai-chat",apiUrl:"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions",models:"glm-5.1, glm-5, glm-4.7, glm-4.5-air",modelLimits:{"glm-5.1":131072,"glm-5":131072,"glm-4.7":131072,"glm-4.5-air":98304}}]},kimi:{name:"Kimi",description:"国内优秀大模型",link:"https://www.kimi.ai/",authType:et.AUTH_TOKEN,services:[{name:"Claude 标准接口 | Coding Plan",sourceType:"claude",apiUrl:"https://api.kimi.com/coding"},{name:"Chat Completions 标准接口 | Coding Plan",sourceType:"openai-chat",apiUrl:"https://api.kimi.com/coding/v1/chat/completions",models:"kimi-for-coding",modelLimits:{"kimi-for-coding":32768}}]},doubao:{name:"火山方舟(豆包)",description:"字节旗下大模型平台。Coding Plan一次性支持GLM、Kimi-K2、Deepseek多个国产模型 邀请码:Y58X463P",link:"https://volcengine.com/L/RcHlm6yxj0w/",authType:et.AUTH_TOKEN,services:[{name:"Claude 标准接口 | Coding Plan",sourceType:"claude",apiUrl:"https://ark.cn-beijing.volces.com/api/coding",models:"ark-code-latest"},{name:"Responses 标准接口 | Coding Plan",sourceType:"openai",apiUrl:"https://ark.cn-beijing.volces.com/api/coding/v3",models:"ark-code-latest"},{name:"Claude 标准接口(付费API)",sourceType:"claude",apiUrl:"https://ark.cn-beijing.volces.com/api/compatible",models:"doubao-seed-2-0-code-preview-260215, doubao-seed-code-preview-251028"},{name:"Responses 标准接口(付费API)",sourceType:"openai",apiUrl:"https://ark.cn-beijing.volces.com/api/v3",models:"doubao-seed-2-0-code-preview-260215, doubao-seed-code-preview-251028"},{name:"Chat Completions 标准接口(付费API)",sourceType:"openai-chat",apiUrl:"https://ark.cn-beijing.volces.com/api/v3/chat/completions",models:"doubao-seed-2-0-code-preview-260215, doubao-seed-code-preview-251028"}]},qwen:{name:"阿里云百炼(千问)",description:"国内优秀大模型",link:"https://help.aliyun.com/zh/model-studio/coding-plan",authType:et.AUTH_TOKEN,services:[{name:"Claude 标准接口 | Coding Plan",sourceType:"claude",apiUrl:"https://coding.dashscope.aliyuncs.com/apps/anthropic",models:"qwen3-max-2026-01-23, qwen3-coder-plus"},{name:"Responses 标准接口 | Coding Plan",sourceType:"openai-chat",apiUrl:"https://coding.dashscope.aliyuncs.com/v1",models:"qwen3-max-2026-01-23, qwen3-coder-plus"},{name:"Responses 标准接口(付费API)",sourceType:"openai",apiUrl:"https://dashscope.aliyuncs.com/api/v2/apps/protocols/compatible-mode/v1",models:"qwen3-max-2026-01-23, qwen3-coder-plus, kimi-k2.5, glm-4.7, MiniMax-M2.1"},{name:"Claude 标准接口(付费API)",sourceType:"claude",apiUrl:"https://dashscope.aliyuncs.com/apps/anthropic",models:"qwen3-max-2026-01-23, qwen3-coder-plus, kimi-k2.5, glm-4.7, MiniMax-M2.1"}]},deepseek:{name:"DeepSeek",description:"DeepSeek 官方 API",link:"https://platform.deepseek.com",authType:et.AUTH_TOKEN,services:[{name:"Claude 标准接口(付费API)",sourceType:"claude",apiUrl:"https://api.deepseek.com/anthropic",models:"deepseek-v4-flash, deepseek-v4-pro"},{name:"DeepSeek Reasoning Chat 接口(付费API)",sourceType:"openai-chat",apiUrl:"https://api.deepseek.com/v1/chat/completions",models:"deepseek-v4-flash, deepseek-v4-pro"}]},mimo:{name:"Mimo",description:"小米 Mimo 国产大模型",link:"https://platform.xiaomimimo.com?ref=M8BFP3",authType:et.AUTH_TOKEN,services:[{name:"Claude 标准接口 | Coding Plan",sourceType:"claude",apiUrl:"https://token-plan-cn.xiaomimimo.com/anthropic",models:"mimo-v2.5-pro, mimo-v2-pro, mimo-v2.5, mimo-v2-omni, mimo-v2-flash"},{name:"Chat Completions 标准接口 | Coding Plan",sourceType:"openai-chat",apiUrl:"https://token-plan-cn.xiaomimimo.com/v1/chat/completions",models:"mimo-v2.5-pro, mimo-v2-pro, mimo-v2.5, mimo-v2-omni, mimo-v2-flash"},{name:"Chat Completions 标准接口(付费API)",sourceType:"openai-chat",apiUrl:"https://api.xiaomimimo.com/v1/chat/completions",models:"mimo-v2.5-pro, mimo-v2-pro, mimo-v2.5, mimo-v2-omni, mimo-v2-flash"},{name:"Claude 标准接口(付费API)",sourceType:"claude",apiUrl:"https://api.xiaomimimo.com/anthropic",models:"mimo-v2.5-pro, mimo-v2-pro, mimo-v2.5, mimo-v2-omni, mimo-v2-flash"}]},openai:{name:"OpenAI",description:"OpenAI 官方 API",link:"https://platform.openai.com",authType:et.AUTH_TOKEN,services:[{name:"GPT官方接口",sourceType:"openai",apiUrl:"https://api.openai.com"}],sortedGroup:3},anthropic:{name:"Anthropic",description:"Anthropic 官方 API",link:"https://www.anthropic.com",authType:et.API_KEY,services:[{name:"Claude官方接口",sourceType:"claude",apiUrl:"https://api.anthropic.com"}],sortedGroup:3},google:{name:"Google AI",description:"Gemini官方接口",authType:et.G_API_KEY,services:[{name:"Gemini",sourceType:"gemini",apiUrl:"https://generativelanguage.googleapis.com"}],sortedGroup:3},openrouter:{name:"OpenRouter",description:"一站式 AI 模型路由平台",link:"https://openrouter.ai",authType:et.AUTH_TOKEN,apiBaseUrl:"https://openrouter.ai/api",services:[{name:"Claude Code专属接口",sourceType:"claude",apiUrl:"https://openrouter.ai/api",models:"anthropic/claude-fable-5, anthropic/claude-opus-4.8, anthropic/claude-opus-4.6, anthropic/claude-opus-4.5, anthropic/claude-sonnet-4.6, anthropic/claude-sonnet-4.5, anthropic/claude-haiku-4.5"},{name:"Responses 标准接口 (Beta)",sourceType:"openai",apiUrl:"https://openrouter.ai/api/v1",models:"openai/gpt-5.3-codex, openai/gpt-5.4, openai/gpt-5.5, openai/gpt-5.4-mini"},{name:"Chat Completions 标准接口",sourceType:"openai-chat",apiUrl:"https://openrouter.ai/api/v1/chat/completions",models:"openai/gpt-5.5, openai/gpt-5.4, openai/gpt-5.4-mini, openai/gpt-5.3-codex, google/gemini-3-flash-preview, google/gemini-3-pro-preview"},{name:"Claude 标准接口",sourceType:"claude",apiUrl:"https://openrouter.ai/api",models:"anthropic/claude-fable-5, anthropic/claude-opus-4.8, anthropic/claude-opus-4.6, anthropic/claude-sonnet-4.6, anthropic/claude-haiku-4.6",authType:et.AUTH_TOKEN}],sortedGroup:3},agnes:{name:"Agnes",description:"优秀的模型厂商,拥有多种模型,提供免费 API 使用",tags:["永久免费"],link:"https://platform.agnes-ai.com",authType:et.AUTH_TOKEN,services:[{name:"Chat Completions 标准接口(免费)",sourceType:"openai-chat",apiUrl:"https://apihub.agnes-ai.com/v1/chat/completions",models:"agnes-2.0-flash, agnes-1.5-flash",authType:et.AUTH_TOKEN}],sortedGroup:-1}},Jl={"claude-code":"Claude Code",codex:"Codex"},ud={claude:"Claude","claude-chat":"Claude Chat",openai:"OpenAI","openai-chat":"OpenAI Chat",gemini:"Gemini","gemini-chat":"Gemini Chat"},TB={"openai-chat":"填写完整的接口地址,如:https://api.openai.com/v1/chat/completions",openai:"填写接口Base URL地址,如:https://api.openai.com,(注,有的服务商需要带/v1)","claude-chat":"填写完整的接口地址,如:https://api.anthropic.com/v1/messages",claude:"只填写 base 地址,如:https://api.anthropic.com",gemini:"只填写 base 地址,如:https://generativelanguage.googleapis.com","gemini-chat":"填写完整的接口地址,如:https://generativelanguage.googleapis.com/v1beta/models/{modelName}:{endPoint} 注意,{modelName}和{endPoint}会在实际运行时被替换,你只需要按此处的格式填写即可"},dd={[et.AUTH_TOKEN]:"AUTH_TOKEN",[et.API_KEY]:"API_KEY",[et.G_API_KEY]:"GOOGLE_API_KEY"},Km={[et.AUTH_TOKEN]:"使用 Authorization: Bearer <token> 进行认证",[et.API_KEY]:"使用 x-api-key: <token> 进行认证",[et.G_API_KEY]:"使用 x-goog-api-key: <token> 进行认证"},OB=`#### 🚀 智谱 GLM Coding Plan
88
+
89
+ > 价格便宜,国内速度快,支持多工具(Claude Code等 20+ 大编程工具),而且其中的GLM-4.7是目前国内最强编程模型。适合对模型有一定要求,同时又无法获取国外模型的朋友入手。
90
+ >
91
+ > 链接:[https://www.bigmodel.cn](https://www.bigmodel.cn/invite?icode=kgOTGFRH%2Ftc5Xkyu5N0wHOnfet45IvM%2BqDogImfeLyI%3D) | [一键配置](# "glm")
92
+
93
+ #### 🌌 MiniMax Coding Plan
94
+
95
+ > 国内优秀的大模型,支持Claude Code和Codex等编程工具,其中 M2.1 模型在大模型评测中获得非常高的分数。可作为国内大模型的备选方案。
96
+ > 链接:[https://platform.minimaxi.com/subscribe/coding-plan](https://platform.minimaxi.com/subscribe/coding-plan?code=G6xKj7L4YN&source=link) | [一键配置](# "minimax")
97
+
98
+ #### 🧠 Mimo Coding Plan
99
+
100
+ > 小米旗下 Mimo 国产大模型,支持 Claude Code 和 Codex 等编程工具,提供 Coding Plan 和付费 API 两种模式,涵盖 mimo-v2.5-pro、mimo-v2-pro、mimo-v2.5、mimo-v2-omni、mimo-v2-flash 等多个模型,性价比出色。
101
+ > 链接:[https://platform.xiaomimimo.com](https://platform.xiaomimimo.com?ref=M8BFP3) | [一键配置](# "mimo")
102
+ `;function zT(e,t){let n,r;const i=a=>a.replace(/!\[.*?\]\(.*?\)/g,l=>{var c;const s=(c=l.match(/\((.*?)\)/))==null?void 0:c[1];if((s==null?void 0:s.indexOf("public/"))===0){const u=s.replace("public/","/");return l.replace(s,u)}else return l});return function(){const[a,l]=h.useState(i(e));return h.useEffect(()=>{if(r){l(i(r));return}const s=c=>{c&&(r=c,l(i(c)))};n?n.then(s).catch(()=>{}):n=t().then(s).catch(()=>{})},[]),a}}const AB=zT(OB,V.getRecommendVendorsMarkdown),IB=zT("",V.getUpgradeMarkdown),$T=h.createContext(void 0);function du(){const e=h.useContext($T);if(!e)throw new Error("useConfirm must be used within ConfirmProvider");return e}let to=null;function NB({children:e}){const[t,n]=h.useState(!1),[r,i]=h.useState({message:""}),a=f=>(i(f),n(!0),new Promise(d=>{to=d})),l=()=>{n(!1),to&&(to(!0),to=null)},s=()=>{n(!1),to&&(to(!1),to=null)},u=(()=>{switch(r.type){case"danger":return{icon:"⚠️",iconColor:"#dc3545",buttonClass:"btn-danger"};case"warning":return{icon:"⚠",iconColor:"#ffc107",buttonClass:"btn-warning"};default:return{icon:"ℹ️",iconColor:"#17a2b8",buttonClass:"btn-primary"}}})();return o.jsxs($T.Provider,{value:{confirm:a},children:[e,t&&o.jsx("div",{className:"modal-overlay",style:{zIndex:1e6},children:o.jsx("div",{className:"modal",style:{maxWidth:"500px"},children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:r.title||"确认操作"})}),o.jsx("div",{style:{padding:"20px"},children:o.jsxs("div",{style:{display:"flex",gap:"15px",alignItems:"flex-start"},children:[o.jsx("span",{style:{fontSize:"32px",flexShrink:0},children:u.icon}),o.jsx("div",{style:{flex:1,whiteSpace:"pre-wrap",lineHeight:"1.6"},children:r.message})]})}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-secondary",onClick:s,children:r.cancelText||"取消"}),o.jsx("button",{className:`btn ${u.buttonClass}`,onClick:l,children:r.confirmText||"确认"})]})]})})})]})}let _B=0;const Av=new Set;let Pf=[];function BT(){Av.forEach(e=>e([...Pf]))}function fd(e,t,n=3e3){const r=++_B,i={id:r,message:e,type:t,duration:n};return Pf.push(i),BT(),n>0&&setTimeout(()=>{FT(r)},n),r}function FT(e){Pf=Pf.filter(t=>t.id!==e),BT()}const U={success(e,t){fd(e,"success",t)},error(e,t){fd(e,"error",t)},warning(e,t){fd(e,"warning",t)},info(e,t){fd(e,"info",t)}};function MB(){const[e,t]=h.useState([]);h.useEffect(()=>(Av.add(t),()=>{Av.delete(t)}),[]);const n=i=>({...{padding:"12px 20px",borderRadius:"8px",marginBottom:"10px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)",display:"flex",alignItems:"center",gap:"10px",minWidth:"300px",maxWidth:"500px",animation:"slideIn 0.2s ease-out"},...{success:{backgroundColor:"#d4edda",color:"#155724",border:"1px solid #c3e6cb"},error:{backgroundColor:"#f8d7da",color:"#721c24",border:"1px solid #f5c6cb"},warning:{backgroundColor:"#fff3cd",color:"#856404",border:"1px solid #ffeaa7"},info:{backgroundColor:"#d1ecf1",color:"#0c5460",border:"1px solid #bee5eb"}}[i]}),r=i=>({success:"✓",error:"✕",warning:"⚠",info:"ℹ"})[i];return o.jsxs(o.Fragment,{children:[o.jsx("style",{children:`
103
+ @keyframes slideIn {
104
+ from {
105
+ transform: translateX(50px);
106
+ opacity: 0;
107
+ }
108
+ to {
109
+ transform: translateX(0);
110
+ opacity: 1;
111
+ }
112
+ }
113
+ `}),o.jsx("div",{style:{position:"fixed",top:"20px",right:"20px",zIndex:1000001},children:e.map(i=>o.jsxs("div",{style:n(i.type),children:[o.jsx("span",{style:{fontSize:"18px",fontWeight:"bold"},children:r(i.type)}),o.jsx("span",{style:{flex:1},children:i.message}),o.jsx("button",{onClick:()=>FT(i.id),style:{background:"none",border:"none",color:"inherit",cursor:"pointer",fontSize:"18px",padding:"0",marginLeft:"10px",opacity:.6},onMouseEnter:a=>a.currentTarget.style.opacity="1",onMouseLeave:a=>a.currentTarget.style.opacity="0.6",children:"×"})]},i.id))})]})}function UT({value:e,onChange:t,existingVendors:n=[],disabled:r=!1}){const[i,a]=h.useState(!1),l=h.useRef(null);h.useEffect(()=>{if(!i)return;const u=f=>{l.current&&!l.current.contains(f.target)&&a(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[i]);const s=h.useMemo(()=>{const u=Object.entries(Tn).map(([p,m])=>({key:p,name:m.name,sortedGroup:m.sortedGroup??0}));u.sort((p,m)=>p.sortedGroup-m.sortedGroup);const f=[];let d=null;for(const p of u)d!==null&&p.sortedGroup!==d&&f.push(null),f.push(p),d=p.sortedGroup;return f},[]),c=e?Tn[e]:null;return o.jsxs("div",{ref:l,style:{position:"relative"},children:[o.jsxs("div",{onClick:()=>!r&&a(!i),style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 14px",border:`1px solid ${i?"var(--accent-primary)":"var(--border-primary)"}`,borderRadius:"8px",background:"var(--input-bg, var(--bg-primary))",cursor:r?"not-allowed":"pointer",opacity:r?.6:1,transition:"border-color 0.2s",userSelect:"none"},children:[c?o.jsx("span",{style:{fontSize:"14px",color:"var(--text-primary)"},children:c.name}):o.jsx("span",{style:{fontSize:"14px",color:"var(--text-muted)"},children:"请选择供应商"}),o.jsx("span",{style:{fontSize:"12px",color:"var(--text-muted)",transform:i?"rotate(180deg)":"rotate(0)",transition:"transform 0.2s"},children:"▼"})]}),i&&o.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:999,marginTop:"4px",maxHeight:"320px",overflowY:"auto",background:"var(--bg-primary)",border:"1px solid var(--border-primary)",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0,0,0,0.15)"},children:s.map((u,f)=>{var g;if(!u)return o.jsx("div",{style:{height:"1px",background:"var(--border-primary)"}},`sep-${f}`);const d=Tn[u.key],p=n.some(y=>y.name===u.name),m=e===u.key;return o.jsxs("div",{onClick:()=>{t(u.key),a(!1)},style:{display:"flex",alignItems:"center",gap:"12px",padding:"10px 14px",cursor:"pointer",background:m?"var(--accent-light)":p?"rgba(255, 167, 38, 0.08)":"rgba(76, 175, 80, 0.08)",borderLeft:m?"3px solid var(--accent-primary)":"3px solid transparent",transition:"background 0.15s"},onMouseEnter:y=>{m||(y.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:y=>{m||(y.currentTarget.style.background=p?"rgba(255, 167, 38, 0.08)":"rgba(76, 175, 80, 0.08)")},children:[o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsxs("div",{style:{fontSize:"14px",fontWeight:m?600:400,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[u.name,(g=d==null?void 0:d.tags)==null?void 0:g.map((y,x)=>o.jsx("span",{style:{fontSize:"11px",marginLeft:"6px",padding:"1px 6px",borderRadius:"8px",background:"rgba(229, 57, 53, 0.1)",color:"#e53935",fontWeight:500,verticalAlign:"middle"},children:y},x))]}),(d==null?void 0:d.description)&&o.jsx("div",{style:{fontSize:"12px",color:"var(--text-muted)",marginTop:"2px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.description})]}),o.jsx("span",{style:{fontSize:"11px",padding:"2px 8px",borderRadius:"10px",fontWeight:500,whiteSpace:"nowrap",background:p?"rgba(255, 167, 38, 0.15)":"rgba(76, 175, 80, 0.15)",color:p?"#e67e22":"#4caf50"},children:p?"已配置":"可用"})]},u.key)})})]})}function Pj(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0");return`${t}-${n}-${r}T${i}:${a}`}function RB({value:e=[],onChange:t,placeholder:n,inputValue:r,onInputChange:i}){const a=s=>{if(s.key==="Enter"||s.key===","){s.preventDefault();const c=r.trim();c&&!e.includes(c)&&(t([...e,c]),i(""))}else s.key==="Backspace"&&!r&&e.length>0&&t(e.slice(0,-1))},l=s=>{t(e.filter((c,u)=>u!==s))};return o.jsx("div",{style:{border:"1px solid var(--border-primary)",borderRadius:"4px",padding:"8px",minHeight:"40px",background:"var(--bg-secondary)"},children:o.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",alignItems:"center"},children:[e.map((s,c)=>o.jsxs("span",{style:{backgroundColor:"var(--accent-light)",color:"var(--text-primary)",padding:"4px 8px",borderRadius:"4px",fontSize:"12px",display:"flex",alignItems:"center",gap:"4px"},children:[s,o.jsx("button",{type:"button",onClick:()=>l(c),style:{background:"none",border:"none",color:"var(--text-primary)",cursor:"pointer",fontSize:"16px",lineHeight:"1",padding:"0",marginLeft:"4px"},onMouseOver:u=>u.currentTarget.style.color="var(--accent-danger)",onMouseOut:u=>u.currentTarget.style.color="var(--text-primary)",children:"×"})]},c)),o.jsx("input",{type:"text",value:r,onChange:s=>i(s.target.value),onKeyDown:a,placeholder:n,style:{border:"none",outline:"none",flex:"1",minWidth:"120px",fontSize:"14px"}})]})})}function DB(){var ut,fn;const{confirm:e}=du(),t=h.useRef(null),[n,r]=h.useState([]),[i,a]=h.useState(null),[l,s]=h.useState(!1),[c,u]=h.useState(!1),[f,d]=h.useState(!1),[p,m]=h.useState(!1),[g,y]=h.useState(null),[x,v]=h.useState(null),[b,w]=h.useState([]),[S,C]=h.useState(""),[j,E]=h.useState({}),[O,R]=h.useState(!1),[A,N]=h.useState(void 0),[_,q]=h.useState(void 0),[W,I]=h.useState(void 0),[F,K]=h.useState(!1),[M,B]=h.useState(void 0),[k,L]=h.useState(void 0),[Q,T]=h.useState(void 0),[ce,ve]=h.useState("openai-chat"),[X,oe]=h.useState(!1),[fe,te]=h.useState(et.AUTH_TOKEN),[Z,se]=h.useState(""),[re,Oe]=h.useState(!0),[ne,_e]=h.useState(!0),[Re,Fe]=h.useState(!0),rt=G=>{if(ve(G),Re)return;let ge;G==="gemini"||G==="gemini-chat"?ge=et.G_API_KEY:G==="claude-chat"||G==="claude"?ge=et.API_KEY:ge=et.AUTH_TOKEN,te(ge),t.current&&(t.current.value=ge)},[Be,qe]=h.useState(""),[ye,Ee]=h.useState([]),[ze,ht]=h.useState(""),ee=AB();h.useEffect(()=>{Y()},[]),h.useEffect(()=>{const G=new Set(b),ge={};Object.entries(j).forEach(([Ae,Ue])=>{G.has(Ae)&&(ge[Ae]=Ue)}),Object.keys(ge).length!==Object.keys(j).length&&E(ge)},[b]);const Y=async()=>{const G=await V.getVendors();return r(G),G.length>0&&!i&&a(G[0]),G},le=()=>{y(null),se(""),s(!0)},D=()=>{d(!0)},de=G=>{y(G),se(G.authType||""),s(!0)},me=async G=>{if(await e({message:"确定要删除此供应商吗?",title:"确认删除",type:"danger",confirmText:"删除",cancelText:"取消"}))try{const je=await V.getRules(),Ae=(G.services||[]).map(_t=>_t.id),Ue=je.filter(_t=>Ae.includes(_t.targetServiceId)).length;if(!await e({message:`二次确认:删除供应商“${G.name}”后,将同时删除关联的 ${Ue} 条路由规则。是否继续?`,title:"二次确认",type:"danger",confirmText:"确认删除",cancelText:"取消"}))return;await V.deleteVendor(G.id),Y(),i&&i.id===G.id&&a(null),U.success(`供应商已删除,关联规则清理 ${Ue} 条`)}catch(je){const Ae=je instanceof Error?je.message:"删除失败";U.error(Ae)}},Te=async G=>{G.preventDefault();const ge=new FormData(G.currentTarget),je={name:ge.get("name"),description:ge.get("description"),apiKey:ge.get("apiKey")||"",apiBaseUrl:ge.get("apiBaseUrl")||"",authType:ge.get("authType")||void 0,sortOrder:parseInt(ge.get("sortOrder"))||0};g?await V.updateVendor(g.id,je):await V.createVendor({...je,services:[]}),s(!1);const Ae=await Y();if(i){const Ue=Ae.find(Nt=>Nt.id===i.id);Ue&&a(Ue)}},Pe=()=>{v(null),w([]),C(""),E({}),R(!1),N(void 0),q(void 0),I(void 0),K(!1),B(void 0),L(void 0),T(void 0),ve("openai-chat"),te((i==null?void 0:i.authType)||et.AUTH_TOKEN),Oe(!!(i!=null&&i.apiKey)),_e(!!(i!=null&&i.apiBaseUrl)),Fe(!!(i!=null&&i.authType)),oe(!1),u(!0)},De=G=>{v(G),w(G.supportedModels||[]),C(""),E(G.modelLimits||{}),R(G.enableTokenLimit||!1),N(G.tokenLimit),q(G.tokenResetInterval),I(G.tokenResetBaseTime?new Date(G.tokenResetBaseTime):void 0),K(G.enableRequestLimit||!1),B(G.requestCountLimit),L(G.requestResetInterval),T(G.requestResetBaseTime?new Date(G.requestResetBaseTime):void 0);const ge=G.sourceType||"openai-chat";if(ve(ge),Oe(G.inheritVendorApiKey===!0),_e(G.inheritVendorApiBaseUrl===!0),Fe(G.inheritVendorAuthType===!0),G.inheritVendorAuthType===!0){const je=(i==null?void 0:i.authType)||et.AUTH_TOKEN;te(je)}else if(G.authType)te(G.authType);else{let je;ge==="gemini"||ge==="gemini-chat"?je=et.G_API_KEY:ge==="claude-chat"||ge==="claude"?je=et.API_KEY:je=et.AUTH_TOKEN,te(je)}oe(G.isDowngradeCompatibility===!0),u(!0)},Le=async G=>{if(await e({message:"确定要删除此API服务吗?",title:"确认删除",type:"danger",confirmText:"删除",cancelText:"取消"}))try{const Ae=(await V.getRules()).filter(_t=>_t.targetServiceId===G).length;if(!await e({message:`二次确认:删除该 API 服务后,将同时删除关联的 ${Ae} 条路由规则。是否继续?`,title:"二次确认",type:"danger",confirmText:"确认删除",cancelText:"取消"}))return;await V.deleteAPIService(G);const Nt=await Y();if(i){const _t=Nt.find(nn=>nn.id===i.id);_t&&a(_t)}U.success(`API服务已删除,关联规则清理 ${Ae} 条`)}catch(je){const Ae=je instanceof Error?je.message:"删除失败";U.error(Ae)}},Ve=async G=>{G.preventDefault();let ge=[...b];if(S.trim()){const Qt=S.split(",").map(St=>St.trim()).filter(St=>St&&!ge.includes(St));ge=[...ge,...Qt]}const je=new FormData(G.currentTarget),Ae=je.get("sourceType"),Ue=je.get("inheritVendorApiBaseUrl")==="on",Nt=(je.get("apiUrl")||"").trim(),_t=Ue?(x==null?void 0:x.apiUrl)||"":Nt,nn=je.get("inheritVendorApiKey")==="on",Xt=je.get("apiKey")||"",Oi=nn?(x==null?void 0:x.apiKey)||"":Xt,Ln=je.get("inheritVendorAuthType")==="on",dt={};Object.entries(j).forEach(([Qt,St])=>{Qt&&St&&St>0&&(dt[Qt]=St)});const Yn={vendorId:i.id,name:je.get("name"),apiUrl:_t,apiKey:Oi,inheritVendorApiKey:nn,inheritVendorApiBaseUrl:Ue,inheritVendorAuthType:Ln,sourceType:Ae,authType:Ln?(x==null?void 0:x.authType)||void 0:je.get("authType")||void 0,supportedModels:ge.length>0?ge:void 0,modelLimits:Object.keys(dt).length>0?dt:void 0,enableProxy:je.get("enableProxy")==="on",enableCodingPlan:je.get("enableCodingPlan")==="on",isDowngradeCompatibility:ce==="openai"?X:void 0,enableTokenLimit:O,tokenLimit:A,tokenResetInterval:_,tokenResetBaseTime:W?W.getTime():void 0,enableRequestLimit:F,requestCountLimit:M,requestResetInterval:k,requestResetBaseTime:Q?Q.getTime():void 0};x?await V.updateAPIService(x.id,Yn):await V.createAPIService(Yn),u(!1),w([]),C(""),E({}),R(!1),N(void 0),q(void 0),I(void 0),K(!1),B(void 0),L(void 0),T(void 0),Oe(!0),_e(!0),oe(!1);const ei=await Y();if(i){const Qt=ei.find(St=>St.id===i.id);Qt&&a(Qt)}},We=G=>{if(G){qe(G);const ge=Tn[G];ge&&ge.services.length>0&&Ee(ge.services.map((je,Ae)=>Ae))}else qe(""),Ee([]);ht(""),m(!0)},Qe=async G=>{G.preventDefault();const ge=Be,je=ze;if(!ge||!je){U.warning("请填写完整信息");return}if(ye.length===0){U.warning("请至少选择一个源类型");return}const Ae=Tn[ge];if(!Ae){U.error("未找到对应的供应商配置");return}try{const Ue=await V.createVendor({name:Ae.name,description:Ae.description,apiKey:je,authType:Ae.authType??et.AUTH_TOKEN,...Ae.apiBaseUrl?{apiBaseUrl:Ae.apiBaseUrl}:{},sortOrder:0,services:[]});if(console.log("[一键配置] 供应商创建成功:",Ue),console.log("[一键配置] 供应商 ID:",Ue==null?void 0:Ue.id),!Ue||!Ue.id)throw console.error("[一键配置] 供应商创建失败或缺少 ID:",Ue),new Error("供应商创建失败,缺少 ID");const Nt=Ae.services.filter((dt,Yn)=>ye.includes(Yn));if(console.log("[一键配置] 准备创建服务:",Nt.length,"个"),console.log("[一键配置] vendorId:",Ue.id),Nt.length===0)throw new Error("没有选择任何服务");const _t=Nt.map(async(dt,Yn)=>{const ei={vendorId:Ue.id,name:dt.name,apiUrl:dt.apiUrl,apiKey:"",inheritVendorApiKey:!0,inheritVendorApiBaseUrl:!1,sourceType:dt.sourceType,authType:dt.authType,supportedModels:dt.models?dt.models.split(",").map(St=>St.trim()):void 0,modelLimits:dt.modelLimits||{},enableCodingPlan:!0};console.log(`[一键配置] 创建服务 ${Yn+1}/${Nt.length}:`,{...ei,apiKey:"***"});const Qt=await V.createAPIService(ei);return console.log(`[一键配置] 服务 ${Yn+1} 创建成功,ID:`,Qt.id),Qt.vendorId||console.error(`[一键配置] 警告:服务 ${Qt.id} 缺少 vendorId!`),Qt}),nn=await Promise.all(_t);console.log("[一键配置] 所有服务创建完成,数量:",nn.length);const Xt=nn.filter(dt=>!dt.vendorId);if(Xt.length>0)throw console.error("[一键配置] 发现缺少 vendorId 的服务:",Xt),new Error(`有 ${Xt.length} 个服务缺少 vendorId`);const Ln=(await Y()).find(dt=>dt.id===Ue.id);a(Ln||{...Ue,services:nn}),m(!1),U.success(`配置成功! 已创建 ${ye.length} 个API服务`)}catch(Ue){console.error("一键配置失败:",Ue),U.error(`配置失败: ${Ue instanceof Error?Ue.message:"未知错误"}`)}};return o.jsxs("div",{className:"vendors-page",children:[o.jsxs("div",{className:"page-header",children:[o.jsx("h1",{children:"供应商管理"}),o.jsx("p",{children:"管理API供应商和服务配置"})]}),o.jsxs("div",{style:{display:"flex",gap:"20px"},children:[o.jsxs("div",{className:"card",style:{flex:"0 0 25%",minWidth:400},children:[o.jsxs("div",{className:"toolbar",children:[o.jsx("h3",{children:"供应商列表"}),o.jsxs("div",{style:{display:"flex",gap:"10px"},children:[o.jsx("button",{className:"btn btn-secondary",style:{background:"#2563EB",color:"#FFFFFF",border:"none",cursor:"pointer"},onClick:D,children:"推荐"}),o.jsx("button",{className:"btn btn-primary",onClick:()=>We(),children:"一键配置"}),o.jsx("button",{className:"btn btn-primary",onClick:le,children:"新增"})]})]}),n.length===0?o.jsx("div",{className:"empty-state",children:o.jsx("p",{children:"暂无供应商"})}):o.jsx("div",{style:{marginTop:"10px"},children:n.map(G=>o.jsx("div",{onClick:()=>a(G),style:{padding:"12px",marginBottom:"8px",backgroundColor:i&&i.id===G.id?"var(--accent-light)":"var(--bg-secondary)",borderRadius:"4px",cursor:"pointer",border:"1px solid var(--border-secondary)",color:"var(--text-primary)"},children:o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px"},children:[o.jsxs("div",{style:{flex:1,minWidth:0,overflow:"hidden"},children:[o.jsx("div",{style:{fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:G.name}),G.description&&o.jsx("div",{style:{fontSize:"12px",color:"var(--text-muted)",marginTop:"4px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:G.description})]}),o.jsxs("div",{className:"action-buttons",style:{flexShrink:0},children:[o.jsx("button",{className:"btn btn-secondary",style:{padding:"4px 8px",fontSize:"12px"},onClick:ge=>{ge.stopPropagation(),de(G)},children:"编辑"}),o.jsx("button",{className:"btn btn-danger",style:{padding:"4px 8px",fontSize:"12px"},onClick:ge=>{ge.stopPropagation(),me(G)},children:"删除"})]})]})},G.id))})]}),o.jsxs("div",{className:"card",style:{flex:1},children:[o.jsxs("div",{className:"toolbar",children:[o.jsxs("h3",{children:["供应商",i?`(${i.name})`:null,"API服务"]}),i&&o.jsx("button",{className:"btn btn-primary",onClick:Pe,children:"新增服务"})]}),i?!i.services||i.services.length===0?o.jsx("div",{className:"empty-state",children:o.jsx("p",{children:"暂无API服务"})}):o.jsxs("table",{style:{fontSize:"smaller"},children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{style:{whiteSpace:"nowrap"},children:"服务名称"}),o.jsx("th",{children:"源类型"}),o.jsx("th",{children:"API地址"}),o.jsx("th",{children:"模型"}),o.jsx("th",{children:"操作"})]})}),o.jsx("tbody",{children:i.services.map(G=>{var ge;return o.jsxs("tr",{children:[o.jsx("td",{children:G.name}),o.jsx("td",{children:G.sourceType?ud[G.sourceType]:"-"}),o.jsx("td",{style:{maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:G.apiUrl,children:G.apiUrl}),o.jsx("td",{children:(ge=G.supportedModels)!=null&&ge.length?`${G.supportedModels.length}个`:"*"}),o.jsx("td",{children:o.jsxs("div",{className:"action-buttons",children:[o.jsx("button",{className:"btn btn-sm btn-secondary",onClick:()=>De(G),children:"编辑"}),o.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>Le(G.id),children:"删除"})]})})]},G.id)})})]}):o.jsx("div",{className:"empty-state",children:o.jsx("p",{children:"请先选择一个供应商"})})]})]}),l&&o.jsxs("div",{className:"modal-overlay",children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:()=>s(!1),"aria-label":"关闭",children:"×"}),o.jsx("div",{className:"modal",children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:g?"编辑供应商":"新增供应商"})}),o.jsxs("form",{onSubmit:Te,children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"供应商名称"}),o.jsx("input",{type:"text",name:"name",defaultValue:g?g.name:"",required:!0})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"描述"}),o.jsx("textarea",{name:"description",rows:3,defaultValue:g?g.description:""})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"API密钥"}),o.jsx("input",{type:"password",name:"apiKey",defaultValue:g&&g.apiKey||"",placeholder:"可选:供应商默认API密钥"})]}),o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{children:["API认证方式 ",o.jsx("small",{children:"新增服务时默认使用此方式"})]}),o.jsxs("select",{name:"authType",defaultValue:(g==null?void 0:g.authType)||"",onChange:G=>se(G.target.value),children:[o.jsx("option",{value:"",disabled:!0,children:"无"}),Object.keys(dd).map(G=>o.jsx("option",{value:G,children:dd[G]},G))]}),Z&&Km[Z]&&o.jsx("small",{style:{display:"block",marginTop:"4px",color:"var(--text-muted)"},children:Km[Z]})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"API Base URL"}),o.jsx("input",{type:"text",name:"apiBaseUrl",defaultValue:g&&g.apiBaseUrl||"",placeholder:"可选:供应商默认API Base URL"})]}),o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{children:["排序 ",o.jsx("small",{children:"数值越大越靠前"})]}),o.jsx("input",{type:"number",name:"sortOrder",defaultValue:g&&g.sortOrder||0,min:"0"})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>s(!1),children:"取消"}),o.jsx("button",{type:"submit",className:"btn btn-primary",children:"保存"})]})]})]})})]}),c&&o.jsxs("div",{className:"modal-overlay",children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:()=>u(!1),"aria-label":"关闭",children:"×"}),o.jsx("div",{className:"modal",style:{width:800},children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:x?"编辑供应商API服务":"新增供应商API服务"})}),o.jsxs("form",{onSubmit:Ve,children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"服务名称"}),o.jsx("input",{type:"text",name:"name",defaultValue:x?x.name:"",required:!0})]}),o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{children:["数据源类型 ",o.jsx("small",{children:"供应商接口返回的数据格式标准类型"})]}),o.jsxs("select",{name:"sourceType",defaultValue:x&&x.sourceType||"",onChange:G=>rt(G.target.value),required:!0,children:[o.jsx("option",{value:"",disabled:!0,children:"请选择源类型"}),Object.keys(ud).map(G=>o.jsx("option",{value:G,children:ud[G]},G))]}),o.jsx("small",{style:{display:"block",marginTop:"4px",color:"var(--text-muted)"},children:TB[ce]||""}),ce==="openai"&&o.jsxs("label",{style:{display:"flex",alignItems:"flex-start",marginTop:"10px",cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",checked:X,onChange:G=>oe(G.target.checked),style:{marginRight:"8px",cursor:"pointer",width:"16px",height:"16px",marginTop:"2px"}}),o.jsxs("span",{children:[o.jsx("span",{style:{fontWeight:500},children:"降级兼容"}),o.jsx("br",{}),o.jsx("small",{style:{color:"var(--text-muted)"},children:"通过降级请求格式来确保非 OpenAI 官方的 Responses 接口可以被 Codex 正确使用。"})]})]})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"供应商API地址"}),o.jsxs("label",{style:{display:"flex",alignItems:"center",marginBottom:"8px",cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",name:"inheritVendorApiBaseUrl",checked:ne,onChange:G=>_e(G.target.checked),style:{marginRight:"8px",cursor:"pointer",width:"16px",height:"16px"}}),o.jsx("span",{children:"使用供应商全局配置的API地址"})]}),!ne&&o.jsx("input",{type:"url",name:"apiUrl",defaultValue:x?x.apiUrl:"",required:!0})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"供应商API密钥"}),o.jsxs("label",{style:{display:"flex",alignItems:"center",marginBottom:"8px",cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",name:"inheritVendorApiKey",checked:re,onChange:G=>Oe(G.target.checked),style:{marginRight:"8px",cursor:"pointer",width:"16px",height:"16px"}}),o.jsx("span",{children:"使用供应商全局配置的API密钥"})]}),!re&&o.jsx("input",{type:"password",name:"apiKey",defaultValue:x?x.apiKey:"",required:!0})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"供应商API认证方式"}),o.jsxs("label",{style:{display:"flex",alignItems:"center",marginBottom:"8px",cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",name:"inheritVendorAuthType",checked:Re,onChange:G=>Fe(G.target.checked),style:{marginRight:"8px",cursor:"pointer",width:"16px",height:"16px"}}),o.jsx("span",{children:"使用供应商全局配置的API认证方式"})]}),!Re&&o.jsxs(o.Fragment,{children:[o.jsx("select",{ref:t,name:"authType",defaultValue:x?x.authType||et.AUTH_TOKEN:fe,onChange:G=>te(G.target.value),children:Object.keys(dd).map(G=>o.jsx("option",{value:G,children:dd[G]},G))}),o.jsx("small",{style:{display:"block",marginTop:"4px",color:"var(--text-muted)"},children:Km[fe]||""})]})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"支持的模型列表"}),o.jsx(RB,{value:b,onChange:w,inputValue:S,onInputChange:C,placeholder:"输入模型名,按Enter或逗号添加"},(x==null?void 0:x.id)||"new"),o.jsx("div",{style:{display:"block",width:"100%"},children:o.jsx("small",{style:{fontSize:"10px"},children:"留空表示支持所有模型,路由配置中,可直接将模型透传给该供应商服务接口。"})})]}),o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{children:["模型输出限制 ",o.jsx("small",{children:"为支持的模型配置最大输出tokens"})]}),o.jsxs("div",{style:{border:"1px solid var(--border-primary)",borderRadius:"8px",padding:"16px",background:"var(--bg-secondary)",maxHeight:"300px",overflowY:"auto"},children:[Object.keys(j).length===0&&b.length===0?o.jsx("div",{style:{color:"var(--text-muted)",textAlign:"center",padding:"20px",fontSize:"14px"},children:"暂无模型限制配置,可点击下方按钮添加"}):o.jsxs("div",{children:[b.length>0&&o.jsxs("div",{style:{marginBottom:"12px"},children:[o.jsx("div",{style:{fontSize:"12px",color:"var(--text-muted)",marginBottom:"8px",fontWeight:500},children:'来自"支持的模型列表"(自动同步)'}),b.map(G=>o.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"8px",alignItems:"center",padding:"8px",background:"var(--bg-primary)",borderRadius:"4px",border:"1px solid var(--accent-light)"},children:[o.jsxs("div",{style:{flex:2,fontSize:"14px",color:"var(--text-primary)",fontWeight:500,display:"flex",alignItems:"center",gap:"6px"},children:[G,o.jsx("span",{style:{fontSize:"10px",padding:"2px 6px",borderRadius:"3px",background:"var(--accent-light)",color:"var(--accent-primary)"},children:"已同步"})]}),o.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",gap:"8px"},children:[o.jsx("input",{type:"number",value:j[G]||"",onChange:ge=>{const je=ge.target.value;if(je===""){const Ae={...j};delete Ae[G],E(Ae)}else E({...j,[G]:parseInt(je)||0})},placeholder:"留空不限",min:"1",style:{width:"100%",padding:"6px 8px",border:"1px solid var(--border-primary)",borderRadius:"4px",fontSize:"14px"}}),o.jsx("span",{style:{fontSize:"12px",color:"var(--text-muted)",whiteSpace:"nowrap"},children:"tokens"})]}),o.jsx("button",{type:"button",className:"btn btn-sm btn-secondary",onClick:()=>{const ge={...j};delete ge[G],E(ge)},style:{padding:"4px 8px",fontSize:"12px"},title:"移除此限制(模型仍在支持列表中)",children:"移除限制"})]},`sync-${G}`))]}),Object.keys(j).length>0&&o.jsx("div",{children:Object.entries(j).filter(([G])=>!b.includes(G)).map(([G,ge])=>o.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"8px",alignItems:"center",padding:"8px",background:"var(--bg-primary)",borderRadius:"4px",border:"1px solid var(--border-secondary)"},children:[o.jsx("input",{type:"text",value:G,onChange:je=>{const Ae={...j},Ue=je.target.value;delete Ae[G],Ae[Ue]=ge,E(Ae)},placeholder:"模型名 (如: gpt-4)",style:{flex:2,padding:"6px 8px",border:"1px solid var(--border-primary)",borderRadius:"4px",fontSize:"14px"}}),o.jsx("input",{type:"number",value:ge,onChange:je=>{E({...j,[G]:parseInt(je.target.value)||0})},placeholder:"最大tokens",min:"1",style:{flex:1,padding:"6px 8px",border:"1px solid var(--border-primary)",borderRadius:"4px",fontSize:"14px"}}),o.jsx("button",{type:"button",className:"btn btn-sm btn-danger",onClick:()=>{const je={...j};delete je[G],E(je)},style:{padding:"4px 8px",fontSize:"12px"},children:"删除"})]},`custom-${G}`))})]}),o.jsx("button",{type:"button",className:"btn btn-sm btn-secondary",onClick:()=>{const G=`model-${Date.now()}`;E({...j,[G]:4096})},style:{marginTop:"8px",width:"100%"},children:"+ 添加模型限制"})]}),o.jsx("div",{style:{display:"block",width:"100%",marginTop:"8px"},children:o.jsxs("small",{style:{fontSize:"10px"},children:[o.jsx("strong",{children:"自动同步:"}),"上方添加的模型会自动在此创建限制配置(默认4096),删除模型会同步移除限制。",o.jsx("strong",{children:"手动添加:"}),"可点击下方按钮为特定模型(如 gpt-4)或前缀(如 gpt-4-*)添加限制。 留空则透传前端工具发送的值。支持精确匹配和前缀匹配。 对于o1等新模型,将自动映射到max_completion_tokens字段。"]})})]}),o.jsx("div",{className:"form-group",children:o.jsxs("label",{style:{display:"flex",alignItems:"center",cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",checked:O,onChange:G=>R(G.target.checked),style:{marginRight:"8px",cursor:"pointer",width:"16px",height:"16px"}}),o.jsx("span",{children:"启用Token超量限制"})]})}),O&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"Token超量值(单位:k)"}),o.jsx("input",{type:"number",value:A||"",onChange:G=>N(G.target.value?parseInt(G.target.value):void 0),min:"1",placeholder:"例如:1000表示1000k tokens"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"自动重置间隔(小时)"}),o.jsx("input",{type:"number",value:_||"",onChange:G=>q(G.target.value?parseInt(G.target.value):void 0),min:"1",placeholder:"例如:720表示30天,168表示7天"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"下一次重置时间基点"}),o.jsx("input",{type:"datetime-local",value:W?Pj(W):"",onChange:G=>{G.target.value?I(new Date(G.target.value)):I(void 0)},className:"datetime-picker-input"}),o.jsx("small",{style:{color:"#666",fontSize:"12px",marginTop:"4px",display:"block"},children:"设置下一次重置的精确时间点"})]})]}),o.jsx("div",{className:"form-group",children:o.jsxs("label",{style:{display:"flex",alignItems:"center",cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",checked:F,onChange:G=>K(G.target.checked),style:{marginRight:"8px",cursor:"pointer",width:"16px",height:"16px"}}),o.jsx("span",{children:"启用请求次数超量限制"})]})}),F&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"请求次数超量值"}),o.jsx("input",{type:"number",value:M||"",onChange:G=>B(G.target.value?parseInt(G.target.value):void 0),min:"1",placeholder:"例如:100"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"自动重置间隔(小时)"}),o.jsx("input",{type:"number",value:k||"",onChange:G=>L(G.target.value?parseInt(G.target.value):void 0),min:"1",placeholder:"例如:720表示30天,168表示7天"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"下一次重置时间基点"}),o.jsx("input",{type:"datetime-local",value:Q?Pj(Q):"",onChange:G=>{G.target.value?T(new Date(G.target.value)):T(void 0)},className:"datetime-picker-input"}),o.jsx("small",{style:{color:"#666",fontSize:"12px",marginTop:"4px",display:"block"},children:"设置下一次重置的精确时间点"})]})]}),o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{style:{display:"flex",alignItems:"center",cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",name:"enableProxy",defaultChecked:(x==null?void 0:x.enableProxy)||!1,style:{marginRight:"8px",cursor:"pointer",width:"16px",height:"16px"}}),o.jsx("span",{children:"启用代理"})]}),o.jsx("small",{style:{display:"block",marginTop:"6px",color:"#666",fontSize:"12px",marginLeft:"24px"},children:'勾选后,此 API 服务的请求将通过设置的代理转发。请在"设置"页面配置代理。'})]}),o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{style:{display:"flex",alignItems:"center",cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",name:"enableCodingPlan",defaultChecked:x?!!x.enableCodingPlan:!0,style:{marginRight:"8px",cursor:"pointer",width:"16px",height:"16px"}}),o.jsx("span",{children:"启用编程套餐限制"})]}),o.jsx("small",{style:{display:"block",marginTop:"6px",color:"#666",fontSize:"12px",marginLeft:"24px"},children:"启用后,此 API 服务仅允许编程工具(如 Claude Code、Codex、Cursor 等)发起的请求通过,普通对话请求将被拒绝。"})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>u(!1),children:"取消"}),o.jsx("button",{type:"submit",className:"btn btn-primary",children:"保存"})]})]})]})})]}),f&&o.jsxs("div",{className:"modal-overlay",children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:()=>d(!1),"aria-label":"关闭",children:"×"}),o.jsx("div",{className:"modal",style:{maxWidth:"800px"},children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:"供应商推荐"})}),o.jsx("div",{className:"modal-body",children:o.jsx("div",{className:"markdown-content",children:o.jsx(gc,{components:{a:({href:G,children:ge,title:je})=>je&&Tn[je]?o.jsx("a",{href:"#",style:{color:"#2563EB",borderBottom:"solid 1px #2563EB",cursor:"pointer"},onClick:Ae=>{Ae.preventDefault(),d(!1),We(je)},children:ge}):o.jsx("a",{href:G,style:{color:"#2563EB",borderBottom:"solid 1px #2563EB"},target:"_blank",rel:"noopener noreferrer",children:ge})},children:ee})})}),o.jsx("div",{className:"modal-footer",children:o.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>d(!1),children:"关闭"})})]})})]}),p&&o.jsxs("div",{className:"modal-overlay",children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:()=>m(!1),"aria-label":"关闭",children:"×"}),o.jsx("div",{className:"modal",children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:"一键配置供应商"})}),o.jsxs("form",{onSubmit:Qe,children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"供应商"}),o.jsx(UT,{value:Be,onChange:G=>{if(qe(G),G){const ge=Tn[G];ge&&ge.services.length>0&&Ee(ge.services.map((je,Ae)=>Ae))}else Ee([])},existingVendors:n})]}),(ut=Tn[Be])!=null&&ut.description?o.jsxs("div",{style:{fontSize:".8em",marginBottom:16,marginTop:-16},children:[Tn[Be].description,Tn[Be].link&&o.jsxs(o.Fragment,{children:[" ",o.jsx("a",{href:Tn[Be].link,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent-primary)"},children:(()=>{try{const G=new URL(Tn[Be].link);return G.protocol+"//"+G.hostname}catch{return Tn[Be].link}})()})]})]}):null,o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{children:["源类型 ",o.jsx("small",{style:{color:"var(--text-muted)",fontWeight:"normal"},children:"可选择多个"})]}),o.jsx("div",{style:{border:"1px solid var(--border-primary)",borderRadius:"8px",padding:"16px",background:"var(--bg-secondary)",minHeight:"100px",display:"flex",flexDirection:"column",gap:"8px"},children:Be?(fn=Tn[Be])==null?void 0:fn.services.map((G,ge)=>{const je=ye.includes(ge);return o.jsxs("label",{style:{display:"flex",alignItems:"center",cursor:"pointer",padding:"10px 14px",borderRadius:"6px",background:je?"var(--accent-light)":"transparent",border:`2px solid ${je?"var(--accent-primary)":"transparent"}`,transition:"all 0.2s ease",position:"relative",overflow:"hidden"},onMouseEnter:Ae=>{je||(Ae.currentTarget.style.background="var(--bg-hover)",Ae.currentTarget.style.borderColor="var(--border-secondary)")},onMouseLeave:Ae=>{je||(Ae.currentTarget.style.background="transparent",Ae.currentTarget.style.borderColor="transparent")},children:[o.jsx("input",{type:"checkbox",checked:je,onChange:Ae=>{Ae.target.checked?Ee([...ye,ge]):Ee(ye.filter(Ue=>Ue!==ge))},style:{width:"18px",height:"18px",marginRight:"12px",cursor:"pointer",accentColor:"var(--accent-primary)"}}),o.jsxs("span",{style:{fontSize:"14px",fontWeight:je?"600":"400",color:"var(--text-primary)",transition:"all 0.2s ease"},children:[G.name," - ",ud[G.sourceType]]}),je&&o.jsx("span",{style:{marginLeft:"auto",fontSize:"16px",color:"var(--text-primary)"},children:"✓"})]},ge)}):o.jsx("div",{style:{color:"var(--text-muted)",textAlign:"center",padding:"30px 20px",fontSize:"14px"},children:"请先选择供应商"})})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"API Key"}),o.jsx("input",{type:"password",name:"apiKey",value:ze,onChange:G=>ht(G.target.value),placeholder:"请输入API密钥",required:!0})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>m(!1),children:"取消"}),o.jsx("button",{type:"submit",className:"btn btn-primary",children:"确认配置"})]})]})]})})]})]})}function LB({value:e,options:t,onChange:n,disabled:r=!1,placeholder:i="请选择"}){const[a,l]=h.useState(!1),s=h.useRef(null);h.useEffect(()=>{if(!a)return;const u=f=>{s.current&&!s.current.contains(f.target)&&l(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[a]);const c=t.find(u=>u.value===e);return o.jsxs("div",{ref:s,style:{position:"relative"},children:[o.jsxs("div",{onClick:()=>!r&&l(!a),style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",border:`1px solid ${a?"var(--accent-primary)":"var(--border-primary)"}`,borderRadius:"8px",background:"var(--input-bg, var(--bg-primary))",cursor:r?"not-allowed":"pointer",opacity:r?.6:1,transition:"border-color 0.2s",userSelect:"none",minWidth:0},children:[c?o.jsx("span",{style:{fontSize:"14px",color:"var(--text-primary)"},children:c.label}):o.jsx("span",{style:{fontSize:"14px",color:"var(--text-muted)"},children:i}),o.jsx("span",{style:{fontSize:"12px",color:"var(--text-muted)",marginLeft:"8px",flexShrink:0,transform:a?"rotate(180deg)":"rotate(0)",transition:"transform 0.2s"},children:"▼"})]}),a&&o.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:999,marginTop:"4px",maxHeight:"360px",overflowY:"auto",background:"var(--bg-primary)",border:"1px solid var(--border-primary)",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0,0,0,0.15)"},children:t.map(u=>{const f=e===u.value;return o.jsxs("div",{onClick:()=>{n(u.value),l(!1)},style:{padding:"10px 14px",cursor:"pointer",background:f?"var(--accent-light)":"transparent",borderLeft:f?"3px solid var(--accent-primary)":"3px solid transparent",transition:"background 0.15s"},onMouseEnter:d=>{f||(d.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:d=>{f||(d.currentTarget.style.background="transparent")},children:[o.jsxs("div",{style:{fontSize:"14px",fontWeight:f?600:400,color:"var(--text-primary)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px"},children:[o.jsx("span",{children:u.label}),f&&o.jsx("span",{style:{fontSize:"13px",color:"var(--accent-primary)",flexShrink:0},children:"✓"})]}),u.description&&o.jsx("div",{style:{fontSize:"12px",color:"var(--text-muted)",marginTop:"4px",lineHeight:"1.5"},children:u.description})]},u.value)})})]})}const zB={1:"选择节点",2:"Skills",3:"MCP",4:"供应商",5:"确认同步"};function $B({show:e,onClose:t,onComplete:n}){const[r,i]=h.useState(1),[a,l]=h.useState(!1),[s,c]=h.useState({current:0,total:0}),[u,f]=h.useState([]),[d,p]=h.useState(null),[m,g]=h.useState(""),[y,x]=h.useState("4567"),[v,b]=h.useState(!1),[w,S]=h.useState([]),[C,j]=h.useState(""),[E,O]=h.useState(4567),[R,A]=h.useState("scan"),[N,_]=h.useState([]),[q,W]=h.useState(new Set),[I,F]=h.useState([]),[K,M]=h.useState(new Set),[B,k]=h.useState({}),[L,Q]=h.useState(!1),[T,ce]=h.useState(""),[ve,X]=h.useState(!1),[oe,fe]=h.useState(!1),[te,Z]=h.useState(!1),se=h.useCallback(()=>{i(1),l(!1),c({current:0,total:0}),f([]),p(null),g(""),x("4567"),b(!1),_([]),W(new Set),F([]),M(new Set),k({}),Q(!1),ce(""),X(!1),fe(!1),Z(!1),S([]),j(""),O(4567),A("scan")},[]);h.useEffect(()=>{e&&(se(),re())},[e]);const re=async()=>{try{const D=await V.lanScan();S(D.networkInterfaces||[]),O(D.port),D.networkInterfaces.length<=1,j(D.subnet),Oe(D.subnet,D.port,D.localIp)}catch(D){console.error("[LAN Scan] 获取网络信息失败:",D)}},Oe=async(D,de,me)=>{l(!0),f([]),c({current:0,total:0});const Te=Date.now();try{const Pe=[];for(let Ve=1;Ve<=254;Ve++){const We=`${D}.${Ve}`;We!==me&&Pe.push(We)}c({current:0,total:Pe.length});const De=30,Le=[];for(let Ve=0;Ve<Pe.length;Ve+=De){const We=Pe.slice(Ve,Ve+De),Qe=await Promise.allSettled(We.map(async ut=>{const fn=await V.lanDiscover(ut,de);return{ip:ut,port:de,data:fn}}));for(const ut of Qe)ut.status==="fulfilled"&&Le.push(ut.value);f([...Le]),c({current:Math.min(Ve+De,Pe.length),total:Pe.length})}c({current:Pe.length,total:Pe.length})}catch(Pe){console.error("[LAN Scan] 扫描失败:",Pe)}finally{const Pe=Date.now()-Te;Pe<1e3&&await new Promise(De=>setTimeout(De,1e3-Pe)),l(!1),fe(!0)}},ne=D=>{j(D);const de=w.find(me=>me.subnet===D);de&&Oe(de.subnet,E,de.address)},_e=()=>{const D=w.find(de=>de.subnet===C);D&&(p(null),Oe(D.subnet,E,D.address))},Re=async()=>{if(m.trim()){b(!0);try{const D=parseInt(y)||4567,de=await V.lanDiscover(m.trim(),D),me={ip:m.trim(),port:D,data:de};f(Te=>Te.some(Pe=>Pe.ip===m.trim()&&Pe.port===D)?Te:[...Te,me]),p(me),U.success("连接成功")}catch{U.error("无法连接,请检查 IP 和端口")}finally{b(!1)}}},Fe=async()=>{if(d){Z(!0);try{let D=[],de=[];try{D=await V.getInstalledSkills()}catch{}try{de=await V.getMCPs()}catch(Le){console.error("[LAN Sync] 获取本地 MCPs 失败,重复检测可能不准确:",Le)}const me=new Set(D.map(Le=>Le.name)),Te=new Set(de.map(Le=>Le.name)),Pe=(d.data.skills||[]).map(Le=>({...Le,isDuplicate:me.has(Le.name)}));_(Pe);const De=(d.data.mcps||[]).map(Le=>({...Le,isDuplicate:Te.has(Le.name)}));F(De),i(2)}finally{Z(!1)}}},rt=async()=>{if(!d)return;const D=q.size>0,de=K.size>0;if(!(!D&&!de&&!L)){X(!0);try{const me=await V.lanSync({remoteNode:{ip:d.ip,port:d.port,name:d.data.node.name},skills:N.filter(Te=>q.has(Te.name)&&!Te.isDuplicate).map(({isDuplicate:Te,...Pe})=>Pe),mcps:I.filter(Te=>K.has(Te.name)&&!Te.isDuplicate).map(({isDuplicate:Te,...Pe})=>{const De=B[Pe.name];return De&&Pe.env?{...Pe,env:{...Pe.env,...De}}:Pe}),vendor:{enabled:L,apiKey:T||void 0}});me.success?(U.success("同步完成"),n(),setTimeout(()=>t(),500)):U.error("同步失败: "+(me.error||"未知错误"))}catch(me){U.error("同步失败: "+me.message)}finally{X(!1)}}},Be=D=>D.env?Object.entries(D.env).filter(([,de])=>de==="***").map(([de])=>de):[],qe=(D,de,me)=>{k(Te=>({...Te,[D]:{...Te[D]||{},[de]:me}}))},ye=D=>{const de=N.find(me=>me.name===D);de!=null&&de.isDuplicate||W(me=>{const Te=new Set(me);return Te.has(D)?Te.delete(D):Te.add(D),Te})},Ee=()=>{const D=N.filter(me=>!me.isDuplicate),de=D.every(me=>q.has(me.name));W(de?new Set:new Set(D.map(me=>me.name)))},ze=D=>{const de=I.find(me=>me.name===D);de!=null&&de.isDuplicate||M(me=>{const Te=new Set(me);return Te.has(D)?Te.delete(D):Te.add(D),Te})},ht=()=>{const D=I.filter(me=>!me.isDuplicate),de=D.every(me=>K.has(me.name));M(de?new Set:new Set(D.map(me=>me.name)))},ee=q.size>0||K.size>0||L,Y=N.filter(D=>!D.isDuplicate),le=I.filter(D=>!D.isDuplicate);return e?o.jsxs("div",{className:"modal-overlay",onClick:D=>{D.target===D.currentTarget&&!ve&&t()},children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:()=>{ve||t()},"aria-label":"关闭",children:"×"}),o.jsx("div",{className:"modal",style:{width:"720px",maxWidth:"90%"},children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:"局域网内同步配置"})}),o.jsx("div",{style:{display:"flex",justifyContent:"space-between",padding:"0 24px",marginBottom:"20px",borderBottom:"1px solid var(--border-secondary)",paddingBottom:"12px"},children:[1,2,3,4,5].map(D=>o.jsxs("span",{style:{fontSize:"13px",color:r===D?"var(--primary-color)":D<r?"var(--text-secondary)":"var(--text-muted)",fontWeight:r===D?600:400,borderBottom:r===D?"2px solid var(--primary-color)":"2px solid transparent",paddingBottom:"10px",cursor:"default",whiteSpace:"nowrap"},children:[D<r?"✓ ":`${D} `,zB[D]]},D))}),o.jsxs("div",{style:{padding:"0 24px",minHeight:"300px",position:"relative"},children:[r===1&&o.jsxs("div",{children:[o.jsx("div",{style:{display:"flex",gap:"24px",marginBottom:"20px"},children:["scan","manual"].map(D=>o.jsx("button",{type:"button",onClick:()=>A(D),style:{padding:"8px 4px",background:"none",border:"none",borderBottom:R===D?"2px solid var(--primary-color)":"none",color:R===D?"var(--primary-color)":"var(--text-muted)",fontWeight:R===D?500:400,fontSize:"14px",cursor:"pointer",transition:"all 0.2s"},children:D==="scan"?"局域网扫描":"手动添加"},D))}),R==="scan"&&o.jsxs(o.Fragment,{children:[w.length>0&&o.jsxs("div",{style:{marginBottom:"16px",padding:"10px 14px",background:"var(--accent-light)",borderRadius:"8px",fontSize:"13px",color:"var(--text-secondary)"},children:[o.jsx("span",{style:{fontWeight:500,color:"var(--accent-primary)"},children:"本机"})," · ",w.map(D=>D.address).join("、")," · ","端口 ",E,w.length>1&&o.jsxs(o.Fragment,{children:[" · ",w.map((D,de)=>o.jsxs("span",{children:[de>0?" / ":"",o.jsxs("button",{type:"button",onClick:()=>ne(D.subnet),disabled:a,style:{padding:0,border:"none",background:"none",color:C===D.subnet?"var(--primary-color)":"var(--text-muted)",fontSize:"12px",fontWeight:C===D.subnet?600:400,cursor:a?"not-allowed":"pointer",textDecoration:C===D.subnet?"underline":"none"},children:[D.subnet,".0/",D.netmask]})]},D.subnet))]})]}),a&&o.jsxs("div",{style:{marginBottom:"16px"},children:[o.jsxs("p",{style:{fontSize:"14px",color:"#666",marginBottom:"8px"},children:["正在扫描 ",C,".0 网段... ",s.current,"/",s.total]}),o.jsx("div",{style:{width:"100%",height:"6px",background:"var(--bg-secondary)",borderRadius:"3px",overflow:"hidden"},children:o.jsx("div",{style:{width:s.total>0?`${s.current/s.total*100}%`:"0%",height:"100%",background:"var(--primary-color)",borderRadius:"3px",transition:"width 0.3s ease"}})})]}),!a&&oe&&u.length===0&&o.jsxs("div",{style:{textAlign:"center",padding:"40px 0",color:"#999"},children:[o.jsx("p",{style:{fontSize:"16px",marginBottom:"8px"},children:"未发现可用节点"}),o.jsx("p",{style:{fontSize:"14px",marginBottom:"12px"},children:'请确认远端节点已开启"允许局域网拉取配置"'}),o.jsx("button",{type:"button",className:"btn btn-secondary",style:{fontSize:"13px",padding:"6px 16px"},onClick:_e,children:"重新扫描"})]}),u.length>0&&o.jsxs("div",{style:{marginBottom:"16px"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[o.jsxs("p",{style:{fontSize:"14px",color:"#666"},children:["已发现 ",u.length," 个节点:"]}),!a&&oe&&o.jsx("button",{type:"button",className:"btn btn-secondary",style:{fontSize:"12px",padding:"4px 10px"},onClick:_e,children:"重新扫描"})]}),o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:u.map(D=>{var de,me;return o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",border:`2px solid ${(d==null?void 0:d.ip)===D.ip&&(d==null?void 0:d.port)===D.port?"var(--primary-color)":"var(--border-secondary)"}`,borderRadius:"8px",cursor:"pointer",background:(d==null?void 0:d.ip)===D.ip&&(d==null?void 0:d.port)===D.port?"var(--primary-bg)":"transparent",transition:"all 0.2s"},onClick:()=>p(D),children:[o.jsx("input",{type:"radio",name:"node",checked:(d==null?void 0:d.ip)===D.ip&&(d==null?void 0:d.port)===D.port,onChange:()=>p(D),style:{accentColor:"var(--primary-color)"}}),o.jsxs("div",{style:{flex:1},children:[o.jsx("div",{style:{fontWeight:500},children:D.data.node.name}),o.jsxs("div",{style:{fontSize:"13px",color:"#666"},children:[D.ip,":",D.port,((de=D.data.skills)==null?void 0:de.length)>0&&` · ${D.data.skills.length} Skills`,((me=D.data.mcps)==null?void 0:me.length)>0&&` · ${D.data.mcps.length} MCP`]})]})]},`${D.ip}-${D.port}`)})})]})]}),te&&o.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,background:"rgba(255, 255, 255, 0.7)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:"8px",zIndex:10},children:[o.jsx("div",{style:{width:"32px",height:"32px",border:"3px solid var(--border-secondary)",borderTop:"3px solid var(--primary-color)",borderRadius:"50%",animation:"spin 1s linear infinite",marginBottom:"12px"}}),o.jsx("p",{style:{fontSize:"14px",color:"var(--text-secondary)"},children:"正在准备数据..."}),o.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]}),R==="manual"&&o.jsxs("div",{style:{padding:"20px 0"},children:[o.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center",marginBottom:"16px"},children:[o.jsx("input",{type:"text",value:m,onChange:D=>g(D.target.value),placeholder:"IP 地址,如 192.168.1.100",style:{flex:1,padding:"8px 12px",borderRadius:"6px",border:"1px solid var(--border-secondary)",background:"var(--input-bg, var(--bg-card))",color:"var(--text-primary)",fontSize:"14px"}}),o.jsx("input",{type:"text",value:y,onChange:D=>x(D.target.value),placeholder:"端口",style:{width:"80px",padding:"8px 12px",borderRadius:"6px",border:"1px solid var(--border-secondary)",background:"var(--input-bg, var(--bg-card))",color:"var(--text-primary)",fontSize:"14px"}}),o.jsx("button",{className:"btn btn-primary",onClick:Re,disabled:v||!m.trim(),children:v?"连接中...":"连接"})]}),u.length>0&&o.jsxs("div",{children:[o.jsx("p",{style:{fontSize:"14px",color:"#666",marginBottom:"8px"},children:"已发现的节点:"}),o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:u.map(D=>{var de,me;return o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",border:`2px solid ${(d==null?void 0:d.ip)===D.ip&&(d==null?void 0:d.port)===D.port?"var(--primary-color)":"var(--border-secondary)"}`,borderRadius:"8px",cursor:"pointer",background:(d==null?void 0:d.ip)===D.ip&&(d==null?void 0:d.port)===D.port?"var(--primary-bg)":"transparent",transition:"all 0.2s"},onClick:()=>p(D),children:[o.jsx("input",{type:"radio",name:"node",checked:(d==null?void 0:d.ip)===D.ip&&(d==null?void 0:d.port)===D.port,onChange:()=>p(D),style:{accentColor:"var(--primary-color)"}}),o.jsxs("div",{style:{flex:1},children:[o.jsx("div",{style:{fontWeight:500},children:D.data.node.name}),o.jsxs("div",{style:{fontSize:"13px",color:"#666"},children:[D.ip,":",D.port,((de=D.data.skills)==null?void 0:de.length)>0&&` · ${D.data.skills.length} Skills`,((me=D.data.mcps)==null?void 0:me.length)>0&&` · ${D.data.mcps.length} MCP`]})]})]},`${D.ip}-${D.port}`)})})]})]})]}),r===2&&o.jsxs("div",{children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px"},children:[o.jsxs("p",{style:{fontSize:"14px",color:"#666"},children:["远端节点:",d==null?void 0:d.data.node.name," (",d==null?void 0:d.ip,")"]}),Y.length>0&&o.jsx("button",{className:"btn btn-secondary",style:{fontSize:"12px",padding:"4px 10px"},onClick:Ee,children:Y.every(D=>q.has(D.name))?"取消全选":"全选"})]}),o.jsx("p",{style:{fontSize:"15px",fontWeight:500,marginBottom:"12px"},children:"选择需要同步的 Skills:"}),N.length===0?o.jsx("div",{style:{textAlign:"center",padding:"30px 0",color:"#999"},children:o.jsx("p",{children:"远端无可用 Skills"})}):o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px",maxHeight:"360px",overflowY:"auto"},children:N.map(D=>o.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"10px",padding:"10px 12px",border:`1px solid ${D.isDuplicate?"#f0ad4e":"var(--border-secondary)"}`,borderRadius:"8px",cursor:D.isDuplicate?"not-allowed":"pointer",opacity:D.isDuplicate?.7:1,background:D.isDuplicate?"var(--bg-secondary)":"transparent"},children:[o.jsx("input",{type:"checkbox",checked:q.has(D.name),onChange:()=>ye(D.name),disabled:D.isDuplicate,style:{accentColor:"var(--primary-color)",marginTop:"2px"}}),o.jsxs("div",{style:{flex:1},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[o.jsx("span",{style:{fontWeight:500},children:D.name}),D.targets&&D.targets.length>0&&o.jsx("span",{style:{fontSize:"11px",padding:"1px 6px",borderRadius:"4px",background:"var(--bg-secondary)",color:"#666"},children:D.targets.join(", ")})]}),D.description&&o.jsx("div",{style:{fontSize:"13px",color:"#666",marginTop:"2px"},children:D.description}),D.isDuplicate&&o.jsx("div",{style:{fontSize:"12px",color:"#e67e22",marginTop:"4px"},children:"⚠ 本地已存在,无法重复同步"})]})]},D.name))})]}),r===3&&o.jsxs("div",{children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px"},children:[o.jsx("p",{style:{fontSize:"15px",fontWeight:500},children:"选择需要同步的 MCP:"}),le.length>0&&o.jsx("button",{className:"btn btn-secondary",style:{fontSize:"12px",padding:"4px 10px"},onClick:ht,children:le.every(D=>K.has(D.name))?"取消全选":"全选"})]}),I.length===0?o.jsx("div",{style:{textAlign:"center",padding:"30px 0",color:"#999"},children:o.jsx("p",{children:"远端无可用 MCP"})}):o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px",maxHeight:"360px",overflowY:"auto"},children:I.map(D=>{const de=Be(D),me=K.has(D.name),Te=me&&de.length>0;return o.jsxs("div",{style:{border:`1px solid ${D.isDuplicate?"#f0ad4e":"var(--border-secondary)"}`,borderRadius:"8px",opacity:D.isDuplicate?.7:1,background:D.isDuplicate?"var(--bg-secondary)":"transparent",overflow:"hidden"},children:[o.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"10px",padding:"10px 12px",cursor:D.isDuplicate?"not-allowed":"pointer"},children:[o.jsx("input",{type:"checkbox",checked:me,onChange:()=>ze(D.name),disabled:D.isDuplicate,style:{accentColor:"var(--primary-color)",marginTop:"2px"}}),o.jsxs("div",{style:{flex:1},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[o.jsx("span",{style:{fontWeight:500},children:D.name}),o.jsx("span",{style:{fontSize:"11px",padding:"1px 6px",borderRadius:"4px",background:"var(--bg-secondary)",color:"#666"},children:D.type}),de.length>0&&!D.isDuplicate&&o.jsx("span",{style:{fontSize:"11px",padding:"1px 6px",borderRadius:"4px",background:"#fff3e0",color:"#e67e22"},children:"含敏感变量"})]}),D.description&&o.jsx("div",{style:{fontSize:"13px",color:"#666",marginTop:"2px"},children:D.description}),D.isDuplicate&&o.jsx("div",{style:{fontSize:"12px",color:"#e67e22",marginTop:"4px"},children:"⚠ 本地已存在,无法重复同步"})]})]}),Te&&o.jsxs("div",{style:{padding:"8px 12px 12px 36px",borderTop:"1px dashed var(--border-secondary)",background:"var(--bg-secondary)"},children:[o.jsx("p",{style:{fontSize:"12px",color:"#e67e22",marginBottom:"8px"},children:"以下环境变量需要手动填写:"}),de.map(Pe=>{var De;return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"6px"},children:[o.jsx("span",{style:{fontSize:"12px",color:"#666",minWidth:"120px",fontFamily:"monospace"},children:Pe}),o.jsx("input",{type:"text",value:((De=B[D.name])==null?void 0:De[Pe])||"",onChange:Le=>qe(D.name,Pe,Le.target.value),placeholder:`请输入 ${Pe}`,style:{flex:1,padding:"4px 8px",borderRadius:"4px",border:"1px solid var(--border-secondary)",background:"var(--input-bg, #fff)",color:"var(--text-primary)",fontSize:"12px"}})]},Pe)})]})]},D.name)})})]}),r===4&&o.jsxs("div",{children:[o.jsx("p",{style:{fontSize:"15px",fontWeight:500,marginBottom:"16px"},children:"是否将该节点作为本地供应商?"}),o.jsxs("div",{style:{display:"flex",gap:"24px",marginBottom:"16px"},children:[o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer"},children:[o.jsx("input",{type:"radio",name:"createVendor",checked:L,onChange:()=>Q(!0),style:{accentColor:"var(--primary-color)"}}),o.jsx("span",{children:"是"})]}),o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer"},children:[o.jsx("input",{type:"radio",name:"createVendor",checked:!L,onChange:()=>Q(!1),style:{accentColor:"var(--primary-color)"}}),o.jsx("span",{children:"否"})]})]}),L&&o.jsxs("div",{style:{padding:"16px",border:"1px solid var(--border-secondary)",borderRadius:"8px",marginBottom:"12px"},children:[o.jsx("label",{style:{fontSize:"14px",fontWeight:500,display:"block",marginBottom:"6px"},children:"API Key(选填)"}),o.jsx("input",{type:"text",value:T,onChange:D=>ce(D.target.value),placeholder:"如果远端节点开启了认证,请填写其接入密钥",style:{width:"100%",padding:"8px 12px",borderRadius:"6px",border:"1px solid var(--border-secondary)",background:"var(--input-bg, var(--bg-secondary))",color:"var(--text-primary)",boxSizing:"border-box"}}),o.jsx("p",{style:{fontSize:"12px",color:"#999",marginTop:"6px"},children:"不填写则使用空密钥连接。"})]}),L&&o.jsxs("p",{style:{fontSize:"13px",color:"#666"},children:["将创建供应商 ",o.jsxs("strong",{children:[d==null?void 0:d.data.node.name,"@",d==null?void 0:d.ip]}),", 包含 6 个 API 服务(Claude Code、Codex、Claude、Responses、Chat Completions、Gemini)。"]}),!L&&o.jsx("p",{style:{fontSize:"13px",color:"#999"},children:"跳过供应商创建,仅同步 Skills 和 MCP 配置。"})]}),r===5&&!ve&&o.jsxs("div",{children:[o.jsx("p",{style:{fontSize:"16px",fontWeight:600,marginBottom:"16px"},children:"同步预览"}),o.jsxs("div",{style:{marginBottom:"16px"},children:[o.jsxs("h4",{style:{fontSize:"14px",color:"#666",marginBottom:"8px"},children:["Skills(",q.size," 项)"]}),q.size===0?o.jsx("p",{style:{fontSize:"13px",color:"#999",paddingLeft:"8px"},children:"未选择"}):o.jsx("div",{style:{paddingLeft:"8px"},children:N.filter(D=>q.has(D.name)).map(D=>{var de;return o.jsxs("div",{style:{fontSize:"14px",padding:"2px 0"},children:["· ",D.name," ",(de=D.targets)!=null&&de.length?`(${D.targets.join(", ")})`:""]},D.name)})})]}),o.jsxs("div",{style:{marginBottom:"16px"},children:[o.jsxs("h4",{style:{fontSize:"14px",color:"#666",marginBottom:"8px"},children:["MCP(",K.size," 项)"]}),K.size===0?o.jsx("p",{style:{fontSize:"13px",color:"#999",paddingLeft:"8px"},children:"未选择"}):o.jsx("div",{style:{paddingLeft:"8px"},children:I.filter(D=>K.has(D.name)).map(D=>{const de=Be(D),me=de.some(Te=>{var Pe,De;return!((De=(Pe=B[D.name])==null?void 0:Pe[Te])!=null&&De.trim())});return o.jsxs("div",{style:{fontSize:"14px",padding:"2px 0"},children:["· ",D.name," (",D.type,")",de.length>0&&o.jsx("span",{style:{fontSize:"12px",color:me?"#e74c3c":"#e67e22",marginLeft:"6px"},children:me?`⚠ ${de.length} 个敏感变量未填写`:"✓ 敏感变量已填写"})]},D.name)})})]}),o.jsxs("div",{style:{marginBottom:"16px"},children:[o.jsx("h4",{style:{fontSize:"14px",color:"#666",marginBottom:"8px"},children:"供应商"}),L?o.jsxs("div",{style:{paddingLeft:"8px"},children:[o.jsxs("div",{style:{fontSize:"14px"},children:["名称:",d==null?void 0:d.data.node.name,"@",d==null?void 0:d.ip]}),o.jsxs("div",{style:{fontSize:"14px"},children:["API Key:",T?"已填写":"未填写"]}),o.jsx("div",{style:{fontSize:"14px"},children:"API 服务:6 个(Claude Code、Codex、Claude、Responses、Chat Completions、Gemini)"})]}):o.jsx("p",{style:{fontSize:"13px",color:"#999",paddingLeft:"8px"},children:"不创建"})]}),!ee&&o.jsx("p",{style:{fontSize:"13px",color:"#e74c3c",textAlign:"center"},children:"未选择任何同步内容"})]}),r===5&&ve&&o.jsxs("div",{style:{textAlign:"center",padding:"60px 0"},children:[o.jsx("div",{style:{width:"40px",height:"40px",border:"3px solid var(--border-secondary)",borderTop:"3px solid var(--primary-color)",borderRadius:"50%",animation:"spin 1s linear infinite",margin:"0 auto 16px"}}),o.jsx("p",{style:{fontSize:"16px",color:"#666"},children:"正在同步..."}),o.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]})]}),o.jsxs("div",{className:"modal-footer",style:{marginTop:"20px"},children:[r>1&&(r<5||!ve)&&o.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>i(r-1),disabled:ve,children:"← 上一步"}),o.jsx("div",{style:{flex:1}}),o.jsx("button",{type:"button",className:"btn btn-secondary",onClick:t,disabled:ve,children:"取消"}),r===1&&o.jsx("button",{type:"button",className:"btn btn-primary",onClick:Fe,disabled:!d||te,children:te?"加载中...":"下一步 →"}),r===2&&o.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>i(3),children:"下一步 →"}),r===3&&o.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>i(4),children:"下一步 →"}),r===4&&o.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>i(5),children:"下一步 →"}),r===5&&!ve&&o.jsx("button",{type:"button",className:"btn btn-primary",onClick:rt,disabled:!ee,children:"同步"})]})]})})]}):null}const WT=h.createContext(null),BB=async e=>{try{await V.clearRuleStatus(e)}catch(t){throw console.error("[RulesStatus] 清除规则状态失败:",t),t}};function FB(e){const t={};return e.forEach(n=>{t[n.ruleId]={status:n.status,totalTokensUsed:n.totalTokensUsed,totalRequestsUsed:n.totalRequestsUsed,errorMessage:n.errorMessage,errorType:n.errorType,lastUpdate:n.timestamp}}),t}function UB({children:e}){const[t,n]=h.useState({}),r=h.useRef(null),i=h.useRef(null),a=h.useRef(Date.now());h.useEffect(()=>{let f=!0;const d=()=>{r.current&&(r.current.close(),r.current=null);const p=localStorage.getItem("auth_token"),m=p?`/api/rules/status/stream?token=${encodeURIComponent(p)}`:"/api/rules/status/stream",g=new EventSource(m);r.current=g,a.current=Date.now(),g.onmessage=y=>{a.current=Date.now();try{const x=JSON.parse(y.data);if(x.type==="init")n(FB(x.statuses));else if(x.type==="update"){const v=x.status;n(b=>({...b,[v.ruleId]:{status:v.status,totalTokensUsed:v.totalTokensUsed,totalRequestsUsed:v.totalRequestsUsed,errorMessage:v.errorMessage,errorType:v.errorType,lastUpdate:v.timestamp}}))}}catch(x){console.error("[RulesStatus] SSE 数据解析错误:",x)}},g.onerror=()=>{console.warn("[RulesStatus] SSE 连接错误,准备重连..."),g.close(),r.current=null,a.current=0}};return d(),i.current=setInterval(()=>{if(!f)return;const m=Date.now()-a.current;m>=15e3&&(console.warn(`[RulesStatus] 心跳超时(${Math.round(m/1e3)}秒无响应),重新连接 SSE...`),d())},3e3),()=>{f=!1,r.current&&(r.current.close(),r.current=null),i.current&&(clearInterval(i.current),i.current=null)}},[]),h.useEffect(()=>{},[]);const s={ruleStatuses:t,getRuleStatus:c=>t[c],clearRuleStatus:BB};return o.jsx(WT.Provider,{value:s,children:e})}function WB(){const e=h.useContext(WT);return e||{ruleStatuses:{},getRuleStatus:t=>{},clearRuleStatus:async t=>{}}}const KB=[{value:"codex",label:"Codex",icon:"🤖"},{value:"claude-code",label:"Claude Code",icon:"⚡"},{value:"api",label:"所有 API",icon:"🔗"}],HB={codex:" [Codex]","claude-code":" [Claude Code]",api:" [API]"},VB={"claude-code":{claude:0,"claude-chat":1,"openai-chat":2,openai:3,gemini:4,"gemini-chat":5},codex:{openai:0,"openai-chat":1,claude:2,"claude-chat":3,gemini:4,"gemini-chat":5},api:{"openai-chat":0,claude:1,"claude-chat":2,openai:3,gemini:4,"gemini-chat":5}};function KT({show:e,onClose:t,onComplete:n}){const[r,i]=h.useState(""),[a,l]=h.useState(""),[s,c]=h.useState("codex"),[u,f]=h.useState(!1),[d,p]=h.useState([]),[m,g]=h.useState([]);h.useEffect(()=>{e&&(V.getVendors().then(p).catch(()=>{}),V.getRoutes().then(g).catch(()=>{}))},[e]);const y=r?Tn[r]:null,x=y?d.find(j=>j.name===y.name):null,v=!!(x!=null&&x.apiKey),b=!x||!v;if(!e)return null;const w=()=>{u||(i(""),l(""),c("codex"),t())},S=(j,E)=>V.createAPIService({vendorId:j,name:E.name,apiUrl:E.apiUrl,apiKey:"",inheritVendorApiKey:!0,inheritVendorApiBaseUrl:!1,sourceType:E.sourceType,authType:E.authType,supportedModels:E.models?E.models.split(",").map(O=>O.trim()):void 0,modelLimits:E.modelLimits||{},enableCodingPlan:!1}),C=async j=>{var O,R;if(j.preventDefault(),!r){U.warning("请选择供应商");return}if(b&&!a){U.warning("请填写 API Key");return}const E=Tn[r];if(!E){U.error("未找到对应的供应商配置");return}f(!0);try{let A,N;if(x){A=x.id,!v&&a&&await V.updateVendor(A,{...x,apiKey:a});const M=new Set((x.services||[]).map(L=>L.sourceType)),B=E.services.filter(L=>!M.has(L.sourceType)),k=B.length>0?await Promise.all(B.map(L=>S(A,L))):[];N=[...x.services||[],...k]}else{const M=await V.createVendor({name:E.name,description:E.description,apiKey:a,authType:E.authType??et.AUTH_TOKEN,...E.apiBaseUrl?{apiBaseUrl:E.apiBaseUrl}:{},sortOrder:0,services:[]});if(!(M!=null&&M.id))throw new Error("供应商创建失败");A=M.id,N=await Promise.all(E.services.map(B=>S(A,B)))}const _=E.name+HB[s],q=new Set(m.map(M=>M.name));let W=_;if(q.has(W)){let M=2;for(;q.has(`${_}-${M}`);)M++;W=`${_}-${M}`}const I=await V.createRoute({name:W,description:"由一键配置自动创建"});if(!(I!=null&&I.id))throw new Error("路由创建失败");const F=VB[s],K=(O=[...N].filter(M=>M.sourceType).map(M=>({service:M,priority:F[M.sourceType]??99})).sort((M,B)=>M.priority-B.priority)[0])==null?void 0:O.service;if(K){const M=(R=K.supportedModels)!=null&&R.length?K.supportedModels[0]:void 0;await V.createRule({routeId:I.id,contentType:"default",targetServiceId:K.id,targetModel:M,sortOrder:0})}if(s==="codex"||s==="claude-code")try{await V.activateToolRoute(s,I.id)}catch{}if(s==="api"){let M=null;try{M=await V.getApiPathBindings()}catch{}if(M!=null&&M.bindings){const B=M.bindings.map(k=>k.apiPath==="/v1/models"?k:{...k,routeId:I.id});try{await V.updateApiPathBindings(B,M.models||"")}catch{}}}U.success("一键配置完成!路由已激活,可以开始使用"),n==null||n(),w(),setTimeout(()=>{window.location.reload()},300)}catch(A){console.error("一键配置失败:",A),U.error(`配置失败: ${A instanceof Error?A.message:"未知错误"}`)}finally{f(!1)}};return o.jsxs("div",{className:"modal-overlay",children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:w,"aria-label":"关闭",disabled:u,children:"×"}),o.jsx("div",{className:"modal",children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:"🚀 一键配置"})}),o.jsxs("form",{onSubmit:C,children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"供应商"}),o.jsx(UT,{value:r,onChange:j=>i(j),existingVendors:d,disabled:u})]}),(y==null?void 0:y.description)&&o.jsxs("div",{style:{fontSize:".8em",marginBottom:16,marginTop:-16},children:[y.description,y.link&&o.jsxs(o.Fragment,{children:[" ",o.jsx("a",{href:y.link,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent-primary)"},children:(()=>{try{const j=new URL(y.link);return j.protocol+"//"+j.hostname}catch{return y.link}})()})]})]}),b&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"API Key"}),o.jsx("input",{type:"password",value:a,onChange:j=>l(j.target.value),placeholder:"请输入API密钥",required:!0,disabled:u})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"目标"}),o.jsx("div",{style:{border:"1px solid var(--border-primary)",borderRadius:"8px",padding:"12px",background:"var(--bg-secondary)",display:"flex",flexDirection:"column",gap:"8px"},children:KB.map(j=>{const E=s===j.value;return o.jsxs("label",{style:{display:"flex",alignItems:"center",cursor:"pointer",padding:"10px 14px",borderRadius:"6px",background:E?"var(--accent-light)":"transparent",border:`2px solid ${E?"var(--accent-primary)":"transparent"}`,transition:"all 0.2s ease"},onMouseEnter:O=>{E||(O.currentTarget.style.background="var(--bg-hover)",O.currentTarget.style.borderColor="var(--border-secondary)")},onMouseLeave:O=>{E||(O.currentTarget.style.background="transparent",O.currentTarget.style.borderColor="transparent")},children:[o.jsx("input",{type:"radio",name:"setupTarget",value:j.value,checked:E,onChange:()=>c(j.value),style:{width:"18px",height:"18px",marginRight:"12px",cursor:"pointer",accentColor:"var(--accent-primary)"},disabled:u}),o.jsxs("span",{style:{fontSize:"14px",fontWeight:E?"600":"400",color:"var(--text-primary)",transition:"all 0.2s ease"},children:[j.icon," ",j.label]}),E&&o.jsx("span",{style:{marginLeft:"auto",fontSize:"16px",color:"var(--text-primary)"},children:"✓"})]},j.value)})})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{type:"button",className:"btn btn-secondary",onClick:w,disabled:u,children:"取消"}),o.jsx("button",{type:"submit",className:"btn btn-primary",disabled:u,children:u?"配置中...":"确认配置"})]})]})]})})]})}const qB=""+new URL("openai-CPEiZpaN.webp",import.meta.url).href,YB=""+new URL("claude-XtpLmGtF.webp",import.meta.url).href,Ej=[{value:"compact",label:"压缩对话",icon:"📦"},{value:"image-understanding",label:"图像理解",icon:"🖼"},{value:"high-iq",label:"高智商",icon:"🧠"},{value:"long-context",label:"长上下文",icon:"📄"},{value:"thinking",label:"思考",icon:"💭"},{value:"background",label:"后台",icon:"⚙"},{value:"model-mapping",label:"模型顶替",icon:"🔄"},{value:"default",label:"默认"}],Tj={compact:0,"image-understanding":1,"high-iq":2,"long-context":3,thinking:4,background:5,"model-mapping":6,default:7},Oj={compact:"📦",background:"🧱",thinking:"💭","high-iq":"🧠","long-context":"📄","image-understanding":"🖼️","model-mapping":"🔄"},HT=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"Extra high"}],VT=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"max",label:"Max"}],Iv=[{value:"default",label:"default",desc:"每次编辑前都会请求批准。适合入门或处理敏感代码。"},{value:"acceptEdits",label:"acceptEdits",desc:"自动编辑选中文本或整个文件;读取、文件编辑及常见文件系统命令(mkdir、touch、mv、cp 等)免询问。"},{value:"plan",label:"plan",desc:"先探索代码并给出方案,确认后再编辑;仅读取免询问。"},{value:"auto",label:"auto",desc:"自动为每个任务选择最佳权限模式;所有操作免询问,带后台安全检查。"},{value:"dontAsk",label:"dontAsk",desc:"仅预先批准的工具免询问。适合锁定的 CI 与脚本。"},{value:"bypassPermissions",label:"bypassPermissions",desc:"运行潜在危险命令前不请求批准;所有操作免询问,带后台安全检查。仅建议在隔离容器与 VM 中使用。"}],GB=e=>HT.some(t=>t.value===e),XB=e=>VT.some(t=>t.value===e),QB=e=>Iv.some(t=>t.value===e),JB=e=>GB(e==null?void 0:e.codexModelReasoningEffort)?e.codexModelReasoningEffort:"high",ZB=e=>XB(e==null?void 0:e.claudeEffortLevel)?e.claudeEffortLevel:"medium",Hm=e=>{const t=QB(e==null?void 0:e.claudePermissionsDefaultMode)?e.claudePermissionsDefaultMode:"default";return t==="bypassPermissions"&&!(e!=null&&e.enableBypassPermissionsSupport)?"default":t};function Aj(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0");return`${t}-${n}-${r}T${i}:${a}`}function Ij(){var o1,l1,s1,c1,u1,d1,f1,p1,h1;const{confirm:e}=du(),{ruleStatuses:t,clearRuleStatus:n}=WB(),[r,i]=h.useState([]),[a,l]=h.useState([]),[s,c]=h.useState([]),[u,f]=h.useState([]),[d,p]=h.useState([]),[m,g]=h.useState([]),[y,x]=h.useState([]),[v,b]=h.useState(null),[w,S]=h.useState([]),[C,j]=h.useState(""),[E,O]=h.useState(null),[R,A]=h.useState(!1),[N,_]=h.useState(!1),[q,W]=h.useState(null),[I,F]=h.useState(null),[K,M]=h.useState(""),[B,k]=h.useState(""),[L,Q]=h.useState(""),[T,ce]=h.useState(""),[ve,X]=h.useState(0),[oe,fe]=h.useState((I==null?void 0:I.contentType)||""),[te,Z]=h.useState(void 0),[se,re]=h.useState(void 0),[Oe,ne]=h.useState(void 0),[_e,Re]=h.useState(void 0),[Fe,rt]=h.useState(""),[Be,qe]=h.useState(void 0),[ye,Ee]=h.useState(void 0),[ze,ht]=h.useState(void 0),[ee,Y]=h.useState(void 0),[le,D]=h.useState(void 0),[de,me]=h.useState(null),[Te,Pe]=h.useState(!1),[De,Le]=h.useState(!1),[Ve,We]=h.useState(void 0),[Qe,ut]=h.useState(void 0),[fn,G]=h.useState({}),[ge,je]=h.useState(!1),[Ae,Ue]=h.useState(""),[Nt,_t]=h.useState(1e3),[nn,Xt]=h.useState(!1),[Oi,Ln]=h.useState(!1),[dt,Yn]=h.useState(null),[ei,Qt]=h.useState(!1),[St,Ya]=h.useState(!1),[Ga,Qo]=h.useState(!1),[Jo,ia]=h.useState(!1),[Zo,Xa]=h.useState(""),[aa,Ht]=h.useState(!1),[$,z]=h.useState(""),[be,Ye]=h.useState(!1),[Ie,mt]=h.useState(""),[Vt,Lr]=h.useState(!1),[Qa,Ps]=h.useState({}),[Ja,Es]=h.useState(null),[Ke,Bt]=h.useState([]),[OM,Zb]=h.useState(!1),[e1,t1]=h.useState(null);h.useEffect(()=>{el(),im(),am(),DM(),xr(),$u(),n1(),MM(),a1()},[]);const n1=async()=>{try{const P=await V.getApiPathBindings();S(P.bindings||[]),j(P.models||"")}catch(P){console.error("Failed to load API path bindings:",P)}},r1=async(P,J)=>{try{const ue=await V.updateApiPathBindings(P,J);S(ue.bindings),U.success("路由映射已保存")}catch(ue){U.error(ue.message||"保存失败")}},AM=(P,J)=>{const ue=w.map(we=>we.apiPath===P?{...we,routeId:J}:we);S(ue),r1(ue,C)},IM=()=>{r1(w,C)};h.useEffect(()=>{E&&eo(E.id)},[E]),h.useEffect(()=>{g(K?d.filter(P=>P.vendorId===K):[]),k(""),Q("")},[K]);const el=async()=>{const P=await V.getRoutes();i(P),P.length>0&&!E&&O(P[0]);const J={};for(const ue of P)try{const we=await V.getBoundSessions(ue.id);J[ue.id]=we.sessions.length}catch{J[ue.id]=0}Ps(J)},NM=async P=>{Es(P),Zb(!0),Bt([]);try{const J=await V.getBoundSessions(P);Bt(J.sessions)}catch{Bt([])}finally{Zb(!1)}},i1=()=>{Es(null),Bt([])},_M=async P=>{if(await e({title:"确认解绑会话",message:"确定要解除该会话的路由绑定吗?解绑后,该会话的后续请求将不再使用此路由。",type:"danger",confirmText:"解绑",cancelText:"取消"})){t1(P);try{const ue=await V.unbindSessionRoute(P);ue.success?(U.success("已解除绑定"),Bt(we=>we.filter(it=>it.id!==P)),Ps(we=>{const it=Ja;return!it||!we[it]?we:{...we,[it]:Math.max(0,we[it]-1)}})):U.error(ue.error||"解绑失败")}catch(ue){U.error(ue.message||"解绑失败")}finally{t1(null)}}},MM=async()=>{try{const P=await V.checkClaudeVersion();Yn(P)}catch(P){console.error("Failed to check Claude version:",P)}},RM=(P,J)=>{if(!P)return-1;const ue=P.split(".").map(Number),we=J.split(".").map(Number);for(let it=0;it<3;it++){const st=ue[it]||0,Cn=we[it]||0;if(st>Cn)return 1;if(st<Cn)return-1}return 0},Za=()=>{var P;return(P=dt==null?void 0:dt.claudeCode)!=null&&P.version?RM(dt.claudeCode.version,"2.1.32")>=0:!1},eo=async P=>{const J=await V.getRules(P);if(l(J),a1(),P)try{const we=(await V.getRulesBlacklistStatus(P)).reduce((it,st)=>(it[st.ruleId]=st,it),{});G(we)}catch(ue){console.error("Failed to load blacklist status:",ue)}},a1=async()=>{try{const P=await V.getRules();c(P)}catch(P){console.error("Failed to load all rules:",P)}},im=async()=>{const P=await V.getVendors();f(P)},am=async()=>{const P=await V.getAPIServices();p(P)},DM=async()=>{const P=await V.getMCPs();x(P)},[Xe,LM]=h.useState(null),[ti,zu]=h.useState(null),xr=async()=>{try{const P=await V.getConfig();b(P),Xa(P.claudeDefaultModel||""),Ht(!1),z(P.autocompactPctOverride!=null?String(P.autocompactPctOverride):""),Ye(!1),mt(P.codexDefaultModel||""),Lr(!1),rt(typeof P.ruleGlobalTimeout=="number"&&P.ruleGlobalTimeout>0?String(P.ruleGlobalTimeout):"")}catch(P){console.error("Failed to load app config:",P)}},$u=async()=>{try{const P=await V.getToolBindings();LM(P)}catch(P){console.error("Failed to load tool bindings:",P)}},Bu=async(P,J)=>{zu(P);try{(await V.activateToolRoute(P,J)).success?(await $u(),await el(),U.success("路由已激活")):U.error("激活失败")}catch(ue){U.error(`激活失败: ${ue.message||"未知错误"}`)}finally{zu(null)}},Fu=async P=>{zu(P);try{(await V.deactivateToolRoute(P)).success?(await $u(),await el(),U.success("路由已停用")):U.error("停用失败")}catch(J){U.error(`停用失败: ${J.message||"未知错误"}`)}finally{zu(null)}},zM=async P=>{P.preventDefault();const J=new FormData(P.currentTarget),ue={name:J.get("name"),description:J.get("description")};q?await V.updateRoute(q.id,ue):await V.createRoute(ue),A(!1),el()},$M=async P=>{if(await e({message:"确定要删除此路由吗?",title:"确认删除",type:"danger",confirmText:"删除",cancelText:"取消"}))try{await V.deleteRoute(P),el(),E&&E.id===P&&(O(null),l([])),U.success("路由已删除")}catch(ue){U.error(ue.message||"删除失败")}},BM=async P=>{if(P.preventDefault(),oe==="image-understanding"&&ge&&!Ae){U.warning("请选择一个MCP工具");return}if(!ge&&!B){U.warning("请选择供应商API服务");return}if(!ge&&te!==void 0&&Ve!==void 0&&te>Ve){U.warning(`Token超量值 (${te}k) 不能超过API服务的限制 (${Ve}k)`);return}if(!ge&&Be!==void 0&&Qe!==void 0&&Be>Qe){U.warning(`请求次数超量值 (${Be}) 不能超过API服务的限制 (${Qe})`);return}const J=new FormData(P.currentTarget),ue={routeId:E.id,contentType:J.get("contentType"),targetServiceId:ge?"":B,targetModel:ge?void 0:L||"",replacedModel:T||"",sortOrder:ve,timeout:_e?_e*1e3:void 0,tokenLimit:ge?void 0:te||void 0,resetInterval:ge?void 0:se,tokenResetBaseTime:ge?void 0:Oe?Oe.getTime():void 0,requestCountLimit:ge?void 0:Be,requestResetInterval:ge?void 0:ye,requestResetBaseTime:ge?void 0:ze?ze.getTime():void 0,frequencyLimit:ee,frequencyWindow:le,useMCP:oe==="image-understanding"?ge:!1,mcpId:oe==="image-understanding"&&ge?Ae:void 0,sessionTokenThreshold:oe==="long-context"?Nt:void 0};I?await V.updateRule(I.id,ue):await V.createRule(ue),_(!1),E&&eo(E.id)},FM=async P=>{await e({message:"确定要删除此路由吗?",title:"确认删除",type:"danger",confirmText:"删除",cancelText:"取消"})&&(await V.deleteRule(P),E&&eo(E.id),U.success("规则已删除"))},UM=async P=>{try{const J=await V.toggleRuleDisable(P);E&&eo(E.id),U.success(J.isDisabled?"规则已屏蔽":"规则已启用")}catch(J){U.error("操作失败: "+J.message)}},WM=async P=>{var J,ue;try{const we=[];(J=fn[P])!=null&&J.isBlacklisted&&we.push(V.clearRuleBlacklist(P));const it=(ue=t[P])==null?void 0:ue.status;(it==="error"||it==="suspended")&&we.push(n(P)),await Promise.all(we),E&&eo(E.id),U.success("已恢复")}catch(we){U.error("恢复失败: "+we.message)}},KM=async P=>{try{const J=a.find(st=>st.id===P);if(!J)return;const ue=a.filter(st=>st.contentType===J.contentType),it=Math.max(...ue.map(st=>st.sortOrder||0))+1;await V.updateRule(P,{sortOrder:it}),E&&eo(E.id),U.success("优先级已提升至最高")}catch(J){U.error("操作失败: "+J.message)}},HM=async P=>{try{if(!a.find(we=>we.id===P))return;await V.updateRule(P,{sortOrder:0}),E&&eo(E.id),U.success("优先级已降至最低")}catch(J){U.error("操作失败: "+J.message)}},VM=async P=>{if(P&&!Za()){U.error("当前 Claude Code 版本不支持 Agent Teams 功能,需要版本 ≥ 2.1.32");return}try{const J=v||{};await V.updateConfig({...J,enableAgentTeams:P}),U.success(P?"Agent Teams 设置已保存(重启 Claude Code 后生效)":"Agent Teams 设置已取消(重启 Claude Code 后生效)"),await xr()}catch(J){U.error("更新失败: "+J.message)}},qM=async P=>{try{const J=v||{},ue=Hm(v),we=!P&&ue==="bypassPermissions"?"default":ue;await V.updateConfig({...J,enableBypassPermissionsSupport:P,claudePermissionsDefaultMode:we}),U.success(P?"对 bypassPermissions 的支持设置已保存(重启 Claude Code 后生效)":"对 bypassPermissions 的支持设置已取消(重启 Claude Code 后生效)"),await xr()}catch(J){U.error("更新失败: "+J.message)}},YM=async P=>{try{const J=v||{};await V.updateConfig({...J,claudePermissionsDefaultMode:P}),U.success("默认权限模式已保存(重启 Claude Code 后生效)"),await xr()}catch(J){U.error("更新失败: "+J.message)}},GM=async P=>{try{Qo(!0);const J=v||{};await V.updateConfig({...J,codexModelReasoningEffort:P}),U.success("Reasoning Effort 设置已保存(重启 Codex 后生效)"),await xr()}catch(J){U.error("更新失败: "+J.message)}finally{Qo(!1)}},XM=async P=>{try{ia(!0);const J=v||{};await V.updateConfig({...J,claudeEffortLevel:P}),U.success("Effort Level 设置已保存(重启 Claude Code 后生效)"),await xr()}catch(J){U.error("更新失败: "+J.message)}finally{ia(!1)}},QM=async()=>{try{const P=v||{};await V.updateConfig({...P,claudeDefaultModel:Zo.trim()||void 0}),U.success("默认模型已保存(重启 Claude Code 后生效)"),Ht(!1),await xr()}catch(P){U.error("保存失败: "+P.message)}},JM=async()=>{const P=$.trim();if(P===""){try{const ue=v||{};await V.updateConfig({...ue,autocompactPctOverride:void 0}),U.success("自动压缩百分比已清除(重启 Claude Code 后生效)"),Ye(!1),await xr()}catch(ue){U.error("保存失败: "+ue.message)}return}const J=Number(P);if(!Number.isInteger(J)||J<1||J>100){U.error("自动压缩百分比必须为 1-100 的整数");return}try{const ue=v||{};await V.updateConfig({...ue,autocompactPctOverride:J}),U.success("自动压缩百分比已保存(重启 Claude Code 后生效)"),Ye(!1),await xr()}catch(ue){U.error("保存失败: "+ue.message)}},ZM=async()=>{try{const P=v||{};await V.updateConfig({...P,codexDefaultModel:Ie.trim()||void 0}),U.success("默认模型已保存(重启 Codex 后生效)"),Lr(!1),await xr()}catch(P){U.error("保存失败: "+P.message)}},eR=async()=>{try{const P=v||{},J=Number(Fe),ue=Number.isFinite(J)&&J>0?J:void 0;await V.updateConfig({...P,ruleGlobalTimeout:ue}),U.success(ue?`规则全局超时时间已设置为 ${ue} 秒`:"规则全局超时时间已恢复为默认值(300秒)"),await xr()}catch(P){U.error("更新失败: "+P.message)}},tR=()=>Ej,nR=P=>{F(P),fe(P.contentType),je(P.useMCP||!1),Ue(P.mcpId||"");const J=d.find(ue=>ue.id===P.targetServiceId);J?(J.vendorId&&(M(J.vendorId),g(d.filter(ue=>ue.vendorId===J.vendorId))),setTimeout(()=>{if(k(J.id),Q(P.targetModel||""),ce(P.replacedModel||""),X(P.sortOrder||0),Re(P.timeout?P.timeout/1e3:void 0),Z(P.tokenLimit||void 0),re(P.resetInterval),ne(P.tokenResetBaseTime?new Date(P.tokenResetBaseTime):void 0),qe(P.requestCountLimit),Ee(P.requestResetInterval),ht(P.requestResetBaseTime?new Date(P.requestResetBaseTime):void 0),Y(P.frequencyLimit),D(P.frequencyWindow),J.enableTokenLimit&&J.tokenLimit){We(J.tokenLimit);const ue=P.tokenLimit===J.tokenLimit&&P.resetInterval===(J.tokenResetInterval||void 0)&&P.tokenLimit!==null&&P.resetInterval!==null;Pe(ue)}else We(void 0),Pe(!1);if(J.enableRequestLimit&&J.requestCountLimit){ut(J.requestCountLimit);const ue=P.requestCountLimit===J.requestCountLimit&&P.requestResetInterval===(J.requestResetInterval||void 0)&&P.requestCountLimit!==null&&P.requestResetInterval!==null;Le(ue)}else ut(void 0),Le(!1);Xt(!!P.tokenLimit),Ln(!!P.requestCountLimit),_t(P.sessionTokenThreshold??1e3)},0)):(P.useMCP&&(M(""),k(""),Q(""),ce(""),X(P.sortOrder||0),Re(P.timeout?P.timeout/1e3:void 0),Xt(!1),Ln(!1)),_t(P.sessionTokenThreshold??1e3)),_(!0)},rR=P=>s.some(J=>{var ue;return J.routeId===P&&((ue=t[J.id])==null?void 0:ue.status)==="in_use"}),iR=P=>{var Ts;const J=fn[P.id],ue=[],we=t[P.id];if((we==null?void 0:we.status)==="in_use")return{status:"in_use",label:"使用中",reason:"正在处理请求"};if((we==null?void 0:we.status)==="suspended"){const Ne=we.errorType==="timeout"?"超时":we.errorType==="http"?"HTTP错误":"错误";return{status:"suspended",label:"已挂起",reason:we.errorMessage||`${Ne}导致服务暂时不可用`}}if((we==null?void 0:we.status)==="error")return{status:"error",label:"请求失败",reason:we.errorMessage||"请求处理失败"};if(J!=null&&J.isBlacklisted){const Ne=J.blacklistEntry;(Ne==null?void 0:Ne.errorType)==="timeout"?ue.push("请求超时"):Ne!=null&&Ne.lastStatusCode&&ue.push(`HTTP ${Ne.lastStatusCode}错误`)}const it=(we==null?void 0:we.totalTokensUsed)!==void 0?we.totalTokensUsed:P.totalTokensUsed;P.tokenLimit&&it!==void 0&&it>=P.tokenLimit*1e3&&ue.push("Token超限");const st=(we==null?void 0:we.totalRequestsUsed)!==void 0?we.totalRequestsUsed:P.totalRequestsUsed;if(P.requestCountLimit&&st!==void 0&&st>=P.requestCountLimit&&ue.push("次数超限"),ue.length>0)return{status:"error",label:J!=null&&J.isBlacklisted?((Ts=J.blacklistEntry)==null?void 0:Ts.errorType)==="timeout"?"超时":"服务错误":ue[0],reason:ue.join(", ")};const Cn=[];if(P.tokenLimit&&it!==void 0){const Ne=it/(P.tokenLimit*1e3)*100;Ne>=80&&Cn.push(`Token ${Ne.toFixed(0)}%`)}if(P.requestCountLimit&&st!==void 0){const Ne=st/P.requestCountLimit*100;Ne>=80&&Cn.push(`次数 ${Ne.toFixed(0)}%`)}return Cn.length>0?{status:"warning",label:"接近限制",reason:Cn.join(", ")}:{status:"success",label:"正常",reason:""}},aR=()=>{F(null),fe("default"),M(""),k(""),Q(""),ce(""),X(0),Re(void 0),Z(void 0),re(void 0),ne(void 0),qe(void 0),Ee(void 0),ht(void 0),Pe(!1),Le(!1),We(void 0),ut(void 0),Xt(!1),Ln(!1),je(!1),Ue(""),_t(1e3),_(!0)};return o.jsxs("div",{className:"routes-page",children:[o.jsxs("div",{className:"page-header",style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[o.jsxs("div",{children:[o.jsx("h1",{children:"路由管理"}),o.jsx("p",{children:"管理API路由和路由配置"})]}),o.jsxs("div",{style:{display:"flex",gap:"8px"},children:[o.jsx("button",{className:"btn btn-secondary",onClick:()=>Ya(!0),style:{whiteSpace:"nowrap"},children:"局域网内同步配置"}),o.jsx("button",{className:"btn btn-primary",onClick:()=>Qt(!0),style:{whiteSpace:"nowrap"},children:"一键配置"})]})]}),o.jsx("div",{style:{display:"flex",flexDirection:"column"},children:o.jsxs("div",{style:{display:"flex",gap:"20px"},children:[o.jsxs("div",{className:"card",style:{flex:"0 0 25%",minWidth:300},children:[o.jsxs("div",{className:"toolbar",children:[o.jsx("h3",{children:"路由"}),o.jsx("button",{className:"btn btn-primary",onClick:()=>A(!0),children:"新建"})]}),r.length===0?o.jsx("div",{className:"empty-state",children:o.jsx("p",{children:"暂无路由规则"})}):o.jsx("div",{style:{marginTop:"10px"},children:r.map(P=>{var J,ue,we,it;return o.jsx("div",{className:rR(P.id)?"route-active-glow":void 0,onClick:()=>O(P),style:{padding:"12px",marginBottom:"8px",backgroundColor:E&&E.id===P.id?"var(--bg-route-item-selected)":"var(--bg-route-item)",borderRadius:"8px",cursor:"pointer",border:"1px solid var(--border-primary)",position:"relative"},children:o.jsxs("div",{children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[o.jsx("div",{style:{fontWeight:500,flex:1,minWidth:0},children:P.name}),o.jsxs("div",{style:{display:"flex",gap:"3px",alignItems:"center",flexShrink:0,marginLeft:"8px"},children:[Qa[P.id]>0&&o.jsxs("div",{style:{position:"relative"},children:[o.jsx("div",{onClick:st=>{st.stopPropagation(),NM(P.id)},style:{width:"18px",height:"18px",borderRadius:"50%",border:"2px solid var(--color-primary, #2980b9)",boxSizing:"border-box",backgroundColor:"transparent",color:"var(--color-primary, #2980b9)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px",fontWeight:700,cursor:"pointer",flexShrink:0},children:Qa[P.id]>99?"99+":Qa[P.id]}),o.jsxs("span",{className:"route-icon-popover",children:[Qa[P.id]," 个会话绑定此路由,点击查看"]})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("img",{src:qB,alt:"Codex",onClick:st=>{var Cn;st.stopPropagation(),!ti&&(((Cn=Xe==null?void 0:Xe.codex)==null?void 0:Cn.routeId)===P.id?Fu("codex"):Bu("codex",P.id))},style:{width:"18px",height:"18px",borderRadius:"50%",cursor:ti?"wait":"pointer",opacity:((J=Xe==null?void 0:Xe.codex)==null?void 0:J.routeId)===P.id?1:.1,transition:"opacity 0.2s ease",objectFit:"cover",flexShrink:0,display:"block"}}),o.jsx("span",{className:"route-icon-popover",children:((ue=Xe==null?void 0:Xe.codex)==null?void 0:ue.routeId)===P.id?"Codex 已绑定此路由,点击解绑":"点击将 Codex 绑定到此路由"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("img",{src:YB,alt:"Claude Code",onClick:st=>{var Cn;st.stopPropagation(),!ti&&(((Cn=Xe==null?void 0:Xe["claude-code"])==null?void 0:Cn.routeId)===P.id?Fu("claude-code"):Bu("claude-code",P.id))},style:{width:"18px",height:"18px",borderRadius:"50%",cursor:ti?"wait":"pointer",opacity:((we=Xe==null?void 0:Xe["claude-code"])==null?void 0:we.routeId)===P.id?1:.1,transition:"opacity 0.2s ease",objectFit:"cover",flexShrink:0,display:"block"}}),o.jsx("span",{className:"route-icon-popover",children:((it=Xe==null?void 0:Xe["claude-code"])==null?void 0:it.routeId)===P.id?"Claude Code 已绑定此路由,点击解绑":"点击将 Claude Code 绑定到此路由"})]})]})]}),P.description&&o.jsx("div",{style:{fontSize:"12px",color:"var(--text-route-muted)",marginTop:"2px"},children:P.description}),o.jsxs("div",{className:"action-buttons",style:{marginTop:"8px"},children:[o.jsx("button",{className:"btn btn-secondary",style:{padding:"4px 8px",fontSize:"12px"},onClick:st=>{st.stopPropagation(),W(P),A(!0)},children:"编辑"}),o.jsx("button",{className:"btn btn-danger",style:{padding:"4px 8px",fontSize:"12px"},onClick:st=>{st.stopPropagation(),$M(P.id)},children:"删除"})]})]})},P.id)})})]}),o.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:o.jsxs("div",{className:"card",style:{flex:1},children:[o.jsxs("div",{className:"toolbar",children:[o.jsx("h3",{children:"规则列表"}),E&&o.jsx("button",{className:"btn btn-primary",onClick:aR,children:"新建规则"})]}),E?a.length===0?o.jsx("div",{className:"empty-state",children:o.jsx("p",{children:"暂无路由规则"})}):o.jsxs("table",{className:"rules-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{className:"col-priority",children:"优先级"}),o.jsx("th",{children:"类型"}),o.jsx("th",{children:"API服务"}),o.jsx("th",{children:"状态"}),o.jsx("th",{children:"用量情况"}),o.jsx("th",{children:"操作"})]})}),o.jsx("tbody",{children:[...a].sort((P,J)=>{const ue=Tj[P.contentType]??999,we=Tj[J.contentType]??999;if(ue!==we)return ue-we;const it=P.sortOrder||0;return(J.sortOrder||0)-it}).map(P=>{var it,st,Cn,Ts;const J=d.find(Ne=>Ne.id===P.targetServiceId),ue=u.find(Ne=>Ne.id===(J==null?void 0:J.vendorId)),we=(it=Ej.find(Ne=>Ne.value===P.contentType))==null?void 0:it.label;return o.jsxs("tr",{children:[o.jsx("td",{className:"col-priority",style:P.isDisabled?{opacity:.4}:void 0,children:o.jsxs("div",{className:"col-priority-box",children:[o.jsx("span",{children:P.sortOrder||0}),o.jsx("button",{className:"priority-arrow-btn",onClick:()=>HM(P.id),title:"降至最低优先级",children:"↓"}),o.jsx("button",{className:"priority-arrow-btn",onClick:()=>KM(P.id),title:"升至最高优先级",children:"↑"})]})}),o.jsx("td",{style:P.isDisabled?{opacity:.4}:void 0,children:o.jsxs("div",{style:{fontSize:"12px",whiteSpace:"nowrap"},children:[P.contentType!=="default"&&Oj[P.contentType]&&o.jsx("span",{style:{fontSize:"14px"},children:Oj[P.contentType]}),o.jsx("span",{children:we}),P.contentType==="model-mapping"&&P.replacedModel&&o.jsxs("div",{style:{position:"relative",display:"inline-block"},onMouseEnter:()=>me(P.id),onMouseLeave:()=>me(null),children:[o.jsx("span",{style:{cursor:"help",fontSize:"14px",color:"var(--text-info)",fontWeight:"bold"},children:"ⓘ"}),de===P.id&&o.jsxs("div",{style:{position:"absolute",left:"50%",transform:"translateX(-50%)",bottom:"calc(100% + 8px)",backgroundColor:"var(--bg-popover, #333)",color:"var(--text-popover, #fff)",padding:"6px 10px",borderRadius:"4px",fontSize:"12px",whiteSpace:"nowrap",zIndex:1e3,boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},children:["被顶替的模型是: ",P.replacedModel,o.jsx("div",{style:{position:"absolute",left:"50%",transform:"translateX(-50%)",bottom:"-4px",width:"0",height:"0",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderTop:"4px solid var(--bg-popover, #333)"}})]})]})]})}),o.jsx("td",{style:P.isDisabled?{opacity:.4}:void 0,children:o.jsx("div",{className:"vendor-sevices-col",style:{fontSize:"0.6em"},children:P.useMCP?o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:["MCP:",((st=y.find(Ne=>Ne.id===P.mcpId))==null?void 0:st.name)||"Unknown"]}),o.jsx("div",{style:{fontSize:"11px",color:"var(--text-muted)"},children:"使用MCP工具"})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:["供应商:",ue?ue.name:"Unknown"]}),o.jsxs("div",{children:["服务:",J?J.name:"Unknown"]}),o.jsxs("div",{children:["模型:",P.targetModel||"透传模型"]})]})})}),o.jsx("td",{style:{whiteSpace:"nowrap",...P.isDisabled?{opacity:.4}:{}},children:(()=>{var m1,g1,v1,y1;const Ne=iR(P),zn=fn[P.id],oR=(zn==null?void 0:zn.isBlacklisted)&&!((m1=Ne.reason)!=null&&m1.includes("Token超限"))&&!((g1=Ne.reason)!=null&&g1.includes("次数超限"));if(P.isDisabled)return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[o.jsx("span",{style:{color:"#6c757d",fontWeight:"bold",fontSize:"14px"},children:"⊘"}),o.jsx("span",{style:{fontSize:"13px",color:"#6c757d",fontWeight:"bold"},children:"已屏蔽"})]});const lR=oR||((v1=t[P.id])==null?void 0:v1.status)==="error"||((y1=t[P.id])==null?void 0:y1.status)==="suspended";return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[Ne.status==="success"&&o.jsx("span",{style:{color:"#28a745",fontWeight:"bold",fontSize:"14px"},children:"✓"}),Ne.status==="warning"&&o.jsx("span",{style:{color:"#ffc107",fontWeight:"bold",fontSize:"14px"},children:"⚠"}),Ne.status==="error"&&o.jsx("span",{style:{color:"#dc3545",fontWeight:"bold",fontSize:"14px"},children:"✗"}),Ne.status==="suspended"&&o.jsx("span",{style:{color:"#6f42c1",fontWeight:"bold",fontSize:"14px"},children:"⏸"}),Ne.status==="in_use"&&o.jsx(o.Fragment,{children:o.jsx("span",{style:{color:"#007bff",fontWeight:"bold",fontSize:"14px",animation:"pulse 1.5s ease-in-out infinite"},children:"●"})}),o.jsx("span",{style:{fontSize:"13px",color:Ne.status==="success"?"#28a745":Ne.status==="warning"?"#ffc107":Ne.status==="in_use"?"#007bff":Ne.status==="suspended"?"#6f42c1":"#dc3545",fontWeight:Ne.status!=="success"?"bold":"normal"},children:Ne.label}),Ne.reason&&o.jsxs("div",{style:{position:"relative",display:"inline-block",cursor:"help"},onMouseEnter:()=>me(P.id+"-status"),onMouseLeave:()=>me(null),children:[o.jsx("span",{style:{fontSize:"12px",color:"#999",marginLeft:"4px"},children:" ⓘ"}),de===P.id+"-status"&&o.jsxs("div",{style:{position:"absolute",left:"50%",transform:"translateX(-50%)",bottom:"calc(100% + 8px)",backgroundColor:"var(--bg-popover, #333)",color:"var(--text-popover, #fff)",padding:"6px 10px",borderRadius:"4px",fontSize:"12px",whiteSpace:"nowrap",zIndex:1e3,boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},children:[Ne.reason,o.jsx("div",{style:{position:"absolute",left:"50%",transform:"translateX(-50%)",bottom:"-4px",width:"0",height:"0",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderTop:"4px solid var(--bg-popover, #333)"}})]})]})]}),lR&&o.jsx("button",{className:"btn btn-info",style:{padding:"2px 8px",fontSize:"11px"},onClick:()=>WM(P.id),children:"恢复"})]})})()}),o.jsx("td",{style:P.isDisabled?{opacity:.4}:void 0,children:P.tokenLimit||P.requestCountLimit?o.jsxs("div",{style:{fontSize:"13px"},children:[P.tokenLimit&&o.jsxs("div",{style:{whiteSpace:"nowrap"},children:[o.jsx("span",{style:{fontWeight:"bold",fontSize:"12px"},children:"Tokens:"}),o.jsxs(o.Fragment,{children:[o.jsxs("span",{style:{color:(()=>{var zn;const Ne=((zn=t[P.id])==null?void 0:zn.totalTokensUsed)??P.totalTokensUsed;return Ne&&P.tokenLimit&&Ne>=P.tokenLimit*1e3?"red":"inherit"})()},children:[(((((Cn=t[P.id])==null?void 0:Cn.totalTokensUsed)??P.totalTokensUsed)||0)/1e3).toFixed(1),"K/",P.tokenLimit.toFixed(0),"K"]}),(()=>{var zn;const Ne=((zn=t[P.id])==null?void 0:zn.totalTokensUsed)??P.totalTokensUsed;return Ne&&P.tokenLimit&&Ne>=P.tokenLimit*1e3?o.jsx("span",{style:{color:"red",marginLeft:"4px",fontWeight:"bold",fontSize:"11px"},children:"超限"}):null})()]})]}),P.requestCountLimit&&o.jsxs("div",{style:{marginTop:P.tokenLimit?"6px":0},children:[o.jsx("span",{style:{fontWeight:"bold",fontSize:"12px"},children:"次数:"}),o.jsxs(o.Fragment,{children:[o.jsxs("span",{style:{color:(()=>{var zn;const Ne=((zn=t[P.id])==null?void 0:zn.totalRequestsUsed)??P.totalRequestsUsed;return Ne&&P.requestCountLimit&&Ne>=P.requestCountLimit?"red":"inherit"})()},children:[(((Ts=t[P.id])==null?void 0:Ts.totalRequestsUsed)??P.totalTokensUsed)||0,"/",P.requestCountLimit]}),(()=>{var zn;const Ne=((zn=t[P.id])==null?void 0:zn.totalRequestsUsed)??P.totalRequestsUsed;return Ne&&P.requestCountLimit&&Ne>=P.requestCountLimit?o.jsx("span",{style:{color:"red",marginLeft:"4px",fontWeight:"bold",fontSize:"11px"},children:"超限"}):null})()]})]})]}):o.jsx("span",{style:{color:"#999",fontSize:"12px"},children:"不限制"})}),o.jsx("td",{children:o.jsxs("div",{className:"action-buttons",style:{justifyContent:"flex-end"},children:[o.jsx("button",{className:`btn ${P.isDisabled?"btn-success":"btn-warning"}`,onClick:()=>UM(P.id),title:P.isDisabled?"启用规则":"临时屏蔽规则",children:P.isDisabled?"启用":"屏蔽"}),o.jsx("button",{className:"btn btn-secondary",onClick:()=>nR(P),children:"编辑"}),o.jsx("button",{className:"btn btn-danger",onClick:()=>FM(P.id),children:"删除"})]})})]},P.id)})})]}):o.jsx("div",{className:"empty-state",children:o.jsx("p",{children:"请先选择一个路由"})}),E&&a.length>0&&o.jsxs("div",{style:{fontSize:"12px",color:"var(--text-info-box)",marginTop:"16px",padding:"12px",backgroundColor:"var(--bg-info-box)",borderRadius:"6px",border:"1px solid var(--border-info-box)",lineHeight:"1.6"},children:[o.jsx("strong",{children:"📌 如何配置规则(推荐)"}),o.jsxs("div",{style:{marginTop:"6px"},children:["• 先创建一条 ",o.jsx("strong",{children:"默认"})," 规则作为兜底,避免请求无规则可走",o.jsx("br",{}),"• 再按你的实际场景增加规则:如图像理解、长上下文、思考、高智商等",o.jsx("br",{}),"• 按类型匹配顺序:",o.jsx("strong",{children:"压缩对话 → 图像理解 → 高智商 → 长上下文 → 思考 → 后台 → 模型顶替 → 默认"}),o.jsx("br",{}),"• 如果要“指定模型走指定服务”,再加 ",o.jsx("strong",{children:"模型顶替"})," 规则",o.jsx("br",{}),"• 同一类型可配多条:",o.jsx("strong",{children:"把主力服务放上面(优先级更大),备用服务放下面"}),o.jsx("br",{}),"• 开启智能故障切换后,系统会在主力不可用时自动切到下一个可用规则",o.jsx("br",{}),"• 你只需要记住:",o.jsx("strong",{children:"先分类型,再排顺序,上主下备"})]})]}),E&&a.length>0&&o.jsxs("div",{style:{fontSize:"12px",color:"var(--text-info-box)",marginTop:"12px",padding:"12px",backgroundColor:"var(--bg-info-box)",borderRadius:"6px",border:"1px solid var(--border-info-box)",lineHeight:"1.6"},children:[o.jsx("strong",{children:"💡 智能故障切换机制"}),o.jsxs("div",{style:{marginTop:"6px"},children:["• 当同一请求类型配置多个规则时,系统会按排序优先使用第一个",o.jsx("br",{}),"• 如果某个服务报错(4xx/5xx)或请求超时,将自动切换到下一个可用服务",o.jsx("br",{}),"• 报错或超时的服务会被标记为不可用(默认10秒),可在设置页面修改“故障自动恢复时间”",o.jsx("br",{}),"• 到达恢复时间后自动解除标记,如果再次报错或超时则重新标记",o.jsx("br",{}),"• 确保您的请求始终路由到稳定可用的服务",o.jsx("br",{}),"• 规则状态列会实时显示每个规则的可用性状态",o.jsx("br",{}),"• 如不需要此功能,可在",o.jsx("strong",{children:"设置"}),'页面关闭"启用智能故障切换"选项']})]})]})})]})}),o.jsxs("div",{className:"card",children:[o.jsx("div",{className:"toolbar",children:o.jsx("h3",{children:"规则配置"})}),o.jsxs("div",{style:{padding:"20px"},children:[o.jsxs("div",{className:"form-group",style:{marginBottom:"0",maxWidth:"420px",display:"flex",alignItems:"center",gap:"12px"},children:[o.jsx("label",{htmlFor:"rule-global-timeout",style:{marginBottom:0,minWidth:"140px",whiteSpace:"nowrap"},children:"超时时间(秒)"}),o.jsx("input",{id:"rule-global-timeout",type:"number",value:Fe,onChange:P=>rt(P.target.value),onBlur:()=>eR(),min:"1",placeholder:"默认300秒",style:{flex:1,minWidth:0}})]}),o.jsx("div",{style:{fontSize:"12px",color:"var(--text-muted)",marginTop:"12px"},children:"设置规则的全局超时时间。当单个规则未配置超时时间时,将使用此值作为超时上限。 不设置则默认为300秒(5分钟)。超时后会自动触发故障切换到下一个可用规则。"})]})]}),o.jsxs("div",{className:"card api-binding-card",style:{marginTop:"20px"},children:[o.jsx("div",{className:"api-binding-header",children:o.jsx("h3",{children:"API 路径路由映射"})}),o.jsx("p",{className:"api-binding-desc",children:"将标准 API 路径绑定到路由,使任何兼容该 API 的编程工具都可以通过对应路径使用服务。"}),o.jsxs("div",{className:"api-binding-baseurl-row",children:[o.jsx("span",{className:"api-binding-baseurl-prefix",children:"Base URL"}),o.jsx("span",{className:"api-binding-baseurl-value",children:window.location.origin})]}),o.jsx("div",{className:"api-binding-list",children:w.map(P=>{const J=P.apiPath==="/v1/models",ue=J?!!C.trim():!!P.routeId;return o.jsxs("div",{className:"api-binding-row",children:[o.jsx("span",{className:`api-binding-status ${ue?"api-binding-status--bound":""}`}),o.jsx("span",{className:"api-binding-path",children:P.apiPath==="/v1beta/models"?"/v1beta/models/{model}:{action}":P.apiPath}),o.jsx("span",{className:"api-binding-arrow",children:"→"}),o.jsx("div",{className:"api-binding-control",children:J?o.jsx("input",{type:"text",value:C,onChange:we=>j(we.target.value),onBlur:IM,placeholder:"自定义模型列表,英文逗号分隔,留空使用默认列表"}):o.jsxs("select",{value:P.routeId||"",onChange:we=>AM(P.apiPath,we.target.value||null),children:[o.jsx("option",{value:"",children:"无"}),r.map(we=>o.jsx("option",{value:we.id,children:we.name},we.id))]})})]},P.apiPath)})})]}),o.jsxs("div",{className:"card",style:{marginTop:"20px"},children:[o.jsx("div",{className:"toolbar",children:o.jsx("h3",{children:"Claude Code 全局配置"})}),o.jsxs("div",{style:{padding:"20px"},children:[o.jsxs("div",{className:"tool-binding-block",children:[o.jsxs("div",{className:"tool-binding-label",children:[o.jsx("span",{className:"tool-binding-label-icon",children:"⚡"}),"激活路由"]}),o.jsxs("div",{className:"tool-binding-row",children:[o.jsxs("select",{id:"claude-route-binding",value:((o1=Xe==null?void 0:Xe["claude-code"])==null?void 0:o1.routeId)||"",onChange:P=>{const J=P.target.value||null;J&&Bu("claude-code",J)},disabled:ti==="claude-code",children:[o.jsx("option",{value:"",children:"选择要激活的路由..."}),r.map(P=>{var J;return o.jsxs("option",{value:P.id,children:[P.name,((J=Xe==null?void 0:Xe["claude-code"])==null?void 0:J.routeId)===P.id?" (已激活)":""]},P.id)})]}),((l1=Xe==null?void 0:Xe["claude-code"])==null?void 0:l1.routeId)&&o.jsx("button",{className:"btn btn-warning tool-binding-deactivate-btn",onClick:()=>Fu("claude-code"),disabled:ti==="claude-code",children:ti==="claude-code"?"处理中...":"停用"})]}),o.jsx("div",{className:"tool-binding-desc",children:"选择一条路由用于 Claude Code 代理请求。激活后,/claude-code/ 路径的请求将使用该路由的规则。"})]}),!Za()&&((s1=dt==null?void 0:dt.claudeCode)==null?void 0:s1.version)&&o.jsxs("div",{style:{backgroundColor:"var(--bg-warning, #fff3cd)",border:"1px solid var(--border-warning, #ffc107)",borderRadius:"6px",padding:"12px",marginBottom:"12px",fontSize:"13px",color:"var(--text-warning, #856404)"},children:["⚠️ 当前 Claude Code 版本 (",dt.claudeCode.version,") 不支持 Agent Teams 功能。",o.jsx("br",{}),"Agent Teams 功能需要 Claude Code 版本 ≥ 2.1.32。请升级 Claude Code 后再使用此功能。"]}),o.jsxs("div",{style:{marginTop:"20px",marginBottom:"20px"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[o.jsx("input",{type:"checkbox",id:"agent-teams-toggle",checked:(v==null?void 0:v.enableAgentTeams)||!1,onChange:P=>VM(P.target.checked),disabled:!Za(),style:{cursor:Za()?"pointer":"not-allowed",width:"16px",height:"16px"}}),o.jsx("label",{htmlFor:"agent-teams-toggle",style:{cursor:Za()?"pointer":"not-allowed",fontSize:"14px",userSelect:"none",color:Za()?"inherit":"var(--text-muted)"},children:"开启 Agent Teams 功能"})]}),o.jsx("div",{style:{fontSize:"12px",color:"var(--text-muted)",marginTop:"12px"},children:Za()?"开启后将启用 Agent Teams 实验性功能,并实时写入配置;重启 Claude Code 后生效。":"Agent Teams 功能需要 Claude Code 版本 ≥ 2.1.32。请升级 Claude Code 后再使用此功能。"})]}),o.jsxs("div",{children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[o.jsx("input",{type:"checkbox",id:"bypass-permissions-support-toggle",checked:(v==null?void 0:v.enableBypassPermissionsSupport)||!1,onChange:P=>qM(P.target.checked),style:{cursor:"pointer",width:"16px",height:"16px"}}),o.jsx("label",{htmlFor:"bypass-permissions-support-toggle",style:{cursor:"pointer",fontSize:"14px",userSelect:"none"},children:"开启对 bypassPermissions 的支持"})]}),o.jsx("div",{style:{fontSize:"12px",color:"var(--text-muted)",marginTop:"12px"},children:"开启后默认编辑跳过危险模式权限提示,你可以切换到其他模式。该设置会实时写入配置文件,重启 Claude Code 后生效。"})]}),o.jsxs("div",{style:{marginTop:"20px"},children:[o.jsxs("div",{className:"form-group",style:{marginBottom:"0",maxWidth:"420px",display:"flex",alignItems:"center",gap:"12px"},children:[o.jsx("label",{style:{marginBottom:0,minWidth:"100px",whiteSpace:"nowrap"},children:"默认权限模式"}),o.jsx("div",{style:{flex:1,minWidth:0},children:o.jsx(LB,{value:Hm(v),options:Iv.filter(P=>P.value!=="bypassPermissions"||(v==null?void 0:v.enableBypassPermissionsSupport)).map(P=>({value:P.value,label:P.label,description:P.desc})),onChange:P=>YM(P)})})]}),o.jsxs("div",{style:{fontSize:"12px",color:"var(--text-muted)",marginTop:"12px"},children:[(c1=Iv.find(P=>P.value===Hm(v)))==null?void 0:c1.desc,v!=null&&v.enableBypassPermissionsSupport?"":" 需先开启上方的 bypassPermissions 支持,才能切换到 bypassPermissions 模式。"," 该设置会实时写入 ~/.claude/settings.json,重启 Claude Code 后生效。"]})]}),o.jsxs("div",{style:{marginTop:"20px"},children:[o.jsxs("div",{className:"form-group",style:{marginBottom:"0",maxWidth:"420px",display:"flex",alignItems:"center",gap:"12px"},children:[o.jsx("label",{htmlFor:"claude-effort-level",style:{marginBottom:0,minWidth:"100px",whiteSpace:"nowrap"},children:"Effort Level"}),o.jsx("select",{id:"claude-effort-level",value:ZB(v),onChange:P=>XM(P.target.value),disabled:Jo,style:{flex:1,minWidth:0},children:VT.map(P=>o.jsx("option",{value:P.value,children:P.label},P.value))})]}),o.jsx("div",{style:{fontSize:"12px",color:"var(--text-muted)",marginTop:"12px"},children:"该设置会实时写入 ~/.claude/settings.json,重启 Claude Code 后生效。"})]}),o.jsxs("div",{style:{marginTop:"20px"},children:[o.jsxs("div",{className:"form-group",style:{marginBottom:"0",maxWidth:"420px",display:"flex",alignItems:"center",gap:"12px"},children:[o.jsx("label",{htmlFor:"claude-default-model",style:{marginBottom:0,minWidth:"100px",whiteSpace:"nowrap"},children:"默认模型"}),o.jsx("input",{id:"claude-default-model",type:"text",value:Zo,onChange:P=>{Xa(P.target.value),Ht(P.target.value!==((v==null?void 0:v.claudeDefaultModel)||""))},onBlur:()=>{aa&&QM()},placeholder:"例如:claude-3-5-sonnet-20241022",style:{flex:1,minWidth:0}})]}),o.jsx("div",{style:{fontSize:"12px",color:"var(--text-muted)",marginTop:"12px"},children:"设置后写入 ~/.claude/settings.json 的 model 字段,重启 Claude Code 后生效。留空则不写入。"})]}),o.jsxs("div",{style:{marginTop:"20px"},children:[o.jsxs("div",{className:"form-group",style:{marginBottom:"0",maxWidth:"420px",display:"flex",alignItems:"center",gap:"12px"},children:[o.jsx("label",{htmlFor:"claude-autocompact-pct",style:{marginBottom:0,minWidth:"100px",whiteSpace:"nowrap"},children:"Autocompact PCT"}),o.jsx("input",{id:"claude-autocompact-pct",type:"number",min:"1",max:"100",value:$,onChange:P=>{z(P.target.value),Ye(P.target.value!==((v==null?void 0:v.autocompactPctOverride)!=null?String(v.autocompactPctOverride):""))},onBlur:()=>{be&&JM()},placeholder:"1-100",style:{flex:1,minWidth:0}})]}),o.jsx("div",{style:{fontSize:"12px",color:"var(--text-muted)",marginTop:"12px"},children:"设置自动压缩百分比阈值(1-100),写入 ~/.claude/settings.json 的 env 字段,重启 Claude Code 后生效。留空则不写入。"})]})]})]}),o.jsxs("div",{className:"card",style:{marginTop:"20px"},children:[o.jsx("div",{className:"toolbar",children:o.jsx("h3",{children:"Codex 全局配置"})}),o.jsxs("div",{style:{padding:"20px"},children:[o.jsxs("div",{className:"tool-binding-block",children:[o.jsxs("div",{className:"tool-binding-label",children:[o.jsx("span",{className:"tool-binding-label-icon",children:"⚡"}),"激活路由"]}),o.jsxs("div",{className:"tool-binding-row",children:[o.jsxs("select",{id:"codex-route-binding",value:((u1=Xe==null?void 0:Xe.codex)==null?void 0:u1.routeId)||"",onChange:P=>{const J=P.target.value||null;J&&Bu("codex",J)},disabled:ti==="codex",children:[o.jsx("option",{value:"",children:"选择要激活的路由..."}),r.map(P=>{var J;return o.jsxs("option",{value:P.id,children:[P.name,((J=Xe==null?void 0:Xe.codex)==null?void 0:J.routeId)===P.id?" (已激活)":""]},P.id)})]}),((d1=Xe==null?void 0:Xe.codex)==null?void 0:d1.routeId)&&o.jsx("button",{className:"btn btn-warning tool-binding-deactivate-btn",onClick:()=>Fu("codex"),disabled:ti==="codex",children:ti==="codex"?"处理中...":"停用"})]}),o.jsx("div",{className:"tool-binding-desc",children:"选择一条路由用于 Codex 代理请求。激活后,/codex/ 路径的请求将使用该路由的规则。"})]}),o.jsxs("div",{className:"form-group",style:{marginBottom:"0",maxWidth:"420px",display:"flex",alignItems:"center",gap:"12px"},children:[o.jsx("label",{htmlFor:"codex-reasoning-effort",style:{marginBottom:0,minWidth:"120px",whiteSpace:"nowrap"},children:"Reasoning Effort"}),o.jsx("select",{id:"codex-reasoning-effort",value:JB(v),onChange:P=>GM(P.target.value),disabled:Ga,style:{flex:1,minWidth:0},children:HT.map(P=>o.jsx("option",{value:P.value,children:P.label},P.value))})]}),o.jsx("div",{style:{fontSize:"12px",color:"var(--text-muted)",marginTop:"12px"},children:"该设置会实时写入 ~/.codex/config.toml,重启 Codex 后生效。"}),o.jsxs("div",{style:{marginTop:"20px"},children:[o.jsxs("div",{className:"form-group",style:{marginBottom:"0",maxWidth:"420px",display:"flex",alignItems:"center",gap:"12px"},children:[o.jsx("label",{htmlFor:"codex-default-model",style:{marginBottom:0,minWidth:"100px",whiteSpace:"nowrap"},children:"默认模型"}),o.jsx("input",{id:"codex-default-model",type:"text",value:Ie,onChange:P=>{mt(P.target.value),Lr(P.target.value!==((v==null?void 0:v.codexDefaultModel)||""))},onBlur:()=>{Vt&&ZM()},placeholder:"例如:o1",style:{flex:1,minWidth:0}})]}),o.jsx("div",{style:{fontSize:"12px",color:"var(--text-muted)",marginTop:"12px"},children:"设置后写入 ~/.codex/config.toml 的 model 字段,重启 Codex 后生效。留空则使用默认值 gpt-5.3-codex。"})]}),o.jsxs("div",{style:{marginTop:"20px",marginBottom:"20px"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[o.jsx("input",{type:"checkbox",id:"codex-enable-memories-toggle",checked:!!(v!=null&&v.codexEnableMemories),onChange:async P=>{try{const J=v||{};await V.updateConfig({...J,codexEnableMemories:P.target.checked}),await xr(),await V.writeCodexConfig(void 0,P.target.checked),U.success("记忆功能设置已保存(重启 Codex 后生效)")}catch(J){U.error("更新失败: "+J.message)}},style:{cursor:"pointer",width:"16px",height:"16px"}}),o.jsx("label",{htmlFor:"codex-enable-memories-toggle",style:{cursor:"pointer",fontSize:"14px",userSelect:"none"},children:"开启记忆功能"})]}),o.jsx("div",{style:{fontSize:"12px",color:"var(--text-muted)",marginTop:"12px"},children:"开启后会在 ~/.codex/config.toml 中添加 features.memories 和 memories 配置段。"})]})]})]}),o.jsxs("div",{className:"card",style:{marginTop:"20px"},children:[o.jsx("div",{className:"toolbar",children:o.jsx("h3",{children:"📝 配置文件自动管理"})}),o.jsxs("div",{style:{padding:"20px",lineHeight:"1.8"},children:[o.jsxs("div",{style:{background:"var(--bg-info-blue)",padding:"15px",borderRadius:"8px",marginBottom:"15px",borderLeft:"4px solid var(--border-info-blue)"},children:[o.jsx("strong",{children:"💡 工作原理"}),o.jsx("p",{style:{marginTop:"8px",marginBottom:"0"},children:"配置文件由服务生命周期统一管理:服务启动时自动写入代理配置,服务停止时自动恢复原始配置;运行中修改全局工具配置会实时写入配置文件。"})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"15px"},children:[o.jsxs("div",{style:{background:"var(--bg-info-green)",padding:"15px",borderRadius:"8px",borderLeft:"4px solid var(--border-info-green)"},children:[o.jsx("strong",{children:"✓ 服务启动"}),o.jsxs("ul",{style:{marginTop:"8px",paddingLeft:"20px",marginBottom:"0"},children:[o.jsx("li",{children:"自动备份并覆盖配置文件"}),o.jsx("li",{children:"按全局工具设置写入 Claude/Codex 配置"})]})]}),o.jsxs("div",{style:{background:"var(--bg-info-orange)",padding:"15px",borderRadius:"8px",borderLeft:"4px solid var(--border-info-orange)"},children:[o.jsx("strong",{children:"○ 服务停止"}),o.jsxs("ul",{style:{marginTop:"8px",paddingLeft:"20px",marginBottom:"0"},children:[o.jsx("li",{children:"自动恢复原始配置文件"}),o.jsx("li",{children:"删除备份文件"})]})]})]}),o.jsxs("div",{style:{marginTop:"15px",padding:"12px 15px",background:"var(--bg-info-yellow)",borderRadius:"8px",borderLeft:"4px solid var(--border-info-yellow)"},children:[o.jsx("strong",{children:"⚠️ 重要提示"}),o.jsxs("ul",{style:{marginTop:"8px",paddingLeft:"20px",marginBottom:"0"},children:[o.jsx("li",{children:"修改路由规则后立即生效;修改全局工具配置后仅需重启对应编程工具(无需重启服务)"}),o.jsx("li",{children:"操作前建议关闭编程工具,避免配置冲突"})]})]}),o.jsxs("details",{style:{marginTop:"15px",cursor:"pointer"},children:[o.jsx("summary",{style:{fontWeight:"bold",color:"#666"},children:"📂 配置文件位置(点击展开)"}),o.jsxs("ul",{style:{marginTop:"8px",paddingLeft:"20px",color:"#666"},children:[o.jsxs("li",{children:[o.jsx("strong",{children:"Claude Code:"})," ~/.claude/settings.json, ~/.claude.json"]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Codex:"})," ~/.codex/config.toml, ~/.codex/auth.json"]})]})]})]})]}),R&&o.jsxs("div",{className:"modal-overlay",children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:()=>A(!1),"aria-label":"关闭",children:"×"}),o.jsx("div",{className:"modal",children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:q?"编辑路由":"新建路由"})}),o.jsxs("form",{onSubmit:zM,children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"路由名称"}),o.jsx("input",{type:"text",name:"name",defaultValue:q?q.name:"",required:!0})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"描述"}),o.jsx("textarea",{name:"description",rows:3,defaultValue:q?q.description:""})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>A(!1),children:"取消"}),o.jsx("button",{type:"submit",className:"btn btn-primary",children:"保存"})]})]})]})})]}),N&&o.jsxs("div",{className:"modal-overlay",children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:()=>_(!1),"aria-label":"关闭",children:"×"}),o.jsx("div",{className:"modal",children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:I?"编辑规则":"新建规则"})}),o.jsxs("form",{onSubmit:BM,children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"对象请求类型"}),o.jsx("select",{name:"contentType",value:oe,required:!0,onChange:P=>{fe(P.target.value)},children:tR().map(P=>o.jsx("option",{value:P.value,children:P.label},P.value))})]}),oe==="high-iq"&&o.jsxs("div",{style:{background:"var(--bg-info-blue)",padding:"12px",borderRadius:"6px",borderLeft:"4px solid var(--border-info-blue)",marginBottom:"16px"},children:[o.jsx("div",{style:{fontSize:"13px",fontWeight:"bold",marginBottom:"6px"},children:"💡 高智商请求使用方法"}),o.jsxs("div",{style:{fontSize:"12px",color:"var(--text-muted)",lineHeight:"1.6"},children:["在编程工具中输入提示词时:",o.jsxs("ul",{style:{marginTop:"8px",paddingLeft:"20px",lineHeight:"1.8"},children:[o.jsxs("li",{children:["使用 ",o.jsx("code",{style:{background:"var(--bg-code-inline, #f5f5f5)",padding:"2px 6px",borderRadius:"3px",fontFamily:"monospace",fontSize:"12px"},children:"[!]"})," 标记高智商请求(仅在”最近一条真实用户输入”生效)"]}),o.jsxs("li",{children:["使用 ",o.jsx("code",{style:{background:"var(--bg-code-inline, #f5f5f5)",padding:"2px 6px",borderRadius:"3px",fontFamily:"monospace",fontSize:"12px"},children:"[x]"})," 标记退出高智商模式,继续走普通模式"]})]})]}),o.jsxs("div",{style:{fontSize:"12px",color:"var(--text-muted)",marginTop:"8px",lineHeight:"1.6"},children:[o.jsx("strong",{children:"示例:"}),o.jsx("br",{}),"• ",o.jsx("code",{style:{background:"var(--bg-code-inline, #f5f5f5)",padding:"2px 6px",borderRadius:"3px",fontFamily:"monospace",fontSize:"12px"},children:"[!] 重构A模块"}),o.jsx("br",{}),"• ",o.jsx("code",{style:{background:"var(--bg-code-inline, #f5f5f5)",padding:"2px 6px",borderRadius:"3px",fontFamily:"monospace",fontSize:"12px"},children:"继续正常对话(不加 [!])"}),o.jsx("br",{}),"• ",o.jsx("code",{style:{background:"var(--bg-code-inline, #f5f5f5)",padding:"2px 6px",borderRadius:"3px",fontFamily:"monospace",fontSize:"12px"},children:"[x] 接下来帮我解决一个简单的问题"})]})]}),oe==="model-mapping"&&o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{children:["被顶替模型 ",o.jsx("small",{children:"(可在日志中找出想要顶替的模型名)"})]}),o.jsx("input",{type:"text",value:T,onChange:P=>ce(P.target.value),placeholder:"例如:gpt-4"})]}),oe==="long-context"&&o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{children:["Session累积Tokens阈值 (单位: k) ",o.jsx("small",{children:"默认1000k (1M tokens)"})]}),o.jsx("input",{type:"number",value:Nt??1e3,onChange:P=>_t(Number(P.target.value)),placeholder:"1000",min:"1"}),o.jsxs("small",{style:{color:"#666",fontSize:"12px",marginTop:"4px",display:"block"},children:["当前对话(session)的累积tokens数量超过 ",Nt??1e3,"k 时,该对话的新请求将走此规则"]})]}),oe==="image-understanding"&&o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{style:{display:"flex",alignItems:"center",cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",checked:ge,onChange:P=>je(P.target.checked),style:{marginRight:"8px",cursor:"pointer",width:"16px",height:"16px"}}),o.jsx("span",{children:"使用MCP"})]}),o.jsx("small",{style:{color:"#666",fontSize:"12px",marginTop:"4px",display:"block"},children:"开启后,将使用MCP工具处理图像理解请求,而不是直接调用API服务"})]}),oe==="image-understanding"&&ge&&o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{children:["选择MCP工具 ",o.jsx("span",{className:"required",children:"*"})]}),o.jsx("div",{style:{maxHeight:"300px",overflowY:"auto",border:"1px solid var(--border-primary)",borderRadius:"6px",padding:"8px"},children:y.length===0?o.jsx("div",{style:{padding:"12px",textAlign:"center",color:"var(--text-muted)"},children:"暂无MCP工具,请先在MCP管理页面添加"}):y.map(P=>o.jsxs("div",{onClick:()=>Ue(P.id),style:{padding:"12px",marginBottom:"8px",border:`2px solid ${Ae===P.id?"var(--primary-color)":"var(--border-primary)"}`,borderRadius:"6px",cursor:"pointer",backgroundColor:Ae===P.id?"var(--bg-info-blue)":"var(--bg-card)",transition:"all 0.2s ease"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o.jsx("div",{style:{fontWeight:600,fontSize:"14px"},children:P.name}),o.jsx("div",{className:"badge badge-secondary",style:{fontSize:"11px"},children:P.type==="stdio"?"命令行":P.type.toUpperCase()})]}),P.description&&o.jsx("div",{style:{fontSize:"12px",color:"var(--text-muted)",marginTop:"4px"},children:P.description})]},P.id))})]}),!ge&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"供应商"}),o.jsxs("select",{value:K,onChange:P=>M(P.target.value),required:!0,children:[o.jsx("option",{value:"",disabled:!0,children:"请选择供应商"}),u.map(P=>o.jsx("option",{value:P.id,children:P.name},P.id))]})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"供应商API服务"}),o.jsxs("select",{value:B,onChange:P=>{const J=P.target.value;k(J),Q("");const ue=d.find(we=>we.id===J);ue&&(ue.enableTokenLimit&&ue.tokenLimit?(Z(ue.tokenLimit),re(ue.tokenResetInterval),ne(ue.tokenResetBaseTime?new Date(ue.tokenResetBaseTime):void 0),We(ue.tokenLimit),Pe(!0),Xt(!0)):(We(void 0),Pe(!1),Xt(!1)),ue.enableRequestLimit&&ue.requestCountLimit?(qe(ue.requestCountLimit),Ee(ue.requestResetInterval),ht(ue.requestResetBaseTime?new Date(ue.requestResetBaseTime):void 0),ut(ue.requestCountLimit),Le(!0),Ln(!0)):(ut(void 0),Le(!1),Ln(!1)))},required:!0,disabled:!K,children:[o.jsx("option",{value:"",disabled:!0,children:"请选择API服务"}),m.map(P=>o.jsx("option",{value:P.id,children:P.name},P.id))]})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"供应商模型"}),o.jsxs("select",{value:L,onChange:P=>Q(P.target.value),disabled:!B,children:[o.jsx("option",{value:"",children:"透传模型名"}),(p1=(f1=d.find(P=>P.id===B))==null?void 0:f1.supportedModels)==null?void 0:p1.map(P=>o.jsx("option",{value:P,children:P},P))]})]}),o.jsx("div",{className:"form-group",children:o.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[o.jsxs("label",{style:{display:"flex",alignItems:"center",cursor:Te?"not-allowed":"pointer"},children:[o.jsx("input",{type:"checkbox",checked:nn,onChange:P=>Xt(P.target.checked),disabled:Te,style:{marginRight:"8px",cursor:Te?"not-allowed":"pointer",width:"16px",height:"16px"}}),o.jsx("span",{children:"启用Tokens超量限制"}),Te&&o.jsx("small",{style:{color:"#999",fontSize:"12px",marginLeft:"8px"},children:"(从API服务继承)"})]}),Te&&o.jsx("button",{type:"button",className:"btn btn-sm btn-secondary",onClick:()=>Pe(!1),style:{padding:"4px 12px",fontSize:"12px"},children:"自定义限制"})]})}),nn&&!Te&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"Tokens超量(单位:k)"}),o.jsx("input",{type:"number",value:te||"",onChange:P=>{const J=P.target.value?parseInt(P.target.value):void 0;if(J!==void 0&&Ve!==void 0&&J>Ve){U.warning(`Token超量值不能超过API服务的限制 (${Ve}k)`);return}Z(J),Te&&J!==Ve&&Pe(!1)},min:"0",max:Ve,placeholder:Ve?`最大 ${Ve}k`:"不限制",disabled:Te}),Ve&&o.jsxs("small",{style:{color:"#666",fontSize:"12px",marginTop:"4px",display:"block"},children:["⚠️ API服务限制:最大 ",Ve,"k,当前值不能超过此限制"]}),o.jsx("small",{style:{color:"#666",fontSize:"12px",marginTop:"4px",display:"block"},children:"当编程工具的请求tokens达到这个量时,在配置了其他规则的情况下,本条规则将失效,从而保护你的余额。例如:输入100表示100k即100,000个tokens"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"Tokens超量自动重置间隔(小时)"}),o.jsx("input",{type:"number",value:se||"",onChange:P=>{re(P.target.value?parseInt(P.target.value):void 0),Te&&Pe(!1)},min:"1",placeholder:"不自动重置",disabled:Te}),o.jsx("small",{style:{color:"#666",fontSize:"12px",marginTop:"4px",display:"block"},children:"设置后,系统将每隔指定小时数自动重置token计数。例如设置5小时,则每5小时重置一次"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"Token下一次重置时间基点"}),o.jsx("input",{type:"datetime-local",value:Oe?Aj(Oe):"",onChange:P=>{P.target.value?ne(new Date(P.target.value)):ne(void 0),Te&&Pe(!1)},disabled:!se||Te,className:"datetime-picker-input"}),o.jsx("small",{style:{color:"#666",fontSize:"12px",marginTop:"4px",display:"block"},children:'配合"Tokens超量自动重置间隔"使用,设置下一次重置的精确时间点。例如,每月1日0点重置(间隔720小时),或每周一0点重置(间隔168小时)。设置后,系统会基于此时间点自动计算后续重置周期'})]})]}),o.jsx("div",{className:"form-group",children:o.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[o.jsxs("label",{style:{display:"flex",alignItems:"center",cursor:De?"not-allowed":"pointer"},children:[o.jsx("input",{type:"checkbox",checked:Oi,onChange:P=>Ln(P.target.checked),disabled:De,style:{marginRight:"8px",cursor:De?"not-allowed":"pointer",width:"16px",height:"16px"}}),o.jsx("span",{children:"启用请求次数超量限制"}),De&&o.jsx("small",{style:{color:"#999",fontSize:"12px",marginLeft:"8px"},children:"(从API服务继承)"})]}),De&&o.jsx("button",{type:"button",className:"btn btn-sm btn-secondary",onClick:()=>Le(!1),style:{padding:"4px 12px",fontSize:"12px"},children:"自定义限制"})]})}),Oi&&!De&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"请求次数超量"}),o.jsx("input",{type:"number",value:Be||"",onChange:P=>{const J=P.target.value?parseInt(P.target.value):void 0;if(J!==void 0&&Qe!==void 0&&J>Qe){U.warning(`请求次数超量值不能超过API服务的限制 (${Qe})`);return}qe(J),De&&J!==Qe&&Le(!1)},min:"0",max:Qe,placeholder:Qe?`最大 ${Qe}`:"不限制",disabled:De}),Qe&&o.jsxs("small",{style:{color:"#666",fontSize:"12px",marginTop:"4px",display:"block"},children:["⚠️ API服务限制:最大 ",Qe,",当前值不能超过此限制"]}),o.jsx("small",{style:{color:"#666",fontSize:"12px",marginTop:"4px",display:"block"},children:"当请求次数达到这个量时,在配置了其他规则的情况下,本条规则将失效"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"请求次数自动重置间隔(小时)"}),o.jsx("input",{type:"number",value:ye||"",onChange:P=>{Ee(P.target.value?parseInt(P.target.value):void 0),De&&Le(!1)},min:"1",placeholder:"不自动重置",disabled:De}),o.jsx("small",{style:{color:"#666",fontSize:"12px",marginTop:"4px",display:"block"},children:"设置后,系统将每隔指定小时数自动重置请求次数计数。例如设置24小时,则每24小时重置一次"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"下一次重置时间基点"}),o.jsx("input",{type:"datetime-local",value:ze?Aj(ze):"",onChange:P=>{P.target.value?ht(new Date(P.target.value)):ht(void 0),De&&Le(!1)},disabled:!ye||De,className:"datetime-picker-input"}),o.jsx("small",{style:{color:"#666",fontSize:"12px",marginTop:"4px",display:"block"},children:'配合"请求次数自动重置间隔"使用,设置下一次重置的精确时间点。例如,每月1日0点重置(间隔720小时),或每周一0点重置(间隔168小时)。设置后,系统会基于此时间点自动计算后续重置周期'})]})]})]}),o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{style:{display:"flex",alignItems:"center",cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",checked:!!ee,onChange:P=>{P.target.checked?(Y(10),D(0)):(Y(void 0),D(void 0))},style:{marginRight:"8px",cursor:"pointer",width:"16px",height:"16px"}}),o.jsx("span",{children:"启用请求频率限制"})]}),o.jsx("small",{style:{color:"#666",fontSize:"12px",marginTop:"4px",display:"block"},children:"启用后,当同一内容类型的请求频率超过限制时,系统会自动切换到其他同类型规则"})]}),ee&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"频率限制次数(并发数)"}),o.jsx("input",{type:"number",value:ee||"",onChange:P=>Y(P.target.value?parseInt(P.target.value):void 0),min:"1",placeholder:"例如: 10"}),o.jsx("small",{style:{color:"#666",fontSize:"12px",marginTop:"4px",display:"block"},children:"在指定时间窗口内允许的最大请求次数"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"频率限制时间窗口(秒,0=同一时刻)"}),o.jsx("input",{type:"number",value:le===0?0:le||"",onChange:P=>{const J=P.target.value?parseInt(P.target.value):void 0;D(J===0?0:J)},min:"0",placeholder:"0 表示同一时刻"}),o.jsx("small",{style:{color:"#666",fontSize:"12px",marginTop:"4px",display:"block"},children:"时间窗口大小。0 表示同一时刻(并发数),持续累积;设置为 60 则在 60 秒内最多允许 N 次请求"})]})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"超时时间(秒)"}),o.jsx("input",{type:"number",value:_e||"",onChange:P=>Re(P.target.value?parseInt(P.target.value):void 0),min:"1",placeholder:v!=null&&v.ruleGlobalTimeout?`全局${v.ruleGlobalTimeout}秒`:"默认300秒"}),o.jsxs("small",{style:{color:"#666",fontSize:"12px",marginTop:"4px",display:"block"},children:["设置此规则的API请求超时时间。不设置则使用全局超时配置(当前为",v!=null&&v.ruleGlobalTimeout?`${v.ruleGlobalTimeout}秒`:"默认300秒","),超时后自动触发故障切换"]})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"排序(值越大优先级越高)"}),o.jsx("input",{type:"number",value:ve,onChange:P=>X(parseInt(P.target.value)||0),min:"0",max:"1000"})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>_(!1),children:"取消"}),o.jsx("button",{type:"submit",className:"btn btn-primary",children:"保存"})]})]})]})})]}),o.jsx(KT,{show:ei,onClose:()=>Qt(!1),onComplete:()=>{el(),im(),am(),$u(),n1()}}),o.jsx($B,{show:St,onClose:()=>Ya(!1),onComplete:()=>{im(),am()}}),Ja&&o.jsxs("div",{className:"modal-overlay",children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:i1,"aria-label":"关闭",children:"×"}),o.jsxs("div",{className:"modal modal--sticky-layout",style:{width:"500px",maxWidth:"90vw"},children:[o.jsx("div",{className:"modal-header",children:o.jsxs("h2",{children:["绑定会话 - ",((h1=r.find(P=>P.id===Ja))==null?void 0:h1.name)||Ja]})}),o.jsxs("div",{className:"modal-body-scrollable",style:{maxHeight:"460px"},children:[OM?o.jsx("div",{style:{textAlign:"center",padding:"20px",color:"var(--text-tertiary)"},children:"加载中..."}):Ke.length===0?o.jsx("div",{style:{textAlign:"center",padding:"20px",color:"var(--text-tertiary)"},children:o.jsx("p",{children:"暂无绑定会话"})}):o.jsxs("div",{style:{marginBottom:"12px",fontSize:"13px",color:"var(--text-tertiary)"},children:["以下 ",Ke.length," 个会话绑定了此路由:"]}),o.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[Ke.slice(0,50).map((P,J)=>{var ue;return o.jsxs("div",{style:{padding:"12px 0",display:"flex",justifyContent:"space-between",alignItems:"center",gap:"12px",borderBottom:J===Math.min(Ke.length,50)-1?"none":"1px solid var(--border-color)"},children:[o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsx("div",{style:{fontWeight:500,fontSize:"14px",marginBottom:"4px"},children:((ue=P.title)==null?void 0:ue.replace(/<\/?session>/g,"").trim())||P.id.slice(0,8)}),o.jsxs("div",{style:{fontSize:"12px",color:"var(--text-tertiary)",display:"flex",gap:"12px",alignItems:"center"},children:[o.jsx("span",{className:`badge ${P.targetType==="claude-code"?"badge-claude-code":"badge-codex"}`,style:{fontSize:"11px"},children:P.targetType==="claude-code"?"Claude Code":"Codex"}),o.jsxs("span",{children:[P.requestCount," 次请求"]}),o.jsxs("span",{children:[P.totalTokens.toLocaleString()," tokens"]})]})]}),o.jsx("button",{type:"button",className:"btn btn-danger",style:{flexShrink:0,padding:"4px 12px",fontSize:"12px"},disabled:e1===P.id,onClick:we=>{we.stopPropagation(),_M(P.id)},children:e1===P.id?"解绑中...":"解绑"})]},P.id)}),Ke.length>50&&o.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:"var(--text-tertiary)",padding:"8px"},children:["等共 ",Ke.length," 个会话"]})]})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("div",{style:{flex:1}}),o.jsx("button",{className:"btn btn-secondary",onClick:i1,children:"关闭"})]})]})]})]})}var qT={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(Wl,function(){var n=1e3,r=6e4,i=36e5,a="millisecond",l="second",s="minute",c="hour",u="day",f="week",d="month",p="quarter",m="year",g="date",y="Invalid Date",x=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(W){var I=["th","st","nd","rd"],F=W%100;return"["+W+(I[(F-20)%10]||I[F]||I[0])+"]"}},w=function(W,I,F){var K=String(W);return!K||K.length>=I?W:""+Array(I+1-K.length).join(F)+W},S={s:w,z:function(W){var I=-W.utcOffset(),F=Math.abs(I),K=Math.floor(F/60),M=F%60;return(I<=0?"+":"-")+w(K,2,"0")+":"+w(M,2,"0")},m:function W(I,F){if(I.date()<F.date())return-W(F,I);var K=12*(F.year()-I.year())+(F.month()-I.month()),M=I.clone().add(K,d),B=F-M<0,k=I.clone().add(K+(B?-1:1),d);return+(-(K+(F-M)/(B?M-k:k-M))||0)},a:function(W){return W<0?Math.ceil(W)||0:Math.floor(W)},p:function(W){return{M:d,y:m,w:f,d:u,D:g,h:c,m:s,s:l,ms:a,Q:p}[W]||String(W||"").toLowerCase().replace(/s$/,"")},u:function(W){return W===void 0}},C="en",j={};j[C]=b;var E="$isDayjsObject",O=function(W){return W instanceof _||!(!W||!W[E])},R=function W(I,F,K){var M;if(!I)return C;if(typeof I=="string"){var B=I.toLowerCase();j[B]&&(M=B),F&&(j[B]=F,M=B);var k=I.split("-");if(!M&&k.length>1)return W(k[0])}else{var L=I.name;j[L]=I,M=L}return!K&&M&&(C=M),M||!K&&C},A=function(W,I){if(O(W))return W.clone();var F=typeof I=="object"?I:{};return F.date=W,F.args=arguments,new _(F)},N=S;N.l=R,N.i=O,N.w=function(W,I){return A(W,{locale:I.$L,utc:I.$u,x:I.$x,$offset:I.$offset})};var _=function(){function W(F){this.$L=R(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[E]=!0}var I=W.prototype;return I.parse=function(F){this.$d=function(K){var M=K.date,B=K.utc;if(M===null)return new Date(NaN);if(N.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var k=M.match(x);if(k){var L=k[2]-1||0,Q=(k[7]||"0").substring(0,3);return B?new Date(Date.UTC(k[1],L,k[3]||1,k[4]||0,k[5]||0,k[6]||0,Q)):new Date(k[1],L,k[3]||1,k[4]||0,k[5]||0,k[6]||0,Q)}}return new Date(M)}(F),this.init()},I.init=function(){var F=this.$d;this.$y=F.getFullYear(),this.$M=F.getMonth(),this.$D=F.getDate(),this.$W=F.getDay(),this.$H=F.getHours(),this.$m=F.getMinutes(),this.$s=F.getSeconds(),this.$ms=F.getMilliseconds()},I.$utils=function(){return N},I.isValid=function(){return this.$d.toString()!==y},I.isSame=function(F,K){var M=A(F);return this.startOf(K)<=M&&M<=this.endOf(K)},I.isAfter=function(F,K){return A(F)<this.startOf(K)},I.isBefore=function(F,K){return this.endOf(K)<A(F)},I.$g=function(F,K,M){return N.u(F)?this[K]:this.set(M,F)},I.unix=function(){return Math.floor(this.valueOf()/1e3)},I.valueOf=function(){return this.$d.getTime()},I.startOf=function(F,K){var M=this,B=!!N.u(K)||K,k=N.p(F),L=function(te,Z){var se=N.w(M.$u?Date.UTC(M.$y,Z,te):new Date(M.$y,Z,te),M);return B?se:se.endOf(u)},Q=function(te,Z){return N.w(M.toDate()[te].apply(M.toDate("s"),(B?[0,0,0,0]:[23,59,59,999]).slice(Z)),M)},T=this.$W,ce=this.$M,ve=this.$D,X="set"+(this.$u?"UTC":"");switch(k){case m:return B?L(1,0):L(31,11);case d:return B?L(1,ce):L(0,ce+1);case f:var oe=this.$locale().weekStart||0,fe=(T<oe?T+7:T)-oe;return L(B?ve-fe:ve+(6-fe),ce);case u:case g:return Q(X+"Hours",0);case c:return Q(X+"Minutes",1);case s:return Q(X+"Seconds",2);case l:return Q(X+"Milliseconds",3);default:return this.clone()}},I.endOf=function(F){return this.startOf(F,!1)},I.$set=function(F,K){var M,B=N.p(F),k="set"+(this.$u?"UTC":""),L=(M={},M[u]=k+"Date",M[g]=k+"Date",M[d]=k+"Month",M[m]=k+"FullYear",M[c]=k+"Hours",M[s]=k+"Minutes",M[l]=k+"Seconds",M[a]=k+"Milliseconds",M)[B],Q=B===u?this.$D+(K-this.$W):K;if(B===d||B===m){var T=this.clone().set(g,1);T.$d[L](Q),T.init(),this.$d=T.set(g,Math.min(this.$D,T.daysInMonth())).$d}else L&&this.$d[L](Q);return this.init(),this},I.set=function(F,K){return this.clone().$set(F,K)},I.get=function(F){return this[N.p(F)]()},I.add=function(F,K){var M,B=this;F=Number(F);var k=N.p(K),L=function(ce){var ve=A(B);return N.w(ve.date(ve.date()+Math.round(ce*F)),B)};if(k===d)return this.set(d,this.$M+F);if(k===m)return this.set(m,this.$y+F);if(k===u)return L(1);if(k===f)return L(7);var Q=(M={},M[s]=r,M[c]=i,M[l]=n,M)[k]||1,T=this.$d.getTime()+F*Q;return N.w(T,this)},I.subtract=function(F,K){return this.add(-1*F,K)},I.format=function(F){var K=this,M=this.$locale();if(!this.isValid())return M.invalidDate||y;var B=F||"YYYY-MM-DDTHH:mm:ssZ",k=N.z(this),L=this.$H,Q=this.$m,T=this.$M,ce=M.weekdays,ve=M.months,X=M.meridiem,oe=function(Z,se,re,Oe){return Z&&(Z[se]||Z(K,B))||re[se].slice(0,Oe)},fe=function(Z){return N.s(L%12||12,Z,"0")},te=X||function(Z,se,re){var Oe=Z<12?"AM":"PM";return re?Oe.toLowerCase():Oe};return B.replace(v,function(Z,se){return se||function(re){switch(re){case"YY":return String(K.$y).slice(-2);case"YYYY":return N.s(K.$y,4,"0");case"M":return T+1;case"MM":return N.s(T+1,2,"0");case"MMM":return oe(M.monthsShort,T,ve,3);case"MMMM":return oe(ve,T);case"D":return K.$D;case"DD":return N.s(K.$D,2,"0");case"d":return String(K.$W);case"dd":return oe(M.weekdaysMin,K.$W,ce,2);case"ddd":return oe(M.weekdaysShort,K.$W,ce,3);case"dddd":return ce[K.$W];case"H":return String(L);case"HH":return N.s(L,2,"0");case"h":return fe(1);case"hh":return fe(2);case"a":return te(L,Q,!0);case"A":return te(L,Q,!1);case"m":return String(Q);case"mm":return N.s(Q,2,"0");case"s":return String(K.$s);case"ss":return N.s(K.$s,2,"0");case"SSS":return N.s(K.$ms,3,"0");case"Z":return k}return null}(Z)||k.replace(":","")})},I.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},I.diff=function(F,K,M){var B,k=this,L=N.p(K),Q=A(F),T=(Q.utcOffset()-this.utcOffset())*r,ce=this-Q,ve=function(){return N.m(k,Q)};switch(L){case m:B=ve()/12;break;case d:B=ve();break;case p:B=ve()/3;break;case f:B=(ce-T)/6048e5;break;case u:B=(ce-T)/864e5;break;case c:B=ce/i;break;case s:B=ce/r;break;case l:B=ce/n;break;default:B=ce}return M?B:N.a(B)},I.daysInMonth=function(){return this.endOf(d).$D},I.$locale=function(){return j[this.$L]},I.locale=function(F,K){if(!F)return this.$L;var M=this.clone(),B=R(F,K,!0);return B&&(M.$L=B),M},I.clone=function(){return N.w(this.$d,this)},I.toDate=function(){return new Date(this.valueOf())},I.toJSON=function(){return this.isValid()?this.toISOString():null},I.toISOString=function(){return this.$d.toISOString()},I.toString=function(){return this.$d.toUTCString()},W}(),q=_.prototype;return A.prototype=q,[["$ms",a],["$s",l],["$m",s],["$H",c],["$W",u],["$M",d],["$y",m],["$D",g]].forEach(function(W){q[W[1]]=function(I){return this.$g(I,W[0],W[1])}}),A.extend=function(W,I){return W.$i||(W(I,_,A),W.$i=!0),A},A.locale=R,A.isDayjs=O,A.unix=function(W){return A(1e3*W)},A.en=j[C],A.Ls=j,A.p={},A})})(qT);var e8=qT.exports;const ft=ss(e8);var YT={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(Wl,function(){return function(n,r,i){n=n||{};var a=r.prototype,l={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function s(u,f,d,p){return a.fromToBase(u,f,d,p)}i.en.relativeTime=l,a.fromToBase=function(u,f,d,p,m){for(var g,y,x,v=d.$locale().relativeTime||l,b=n.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],w=b.length,S=0;S<w;S+=1){var C=b[S];C.d&&(g=p?i(u).diff(d,C.d,!0):d.diff(u,C.d,!0));var j=(n.rounding||Math.round)(Math.abs(g));if(x=g>0,j<=C.r||!C.r){j<=1&&S>0&&(C=b[S-1]);var E=v[C.l];m&&(j=m(""+j)),y=typeof E=="string"?E.replace("%d",j):E(j,f,C.l,x);break}}if(f)return y;var O=x?v.future:v.past;return typeof O=="function"?O(y):O.replace("%s",y)},a.to=function(u,f){return s(u,f,this,!0)},a.from=function(u,f){return s(u,f,this)};var c=function(u){return u.$u?i.utc():i()};a.toNow=function(u){return this.to(c(this),u)},a.fromNow=function(u){return this.from(c(this),u)}}})})(YT);var t8=YT.exports;const Gx=ss(t8),Bc=({currentPage:e,totalItems:t,pageSize:n,onPageChange:r,onPageSizeChange:i,pageSizeOptions:a=[10,20,50,100]})=>{const l=Math.max(1,Math.ceil(t/n)),s=e===1,c=e>=l,u=()=>{s||r(1)},f=()=>{s||r(e-1)},d=()=>{c||r(e+1)},p=()=>{c||r(l)},m=g=>{const y=parseInt(g.target.value,10);i(y)};return o.jsxs("div",{className:"pagination",children:[o.jsxs("div",{className:"pagination-info",children:["共 ",t," 条"]}),o.jsxs("div",{className:"pagination-controls",children:[o.jsx("button",{className:"pagination-btn",onClick:u,disabled:s,children:"首页"}),o.jsx("button",{className:"pagination-btn",onClick:f,disabled:s,children:"上一页"}),o.jsxs("span",{className:"pagination-info",children:["第 ",e," / ",l," 页"]}),o.jsx("button",{className:"pagination-btn",onClick:d,disabled:c,children:"下一页"}),o.jsx("button",{className:"pagination-btn",onClick:p,disabled:c,children:"尾页"})]}),o.jsx("div",{className:"pagination-size",children:o.jsxs("label",{children:["每页显示",o.jsx("select",{className:"pagination-select",value:n,onChange:m,children:a.map(g=>o.jsx("option",{value:g,children:g},g))}),"条"]})})]})},n8=["authorization","x-api-key","api-key","apikey","x-auth-token","auth-token","secret","password","api_secret","jwt","csrf_token","xsrf_token","auth_token","session_token","private_key","client_secret"],r8=e=>{const t=e.toLowerCase();return!!(n8.some(n=>t===n)||t.startsWith("api_")&&(t.endsWith("_key")||t.endsWith("_secret"))||(t.endsWith("_token")||t.endsWith("_key")||t.endsWith("_secret"))&&!["max_tokens","input_tokens","output_tokens","completion_tokens","prompt_tokens","cachereadinputtokens","totaltokens"].some(r=>t.replace(/_/g,"").includes(r.replace(/_/g,""))))},i8=e=>!e||e.length<=8?"***":`${e.slice(0,4)}${"*".repeat(Math.min(e.length-8,20))}${e.slice(-4)}`,Nv=e=>{if(e==null)return e;if(Array.isArray(e))return e.map(t=>Nv(t));if(typeof e=="object"){const t={};for(const[n,r]of Object.entries(e))r8(n)?t[n]=typeof r=="string"?i8(r):"***":typeof r=="object"?t[n]=Nv(r):t[n]=r;return t}return e},kr=({data:e,title:t,collapsed:n=!1})=>{const[r,i]=h.useState(!n),[a,l]=h.useState(!1),s=f=>{try{let d;typeof f=="string"?d=JSON.parse(f):d=f;const p=Nv(d);return JSON.stringify(p,null,2)}catch{return typeof f=="string"?f:String(f)}},c=()=>{const f=s(e);navigator.clipboard.writeText(f).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)}).catch(d=>{console.error("Failed to copy JSON:",d)})},u=s(e);return o.jsxs("div",{className:"json-viewer",children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[t&&o.jsx("h4",{style:{margin:0,fontSize:"14px",color:"var(--text-primary)"},children:t}),o.jsxs("div",{style:{display:"flex",gap:"8px"},children:[o.jsx("button",{onClick:()=>i(!r),className:"btn btn-sm btn-secondary",style:{fontSize:"12px",padding:"2px 8px"},children:r?"折叠":"展开"}),o.jsx("button",{onClick:c,className:"btn btn-sm btn-primary",style:{fontSize:"12px",padding:"2px 8px"},children:a?"已复制":"复制"})]})]}),r&&o.jsx("pre",{style:{background:"var(--bg-code)",border:"1px solid var(--border-primary)",borderRadius:"8px",padding:"12px",overflowX:"auto",fontSize:"12px",lineHeight:"1.4",color:"var(--text-primary)",maxHeight:"400px",overflowY:"auto",margin:0},children:o.jsx("code",{children:u})})]})};function fu(e){const t=e.split(`
114
+ `).map(r=>r.trim()).join(`
115
+ `).split(`
116
+
117
+ `).filter(r=>r.trim()),n=[];for(const r of t){let i="",a=[],l=0;r.split(`
118
+ `).forEach(f=>{if(/^[a-z]+:/.test(f)){const d=f.indexOf(":"),p=f.slice(0,d).trim(),m=f.slice(d+1).trim();p==="event"?i=m:p==="data"?(a.push(m),l=1):a.length&&(l=-1)}else l===1&&a.push(f)});const c=a.length>0?a.join(`
119
+ `).trim():void 0;let u;if(c)try{u=JSON.parse(c)}catch{u=c}n.push({event:i,data:u,raw:r})}return n}function pu(e,t){var s,c;let n="",r="",i=!1,a=!1,l=!1;for(const u of e){const f=u.data;if(f){if(u.event==="content_block_start"&&f.content_block){const d=f.content_block.type;d==="thinking"?i=!0:d==="text"&&(a=!0);continue}if(u.event==="content_block_stop"){i=!1,a=!1;continue}if(u.event==="content_block_delta"&&f.delta){f.delta.type==="text_delta"&&a?n+=f.delta.text||"":f.delta.type==="thinking_delta"&&i&&(r+=f.delta.thinking||"");continue}if(u.event==="response.reasoning_text.delta"&&f.delta!==void 0){r+=f.delta||"",l=!0;continue}if(u.event==="response.content_part.done"&&f.part){const d=f.part;d.type==="reasoning_text"&&d.text?l||(r=d.text):d.type==="output_text"&&d.text&&(n+=d.text);continue}if(!u.event&&f.choices){const d=(c=(s=f.choices)==null?void 0:s[0])==null?void 0:c.delta;d&&(typeof d.content=="string"&&(n+=d.content),d.thinking&&typeof d.thinking.content=="string"&&(r+=d.thinking.content));continue}(f.reasoning_content||f.thinking)&&(r+=f.reasoning_content||f.thinking||"")}}return{text:n,thinking:r}}function a8(e,t){if(!e||e.length===0)return{text:"",thinking:""};const n=fu(e);return pu(n)}function GT(e){var t,n;if(console.log("[assembleResponseBody] log:",{id:e.id,hasResponseBody:!!e.responseBody,responseBodyLength:(t=e.responseBody)==null?void 0:t.length,hasStreamChunks:!!e.streamChunks,streamChunksLength:(n=e.streamChunks)==null?void 0:n.length,targetType:e.targetType}),e.responseBody)try{const r=JSON.parse(e.responseBody);return console.log("[assembleResponseBody] returning parsed responseBody"),r}catch{return console.log("[assembleResponseBody] returning raw responseBody (parse failed)"),e.responseBody}if(e.streamChunks&&e.streamChunks.length>0){console.log("[assembleResponseBody] processing streamChunks:",e.streamChunks.length);const{text:r,thinking:i}=a8(e.downstreamResponseBody,e.targetType);if(console.log("[assembleResponseBody] assembled text:",{textLength:r.length,thinkingLength:i.length}),e.targetType==="claude-code"){const l=[];i&&l.push({type:"thinking",thinking:i}),r&&l.push({type:"text",text:r}),l.length===0&&l.push({type:"text",text:"(空内容 - 可能响应未完成或解析失败)"});const s={type:"message",role:"assistant",content:l,model:e.targetModel||e.requestModel,usage:e.usage};return console.log("[assembleResponseBody] returning claude-code format with",l.length,"content blocks"),s}else if(e.targetType==="codex"){const l={id:e.id,object:"chat.completion",created:Math.floor(e.timestamp/1e3),model:e.targetModel||e.requestModel,choices:[{index:0,message:{role:"assistant",content:r||i||"(空内容 - 可能响应未完成或解析失败)"},finish_reason:"stop"}],usage:e.usage};return console.log("[assembleResponseBody] returning codex format"),l}const a={content:r||i||"(空内容 - 可能响应未完成或解析失败)",usage:e.usage};return console.log("[assembleResponseBody] returning generic format"),a}return console.log("[assembleResponseBody] no responseBody or streamChunks, returning null"),null}function o8(e){const t=[];t.push(`# 请求日志详情
120
+ `),t.push("## 基本信息"),t.push(`- **日志ID**: ${e.id}`),t.push(`- **时间**: ${ft(e.timestamp).format("YYYY-MM-DD HH:mm:ss")}`),e.targetType&&t.push(`- **客户端类型**: ${Jl[e.targetType]||"-"}`),e.tags&&e.tags.length>0&&t.push(`- **标签**: ${e.tags.join(", ")}`),t.push(""),t.push("## 模型信息"),e.requestModel&&t.push(`- **请求模型**: ${e.requestModel}`),e.vendorName&&t.push(`- **供应商**: ${e.vendorName}`),e.targetServiceName&&t.push(`- **供应商API服务**: ${e.targetServiceName}`),e.targetModel&&t.push(`- **供应商模型**: ${e.targetModel}`),t.push(""),t.push("## 请求信息"),t.push(`- **请求方法**: ${e.method}`),t.push(`- **请求路径**: ${e.path}`),t.push(""),e.headers&&(t.push("## 请求头"),t.push("```json"),t.push(JSON.stringify(e.headers,null,2)),t.push("```\n")),e.body&&(t.push("## 请求体"),t.push("```json"),t.push(JSON.stringify(e.body,null,2)),t.push("```\n")),e.upstreamRequest&&(t.push("## 实际转发的请求信息"),t.push("```json"),t.push(JSON.stringify(e.upstreamRequest,null,2)),t.push("```\n")),t.push("## 响应信息"),t.push(`- **状态码**: ${e.statusCode||"Error"}`),t.push(`- **响应时间**: ${e.responseTime?`${e.responseTime}ms`:"-"}`),t.push(""),e.responseHeaders&&(t.push("## 响应头"),t.push("```json"),t.push(JSON.stringify(e.responseHeaders,null,2)),t.push("```\n"));const n=GT(e);if(n&&(t.push("## 响应体"),t.push("```json"),t.push(JSON.stringify(n,null,2)),t.push("```\n")),e.usage&&(t.push("## Token 使用"),t.push(`- **输入**: ${e.usage.inputTokens}`),t.push(`- **输出**: ${e.usage.outputTokens}`),e.usage.totalTokens!==void 0&&t.push(`- **总计**: ${e.usage.totalTokens}`),e.usage.cacheReadInputTokens!==void 0&&t.push(`- **缓存读取**: ${e.usage.cacheReadInputTokens}`),t.push("")),e.error&&(t.push("## 错误信息"),t.push("```"),t.push(e.error),t.push("```\n")),e.downstreamResponseBody&&(t.push("## 实际转发的响应体"),t.push("```json"),t.push(typeof e.downstreamResponseBody=="string"?e.downstreamResponseBody:JSON.stringify(e.downstreamResponseBody,null,2)),t.push("```\n"),typeof e.downstreamResponseBody=="string"&&(e.downstreamResponseBody.includes("event:")||e.downstreamResponseBody.includes("data:")))){const r=fu(e.downstreamResponseBody),{text:i,thinking:a}=pu(r);a&&(t.push(`## 思考内容 (${a.length} 字符)`),t.push("```"),t.push(a),t.push("```\n")),i&&(t.push(`## 回复内容 (${i.length} 字符)`),t.push("```"),t.push(i),t.push("```\n"))}return t.join(`
121
+ `)}function l8(e){const t=[];return t.push(`# 错误日志详情
122
+ `),t.push("## 基本信息"),t.push(`- **ID**: ${e.id}`),t.push(`- **时间**: ${ft(e.timestamp).format("YYYY-MM-DD HH:mm:ss")}`),e.targetType&&t.push(`- **客户端类型**: ${Jl[e.targetType]||"-"}`),e.tags&&e.tags.length>0&&t.push(`- **标签**: ${e.tags.join(", ")}`),t.push(""),t.push("## 模型信息"),e.requestModel&&t.push(`- **请求模型**: ${e.requestModel}`),e.vendorName&&t.push(`- **供应商**: ${e.vendorName}`),e.targetServiceName&&t.push(`- **供应商API服务**: ${e.targetServiceName}`),e.targetModel&&t.push(`- **供应商模型**: ${e.targetModel}`),t.push(""),t.push("## 请求信息"),t.push(`- **请求方法**: ${e.method}`),t.push(`- **请求路径**: ${e.path}`),t.push(""),e.requestHeaders&&(t.push("## 请求头"),t.push("```json"),t.push(JSON.stringify(e.requestHeaders,null,2)),t.push("```\n")),e.requestBody&&(t.push("## 请求体"),t.push("```json"),t.push(JSON.stringify(e.requestBody,null,2)),t.push("```\n")),e.upstreamRequest&&(t.push("## 实际转发的请求信息"),t.push("```json"),t.push(JSON.stringify(e.upstreamRequest,null,2)),t.push("```\n")),t.push("## 错误信息"),t.push("```"),t.push(e.errorMessage),t.push("```\n"),e.errorStack&&(t.push("## 错误堆栈"),t.push("```"),t.push(e.errorStack),t.push("```\n")),t.push("## 响应信息"),t.push(`- **状态码**: ${e.statusCode||"-"}`),t.push(`- **响应时间**: ${e.responseTime?`${e.responseTime}ms`:"-"}`),t.push(""),e.responseHeaders&&(t.push("## 响应头"),t.push("```json"),t.push(JSON.stringify(e.responseHeaders,null,2)),t.push("```\n")),e.responseBody&&(t.push("## 响应体"),t.push("```json"),t.push(JSON.stringify(e.responseBody,null,2)),t.push("```\n")),t.join(`
123
+ `)}const s8=1e6;function c8(e){return"errorMessage"in e}function u8({events:e}){const{text:t,thinking:n}=pu(e);return console.log("AssembledTextViewFromDownstream",{text:t,thinking:n}),!t&&!n?o.jsx("div",{style:{color:"#7f8c8d",fontStyle:"italic"},children:"无法解析出文本内容"}):o.jsxs("div",{className:"assembled-text-view",children:[n&&o.jsxs("details",{style:{marginBottom:"15px",border:"1px solid var(--border-thinking-box)",borderRadius:"8px",padding:"10px",backgroundColor:"var(--bg-thinking-box)"},open:!0,children:[o.jsxs("summary",{style:{cursor:"pointer",fontWeight:"bold",color:"var(--text-thinking-title)",userSelect:"none"},children:["思考内容 (",n.length," 字符)"]}),o.jsx("pre",{style:{marginTop:"10px",whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"monospace",fontSize:"13px",color:"var(--text-thinking-content)",backgroundColor:"var(--bg-thinking-content)",padding:"10px",borderRadius:"4px",border:"1px solid var(--border-thinking-content)"},children:n})]}),t&&o.jsxs("div",{children:[o.jsxs("div",{style:{fontWeight:"bold",marginBottom:"8px",color:"var(--text-reply-title)"},children:["回复内容 (",t.length," 字符)"]}),o.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"monospace",fontSize:"13px",color:"var(--text-reply-content)",backgroundColor:"var(--bg-reply-content)",padding:"10px",borderRadius:"4px",border:"1px solid var(--border-reply-content)"},children:t})]})]})}function d8({log:e}){const[t,n]=h.useState(!1),[r,i]=h.useState(!0);return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"日志ID"}),o.jsx("input",{type:"text",value:e.id,readOnly:!0})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"时间"}),o.jsx("input",{type:"text",value:ft(e.timestamp).format("YYYY-MM-DD HH:mm:ss"),readOnly:!0})]}),e.targetType&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"客户端类型"}),o.jsx("input",{type:"text",value:Jl[e.targetType]||"-",readOnly:!0})]}),e.tags&&e.tags.length>0&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"标签"}),o.jsx("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap",marginTop:"8px"},children:e.tags.map((a,l)=>o.jsx("span",{style:{padding:"4px 12px",backgroundColor:"#3498db",color:"white",borderRadius:"12px",fontSize:"13px",fontWeight:"500"},children:a},l))})]}),e.requestModel&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"请求模型"}),o.jsx("input",{type:"text",value:e.requestModel,readOnly:!0})]}),e.vendorName&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"供应商"}),o.jsx("input",{type:"text",value:e.vendorName,readOnly:!0})]}),e.targetServiceName&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"供应商API服务"}),o.jsx("input",{type:"text",value:e.targetServiceName,readOnly:!0})]}),e.targetModel&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"供应商模型"}),o.jsx("input",{type:"text",value:e.targetModel,readOnly:!0})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"请求方法"}),o.jsx("input",{type:"text",value:e.method,readOnly:!0})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"请求路径"}),o.jsx("input",{type:"text",value:e.path,readOnly:!0})]}),e.headers&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"请求头"}),o.jsx(kr,{data:e.headers,collapsed:!0})]}),e.body&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"请求体"}),o.jsx(kr,{data:e.body,collapsed:!0})]}),e.upstreamRequest&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"实际转发的请求信息"}),o.jsx(kr,{data:e.upstreamRequest})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"状态码"}),o.jsx("input",{type:"text",value:e.statusCode||"Error",readOnly:!0})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"响应时间"}),o.jsx("input",{type:"text",value:e.responseTime?`${e.responseTime}ms`:"-",readOnly:!0})]}),e.responseHeaders&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"响应头"}),o.jsx(kr,{data:e.responseHeaders,collapsed:!0})]}),(()=>{const a=GT(e);return console.log("[RequestLogDetail] assembledBody:",a),a?o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"响应体"}),o.jsx(kr,{data:a})]}):o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"响应体"}),o.jsxs("div",{style:{padding:"10px",color:"#7f8c8d",fontStyle:"italic"},children:["无响应体数据",e.streamChunks===void 0&&e.responseBody===void 0&&o.jsx("div",{style:{marginTop:"5px",fontSize:"12px",color:"#e74c3c"},children:"⚠️ 该日志不包含响应数据(可能是旧版本记录)"})]})]})})(),e.usage&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"Token 使用"}),o.jsx("textarea",{rows:4,value:`输入: ${e.usage.inputTokens}
124
+ 输出: ${e.usage.outputTokens}
125
+ `+(e.usage.totalTokens!==void 0?`总计: ${e.usage.totalTokens}
126
+ `:"")+(e.usage.cacheReadInputTokens!==void 0?`缓存读取: ${e.usage.cacheReadInputTokens}`:""),readOnly:!0})]}),e.error&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"错误信息"}),o.jsx("textarea",{rows:4,value:e.error,readOnly:!0,style:{color:"red"}})]}),e.downstreamResponseBody&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"实际转发的响应体"}),o.jsx(kr,{data:e.downstreamResponseBody,collapsed:!0})]}),(()=>{const a=e.downstreamResponseBody;if(!a||!(typeof a=="string"&&(a.includes("event:")||a.includes("data:"))))return null;const s=fu(a);return o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{children:["Stream Events (",s.length,"个)",o.jsx("button",{onClick:()=>n(!t),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},className:"btn btn-sm btn-secondary",children:t?"折叠":"展开"}),o.jsx("button",{onClick:()=>i(!r),style:{marginLeft:"5px",padding:"2px 8px",fontSize:"12px"},className:"btn btn-sm btn-primary",children:r?"隐藏拼装结果":"查看拼装结果"})]}),t&&o.jsx("div",{style:{maxHeight:"400px",overflowY:"auto",border:"1px solid #ddd",padding:"10px",borderRadius:"4px"},children:s.map((c,u)=>o.jsxs("div",{style:{marginBottom:"10px"},children:[o.jsxs("div",{style:{fontWeight:"bold",fontSize:"12px",color:"#7f8c8d",marginBottom:"4px"},children:["Event #",u+1," ",c.event&&`[${c.event}]`]}),o.jsx(kr,{data:c.data||c.raw,collapsed:!0})]},u))}),r&&o.jsx("div",{style:{marginTop:"10px",maxHeight:"400px",overflowY:"auto",border:"1px solid var(--border-secondary)",padding:"10px",borderRadius:"4px",backgroundColor:"var(--bg-assembled-text)"},children:o.jsx(u8,{events:s})})]})})()]})}function f8({log:e}){return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"ID"}),o.jsx("input",{type:"text",value:e.id,readOnly:!0})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"时间"}),o.jsx("input",{type:"text",value:ft(e.timestamp).format("YYYY-MM-DD HH:mm:ss"),readOnly:!0})]}),e.targetType&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"客户端类型"}),o.jsx("input",{type:"text",value:Jl[e.targetType]||"-",readOnly:!0})]}),e.tags&&e.tags.length>0&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"标签"}),o.jsx("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap",marginTop:"8px"},children:e.tags.map((t,n)=>o.jsx("span",{style:{padding:"4px 12px",backgroundColor:"#3498db",color:"white",borderRadius:"12px",fontSize:"13px",fontWeight:"500"},children:t},n))})]}),e.requestModel&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"请求模型"}),o.jsx("input",{type:"text",value:e.requestModel,readOnly:!0})]}),e.vendorName&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"供应商"}),o.jsx("input",{type:"text",value:e.vendorName,readOnly:!0})]}),e.targetServiceName&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"供应商API服务"}),o.jsx("input",{type:"text",value:e.targetServiceName,readOnly:!0})]}),e.targetModel&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"供应商模型"}),o.jsx("input",{type:"text",value:e.targetModel,readOnly:!0})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"请求方法"}),o.jsx("input",{type:"text",value:e.method,readOnly:!0})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"请求路径"}),o.jsx("input",{type:"text",value:e.path,readOnly:!0})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"状态码"}),o.jsx("input",{type:"text",value:e.statusCode||"-",readOnly:!0})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"响应时间"}),o.jsx("input",{type:"text",value:e.responseTime?`${e.responseTime}ms`:"-",readOnly:!0})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"错误信息"}),o.jsx("textarea",{rows:4,value:e.errorMessage,readOnly:!0,style:{color:"#e74c3c"}})]}),e.errorStack&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"错误堆栈"}),o.jsx("textarea",{rows:8,value:e.errorStack,readOnly:!0,style:{fontSize:"12px",color:"#7f8c8d"}})]}),e.requestHeaders&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"请求头"}),o.jsx(kr,{data:e.requestHeaders,collapsed:!0})]}),e.requestBody&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"请求体"}),o.jsx(kr,{data:e.requestBody,collapsed:!0})]}),e.upstreamRequest&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"实际转发的请求信息"}),o.jsx(kr,{data:e.upstreamRequest})]}),e.responseHeaders&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"响应头"}),o.jsx(kr,{data:e.responseHeaders,collapsed:!0})]}),e.responseBody&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"响应体"}),o.jsx(kr,{data:e.responseBody})]})]})}function Ef({log:e,onClose:t,zIndex:n}){const r=n??s8,i=c8(e),a=()=>{const l=i?l8(e):o8(e);navigator.clipboard.writeText(l).then(()=>{U.success("复制成功")}).catch(()=>{U.error("复制失败")})};return o.jsxs("div",{className:"modal-overlay",style:{zIndex:r},children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:t,"aria-label":"关闭",style:{zIndex:r+1},children:"×"}),o.jsxs("div",{className:"modal modal--sticky-layout",style:{width:"800px",zIndex:r},children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:i?"错误日志详情":"请求详情"})}),o.jsx("div",{className:"modal-body-scrollable",children:i?o.jsx(f8,{log:e}):o.jsx(d8,{log:e})}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-primary",onClick:a,children:"复制"}),o.jsx("button",{className:"btn btn-secondary",onClick:t,children:"关闭"})]})]})]})}const p8=!1;ft.extend(Gx);function h8(){const{confirm:e}=du(),[t,n]=h.useState("request"),[r,i]=h.useState([]),[a,l]=h.useState([]),[s,c]=h.useState(null),[u,f]=h.useState(null),[d,p]=h.useState(1),[m,g]=h.useState(20),[y,x]=h.useState(0),[v,b]=h.useState(1),[w,S]=h.useState(20),[C,j]=h.useState(0),[E,O]=h.useState(!1),[R,A]=h.useState(!1),[N,_]=h.useState(10),[q,W]=h.useState([]),[I,F]=h.useState([]),[K,M]=h.useState(""),[B,k]=h.useState(""),[L,Q]=h.useState(""),[T,ce]=h.useState(""),[ve,X]=h.useState(""),[oe,fe]=h.useState("");h.useEffect(()=>{te()},[t,d,m,v,w,ve,oe]),h.useEffect(()=>{Z(),se()},[]),h.useEffect(()=>{let ee=null,Y=null;return R&&(Y=setInterval(()=>{_(le=>le<=1?10:le-1)},1e3),ee=setInterval(()=>{te(),se()},1e4)),()=>{ee&&clearInterval(ee),Y&&clearInterval(Y)}},[R,t,d,m,v,w]);const te=async()=>{O(!0);try{if(t==="request"){const ee=(d-1)*m,[Y,le]=await Promise.all([ve.trim()?V.searchLogs(ve.trim(),m,ee):V.getLogs(m,ee),ve.trim()?V.searchLogsCount(ve.trim()):V.getLogsCount()]);i(Y),x(le.count)}else if(t==="error"){const ee=(v-1)*w,[Y,le]=await Promise.all([oe.trim()?V.searchErrorLogs(oe.trim(),w,ee):V.getErrorLogs(w,ee),oe.trim()?V.searchErrorLogsCount(oe.trim()):V.getErrorLogsCount()]);l(Y),j(le.count)}}catch(ee){console.error("Failed to load logs:",ee)}finally{O(!1)}},Z=async()=>{try{const[ee,Y]=await Promise.all([V.getVendors(),V.getAPIServices()]);W(ee),F(Y)}catch(ee){console.error("Failed to load vendors and services:",ee)}},se=async()=>{try{const[ee,Y]=await Promise.all([V.getLogsCount(),V.getErrorLogsCount()]);x(ee.count),j(Y.count)}catch(ee){console.error("Failed to load counts:",ee)}},re=ee=>ee?ee>=200&&ee<300?"badge-success":ee>=400&&ee<500?"badge-warning":"badge-danger":"badge-danger",Oe=ee=>{k(ee),Q(""),ce("")},ne=ee=>{Q(ee),ce("")},_e=()=>B?I.filter(ee=>ee.vendorId===B):[],Re=()=>{if(!L)return[];const ee=I.find(Y=>Y.id===L);return(ee==null?void 0:ee.supportedModels)||[]},rt=(ee=>ee.filter(Y=>!(K&&Y.targetType!==K||B&&Y.vendorId!==B||L&&Y.targetServiceId!==L||T&&Y.targetModel!==T)))(r),Be=ee=>{p(ee)},qe=ee=>{g(ee),p(1)},ye=ee=>{b(ee)},Ee=ee=>{S(ee),b(1)},ze=()=>rt.length===0?o.jsx("div",{className:"empty-state",children:o.jsx("p",{children:"暂无请求日志"})}):o.jsxs("table",{children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"时间"}),o.jsx("th",{children:"客户端类型"}),o.jsx("th",{children:"路径"}),o.jsx("th",{children:"状态"}),o.jsx("th",{children:"响应时间"}),o.jsx("th",{children:"Tokens信息"}),o.jsx("th",{children:"操作"})]})}),o.jsx("tbody",{children:rt.map(ee=>o.jsxs("tr",{children:[o.jsx("td",{children:ft(ee.timestamp).format("YYYY-MM-DD HH:mm:ss")}),o.jsx("td",{children:Jl[ee.targetType]?o.jsx("span",{className:`badge ${ee.targetType==="claude-code"?"badge-claude-code":ee.targetType==="codex"?"badge-codex":"badge-info"}`,children:Jl[ee.targetType]}):"-"}),o.jsx("td",{children:ee.path}),o.jsx("td",{children:o.jsx("span",{className:`badge ${re(ee.statusCode)}`,children:ee.statusCode||"Error"})}),o.jsx("td",{children:ee.responseTime?`${ee.responseTime}ms`:"-"}),o.jsx("td",{children:ee.usage?o.jsxs("span",{children:[ee.usage.totalTokens?ee.usage.totalTokens:ee.usage.inputTokens+ee.usage.outputTokens," tokens"]}):"-"}),o.jsx("td",{children:o.jsxs("div",{style:{position:"relative",display:"inline-block"},children:[(()=>{const Y=ee.downstreamResponseBody;return typeof Y=="string"&&(Y.includes("event:")||Y.includes("data:"))&&o.jsx("span",{style:{position:"absolute",top:"-4px",right:"-4px",width:"6px",height:"6px",backgroundColor:"#f39c12",borderRadius:"50%",boxShadow:"0 0 0 2px rgba(243, 156, 18, 0.5)"}})})(),o.jsx("button",{className:"btn btn-secondary",onClick:()=>c(ee),children:"详情"})]})})]},ee.id))})]}),ht=()=>a.length===0?o.jsx("div",{className:"empty-state",children:o.jsx("p",{children:"暂无错误日志"})}):o.jsxs("table",{children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"时间"}),o.jsx("th",{children:"方法"}),o.jsx("th",{children:"路径"}),o.jsx("th",{children:"状态"}),o.jsx("th",{children:"错误信息"}),o.jsx("th",{children:"操作"})]})}),o.jsx("tbody",{children:a.map(ee=>o.jsxs("tr",{children:[o.jsx("td",{children:ft(ee.timestamp).format("YYYY-MM-DD HH:mm:ss")}),o.jsx("td",{children:o.jsx("span",{className:"badge badge-danger",children:ee.method})}),o.jsx("td",{children:ee.path}),o.jsx("td",{children:o.jsx("span",{className:"badge badge-danger",children:ee.statusCode||"-"})}),o.jsx("td",{style:{maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"#e74c3c"},children:ee.errorMessage}),o.jsx("td",{children:o.jsx("button",{className:"btn btn-secondary",onClick:()=>f(ee),children:"详情"})})]},ee.id))})]});return o.jsxs("div",{className:"logs-page",children:[o.jsx("div",{className:"page-header",children:o.jsxs("div",{className:"page-header-content",children:[o.jsxs("div",{className:"page-header-text",children:[o.jsx("h1",{children:"日志"}),o.jsx("p",{children:"查看所有API请求日志"})]}),p8]})}),o.jsxs("div",{className:"card",children:[o.jsx("div",{style:{borderBottom:"1px solid #ecf0f1",marginBottom:"20px"},children:o.jsxs("div",{style:{display:"flex",gap:"0"},children:[o.jsxs("button",{onClick:()=>n("request"),style:{padding:"12px 24px",border:"none",background:t==="request"?"#3498db":"transparent",color:t==="request"?"white":"#7f8c8d",cursor:"pointer",borderBottom:t==="request"?"2px solid #2980b9":"2px solid transparent",fontWeight:t==="request"?"bold":"normal"},children:["请求日志 (",y,")"]}),o.jsxs("button",{onClick:()=>n("error"),style:{padding:"12px 24px",border:"none",background:t==="error"?"#e74c3c":"transparent",color:t==="error"?"white":"#7f8c8d",cursor:"pointer",borderBottom:t==="error"?"2px solid #c0392b":"2px solid transparent",fontWeight:t==="error"?"bold":"normal"},children:["错误日志 (",C,")"]})]})}),o.jsxs("div",{className:"toolbar",children:[o.jsxs("h3",{children:[t==="error"&&"错误日志列表",t==="request"&&"请求日志列表"]}),o.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center"},children:[t==="request"&&o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[o.jsx("input",{type:"text",placeholder:"搜索日志内容...",value:ve,onChange:ee=>{X(ee.target.value),p(1)},onKeyDown:ee=>{ee.key==="Enter"&&te()},style:{padding:"6px 12px",borderRadius:"8px",border:"1px solid var(--border-primary)",background:"var(--bg-card)",color:"var(--text-primary)",width:"200px",fontSize:"14px"}}),ve&&o.jsx("button",{onClick:()=>{X(""),p(1)},style:{padding:"6px 10px",borderRadius:"6px",border:"1px solid var(--border-primary)",background:"var(--bg-secondary)",color:"var(--text-primary)",cursor:"pointer",fontSize:"13px"},children:"清除"})]}),t==="error"&&o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[o.jsx("input",{type:"text",placeholder:"搜索错误日志...",value:oe,onChange:ee=>{fe(ee.target.value),b(1)},onKeyDown:ee=>{ee.key==="Enter"&&te()},style:{padding:"6px 12px",borderRadius:"8px",border:"1px solid var(--border-primary)",background:"var(--bg-card)",color:"var(--text-primary)",width:"200px",fontSize:"14px"}}),oe&&o.jsx("button",{onClick:()=>{fe(""),b(1)},style:{padding:"6px 10px",borderRadius:"6px",border:"1px solid var(--border-primary)",background:"var(--bg-secondary)",color:"var(--text-primary)",cursor:"pointer",fontSize:"13px"},children:"清除"})]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"0 12px",background:"var(--bg-secondary)",borderRadius:"8px"},children:[o.jsx("input",{type:"checkbox",id:"auto-refresh",checked:R,onChange:ee=>{A(ee.target.checked),ee.target.checked&&_(10)},style:{cursor:"pointer"}}),o.jsxs("label",{htmlFor:"auto-refresh",style:{cursor:"pointer",fontSize:"14px",color:"var(--text-primary)",userSelect:"none"},children:["自动刷新 ",R&&`(⏱ ${N}s)`]})]}),o.jsx("button",{className:"btn btn-primary",onClick:()=>{te(),se(),_(10)},children:"刷新"})]})]}),t==="request"&&o.jsxs("div",{style:{padding:"15px",background:"var(--bg-secondary)",borderRadius:"12px",marginBottom:"20px",display:"flex",gap:"15px",alignItems:"center",flexWrap:"wrap",border:"1px solid var(--border-primary)"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[o.jsx("label",{style:{fontWeight:"bold",color:"var(--text-primary)"},children:"来源类型:"}),o.jsxs("select",{value:K,onChange:ee=>M(ee.target.value),style:{padding:"6px 10px",borderRadius:"8px",border:"1px solid var(--border-primary)",background:"var(--bg-card)",color:"var(--text-primary)"},children:[o.jsx("option",{value:"",children:"全部"}),o.jsx("option",{value:"claude-code",children:"Claude Code"}),o.jsx("option",{value:"codex",children:"Codex"})]})]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[o.jsx("label",{style:{fontWeight:"bold",color:"var(--text-primary)"},children:"供应商:"}),o.jsxs("select",{value:B,onChange:ee=>Oe(ee.target.value),style:{padding:"6px 10px",borderRadius:"8px",border:"1px solid var(--border-primary)",minWidth:"150px",background:"var(--bg-card)",color:"var(--text-primary)"},children:[o.jsx("option",{value:"",children:"全部供应商"}),q.map(ee=>o.jsx("option",{value:ee.id,children:ee.name},ee.id))]})]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[o.jsx("label",{style:{fontWeight:"bold",color:"var(--text-primary)"},children:"API服务:"}),o.jsxs("select",{value:L,onChange:ee=>ne(ee.target.value),disabled:!B,style:{padding:"6px 10px",borderRadius:"8px",border:"1px solid var(--border-primary)",minWidth:"150px",background:B?"var(--bg-card)":"var(--bg-secondary)",color:"var(--text-primary)",cursor:B?"pointer":"not-allowed",opacity:B?1:.6},children:[o.jsx("option",{value:"",children:"全部服务"}),_e().map(ee=>o.jsx("option",{value:ee.id,children:ee.name},ee.id))]})]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[o.jsx("label",{style:{fontWeight:"bold",color:"var(--text-primary)"},children:"模型:"}),o.jsxs("select",{value:T,onChange:ee=>ce(ee.target.value),disabled:!L,style:{padding:"6px 10px",borderRadius:"8px",border:"1px solid var(--border-primary)",minWidth:"150px",background:L?"var(--bg-card)":"var(--bg-secondary)",color:"var(--text-primary)",cursor:L?"pointer":"not-allowed",opacity:L?1:.6},children:[o.jsx("option",{value:"",children:"全部模型"}),Re().map(ee=>o.jsx("option",{value:ee,children:ee},ee))]})]}),(K||B||L||T)&&o.jsx("button",{onClick:()=>{M(""),k(""),Q(""),ce("")},style:{padding:"6px 12px",borderRadius:"8px",border:"1px solid var(--accent-danger)",background:"var(--accent-danger)",color:"white",cursor:"pointer",fontSize:"14px"},children:"清除筛选"})]}),t==="request"&&o.jsxs(o.Fragment,{children:[E?o.jsx("div",{className:"empty-state",children:o.jsx("p",{children:"加载中..."})}):ze(),!E&&o.jsx(Bc,{currentPage:d,totalItems:y,pageSize:m,onPageChange:Be,onPageSizeChange:qe})]}),t==="error"&&o.jsxs(o.Fragment,{children:[E?o.jsx("div",{className:"empty-state",children:o.jsx("p",{children:"加载中..."})}):ht(),!E&&o.jsx(Bc,{currentPage:v,totalItems:C,pageSize:w,onPageChange:ye,onPageSizeChange:Ee})]})]}),s&&o.jsx(Ef,{log:s,onClose:()=>c(null)}),u&&o.jsx(Ef,{log:u,onClose:()=>f(null)})]})}function m8({session:e,onClose:t}){var N;const[n,r]=h.useState(e.targetType==="claude-code"?"codex":"claude-code"),[i,a]=h.useState(!1),[l,s]=h.useState(!0),[c,u]=h.useState(0),[f,d]=h.useState(!1),[p,m]=h.useState(null),[g,y]=h.useState(""),[x,v]=h.useState(null),[b,w]=h.useState(!1),S=e.targetType==="claude-code"?"Claude Code":"Codex",C=n==="claude-code"?"Claude Code":"Codex",j=(()=>{const _=e.lastRequestAt-e.firstRequestAt,q=Math.floor(_/6e4);return q<1?`${Math.max(1,Math.floor(_/1e3))}秒`:q<60?`${q}分钟`:`${Math.floor(q/60)}小时${q%60}分钟`})(),E=async()=>{d(!0),m(null),v(null);try{const _={sourceSessionId:e.id,targetTool:n,includeThinking:i,includeToolCalls:l,maxRounds:c},q=await V.migrationPreview(e.id,_);m(q),y(q.generatedPrompt)}catch(_){U.error(_.message||"预览失败")}finally{d(!1)}},O=async()=>{const _=g||(p==null?void 0:p.generatedPrompt)||"";try{await navigator.clipboard.writeText(_),U.success("已复制到剪贴板!请打开 "+C+",粘贴为第一条消息")}catch{const q=document.querySelector(".migration-prompt-textarea");q?(q.select(),document.execCommand("copy"),U.success("已复制到剪贴板!")):U.error("复制失败,请手动选择内容复制")}},R=async()=>{if(x!=null&&x.command)try{await navigator.clipboard.writeText(x.command),U.success("命令已复制!请在终端中执行")}catch{U.error("复制失败")}},A=async()=>{w(!0),v(null);try{const _={sourceSessionId:e.id,targetTool:n,includeThinking:i,includeToolCalls:l,maxRounds:c},q=await V.migrateLaunch(e.id,_);v(q),q.success&&U.success(`已在新的终端窗口中启动 ${C}`)}catch(_){U.error(_.message||"启动失败")}finally{w(!1)}};return o.jsxs("div",{className:"modal-overlay",children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:t,"aria-label":"关闭",children:"×"}),o.jsxs("div",{className:"modal modal--sticky-layout migration-modal",style:{width:"900px",maxWidth:"90vw"},children:[o.jsxs("div",{className:"modal-header",children:[o.jsx("h2",{children:"会话迁移"}),o.jsxs("div",{style:{fontSize:"13px",color:"var(--text-tertiary)",marginLeft:"12px"},children:["将 ",S," 会话迁移到 ",C]})]}),o.jsxs("div",{className:"modal-body-scrollable",style:{padding:"20px"},children:[o.jsxs("div",{className:"migration-source-info",children:[o.jsx("div",{className:"migration-source-title",children:((N=e.title)==null?void 0:N.replace(/<\/?session>/g,"").trim())||e.id.slice(0,8)}),o.jsxs("div",{className:"migration-source-meta",children:[o.jsx("span",{className:`badge migration-source-badge ${e.targetType==="claude-code"?"migration-badge-claude":"migration-badge-codex"}`,children:e.targetType==="claude-code"?"Claude Code":"Codex"}),o.jsxs("span",{children:[e.requestCount," 轮对话"]}),o.jsxs("span",{children:[e.totalTokens.toLocaleString()," tokens"]}),o.jsx("span",{children:j})]})]}),o.jsxs("div",{style:{marginTop:"20px"},children:[o.jsx("label",{style:{display:"block",marginBottom:"12px",fontWeight:500,color:"var(--text-secondary)",fontSize:"13px"},children:"迁移方向"}),o.jsxs("div",{className:"migration-tool-cards",children:[o.jsxs("div",{className:"migration-tool-card is-source",style:{cursor:"default"},children:[o.jsx("div",{className:"migration-tool-card-icon",children:e.targetType==="claude-code"?o.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2Z"}),o.jsx("path",{d:"M8.5 8.5h7v7h-7z"}),o.jsx("path",{d:"M5 12h2"}),o.jsx("path",{d:"M17 12h2"}),o.jsx("path",{d:"M12 5v2"}),o.jsx("path",{d:"M12 17v2"})]}):o.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2Z"}),o.jsx("path",{d:"M12 6v4l3 2"}),o.jsx("path",{d:"M9 18h6"}),o.jsx("path",{d:"M9 14h3"})]})}),o.jsx("div",{className:"migration-tool-card-name",children:S}),o.jsx("span",{className:"migration-tool-card-badge",children:"来源"})]}),o.jsx("div",{className:"migration-arrow",children:o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M5 12h14"}),o.jsx("path",{d:"m12 5 7 7-7 7"})]})}),o.jsxs("button",{type:"button",className:`migration-tool-card${n==="claude-code"?" active":""}`,onClick:()=>{r("claude-code"),v(null)},children:[o.jsx("div",{className:"migration-tool-card-icon",children:o.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2Z"}),o.jsx("path",{d:"M8.5 8.5h7v7h-7z"}),o.jsx("path",{d:"M5 12h2"}),o.jsx("path",{d:"M17 12h2"}),o.jsx("path",{d:"M12 5v2"}),o.jsx("path",{d:"M12 17v2"})]})}),o.jsx("div",{className:"migration-tool-card-name",children:"Claude Code"}),o.jsx("div",{className:"migration-tool-card-desc",children:e.targetType==="claude-code"&&n==="claude-code"?"同工具新会话":"Anthropic 编程助手"})]}),o.jsxs("button",{type:"button",className:`migration-tool-card${n==="codex"?" active":""}`,onClick:()=>{r("codex"),v(null)},children:[o.jsx("div",{className:"migration-tool-card-icon",children:o.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2Z"}),o.jsx("path",{d:"M12 6v4l3 2"}),o.jsx("path",{d:"M9 18h6"}),o.jsx("path",{d:"M9 14h3"})]})}),o.jsx("div",{className:"migration-tool-card-name",children:"Codex"}),o.jsx("div",{className:"migration-tool-card-desc",children:e.targetType==="codex"&&n==="codex"?"同工具新会话":"OpenAI 编程助手"})]})]})]}),o.jsxs("div",{className:"migration-options",style:{marginTop:"12px",display:"flex",gap:"16px",alignItems:"center",flexWrap:"wrap"},children:[o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px",fontSize:"14px",cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",checked:l,onChange:_=>s(_.target.checked)}),"包含工具调用摘要"]}),o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px",fontSize:"14px",cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",checked:i,onChange:_=>a(_.target.checked)}),"包含思考过程"]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[o.jsx("label",{style:{fontSize:"14px",whiteSpace:"nowrap"},children:"最大轮数:"}),o.jsxs("select",{value:c,onChange:_=>u(Number(_.target.value)),style:{padding:"4px 8px",border:"1px solid var(--border-primary)",borderRadius:"6px",fontSize:"14px",backgroundColor:"var(--input-bg)",color:"var(--text-primary)"},children:[o.jsx("option",{value:0,children:"全部"}),o.jsx("option",{value:5,children:"最近 5 轮"}),o.jsx("option",{value:10,children:"最近 10 轮"}),o.jsx("option",{value:20,children:"最近 20 轮"}),o.jsx("option",{value:30,children:"最近 30 轮"})]})]})]}),o.jsx("div",{style:{marginTop:"16px"},children:o.jsx("button",{className:"btn btn-primary",onClick:E,disabled:f,children:f?"加载中...":"预览迁移内容"})}),!p&&!f&&o.jsxs("div",{className:"migration-empty-hint",children:[o.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M12 20h9"}),o.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 1 1 3 3L7 19l-4 1 1-4Z"})]}),o.jsxs("div",{children:[o.jsx("div",{style:{fontWeight:500,color:"var(--text-secondary)",marginBottom:"4px"},children:"请先预览迁移内容"}),o.jsx("div",{style:{fontSize:"13px",color:"var(--text-tertiary)"},children:"点击上方「预览迁移内容」按钮,确认迁移 Prompt 后即可启动目标工具或复制到剪贴板"})]})]}),p&&o.jsxs("div",{className:"migration-preview-section",style:{marginTop:"16px"},children:[o.jsx("textarea",{className:"migration-prompt-textarea",value:g,onChange:_=>y(_.target.value),style:{width:"100%",minHeight:"400px",padding:"12px",border:"1px solid var(--border-primary)",borderRadius:"8px",fontSize:"13px",fontFamily:"monospace",backgroundColor:"var(--input-bg)",color:"var(--text-primary)",resize:"vertical",lineHeight:1.5}}),o.jsx("div",{className:"migration-preview-footer",style:{marginTop:"10px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:o.jsxs("div",{style:{fontSize:"13px",color:"var(--text-tertiary)"},children:["预估 Tokens: ",p.estimatedTokens.toLocaleString(),p.warnings.map((_,q)=>o.jsxs("span",{style:{color:"#e67e22",marginLeft:"12px"},children:["⚠ ",_]},q)),p.content.extractedRounds>0&&o.jsxs("span",{style:{color:"var(--text-tertiary)",marginLeft:"12px"},children:[p.content.extractedRounds,"/",p.content.totalRounds," 轮"]})]})})]}),x&&o.jsx("div",{className:`migration-launch-result ${x.success?"migration-launch-success":"migration-launch-fallback"}`,style:{marginTop:"16px",padding:"16px",borderRadius:"8px",backgroundColor:x.success?"#27ae6010":"#e67e2210",border:`1px solid ${x.success?"#27ae6040":"#e67e2240"}`},children:x.success?o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:"14px",fontWeight:600,color:"#27ae60",marginBottom:"8px"},children:["✅ 已在新终端窗口中启动 ",C]}),o.jsxs("div",{style:{fontSize:"13px",color:"var(--text-secondary)"},children:["请在新终端窗口中继续与 ",C," 交互"]})]}):o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:"14px",fontWeight:600,color:"#e67e22",marginBottom:"8px"},children:["⚠️ ",x.reason||"无法自动启动"]}),x.command&&o.jsxs("div",{style:{marginTop:"8px"},children:[o.jsx("div",{style:{fontSize:"13px",color:"var(--text-secondary)"},children:"请在终端中执行以下命令:"}),o.jsx("pre",{style:{marginTop:"6px",padding:"10px",backgroundColor:"var(--bg-secondary)",borderRadius:"6px",fontSize:"12px",fontFamily:"monospace",overflow:"auto"},children:x.command}),o.jsx("button",{className:"btn btn-sm btn-secondary",onClick:R,style:{marginTop:"6px"},children:"复制命令"})]}),x.fallbackSuggestions&&x.fallbackSuggestions.length>0&&o.jsx("div",{style:{marginTop:"8px",fontSize:"13px",color:"var(--text-tertiary)"},children:x.fallbackSuggestions.map((_,q)=>o.jsxs("div",{children:["• ",_]},q))})]})})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-primary",onClick:A,disabled:b||!p,title:p?"":"请先预览迁移内容",children:b?"启动中...":`🚀 启动 ${C}`}),o.jsx("button",{className:"btn btn-secondary",onClick:O,disabled:!p,title:p?"":"请先预览迁移内容",children:"📋 复制到剪贴板"}),o.jsx("button",{className:"btn btn-secondary",onClick:t,children:"关闭"})]})]})]})}function g8({session:e,onClose:t,onBound:n}){var v;const[r,i]=h.useState([]),[a,l]=h.useState({}),[s,c]=h.useState(e.routeId||null),[u,f]=h.useState(!1),[d,p]=h.useState(!0),m=e.targetType==="claude-code"?"Claude Code":"Codex";h.useEffect(()=>{(async()=>{try{const w=await V.getRoutes();i(w);const S={};for(const C of w)try{const j=await V.getRules(C.id);S[C.id]=j.length}catch{S[C.id]=0}l(S)}catch{U.error("加载路由列表失败")}finally{p(!1)}})()},[]);const g=async()=>{if(s){f(!0);try{const b=await V.bindSessionRoute(e.id,s);b.success?(U.success("路由绑定成功"),n(),t()):U.error(b.error||"绑定失败")}catch(b){U.error(b.message||"绑定失败")}finally{f(!1)}}},y=async()=>{f(!0);try{const b=await V.unbindSessionRoute(e.id);b.success?(U.success("已解除路由绑定"),n(),t()):U.error(b.error||"解绑失败")}catch(b){U.error(b.message||"解绑失败")}finally{f(!1)}},x=s!==(e.routeId||null);return o.jsxs("div",{className:"modal-overlay",children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:t,"aria-label":"关闭",children:"×"}),o.jsxs("div",{className:"modal",style:{width:"500px",maxWidth:"90vw"},children:[o.jsxs("div",{className:"modal-header",children:[o.jsx("h2",{children:"路由绑定"}),o.jsx("div",{style:{fontSize:"13px",color:"var(--text-tertiary)",marginLeft:"12px"},children:"为会话指定专用的路由"})]}),o.jsxs("div",{className:"modal-body-scrollable",style:{padding:"20px"},children:[o.jsxs("div",{style:{padding:"12px 16px",backgroundColor:"var(--bg-secondary)",borderRadius:"8px",marginBottom:"20px"},children:[o.jsx("div",{style:{fontWeight:500,marginBottom:"6px"},children:((v=e.title)==null?void 0:v.replace(/<\/?session>/g,"").trim())||e.id.slice(0,8)}),o.jsxs("div",{style:{fontSize:"12px",color:"var(--text-tertiary)",display:"flex",gap:"12px",alignItems:"center"},children:[o.jsx("span",{className:`badge ${e.targetType==="claude-code"?"badge-claude-code":"badge-codex"}`,style:{fontSize:"11px"},children:m}),o.jsxs("span",{children:[e.requestCount," 次请求"]}),o.jsxs("span",{children:[e.totalTokens.toLocaleString()," tokens"]})]})]}),e.routeId&&o.jsx("div",{style:{padding:"10px 14px",backgroundColor:"var(--bg-info, rgba(41, 128, 185, 0.1))",borderRadius:"6px",marginBottom:"16px",display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"13px"},children:o.jsxs("span",{style:{color:"var(--text-secondary)"},children:["当前绑定:",o.jsx("strong",{children:e.routeName||e.routeId})]})}),o.jsxs("div",{style:{marginBottom:"16px"},children:[o.jsx("label",{style:{display:"block",marginBottom:"10px",fontWeight:500,color:"var(--text-secondary)",fontSize:"13px"},children:"选择路由"}),d?o.jsx("div",{style:{textAlign:"center",padding:"20px",color:"var(--text-tertiary)"},children:"加载中..."}):r.length===0?o.jsxs("div",{style:{textAlign:"center",padding:"20px",color:"var(--text-tertiary)"},children:[o.jsx("p",{children:"暂无可用路由"}),o.jsx("p",{style:{fontSize:"12px",marginTop:"8px"},children:"请先在路由管理页面创建路由"})]}):o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px",maxHeight:"300px",overflowY:"auto"},children:r.map(b=>{const w=s===b.id,S=e.routeId===b.id;return o.jsx("div",{onClick:()=>c(b.id),style:{padding:"12px 14px",border:`2px solid ${w?"var(--color-primary, #2980b9)":"var(--border-primary, #e0e0e0)"}`,borderRadius:"8px",cursor:"pointer",backgroundColor:w?"var(--bg-route-item-selected, rgba(41, 128, 185, 0.08))":"var(--bg-primary)",transition:"all 0.15s ease",position:"relative"},children:o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o.jsxs("div",{children:[o.jsxs("div",{style:{fontWeight:500,fontSize:"14px",display:"flex",alignItems:"center",gap:"8px"},children:[o.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",border:`2px solid ${w?"var(--color-primary, #2980b9)":"var(--border-secondary, #ccc)"}`,display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:w&&o.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:"var(--color-primary, #2980b9)"}})}),b.name,S&&o.jsx("span",{style:{fontSize:"10px",padding:"1px 6px",borderRadius:"4px",backgroundColor:"var(--color-primary, #2980b9)",color:"white"},children:"当前"})]}),b.description&&o.jsx("div",{style:{fontSize:"12px",color:"var(--text-tertiary)",marginTop:"4px",marginLeft:"24px"},children:b.description})]}),o.jsxs("div",{style:{fontSize:"12px",color:"var(--text-tertiary)",flexShrink:0},children:[a[b.id]||0," 条规则"]})]})},b.id)})})]})]}),o.jsxs("div",{className:"modal-footer",children:[e.routeId&&o.jsx("button",{className:"btn btn-danger",onClick:y,disabled:u,children:"解绑"}),o.jsx("div",{style:{flex:1}}),o.jsx("button",{className:"btn btn-secondary",onClick:t,children:"取消"}),o.jsx("button",{className:"btn btn-primary",onClick:g,disabled:u||!s||!x,children:u?"处理中...":"确认绑定"})]})]})]})}const v8=Array.from({length:15},(e,t)=>t+1);function y8({onClose:e,onCleared:t}){const[n,r]=h.useState(7),[i,a]=h.useState(!1),[l,s]=h.useState(!1),c=async()=>{s(!0);try{const f=await V.cleanupSessions(n,i);f.sessionsAffected===0?U.info("没有符合条件的会话需要清除"):i?U.success(`已清除 ${f.sessionsAffected} 个会话的日志(共 ${f.logsDeleted} 条),会话记录已保留`):U.success(`已清除 ${f.sessionsAffected} 个会话及其关联日志(共 ${f.logsDeleted} 条)`),t(),e()}catch(f){U.error(f.message||"清除会话失败")}finally{s(!1)}},u=i?`将删除最后请求在 ${n} 天以前的会话所关联的日志,会话记录本身将被保留。`:`将永久删除最后请求在 ${n} 天以前的会话,及其所有关联日志。此操作不可撤销。`;return o.jsxs("div",{className:"modal-overlay",children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:e,"aria-label":"关闭",children:"×"}),o.jsxs("div",{className:"modal",style:{width:"480px",maxWidth:"90vw"},children:[o.jsxs("div",{className:"modal-header",children:[o.jsx("h2",{children:"清除会话"}),o.jsx("div",{style:{fontSize:"13px",color:"var(--text-tertiary)",marginLeft:"12px"},children:"按最后请求时间清理过期会话"})]}),o.jsxs("div",{className:"modal-body-scrollable",style:{padding:"20px"},children:[o.jsxs("div",{style:{marginBottom:"20px"},children:[o.jsx("label",{style:{display:"block",marginBottom:"10px",fontWeight:500,color:"var(--text-secondary)",fontSize:"13px"},children:"清除范围"}),o.jsxs("div",{style:{padding:"14px 16px",backgroundColor:"var(--bg-secondary)",borderRadius:"8px",display:"flex",alignItems:"center",gap:"10px",flexWrap:"wrap"},children:[o.jsx("span",{style:{fontSize:"14px",color:"var(--text-secondary)"},children:"最后请求在"}),o.jsx("select",{value:n,onChange:f=>r(Number(f.target.value)),disabled:l,style:{padding:"6px 10px",borderRadius:"6px",border:"1px solid var(--border-primary)",backgroundColor:"var(--bg-primary)",color:"var(--text-primary)",fontSize:"14px",cursor:"pointer"},children:v8.map(f=>o.jsx("option",{value:f,children:f},f))}),o.jsx("span",{style:{fontSize:"14px",color:"var(--text-secondary)"},children:"天以前的会话"})]})]}),o.jsxs("div",{onClick:()=>!l&&a(f=>!f),style:{padding:"14px 16px",borderRadius:"8px",border:`2px solid ${i?"var(--color-primary, #2980b9)":"var(--border-primary, #e0e0e0)"}`,backgroundColor:i?"var(--bg-route-item-selected, rgba(41, 128, 185, 0.08))":"var(--bg-primary)",cursor:l?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px",opacity:l?.6:1},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontWeight:500,fontSize:"14px",color:"var(--text-primary)"},children:"仅清空日志"}),o.jsx("div",{style:{fontSize:"12px",color:"var(--text-tertiary)",marginTop:"4px"},children:"开启后保留会话记录,仅删除这些会话的关联日志"})]}),o.jsx("div",{style:{width:"40px",height:"22px",borderRadius:"11px",backgroundColor:i?"var(--color-primary, #2980b9)":"var(--border-secondary, #ccc)",position:"relative",transition:"background-color 0.15s ease",flexShrink:0},children:o.jsx("div",{style:{position:"absolute",top:"2px",left:i?"20px":"2px",width:"18px",height:"18px",borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.15s ease",boxShadow:"0 1px 3px rgba(0,0,0,0.2)"}})})]}),o.jsxs("div",{style:{marginTop:"20px",padding:"12px 14px",backgroundColor:"rgba(231, 76, 60, 0.08)",border:"1px solid rgba(231, 76, 60, 0.3)",borderRadius:"6px",fontSize:"13px",color:"#c0392b",lineHeight:1.5},children:[o.jsx("strong",{children:"⚠️ 警告:"}),u]})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("div",{style:{flex:1}}),o.jsx("button",{className:"btn btn-secondary",onClick:e,disabled:l,children:"取消"}),o.jsx("button",{className:"btn btn-danger",onClick:c,disabled:l,children:l?"处理中...":"确认清除"})]})]})]})}ft.extend(Gx);function x8(e,t,n,r){if(!e)return[];const i=[];if(e.role==="user"){const a=e.content;if(typeof a=="string")i.push({role:"user",content:a,timestamp:t,model:n});else if(Array.isArray(a)){let l=[];const s=()=>{l.length>0&&(i.push({role:"user",content:l.join(`
127
+ `),timestamp:t,model:n}),l=[])};for(const c of a)if((c==null?void 0:c.type)==="text"&&(c!=null&&c.text))l.push(c.text);else if((c==null?void 0:c.type)==="image"||(c==null?void 0:c.type)==="image_url")l.push("[图片]");else if((c==null?void 0:c.type)==="tool_result"){s();let u="";c.content&&(typeof c.content=="string"?u=c.content:Array.isArray(c.content)?u=c.content.map(m=>typeof m=="string"?m:(m==null?void 0:m.type)==="text"&&(m!=null&&m.text)?m.text:(m==null?void 0:m.type)==="image"||(m==null?void 0:m.type)==="image_url"?"[图片]":JSON.stringify(m)).join(`
128
+ `):u=JSON.stringify(c.content));const f=c.tool_use_id&&(r==null?void 0:r.get(c.tool_use_id))||c.name||"",d=c.tool_use_id?c.tool_use_id.slice(-8):"",p=f?`[工具结果: ${f}${d?` · ...${d}`:""}]`:d?`[工具结果: ...${d}]`:"[工具结果]";i.push({role:"user",type:"tool_result",header:p,content:u||p,timestamp:t,model:n})}s()}}else if(e.role==="assistant"){const a=e.content;if(typeof a=="string")a&&i.push({role:"assistant",content:a,timestamp:t,model:n});else if(Array.isArray(a)){let l="",s="";for(const c of a)if(c.type==="text"&&c.text&&(l+=c.text),c.type==="thinking"&&c.thinking&&(s+=c.thinking),c.type==="tool_use"){(l||s)&&(i.push({role:"assistant",content:l,thinking:s||void 0,timestamp:t,model:n}),l="",s="");const u=c.name||"",f=c.id?c.id.slice(-8):"",d=u+(f?` · ...${f}`:""),p=c.input?JSON.stringify(c.input,null,2):"";i.push({role:"assistant",type:"tool_use",header:`[工具调用: ${d}]`,content:p||`[工具调用: ${d}]`,timestamp:t,model:n})}(l||s)&&i.push({role:"assistant",content:l||"",thinking:s||void 0,timestamp:t,model:n})}}return i}function b8(e){var i,a,l,s,c;const t=[],n={timestamp:e.timestamp,model:e.targetModel,tokens:((i=e.usage)==null?void 0:i.totalTokens)||(e.usage?e.usage.inputTokens+e.usage.outputTokens:void 0)},r=e.downstreamResponseBody;if(typeof r=="string"&&(r.includes("event:")||r.includes("data:"))){const u=fu(r),{text:f,thinking:d}=pu(u);if(f||d)return t.push({role:"assistant",content:f||"",thinking:d||void 0,...n}),t}if(e.responseBody)try{const u=typeof e.responseBody=="string"?JSON.parse(e.responseBody):e.responseBody;if(u.content&&Array.isArray(u.content)){let f="",d="";for(const p of u.content)if(p.type==="text"&&p.text&&(f+=p.text),p.type==="thinking"&&p.thinking&&(d+=p.thinking),p.type==="tool_use"){(f||d)&&(t.push({role:"assistant",content:f,thinking:d||void 0,...n}),f="",d="");const m=p.name||"",g=p.id?p.id.slice(-8):"",y=m+(g?` · ...${g}`:""),x=p.input?JSON.stringify(p.input,null,2):"";t.push({role:"assistant",type:"tool_use",header:`[工具调用: ${y}]`,content:x||`[工具调用: ${y}]`,...n})}if((f||d)&&t.push({role:"assistant",content:f||"",thinking:d||void 0,...n}),t.length>0)return t}if((l=(a=u.choices)==null?void 0:a[0])!=null&&l.message){const f=u.choices[0].message;if(f.content&&t.push({role:"assistant",content:f.content,...n}),f.tool_calls&&Array.isArray(f.tool_calls))for(const d of f.tool_calls){const p=((s=d.function)==null?void 0:s.name)||"",m=d.id?d.id.slice(-8):"",g=p+(m?` · ...${m}`:""),y=((c=d.function)==null?void 0:c.arguments)||"";t.push({role:"assistant",type:"tool_use",header:`[工具调用: ${g}]`,content:y||`[工具调用: ${g}]`,...n})}if(t.length>0)return t}if(u.output){let f="";const d=Array.isArray(u.output)?u.output:[u.output];for(const p of d){if(p.type==="message"&&p.content){const m=Array.isArray(p.content)?p.content:[p.content];for(const g of m)g.type==="output_text"&&g.text?f+=g.text:typeof g=="string"&&(f+=g)}if(p.type==="function_call"){f&&(t.push({role:"assistant",content:f,...n}),f="");const m=p.name||"",g=p.call_id?p.call_id.slice(-8):"",y=m+(g?` · ...${g}`:""),x=p.arguments||"";t.push({role:"assistant",type:"tool_use",header:`[工具调用: ${y}]`,content:x||`[工具调用: ${y}]`,...n})}}if(f&&t.push({role:"assistant",content:f,...n}),t.length>0)return t}}catch{}return t}function Xx(e){var i,a;const t=[];let n=0;const r=new Map;for(const l of e){const s=((i=l.body)==null?void 0:i.messages)||[];for(const c of s)if(c.role==="assistant"&&Array.isArray(c.content))for(const u of c.content)u.type==="tool_use"&&u.id&&u.name&&r.set(u.id,u.name)}for(const l of e){const s=((a=l.body)==null?void 0:a.messages)||[],c=s.slice(n);n=s.length;for(const f of c){const d=x8(f,l.timestamp,l.requestModel,r);t.push(...d)}const u=b8(l);t.push(...u)}return w8(t)}function w8(e){const t=[];for(const n of e){if(n.role!=="assistant"){t.push(n);continue}const r=t.findIndex(i=>i.role==="assistant"&&i.type===n.type&&i.content===n.content);if(r===-1)t.push(n);else{const i=t[r],a=!!n.tokens,l=!!i.tokens;a&&!l&&(t[r]=n)}}return t}function go(e){return(e||"").replace("<session>","").replace("</session>","").trim()||"(无标题)"}function j8({content:e,header:t,forceCollapsible:n,hideContentWhenCollapsed:r}){const i=e.split(`
129
+ `),a=10,l=3,s=h.useRef(null),c=!!n,u=n||i.length>a,f=c?l:a,[d,p]=h.useState(!u),m=()=>{d?(requestAnimationFrame(()=>{const g=s.current,y=g==null?void 0:g.closest(".modal-body-scrollable");if(g&&y){const x=g.getBoundingClientRect(),v=y.getBoundingClientRect();(x.top<v.top||x.top>v.bottom)&&g.scrollIntoView({block:"start"})}}),p(!1)):p(!0)};return u?!d&&r?o.jsx("div",{className:"chat-collapsible-wrapper",ref:s,style:{width:"400px"},children:o.jsxs("div",{className:"chat-collapse-top-bar",children:[t&&o.jsx("div",{className:"chat-tool-header",children:t}),o.jsx("div",{className:"chat-collapse-btn-sticky",children:o.jsxs("button",{className:"chat-collapse-btn",onClick:m,children:["展开 (",i.length," 行)"]})})]})}):o.jsxs("div",{className:"chat-collapsible-wrapper",ref:s,style:!d&&c?{width:"400px"}:void 0,children:[o.jsxs("div",{className:"chat-collapse-top-bar",children:[t&&o.jsx("div",{className:"chat-tool-header",children:t}),o.jsx("div",{className:"chat-collapse-btn-sticky",children:o.jsx("button",{className:"chat-collapse-btn",onClick:m,children:d?"收起":`展开全部 (${i.length} 行)`})})]}),o.jsx("div",{className:"chat-content-text",children:d?e:i.slice(0,f).join(`
130
+ `)}),!d&&o.jsx("div",{className:"chat-collapse-fade",onClick:m,children:o.jsxs("span",{className:"chat-collapse-fade-btn",children:["展开全部 (",i.length," 行)"]})})]}):o.jsxs(o.Fragment,{children:[t&&o.jsx("div",{className:"chat-tool-header",children:t}),o.jsx("div",{className:"chat-content-text",children:e})]})}function S8({logs:e,onFetchNew:t}){const n=[...e].sort((m,g)=>m.timestamp-g.timestamp),[r,i]=h.useState(n),a=Xx(r),l=h.useRef(null),[s,c]=h.useState(!1),[u,f]=h.useState(!1);h.useEffect(()=>{i([...e].sort((m,g)=>m.timestamp-g.timestamp))},[e]),h.useEffect(()=>{var y;const m=(y=l.current)==null?void 0:y.parentElement;if(!m)return;const g=()=>{const x=m.scrollHeight-m.scrollTop-m.clientHeight<60;c(x)};return m.addEventListener("scroll",g),g(),()=>m.removeEventListener("scroll",g)},[r]);const d=()=>{var g;const m=(g=l.current)==null?void 0:g.parentElement;m&&m.scrollTo({top:m.scrollHeight,behavior:"smooth"})},p=async()=>{if(s&&t){f(!0);try{const m=await t(),g=new Set(r.map(v=>v.id)),x=[...m].sort((v,b)=>v.timestamp-b.timestamp).filter(v=>!g.has(v.id));x.length>0&&(i(v=>[...v,...x]),requestAnimationFrame(()=>d()))}finally{f(!1)}}else d()};return a.length===0?o.jsx("div",{style:{textAlign:"center",padding:"20px",color:"var(--text-tertiary)"},children:"暂无对话内容"}):o.jsxs("div",{className:"chat-view-container",ref:l,children:[a.map((m,g)=>o.jsxs("div",{className:`chat-message chat-message--${m.role}${m.type?` chat-message--${m.type}`:""}`,children:[o.jsxs("div",{className:"chat-bubble",children:[m.role==="assistant"&&m.thinking&&o.jsxs("details",{className:"chat-thinking",children:[o.jsxs("summary",{children:["思考内容 (",m.thinking.length," 字符)"]}),o.jsx("pre",{children:m.thinking})]}),m.content&&o.jsx(j8,{content:m.content,header:m.header,forceCollapsible:!!m.type,hideContentWhenCollapsed:m.type==="tool_use"})]}),!m.type&&o.jsxs("div",{className:"chat-meta",children:[ft(m.timestamp).format("HH:mm:ss"),m.model&&` · ${m.model}`,m.tokens&&` · ${m.tokens.toLocaleString()} tokens`]})]},g)),o.jsx("div",{className:"chat-scroll-bottom",children:o.jsx("button",{className:"chat-scroll-bottom-btn",onClick:p,disabled:u,children:u?o.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"spin-icon",children:o.jsx("path",{d:"M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.3"})}):o.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"M12 5v14M5 12l7 7 7-7"})})})})]})}function XT({session:e,logs:t,logsLoading:n,onRefreshLogs:r,onFetchNewLogs:i,onClose:a,onExport:l}){const[s,c]=h.useState("logs"),[u,f]=h.useState(null),d=(g,y)=>{const x=y-g;return x<6e4?`${Math.floor(x/1e3)}秒`:x<36e5?`${Math.floor(x/6e4)}分钟`:`${Math.floor(x/36e5)}小时`},p=g=>g>=1e6?(g/1e6).toFixed(1)+"M":g>=1e3?(g/1e3).toFixed(1)+"k":String(g),m=()=>{if(l){l(e,t,s);return}const y=`${go(e.title)}.json`;if(s==="chat"){const x=Xx(t),v={session:{id:e.id,targetType:e.targetType,title:e.title,firstRequestAt:e.firstRequestAt,lastRequestAt:e.lastRequestAt,requestCount:e.requestCount,totalTokens:e.totalTokens},messages:x.map(C=>({role:C.role,type:C.type,header:C.header,content:C.content,thinking:C.thinking,timestamp:C.timestamp,model:C.model,tokens:C.tokens}))},b=new Blob([JSON.stringify(v,null,2)],{type:"application/json"}),w=URL.createObjectURL(b),S=document.createElement("a");S.href=w,S.download=y,S.click(),URL.revokeObjectURL(w)}else{const x={session:{id:e.id,targetType:e.targetType,title:e.title,firstRequestAt:e.firstRequestAt,lastRequestAt:e.lastRequestAt,requestCount:e.requestCount,totalTokens:e.totalTokens},logs:t},v=new Blob([JSON.stringify(x,null,2)],{type:"application/json"}),b=URL.createObjectURL(v),w=document.createElement("a");w.href=b,w.download=y,w.click(),URL.revokeObjectURL(b)}};return o.jsxs("div",{className:"modal-overlay",children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:a,"aria-label":"关闭",children:"×"}),o.jsxs("div",{className:"modal modal--sticky-layout",style:{width:"900px",maxWidth:"90vw"},children:[o.jsxs("div",{className:"modal-header",children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[o.jsx("h2",{children:"会话详情"}),o.jsx("button",{className:"session-refresh-btn",onClick:r,disabled:n,title:"刷新",children:o.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:n?"spin-icon":"",children:o.jsx("path",{d:"M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.3"})})})]}),o.jsxs("div",{className:"session-view-toggle",children:[o.jsx("button",{className:s==="logs"?"active":"",onClick:()=>c("logs"),children:"日志"}),o.jsx("button",{className:s==="chat"?"active":"",onClick:()=>c("chat"),children:"对话"})]})]}),o.jsx("div",{className:"modal-body-scrollable",children:s==="logs"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{marginBottom:"12px",padding:"10px 12px",background:"var(--bg-secondary)",borderRadius:"8px"},children:[o.jsx("div",{style:{fontSize:"15px",fontWeight:500,marginBottom:"8px"},children:go(e.title)}),o.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"12px 20px",fontSize:"13px",color:"var(--text-secondary)"},children:[o.jsxs("div",{children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"类型"})," ",o.jsx("span",{style:{display:"inline-block",padding:"1px 6px",borderRadius:"4px",fontSize:"12px",background:e.targetType==="claude-code"?"rgba(59,130,246,0.1)":"rgba(34,197,94,0.1)",color:e.targetType==="claude-code"?"var(--color-primary, #3b82f6)":"var(--color-success, #22c55e)"},children:e.targetType==="claude-code"?"Claude Code":"Codex"})]}),o.jsxs("div",{children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"请求数"})," ",e.requestCount]}),o.jsxs("div",{children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Tokens"})," ",p(e.totalTokens)]}),o.jsxs("div",{children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"时长"})," ",d(e.firstRequestAt,e.lastRequestAt)]}),o.jsxs("div",{children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"首次请求"})," ",ft(e.firstRequestAt).format("YYYY-MM-DD HH:mm:ss")]}),o.jsxs("div",{children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"最后请求"})," ",ft(e.lastRequestAt).format("YYYY-MM-DD HH:mm:ss")]})]})]}),o.jsxs("h3",{style:{marginTop:"0",marginBottom:"10px"},children:["会话日志 (",t.length,")"]}),n?o.jsx("div",{style:{textAlign:"center",padding:"20px"},children:"加载中..."}):t.length===0?o.jsx("div",{style:{textAlign:"center",padding:"20px",color:"#7f8c8d"},children:"暂无日志"}):o.jsx("div",{style:{border:"1px solid var(--border-color)",borderRadius:"8px",overflow:"hidden"},children:o.jsxs("table",{style:{fontSize:"14px"},children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"时间"}),o.jsx("th",{children:"状态"}),o.jsx("th",{children:"响应时间"}),o.jsx("th",{children:"Tokens"}),o.jsx("th",{children:"操作"})]})}),o.jsx("tbody",{children:[...t].sort((g,y)=>g.timestamp-y.timestamp).map(g=>o.jsxs("tr",{children:[o.jsx("td",{children:ft(g.timestamp).format("HH:mm:ss")}),o.jsx("td",{children:o.jsx("span",{className:`badge ${g.statusCode&&g.statusCode>=200&&g.statusCode<300?"badge-success":g.statusCode&&g.statusCode>=400?"badge-danger":"badge-warning"}`,children:g.statusCode||"Error"})}),o.jsx("td",{children:g.responseTime?`${g.responseTime}ms`:"-"}),o.jsx("td",{children:g.usage?o.jsx("span",{children:g.usage.totalTokens||g.usage.inputTokens+g.usage.outputTokens}):"-"}),o.jsx("td",{children:o.jsx("button",{className:"btn btn-sm btn-secondary",onClick:()=>f(g),children:"详情"})})]},g.id))})]})})]}):o.jsx(o.Fragment,{children:n?o.jsx("div",{style:{textAlign:"center",padding:"20px"},children:"加载中..."}):o.jsx(S8,{logs:t,onFetchNew:i})})}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-primary",onClick:m,disabled:t.length===0,children:"导出"}),o.jsx("button",{className:"btn btn-secondary",onClick:a,children:"关闭"})]})]}),u&&o.jsx(Ef,{log:u,onClose:()=>f(null)})]})}ft.extend(Gx);function k8(){const[e,t]=h.useState([]),[n,r]=h.useState(0),[i,a]=h.useState(1),[l,s]=h.useState(20),[c,u]=h.useState(null),[f,d]=h.useState([]),[p,m]=h.useState(!1),[g,y]=h.useState(""),[x,v]=h.useState(""),[b,w]=h.useState(!1),[S,C]=h.useState(10),[j,E]=h.useState(null),[O,R]=h.useState(null),[A,N]=h.useState(!1);h.useEffect(()=>{q()},[i,l]),h.useEffect(()=>{let k=null,L=null;return b&&(L=setInterval(()=>{C(Q=>Q<=1?10:Q-1)},1e3),k=setInterval(()=>{q()},1e4)),()=>{k&&clearInterval(k),L&&clearInterval(L)}},[b,i,l]);const _=e.filter(k=>{if(x&&k.targetType!==x)return!1;if(g.trim()){const L=g.trim().toLowerCase(),Q=(k.title||"").toLowerCase(),T=k.id.toLowerCase();if(!Q.includes(L)&&!T.includes(L))return!1}return!0}),q=async()=>{try{const k=(i-1)*l,[L,Q]=await Promise.all([V.getSessions(l,k),V.getSessionsCount()]);t(L),r(Q.count)}catch(k){console.error("Failed to load sessions:",k)}},W=async k=>{u(k),m(!0);try{const L=await V.getSessionLogs(k.id,1e4);d(L)}catch(L){console.error("Failed to load session logs:",L)}finally{m(!1)}},I=(k,L)=>{const Q=L-k;return Q<6e4?`${Math.floor(Q/1e3)}秒`:Q<36e5?`${Math.floor(Q/6e4)}分钟`:`${Math.floor(Q/36e5)}小时`},F=k=>k==="claude-code"?o.jsx("span",{className:"badge badge-claude-code",children:"Claude Code"}):k==="codex"?o.jsx("span",{className:"badge badge-codex",children:"Codex"}):o.jsx("span",{className:"badge",children:k}),K=(k,L,Q)=>{const T=k;if(Q==="chat"){const re=Xx(L).map((Be,qe)=>({index:qe+1,role:Be.role,type:Be.type||null,header:Be.header||null,content:Be.content,thinking:Be.thinking||null,timestamp:ft(Be.timestamp).format("YYYY-MM-DD HH:mm:ss"),model:Be.model||null,tokens:Be.tokens||null})),Oe={session:{id:T.id,title:go(T.title),targetType:T.targetType,requestCount:T.requestCount,totalTokens:T.totalTokens,firstRequestAt:ft(T.firstRequestAt).format("YYYY-MM-DD HH:mm:ss"),lastRequestAt:ft(T.lastRequestAt).format("YYYY-MM-DD HH:mm:ss"),duration:I(T.firstRequestAt,T.lastRequestAt)},messages:re,exportedAt:ft().format("YYYY-MM-DD HH:mm:ss")},ne=JSON.stringify(Oe,null,2),_e=new Blob([ne],{type:"application/json;charset=utf-8"}),Re=URL.createObjectURL(_e),Fe=document.createElement("a");Fe.href=Re;const rt=go(T.title).replace(/[\\/:*?"<>|]/g,"_");Fe.download=`${rt}_对话.json`,document.body.appendChild(Fe),Fe.click(),document.body.removeChild(Fe),URL.revokeObjectURL(Re),U.success("对话数据已导出");return}const ce=L.map((se,re)=>{var Re,Fe,rt,Be;const Oe=((Re=se.body)==null?void 0:Re.messages)||[];let ne="";const _e=se.downstreamResponseBody;if(typeof _e=="string"&&(_e.includes("event:")||_e.includes("data:"))){const qe=fu(_e),{text:ye,thinking:Ee}=pu(qe),ze=[];Ee&&ze.push(`<details><summary>思考过程</summary>
131
+
132
+ ${Ee}
133
+
134
+ </details>`),ye&&ze.push(ye),ne=ze.join(`
135
+
136
+ `)}if(!ne&&se.responseBody)try{const qe=typeof se.responseBody=="string"?JSON.parse(se.responseBody):se.responseBody;if(qe.content){if(Array.isArray(qe.content)){const ye=[];for(const Ee of qe.content)Ee.type==="text"&&Ee.text?ye.push(Ee.text):Ee.type==="thinking"&&Ee.thinking&&ye.push(`<details><summary>思考过程</summary>
137
+
138
+ ${Ee.thinking}
139
+
140
+ </details>`);ne=ye.join(`
141
+
142
+ `)}typeof qe.content=="string"&&(ne=qe.content)}!ne&&((Be=(rt=(Fe=qe.choices)==null?void 0:Fe[0])==null?void 0:rt.message)!=null&&Be.content)&&(ne=qe.choices[0].message.content)}catch{}return{index:re+1,timestamp:ft(se.timestamp).format("YYYY-MM-DD HH:mm:ss"),statusCode:se.statusCode||null,responseTime:se.responseTime||null,requestModel:se.requestModel||null,targetModel:se.targetModel||null,vendorName:se.vendorName||null,serviceName:se.targetServiceName||null,contentType:se.contentType||null,tags:se.tags||[],usage:se.usage||null,messages:Oe,response:ne||null}}),ve={session:{id:T.id,title:T.title||null,targetType:T.targetType,requestCount:T.requestCount,totalTokens:T.totalTokens,model:T.model||null,vendorName:T.vendorName||null,serviceName:T.serviceName||null,firstRequestAt:ft(T.firstRequestAt).format("YYYY-MM-DD HH:mm:ss"),lastRequestAt:ft(T.lastRequestAt).format("YYYY-MM-DD HH:mm:ss"),duration:I(T.firstRequestAt,T.lastRequestAt)},logs:ce,exportedAt:ft().format("YYYY-MM-DD HH:mm:ss")},X=JSON.stringify(ve,null,2),oe=new Blob([X],{type:"application/json;charset=utf-8"}),fe=URL.createObjectURL(oe),te=document.createElement("a");te.href=fe;const Z=go(T.title).replace(/[\\/:*?"<>|]/g,"_");te.download=`${Z}.json`,document.body.appendChild(te),te.click(),document.body.removeChild(te),URL.revokeObjectURL(fe),U.success("导出成功")},M=k=>a(k),B=k=>{s(k),a(1)};return o.jsxs("div",{className:"sessions-page",children:[o.jsx("div",{className:"page-header",children:o.jsxs("div",{className:"page-header-content",children:[o.jsxs("div",{className:"page-header-text",children:[o.jsx("h1",{children:"会话"}),o.jsx("p",{children:"查看和管理所有会话记录"})]}),o.jsx("button",{className:"btn btn-danger",onClick:()=>N(!0),children:"清除会话"})]})}),o.jsxs("div",{className:"card",children:[o.jsxs("div",{className:"toolbar",children:[o.jsx("h3",{children:"会话列表"}),o.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[o.jsx("input",{type:"text",placeholder:"搜索标题或ID...",value:g,onChange:k=>{y(k.target.value),a(1)},onKeyDown:k=>{k.key==="Enter"&&q()},style:{padding:"6px 12px",border:"1px solid var(--border-primary)",borderRadius:"6px",fontSize:"14px",width:"200px",backgroundColor:"var(--input-bg)",color:"var(--text-primary)"}}),g&&o.jsx("button",{className:"btn btn-sm btn-secondary",onClick:()=>{y(""),a(1)},children:"清除"})]}),o.jsxs("select",{value:x,onChange:k=>{v(k.target.value),a(1)},style:{padding:"6px 12px",border:"1px solid var(--border-primary)",borderRadius:"6px",fontSize:"14px",backgroundColor:"var(--input-bg)",color:"var(--text-primary)"},children:[o.jsx("option",{value:"",children:"全部类型"}),o.jsx("option",{value:"claude-code",children:"Claude Code"}),o.jsx("option",{value:"codex",children:"Codex"})]}),(g||x)&&o.jsx("button",{className:"btn btn-sm",style:{backgroundColor:"#e67e22",color:"white",border:"none"},onClick:()=>{y(""),v(""),a(1)},children:"清除筛选"}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[o.jsx("input",{type:"checkbox",id:"auto-refresh",checked:b,onChange:k=>{w(k.target.checked),C(10)}}),o.jsxs("label",{htmlFor:"auto-refresh",style:{cursor:"pointer",fontSize:"14px",color:"var(--text-primary)",userSelect:"none"},children:["自动刷新 ",b&&`(⏱ ${S}s)`]})]}),o.jsx("button",{className:"btn btn-primary",onClick:()=>{q(),C(10)},children:"刷新"})]})]}),e.length===0?o.jsx("div",{className:"empty-state",children:o.jsx("p",{children:"暂无会话记录"})}):_.length===0?o.jsx("div",{className:"empty-state",children:o.jsx("p",{children:"没有匹配的会话"})}):o.jsxs(o.Fragment,{children:[o.jsxs("table",{children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"标题"}),o.jsx("th",{children:"客户端类型"}),o.jsx("th",{children:"请求数"}),o.jsx("th",{children:"Tokens"}),o.jsx("th",{children:"首次请求"}),o.jsx("th",{children:"最后请求"}),o.jsx("th",{children:"时长"}),o.jsx("th",{children:"操作"})]})}),o.jsx("tbody",{children:_.map(k=>o.jsxs("tr",{onClick:()=>W(k),style:{cursor:"pointer",backgroundColor:(c==null?void 0:c.id)===k.id?"var(--bg-selected)":void 0},children:[o.jsx("td",{style:{maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:go(k.title)}),o.jsx("td",{children:F(k.targetType)}),o.jsx("td",{children:k.requestCount}),o.jsx("td",{children:k.totalTokens.toLocaleString()}),o.jsx("td",{children:ft(k.firstRequestAt).format("MM-DD HH:mm")}),o.jsx("td",{children:ft(k.lastRequestAt).format("MM-DD HH:mm")}),o.jsx("td",{children:I(k.firstRequestAt,k.lastRequestAt)}),o.jsx("td",{children:o.jsxs("div",{style:{display:"flex",gap:"6px"},children:[o.jsx("button",{className:"btn btn-sm btn-secondary",onClick:L=>{L.stopPropagation(),W(k)},children:"查看"}),o.jsx("button",{className:"btn btn-sm btn-primary",onClick:L=>{L.stopPropagation(),u(k),m(!0),V.getSessionLogs(k.id,1e4).then(Q=>d(Q)).catch(console.error).finally(()=>m(!1))},children:"对话"}),o.jsx("button",{className:"btn btn-sm",style:{backgroundColor:"#8e44ad",color:"white",border:"none"},onClick:L=>{L.stopPropagation(),E(k)},title:"迁移到另一个工具",children:"迁移"}),o.jsx("button",{className:"btn btn-sm",style:{backgroundColor:k.routeId?"#27ae60":"#2980b9",color:"white",border:"none",minWidth:(k.routeId,void 0)},onClick:L=>{L.stopPropagation(),R(k)},title:k.routeId?`已绑定: ${k.routeName||k.routeId}`:"绑定路由",children:k.routeName?k.routeName.length>8?k.routeName.slice(0,8)+"…":k.routeName:"路由"})]})})]},k.id))})]}),o.jsx(Bc,{currentPage:i,pageSize:l,totalItems:n,onPageChange:M,onPageSizeChange:B})]})]}),c&&o.jsx(XT,{session:c,logs:f,logsLoading:p,onRefreshLogs:async()=>{if(c){m(!0);try{const k=await V.getSessionLogs(c.id,1e4);d(k)}catch(k){console.error("Failed to refresh session logs:",k)}finally{m(!1)}}},onFetchNewLogs:async()=>{if(!c)return[];const k=await V.getSessionLogs(c.id,1e4);return d(k),k},onClose:()=>{u(null),d([])},onExport:K}),j&&o.jsx(m8,{session:j,onClose:()=>E(null)}),O&&o.jsx(g8,{session:O,onClose:()=>R(null),onBound:()=>{q()}}),A&&o.jsx(y8,{onClose:()=>N(!1),onCleared:()=>{a(1),q()}})]})}function Fc({checked:e,onChange:t,disabled:n,label:r,labelPosition:i="right"}){const a=o.jsx("button",{type:"button",role:"switch","aria-checked":e,className:`switch ${e?"active":""}`,onClick:()=>!n&&t(!e),disabled:n,children:o.jsx("span",{className:"switch-thumb",style:{position:"absolute",top:"2px",left:e?"22px":"2px",width:"20px",height:"20px",borderRadius:"10px",backgroundColor:"#fff",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)"}})});return r?i==="left"?o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:n?"not-allowed":"pointer"},children:[o.jsx("span",{style:{fontSize:"14px",color:"var(--text-muted)"},children:r}),a]}):o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:n?"not-allowed":"pointer"},children:[a,o.jsx("span",{style:{fontSize:"14px",color:"var(--text-muted)"},children:r})]}):a}function Nj({skillId:e,targetType:t,enabled:n,onChange:r,disabled:i}){const a=t==="claude-code"?"Claude Code":"Codex";return o.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:o.jsx(Fc,{checked:n,onChange:l=>r(e,t,l),disabled:i,label:a,labelPosition:"right"})})}function C8(){var I,F,K,M,B,k;const[e,t]=h.useState(null),[n,r]=h.useState(!0),[i,a]=h.useState("10"),[l,s]=h.useState(""),[c,u]=h.useState(""),[f,d]=h.useState(""),[p,m]=h.useState({proxyEnabled:!1,proxyUrl:"",proxyUsername:"",proxyPassword:""}),[g,y]=h.useState(!1),[x,v]=h.useState(null),[b,w]=h.useState(!1),[S,C]=h.useState(!1);h.useEffect(()=>{j()},[]);const j=async()=>{const L=await V.getConfig();t(L),r(L.enableFailover!==!1),a(typeof L.failoverRecoverySeconds=="number"&&L.failoverRecoverySeconds>0?String(Math.floor(L.failoverRecoverySeconds)):"10"),m({proxyEnabled:L.proxyEnabled||!1,proxyUrl:L.proxyUrl||"",proxyUsername:L.proxyUsername||"",proxyPassword:L.proxyPassword||""}),y(L.enableLanDiscovery||!1)},E=async L=>{L.preventDefault();const Q=Number(i),T=Number.isFinite(Q)&&Q>0?Math.floor(Q):10,ce={...e,enableFailover:n,failoverRecoverySeconds:T};await V.updateConfig(ce)?(U.success("配置保存成功"),j()):U.error("配置保存失败")},O=async L=>{L.preventDefault();const Q=new FormData(L.currentTarget),T={...e,enableLogging:Q.get("enableLogging")==="true",logRetentionDays:parseInt(Q.get("logRetentionDays")),maxLogSize:parseInt(Q.get("maxLogSize"))};await V.updateConfig(T)?(U.success("日志配置保存成功"),j()):U.error("日志配置保存失败")},R=async L=>{L.preventDefault();const Q=new FormData(L.currentTarget),T={...e,proxyEnabled:Q.get("proxyEnabled")==="true",proxyUrl:Q.get("proxyUrl"),proxyUsername:Q.get("proxyUsername"),proxyPassword:Q.get("proxyPassword")};await V.updateConfig(T)?(U.success("代理配置保存成功"),j()):U.error("代理配置保存失败")},A=async L=>{y(L);const Q={...e,enableLanDiscovery:L};await V.updateConfig(Q)?(U.success(L?"已开启局域网同步":"已关闭局域网同步"),j()):(y(!L),U.error("配置保存失败"))},N=async()=>{if(!l){U.warning("请输入密码");return}try{const L=await V.exportData(l);d(L),U.success("导出成功,请复制下方数据")}catch(L){U.error("导出失败: "+L.message)}},_=async()=>{if(!l||!c){U.warning("请输入密码和导入数据");return}w(!0);try{const L=await V.previewImportData(c,l);v(L),L.success||U.error(L.message||"预览失败")}catch(L){U.error("预览失败: "+L.message),v({success:!1,message:L.message})}finally{w(!1)}},q=async()=>{if(!l||!c||!(x!=null&&x.success)){U.warning("请先预览数据并确认无误");return}C(!0);try{const L=await V.importData(c,l);L.success?(U.success(L.message+(L.details?` (${L.details})`:"")),u(""),s(""),v(null)):U.error(L.message+(L.details?`: ${L.details}`:""))}catch(L){U.error("导入失败: "+L.message)}finally{C(!1)}},W=()=>{v(null),u(""),s("")};return e?o.jsxs("div",{children:[o.jsxs("div",{className:"page-header",children:[o.jsx("h1",{children:"设置"}),o.jsx("p",{children:"管理应用配置和数据导入导出"})]}),o.jsxs("div",{className:"card",children:[o.jsx("h3",{children:"应用配置"}),o.jsxs("form",{onSubmit:E,children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"启用智能故障切换"}),o.jsxs("select",{name:"enableFailover",value:n?"true":"false",onChange:L=>r(L.target.value==="true"),children:[o.jsx("option",{value:"true",children:"是"}),o.jsx("option",{value:"false",children:"否"})]}),o.jsx("small",{style:{display:"block",marginTop:"4px",color:"#666",fontSize:"12px"},children:"启用后,当某个服务报错时会自动切换到备用服务,并按下方“故障自动恢复时间”自动恢复"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"故障自动恢复时间(秒)"}),o.jsx("input",{type:"number",name:"failoverRecoverySeconds",min:1,step:1,value:i,onChange:L=>a(L.target.value),disabled:!n}),o.jsx("small",{style:{display:"block",marginTop:"4px",color:"#666",fontSize:"12px"},children:"默认 10 秒。仅在“启用智能故障切换”为“是”时可修改"})]}),o.jsx("button",{type:"submit",className:"btn btn-primary",children:"保存配置"})]})]}),o.jsxs("div",{className:"card",style:{marginTop:"20px"},children:[o.jsx("h3",{children:"日志设置"}),o.jsx("p",{style:{color:"#7f8c8d",fontSize:"14px"},children:"配置请求日志的记录和保留策略。"}),o.jsxs("form",{onSubmit:O,children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"启用日志"}),o.jsxs("select",{name:"enableLogging",defaultValue:e.enableLogging?"true":"false",children:[o.jsx("option",{value:"true",children:"是"}),o.jsx("option",{value:"false",children:"否"})]})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"日志保留天数"}),o.jsx("input",{type:"number",name:"logRetentionDays",defaultValue:e.logRetentionDays,required:!0})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"最大日志数量"}),o.jsx("input",{type:"number",name:"maxLogSize",defaultValue:e.maxLogSize,required:!0})]}),o.jsx("button",{type:"submit",className:"btn btn-primary",children:"保存日志配置"})]})]}),o.jsxs("div",{className:"card",style:{marginTop:"20px"},children:[o.jsx("h3",{children:"代理设置"}),o.jsx("p",{style:{color:"#7f8c8d",fontSize:"14px"},children:"配置代理服务器,API 服务可选择是否通过代理转发请求。"}),o.jsxs("form",{onSubmit:R,children:[o.jsx("input",{type:"hidden",name:"proxyEnabled",value:p.proxyEnabled?"true":"false"}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"启用代理"}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[o.jsx(Fc,{checked:p.proxyEnabled,onChange:L=>m(Q=>({...Q,proxyEnabled:L}))}),o.jsx("span",{style:{fontSize:"14px",color:"#666"},children:p.proxyEnabled?"已启用":"未启用"})]})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"代理地址"}),o.jsx("input",{type:"text",name:"proxyUrl",value:p.proxyUrl,onChange:L=>m(Q=>({...Q,proxyUrl:L.target.value})),placeholder:"例如: proxy.example.com:8080 或 http://proxy.example.com:8080"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"代理用户名(可选)"}),o.jsx("input",{type:"text",name:"proxyUsername",value:p.proxyUsername,onChange:L=>m(Q=>({...Q,proxyUsername:L.target.value})),placeholder:"如果代理需要认证"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"代理密码(可选)"}),o.jsx("input",{type:"password",name:"proxyPassword",value:p.proxyPassword,onChange:L=>m(Q=>({...Q,proxyPassword:L.target.value})),placeholder:"如果代理需要认证"})]}),o.jsx("button",{type:"submit",className:"btn btn-primary",children:"保存代理配置"})]})]}),o.jsxs("div",{className:"card",style:{marginTop:"20px"},children:[o.jsx("h3",{children:"局域网同步"}),o.jsx("p",{style:{color:"#7f8c8d",fontSize:"14px"},children:"开启后,同一局域网内的其他 AICodeSwitch 节点可以发现并拉取本节点的 Skills、MCP 配置信息。上游 API Key 等敏感信息不会被传输。"}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"允许局域网拉取配置"}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[o.jsx(Fc,{checked:g,onChange:A}),o.jsx("span",{style:{fontSize:"14px",color:"#666"},children:g?"已启用":"未启用"})]})]})]}),o.jsxs("div",{className:"card",style:{marginTop:"20px"},children:[o.jsx("h3",{children:"数据导出"}),o.jsx("p",{style:{color:"#7f8c8d",fontSize:"14px"},children:"导出所有配置数据,包括供应商、API服务、路由等。数据将使用密码加密。"}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"加密密码"}),o.jsx("input",{type:"password",value:l,onChange:L=>s(L.target.value),placeholder:"用于加密导出数据"})]}),o.jsx("button",{className:"btn btn-primary",onClick:N,children:"导出数据"}),f&&o.jsxs("div",{className:"form-group",style:{marginTop:"20px"},children:[o.jsx("label",{children:"导出的数据(请复制保存)"}),o.jsx("textarea",{rows:6,value:f,readOnly:!0,style:{fontFamily:"monospace",fontSize:"12px"}}),o.jsx("button",{className:"btn btn-secondary",style:{marginTop:"10px"},onClick:()=>{navigator.clipboard.writeText(f),U.success("已复制到剪贴板")},children:"复制到剪贴板"})]})]}),o.jsxs("div",{className:"card",style:{marginTop:"20px"},children:[o.jsx("h3",{children:"数据导入"}),o.jsx("p",{style:{color:"#e74c3c",fontSize:"14px",fontWeight:500},children:"警告:导入数据将覆盖所有现有配置!请确保已备份重要数据。"}),x!=null&&x.success?o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{marginTop:"15px",padding:"15px",backgroundColor:"#e8f4fd",borderRadius:"6px",border:"1px solid #bee5eb"},children:[o.jsx("h4",{style:{margin:"0 0 12px 0",color:"#0c5460",fontSize:"16px"},children:"数据预览"}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"10px",marginBottom:"12px"},children:[o.jsxs("div",{style:{padding:"10px",backgroundColor:"white",borderRadius:"4px"},children:[o.jsx("div",{style:{fontSize:"12px",color:"#666"},children:"供应商"}),o.jsx("div",{style:{fontSize:"20px",fontWeight:"bold",color:"#333"},children:((I=x.data)==null?void 0:I.vendors)||0})]}),o.jsxs("div",{style:{padding:"10px",backgroundColor:"white",borderRadius:"4px"},children:[o.jsx("div",{style:{fontSize:"12px",color:"#666"},children:"API服务"}),o.jsx("div",{style:{fontSize:"20px",fontWeight:"bold",color:"#333"},children:((F=x.data)==null?void 0:F.services)||0})]}),o.jsxs("div",{style:{padding:"10px",backgroundColor:"white",borderRadius:"4px"},children:[o.jsx("div",{style:{fontSize:"12px",color:"#666"},children:"路由"}),o.jsx("div",{style:{fontSize:"20px",fontWeight:"bold",color:"#333"},children:((K=x.data)==null?void 0:K.routes)||0})]}),o.jsxs("div",{style:{padding:"10px",backgroundColor:"white",borderRadius:"4px"},children:[o.jsx("div",{style:{fontSize:"12px",color:"#666"},children:"规则"}),o.jsx("div",{style:{fontSize:"20px",fontWeight:"bold",color:"#333"},children:((M=x.data)==null?void 0:M.rules)||0})]})]}),o.jsxs("div",{style:{fontSize:"12px",color:"#666",marginTop:"8px"},children:[o.jsxs("div",{children:["数据版本: ",(B=x.data)==null?void 0:B.version]}),o.jsxs("div",{children:["导出时间: ",(k=x.data)!=null&&k.exportDate?new Date(x.data.exportDate).toLocaleString("zh-CN"):"-"]})]})]}),o.jsxs("div",{style:{marginTop:"15px",padding:"12px",backgroundColor:"#fff3cd",borderRadius:"4px",border:"1px solid #ffeaa7",color:"#856404"},children:[o.jsx("strong",{children:"确认导入?"})," 此操作将覆盖所有现有的供应商、服务、路由和规则配置,且无法撤销。"]}),o.jsxs("div",{style:{marginTop:"15px",display:"flex",gap:"10px"},children:[o.jsx("button",{className:"btn btn-danger",onClick:q,disabled:S,children:S?"导入中...":"确认导入"}),o.jsx("button",{className:"btn btn-secondary",onClick:W,disabled:S,children:"取消"})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"解密密码"}),o.jsx("input",{type:"password",value:l,onChange:L=>s(L.target.value),placeholder:"用于解密导入数据"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"导入数据"}),o.jsx("textarea",{rows:6,value:c,onChange:L=>u(L.target.value),placeholder:"粘贴导出的加密数据",style:{fontFamily:"monospace",fontSize:"12px"}})]}),o.jsx("button",{className:"btn btn-primary",onClick:_,disabled:b||!l||!c,children:b?"预览中...":"预览数据"}),(x==null?void 0:x.success)===!1&&o.jsxs("div",{style:{marginTop:"10px",padding:"10px",backgroundColor:"#fdeaea",borderRadius:"4px",color:"#e74c3c"},children:[o.jsx("strong",{children:"预览失败:"}),x.message]})]})]})]}):o.jsx("div",{children:"加载中..."})}function P8(){var p,m,g,y,x,v,b,w;const[e,t]=h.useState({claude:!1,codex:!1}),[n,r]=h.useState({claude:!1,codex:!1}),[i,a]=h.useState({claude:null,codex:null}),[l,s]=h.useState("");h.useEffect(()=>{c()},[]);const c=async()=>{try{const[S,C]=await Promise.all([V.getClaudeConfigStatus(),V.getCodexConfigStatus()]);a({claude:S,codex:C})}catch(S){console.error("Failed to check config status:",S)}},u=async S=>{t(C=>({...C,[S]:!0})),s("");try{(S==="claude"?await V.writeClaudeConfig():await V.writeCodexConfig())?(s(`${S==="claude"?"Claude Code":"Codex"}配置文件写入成功!原始文件已备份为 .aicodeswitch_backup 文件。`),await c()):s("写入失败: 操作未成功")}catch(C){s(`写入失败: ${C.message}`)}finally{t(C=>({...C,[S]:!1}))}},f=async S=>{r(C=>({...C,[S]:!0})),s("");try{(S==="claude"?await V.restoreClaudeConfig():await V.restoreCodexConfig())?(s(`${S==="claude"?"Claude Code":"Codex"}配置文件已从备份恢复!`),await c()):s("恢复失败: 操作未成功")}catch(C){s(`恢复失败: ${C.message}`)}finally{r(C=>({...C,[S]:!1}))}},d=S=>{const C=i[S];if(!C)return null;const j=S==="claude"?"Claude Code":"Codex";return C.isOverwritten&&C.isModified?o.jsxs("p",{style:{color:"#f39c12",fontSize:"12px",marginTop:"10px"},children:["⚠️ 检测到",j,"配置已被修改,但备份文件仍然存在。建议先恢复原始配置,再重新写入以确保配置正确。"]}):C.isOverwritten&&!C.isModified?o.jsxs("p",{style:{color:"#27ae60",fontSize:"12px",marginTop:"10px"},children:["✓ ",j,"配置已正确设置为代理模式,且未被修改。"]}):!C.isOverwritten&&C.hasBackup?o.jsx("p",{style:{color:"#e74c3c",fontSize:"12px",marginTop:"10px"},children:"⚠️ 检测到配置状态不一致。备份文件存在但当前配置不是代理配置,请先恢复或手动删除备份文件。"}):null};return o.jsxs("div",{children:[o.jsxs("div",{className:"page-header",children:[o.jsx("h1",{children:"写入配置"}),o.jsx("p",{children:"将Claude Code和Codex的配置文件写入到用户目录"})]}),o.jsxs("div",{className:"card",style:{marginBottom:"20px"},children:[o.jsx("h3",{children:"Claude Code配置"}),o.jsx("p",{style:{color:"#7f8c8d",marginBottom:"15px"},children:"为Claude Code工具写入配置文件。原始文件将被备份为.aicodeswitch_backup文件。"}),o.jsxs("div",{style:{marginBottom:"15px"},children:[o.jsx("h4",{children:"配置文件:"}),o.jsxs("ul",{style:{color:"#7f8c8d",lineHeight:"1.6"},children:[o.jsxs("li",{children:[o.jsx("code",{children:"~/.claude/settings.json"})," - Claude Code设置"]}),o.jsxs("li",{children:[o.jsx("code",{children:"~/.claude.json"})," - Claude Code初始化设置"]})]})]}),o.jsxs("div",{style:{display:"flex",gap:"10px"},children:[o.jsx("button",{className:"btn btn-primary",onClick:()=>u("claude"),disabled:e.claude||(((p=i.claude)==null?void 0:p.isOverwritten)??!1),children:e.claude?"写入中...":"写入Claude Code配置"}),o.jsx("button",{className:"btn btn-secondary",onClick:()=>f("claude"),disabled:n.claude||!(((m=i.claude)==null?void 0:m.hasBackup)??!1),children:n.claude?"恢复中...":"恢复Claude Code配置"})]}),d("claude"),((g=i.claude)==null?void 0:g.isOverwritten)&&!((y=i.claude)!=null&&y.isModified)&&o.jsx("p",{style:{color:"#e74c3c",fontSize:"12px",marginTop:"10px"},children:"⚠️ 配置已被覆盖,如需重新写入请先恢复原始配置"})]}),o.jsxs("div",{className:"card",children:[o.jsx("h3",{children:"Codex配置"}),o.jsx("p",{style:{color:"#7f8c8d",marginBottom:"15px"},children:"为Codex工具写入配置文件。原始文件将被备份为.aicodeswitch_backup文件。"}),o.jsxs("div",{style:{marginBottom:"15px"},children:[o.jsx("h4",{children:"配置文件:"}),o.jsxs("ul",{style:{color:"#7f8c8d",lineHeight:"1.6"},children:[o.jsxs("li",{children:[o.jsx("code",{children:"~/.codex/config.toml"})," - Codex配置"]}),o.jsxs("li",{children:[o.jsx("code",{children:"~/.codex/auth.json"})," - Codex认证信息"]})]})]}),o.jsxs("div",{style:{display:"flex",gap:"10px"},children:[o.jsx("button",{className:"btn btn-primary",onClick:()=>u("codex"),disabled:e.codex||(((x=i.codex)==null?void 0:x.isOverwritten)??!1),children:e.codex?"写入中...":"写入Codex配置"}),o.jsx("button",{className:"btn btn-secondary",onClick:()=>f("codex"),disabled:n.codex||!(((v=i.codex)==null?void 0:v.hasBackup)??!1),children:n.codex?"恢复中...":"恢复Codex配置"})]}),d("codex"),((b=i.codex)==null?void 0:b.isOverwritten)&&!((w=i.codex)!=null&&w.isModified)&&o.jsx("p",{style:{color:"#e74c3c",fontSize:"12px",marginTop:"10px"},children:"⚠️ 配置已被覆盖,如需重新写入请先恢复原始配置"})]}),l&&o.jsx("div",{style:{marginTop:"20px",padding:"10px",borderRadius:"4px",backgroundColor:l.includes("成功")?"#d4edda":"#f8d7da",color:l.includes("成功")?"#155724":"#721c24",border:`1px solid ${l.includes("成功")?"#c3e6cb":"#f5c6cb"}`},children:l})]})}const E8=`# AI Code Switch
143
+
144
+ ## 简介
145
+
146
+ AI Code Switch 是帮助你在本地管理 AI 编程工具接入大模型的工具。
147
+ 它可以让你的 Claude Code、Codex 等工具不再局限于官方模型。
148
+ 为所有编程工具提供本地API驱动,自动智能的切换不同场景下的模型。
149
+
150
+ **而且它尽可能简单的帮你解决这件事。**
151
+
152
+ - 视频演示:[https://www.bilibili.com/video/BV1uEznBuEJd/](https://www.bilibili.com/video/BV1uEznBuEJd/?from=github)
153
+ - 1分钟让Claude Code接入GLM国产模型:[https://www.bilibili.com/video/BV1a865B8ErA/](https://www.bilibili.com/video/BV1a865B8ErA/)
154
+ - 1分钟让Codex接入免费模型Agnes:[https://www.bilibili.com/video/BV1tQ7Q63Eva/](https://www.bilibili.com/video/BV1tQ7Q63Eva/) Codex接入Deepseek可参考该方法实现
155
+ - 在线教程:[https://space.bilibili.com/37442719/lists/8333248](https://space.bilibili.com/37442719/lists/8333248)
156
+
157
+ ## 功能要点
158
+
159
+ * 可登记任意的大模型API接口服务,让你可以在一个面板管理你的大模型厂商
160
+ * 一键切换模型:可以注册多个供应商的多个API接口,当想要切换模型时,只需要点击一个按钮就可以立即切换
161
+ * 自动配置:无需你手动去修改claude code或codex的系统配置文件,aicodeswitch自动帮你修改,你只要启动它,无需配置claude code或codex就可以让它们正常工作
162
+ * 一键配置供应商,省去复杂的供应商配置流程
163
+ * 启动所有已知大模型接口标准,可接入任意客户端,包括但不限于openclaw、hermes、trae等,根据不同需要自主配置接口对应的大模型服务
164
+ * API转流:将兼容openai接口标准的模型,轻松接入到claude code中,支持将符合openai、anthropic、gemini的数据格式转发给claude code或codex
165
+ * 按需中转请求:根据请求类型,让不同的模型来处理不同的任务,节省成本,基于该特性,可以让glm等原生非多模态模型支持图像识别
166
+ * 智能故障切换:当API服务发生故障时,智能切换到其他API服务进行尝试,无需手动切换,特别适用于中转服务商
167
+ * 代理:针对无法直接访问的模型服务,例如地区被ban,支持设置代理来解决
168
+ * tokens超量限制:避免其中一个服务商的用量超过限制,浪费了钱,适合有免费额度的服务商
169
+ * 次数超量限制:次数到达一定量后,切换其他服务商,适合coding plan的服务商
170
+ * 日志:超精细的日志记录和会话记录,帮助你发现编程工具本身的问题,以及专研工具的agent逻辑
171
+ * 统计:丰富且详细的统计数据,用量信息快速掌握,发掘自己的编程习惯
172
+ * Skills管理:一键搜索和安装Skills,一键启用skill到claude code或codex
173
+ * MCP管理:一键安装预设MCP,一键启用MCP
174
+ * 导入和导出:一键备份数据,在多太电脑间共享aicodeswitch配置
175
+ * 服务端部署,自定义API Key,支持B/S架构,让aicodeswitch成为在线服务,提供给团队使用
176
+ * 数据完全本地,自主可控
177
+ * 特殊语法:在发送的提示词最前面添加\`[!]\`来直接切换为高智商模型服务(\`[x]\`关闭),简单快捷
178
+
179
+ ![](public/aicodeswitch-flow.svg)
180
+
181
+ ## 桌面客户端
182
+
183
+ [进入下载](https://github.com/tangshuang/aicodeswitch/releases)
184
+
185
+ ## 命令行工具
186
+
187
+ \`\`\`
188
+ # 安装
189
+ npm install -g aicodeswitch
190
+ # 启动服务
191
+ aicos start
192
+ # http://127.0.0.1:4567
193
+ # 启动服务并打开管理界面
194
+ aicos ui
195
+ # 停止服务
196
+ aicos stop
197
+ \`\`\`
198
+
199
+ ## 管理界面
200
+
201
+ **配置供应商**
202
+
203
+ * 什么是供应商?
204
+ * 供应商配置有什么用?
205
+
206
+ 具体请看下方文档。
207
+
208
+ **路由配置**
209
+
210
+ * 什么是路由?
211
+ * 什么是路由规则?
212
+
213
+ 具体请看下方文档。
214
+
215
+ **覆盖配置文件**
216
+
217
+ 在aicodeswitch中,点击“写入Claude Code配置”按钮,它会修改Claude Code的配置文件,让Claude Code开始使用aicocdeswitch提供的模型API,而非直接连到官网的模型API。
218
+
219
+ 你不用太担心,你可以在写入后,点击“恢复Claude Code配置”按钮,将Claude Code的配置文件恢复到原始状态。
220
+
221
+ Codex的配置覆盖逻辑一模一样。
222
+
223
+ **设置**
224
+
225
+ 你可以在设置页面,对aicodedeswitch进行配置。
226
+
227
+ 也可以导出配置数据,转移到其他电脑上导入。
228
+
229
+ ## 配置供应商
230
+
231
+ ### 什么是供应商?
232
+
233
+ 所谓供应商,就是提供AI服务的上游服务商。可以是OpenAI、Claude、DeepSeek、GLM 官方服务,也可以是其他中转服务商。
234
+
235
+ ### 供应商配置有什么用?
236
+
237
+ 通过将你所有的AI服务商统一起来管理,可以帮你:
238
+
239
+ 1. 避免频繁修改配置文件,通过aicodeswitch,可以一键切换到不同的供应商的AI服务API
240
+ 2. 通过aicodeswitch,将不同供应商的接口数据,转换为工具可以正确使用的接口数据格式,也就是说,你可以将Claude Code接入遵循openai的接口数据协议的其他接口
241
+ 3. 避免你忘记曾经注册过那些供应商
242
+ 4. 充分榨干不怎么用的供应商的服务,避免充值后不怎么用浪费了
243
+
244
+ ### 什么是API服务的“源类型”
245
+
246
+ 供应商接口返回的数据格式标准类型,目前支持以下几种:
247
+
248
+ * OpenAI(Responses API标准)
249
+ * OpenAI Chat (Chat Completions API标准)
250
+ * DeepSeek Chat(reasoning_content标准)
251
+ * Claude
252
+ * Claude Chat
253
+ * Gemini
254
+ * Gemini Chat
255
+
256
+ **有什么用?**
257
+
258
+ aicodeswitch内部,会根据“源类型”来转换数据。例如,你的供应商API服务接口是OpenAI Chat的数据格式,而你在路由中配置的“客户端工具“是Claude Code,那么就意味着,这个供应商API的数据,需要经过转换之后才能被Claude Code正确使用。
259
+
260
+ ## 路由管理
261
+
262
+ ### 什么是路由?
263
+
264
+ 路由是aicodeswitch的核心功能,它负责将不同的对象工具(目前指Claude Code和Codex)的请求,路由到不同的供应商API服务上。
265
+
266
+ ### 什么是“客户端工具”?
267
+
268
+ 目前指Claude Code或Codex。
269
+
270
+ ### 什么是“路由规则”?
271
+
272
+ 以Claude Code为例,它的请求实际上并非铁板一块,可以被分为多种。比如它的深度思考、长文对话、图片理解等等,都是可以独立对待的。
273
+
274
+ 路由规则的目的,就是让你的工具发出的请求,可以根据这个区分,发送给不同的服务商来处理。例如,你默认使用glm-4.7作为写代码的模型,但是,你可以把图片识别的请求发给doubao-code来进行,因为doubao-code的图片识别平均价格可以更低。同样的道理,不同目标的请求可以通过不同的规则来处理,以提升编程的质量和效果。
275
+
276
+ 目前,我仅提供了几个比较容易区分的规则,以后,还会添加更多的规则。
277
+
278
+ ### 激活路由
279
+
280
+ 我们可以为Claude Code添加多个路由,但是,我们必须激活一个路由,才能开始使用。
281
+ 而且,所有以Claude Code为对象的路由,在同一时间,只有一个可以被激活。
282
+
283
+ ### 切换路由
284
+
285
+ 你可以根据你的实际情况来实时切换路由,比如,你可以在发现自己的某个服务商处的余额较少时,立即切换到另外一个服务商。
286
+
287
+ **智能故障切换机制**
288
+
289
+ 当同一请求类型配置多个规则时,系统会按排序优先使用第一个,如果某个服务报错(4xx/5xx)或请求超时,将自动切换到下一个可用规则,确保你可以正常使用coding工具。
290
+
291
+ ### 数据转流
292
+
293
+ 支持将openai的流式响应数据转换成Claude Code的流式数据,并支持实时转换,从而可以让你使用支持openAI的API服务来在Claude Code中使用。
294
+
295
+ *不过,需要注意,如果你的API服务商不支持tools,或者所支持的max_tokens太小,是无法在Claude Code中使用的。*
296
+
297
+ ## Skills管理
298
+
299
+ 你可以在 aicodeswitch 中集中统一管理 skills,把skills分发给claude code和codex,随时启用和停用skills。
300
+ 另外,你可以基于自然语言搜索skills,找到skill之后,支持一键安装。
301
+
302
+ ## MCP管理
303
+
304
+ 你可以在 aicodeswitch 中集中统一管理 MCP,把MCP分发给claude code和codex,随时启用和停用MCP。
305
+ 并且,你还可以通过MCP来实现图像理解。
306
+
307
+ ## 日志
308
+
309
+ 在**日志**页面,您可以查看:
310
+
311
+ **请求日志**:所有 API 请求的详细记录
312
+
313
+ * 请求来源和目标
314
+ * 请求内容和响应
315
+ * 耗时和状态码
316
+ * 错误信息(如有)
317
+
318
+ **错误日志**:错误和异常记录
319
+
320
+ * 错误类型
321
+ * 错误详情
322
+ * 发生时间
323
+
324
+ **会话日志**:按照会话session来汇集日志
325
+
326
+ **日志筛选**
327
+
328
+ 根据提供的选项进行筛选。
329
+
330
+ ## 配置文件
331
+
332
+ 作为 CLI 工具,你可以在 ~/.aicodeswitch/ 目录下找到工具的相关文件。里面有一个 aicodeswitch.conf 文件,可以进行配置。
333
+ 目前仅支持以下配置:
334
+
335
+ \`\`\`
336
+ # aicodeswitch的服务IP
337
+ HOST=127.0.0.1
338
+ # aicodeswitch的服务端口
339
+ PORT=4567
340
+
341
+ # 如果提供AUTH,你无法直接登录用户界面,必须输入AUTH的值才能进入,相当于是一个登陆鉴权
342
+ # 如果你在自己的服务器上使用,通过远程接入接口时,就必须提供这个值
343
+ # AUTH=
344
+ \`\`\`
345
+
346
+ ## 常见问题
347
+
348
+ ### 1\\. 如何切换供应商?
349
+
350
+ 在路由管理页面修改规则的目标供应商,或调整优先级即可。
351
+
352
+ ### 2\\. 如何查看失败的请求?
353
+
354
+ 在请求日志页面,筛选状态码不为 200 的记录。
355
+
356
+ ### 3\\. 如何备份配置?
357
+
358
+ 在系统设置页面使用**导出配置**功能,然后将提供的数据保存到本地文件中。
359
+
360
+ ### 4\\. 如何设置日志保留时间?
361
+
362
+ 在系统设置页面修改**日志保留天数**配置。
363
+
364
+ ## 我的开源
365
+
366
+ * [PCM](https://github.com/tangshuang/pcm): 用户意图识别、精准上下文、多线对话的Agent系统
367
+ * [Lan Transfer](https://github.com/tangshuang/lan-transfer): 免费高效的局域网文件互传工具
368
+ * [MCP Bone](https://github.com/tangshuang/mcp-bone): 远程托管的MCP服管理工具
369
+ * [Anys](https://github.com/tangshuang/anys): 免费前端监控kit
370
+ * [WebCut](https://github.com/tangshuang/webcut): 免费开源的网页端视频剪辑UI框架
371
+ * [indb](https://github.com/tangshuang/indb): 网页端轻量kv数据库操作库
372
+ * [Formast](https://github.com/tangshuang/formast): 复杂业务场景下的企业级JSON驱动表单框架
373
+
374
+ ## 关联资源
375
+
376
+ * [Claude Code 深度教程](https://claudecode.tangshuang.net): 100%免费的Claude Code入门到精通教程
377
+ * [AICodingBus](https://aicodingbus.24x7.to): AI Tokens 交换平台
378
+
379
+ ## 支持我
380
+
381
+ ![](public/donate-to-me.png)
382
+
383
+ 你的支持是我前进的动力!
384
+
385
+ ## 许可
386
+
387
+ 此项目采用双许可证模式:
388
+
389
+ * **开源使用**:项目默认采用 GPL 3.0 许可证,允许个人免费使用、修改和分发,但所有衍生品必须开源。
390
+ * **商业使用**:如果您希望商业化使用而不遵守 GPL 条款(例如闭源销售),请联系我们购买单独的商业许可证。
391
+
392
+ ## 技术支持
393
+
394
+ 如有问题或建议,请访问项目 [GitHub 仓库](https://github.com/tangshuang/aicodeswitch/issues)提交 Issue。
395
+ `,T8=()=>o.jsx("div",{className:"markdown-content",children:o.jsx(gc,{children:E8})});function QT(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=QT(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function nt(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=QT(e))&&(r&&(r+=" "),r+=t);return r}var O8=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function Qx(e){if(typeof e!="string")return!1;var t=O8;return t.includes(e)}var A8=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],I8=new Set(A8);function JT(e){return typeof e!="string"?!1:I8.has(e)}function ZT(e){return typeof e=="string"&&e.startsWith("data-")}function Wn(e){if(typeof e!="object"||e===null)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(JT(n)||ZT(n))&&(t[n]=e[n]);return t}function Mo(e){if(e==null)return null;if(h.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return Wn(t)}return typeof e=="object"&&!Array.isArray(e)?Wn(e):null}function Mn(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(JT(n)||ZT(n)||Qx(n))&&(t[n]=e[n]);return t}function N8(e){return e==null?null:h.isValidElement(e)?Mn(e.props):typeof e=="object"&&!Array.isArray(e)?Mn(e):null}var _8=["children","width","height","viewBox","className","style","title","desc"];function _v(){return _v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_v.apply(null,arguments)}function M8(e,t){if(e==null)return{};var n,r,i=R8(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function R8(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Jx=h.forwardRef((e,t)=>{var{children:n,width:r,height:i,viewBox:a,className:l,style:s,title:c,desc:u}=e,f=M8(e,_8),d=a||{width:r,height:i,x:0,y:0},p=nt("recharts-surface",l);return h.createElement("svg",_v({},Mn(f),{className:p,width:r,height:i,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height),ref:t}),h.createElement("title",null,c),h.createElement("desc",null,u),n)}),D8=["children","className"];function Mv(){return Mv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Mv.apply(null,arguments)}function L8(e,t){if(e==null)return{};var n,r,i=z8(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function z8(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var zt=h.forwardRef((e,t)=>{var{children:n,className:r}=e,i=L8(e,D8),a=nt("recharts-layer",r);return h.createElement("g",Mv({className:a},Mn(i),{ref:t}),n)}),eO=h.createContext(null),$8=()=>h.useContext(eO);function bt(e){return function(){return e}}const tO=Math.cos,Tf=Math.sin,Qr=Math.sqrt,Of=Math.PI,Jp=2*Of,Rv=Math.PI,Dv=2*Rv,so=1e-6,B8=Dv-so;function nO(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function F8(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return nO;const n=10**t;return function(r){this._+=r[0];for(let i=1,a=r.length;i<a;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}class U8{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?nO:F8(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,a,l){this._append`C${+t},${+n},${+r},${+i},${this._x1=+a},${this._y1=+l}`}arcTo(t,n,r,i,a){if(t=+t,n=+n,r=+r,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let l=this._x1,s=this._y1,c=r-t,u=i-n,f=l-t,d=s-n,p=f*f+d*d;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(p>so)if(!(Math.abs(d*c-u*f)>so)||!a)this._append`L${this._x1=t},${this._y1=n}`;else{let m=r-l,g=i-s,y=c*c+u*u,x=m*m+g*g,v=Math.sqrt(y),b=Math.sqrt(p),w=a*Math.tan((Rv-Math.acos((y+p-x)/(2*v*b)))/2),S=w/b,C=w/v;Math.abs(S-1)>so&&this._append`L${t+S*f},${n+S*d}`,this._append`A${a},${a},0,0,${+(d*m>f*g)},${this._x1=t+C*c},${this._y1=n+C*u}`}}arc(t,n,r,i,a,l){if(t=+t,n=+n,r=+r,l=!!l,r<0)throw new Error(`negative radius: ${r}`);let s=r*Math.cos(i),c=r*Math.sin(i),u=t+s,f=n+c,d=1^l,p=l?i-a:a-i;this._x1===null?this._append`M${u},${f}`:(Math.abs(this._x1-u)>so||Math.abs(this._y1-f)>so)&&this._append`L${u},${f}`,r&&(p<0&&(p=p%Dv+Dv),p>B8?this._append`A${r},${r},0,1,${d},${t-s},${n-c}A${r},${r},0,1,${d},${this._x1=u},${this._y1=f}`:p>so&&this._append`A${r},${r},0,${+(p>=Rv)},${d},${this._x1=t+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function Zx(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new U8(t)}function e0(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function rO(e){this._context=e}rO.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Zp(e){return new rO(e)}function iO(e){return e[0]}function aO(e){return e[1]}function oO(e,t){var n=bt(!0),r=null,i=Zp,a=null,l=Zx(s);e=typeof e=="function"?e:e===void 0?iO:bt(e),t=typeof t=="function"?t:t===void 0?aO:bt(t);function s(c){var u,f=(c=e0(c)).length,d,p=!1,m;for(r==null&&(a=i(m=l())),u=0;u<=f;++u)!(u<f&&n(d=c[u],u,c))===p&&((p=!p)?a.lineStart():a.lineEnd()),p&&a.point(+e(d,u,c),+t(d,u,c));if(m)return a=null,m+""||null}return s.x=function(c){return arguments.length?(e=typeof c=="function"?c:bt(+c),s):e},s.y=function(c){return arguments.length?(t=typeof c=="function"?c:bt(+c),s):t},s.defined=function(c){return arguments.length?(n=typeof c=="function"?c:bt(!!c),s):n},s.curve=function(c){return arguments.length?(i=c,r!=null&&(a=i(r)),s):i},s.context=function(c){return arguments.length?(c==null?r=a=null:a=i(r=c),s):r},s}function pd(e,t,n){var r=null,i=bt(!0),a=null,l=Zp,s=null,c=Zx(u);e=typeof e=="function"?e:e===void 0?iO:bt(+e),t=typeof t=="function"?t:bt(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?aO:bt(+n);function u(d){var p,m,g,y=(d=e0(d)).length,x,v=!1,b,w=new Array(y),S=new Array(y);for(a==null&&(s=l(b=c())),p=0;p<=y;++p){if(!(p<y&&i(x=d[p],p,d))===v)if(v=!v)m=p,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),g=p-1;g>=m;--g)s.point(w[g],S[g]);s.lineEnd(),s.areaEnd()}v&&(w[p]=+e(x,p,d),S[p]=+t(x,p,d),s.point(r?+r(x,p,d):w[p],n?+n(x,p,d):S[p]))}if(b)return s=null,b+""||null}function f(){return oO().defined(i).curve(l).context(a)}return u.x=function(d){return arguments.length?(e=typeof d=="function"?d:bt(+d),r=null,u):e},u.x0=function(d){return arguments.length?(e=typeof d=="function"?d:bt(+d),u):e},u.x1=function(d){return arguments.length?(r=d==null?null:typeof d=="function"?d:bt(+d),u):r},u.y=function(d){return arguments.length?(t=typeof d=="function"?d:bt(+d),n=null,u):t},u.y0=function(d){return arguments.length?(t=typeof d=="function"?d:bt(+d),u):t},u.y1=function(d){return arguments.length?(n=d==null?null:typeof d=="function"?d:bt(+d),u):n},u.lineX0=u.lineY0=function(){return f().x(e).y(t)},u.lineY1=function(){return f().x(e).y(n)},u.lineX1=function(){return f().x(r).y(t)},u.defined=function(d){return arguments.length?(i=typeof d=="function"?d:bt(!!d),u):i},u.curve=function(d){return arguments.length?(l=d,a!=null&&(s=l(a)),u):l},u.context=function(d){return arguments.length?(d==null?a=s=null:s=l(a=d),u):a},u}class lO{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function W8(e){return new lO(e,!0)}function K8(e){return new lO(e,!1)}const t0={draw(e,t){const n=Qr(t/Of);e.moveTo(n,0),e.arc(0,0,n,0,Jp)}},H8={draw(e,t){const n=Qr(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},sO=Qr(1/3),V8=sO*2,q8={draw(e,t){const n=Qr(t/V8),r=n*sO;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},Y8={draw(e,t){const n=Qr(t),r=-n/2;e.rect(r,r,n,n)}},G8=.8908130915292852,cO=Tf(Of/10)/Tf(7*Of/10),X8=Tf(Jp/10)*cO,Q8=-tO(Jp/10)*cO,J8={draw(e,t){const n=Qr(t*G8),r=X8*n,i=Q8*n;e.moveTo(0,-n),e.lineTo(r,i);for(let a=1;a<5;++a){const l=Jp*a/5,s=tO(l),c=Tf(l);e.lineTo(c*n,-s*n),e.lineTo(s*r-c*i,c*r+s*i)}e.closePath()}},Vm=Qr(3),Z8={draw(e,t){const n=-Qr(t/(Vm*3));e.moveTo(0,n*2),e.lineTo(-Vm*n,-n),e.lineTo(Vm*n,-n),e.closePath()}},br=-.5,wr=Qr(3)/2,Lv=1/Qr(12),e5=(Lv/2+1)*3,t5={draw(e,t){const n=Qr(t/e5),r=n/2,i=n*Lv,a=r,l=n*Lv+n,s=-a,c=l;e.moveTo(r,i),e.lineTo(a,l),e.lineTo(s,c),e.lineTo(br*r-wr*i,wr*r+br*i),e.lineTo(br*a-wr*l,wr*a+br*l),e.lineTo(br*s-wr*c,wr*s+br*c),e.lineTo(br*r+wr*i,br*i-wr*r),e.lineTo(br*a+wr*l,br*l-wr*a),e.lineTo(br*s+wr*c,br*c-wr*s),e.closePath()}};function n5(e,t){let n=null,r=Zx(i);e=typeof e=="function"?e:bt(e||t0),t=typeof t=="function"?t:bt(t===void 0?64:+t);function i(){let a;if(n||(n=a=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),a)return n=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:bt(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:bt(+a),i):t},i.context=function(a){return arguments.length?(n=a??null,i):n},i}function Af(){}function If(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function uO(e){this._context=e}uO.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:If(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:If(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function r5(e){return new uO(e)}function dO(e){this._context=e}dO.prototype={areaStart:Af,areaEnd:Af,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:If(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function i5(e){return new dO(e)}function fO(e){this._context=e}fO.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:If(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function a5(e){return new fO(e)}function pO(e){this._context=e}pO.prototype={areaStart:Af,areaEnd:Af,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function o5(e){return new pO(e)}function _j(e){return e<0?-1:1}function Mj(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),l=(n-e._y1)/(i||r<0&&-0),s=(a*i+l*r)/(r+i);return(_j(a)+_j(l))*Math.min(Math.abs(a),Math.abs(l),.5*Math.abs(s))||0}function Rj(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function qm(e,t,n){var r=e._x0,i=e._y0,a=e._x1,l=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,l-s*n,a,l)}function Nf(e){this._context=e}Nf.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:qm(this,this._t0,Rj(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,qm(this,Rj(this,n=Mj(this,e,t)),n);break;default:qm(this,this._t0,n=Mj(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function hO(e){this._context=new mO(e)}(hO.prototype=Object.create(Nf.prototype)).point=function(e,t){Nf.prototype.point.call(this,t,e)};function mO(e){this._context=e}mO.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function l5(e){return new Nf(e)}function s5(e){return new hO(e)}function gO(e){this._context=e}gO.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=Dj(e),i=Dj(t),a=0,l=1;l<n;++a,++l)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[l],t[l]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function Dj(e){var t,n=e.length-1,r,i=new Array(n),a=new Array(n),l=new Array(n);for(i[0]=0,a[0]=2,l[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,l[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,l[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,l[t]-=r*l[t-1];for(i[n-1]=l[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(l[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function c5(e){return new gO(e)}function eh(e,t){this._context=e,this._t=t}eh.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function u5(e){return new eh(e,.5)}function d5(e){return new eh(e,0)}function f5(e){return new eh(e,1)}function Ro(e,t){if((l=e.length)>1)for(var n=1,r,i,a=e[t[0]],l,s=a.length;n<l;++n)for(i=a,a=e[t[n]],r=0;r<s;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function zv(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function p5(e,t){return e[t]}function h5(e){const t=[];return t.key=e,t}function m5(){var e=bt([]),t=zv,n=Ro,r=p5;function i(a){var l=Array.from(e.apply(this,arguments),h5),s,c=l.length,u=-1,f;for(const d of a)for(s=0,++u;s<c;++s)(l[s][u]=[0,+r(d,l[s].key,u,a)]).data=d;for(s=0,f=e0(t(l));s<c;++s)l[f[s]].index=s;return n(l,f),l}return i.keys=function(a){return arguments.length?(e=typeof a=="function"?a:bt(Array.from(a)),i):e},i.value=function(a){return arguments.length?(r=typeof a=="function"?a:bt(+a),i):r},i.order=function(a){return arguments.length?(t=a==null?zv:typeof a=="function"?a:bt(Array.from(a)),i):t},i.offset=function(a){return arguments.length?(n=a??Ro,i):n},i}function g5(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,l;i<a;++i){for(l=n=0;n<r;++n)l+=e[n][i][1]||0;if(l)for(n=0;n<r;++n)e[n][i][1]/=l}Ro(e,t)}}function v5(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var l=0,s=0;l<i;++l)s+=e[l][n][1]||0;r[n][1]+=r[n][0]=-s/2}Ro(e,t)}}function y5(e,t){if(!(!((l=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,l;r<a;++r){for(var s=0,c=0,u=0;s<l;++s){for(var f=e[t[s]],d=f[r][1]||0,p=f[r-1][1]||0,m=(d-p)/2,g=0;g<s;++g){var y=e[t[g]],x=y[r][1]||0,v=y[r-1][1]||0;m+=x-v}c+=d,u+=m*d}i[r-1][1]+=i[r-1][0]=n,c&&(n-=u/c)}i[r-1][1]+=i[r-1][0]=n,Ro(e,t)}}function $v(e){return e==="__proto__"}function vO(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}function n0(e){var t;return typeof e=="string"||typeof e=="symbol"?e:Object.is((t=e==null?void 0:e.valueOf)==null?void 0:t.call(e),-0)?"-0":String(e)}function yO(e){if(e==null)return"";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(yO).join(",");const t=String(e);return t==="0"&&Object.is(Number(e),-0)?"-0":t}function r0(e){if(Array.isArray(e))return e.map(n0);if(typeof e=="symbol")return[e];e=yO(e);const t=[],n=e.length;if(n===0)return t;let r=0,i="",a="",l=!1;for(e.charCodeAt(0)===46&&(t.push(""),r++);r<n;){const s=e[r];a?s==="\\"&&r+1<n?(r++,i+=e[r]):s===a?a="":i+=s:l?s==='"'||s==="'"?a=s:s==="]"?(l=!1,t.push(i),i=""):i+=s:s==="["?(l=!0,i&&(t.push(i),i="")):s==="."?i&&(t.push(i),i=""):i+=s,r++}return i&&t.push(i),t}function bi(e,t,n){if(e==null)return n;switch(typeof t){case"string":{if($v(t))return n;const r=e[t];return r===void 0?vO(t)?bi(e,r0(t),n):n:r}case"number":case"symbol":{typeof t=="number"&&(t=n0(t));const r=e[t];return r===void 0?n:r}default:{if(Array.isArray(t))return x5(e,t,n);if(Object.is(t==null?void 0:t.valueOf(),-0)?t="-0":t=String(t),$v(t))return n;const r=e[t];return r===void 0?n:r}}}function x5(e,t,n){if(t.length===0)return n;let r=e;for(let i=0;i<t.length;i++){if(r==null||$v(t[i]))return n;r=r[t[i]]}return r===void 0?n:r}var b5=4;function ba(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:b5,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function Ut(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.reduce((i,a,l)=>{var s=n[l-1];return typeof s=="string"?i+s+a:s!==void 0?i+ba(s)+a:i+a},"")}var mn=e=>e===0?0:e>0?1:-1,Gr=e=>typeof e=="number"&&e!=+e,Do=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,xe=e=>(typeof e=="number"||e instanceof Number)&&!Gr(e),wi=e=>xe(e)||typeof e=="string",w5=0,Uc=e=>{var t=++w5;return"".concat(e||"").concat(t)},Nn=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!xe(t)&&typeof t!="string")return r;var a;if(Do(t)){if(n==null)return r;var l=t.indexOf("%");a=n*parseFloat(t.slice(0,l))/100}else a=+t;return Gr(a)&&(a=r),i&&n!=null&&a>n&&(a=n),a},xO=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[String(e[r])])n[String(e[r])]=!0;else return!0;return!1};function ct(e,t,n){return xe(e)&&xe(t)?ba(e+n*(t-e)):t}function bO(e,t,n){if(!(!e||!e.length))return e.find(r=>r&&(typeof t=="function"?t(r):bi(r,t))===n)}var Tt=e=>e===null||typeof e>"u",hu=e=>Tt(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function Zn(e){return e!=null}function Ua(){}var j5=["type","size","sizeType"];function Bv(){return Bv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Bv.apply(null,arguments)}function Lj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function zj(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Lj(Object(n),!0).forEach(function(r){S5(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lj(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function S5(e,t,n){return(t=k5(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function k5(e){var t=C5(e,"string");return typeof t=="symbol"?t:t+""}function C5(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function P5(e,t){if(e==null)return{};var n,r,i=E5(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function E5(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var wO={symbolCircle:t0,symbolCross:H8,symbolDiamond:q8,symbolSquare:Y8,symbolStar:J8,symbolTriangle:Z8,symbolWye:t5},T5=Math.PI/180,O5=e=>{var t="symbol".concat(hu(e));return wO[t]||t0},A5=(e,t,n)=>{if(t==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var r=18*T5;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},I5=(e,t)=>{wO["symbol".concat(hu(e))]=t},i0=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=P5(e,j5),a=zj(zj({},i),{},{type:t,size:n,sizeType:r}),l="circle";typeof t=="string"&&(l=t);var s=()=>{var p=O5(l),m=n5().type(p).size(A5(n,r,l)),g=m();if(g!==null)return g},{className:c,cx:u,cy:f}=a,d=Mn(a);return xe(u)&&xe(f)&&xe(n)?h.createElement("path",Bv({},d,{className:nt("recharts-symbols",c),transform:"translate(".concat(u,", ").concat(f,")"),d:s()})):null};i0.registerSymbol=I5;var jO=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,a0=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(h.isValidElement(e)&&(n=e.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{Qx(i)&&typeof n[i]=="function"&&(r[i]=a=>n[i](n,a))}),r},N5=(e,t,n)=>r=>(e(t,n,r),null),mu=(e,t,n)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];Qx(i)&&typeof a=="function"&&(r||(r={}),r[i]=N5(a,t,n))}),r};function $j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function _5(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$j(Object(n),!0).forEach(function(r){M5(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$j(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function M5(e,t,n){return(t=R5(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function R5(e){var t=D5(e,"string");return typeof t=="symbol"?t:t+""}function D5(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Gt(e,t){var n=_5({},e),r=t,i=Object.keys(t),a=i.reduce((l,s)=>(l[s]===void 0&&r[s]!==void 0&&(l[s]=r[s]),l),n);return a}function _f(){return _f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_f.apply(null,arguments)}function Bj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function SO(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Bj(Object(n),!0).forEach(function(r){L5(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bj(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function L5(e,t,n){return(t=z5(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function z5(e){var t=$5(e,"string");return typeof t=="symbol"?t:t+""}function $5(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Sr=32,B5={align:"center",iconSize:14,inactiveColor:"#ccc",layout:"horizontal",verticalAlign:"middle",labelStyle:{}};function F5(e){if(typeof e=="object"&&e!==null&&"strokeDasharray"in e)return String(e.strokeDasharray)}function U5(e){var{data:t,iconType:n,inactiveColor:r}=e,i=Sr/2,a=Sr/6,l=Sr/3,s=t.inactive?r:t.color,c=n??t.type;if(c==="none")return null;if(c==="plainline")return h.createElement("line",{strokeWidth:4,fill:"none",stroke:s,strokeDasharray:F5(t.payload),x1:0,y1:i,x2:Sr,y2:i,className:"recharts-legend-icon"});if(c==="line")return h.createElement("path",{strokeWidth:4,fill:"none",stroke:s,d:"M0,".concat(i,"h").concat(l,`
396
+ A`).concat(a,",").concat(a,",0,1,1,").concat(2*l,",").concat(i,`
397
+ H`).concat(Sr,"M").concat(2*l,",").concat(i,`
398
+ A`).concat(a,",").concat(a,",0,1,1,").concat(l,",").concat(i),className:"recharts-legend-icon"});if(c==="rect")return h.createElement("path",{stroke:"none",fill:s,d:"M0,".concat(Sr/8,"h").concat(Sr,"v").concat(Sr*3/4,"h").concat(-Sr,"z"),className:"recharts-legend-icon"});if(h.isValidElement(t.legendIcon)){var u=SO({},t);return delete u.legendIcon,h.cloneElement(t.legendIcon,u)}return h.createElement(i0,{fill:s,cx:i,cy:i,size:Sr,sizeType:"diameter",type:c})}function W5(e){var{payload:t,iconSize:n,layout:r,formatter:i,inactiveColor:a,iconType:l,labelStyle:s}=e,c={x:0,y:0,width:Sr,height:Sr},u={display:r==="horizontal"?"inline-block":"block",marginRight:10},f={display:"inline-block",verticalAlign:"middle",marginRight:4};return t.map((d,p)=>{var m=d.formatter||i,g=nt({"recharts-legend-item":!0,["legend-item-".concat(p)]:!0,inactive:d.inactive});if(d.type==="none")return null;var y=typeof s=="object"?SO({},s):{};y.color=d.inactive?a:y.color||d.color;var x=m?m(d.value,d,p):d.value;return h.createElement("li",_f({className:g,style:u,key:"legend-item-".concat(p)},mu(e,d,p)),h.createElement(Jx,{width:n,height:n,viewBox:c,style:f,"aria-label":"".concat(d.value," legend icon")},h.createElement(U5,{data:d,iconType:l,inactiveColor:a})),h.createElement("span",{className:"recharts-legend-item-text",style:y},x))})}var K5=e=>{var t=Gt(e,B5),{payload:n,layout:r,align:i}=t;if(!n||!n.length)return null;var a={padding:0,margin:0,textAlign:r==="horizontal"?i:"left"};return h.createElement("ul",{className:"recharts-default-legend",style:a},h.createElement(W5,_f({},t,{payload:n})))};function H5(e,t){const n=new Map;for(let r=0;r<e.length;r++){const i=e[r],a=t(i,r,e);n.has(a)||n.set(a,i)}return Array.from(n.values())}function V5(e,t){return function(...n){return e.apply(this,n.slice(0,t))}}function kO(e){return e}function q5(e){return function(t){return bi(t,e)}}function Fv(e){return e==null||typeof e!="object"&&typeof e!="function"}function Y5(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function G5(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function o0(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const X5="[object RegExp]",CO="[object String]",PO="[object Number]",EO="[object Boolean]",TO="[object Arguments]",Q5="[object Symbol]",J5="[object Date]",Z5="[object Map]",eF="[object Set]",tF="[object Array]",nF="[object ArrayBuffer]",rF="[object Object]",iF="[object DataView]",aF="[object Uint8Array]",oF="[object Uint8ClampedArray]",lF="[object Uint16Array]",sF="[object Uint32Array]",cF="[object Int8Array]",uF="[object Int16Array]",dF="[object Int32Array]",fF="[object Float32Array]",pF="[object Float64Array]",Fj=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||function(){return this}();function hF(e){return typeof Fj.Buffer<"u"&&Fj.Buffer.isBuffer(e)}function mF(e,t){return vo(e,void 0,e,new Map,t)}function vo(e,t,n,r=new Map,i=void 0){const a=i==null?void 0:i(e,t,n,r);if(a!==void 0)return a;if(Fv(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){const l=new Array(e.length);r.set(e,l);for(let s=0;s<e.length;s++)l[s]=vo(e[s],s,n,r,i);return Object.hasOwn(e,"index")&&(l.index=e.index),Object.hasOwn(e,"input")&&(l.input=e.input),l}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const l=new RegExp(e.source,e.flags);return l.lastIndex=e.lastIndex,l}if(e instanceof Map){const l=new Map;r.set(e,l);for(const[s,c]of e)l.set(s,vo(c,s,n,r,i));return l}if(e instanceof Set){const l=new Set;r.set(e,l);for(const s of e)l.add(vo(s,void 0,n,r,i));return l}if(hF(e))return e.subarray();if(Y5(e)){const l=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,l);for(let s=0;s<e.length;s++)l[s]=vo(e[s],s,n,r,i);return l}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){const l=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,l),Br(l,e,n,r,i),l}if(typeof File<"u"&&e instanceof File){const l=new File([e],e.name,{type:e.type});return r.set(e,l),Br(l,e,n,r,i),l}if(typeof Blob<"u"&&e instanceof Blob){const l=new Blob([e],{type:e.type});return r.set(e,l),Br(l,e,n,r,i),l}if(e instanceof Error){const l=structuredClone(e);return r.set(e,l),l.message=e.message,l.name=e.name,l.stack=e.stack,l.cause=e.cause,l.constructor=e.constructor,Br(l,e,n,r,i),l}if(e instanceof Boolean){const l=new Boolean(e.valueOf());return r.set(e,l),Br(l,e,n,r,i),l}if(e instanceof Number){const l=new Number(e.valueOf());return r.set(e,l),Br(l,e,n,r,i),l}if(e instanceof String){const l=new String(e.valueOf());return r.set(e,l),Br(l,e,n,r,i),l}if(typeof e=="object"&&gF(e)){const l=Object.create(Object.getPrototypeOf(e));return r.set(e,l),Br(l,e,n,r,i),l}return e}function Br(e,t,n=e,r,i){const a=[...Object.keys(t),...G5(t)];for(let l=0;l<a.length;l++){const s=a[l],c=Object.getOwnPropertyDescriptor(e,s);(c==null||c.writable)&&(e[s]=vo(t[s],s,n,r,i))}}function gF(e){switch(o0(e)){case TO:case tF:case nF:case iF:case EO:case J5:case fF:case pF:case cF:case uF:case dF:case Z5:case PO:case rF:case X5:case eF:case CO:case Q5:case aF:case oF:case lF:case sF:return!0;default:return!1}}function vF(e){return vo(e,void 0,e,new Map,void 0)}function Uv(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function OO(e){return e!==null&&(typeof e=="object"||typeof e=="function")}function AO(e,t,n){return typeof n!="function"?AO(e,t,()=>{}):Wv(e,t,function r(i,a,l,s,c,u){const f=n(i,a,l,s,c,u);return f!==void 0?!!f:Wv(i,a,r,u)},new Map)}function Wv(e,t,n,r){if(t===e)return!0;switch(typeof t){case"object":return yF(e,t,n,r);case"function":return Object.keys(t).length>0?Wv(e,{...t},n,r):Uv(e,t);default:return OO(e)?typeof t=="string"?t==="":!0:Uv(e,t)}}function yF(e,t,n,r){if(t==null)return!0;if(Array.isArray(t))return IO(e,t,n,r);if(t instanceof Map)return xF(e,t,n,r);if(t instanceof Set)return bF(e,t,n,r);const i=Object.keys(t);if(e==null||Fv(e))return i.length===0;if(i.length===0)return!0;if(r!=null&&r.has(t))return r.get(t)===e;r==null||r.set(t,e);try{for(let a=0;a<i.length;a++){const l=i[a];if(!Fv(e)&&!(l in e)||t[l]===void 0&&e[l]!==void 0||t[l]===null&&e[l]!==null||!n(e[l],t[l],l,e,t,r))return!1}return!0}finally{r==null||r.delete(t)}}function xF(e,t,n,r){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(const[i,a]of t.entries())if(n(e.get(i),a,i,e,t,r)===!1)return!1;return!0}function IO(e,t,n,r){if(t.length===0)return!0;if(!Array.isArray(e))return!1;const i=new Set;for(let a=0;a<t.length;a++){const l=t[a];let s=!1;for(let c=0;c<e.length;c++){if(i.has(c))continue;const u=e[c];let f=!1;if(n(u,l,a,e,t,r)&&(f=!0),f){i.add(c),s=!0;break}}if(!s)return!1}return!0}function bF(e,t,n,r){return t.size===0?!0:e instanceof Set?IO([...e],[...t],n,r):!1}function NO(e,t){return AO(e,t,()=>{})}function wF(e){return e=vF(e),t=>NO(t,e)}function jF(e,t){return mF(e,(n,r,i,a)=>{if(typeof e=="object"){if(o0(e)==="[object Object]"&&typeof e.constructor!="function"){const l={};return a.set(e,l),Br(l,e,i,a),l}switch(Object.prototype.toString.call(e)){case PO:case CO:case EO:{const l=new e.constructor(e==null?void 0:e.valueOf());return Br(l,e),l}case TO:{const l={};return Br(l,e),l.length=e.length,l[Symbol.iterator]=e[Symbol.iterator],l}default:return}}})}function SF(e){return jF(e)}const kF=/^(?:0|[1-9]\d*)$/;function _O(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e<t;case"symbol":return!1;case"string":return kF.test(e)}}function CF(e){return e!==null&&typeof e=="object"&&o0(e)==="[object Arguments]"}function PF(e,t){let n;if(Array.isArray(t)?n=t:typeof t=="string"&&vO(t)&&(e==null?void 0:e[t])==null?n=r0(t):n=[t],n.length===0)return!1;let r=e;for(let i=0;i<n.length;i++){const a=n[i];if((r==null||!Object.hasOwn(r,a))&&!((Array.isArray(r)||CF(r))&&_O(a)&&a<r.length))return!1;r=r[a]}return!0}function EF(e,t){switch(typeof e){case"object":Object.is(e==null?void 0:e.valueOf(),-0)&&(e="-0");break;case"number":e=n0(e);break}return t=SF(t),function(n){const r=bi(n,e);return r===void 0?PF(n,e):t===void 0?r===void 0:NO(r,t)}}function TF(e){if(e==null)return kO;switch(typeof e){case"function":return e;case"object":return Array.isArray(e)&&e.length===2?EF(e[0],e[1]):wF(e);case"string":case"symbol":case"number":return q5(e)}}function OF(e){return Number.isSafeInteger(e)&&e>=0}function MO(e){return e!=null&&typeof e!="function"&&OF(e.length)}function AF(e){return typeof e=="object"&&e!==null}function IF(e){return AF(e)&&MO(e)}function Uj(e,t=kO){return IF(e)?H5(Array.from(e),V5(TF(t),1)):[]}function RO(e,t,n){return t===!0?Uj(e,n):typeof t=="function"?Uj(e,t):e}var DO={exports:{}},LO={},zO={exports:{}},$O={};/**
399
+ * @license React
400
+ * use-sync-external-store-shim.production.js
401
+ *
402
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
403
+ *
404
+ * This source code is licensed under the MIT license found in the
405
+ * LICENSE file in the root directory of this source tree.
406
+ */var Zl=h;function NF(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var _F=typeof Object.is=="function"?Object.is:NF,MF=Zl.useState,RF=Zl.useEffect,DF=Zl.useLayoutEffect,LF=Zl.useDebugValue;function zF(e,t){var n=t(),r=MF({inst:{value:n,getSnapshot:t}}),i=r[0].inst,a=r[1];return DF(function(){i.value=n,i.getSnapshot=t,Ym(i)&&a({inst:i})},[e,n,t]),RF(function(){return Ym(i)&&a({inst:i}),e(function(){Ym(i)&&a({inst:i})})},[e]),LF(n),n}function Ym(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!_F(e,n)}catch{return!0}}function $F(e,t){return t()}var BF=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?$F:zF;$O.useSyncExternalStore=Zl.useSyncExternalStore!==void 0?Zl.useSyncExternalStore:BF;zO.exports=$O;var FF=zO.exports;/**
407
+ * @license React
408
+ * use-sync-external-store-shim/with-selector.production.js
409
+ *
410
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
411
+ *
412
+ * This source code is licensed under the MIT license found in the
413
+ * LICENSE file in the root directory of this source tree.
414
+ */var th=h,UF=FF;function WF(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var KF=typeof Object.is=="function"?Object.is:WF,HF=UF.useSyncExternalStore,VF=th.useRef,qF=th.useEffect,YF=th.useMemo,GF=th.useDebugValue;LO.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=VF(null);if(a.current===null){var l={hasValue:!1,value:null};a.current=l}else l=a.current;a=YF(function(){function c(m){if(!u){if(u=!0,f=m,m=r(m),i!==void 0&&l.hasValue){var g=l.value;if(i(g,m))return d=g}return d=m}if(g=d,KF(f,m))return g;var y=r(m);return i!==void 0&&i(g,y)?(f=m,g):(f=m,d=y)}var u=!1,f,d,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,i]);var s=HF(e,a[0],a[1]);return qF(function(){l.hasValue=!0,l.value=s},[s]),GF(s),s};DO.exports=LO;var XF=DO.exports,l0=h.createContext(null),QF=e=>e,gt=()=>{var e=h.useContext(l0);return e?e.store.dispatch:QF},Vd=()=>{},JF=()=>Vd,ZF=(e,t)=>e===t;function ke(e){var t=h.useContext(l0),n=h.useMemo(()=>t?r=>{if(r!=null)return e(r)}:Vd,[t,e]);return XF.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:JF,t?t.store.getState:Vd,t?t.store.getState:Vd,n,ZF)}function eU(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function tU(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function nU(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var Wj=e=>Array.isArray(e)?e:[e];function rU(e){const t=Array.isArray(e[0])?e[0]:e;return nU(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function iU(e,t){const n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}var aU=class{constructor(e){this.value=e}deref(){return this.value}},oU=typeof WeakRef<"u"?WeakRef:aU,lU=0,Kj=1;function hd(){return{s:lU,v:void 0,o:null,p:null}}function BO(e,t={}){let n=hd();const{resultEqualityCheck:r}=t;let i,a=0;function l(){var d;let s=n;const{length:c}=arguments;for(let p=0,m=c;p<m;p++){const g=arguments[p];if(typeof g=="function"||typeof g=="object"&&g!==null){let y=s.o;y===null&&(s.o=y=new WeakMap);const x=y.get(g);x===void 0?(s=hd(),y.set(g,s)):s=x}else{let y=s.p;y===null&&(s.p=y=new Map);const x=y.get(g);x===void 0?(s=hd(),y.set(g,s)):s=x}}const u=s;let f;if(s.s===Kj)f=s.v;else if(f=e.apply(null,arguments),a++,r){const p=((d=i==null?void 0:i.deref)==null?void 0:d.call(i))??i;p!=null&&r(p,f)&&(f=p,a!==0&&a--),i=typeof f=="object"&&f!==null||typeof f=="function"?new oU(f):f}return u.s=Kj,u.v=f,f}return l.clearCache=()=>{n=hd(),l.resetResultsCount()},l.resultsCount=()=>a,l.resetResultsCount=()=>{a=0},l}function sU(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let a=0,l=0,s,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),eU(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const f={...n,...c},{memoize:d,memoizeOptions:p=[],argsMemoize:m=BO,argsMemoizeOptions:g=[]}=f,y=Wj(p),x=Wj(g),v=rU(i),b=d(function(){return a++,u.apply(null,arguments)},...y),w=m(function(){l++;const C=iU(v,arguments);return s=b.apply(null,C),s},...x);return Object.assign(w,{resultFunc:u,memoizedResultFunc:b,dependencies:v,dependencyRecomputations:()=>l,resetDependencyRecomputations:()=>{l=0},lastResult:()=>s,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:d,argsMemoize:m})};return Object.assign(r,{withTypes:()=>r}),r}var H=sU(BO),cU=Object.assign((e,t=H)=>{tU(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(a=>e[a]);return t(r,(...a)=>a.reduce((l,s,c)=>(l[n[c]]=s,l),{}))},{withTypes:()=>cU});function uU(e,t=1){const n=[],r=Math.floor(t),i=(a,l)=>{for(let s=0;s<a.length;s++){const c=a[s];Array.isArray(c)&&l<r?i(c,l+1):n.push(c)}};return i(e,0),n}function Kv(e,t,n){return OO(n)&&(typeof t=="number"&&MO(n)&&_O(t)&&t<n.length||typeof t=="string"&&t in n)?Uv(n[t],e):!1}function Hj(e){return typeof e=="symbol"?1:e===null?2:e===void 0?3:e!==e?4:0}const dU=(e,t,n)=>{if(e!==t){const r=Hj(e),i=Hj(t);if(r===i&&r===0){if(e<t)return n==="desc"?1:-1;if(e>t)return n==="desc"?-1:1}return n==="desc"?i-r:r-i}return 0};function FO(e){return typeof e=="symbol"||e instanceof Symbol}const fU=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,pU=/^\w*$/;function hU(e,t){return Array.isArray(e)?!1:typeof e=="number"||typeof e=="boolean"||e==null||FO(e)?!0:typeof e=="string"&&(pU.test(e)||!fU.test(e))||t!=null}function mU(e,t,n,r){if(e==null)return[];n=n,Array.isArray(e)||(e=Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(s=>String(s));const i=(s,c)=>{let u=s;for(let f=0;f<c.length&&u!=null;++f)u=u[c[f]];return u},a=(s,c)=>c==null||s==null?c:typeof s=="object"&&"key"in s?Object.hasOwn(c,s.key)?c[s.key]:i(c,s.path):typeof s=="function"?s(c):Array.isArray(s)?i(c,s):typeof c=="object"?c[s]:c,l=t.map(s=>(Array.isArray(s)&&s.length===1&&(s=s[0]),s==null||typeof s=="function"||Array.isArray(s)||hU(s)?s:{key:s,path:r0(s)}));return e.map(s=>({original:s,criteria:l.map(c=>a(c,s))})).slice().sort((s,c)=>{for(let u=0;u<l.length;u++){const f=dU(s.criteria[u],c.criteria[u],n[u]);if(f!==0)return f}return 0}).map(s=>s.original)}function nh(e,...t){const n=t.length;return n>1&&Kv(e,t[0],t[1])?t=[]:n>2&&Kv(t[0],t[1],t[2])&&(t=[t[0]]),mU(e,uU(t),["asc"])}var UO=e=>e.legend.settings,gU=e=>e.legend.size,vU=e=>e.legend.payload,yU=H([vU,UO],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?nh(r,n):r});function xU(){return ke(yU)}var md=1;function WO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=h.useState({height:0,left:0,top:0,width:0}),r=h.useCallback(i=>{if(i!=null){var a=i.getBoundingClientRect(),l={height:a.height,left:a.left,top:a.top,width:a.width};(Math.abs(l.height-t.height)>md||Math.abs(l.left-t.left)>md||Math.abs(l.top-t.top)>md||Math.abs(l.width-t.width)>md)&&n({height:l.height,left:l.left,top:l.top,width:l.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}function bn(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var bU=typeof Symbol=="function"&&Symbol.observable||"@@observable",Vj=bU,Gm=()=>Math.random().toString(36).substring(7).split("").join("."),wU={INIT:`@@redux/INIT${Gm()}`,REPLACE:`@@redux/REPLACE${Gm()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Gm()}`},Mf=wU;function s0(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function KO(e,t,n){if(typeof e!="function")throw new Error(bn(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(bn(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(bn(1));return n(KO)(e,t)}let r=e,i=t,a=new Map,l=a,s=0,c=!1;function u(){l===a&&(l=new Map,a.forEach((x,v)=>{l.set(v,x)}))}function f(){if(c)throw new Error(bn(3));return i}function d(x){if(typeof x!="function")throw new Error(bn(4));if(c)throw new Error(bn(5));let v=!0;u();const b=s++;return l.set(b,x),function(){if(v){if(c)throw new Error(bn(6));v=!1,u(),l.delete(b),a=null}}}function p(x){if(!s0(x))throw new Error(bn(7));if(typeof x.type>"u")throw new Error(bn(8));if(typeof x.type!="string")throw new Error(bn(17));if(c)throw new Error(bn(9));try{c=!0,i=r(i,x)}finally{c=!1}return(a=l).forEach(b=>{b()}),x}function m(x){if(typeof x!="function")throw new Error(bn(10));r=x,p({type:Mf.REPLACE})}function g(){const x=d;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(bn(11));function b(){const S=v;S.next&&S.next(f())}return b(),{unsubscribe:x(b)}},[Vj](){return this}}}return p({type:Mf.INIT}),{dispatch:p,subscribe:d,getState:f,replaceReducer:m,[Vj]:g}}function jU(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:Mf.INIT})>"u")throw new Error(bn(12));if(typeof n(void 0,{type:Mf.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(bn(13))})}function HO(e){const t=Object.keys(e),n={};for(let a=0;a<t.length;a++){const l=t[a];typeof e[l]=="function"&&(n[l]=e[l])}const r=Object.keys(n);let i;try{jU(n)}catch(a){i=a}return function(l={},s){if(i)throw i;let c=!1;const u={};for(let f=0;f<r.length;f++){const d=r[f],p=n[d],m=l[d],g=p(m,s);if(typeof g>"u")throw s&&s.type,new Error(bn(14));u[d]=g,c=c||g!==m}return c=c||r.length!==Object.keys(l).length,c?u:l}}function Rf(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function SU(...e){return t=>(n,r)=>{const i=t(n,r);let a=()=>{throw new Error(bn(15))};const l={getState:i.getState,dispatch:(c,...u)=>a(c,...u)},s=e.map(c=>c(l));return a=Rf(...s)(i.dispatch),{...i,dispatch:a}}}function VO(e){return s0(e)&&"type"in e&&typeof e.type=="string"}var qO=Symbol.for("immer-nothing"),qj=Symbol.for("immer-draftable"),Kn=Symbol.for("immer-state");function Wr(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var dr=Object,es=dr.getPrototypeOf,Df="constructor",rh="prototype",Hv="configurable",Lf="enumerable",qd="writable",Wc="value",Hi=e=>!!e&&!!e[Kn];function Xr(e){var t;return e?YO(e)||ah(e)||!!e[qj]||!!((t=e[Df])!=null&&t[qj])||oh(e)||lh(e):!1}var kU=dr[rh][Df].toString(),Yj=new WeakMap;function YO(e){if(!e||!c0(e))return!1;const t=es(e);if(t===null||t===dr[rh])return!0;const n=dr.hasOwnProperty.call(t,Df)&&t[Df];if(n===Object)return!0;if(!dl(n))return!1;let r=Yj.get(n);return r===void 0&&(r=Function.toString.call(n),Yj.set(n,r)),r===kU}function ih(e,t,n=!0){gu(e)===0?(n?Reflect.ownKeys(e):dr.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function gu(e){const t=e[Kn];return t?t.type_:ah(e)?1:oh(e)?2:lh(e)?3:0}var Gj=(e,t,n=gu(e))=>n===2?e.has(t):dr[rh].hasOwnProperty.call(e,t),Vv=(e,t,n=gu(e))=>n===2?e.get(t):e[t],zf=(e,t,n,r=gu(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function CU(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var ah=Array.isArray,oh=e=>e instanceof Map,lh=e=>e instanceof Set,c0=e=>typeof e=="object",dl=e=>typeof e=="function",Xm=e=>typeof e=="boolean";function PU(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var Ni=e=>e.copy_||e.base_,u0=e=>e.modified_?e.copy_:e.base_;function qv(e,t){if(oh(e))return new Map(e);if(lh(e))return new Set(e);if(ah(e))return Array[rh].slice.call(e);const n=YO(e);if(t===!0||t==="class_only"&&!n){const r=dr.getOwnPropertyDescriptors(e);delete r[Kn];let i=Reflect.ownKeys(r);for(let a=0;a<i.length;a++){const l=i[a],s=r[l];s[qd]===!1&&(s[qd]=!0,s[Hv]=!0),(s.get||s.set)&&(r[l]={[Hv]:!0,[qd]:!0,[Lf]:s[Lf],[Wc]:e[l]})}return dr.create(es(e),r)}else{const r=es(e);if(r!==null&&n)return{...e};const i=dr.create(r);return dr.assign(i,e)}}function d0(e,t=!1){return sh(e)||Hi(e)||!Xr(e)||(gu(e)>1&&dr.defineProperties(e,{set:gd,add:gd,clear:gd,delete:gd}),dr.freeze(e),t&&ih(e,(n,r)=>{d0(r,!0)},!1)),e}function EU(){Wr(2)}var gd={[Wc]:EU};function sh(e){return e===null||!c0(e)?!0:dr.isFrozen(e)}var $f="MapSet",Yv="Patches",Xj="ArrayMethods",GO={};function Lo(e){const t=GO[e];return t||Wr(0,e),t}var Qj=e=>!!GO[e],Kc,XO=()=>Kc,TU=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Qj($f)?Lo($f):void 0,arrayMethodsPlugin_:Qj(Xj)?Lo(Xj):void 0});function Jj(e,t){t&&(e.patchPlugin_=Lo(Yv),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Gv(e){Xv(e),e.drafts_.forEach(OU),e.drafts_=null}function Xv(e){e===Kc&&(Kc=e.parent_)}var Zj=e=>Kc=TU(Kc,e);function OU(e){const t=e[Kn];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function eS(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(e!==void 0&&e!==n){n[Kn].modified_&&(Gv(t),Wr(4)),Xr(e)&&(e=tS(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(n[Kn].base_,e,t)}else e=tS(t,n);return AU(t,e,!0),Gv(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==qO?e:void 0}function tS(e,t){if(sh(t))return t;const n=t[Kn];if(!n)return Bf(t,e.handledSet_,e);if(!ch(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);ZO(n,e)}return n.copy_}function AU(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&d0(t,n)}function QO(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var ch=(e,t)=>e.scope_===t,IU=[];function JO(e,t,n,r){const i=Ni(e),a=e.type_;if(r!==void 0&&Vv(i,r,a)===t){zf(i,r,n,a);return}if(!e.draftLocations_){const s=e.draftLocations_=new Map;ih(i,(c,u)=>{if(Hi(u)){const f=s.get(u)||[];f.push(c),s.set(u,f)}})}const l=e.draftLocations_.get(t)??IU;for(const s of l)zf(i,s,n,a)}function NU(e,t,n){e.callbacks_.push(function(i){var s;const a=t;if(!a||!ch(a,i))return;(s=i.mapSetPlugin_)==null||s.fixSetContents(a);const l=u0(a);JO(e,a.draft_??a,l,n),ZO(a,i)})}function ZO(e,t){var r;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((r=e.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:i}=t;if(i){const a=i.getPath(e);a&&i.generatePatches_(e,a,t)}QO(e)}}function _U(e,t,n){const{scope_:r}=e;if(Hi(n)){const i=n[Kn];ch(i,r)&&i.callbacks_.push(function(){Yd(e);const l=u0(i);JO(e,n,l,t)})}else Xr(n)&&e.callbacks_.push(function(){const a=Ni(e);e.type_===3?a.has(n)&&Bf(n,r.handledSet_,r):Vv(a,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Bf(Vv(e.copy_,t,e.type_),r.handledSet_,r)})}function Bf(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Hi(e)||t.has(e)||!Xr(e)||sh(e)||(t.add(e),ih(e,(r,i)=>{if(Hi(i)){const a=i[Kn];if(ch(a,n)){const l=u0(a);zf(e,r,l,e.type_),QO(a)}}else Xr(i)&&Bf(i,t,n)})),e}function MU(e,t){const n=ah(e),r={type_:n?1:0,scope_:t?t.scope_:XO(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,a=Ff;n&&(i=[r],a=Hc);const{revoke:l,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=l,[s,r]}var Ff={get(e,t){if(t===Kn)return e;let n=e.scope_.arrayMethodsPlugin_;const r=e.type_===1&&typeof t=="string";if(r&&n!=null&&n.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=Ni(e);if(!Gj(i,t,e.type_))return RU(e,i,t);const a=i[t];if(e.finalized_||!Xr(a)||r&&e.operationMethod&&(n!=null&&n.isMutatingArrayMethod(e.operationMethod))&&PU(t))return a;if(a===Qm(e.base_,t)){Yd(e);const l=e.type_===1?+t:t,s=Jv(e.scope_,a,e,l);return e.copy_[l]=s}return a},has(e,t){return t in Ni(e)},ownKeys(e){return Reflect.ownKeys(Ni(e))},set(e,t,n){const r=eA(Ni(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=Qm(Ni(e),t),a=i==null?void 0:i[Kn];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(CU(n,i)&&(n!==void 0||Gj(e.base_,t,e.type_)))return!0;Yd(e),Qv(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),_U(e,t,n)),!0},deleteProperty(e,t){return Yd(e),Qm(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Qv(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Ni(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[qd]:!0,[Hv]:e.type_!==1||t!=="length",[Lf]:r[Lf],[Wc]:n[t]}},defineProperty(){Wr(11)},getPrototypeOf(e){return es(e.base_)},setPrototypeOf(){Wr(12)}},Hc={};for(let e in Ff){let t=Ff[e];Hc[e]=function(){const n=arguments;return n[0]=n[0][0],t.apply(this,n)}}Hc.deleteProperty=function(e,t){return Hc.set.call(this,e,t,void 0)};Hc.set=function(e,t,n){return Ff.set.call(this,e[0],t,n,e[0])};function Qm(e,t){const n=e[Kn];return(n?Ni(n):e)[t]}function RU(e,t,n){var i;const r=eA(t,n);return r?Wc in r?r[Wc]:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function eA(e,t){if(!(t in e))return;let n=es(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=es(n)}}function Qv(e){e.modified_||(e.modified_=!0,e.parent_&&Qv(e.parent_))}function Yd(e){e.copy_||(e.assigned_=new Map,e.copy_=qv(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var DU=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(dl(n)&&!dl(r)){const l=r;r=n;const s=this;return function(u=l,...f){return s.produce(u,d=>r.call(this,d,...f))}}dl(r)||Wr(6),i!==void 0&&!dl(i)&&Wr(7);let a;if(Xr(n)){const l=Zj(this),s=Jv(l,n,void 0);let c=!0;try{a=r(s),c=!1}finally{c?Gv(l):Xv(l)}return Jj(l,i),eS(a,l)}else if(!n||!c0(n)){if(a=r(n),a===void 0&&(a=n),a===qO&&(a=void 0),this.autoFreeze_&&d0(a,!0),i){const l=[],s=[];Lo(Yv).generateReplacementPatches_(n,a,{patches_:l,inversePatches_:s}),i(l,s)}return a}else Wr(1,n)},this.produceWithPatches=(n,r)=>{if(dl(n))return(s,...c)=>this.produceWithPatches(s,u=>n(u,...c));let i,a;return[this.produce(n,r,(s,c)=>{i=s,a=c}),i,a]},Xm(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),Xm(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),Xm(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Xr(t)||Wr(8),Hi(t)&&(t=Or(t));const n=Zj(this),r=Jv(n,t,void 0);return r[Kn].isManual_=!0,Xv(n),r}finishDraft(t,n){const r=t&&t[Kn];(!r||!r.isManual_)&&Wr(9);const{scope_:i}=r;return Jj(i,n),eS(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,n){let r;for(r=n.length-1;r>=0;r--){const a=n[r];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}r>-1&&(n=n.slice(r+1));const i=Lo(Yv).applyPatches_;return Hi(t)?i(t,n):this.produce(t,a=>i(a,n))}};function Jv(e,t,n,r){const[i,a]=oh(t)?Lo($f).proxyMap_(t,n):lh(t)?Lo($f).proxySet_(t,n):MU(t,n);return((n==null?void 0:n.scope_)??XO()).drafts_.push(i),a.callbacks_=(n==null?void 0:n.callbacks_)??[],a.key_=r,n&&r!==void 0?NU(n,a,r):a.callbacks_.push(function(c){var f;(f=c.mapSetPlugin_)==null||f.fixSetContents(a);const{patchPlugin_:u}=c;a.modified_&&u&&u.generatePatches_(a,[],c)}),i}function Or(e){return Hi(e)||Wr(10,e),tA(e)}function tA(e){if(!Xr(e)||sh(e))return e;const t=e[Kn];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=qv(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=qv(e,!0);return ih(n,(i,a)=>{zf(n,i,tA(a))},r),t&&(t.finalized_=!1),n}var LU=new DU,nA=LU.produce;function rA(e){return({dispatch:n,getState:r})=>i=>a=>typeof a=="function"?a(n,r,e):i(a)}var zU=rA(),$U=rA,BU=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Rf:Rf.apply(null,arguments)};function mr(e,t){function n(...r){if(t){let i=t(...r);if(!i)throw new Error(pr(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>VO(r)&&r.type===e,n}var iA=class ec extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,ec.prototype)}static get[Symbol.species](){return ec}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new ec(...t[0].concat(this)):new ec(...t.concat(this))}};function nS(e){return Xr(e)?nA(e,()=>{}):e}function vd(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function FU(e){return typeof e=="boolean"}var UU=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let l=new iA;return n&&(FU(n)?l.push(zU):l.push($U(n.extraArgument))),l},aA="RTK_autoBatch",Ct=()=>e=>({payload:e,meta:{[aA]:!0}}),rS=e=>t=>{setTimeout(t,e)},WU=(e,t)=>n=>{let r=!1;const i=()=>{r||(r=!0,cancelAnimationFrame(a),clearTimeout(l),n())},a=e(i),l=setTimeout(i,t)},oA=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,a=!1,l=!1;const s=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?WU(window.requestAnimationFrame,100):rS(10):e.type==="callback"?e.queueNotification:rS(e.timeout),u=()=>{l=!1,a&&(a=!1,s.forEach(f=>f()))};return Object.assign({},r,{subscribe(f){const d=()=>i&&f(),p=r.subscribe(d);return s.add(f),()=>{p(),s.delete(f)}},dispatch(f){var d;try{return i=!((d=f==null?void 0:f.meta)!=null&&d[aA]),a=!i,a&&(l||(l=!0,c(u))),r.dispatch(f)}finally{i=!0}}})},KU=e=>function(n){const{autoBatch:r=!0}=n??{};let i=new iA(e);return r&&i.push(oA(typeof r=="object"?r:void 0)),i};function HU(e){const t=UU(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:a=void 0,enhancers:l=void 0}=e||{};let s;if(typeof n=="function")s=n;else if(s0(n))s=HO(n);else throw new Error(pr(1));let c;typeof r=="function"?c=r(t):c=t();let u=Rf;i&&(u=BU({trace:!1,...typeof i=="object"&&i}));const f=SU(...c),d=KU(f);let p=typeof l=="function"?l(d):d();const m=u(...p);return KO(s,a,m)}function lA(e){const t={},n=[];let r;const i={addCase(a,l){const s=typeof a=="string"?a:a.type;if(!s)throw new Error(pr(28));if(s in t)throw new Error(pr(29));return t[s]=l,i},addAsyncThunk(a,l){return l.pending&&(t[a.pending.type]=l.pending),l.rejected&&(t[a.rejected.type]=l.rejected),l.fulfilled&&(t[a.fulfilled.type]=l.fulfilled),l.settled&&n.push({matcher:a.settled,reducer:l.settled}),i},addMatcher(a,l){return n.push({matcher:a,reducer:l}),i},addDefaultCase(a){return r=a,i}};return e(i),[t,n,r]}function VU(e){return typeof e=="function"}function qU(e,t){let[n,r,i]=lA(t),a;if(VU(e))a=()=>nS(e());else{const s=nS(e);a=()=>s}function l(s=a(),c){let u=[n[c.type],...r.filter(({matcher:f})=>f(c)).map(({reducer:f})=>f)];return u.filter(f=>!!f).length===0&&(u=[i]),u.reduce((f,d)=>{if(d)if(Hi(f)){const m=d(f,c);return m===void 0?f:m}else{if(Xr(f))return nA(f,p=>d(p,c));{const p=d(f,c);if(p===void 0){if(f===null)return f;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return f},s)}return l.getInitialState=a,l}var YU="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",GU=(e=21)=>{let t="",n=e;for(;n--;)t+=YU[Math.random()*64|0];return t},XU=Symbol.for("rtk-slice-createasyncthunk");function QU(e,t){return`${e}/${t}`}function JU({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[XU];return function(i){const{name:a,reducerPath:l=a}=i;if(!a)throw new Error(pr(11));const s=(typeof i.reducers=="function"?i.reducers(eW()):i.reducers)||{},c=Object.keys(s),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},f={addCase(S,C){const j=typeof S=="string"?S:S.type;if(!j)throw new Error(pr(12));if(j in u.sliceCaseReducersByType)throw new Error(pr(13));return u.sliceCaseReducersByType[j]=C,f},addMatcher(S,C){return u.sliceMatchers.push({matcher:S,reducer:C}),f},exposeAction(S,C){return u.actionCreators[S]=C,f},exposeCaseReducer(S,C){return u.sliceCaseReducersByName[S]=C,f}};c.forEach(S=>{const C=s[S],j={reducerName:S,type:QU(a,S),createNotation:typeof i.reducers=="function"};nW(C)?iW(j,C,f,t):tW(j,C,f)});function d(){const[S={},C=[],j=void 0]=typeof i.extraReducers=="function"?lA(i.extraReducers):[i.extraReducers],E={...S,...u.sliceCaseReducersByType};return qU(i.initialState,O=>{for(let R in E)O.addCase(R,E[R]);for(let R of u.sliceMatchers)O.addMatcher(R.matcher,R.reducer);for(let R of C)O.addMatcher(R.matcher,R.reducer);j&&O.addDefaultCase(j)})}const p=S=>S,m=new Map,g=new WeakMap;let y;function x(S,C){return y||(y=d()),y(S,C)}function v(){return y||(y=d()),y.getInitialState()}function b(S,C=!1){function j(O){let R=O[S];return typeof R>"u"&&C&&(R=vd(g,j,v)),R}function E(O=p){const R=vd(m,C,()=>new WeakMap);return vd(R,O,()=>{const A={};for(const[N,_]of Object.entries(i.selectors??{}))A[N]=ZU(_,O,()=>vd(g,O,v),C);return A})}return{reducerPath:S,getSelectors:E,get selectors(){return E(j)},selectSlice:j}}const w={name:a,reducer:x,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:v,...b(l),injectInto(S,{reducerPath:C,...j}={}){const E=C??l;return S.inject({reducerPath:E,reducer:x},j),{...w,...b(E,!0)}}};return w}}function ZU(e,t,n,r){function i(a,...l){let s=t(a);return typeof s>"u"&&r&&(s=n()),e(s,...l)}return i.unwrapped=e,i}var Dn=JU();function eW(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function tW({type:e,reducerName:t,createNotation:n},r,i){let a,l;if("reducer"in r){if(n&&!rW(r))throw new Error(pr(17));a=r.reducer,l=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,l?mr(e,l):mr(e))}function nW(e){return e._reducerDefinitionType==="asyncThunk"}function rW(e){return e._reducerDefinitionType==="reducerWithPrepare"}function iW({type:e,reducerName:t},n,r,i){if(!i)throw new Error(pr(18));const{payloadCreator:a,fulfilled:l,pending:s,rejected:c,settled:u,options:f}=n,d=i(e,a,f);r.exposeAction(t,d),l&&r.addCase(d.fulfilled,l),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),u&&r.addMatcher(d.settled,u),r.exposeCaseReducer(t,{fulfilled:l||yd,pending:s||yd,rejected:c||yd,settled:u||yd})}function yd(){}var aW="task",sA="listener",cA="completed",f0="cancelled",oW=`task-${f0}`,lW=`task-${cA}`,Zv=`${sA}-${f0}`,sW=`${sA}-${cA}`,uh=class{constructor(e){Uu(this,"code");Uu(this,"name","TaskAbortError");Uu(this,"message");this.code=e,this.message=`${aW} ${f0} (reason: ${e})`}},p0=(e,t)=>{if(typeof e!="function")throw new TypeError(pr(32))},Uf=()=>{},uA=(e,t=Uf)=>(e.catch(t),e),dA=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Co=e=>{if(e.aborted)throw new uh(e.reason)};function fA(e,t){let n=Uf;return new Promise((r,i)=>{const a=()=>i(new uh(e.reason));if(e.aborted){a();return}n=dA(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=Uf})}var cW=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof uh?"cancelled":"rejected",error:n}}finally{t==null||t()}},Wf=e=>t=>uA(fA(e,t).then(n=>(Co(e),n))),pA=e=>{const t=Wf(e);return n=>t(new Promise(r=>setTimeout(r,n)))},{assign:$l}=Object,iS={},dh="listenerMiddleware",uW=(e,t)=>{const n=r=>dA(e,()=>r.abort(e.reason));return(r,i)=>{p0(r);const a=new AbortController;n(a);const l=cW(async()=>{Co(e),Co(a.signal);const s=await r({pause:Wf(a.signal),delay:pA(a.signal),signal:a.signal});return Co(a.signal),s},()=>a.abort(lW));return i!=null&&i.autoJoin&&t.push(l.catch(Uf)),{result:Wf(e)(l),cancel(){a.abort(oW)}}}},dW=(e,t)=>{const n=async(r,i)=>{Co(t);let a=()=>{};const s=[new Promise((c,u)=>{let f=e({predicate:r,effect:(d,p)=>{p.unsubscribe(),c([d,p.getState(),p.getOriginalState()])}});a=()=>{f(),u()}})];i!=null&&s.push(new Promise(c=>setTimeout(c,i,null)));try{const c=await fA(t,Promise.race(s));return Co(t),c}finally{a()}};return(r,i)=>uA(n(r,i))},hA=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=mr(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(pr(21));return p0(a),{predicate:i,type:t,effect:a}},mA=$l(e=>{const{type:t,predicate:n,effect:r}=hA(e);return{id:GU(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(pr(22))}}},{withTypes:()=>mA}),aS=(e,t)=>{const{type:n,effect:r,predicate:i}=hA(t);return Array.from(e.values()).find(a=>(typeof n=="string"?a.type===n:a.predicate===i)&&a.effect===r)},ey=e=>{e.pending.forEach(t=>{t.abort(Zv)})},fW=(e,t)=>()=>{for(const n of t.keys())ey(n);e.clear()},oS=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},gA=$l(mr(`${dh}/add`),{withTypes:()=>gA}),pW=mr(`${dh}/removeAll`),vA=$l(mr(`${dh}/remove`),{withTypes:()=>vA}),hW=(...e)=>{console.error(`${dh}/error`,...e)},vu=(e={})=>{const t=new Map,n=new Map,r=m=>{const g=n.get(m)??0;n.set(m,g+1)},i=m=>{const g=n.get(m)??1;g===1?n.delete(m):n.set(m,g-1)},{extra:a,onError:l=hW}=e;p0(l);const s=m=>(m.unsubscribe=()=>t.delete(m.id),t.set(m.id,m),g=>{m.unsubscribe(),g!=null&&g.cancelActive&&ey(m)}),c=m=>{const g=aS(t,m)??mA(m);return s(g)};$l(c,{withTypes:()=>c});const u=m=>{const g=aS(t,m);return g&&(g.unsubscribe(),m.cancelActive&&ey(g)),!!g};$l(u,{withTypes:()=>u});const f=async(m,g,y,x)=>{const v=new AbortController,b=dW(c,v.signal),w=[];try{m.pending.add(v),r(m),await Promise.resolve(m.effect(g,$l({},y,{getOriginalState:x,condition:(S,C)=>b(S,C).then(Boolean),take:b,delay:pA(v.signal),pause:Wf(v.signal),extra:a,signal:v.signal,fork:uW(v.signal,w),unsubscribe:m.unsubscribe,subscribe:()=>{t.set(m.id,m)},cancelActiveListeners:()=>{m.pending.forEach((S,C,j)=>{S!==v&&(S.abort(Zv),j.delete(S))})},cancel:()=>{v.abort(Zv),m.pending.delete(v)},throwIfCancelled:()=>{Co(v.signal)}})))}catch(S){S instanceof uh||oS(l,S,{raisedBy:"effect"})}finally{await Promise.all(w),v.abort(sW),i(m),m.pending.delete(v)}},d=fW(t,n);return{middleware:m=>g=>y=>{if(!VO(y))return g(y);if(gA.match(y))return c(y.payload);if(pW.match(y)){d();return}if(vA.match(y))return u(y.payload);let x=m.getState();const v=()=>{if(x===iS)throw new Error(pr(23));return x};let b;try{if(b=g(y),t.size>0){const w=m.getState(),S=Array.from(t.values());for(const C of S){let j=!1;try{j=C.predicate(y,w,x)}catch(E){j=!1,oS(l,E,{raisedBy:"predicate"})}j&&f(C,y,m,v)}}}finally{x=iS}return b},startListening:c,stopListening:u,clearListeners:d}};function pr(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var mW={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},yA=Dn({name:"chartLayout",initialState:mW,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,a;e.margin.top=(n=t.payload.top)!==null&&n!==void 0?n:0,e.margin.right=(r=t.payload.right)!==null&&r!==void 0?r:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(a=t.payload.left)!==null&&a!==void 0?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:gW,setLayout:vW,setChartSize:yW,setScale:xW}=yA.actions,bW=yA.reducer;function xA(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function He(e){return Number.isFinite(e)}function ji(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function lS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Pl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?lS(Object(n),!0).forEach(function(r){wW(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function wW(e,t,n){return(t=jW(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jW(e){var t=SW(e,"string");return typeof t=="symbol"?t:t+""}function SW(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function at(e,t,n){return Tt(e)||Tt(t)?n:wi(t)?bi(e,t,n):typeof t=="function"?t(e):n}var kW=(e,t,n)=>{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:l,layout:s}=t;if((s==="vertical"||s==="horizontal"&&l==="middle")&&a!=="center"&&xe(e[a]))return Pl(Pl({},e),{},{[a]:e[a]+(r||0)});if((s==="horizontal"||s==="vertical"&&a==="center")&&l!=="middle"&&xe(e[l]))return Pl(Pl({},e),{},{[l]:e[l]+(i||0)})}return e},Jr=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",bA=(e,t,n,r)=>{if(r)return e.map(s=>s.coordinate);var i,a,l=e.map(s=>(s.coordinate===t&&(i=!0),s.coordinate===n&&(a=!0),s.coordinate));return i||l.push(t),a||l.push(n),l},wA=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:l,realScaleType:s,isCategorical:c,categoricalDomain:u,tickCount:f,ticks:d,niceTicks:p,axisType:m}=e;if(!l)return null;var g=s==="scaleBand"&&l.bandwidth?l.bandwidth()/2:2,y=i==="category"&&l.bandwidth?l.bandwidth()/g:0;if(y=m==="angleAxis"&&a&&a.length>=2?mn(a[0]-a[1])*2*y:y,d||p){var x=(d||p||[]).map((v,b)=>{var w=r?r.indexOf(v):v,S=l.map(w);return He(S)?{coordinate:S+y,value:v,offset:y,index:b}:null}).filter(Zn);return x}return c&&u?u.map((v,b)=>{var w=l.map(v);return He(w)?{coordinate:w+y,value:v,index:b,offset:y}:null}).filter(Zn):l.ticks&&f!=null?l.ticks(f).map((v,b)=>{var w=l.map(v);return He(w)?{coordinate:w+y,value:v,index:b,offset:y}:null}).filter(Zn):l.domain().map((v,b)=>{var w=l.map(v);return He(w)?{coordinate:w+y,value:r?r[v]:v,index:b,offset:y}:null}).filter(Zn)},CW=(e,t)=>{if(!t||t.length!==2||!xe(t[0])||!xe(t[1]))return e;var n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!xe(e[0])||e[0]<n)&&(i[0]=n),(!xe(e[1])||e[1]>r)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]<n&&(i[1]=n),i},PW=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i<r;++i)for(var a=0,l=0,s=0;s<n;++s){var c=e[s],u=c==null?void 0:c[i];if(u!=null){var f=u[1],d=u[0],p=Gr(f)?d:f;p>=0?(u[0]=a,a+=p,u[1]=a):(u[0]=l,l+=p,u[1]=l)}}}},EW=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i<r;++i)for(var a=0,l=0;l<n;++l){var s=e[l],c=s==null?void 0:s[i];if(c!=null){var u=Gr(c[1])?c[0]:c[1];u>=0?(c[0]=a,a+=u,c[1]=a):(c[0]=0,c[1]=0)}}}},TW={sign:PW,expand:g5,none:Ro,silhouette:v5,wiggle:y5,positive:EW},OW=(e,t,n)=>{var r,i=(r=TW[n])!==null&&r!==void 0?r:Ro,a=m5().keys(t).value((s,c)=>Number(at(s,c,0))).order(zv).offset(i),l=a(e);return l.forEach((s,c)=>{s.forEach((u,f)=>{var d=at(e[f],t[c],0);Array.isArray(d)&&d.length===2&&xe(d[0])&&xe(d[1])&&(u[0]=d[0],u[1]=d[1])})}),l};function jA(e){return e==null?void 0:String(e)}function Kf(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:l}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Tt(i[t.dataKey])){var s=bO(n,"value",i[t.dataKey]);if(s)return s.coordinate+r/2}return n!=null&&n[a]?n[a].coordinate+r/2:null}var c=at(i,Tt(l)?t.dataKey:l),u=t.scale.map(c);return xe(u)?u:null}var sS=e=>{var{axis:t,ticks:n,offset:r,bandSize:i,entry:a,index:l}=e;if(t.type==="category")return n[l]?n[l].coordinate+r:null;var s=at(a,t.dataKey,t.scale.domain()[l]);if(Tt(s))return null;var c=t.scale.map(s);return xe(c)?c-i/2+r:null},AW=e=>{var{numericAxis:t}=e,n=t.scale.domain();if(t.type==="number"){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},IW=e=>{var t=e.flat(2).filter(xe);return[Math.min(...t),Math.max(...t)]},NW=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],_W=(e,t,n)=>{if(e!=null)return NW(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:l}=a,s=l.reduce((c,u)=>{var f=xA(u,t,n),d=IW(f);return!He(d[0])||!He(d[1])?c:[Math.min(c[0],d[0]),Math.max(c[1],d[1])]},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))},cS=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,uS=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Ma=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=nh(t,f=>f.coordinate),a=1/0,l=1,s=i.length;l<s;l++){var c=i[l],u=i[l-1];a=Math.min(((c==null?void 0:c.coordinate)||0)-((u==null?void 0:u.coordinate)||0),a)}return a===1/0?0:a}return n?void 0:0};function dS(e){var{tooltipEntrySettings:t,dataKey:n,payload:r,value:i,name:a}=e;return Pl(Pl({},t),{},{dataKey:n,payload:r,value:i,name:a})}function Wa(e,t){if(e)return String(e);if(typeof t=="string")return t}var MW=(e,t)=>{if(t==="horizontal")return e.relativeX;if(t==="vertical")return e.relativeY},RW=(e,t)=>t==="centric"?e.angle:e.radius,Ji=e=>e.layout.width,Zi=e=>e.layout.height,DW=e=>e.layout.scale,SA=e=>e.layout.margin,fh=H(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),ph=H(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),kA="data-recharts-item-index",CA="data-recharts-item-id",yu=60;function fS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function xd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fS(Object(n),!0).forEach(function(r){LW(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function LW(e,t,n){return(t=zW(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zW(e){var t=$W(e,"string");return typeof t=="symbol"?t:t+""}function $W(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var BW=e=>e.brush.height;function FW(e){var t=ph(e);return t.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:yu;return n+i}return n},0)}function UW(e){var t=ph(e);return t.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:yu;return n+i}return n},0)}function WW(e){var t=fh(e);return t.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function KW(e){var t=fh(e);return t.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var cn=H([Ji,Zi,SA,BW,FW,UW,WW,KW,UO,gU],(e,t,n,r,i,a,l,s,c,u)=>{var f={left:(n.left||0)+i,right:(n.right||0)+a},d={top:(n.top||0)+l,bottom:(n.bottom||0)+s},p=xd(xd({},d),f),m=p.bottom;p.bottom+=r,p=kW(p,c,u);var g=e-p.left-p.right,y=t-p.top-p.bottom;return xd(xd({brushBottom:m},p),{},{width:Math.max(g,0),height:Math.max(y,0)})}),HW=H(cn,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),h0=H(Ji,Zi,(e,t)=>({x:0,y:0,width:e,height:t})),VW=h.createContext(null),vn=()=>h.useContext(VW)!=null,hh=e=>e.brush,mh=H([hh,cn,SA],(e,t,n)=>({height:e.height,x:xe(e.x)?e.x:t.left,y:xe(e.y)?e.y:t.top+t.height+t.brushBottom-((n==null?void 0:n.bottom)||0),width:xe(e.width)?e.width:t.width}));function qW(e,t,{signal:n,edges:r}={}){let i,a=null;const l=r!=null&&r.includes("leading"),s=r==null||r.includes("trailing"),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},u=()=>{s&&c(),m()};let f=null;const d=()=>{f!=null&&clearTimeout(f),f=setTimeout(()=>{f=null,u()},t)},p=()=>{f!==null&&(clearTimeout(f),f=null)},m=()=>{p(),i=void 0,a=null},g=()=>{c()},y=function(...x){if(n!=null&&n.aborted)return;i=this,a=x;const v=f==null;d(),l&&v&&c()};return y.schedule=d,y.cancel=m,y.flush=g,n==null||n.addEventListener("abort",m,{once:!0}),y}function YW(e,t=0,n={}){typeof n!="object"&&(n={});const{leading:r=!1,trailing:i=!0,maxWait:a}=n,l=Array(2);r&&(l[0]="leading"),i&&(l[1]="trailing");let s,c=null;const u=qW(function(...p){s=e.apply(this,p),c=null},t,{edges:l}),f=function(...p){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?(s=e.apply(this,p),c=Date.now(),u.cancel(),u.schedule(),s):(u.apply(this,p),s)},d=()=>(u.flush(),s);return f.cancel=u.cancel,f.flush=d,f}function GW(e,t=0,n={}){const{leading:r=!0,trailing:i=!0}=n;return YW(e,t,{leading:r,maxWait:t,trailing:i})}var Hf=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;a<r;a++)i[a-2]=arguments[a];if(typeof console<"u"&&console.warn&&(n===void 0&&console.warn("LogUtils requires an error message argument"),!t))if(n===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=0;console.warn(n.replace(/%s/g,()=>i[l++]))}},pi={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},PA=(e,t,n)=>{var{width:r=pi.width,height:i=pi.height,aspect:a,maxHeight:l}=n,s=Do(r)?e:Number(r),c=Do(i)?t:Number(i);return a&&a>0&&(s?c=s/a:c&&(s=c*a),l&&c!=null&&c>l&&(c=l)),{calculatedWidth:s,calculatedHeight:c}},XW={width:0,height:0,overflow:"visible"},QW={width:0,overflowX:"visible"},JW={height:0,overflowY:"visible"},ZW={},eK=e=>{var{width:t,height:n}=e,r=Do(t),i=Do(n);return r&&i?XW:r?QW:i?JW:ZW};function tK(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return i===void 0&&a===void 0?(i=pi.width,a=pi.height):i===void 0?i=r&&r>0?void 0:pi.width:a===void 0&&(a=r&&r>0?void 0:pi.height),{width:i,height:a}}function ty(){return ty=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ty.apply(null,arguments)}function pS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function hS(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pS(Object(n),!0).forEach(function(r){nK(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function nK(e,t,n){return(t=rK(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rK(e){var t=iK(e,"string");return typeof t=="symbol"?t:t+""}function iK(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var EA=h.createContext(pi.initialDimension);function aK(e){return ji(e.width)&&ji(e.height)}function TA(e){var{children:t,width:n,height:r}=e,i=h.useMemo(()=>({width:n,height:r}),[n,r]);return aK(i)?h.createElement(EA.Provider,{value:i},t):null}var m0=()=>h.useContext(EA),oK=h.forwardRef((e,t)=>{var{aspect:n,initialDimension:r=pi.initialDimension,width:i,height:a,minWidth:l=pi.minWidth,minHeight:s,maxHeight:c,children:u,debounce:f=pi.debounce,id:d,className:p,onResize:m,style:g={}}=e,y=h.useRef(null),x=h.useRef();x.current=m,h.useImperativeHandle(t,()=>y.current);var[v,b]=h.useState({containerWidth:r.width,containerHeight:r.height}),w=h.useCallback((O,R)=>{b(A=>{var N=Math.round(O),_=Math.round(R);return A.containerWidth===N&&A.containerHeight===_?A:{containerWidth:N,containerHeight:_}})},[]);h.useEffect(()=>{if(y.current==null||typeof ResizeObserver>"u")return Ua;var O=_=>{var q,W=_[0];if(W!=null){var{width:I,height:F}=W.contentRect;w(I,F),(q=x.current)===null||q===void 0||q.call(x,I,F)}};f>0&&(O=GW(O,f,{trailing:!0,leading:!1}));var R=new ResizeObserver(O),{width:A,height:N}=y.current.getBoundingClientRect();return w(A,N),R.observe(y.current),()=>{R.disconnect()}},[w,f]);var{containerWidth:S,containerHeight:C}=v;Hf(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:j,calculatedHeight:E}=PA(S,C,{width:i,height:a,aspect:n,maxHeight:c});return Hf(j!=null&&j>0||E!=null&&E>0,`The width(%s) and height(%s) of chart should be greater than 0,
415
+ please check the style of container, or the props width(%s) and height(%s),
416
+ or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
417
+ height and width.`,j,E,i,a,l,s,n),h.createElement("div",{id:d?"".concat(d):void 0,className:nt("recharts-responsive-container",p),style:hS(hS({},g),{},{width:i,height:a,minWidth:l,minHeight:s,maxHeight:c}),ref:y},h.createElement("div",{style:eK({width:i,height:a})},h.createElement(TA,{width:j,height:E},u)))}),fl=h.forwardRef((e,t)=>{var n=m0();if(ji(n.width)&&ji(n.height))return e.children;var{width:r,height:i}=tK({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:l}=PA(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return xe(a)&&xe(l)?h.createElement(TA,{width:a,height:l},e.children):h.createElement(oK,ty({},e,{width:r,height:i,ref:t}))});function g0(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var gh=()=>{var e,t=vn(),n=ke(HW),r=ke(mh),i=(e=ke(hh))===null||e===void 0?void 0:e.padding;return!t||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},lK={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},OA=()=>{var e;return(e=ke(cn))!==null&&e!==void 0?e:lK},v0=()=>ke(Ji),y0=()=>ke(Zi),sK=()=>ke(e=>e.layout.margin),Ze=e=>e.layout.layoutType,Ka=()=>ke(Ze),x0=()=>{var e=Ka();if(e==="horizontal"||e==="vertical")return e},AA=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},cK=()=>{var e=Ka();return e!==void 0},xu=e=>{var t=gt(),n=vn(),{width:r,height:i}=e,a=m0(),l=r,s=i;return a&&(l=a.width>0?a.width:r,s=a.height>0?a.height:i),h.useEffect(()=>{!n&&ji(l)&&ji(s)&&t(yW({width:l,height:s}))},[t,n,l,s]),null},IA=Symbol.for("immer-nothing"),mS=Symbol.for("immer-draftable"),gr=Symbol.for("immer-state");function Kr(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Vc=Object.getPrototypeOf;function ts(e){return!!e&&!!e[gr]}function zo(e){var t;return e?NA(e)||Array.isArray(e)||!!e[mS]||!!((t=e.constructor)!=null&&t[mS])||bu(e)||yh(e):!1}var uK=Object.prototype.constructor.toString(),gS=new WeakMap;function NA(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=gS.get(n);return r===void 0&&(r=Function.toString.call(n),gS.set(n,r)),r===uK}function Vf(e,t,n=!0){vh(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function vh(e){const t=e[gr];return t?t.type_:Array.isArray(e)?1:bu(e)?2:yh(e)?3:0}function ny(e,t){return vh(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function _A(e,t,n){const r=vh(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function dK(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function bu(e){return e instanceof Map}function yh(e){return e instanceof Set}function co(e){return e.copy_||e.base_}function ry(e,t){if(bu(e))return new Map(e);if(yh(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=NA(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[gr];let i=Reflect.ownKeys(r);for(let a=0;a<i.length;a++){const l=i[a],s=r[l];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(r[l]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[l]})}return Object.create(Vc(e),r)}else{const r=Vc(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function b0(e,t=!1){return xh(e)||ts(e)||!zo(e)||(vh(e)>1&&Object.defineProperties(e,{set:bd,add:bd,clear:bd,delete:bd}),Object.freeze(e),t&&Object.values(e).forEach(n=>b0(n,!0))),e}function fK(){Kr(2)}var bd={value:fK};function xh(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var pK={};function $o(e){const t=pK[e];return t||Kr(0,e),t}var qc;function MA(){return qc}function hK(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function vS(e,t){t&&($o("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function iy(e){ay(e),e.drafts_.forEach(mK),e.drafts_=null}function ay(e){e===qc&&(qc=e.parent_)}function yS(e){return qc=hK(qc,e)}function mK(e){const t=e[gr];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function xS(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[gr].modified_&&(iy(t),Kr(4)),zo(e)&&(e=qf(t,e),t.parent_||Yf(t,e)),t.patches_&&$o("Patches").generateReplacementPatches_(n[gr].base_,e,t.patches_,t.inversePatches_)):e=qf(t,n,[]),iy(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==IA?e:void 0}function qf(e,t,n){if(xh(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[gr];if(!i)return Vf(t,(a,l)=>bS(e,i,t,a,l,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return Yf(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const a=i.copy_;let l=a,s=!1;i.type_===3&&(l=new Set(a),a.clear(),s=!0),Vf(l,(c,u)=>bS(e,i,a,c,u,n,s),r),Yf(e,a,!1),n&&e.patches_&&$o("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function bS(e,t,n,r,i,a,l){if(i==null||typeof i!="object"&&!l)return;const s=xh(i);if(!(s&&!l)){if(ts(i)){const c=a&&t&&t.type_!==3&&!ny(t.assigned_,r)?a.concat(r):void 0,u=qf(e,i,c);if(_A(n,r,u),ts(u))e.canAutoFreeze_=!1;else return}else l&&n.add(i);if(zo(i)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&s)return;qf(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(bu(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&Yf(e,i)}}}function Yf(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&b0(t,n)}function gK(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:MA(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,a=w0;n&&(i=[r],a=Yc);const{revoke:l,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=l,s}var w0={get(e,t){if(t===gr)return e;const n=co(e);if(!ny(n,t))return vK(e,n,t);const r=n[t];return e.finalized_||!zo(r)?r:r===Jm(e.base_,t)?(Zm(e),e.copy_[t]=ly(r,e)):r},has(e,t){return t in co(e)},ownKeys(e){return Reflect.ownKeys(co(e))},set(e,t,n){const r=RA(co(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=Jm(co(e),t),a=i==null?void 0:i[gr];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(dK(n,i)&&(n!==void 0||ny(e.base_,t)))return!0;Zm(e),oy(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Jm(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Zm(e),oy(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=co(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Kr(11)},getPrototypeOf(e){return Vc(e.base_)},setPrototypeOf(){Kr(12)}},Yc={};Vf(w0,(e,t)=>{Yc[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Yc.deleteProperty=function(e,t){return Yc.set.call(this,e,t,void 0)};Yc.set=function(e,t,n){return w0.set.call(this,e[0],t,n,e[0])};function Jm(e,t){const n=e[gr];return(n?co(n):e)[t]}function vK(e,t,n){var i;const r=RA(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function RA(e,t){if(!(t in e))return;let n=Vc(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Vc(n)}}function oy(e){e.modified_||(e.modified_=!0,e.parent_&&oy(e.parent_))}function Zm(e){e.copy_||(e.copy_=ry(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var yK=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const a=n;n=t;const l=this;return function(c=a,...u){return l.produce(c,f=>n.call(this,f,...u))}}typeof n!="function"&&Kr(6),r!==void 0&&typeof r!="function"&&Kr(7);let i;if(zo(t)){const a=yS(this),l=ly(t,void 0);let s=!0;try{i=n(l),s=!1}finally{s?iy(a):ay(a)}return vS(a,r),xS(i,a)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===IA&&(i=void 0),this.autoFreeze_&&b0(i,!0),r){const a=[],l=[];$o("Patches").generateReplacementPatches_(t,i,a,l),r(a,l)}return i}else Kr(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(l,...s)=>this.produceWithPatches(l,c=>t(c,...s));let r,i;return[this.produce(t,n,(l,s)=>{r=l,i=s}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){zo(e)||Kr(8),ts(e)&&(e=xK(e));const t=yS(this),n=ly(e,void 0);return n[gr].isManual_=!0,ay(t),n}finishDraft(e,t){const n=e&&e[gr];(!n||!n.isManual_)&&Kr(9);const{scope_:r}=n;return vS(r,t),xS(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=$o("Patches").applyPatches_;return ts(e)?r(e,t):this.produce(e,i=>r(i,t))}};function ly(e,t){const n=bu(e)?$o("MapSet").proxyMap_(e,t):yh(e)?$o("MapSet").proxySet_(e,t):gK(e,t);return(t?t.scope_:MA()).drafts_.push(n),n}function xK(e){return ts(e)||Kr(10,e),DA(e)}function DA(e){if(!zo(e)||xh(e))return e;const t=e[gr];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ry(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=ry(e,!0);return Vf(n,(i,a)=>{_A(n,i,DA(a))},r),t&&(t.finalized_=!1),n}var bK=new yK;bK.produce;var wK={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},LA=Dn({name:"legend",initialState:wK,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:Ct()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Or(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:Ct()},removeLegendPayload:{reducer(e,t){var n=Or(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:Ct()}}}),{setLegendSize:wS,setLegendSettings:jK,addLegendPayload:zA,replaceLegendPayload:$A,removeLegendPayload:BA}=LA.actions,SK=LA.reducer,kK={};/**
418
+ * @license React
419
+ * use-sync-external-store-with-selector.production.js
420
+ *
421
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
422
+ *
423
+ * This source code is licensed under the MIT license found in the
424
+ * LICENSE file in the root directory of this source tree.
425
+ */var wu=h;function CK(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var PK=typeof Object.is=="function"?Object.is:CK,EK=wu.useSyncExternalStore,TK=wu.useRef,OK=wu.useEffect,AK=wu.useMemo,IK=wu.useDebugValue;kK.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=TK(null);if(a.current===null){var l={hasValue:!1,value:null};a.current=l}else l=a.current;a=AK(function(){function c(m){if(!u){if(u=!0,f=m,m=r(m),i!==void 0&&l.hasValue){var g=l.value;if(i(g,m))return d=g}return d=m}if(g=d,PK(f,m))return g;var y=r(m);return i!==void 0&&i(g,y)?(f=m,g):(f=m,d=y)}var u=!1,f,d,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,i]);var s=EK(e,a[0],a[1]);return OK(function(){l.hasValue=!0,l.value=s},[s]),IK(s),s};function NK(e){e()}function _K(){let e=null,t=null;return{clear(){e=null,t=null},notify(){NK(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var jS={notify(){},get:()=>[]};function MK(e,t){let n,r=jS,i=0,a=!1;function l(y){f();const x=r.subscribe(y);let v=!1;return()=>{v||(v=!0,x(),d())}}function s(){r.notify()}function c(){g.onStateChange&&g.onStateChange()}function u(){return a}function f(){i++,n||(n=e.subscribe(c),r=_K())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=jS)}function p(){a||(a=!0,f())}function m(){a&&(a=!1,d())}const g={addNestedSub:l,notifyNestedSubs:s,handleChangeWrapper:c,isSubscribed:u,trySubscribe:p,tryUnsubscribe:m,getListeners:()=>r};return g}var RK=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",DK=RK(),LK=()=>typeof navigator<"u"&&navigator.product==="ReactNative",zK=LK(),$K=()=>DK||zK?h.useLayoutEffect:h.useEffect,BK=$K();function SS(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function FK(e,t){if(SS(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++)if(!Object.prototype.hasOwnProperty.call(t,n[i])||!SS(e[n[i]],t[n[i]]))return!1;return!0}var eg=Symbol.for("react-redux-context"),tg=typeof globalThis<"u"?globalThis:{};function UK(){if(!h.createContext)return{};const e=tg[eg]??(tg[eg]=new Map);let t=e.get(h.createContext);return t||(t=h.createContext(null),e.set(h.createContext,t)),t}var WK=UK();function KK(e){const{children:t,context:n,serverState:r,store:i}=e,a=h.useMemo(()=>{const c=MK(i);return{store:i,subscription:c,getServerState:r?()=>r:void 0}},[i,r]),l=h.useMemo(()=>i.getState(),[i]);BK(()=>{const{subscription:c}=a;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),l!==i.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[a,l]);const s=n||WK;return h.createElement(s.Provider,{value:a},t)}var HK=KK,VK=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function qK(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function qo(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var r of n)if(VK.has(r)){if(e[r]==null&&t[r]==null)continue;if(!FK(e[r],t[r]))return!1}else if(!qK(e[r],t[r]))return!1;return!0}var YK=["contextPayload"];function sy(){return sy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sy.apply(null,arguments)}function kS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ns(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?kS(Object(n),!0).forEach(function(r){GK(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function GK(e,t,n){return(t=XK(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function XK(e){var t=QK(e,"string");return typeof t=="symbol"?t:t+""}function QK(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function JK(e,t){if(e==null)return{};var n,r,i=ZK(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ZK(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function eH(e){return e.value}function tH(e){var{contextPayload:t}=e,n=JK(e,YK),r=RO(t,e.payloadUniqBy,eH),i=ns(ns({},n),{},{payload:r});return h.isValidElement(e.content)?h.cloneElement(e.content,i):typeof e.content=="function"?h.createElement(e.content,i):h.createElement(K5,i)}function nH(e,t,n,r,i,a){var{layout:l,align:s,verticalAlign:c}=t,u,f;return(!e||(e.left===void 0||e.left===null)&&(e.right===void 0||e.right===null))&&(s==="center"&&l==="vertical"?u={left:((r||0)-a.width)/2}:u=s==="right"?{right:n&&n.right||0}:{left:n&&n.left||0}),(!e||(e.top===void 0||e.top===null)&&(e.bottom===void 0||e.bottom===null))&&(c==="middle"?f={top:((i||0)-a.height)/2}:f=c==="bottom"?{bottom:n&&n.bottom||0}:{top:n&&n.top||0}),ns(ns({},u),f)}function rH(e){var t=gt();return h.useEffect(()=>{t(jK(e))},[t,e]),null}function iH(e){var t=gt();return h.useEffect(()=>(t(wS(e)),()=>{t(wS({width:0,height:0}))}),[t,e]),null}function aH(e,t,n,r){return e==="vertical"&&t!=null?{height:t}:e==="horizontal"?{width:n||r}:null}var oH={align:"center",iconSize:14,inactiveColor:"#ccc",itemSorter:"value",layout:"horizontal",verticalAlign:"bottom"};function lH(e){var t=Gt(e,oH),n=xU(),r=$8(),i=sK(),{width:a,height:l,wrapperStyle:s,portal:c}=t,[u,f]=WO([n]),d=v0(),p=y0();if(d==null||p==null)return null;var m=d-((i==null?void 0:i.left)||0)-((i==null?void 0:i.right)||0),g=aH(t.layout,l,a,m),y=c?s:ns(ns({position:"absolute",width:(g==null?void 0:g.width)||a||"auto",height:(g==null?void 0:g.height)||l||"auto"},nH(s,t,i,d,p,u)),s),x=c??r;if(x==null||n==null)return null;var v=h.createElement("div",{className:"recharts-legend-wrapper",style:y,ref:f},h.createElement(rH,{layout:t.layout,align:t.align,verticalAlign:t.verticalAlign,itemSorter:t.itemSorter}),!c&&h.createElement(iH,{width:u.width,height:u.height}),h.createElement(tH,sy({},t,g,{margin:i,chartWidth:d,chartHeight:p,contextPayload:n})));return Up.createPortal(v,x)}var tc=h.memo(lH,qo);tc.displayName="Legend";function cy(){return cy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},cy.apply(null,arguments)}function CS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function $s(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?CS(Object(n),!0).forEach(function(r){sH(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function sH(e,t,n){return(t=cH(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cH(e){var t=uH(e,"string");return typeof t=="symbol"?t:t+""}function uH(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function dH(e){return Array.isArray(e)&&wi(e[0])&&wi(e[1])?e.join(" ~ "):e}var rl={separator:" : ",contentStyle:{margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},itemStyle:{display:"block",paddingTop:4,paddingBottom:4,color:"#000"},labelStyle:{},accessibilityLayer:!1};function fH(e,t){return t==null?e:nh(e,t)}var pH=e=>{var{separator:t=rl.separator,contentStyle:n,itemStyle:r,labelStyle:i=rl.labelStyle,payload:a,formatter:l,itemSorter:s,wrapperClassName:c,labelClassName:u,label:f,labelFormatter:d,accessibilityLayer:p=rl.accessibilityLayer}=e,m=()=>{if(a&&a.length){var C={padding:0,margin:0},j=fH(a,s),E=j.map((O,R)=>{if(!O||O.type==="none")return null;var A=O.formatter||l||dH,{value:N,name:_}=O,q=N,W=_;if(A){var I=A(N,_,O,R,a);if(Array.isArray(I))[q,W]=I;else if(I!=null)q=I;else return null}var F=$s($s({},rl.itemStyle),{},{color:O.color||rl.itemStyle.color},r);return h.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(R),style:F},wi(W)?h.createElement("span",{className:"recharts-tooltip-item-name"},W):null,wi(W)?h.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,h.createElement("span",{className:"recharts-tooltip-item-value"},q),h.createElement("span",{className:"recharts-tooltip-item-unit"},O.unit||""))});return h.createElement("ul",{className:"recharts-tooltip-item-list",style:C},E)}return null},g=$s($s({},rl.contentStyle),n),y=$s({margin:0},i),x=!Tt(f),v=x?f:"",b=nt("recharts-default-tooltip",c),w=nt("recharts-tooltip-label",u);x&&d&&a!==void 0&&a!==null&&(v=d(f,a));var S=p?{role:"status","aria-live":"assertive"}:{};return h.createElement("div",cy({className:b,style:g},S),h.createElement("p",{className:w,style:y},h.isValidElement(v)?v:"".concat(v)),m())},Bs="recharts-tooltip-wrapper",hH={visibility:"hidden"};function mH(e){var{coordinate:t,translateX:n,translateY:r}=e;return nt(Bs,{["".concat(Bs,"-right")]:xe(n)&&t&&xe(t.x)&&n>=t.x,["".concat(Bs,"-left")]:xe(n)&&t&&xe(t.x)&&n<t.x,["".concat(Bs,"-bottom")]:xe(r)&&t&&xe(t.y)&&r>=t.y,["".concat(Bs,"-top")]:xe(r)&&t&&xe(t.y)&&r<t.y})}function PS(e){var{allowEscapeViewBox:t,coordinate:n,key:r,offset:i,position:a,reverseDirection:l,tooltipDimension:s,viewBox:c,viewBoxDimension:u}=e;if(a&&xe(a[r]))return a[r];var f=n[r]-s-(i>0?i:0),d=n[r]+i;if(t[r])return l[r]?f:d;var p=c[r];if(p==null)return 0;if(l[r]){var m=f,g=p;return m<g?Math.max(d,p):Math.max(f,p)}if(u==null)return 0;var y=d+s,x=p+u;return y>x?Math.max(f,p):Math.max(d,p)}function gH(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function vH(e){var{allowEscapeViewBox:t,coordinate:n,offsetTop:r,offsetLeft:i,position:a,reverseDirection:l,tooltipBox:s,useTranslate3d:c,viewBox:u}=e,f,d,p;return s.height>0&&s.width>0&&n?(d=PS({allowEscapeViewBox:t,coordinate:n,key:"x",offset:i,position:a,reverseDirection:l,tooltipDimension:s.width,viewBox:u,viewBoxDimension:u.width}),p=PS({allowEscapeViewBox:t,coordinate:n,key:"y",offset:r,position:a,reverseDirection:l,tooltipDimension:s.height,viewBox:u,viewBoxDimension:u.height}),f=gH({translateX:d,translateY:p,useTranslate3d:c})):f=hH,{cssProperties:f,cssClasses:mH({translateX:d,translateY:p,coordinate:n})}}var yH=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),ju={isSsr:yH()};function FA(){var[e,t]=h.useState(()=>ju.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return h.useEffect(()=>{if(window.matchMedia){var n=window.matchMedia("(prefers-reduced-motion: reduce)"),r=()=>{t(n.matches)};return n.addEventListener("change",r),()=>{n.removeEventListener("change",r)}}},[]),e}function ES(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function il(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ES(Object(n),!0).forEach(function(r){xH(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ES(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function xH(e,t,n){return(t=bH(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bH(e){var t=wH(e,"string");return typeof t=="symbol"?t:t+""}function wH(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jH(e){if(!(e.prefersReducedMotion&&e.isAnimationActive==="auto")&&e.isAnimationActive&&e.active)return"transform ".concat(e.animationDuration,"ms ").concat(e.animationEasing)}function SH(e){var t,n,r,i,a,l,s=FA(),[c,u]=h.useState(()=>({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}));h.useEffect(()=>{var g=y=>{if(y.key==="Escape"){var x,v,b,w;u({dismissed:!0,dismissedAtCoordinate:{x:(x=(v=e.coordinate)===null||v===void 0?void 0:v.x)!==null&&x!==void 0?x:0,y:(b=(w=e.coordinate)===null||w===void 0?void 0:w.y)!==null&&b!==void 0?b:0}})}};return document.addEventListener("keydown",g),()=>{document.removeEventListener("keydown",g)}},[(t=e.coordinate)===null||t===void 0?void 0:t.x,(n=e.coordinate)===null||n===void 0?void 0:n.y]),c.dismissed&&(((r=(i=e.coordinate)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)!==c.dismissedAtCoordinate.x||((a=(l=e.coordinate)===null||l===void 0?void 0:l.y)!==null&&a!==void 0?a:0)!==c.dismissedAtCoordinate.y)&&u(il(il({},c),{},{dismissed:!1}));var{cssClasses:f,cssProperties:d}=vH({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset=="number"?e.offset:e.offset.x,offsetTop:typeof e.offset=="number"?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:{height:e.lastBoundingBox.height,width:e.lastBoundingBox.width},useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),p=e.hasPortalFromProps?{}:il(il({transition:jH({prefersReducedMotion:s,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},d),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),m=il(il({},p),{},{visibility:!c.dismissed&&e.active&&e.hasPayload?"visible":"hidden"},e.wrapperStyle);return h.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:f,style:m,ref:e.innerRef},e.children)}var kH=h.memo(SH),UA=()=>{var e;return(e=ke(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function uy(){return uy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},uy.apply(null,arguments)}function TS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function OS(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?TS(Object(n),!0).forEach(function(r){CH(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):TS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function CH(e,t,n){return(t=PH(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function PH(e){var t=EH(e,"string");return typeof t=="symbol"?t:t+""}function EH(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var AS={curveBasisClosed:i5,curveBasisOpen:a5,curveBasis:r5,curveBumpX:W8,curveBumpY:K8,curveLinearClosed:o5,curveLinear:Zp,curveMonotoneX:l5,curveMonotoneY:s5,curveNatural:c5,curveStep:u5,curveStepAfter:f5,curveStepBefore:d5},Gf=e=>He(e.x)&&He(e.y),IS=e=>e.base!=null&&Gf(e.base)&&Gf(e),Fs=e=>e.x,Us=e=>e.y,TH=(e,t)=>{if(typeof e=="function")return e;var n="curve".concat(hu(e));if((n==="curveMonotone"||n==="curveBump")&&t){var r=AS["".concat(n).concat(t==="vertical"?"Y":"X")];if(r)return r}return AS[n]||Zp},NS={connectNulls:!1,type:"linear"},OH=e=>{var{type:t=NS.type,points:n=[],baseLine:r,layout:i,connectNulls:a=NS.connectNulls}=e,l=TH(t,i),s=a?n.filter(Gf):n;if(Array.isArray(r)){var c,u=n.map((g,y)=>OS(OS({},g),{},{base:r[y]}));i==="vertical"?c=pd().y(Us).x1(Fs).x0(g=>g.base.x):c=pd().x(Fs).y1(Us).y0(g=>g.base.y);var f=c.defined(IS).curve(l),d=a?u.filter(IS):u;return f(d)}var p;i==="vertical"&&xe(r)?p=pd().y(Us).x1(Fs).x0(r):xe(r)?p=pd().x(Fs).y1(Us).y0(r):p=oO().x(Fs).y(Us);var m=p.defined(Gf).curve(l);return m(s)},Bl=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=Ka();if((!n||!n.length)&&!r)return null;var l={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},s=n&&n.length?OH(l):r;return h.createElement("path",uy({},Wn(e),a0(e),{className:nt("recharts-curve",t),d:s===null?void 0:s,ref:i}))},AH=["x","y","top","left","width","height","className"];function dy(){return dy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},dy.apply(null,arguments)}function _S(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function IH(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_S(Object(n),!0).forEach(function(r){NH(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_S(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function NH(e,t,n){return(t=_H(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _H(e){var t=MH(e,"string");return typeof t=="symbol"?t:t+""}function MH(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function RH(e,t){if(e==null)return{};var n,r,i=DH(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function DH(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var LH=(e,t,n,r,i,a)=>"M".concat(e,",").concat(i,"v").concat(r,"M").concat(a,",").concat(t,"h").concat(n),zH=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:a=0,height:l=0,className:s}=e,c=RH(e,AH),u=IH({x:t,y:n,top:r,left:i,width:a,height:l},c);return!xe(t)||!xe(n)||!xe(a)||!xe(l)||!xe(r)||!xe(i)?null:h.createElement("path",dy({},Mn(u),{className:nt("recharts-cross",s),d:LH(t,n,a,l,r,i)}))};function $H(e,t,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-i,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function MS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function RS(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?MS(Object(n),!0).forEach(function(r){BH(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):MS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function BH(e,t,n){return(t=FH(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function FH(e){var t=UH(e,"string");return typeof t=="symbol"?t:t+""}function UH(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var WH=e=>e.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),WA=(e,t,n)=>e.map(r=>"".concat(WH(r)," ").concat(t,"ms ").concat(n)).join(","),KH=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((n,r)=>n.filter(i=>r.includes(i))),Gc=(e,t)=>Object.keys(t).reduce((n,r)=>RS(RS({},n),{},{[r]:e(r,t[r])}),{});function DS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ln(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?DS(Object(n),!0).forEach(function(r){HH(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):DS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function HH(e,t,n){return(t=VH(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function VH(e){var t=qH(e,"string");return typeof t=="symbol"?t:t+""}function qH(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Xf=(e,t,n)=>e+(t-e)*n,fy=e=>{var{from:t,to:n}=e;return t!==n},KA=(e,t,n)=>{var r=Gc((i,a)=>{if(fy(a)){var[l,s]=e(a.from,a.to,a.velocity);return ln(ln({},a),{},{from:l,velocity:s})}return a},t);return n<1?Gc((i,a)=>fy(a)&&r[i]!=null?ln(ln({},a),{},{velocity:Xf(a.velocity,r[i].velocity,n),from:Xf(a.from,r[i].from,n)}):a,t):KA(e,r,n-1)};function YH(e,t,n,r,i,a){var l,s=r.reduce((p,m)=>ln(ln({},p),{},{[m]:{from:e[m],velocity:0,to:t[m]}}),{}),c=()=>Gc((p,m)=>m.from,s),u=()=>!Object.values(s).filter(fy).length,f=null,d=p=>{l||(l=p);var m=p-l,g=m/n.dt;s=KA(n,s,g),i(ln(ln(ln({},e),t),c())),l=p,u()||(f=a.setTimeout(d))};return()=>(f=a.setTimeout(d),()=>{var p;(p=f)===null||p===void 0||p()})}function GH(e,t,n,r,i,a,l){var s=null,c=i.reduce((d,p)=>{var m=e[p],g=t[p];return m==null||g==null?d:ln(ln({},d),{},{[p]:[m,g]})},{}),u,f=d=>{u||(u=d);var p=(d-u)/r,m=Gc((y,x)=>Xf(...x,n(p)),c);if(a(ln(ln(ln({},e),t),m)),p<1)s=l.setTimeout(f);else{var g=Gc((y,x)=>Xf(...x,n(1)),c);a(ln(ln(ln({},e),t),g))}};return()=>(s=l.setTimeout(f),()=>{var d;(d=s)===null||d===void 0||d()})}const XH=(e,t,n,r,i,a)=>{var l=KH(e,t);return n==null?()=>(i(ln(ln({},e),t)),()=>{}):n.isStepper===!0?YH(e,t,n,l,i,a):GH(e,t,n,r,l,i,a)};var Qf=1e-4,HA=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],VA=(e,t)=>e.map((n,r)=>n*t**r).reduce((n,r)=>n+r),LS=(e,t)=>n=>{var r=HA(e,t);return VA(r,n)},QH=(e,t)=>n=>{var r=HA(e,t),i=[...r.map((a,l)=>a*l).slice(1),0];return VA(i,n)},JH=e=>{var t,n=e.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(t=n[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(r==null||r.length!==4)return null;var i=r.map(a=>parseFloat(a));return[i[0],i[1],i[2],i[3]]},ZH=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(n.length===1)switch(n[0]){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-out":return[.42,0,.58,1];case"ease-in-out":return[0,0,.58,1];default:{var i=JH(n[0]);if(i)return i}}return n.length===4?n:[0,0,1,1]},e9=(e,t,n,r)=>{var i=LS(e,n),a=LS(t,r),l=QH(e,n),s=u=>u>1?1:u<0?0:u,c=u=>{for(var f=u>1?1:u,d=f,p=0;p<8;++p){var m=i(d)-f,g=l(d);if(Math.abs(m-f)<Qf||g<Qf)return a(d);d=s(d-m/g)}return a(d)};return c.isStepper=!1,c},zS=function(){return e9(...ZH(...arguments))},t9=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{stiff:n=100,damping:r=8,dt:i=17}=t,a=(l,s,c)=>{var u=-(l-s)*n,f=c*r,d=c+(u-f)*i/1e3,p=c*i/1e3+l;return Math.abs(p-s)<Qf&&Math.abs(d)<Qf?[s,0]:[p,d]};return a.isStepper=!0,a.dt=i,a},n9=e=>{if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return zS(e);case"spring":return t9();default:if(e.split("(")[0]==="cubic-bezier")return zS(e)}return typeof e=="function"?e:null};function r9(e){var t,n=()=>null,r=!1,i=null,a=l=>{if(!r){if(Array.isArray(l)){if(!l.length)return;var s=l,[c,...u]=s;if(typeof c=="number"){i=e.setTimeout(a.bind(null,u),c);return}a(c),i=e.setTimeout(a.bind(null,u));return}typeof l=="string"&&(t=l,n(t)),typeof l=="object"&&(t=l,n(t)),typeof l=="function"&&l()}};return{stop:()=>{r=!0},start:l=>{r=!1,i&&(i(),i=null),a(l)},subscribe:l=>(n=l,()=>{n=()=>null}),getTimeoutController:()=>e}}class i9{setTimeout(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,a=l=>{l-r>=n?t(l):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(a))};return i=requestAnimationFrame(a),()=>{i!=null&&cancelAnimationFrame(i)}}}function a9(){return r9(new i9)}var o9=h.createContext(a9);function l9(e,t){var n=h.useContext(o9);return h.useMemo(()=>t??n(e),[e,t,n])}var s9={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},$S={t:0},ng={t:1};function gs(e){var t=Gt(e,s9),{isActive:n,canBegin:r,duration:i,easing:a,begin:l,onAnimationEnd:s,onAnimationStart:c,children:u}=t,f=FA(),d=n==="auto"?!ju.isSsr&&!f:n,p=l9(t.animationId,t.animationManager),[m,g]=h.useState(d?$S:ng),y=h.useRef(null);return h.useEffect(()=>{d||g(ng)},[d]),h.useEffect(()=>{if(!d||!r)return Ua;var x=XH($S,ng,n9(a),i,g,p.getTimeoutController()),v=()=>{y.current=x()};return p.start([c,l,v,i,s]),()=>{p.stop(),y.current&&y.current(),s()}},[d,r,i,a,l,c,s,p]),u(m.t)}function vs(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=h.useRef(Uc(t)),r=h.useRef(e);return r.current!==e&&(n.current=Uc(t),r.current=e),n.current}var c9=["radius"],u9=["radius"],BS,FS,US,WS,KS,HS,VS,qS,YS,GS;function XS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function QS(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?XS(Object(n),!0).forEach(function(r){d9(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function d9(e,t,n){return(t=f9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f9(e){var t=p9(e,"string");return typeof t=="symbol"?t:t+""}function p9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Jf(){return Jf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jf.apply(null,arguments)}function JS(e,t){if(e==null)return{};var n,r,i=h9(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function h9(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function ii(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var ZS=(e,t,n,r,i)=>{var a=ba(n),l=ba(r),s=Math.min(Math.abs(a)/2,Math.abs(l)/2),c=l>=0?1:-1,u=a>=0?1:-1,f=l>=0&&a>=0||l<0&&a<0?1:0,d;if(s>0&&Array.isArray(i)){for(var p=[0,0,0,0],m=0,g=4;m<g;m++){var y,x=(y=i[m])!==null&&y!==void 0?y:0;p[m]=x>s?s:x}d=Ut(BS||(BS=ii(["M",",",""])),e,t+c*p[0]),p[0]>0&&(d+=Ut(FS||(FS=ii(["A ",",",",0,0,",",",",",""])),p[0],p[0],f,e+u*p[0],t)),d+=Ut(US||(US=ii(["L ",",",""])),e+n-u*p[1],t),p[1]>0&&(d+=Ut(WS||(WS=ii(["A ",",",",0,0,",`,
426
+ `,",",""])),p[1],p[1],f,e+n,t+c*p[1])),d+=Ut(KS||(KS=ii(["L ",",",""])),e+n,t+r-c*p[2]),p[2]>0&&(d+=Ut(HS||(HS=ii(["A ",",",",0,0,",`,
427
+ `,",",""])),p[2],p[2],f,e+n-u*p[2],t+r)),d+=Ut(VS||(VS=ii(["L ",",",""])),e+u*p[3],t+r),p[3]>0&&(d+=Ut(qS||(qS=ii(["A ",",",",0,0,",`,
428
+ `,",",""])),p[3],p[3],f,e,t+r-c*p[3])),d+="Z"}else if(s>0&&i===+i&&i>0){var v=Math.min(s,i);d=Ut(YS||(YS=ii(["M ",",",`
429
+ A `,",",",0,0,",",",",",`
430
+ L `,",",`
431
+ A `,",",",0,0,",",",",",`
432
+ L `,",",`
433
+ A `,",",",0,0,",",",",",`
434
+ L `,",",`
435
+ A `,",",",0,0,",",",","," Z"])),e,t+c*v,v,v,f,e+u*v,t,e+n-u*v,t,v,v,f,e+n,t+c*v,e+n,t+r-c*v,v,v,f,e+n-u*v,t+r,e+u*v,t+r,v,v,f,e,t+r-c*v)}else d=Ut(GS||(GS=ii(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return d},ek={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},qA=e=>{var t=Gt(e,ek),n=h.useRef(null),[r,i]=h.useState(-1);h.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var K=n.current.getTotalLength();K&&i(K)}catch{}},[]);var{x:a,y:l,width:s,height:c,radius:u,className:f}=t,{animationEasing:d,animationDuration:p,animationBegin:m,isAnimationActive:g,isUpdateAnimationActive:y}=t,x=h.useRef(s),v=h.useRef(c),b=h.useRef(a),w=h.useRef(l),S=h.useMemo(()=>({x:a,y:l,width:s,height:c,radius:u}),[a,l,s,c,u]),C=vs(S,"rectangle-");if(a!==+a||l!==+l||s!==+s||c!==+c||s===0||c===0)return null;var j=nt("recharts-rectangle",f);if(!y){var E=Mn(t),{radius:O}=E,R=JS(E,c9);return h.createElement("path",Jf({},R,{x:ba(a),y:ba(l),width:ba(s),height:ba(c),radius:typeof u=="number"?u:void 0,className:j,d:ZS(a,l,s,c,u)}))}var A=x.current,N=v.current,_=b.current,q=w.current,W="0px ".concat(r===-1?1:r,"px"),I="".concat(r,"px ").concat(r,"px"),F=WA(["strokeDasharray"],p,typeof d=="string"?d:ek.animationEasing);return h.createElement(gs,{animationId:C,key:C,canBegin:r>0,duration:p,easing:d,isActive:y,begin:m},K=>{var M=ct(A,s,K),B=ct(N,c,K),k=ct(_,a,K),L=ct(q,l,K);n.current&&(x.current=M,v.current=B,b.current=k,w.current=L);var Q;g?K>0?Q={transition:F,strokeDasharray:I}:Q={strokeDasharray:W}:Q={strokeDasharray:I};var T=Mn(t),{radius:ce}=T,ve=JS(T,u9);return h.createElement("path",Jf({},ve,{radius:typeof u=="number"?u:void 0,className:j,d:ZS(k,L,M,B,u),ref:n,style:QS(QS({},Q),t.style)}))})};function tk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function nk(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tk(Object(n),!0).forEach(function(r){m9(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function m9(e,t,n){return(t=g9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g9(e){var t=v9(e,"string");return typeof t=="symbol"?t:t+""}function v9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Zf=Math.PI/180,y9=e=>e*180/Math.PI,en=(e,t,n,r)=>({x:e+Math.cos(-Zf*r)*n,y:t+Math.sin(-Zf*r)*n}),YA=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},x9=(e,t)=>{var{x:n,y:r}=e,{x:i,y:a}=t;return Math.sqrt((n-i)**2+(r-a)**2)},b9=(e,t)=>{var{x:n,y:r}=e,{cx:i,cy:a}=t,l=x9({x:n,y:r},{x:i,y:a});if(l<=0)return{radius:l,angle:0};var s=(n-i)/l,c=Math.acos(s);return r>a&&(c=2*Math.PI-c),{radius:l,angle:y9(c),angleInRadian:c}},w9=e=>{var{startAngle:t,endAngle:n}=e,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-a*360,endAngle:n-a*360}},j9=(e,t)=>{var{startAngle:n,endAngle:r}=t,i=Math.floor(n/360),a=Math.floor(r/360),l=Math.min(i,a);return e+l*360},S9=(e,t)=>{var{relativeX:n,relativeY:r}=e,{radius:i,angle:a}=b9({x:n,y:r},t),{innerRadius:l,outerRadius:s}=t;if(i<l||i>s||i===0)return null;var{startAngle:c,endAngle:u}=w9(t),f=a,d;if(c<=u){for(;f>u;)f-=360;for(;f<c;)f+=360;d=f>=c&&f<=u}else{for(;f>c;)f-=360;for(;f<u;)f+=360;d=f>=u&&f<=c}return d?nk(nk({},t),{},{radius:i,angle:j9(f,t)}):null};function GA(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:a}=e,l=en(t,n,r,i),s=en(t,n,r,a);return{points:[l,s],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}var rk,ik,ak,ok,lk,sk,ck;function py(){return py=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},py.apply(null,arguments)}function yo(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var k9=(e,t)=>{var n=mn(t-e),r=Math.min(Math.abs(t-e),359.999);return n*r},wd=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:a,isExternal:l,cornerRadius:s,cornerIsExternal:c}=e,u=s*(l?1:-1)+r,f=Math.asin(s/u)/Zf,d=c?i:i+a*f,p=en(t,n,u,d),m=en(t,n,r,d),g=c?i-a*f:i,y=en(t,n,u*Math.cos(f*Zf),g);return{center:p,circleTangency:m,lineTangency:y,theta:f}},XA=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:l}=e,s=k9(a,l),c=a+s,u=en(t,n,i,a),f=en(t,n,i,c),d=Ut(rk||(rk=yo(["M ",",",`
436
+ A `,",",`,0,
437
+ `,",",`,
438
+ `,",",`
439
+ `])),u.x,u.y,i,i,+(Math.abs(s)>180),+(a>c),f.x,f.y);if(r>0){var p=en(t,n,r,a),m=en(t,n,r,c);d+=Ut(ik||(ik=yo(["L ",",",`
440
+ A `,",",`,0,
441
+ `,",",`,
442
+ `,","," Z"])),m.x,m.y,r,r,+(Math.abs(s)>180),+(a<=c),p.x,p.y)}else d+=Ut(ak||(ak=yo(["L ",","," Z"])),t,n);return d},C9=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:a,forceCornerRadius:l,cornerIsExternal:s,startAngle:c,endAngle:u}=e,f=mn(u-c),{circleTangency:d,lineTangency:p,theta:m}=wd({cx:t,cy:n,radius:i,angle:c,sign:f,cornerRadius:a,cornerIsExternal:s}),{circleTangency:g,lineTangency:y,theta:x}=wd({cx:t,cy:n,radius:i,angle:u,sign:-f,cornerRadius:a,cornerIsExternal:s}),v=s?Math.abs(c-u):Math.abs(c-u)-m-x;if(v<0)return l?Ut(ok||(ok=yo(["M ",",",`
443
+ a`,",",",0,0,1,",`,0
444
+ a`,",",",0,0,1,",`,0
445
+ `])),p.x,p.y,a,a,a*2,a,a,-a*2):XA({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:u});var b=Ut(lk||(lk=yo(["M ",",",`
446
+ A`,",",",0,0,",",",",",`
447
+ A`,",",",0,",",",",",",",`
448
+ A`,",",",0,0,",",",",",`
449
+ `])),p.x,p.y,a,a,+(f<0),d.x,d.y,i,i,+(v>180),+(f<0),g.x,g.y,a,a,+(f<0),y.x,y.y);if(r>0){var{circleTangency:w,lineTangency:S,theta:C}=wd({cx:t,cy:n,radius:r,angle:c,sign:f,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),{circleTangency:j,lineTangency:E,theta:O}=wd({cx:t,cy:n,radius:r,angle:u,sign:-f,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),R=s?Math.abs(c-u):Math.abs(c-u)-C-O;if(R<0&&a===0)return"".concat(b,"L").concat(t,",").concat(n,"Z");b+=Ut(sk||(sk=yo(["L",",",`
450
+ A`,",",",0,0,",",",",",`
451
+ A`,",",",0,",",",",",",",`
452
+ A`,",",",0,0,",",",",","Z"])),E.x,E.y,a,a,+(f<0),j.x,j.y,r,r,+(R>180),+(f>0),w.x,w.y,a,a,+(f<0),S.x,S.y)}else b+=Ut(ck||(ck=yo(["L",",","Z"])),t,n);return b},P9={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},QA=e=>{var t=Gt(e,P9),{cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:l,forceCornerRadius:s,cornerIsExternal:c,startAngle:u,endAngle:f,className:d}=t;if(a<i||u===f)return null;var p=nt("recharts-sector",d),m=a-i,g=Nn(l,m,0,!0),y;return g>0&&Math.abs(u-f)<360?y=C9({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(g,m/2),forceCornerRadius:s,cornerIsExternal:c,startAngle:u,endAngle:f}):y=XA({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:u,endAngle:f}),h.createElement("path",py({},Mn(t),{className:p,d:y}))};function E9(e,t,n){if(e==="horizontal")return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e==="vertical")return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(jO(t)){if(e==="centric"){var{cx:r,cy:i,innerRadius:a,outerRadius:l,angle:s}=t,c=en(r,i,a,s),u=en(r,i,l,s);return[{x:c.x,y:c.y},{x:u.x,y:u.y}]}return GA(t)}}function T9(e){return FO(e)?NaN:Number(e)}function rg(e){return e?(e=T9(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}function JA(e,t,n){n&&typeof n!="number"&&Kv(e,t,n)&&(t=n=void 0),e=rg(e),t===void 0?(t=e,e=0):t=rg(t),n=n===void 0?e<t?1:-1:rg(n);const r=Math.max(Math.ceil((t-e)/(n||1)),0),i=new Array(r);for(let a=0;a<r;a++)i[a]=e,e+=n;return i}var Zr=e=>e.chartData,Su=H([Zr],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),ku=(e,t,n,r)=>r?Su(e):Zr(e),ZA=(e,t,n)=>n?Su(e):Zr(e),O9=H([ku],e=>{var{chartData:t,dataStartIndex:n,dataEndIndex:r}=e;return t!=null?t.slice(n,r+1):[]}),A9=H([Su],e=>{var{chartData:t,dataStartIndex:n,dataEndIndex:r}=e;return t!=null?t.slice(n,r+1):[]}),I9=H([Zr],e=>{var{chartData:t,dataStartIndex:n,dataEndIndex:r}=e;return t!=null?t.slice(n,r+1):[]});function vi(e){if(Array.isArray(e)&&e.length===2){var[t,n]=e;if(He(t)&&He(n))return!0}return!1}function uk(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function eI(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[n,r]=e,i,a;if(He(n))i=n;else if(typeof n=="function")return;if(He(r))a=r;else if(typeof r=="function")return;var l=[i,a];if(vi(l))return l}}function N9(e,t,n){if(!(!n&&t==null)){if(typeof e=="function"&&t!=null)try{var r=e(t,n);if(vi(r))return uk(r,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var[i,a]=e,l,s;if(i==="auto")t!=null&&(l=Math.min(...t));else if(xe(i))l=i;else if(typeof i=="function")try{t!=null&&(l=i(t==null?void 0:t[0]))}catch{}else if(typeof i=="string"&&cS.test(i)){var c=cS.exec(i);if(c==null||c[1]==null||t==null)l=void 0;else{var u=+c[1];l=t[0]-u}}else l=t==null?void 0:t[0];if(a==="auto")t!=null&&(s=Math.max(...t));else if(xe(a))s=a;else if(typeof a=="function")try{t!=null&&(s=a(t==null?void 0:t[1]))}catch{}else if(typeof a=="string"&&uS.test(a)){var f=uS.exec(a);if(f==null||f[1]==null||t==null)s=void 0;else{var d=+f[1];s=t[1]+d}}else s=t==null?void 0:t[1];var p=[l,s];if(vi(p))return t==null?p:uk(p,t,n)}}}var ys=1e9,_9={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},S0,It=!0,Mr="[DecimalError] ",Po=Mr+"Invalid argument: ",j0=Mr+"Exponent out of range: ",xs=Math.floor,uo=Math.pow,M9=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,sr,pn=1e7,Pt=7,tI=9007199254740991,ep=xs(tI/Pt),Ce={};Ce.absoluteValue=Ce.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};Ce.comparedTo=Ce.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=r<i?r:i;t<n;++t)if(a.d[t]!==e.d[t])return a.d[t]>e.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1};Ce.decimalPlaces=Ce.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*Pt;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};Ce.dividedBy=Ce.div=function(e){return $i(this,new this.constructor(e))};Ce.dividedToIntegerBy=Ce.idiv=function(e){var t=this,n=t.constructor;return yt($i(t,new n(e),0,1),n.precision)};Ce.equals=Ce.eq=function(e){return!this.cmp(e)};Ce.exponent=function(){return tn(this)};Ce.greaterThan=Ce.gt=function(e){return this.cmp(e)>0};Ce.greaterThanOrEqualTo=Ce.gte=function(e){return this.cmp(e)>=0};Ce.isInteger=Ce.isint=function(){return this.e>this.d.length-2};Ce.isNegative=Ce.isneg=function(){return this.s<0};Ce.isPositive=Ce.ispos=function(){return this.s>0};Ce.isZero=function(){return this.s===0};Ce.lessThan=Ce.lt=function(e){return this.cmp(e)<0};Ce.lessThanOrEqualTo=Ce.lte=function(e){return this.cmp(e)<1};Ce.logarithm=Ce.log=function(e){var t,n=this,r=n.constructor,i=r.precision,a=i+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(sr))throw Error(Mr+"NaN");if(n.s<1)throw Error(Mr+(n.s?"NaN":"-Infinity"));return n.eq(sr)?new r(0):(It=!1,t=$i(Xc(n,a),Xc(e,a),a),It=!0,yt(t,i))};Ce.minus=Ce.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?iI(t,e):nI(t,(e.s=-e.s,e))};Ce.modulo=Ce.mod=function(e){var t,n=this,r=n.constructor,i=r.precision;if(e=new r(e),!e.s)throw Error(Mr+"NaN");return n.s?(It=!1,t=$i(n,e,0,1).times(e),It=!0,n.minus(t)):yt(new r(n),i)};Ce.naturalExponential=Ce.exp=function(){return rI(this)};Ce.naturalLogarithm=Ce.ln=function(){return Xc(this)};Ce.negated=Ce.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Ce.plus=Ce.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?nI(t,e):iI(t,(e.s=-e.s,e))};Ce.precision=Ce.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Po+e);if(t=tn(i)+1,r=i.d.length-1,n=r*Pt+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};Ce.squareRoot=Ce.sqrt=function(){var e,t,n,r,i,a,l,s=this,c=s.constructor;if(s.s<1){if(!s.s)return new c(0);throw Error(Mr+"NaN")}for(e=tn(s),It=!1,i=Math.sqrt(+s),i==0||i==1/0?(t=hi(s.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=xs((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(i.toString()),n=c.precision,i=l=n+3;;)if(a=r,r=a.plus($i(s,a,l+2)).times(.5),hi(a.d).slice(0,l)===(t=hi(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),i==l&&t=="4999"){if(yt(a,n+1,0),a.times(a).eq(s)){r=a;break}}else if(t!="9999")break;l+=4}return It=!0,yt(r,n)};Ce.times=Ce.mul=function(e){var t,n,r,i,a,l,s,c,u,f=this,d=f.constructor,p=f.d,m=(e=new d(e)).d;if(!f.s||!e.s)return new d(0);for(e.s*=f.s,n=f.e+e.e,c=p.length,u=m.length,c<u&&(a=p,p=m,m=a,l=c,c=u,u=l),a=[],l=c+u,r=l;r--;)a.push(0);for(r=u;--r>=0;){for(t=0,i=c+r;i>r;)s=a[i]+m[r]*p[i-r-1]+t,a[i--]=s%pn|0,t=s/pn|0;a[i]=(a[i]+t)%pn|0}for(;!a[--l];)a.pop();return t?++n:a.shift(),e.d=a,e.e=n,It?yt(e,d.precision):e};Ce.toDecimalPlaces=Ce.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(Si(e,0,ys),t===void 0?t=r.rounding:Si(t,0,8),yt(n,e+tn(n)+1,t))};Ce.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=Bo(r,!0):(Si(e,0,ys),t===void 0?t=i.rounding:Si(t,0,8),r=yt(new i(r),e+1,t),n=Bo(r,!0,e+1)),n};Ce.toFixed=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?Bo(i):(Si(e,0,ys),t===void 0?t=a.rounding:Si(t,0,8),r=yt(new a(i),e+tn(i)+1,t),n=Bo(r.abs(),!1,e+tn(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};Ce.toInteger=Ce.toint=function(){var e=this,t=e.constructor;return yt(new t(e),tn(e)+1,t.rounding)};Ce.toNumber=function(){return+this};Ce.toPower=Ce.pow=function(e){var t,n,r,i,a,l,s=this,c=s.constructor,u=12,f=+(e=new c(e));if(!e.s)return new c(sr);if(s=new c(s),!s.s){if(e.s<1)throw Error(Mr+"Infinity");return s}if(s.eq(sr))return s;if(r=c.precision,e.eq(sr))return yt(s,r);if(t=e.e,n=e.d.length-1,l=t>=n,a=s.s,l){if((n=f<0?-f:f)<=tI){for(i=new c(sr),t=Math.ceil(r/Pt+4),It=!1;n%2&&(i=i.times(s),fk(i.d,t)),n=xs(n/2),n!==0;)s=s.times(s),fk(s.d,t);return It=!0,e.s<0?new c(sr).div(i):yt(i,r)}}else if(a<0)throw Error(Mr+"NaN");return a=a<0&&e.d[Math.max(t,n)]&1?-1:1,s.s=1,It=!1,i=e.times(Xc(s,r+u)),It=!0,i=rI(i),i.s=a,i};Ce.toPrecision=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?(n=tn(i),r=Bo(i,n<=a.toExpNeg||n>=a.toExpPos)):(Si(e,1,ys),t===void 0?t=a.rounding:Si(t,0,8),i=yt(new a(i),e,t),n=tn(i),r=Bo(i,e<=n||n<=a.toExpNeg,e)),r};Ce.toSignificantDigits=Ce.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(Si(e,1,ys),t===void 0?t=r.rounding:Si(t,0,8)),yt(new r(n),e,t)};Ce.toString=Ce.valueOf=Ce.val=Ce.toJSON=Ce[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=tn(e),n=e.constructor;return Bo(e,t<=n.toExpNeg||t>=n.toExpPos)};function nI(e,t){var n,r,i,a,l,s,c,u,f=e.constructor,d=f.precision;if(!e.s||!t.s)return t.s||(t=new f(e)),It?yt(t,d):t;if(c=e.d,u=t.d,l=e.e,i=t.e,c=c.slice(),a=l-i,a){for(a<0?(r=c,a=-a,s=u.length):(r=u,i=l,s=c.length),l=Math.ceil(d/Pt),s=l>s?l+1:s+1,a>s&&(a=s,r.length=1),r.reverse();a--;)r.push(0);r.reverse()}for(s=c.length,a=u.length,s-a<0&&(a=s,r=u,u=c,c=r),n=0;a;)n=(c[--a]=c[a]+u[a]+n)/pn|0,c[a]%=pn;for(n&&(c.unshift(n),++i),s=c.length;c[--s]==0;)c.pop();return t.d=c,t.e=i,It?yt(t,d):t}function Si(e,t,n){if(e!==~~e||e<t||e>n)throw Error(Po+e)}function hi(e){var t,n,r,i=e.length-1,a="",l=e[0];if(i>0){for(a+=l,t=1;t<i;t++)r=e[t]+"",n=Pt-r.length,n&&(a+=fa(n)),a+=r;l=e[t],r=l+"",n=Pt-r.length,n&&(a+=fa(n))}else if(l===0)return"0";for(;l%10===0;)l/=10;return a+l}var $i=function(){function e(r,i){var a,l=0,s=r.length;for(r=r.slice();s--;)a=r[s]*i+l,r[s]=a%pn|0,l=a/pn|0;return l&&r.unshift(l),r}function t(r,i,a,l){var s,c;if(a!=l)c=a>l?1:-1;else for(s=c=0;s<a;s++)if(r[s]!=i[s]){c=r[s]>i[s]?1:-1;break}return c}function n(r,i,a){for(var l=0;a--;)r[a]-=l,l=r[a]<i[a]?1:0,r[a]=l*pn+r[a]-i[a];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,a,l){var s,c,u,f,d,p,m,g,y,x,v,b,w,S,C,j,E,O,R=r.constructor,A=r.s==i.s?1:-1,N=r.d,_=i.d;if(!r.s)return new R(r);if(!i.s)throw Error(Mr+"Division by zero");for(c=r.e-i.e,E=_.length,C=N.length,m=new R(A),g=m.d=[],u=0;_[u]==(N[u]||0);)++u;if(_[u]>(N[u]||0)&&--c,a==null?b=a=R.precision:l?b=a+(tn(r)-tn(i))+1:b=a,b<0)return new R(0);if(b=b/Pt+2|0,u=0,E==1)for(f=0,_=_[0],b++;(u<C||f)&&b--;u++)w=f*pn+(N[u]||0),g[u]=w/_|0,f=w%_|0;else{for(f=pn/(_[0]+1)|0,f>1&&(_=e(_,f),N=e(N,f),E=_.length,C=N.length),S=E,y=N.slice(0,E),x=y.length;x<E;)y[x++]=0;O=_.slice(),O.unshift(0),j=_[0],_[1]>=pn/2&&++j;do f=0,s=t(_,y,E,x),s<0?(v=y[0],E!=x&&(v=v*pn+(y[1]||0)),f=v/j|0,f>1?(f>=pn&&(f=pn-1),d=e(_,f),p=d.length,x=y.length,s=t(d,y,p,x),s==1&&(f--,n(d,E<p?O:_,p))):(f==0&&(s=f=1),d=_.slice()),p=d.length,p<x&&d.unshift(0),n(y,d,x),s==-1&&(x=y.length,s=t(_,y,E,x),s<1&&(f++,n(y,E<x?O:_,x))),x=y.length):s===0&&(f++,y=[0]),g[u++]=f,s&&y[0]?y[x++]=N[S]||0:(y=[N[S]],x=1);while((S++<C||y[0]!==void 0)&&b--)}return g[0]||g.shift(),m.e=c,yt(m,l?a+tn(m)+1:a)}}();function rI(e,t){var n,r,i,a,l,s,c=0,u=0,f=e.constructor,d=f.precision;if(tn(e)>16)throw Error(j0+tn(e));if(!e.s)return new f(sr);for(It=!1,s=d,l=new f(.03125);e.abs().gte(.1);)e=e.times(l),u+=5;for(r=Math.log(uo(2,u))/Math.LN10*2+5|0,s+=r,n=i=a=new f(sr),f.precision=s;;){if(i=yt(i.times(e),s),n=n.times(++c),l=a.plus($i(i,n,s)),hi(l.d).slice(0,s)===hi(a.d).slice(0,s)){for(;u--;)a=yt(a.times(a),s);return f.precision=d,t==null?(It=!0,yt(a,d)):a}a=l}}function tn(e){for(var t=e.e*Pt,n=e.d[0];n>=10;n/=10)t++;return t}function ig(e,t,n){if(t>e.LN10.sd())throw It=!0,n&&(e.precision=n),Error(Mr+"LN10 precision limit exceeded");return yt(new e(e.LN10),t)}function fa(e){for(var t="";e--;)t+="0";return t}function Xc(e,t){var n,r,i,a,l,s,c,u,f,d=1,p=10,m=e,g=m.d,y=m.constructor,x=y.precision;if(m.s<1)throw Error(Mr+(m.s?"NaN":"-Infinity"));if(m.eq(sr))return new y(0);if(t==null?(It=!1,u=x):u=t,m.eq(10))return t==null&&(It=!0),ig(y,u);if(u+=p,y.precision=u,n=hi(g),r=n.charAt(0),a=tn(m),Math.abs(a)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)m=m.times(e),n=hi(m.d),r=n.charAt(0),d++;a=tn(m),r>1?(m=new y("0."+n),a++):m=new y(r+"."+n.slice(1))}else return c=ig(y,u+2,x).times(a+""),m=Xc(new y(r+"."+n.slice(1)),u-p).plus(c),y.precision=x,t==null?(It=!0,yt(m,x)):m;for(s=l=m=$i(m.minus(sr),m.plus(sr),u),f=yt(m.times(m),u),i=3;;){if(l=yt(l.times(f),u),c=s.plus($i(l,new y(i),u)),hi(c.d).slice(0,u)===hi(s.d).slice(0,u))return s=s.times(2),a!==0&&(s=s.plus(ig(y,u+2,x).times(a+""))),s=$i(s,new y(d),u),y.precision=x,t==null?(It=!0,yt(s,x)):s;s=c,i+=2}}function dk(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(r,i),t){if(i-=r,n=n-r-1,e.e=xs(n/Pt),e.d=[],r=(n+1)%Pt,n<0&&(r+=Pt),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=Pt;r<i;)e.d.push(+t.slice(r,r+=Pt));t=t.slice(r),r=Pt-t.length}else r-=i;for(;r--;)t+="0";if(e.d.push(+t),It&&(e.e>ep||e.e<-ep))throw Error(j0+n)}else e.s=0,e.e=0,e.d=[0];return e}function yt(e,t,n){var r,i,a,l,s,c,u,f,d=e.d;for(l=1,a=d[0];a>=10;a/=10)l++;if(r=t-l,r<0)r+=Pt,i=t,u=d[f=0];else{if(f=Math.ceil((r+1)/Pt),a=d.length,f>=a)return e;for(u=a=d[f],l=1;a>=10;a/=10)l++;r%=Pt,i=r-Pt+l}if(n!==void 0&&(a=uo(10,l-i-1),s=u/a%10|0,c=t<0||d[f+1]!==void 0||u%a,c=n<4?(s||c)&&(n==0||n==(e.s<0?3:2)):s>5||s==5&&(n==4||c||n==6&&(r>0?i>0?u/uo(10,l-i):0:d[f-1])%10&1||n==(e.s<0?8:7))),t<1||!d[0])return c?(a=tn(e),d.length=1,t=t-a-1,d[0]=uo(10,(Pt-t%Pt)%Pt),e.e=xs(-t/Pt)||0):(d.length=1,d[0]=e.e=e.s=0),e;if(r==0?(d.length=f,a=1,f--):(d.length=f+1,a=uo(10,Pt-r),d[f]=i>0?(u/uo(10,l-i)%uo(10,i)|0)*a:0),c)for(;;)if(f==0){(d[0]+=a)==pn&&(d[0]=1,++e.e);break}else{if(d[f]+=a,d[f]!=pn)break;d[f--]=0,a=1}for(r=d.length;d[--r]===0;)d.pop();if(It&&(e.e>ep||e.e<-ep))throw Error(j0+tn(e));return e}function iI(e,t){var n,r,i,a,l,s,c,u,f,d,p=e.constructor,m=p.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new p(e),It?yt(t,m):t;if(c=e.d,d=t.d,r=t.e,u=e.e,c=c.slice(),l=u-r,l){for(f=l<0,f?(n=c,l=-l,s=d.length):(n=d,r=u,s=c.length),i=Math.max(Math.ceil(m/Pt),s)+2,l>i&&(l=i,n.length=1),n.reverse(),i=l;i--;)n.push(0);n.reverse()}else{for(i=c.length,s=d.length,f=i<s,f&&(s=i),i=0;i<s;i++)if(c[i]!=d[i]){f=c[i]<d[i];break}l=0}for(f&&(n=c,c=d,d=n,t.s=-t.s),s=c.length,i=d.length-s;i>0;--i)c[s++]=0;for(i=d.length;i>l;){if(c[--i]<d[i]){for(a=i;a&&c[--a]===0;)c[a]=pn-1;--c[a],c[i]+=pn}c[i]-=d[i]}for(;c[--s]===0;)c.pop();for(;c[0]===0;c.shift())--r;return c[0]?(t.d=c,t.e=r,It?yt(t,m):t):new p(0)}function Bo(e,t,n){var r,i=tn(e),a=hi(e.d),l=a.length;return t?(n&&(r=n-l)>0?a=a.charAt(0)+"."+a.slice(1)+fa(r):l>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+fa(-i-1)+a,n&&(r=n-l)>0&&(a+=fa(r))):i>=l?(a+=fa(i+1-l),n&&(r=n-i-1)>0&&(a=a+"."+fa(r))):((r=i+1)<l&&(a=a.slice(0,r)+"."+a.slice(r)),n&&(r=n-l)>0&&(i+1===l&&(a+="."),a+=fa(r))),e.s<0?"-"+a:a}function fk(e,t){if(e.length>t)return e.length=t,!0}function aI(e){var t,n,r;function i(a){var l=this;if(!(l instanceof i))return new i(a);if(l.constructor=i,a instanceof i){l.s=a.s,l.e=a.e,l.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(Po+a);if(a>0)l.s=1;else if(a<0)a=-a,l.s=-1;else{l.s=0,l.e=0,l.d=[0];return}if(a===~~a&&a<1e7){l.e=0,l.d=[a];return}return dk(l,a.toString())}else if(typeof a!="string")throw Error(Po+a);if(a.charCodeAt(0)===45?(a=a.slice(1),l.s=-1):l.s=1,M9.test(a))dk(l,a);else throw Error(Po+a)}if(i.prototype=Ce,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=aI,i.config=i.set=R9,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<r.length;)e.hasOwnProperty(n=r[t++])||(e[n]=this[n]);return i.config(e),i}function R9(e){if(!e||typeof e!="object")throw Error(Mr+"Object expected");var t,n,r,i=["precision",1,ys,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<i.length;t+=3)if((r=e[n=i[t]])!==void 0)if(xs(r)===r&&r>=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(Po+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Po+n+": "+r);return this}var S0=aI(_9);sr=new S0(1);const Je=S0;function oI(e){var t;return e===0?t=1:t=Math.floor(new Je(e).abs().log(10).toNumber())+1,t}function lI(e,t,n){for(var r=new Je(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var sI=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},k0=(e,t,n)=>{if(e.lte(0))return new Je(0);var r=oI(e.toNumber()),i=new Je(10).pow(r),a=e.div(i),l=r!==1?.05:.1,s=new Je(Math.ceil(a.div(l).toNumber())).add(n).mul(l),c=s.mul(i);return t?new Je(c.toNumber()):new Je(Math.ceil(c.toNumber()))},cI=(e,t,n)=>{var r;if(e.lte(0))return new Je(0);var i=[1,2,2.5,5],a=e.toNumber(),l=Math.floor(new Je(a).abs().log(10).toNumber()),s=new Je(10).pow(l),c=e.div(s).toNumber(),u=i.findIndex(m=>m>=c-1e-10);if(u===-1&&(s=s.mul(10),u=0),u+=n,u>=i.length){var f=Math.floor(u/i.length);u%=i.length,s=s.mul(new Je(10).pow(f))}var d=(r=i[u])!==null&&r!==void 0?r:1,p=new Je(d).mul(s);return t?p:new Je(Math.ceil(p.toNumber()))},D9=(e,t,n)=>{var r=new Je(1),i=new Je(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new Je(10).pow(oI(e)-1),i=new Je(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new Je(Math.floor(e)))}else e===0?i=new Je(Math.floor((t-1)/2)):n||(i=new Je(Math.floor(e)));for(var l=Math.floor((t-1)/2),s=[],c=0;c<t;c++)s.push(i.add(new Je(c-l).mul(r)).toNumber());return s},uI=function(t,n,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:k0;if(!Number.isFinite((n-t)/(r-1)))return{step:new Je(0),tickMin:new Je(0),tickMax:new Je(0)};var s=l(new Je(n).sub(t).div(r-1),i,a),c;t<=0&&n>=0?c=new Je(0):(c=new Je(t).add(n).div(2),c=c.sub(new Je(c).mod(s)));var u=Math.ceil(c.sub(t).div(s).toNumber()),f=Math.ceil(new Je(n).sub(c).div(s).toNumber()),d=u+f+1;return d>r?uI(t,n,r,i,a+1,l):(d<r&&(f=n>0?f+(r-d):f,u=n>0?u:u+(r-d)),{step:s,tickMin:c.sub(new Je(u).mul(s)),tickMax:c.add(new Je(f).mul(s))})},pk=function(t){var[n,r]=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",s=Math.max(i,2),[c,u]=sI([n,r]);if(c===-1/0||u===1/0){var f=u===1/0?[c,...Array(i-1).fill(1/0)]:[...Array(i-1).fill(-1/0),u];return n>r?f.reverse():f}if(c===u)return D9(c,i,a);var d=l==="snap125"?cI:k0,{step:p,tickMin:m,tickMax:g}=uI(c,u,s,a,0,d),y=lI(m,g.add(new Je(.1).mul(p)),p);return n>r?y.reverse():y},hk=function(t,n){var[r,i]=t,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",[s,c]=sI([r,i]);if(s===-1/0||c===1/0)return[r,i];if(s===c)return[s];var u=l==="snap125"?cI:k0,f=Math.max(n,2),d=u(new Je(c).sub(s).div(f-1),a,0),p=[...lI(new Je(s),new Je(c),d),c];return a===!1&&(p=p.map(m=>Math.round(m))),r>i?p.reverse():p},dI=e=>e.rootProps.maxBarSize,L9=e=>e.rootProps.barGap,fI=e=>e.rootProps.barCategoryGap,z9=e=>e.rootProps.barSize,Cu=e=>e.rootProps.stackOffset,pI=e=>e.rootProps.reverseStackOrder,C0=e=>e.options.chartName,P0=e=>e.rootProps.syncId,hI=e=>e.rootProps.syncMethod,E0=e=>e.options.eventEmitter,$9=e=>e.rootProps.baseValue,Yt={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},no={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},ai={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},bh=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function wh(e,t,n){if(n!=="auto")return n;if(e!=null)return Jr(e,t)?"category":"number"}function mk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function tp(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?mk(Object(n),!0).forEach(function(r){B9(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function B9(e,t,n){return(t=F9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F9(e){var t=U9(e,"string");return typeof t=="symbol"?t:t+""}function U9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var gk={allowDataOverflow:no.allowDataOverflow,allowDecimals:no.allowDecimals,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:no.angleAxisId,includeHidden:!1,name:void 0,reversed:no.reversed,scale:no.scale,tick:no.tick,tickCount:void 0,ticks:void 0,type:no.type,unit:void 0,niceTicks:"auto"},vk={allowDataOverflow:ai.allowDataOverflow,allowDecimals:ai.allowDecimals,allowDuplicatedCategory:ai.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:ai.radiusAxisId,includeHidden:ai.includeHidden,name:void 0,reversed:ai.reversed,scale:ai.scale,tick:ai.tick,tickCount:ai.tickCount,ticks:void 0,type:ai.type,unit:void 0,niceTicks:"auto"},W9=(e,t)=>{if(t!=null)return e.polarAxis.angleAxis[t]},T0=H([W9,AA],(e,t)=>{var n;if(e!=null)return e;var r=(n=wh(t,"angleAxis",gk.type))!==null&&n!==void 0?n:"category";return tp(tp({},gk),{},{type:r})}),K9=(e,t)=>e.polarAxis.radiusAxis[t],O0=H([K9,AA],(e,t)=>{var n;if(e!=null)return e;var r=(n=wh(t,"radiusAxis",vk.type))!==null&&n!==void 0?n:"category";return tp(tp({},vk),{},{type:r})}),jh=e=>e.polarOptions,A0=H([Ji,Zi,cn],YA),mI=H([jh,A0],(e,t)=>{if(e!=null)return Nn(e.innerRadius,t,0)}),gI=H([jh,A0],(e,t)=>{if(e!=null)return Nn(e.outerRadius,t,t*.8)}),H9=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]},vI=H([jh],H9);H([T0,vI],bh);var yI=H([A0,mI,gI],(e,t,n)=>{if(!(e==null||t==null||n==null))return[t,n]});H([O0,yI],bh);var xI=H([Ze,jh,mI,gI,Ji,Zi],(e,t,n,r,i,a)=>{if(!(e!=="centric"&&e!=="radial"||t==null||n==null||r==null)){var{cx:l,cy:s,startAngle:c,endAngle:u}=t;return{cx:Nn(l,i,i/2),cy:Nn(s,a,a/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:u,clockWise:!1}}}),$t=(e,t)=>t,Pu=(e,t,n)=>n;function Sh(e){return e==null?void 0:e.id}function bI(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=n,l=new Map;return e.forEach(s=>{var c,u=(c=s.data)!==null&&c!==void 0?c:r;if(!(u==null||u.length===0)){var f=Sh(s);u.forEach((d,p)=>{var m=a==null||i?p:String(at(d,a,null)),g=at(d,s.dataKey,0),y;l.has(m)?y=l.get(m):y={},Object.assign(y,{[f]:g}),l.set(m,y)})}}),Array.from(l.values())}function kh(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var Ch=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function Ph(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function V9(e,t){if(e.length===t.length){for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return!1}var yn=e=>{var t=Ze(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},bs=e=>e.tooltip.settings.axisId;function I0(e){if(e!=null){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(a){function l(){return a.apply(this,arguments)}return l.toString=function(){return a.toString()},l}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(a){var l=i[0],s=i[1];return l<=s?a>=l&&a<=s:a>=s&&a<=l},bandwidth:n?()=>n.call(e):void 0,ticks:t?a=>t.call(e,a):void 0,map:(a,l)=>{var s=e(a);if(s!=null){if(e.bandwidth&&l!==null&&l!==void 0&&l.position){var c=e.bandwidth();switch(l.position){case"middle":s+=c/2;break;case"end":s+=c;break}}return s}}}}}var wI=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!vi(t)){for(var n,r,i=0;i<t.length;i++){var a=t[i];He(a)&&((n===void 0||a<n)&&(n=a),(r===void 0||a>r)&&(r=a))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t}default:return t}};function Aa(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function q9(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function N0(e){let t,n,r;e.length!==2?(t=Aa,n=(s,c)=>Aa(e(s),c),r=(s,c)=>e(s)-c):(t=e===Aa||e===q9?e:Y9,n=e,r=e);function i(s,c,u=0,f=s.length){if(u<f){if(t(c,c)!==0)return f;do{const d=u+f>>>1;n(s[d],c)<0?u=d+1:f=d}while(u<f)}return u}function a(s,c,u=0,f=s.length){if(u<f){if(t(c,c)!==0)return f;do{const d=u+f>>>1;n(s[d],c)<=0?u=d+1:f=d}while(u<f)}return u}function l(s,c,u=0,f=s.length){const d=i(s,c,u,f-1);return d>u&&r(s[d-1],c)>-r(s[d],c)?d-1:d}return{left:i,center:l,right:a}}function Y9(){return 0}function jI(e){return e===null?NaN:+e}function*G9(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const X9=N0(Aa),Eu=X9.right;N0(jI).center;class yk extends Map{constructor(t,n=Z9){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(xk(this,t))}has(t){return super.has(xk(this,t))}set(t,n){return super.set(Q9(this,t),n)}delete(t){return super.delete(J9(this,t))}}function xk({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function Q9({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function J9({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function Z9(e){return e!==null&&typeof e=="object"?e.valueOf():e}function e7(e=Aa){if(e===Aa)return SI;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function SI(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const t7=Math.sqrt(50),n7=Math.sqrt(10),r7=Math.sqrt(2);function np(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),l=a>=t7?10:a>=n7?5:a>=r7?2:1;let s,c,u;return i<0?(u=Math.pow(10,-i)/l,s=Math.round(e*u),c=Math.round(t*u),s/u<e&&++s,c/u>t&&--c,u=-u):(u=Math.pow(10,i)*l,s=Math.round(e/u),c=Math.round(t/u),s*u<e&&++s,c*u>t&&--c),c<s&&.5<=n&&n<2?np(e,t,n*2):[s,c,u]}function hy(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const r=t<e,[i,a,l]=r?np(t,e,n):np(e,t,n);if(!(a>=i))return[];const s=a-i+1,c=new Array(s);if(r)if(l<0)for(let u=0;u<s;++u)c[u]=(a-u)/-l;else for(let u=0;u<s;++u)c[u]=(a-u)*l;else if(l<0)for(let u=0;u<s;++u)c[u]=(i+u)/-l;else for(let u=0;u<s;++u)c[u]=(i+u)*l;return c}function my(e,t,n){return t=+t,e=+e,n=+n,np(e,t,n)[2]}function gy(e,t,n){t=+t,e=+e,n=+n;const r=t<e,i=r?my(t,e,n):my(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function bk(e,t){let n;for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);return n}function wk(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function kI(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?SI:e7(i);r>n;){if(r-n>600){const c=r-n+1,u=t-n+1,f=Math.log(c),d=.5*Math.exp(2*f/3),p=.5*Math.sqrt(f*d*(c-d)/c)*(u-c/2<0?-1:1),m=Math.max(n,Math.floor(t-u*d/c+p)),g=Math.min(r,Math.floor(t+(c-u)*d/c+p));kI(e,t,m,g,i)}const a=e[t];let l=n,s=r;for(Ws(e,n,t),i(e[r],a)>0&&Ws(e,n,r);l<s;){for(Ws(e,l,s),++l,--s;i(e[l],a)<0;)++l;for(;i(e[s],a)>0;)--s}i(e[n],a)===0?Ws(e,n,s):(++s,Ws(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function Ws(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function i7(e,t,n){if(e=Float64Array.from(G9(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return wk(e);if(t>=1)return bk(e);var r,i=(r-1)*t,a=Math.floor(i),l=bk(kI(e,a).subarray(0,a+1)),s=wk(e.subarray(a+1));return l+(s-l)*(i-a)}}function a7(e,t,n=jI){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),l=+n(e[a],a,e),s=+n(e[a+1],a+1,e);return l+(s-l)*(i-a)}}function o7(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=new Array(i);++r<i;)a[r]=e+r*n;return a}function Rr(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function ea(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const vy=Symbol("implicit");function _0(){var e=new yk,t=[],n=[],r=vy;function i(a){let l=e.get(a);if(l===void 0){if(r!==vy)return r;e.set(a,l=t.push(a)-1)}return n[l%n.length]}return i.domain=function(a){if(!arguments.length)return t.slice();t=[],e=new yk;for(const l of a)e.has(l)||e.set(l,t.push(l)-1);return i},i.range=function(a){return arguments.length?(n=Array.from(a),i):n.slice()},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return _0(t,n).unknown(r)},Rr.apply(i,arguments),i}function M0(){var e=_0().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,a,l,s=!1,c=0,u=0,f=.5;delete e.unknown;function d(){var p=t().length,m=i<r,g=m?i:r,y=m?r:i;a=(y-g)/Math.max(1,p-c+u*2),s&&(a=Math.floor(a)),g+=(y-g-a*(p-c))*f,l=a*(1-c),s&&(g=Math.round(g),l=Math.round(l));var x=o7(p).map(function(v){return g+a*v});return n(m?x.reverse():x)}return e.domain=function(p){return arguments.length?(t(p),d()):t()},e.range=function(p){return arguments.length?([r,i]=p,r=+r,i=+i,d()):[r,i]},e.rangeRound=function(p){return[r,i]=p,r=+r,i=+i,s=!0,d()},e.bandwidth=function(){return l},e.step=function(){return a},e.round=function(p){return arguments.length?(s=!!p,d()):s},e.padding=function(p){return arguments.length?(c=Math.min(1,u=+p),d()):c},e.paddingInner=function(p){return arguments.length?(c=Math.min(1,p),d()):c},e.paddingOuter=function(p){return arguments.length?(u=+p,d()):u},e.align=function(p){return arguments.length?(f=Math.max(0,Math.min(1,p)),d()):f},e.copy=function(){return M0(t(),[r,i]).round(s).paddingInner(c).paddingOuter(u).align(f)},Rr.apply(d(),arguments)}function CI(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return CI(t())},e}function l7(){return CI(M0.apply(null,arguments).paddingInner(1))}function R0(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function PI(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Tu(){}var Qc=.7,rp=1/Qc,Fl="\\s*([+-]?\\d+)\\s*",Jc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",yi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",s7=/^#([0-9a-f]{3,8})$/,c7=new RegExp(`^rgb\\(${Fl},${Fl},${Fl}\\)$`),u7=new RegExp(`^rgb\\(${yi},${yi},${yi}\\)$`),d7=new RegExp(`^rgba\\(${Fl},${Fl},${Fl},${Jc}\\)$`),f7=new RegExp(`^rgba\\(${yi},${yi},${yi},${Jc}\\)$`),p7=new RegExp(`^hsl\\(${Jc},${yi},${yi}\\)$`),h7=new RegExp(`^hsla\\(${Jc},${yi},${yi},${Jc}\\)$`),jk={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};R0(Tu,Zc,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Sk,formatHex:Sk,formatHex8:m7,formatHsl:g7,formatRgb:kk,toString:kk});function Sk(){return this.rgb().formatHex()}function m7(){return this.rgb().formatHex8()}function g7(){return EI(this).formatHsl()}function kk(){return this.rgb().formatRgb()}function Zc(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=s7.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Ck(t):n===3?new er(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?jd(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?jd(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=c7.exec(e))?new er(t[1],t[2],t[3],1):(t=u7.exec(e))?new er(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=d7.exec(e))?jd(t[1],t[2],t[3],t[4]):(t=f7.exec(e))?jd(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=p7.exec(e))?Tk(t[1],t[2]/100,t[3]/100,1):(t=h7.exec(e))?Tk(t[1],t[2]/100,t[3]/100,t[4]):jk.hasOwnProperty(e)?Ck(jk[e]):e==="transparent"?new er(NaN,NaN,NaN,0):null}function Ck(e){return new er(e>>16&255,e>>8&255,e&255,1)}function jd(e,t,n,r){return r<=0&&(e=t=n=NaN),new er(e,t,n,r)}function v7(e){return e instanceof Tu||(e=Zc(e)),e?(e=e.rgb(),new er(e.r,e.g,e.b,e.opacity)):new er}function yy(e,t,n,r){return arguments.length===1?v7(e):new er(e,t,n,r??1)}function er(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}R0(er,yy,PI(Tu,{brighter(e){return e=e==null?rp:Math.pow(rp,e),new er(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Qc:Math.pow(Qc,e),new er(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new er(Eo(this.r),Eo(this.g),Eo(this.b),ip(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:Pk,formatHex:Pk,formatHex8:y7,formatRgb:Ek,toString:Ek}));function Pk(){return`#${xo(this.r)}${xo(this.g)}${xo(this.b)}`}function y7(){return`#${xo(this.r)}${xo(this.g)}${xo(this.b)}${xo((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ek(){const e=ip(this.opacity);return`${e===1?"rgb(":"rgba("}${Eo(this.r)}, ${Eo(this.g)}, ${Eo(this.b)}${e===1?")":`, ${e})`}`}function ip(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Eo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function xo(e){return e=Eo(e),(e<16?"0":"")+e.toString(16)}function Tk(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Hr(e,t,n,r)}function EI(e){if(e instanceof Hr)return new Hr(e.h,e.s,e.l,e.opacity);if(e instanceof Tu||(e=Zc(e)),!e)return new Hr;if(e instanceof Hr)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),l=NaN,s=a-i,c=(a+i)/2;return s?(t===a?l=(n-r)/s+(n<r)*6:n===a?l=(r-t)/s+2:l=(t-n)/s+4,s/=c<.5?a+i:2-a-i,l*=60):s=c>0&&c<1?0:l,new Hr(l,s,c,e.opacity)}function x7(e,t,n,r){return arguments.length===1?EI(e):new Hr(e,t,n,r??1)}function Hr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}R0(Hr,x7,PI(Tu,{brighter(e){return e=e==null?rp:Math.pow(rp,e),new Hr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Qc:Math.pow(Qc,e),new Hr(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new er(ag(e>=240?e-240:e+120,i,r),ag(e,i,r),ag(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Hr(Ok(this.h),Sd(this.s),Sd(this.l),ip(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=ip(this.opacity);return`${e===1?"hsl(":"hsla("}${Ok(this.h)}, ${Sd(this.s)*100}%, ${Sd(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ok(e){return e=(e||0)%360,e<0?e+360:e}function Sd(e){return Math.max(0,Math.min(1,e||0))}function ag(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 D0=e=>()=>e;function b7(e,t){return function(n){return e+n*t}}function w7(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function j7(e){return(e=+e)==1?TI:function(t,n){return n-t?w7(t,n,e):D0(isNaN(t)?n:t)}}function TI(e,t){var n=t-e;return n?b7(e,n):D0(isNaN(e)?t:e)}const Ak=function e(t){var n=j7(t);function r(i,a){var l=n((i=yy(i)).r,(a=yy(a)).r),s=n(i.g,a.g),c=n(i.b,a.b),u=TI(i.opacity,a.opacity);return function(f){return i.r=l(f),i.g=s(f),i.b=c(f),i.opacity=u(f),i+""}}return r.gamma=e,r}(1);function S7(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function k7(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function C7(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),a=new Array(n),l;for(l=0;l<r;++l)i[l]=ws(e[l],t[l]);for(;l<n;++l)a[l]=t[l];return function(s){for(l=0;l<r;++l)a[l]=i[l](s);return a}}function P7(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function ap(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function E7(e,t){var n={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=ws(e[i],t[i]):r[i]=t[i];return function(a){for(i in n)r[i]=n[i](a);return r}}var xy=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,og=new RegExp(xy.source,"g");function T7(e){return function(){return e}}function O7(e){return function(t){return e(t)+""}}function A7(e,t){var n=xy.lastIndex=og.lastIndex=0,r,i,a,l=-1,s=[],c=[];for(e=e+"",t=t+"";(r=xy.exec(e))&&(i=og.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[l]?s[l]+=a:s[++l]=a),(r=r[0])===(i=i[0])?s[l]?s[l]+=i:s[++l]=i:(s[++l]=null,c.push({i:l,x:ap(r,i)})),n=og.lastIndex;return n<t.length&&(a=t.slice(n),s[l]?s[l]+=a:s[++l]=a),s.length<2?c[0]?O7(c[0].x):T7(t):(t=c.length,function(u){for(var f=0,d;f<t;++f)s[(d=c[f]).i]=d.x(u);return s.join("")})}function ws(e,t){var n=typeof t,r;return t==null||n==="boolean"?D0(t):(n==="number"?ap:n==="string"?(r=Zc(t))?(t=r,Ak):A7:t instanceof Zc?Ak:t instanceof Date?P7:k7(t)?S7:Array.isArray(t)?C7:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?E7:ap)(e,t)}function L0(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function I7(e,t){t===void 0&&(t=e,e=ws);for(var n=0,r=t.length-1,i=t[0],a=new Array(r<0?0:r);n<r;)a[n]=e(i,i=t[++n]);return function(l){var s=Math.max(0,Math.min(r-1,Math.floor(l*=r)));return a[s](l-s)}}function N7(e){return function(){return e}}function op(e){return+e}var Ik=[0,1];function Fn(e){return e}function by(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:N7(isNaN(t)?NaN:.5)}function _7(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function M7(e,t,n){var r=e[0],i=e[1],a=t[0],l=t[1];return i<r?(r=by(i,r),a=n(l,a)):(r=by(r,i),a=n(a,l)),function(s){return a(r(s))}}function R7(e,t,n){var r=Math.min(e.length,t.length)-1,i=new Array(r),a=new Array(r),l=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++l<r;)i[l]=by(e[l],e[l+1]),a[l]=n(t[l],t[l+1]);return function(s){var c=Eu(e,s,1,r)-1;return a[c](i[c](s))}}function Ou(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Eh(){var e=Ik,t=Ik,n=ws,r,i,a,l=Fn,s,c,u;function f(){var p=Math.min(e.length,t.length);return l!==Fn&&(l=_7(e[0],e[p-1])),s=p>2?R7:M7,c=u=null,d}function d(p){return p==null||isNaN(p=+p)?a:(c||(c=s(e.map(r),t,n)))(r(l(p)))}return d.invert=function(p){return l(i((u||(u=s(t,e.map(r),ap)))(p)))},d.domain=function(p){return arguments.length?(e=Array.from(p,op),f()):e.slice()},d.range=function(p){return arguments.length?(t=Array.from(p),f()):t.slice()},d.rangeRound=function(p){return t=Array.from(p),n=L0,f()},d.clamp=function(p){return arguments.length?(l=p?!0:Fn,f()):l!==Fn},d.interpolate=function(p){return arguments.length?(n=p,f()):n},d.unknown=function(p){return arguments.length?(a=p,d):a},function(p,m){return r=p,i=m,f()}}function z0(){return Eh()(Fn,Fn)}function D7(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function lp(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function rs(e){return e=lp(Math.abs(e)),e?e[1]:NaN}function L7(e,t){return function(n,r){for(var i=n.length,a=[],l=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[l=(l+1)%e.length];return a.reverse().join(t)}}function z7(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var $7=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function eu(e){if(!(t=$7.exec(e)))throw new Error("invalid format: "+e);var t;return new $0({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}eu.prototype=$0.prototype;function $0(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}$0.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function B7(e){e:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+e[n])break e;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var sp;function F7(e,t){var n=lp(e,t);if(!n)return sp=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(sp=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,l=r.length;return a===l?r:a>l?r+new Array(a-l+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+lp(e,Math.max(0,t+a-1))[0]}function Nk(e,t){var n=lp(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const _k={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:D7,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Nk(e*100,t),r:Nk,s:F7,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Mk(e){return e}var Rk=Array.prototype.map,Dk=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function U7(e){var t=e.grouping===void 0||e.thousands===void 0?Mk:L7(Rk.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?Mk:z7(Rk.call(e.numerals,String)),l=e.percent===void 0?"%":e.percent+"",s=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(d,p){d=eu(d);var m=d.fill,g=d.align,y=d.sign,x=d.symbol,v=d.zero,b=d.width,w=d.comma,S=d.precision,C=d.trim,j=d.type;j==="n"?(w=!0,j="g"):_k[j]||(S===void 0&&(S=12),C=!0,j="g"),(v||m==="0"&&g==="=")&&(v=!0,m="0",g="=");var E=(p&&p.prefix!==void 0?p.prefix:"")+(x==="$"?n:x==="#"&&/[boxX]/.test(j)?"0"+j.toLowerCase():""),O=(x==="$"?r:/[%p]/.test(j)?l:"")+(p&&p.suffix!==void 0?p.suffix:""),R=_k[j],A=/[defgprs%]/.test(j);S=S===void 0?6:/[gprs]/.test(j)?Math.max(1,Math.min(21,S)):Math.max(0,Math.min(20,S));function N(_){var q=E,W=O,I,F,K;if(j==="c")W=R(_)+W,_="";else{_=+_;var M=_<0||1/_<0;if(_=isNaN(_)?c:R(Math.abs(_),S),C&&(_=B7(_)),M&&+_==0&&y!=="+"&&(M=!1),q=(M?y==="("?y:s:y==="-"||y==="("?"":y)+q,W=(j==="s"&&!isNaN(_)&&sp!==void 0?Dk[8+sp/3]:"")+W+(M&&y==="("?")":""),A){for(I=-1,F=_.length;++I<F;)if(K=_.charCodeAt(I),48>K||K>57){W=(K===46?i+_.slice(I+1):_.slice(I))+W,_=_.slice(0,I);break}}}w&&!v&&(_=t(_,1/0));var B=q.length+_.length+W.length,k=B<b?new Array(b-B+1).join(m):"";switch(w&&v&&(_=t(k+_,k.length?b-W.length:1/0),k=""),g){case"<":_=q+_+W+k;break;case"=":_=q+k+_+W;break;case"^":_=k.slice(0,B=k.length>>1)+q+_+W+k.slice(B);break;default:_=k+q+_+W;break}return a(_)}return N.toString=function(){return d+""},N}function f(d,p){var m=Math.max(-8,Math.min(8,Math.floor(rs(p)/3)))*3,g=Math.pow(10,-m),y=u((d=eu(d),d.type="f",d),{suffix:Dk[8+m/3]});return function(x){return y(g*x)}}return{format:u,formatPrefix:f}}var kd,B0,OI;W7({thousands:",",grouping:[3],currency:["$",""]});function W7(e){return kd=U7(e),B0=kd.format,OI=kd.formatPrefix,kd}function K7(e){return Math.max(0,-rs(Math.abs(e)))}function H7(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(rs(t)/3)))*3-rs(Math.abs(e)))}function V7(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,rs(t)-rs(e))+1}function AI(e,t,n,r){var i=gy(e,t,n),a;switch(r=eu(r??",f"),r.type){case"s":{var l=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=H7(i,l))&&(r.precision=a),OI(r,l)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=V7(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(a=K7(i))&&(r.precision=a-(r.type==="%")*2);break}}return B0(r)}function Ha(e){var t=e.domain;return e.ticks=function(n){var r=t();return hy(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return AI(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,a=r.length-1,l=r[i],s=r[a],c,u,f=10;for(s<l&&(u=l,l=s,s=u,u=i,i=a,a=u);f-- >0;){if(u=my(l,s,n),u===c)return r[i]=l,r[a]=s,t(r);if(u>0)l=Math.floor(l/u)*u,s=Math.ceil(s/u)*u;else if(u<0)l=Math.ceil(l*u)/u,s=Math.floor(s*u)/u;else break;c=u}return e},e}function II(){var e=z0();return e.copy=function(){return Ou(e,II())},Rr.apply(e,arguments),Ha(e)}function NI(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,op),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return NI(e).unknown(t)},e=arguments.length?Array.from(e,op):[0,1],Ha(n)}function _I(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],l;return a<i&&(l=n,n=r,r=l,l=i,i=a,a=l),e[n]=t.floor(i),e[r]=t.ceil(a),e}function Lk(e){return Math.log(e)}function zk(e){return Math.exp(e)}function q7(e){return-Math.log(-e)}function Y7(e){return-Math.exp(-e)}function G7(e){return isFinite(e)?+("1e"+e):e<0?0:e}function X7(e){return e===10?G7:e===Math.E?Math.exp:t=>Math.pow(e,t)}function Q7(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function $k(e){return(t,n)=>-e(-t,n)}function F0(e){const t=e(Lk,zk),n=t.domain;let r=10,i,a;function l(){return i=Q7(r),a=X7(r),n()[0]<0?(i=$k(i),a=$k(a),e(q7,Y7)):e(Lk,zk),t}return t.base=function(s){return arguments.length?(r=+s,l()):r},t.domain=function(s){return arguments.length?(n(s),l()):n()},t.ticks=s=>{const c=n();let u=c[0],f=c[c.length-1];const d=f<u;d&&([u,f]=[f,u]);let p=i(u),m=i(f),g,y;const x=s==null?10:+s;let v=[];if(!(r%1)&&m-p<x){if(p=Math.floor(p),m=Math.ceil(m),u>0){for(;p<=m;++p)for(g=1;g<r;++g)if(y=p<0?g/a(-p):g*a(p),!(y<u)){if(y>f)break;v.push(y)}}else for(;p<=m;++p)for(g=r-1;g>=1;--g)if(y=p>0?g/a(-p):g*a(p),!(y<u)){if(y>f)break;v.push(y)}v.length*2<x&&(v=hy(u,f,x))}else v=hy(p,m,Math.min(m-p,x)).map(a);return d?v.reverse():v},t.tickFormat=(s,c)=>{if(s==null&&(s=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=eu(c)).precision==null&&(c.trim=!0),c=B0(c)),s===1/0)return c;const u=Math.max(1,r*s/t.ticks().length);return f=>{let d=f/a(Math.round(i(f)));return d*r<r-.5&&(d*=r),d<=u?c(f):""}},t.nice=()=>n(_I(n(),{floor:s=>a(Math.floor(i(s))),ceil:s=>a(Math.ceil(i(s)))})),t}function MI(){const e=F0(Eh()).domain([1,10]);return e.copy=()=>Ou(e,MI()).base(e.base()),Rr.apply(e,arguments),e}function Bk(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Fk(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function U0(e){var t=1,n=e(Bk(t),Fk(t));return n.constant=function(r){return arguments.length?e(Bk(t=+r),Fk(t)):t},Ha(n)}function RI(){var e=U0(Eh());return e.copy=function(){return Ou(e,RI()).constant(e.constant())},Rr.apply(e,arguments)}function Uk(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function J7(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Z7(e){return e<0?-e*e:e*e}function W0(e){var t=e(Fn,Fn),n=1;function r(){return n===1?e(Fn,Fn):n===.5?e(J7,Z7):e(Uk(n),Uk(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Ha(t)}function K0(){var e=W0(Eh());return e.copy=function(){return Ou(e,K0()).exponent(e.exponent())},Rr.apply(e,arguments),e}function eV(){return K0.apply(null,arguments).exponent(.5)}function Wk(e){return Math.sign(e)*e*e}function tV(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function DI(){var e=z0(),t=[0,1],n=!1,r;function i(a){var l=tV(e(a));return isNaN(l)?r:n?Math.round(l):l}return i.invert=function(a){return e.invert(Wk(a))},i.domain=function(a){return arguments.length?(e.domain(a),i):e.domain()},i.range=function(a){return arguments.length?(e.range((t=Array.from(a,op)).map(Wk)),i):t.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(n=!!a,i):n},i.clamp=function(a){return arguments.length?(e.clamp(a),i):e.clamp()},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return DI(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},Rr.apply(i,arguments),Ha(i)}function LI(){var e=[],t=[],n=[],r;function i(){var l=0,s=Math.max(1,t.length);for(n=new Array(s-1);++l<s;)n[l-1]=a7(e,l/s);return a}function a(l){return l==null||isNaN(l=+l)?r:t[Eu(n,l)]}return a.invertExtent=function(l){var s=t.indexOf(l);return s<0?[NaN,NaN]:[s>0?n[s-1]:e[0],s<n.length?n[s]:e[e.length-1]]},a.domain=function(l){if(!arguments.length)return e.slice();e=[];for(let s of l)s!=null&&!isNaN(s=+s)&&e.push(s);return e.sort(Aa),i()},a.range=function(l){return arguments.length?(t=Array.from(l),i()):t.slice()},a.unknown=function(l){return arguments.length?(r=l,a):r},a.quantiles=function(){return n.slice()},a.copy=function(){return LI().domain(e).range(t).unknown(r)},Rr.apply(a,arguments)}function zI(){var e=0,t=1,n=1,r=[.5],i=[0,1],a;function l(c){return c!=null&&c<=c?i[Eu(r,c,0,n)]:a}function s(){var c=-1;for(r=new Array(n);++c<n;)r[c]=((c+1)*t-(c-n)*e)/(n+1);return l}return l.domain=function(c){return arguments.length?([e,t]=c,e=+e,t=+t,s()):[e,t]},l.range=function(c){return arguments.length?(n=(i=Array.from(c)).length-1,s()):i.slice()},l.invertExtent=function(c){var u=i.indexOf(c);return u<0?[NaN,NaN]:u<1?[e,r[0]]:u>=n?[r[n-1],t]:[r[u-1],r[u]]},l.unknown=function(c){return arguments.length&&(a=c),l},l.thresholds=function(){return r.slice()},l.copy=function(){return zI().domain([e,t]).range(i).unknown(a)},Rr.apply(Ha(l),arguments)}function $I(){var e=[.5],t=[0,1],n,r=1;function i(a){return a!=null&&a<=a?t[Eu(e,a,0,r)]:n}return i.domain=function(a){return arguments.length?(e=Array.from(a),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(a){return arguments.length?(t=Array.from(a),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(a){var l=t.indexOf(a);return[e[l-1],e[l]]},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return $I().domain(e).range(t).unknown(n)},Rr.apply(i,arguments)}const lg=new Date,sg=new Date;function un(e,t,n,r){function i(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),i.round=a=>{const l=i(a),s=i.ceil(a);return a-l<s-a?l:s},i.offset=(a,l)=>(t(a=new Date(+a),l==null?1:Math.floor(l)),a),i.range=(a,l,s)=>{const c=[];if(a=i.ceil(a),s=s==null?1:Math.floor(s),!(a<l)||!(s>0))return c;let u;do c.push(u=new Date(+a)),t(a,s),e(a);while(u<a&&a<l);return c},i.filter=a=>un(l=>{if(l>=l)for(;e(l),!a(l);)l.setTime(l-1)},(l,s)=>{if(l>=l)if(s<0)for(;++s<=0;)for(;t(l,-1),!a(l););else for(;--s>=0;)for(;t(l,1),!a(l););}),n&&(i.count=(a,l)=>(lg.setTime(+a),sg.setTime(+l),e(lg),e(sg),Math.floor(n(lg,sg))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(r?l=>r(l)%a===0:l=>i.count(0,l)%a===0):i)),i}const cp=un(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);cp.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?un(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):cp);cp.range;const Di=1e3,Ar=Di*60,Li=Ar*60,Vi=Li*24,H0=Vi*7,Kk=Vi*30,cg=Vi*365,bo=un(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Di)},(e,t)=>(t-e)/Di,e=>e.getUTCSeconds());bo.range;const V0=un(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Di)},(e,t)=>{e.setTime(+e+t*Ar)},(e,t)=>(t-e)/Ar,e=>e.getMinutes());V0.range;const q0=un(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Ar)},(e,t)=>(t-e)/Ar,e=>e.getUTCMinutes());q0.range;const Y0=un(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Di-e.getMinutes()*Ar)},(e,t)=>{e.setTime(+e+t*Li)},(e,t)=>(t-e)/Li,e=>e.getHours());Y0.range;const G0=un(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Li)},(e,t)=>(t-e)/Li,e=>e.getUTCHours());G0.range;const Au=un(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Ar)/Vi,e=>e.getDate()-1);Au.range;const Th=un(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Vi,e=>e.getUTCDate()-1);Th.range;const BI=un(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Vi,e=>Math.floor(e/Vi));BI.range;function Yo(e){return un(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Ar)/H0)}const Oh=Yo(0),up=Yo(1),nV=Yo(2),rV=Yo(3),is=Yo(4),iV=Yo(5),aV=Yo(6);Oh.range;up.range;nV.range;rV.range;is.range;iV.range;aV.range;function Go(e){return un(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/H0)}const Ah=Go(0),dp=Go(1),oV=Go(2),lV=Go(3),as=Go(4),sV=Go(5),cV=Go(6);Ah.range;dp.range;oV.range;lV.range;as.range;sV.range;cV.range;const X0=un(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());X0.range;const Q0=un(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Q0.range;const qi=un(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());qi.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:un(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});qi.range;const Yi=un(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Yi.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:un(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});Yi.range;function FI(e,t,n,r,i,a){const l=[[bo,1,Di],[bo,5,5*Di],[bo,15,15*Di],[bo,30,30*Di],[a,1,Ar],[a,5,5*Ar],[a,15,15*Ar],[a,30,30*Ar],[i,1,Li],[i,3,3*Li],[i,6,6*Li],[i,12,12*Li],[r,1,Vi],[r,2,2*Vi],[n,1,H0],[t,1,Kk],[t,3,3*Kk],[e,1,cg]];function s(u,f,d){const p=f<u;p&&([u,f]=[f,u]);const m=d&&typeof d.range=="function"?d:c(u,f,d),g=m?m.range(u,+f+1):[];return p?g.reverse():g}function c(u,f,d){const p=Math.abs(f-u)/d,m=N0(([,,x])=>x).right(l,p);if(m===l.length)return e.every(gy(u/cg,f/cg,d));if(m===0)return cp.every(Math.max(gy(u,f,d),1));const[g,y]=l[p/l[m-1][2]<l[m][2]/p?m-1:m];return g.every(y)}return[s,c]}const[uV,dV]=FI(Yi,Q0,Ah,BI,G0,q0),[fV,pV]=FI(qi,X0,Oh,Au,Y0,V0);function ug(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function dg(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Ks(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function hV(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,l=e.shortDays,s=e.months,c=e.shortMonths,u=Hs(i),f=Vs(i),d=Hs(a),p=Vs(a),m=Hs(l),g=Vs(l),y=Hs(s),x=Vs(s),v=Hs(c),b=Vs(c),w={a:K,A:M,b:B,B:k,c:null,d:Xk,e:Xk,f:LV,g:qV,G:GV,H:MV,I:RV,j:DV,L:UI,m:zV,M:$V,p:L,q:Q,Q:Zk,s:eC,S:BV,u:FV,U:UV,V:WV,w:KV,W:HV,x:null,X:null,y:VV,Y:YV,Z:XV,"%":Jk},S={a:T,A:ce,b:ve,B:X,c:null,d:Qk,e:Qk,f:eq,g:uq,G:fq,H:QV,I:JV,j:ZV,L:KI,m:tq,M:nq,p:oe,q:fe,Q:Zk,s:eC,S:rq,u:iq,U:aq,V:oq,w:lq,W:sq,x:null,X:null,y:cq,Y:dq,Z:pq,"%":Jk},C={a:A,A:N,b:_,B:q,c:W,d:Yk,e:Yk,f:AV,g:qk,G:Vk,H:Gk,I:Gk,j:PV,L:OV,m:CV,M:EV,p:R,q:kV,Q:NV,s:_V,S:TV,u:xV,U:bV,V:wV,w:yV,W:jV,x:I,X:F,y:qk,Y:Vk,Z:SV,"%":IV};w.x=j(n,w),w.X=j(r,w),w.c=j(t,w),S.x=j(n,S),S.X=j(r,S),S.c=j(t,S);function j(te,Z){return function(se){var re=[],Oe=-1,ne=0,_e=te.length,Re,Fe,rt;for(se instanceof Date||(se=new Date(+se));++Oe<_e;)te.charCodeAt(Oe)===37&&(re.push(te.slice(ne,Oe)),(Fe=Hk[Re=te.charAt(++Oe)])!=null?Re=te.charAt(++Oe):Fe=Re==="e"?" ":"0",(rt=Z[Re])&&(Re=rt(se,Fe)),re.push(Re),ne=Oe+1);return re.push(te.slice(ne,Oe)),re.join("")}}function E(te,Z){return function(se){var re=Ks(1900,void 0,1),Oe=O(re,te,se+="",0),ne,_e;if(Oe!=se.length)return null;if("Q"in re)return new Date(re.Q);if("s"in re)return new Date(re.s*1e3+("L"in re?re.L:0));if(Z&&!("Z"in re)&&(re.Z=0),"p"in re&&(re.H=re.H%12+re.p*12),re.m===void 0&&(re.m="q"in re?re.q:0),"V"in re){if(re.V<1||re.V>53)return null;"w"in re||(re.w=1),"Z"in re?(ne=dg(Ks(re.y,0,1)),_e=ne.getUTCDay(),ne=_e>4||_e===0?dp.ceil(ne):dp(ne),ne=Th.offset(ne,(re.V-1)*7),re.y=ne.getUTCFullYear(),re.m=ne.getUTCMonth(),re.d=ne.getUTCDate()+(re.w+6)%7):(ne=ug(Ks(re.y,0,1)),_e=ne.getDay(),ne=_e>4||_e===0?up.ceil(ne):up(ne),ne=Au.offset(ne,(re.V-1)*7),re.y=ne.getFullYear(),re.m=ne.getMonth(),re.d=ne.getDate()+(re.w+6)%7)}else("W"in re||"U"in re)&&("w"in re||(re.w="u"in re?re.u%7:"W"in re?1:0),_e="Z"in re?dg(Ks(re.y,0,1)).getUTCDay():ug(Ks(re.y,0,1)).getDay(),re.m=0,re.d="W"in re?(re.w+6)%7+re.W*7-(_e+5)%7:re.w+re.U*7-(_e+6)%7);return"Z"in re?(re.H+=re.Z/100|0,re.M+=re.Z%100,dg(re)):ug(re)}}function O(te,Z,se,re){for(var Oe=0,ne=Z.length,_e=se.length,Re,Fe;Oe<ne;){if(re>=_e)return-1;if(Re=Z.charCodeAt(Oe++),Re===37){if(Re=Z.charAt(Oe++),Fe=C[Re in Hk?Z.charAt(Oe++):Re],!Fe||(re=Fe(te,se,re))<0)return-1}else if(Re!=se.charCodeAt(re++))return-1}return re}function R(te,Z,se){var re=u.exec(Z.slice(se));return re?(te.p=f.get(re[0].toLowerCase()),se+re[0].length):-1}function A(te,Z,se){var re=m.exec(Z.slice(se));return re?(te.w=g.get(re[0].toLowerCase()),se+re[0].length):-1}function N(te,Z,se){var re=d.exec(Z.slice(se));return re?(te.w=p.get(re[0].toLowerCase()),se+re[0].length):-1}function _(te,Z,se){var re=v.exec(Z.slice(se));return re?(te.m=b.get(re[0].toLowerCase()),se+re[0].length):-1}function q(te,Z,se){var re=y.exec(Z.slice(se));return re?(te.m=x.get(re[0].toLowerCase()),se+re[0].length):-1}function W(te,Z,se){return O(te,t,Z,se)}function I(te,Z,se){return O(te,n,Z,se)}function F(te,Z,se){return O(te,r,Z,se)}function K(te){return l[te.getDay()]}function M(te){return a[te.getDay()]}function B(te){return c[te.getMonth()]}function k(te){return s[te.getMonth()]}function L(te){return i[+(te.getHours()>=12)]}function Q(te){return 1+~~(te.getMonth()/3)}function T(te){return l[te.getUTCDay()]}function ce(te){return a[te.getUTCDay()]}function ve(te){return c[te.getUTCMonth()]}function X(te){return s[te.getUTCMonth()]}function oe(te){return i[+(te.getUTCHours()>=12)]}function fe(te){return 1+~~(te.getUTCMonth()/3)}return{format:function(te){var Z=j(te+="",w);return Z.toString=function(){return te},Z},parse:function(te){var Z=E(te+="",!1);return Z.toString=function(){return te},Z},utcFormat:function(te){var Z=j(te+="",S);return Z.toString=function(){return te},Z},utcParse:function(te){var Z=E(te+="",!0);return Z.toString=function(){return te},Z}}}var Hk={"-":"",_:" ",0:"0"},xn=/^\s*\d+/,mV=/^%/,gV=/[\\^$*+?|[\]().{}]/g;function ot(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a<n?new Array(n-a+1).join(t)+i:i)}function vV(e){return e.replace(gV,"\\$&")}function Hs(e){return new RegExp("^(?:"+e.map(vV).join("|")+")","i")}function Vs(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function yV(e,t,n){var r=xn.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function xV(e,t,n){var r=xn.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function bV(e,t,n){var r=xn.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function wV(e,t,n){var r=xn.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function jV(e,t,n){var r=xn.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Vk(e,t,n){var r=xn.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function qk(e,t,n){var r=xn.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function SV(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function kV(e,t,n){var r=xn.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function CV(e,t,n){var r=xn.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Yk(e,t,n){var r=xn.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function PV(e,t,n){var r=xn.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Gk(e,t,n){var r=xn.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function EV(e,t,n){var r=xn.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function TV(e,t,n){var r=xn.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function OV(e,t,n){var r=xn.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function AV(e,t,n){var r=xn.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function IV(e,t,n){var r=mV.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function NV(e,t,n){var r=xn.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function _V(e,t,n){var r=xn.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function Xk(e,t){return ot(e.getDate(),t,2)}function MV(e,t){return ot(e.getHours(),t,2)}function RV(e,t){return ot(e.getHours()%12||12,t,2)}function DV(e,t){return ot(1+Au.count(qi(e),e),t,3)}function UI(e,t){return ot(e.getMilliseconds(),t,3)}function LV(e,t){return UI(e,t)+"000"}function zV(e,t){return ot(e.getMonth()+1,t,2)}function $V(e,t){return ot(e.getMinutes(),t,2)}function BV(e,t){return ot(e.getSeconds(),t,2)}function FV(e){var t=e.getDay();return t===0?7:t}function UV(e,t){return ot(Oh.count(qi(e)-1,e),t,2)}function WI(e){var t=e.getDay();return t>=4||t===0?is(e):is.ceil(e)}function WV(e,t){return e=WI(e),ot(is.count(qi(e),e)+(qi(e).getDay()===4),t,2)}function KV(e){return e.getDay()}function HV(e,t){return ot(up.count(qi(e)-1,e),t,2)}function VV(e,t){return ot(e.getFullYear()%100,t,2)}function qV(e,t){return e=WI(e),ot(e.getFullYear()%100,t,2)}function YV(e,t){return ot(e.getFullYear()%1e4,t,4)}function GV(e,t){var n=e.getDay();return e=n>=4||n===0?is(e):is.ceil(e),ot(e.getFullYear()%1e4,t,4)}function XV(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+ot(t/60|0,"0",2)+ot(t%60,"0",2)}function Qk(e,t){return ot(e.getUTCDate(),t,2)}function QV(e,t){return ot(e.getUTCHours(),t,2)}function JV(e,t){return ot(e.getUTCHours()%12||12,t,2)}function ZV(e,t){return ot(1+Th.count(Yi(e),e),t,3)}function KI(e,t){return ot(e.getUTCMilliseconds(),t,3)}function eq(e,t){return KI(e,t)+"000"}function tq(e,t){return ot(e.getUTCMonth()+1,t,2)}function nq(e,t){return ot(e.getUTCMinutes(),t,2)}function rq(e,t){return ot(e.getUTCSeconds(),t,2)}function iq(e){var t=e.getUTCDay();return t===0?7:t}function aq(e,t){return ot(Ah.count(Yi(e)-1,e),t,2)}function HI(e){var t=e.getUTCDay();return t>=4||t===0?as(e):as.ceil(e)}function oq(e,t){return e=HI(e),ot(as.count(Yi(e),e)+(Yi(e).getUTCDay()===4),t,2)}function lq(e){return e.getUTCDay()}function sq(e,t){return ot(dp.count(Yi(e)-1,e),t,2)}function cq(e,t){return ot(e.getUTCFullYear()%100,t,2)}function uq(e,t){return e=HI(e),ot(e.getUTCFullYear()%100,t,2)}function dq(e,t){return ot(e.getUTCFullYear()%1e4,t,4)}function fq(e,t){var n=e.getUTCDay();return e=n>=4||n===0?as(e):as.ceil(e),ot(e.getUTCFullYear()%1e4,t,4)}function pq(){return"+0000"}function Jk(){return"%"}function Zk(e){return+e}function eC(e){return Math.floor(+e/1e3)}var al,VI,qI;hq({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function hq(e){return al=hV(e),VI=al.format,al.parse,qI=al.utcFormat,al.utcParse,al}function mq(e){return new Date(e)}function gq(e){return e instanceof Date?+e:+new Date(+e)}function J0(e,t,n,r,i,a,l,s,c,u){var f=z0(),d=f.invert,p=f.domain,m=u(".%L"),g=u(":%S"),y=u("%I:%M"),x=u("%I %p"),v=u("%a %d"),b=u("%b %d"),w=u("%B"),S=u("%Y");function C(j){return(c(j)<j?m:s(j)<j?g:l(j)<j?y:a(j)<j?x:r(j)<j?i(j)<j?v:b:n(j)<j?w:S)(j)}return f.invert=function(j){return new Date(d(j))},f.domain=function(j){return arguments.length?p(Array.from(j,gq)):p().map(mq)},f.ticks=function(j){var E=p();return e(E[0],E[E.length-1],j??10)},f.tickFormat=function(j,E){return E==null?C:u(E)},f.nice=function(j){var E=p();return(!j||typeof j.range!="function")&&(j=t(E[0],E[E.length-1],j??10)),j?p(_I(E,j)):f},f.copy=function(){return Ou(f,J0(e,t,n,r,i,a,l,s,c,u))},f}function vq(){return Rr.apply(J0(fV,pV,qi,X0,Oh,Au,Y0,V0,bo,VI).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function yq(){return Rr.apply(J0(uV,dV,Yi,Q0,Ah,Th,G0,q0,bo,qI).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Ih(){var e=0,t=1,n,r,i,a,l=Fn,s=!1,c;function u(d){return d==null||isNaN(d=+d)?c:l(i===0?.5:(d=(a(d)-n)*i,s?Math.max(0,Math.min(1,d)):d))}u.domain=function(d){return arguments.length?([e,t]=d,n=a(e=+e),r=a(t=+t),i=n===r?0:1/(r-n),u):[e,t]},u.clamp=function(d){return arguments.length?(s=!!d,u):s},u.interpolator=function(d){return arguments.length?(l=d,u):l};function f(d){return function(p){var m,g;return arguments.length?([m,g]=p,l=d(m,g),u):[l(0),l(1)]}}return u.range=f(ws),u.rangeRound=f(L0),u.unknown=function(d){return arguments.length?(c=d,u):c},function(d){return a=d,n=d(e),r=d(t),i=n===r?0:1/(r-n),u}}function Va(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function YI(){var e=Ha(Ih()(Fn));return e.copy=function(){return Va(e,YI())},ea.apply(e,arguments)}function GI(){var e=F0(Ih()).domain([1,10]);return e.copy=function(){return Va(e,GI()).base(e.base())},ea.apply(e,arguments)}function XI(){var e=U0(Ih());return e.copy=function(){return Va(e,XI()).constant(e.constant())},ea.apply(e,arguments)}function Z0(){var e=W0(Ih());return e.copy=function(){return Va(e,Z0()).exponent(e.exponent())},ea.apply(e,arguments)}function xq(){return Z0.apply(null,arguments).exponent(.5)}function QI(){var e=[],t=Fn;function n(r){if(r!=null&&!isNaN(r=+r))return t((Eu(e,r,1)-1)/(e.length-1))}return n.domain=function(r){if(!arguments.length)return e.slice();e=[];for(let i of r)i!=null&&!isNaN(i=+i)&&e.push(i);return e.sort(Aa),n},n.interpolator=function(r){return arguments.length?(t=r,n):t},n.range=function(){return e.map((r,i)=>t(i/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,a)=>i7(e,a/r))},n.copy=function(){return QI(t).domain(e)},ea.apply(n,arguments)}function Nh(){var e=0,t=.5,n=1,r=1,i,a,l,s,c,u=Fn,f,d=!1,p;function m(y){return isNaN(y=+y)?p:(y=.5+((y=+f(y))-a)*(r*y<r*a?s:c),u(d?Math.max(0,Math.min(1,y)):y))}m.domain=function(y){return arguments.length?([e,t,n]=y,i=f(e=+e),a=f(t=+t),l=f(n=+n),s=i===a?0:.5/(a-i),c=a===l?0:.5/(l-a),r=a<i?-1:1,m):[e,t,n]},m.clamp=function(y){return arguments.length?(d=!!y,m):d},m.interpolator=function(y){return arguments.length?(u=y,m):u};function g(y){return function(x){var v,b,w;return arguments.length?([v,b,w]=x,u=I7(y,[v,b,w]),m):[u(0),u(.5),u(1)]}}return m.range=g(ws),m.rangeRound=g(L0),m.unknown=function(y){return arguments.length?(p=y,m):p},function(y){return f=y,i=y(e),a=y(t),l=y(n),s=i===a?0:.5/(a-i),c=a===l?0:.5/(l-a),r=a<i?-1:1,m}}function JI(){var e=Ha(Nh()(Fn));return e.copy=function(){return Va(e,JI())},ea.apply(e,arguments)}function ZI(){var e=F0(Nh()).domain([.1,1,10]);return e.copy=function(){return Va(e,ZI()).base(e.base())},ea.apply(e,arguments)}function eN(){var e=U0(Nh());return e.copy=function(){return Va(e,eN()).constant(e.constant())},ea.apply(e,arguments)}function eb(){var e=W0(Nh());return e.copy=function(){return Va(e,eb()).exponent(e.exponent())},ea.apply(e,arguments)}function bq(){return eb.apply(null,arguments).exponent(.5)}const tN=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:M0,scaleDiverging:JI,scaleDivergingLog:ZI,scaleDivergingPow:eb,scaleDivergingSqrt:bq,scaleDivergingSymlog:eN,scaleIdentity:NI,scaleImplicit:vy,scaleLinear:II,scaleLog:MI,scaleOrdinal:_0,scalePoint:l7,scalePow:K0,scaleQuantile:LI,scaleQuantize:zI,scaleRadial:DI,scaleSequential:YI,scaleSequentialLog:GI,scaleSequentialPow:Z0,scaleSequentialQuantile:QI,scaleSequentialSqrt:xq,scaleSequentialSymlog:XI,scaleSqrt:eV,scaleSymlog:RI,scaleThreshold:$I,scaleTime:vq,scaleUtc:yq,tickFormat:AI},Symbol.toStringTag,{value:"Module"}));function wq(e){var t=tN;if(e in t&&typeof t[e]=="function")return t[e]();var n="scale".concat(hu(e));if(n in t&&typeof t[n]=="function")return t[n]()}function tC(e,t,n){if(typeof e=="function")return e.copy().domain(t).range(n);if(e!=null){var r=wq(e);if(r!=null)return r.domain(t).range(n),r}}function tb(e,t,n,r){if(!(n==null||r==null))return typeof e.scale=="function"?tC(e.scale,n,r):tC(t,n,r)}function jq(e){return"scale".concat(hu(e))}function Sq(e){return jq(e)in tN}var nN=(e,t,n)=>{if(e!=null){var{scale:r,type:i}=e;if(r==="auto")return i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!t)?"point":i==="category"?"band":"linear";if(typeof r=="string")return Sq(r)?r:"point"}};function kq(e,t){for(var n=0,r=e.length,i=e[0]<e[e.length-1];n<r;){var a=Math.floor((n+r)/2);(i?e[a]<t:e[a]>t)?n=a+1:r=a}return n}function rN(e,t){if(e){var n=t??e.domain(),r=n.map(a=>{var l;return(l=e(a))!==null&&l!==void 0?l:0}),i=e.range();if(!(n.length===0||i.length<2))return a=>{var l,s,c=kq(r,a);if(c<=0)return n[0];if(c>=n.length)return n[n.length-1];var u=(l=r[c-1])!==null&&l!==void 0?l:0,f=(s=r[c])!==null&&s!==void 0?s:0;return Math.abs(a-u)<=Math.abs(a-f)?n[c-1]:n[c]}}}function Cq(e){if(e!=null)return"invert"in e&&typeof e.invert=="function"?e.invert.bind(e):rN(e,void 0)}function nC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function fp(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nC(Object(n),!0).forEach(function(r){Pq(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Pq(e,t,n){return(t=Eq(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Eq(e){var t=Tq(e,"string");return typeof t=="symbol"?t:t+""}function Tq(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var wy=[0,"auto"],rn={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0,niceTicks:"auto"},iN=(e,t)=>e.cartesianAxis.xAxis[t],ta=(e,t)=>{var n=iN(e,t);return n??rn},an={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:wy,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,niceTicks:"auto",width:yu},aN=(e,t)=>e.cartesianAxis.yAxis[t],na=(e,t)=>{var n=aN(e,t);return n??an},Oq={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},nb=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return n??Oq},Kt=(e,t,n)=>{switch(t){case"xAxis":return ta(e,n);case"yAxis":return na(e,n);case"zAxis":return nb(e,n);case"angleAxis":return T0(e,n);case"radiusAxis":return O0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},Aq=(e,t,n)=>{switch(t){case"xAxis":return ta(e,n);case"yAxis":return na(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},js=(e,t,n)=>{switch(t){case"xAxis":return ta(e,n);case"yAxis":return na(e,n);case"angleAxis":return T0(e,n);case"radiusAxis":return O0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},oN=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function rb(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var Iu=e=>e.graphicalItems.cartesianItems,Iq=H([$t,Pu],rb),ib=(e,t,n)=>e.filter(n).filter(r=>(t==null?void 0:t.includeHidden)===!0?!0:!r.hide),Ss=H([Iu,Kt,Iq],ib,{memoizeOptions:{resultEqualityCheck:Ph}}),lN=H([Ss],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(kh)),sN=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),Nq=H([Ss],sN),ab=e=>e.map(t=>t.data).filter(Boolean).flat(1),_q=H([Ss],e=>e.some(t=>!t.data)),cN=H([Ss],ab,{memoizeOptions:{resultEqualityCheck:Ph}}),ob=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},lb=H([cN,ku],ob),uN=(e,t,n)=>(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:at(r,t.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>e.map(i=>({value:at(i,r)}))):e.map(r=>({value:r})),dN=(e,t,n,r,i,a)=>{var{chartData:l=[],dataStartIndex:s,dataEndIndex:c}=r,u=uN(e,t,n);if(i&&(t==null?void 0:t.dataKey)!=null&&a.length>0){var f=l.slice(s,c+1),d=f.map(p=>({value:at(p,t.dataKey)})).filter(p=>p.value!=null);return[...d,...u]}return u},Nu=H([lb,Kt,Ss,ku,_q,cN],dN);function Ul(e){if(wi(e)||e instanceof Date){var t=Number(e);if(He(t))return t}}function rC(e){if(Array.isArray(e)){var t=[Ul(e[0]),Ul(e[1])];return vi(t)?t:void 0}var n=Ul(e);if(n!=null)return[n,n]}function ki(e){return e.map(Ul).filter(Zn)}function Mq(e,t){var n=Ul(e),r=Ul(t);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var Rq=H([Nu],e=>e==null?void 0:e.map(t=>t.value).sort(Mq));function fN(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function Dq(e,t,n){if(!n)return[];if(!n.length)return[];var r;if(typeof t=="number"&&!Gr(t))r=t;else if(Array.isArray(t)){var i=ki(t);i.length>0&&(r=Math.max(...i))}return r==null?[]:ki(n.flatMap(a=>{var l=at(e,a.dataKey),s,c;if(Array.isArray(l)?[s,c]=l:s=c=l,!(!He(s)||!He(c)))return[r-s,r+c]}))}var dn=e=>{var t=yn(e),n=bs(e);return js(e,t,n)},os=H([dn],e=>e==null?void 0:e.dataKey),Lq=H([lN,ku,dn],bI),pN=(e,t,n,r)=>{var i={},a=t.reduce((l,s)=>{if(s.stackId==null)return l;var c=l[s.stackId];return c==null&&(c=[]),c.push(s),l[s.stackId]=c,l},i);return Object.fromEntries(Object.entries(a).map(l=>{var[s,c]=l,u=r?[...c].reverse():c,f=u.map(Sh);return[s,{stackedData:OW(e,f,n),graphicalItems:u}]}))},pp=H([Lq,lN,Cu,pI],pN),hN=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(r==null&&n!=="zAxis"){var l=_W(e,i,a);if(!(l!=null&&l[0]===0&&l[1]===0))return l}},zq=H([Kt],e=>e.allowDataOverflow),sb=e=>{var t;if(e==null||!("domain"in e))return wy;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var n=ki(e.ticks);return[Math.min(...n),Math.max(...n)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:wy},cb=H([Kt],sb),ub=H([cb,zq],eI),$q=H([pp,Zr,$t,ub],hN,{memoizeOptions:{resultEqualityCheck:Ch}}),_h=e=>e.errorBars,Bq=(e,t,n)=>e.flatMap(r=>t[r.id]).filter(Boolean).filter(r=>fN(n,r)),hp=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=n.filter(Boolean);if(i.length!==0){var a=i.flat(),l=Math.min(...a),s=Math.max(...a);return[l,s]}},db=function(t,n,r,i,a){var l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:[],s,c;if(r.length>0&&r.forEach(u=>{var f,d=u.data!=null?[...u.data]:l,p=(f=i[u.id])===null||f===void 0?void 0:f.filter(m=>fN(a,m));d.forEach(m=>{var g,y=at(m,(g=n.dataKey)!==null&&g!==void 0?g:u.dataKey),x=Dq(m,y,p);if(x.length>=2){var v=Math.min(...x),b=Math.max(...x);(s==null||v<s)&&(s=v),(c==null||b>c)&&(c=b)}var w=rC(y);w!=null&&(s=s==null?w[0]:Math.min(s,w[0]),c=c==null?w[1]:Math.max(c,w[1]))})}),(n==null?void 0:n.dataKey)!=null&&r.length===0&&t.forEach(u=>{var f=rC(at(u,n.dataKey));f!=null&&(s=s==null?f[0]:Math.min(s,f[0]),c=c==null?f[1]:Math.max(c,f[1]))}),He(s)&&He(c))return[s,c]},Fq=H([lb,Kt,Nq,_h,$t,O9],db,{memoizeOptions:{resultEqualityCheck:Ch}});function Uq(e){var{value:t}=e;if(wi(t)||t instanceof Date)return t}var Wq=(e,t,n)=>{var r=e.map(Uq).filter(i=>i!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&xO(r))?JA(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},mN=e=>e.referenceElements.dots,ks=(e,t,n)=>e.filter(r=>r.ifOverflow==="extendDomain").filter(r=>t==="xAxis"?r.xAxisId===n:r.yAxisId===n),Kq=H([mN,$t,Pu],ks),gN=e=>e.referenceElements.areas,Hq=H([gN,$t,Pu],ks),vN=e=>e.referenceElements.lines,Vq=H([vN,$t,Pu],ks),yN=(e,t)=>{if(e!=null){var n=ki(e.map(r=>t==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},qq=H(Kq,$t,yN),xN=(e,t)=>{if(e!=null){var n=ki(e.flatMap(r=>[t==="xAxis"?r.x1:r.y1,t==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Yq=H([Hq,$t],xN);function Gq(e){var t;if(e.x!=null)return ki([e.x]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.x);return n==null||n.length===0?[]:ki(n)}function Xq(e){var t;if(e.y!=null)return ki([e.y]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.y);return n==null||n.length===0?[]:ki(n)}var bN=(e,t)=>{if(e!=null){var n=e.flatMap(r=>t==="xAxis"?Gq(r):Xq(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Qq=H([Vq,$t],bN),Jq=H(qq,Qq,Yq,(e,t,n)=>hp(e,n,t)),fb=(e,t,n,r,i,a,l,s)=>{if(n!=null)return n;var c=l==="vertical"&&s==="xAxis"||l==="horizontal"&&s==="yAxis",u=c?hp(r,a,i):hp(a,i);return N9(t,u,e.allowDataOverflow)},Zq=H([Kt,cb,ub,$q,Fq,Jq,Ze,$t],fb,{memoizeOptions:{resultEqualityCheck:Ch}}),eY=[0,1],pb=(e,t,n,r,i,a,l)=>{if(!((e==null||n==null||n.length===0)&&l===void 0)){var{dataKey:s,type:c}=e,u=Jr(t,a);if(u&&s==null){var f;return JA(0,(f=n==null?void 0:n.length)!==null&&f!==void 0?f:0)}return c==="category"?Wq(r,e,u):i==="expand"&&!u?eY:l}},hb=H([Kt,Ze,lb,Nu,Cu,$t,Zq],pb),qa=H([Kt,oN,C0],nN),mb=(e,t,n)=>{var{niceTicks:r}=t;if(r!=="none"){var i=sb(t),a=Array.isArray(i)&&(i[0]==="auto"||i[1]==="auto");if((r==="snap125"||r==="adaptive")&&t!=null&&t.tickCount&&vi(e)){if(a)return pk(e,t.tickCount,t.allowDecimals,r);if(t.type==="number")return hk(e,t.tickCount,t.allowDecimals,r)}if(r==="auto"&&n==="linear"&&t!=null&&t.tickCount){if(a&&vi(e))return pk(e,t.tickCount,t.allowDecimals,"adaptive");if(t.type==="number"&&vi(e))return hk(e,t.tickCount,t.allowDecimals,"adaptive")}}},gb=H([hb,js,qa],mb),vb=(e,t,n,r)=>{if(r!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&vi(t)&&Array.isArray(n)&&n.length>0){var i,a,l=t[0],s=(i=n[0])!==null&&i!==void 0?i:0,c=t[1],u=(a=n[n.length-1])!==null&&a!==void 0?a:0;return[Math.min(l,s),Math.max(c,u)]}return t},tY=H([Kt,hb,gb,$t],vb),nY=H(Nu,Kt,(e,t)=>{if(!(!t||t.type!=="number")){var n=1/0,r=Array.from(ki(e.map(d=>d.value))).sort((d,p)=>d-p),i=r[0],a=r[r.length-1];if(i==null||a==null)return 1/0;var l=a-i;if(l===0)return 1/0;for(var s=0;s<r.length-1;s++){var c=r[s],u=r[s+1];if(!(c==null||u==null)){var f=u-c;n=Math.min(n,f)}}return n/l}}),wN=H(nY,Ze,fI,cn,(e,t,n,r,i)=>i,(e,t,n,r,i)=>{if(!He(e))return 0;var a=t==="vertical"?r.height:r.width;if(i==="gap")return e*a/2;if(i==="no-gap"){var l=Nn(n,e*a),s=e*a/2;return s-l-(s-l)/a*l}return 0}),rY=(e,t,n)=>{var r=ta(e,t);return r==null||typeof r.padding!="string"?0:wN(e,"xAxis",t,n,r.padding)},iY=(e,t,n)=>{var r=na(e,t);return r==null||typeof r.padding!="string"?0:wN(e,"yAxis",t,n,r.padding)},aY=H(ta,rY,(e,t)=>{var n,r;if(e==null)return{left:0,right:0};var{padding:i}=e;return typeof i=="string"?{left:t,right:t}:{left:((n=i.left)!==null&&n!==void 0?n:0)+t,right:((r=i.right)!==null&&r!==void 0?r:0)+t}}),oY=H(na,iY,(e,t)=>{var n,r;if(e==null)return{top:0,bottom:0};var{padding:i}=e;return typeof i=="string"?{top:t,bottom:t}:{top:((n=i.top)!==null&&n!==void 0?n:0)+t,bottom:((r=i.bottom)!==null&&r!==void 0?r:0)+t}}),lY=H([cn,aY,mh,hh,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),sY=H([cn,Ze,oY,mh,hh,(e,t,n)=>n],(e,t,n,r,i,a)=>{var{padding:l}=i;return a?[r.height-l.bottom,l.top]:t==="horizontal"?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),_u=(e,t,n,r)=>{var i;switch(t){case"xAxis":return lY(e,n,r);case"yAxis":return sY(e,n,r);case"zAxis":return(i=nb(e,n))===null||i===void 0?void 0:i.range;case"angleAxis":return vI(e);case"radiusAxis":return yI(e,n);default:return}},jN=H([Kt,_u],bh),cY=H([qa,tY],wI),yb=H([Kt,qa,cY,jN],tb),SN=(e,t,n,r)=>{if(!(n==null||n.dataKey==null)){var{type:i,scale:a}=n,l=Jr(e,r);if(l&&(i==="number"||a!=="auto"))return t.map(s=>s.value)}},xb=H([Ze,Nu,js,$t],SN),Mh=H([yb],I0);H([yb],Cq);H([yb,Rq],rN);H([Ss,_h,$t],Bq);function kN(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var Rh=(e,t)=>t,Dh=(e,t,n)=>n,uY=H(fh,Rh,Dh,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(kN)),dY=H(ph,Rh,Dh,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(kN)),CN=(e,t)=>({width:e.width,height:t.height}),fY=(e,t)=>{var n=typeof t.width=="number"?t.width:yu;return{width:n,height:e.height}},PN=H(cn,ta,CN),pY=(e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}},hY=(e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}},mY=H(Zi,cn,uY,Rh,Dh,(e,t,n,r,i)=>{var a={},l;return n.forEach(s=>{var c=CN(t,s);l==null&&(l=pY(t,r,e));var u=r==="top"&&!i||r==="bottom"&&i;a[s.id]=l-Number(u)*c.height,l+=(u?-1:1)*c.height}),a}),gY=H(Ji,cn,dY,Rh,Dh,(e,t,n,r,i)=>{var a={},l;return n.forEach(s=>{var c=fY(t,s);l==null&&(l=hY(t,r,e));var u=r==="left"&&!i||r==="right"&&i;a[s.id]=l-Number(u)*c.width,l+=(u?-1:1)*c.width}),a}),vY=(e,t)=>{var n=ta(e,t);if(n!=null)return mY(e,n.orientation,n.mirror)},yY=H([cn,ta,vY,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}}),xY=(e,t)=>{var n=na(e,t);if(n!=null)return gY(e,n.orientation,n.mirror)},bY=H([cn,na,xY,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n==null?void 0:n[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}}),EN=H(cn,na,(e,t)=>{var n=typeof t.width=="number"?t.width:yu;return{width:n,height:e.height}}),iC=(e,t,n)=>{switch(t){case"xAxis":return PN(e,n).width;case"yAxis":return EN(e,n).height;default:return}},TN=(e,t,n,r)=>{if(n!=null){var{allowDuplicatedCategory:i,type:a,dataKey:l}=n,s=Jr(e,r),c=t.map(f=>f.value),u=c.filter(f=>f!=null);if(l&&s&&a==="category"&&i&&xO(u))return c}},bb=H([Ze,Nu,Kt,$t],TN),aC=H([Ze,Aq,qa,Mh,bb,xb,_u,gb,$t],(e,t,n,r,i,a,l,s,c)=>{if(t!=null){var u=Jr(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:a,duplicateDomain:i,isCategorical:u,niceTicks:s,range:l,realScaleType:n,scale:r}}}),wY=(e,t,n,r,i,a,l,s,c)=>{if(!(t==null||r==null)){var u=Jr(e,c),{type:f,ticks:d,tickCount:p}=t,m=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,g=f==="category"&&r.bandwidth?r.bandwidth()/m:0;g=c==="angleAxis"&&a!=null&&a.length>=2?mn(a[0]-a[1])*2*g:g;var y=d||i;return y?y.map((x,v)=>{var b=l?l.indexOf(x):x,w=r.map(b);return He(w)?{index:v,coordinate:w+g,value:x,offset:g}:null}).filter(Zn):u&&s?s.map((x,v)=>{var b=r.map(x);return He(b)?{coordinate:b+g,value:x,index:v,offset:g}:null}).filter(Zn):r.ticks?r.ticks(p).map((x,v)=>{var b=r.map(x);return He(b)?{coordinate:b+g,value:x,index:v,offset:g}:null}).filter(Zn):r.domain().map((x,v)=>{var b=r.map(x);return He(b)?{coordinate:b+g,value:l?l[x]:x,index:v,offset:g}:null}).filter(Zn)}},ON=H([Ze,js,qa,Mh,gb,_u,bb,xb,$t],wY),jY=(e,t,n,r,i,a,l)=>{if(!(t==null||n==null||r==null||r[0]===r[1])){var s=Jr(e,l),{tickCount:c}=t,u=0;return u=l==="angleAxis"&&(r==null?void 0:r.length)>=2?mn(r[0]-r[1])*2*u:u,s&&a?a.map((f,d)=>{var p=n.map(f);return He(p)?{coordinate:p+u,value:f,index:d,offset:u}:null}).filter(Zn):n.ticks?n.ticks(c).map((f,d)=>{var p=n.map(f);return He(p)?{coordinate:p+u,value:f,index:d,offset:u}:null}).filter(Zn):n.domain().map((f,d)=>{var p=n.map(f);return He(p)?{coordinate:p+u,value:i?i[f]:f,index:d,offset:u}:null}).filter(Zn)}},Ci=H([Ze,js,Mh,_u,bb,xb,$t],jY),Pi=H(Kt,Mh,(e,t)=>{if(!(e==null||t==null))return fp(fp({},e),{},{scale:t})}),SY=H([Kt,qa,hb,jN],tb),kY=H([SY],I0);H((e,t,n)=>nb(e,n),kY,(e,t)=>{if(!(e==null||t==null))return fp(fp({},e),{},{scale:t})});var CY=H([Ze,fh,ph],(e,t,n)=>{switch(e){case"horizontal":return t.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),PY=(e,t,n)=>{var r;return(r=e.renderedTicks[t])===null||r===void 0?void 0:r[n]};H([PY],e=>{if(!(!e||e.length===0))return t=>{var n,r=1/0,i=e[0];for(var a of e){var l=Math.abs(a.coordinate-t);l<r&&(r=l,i=a)}return(n=i)===null||n===void 0?void 0:n.value}});var AN=e=>e.options.defaultTooltipEventType,IN=e=>e.options.validateTooltipEventTypes;function NN(e,t,n){if(e==null)return t;var r=e?"axis":"item";return n==null?t:n.includes(r)?r:t}function Mu(e,t){var n=AN(e),r=IN(e);return NN(t,n,r)}function EY(e){return ke(t=>Mu(t,e))}var _N=(e,t)=>{var n,r=Number(t);if(!(Gr(r)||t==null))return r>=0?e==null||(n=e[r])===null||n===void 0?void 0:n.value:void 0},TY=e=>e.tooltip.settings,ga={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},OY={itemInteraction:{click:ga,hover:ga},axisInteraction:{click:ga,hover:ga},keyboardInteraction:ga,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},MN=Dn({name:"tooltip",initialState:OY,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:Ct()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Or(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:Ct()},removeTooltipEntrySettings:{reducer(e,t){var n=Or(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:Ct()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:AY,replaceTooltipEntrySettings:IY,removeTooltipEntrySettings:NY,setTooltipSettingsState:_Y,setActiveMouseOverItemIndex:RN,mouseLeaveItem:MY,mouseLeaveChart:DN,setActiveClickItemIndex:RY,setMouseOverAxisIndex:LN,setMouseClickAxisIndex:DY,setSyncInteraction:nc,setKeyboardInteraction:mp}=MN.actions,LY=MN.reducer;function oC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Cd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?oC(Object(n),!0).forEach(function(r){zY(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function zY(e,t,n){return(t=$Y(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $Y(e){var t=BY(e,"string");return typeof t=="symbol"?t:t+""}function BY(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function FY(e,t,n){return t==="axis"?n==="click"?e.axisInteraction.click:e.axisInteraction.hover:n==="click"?e.itemInteraction.click:e.itemInteraction.hover}function UY(e){return e.index!=null}var zN=(e,t,n,r)=>{if(t==null)return ga;var i=FY(e,t,n);if(i==null)return ga;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if(UY(i)){if(a)return Cd(Cd({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Cd(Cd({},ga),{},{coordinate:i.coordinate})};function WY(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function KY(e,t){var n=WY(e),r=t[0],i=t[1];if(n===void 0)return!1;var a=Math.min(r,i),l=Math.max(r,i);return n>=a&&n<=l}function HY(e,t,n){if(n==null||t==null)return!0;var r=at(e,t);return r==null||!vi(n)?!0:KY(r,n)}var vc=(e,t,n,r)=>{var i=e==null?void 0:e.index;if(i==null)return null;var a=Number(i);if(!He(a))return i;var l=0,s=1/0;t.length>0&&(s=t.length-1);var c=Math.max(l,Math.min(a,s)),u=t[c];return u==null||HY(u,n,r)?String(c):null},$N=(e,t,n,r,i,a,l)=>{if(a!=null){var s=l[0],c=s==null?void 0:s.getPosition(a);if(c!=null)return c;var u=i==null?void 0:i[Number(a)];if(u)switch(n){case"horizontal":return{x:u.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:u.coordinate}}}},BN=(e,t,n,r)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i;if(n==="hover"?i=e.itemInteraction.hover.graphicalItemId:i=e.itemInteraction.click.graphicalItemId,e.syncInteraction.active&&i==null)return e.tooltipItemPayloads;if(i==null&&(r!=null||e.keyboardInteraction.active)){var a=e.tooltipItemPayloads[0];return a!=null?[a]:[]}return e.tooltipItemPayloads.filter(l=>{var s;return((s=l.settings)===null||s===void 0?void 0:s.graphicalItemId)===i})},FN=e=>e.options.tooltipPayloadSearcher,Cs=e=>e.tooltip;function lC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function sC(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?lC(Object(n),!0).forEach(function(r){VY(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function VY(e,t,n){return(t=qY(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qY(e){var t=YY(e,"string");return typeof t=="symbol"?t:t+""}function YY(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function GY(e){if(typeof e=="string"||typeof e=="number")return e}function XY(e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}function QY(e){if(typeof e=="string"||typeof e=="number")return e;if(typeof e=="function")return t=>e(t)}function cC(e){if(typeof e=="string")return e}function JY(e){if(!(e==null||typeof e!="object")){var t="name"in e?GY(e.name):void 0,n="unit"in e?XY(e.unit):void 0,r="dataKey"in e?QY(e.dataKey):void 0,i="payload"in e?e.payload:void 0,a="color"in e?cC(e.color):void 0,l="fill"in e?cC(e.fill):void 0;return{name:t,unit:n,dataKey:r,payload:i,color:a,fill:l}}}function ZY(e,t){return e??t}var UN=(e,t,n,r,i,a,l)=>{if(!(t==null||a==null)){var{chartData:s,computedData:c,dataStartIndex:u,dataEndIndex:f}=n,d=[];return e.reduce((p,m)=>{var g,{dataDefinedOnItem:y,settings:x}=m,v=ZY(y,s),b=Array.isArray(v)?xA(v,u,f):v,w=(g=x==null?void 0:x.dataKey)!==null&&g!==void 0?g:r,S=x==null?void 0:x.nameKey,C;if(r&&Array.isArray(b)&&!Array.isArray(b[0])&&l==="axis"?C=bO(b,r,i):C=a(b,t,c,S),Array.isArray(C))C.forEach(E=>{var O,R,A=JY(E),N=A==null?void 0:A.name,_=A==null?void 0:A.dataKey,q=A==null?void 0:A.payload,W=sC(sC({},x),{},{name:N,unit:A==null?void 0:A.unit,color:(O=A==null?void 0:A.color)!==null&&O!==void 0?O:x==null?void 0:x.color,fill:(R=A==null?void 0:A.fill)!==null&&R!==void 0?R:x==null?void 0:x.fill});p.push(dS({tooltipEntrySettings:W,dataKey:_,payload:q,value:at(q,_),name:N==null?void 0:String(N)}))});else{var j;p.push(dS({tooltipEntrySettings:x,dataKey:w,payload:C,value:at(C,w),name:(j=at(C,S))!==null&&j!==void 0?j:x==null?void 0:x.name}))}return p},d)}},wb=H([dn,oN,C0],nN),eG=H([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),tG=H([yn,bs],rb),Xo=H([eG,dn,tG],ib,{memoizeOptions:{resultEqualityCheck:Ph}}),nG=H([Xo],e=>e.filter(kh)),WN=H([Xo],ab,{memoizeOptions:{resultEqualityCheck:Ph}}),rG=H([Xo],e=>e.some(t=>!t.data)),Fo=H([WN,Zr],ob),iG=H([nG,Zr,dn],bI),jb=H([Fo,dn,Xo,Zr,rG,WN],dN),KN=H([dn],sb),aG=H([dn],e=>e.allowDataOverflow),HN=H([KN,aG],eI),oG=H([Xo],e=>e.filter(kh)),lG=H([iG,oG,Cu,pI],pN),sG=H([lG,Zr,yn,HN],hN),cG=H([Xo],sN),uG=H([Fo,dn,cG,_h,yn,I9],db,{memoizeOptions:{resultEqualityCheck:Ch}}),dG=H([mN,yn,bs],ks),fG=H([dG,yn],yN),pG=H([gN,yn,bs],ks),hG=H([pG,yn],xN),mG=H([vN,yn,bs],ks),gG=H([mG,yn],bN),vG=H([fG,gG,hG],hp),yG=H([dn,KN,HN,sG,uG,vG,Ze,yn],fb),ls=H([dn,Ze,Fo,jb,Cu,yn,yG],pb),xG=H([ls,dn,wb],mb),bG=H([dn,ls,xG,yn],vb),VN=e=>{var t=yn(e),n=bs(e),r=!1;return _u(e,t,n,r)},qN=H([dn,VN],bh),wG=H([dn,wb,bG,qN],tb),YN=H([wG],I0),jG=H([Ze,jb,dn,yn],TN),SG=H([Ze,jb,dn,yn],SN),kG=(e,t,n,r,i,a,l,s)=>{if(t){var{type:c}=t,u=Jr(e,s);if(r){var f=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,d=c==="category"&&r.bandwidth?r.bandwidth()/f:0;return d=s==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?mn(i[0]-i[1])*2*d:d,u&&l?l.map((p,m)=>{var g=r.map(p);return He(g)?{coordinate:g+d,value:p,index:m,offset:d}:null}).filter(Zn):r.domain().map((p,m)=>{var g=r.map(p);return He(g)?{coordinate:g+d,value:a?a[p]:p,index:m,offset:d}:null}).filter(Zn)}}},ra=H([Ze,dn,wb,YN,VN,jG,SG,yn],kG),Sb=H([AN,IN,TY],(e,t,n)=>NN(n.shared,e,t)),GN=e=>e.tooltip.settings.trigger,kb=e=>e.tooltip.settings.defaultIndex,Ru=H([Cs,Sb,GN,kb],zN),Ra=H([Ru,Fo,os,ls],vc),XN=H([ra,Ra],_N),Cb=H([Ru],e=>{if(e)return e.dataKey}),QN=H([Ru],e=>{if(e)return e.graphicalItemId}),JN=H([Cs,Sb,GN,kb],BN),CG=H([Ji,Zi,Ze,cn,ra,kb,JN],$N),PG=H([Ru,CG],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),EG=H([Ru],e=>{var t;return(t=e==null?void 0:e.active)!==null&&t!==void 0?t:!1}),TG=H([JN,Ra,Zr,os,XN,FN,Sb],UN),OG=H([TG],e=>{if(e!=null){var t=e.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(t))}});function uC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function dC(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?uC(Object(n),!0).forEach(function(r){AG(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function AG(e,t,n){return(t=IG(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function IG(e){var t=NG(e,"string");return typeof t=="symbol"?t:t+""}function NG(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var _G=()=>ke(dn),MG=()=>{var e=_G(),t=ke(ra),n=ke(YN);return Ma(!e||!n?void 0:dC(dC({},e),{},{scale:n}),t)};function fC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ol(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fC(Object(n),!0).forEach(function(r){RG(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function RG(e,t,n){return(t=DG(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function DG(e){var t=LG(e,"string");return typeof t=="symbol"?t:t+""}function LG(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var zG=(e,t,n,r)=>{var i=t.find(a=>a&&a.index===n);if(i){if(e==="horizontal")return{x:i.coordinate,y:r.relativeY};if(e==="vertical")return{x:r.relativeX,y:i.coordinate}}return{x:0,y:0}},$G=(e,t,n,r)=>{var i=t.find(u=>u&&u.index===n);if(i){if(e==="centric"){var a=i.coordinate,{radius:l}=r;return ol(ol(ol({},r),en(r.cx,r.cy,l,a)),{},{angle:a,radius:l})}var s=i.coordinate,{angle:c}=r;return ol(ol(ol({},r),en(r.cx,r.cy,s,c)),{},{angle:c,radius:s})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function BG(e,t){var{relativeX:n,relativeY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var ZN=(e,t,n,r,i)=>{var a,l=(a=t==null?void 0:t.length)!==null&&a!==void 0?a:0;if(l<=1||e==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var s=0;s<l;s++){var c,u,f,d,p,m=s>0?(c=n[s-1])===null||c===void 0?void 0:c.coordinate:(u=n[l-1])===null||u===void 0?void 0:u.coordinate,g=(f=n[s])===null||f===void 0?void 0:f.coordinate,y=s>=l-1?(d=n[0])===null||d===void 0?void 0:d.coordinate:(p=n[s+1])===null||p===void 0?void 0:p.coordinate,x=void 0;if(!(m==null||g==null||y==null))if(mn(g-m)!==mn(y-g)){var v=[];if(mn(y-g)===mn(i[1]-i[0])){x=y;var b=g+i[1]-i[0];v[0]=Math.min(b,(b+m)/2),v[1]=Math.max(b,(b+m)/2)}else{x=m;var w=y+i[1]-i[0];v[0]=Math.min(g,(w+g)/2),v[1]=Math.max(g,(w+g)/2)}var S=[Math.min(g,(x+g)/2),Math.max(g,(x+g)/2)];if(e>S[0]&&e<=S[1]||e>=v[0]&&e<=v[1]){var C;return(C=n[s])===null||C===void 0?void 0:C.index}}else{var j=Math.min(m,y),E=Math.max(m,y);if(e>(j+g)/2&&e<=(E+g)/2){var O;return(O=n[s])===null||O===void 0?void 0:O.index}}}else if(t)for(var R=0;R<l;R++){var A=t[R];if(A!=null){var N=t[R+1],_=t[R-1];if(R===0&&N!=null&&e<=(A.coordinate+N.coordinate)/2||R===l-1&&_!=null&&e>(A.coordinate+_.coordinate)/2||R>0&&R<l-1&&_!=null&&N!=null&&e>(A.coordinate+_.coordinate)/2&&e<=(A.coordinate+N.coordinate)/2)return A.index}}return-1},e_=()=>ke(C0),Pb=(e,t)=>t,t_=(e,t,n)=>n,Eb=(e,t,n,r)=>r,FG=H(ra,e=>nh(e,t=>t.coordinate)),Tb=H([Cs,Pb,t_,Eb],zN),Ob=H([Tb,Fo,os,ls],vc),UG=(e,t,n)=>{if(t!=null){var r=Cs(e);return t==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},n_=H([Cs,Pb,t_,Eb],BN),gp=H([Ji,Zi,Ze,cn,ra,Eb,n_],$N),WG=H([Tb,gp],(e,t)=>{var n;return(n=e.coordinate)!==null&&n!==void 0?n:t}),r_=H([ra,Ob],_N),KG=H([n_,Ob,Zr,os,r_,FN,Pb],UN),HG=H([Tb,Ob],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),VG=(e,t,n,r,i,a,l)=>{if(!(!e||!n||!r||!i)&&BG(e,l)){var s=MW(e,t),c=ZN(s,a,i,n,r),u=zG(t,i,c,e);return{activeIndex:String(c),activeCoordinate:u}}},qG=(e,t,n,r,i,a,l)=>{if(!(!e||!r||!i||!a||!n)){var s=S9(e,n);if(s){var c=RW(s,t),u=ZN(c,l,a,r,i),f=$G(t,a,u,s);return{activeIndex:String(u),activeCoordinate:f}}}},YG=(e,t,n,r,i,a,l,s)=>{if(!(!e||!t||!r||!i||!a))return t==="horizontal"||t==="vertical"?VG(e,t,r,i,a,l,s):qG(e,t,n,r,i,a,l)},GG=H(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),XG=H(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(r=>parseInt(r,10)).concat(Object.values(Yt)),n=Array.from(new Set(t));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:V9}});function pC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function hC(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pC(Object(n),!0).forEach(function(r){QG(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function QG(e,t,n){return(t=JG(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function JG(e){var t=ZG(e,"string");return typeof t=="symbol"?t:t+""}function ZG(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var eX={},tX={zIndexMap:Object.values(Yt).reduce((e,t)=>hC(hC({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),eX)},nX=new Set(Object.values(Yt));function rX(e){return nX.has(e)}var i_=Dn({name:"zIndex",initialState:tX,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:Ct()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!rX(n)&&delete e.zIndexMap[n])},prepare:Ct()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=r:e.zIndexMap[n].element=r:e.zIndexMap[n]={consumers:0,element:i?void 0:r,panoramaElement:i?r:void 0}},prepare:Ct()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:Ct()}}}),{registerZIndexPortal:iX,unregisterZIndexPortal:fg,registerZIndexPortalElement:aX,unregisterZIndexPortalElement:oX}=i_.actions,lX=i_.reducer;function qn(e){var{zIndex:t,children:n}=e,r=cK(),i=r&&t!==void 0&&t!==0,a=vn(),l=h.useRef(void 0),s=h.useRef(new Set),c=gt(),u=ke(d=>GG(d,t,a));if(h.useLayoutEffect(()=>{if(!i){var d=s.current;d.forEach(m=>{c(fg({zIndex:m}))}),d.clear(),l.current=void 0;return}if(s.current.has(t)||(c(iX({zIndex:t})),s.current.add(t)),u){l.current=u;var p=s.current;p.forEach(m=>{m!==t&&(c(fg({zIndex:m})),p.delete(m))})}},[c,t,i,u]),h.useLayoutEffect(()=>{var d=s.current;return()=>{d.forEach(p=>{c(fg({zIndex:p}))}),d.clear()}},[c]),!i)return n;var f=u??l.current;return f?Up.createPortal(n,f):null}function jy(){return jy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jy.apply(null,arguments)}function mC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Pd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?mC(Object(n),!0).forEach(function(r){sX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function sX(e,t,n){return(t=cX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cX(e){var t=uX(e,"string");return typeof t=="symbol"?t:t+""}function uX(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function dX(e){var{cursor:t,cursorComp:n,cursorProps:r}=e;return h.isValidElement(t)?h.cloneElement(t,r):h.createElement(n,r)}function fX(e){var t,{coordinate:n,payload:r,index:i,offset:a,tooltipAxisBandSize:l,layout:s,cursor:c,tooltipEventType:u,chartName:f}=e,d=n,p=r,m=i;if(!c||!d||f!=="ScatterChart"&&u!=="axis")return null;var g,y,x;if(f==="ScatterChart")g=d,y=zH,x=Yt.cursorLine;else if(f==="BarChart")g=$H(s,d,a,l),y=qA,x=Yt.cursorRectangle;else if(s==="radial"&&jO(d)){var{cx:v,cy:b,radius:w,startAngle:S,endAngle:C}=GA(d);g={cx:v,cy:b,startAngle:S,endAngle:C,innerRadius:w,outerRadius:w},y=QA,x=Yt.cursorLine}else g={points:E9(s,d,a)},y=Bl,x=Yt.cursorLine;var j=typeof c=="object"&&"className"in c?c.className:void 0,E=Pd(Pd(Pd(Pd({stroke:"#ccc",pointerEvents:"none"},a),g),Mo(c)),{},{payload:p,payloadIndex:m,className:nt("recharts-tooltip-cursor",j)});return h.createElement(qn,{zIndex:(t=e.zIndex)!==null&&t!==void 0?t:x},h.createElement(dX,{cursor:c,cursorComp:y,cursorProps:E}))}function pX(e){var t=MG(),n=OA(),r=Ka(),i=e_();return t==null||n==null||r==null||i==null?null:h.createElement(fX,jy({},e,{offset:n,layout:r,tooltipAxisBandSize:t,chartName:i}))}var a_=h.createContext(null),hX=()=>h.useContext(a_),o_={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,u,f){this.fn=c,this.context=u,this.once=f||!1}function a(c,u,f,d,p){if(typeof f!="function")throw new TypeError("The listener must be a function");var m=new i(f,d||c,p),g=n?n+u:u;return c._events[g]?c._events[g].fn?c._events[g]=[c._events[g],m]:c._events[g].push(m):(c._events[g]=m,c._eventsCount++),c}function l(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function s(){this._events=new r,this._eventsCount=0}s.prototype.eventNames=function(){var u=[],f,d;if(this._eventsCount===0)return u;for(d in f=this._events)t.call(f,d)&&u.push(n?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(f)):u},s.prototype.listeners=function(u){var f=n?n+u:u,d=this._events[f];if(!d)return[];if(d.fn)return[d.fn];for(var p=0,m=d.length,g=new Array(m);p<m;p++)g[p]=d[p].fn;return g},s.prototype.listenerCount=function(u){var f=n?n+u:u,d=this._events[f];return d?d.fn?1:d.length:0},s.prototype.emit=function(u,f,d,p,m,g){var y=n?n+u:u;if(!this._events[y])return!1;var x=this._events[y],v=arguments.length,b,w;if(x.fn){switch(x.once&&this.removeListener(u,x.fn,void 0,!0),v){case 1:return x.fn.call(x.context),!0;case 2:return x.fn.call(x.context,f),!0;case 3:return x.fn.call(x.context,f,d),!0;case 4:return x.fn.call(x.context,f,d,p),!0;case 5:return x.fn.call(x.context,f,d,p,m),!0;case 6:return x.fn.call(x.context,f,d,p,m,g),!0}for(w=1,b=new Array(v-1);w<v;w++)b[w-1]=arguments[w];x.fn.apply(x.context,b)}else{var S=x.length,C;for(w=0;w<S;w++)switch(x[w].once&&this.removeListener(u,x[w].fn,void 0,!0),v){case 1:x[w].fn.call(x[w].context);break;case 2:x[w].fn.call(x[w].context,f);break;case 3:x[w].fn.call(x[w].context,f,d);break;case 4:x[w].fn.call(x[w].context,f,d,p);break;default:if(!b)for(C=1,b=new Array(v-1);C<v;C++)b[C-1]=arguments[C];x[w].fn.apply(x[w].context,b)}}return!0},s.prototype.on=function(u,f,d){return a(this,u,f,d,!1)},s.prototype.once=function(u,f,d){return a(this,u,f,d,!0)},s.prototype.removeListener=function(u,f,d,p){var m=n?n+u:u;if(!this._events[m])return this;if(!f)return l(this,m),this;var g=this._events[m];if(g.fn)g.fn===f&&(!p||g.once)&&(!d||g.context===d)&&l(this,m);else{for(var y=0,x=[],v=g.length;y<v;y++)(g[y].fn!==f||p&&!g[y].once||d&&g[y].context!==d)&&x.push(g[y]);x.length?this._events[m]=x.length===1?x[0]:x:l(this,m)}return this},s.prototype.removeAllListeners=function(u){var f;return u?(f=n?n+u:u,this._events[f]&&l(this,f)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s})(o_);var mX=o_.exports;const gX=ss(mX);var tu=new gX,Sy="recharts.syncEvent.tooltip",gC="recharts.syncEvent.brush",Lh=(e,t)=>{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!Gr(n))return e[n]}},vX={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},l_=Dn({name:"options",initialState:vX,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),yX=l_.reducer,{createEventEmitter:xX}=l_.actions;function bX(e){return e.tooltip.syncInteraction}var wX={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},s_=Dn({name:"chartData",initialState:wX,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;n!=null&&(e.dataStartIndex=n),r!=null&&(e.dataEndIndex=r)}}}),{setChartData:vC,setDataStartEndIndexes:jX,setComputedData:Qie}=s_.actions,SX=s_.reducer,kX=["x","y"];function yC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ll(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yC(Object(n),!0).forEach(function(r){CX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function CX(e,t,n){return(t=PX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function PX(e){var t=EX(e,"string");return typeof t=="symbol"?t:t+""}function EX(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function TX(e,t){if(e==null)return{};var n,r,i=OX(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function OX(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function AX(){var e=ke(P0),t=ke(E0),n=gt(),r=ke(hI),i=ke(ra),a=Ka(),l=gh(),s=ke(c=>c.rootProps.className);h.useEffect(()=>{if(e==null)return Ua;var c=(u,f,d)=>{if(t!==d&&e===u){if(f.payload.active===!1){n(nc({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(r==="index"){var p;if(l&&f!==null&&f!==void 0&&(p=f.payload)!==null&&p!==void 0&&p.coordinate&&f.payload.sourceViewBox){var m=f.payload.coordinate,{x:g,y}=m,x=TX(m,kX),{x:v,y:b,width:w,height:S}=f.payload.sourceViewBox,C=ll(ll({},x),{},{x:l.x+(w?(g-v)/w:0)*l.width,y:l.y+(S?(y-b)/S:0)*l.height});n(ll(ll({},f),{},{payload:ll(ll({},f.payload),{},{coordinate:C})}))}else n(f);return}if(i!=null){var j;if(typeof r=="function"){var E={activeTooltipIndex:f.payload.index==null?void 0:Number(f.payload.index),isTooltipActive:f.payload.active,activeIndex:f.payload.index==null?void 0:Number(f.payload.index),activeLabel:f.payload.label,activeDataKey:f.payload.dataKey,activeCoordinate:f.payload.coordinate},O=r(i,E);j=i[O]}else r==="value"&&(j=i.find(F=>String(F.value)===f.payload.label));var{coordinate:R}=f.payload;if(R==null||l==null){n(nc({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(j==null){n(nc({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:f.payload.sourceViewBox,graphicalItemId:void 0}));return}var{x:A,y:N}=R,_=Math.min(A,l.x+l.width),q=Math.min(N,l.y+l.height),W={x:a==="horizontal"?j.coordinate:_,y:a==="horizontal"?q:j.coordinate},I=nc({active:f.payload.active,coordinate:W,dataKey:f.payload.dataKey,index:String(j.index),label:f.payload.label,sourceViewBox:f.payload.sourceViewBox,graphicalItemId:f.payload.graphicalItemId});n(I)}}};return tu.on(Sy,c),()=>{tu.off(Sy,c)}},[s,n,t,e,r,i,a,l])}function IX(){var e=ke(P0),t=ke(E0),n=gt();h.useEffect(()=>{if(e==null)return Ua;var r=(i,a,l)=>{t!==l&&e===i&&n(jX(a))};return tu.on(gC,r),()=>{tu.off(gC,r)}},[n,t,e])}function NX(){var e=gt();h.useEffect(()=>{e(xX())},[e]),AX(),IX()}function _X(e,t,n,r,i,a){var l=ke(g=>UG(g,e,t)),s=ke(QN),c=ke(E0),u=ke(P0),f=ke(hI),d=ke(bX),p=(d==null?void 0:d.sourceViewBox)!=null,m=gh();h.useEffect(()=>{if(!p&&u!=null&&c!=null){var g=nc({active:a,coordinate:n,dataKey:l,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:m,graphicalItemId:s});tu.emit(Sy,u,g,c)}},[p,n,l,s,i,r,c,u,f,a,m])}function xC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function bC(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?xC(Object(n),!0).forEach(function(r){MX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function MX(e,t,n){return(t=RX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function RX(e){var t=DX(e,"string");return typeof t=="symbol"?t:t+""}function DX(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function LX(e){return e.dataKey}function zX(e,t){return h.isValidElement(e)?h.cloneElement(e,t):typeof e=="function"?h.createElement(e,t):h.createElement(pH,t)}var wC=[],$X={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function pl(e){var t,n,r=Gt(e,$X),{active:i,allowEscapeViewBox:a,animationDuration:l,animationEasing:s,content:c,filterNull:u,isAnimationActive:f,offset:d,payloadUniqBy:p,position:m,reverseDirection:g,useTranslate3d:y,wrapperStyle:x,cursor:v,shared:b,trigger:w,defaultIndex:S,portal:C,axisId:j}=r,E=gt(),O=typeof S=="number"?String(S):S;h.useEffect(()=>{E(_Y({shared:b,trigger:w,axisId:j,active:i,defaultIndex:O}))},[E,b,w,j,i,O]);var R=gh(),A=UA(),N=EY(b),{activeIndex:_,isActive:q}=(t=ke(fe=>HG(fe,N,w,O)))!==null&&t!==void 0?t:{},W=ke(fe=>KG(fe,N,w,O)),I=ke(fe=>r_(fe,N,w,O)),F=ke(fe=>WG(fe,N,w,O)),K=W,M=hX(),B=(n=i??q)!==null&&n!==void 0?n:!1,[k,L]=WO([K,B]),Q=N==="axis"?I:void 0;_X(N,w,F,Q,_,B);var T=C??M;if(T==null||R==null||N==null)return null;var ce=K??wC;B||(ce=wC),u&&ce.length&&(ce=RO(ce.filter(fe=>fe.value!=null&&(fe.hide!==!0||r.includeHidden)),p,LX));var ve=ce.length>0,X=bC(bC({},r),{},{payload:ce,label:Q,active:B,activeIndex:_,coordinate:F,accessibilityLayer:A}),oe=h.createElement(kH,{allowEscapeViewBox:a,animationDuration:l,animationEasing:s,isAnimationActive:f,active:B,coordinate:F,hasPayload:ve,offset:d,position:m,reverseDirection:g,useTranslate3d:y,viewBox:R,wrapperStyle:x,lastBoundingBox:k,innerRef:L,hasPortalFromProps:!!C},zX(c,X));return h.createElement(h.Fragment,null,Up.createPortal(oe,T),B&&h.createElement(pX,{cursor:v,tooltipEventType:N,coordinate:F,payload:ce,index:_}))}var Du=e=>null;Du.displayName="Cell";function BX(e,t,n){return(t=FX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function FX(e){var t=UX(e,"string");return typeof t=="symbol"?t:t+""}function UX(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class WX{constructor(t){BX(this,"cache",new Map),this.maxSize=t}get(t){var n=this.cache.get(t);return n!==void 0&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(t,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function jC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function KX(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?jC(Object(n),!0).forEach(function(r){HX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function HX(e,t,n){return(t=VX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function VX(e){var t=qX(e,"string");return typeof t=="symbol"?t:t+""}function qX(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var YX={cacheSize:2e3,enableCache:!0},c_=KX({},YX),SC=new WX(c_.cacheSize),GX={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},kC="recharts_measurement_span";function XX(e,t){var n=t.fontSize||"",r=t.fontFamily||"",i=t.fontWeight||"",a=t.fontStyle||"",l=t.letterSpacing||"",s=t.textTransform||"";return"".concat(e,"|").concat(n,"|").concat(r,"|").concat(i,"|").concat(a,"|").concat(l,"|").concat(s)}var CC=(e,t)=>{try{var n=document.getElementById(kC);n||(n=document.createElement("span"),n.setAttribute("id",kC),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,GX,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},yc=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||ju.isSsr)return{width:0,height:0};if(!c_.enableCache)return CC(t,n);var r=XX(t,n),i=SC.get(r);if(i)return i;var a=CC(t,n);return SC.set(r,a),a},u_;function QX(e,t,n){return(t=JX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function JX(e){var t=ZX(e,"string");return typeof t=="symbol"?t:t+""}function ZX(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var PC=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,EC=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,eQ=/^(px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q)$/,tQ=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,nQ={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},rQ=["cm","mm","pt","pc","in","Q","px"];function iQ(e){return rQ.includes(e)}var El="NaN";function aQ(e,t){return e*nQ[t]}class jn{static parse(t){var n,[,r,i]=(n=tQ.exec(t))!==null&&n!==void 0?n:[];return r==null?jn.NaN:new jn(parseFloat(r),i??"")}constructor(t,n){this.num=t,this.unit=n,this.num=t,this.unit=n,Gr(t)&&(this.unit=""),n!==""&&!eQ.test(n)&&(this.num=NaN,this.unit=""),iQ(n)&&(this.num=aQ(t,n),this.unit="px")}add(t){return this.unit!==t.unit?new jn(NaN,""):new jn(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new jn(NaN,""):new jn(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new jn(NaN,""):new jn(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new jn(NaN,""):new jn(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return Gr(this.num)}}u_=jn;QX(jn,"NaN",new u_(NaN,""));function d_(e){if(e==null||e.includes(El))return El;for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,a]=(n=PC.exec(t))!==null&&n!==void 0?n:[],l=jn.parse(r??""),s=jn.parse(a??""),c=i==="*"?l.multiply(s):l.divide(s);if(c.isNaN())return El;t=t.replace(PC,c.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var u,[,f,d,p]=(u=EC.exec(t))!==null&&u!==void 0?u:[],m=jn.parse(f??""),g=jn.parse(p??""),y=d==="+"?m.add(g):m.subtract(g);if(y.isNaN())return El;t=t.replace(EC,y.toString())}return t}var TC=/\(([^()]*)\)/;function oQ(e){for(var t=e,n;(n=TC.exec(t))!=null;){var[,r]=n;t=t.replace(TC,d_(r))}return t}function lQ(e){var t=e.replace(/\s+/g,"");return t=oQ(t),t=d_(t),t}function sQ(e){try{return lQ(e)}catch{return El}}function pg(e){var t=sQ(e.slice(5,-1));return t===El?"":t}var cQ=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],uQ=["dx","dy","angle","className","breakAll"];function ky(){return ky=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ky.apply(null,arguments)}function OC(e,t){if(e==null)return{};var n,r,i=dQ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function dQ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var f_=/[ \f\n\r\t\v\u2028\u2029]+/,p_=e=>{var{children:t,breakAll:n,style:r}=e;try{var i=[];Tt(t)||(n?i=t.toString().split(""):i=t.toString().split(f_));var a=i.map(s=>({word:s,width:yc(s,r).width})),l=n?0:yc(" ",r).width;return{wordsWithComputedWidth:a,spaceWidth:l}}catch{return null}};function h_(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}function fQ(e){return Tt(e)||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}var m_=(e,t,n,r)=>e.reduce((i,a)=>{var{word:l,width:s}=a,c=i[i.length-1];if(c&&s!=null&&(t==null||r||c.width+s+n<Number(t)))c.words.push(l),c.width+=s+n;else{var u={words:[l],width:s};i.push(u)}return i},[]),g_=e=>e.reduce((t,n)=>t.width>n.width?t:n),pQ="…",AC=(e,t,n,r,i,a,l,s)=>{var c=e.slice(0,t),u=p_({breakAll:n,style:r,children:c+pQ});if(!u)return[!1,[]];var f=m_(u.wordsWithComputedWidth,a,l,s),d=f.length>i||g_(f).width>Number(a);return[d,f]},hQ=(e,t,n,r,i)=>{var{maxLines:a,children:l,style:s,breakAll:c}=e,u=xe(a),f=String(l),d=m_(t,r,n,i);if(!u||i)return d;var p=d.length>a||g_(d).width>Number(r);if(!p)return d;for(var m=0,g=f.length-1,y=0,x;m<=g&&y<=f.length-1;){var v=Math.floor((m+g)/2),b=v-1,[w,S]=AC(f,b,c,s,a,r,n,i),[C]=AC(f,v,c,s,a,r,n,i);if(!w&&!C&&(m=v+1),w&&C&&(g=v-1),!w&&C){x=S;break}y++}return x||d},IC=e=>{var t=Tt(e)?[]:e.toString().split(f_);return[{words:t,width:void 0}]},mQ=e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:l}=e;if((t||n)&&!ju.isSsr){var s,c,u=p_({breakAll:a,children:r,style:i});if(u){var{wordsWithComputedWidth:f,spaceWidth:d}=u;s=f,c=d}else return IC(r);return hQ({breakAll:a,children:r,maxLines:l,style:i},s,c,t,!!n)}return IC(r)},v_="#808080",gQ={angle:0,breakAll:!1,capHeight:"0.71em",fill:v_,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},zh=h.forwardRef((e,t)=>{var n=Gt(e,gQ),{x:r,y:i,lineHeight:a,capHeight:l,fill:s,scaleToFit:c,textAnchor:u,verticalAnchor:f}=n,d=OC(n,cQ),p=h.useMemo(()=>mQ({breakAll:d.breakAll,children:d.children,maxLines:d.maxLines,scaleToFit:c,style:d.style,width:d.width}),[d.breakAll,d.children,d.maxLines,c,d.style,d.width]),{dx:m,dy:g,angle:y,className:x,breakAll:v}=d,b=OC(d,uQ);if(!wi(r)||!wi(i)||p.length===0)return null;var w=Number(r)+(xe(m)?m:0),S=Number(i)+(xe(g)?g:0);if(!He(w)||!He(S))return null;var C;switch(f){case"start":C=pg("calc(".concat(l,")"));break;case"middle":C=pg("calc(".concat((p.length-1)/2," * -").concat(a," + (").concat(l," / 2))"));break;default:C=pg("calc(".concat(p.length-1," * -").concat(a,")"));break}var j=[],E=p[0];if(c&&E!=null){var O=E.width,{width:R}=d;j.push("scale(".concat(xe(R)&&xe(O)?R/O:1,")"))}return y&&j.push("rotate(".concat(y,", ").concat(w,", ").concat(S,")")),j.length&&(b.transform=j.join(" ")),h.createElement("text",ky({},Mn(b),{ref:t,x:w,y:S,className:nt("recharts-text",x),textAnchor:u,fill:s.includes("url")?v_:s}),p.map((A,N)=>{var _=A.words.join(v?"":" ");return h.createElement("tspan",{x:w,dy:N===0?C:a,key:"".concat(_,"-").concat(N)},_)}))});zh.displayName="Text";function NC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function oi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?NC(Object(n),!0).forEach(function(r){vQ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):NC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function vQ(e,t,n){return(t=yQ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yQ(e){var t=xQ(e,"string");return typeof t=="symbol"?t:t+""}function xQ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var bQ=e=>{var{viewBox:t,position:n,offset:r=0,parentViewBox:i}=e,{x:a,y:l,height:s,upperWidth:c,lowerWidth:u}=g0(t),f=a,d=a+(c-u)/2,p=(f+d)/2,m=(c+u)/2,g=f+c/2,y=s>=0?1:-1,x=y*r,v=y>0?"end":"start",b=y>0?"start":"end",w=c>=0?1:-1,S=w*r,C=w>0?"end":"start",j=w>0?"start":"end",E=i;if(n==="top"){var O={x:f+c/2,y:l-x,horizontalAnchor:"middle",verticalAnchor:v};return E&&(O.height=Math.max(l-E.y,0),O.width=c),O}if(n==="bottom"){var R={x:d+u/2,y:l+s+x,horizontalAnchor:"middle",verticalAnchor:b};return E&&(R.height=Math.max(E.y+E.height-(l+s),0),R.width=u),R}if(n==="left"){var A={x:p-S,y:l+s/2,horizontalAnchor:C,verticalAnchor:"middle"};return E&&(A.width=Math.max(A.x-E.x,0),A.height=s),A}if(n==="right"){var N={x:p+m+S,y:l+s/2,horizontalAnchor:j,verticalAnchor:"middle"};return E&&(N.width=Math.max(E.x+E.width-N.x,0),N.height=s),N}var _=E?{width:m,height:s}:{};return n==="insideLeft"?oi({x:p+S,y:l+s/2,horizontalAnchor:j,verticalAnchor:"middle"},_):n==="insideRight"?oi({x:p+m-S,y:l+s/2,horizontalAnchor:C,verticalAnchor:"middle"},_):n==="insideTop"?oi({x:f+c/2,y:l+x,horizontalAnchor:"middle",verticalAnchor:b},_):n==="insideBottom"?oi({x:d+u/2,y:l+s-x,horizontalAnchor:"middle",verticalAnchor:v},_):n==="insideTopLeft"?oi({x:f+S,y:l+x,horizontalAnchor:j,verticalAnchor:b},_):n==="insideTopRight"?oi({x:f+c-S,y:l+x,horizontalAnchor:C,verticalAnchor:b},_):n==="insideBottomLeft"?oi({x:d+S,y:l+s-x,horizontalAnchor:j,verticalAnchor:v},_):n==="insideBottomRight"?oi({x:d+u-S,y:l+s-x,horizontalAnchor:C,verticalAnchor:v},_):n&&typeof n=="object"&&(xe(n.x)||Do(n.x))&&(xe(n.y)||Do(n.y))?oi({x:a+Nn(n.x,m),y:l+Nn(n.y,s),horizontalAnchor:"end",verticalAnchor:"end"},_):oi({x:g,y:l+s/2,horizontalAnchor:"middle",verticalAnchor:"middle"},_)},wQ=["labelRef"],jQ=["content"];function _C(e,t){if(e==null)return{};var n,r,i=SQ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function SQ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function MC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?MC(Object(n),!0).forEach(function(r){kQ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):MC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function kQ(e,t,n){return(t=CQ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function CQ(e){var t=PQ(e,"string");return typeof t=="symbol"?t:t+""}function PQ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _i(){return _i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_i.apply(null,arguments)}var y_=h.createContext(null),EQ=e=>{var{x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:l,children:s}=e,c=h.useMemo(()=>({x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:l}),[t,n,r,i,a,l]);return h.createElement(y_.Provider,{value:c},s)},x_=()=>{var e=h.useContext(y_),t=gh();return e||(t?g0(t):void 0)},TQ=h.createContext(null),OQ=()=>{var e=h.useContext(TQ),t=ke(xI);return e||t},AQ=e=>{var{value:t,formatter:n}=e,r=Tt(e.children)?t:e.children;return typeof n=="function"?n(r):r},Ab=e=>e!=null&&typeof e=="function",IQ=(e,t)=>{var n=mn(t-e),r=Math.min(Math.abs(t-e),360);return n*r},NQ=(e,t,n,r,i)=>{var{offset:a,className:l}=e,{cx:s,cy:c,innerRadius:u,outerRadius:f,startAngle:d,endAngle:p,clockWise:m}=i,g=(u+f)/2,y=IQ(d,p),x=y>=0?1:-1,v,b;switch(t){case"insideStart":v=d+x*a,b=m;break;case"insideEnd":v=p-x*a,b=!m;break;case"end":v=p+x*a,b=m;break;default:throw new Error("Unsupported position ".concat(t))}b=y<=0?b:!b;var w=en(s,c,g,v),S=en(s,c,g,v+(b?1:-1)*359),C="M".concat(w.x,",").concat(w.y,`
453
+ A`).concat(g,",").concat(g,",0,1,").concat(b?0:1,`,
454
+ `).concat(S.x,",").concat(S.y),j=Tt(e.id)?Uc("recharts-radial-line-"):e.id;return h.createElement("text",_i({},r,{dominantBaseline:"central",className:nt("recharts-radial-bar-label",l)}),h.createElement("defs",null,h.createElement("path",{id:j,d:C})),h.createElement("textPath",{xlinkHref:"#".concat(j)},n))},_Q=(e,t,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:l,startAngle:s,endAngle:c}=e,u=(s+c)/2;if(n==="outside"){var{x:f,y:d}=en(r,i,l+t,u);return{x:f,y:d,textAnchor:f>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var p=(a+l)/2,{x:m,y:g}=en(r,i,p,u);return{x:m,y:g,textAnchor:"middle",verticalAnchor:"middle"}},Gd=e=>e!=null&&"cx"in e&&xe(e.cx),MQ={angle:0,offset:5,zIndex:Yt.label,position:"middle",textBreakAll:!1};function RQ(e){if(!Gd(e))return e;var{cx:t,cy:n,outerRadius:r}=e,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function pa(e){var t=Gt(e,MQ),{viewBox:n,parentViewBox:r,position:i,value:a,children:l,content:s,className:c="",textBreakAll:u,labelRef:f}=t,d=OQ(),p=x_(),m=i==="center"?p:d??p,g,y,x;n==null?g=m:Gd(n)?g=n:g=g0(n);var v=RQ(g);if(!g||Tt(a)&&Tt(l)&&!h.isValidElement(s)&&typeof s!="function")return null;var b=rc(rc({},t),{},{viewBox:g});if(h.isValidElement(s)){var{labelRef:w}=b,S=_C(b,wQ);return h.cloneElement(s,S)}if(typeof s=="function"){var{content:C}=b,j=_C(b,jQ);if(y=h.createElement(s,j),h.isValidElement(y))return y}else y=AQ(t);var E=Mn(t);if(Gd(g)){if(i==="insideStart"||i==="insideEnd"||i==="end")return NQ(t,i,y,E,g);x=_Q(g,t.offset,t.position)}else{if(!v)return null;var O=bQ({viewBox:v,position:i,offset:t.offset,parentViewBox:Gd(r)?void 0:r});x=rc(rc({x:O.x,y:O.y,textAnchor:O.horizontalAnchor,verticalAnchor:O.verticalAnchor},O.width!==void 0?{width:O.width}:{}),O.height!==void 0?{height:O.height}:{})}return h.createElement(qn,{zIndex:t.zIndex},h.createElement(zh,_i({ref:f,className:nt("recharts-label",c)},E,x,{textAnchor:h_(E.textAnchor)?E.textAnchor:x.textAnchor,breakAll:u}),y))}pa.displayName="Label";var DQ=(e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return e===!0?h.createElement(pa,_i({key:"label-implicit"},r)):wi(e)?h.createElement(pa,_i({key:"label-implicit",value:e},r)):h.isValidElement(e)?e.type===pa?h.cloneElement(e,rc({key:"label-implicit"},r)):h.createElement(pa,_i({key:"label-implicit",content:e},r)):Ab(e)?h.createElement(pa,_i({key:"label-implicit",content:e},r)):e&&typeof e=="object"?h.createElement(pa,_i({},e,{key:"label-implicit"},r)):null};function LQ(e){var{label:t,labelRef:n}=e,r=x_();return DQ(t,r,n)||null}var zQ=["valueAccessor"],$Q=["dataKey","clockWise","id","textBreakAll","zIndex"];function vp(){return vp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vp.apply(null,arguments)}function RC(e,t){if(e==null)return{};var n,r,i=BQ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function BQ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var FQ=e=>{var t=Array.isArray(e.value)?e.value[e.value.length-1]:e.value;if(fQ(t))return t},b_=h.createContext(void 0),Ib=b_.Provider,w_=h.createContext(void 0),UQ=w_.Provider;function WQ(){return h.useContext(b_)}function KQ(){return h.useContext(w_)}function Xd(e){var{valueAccessor:t=FQ}=e,n=RC(e,zQ),{dataKey:r,clockWise:i,id:a,textBreakAll:l,zIndex:s}=n,c=RC(n,$Q),u=WQ(),f=KQ(),d=u||f;return!d||!d.length?null:h.createElement(qn,{zIndex:s??Yt.label},h.createElement(zt,{className:"recharts-label-list"},d.map((p,m)=>{var g,y=Tt(r)?t(p,m):at(p.payload,r),x=Tt(a)?{}:{id:"".concat(a,"-").concat(m)};return h.createElement(pa,vp({key:"label-".concat(m)},Mn(p),c,x,{fill:(g=n.fill)!==null&&g!==void 0?g:p.fill,parentViewBox:p.parentViewBox,value:y,textBreakAll:l,viewBox:p.viewBox,index:m,zIndex:0}))})))}Xd.displayName="LabelList";function $h(e){var{label:t}=e;return t?t===!0?h.createElement(Xd,{key:"labelList-implicit"}):h.isValidElement(t)||Ab(t)?h.createElement(Xd,{key:"labelList-implicit",content:t}):typeof t=="object"?h.createElement(Xd,vp({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function Cy(){return Cy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Cy.apply(null,arguments)}var j_=e=>{var{cx:t,cy:n,r,className:i}=e,a=nt("recharts-dot",i);return xe(t)&&xe(n)&&xe(r)?h.createElement("circle",Cy({},Wn(e),a0(e),{className:a,cx:t,cy:n,r})):null},S_=e=>e.graphicalItems.polarItems,HQ=H([$t,Pu],rb),Bh=H([S_,Kt,HQ],ib),VQ=H([Bh],ab),Fh=H([VQ,Su],ob),qQ=H([Fh,Kt,Bh],uN);H([Fh,Kt,Bh],(e,t,n)=>n.length>0?e.flatMap(r=>n.flatMap(i=>{var a,l=at(r,(a=t.dataKey)!==null&&a!==void 0?a:i.dataKey);return{value:l,errorDomain:[]}})).filter(Boolean):(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:at(r,t.dataKey),errorDomain:[]})):e.map(r=>({value:r,errorDomain:[]})));var DC=()=>{},YQ=H([Fh,Kt,Bh,_h,$t,A9],db),GQ=H([Kt,cb,ub,DC,YQ,DC,Ze,$t],fb),k_=H([Kt,Ze,Fh,qQ,Cu,$t,GQ],pb),XQ=H([k_,js,qa],mb),QQ=H([Kt,k_,XQ,$t],vb);H([qa,QQ],wI);var JQ={radiusAxis:{},angleAxis:{}},C_=Dn({name:"polarAxis",initialState:JQ,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:Jie,removeRadiusAxis:Zie,addAngleAxis:eae,removeAngleAxis:tae}=C_.actions,ZQ=C_.reducer;function P_(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}function LC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function zC(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?LC(Object(n),!0).forEach(function(r){eJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):LC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function eJ(e,t,n){return(t=tJ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tJ(e){var t=nJ(e,"string");return typeof t=="symbol"?t:t+""}function nJ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var rJ=(e,t)=>t,Nb=H([S_,rJ],(e,t)=>e.filter(n=>n.type==="pie").find(n=>n.id===t)),iJ=[],_b=(e,t,n)=>(n==null?void 0:n.length)===0?iJ:n,E_=H([Su,Nb,_b],(e,t,n)=>{var{chartData:r}=e;if(t!=null){var i;if((t==null?void 0:t.data)!=null&&t.data.length>0?i=t.data:i=r,(!i||!i.length)&&n!=null&&(i=n.map(a=>zC(zC({},t.presentationProps),a.props))),i!=null)return i}}),aJ=H([E_,Nb,_b],(e,t,n)=>{if(!(e==null||t==null))return e.map((r,i)=>{var a,l=at(r,t.nameKey,t.name),s;return n!=null&&(a=n[i])!==null&&a!==void 0&&(a=a.props)!==null&&a!==void 0&&a.fill?s=n[i].props.fill:typeof r=="object"&&r!=null&&"fill"in r?s=r.fill:s=t.fill,{value:Wa(l,t.dataKey),color:s,payload:r,type:t.legendType}})}),oJ=H([E_,Nb,_b,cn],(e,t,n,r)=>{if(!(t==null||e==null))return lZ({offset:r,pieSettings:t,displayedData:e,cells:n})}),T_={exports:{}},xt={};/**
455
+ * @license React
456
+ * react-is.production.js
457
+ *
458
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
459
+ *
460
+ * This source code is licensed under the MIT license found in the
461
+ * LICENSE file in the root directory of this source tree.
462
+ */var Mb=Symbol.for("react.transitional.element"),Rb=Symbol.for("react.portal"),Uh=Symbol.for("react.fragment"),Wh=Symbol.for("react.strict_mode"),Kh=Symbol.for("react.profiler"),Hh=Symbol.for("react.consumer"),Vh=Symbol.for("react.context"),qh=Symbol.for("react.forward_ref"),Yh=Symbol.for("react.suspense"),Gh=Symbol.for("react.suspense_list"),Xh=Symbol.for("react.memo"),Qh=Symbol.for("react.lazy"),lJ=Symbol.for("react.view_transition"),sJ=Symbol.for("react.client.reference");function Dr(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case Mb:switch(e=e.type,e){case Uh:case Kh:case Wh:case Yh:case Gh:case lJ:return e;default:switch(e=e&&e.$$typeof,e){case Vh:case qh:case Qh:case Xh:return e;case Hh:return e;default:return t}}case Rb:return t}}}xt.ContextConsumer=Hh;xt.ContextProvider=Vh;xt.Element=Mb;xt.ForwardRef=qh;xt.Fragment=Uh;xt.Lazy=Qh;xt.Memo=Xh;xt.Portal=Rb;xt.Profiler=Kh;xt.StrictMode=Wh;xt.Suspense=Yh;xt.SuspenseList=Gh;xt.isContextConsumer=function(e){return Dr(e)===Hh};xt.isContextProvider=function(e){return Dr(e)===Vh};xt.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Mb};xt.isForwardRef=function(e){return Dr(e)===qh};xt.isFragment=function(e){return Dr(e)===Uh};xt.isLazy=function(e){return Dr(e)===Qh};xt.isMemo=function(e){return Dr(e)===Xh};xt.isPortal=function(e){return Dr(e)===Rb};xt.isProfiler=function(e){return Dr(e)===Kh};xt.isStrictMode=function(e){return Dr(e)===Wh};xt.isSuspense=function(e){return Dr(e)===Yh};xt.isSuspenseList=function(e){return Dr(e)===Gh};xt.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===Uh||e===Kh||e===Wh||e===Yh||e===Gh||typeof e=="object"&&e!==null&&(e.$$typeof===Qh||e.$$typeof===Xh||e.$$typeof===Vh||e.$$typeof===Hh||e.$$typeof===qh||e.$$typeof===sJ||e.getModuleId!==void 0)};xt.typeOf=Dr;T_.exports=xt;var cJ=T_.exports,$C=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",BC=null,hg=null,O_=e=>{if(e===BC&&Array.isArray(hg))return hg;var t=[];return h.Children.forEach(e,n=>{Tt(n)||(cJ.isFragment(n)?t=t.concat(O_(n.props.children)):t.push(n))}),hg=t,BC=e,t};function Db(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(i=>$C(i)):r=[$C(t)],O_(e).forEach(i=>{var a=bi(i,"type.displayName")||bi(i,"type.name");a&&r.indexOf(a)!==-1&&n.push(i)}),n}var Lb=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0;function uJ(e){var n;if(typeof e!="object"||e==null)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(Object.prototype.toString.call(e)!=="[object Object]"){const r=e[Symbol.toStringTag];return r==null||!((n=Object.getOwnPropertyDescriptor(e,Symbol.toStringTag))!=null&&n.writable)?!1:e.toString()===`[object ${r}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}var FC,UC,WC,KC,HC;function VC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function qC(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?VC(Object(n),!0).forEach(function(r){dJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function dJ(e,t,n){return(t=fJ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fJ(e){var t=pJ(e,"string");return typeof t=="symbol"?t:t+""}function pJ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yp(){return yp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yp.apply(null,arguments)}function qs(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var YC=(e,t,n,r,i)=>{var a=n-r,l;return l=Ut(FC||(FC=qs(["M ",",",""])),e,t),l+=Ut(UC||(UC=qs(["L ",",",""])),e+n,t),l+=Ut(WC||(WC=qs(["L ",",",""])),e+n-a/2,t+i),l+=Ut(KC||(KC=qs(["L ",",",""])),e+n-a/2-r,t+i),l+=Ut(HC||(HC=qs(["L ",","," Z"])),e,t),l},hJ={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},mJ=e=>{var t=Gt(e,hJ),{x:n,y:r,upperWidth:i,lowerWidth:a,height:l,className:s}=t,{animationEasing:c,animationDuration:u,animationBegin:f,isUpdateAnimationActive:d}=t,p=h.useRef(null),[m,g]=h.useState(-1),y=h.useRef(i),x=h.useRef(a),v=h.useRef(l),b=h.useRef(n),w=h.useRef(r),S=vs(e,"trapezoid-");if(h.useEffect(()=>{if(p.current&&p.current.getTotalLength)try{var W=p.current.getTotalLength();W&&g(W)}catch{}},[]),n!==+n||r!==+r||i!==+i||a!==+a||l!==+l||i===0&&a===0||l===0)return null;var C=nt("recharts-trapezoid",s);if(!d)return h.createElement("g",null,h.createElement("path",yp({},Mn(t),{className:C,d:YC(n,r,i,a,l)})));var j=y.current,E=x.current,O=v.current,R=b.current,A=w.current,N="0px ".concat(m===-1?1:m,"px"),_="".concat(m,"px ").concat(m,"px"),q=WA(["strokeDasharray"],u,c);return h.createElement(gs,{animationId:S,key:S,canBegin:m>0,duration:u,easing:c,isActive:d,begin:f},W=>{var I=ct(j,i,W),F=ct(E,a,W),K=ct(O,l,W),M=ct(R,n,W),B=ct(A,r,W);p.current&&(y.current=I,x.current=F,v.current=K,b.current=M,w.current=B);var k=W>0?{transition:q,strokeDasharray:_}:{strokeDasharray:N};return h.createElement("path",yp({},Mn(t),{className:C,d:YC(M,B,I,F,K),ref:p,style:qC(qC({},k),t.style)}))})},gJ=["option","shapeType","activeClassName","inActiveClassName"];function vJ(e,t){if(e==null)return{};var n,r,i=yJ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function yJ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function GC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function xp(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?GC(Object(n),!0).forEach(function(r){xJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function xJ(e,t,n){return(t=bJ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bJ(e){var t=wJ(e,"string");return typeof t=="symbol"?t:t+""}function wJ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jJ(e,t){return xp(xp({},t),e)}function SJ(e,t){return e==="symbols"}function XC(e){var{shapeType:t,elementProps:n}=e;switch(t){case"rectangle":return h.createElement(qA,n);case"trapezoid":return h.createElement(mJ,n);case"sector":return h.createElement(QA,n);case"symbols":if(SJ(t))return h.createElement(i0,n);break;case"curve":return h.createElement(Bl,n);default:return null}}function kJ(e){return h.isValidElement(e)?e.props:e}function zb(e){var{option:t,shapeType:n,activeClassName:r="recharts-active-shape",inActiveClassName:i="recharts-shape"}=e,a=vJ(e,gJ),l;if(h.isValidElement(t))l=h.cloneElement(t,xp(xp({},a),kJ(t)));else if(typeof t=="function")l=t(a,a.index);else if(uJ(t)&&typeof t!="boolean"){var s=jJ(t,a);l=h.createElement(XC,{shapeType:n,elementProps:s})}else{var c=a;l=h.createElement(XC,{shapeType:n,elementProps:c})}return a.isActive?h.createElement(zt,{className:r},l):h.createElement(zt,{className:i},l)}var $b=(e,t,n)=>{var r=gt();return(i,a)=>l=>{e==null||e(i,a,l),r(RN({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},Bb=e=>{var t=gt();return(n,r)=>i=>{e==null||e(n,r,i),t(MY())}},Fb=(e,t,n)=>{var r=gt();return(i,a)=>l=>{e==null||e(i,a,l),r(RY({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}};function Jh(e){var{tooltipEntrySettings:t}=e,n=gt(),r=vn(),i=h.useRef(null);return h.useLayoutEffect(()=>{r||(i.current===null?n(AY(t)):i.current!==t&&n(IY({prev:i.current,next:t})),i.current=t)},[t,n,r]),h.useLayoutEffect(()=>()=>{i.current&&(n(NY(i.current)),i.current=null)},[n]),null}function Ub(e){var{legendPayload:t}=e,n=gt(),r=vn(),i=h.useRef(null);return h.useLayoutEffect(()=>{r||(i.current===null?n(zA(t)):i.current!==t&&n($A({prev:i.current,next:t})),i.current=t)},[n,r,t]),h.useLayoutEffect(()=>()=>{i.current&&(n(BA(i.current)),i.current=null)},[n]),null}function CJ(e){var{legendPayload:t}=e,n=gt(),r=ke(Ze),i=h.useRef(null);return h.useLayoutEffect(()=>{r!=="centric"&&r!=="radial"||(i.current===null?n(zA(t)):i.current!==t&&n($A({prev:i.current,next:t})),i.current=t)},[n,r,t]),h.useLayoutEffect(()=>()=>{i.current&&(n(BA(i.current)),i.current=null)},[n]),null}var mg,PJ=()=>{var[e]=h.useState(()=>Uc("uid-"));return e},EJ=(mg=UP.useId)!==null&&mg!==void 0?mg:PJ;function TJ(e,t){var n=EJ();return t||(e?"".concat(e,"-").concat(n):n)}var OJ=h.createContext(void 0),Zh=e=>{var{id:t,type:n,children:r}=e,i=TJ("recharts-".concat(n),t);return h.createElement(OJ.Provider,{value:i},r(i))},AJ={cartesianItems:[],polarItems:[]},A_=Dn({name:"graphicalItems",initialState:AJ,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:Ct()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Or(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:Ct()},removeCartesianGraphicalItem:{reducer(e,t){var n=Or(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:Ct()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:Ct()},removePolarGraphicalItem:{reducer(e,t){var n=Or(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:Ct()},replacePolarGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=Or(e).polarItems.indexOf(n);i>-1&&(e.polarItems[i]=r)},prepare:Ct()}}}),{addCartesianGraphicalItem:IJ,replaceCartesianGraphicalItem:NJ,removeCartesianGraphicalItem:_J,addPolarGraphicalItem:MJ,removePolarGraphicalItem:RJ,replacePolarGraphicalItem:DJ}=A_.actions,LJ=A_.reducer,zJ=e=>{var t=gt(),n=h.useRef(null);return h.useLayoutEffect(()=>{n.current===null?t(IJ(e)):n.current!==e&&t(NJ({prev:n.current,next:e})),n.current=e},[t,e]),h.useLayoutEffect(()=>()=>{n.current&&(t(_J(n.current)),n.current=null)},[t]),null},Wb=h.memo(zJ),$J=e=>{var t=gt(),n=h.useRef(null);return h.useLayoutEffect(()=>{n.current===null?t(MJ(e)):n.current!==e&&t(DJ({prev:n.current,next:e})),n.current=e},[t,e]),h.useLayoutEffect(()=>()=>{n.current&&(t(RJ(n.current)),n.current=null)},[t]),null},BJ=h.memo($J),FJ=["key"],UJ=["onMouseEnter","onClick","onMouseLeave"],WJ=["id"],KJ=["id"];function Da(){return Da=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Da.apply(null,arguments)}function em(e,t){if(e==null)return{};var n,r,i=HJ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function HJ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function QC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ot(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?QC(Object(n),!0).forEach(function(r){VJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function VJ(e,t,n){return(t=qJ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qJ(e){var t=YJ(e,"string");return typeof t=="symbol"?t:t+""}function YJ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function GJ(e){var t=h.useMemo(()=>Db(e.children,Du),[e.children]),n=ke(r=>aJ(r,e.id,t));return n==null?null:h.createElement(CJ,{legendPayload:n})}function XJ(e){if(!(e==null||typeof e=="boolean"||typeof e=="function")){if(h.isValidElement(e)){var t,n=(t=e.props)===null||t===void 0?void 0:t.fill;return typeof n=="string"?n:void 0}var{fill:r}=e;return typeof r=="string"?r:void 0}}var QJ=h.memo(e=>{var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:a,fill:l,name:s,hide:c,tooltipType:u,id:f,activeShape:d}=e,p=XJ(d),m=r.map(y=>{var x=y.tooltipPayload;return p==null||x==null?x:x.map(v=>Ot(Ot({},v),{},{color:p,fill:p}))}),g={dataDefinedOnItem:m,getPosition:y=>{var x;return(x=r[Number(y)])===null||x===void 0?void 0:x.tooltipPosition},settings:{stroke:i,strokeWidth:a,fill:l,dataKey:t,nameKey:n,name:Wa(s,t),hide:c,type:u,color:l,unit:"",graphicalItemId:f}};return h.createElement(Jh,{tooltipEntrySettings:g})}),JJ=(e,t)=>e>t?"start":e<t?"end":"middle",ZJ=(e,t,n)=>Nn(typeof t=="function"?t(e):t,n,n*.8),eZ=(e,t,n)=>{var{top:r,left:i,width:a,height:l}=t,s=YA(a,l),c=i+Nn(e.cx,a,a/2),u=r+Nn(e.cy,l,l/2),f=Nn(e.innerRadius,s,0),d=ZJ(n,e.outerRadius,s),p=e.maxRadius||Math.sqrt(a*a+l*l)/2;return{cx:c,cy:u,innerRadius:f,outerRadius:d,maxRadius:p}},tZ=(e,t)=>{var n=mn(t-e),r=Math.min(Math.abs(t-e),360);return n*r},nZ=(e,t)=>{if(h.isValidElement(e))return h.cloneElement(e,t);if(typeof e=="function")return e(t);var n=nt("recharts-pie-label-line",typeof e!="boolean"?e.className:""),{key:r}=t,i=em(t,FJ);return h.createElement(Bl,Da({},i,{type:"linear",className:n}))},rZ=(e,t,n)=>{if(h.isValidElement(e))return h.cloneElement(e,t);var r=n;if(typeof e=="function"&&(r=e(t),h.isValidElement(r)))return r;var i=nt("recharts-pie-label-text",P_(e));return h.createElement(zh,Da({},t,{alignmentBaseline:"middle",className:i}),r)};function iZ(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:a,dataKey:l}=n;if(!r||!i||!t)return null;var s=Wn(n),c=Mo(i),u=Mo(a),f=typeof i=="object"&&"offsetRadius"in i&&typeof i.offsetRadius=="number"&&i.offsetRadius||20,d=t.map((p,m)=>{var g=(p.startAngle+p.endAngle)/2,y=en(p.cx,p.cy,p.outerRadius+f,g),x=Ot(Ot(Ot(Ot({},s),p),{},{stroke:"none"},c),{},{index:m,textAnchor:JJ(y.x,p.cx)},y),v=Ot(Ot(Ot(Ot({},s),p),{},{fill:"none",stroke:p.fill},u),{},{index:m,points:[en(p.cx,p.cy,p.outerRadius,g),y],key:"line"});return h.createElement(qn,{zIndex:Yt.label,key:"label-".concat(p.startAngle,"-").concat(p.endAngle,"-").concat(p.midAngle,"-").concat(m)},h.createElement(zt,null,a&&nZ(a,v),rZ(i,x,at(p,l))))});return h.createElement(zt,{className:"recharts-pie-labels"},d)}function aZ(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return typeof i=="object"&&i!=null&&"position"in i?h.createElement($h,{label:i}):h.createElement(iZ,{sectors:t,props:n,showLabels:r})}function oZ(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i,shape:a,id:l}=e,s=ke(Ra),c=ke(Cb),u=ke(QN),{onMouseEnter:f,onClick:d,onMouseLeave:p}=i,m=em(i,UJ),g=$b(f,i.dataKey,l),y=Bb(p),x=Fb(d,i.dataKey,l);return t==null||t.length===0?null:h.createElement(h.Fragment,null,t.map((v,b)=>{if((v==null?void 0:v.startAngle)===0&&(v==null?void 0:v.endAngle)===0&&t.length!==1)return null;var w=u==null||u===l,S=String(b)===s&&(c==null||i.dataKey===c)&&w,C=s?r:null,j=n&&S?n:C,E=Ot(Ot({},v),{},{stroke:v.stroke,tabIndex:-1,[kA]:b,[CA]:l});return h.createElement(zt,Da({key:"sector-".concat(v==null?void 0:v.startAngle,"-").concat(v==null?void 0:v.endAngle,"-").concat(v.midAngle,"-").concat(b),tabIndex:-1,className:"recharts-pie-sector"},mu(m,v,b),{onMouseEnter:g(v,b),onMouseLeave:y(v,b),onClick:x(v,b)}),h.createElement(zb,Da({option:a??j,index:b,shapeType:"sector",isActive:S},E)))}))}function lZ(e){var t,{pieSettings:n,displayedData:r,cells:i,offset:a}=e,{cornerRadius:l,startAngle:s,endAngle:c,dataKey:u,nameKey:f,tooltipType:d}=n,p=Math.abs(n.minAngle),m=tZ(s,c),g=Math.abs(m),y=r.length<=1?0:(t=n.paddingAngle)!==null&&t!==void 0?t:0,x=r.filter(O=>at(O,u,0)!==0).length,v=(g>=360?x:x-1)*y,b=r.reduce((O,R)=>{var A=at(R,u,0);return O+(xe(A)?A:0)},0),w=p>0&&b>0&&r.some(O=>{var R=at(O,u,0),A=(xe(R)?R:0)/b;return R!==0&&A*g<p}),S=w?p:0,C=g-x*S-v,j;if(b>0){var E;j=r.map((O,R)=>{var A=at(O,u,0),N=at(O,f,R),_=eZ(n,a,O),q=(xe(A)?A:0)/b,W,I=Ot(Ot({},O),i&&i[R]&&i[R].props),F=I!=null&&"fill"in I&&typeof I.fill=="string"?I.fill:n.fill;R?W=E.endAngle+mn(m)*y*(A!==0?1:0):W=s;var K=W+mn(m)*((A!==0?S:0)+q*C),M=(W+K)/2,B=(_.innerRadius+_.outerRadius)/2,k=[{name:N,value:A,payload:I,dataKey:u,type:d,color:F,fill:F,graphicalItemId:n.id}],L=en(_.cx,_.cy,B,M);return E=Ot(Ot(Ot(Ot({},n.presentationProps),{},{percent:q,cornerRadius:typeof l=="string"?parseFloat(l):l,name:N,tooltipPayload:k,midAngle:M,middleRadius:B,tooltipPosition:L},I),_),{},{value:A,dataKey:u,startAngle:W,endAngle:K,payload:I,paddingAngle:A!==0?mn(m)*y:0}),E})}return j}function sZ(e){var{showLabels:t,sectors:n,children:r}=e,i=h.useMemo(()=>!t||!n?[]:n.map(a=>({value:a.value,payload:a.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:a.cx,cy:a.cy,innerRadius:a.innerRadius,outerRadius:a.outerRadius,startAngle:a.startAngle,endAngle:a.endAngle,clockWise:!1},fill:a.fill})),[n,t]);return h.createElement(UQ,{value:t?i:void 0},r)}function cZ(e){var{props:t,previousSectorsRef:n,id:r}=e,{sectors:i,isAnimationActive:a,animationBegin:l,animationDuration:s,animationEasing:c,activeShape:u,inactiveShape:f,onAnimationStart:d,onAnimationEnd:p}=t,m=vs(t,"recharts-pie-"),g=n.current,[y,x]=h.useState(!1),v=h.useCallback(()=>{typeof p=="function"&&p(),x(!1)},[p]),b=h.useCallback(()=>{typeof d=="function"&&d(),x(!0)},[d]);return h.createElement(sZ,{showLabels:!y,sectors:i},h.createElement(gs,{animationId:m,begin:l,duration:s,isActive:a,easing:c,onAnimationStart:b,onAnimationEnd:v,key:m},w=>{var S,C=[],j=i&&i[0],E=(S=j==null?void 0:j.startAngle)!==null&&S!==void 0?S:0;return i==null||i.forEach((O,R)=>{var A=g&&g[R],N=R>0?bi(O,"paddingAngle",0):0;if(A){var _=ct(A.endAngle-A.startAngle,O.endAngle-O.startAngle,w),q=Ot(Ot({},O),{},{startAngle:E+N,endAngle:E+_+N});C.push(q),E=q.endAngle}else{var{endAngle:W,startAngle:I}=O,F=ct(0,W-I,w),K=Ot(Ot({},O),{},{startAngle:E+N,endAngle:E+F+N});C.push(K),E=K.endAngle}}),n.current=C,h.createElement(zt,null,h.createElement(oZ,{sectors:C,activeShape:u,inactiveShape:f,allOtherPieProps:t,shape:t.shape,id:r}))}),h.createElement(aZ,{showLabels:!y,sectors:i,props:t}),t.children)}var uZ={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:Yt.area};function dZ(e){var{id:t}=e,n=em(e,WJ),{hide:r,className:i,rootTabIndex:a}=e,l=h.useMemo(()=>Db(e.children,Du),[e.children]),s=ke(f=>oJ(f,t,l)),c=h.useRef(null),u=nt("recharts-pie",i);return r||s==null?(c.current=null,h.createElement(zt,{tabIndex:a,className:u})):h.createElement(qn,{zIndex:e.zIndex},h.createElement(QJ,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:s,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t,activeShape:e.activeShape}),h.createElement(zt,{tabIndex:a,className:u},h.createElement(cZ,{props:Ot(Ot({},n),{},{sectors:s}),previousSectorsRef:c,id:t})))}function fZ(e){var t=Gt(e,uZ),{id:n}=t,r=em(t,KJ),i=Wn(r);return h.createElement(Zh,{id:n,type:"pie"},a=>h.createElement(h.Fragment,null,h.createElement(BJ,{type:"pie",id:a,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),h.createElement(GJ,Da({},r,{id:a})),h.createElement(dZ,Da({},r,{id:a}))))}var I_=fZ;I_.displayName="Pie";var pZ=["points"];function JC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function gg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?JC(Object(n),!0).forEach(function(r){hZ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):JC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function hZ(e,t,n){return(t=mZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mZ(e){var t=gZ(e,"string");return typeof t=="symbol"?t:t+""}function gZ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function bp(){return bp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bp.apply(null,arguments)}function vZ(e,t){if(e==null)return{};var n,r,i=yZ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function yZ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function xZ(e){var{option:t,dotProps:n,className:r}=e;if(h.isValidElement(t))return h.cloneElement(t,n);if(typeof t=="function")return t(n);var i=nt(r,typeof t!="boolean"?t.className:""),a=n??{},{points:l}=a,s=vZ(a,pZ);return h.createElement(j_,bp({},s,{className:i}))}function bZ(e,t){return e==null?!1:t?!0:e.length===1}function N_(e){var{points:t,dot:n,className:r,dotClassName:i,dataKey:a,baseProps:l,needClip:s,clipPathId:c,zIndex:u=Yt.scatter}=e;if(!bZ(t,n))return null;var f=Lb(n),d=N8(n),p=t.map((g,y)=>{var x,v,b=gg(gg(gg({r:3},l),d),{},{index:y,cx:(x=g.x)!==null&&x!==void 0?x:void 0,cy:(v=g.y)!==null&&v!==void 0?v:void 0,dataKey:a,value:g.value,payload:g.payload,points:t});return h.createElement(xZ,{key:"dot-".concat(y),option:n,dotProps:b,className:i})}),m={};return s&&c!=null&&(m.clipPath="url(#clipPath-".concat(f?"":"dots-").concat(c,")")),h.createElement(qn,{zIndex:u},h.createElement(zt,bp({className:r},m),p))}function ZC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function eP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ZC(Object(n),!0).forEach(function(r){wZ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ZC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function wZ(e,t,n){return(t=jZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jZ(e){var t=SZ(e,"string");return typeof t=="symbol"?t:t+""}function SZ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var __=0,kZ={xAxis:{},yAxis:{},zAxis:{}},M_=Dn({name:"cartesianAxis",initialState:kZ,reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:Ct()},replaceXAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;e.xAxis[n.id]!==void 0&&(n.id!==r.id&&delete e.xAxis[n.id],e.xAxis[r.id]=r)},prepare:Ct()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:Ct()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:Ct()},replaceYAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;e.yAxis[n.id]!==void 0&&(n.id!==r.id&&delete e.yAxis[n.id],e.yAxis[r.id]=r)},prepare:Ct()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:Ct()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:Ct()},replaceZAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;e.zAxis[n.id]!==void 0&&(n.id!==r.id&&delete e.zAxis[n.id],e.zAxis[r.id]=r)},prepare:Ct()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:Ct()},updateYAxisWidth(e,t){var{id:n,width:r}=t.payload,i=e.yAxis[n];if(i){var a,l=i.widthHistory||[];if(l.length===3&&l[0]===l[2]&&r===l[1]&&r!==i.width&&Math.abs(r-((a=l[0])!==null&&a!==void 0?a:0))<=1)return;var s=[...l,r].slice(-3);e.yAxis[n]=eP(eP({},i),{},{width:r,widthHistory:s})}}}}),{addXAxis:CZ,replaceXAxis:PZ,removeXAxis:EZ,addYAxis:TZ,replaceYAxis:OZ,removeYAxis:AZ,addZAxis:nae,replaceZAxis:rae,removeZAxis:iae,updateYAxisWidth:IZ}=M_.actions,NZ=M_.reducer,_Z=H([cn],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),MZ=H([_Z,Ji,Zi],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),tm=()=>ke(MZ),RZ=()=>ke(OG);function tP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function vg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tP(Object(n),!0).forEach(function(r){DZ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function DZ(e,t,n){return(t=LZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function LZ(e){var t=zZ(e,"string");return typeof t=="symbol"?t:t+""}function zZ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var $Z=e=>{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:a,clipPath:l}=e;if(i===!1||t.x==null||t.y==null)return null;var s={index:n,dataKey:a,cx:t.x,cy:t.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},c=vg(vg(vg({},s),Mo(i)),a0(i)),u;return h.isValidElement(i)?u=h.cloneElement(i,c):typeof i=="function"?u=i(c):u=h.createElement(j_,c),h.createElement(zt,{className:"recharts-active-dot",clipPath:l},u)};function Py(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:l=Yt.activeDot}=e,s=ke(Ra),c=RZ();if(t==null||c==null)return null;var u=t.find(f=>c.includes(f.payload));return Tt(u)?null:h.createElement(qn,{zIndex:l},h.createElement($Z,{point:u,childIndex:Number(s),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}var nP=(e,t,n)=>{var r=n??e;if(!Tt(r))return Nn(r,t,0)},BZ=(e,t,n)=>{var r={},i=e.filter(kh),a=e.filter(u=>u.stackId==null),l=i.reduce((u,f)=>{var d=u[f.stackId];return d==null&&(d=[]),d.push(f),u[f.stackId]=d,u},r),s=Object.entries(l).map(u=>{var f,[d,p]=u,m=p.map(y=>y.dataKey),g=nP(t,n,(f=p[0])===null||f===void 0?void 0:f.barSize);return{stackId:d,dataKeys:m,barSize:g}}),c=a.map(u=>{var f=[u.dataKey].filter(p=>p!=null),d=nP(t,n,u.barSize);return{stackId:void 0,dataKeys:f,barSize:d}});return[...s,...c]};function rP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ed(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?rP(Object(n),!0).forEach(function(r){FZ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function FZ(e,t,n){return(t=UZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function UZ(e){var t=WZ(e,"string");return typeof t=="symbol"?t:t+""}function WZ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function KZ(e,t,n,r,i){var a,l=r.length;if(!(l<1)){var s=Nn(e,n,0,!0),c,u=[];if(He((a=r[0])===null||a===void 0?void 0:a.barSize)){var f=!1,d=n/l,p=r.reduce((b,w)=>b+(w.barSize||0),0);p+=(l-1)*s,p>=n&&(p-=(l-1)*s,s=0),p>=n&&d>0&&(f=!0,d*=.9,p=l*d);var m=(n-p)/2>>0,g={offset:m-s,size:0};c=r.reduce((b,w)=>{var S,C={stackId:w.stackId,dataKeys:w.dataKeys,position:{offset:g.offset+g.size+s,size:f?d:(S=w.barSize)!==null&&S!==void 0?S:0}},j=[...b,C];return g=C.position,j},u)}else{var y=Nn(t,n,0,!0);n-2*y-(l-1)*s<=0&&(s=0);var x=(n-2*y-(l-1)*s)/l;x>1&&(x>>=0);var v=He(i)?Math.min(x,i):x;c=r.reduce((b,w,S)=>[...b,{stackId:w.stackId,dataKeys:w.dataKeys,position:{offset:y+(x+s)*S+(x-v)/2,size:v}}],u)}return c}}var HZ=(e,t,n,r,i,a,l)=>{var s=Tt(l)?t:l,c=KZ(n,r,i!==a?i:a,e,s);return i!==a&&c!=null&&(c=c.map(u=>Ed(Ed({},u),{},{position:Ed(Ed({},u.position),{},{offset:u.position.offset-i/2})}))),c},VZ=(e,t)=>{var n=Sh(t);if(!(!e||n==null||t==null)){var{stackId:r}=t;if(r!=null){var i=e[r];if(i){var{stackedData:a}=i;if(a)return a.find(l=>l.key===n)}}}},qZ=(e,t)=>{if(!(e==null||t==null)){var n=e.find(r=>r.stackId===t.stackId&&t.dataKey!=null&&r.dataKeys.includes(t.dataKey));if(n!=null)return n.position}};function YZ(e,t){return e&&typeof e=="object"&&"zIndex"in e&&typeof e.zIndex=="number"&&He(e.zIndex)?e.zIndex:t}var R_=e=>{var{chartData:t}=e,n=gt(),r=vn();return h.useEffect(()=>r?()=>{}:(n(vC(t)),()=>{n(vC(void 0))}),[t,n,r]),null},iP={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},D_=Dn({name:"brush",initialState:iP,reducers:{setBrushSettings(e,t){return t.payload==null?iP:t.payload}}}),{setBrushSettings:aae}=D_.actions,GZ=D_.reducer;function XZ(e){return(e%180+180)%180}var QZ=function(t){var{width:n,height:r}=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=XZ(i),l=a*Math.PI/180,s=Math.atan(r/n),c=l>s&&l<Math.PI-s?r/Math.sin(l):n/Math.cos(l);return Math.abs(c)},JZ={dots:[],areas:[],lines:[]},L_=Dn({name:"referenceElements",initialState:JZ,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=Or(e).dots.findIndex(r=>r===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=Or(e).areas.findIndex(r=>r===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=Or(e).lines.findIndex(r=>r===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:oae,removeDot:lae,addArea:sae,removeArea:cae,addLine:uae,removeLine:dae}=L_.actions,ZZ=L_.reducer,eee=h.createContext(void 0),tee=e=>{var{children:t}=e,[n]=h.useState("".concat(Uc("recharts"),"-clip")),r=tm();if(r==null)return null;var{x:i,y:a,width:l,height:s}=r;return h.createElement(eee.Provider,{value:n},h.createElement("defs",null,h.createElement("clipPath",{id:n},h.createElement("rect",{x:i,y:a,height:s,width:l}))),t)};function z_(e,t){if(t<1)return[];if(t===1)return e;for(var n=[],r=0;r<e.length;r+=t){var i=e[r];i!==void 0&&n.push(i)}return n}function nee(e,t,n){var r={width:e.width+t.width,height:e.height+t.height};return QZ(r,n)}function ree(e,t,n){var r=n==="width",{x:i,y:a,width:l,height:s}=e;return t===1?{start:r?i:a,end:r?i+l:a+s}:{start:r?i+l:a+s,end:r?i:a}}function nu(e,t,n,r,i){if(e*t<e*r||e*t>e*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function iee(e,t){return z_(e,t+1)}function aee(e,t,n,r,i){for(var a=(r||[]).slice(),{start:l,end:s}=t,c=0,u=1,f=l,d=function(){var g=r==null?void 0:r[c];if(g===void 0)return{v:z_(r,u)};var y=c,x,v=()=>(x===void 0&&(x=n(g,y)),x),b=g.coordinate,w=c===0||nu(e,b,v,f,s);w||(c=0,f=l,u+=1),w&&(f=b+e*(v()/2+i),c+=u)},p;u<=a.length;)if(p=d(),p)return p.v;return[]}function oee(e,t,n,r,i){var a=(r||[]).slice(),l=a.length;if(l===0)return[];for(var{start:s,end:c}=t,u=1;u<=l;u++){for(var f=(l-1)%u,d=s,p=!0,m=function(){var S=r[y];if(S==null)return 0;var C=y,j,E=()=>(j===void 0&&(j=n(S,C)),j),O=S.coordinate,R=y===f||nu(e,O,E,d,c);if(!R)return p=!1,1;R&&(d=O+e*(E()/2+i))},g,y=f;y<l&&(g=m(),!(g!==0&&g===1));y+=u);if(p){for(var x=[],v=f;v<l;v+=u){var b=r[v];b!=null&&x.push(b)}return x}}return[]}function aP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function On(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?aP(Object(n),!0).forEach(function(r){lee(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function lee(e,t,n){return(t=see(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function see(e){var t=cee(e,"string");return typeof t=="symbol"?t:t+""}function cee(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function uee(e,t,n,r,i){for(var a=(r||[]).slice(),l=a.length,{start:s}=t,{end:c}=t,u=function(p){var m=a[p];if(m==null)return 1;var g=m,y,x=()=>(y===void 0&&(y=n(m,p)),y);if(p===l-1){var v=e*(g.coordinate+e*x()/2-c);a[p]=g=On(On({},g),{},{tickCoord:v>0?g.coordinate-v*e:g.coordinate})}else a[p]=g=On(On({},g),{},{tickCoord:g.coordinate});if(g.tickCoord!=null){var b=nu(e,g.tickCoord,x,s,c);b&&(c=g.tickCoord-e*(x()/2+i),a[p]=On(On({},g),{},{isShow:!0}))}},f=l-1;f>=0;f--)u(f);return a}function dee(e,t,n,r,i,a){var l=(r||[]).slice(),s=l.length,{start:c,end:u}=t;if(a){var f=r[s-1];if(f!=null){var d=n(f,s-1),p=e*(f.coordinate+e*d/2-u);if(l[s-1]=f=On(On({},f),{},{tickCoord:p>0?f.coordinate-p*e:f.coordinate}),f.tickCoord!=null){var m=nu(e,f.tickCoord,()=>d,c,u);m&&(u=f.tickCoord-e*(d/2+i),l[s-1]=On(On({},f),{},{isShow:!0}))}}}for(var g=a?s-1:s,y=function(b){var w=l[b];if(w==null)return 1;var S=w,C,j=()=>(C===void 0&&(C=n(w,b)),C);if(b===0){var E=e*(S.coordinate-e*j()/2-c);l[b]=S=On(On({},S),{},{tickCoord:E<0?S.coordinate-E*e:S.coordinate})}else l[b]=S=On(On({},S),{},{tickCoord:S.coordinate});if(S.tickCoord!=null){var O=nu(e,S.tickCoord,j,c,u);O&&(c=S.tickCoord+e*(j()/2+i),l[b]=On(On({},S),{},{isShow:!0}))}},x=0;x<g;x++)y(x);return l}function Kb(e,t,n){var{tick:r,ticks:i,viewBox:a,minTickGap:l,orientation:s,interval:c,tickFormatter:u,unit:f,angle:d}=e;if(!i||!i.length||!r)return[];if(xe(c)||ju.isSsr){var p;return(p=iee(i,xe(c)?c:0))!==null&&p!==void 0?p:[]}var m=[],g=s==="top"||s==="bottom"?"width":"height",y=f&&g==="width"?yc(f,{fontSize:t,letterSpacing:n}):{width:0,height:0},x=(C,j)=>{var E=typeof u=="function"?u(C.value,j):C.value;return g==="width"?nee(yc(E,{fontSize:t,letterSpacing:n}),y,d):yc(E,{fontSize:t,letterSpacing:n})[g]},v=i[0],b=i[1],w=i.length>=2&&v!=null&&b!=null?mn(b.coordinate-v.coordinate):1,S=ree(a,w,g);return c==="equidistantPreserveStart"?aee(w,S,x,i,l):c==="equidistantPreserveEnd"?oee(w,S,x,i,l):(c==="preserveStart"||c==="preserveStartEnd"?m=dee(w,S,x,i,l,c==="preserveStartEnd"):m=uee(w,S,x,i,l),m.filter(C=>C.isShow))}var fee=e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:i=0,tickMargin:a=0}=e,l=0;if(t){Array.from(t).forEach(f=>{if(f){var d=f.getBoundingClientRect();d.width>l&&(l=d.width)}});var s=n?n.getBoundingClientRect().width:0,c=i+a,u=l+c+s+(n?r:0);return Math.round(u)}return 0},pee={xAxis:{},yAxis:{}},$_=Dn({name:"renderedTicks",initialState:pee,reducers:{setRenderedTicks:(e,t)=>{var{axisType:n,axisId:r,ticks:i}=t.payload;e[n][r]=i},removeRenderedTicks:(e,t)=>{var{axisType:n,axisId:r}=t.payload;delete e[n][r]}}}),{setRenderedTicks:hee,removeRenderedTicks:mee}=$_.actions,gee=$_.reducer,vee=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function yee(e,t){if(e==null)return{};var n,r,i=xee(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function xee(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Uo(){return Uo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Uo.apply(null,arguments)}function oP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ft(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?oP(Object(n),!0).forEach(function(r){bee(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function bee(e,t,n){return(t=wee(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wee(e){var t=jee(e,"string");return typeof t=="symbol"?t:t+""}function jee(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Bi={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:Yt.axis};function See(e){var{x:t,y:n,width:r,height:i,orientation:a,mirror:l,axisLine:s,otherSvgProps:c}=e;if(!s)return null;var u=Ft(Ft(Ft({},c),Wn(s)),{},{fill:"none"});if(a==="top"||a==="bottom"){var f=+(a==="top"&&!l||a==="bottom"&&l);u=Ft(Ft({},u),{},{x1:t,y1:n+f*i,x2:t+r,y2:n+f*i})}else{var d=+(a==="left"&&!l||a==="right"&&l);u=Ft(Ft({},u),{},{x1:t+d*r,y1:n,x2:t+d*r,y2:n+i})}return h.createElement("line",Uo({},u,{className:nt("recharts-cartesian-axis-line",bi(s,"className"))}))}function kee(e,t,n,r,i,a,l,s,c){var u,f,d,p,m,g,y=s?-1:1,x=e.tickSize||l,v=xe(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case"top":u=f=e.coordinate,p=n+ +!s*i,d=p-y*x,g=d-y*c,m=v;break;case"left":d=p=e.coordinate,f=t+ +!s*r,u=f-y*x,m=u-y*c,g=v;break;case"right":d=p=e.coordinate,f=t+ +s*r,u=f+y*x,m=u+y*c,g=v;break;default:u=f=e.coordinate,p=n+ +s*i,d=p+y*x,g=d+y*c,m=v;break}return{line:{x1:u,y1:d,x2:f,y2:p},tick:{x:m,y:g}}}function Cee(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}function Pee(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}function Eee(e){var{option:t,tickProps:n,value:r}=e,i,a=nt(n.className,"recharts-cartesian-axis-tick-value");if(h.isValidElement(t))i=h.cloneElement(t,Ft(Ft({},n),{},{className:a}));else if(typeof t=="function")i=t(Ft(Ft({},n),{},{className:a}));else{var l="recharts-cartesian-axis-tick-value";typeof t!="boolean"&&(l=nt(l,P_(t))),i=h.createElement(zh,Uo({},n,{className:l}),r)}return i}function Tee(e){var{ticks:t,axisType:n,axisId:r}=e,i=gt();return h.useEffect(()=>{if(r==null||n==null)return Ua;var a=t.map(l=>({value:l.value,coordinate:l.coordinate,offset:l.offset,index:l.index}));return i(hee({ticks:a,axisId:r,axisType:n})),()=>{i(mee({axisId:r,axisType:n}))}},[i,t,r,n]),null}var Oee=h.forwardRef((e,t)=>{var{ticks:n=[],tick:r,tickLine:i,stroke:a,tickFormatter:l,unit:s,padding:c,tickTextProps:u,orientation:f,mirror:d,x:p,y:m,width:g,height:y,tickSize:x,tickMargin:v,fontSize:b,letterSpacing:w,getTicksConfig:S,events:C,axisType:j,axisId:E}=e,O=Kb(Ft(Ft({},S),{},{ticks:n}),b,w),R=Wn(S),A=Mo(r),N=h_(R.textAnchor)?R.textAnchor:Cee(f,d),_=Pee(f,d),q={};typeof i=="object"&&(q=i);var W=Ft(Ft({},R),{},{fill:"none"},q),I=O.map(M=>Ft({entry:M},kee(M,p,m,g,y,f,x,d,v))),F=I.map(M=>{var{entry:B,line:k}=M;return h.createElement(zt,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(B.value,"-").concat(B.coordinate,"-").concat(B.tickCoord)},i&&h.createElement("line",Uo({},W,k,{className:nt("recharts-cartesian-axis-tick-line",bi(i,"className"))})))}),K=I.map((M,B)=>{var k,L,{entry:Q,tick:T}=M,ce=Ft(Ft(Ft(Ft({verticalAnchor:_},R),{},{textAnchor:N,stroke:"none",fill:a},T),{},{index:B,payload:Q,visibleTicksCount:O.length,tickFormatter:l,padding:c},u),{},{angle:(k=(L=u==null?void 0:u.angle)!==null&&L!==void 0?L:R.angle)!==null&&k!==void 0?k:0}),ve=Ft(Ft({},ce),A);return h.createElement(zt,Uo({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(Q.value,"-").concat(Q.coordinate,"-").concat(Q.tickCoord)},mu(C,Q,B)),r&&h.createElement(Eee,{option:r,tickProps:ve,value:"".concat(typeof l=="function"?l(Q.value,B):Q.value).concat(s||"")}))});return h.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(j,"-ticks")},h.createElement(Tee,{ticks:O,axisId:E,axisType:j}),K.length>0&&h.createElement(qn,{zIndex:Yt.label},h.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(j,"-tick-labels"),ref:t},K)),F.length>0&&h.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(j,"-tick-lines")},F))}),Aee=h.forwardRef((e,t)=>{var{axisLine:n,width:r,height:i,className:a,hide:l,ticks:s,axisType:c,axisId:u}=e,f=yee(e,vee),[d,p]=h.useState(""),[m,g]=h.useState(""),y=h.useRef(null);h.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var v;return fee({ticks:y.current,label:(v=e.labelRef)===null||v===void 0?void 0:v.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var x=h.useCallback(v=>{if(v){var b=v.getElementsByClassName("recharts-cartesian-axis-tick-value");y.current=b;var w=b[0];if(w){var S=window.getComputedStyle(w),C=S.fontSize,j=S.letterSpacing;(C!==d||j!==m)&&(p(C),g(j))}}},[d,m]);return l||r!=null&&r<=0||i!=null&&i<=0?null:h.createElement(qn,{zIndex:e.zIndex},h.createElement(zt,{className:nt("recharts-cartesian-axis",a)},h.createElement(See,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:Wn(e)}),h.createElement(Oee,{ref:x,axisType:c,events:f,fontSize:d,getTicksConfig:e,height:e.height,letterSpacing:m,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:s,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:u}),h.createElement(EQ,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},h.createElement(LQ,{label:e.label,labelRef:e.labelRef}),e.children)))}),Hb=h.forwardRef((e,t)=>{var n=Gt(e,Bi);return h.createElement(Aee,Uo({},n,{ref:t}))});Hb.displayName="CartesianAxis";var Iee=["x1","y1","x2","y2","key"],Nee=["offset"],_ee=["xAxisId","yAxisId"],Mee=["xAxisId","yAxisId"];function lP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function In(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?lP(Object(n),!0).forEach(function(r){Ree(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ree(e,t,n){return(t=Dee(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dee(e){var t=Lee(e,"string");return typeof t=="symbol"?t:t+""}function Lee(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function wo(){return wo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},wo.apply(null,arguments)}function wp(e,t){if(e==null)return{};var n,r,i=zee(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function zee(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var $ee=e=>{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:n,x:r,y:i,width:a,height:l,ry:s}=e;return h.createElement("rect",{x:r,y:i,ry:s,width:a,height:l,stroke:"none",fill:t,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function B_(e){var{option:t,lineItemProps:n}=e,r;if(h.isValidElement(t))r=h.cloneElement(t,n);else if(typeof t=="function")r=t(n);else{var i,{x1:a,y1:l,x2:s,y2:c,key:u}=n,f=wp(n,Iee),d=(i=Wn(f))!==null&&i!==void 0?i:{},{offset:p}=d,m=wp(d,Nee);r=h.createElement("line",wo({},m,{x1:a,y1:l,x2:s,y2:c,fill:"none",key:u}))}return r}function Bee(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:l}=e,s=wp(e,_ee),c=i.map((u,f)=>{var d=In(In({},s),{},{x1:t,y1:u,x2:t+n,y2:u,key:"line-".concat(f),index:f});return h.createElement(B_,{key:"line-".concat(f),option:r,lineItemProps:d})});return h.createElement("g",{className:"recharts-cartesian-grid-horizontal"},c)}function Fee(e){var{y:t,height:n,vertical:r=!0,verticalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:l}=e,s=wp(e,Mee),c=i.map((u,f)=>{var d=In(In({},s),{},{x1:u,y1:t,x2:u,y2:t+n,key:"line-".concat(f),index:f});return h.createElement(B_,{option:r,lineItemProps:d,key:"line-".concat(f)})});return h.createElement("g",{className:"recharts-cartesian-grid-vertical"},c)}function Uee(e){var{horizontalFill:t,fillOpacity:n,x:r,y:i,width:a,height:l,horizontalPoints:s,horizontal:c=!0}=e;if(!c||!t||!t.length||s==null)return null;var u=s.map(d=>Math.round(d+i-i)).sort((d,p)=>d-p);i!==u[0]&&u.unshift(0);var f=u.map((d,p)=>{var m=u[p+1],g=m==null,y=g?i+l-d:m-d;if(y<=0)return null;var x=p%t.length;return h.createElement("rect",{key:"react-".concat(p),y:d,x:r,height:y,width:a,stroke:"none",fill:t[x],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return h.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function Wee(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:i,y:a,width:l,height:s,verticalPoints:c}=e;if(!t||!n||!n.length)return null;var u=c.map(d=>Math.round(d+i-i)).sort((d,p)=>d-p);i!==u[0]&&u.unshift(0);var f=u.map((d,p)=>{var m=u[p+1],g=m==null,y=g?i+l-d:m-d;if(y<=0)return null;var x=p%n.length;return h.createElement("rect",{key:"react-".concat(p),x:d,y:a,width:y,height:s,stroke:"none",fill:n[x],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return h.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var Kee=(e,t)=>{var{xAxis:n,width:r,height:i,offset:a}=e;return bA(Kb(In(In(In({},Bi),n),{},{ticks:wA(n),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},Hee=(e,t)=>{var{yAxis:n,width:r,height:i,offset:a}=e;return bA(Kb(In(In(In({},Bi),n),{},{ticks:wA(n),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},Vee={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Yt.grid};function Tl(e){var t=v0(),n=y0(),r=OA(),i=In(In({},Gt(e,Vee)),{},{x:xe(e.x)?e.x:r.left,y:xe(e.y)?e.y:r.top,width:xe(e.width)?e.width:r.width,height:xe(e.height)?e.height:r.height}),{xAxisId:a,yAxisId:l,x:s,y:c,width:u,height:f,syncWithTicks:d,horizontalValues:p,verticalValues:m}=i,g=vn(),y=ke(R=>aC(R,"xAxis",a,g)),x=ke(R=>aC(R,"yAxis",l,g));if(!ji(u)||!ji(f)||!xe(s)||!xe(c))return null;var v=i.verticalCoordinatesGenerator||Kee,b=i.horizontalCoordinatesGenerator||Hee,{horizontalPoints:w,verticalPoints:S}=i;if((!w||!w.length)&&typeof b=="function"){var C=p&&p.length,j=b({yAxis:x?In(In({},x),{},{ticks:C?p:x.ticks}):void 0,width:t??u,height:n??f,offset:r},C?!0:d);Hf(Array.isArray(j),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof j,"]")),Array.isArray(j)&&(w=j)}if((!S||!S.length)&&typeof v=="function"){var E=m&&m.length,O=v({xAxis:y?In(In({},y),{},{ticks:E?m:y.ticks}):void 0,width:t??u,height:n??f,offset:r},E?!0:d);Hf(Array.isArray(O),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof O,"]")),Array.isArray(O)&&(S=O)}return h.createElement(qn,{zIndex:i.zIndex},h.createElement("g",{className:"recharts-cartesian-grid"},h.createElement($ee,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),h.createElement(Uee,wo({},i,{horizontalPoints:w})),h.createElement(Wee,wo({},i,{verticalPoints:S})),h.createElement(Bee,wo({},i,{offset:r,horizontalPoints:w,xAxis:y,yAxis:x})),h.createElement(Fee,wo({},i,{offset:r,verticalPoints:S,xAxis:y,yAxis:x}))))}Tl.displayName="CartesianGrid";var qee={},F_=Dn({name:"errorBars",initialState:qee,reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(a=>a.dataKey===r.dataKey&&a.direction===r.direction?i:a))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(i=>i.dataKey!==r.dataKey||i.direction!==r.direction))}}}),{addErrorBar:fae,replaceErrorBar:pae,removeErrorBar:hae}=F_.actions,Yee=F_.reducer,Gee=["children"];function Xee(e,t){if(e==null)return{};var n,r,i=Qee(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Qee(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Jee={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},Zee=h.createContext(Jee);function U_(e){var{children:t}=e,n=Xee(e,Gee);return h.createElement(Zee.Provider,{value:n},t)}function nm(e,t){var n,r,i=ke(u=>ta(u,e)),a=ke(u=>na(u,t)),l=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:rn.allowDataOverflow,s=(r=a==null?void 0:a.allowDataOverflow)!==null&&r!==void 0?r:an.allowDataOverflow,c=l||s;return{needClip:c,needClipX:l,needClipY:s}}function Vb(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=tm(),{needClipX:a,needClipY:l,needClip:s}=nm(t,n);if(!s||!i)return null;var{x:c,y:u,width:f,height:d}=i;return h.createElement("clipPath",{id:"clipPath-".concat(r)},h.createElement("rect",{x:a?c:c-f/2,y:l?u:u-d/2,width:a?f:f*2,height:l?d:d*2}))}var W_=(e,t,n,r)=>Pi(e,"xAxis",t,r),K_=(e,t,n,r)=>Ci(e,"xAxis",t,r),H_=(e,t,n,r)=>Pi(e,"yAxis",n,r),V_=(e,t,n,r)=>Ci(e,"yAxis",n,r),ete=H([Ze,W_,H_,K_,V_],(e,t,n,r,i)=>Jr(e,"xAxis")?Ma(t,r,!1):Ma(n,i,!1)),tte=(e,t,n,r,i)=>i;function nte(e){return e.type==="line"}var rte=H([Iu,tte],(e,t)=>e.filter(nte).find(n=>n.id===t)),ite=H([Ze,W_,H_,K_,V_,rte,ete,ku],(e,t,n,r,i,a,l,s)=>{var{chartData:c,dataStartIndex:u,dataEndIndex:f}=s;if(!(a==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||l==null||e!=="horizontal"&&e!=="vertical")){var{dataKey:d,data:p}=a,m;if(p!=null&&p.length>0?m=p:m=c==null?void 0:c.slice(u,f+1),m!=null)return kte({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:l,displayedData:m})}});function q_(e){var t=Mo(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:a}=t,l=Number(i),s=Number(a);return(Number.isNaN(l)||l<0)&&(l=n),(Number.isNaN(s)||s<0)&&(s=r),{r:l,strokeWidth:s}}return{r:n,strokeWidth:r}}var ate=["id"],ote=["type","layout","connectNulls","needClip","shape"],lte=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function ru(){return ru=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ru.apply(null,arguments)}function sP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ui(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sP(Object(n),!0).forEach(function(r){ste(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ste(e,t,n){return(t=cte(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cte(e){var t=ute(e,"string");return typeof t=="symbol"?t:t+""}function ute(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function qb(e,t){if(e==null)return{};var n,r,i=dte(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function dte(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var fte=e=>{var{dataKey:t,name:n,stroke:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:Wa(n,t),payload:e}]},pte=h.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:l,hide:s,unit:c,tooltipType:u,id:f}=e,d={dataDefinedOnItem:n,getPosition:Ua,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Wa(l,t),hide:s,type:u,color:r,unit:c,graphicalItemId:f}};return h.createElement(Jh,{tooltipEntrySettings:d})}),Y_=(e,t)=>"".concat(t,"px ").concat(e,"px");function hte(e,t){for(var n=e.length%2!==0?[...e,0]:e,r=[],i=0;i<t;++i)r.push(...n);return r}var mte=(e,t,n)=>{var r=n.reduce((p,m)=>p+m,0);if(!r)return Y_(t,e);for(var i=Math.floor(e/r),a=e%r,l=[],s=0,c=0;s<n.length;c+=(u=n[s])!==null&&u!==void 0?u:0,++s){var u,f=n[s];if(f!=null&&c+f>a){l=[...n.slice(0,s),a-c];break}}var d=l.length%2===0?[0,t]:[t];return[...hte(n,i),...l,...d].map(p=>"".concat(p,"px")).join(", ")};function gte(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:a,needClip:l}=r,{id:s}=r,c=qb(r,ate),u=Wn(c);return h.createElement(N_,{points:n,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:a,baseProps:u,needClip:l,clipPathId:t})}function vte(e){var{showLabels:t,children:n,points:r}=e,i=h.useMemo(()=>r==null?void 0:r.map(a=>{var l,s,c={x:(l=a.x)!==null&&l!==void 0?l:0,y:(s=a.y)!==null&&s!==void 0?s:0,width:0,lowerWidth:0,upperWidth:0,height:0};return ui(ui({},c),{},{value:a.value,payload:a.payload,viewBox:c,parentViewBox:void 0,fill:void 0})}),[r]);return h.createElement(Ib,{value:t?i:void 0},n)}function cP(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:i,props:a}=e,{type:l,layout:s,connectNulls:c,needClip:u,shape:f}=a,d=qb(a,ote),p=ui(ui({},Mn(d)),{},{fill:"none",className:"recharts-line-curve",clipPath:u?"url(#clipPath-".concat(t,")"):void 0,points:r,type:l,layout:s,connectNulls:c,strokeDasharray:i??a.strokeDasharray});return h.createElement(h.Fragment,null,(r==null?void 0:r.length)>1&&h.createElement(zb,ru({shapeType:"curve",option:f},p,{pathRef:n})),h.createElement(gte,{points:r,clipPathId:t,props:a}))}function yte(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function xte(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:i,longestAnimatedLengthRef:a}=e,{points:l,strokeDasharray:s,isAnimationActive:c,animationBegin:u,animationDuration:f,animationEasing:d,animateNewValues:p,width:m,height:g,onAnimationEnd:y,onAnimationStart:x}=n,v=i.current,b=vs(l,"recharts-line-"),w=h.useRef(b),[S,C]=h.useState(!1),j=!S,E=h.useCallback(()=>{typeof y=="function"&&y(),C(!1)},[y]),O=h.useCallback(()=>{typeof x=="function"&&x(),C(!0)},[x]),R=yte(r.current),A=h.useRef(0);w.current!==b&&(A.current=a.current,w.current=b);var N=A.current;return h.createElement(vte,{points:l,showLabels:j},n.children,h.createElement(gs,{animationId:b,begin:u,duration:f,isActive:c,easing:d,onAnimationEnd:E,onAnimationStart:O,key:b},_=>{var q=ct(N,R+N,_),W=Math.min(q,R),I;if(c)if(s){var F="".concat(s).split(/[,\s]+/gim).map(B=>parseFloat(B));I=mte(W,R,F)}else I=Y_(R,W);else I=s==null?void 0:String(s);if(_>0&&R>0&&(i.current=l,a.current=Math.max(a.current,W)),v){var K=v.length/l.length,M=_===1?l:l.map((B,k)=>{var L=Math.floor(k*K);if(v[L]){var Q=v[L];return ui(ui({},B),{},{x:ct(Q.x,B.x,_),y:ct(Q.y,B.y,_)})}return p?ui(ui({},B),{},{x:ct(m*2,B.x,_),y:ct(g/2,B.y,_)}):ui(ui({},B),{},{x:B.x,y:B.y})});return i.current=M,h.createElement(cP,{props:n,points:M,clipPathId:t,pathRef:r,strokeDasharray:I})}return h.createElement(cP,{props:n,points:l,clipPathId:t,pathRef:r,strokeDasharray:I})}),h.createElement($h,{label:n.label}))}function bte(e){var{clipPathId:t,props:n}=e,r=h.useRef(null),i=h.useRef(0),a=h.useRef(null);return h.createElement(xte,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:a})}var wte=(e,t)=>{var n,r;return{x:(n=e.x)!==null&&n!==void 0?n:void 0,y:(r=e.y)!==null&&r!==void 0?r:void 0,value:e.value,errorVal:at(e.payload,t)}};class jte extends h.Component{render(){var{hide:t,dot:n,points:r,className:i,xAxisId:a,yAxisId:l,top:s,left:c,width:u,height:f,id:d,needClip:p,zIndex:m}=this.props;if(t)return null;var g=nt("recharts-line",i),y=d,{r:x,strokeWidth:v}=q_(n),b=Lb(n),w=x*2+v,S=p?"url(#clipPath-".concat(b?"":"dots-").concat(y,")"):void 0;return h.createElement(qn,{zIndex:m},h.createElement(zt,{className:g},p&&h.createElement("defs",null,h.createElement(Vb,{clipPathId:y,xAxisId:a,yAxisId:l}),!b&&h.createElement("clipPath",{id:"clipPath-dots-".concat(y)},h.createElement("rect",{x:c-w/2,y:s-w/2,width:u+w,height:f+w}))),h.createElement(U_,{xAxisId:a,yAxisId:l,data:r,dataPointFormatter:wte,errorBarOffset:0},h.createElement(bte,{props:this.props,clipPathId:y}))),h.createElement(Py,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:S}))}}var G_={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Yt.line,type:"linear"};function Ste(e){var t=Gt(e,G_),{activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:l,connectNulls:s,dot:c,hide:u,isAnimationActive:f,label:d,legendType:p,xAxisId:m,yAxisId:g,id:y}=t,x=qb(t,lte),{needClip:v}=nm(m,g),b=tm(),w=Ka(),S=vn(),C=ke(A=>ite(A,m,g,S,y));if(w!=="horizontal"&&w!=="vertical"||C==null||b==null)return null;var{height:j,width:E,x:O,y:R}=b;return h.createElement(jte,ru({},x,{id:y,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:l,isAnimationActive:f,hide:u,label:d,legendType:p,xAxisId:m,yAxisId:g,points:C,layout:w,height:j,width:E,left:O,top:R,needClip:v}))}function kte(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,dataKey:l,bandSize:s,displayedData:c}=e;return c.map((u,f)=>{var d=at(u,l);if(t==="horizontal"){var p=Kf({axis:n,ticks:i,bandSize:s,entry:u,index:f}),m=Tt(d)?null:r.scale.map(d);return{x:p,y:m??null,value:d,payload:u}}var g=Tt(d)?null:n.scale.map(d),y=Kf({axis:r,ticks:a,bandSize:s,entry:u,index:f});return g==null||y==null?null:{x:g,y,value:d,payload:u}}).filter(Boolean)}function Cte(e){var t=Gt(e,G_),n=vn();return h.createElement(Zh,{id:t.id,type:"line"},r=>h.createElement(h.Fragment,null,h.createElement(Ub,{legendPayload:fte(t)}),h.createElement(pte,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:r}),h.createElement(Wb,{type:"line",id:r,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),h.createElement(Ste,ru({},t,{id:r}))))}var xc=h.memo(Cte,qo);xc.displayName="Line";function Ei(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:__}function Ti(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:__}var X_=(e,t,n)=>Pi(e,"xAxis",Ei(e,t),n),Q_=(e,t,n)=>Ci(e,"xAxis",Ei(e,t),n),J_=(e,t,n)=>Pi(e,"yAxis",Ti(e,t),n),Z_=(e,t,n)=>Ci(e,"yAxis",Ti(e,t),n),Pte=H([Ze,X_,J_,Q_,Z_],(e,t,n,r,i)=>Jr(e,"xAxis")?Ma(t,r,!1):Ma(n,i,!1)),Ete=(e,t)=>t,eM=H([Iu,Ete],(e,t)=>e.filter(n=>n.type==="area").find(n=>n.id===t)),tM=e=>{var t=Ze(e),n=Jr(t,"xAxis");return n?"yAxis":"xAxis"},Tte=(e,t)=>{var n=tM(e);return n==="yAxis"?Ti(e,t):Ei(e,t)},Ote=(e,t,n)=>pp(e,tM(e),Tte(e,t),n),Ate=H([eM,Ote],(e,t)=>{var n;if(!(e==null||t==null)){var{stackId:r}=e,i=Sh(e);if(!(r==null||i==null)){var a=(n=t[r])===null||n===void 0?void 0:n.stackedData,l=a==null?void 0:a.find(s=>s.key===i);if(l!=null)return l.map(s=>[s[0],s[1]])}}}),Ite=H([Ze,X_,J_,Q_,Z_,Ate,ZA,Pte,eM,$9],(e,t,n,r,i,a,l,s,c,u)=>{var{chartData:f,dataStartIndex:d,dataEndIndex:p}=l;if(!(c==null||e!=="horizontal"&&e!=="vertical"||t==null||n==null||r==null||i==null||r.length===0||i.length===0||s==null)){var{data:m}=c,g;if(m&&m.length>0?g=m:g=f==null?void 0:f.slice(d,p+1),g!=null)return Qte({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:d,areaSettings:c,stackedData:a,displayedData:g,chartBaseValue:u,bandSize:s})}}),Nte=["id"],_te=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function To(){return To=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},To.apply(null,arguments)}function nM(e,t){if(e==null)return{};var n,r,i=Mte(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Mte(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function uP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ol(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?uP(Object(n),!0).forEach(function(r){Rte(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Rte(e,t,n){return(t=Dte(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dte(e){var t=Lte(e,"string");return typeof t=="symbol"?t:t+""}function Lte(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jp(e,t){return e&&e!=="none"?e:t}var zte=e=>{var{dataKey:t,name:n,stroke:r,fill:i,legendType:a,hide:l}=e;return[{inactive:l,dataKey:t,type:a,color:jp(r,i),value:Wa(n,t),payload:e}]},$te=h.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:l,hide:s,unit:c,tooltipType:u,id:f}=e,d={dataDefinedOnItem:n,getPosition:Ua,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Wa(l,t),hide:s,type:u,color:jp(r,a),unit:c,graphicalItemId:f}};return h.createElement(Jh,{tooltipEntrySettings:d})});function Bte(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:a,dataKey:l}=r,s=Wn(r);return h.createElement(N_,{points:n,dot:a,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:l,baseProps:s,needClip:i,clipPathId:t})}function Fte(e){var{showLabels:t,children:n,points:r}=e,i=r.map(a=>{var l,s,c={x:(l=a.x)!==null&&l!==void 0?l:0,y:(s=a.y)!==null&&s!==void 0?s:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Ol(Ol({},c),{},{value:a.value,payload:a.payload,parentViewBox:void 0,viewBox:c,fill:void 0})});return h.createElement(Ib,{value:t?i:void 0},n)}function dP(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:a}=e,{layout:l,type:s,stroke:c,connectNulls:u,isRange:f}=a,{id:d}=a,p=nM(a,Nte),m=Wn(p),g=Mn(p);return h.createElement(h.Fragment,null,(t==null?void 0:t.length)>1&&h.createElement(zt,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},h.createElement(Bl,To({},g,{id:d,points:t,connectNulls:u,type:s,baseLine:n,layout:l,stroke:"none",className:"recharts-area-area"})),c!=="none"&&h.createElement(Bl,To({},m,{className:"recharts-area-curve",layout:l,type:s,connectNulls:u,fill:"none",points:t})),c!=="none"&&f&&Array.isArray(n)&&h.createElement(Bl,To({},m,{className:"recharts-area-curve",layout:l,type:s,connectNulls:u,fill:"none",points:n}))),h.createElement(Bte,{points:t,props:p,clipPathId:i}))}function Ute(e){var t,n,{alpha:r,baseLine:i,points:a,strokeWidth:l}=e,s=(t=a[0])===null||t===void 0?void 0:t.y,c=(n=a[a.length-1])===null||n===void 0?void 0:n.y;if(!He(s)||!He(c))return null;var u=r*Math.abs(s-c),f=Math.max(...a.map(d=>d.x||0));return xe(i)?f=Math.max(i,f):i&&Array.isArray(i)&&i.length&&(f=Math.max(...i.map(d=>d.x||0),f)),xe(f)?h.createElement("rect",{x:0,y:s<c?s:s-u,width:f+(l?parseInt("".concat(l),10):1),height:Math.floor(u)}):null}function Wte(e){var t,n,{alpha:r,baseLine:i,points:a,strokeWidth:l}=e,s=(t=a[0])===null||t===void 0?void 0:t.x,c=(n=a[a.length-1])===null||n===void 0?void 0:n.x;if(!He(s)||!He(c))return null;var u=r*Math.abs(s-c),f=Math.max(...a.map(d=>d.y||0));return xe(i)?f=Math.max(i,f):i&&Array.isArray(i)&&i.length&&(f=Math.max(...i.map(d=>d.y||0),f)),xe(f)?h.createElement("rect",{x:s<c?s:s-u,y:0,width:u,height:Math.floor(f+(l?parseInt("".concat(l),10):1))}):null}function Kte(e){var{alpha:t,layout:n,points:r,baseLine:i,strokeWidth:a}=e;return n==="vertical"?h.createElement(Ute,{alpha:t,points:r,baseLine:i,strokeWidth:a}):h.createElement(Wte,{alpha:t,points:r,baseLine:i,strokeWidth:a})}function Hte(e){var{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a}=e,{points:l,baseLine:s,isAnimationActive:c,animationBegin:u,animationDuration:f,animationEasing:d,onAnimationStart:p,onAnimationEnd:m}=r,g=h.useMemo(()=>({points:l,baseLine:s}),[l,s]),y=vs(g,"recharts-area-"),x=x0(),[v,b]=h.useState(!1),w=!v,S=h.useCallback(()=>{typeof m=="function"&&m(),b(!1)},[m]),C=h.useCallback(()=>{typeof p=="function"&&p(),b(!0)},[p]);if(x==null)return null;var j=i.current,E=a.current;return h.createElement(Fte,{showLabels:w,points:l},r.children,h.createElement(gs,{animationId:y,begin:u,duration:f,isActive:c,easing:d,onAnimationEnd:S,onAnimationStart:C,key:y},O=>{if(j){var R=j.length/l.length,A=O===1?l:l.map((_,q)=>{var W=Math.floor(q*R);if(j[W]){var I=j[W];return Ol(Ol({},_),{},{x:ct(I.x,_.x,O),y:ct(I.y,_.y,O)})}return _}),N;return xe(s)?N=ct(E,s,O):Tt(s)||Gr(s)?N=ct(E,0,O):N=s.map((_,q)=>{var W=Math.floor(q*R);if(Array.isArray(E)&&E[W]){var I=E[W];return Ol(Ol({},_),{},{x:ct(I.x,_.x,O),y:ct(I.y,_.y,O)})}return _}),O>0&&(i.current=A,a.current=N),h.createElement(dP,{points:A,baseLine:N,needClip:t,clipPathId:n,props:r})}return O>0&&(i.current=l,a.current=s),h.createElement(zt,null,c&&h.createElement("defs",null,h.createElement("clipPath",{id:"animationClipPath-".concat(n)},h.createElement(Kte,{alpha:O,points:l,baseLine:s,layout:x,strokeWidth:r.strokeWidth}))),h.createElement(zt,{clipPath:"url(#animationClipPath-".concat(n,")")},h.createElement(dP,{points:l,baseLine:s,needClip:t,clipPathId:n,props:r})))}),h.createElement($h,{label:r.label}))}function Vte(e){var{needClip:t,clipPathId:n,props:r}=e,i=h.useRef(null),a=h.useRef();return h.createElement(Hte,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}class qte extends h.PureComponent{render(){var{hide:t,dot:n,points:r,className:i,top:a,left:l,needClip:s,xAxisId:c,yAxisId:u,width:f,height:d,id:p,baseLine:m,zIndex:g}=this.props;if(t)return null;var y=nt("recharts-area",i),x=p,{r:v,strokeWidth:b}=q_(n),w=Lb(n),S=v*2+b,C=s?"url(#clipPath-".concat(w?"":"dots-").concat(x,")"):void 0;return h.createElement(qn,{zIndex:g},h.createElement(zt,{className:y},s&&h.createElement("defs",null,h.createElement(Vb,{clipPathId:x,xAxisId:c,yAxisId:u}),!w&&h.createElement("clipPath",{id:"clipPath-dots-".concat(x)},h.createElement("rect",{x:l-S/2,y:a-S/2,width:f+S,height:d+S}))),h.createElement(Vte,{needClip:s,clipPathId:x,props:this.props})),h.createElement(Py,{points:r,mainColor:jp(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:C}),this.props.isRange&&Array.isArray(m)&&h.createElement(Py,{points:m,mainColor:jp(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:C}))}}var Yte={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:Yt.area};function Gte(e){var t,{activeDot:n,animationBegin:r,animationDuration:i,animationEasing:a,connectNulls:l,dot:s,fill:c,fillOpacity:u,hide:f,isAnimationActive:d,legendType:p,stroke:m,xAxisId:g,yAxisId:y}=e,x=nM(e,_te),v=Ka(),b=e_(),{needClip:w}=nm(g,y),S=vn(),{points:C,isRange:j,baseLine:E}=(t=ke(q=>Ite(q,e.id,S)))!==null&&t!==void 0?t:{},O=tm();if(v!=="horizontal"&&v!=="vertical"||O==null||b!=="AreaChart"&&b!=="ComposedChart")return null;var{height:R,width:A,x:N,y:_}=O;return!C||!C.length?null:h.createElement(qte,To({},x,{activeDot:n,animationBegin:r,animationDuration:i,animationEasing:a,baseLine:E,connectNulls:l,dot:s,fill:c,fillOpacity:u,height:R,hide:f,layout:v,isAnimationActive:d,isRange:j,legendType:p,needClip:w,points:C,stroke:m,width:A,left:N,top:_,xAxisId:g,yAxisId:y}))}var Xte=(e,t,n,r,i)=>{var a=n??t;if(xe(a))return a;var l=e==="horizontal"?i:r,s=l.scale.domain();if(l.type==="number"){var c=Math.max(s[0],s[1]),u=Math.min(s[0],s[1]);return a==="dataMin"?u:a==="dataMax"||c<0?c:Math.max(Math.min(s[0],s[1]),0)}return a==="dataMin"?s[0]:a==="dataMax"?s[1]:s[0]};function Qte(e){var{areaSettings:{connectNulls:t,baseValue:n,dataKey:r},stackedData:i,layout:a,chartBaseValue:l,xAxis:s,yAxis:c,displayedData:u,dataStartIndex:f,xAxisTicks:d,yAxisTicks:p,bandSize:m}=e,g=i&&i.length,y=Xte(a,l,n,s,c),x=a==="horizontal",v=!1,b=u.map((S,C)=>{var j,E,O,R;if(g)R=i[f+C];else{var A=at(S,r);Array.isArray(A)?(R=A,v=!0):R=[y,A]}var N=(j=(E=R)===null||E===void 0?void 0:E[1])!==null&&j!==void 0?j:null,_=N==null||g&&!t&&at(S,r)==null;if(x){var q;return{x:Kf({axis:s,ticks:d,bandSize:m,entry:S,index:C}),y:_?null:(q=c.scale.map(N))!==null&&q!==void 0?q:null,value:R,payload:S}}return{x:_?null:(O=s.scale.map(N))!==null&&O!==void 0?O:null,y:Kf({axis:c,ticks:p,bandSize:m,entry:S,index:C}),value:R,payload:S}}),w;return g||v?w=b.map(S=>{var C,j=Array.isArray(S.value)?S.value[0]:null;if(x){var E;return{x:S.x,y:j!=null&&S.y!=null&&(E=c.scale.map(j))!==null&&E!==void 0?E:null,payload:S.payload}}return{x:j!=null&&(C=s.scale.map(j))!==null&&C!==void 0?C:null,y:S.y,payload:S.payload}}):w=x?c.scale.map(y):s.scale.map(y),{points:b,baseLine:w??0,isRange:v}}function Jte(e){var t=Gt(e,Yte),n=vn();return h.createElement(Zh,{id:t.id,type:"area"},r=>h.createElement(h.Fragment,null,h.createElement(Ub,{legendPayload:zte(t)}),h.createElement($te,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:r}),h.createElement(Wb,{type:"area",id:r,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:jA(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),h.createElement(Gte,To({},t,{id:r}))))}var Ey=h.memo(Jte,qo);Ey.displayName="Area";var Zte="Invariant failed";function ene(e,t){throw new Error(Zte)}function Ty(){return Ty=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ty.apply(null,arguments)}function Yb(e){return h.createElement(zb,Ty({shapeType:"rectangle",activeClassName:"recharts-active-bar",inActiveClassName:"recharts-inactive-bar"},e))}var tne=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(r,i)=>{if(xe(t))return t;var a=xe(r)||Tt(r);return a?t(r,i):(a||ene(),n)}},nne=(e,t,n)=>n,rne=(e,t)=>t,Lu=H([Iu,rne],(e,t)=>e.filter(n=>n.type==="bar").find(n=>n.id===t)),ine=H([Lu],e=>e==null?void 0:e.maxBarSize),ane=(e,t,n,r)=>r,one=H([Ze,Iu,Ei,Ti,nne],(e,t,n,r,i)=>t.filter(a=>e==="horizontal"?a.xAxisId===n:a.yAxisId===r).filter(a=>a.isPanorama===i).filter(a=>a.hide===!1).filter(a=>a.type==="bar")),lne=(e,t,n)=>{var r=Ze(e),i=Ei(e,t),a=Ti(e,t);if(!(i==null||a==null))return r==="horizontal"?pp(e,"yAxis",a,n):pp(e,"xAxis",i,n)},sne=(e,t)=>{var n=Ze(e),r=Ei(e,t),i=Ti(e,t);if(!(r==null||i==null))return n==="horizontal"?iC(e,"xAxis",r):iC(e,"yAxis",i)},cne=H([one,z9,sne],BZ),une=(e,t,n)=>{var r,i,a=Lu(e,t);if(a==null)return 0;var l=Ei(e,t),s=Ti(e,t);if(l==null||s==null)return 0;var c=Ze(e),u=dI(e),{maxBarSize:f}=a,d=Tt(f)?u:f,p,m;return c==="horizontal"?(p=Pi(e,"xAxis",l,n),m=Ci(e,"xAxis",l,n)):(p=Pi(e,"yAxis",s,n),m=Ci(e,"yAxis",s,n)),(r=(i=Ma(p,m,!0))!==null&&i!==void 0?i:d)!==null&&r!==void 0?r:0},rM=(e,t,n)=>{var r=Ze(e),i=Ei(e,t),a=Ti(e,t);if(!(i==null||a==null)){var l,s;return r==="horizontal"?(l=Pi(e,"xAxis",i,n),s=Ci(e,"xAxis",i,n)):(l=Pi(e,"yAxis",a,n),s=Ci(e,"yAxis",a,n)),Ma(l,s)}},dne=H([cne,dI,L9,fI,une,rM,ine],HZ),fne=(e,t,n)=>{var r=Ei(e,t);if(r!=null)return Pi(e,"xAxis",r,n)},pne=(e,t,n)=>{var r=Ti(e,t);if(r!=null)return Pi(e,"yAxis",r,n)},hne=(e,t,n)=>{var r=Ei(e,t);if(r!=null)return Ci(e,"xAxis",r,n)},mne=(e,t,n)=>{var r=Ti(e,t);if(r!=null)return Ci(e,"yAxis",r,n)},gne=H([dne,Lu],qZ),vne=H([lne,Lu],VZ),yne=H([cn,h0,fne,pne,hne,mne,gne,Ze,ZA,rM,vne,Lu,ane],(e,t,n,r,i,a,l,s,c,u,f,d,p)=>{var{chartData:m,dataStartIndex:g,dataEndIndex:y}=c;if(!(d==null||l==null||t==null||s!=="horizontal"&&s!=="vertical"||n==null||r==null||i==null||a==null||u==null)){var{data:x}=d,v;if(x!=null&&x.length>0?v=x:v=m==null?void 0:m.slice(g,y+1),v!=null)return Vne({layout:s,barSettings:d,pos:l,parentViewBox:t,bandSize:u,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,stackedData:f,displayedData:v,offset:e,cells:p,dataStartIndex:g})}}),xne=["index"];function Oy(){return Oy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Oy.apply(null,arguments)}function bne(e,t){if(e==null)return{};var n,r,i=wne(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function wne(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var iM=h.createContext(void 0),jne=e=>{var t=h.useContext(iM);if(t!=null)return t.stackId;if(e!=null)return jA(e)},Sne=(e,t)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(t),kne=e=>{var t=h.useContext(iM);if(t!=null){var{stackId:n}=t;return"url(#".concat(Sne(n,e),")")}},aM=e=>{var{index:t}=e,n=bne(e,xne),r=kne(t);return h.createElement(zt,Oy({className:"recharts-bar-stack-layer",clipPath:r},n))},Cne=["onMouseEnter","onMouseLeave","onClick"],Pne=["value","background","tooltipPosition"],Ene=["id"],Tne=["onMouseEnter","onClick","onMouseLeave"];function La(){return La=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},La.apply(null,arguments)}function fP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Bn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fP(Object(n),!0).forEach(function(r){One(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function One(e,t,n){return(t=Ane(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ane(e){var t=Ine(e,"string");return typeof t=="symbol"?t:t+""}function Ine(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Sp(e,t){if(e==null)return{};var n,r,i=Nne(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Nne(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var _ne=e=>{var{dataKey:t,name:n,fill:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:Wa(n,t),payload:e}]},Mne=h.memo(e=>{var{dataKey:t,stroke:n,strokeWidth:r,fill:i,name:a,hide:l,unit:s,tooltipType:c,id:u}=e,f={dataDefinedOnItem:void 0,getPosition:Ua,settings:{stroke:n,strokeWidth:r,fill:i,dataKey:t,nameKey:void 0,name:Wa(a,t),hide:l,type:c,color:i,unit:s,graphicalItemId:u}};return h.createElement(Jh,{tooltipEntrySettings:f})});function Rne(e){var t=ke(Ra),{data:n,dataKey:r,background:i,allOtherBarProps:a}=e,{onMouseEnter:l,onMouseLeave:s,onClick:c}=a,u=Sp(a,Cne),f=$b(l,r,a.id),d=Bb(s),p=Fb(c,r,a.id);if(!i||n==null)return null;var m=Mo(i);return h.createElement(qn,{zIndex:YZ(i,Yt.barBackground)},n.map((g,y)=>{var{value:x,background:v,tooltipPosition:b}=g,w=Sp(g,Pne);if(!v)return null;var S=f(g,y),C=d(g,y),j=p(g,y),E=Bn(Bn(Bn(Bn(Bn({option:i,isActive:String(y)===t},w),{},{fill:"#eee"},v),m),mu(u,g,y)),{},{onMouseEnter:S,onMouseLeave:C,onClick:j,dataKey:r,index:y,className:"recharts-bar-background-rectangle"});return h.createElement(Yb,La({key:"background-bar-".concat(y)},E))}))}function Dne(e){var{showLabels:t,children:n,rects:r}=e,i=r==null?void 0:r.map(a=>{var l={x:a.x,y:a.y,width:a.width,lowerWidth:a.width,upperWidth:a.width,height:a.height};return Bn(Bn({},l),{},{value:a.value,payload:a.payload,parentViewBox:a.parentViewBox,viewBox:l,fill:a.fill})});return h.createElement(Ib,{value:t?i:void 0},n)}function Lne(e){var{shape:t,activeBar:n,baseProps:r,entry:i,index:a,dataKey:l}=e,s=ke(Ra),c=ke(Cb),u=n&&String(i.originalDataIndex)===s&&(c==null||l===c),[f,d]=h.useState(!1),[p,m]=h.useState(!1);h.useEffect(()=>{var w;return u?(d(!0),w=requestAnimationFrame(()=>{m(!0)})):m(!1),()=>{cancelAnimationFrame(w)}},[u]);var g=h.useCallback(()=>{u||d(!1)},[u]),y=u&&p,x=u||f,v;u?n===!0?v=t:v=n:v=t;var b=h.createElement(Yb,La({},r,{name:String(r.name)},i,{isActive:y,option:v,index:a,dataKey:l,onTransitionEnd:g}));return x?h.createElement(qn,{zIndex:Yt.activeBar},h.createElement(aM,{index:i.originalDataIndex},b)):b}function zne(e){var{shape:t,baseProps:n,entry:r,index:i,dataKey:a}=e;return h.createElement(Yb,La({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:i,dataKey:a}))}function $ne(e){var t,{data:n,props:r}=e,i=(t=Wn(r))!==null&&t!==void 0?t:{},{id:a}=i,l=Sp(i,Ene),{shape:s,dataKey:c,activeBar:u}=r,{onMouseEnter:f,onClick:d,onMouseLeave:p}=r,m=Sp(r,Tne),g=$b(f,c,a),y=Bb(p),x=Fb(d,c,a);return n?h.createElement(h.Fragment,null,n.map((v,b)=>h.createElement(aM,La({index:v.originalDataIndex,key:"rectangle-".concat(v==null?void 0:v.x,"-").concat(v==null?void 0:v.y,"-").concat(v==null?void 0:v.value,"-").concat(b),className:"recharts-bar-rectangle"},mu(m,v,b),{onMouseEnter:g(v,b),onMouseLeave:y(v,b),onClick:x(v,b)}),u?h.createElement(Lne,{shape:s,activeBar:u,baseProps:l,entry:v,index:b,dataKey:c}):h.createElement(zne,{shape:s,baseProps:l,entry:v,index:b,dataKey:c})))):null}function Bne(e){var{props:t,previousRectanglesRef:n}=e,{data:r,layout:i,isAnimationActive:a,animationBegin:l,animationDuration:s,animationEasing:c,onAnimationEnd:u,onAnimationStart:f}=t,d=n.current,p=vs(t,"recharts-bar-"),[m,g]=h.useState(!1),y=!m,x=h.useCallback(()=>{typeof u=="function"&&u(),g(!1)},[u]),v=h.useCallback(()=>{typeof f=="function"&&f(),g(!0)},[f]);return h.createElement(Dne,{showLabels:y,rects:r},h.createElement(gs,{animationId:p,begin:l,duration:s,isActive:a,easing:c,onAnimationEnd:x,onAnimationStart:v,key:p},b=>{var w=b===1?r:r==null?void 0:r.map((S,C)=>{var j=d&&d[C];if(j)return Bn(Bn({},S),{},{x:ct(j.x,S.x,b),y:ct(j.y,S.y,b),width:ct(j.width,S.width,b),height:ct(j.height,S.height,b)});if(i==="horizontal"){var E=ct(0,S.height,b),O=ct(S.stackedBarStart,S.y,b);return Bn(Bn({},S),{},{y:O,height:E})}var R=ct(0,S.width,b),A=ct(S.stackedBarStart,S.x,b);return Bn(Bn({},S),{},{width:R,x:A})});return b>0&&(n.current=w??null),w==null?null:h.createElement(zt,null,h.createElement($ne,{props:t,data:w}))}),h.createElement($h,{label:t.label}),t.children)}function Fne(e){var t=h.useRef(null);return h.createElement(Bne,{previousRectanglesRef:t,props:e})}var oM=0,Une=(e,t)=>{var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:at(e,t)}};class Wne extends h.PureComponent{render(){var{hide:t,data:n,dataKey:r,className:i,xAxisId:a,yAxisId:l,needClip:s,background:c,id:u}=this.props;if(t||n==null)return null;var f=nt("recharts-bar",i),d=u;return h.createElement(zt,{className:f,id:u},s&&h.createElement("defs",null,h.createElement(Vb,{clipPathId:d,xAxisId:a,yAxisId:l})),h.createElement(zt,{className:"recharts-bar-rectangles",clipPath:s?"url(#clipPath-".concat(d,")"):void 0},h.createElement(Rne,{data:n,dataKey:r,background:c,allOtherBarProps:this.props}),h.createElement(Fne,this.props)))}}var Kne={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:oM,xAxisId:0,yAxisId:0,zIndex:Yt.bar};function Hne(e){var{xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:a,activeBar:l,animationBegin:s,animationDuration:c,animationEasing:u,isAnimationActive:f}=e,{needClip:d}=nm(t,n),p=Ka(),m=vn(),g=Db(e.children,Du),y=ke(b=>yne(b,e.id,m,g));if(p!=="vertical"&&p!=="horizontal")return null;var x,v=y==null?void 0:y[0];return v==null||v.height==null||v.width==null?x=0:x=p==="vertical"?v.height/2:v.width/2,h.createElement(U_,{xAxisId:t,yAxisId:n,data:y,dataPointFormatter:Une,errorBarOffset:x},h.createElement(Wne,La({},e,{layout:p,needClip:d,data:y,xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:a,activeBar:l,animationBegin:s,animationDuration:c,animationEasing:u,isAnimationActive:f})))}function Vne(e){var{layout:t,barSettings:{dataKey:n,minPointSize:r,hasCustomShape:i},pos:a,bandSize:l,xAxis:s,yAxis:c,xAxisTicks:u,yAxisTicks:f,stackedData:d,displayedData:p,offset:m,cells:g,parentViewBox:y,dataStartIndex:x}=e,v=t==="horizontal"?c:s,b=d?v.scale.domain():null,w=AW({numericAxis:v}),S=v.scale.map(w);return p.map((C,j)=>{var E,O,R,A,N,_;if(d){var q=d[j+x];if(q==null)return null;E=CW(q,b)}else E=at(C,n),Array.isArray(E)||(E=[w,E]);var W=tne(r,oM)(E[1],j);if(t==="horizontal"){var I,F=c.scale.map(E[0]),K=c.scale.map(E[1]);if(F==null||K==null)return null;O=sS({axis:s,ticks:u,bandSize:l,offset:a.offset,entry:C,index:j}),R=(I=K??F)!==null&&I!==void 0?I:void 0,A=a.size;var M=F-K;if(N=Gr(M)?0:M,_={x:O,y:m.top,width:A,height:m.height},Math.abs(W)>0&&Math.abs(N)<Math.abs(W)){var B=mn(N||W)*(Math.abs(W)-Math.abs(N));R-=B,N+=B}}else{var k=s.scale.map(E[0]),L=s.scale.map(E[1]);if(k==null||L==null)return null;if(O=k,R=sS({axis:c,ticks:f,bandSize:l,offset:a.offset,entry:C,index:j}),A=L-k,N=a.size,_={x:m.left,y:R,width:m.width,height:N},Math.abs(W)>0&&Math.abs(A)<Math.abs(W)){var Q=mn(A||W)*(Math.abs(W)-Math.abs(A));A+=Q}}if(O==null||R==null||A==null||N==null||!i&&(A===0||N===0))return null;var T=Bn(Bn({},C),{},{stackedBarStart:S,x:O,y:R,width:A,height:N,value:d?E:E[1],payload:C,background:_,tooltipPosition:{x:O+A/2,y:R+N/2},parentViewBox:y,originalDataIndex:j},g&&g[j]&&g[j].props);return T}).filter(Boolean)}function qne(e){var t=Gt(e,Kne),n=jne(t.stackId),r=vn();return h.createElement(Zh,{id:t.id,type:"bar"},i=>h.createElement(h.Fragment,null,h.createElement(Ub,{legendPayload:_ne(t)}),h.createElement(Mne,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:i}),h.createElement(Wb,{type:"bar",id:i,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:n,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:r,hasCustomShape:t.shape!=null}),h.createElement(qn,{zIndex:t.zIndex},h.createElement(Hne,La({},t,{id:i})))))}var lM=h.memo(qne,qo);lM.displayName="Bar";var Yne=["domain","range"],Gne=["domain","range"];function pP(e,t){if(e==null)return{};var n,r,i=Xne(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Xne(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function hP(e,t){return e===t?!0:Array.isArray(e)&&e.length===2&&Array.isArray(t)&&t.length===2?e[0]===t[0]&&e[1]===t[1]:!1}function sM(e,t){if(e===t)return!0;var{domain:n,range:r}=e,i=pP(e,Yne),{domain:a,range:l}=t,s=pP(t,Gne);return!hP(n,a)||!hP(r,l)?!1:qo(i,s)}var Qne=["type"],Jne=["dangerouslySetInnerHTML","ticks","scale"],Zne=["id","scale"];function Ay(){return Ay=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ay.apply(null,arguments)}function mP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function gP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?mP(Object(n),!0).forEach(function(r){ere(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ere(e,t,n){return(t=tre(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tre(e){var t=nre(e,"string");return typeof t=="symbol"?t:t+""}function nre(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Iy(e,t){if(e==null)return{};var n,r,i=rre(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function rre(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function ire(e){var t=gt(),n=h.useRef(null),r=x0(),{type:i}=e,a=Iy(e,Qne),l=wh(r,"xAxis",i),s=h.useMemo(()=>{if(l!=null)return gP(gP({},a),{},{type:l})},[a,l]);return h.useLayoutEffect(()=>{s!=null&&(n.current===null?t(CZ(s)):n.current!==s&&t(PZ({prev:n.current,next:s})),n.current=s)},[s,t]),h.useLayoutEffect(()=>()=>{n.current&&(t(EZ(n.current)),n.current=null)},[t]),null}var are=e=>{var{xAxisId:t,className:n}=e,r=ke(h0),i=vn(),a="xAxis",l=ke(v=>ON(v,a,t,i)),s=ke(v=>PN(v,t)),c=ke(v=>yY(v,t)),u=ke(v=>iN(v,t));if(s==null||c==null||u==null)return null;var{dangerouslySetInnerHTML:f,ticks:d,scale:p}=e,m=Iy(e,Jne),{id:g,scale:y}=u,x=Iy(u,Zne);return h.createElement(Hb,Ay({},m,x,{x:c.x,y:c.y,width:s.width,height:s.height,className:nt("recharts-".concat(a," ").concat(a),n),viewBox:r,ticks:l,axisType:a,axisId:t}))},ore={allowDataOverflow:rn.allowDataOverflow,allowDecimals:rn.allowDecimals,allowDuplicatedCategory:rn.allowDuplicatedCategory,angle:rn.angle,axisLine:Bi.axisLine,height:rn.height,hide:!1,includeHidden:rn.includeHidden,interval:rn.interval,label:!1,minTickGap:rn.minTickGap,mirror:rn.mirror,orientation:rn.orientation,padding:rn.padding,reversed:rn.reversed,scale:rn.scale,tick:rn.tick,tickCount:rn.tickCount,tickLine:Bi.tickLine,tickSize:Bi.tickSize,type:rn.type,niceTicks:rn.niceTicks,xAxisId:0},lre=e=>{var t=Gt(e,ore);return h.createElement(h.Fragment,null,h.createElement(ire,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),h.createElement(are,t))},Al=h.memo(lre,sM);Al.displayName="XAxis";var sre=["type"],cre=["dangerouslySetInnerHTML","ticks","scale"],ure=["id","scale"];function Ny(){return Ny=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ny.apply(null,arguments)}function vP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function yP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vP(Object(n),!0).forEach(function(r){dre(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function dre(e,t,n){return(t=fre(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fre(e){var t=pre(e,"string");return typeof t=="symbol"?t:t+""}function pre(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _y(e,t){if(e==null)return{};var n,r,i=hre(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function hre(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function mre(e){var t=gt(),n=h.useRef(null),r=x0(),{type:i}=e,a=_y(e,sre),l=wh(r,"yAxis",i),s=h.useMemo(()=>{if(l!=null)return yP(yP({},a),{},{type:l})},[l,a]);return h.useLayoutEffect(()=>{s!=null&&(n.current===null?t(TZ(s)):n.current!==s&&t(OZ({prev:n.current,next:s})),n.current=s)},[s,t]),h.useLayoutEffect(()=>()=>{n.current&&(t(AZ(n.current)),n.current=null)},[t]),null}function gre(e){var{yAxisId:t,className:n,width:r,label:i}=e,a=h.useRef(null),l=h.useRef(null),s=ke(h0),c=vn(),u=gt(),f="yAxis",d=ke(j=>EN(j,t)),p=ke(j=>bY(j,t)),m=ke(j=>ON(j,f,t,c)),g=ke(j=>aN(j,t));if(h.useLayoutEffect(()=>{if(!(r!=="auto"||!d||Ab(i)||h.isValidElement(i)||g==null)){var j=a.current;if(j){var E=j.getCalculatedWidth();Math.round(d.width)!==Math.round(E)&&u(IZ({id:t,width:E}))}}},[m,d,u,i,t,r,g]),d==null||p==null||g==null)return null;var{dangerouslySetInnerHTML:y,ticks:x,scale:v}=e,b=_y(e,cre),{id:w,scale:S}=g,C=_y(g,ure);return h.createElement(Hb,Ny({},b,C,{ref:a,labelRef:l,x:p.x,y:p.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:d.width,height:d.height,className:nt("recharts-".concat(f," ").concat(f),n),viewBox:s,ticks:m,axisType:f,axisId:t}))}var vre={allowDataOverflow:an.allowDataOverflow,allowDecimals:an.allowDecimals,allowDuplicatedCategory:an.allowDuplicatedCategory,angle:an.angle,axisLine:Bi.axisLine,hide:!1,includeHidden:an.includeHidden,interval:an.interval,label:!1,minTickGap:an.minTickGap,mirror:an.mirror,orientation:an.orientation,padding:an.padding,reversed:an.reversed,scale:an.scale,tick:an.tick,tickCount:an.tickCount,tickLine:Bi.tickLine,tickSize:Bi.tickSize,type:an.type,niceTicks:an.niceTicks,width:an.width,yAxisId:0},yre=e=>{var t=Gt(e,vre);return h.createElement(h.Fragment,null,h.createElement(mre,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),h.createElement(gre,t))},Il=h.memo(yre,sM);Il.displayName="YAxis";var xre=(e,t)=>t,Gb=H([xre,Ze,xI,yn,qN,ra,FG,cn],YG);function bre(e){return"getBBox"in e.currentTarget&&typeof e.currentTarget.getBBox=="function"}function Xb(e){var t=e.currentTarget.getBoundingClientRect(),n,r;if(bre(e)){var i=e.currentTarget.getBBox();n=i.width>0?t.width/i.width:1,r=i.height>0?t.height/i.height:1}else{var a=e.currentTarget;n=a.offsetWidth>0?t.width/a.offsetWidth:1,r=a.offsetHeight>0?t.height/a.offsetHeight:1}var l=(s,c)=>({relativeX:Math.round((s-t.left)/n),relativeY:Math.round((c-t.top)/r)});return"touches"in e?Array.from(e.touches).map(s=>l(s.clientX,s.clientY)):l(e.clientX,e.clientY)}var cM=mr("mouseClick"),uM=vu();uM.startListening({actionCreator:cM,effect:(e,t)=>{var n=e.payload,r=Gb(t.getState(),Xb(n));(r==null?void 0:r.activeIndex)!=null&&t.dispatch(DY({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var My=mr("mouseMove"),dM=vu(),sl=null,ro=null,yg=null;dM.startListening({actionCreator:My,effect:(e,t)=>{var n=e.payload,r=t.getState(),{throttleDelay:i,throttledEvents:a}=r.eventSettings,l=a==="all"||(a==null?void 0:a.includes("mousemove"));sl!==null&&(cancelAnimationFrame(sl),sl=null),ro!==null&&(typeof i!="number"||!l)&&(clearTimeout(ro),ro=null),yg=Xb(n);var s=()=>{var c=t.getState(),u=Mu(c,c.tooltip.settings.shared);if(!yg){sl=null,ro=null;return}if(u==="axis"){var f=Gb(c,yg);(f==null?void 0:f.activeIndex)!=null?t.dispatch(LN({activeIndex:f.activeIndex,activeDataKey:void 0,activeCoordinate:f.activeCoordinate})):t.dispatch(DN())}sl=null,ro=null};if(!l){s();return}i==="raf"?sl=requestAnimationFrame(s):typeof i=="number"&&ro===null&&(ro=setTimeout(s,i))}});function wre(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<<CHILDREN>>":t}var xP={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},fM=Dn({name:"rootProps",initialState:xP,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(n=t.payload.barGap)!==null&&n!==void 0?n:xP.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),jre=fM.reducer,{updateOptions:Sre}=fM.actions,kre=null,Cre={updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)},pM=Dn({name:"polarOptions",initialState:kre,reducers:Cre}),{updatePolarOptions:Pre}=pM.actions,Ere=pM.reducer,hM=mr("keyDown"),mM=mr("focus"),gM=mr("blur"),rm=vu(),cl=null,io=null,Td=null;rm.startListening({actionCreator:hM,effect:(e,t)=>{Td=e.payload,cl!==null&&(cancelAnimationFrame(cl),cl=null);var n=t.getState(),{throttleDelay:r,throttledEvents:i}=n.eventSettings,a=i==="all"||i.includes("keydown");io!==null&&(typeof r!="number"||!a)&&(clearTimeout(io),io=null);var l=()=>{try{var s=t.getState(),c=s.rootProps.accessibilityLayer!==!1;if(!c)return;var{keyboardInteraction:u}=s.tooltip,f=Td;if(f!=="ArrowRight"&&f!=="ArrowLeft"&&f!=="Enter")return;var d=vc(u,Fo(s),os(s),ls(s)),p=d==null?-1:Number(d),m=!Number.isFinite(p)||p<0,g=ra(s),y=Fo(s),x=Mu(s,s.tooltip.settings.shared);if(f==="Enter"){if(m)return;var v=gp(s,x,"hover",String(u.index));t.dispatch(mp({active:!u.active,activeIndex:u.index,activeCoordinate:v}));return}var b=CY(s),w=b==="left-to-right"?1:-1,S=f==="ArrowRight"?1:-1,C;if(m){var j=os(s),E=ls(s),O=S*w,R=W=>({active:!1,index:String(W),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(C=-1,O>0){for(var A=0;A<y.length;A++)if(vc(R(A),y,j,E)!=null){C=A;break}}else for(var N=y.length-1;N>=0;N--)if(vc(R(N),y,j,E)!=null){C=N;break}if(C<0)return}else{C=p+S*w;var _=(g==null?void 0:g.length)||y.length;if(_===0||C>=_||C<0)return}var q=gp(s,x,"hover",String(C));t.dispatch(mp({active:!0,activeIndex:C.toString(),activeCoordinate:q}))}finally{cl=null,io=null}};if(!a){l();return}r==="raf"?cl=requestAnimationFrame(l):typeof r=="number"&&io===null&&(l(),Td=null,io=setTimeout(()=>{Td?l():(io=null,cl=null)},r))}});rm.startListening({actionCreator:mM,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;if(!i.active&&i.index==null){var a="0",l=Mu(n,n.tooltip.settings.shared),s=gp(n,l,"hover",String(a));t.dispatch(mp({active:!0,activeIndex:a,activeCoordinate:s}))}}}});rm.startListening({actionCreator:gM,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;i.active&&t.dispatch(mp({active:!1,activeIndex:i.index,activeCoordinate:i.coordinate}))}}});function vM(e){e.persist();var{currentTarget:t}=e;return new Proxy(e,{get:(n,r)=>{if(r==="currentTarget")return t;var i=Reflect.get(n,r);return typeof i=="function"?i.bind(n):i}})}var jr=mr("externalEvent"),yM=vu(),Od=new Map,Ys=new Map,xg=new Map;yM.startListening({actionCreator:jr,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){var i=r.type,a=vM(r);xg.set(i,{handler:n,reactEvent:a});var l=Od.get(i);l!==void 0&&(cancelAnimationFrame(l),Od.delete(i));var s=t.getState(),{throttleDelay:c,throttledEvents:u}=s.eventSettings,f=u,d=f==="all"||(f==null?void 0:f.includes(i)),p=Ys.get(i);p!==void 0&&(typeof c!="number"||!d)&&(clearTimeout(p),Ys.delete(i));var m=()=>{var x=xg.get(i);try{if(!x)return;var{handler:v,reactEvent:b}=x,w=t.getState(),S={activeCoordinate:PG(w),activeDataKey:Cb(w),activeIndex:Ra(w),activeLabel:XN(w),activeTooltipIndex:Ra(w),isTooltipActive:EG(w)};v&&v(S,b)}finally{Od.delete(i),Ys.delete(i),xg.delete(i)}};if(!d){m();return}if(c==="raf"){var g=requestAnimationFrame(m);Od.set(i,g)}else if(typeof c=="number"){if(!Ys.has(i)){m();var y=setTimeout(m,c);Ys.set(i,y)}}else m()}}});var Tre=H([Cs],e=>e.tooltipItemPayloads),Ore=H([Tre,(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(a=>a.settings.graphicalItemId===n);if(r!=null){var{getPosition:i}=r;if(i!=null)return i(t)}}}),xM=mr("touchMove"),bM=vu(),ao=null,sa=null,bP=null,Gs=null;bM.startListening({actionCreator:xM,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){Gs=vM(n);var r=t.getState(),{throttleDelay:i,throttledEvents:a}=r.eventSettings,l=a==="all"||a.includes("touchmove");ao!==null&&(cancelAnimationFrame(ao),ao=null),sa!==null&&(typeof i!="number"||!l)&&(clearTimeout(sa),sa=null),bP=Array.from(n.touches).map(c=>Xb({clientX:c.clientX,clientY:c.clientY,currentTarget:n.currentTarget}));var s=()=>{if(Gs!=null){var c=t.getState(),u=Mu(c,c.tooltip.settings.shared);if(u==="axis"){var f,d=(f=bP)===null||f===void 0?void 0:f[0];if(d==null){ao=null,sa=null;return}var p=Gb(c,d);(p==null?void 0:p.activeIndex)!=null&&t.dispatch(LN({activeIndex:p.activeIndex,activeDataKey:void 0,activeCoordinate:p.activeCoordinate}))}else if(u==="item"){var m,g=Gs.touches[0];if(document.elementFromPoint==null||g==null)return;var y=document.elementFromPoint(g.clientX,g.clientY);if(!y||!y.getAttribute)return;var x=y.getAttribute(kA),v=(m=y.getAttribute(CA))!==null&&m!==void 0?m:void 0,b=Xo(c).find(C=>C.id===v);if(x==null||b==null||v==null)return;var{dataKey:w}=b,S=Ore(c,x,v);t.dispatch(RN({activeDataKey:w,activeIndex:x,activeCoordinate:S,activeGraphicalItemId:v}))}ao=null,sa=null}};if(!l){s();return}i==="raf"?ao=requestAnimationFrame(s):typeof i=="number"&&sa===null&&(s(),Gs=null,sa=setTimeout(()=>{Gs?s():(sa=null,ao=null)},i))}}});var Qb={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},wM=Dn({name:"eventSettings",initialState:Qb,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=t.payload.throttledEvents)}}}),{setEventSettings:Are}=wM.actions,Ire=wM.reducer,Nre=HO({brush:GZ,cartesianAxis:NZ,chartData:SX,errorBars:Yee,eventSettings:Ire,graphicalItems:LJ,layout:bW,legend:SK,options:yX,polarAxis:ZQ,polarOptions:Ere,referenceElements:ZZ,renderedTicks:gee,rootProps:jre,tooltip:LY,zIndex:lX}),_re=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return HU({reducer:Nre,preloadedState:t,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([uM.middleware,dM.middleware,rm.middleware,yM.middleware,bM.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(oA({type:"raf"}))},devTools:{serialize:{replacer:wre},name:"recharts-".concat(n)}})};function jM(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=vn(),a=h.useRef(null);if(i)return n;a.current==null&&(a.current=_re(t,r));var l=l0;return h.createElement(HK,{context:l,store:a.current},n)}function Mre(e){var{layout:t,margin:n}=e,r=gt(),i=vn();return h.useEffect(()=>{i||(r(vW(t)),r(gW(n)))},[r,i,t,n]),null}var SM=h.memo(Mre,qo);function kM(e){var t=gt();return h.useEffect(()=>{t(Sre(e))},[t,e]),null}var Rre=e=>{var t=gt();return h.useEffect(()=>{t(Are(e))},[t,e]),null},CM=h.memo(Rre,qo);function wP(e){var{zIndex:t,isPanorama:n}=e,r=h.useRef(null),i=gt();return h.useLayoutEffect(()=>(r.current&&i(aX({zIndex:t,element:r.current,isPanorama:n})),()=>{i(oX({zIndex:t,isPanorama:n}))}),[i,t,n]),h.createElement("g",{tabIndex:-1,ref:r,className:"recharts-zIndex-layer_".concat(t)})}function jP(e){var{children:t,isPanorama:n}=e,r=ke(XG);if(!r||r.length===0)return t;var i=r.filter(l=>l<0),a=r.filter(l=>l>0);return h.createElement(h.Fragment,null,i.map(l=>h.createElement(wP,{key:l,zIndex:l,isPanorama:n})),t,a.map(l=>h.createElement(wP,{key:l,zIndex:l,isPanorama:n})))}var Dre=["children"];function Lre(e,t){if(e==null)return{};var n,r,i=zre(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function zre(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function kp(){return kp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kp.apply(null,arguments)}var $re={width:"100%",height:"100%",display:"block"},Bre=h.forwardRef((e,t)=>{var n=v0(),r=y0(),i=UA();if(!ji(n)||!ji(r))return null;var{children:a,otherAttributes:l,title:s,desc:c}=e,u,f;return l!=null&&(typeof l.tabIndex=="number"?u=l.tabIndex:u=i?0:void 0,typeof l.role=="string"?f=l.role:f=i?"application":void 0),h.createElement(Jx,kp({},l,{title:s,desc:c,role:f,tabIndex:u,width:n,height:r,style:$re,ref:t}),a)}),Fre=e=>{var{children:t}=e,n=ke(mh);if(!n)return null;var{width:r,height:i,y:a,x:l}=n;return h.createElement(Jx,{width:r,height:i,x:l,y:a},t)},SP=h.forwardRef((e,t)=>{var{children:n}=e,r=Lre(e,Dre),i=vn();return i?h.createElement(Fre,null,h.createElement(jP,{isPanorama:!0},n)):h.createElement(Bre,kp({ref:t},r),h.createElement(jP,{isPanorama:!1},n))});function Ure(){var e=gt(),[t,n]=h.useState(null),r=ke(DW);return h.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),a=i.width/t.offsetWidth;He(a)&&a!==r&&e(xW(a))}},[t,e,r]),n}function kP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Wre(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?kP(Object(n),!0).forEach(function(r){Kre(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Kre(e,t,n){return(t=Hre(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hre(e){var t=Vre(e,"string");return typeof t=="symbol"?t:t+""}function Vre(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ia(){return Ia=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ia.apply(null,arguments)}var qre=()=>(NX(),null);function Cp(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var Yre=h.forwardRef((e,t)=>{var n,r,i=h.useRef(null),[a,l]=h.useState({containerWidth:Cp((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:Cp((r=e.style)===null||r===void 0?void 0:r.height)}),s=h.useCallback((u,f)=>{l(d=>{var p=Math.round(u),m=Math.round(f);return d.containerWidth===p&&d.containerHeight===m?d:{containerWidth:p,containerHeight:m}})},[]),c=h.useCallback(u=>{if(typeof t=="function"&&t(u),i.current!=null&&(i.current.disconnect(),i.current=null),u!=null&&typeof ResizeObserver<"u"){var{width:f,height:d}=u.getBoundingClientRect();s(f,d);var p=g=>{var y=g[0];if(y!=null){var{width:x,height:v}=y.contentRect;s(x,v)}},m=new ResizeObserver(p);m.observe(u),i.current=m}},[t,s]);return h.useEffect(()=>()=>{var u=i.current;u!=null&&u.disconnect()},[s]),h.createElement(h.Fragment,null,h.createElement(xu,{width:a.containerWidth,height:a.containerHeight}),h.createElement("div",Ia({ref:c},e)))}),Gre=h.forwardRef((e,t)=>{var{width:n,height:r}=e,[i,a]=h.useState({containerWidth:Cp(n),containerHeight:Cp(r)}),l=h.useCallback((c,u)=>{a(f=>{var d=Math.round(c),p=Math.round(u);return f.containerWidth===d&&f.containerHeight===p?f:{containerWidth:d,containerHeight:p}})},[]),s=h.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:u,height:f}=c.getBoundingClientRect();l(u,f)}},[t,l]);return h.createElement(h.Fragment,null,h.createElement(xu,{width:i.containerWidth,height:i.containerHeight}),h.createElement("div",Ia({ref:s},e)))}),Xre=h.forwardRef((e,t)=>{var{width:n,height:r}=e;return h.createElement(h.Fragment,null,h.createElement(xu,{width:n,height:r}),h.createElement("div",Ia({ref:t},e)))}),Qre=h.forwardRef((e,t)=>{var{width:n,height:r}=e;return typeof n=="string"||typeof r=="string"?h.createElement(Gre,Ia({},e,{ref:t})):typeof n=="number"&&typeof r=="number"?h.createElement(Xre,Ia({},e,{width:n,height:r,ref:t})):h.createElement(h.Fragment,null,h.createElement(xu,{width:n,height:r}),h.createElement("div",Ia({ref:t},e)))});function Jre(e){return e?Yre:Qre}var Zre=h.forwardRef((e,t)=>{var{children:n,className:r,height:i,onClick:a,onContextMenu:l,onDoubleClick:s,onMouseDown:c,onMouseEnter:u,onMouseLeave:f,onMouseMove:d,onMouseUp:p,onTouchEnd:m,onTouchMove:g,onTouchStart:y,style:x,width:v,responsive:b,dispatchTouchEvents:w=!0}=e,S=h.useRef(null),C=gt(),[j,E]=h.useState(null),[O,R]=h.useState(null),A=Ure(),N=m0(),_=(N==null?void 0:N.width)>0?N.width:v,q=(N==null?void 0:N.height)>0?N.height:i,W=h.useCallback(Z=>{A(Z),typeof t=="function"&&t(Z),E(Z),R(Z),Z!=null&&(S.current=Z)},[A,t,E,R]),I=h.useCallback(Z=>{C(cM(Z)),C(jr({handler:a,reactEvent:Z}))},[C,a]),F=h.useCallback(Z=>{C(My(Z)),C(jr({handler:u,reactEvent:Z}))},[C,u]),K=h.useCallback(Z=>{C(DN()),C(jr({handler:f,reactEvent:Z}))},[C,f]),M=h.useCallback(Z=>{C(My(Z)),C(jr({handler:d,reactEvent:Z}))},[C,d]),B=h.useCallback(()=>{C(mM())},[C]),k=h.useCallback(()=>{C(gM())},[C]),L=h.useCallback(Z=>{C(hM(Z.key))},[C]),Q=h.useCallback(Z=>{C(jr({handler:l,reactEvent:Z}))},[C,l]),T=h.useCallback(Z=>{C(jr({handler:s,reactEvent:Z}))},[C,s]),ce=h.useCallback(Z=>{C(jr({handler:c,reactEvent:Z}))},[C,c]),ve=h.useCallback(Z=>{C(jr({handler:p,reactEvent:Z}))},[C,p]),X=h.useCallback(Z=>{C(jr({handler:y,reactEvent:Z}))},[C,y]),oe=h.useCallback(Z=>{w&&C(xM(Z)),C(jr({handler:g,reactEvent:Z}))},[C,w,g]),fe=h.useCallback(Z=>{C(jr({handler:m,reactEvent:Z}))},[C,m]),te=Jre(b);return h.createElement(a_.Provider,{value:j},h.createElement(eO.Provider,{value:O},h.createElement(te,{width:_??(x==null?void 0:x.width),height:q??(x==null?void 0:x.height),className:nt("recharts-wrapper",r),style:Wre({position:"relative",cursor:"default",width:_,height:q},x),onClick:I,onContextMenu:Q,onDoubleClick:T,onFocus:B,onBlur:k,onKeyDown:L,onMouseDown:ce,onMouseEnter:F,onMouseLeave:K,onMouseMove:M,onMouseUp:ve,onTouchEnd:fe,onTouchMove:oe,onTouchStart:X,ref:W},h.createElement(qre,null),n)))}),eie=["width","height","responsive","children","className","style","compact","title","desc"];function tie(e,t){if(e==null)return{};var n,r,i=nie(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function nie(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var PM=h.forwardRef((e,t)=>{var{width:n,height:r,responsive:i,children:a,className:l,style:s,compact:c,title:u,desc:f}=e,d=tie(e,eie),p=Wn(d);return c?h.createElement(h.Fragment,null,h.createElement(xu,{width:n,height:r}),h.createElement(SP,{otherAttributes:p,title:u,desc:f},a)):h.createElement(Zre,{className:l,style:s,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},h.createElement(SP,{otherAttributes:p,title:u,desc:f,ref:t},h.createElement(tee,null,a)))});function Ry(){return Ry=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ry.apply(null,arguments)}function CP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rie(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?CP(Object(n),!0).forEach(function(r){iie(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function iie(e,t,n){return(t=aie(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function aie(e){var t=oie(e,"string");return typeof t=="symbol"?t:t+""}function oie(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var lie={top:5,right:5,bottom:5,left:5},sie=rie({accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:lie,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},Qb),Jb=h.forwardRef(function(t,n){var r,i=Gt(t.categoricalChartProps,sie),{chartName:a,defaultTooltipEventType:l,validateTooltipEventTypes:s,tooltipPayloadSearcher:c,categoricalChartProps:u}=t,f={chartName:a,defaultTooltipEventType:l,validateTooltipEventTypes:s,tooltipPayloadSearcher:c,eventEmitter:void 0};return h.createElement(jM,{preloadedState:{options:f},reduxStoreName:(r=u.id)!==null&&r!==void 0?r:a},h.createElement(R_,{chartData:u.data}),h.createElement(SM,{layout:i.layout,margin:i.margin}),h.createElement(CM,{throttleDelay:i.throttleDelay,throttledEvents:i.throttledEvents}),h.createElement(kM,{baseValue:i.baseValue,accessibilityLayer:i.accessibilityLayer,barCategoryGap:i.barCategoryGap,maxBarSize:i.maxBarSize,stackOffset:i.stackOffset,barGap:i.barGap,barSize:i.barSize,syncId:i.syncId,syncMethod:i.syncMethod,className:i.className,reverseStackOrder:i.reverseStackOrder}),h.createElement(PM,Ry({},i,{ref:n})))}),cie=["axis"],Dy=h.forwardRef((e,t)=>h.createElement(Jb,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:cie,tooltipPayloadSearcher:Lh,categoricalChartProps:e,ref:t})),uie=["axis","item"],die=h.forwardRef((e,t)=>h.createElement(Jb,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:uie,tooltipPayloadSearcher:Lh,categoricalChartProps:e,ref:t}));function fie(e){var t=gt();return h.useEffect(()=>{t(Pre(e))},[t,e]),null}var pie=["layout"];function Ly(){return Ly=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ly.apply(null,arguments)}function hie(e,t){if(e==null)return{};var n,r,i=mie(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function mie(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function PP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function gie(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?PP(Object(n),!0).forEach(function(r){vie(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):PP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function vie(e,t,n){return(t=yie(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yie(e){var t=xie(e,"string");return typeof t=="symbol"?t:t+""}function xie(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var bie={top:5,right:5,bottom:5,left:5},EM=gie({accessibilityLayer:!0,stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:bie,reverseStackOrder:!1,syncMethod:"index",layout:"radial",responsive:!1,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"},Qb),wie=h.forwardRef(function(t,n){var r,i=Gt(t.categoricalChartProps,EM),{layout:a}=i,l=hie(i,pie),{chartName:s,defaultTooltipEventType:c,validateTooltipEventTypes:u,tooltipPayloadSearcher:f}=t,d={chartName:s,defaultTooltipEventType:c,validateTooltipEventTypes:u,tooltipPayloadSearcher:f,eventEmitter:void 0};return h.createElement(jM,{preloadedState:{options:d},reduxStoreName:(r=i.id)!==null&&r!==void 0?r:s},h.createElement(R_,{chartData:i.data}),h.createElement(SM,{layout:a,margin:i.margin}),h.createElement(CM,{throttleDelay:i.throttleDelay,throttledEvents:i.throttledEvents}),h.createElement(kM,{baseValue:void 0,accessibilityLayer:i.accessibilityLayer,barCategoryGap:i.barCategoryGap,maxBarSize:i.maxBarSize,stackOffset:i.stackOffset,barGap:i.barGap,barSize:i.barSize,syncId:i.syncId,syncMethod:i.syncMethod,className:i.className,reverseStackOrder:i.reverseStackOrder}),h.createElement(fie,{cx:i.cx,cy:i.cy,startAngle:i.startAngle,endAngle:i.endAngle,innerRadius:i.innerRadius,outerRadius:i.outerRadius}),h.createElement(PM,Ly({},l,{ref:n})))});function EP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function TP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?EP(Object(n),!0).forEach(function(r){jie(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):EP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function jie(e,t,n){return(t=Sie(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sie(e){var t=kie(e,"string");return typeof t=="symbol"?t:t+""}function kie(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Cie=["item"],Pie=TP(TP({},EM),{},{layout:"centric",startAngle:0,endAngle:360}),Eie=h.forwardRef((e,t)=>{var n=Gt(e,Pie);return h.createElement(wie,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:Cie,tooltipPayloadSearcher:Lh,categoricalChartProps:n,ref:t})}),Tie=["axis"],Oie=h.forwardRef((e,t)=>h.createElement(Jb,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Tie,tooltipPayloadSearcher:Lh,categoricalChartProps:e,ref:t}));const Aie={background:"var(--bg-card)",borderRadius:"16px",border:"1px solid var(--border-primary)",padding:"20px",marginTop:"24px"},Iie={padding:"6px 12px",borderRadius:"8px",border:"1px solid var(--border-primary)",background:"var(--bg-secondary)",color:"var(--text-primary)",cursor:"pointer",fontSize:"13px"},bg={padding:"6px 12px",borderRadius:"8px",border:"1px solid var(--border-primary)",background:"var(--bg-card)",color:"var(--text-primary)",fontSize:"13px"};function Ad(e){return e?e>=1e3?`${(e/1e3).toFixed(2)}s`:`${Math.round(e)}ms`:"-"}function Id(e){return e?Math.round(e).toLocaleString():"-"}function Nie(e){return`${(e*100).toFixed(1)}%`}function _ie(e,t){return e?e.slice(-t):[]}function Mie(){const[e,t]=h.useState("service"),[n,r]=h.useState("ttft"),[i,a]=h.useState(24),[l,s]=h.useState("overview"),[c,u]=h.useState(null),[f,d]=h.useState(null),[p,m]=h.useState(null),[g,y]=h.useState(null),[x,v]=h.useState("desc"),[b,w]=h.useState([]),[S,C]=h.useState([]),[j,E]=h.useState(null),[O,R]=h.useState(null),[A,N]=h.useState(null),[_,q]=h.useState(!1),[W,I]=h.useState(null),F=h.useCallback(async()=>{q(!0),I(null);try{l==="overview"?e==="service"?w(await V.getPerformanceServicesOverview()||[]):C(await V.getPerformanceVendors()||[]):l==="vendor"&&c?E(await V.getPerformanceVendor(c)):l==="service"&&f?R(await V.getPerformanceService(f)):l==="model"&&f&&p&&N(await V.getPerformanceModel(f,p))}catch(ne){I((ne==null?void 0:ne.message)||"加载失败")}finally{q(!1)}},[e,l,c,f,p]);h.useEffect(()=>{F()},[F]);const K=ne=>{t(ne),s("overview"),u(null),d(null),m(null),E(null),R(null),N(null),y(null)},M=ne=>{u(ne),d(null),m(null),E(null),R(null),N(null),s("vendor"),y(null)},B=ne=>{d(ne),m(null),R(null),N(null),s("service"),y(null)},k=ne=>{m(ne),N(null),s("model"),y(null)},L=()=>{u(null),d(null),m(null),s("overview"),y(null)},Q=()=>{d(null),m(null),R(null),s("vendor"),y(null)},T=h.useMemo(()=>l==="overview"&&e==="service"?b.map(ne=>({id:ne.serviceId,name:ne.serviceName||ne.serviceId,vendorName:ne.vendorName,derived:ne.derived,onClick:()=>B(ne.serviceId)})):l==="overview"&&e==="vendor"?S.map(ne=>({id:ne.vendorId,name:ne.vendorName||ne.vendorId,derived:ne.derived,onClick:()=>M(ne.vendorId)})):l==="vendor"&&j?j.services.map(ne=>({id:ne.serviceId,name:ne.serviceName||ne.serviceId,derived:ne.derived,onClick:()=>B(ne.serviceId)})):l==="service"&&O?O.models.map(ne=>({id:ne.model,name:ne.model,derived:ne.derived,onClick:()=>k(ne.model)})):[],[l,e,b,S,j,O]),ce=h.useMemo(()=>{if(!g)return T;const ne=x==="asc"?1:-1;return[...T].sort((_e,Re)=>{const Fe=_e.derived[g]??0,rt=Re.derived[g]??0;return(Fe-rt)*ne})},[T,g,x]),ve=ne=>{g===ne?v(_e=>_e==="asc"?"desc":"asc"):(y(ne),v("desc"))},X=ne=>g!==ne?" ⇅":x==="asc"?" ▲":" ▼",oe=(()=>{if(l==="vendor")return j==null?void 0:j.hourly;if(l==="service")return O==null?void 0:O.hourly;if(l==="model")return A==null?void 0:A.hourly})(),te=_ie(oe,i).map(ne=>({hour:ne.hour.slice(11),value:n==="ttft"?ne.avgTtftMs:ne.avgTpm})),Z=l==="overview"&&e==="service",se=l==="overview"&&e==="vendor"?"供应商":l==="service"?"模型":"API 服务",re=n==="ttft"?"首 Token 返回时间":"吞吐 TPM",Oe=l==="model"?A==null?void 0:A.derived:void 0;return o.jsxs("div",{style:Aie,children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px",flexWrap:"wrap",gap:"8px"},children:[o.jsx("h3",{style:{margin:0,fontSize:"18px",color:"var(--text-primary)"},children:"⚡ 服务性能 / 测速统计"}),l!=="overview"&&o.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center",flexWrap:"wrap",fontSize:"13px"},children:[o.jsx("span",{onClick:L,style:wg,children:e==="service"?"全部 API 服务":"全部供应商"}),e==="vendor"&&c&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"var(--text-muted)"},children:"›"}),l==="vendor"?o.jsx("span",{style:{color:"var(--text-primary)"},children:(j==null?void 0:j.vendorName)||c}):o.jsx("span",{onClick:Q,style:wg,children:(j==null?void 0:j.vendorName)||c})]}),O&&(l==="service"||l==="model")&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"var(--text-muted)"},children:"›"}),l==="service"?o.jsx("span",{style:{color:"var(--text-primary)"},children:O.serviceName||f}):o.jsx("span",{onClick:()=>{m(null),N(null),s("service"),y(null)},style:wg,children:O.serviceName||f})]}),p&&l==="model"&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"var(--text-muted)"},children:"›"}),o.jsx("span",{style:{color:"var(--text-primary)"},children:p})]})]})]}),o.jsx("p",{style:{margin:"0 0 16px 0",color:"var(--text-muted)",fontSize:"13px"},children:"全局统计,与认证模式无关。首 Token 返回时间 = 请求发起到首个 token 的延迟;TPM = 生成阶段每分钟吐出的 token 数(基于真实流量被动采集)。"}),o.jsxs("div",{style:{display:"flex",gap:"12px",marginBottom:"16px",flexWrap:"wrap"},children:[o.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[o.jsx("label",{style:{color:"var(--text-muted)",fontSize:"13px"},children:"维度:"}),o.jsxs("select",{style:bg,value:e,onChange:ne=>K(ne.target.value),disabled:l!=="overview",children:[o.jsx("option",{value:"service",children:"API 服务"}),o.jsx("option",{value:"vendor",children:"供应商"})]})]}),o.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[o.jsx("label",{style:{color:"var(--text-muted)",fontSize:"13px"},children:"指标:"}),o.jsxs("select",{style:bg,value:n,onChange:ne=>r(ne.target.value),children:[o.jsx("option",{value:"ttft",children:"首 Token 返回时间"}),o.jsx("option",{value:"tpm",children:"吞吐 TPM"})]})]}),o.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[o.jsx("label",{style:{color:"var(--text-muted)",fontSize:"13px"},children:"时段:"}),o.jsxs("select",{style:bg,value:i,onChange:ne=>a(Number(ne.target.value)),children:[o.jsx("option",{value:24,children:"近 24 小时"}),o.jsx("option",{value:168,children:"近 7 天"}),o.jsx("option",{value:720,children:"近 30 天"})]})]}),o.jsx("button",{style:Iie,onClick:F,children:"🔄 刷新"})]}),W&&o.jsx("div",{style:{color:"#e74c3c",marginBottom:"12px"},children:W}),o.jsx("div",{style:{overflowX:"auto"},children:o.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{style:ul,children:se}),Z&&o.jsx("th",{style:ul,children:"供应商"}),o.jsxs("th",{style:{...ul,cursor:"pointer",userSelect:"none"},onClick:()=>ve("avgTtftMs"),children:["平均首Token",X("avgTtftMs")]}),o.jsxs("th",{style:{...ul,cursor:"pointer",userSelect:"none"},onClick:()=>ve("avgTpm"),children:["平均 TPM",X("avgTpm")]}),o.jsx("th",{style:ul,children:"样本数"}),o.jsxs("th",{style:{...ul,cursor:"pointer",userSelect:"none"},onClick:()=>ve("successRate"),children:["成功率",X("successRate")]})]})}),o.jsxs("tbody",{children:[_&&o.jsx("tr",{children:o.jsx("td",{style:ca,colSpan:Z?6:5,align:"center",children:"加载中..."})}),!_&&ce.length===0&&o.jsx("tr",{children:o.jsx("td",{style:{...ca,color:"var(--text-muted)"},colSpan:Z?6:5,align:"center",children:"暂无数据"})}),!_&&ce.map(ne=>o.jsxs("tr",{style:Rie,children:[o.jsx("td",{style:ca,children:o.jsx("span",{style:{color:"var(--text-primary)",cursor:"pointer",textDecoration:"underline"},onClick:ne.onClick,children:ne.name})}),Z&&o.jsx("td",{style:{...ca,color:"var(--text-muted)"},children:ne.vendorName||"-"}),o.jsx("td",{style:ca,children:Ad(ne.derived.avgTtftMs)}),o.jsx("td",{style:ca,children:ne.derived.count>0?Id(ne.derived.avgTpm):"-"}),o.jsx("td",{style:ca,children:ne.derived.count}),o.jsx("td",{style:ca,children:Nie(ne.derived.successRate)})]},ne.id))]})]})}),l!=="overview"&&o.jsxs("div",{style:{marginTop:"24px"},children:[o.jsxs("h4",{style:{margin:"0 0 12px 0",fontSize:"15px",color:"var(--text-primary)"},children:[re," · 按小时走势",Oe&&o.jsxs("span",{style:{marginLeft:"12px",fontSize:"12px",color:"var(--text-muted)"},children:["最小 ",n==="ttft"?Ad(Oe.minTtftMs):Id(Oe.minTps?Oe.minTps*60:void 0)," / 最大 ",n==="ttft"?Ad(Oe.maxTtftMs):Id(Oe.maxTps?Oe.maxTps*60:void 0)]})]}),te.length===0?o.jsx("div",{style:{color:"var(--text-muted)",padding:"24px",textAlign:"center"},children:"暂无走势数据"}):o.jsx(fl,{width:"100%",height:260,children:o.jsxs(Dy,{data:te,margin:{top:8,right:16,bottom:0,left:8},children:[o.jsx(Tl,{strokeDasharray:"3 3",stroke:"var(--border-primary)"}),o.jsx(Al,{dataKey:"hour",stroke:"var(--text-muted)",fontSize:12}),o.jsx(Il,{stroke:"var(--text-muted)",fontSize:12}),o.jsx(pl,{contentStyle:{background:"var(--bg-card)",border:"1px solid var(--border-primary)",borderRadius:"8px"},formatter:ne=>[n==="ttft"?Ad(Number(ne)):Id(Number(ne)),re]}),o.jsx(xc,{type:"monotone",dataKey:"value",stroke:"#667eea",strokeWidth:2,dot:!1,name:re})]})})]})]})}const ul={textAlign:"left",padding:"10px 12px",borderBottom:"2px solid var(--border-primary)",color:"var(--text-muted)",fontWeight:500,fontSize:"12px"},ca={padding:"10px 12px",borderBottom:"1px solid var(--border-primary)",color:"var(--text-primary)"},wg={color:"var(--text-primary)",cursor:"pointer",textDecoration:"underline",textDecorationColor:"transparent"},Rie={transition:"background 0.15s"},OP=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899","#06b6d4","#f97316"];function Die(){const[e,t]=h.useState(null),[n,r]=h.useState(!0),[i,a]=h.useState(30);h.useEffect(()=>{l()},[i]);const l=async()=>{try{r(!0);const d=await V.getStatistics(i);t(d)}catch(d){console.error("Failed to load statistics:",d)}finally{r(!1)}},s=d=>d>=1e6?`${(d/1e6).toFixed(1)}M`:d>=1e3?`${(d/1e3).toFixed(1)}K`:d.toString(),c=d=>{if(d>=60){const p=Math.floor(d/60),m=d%60;return`${p}h ${m}m`}return`${d}m`};if(n)return o.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"60vh"},children:o.jsx("div",{style:{fontSize:"18px",color:"var(--text-muted)"},children:"加载统计数据中..."})});if(!e)return o.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"60vh"},children:o.jsx("div",{style:{fontSize:"18px",color:"var(--text-muted)"},children:"暂无统计数据"})});const u={"image-understanding":"图像理解","high-iq":"高智商","long-context":"长上下文",thinking:"思考模式",background:"后台任务","model-mapping":"模型顶替",default:"默认请求"},f=e.timeline.map(d=>({date:d.date,codingTime:Math.round(d.totalInputTokens/250+d.totalOutputTokens/100)}));return o.jsxs("div",{children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"24px"},children:[o.jsxs("div",{children:[o.jsx("h1",{style:{margin:0,fontSize:"28px",fontWeight:"bold",color:"var(--text-primary)"},children:"📊 数据统计"}),o.jsx("p",{style:{margin:"4px 0 0 0",color:"var(--text-muted)"},children:"查看您的 AI 编程助手使用情况分析"})]}),o.jsxs("div",{style:{display:"flex",gap:"12px",alignItems:"center"},children:[o.jsx("label",{style:{color:"var(--text-primary)",fontWeight:"500"},children:"统计周期:"}),o.jsxs("select",{value:i,onChange:d=>a(Number(d.target.value)),style:{padding:"8px 16px",borderRadius:"8px",border:"1px solid var(--border-primary)",background:"var(--bg-card)",color:"var(--text-primary)",fontSize:"14px",cursor:"pointer"},children:[o.jsx("option",{value:7,children:"最近 7 天"}),o.jsx("option",{value:30,children:"最近 30 天"}),o.jsx("option",{value:90,children:"最近 90 天"})]}),o.jsx("button",{onClick:l,style:{padding:"8px 16px",borderRadius:"8px",border:"1px solid var(--border-primary)",background:"var(--bg-card)",color:"var(--text-primary)",fontSize:"14px",cursor:"pointer"},children:"🔄 刷新"})]})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(240px, 1fr))",gap:"16px",marginBottom:"24px"},children:[o.jsxs("div",{style:{background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",padding:"20px",borderRadius:"16px",color:"white",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)"},children:[o.jsx("div",{style:{fontSize:"14px",opacity:.9,marginBottom:"8px"},children:"总请求数"}),o.jsx("div",{style:{fontSize:"32px",fontWeight:"bold"},children:s(e.overview.totalRequests)})]}),o.jsxs("div",{style:{background:"linear-gradient(135deg, #f093fb 0%, #f5576c 100%)",padding:"20px",borderRadius:"16px",color:"white",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)"},children:[o.jsx("div",{style:{fontSize:"14px",opacity:.9,marginBottom:"8px"},children:"总 Tokens"}),o.jsx("div",{style:{fontSize:"32px",fontWeight:"bold"},children:s(e.overview.totalTokens)})]}),o.jsxs("div",{style:{background:"linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)",padding:"20px",borderRadius:"16px",color:"white",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)"},children:[o.jsx("div",{style:{fontSize:"14px",opacity:.9,marginBottom:"8px"},children:"编程时长"}),o.jsx("div",{style:{fontSize:"32px",fontWeight:"bold"},children:c(e.overview.totalCodingTime)})]}),o.jsxs("div",{style:{background:"linear-gradient(135deg, #14a042 0%, #38f9d7 100%)",padding:"20px",borderRadius:"16px",color:"white",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)"},children:[o.jsx("div",{style:{fontSize:"14px",opacity:.9,marginBottom:"8px"},children:"成功率"}),o.jsxs("div",{style:{fontSize:"32px",fontWeight:"bold"},children:[e.overview.successRate.toFixed(1),"%"]})]}),o.jsxs("div",{style:{background:"linear-gradient(135deg, #fa709a 0%, #fee140 100%)",padding:"20px",borderRadius:"16px",color:"white",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)"},children:[o.jsx("div",{style:{fontSize:"14px",opacity:.9,marginBottom:"8px"},children:"平均响应时间"}),o.jsxs("div",{style:{fontSize:"32px",fontWeight:"bold"},children:[e.overview.avgResponseTime.toFixed(2),"ms"]})]}),o.jsxs("div",{style:{background:"linear-gradient(135deg, #30cfd0 0%, #330867 100%)",padding:"20px",borderRadius:"16px",color:"white",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)"},children:[o.jsx("div",{style:{fontSize:"14px",opacity:.9,marginBottom:"8px"},children:"配置统计"}),o.jsxs("div",{style:{fontSize:"14px",marginTop:"8px"},children:[e.overview.totalVendors," 供应商 · ",e.overview.totalServices," 服务 · ",e.overview.totalRoutes," 路由"]})]})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(500px, 1fr))",gap:"20px",marginBottom:"24px"},children:[o.jsxs("div",{style:{background:"var(--bg-card)",padding:"20px",borderRadius:"16px",border:"1px solid var(--border-primary)"},children:[o.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:"18px",color:"var(--text-primary)"},children:"📈 请求趋势"}),o.jsx(fl,{width:"100%",height:300,children:o.jsxs(Oie,{data:e.timeline,children:[o.jsx("defs",{children:o.jsxs("linearGradient",{id:"colorRequests",x1:"0",y1:"0",x2:"0",y2:"1",children:[o.jsx("stop",{offset:"5%",stopColor:"#8884d8",stopOpacity:.8}),o.jsx("stop",{offset:"95%",stopColor:"#8884d8",stopOpacity:0})]})}),o.jsx(Tl,{strokeDasharray:"3 3",stroke:"var(--border-primary)"}),o.jsx(Al,{dataKey:"date",stroke:"var(--text-muted)",fontSize:12,tickFormatter:d=>ft(d).format("MM/DD")}),o.jsx(Il,{stroke:"var(--text-muted)",fontSize:12}),o.jsx(pl,{contentStyle:{background:"var(--bg-card)",border:"1px solid var(--border-primary)",borderRadius:"8px",color:"var(--text-primary)"},labelFormatter:d=>ft(d).format("YYYY-MM-DD")}),o.jsx(tc,{}),o.jsx(Ey,{type:"monotone",dataKey:"totalRequests",name:"请求数",stroke:"#8884d8",fillOpacity:1,fill:"url(#colorRequests)"})]})})]}),o.jsxs("div",{style:{background:"var(--bg-card)",padding:"20px",borderRadius:"16px",border:"1px solid var(--border-primary)"},children:[o.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:"18px",color:"var(--text-primary)"},children:"🔢 Token 使用趋势"}),o.jsx(fl,{width:"100%",height:300,children:o.jsxs(Dy,{data:e.timeline,children:[o.jsx(Tl,{strokeDasharray:"3 3",stroke:"var(--border-primary)"}),o.jsx(Al,{dataKey:"date",stroke:"var(--text-muted)",fontSize:12,tickFormatter:d=>ft(d).format("MM/DD")}),o.jsx(Il,{stroke:"var(--text-muted)",fontSize:12,tickFormatter:d=>d?s(Number(d)):""}),o.jsx(pl,{contentStyle:{background:"var(--bg-card)",border:"1px solid var(--border-primary)",borderRadius:"8px",color:"var(--text-primary)"},labelFormatter:d=>ft(d).format("YYYY-MM-DD"),formatter:d=>d?s(Number(d)):""}),o.jsx(tc,{}),o.jsx(xc,{type:"monotone",dataKey:"totalInputTokens",name:"输入 Tokens",stroke:"#10b981",strokeWidth:2,dot:!1}),o.jsx(xc,{type:"monotone",dataKey:"totalOutputTokens",name:"输出 Tokens",stroke:"#f59e0b",strokeWidth:2,dot:!1})]})})]}),o.jsxs("div",{style:{background:"var(--bg-card)",padding:"20px",borderRadius:"16px",border:"1px solid var(--border-primary)"},children:[o.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:"18px",color:"var(--text-primary)"},children:"⏱️ 每日编程时长趋势"}),o.jsx(fl,{width:"100%",height:300,children:o.jsxs(Dy,{data:f,children:[o.jsx("defs",{children:o.jsxs("linearGradient",{id:"colorCodingTime",x1:"0",y1:"0",x2:"0",y2:"1",children:[o.jsx("stop",{offset:"5%",stopColor:"#8b5cf6",stopOpacity:.8}),o.jsx("stop",{offset:"95%",stopColor:"#8b5cf6",stopOpacity:0})]})}),o.jsx(Tl,{strokeDasharray:"3 3",stroke:"var(--border-primary)"}),o.jsx(Al,{dataKey:"date",stroke:"var(--text-muted)",fontSize:12,tickFormatter:d=>ft(d).format("MM/DD")}),o.jsx(Il,{stroke:"var(--text-muted)",fontSize:12,tickFormatter:d=>d!=null?d>=60?`${Math.round(Number(d)/60)}h`:`${Number(d)}m`:""}),o.jsx(pl,{contentStyle:{background:"var(--bg-card)",border:"1px solid var(--border-primary)",borderRadius:"8px",color:"var(--text-primary)"},labelFormatter:d=>ft(d).format("YYYY-MM-DD"),formatter:d=>d!=null?c(Number(d)):""}),o.jsx(tc,{}),o.jsx(Ey,{type:"monotone",dataKey:"codingTime",name:"编程时长",stroke:"#8b5cf6",fillOpacity:1,fill:"url(#colorCodingTime)"}),o.jsx(xc,{type:"monotone",dataKey:"codingTime",name:"编程时长",stroke:"#8b5cf6",strokeWidth:3,dot:{fill:"#8b5cf6",r:4},activeDot:{r:6}})]})}),o.jsx("div",{style:{marginTop:"12px",padding:"12px",background:"var(--bg-secondary)",borderRadius:"8px",fontSize:"14px",color:"var(--text-muted)",textAlign:"center"},children:"💡 编程时长基于 tokens 估算(阅读速度 250 tokens/分钟,编码速度 100 tokens/分钟)"})]}),o.jsxs("div",{style:{background:"var(--bg-card)",padding:"20px",borderRadius:"16px",border:"1px solid var(--border-primary)"},children:[o.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:"18px",color:"var(--text-primary)"},children:"🏢 供应商使用分布"}),o.jsx(fl,{width:"100%",height:300,children:o.jsxs(die,{data:e.byVendor,children:[o.jsx(Tl,{strokeDasharray:"3 3",stroke:"var(--border-primary)"}),o.jsx(Al,{dataKey:"vendorName",stroke:"var(--text-muted)",fontSize:12,angle:-45,textAnchor:"end",height:80}),o.jsx(Il,{stroke:"var(--text-muted)",fontSize:12}),o.jsx(pl,{contentStyle:{background:"var(--bg-card)",border:"1px solid var(--border-primary)",borderRadius:"8px",color:"var(--text-primary)"}}),o.jsx(tc,{}),o.jsx(lM,{dataKey:"totalRequests",name:"请求数",fill:"#3b82f6"})]})})]}),o.jsxs("div",{style:{background:"var(--bg-card)",padding:"20px",borderRadius:"16px",border:"1px solid var(--border-primary)"},children:[o.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:"18px",color:"var(--text-primary)"},children:"📋 请求类型分布"}),o.jsx(fl,{width:"100%",height:300,children:o.jsxs(Eie,{children:[o.jsx(I_,{data:e.contentTypeDistribution,cx:"50%",cy:"50%",labelLine:!0,label:d=>`${u[d.contentType]||d.contentType} (${d.percentage}%)`,outerRadius:80,fill:"#8884d8",dataKey:"count",children:e.contentTypeDistribution.map((d,p)=>o.jsx(Du,{fill:OP[p%OP.length]},`cell-${p}`))}),o.jsx(pl,{contentStyle:{background:"var(--bg-card)",border:"1px solid var(--border-primary)",borderRadius:"8px",color:"var(--text-primary)"},formatter:(d,p,m)=>{var b,w;const g=d??0,y=((b=m.payload)==null?void 0:b.percentage)??0,x=((w=m.payload)==null?void 0:w.contentType)||"",v=u[x]||x;return`${g} (${y}%) - ${v}`}})]})})]})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(400px, 1fr))",gap:"20px"},children:[o.jsxs("div",{style:{background:"var(--bg-card)",padding:"20px",borderRadius:"16px",border:"1px solid var(--border-primary)"},children:[o.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:"18px",color:"var(--text-primary)"},children:"🎯 按编程工具统计"}),o.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[o.jsx("thead",{children:o.jsxs("tr",{style:{borderBottom:"2px solid var(--border-primary)"},children:[o.jsx("th",{style:{padding:"12px",textAlign:"left",color:"var(--text-muted)",fontSize:"14px"},children:"类型"}),o.jsx("th",{style:{padding:"12px",textAlign:"right",color:"var(--text-muted)",fontSize:"14px"},children:"请求数"}),o.jsx("th",{style:{padding:"12px",textAlign:"right",color:"var(--text-muted)",fontSize:"14px"},children:"Tokens"})]})}),o.jsx("tbody",{children:e.byTargetType.map(d=>o.jsxs("tr",{style:{borderBottom:"1px solid var(--border-secondary)"},children:[o.jsx("td",{style:{padding:"12px",color:"var(--text-primary)"},children:d.targetType==="claude-code"?"Claude Code":"Codex"}),o.jsx("td",{style:{padding:"12px",textAlign:"right",color:"var(--text-primary)"},children:s(d.totalRequests)}),o.jsx("td",{style:{padding:"12px",textAlign:"right",color:"var(--text-primary)"},children:s(d.totalTokens)})]},d.targetType))})]})]}),o.jsxs("div",{style:{background:"var(--bg-card)",padding:"20px",borderRadius:"16px",border:"1px solid var(--border-primary)"},children:[o.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:"18px",color:"var(--text-primary)"},children:"🤖 按模型统计"}),o.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[o.jsx("thead",{children:o.jsxs("tr",{style:{borderBottom:"2px solid var(--border-primary)"},children:[o.jsx("th",{style:{padding:"12px",textAlign:"left",color:"var(--text-muted)",fontSize:"14px"},children:"模型"}),o.jsx("th",{style:{padding:"12px",textAlign:"right",color:"var(--text-muted)",fontSize:"14px"},children:"请求数"}),o.jsx("th",{style:{padding:"12px",textAlign:"right",color:"var(--text-muted)",fontSize:"14px"},children:"Tokens"})]})}),o.jsx("tbody",{children:e.byModel.slice(0,10).map(d=>o.jsxs("tr",{style:{borderBottom:"1px solid var(--border-secondary)"},children:[o.jsx("td",{style:{padding:"12px",color:"var(--text-primary)",maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis"},children:d.modelName}),o.jsx("td",{style:{padding:"12px",textAlign:"right",color:"var(--text-primary)"},children:s(d.totalRequests)}),o.jsx("td",{style:{padding:"12px",textAlign:"right",color:"var(--text-primary)"},children:s(d.totalTokens)})]},d.modelName))})]})]}),o.jsxs("div",{style:{background:"var(--bg-card)",padding:"20px",borderRadius:"16px",border:"1px solid var(--border-primary)"},children:[o.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:"18px",color:"var(--text-primary)"},children:"🔧 按服务商API服务统计"}),o.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[o.jsx("thead",{children:o.jsxs("tr",{style:{borderBottom:"2px solid var(--border-primary)"},children:[o.jsx("th",{style:{padding:"12px",textAlign:"left",color:"var(--text-muted)",fontSize:"14px"},children:"服务"}),o.jsx("th",{style:{padding:"12px",textAlign:"right",color:"var(--text-muted)",fontSize:"14px"},children:"请求数"}),o.jsx("th",{style:{padding:"12px",textAlign:"right",color:"var(--text-muted)",fontSize:"14px"},children:"Tokens"})]})}),o.jsx("tbody",{children:e.byService.slice(0,10).map(d=>o.jsxs("tr",{style:{borderBottom:"1px solid var(--border-secondary)"},children:[o.jsxs("td",{style:{padding:"12px",color:"var(--text-primary)"},children:[o.jsx("div",{style:{fontSize:"14px",fontWeight:"bold"},children:d.serviceName}),o.jsx("div",{style:{fontSize:"12px",color:"var(--text-muted)"},children:d.vendorName})]}),o.jsx("td",{style:{padding:"12px",textAlign:"right",color:"var(--text-primary)"},children:s(d.totalRequests)}),o.jsx("td",{style:{padding:"12px",textAlign:"right",color:"var(--text-primary)"},children:s(d.totalTokens)})]},d.serviceId))})]})]}),o.jsxs("div",{style:{background:"var(--bg-card)",padding:"20px",borderRadius:"16px",border:"1px solid var(--border-primary)"},children:[o.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:"18px",color:"var(--text-primary)"},children:"💰 Token 详细统计"}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"12px",background:"var(--bg-secondary)",borderRadius:"8px"},children:[o.jsx("span",{style:{color:"var(--text-muted)"},children:"输入 Tokens"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:"bold"},children:s(e.overview.totalInputTokens)})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"12px",background:"var(--bg-secondary)",borderRadius:"8px"},children:[o.jsx("span",{style:{color:"var(--text-muted)"},children:"输出 Tokens"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:"bold"},children:s(e.overview.totalOutputTokens)})]}),e.overview.totalCacheReadTokens>0&&o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"12px",background:"var(--bg-secondary)",borderRadius:"8px"},children:[o.jsx("span",{style:{color:"var(--text-muted)"},children:"缓存读取 Tokens"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:"bold"},children:s(e.overview.totalCacheReadTokens)})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"12px",background:"var(--bg-secondary)",borderRadius:"8px"},children:[o.jsx("span",{style:{color:"var(--text-muted)"},children:"总计 Tokens"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:"bold"},children:s(e.overview.totalTokens)})]}),o.jsxs("div",{style:{marginTop:"8px",padding:"12px",background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",borderRadius:"8px",color:"white"},children:[o.jsx("div",{style:{fontSize:"12px",opacity:.9},children:"预估节省"}),o.jsxs("div",{style:{fontSize:"20px",fontWeight:"bold",marginTop:"4px"},children:["$",(e.overview.totalTokens/1e6*15).toFixed(2)]}),o.jsx("div",{style:{fontSize:"12px",opacity:.9,marginTop:"4px"},children:"按 $15/1M tokens 估算"})]})]})]})]}),o.jsx(Mie,{})]})}function AP({isOpen:e,onClose:t,title:n,children:r,showCloseButton:i=!0,closeOnOverlayClick:a=!1,maxWidth:l="600px"}){return e?o.jsxs("div",{className:"modal-overlay",style:{zIndex:1e6},onClick:s=>{a||s.stopPropagation()},children:[i&&o.jsx("button",{type:"button",className:"modal-close-btn",onClick:t,"aria-label":"关闭",children:"×"}),o.jsx("div",{className:"modal",style:{maxWidth:l,width:"90%"},children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:n})}),r]})})]}):null}function Lie(){const[e,t]=h.useState(!1),[n,r]=h.useState([]),[i,a]=h.useState(!0),[l,s]=h.useState({skillId:null,skillName:"",isDeleting:!1}),[c,u]=h.useState(!1),[f,d]=h.useState({name:"",description:"",instruction:"",link:"",targets:[]}),[p,m]=h.useState(!1),[g,y]=h.useState(!1),[x,v]=h.useState(""),[b,w]=h.useState(""),[S,C]=h.useState(!1),[j,E]=h.useState([]),[O,R]=h.useState(!1),[A,N]=h.useState({skill:null,isInstalling:!1,targetType:null,status:"idle",message:"",progress:0,selectedTargets:[]}),_=async()=>{try{a(!0);const X=await V.getInstalledSkills();r(X)}catch(X){console.error("Failed to load installed skills:",X),U.error("加载已安装 Skills 失败")}finally{a(!1)}};h.useEffect(()=>{_()},[]);const q=async()=>{const X=b.trim();if(!X){U.warning("请输入需求描述后再搜索");return}try{C(!0),R(!0);const fe=(await V.searchSkills(X)).sort((te,Z)=>{const se=te.stars??0;return(Z.stars??0)-se});E(fe)}catch(oe){console.error("Failed to search skills:",oe),U.error("搜索失败,请稍后重试")}finally{C(!1)}},W=X=>{N({skill:X,isInstalling:!1,targetType:null,status:"idle",message:"",progress:0,selectedTargets:[]})},I=()=>{A.isInstalling||N({skill:null,isInstalling:!1,targetType:null,status:"idle",message:"",progress:0,selectedTargets:[]})},F=(X,oe)=>{N(fe=>({...fe,selectedTargets:oe?[...fe.selectedTargets,X]:fe.selectedTargets.filter(te=>te!==X)}))},K=async()=>{var X;if(A.skill)try{N(fe=>({...fe,isInstalling:!0,status:"preparing",message:"正在准备安装...",progress:0})),N(fe=>({...fe,status:"downloading",message:"正在从GitHub下载..."}));const oe=await V.installSkill(A.skill,A.selectedTargets[0]);if(oe.success){const fe=A.selectedTargets,te=(X=oe.installedSkill)==null?void 0:X.id;if(!te){N(se=>({...se,status:"error",message:"安装返回数据异常"})),U.error("安装返回数据异常");return}let Z=0;for(const se of fe)(await V.enableSkill(te,se)).success&&Z++;N(se=>({...se,status:"completed",message:fe.length>0?`安装完成!已启用 ${Z}/${fe.length} 个目标`:"安装完成!可在列表中启用目标",progress:100})),fe.length>0?U.success(`已安装到 ${fe.map(se=>se==="claude-code"?"Claude Code":"Codex").join(", ")}`):U.success("安装完成!可在列表中启用目标"),await _()}else N(fe=>({...fe,status:"error",message:oe.message?`${oe.message}。如多次失败,可尝试在设置中配置代理`:"安装失败,请稍后重试"})),U.error(oe.message?`${oe.message}。如多次失败,可尝试在设置中配置代理`:"安装失败,请稍后重试")}catch(oe){console.error("Failed to install skill:",oe),N(fe=>({...fe,status:"error",message:"安装失败,请稍后重试。如多次失败,可尝试在设置中配置代理"})),U.error("安装失败,请稍后重试。如多次失败,可尝试在设置中配置代理")}finally{setTimeout(()=>{N(oe=>({...oe,skill:null,isInstalling:!1,targetType:null,status:"idle",message:"",progress:0,selectedTargets:[]}))},2e3)}},M=async(X,oe,fe)=>{try{fe?(await V.enableSkill(X,oe),U.success(`已启用 ${oe==="claude-code"?"Claude Code":"Codex"}`)):(await V.disableSkill(X,oe),U.success(`已禁用 ${oe==="claude-code"?"Claude Code":"Codex"}`)),await _()}catch(te){console.error("Failed to toggle skill:",te),U.error("操作失败,请稍后重试")}},B=X=>{s({skillId:X.id,skillName:X.name,isDeleting:!1})},k=()=>{l.isDeleting||s({skillId:null,skillName:"",isDeleting:!1})},L=async()=>{if(l.skillId)try{s(X=>({...X,isDeleting:!0})),await V.deleteSkill(l.skillId),U.success("已删除 Skill"),await _(),k()}catch(X){console.error("Failed to delete skill:",X),U.error("删除失败,请稍后重试"),s(oe=>({...oe,isDeleting:!1}))}},Q=()=>{try{const X=x.trim();if(!X){U.error("请粘贴 SKILL.md 内容");return}let oe="",fe="",te=X;if(X.startsWith("---")){const Z=X.indexOf("---",3);if(Z!==-1){const se=X.slice(3,Z),re=X.match(/^#\s+(.+)$/m);oe=re?re[1].trim():"";const Oe=se.split(`
463
+ `);for(const ne of Oe)ne.startsWith("name:")?oe=ne.replace("name:","").trim():ne.startsWith("description:")&&(fe=ne.replace("description:","").trim());te=X.slice(Z+3).trim(),te=te.replace(/^##\s+指令\n*/,"").trim()}}else{const Z=X.match(/^#\s+(.+)$/m);Z&&(oe=Z[1].trim())}if(!oe){U.error("无法解析 Skill 名称");return}d(Z=>({...Z,name:oe,description:fe||Z.description,instruction:te||Z.instruction})),y(!1),v(""),U.success("解析成功")}catch(X){console.error("Failed to parse skill:",X),U.error("解析失败,请检查格式")}},T=async X=>{var oe;if(X.preventDefault(),!f.name.trim()){U.error("请填写 Skill 名称");return}if(!f.description.trim()){U.error("请填写描述");return}if(!f.instruction.trim()){U.error("请填写指令");return}try{m(!0);const fe=await V.createLocalSkill({name:f.name.trim(),description:f.description.trim(),instruction:f.instruction.trim(),link:f.link.trim()||void 0,targets:f.targets});if(fe.success){U.success("Skill 创建成功"),u(!1),d({name:"",description:"",instruction:"",link:"",targets:[]}),await _();for(const te of f.targets)(oe=fe.installedSkill)!=null&&oe.id&&await V.enableSkill(fe.installedSkill.id,te)}else U.error(fe.message||"创建失败")}catch(fe){console.error("Failed to create skill:",fe),U.error("创建失败,请稍后重试")}finally{m(!1)}},ce=()=>i?o.jsx("div",{className:"empty-state",children:o.jsx("p",{children:"正在加载已安装 Skills..."})}):n.length===0?o.jsxs("div",{className:"empty-state",children:[o.jsx("p",{children:"当前没有检测到全局 Skills"}),o.jsx("span",{children:"你可以在“发现”中搜索并安装新的 Skills。"})]}):o.jsx("div",{className:"skills-grid",children:n.map(X=>o.jsxs("div",{className:"card skill-card",style:{display:"flex",flexDirection:"column"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[o.jsx("div",{className:"skill-title",style:{flex:1},children:X.name}),o.jsxs("div",{style:{display:"flex",gap:"8px",flexShrink:0},children:[X.githubUrl&&o.jsx("a",{href:X.githubUrl,target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary",style:{padding:"6px 12px",fontSize:"12px",textDecoration:"none",display:"inline-flex",alignItems:"center"},children:"查看详情"}),o.jsx("button",{className:"btn btn-danger",onClick:()=>B(X),style:{padding:"6px 12px",fontSize:"12px"},children:"删除"})]})]}),o.jsxs("div",{style:{flex:1},children:[o.jsx("div",{className:"skill-description",children:X.description||"暂无描述"}),o.jsxs("div",{style:{marginTop:"8px",fontSize:"12px",color:"var(--text-muted)"},children:["安装时间: ",new Date(X.installedAt).toLocaleDateString("zh-CN")]})]}),o.jsxs("div",{style:{marginTop:"auto",paddingTop:"16px",borderTop:"1px solid var(--border-color)",display:"flex",gap:"24px"},children:[o.jsx(Nj,{skillId:X.id,targetType:"claude-code",enabled:X.enabledTargets.includes("claude-code"),onChange:M}),o.jsx(Nj,{skillId:X.id,targetType:"codex",enabled:X.enabledTargets.includes("codex"),onChange:M})]})]},X.id))}),ve=()=>o.jsxs("div",{className:"skills-discover",children:[o.jsxs("div",{className:"card skills-search-card",children:[o.jsxs("div",{className:"skills-search-header",children:[o.jsx("h3",{children:"描述你的需求,我会帮你找到你需要的 Skills"}),o.jsx("p",{children:"例如:帮我写 TypeScript 类型定义、自动生成测试用例、优化 React 性能"})]}),o.jsx("textarea",{rows:4,value:b,onChange:X=>w(X.target.value),placeholder:"请输入你的需求...",className:"skills-search-input"}),o.jsx("div",{className:"skills-search-actions",children:o.jsx("button",{className:"btn btn-primary",onClick:q,disabled:S,children:S?"搜索中...":"搜索"})})]}),o.jsxs("div",{className:"skills-results",children:[S&&o.jsx("div",{className:"empty-state",children:o.jsx("p",{children:"正在进行 AI 搜索..."})}),!S&&O&&j.length===0&&o.jsxs("div",{className:"empty-state",children:[o.jsx("p",{children:"没有找到匹配的 Skills"}),o.jsx("span",{children:"试试换个描述或添加更多细节。"})]}),!S&&j.length>0&&o.jsx("div",{className:"skills-grid",children:j.map(X=>o.jsxs("div",{className:"card skill-card",children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[o.jsx("div",{className:"skill-title",style:{flex:1},children:X.name}),X.stars!==void 0&&X.stars>0&&o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",color:"#f39c12",fontSize:"14px",flexShrink:0},children:[o.jsx("span",{children:"⭐"}),o.jsx("span",{style:{fontWeight:"600"},children:X.stars})]})]}),X.tags&&X.tags.length>0&&o.jsx("div",{className:"skill-tags",children:X.tags.map(oe=>o.jsx("span",{className:"badge badge-secondary",children:oe},oe))}),o.jsx("div",{className:"skill-description",children:X.description||"暂无描述"}),o.jsxs("div",{className:"skills-result-actions",children:[X.url?o.jsx("a",{className:"btn btn-secondary",href:X.url,target:"_blank",rel:"noopener noreferrer",style:{marginLeft:"8px"},children:"查看"}):null,o.jsx("button",{className:"btn btn-secondary",onClick:()=>W(X),children:"安装"})]})]},X.id))})]})]});return o.jsxs("div",{children:[o.jsxs("div",{className:"skills-header-row",children:[o.jsxs("div",{className:"page-header",children:[o.jsx("h1",{children:"Skills 管理"}),o.jsx("p",{children:"管理 Claude Code 与 Codex 的全局技能,并发现新的生产力增强 Skills。"})]}),o.jsxs("div",{className:"skills-header-actions",children:[!e&&o.jsx("button",{className:"btn btn-secondary skills-discover-btn",onClick:()=>u(!0),style:{marginRight:"8px"},children:"新增"}),o.jsx("button",{className:"btn btn-secondary skills-discover-btn",onClick:()=>t(X=>!X),children:e?"返回":"发现"})]})]}),e?ve():ce(),A.skill&&o.jsxs("div",{className:"modal-overlay",style:{zIndex:1e6},children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:I,disabled:A.isInstalling,"aria-label":"关闭",children:"×"}),o.jsx("div",{className:"modal",style:{maxWidth:"520px"},children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:A.status==="idle"?"选择安装目标":A.status==="completed"?"安装完成":A.status==="error"?"安装失败":"正在安装"})}),o.jsx("div",{className:"modal-body",style:{padding:"0 20px 10px"},children:A.status==="idle"?o.jsxs(o.Fragment,{children:[o.jsxs("p",{style:{marginBottom:"12px",color:"var(--text-muted)"},children:["即将安装:",o.jsx("strong",{children:A.skill.name})]}),A.skill.description&&o.jsx("p",{style:{marginBottom:"12px",color:"var(--text-muted)",fontSize:"14px"},children:A.skill.description}),o.jsxs("div",{style:{marginTop:"20px"},children:[o.jsx("p",{style:{fontSize:"14px",color:"var(--text-muted)",marginBottom:"12px"},children:"选择安装目标(可多选):"}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",checked:A.selectedTargets.includes("claude-code"),onChange:X=>F("claude-code",X.target.checked),style:{width:"18px",height:"18px",cursor:"pointer"}}),o.jsx("span",{style:{fontSize:"14px"},children:"Claude Code"})]}),o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",checked:A.selectedTargets.includes("codex"),onChange:X=>F("codex",X.target.checked),style:{width:"18px",height:"18px",cursor:"pointer"}}),o.jsx("span",{style:{fontSize:"14px"},children:"Codex"})]})]})]})]}):o.jsxs("div",{style:{padding:"20px 0"},children:[o.jsx("div",{style:{height:"8px",backgroundColor:"var(--bg-secondary)",borderRadius:"4px",overflow:"hidden",marginBottom:"16px"},children:o.jsx("div",{style:{width:`${A.progress}%`,height:"100%",backgroundColor:A.status==="error"?"var(--error-color)":"var(--primary-color)",transition:"width 0.3s ease"}})}),o.jsx("p",{style:{textAlign:"center",color:"var(--text-muted)",marginBottom:"8px"},children:A.message}),A.status==="error"&&o.jsx("p",{style:{textAlign:"center",color:"var(--error)",fontSize:"14px"},children:A.message})]})}),o.jsx("div",{className:"modal-footer",style:{justifyContent:A.status!=="idle"?"center":"space-between"},children:A.status==="idle"?o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"btn btn-secondary",onClick:I,disabled:A.isInstalling,children:"取消"}),o.jsx("button",{className:"btn btn-primary",onClick:K,disabled:A.isInstalling,children:"确定安装"})]}):A.status==="completed"||A.status==="error"?o.jsx("button",{className:"btn btn-primary",onClick:I,children:"关闭"}):o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[o.jsx("div",{className:"spinner",style:{width:"16px",height:"16px",border:"2px solid var(--bg-secondary)",borderTopColor:"var(--primary-color)",borderRadius:"50%"}}),o.jsx("span",{style:{color:"var(--text-muted)"},children:"正在处理..."})]})})]})})]}),l.skillId&&o.jsxs("div",{className:"modal-overlay",style:{zIndex:1000001},children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:k,disabled:l.isDeleting,"aria-label":"关闭",children:"×"}),o.jsx("div",{className:"modal",style:{maxWidth:"400px"},children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:"确认删除"})}),o.jsxs("div",{className:"modal-body",style:{padding:"0 20px 10px"},children:[o.jsxs("p",{style:{color:"var(--text-muted)"},children:["确定要删除 Skill ",o.jsx("strong",{children:l.skillName})," 吗?"]}),o.jsx("p",{style:{color:"var(--text-muted)",fontSize:"14px",marginTop:"8px"},children:"这将删除该Skill及其所有平台的软链接,且无法恢复。"})]}),o.jsxs("div",{className:"modal-footer",style:{justifyContent:"space-between"},children:[o.jsx("button",{className:"btn btn-secondary",onClick:k,disabled:l.isDeleting,children:"取消"}),o.jsx("button",{className:"btn btn-danger",onClick:L,disabled:l.isDeleting,children:l.isDeleting?"删除中...":"确认删除"})]})]})})]}),c&&o.jsx(AP,{isOpen:c,onClose:()=>u(!1),title:"新增 Skill",closeOnOverlayClick:!1,children:o.jsxs("form",{onSubmit:T,children:[o.jsxs("div",{style:{padding:"20px"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[o.jsx("small",{style:{color:"var(--text-muted)",fontSize:"13px"},children:"从其他来源复制的 SKILL.md 内容可直接粘贴解析"}),o.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>y(!0),style:{padding:"6px 16px",fontSize:"13px"},children:"解析"})]}),o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{children:["名称 ",o.jsx("span",{style:{color:"#e74c3c"},children:"*"})]}),o.jsx("input",{type:"text",value:f.name,onChange:X=>d(oe=>({...oe,name:X.target.value})),placeholder:"输入 Skill 名称",required:!0})]}),o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{children:["描述 ",o.jsx("span",{style:{color:"#e74c3c"},children:"*"})]}),o.jsx("input",{type:"text",value:f.description,onChange:X=>d(oe=>({...oe,description:X.target.value})),placeholder:"简要描述这个 Skill 的功能",required:!0})]}),o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{children:["指令 ",o.jsx("span",{style:{color:"#e74c3c"},children:"*"})]}),o.jsx("small",{style:{display:"block",marginBottom:"8px",color:"#666",fontSize:"12px",lineHeight:"1.5"},children:"当这个 Skill 被触发时,你希望模型遵循哪些规则或信息"}),o.jsx("textarea",{value:f.instruction,onChange:X=>d(oe=>({...oe,instruction:X.target.value})),placeholder:`当这个 Skill 被触发时,你希望模型遵循哪些规则或信息,例如:
464
+ # codemap
465
+ ## 命令
466
+ ## 使用场景
467
+ ## 输出解释
468
+ ## 示例`,rows:10,style:{fontFamily:"monospace",fontSize:"13px"},required:!0})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"链接(可选)"}),o.jsx("input",{type:"url",value:f.link,onChange:X=>d(oe=>({...oe,link:X.target.value})),placeholder:"https://example.com 或 GitHub 仓库地址"}),o.jsx("small",{style:{display:"block",marginTop:"4px",color:"#666",fontSize:"12px"},children:"Skill 相关文档或资源链接"})]}),o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{children:["安装目标 ",o.jsx("span",{style:{color:"#e74c3c"},children:"*"})]}),o.jsxs("div",{style:{display:"flex",gap:"20px",marginTop:"8px"},children:[o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",whiteSpace:"nowrap"},children:[o.jsx("input",{type:"checkbox",checked:f.targets.includes("claude-code"),onChange:X=>{X.target.checked?d(oe=>({...oe,targets:[...oe.targets,"claude-code"]})):d(oe=>({...oe,targets:oe.targets.filter(fe=>fe!=="claude-code")}))}}),"Claude Code"]}),o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",checked:f.targets.includes("codex"),onChange:X=>{X.target.checked?d(oe=>({...oe,targets:[...oe.targets,"codex"]})):d(oe=>({...oe,targets:oe.targets.filter(fe=>fe!=="codex")}))}}),"Codex"]})]})]}),o.jsx("div",{style:{marginTop:"16px",padding:"12px",background:"var(--bg-tertiary)",borderRadius:"8px"},children:o.jsxs("small",{style:{color:"var(--text-muted)",fontSize:"12px",lineHeight:"1.6"},children:["💡 提示:Skill 创建后,可通过 ",o.jsxs("code",{style:{background:"var(--bg-secondary)",padding:"2px 6px",borderRadius:"4px"},children:["~/.aicodeswitch/skills/",f.name||"skill-name"]})," 路径对 Skill 内容进行二次编辑"]})})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>u(!1),disabled:p,children:"取消"}),o.jsx("button",{type:"submit",className:"btn btn-primary",disabled:p,children:p?"创建中...":"确认创建"})]})]})}),g&&o.jsxs(AP,{isOpen:g,onClose:()=>{y(!1),v("")},title:"解析 SKILL.md",closeOnOverlayClick:!1,children:[o.jsxs("div",{style:{padding:"20px"},children:[o.jsx("p",{style:{color:"var(--text-muted)",fontSize:"14px",marginBottom:"12px"},children:"直接粘贴从其他地方复制的 SKILL.md 内容,系统将自动解析填充到表单中。"}),o.jsx("textarea",{value:x,onChange:X=>v(X.target.value),placeholder:`---
469
+ name: skill-name
470
+ description: Skill 描述
471
+ ---
472
+
473
+ # Skill 名称
474
+
475
+ Skill 描述
476
+
477
+ ## 指令
478
+
479
+ 技能指令内容...`,rows:15,style:{width:"100%",fontFamily:"monospace",fontSize:"13px",padding:"12px",border:"1px solid var(--border-color)",borderRadius:"8px",background:"var(--bg-primary)",color:"var(--text-primary)",resize:"vertical"}})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>{y(!1),v("")},children:"取消"}),o.jsx("button",{type:"button",className:"btn btn-primary",onClick:Q,children:"解析并填充"})]})]})]})}const zie=[{id:"glm-vision",name:"GLM 视觉理解",description:"提供图像理解能力,支持多种视觉场景分析",type:"stdio",command:"npx",args:["-y","@z_ai/mcp-server"],env:{Z_AI_MODE:"ZHIPU"},apiKeyIn:"headers"},{id:"glm-web-search",name:"GLM 联网搜索",description:"提供网络搜索能力,实时获取最新信息",type:"http",url:"https://open.bigmodel.cn/api/mcp/web_search_prime/mcp",apiKeyIn:"headers"},{id:"glm-web-reader",name:"GLM 网页读取",description:"提供网页内容读取和解析能力",type:"http",url:"https://open.bigmodel.cn/api/mcp/web_reader/mcp",apiKeyIn:"headers"},{id:"glm-zread",name:"GLM 开源仓库",description:"提供开源仓库代码搜索和阅读能力",type:"http",url:"https://open.bigmodel.cn/api/mcp/zread/mcp",apiKeyIn:"headers"},{id:"minimax-coding-plan",name:"MiniMax Coding Plan",description:"提供网络搜索和图片理解能力",type:"stdio",command:"uvx",args:["-y","minimax-coding-plan-mcp"],env:{MINIMAX_API_HOST:"https://api.minimaxi.com"},apiKeyIn:"env",apiKeyEnvName:"MINIMAX_API_KEY"}];function $ie(){var q,W;const[e,t]=h.useState([]),[n,r]=h.useState(!0),[i,a]=h.useState(!1),[l,s]=h.useState(null),[c,u]=h.useState({name:"",description:"",type:"stdio",command:"",args:"",url:"",headers:"",env:"",targets:[]}),[f,d]=h.useState(!1),[p,m]=h.useState({mcpId:null,mcpName:"",isDeleting:!1}),[g,y]=h.useState({isOpen:!1,step:"select",message:"",installingMCPName:null,apiKey:"",selectedDefinition:null}),x=async()=>{try{r(!0);const I=await V.getMCPs();t(I)}catch(I){console.error("Failed to load MCPs:",I),U.error("加载 MCP 工具失败")}finally{r(!1)}};h.useEffect(()=>{x()},[]);const v=()=>{s(null),u({name:"",description:"",type:"stdio",command:"",args:"",url:"",headers:"",env:"",targets:[]}),a(!0)},b=I=>{s(I),u({name:I.name,description:I.description||"",type:I.type,command:I.command||"",args:I.args?I.args.join(" "):"",url:I.url||"",headers:I.headers?JSON.stringify(I.headers,null,2):"",env:I.env?JSON.stringify(I.env,null,2):"",targets:I.targets||[]}),a(!0)},w=()=>{f||(a(!1),s(null))},S=async I=>{var F,K;if(I.preventDefault(),!c.name.trim()){U.error("请填写 MCP 名称");return}if(c.type==="stdio"&&!c.command){U.error("请填写命令");return}if((c.type==="http"||c.type==="sse")&&!c.url){U.error("请填写 URL");return}try{d(!0);const M={},B={};if(c.env)try{Object.assign(M,JSON.parse(c.env))}catch{U.error("环境变量格式错误,请使用有效的 JSON 格式");return}if(c.headers)try{Object.assign(B,JSON.parse(c.headers))}catch{U.error("请求头格式错误,请使用有效的 JSON 格式");return}const k={name:c.name.trim(),description:c.description.trim(),type:c.type,command:(F=c.command)==null?void 0:F.trim(),args:c.args?c.args.trim().split(/\s+/):void 0,url:(K=c.url)==null?void 0:K.trim(),headers:Object.keys(B).length>0?B:void 0,env:Object.keys(M).length>0?M:void 0,targets:c.targets};l?(await V.updateMCP(l.id,k),U.success("MCP 工具已更新")):(await V.createMCP(k),U.success("MCP 工具已添加")),a(!1),s(null),await x()}catch(M){console.error("Failed to save MCP:",M),U.error("保存失败,请稍后重试")}finally{d(!1)}},C=I=>{m({mcpId:I.id,mcpName:I.name,isDeleting:!1})},j=()=>{p.isDeleting||m({mcpId:null,mcpName:"",isDeleting:!1})},E=async()=>{if(p.mcpId)try{m(I=>({...I,isDeleting:!0})),await V.deleteMCP(p.mcpId),U.success("已删除 MCP 工具"),await x(),j()}catch(I){console.error("Failed to delete MCP:",I),U.error("删除失败,请稍后重试"),m(F=>({...F,isDeleting:!1}))}},O=()=>{y({isOpen:!0,step:"select",message:"",installingMCPName:null,apiKey:"",selectedDefinition:null})},R=()=>{g.installingMCPName||y({isOpen:!1,step:"select",message:"",installingMCPName:null,apiKey:"",selectedDefinition:null})},A=I=>{y(F=>({...F,step:"input-api-key",selectedDefinition:I}))},N=async()=>{var I;if(!g.apiKey.trim()){U.error("请填写 API Key");return}if(g.selectedDefinition)try{const F=g.selectedDefinition;y(ce=>({...ce,step:"installing",message:"正在安装...",installingMCPName:F.name}));const K=F.apiKeyEnvName||"Z_AI_API_KEY",M=F.apiKeyIn==="env",B=[];F.env&&Object.entries(F.env).forEach(([ce,ve])=>{ve!==void 0&&B.push([ce,ve])}),M&&B.push([K,g.apiKey.trim()]);const k=B.length>0?Object.fromEntries(B):void 0,Q=F.apiKeyIn==="headers"?{Authorization:`Bearer ${g.apiKey.trim()}`}:void 0,T={name:F.name,description:F.description,type:F.type,command:F.command,args:F.args,url:F.url,env:k,headers:Q,targets:["claude-code","codex"]};await V.createMCP(T),y(ce=>({...ce,step:"completed",message:`成功安装 ${F.name}`,installingMCPName:null})),U.success(`已安装 ${F.name}`),await x()}catch(F){console.error(`Failed to install ${(I=g.selectedDefinition)==null?void 0:I.id}:`,F),y(K=>({...K,step:"error",message:"安装失败,请稍后重试",installingMCPName:null})),U.error("安装失败,请稍后重试")}},_=I=>{switch(I){case"stdio":return"命令行";case"http":return"HTTP";case"sse":return"SSE";default:return I}};return o.jsxs("div",{children:[o.jsxs("div",{className:"page-header",style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o.jsxs("div",{children:[o.jsx("h1",{children:"MCP 管理"}),o.jsx("p",{children:"管理 Model Context Protocol (MCP) 工具,扩展 Claude Code 和 Codex 的能力"})]}),o.jsxs("div",{style:{display:"flex",gap:"12px"},children:[o.jsxs("button",{className:"btn btn-secondary",onClick:O,style:{display:"flex",alignItems:"center",gap:"8px"},children:[o.jsx("span",{children:"⚡"}),o.jsx("span",{children:"一键安装 MCP"})]}),o.jsx("button",{className:"btn btn-primary",onClick:v,children:"添加 MCP 工具"})]})]}),n?o.jsx("div",{className:"empty-state",children:o.jsx("p",{children:"正在加载 MCP 工具..."})}):e.length===0?o.jsxs("div",{className:"empty-state",children:[o.jsx("p",{children:"当前没有安装 MCP 工具"}),o.jsx("span",{children:'你可以点击"添加 MCP 工具"或"一键安装 MCP"来添加工具。'})]}):o.jsx("div",{className:"mcp-grid",style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(400px, 1fr))",gap:"16px",marginTop:"24px"},children:e.map(I=>{var F,K,M;return o.jsxs("div",{className:"card mcp-card",style:{display:"flex",flexDirection:"column"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flex:1,minWidth:0},children:[o.jsx("div",{className:"mcp-title",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:I.name}),o.jsx("div",{className:"badge badge-secondary",children:_(I.type)})]}),o.jsxs("div",{style:{display:"flex",gap:"6px",flexShrink:0},children:[o.jsx("button",{className:"btn btn-secondary",onClick:()=>b(I),style:{padding:"6px 14px",fontSize:"13px"},children:"编辑"}),o.jsx("button",{className:"btn btn-danger",onClick:()=>C(I),style:{padding:"6px 14px",fontSize:"13px"},children:"删除"})]})]}),I.description&&o.jsx("div",{className:"mcp-description",style:{marginTop:"12px",color:"var(--text-muted)",fontSize:"14px"},children:I.description}),o.jsxs("div",{style:{marginTop:"12px",fontSize:"12px",color:"var(--text-muted)"},children:["安装时间: ",new Date(I.createdAt).toLocaleDateString("zh-CN")]}),I.type==="stdio"&&I.command&&o.jsxs("div",{style:{marginTop:"8px",fontSize:"12px",fontFamily:"monospace",color:"var(--text-muted)"},children:["命令: ",I.command," ",(F=I.args)==null?void 0:F.join(" ")]}),(I.type==="http"||I.type==="sse")&&I.url&&o.jsxs("div",{style:{marginTop:"8px",fontSize:"12px",color:"var(--text-muted)"},children:["URL: ",I.url]}),o.jsx("div",{style:{marginTop:"auto",paddingTop:"16px",borderTop:"1px solid var(--border-color)",display:"flex",alignItems:"center"},children:o.jsxs("div",{style:{display:"flex",gap:"24px"},children:[o.jsx(Fc,{checked:((K=I.targets)==null?void 0:K.includes("claude-code"))??!1,onChange:async B=>{const k=I.targets||[],L=B?[...k,"claude-code"]:k.filter(Q=>Q!=="claude-code");await V.updateMCP(I.id,{targets:L}),await x()},label:"Claude Code",labelPosition:"right"}),o.jsx(Fc,{checked:((M=I.targets)==null?void 0:M.includes("codex"))??!1,onChange:async B=>{const k=I.targets||[],L=B?[...k,"codex"]:k.filter(Q=>Q!=="codex");await V.updateMCP(I.id,{targets:L}),await x()},label:"Codex",labelPosition:"right"})]})})]},I.id)})}),i&&o.jsxs("div",{className:"modal-overlay",style:{zIndex:1e6},children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:w,disabled:f,"aria-label":"关闭",children:"×"}),o.jsx("div",{className:"modal",style:{maxWidth:"600px",maxHeight:"80vh",overflow:"auto"},children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:l?"编辑 MCP 工具":"添加 MCP 工具"})}),o.jsxs("form",{onSubmit:S,children:[o.jsxs("div",{className:"modal-body",style:{padding:"0 20px 10px"},children:[o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{htmlFor:"mcp-name",children:["MCP 名称 ",o.jsx("span",{className:"required",children:"*"})]}),o.jsx("input",{id:"mcp-name",type:"text",value:c.name,onChange:I=>u({...c,name:I.target.value}),placeholder:"例如:GLM 视觉理解",disabled:f})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"mcp-description",children:"描述"}),o.jsx("textarea",{id:"mcp-description",rows:2,value:c.description,onChange:I=>u({...c,description:I.target.value}),placeholder:"描述该 MCP 工具的功能",disabled:f})]}),o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{htmlFor:"mcp-type",children:["类型 ",o.jsx("span",{className:"required",children:"*"})]}),o.jsxs("select",{id:"mcp-type",value:c.type,onChange:I=>u({...c,type:I.target.value}),disabled:f,children:[o.jsx("option",{value:"stdio",children:"命令行 (stdio)"}),o.jsx("option",{value:"http",children:"HTTP"}),o.jsx("option",{value:"sse",children:"SSE"})]})]}),c.type==="stdio"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{htmlFor:"mcp-command",children:["命令 ",o.jsx("span",{className:"required",children:"*"})]}),o.jsx("input",{id:"mcp-command",type:"text",value:c.command,onChange:I=>u({...c,command:I.target.value}),placeholder:"例如:npx",disabled:f})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"mcp-args",children:"参数(空格分隔)"}),o.jsx("input",{id:"mcp-args",type:"text",value:c.args,onChange:I=>u({...c,args:I.target.value}),placeholder:"例如:-y @z_ai/mcp-server",disabled:f})]})]}),(c.type==="http"||c.type==="sse")&&o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{htmlFor:"mcp-url",children:["URL ",o.jsx("span",{className:"required",children:"*"})]}),o.jsx("input",{id:"mcp-url",type:"url",value:c.url,onChange:I=>u({...c,url:I.target.value}),placeholder:"例如:https://api.example.com/mcp",disabled:f})]}),(c.type==="http"||c.type==="sse")&&o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"mcp-headers",children:"请求头 (JSON)"}),o.jsx("textarea",{id:"mcp-headers",rows:3,value:c.headers,onChange:I=>u({...c,headers:I.target.value}),placeholder:'{\\n "Authorization": "Bearer your-token"\\n}',disabled:f,style:{fontFamily:"monospace",fontSize:"13px"}})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"mcp-env",children:"环境变量 (JSON)"}),o.jsx("textarea",{id:"mcp-env",rows:3,value:c.env,onChange:I=>u({...c,env:I.target.value}),placeholder:'{\\n "API_KEY": "your-key"\\n}',disabled:f,style:{fontFamily:"monospace",fontSize:"13px"}})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{children:"启用目标"}),o.jsxs("div",{style:{display:"flex",gap:"16px"},children:[o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",checked:c.targets.includes("claude-code"),onChange:I=>u({...c,targets:I.target.checked?[...c.targets,"claude-code"]:c.targets.filter(F=>F!=="claude-code")}),style:{width:"16px",height:"16px",cursor:"pointer"},disabled:f}),o.jsx("span",{children:"Claude Code"})]}),o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",checked:c.targets.includes("codex"),onChange:I=>u({...c,targets:I.target.checked?[...c.targets,"codex"]:c.targets.filter(F=>F!=="codex")}),style:{width:"16px",height:"16px",cursor:"pointer"},disabled:f}),o.jsx("span",{children:"Codex"})]})]})]})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-secondary",type:"button",onClick:w,disabled:f,children:"取消"}),o.jsx("button",{className:"btn btn-primary",type:"submit",disabled:f,children:f?"保存中...":l?"保存":"添加"})]})]})]})})]}),p.mcpId&&o.jsxs("div",{className:"modal-overlay",style:{zIndex:1000001},children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:j,disabled:p.isDeleting,"aria-label":"关闭",children:"×"}),o.jsx("div",{className:"modal",style:{maxWidth:"400px"},children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:"确认删除"})}),o.jsx("div",{className:"modal-body",style:{padding:"0 20px 10px"},children:o.jsxs("p",{style:{color:"var(--text-muted)"},children:['确定要删除 MCP 工具 "',o.jsx("strong",{children:p.mcpName}),'" 吗?此操作无法撤销。']})}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-secondary",onClick:j,disabled:p.isDeleting,children:"取消"}),o.jsx("button",{className:"btn btn-danger",onClick:E,disabled:p.isDeleting,children:p.isDeleting?"删除中...":"删除"})]})]})})]}),g.isOpen&&o.jsxs("div",{className:"modal-overlay",style:{zIndex:1000002},children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:R,disabled:g.installingMCPName!==null,"aria-label":"关闭",children:"×"}),o.jsx("div",{className:"modal",style:{maxWidth:"700px"},children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:"一键安装 MCP 工具"})}),o.jsxs("div",{className:"modal-body",style:{padding:"0 20px 10px"},children:[g.step==="select"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{style:{fontSize:"14px",color:"var(--text-muted)",marginBottom:"20px"},children:"点击下方的卡片,快速安装 MCP 工具到您的系统中:"}),o.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(280px, 1fr))",gap:"16px"},children:zie.map(I=>{const F=e.some(K=>K.name===I.name);return o.jsxs("div",{className:"card",style:{padding:"16px",cursor:F?"not-allowed":"pointer",transition:"all 0.2s ease",opacity:F?.7:1},onClick:()=>!F&&A(I),children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"8px"},children:[o.jsx("div",{style:{fontWeight:"600",fontSize:"16px"},children:I.name}),o.jsxs("div",{style:{display:"flex",gap:"8px"},children:[F&&o.jsx("div",{className:"badge badge-success",style:{fontSize:"12px"},children:"已安装"}),o.jsx("div",{className:"badge badge-secondary",style:{fontSize:"12px"},children:_(I.type)})]})]}),o.jsx("div",{style:{fontSize:"13px",color:"var(--text-muted)",marginBottom:"12px"},children:I.description}),o.jsx("button",{className:"btn btn-primary",style:{width:"100%"},disabled:F,children:F?"已安装":"安装"})]},I.id)})})]}),g.step==="input-api-key"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{textAlign:"center",marginBottom:"16px"},children:[o.jsx("h3",{style:{fontSize:"18px",marginBottom:"8px"},children:(q=g.selectedDefinition)==null?void 0:q.name}),o.jsx("p",{style:{fontSize:"14px",color:"var(--text-muted)"},children:(W=g.selectedDefinition)==null?void 0:W.description})]}),o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{htmlFor:"quick-install-api-key",children:["API Key ",o.jsx("span",{className:"required",children:"*"})]}),o.jsx("input",{id:"quick-install-api-key",type:"password",value:g.apiKey,onChange:I=>y({...g,apiKey:I.target.value}),placeholder:"请输入您的 API Key",disabled:g.installingMCPName!==null,autoFocus:!0}),o.jsx("p",{style:{fontSize:"12px",color:"var(--text-muted)",marginTop:"4px"},children:"API Key 将用于此 MCP 工具的认证。您可以访问相应的开放平台获取。"})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-secondary",onClick:()=>y(I=>({...I,step:"select",selectedDefinition:null})),disabled:g.installingMCPName!==null,children:"返回"}),o.jsx("button",{className:"btn btn-primary",onClick:N,disabled:g.installingMCPName!==null||!g.apiKey.trim(),children:g.installingMCPName?"安装中...":"开始安装"})]})]}),g.step==="installing"&&o.jsxs("div",{style:{padding:"20px 0",textAlign:"center"},children:[o.jsx("div",{className:"spinner",style:{width:"32px",height:"32px",margin:"0 auto 16px"}}),o.jsx("p",{style:{color:"var(--text-muted)"},children:g.message}),o.jsxs("p",{style:{fontSize:"14px",marginTop:"8px",color:"var(--text-muted)"},children:["正在安装 ",o.jsx("strong",{children:g.installingMCPName}),"..."]})]}),g.step==="completed"&&o.jsxs("div",{style:{padding:"20px 0",textAlign:"center"},children:[o.jsx("div",{style:{fontSize:"48px",marginBottom:"16px"},children:"✅"}),o.jsx("p",{style:{fontSize:"16px",marginBottom:"8px"},children:g.message}),o.jsx("p",{style:{fontSize:"14px",color:"var(--text-muted)"},children:"MCP 工具已启用到 Claude Code 和 Codex,您可以在列表中查看详情。"})]}),g.step==="error"&&o.jsxs("div",{style:{padding:"20px 0",textAlign:"center"},children:[o.jsx("div",{style:{fontSize:"48px",marginBottom:"16px"},children:"❌"}),o.jsx("p",{style:{fontSize:"16px",marginBottom:"8px"},children:g.message})]})]}),o.jsx("div",{className:"modal-footer",style:{justifyContent:(g.step==="select"||g.step==="input-api-key","center")},children:(g.step==="completed"||g.step==="error")&&o.jsx("button",{className:"btn btn-primary",onClick:R,children:"关闭"})})]})})]})]})}function TM({keyName:e,apiKey:t,guide:n,onClose:r}){const i=a=>{navigator.clipboard.writeText(a).then(()=>U.success("已复制"))};return o.jsxs("div",{className:"modal-overlay",onClick:r,children:[o.jsxs("div",{className:"modal",style:{minWidth:"auto",width:"700px",padding:"28px"},onClick:a=>a.stopPropagation(),children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:r,style:{top:"12px",right:"12px",width:"36px",height:"36px",fontSize:"24px"},"aria-label":"关闭",children:"×"}),o.jsx("h3",{style:{margin:"0 0 4px",fontSize:"20px"},children:"📋 接入指引"}),o.jsxs("p",{style:{margin:"0 0 22px",color:"var(--text-tertiary)",fontSize:"13px"},children:["密钥「",e,"」的接入配置"]}),n?(()=>{const a=Object.values(n).flatMap(s=>Object.keys(s.envVars||{})),l=Math.max(...a.map(s=>s.length),0);return o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"16px",marginBottom:"20px"},children:Object.entries(n).map(([s,c])=>{const u=Object.entries(c.envVars);return o.jsxs("div",{className:"ak-guide-section",children:[o.jsx("div",{className:"ak-guide-section-header",children:c.description}),o.jsx("div",{style:{padding:"14px 16px"},children:u.map(([f,d])=>o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0",marginBottom:"8px",fontSize:"13px"},children:[o.jsx("span",{className:"ak-guide-env-name",style:{minWidth:`${l*8.5}px`},children:f}),o.jsx("span",{style:{color:"var(--text-secondary)",margin:"0 8px"},children:"="}),o.jsx("code",{className:"ak-guide-env-value",children:d}),o.jsx("button",{className:"btn btn-sm ak-action-btn",onClick:()=>i(d),style:{flexShrink:0,padding:"4px 8px",marginLeft:"8px"},children:"复制"})]},f))})]},s)})})})():o.jsxs("div",{style:{marginBottom:"20px",textAlign:"center",padding:"30px 0"},children:[o.jsx("div",{style:{fontSize:"36px",marginBottom:"8px"},children:"🔑"}),o.jsx("div",{style:{fontWeight:600,fontSize:"15px",marginBottom:"12px"},children:"API Key"}),o.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:o.jsx("code",{style:{padding:"12px 16px",borderRadius:"8px",background:"var(--bg-primary-solid)",fontSize:"14px",fontFamily:'"SF Mono", "Fira Code", monospace',border:"2px dashed var(--color-primary)"},children:t})}),o.jsx("span",{style:{fontSize:"11px",color:"var(--text-tertiary)",display:"block",marginTop:"8px"},children:"完整 Key 仅在创建时展示,此处仅显示掩码"})]}),o.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:o.jsx("button",{onClick:r,className:"ak-modal-btn-secondary",children:"关闭"})})]}),o.jsx("style",{children:`
480
+ .ak-guide-section {
481
+ border-radius: 10px;
482
+ border: 1px solid var(--border-primary);
483
+ overflow: hidden;
484
+ background: var(--bg-primary-solid);
485
+ }
486
+ .ak-guide-section-header {
487
+ padding: 10px 16px;
488
+ border-bottom: 1px solid var(--border-primary);
489
+ background: var(--bg-secondary);
490
+ fontWeight: 600;
491
+ font-size: 14px;
492
+ }
493
+ .ak-guide-env-name {
494
+ color: var(--color-accent, #8b5cf6);
495
+ fontWeight: 600;
496
+ fontFamily: "SF Mono", "Fira Code", monospace;
497
+ flexShrink: 0;
498
+ }
499
+ .ak-guide-env-value {
500
+ flex: 1;
501
+ padding: 6px 10px;
502
+ border-radius: 5px;
503
+ background: var(--bg-secondary);
504
+ wordBreak: break-all;
505
+ fontSize: 12px;
506
+ fontFamily: "SF Mono", "Fira Code", monospace;
507
+ }
508
+ [data-theme="dark"] .ak-guide-section {
509
+ background: #0C1F12;
510
+ border-color: rgba(167, 243, 208, 0.15);
511
+ }
512
+ [data-theme="dark"] .ak-guide-section-header {
513
+ background: rgba(30, 58, 40, 0.95);
514
+ border-color: rgba(167, 243, 208, 0.15);
515
+ }
516
+ [data-theme="dark"] .ak-guide-env-value {
517
+ background: rgba(30, 58, 40, 0.95);
518
+ }
519
+ `})]})}function Bie(){const[e,t]=h.useState([]),[n,r]=h.useState([]),[i,a]=h.useState([]),[l,s]=h.useState([]),[c,u]=h.useState([]),[f,d]=h.useState(0),[p,m]=h.useState(1),g=20,[y,x]=h.useState(!0),[v,b]=h.useState(""),[w,S]=h.useState(""),[C,j]=h.useState(new Set),[E,O]=h.useState(!1),[R,A]=h.useState(null),[N,_]=h.useState(""),[q,W]=h.useState(""),[I,F]=h.useState(""),[K,M]=h.useState(!1),[B,k]=h.useState(()=>localStorage.getItem("policies-panel-open")==="true"),[L,Q]=h.useState(null),[T,ce]=h.useState(!1),[ve,X]=h.useState(""),[oe,fe]=h.useState(""),[te,Z]=h.useState("system"),[se,re]=h.useState(""),[Oe,ne]=h.useState(""),[_e,Re]=h.useState(""),[Fe,rt]=h.useState(""),[Be,qe]=h.useState(""),[ye,Ee]=h.useState([]),[ze,ht]=h.useState([]),[ee,Y]=h.useState("none"),[le,D]=h.useState(""),[de,me]=h.useState([]),[Te,Pe]=h.useState(!1),De=h.useRef(null),{confirm:Le}=du(),Ve=h.useRef(null);h.useEffect(()=>{if(!K)return;const $=z=>{Ve.current&&!Ve.current.contains(z.target)&&M(!1)};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[K]);const We=async()=>{x(!0);try{const $=await V.getAccessKeys({page:p,pageSize:g,status:v||void 0,search:w||void 0});t($.data),d($.total)}catch($){U.error("加载密钥列表失败: "+$.message)}finally{x(!1)}},Qe=async()=>{try{const[$,z,be]=await Promise.all([V.getPolicies().catch(()=>[]),V.getRoutes().catch(()=>[]),V.getPolicyTemplates().catch(()=>[])]);r($),a(z),s(be)}catch{}};h.useEffect(()=>{We()},[p,v,w]),h.useEffect(()=>{Qe()},[]),h.useEffect(()=>{V.getWriteLocalRecords().then(u).catch(()=>{})},[e]);const ut=async()=>{if(!N.trim()){U.error("请输入密钥名称");return}try{const $=await V.createAccessKey({name:N.trim(),remark:q||void 0,policyId:I||void 0});O(!1),A($),_(""),W(""),F(""),We()}catch($){U.error("创建失败: "+$.message)}},fn=async $=>{try{await V.updateAccessKey($.id,{status:$.status==="active"?"disabled":"active"}),U.success($.status==="active"?"已停用":"已启用"),We()}catch(z){U.error("操作失败: "+z.message)}},G=async $=>{if(await Le({message:`确定删除密钥「${$.name}」吗?`}))try{await V.deleteAccessKey($.id),U.success("已删除"),We()}catch(be){U.error("删除失败: "+be.message)}},ge=async $=>{if(await Le({message:"重新生成后旧密钥将立即失效,确定继续吗?"}))try{const be=await V.regenerateAccessKey($.id);A({key:{...$,apiKey:be.apiKey},apiKey:be.apiKey}),We()}catch(be){U.error("重新生成失败: "+be.message)}},[je,Ae]=h.useState(null),Ue=async $=>{try{const z=await V.getAccessKeyGuide($.id);Ae({key:$,guide:z})}catch(z){U.error("获取指引失败: "+z.message)}},Nt=async $=>{if(C.size!==0)try{await V.batchUpdateAccessKeyStatus(Array.from(C),$),U.success(`已批量${$==="active"?"启用":"停用"} ${C.size} 个密钥`),j(new Set),M(!1),We()}catch(z){U.error("批量操作失败: "+z.message)}},_t=async()=>{if(!(C.size===0||!await Le({message:`确定删除选中的 ${C.size} 个密钥吗?`})))try{await V.batchDeleteAccessKeys(Array.from(C)),U.success(`已删除 ${C.size} 个密钥`),j(new Set),M(!1),We()}catch(z){U.error("批量删除失败: "+z.message)}},nn=async $=>{if(!(C.size===0||!$))try{await V.batchBindAccessKeyPolicy(Array.from(C),$),U.success("已批量绑定策略"),j(new Set),M(!1),We()}catch(z){U.error("批量绑定失败: "+z.message)}},Xt=$=>{const z=new Set(C);z.has($)?z.delete($):z.add($),j(z)},Oi=()=>j(C.size===e.length?new Set:new Set(e.map($=>$.id))),Ln=$=>navigator.clipboard.writeText($).then(()=>U.success("已复制")),dt=()=>{X(""),fe(""),Z(""),re(""),ne(""),Re(""),rt(""),qe(""),Ee([]),ht([]),Y("none"),D("")},Yn=$=>{var z,be,Ye,Ie,mt,Vt,Lr;$?(Q($),X($.name),fe($.description||""),Z($.routeId||"system"),re(((z=$.dailyTokenLimit)==null?void 0:z.toString())||""),ne(((be=$.monthlyTokenLimit)==null?void 0:be.toString())||""),Re(((Ye=$.dailyRequestLimit)==null?void 0:Ye.toString())||""),rt(((Ie=$.rpmLimit)==null?void 0:Ie.toString())||""),qe(((mt=$.concurrentLimit)==null?void 0:mt.toString())||""),Ee($.allowedModels||[]),ht($.blockedModels||[]),Y((Vt=$.allowedModels)!=null&&Vt.length?"allow":(Lr=$.blockedModels)!=null&&Lr.length?"block":"none")):(Q(null),dt()),ce(!0),ei()},ei=async()=>{try{const $=await V.getVendors(),z=new Map;($||[]).forEach(be=>{const Ye=be.name||"";(be.services||[]).forEach(Ie=>{(Ie.supportedModels||[]).forEach(mt=>{z.has(mt)||z.set(mt,new Set),z.get(mt).add(Ye)})})}),me(Array.from(z.entries()).map(([be,Ye])=>({name:be,vendors:Array.from(Ye)})).sort((be,Ye)=>be.name.localeCompare(Ye.name)))}catch{}},Qt=ee==="allow"?ye:ze,St=le.trim()?de.filter($=>$.name.toLowerCase().includes(le.toLowerCase())&&!Qt.includes($.name)):de.filter($=>!Qt.includes($.name)),Ya=$=>{var be,Ye,Ie,mt,Vt;const z=$.config;X(z.name||""),fe($.description),re(((be=z.dailyTokenLimit)==null?void 0:be.toString())||""),ne(((Ye=z.monthlyTokenLimit)==null?void 0:Ye.toString())||""),Re(((Ie=z.dailyRequestLimit)==null?void 0:Ie.toString())||""),rt(((mt=z.rpmLimit)==null?void 0:mt.toString())||""),qe(((Vt=z.concurrentLimit)==null?void 0:Vt.toString())||""),U.success(`已应用模板: ${$.name}`)},Ga=async()=>{if(!ve.trim()){U.error("请输入策略名称");return}const $={name:ve.trim(),description:oe||void 0,routeId:te==="system"?"system":te||void 0,dailyTokenLimit:se?Number(se):void 0,monthlyTokenLimit:Oe?Number(Oe):void 0,dailyRequestLimit:_e?Number(_e):void 0,rpmLimit:Fe?Number(Fe):void 0,concurrentLimit:Be?Number(Be):void 0,allowedModels:ee==="allow"?ye:void 0,blockedModels:ee==="block"?ze:void 0};try{L?(await V.updatePolicy(L.id,$),U.success("策略已更新")):(await V.createPolicy($),U.success("策略已创建")),ce(!1),Qe(),We()}catch(z){U.error("保存失败: "+z.message)}},Qo=async $=>{if($.keyCount&&$.keyCount>0){U.error(`有 ${$.keyCount} 个密钥正在使用此策略,请先解除绑定`);return}if(await Le({message:`确定删除策略「${$.name}」吗?`}))try{await V.deletePolicy($.id),U.success("已删除"),Qe(),We()}catch(be){U.error("删除失败: "+be.message)}},Jo=async $=>{try{await V.duplicatePolicy($.id),U.success("已复制"),Qe()}catch(z){U.error("复制失败: "+z.message)}},ia=($,z)=>{const be=le.trim();be&&!$.includes(be)&&(z([...$,be]),D(""))},Zo=$=>{var z;return(z=i.find(be=>be.id===$))==null?void 0:z.name},Xa=$=>{const z=[];return $.dailyTokenLimit&&z.push(`日${$.dailyTokenLimit}k`),$.monthlyTokenLimit&&z.push(`月${$.monthlyTokenLimit}k`),$.dailyRequestLimit&&z.push(`日${$.dailyRequestLimit}次`),$.rpmLimit&&z.push(`RPM ${$.rpmLimit}`),$.concurrentLimit&&z.push(`并发${$.concurrentLimit}`),z.length>0?z.join(", "):"无限制"},aa=Math.ceil(f/g),Ht={padding:"6px 10px",borderRadius:"4px",border:"1px solid var(--border-primary)",background:"var(--bg-secondary)",color:"var(--text-primary)",boxSizing:"border-box",fontSize:"13px"};return o.jsxs("div",{className:"page-container",children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"24px"},children:[o.jsx("h2",{style:{margin:0},children:"API Key"}),o.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[o.jsx("button",{className:"btn btn-primary",onClick:()=>{O(!0),Qe()},style:{height:"45px"},children:"+ 创建密钥"}),o.jsxs("button",{className:`btn ${B?"btn-primary":"btn-secondary"}`,onClick:()=>{const $=!B;k($),localStorage.setItem("policies-panel-open",String($)),$&&Qe()},style:{height:"45px",display:"inline-flex",alignItems:"center",gap:"8px"},children:[o.jsx("span",{children:"📜 策略管理"}),n.length>0&&o.jsxs("span",{children:["(",n.length,")"]}),o.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"18px",height:"18px",borderRadius:"50%",border:"2px solid #fff",background:B?"var(--color-success, #22c55e)":"transparent",flexShrink:0,transition:"all 0.25s"},children:B&&o.jsx("span",{style:{color:"#fff",fontSize:"12px",lineHeight:1},children:"✓"})})]})]})]}),o.jsxs("div",{style:{display:"flex",gap:"0",minHeight:0},children:[o.jsx("div",{style:{flex:1,minWidth:0,transition:"margin-right 0.35s ease",marginRight:B?"24px":"0"},children:o.jsxs("div",{className:"card",style:{marginBottom:"0"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[o.jsxs("div",{style:{display:"flex",gap:"10px"},children:[o.jsxs("select",{value:v,onChange:$=>{b($.target.value),m(1)},style:Ht,children:[o.jsx("option",{value:"",children:"全部状态"}),o.jsx("option",{value:"active",children:"启用"}),o.jsx("option",{value:"disabled",children:"停用"})]}),o.jsx("input",{type:"text",placeholder:"搜索名称或备注...",value:w,onChange:$=>{S($.target.value),m(1)},style:{...Ht,minWidth:"200px"}})]}),C.size>0&&o.jsxs("div",{ref:Ve,style:{position:"relative",flexShrink:0},children:[o.jsxs("button",{className:"ak-action-btn",onClick:()=>M(!K),children:["批量操作 (",C.size,") ▾"]}),K&&o.jsxs("div",{className:"ak-dropdown-menu",children:[o.jsx("button",{className:"dropdown-btn",onClick:()=>Nt("active"),children:"批量启用"}),o.jsx("button",{className:"dropdown-btn",onClick:()=>Nt("disabled"),children:"批量停用"}),o.jsx("hr",{style:{margin:"2px 0",border:"none",borderTop:"1px solid var(--border-primary)"}}),o.jsxs("select",{style:{width:"100%",border:"none",background:"none",padding:"6px 10px",cursor:"pointer",color:"var(--text-primary)"},onChange:$=>{$.target.value&&nn($.target.value)},children:[o.jsx("option",{value:"",children:"批量绑定策略..."}),n.map($=>o.jsx("option",{value:$.id,children:$.name},$.id))]}),o.jsx("hr",{style:{margin:"2px 0",border:"none",borderTop:"1px solid var(--border-primary)"}}),o.jsx("button",{className:"dropdown-btn",style:{color:"var(--color-danger)"},onClick:_t,children:"批量删除"})]})]})]}),y?o.jsx("div",{style:{textAlign:"center",padding:"40px"},children:"加载中..."}):o.jsx("div",{style:{overflowX:"auto"},children:o.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[o.jsx("thead",{children:o.jsxs("tr",{style:{borderBottom:"2px solid var(--border-primary)"},children:[o.jsx("th",{style:{padding:"10px 12px",textAlign:"left",width:32},children:o.jsx("input",{type:"checkbox",checked:C.size===e.length&&e.length>0,onChange:Oi})}),o.jsx("th",{style:{padding:"10px 12px",textAlign:"left"},children:"名称"}),o.jsx("th",{style:{padding:"10px 12px",textAlign:"left"},children:"API Key"}),o.jsx("th",{style:{padding:"10px 12px",textAlign:"left"},children:"策略"}),o.jsx("th",{style:{padding:"10px 12px",textAlign:"center",width:60},children:"状态"}),o.jsx("th",{style:{padding:"10px 12px",textAlign:"left",minWidth:90},children:"创建时间"}),o.jsx("th",{style:{padding:"10px 12px",textAlign:"left",minWidth:90},children:"最后活跃"}),o.jsx("th",{style:{padding:"10px 12px",textAlign:"center",width:120},children:"操作"})]})}),o.jsx("tbody",{children:e.length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:8,style:{padding:"40px",textAlign:"center",color:"var(--text-tertiary)"},children:f===0?"暂无密钥,点击「创建密钥」开始":"无匹配结果"})}):e.map($=>o.jsxs("tr",{style:{borderBottom:"1px solid var(--border-primary)"},children:[o.jsx("td",{style:{padding:"10px 12px"},children:o.jsx("input",{type:"checkbox",checked:C.has($.id),onChange:()=>Xt($.id)})}),o.jsxs("td",{style:{padding:"10px 12px"},children:[o.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"6px",flexWrap:"wrap"},children:[o.jsx("a",{href:`#/access-keys/${$.id}`,style:{color:"var(--color-primary)",textDecoration:"none",fontWeight:500},children:$.name}),(()=>{const z=c.find(be=>be.accessKeyId===$.id);return z?z.targets.map(be=>o.jsx("span",{style:{display:"inline-block",padding:"1px 6px",borderRadius:"8px",fontSize:"11px",lineHeight:"16px",background:be==="claude-code"?"#cc7832":"#000",color:"#fff"},children:be==="claude-code"?"Claude Code":"Codex"},be)):null})()]}),$.remark&&o.jsx("div",{style:{fontSize:"12px",color:"var(--text-tertiary)",marginTop:"2px"},children:$.remark})]}),o.jsx("td",{style:{padding:"10px 12px"},children:o.jsx("code",{style:{fontSize:"12px",background:"var(--bg-secondary)",padding:"2px 6px",borderRadius:"3px"},children:$.apiKey})}),o.jsx("td",{style:{padding:"10px 12px",fontSize:"13px"},children:$.policyName||o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"未配置"})}),o.jsx("td",{style:{padding:"10px 12px",textAlign:"center"},children:o.jsx("span",{style:{display:"inline-block",width:"8px",height:"8px",borderRadius:"50%",background:$.status==="active"?"#22c55e":"var(--text-tertiary)"},title:$.status==="active"?"启用":"停用"})}),o.jsx("td",{style:{padding:"10px 12px",fontSize:"13px",color:"var(--text-secondary)"},children:new Date($.createdAt).toLocaleDateString()}),o.jsx("td",{style:{padding:"10px 12px",fontSize:"13px",color:"var(--text-secondary)"},children:$.lastActiveAt?new Date($.lastActiveAt).toLocaleDateString():"-"}),o.jsx("td",{style:{padding:"10px 12px",textAlign:"center"},children:o.jsxs("div",{style:{display:"flex",gap:"4px",justifyContent:"center"},children:[o.jsx("button",{className:"btn btn-sm ak-action-btn",onClick:()=>Ue($),title:"接入指引",children:"📋"}),o.jsx("button",{className:"btn btn-sm ak-action-btn",onClick:()=>fn($),title:$.status==="active"?"停用":"启用",children:$.status==="active"?"⏸":"▶"}),o.jsx("button",{className:"btn btn-sm ak-action-btn",onClick:()=>ge($),title:"重新生成",children:"🔄"}),o.jsx("button",{className:"btn btn-sm ak-action-btn ak-action-btn--danger",onClick:()=>G($),title:"删除",children:"✕"})]})})]},$.id))})]})}),aa>1&&o.jsxs("div",{style:{display:"flex",justifyContent:"center",gap:"8px",marginTop:"16px"},children:[o.jsx("button",{className:"btn btn-sm",disabled:p<=1,onClick:()=>m(p-1),children:"‹"}),o.jsxs("span",{style:{color:"var(--text-secondary)",fontSize:"14px"},children:[p,"/",aa," · 共 ",f," 个"]}),o.jsx("button",{className:"btn btn-sm",disabled:p>=aa,onClick:()=>m(p+1),children:"›"})]})]})}),o.jsx("div",{style:{width:B?"480px":"0",overflow:"hidden",transition:"width 0.35s ease, opacity 0.35s ease",opacity:B?1:0,flexShrink:0},children:o.jsx("div",{style:{width:"480px",height:"100%"},children:o.jsxs("div",{className:"card",style:{height:"100%",marginBottom:"0",display:"flex",flexDirection:"column"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",paddingBottom:"16px",marginBottom:"16px",borderBottom:"1px solid var(--border-primary)",flexShrink:0},children:[o.jsx("h4",{style:{margin:0,fontSize:"16px"},children:"📜 策略管理"}),o.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>Yn(),children:"+ 创建策略"})]}),o.jsx("div",{style:{overflowY:"auto",flex:1},children:n.length===0?o.jsxs("div",{style:{textAlign:"center",padding:"40px 0",color:"var(--text-tertiary)",fontSize:"14px"},children:["暂无策略",o.jsx("br",{}),"点击「创建策略」开始配置"]}):o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:n.map($=>o.jsxs("div",{style:{padding:"16px",borderRadius:"12px",border:"1px solid var(--border-primary)",background:"var(--bg-secondary)"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"8px"},children:[o.jsxs("div",{children:[o.jsxs("div",{style:{fontWeight:600,fontSize:"14px",marginBottom:"2px"},children:["📋 ",$.name]}),$.description&&o.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:"12px"},children:$.description})]}),o.jsxs("div",{style:{display:"flex",gap:"4px"},children:[o.jsx("button",{className:"btn btn-sm ak-action-btn",onClick:()=>Yn($),children:"编辑"}),o.jsx("button",{className:"btn btn-sm ak-action-btn",onClick:()=>Jo($),children:"复制"}),o.jsx("button",{className:"btn btn-sm ak-action-btn ak-action-btn--danger",onClick:()=>Qo($),children:"删除"})]})]}),o.jsxs("div",{style:{display:"flex",gap:"16px",fontSize:"12px",color:"var(--text-secondary)"},children:[o.jsxs("span",{children:["🔗 路由: ",$.routeId&&$.routeId!=="system"?Zo($.routeId)||o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"未绑定"}):o.jsx("span",{style:{color:"var(--accent-color, #4a90d9)"},children:"按系统默认"})]}),o.jsxs("span",{children:["🔑 Key: ",$.keyCount||0]}),o.jsxs("span",{children:["📊 配额: ",Xa($)]})]})]},$.id))})})]})})})]}),E&&o.jsx("div",{className:"modal-overlay",onClick:()=>O(!1),children:o.jsxs("div",{className:"modal",style:{minWidth:"auto",width:"480px",padding:"28px"},onClick:$=>$.stopPropagation(),children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:()=>O(!1),style:{top:"12px",right:"12px",width:"36px",height:"36px",fontSize:"24px"},"aria-label":"关闭",children:"×"}),o.jsx("h3",{style:{margin:"0 0 6px",fontSize:"20px"},children:"创建接入密钥"}),o.jsx("p",{style:{margin:"0 0 20px",color:"var(--text-tertiary)",fontSize:"13px"},children:"生成一个以 sk_ 开头的 API Key,分发给团队成员使用"}),o.jsxs("div",{style:{marginBottom:"14px"},children:[o.jsxs("label",{style:{display:"block",marginBottom:"6px",fontWeight:600,fontSize:"14px"},children:["名称 ",o.jsx("span",{style:{color:"var(--color-danger)"},children:"*"})]}),o.jsx("input",{type:"text",value:N,onChange:$=>_($.target.value),placeholder:"例如:张三 - 前端组",autoFocus:!0,style:{...Ht,width:"100%",padding:"10px 14px",fontSize:"14px",borderRadius:"8px"}})]}),o.jsxs("div",{style:{marginBottom:"14px"},children:[o.jsxs("label",{style:{display:"block",marginBottom:"6px",fontWeight:600,fontSize:"14px"},children:["备注 ",o.jsx("span",{style:{color:"var(--text-tertiary)",fontWeight:400,fontSize:"12px"},children:"(可选)"})]}),o.jsx("textarea",{value:q,onChange:$=>W($.target.value),placeholder:"补充说明信息",style:{...Ht,width:"100%",padding:"10px 14px",minHeight:"52px",fontSize:"14px",borderRadius:"8px",resize:"vertical"}})]}),o.jsxs("div",{style:{marginBottom:"24px"},children:[o.jsxs("label",{style:{display:"block",marginBottom:"6px",fontWeight:600,fontSize:"14px"},children:["策略 ",o.jsx("span",{style:{color:"var(--text-tertiary)",fontWeight:400,fontSize:"12px"},children:"(可选)"})]}),o.jsxs("select",{value:I,onChange:$=>F($.target.value),style:{...Ht,width:"100%",padding:"10px 14px",fontSize:"14px",borderRadius:"8px",cursor:"pointer"},children:[o.jsx("option",{value:"",children:"稍后配置"}),n.map($=>o.jsx("option",{value:$.id,children:$.name},$.id))]})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px"},children:[o.jsx("button",{onClick:()=>O(!1),className:"ak-modal-btn-secondary",children:"取消"}),o.jsx("button",{onClick:ut,className:"ak-modal-btn-primary",children:"创建密钥"})]})]})}),R&&o.jsx("div",{className:"modal-overlay",onClick:()=>A(null),children:o.jsxs("div",{className:"modal",style:{minWidth:"auto",width:"600px",padding:"28px"},onClick:$=>$.stopPropagation(),children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:()=>A(null),style:{top:"12px",right:"12px",width:"36px",height:"36px",fontSize:"24px"},"aria-label":"关闭",children:"×"}),o.jsxs("div",{style:{textAlign:"center",marginBottom:"20px"},children:[o.jsx("div",{style:{fontSize:"40px",marginBottom:"8px"},children:"🔑"}),o.jsx("h3",{style:{margin:"0",fontSize:"20px",color:"#22c55e"},children:"密钥创建成功"})]}),o.jsxs("div",{style:{background:"var(--bg-primary)",borderRadius:"10px",padding:"16px",border:"2px dashed #22c55e",marginBottom:"20px"},children:[o.jsx("div",{style:{fontSize:"11px",color:"var(--text-tertiary)",marginBottom:"8px",textTransform:"uppercase",letterSpacing:"1px"},children:"API Key"}),o.jsx("code",{style:{display:"block",fontSize:"16px",wordBreak:"break-all",lineHeight:1.6,fontFamily:'"SF Mono", "Fira Code", monospace',color:"var(--text-primary)"},children:R.apiKey})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"center",gap:"10px"},children:[o.jsx("button",{onClick:()=>Ln(R.apiKey),className:"ak-modal-btn-primary",children:"📋 复制 Key"}),o.jsx("button",{onClick:()=>A(null),className:"ak-modal-btn-secondary",children:"完成"})]})]})}),T&&o.jsx("div",{className:"modal-overlay",onClick:()=>ce(!1),children:o.jsxs("div",{className:"modal",style:{minWidth:"auto",width:"600px",padding:"28px"},onClick:$=>$.stopPropagation(),children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:()=>ce(!1),style:{top:"12px",right:"12px",width:"36px",height:"36px",fontSize:"24px"},"aria-label":"关闭",children:"×"}),o.jsx("h3",{style:{margin:"0 0 4px",fontSize:"20px"},children:L?"编辑策略":"创建策略"}),o.jsx("p",{style:{margin:"0 0 22px",color:"var(--text-tertiary)",fontSize:"13px"},children:"配置路由、配额限制和模型过滤规则,多个密钥可复用同一策略"}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"14px",marginBottom:"18px"},children:[o.jsxs("div",{children:[o.jsxs("label",{style:{display:"block",marginBottom:"6px",fontWeight:600,fontSize:"14px"},children:["名称 ",o.jsx("span",{style:{color:"var(--color-danger)"},children:"*"})]}),o.jsx("input",{type:"text",value:ve,onChange:$=>X($.target.value),placeholder:"例如:中度限制策略",style:{...Ht,width:"100%",padding:"10px 14px",fontSize:"14px",borderRadius:"8px"}})]}),o.jsxs("div",{children:[o.jsxs("label",{style:{display:"block",marginBottom:"6px",fontWeight:600,fontSize:"14px"},children:["描述 ",o.jsx("span",{style:{color:"var(--text-tertiary)",fontWeight:400,fontSize:"12px"},children:"(可选)"})]}),o.jsx("input",{type:"text",value:oe,onChange:$=>fe($.target.value),placeholder:"适合普通开发者使用",style:{...Ht,width:"100%",padding:"10px 14px",fontSize:"14px",borderRadius:"8px"}})]})]}),o.jsxs("div",{style:{marginBottom:"18px"},children:[o.jsx("label",{style:{display:"block",marginBottom:"6px",fontWeight:600,fontSize:"14px"},children:"路由绑定"}),o.jsxs("select",{value:te,onChange:$=>Z($.target.value),style:{...Ht,width:"100%",padding:"10px 14px",fontSize:"14px",borderRadius:"8px",cursor:"pointer"},children:[o.jsx("option",{value:"system",children:"按系统默认"}),i.map($=>o.jsx("option",{value:$.id,children:$.name},$.id))]})]}),o.jsxs("div",{style:{marginBottom:"18px"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[o.jsx("label",{style:{fontWeight:600,fontSize:"14px"},children:"配额限制"}),!L&&l.length>0&&o.jsxs("select",{style:{fontSize:"13px",padding:"6px 12px",borderRadius:"6px",border:"1px solid var(--border-primary)",background:"var(--bg-secondary)",cursor:"pointer",color:"var(--text-secondary)"},onChange:$=>{$.target.value&&(Ya(l[Number($.target.value)]),$.target.value="")},children:[o.jsx("option",{value:"",children:"📋 使用模板..."}),l.map(($,z)=>o.jsxs("option",{value:String(z),children:[$.name," — ",$.description]},z))]})]}),o.jsx("div",{style:{background:"var(--bg-primary)",borderRadius:"10px",padding:"16px",border:"1px solid var(--border-primary)"},children:o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"12px"},children:[o.jsxs("div",{children:[o.jsx("label",{style:{display:"block",fontSize:"12px",color:"var(--text-tertiary)",marginBottom:"4px"},children:"日 Token (k)"}),o.jsx("input",{type:"number",value:se,onChange:$=>re($.target.value),placeholder:"不限",style:{...Ht,width:"100%",padding:"9px 10px",borderRadius:"6px"}})]}),o.jsxs("div",{children:[o.jsx("label",{style:{display:"block",fontSize:"12px",color:"var(--text-tertiary)",marginBottom:"4px"},children:"月 Token (k)"}),o.jsx("input",{type:"number",value:Oe,onChange:$=>ne($.target.value),placeholder:"不限",style:{...Ht,width:"100%",padding:"9px 10px",borderRadius:"6px"}})]}),o.jsxs("div",{children:[o.jsx("label",{style:{display:"block",fontSize:"12px",color:"var(--text-tertiary)",marginBottom:"4px"},children:"日请求 (次)"}),o.jsx("input",{type:"number",value:_e,onChange:$=>Re($.target.value),placeholder:"不限",style:{...Ht,width:"100%",padding:"9px 10px",borderRadius:"6px"}})]}),o.jsxs("div",{children:[o.jsx("label",{style:{display:"block",fontSize:"12px",color:"var(--text-tertiary)",marginBottom:"4px"},children:"RPM"}),o.jsx("input",{type:"number",value:Fe,onChange:$=>rt($.target.value),placeholder:"不限",style:{...Ht,width:"100%",padding:"9px 10px",borderRadius:"6px"}})]}),o.jsxs("div",{children:[o.jsx("label",{style:{display:"block",fontSize:"12px",color:"var(--text-tertiary)",marginBottom:"4px"},children:"并发"}),o.jsx("input",{type:"number",value:Be,onChange:$=>qe($.target.value),placeholder:"不限",style:{...Ht,width:"100%",padding:"9px 10px",borderRadius:"6px"}})]})]})})]}),o.jsxs("div",{style:{marginBottom:"24px"},children:[o.jsx("label",{style:{display:"block",marginBottom:"6px",fontWeight:600,fontSize:"14px"},children:"模型过滤"}),o.jsxs("div",{style:{background:"var(--bg-primary)",borderRadius:"10px",padding:"14px",border:"1px solid var(--border-primary)"},children:[o.jsx("div",{style:{display:"flex",gap:"16px",marginBottom:ee!=="none"?"12px":"0"},children:[{value:"none",label:"不限制",desc:"允许所有模型"},{value:"allow",label:"白名单",desc:"仅允许指定模型"},{value:"block",label:"黑名单",desc:"禁止指定模型"}].map($=>o.jsxs("label",{className:`policy-model-opt ${ee===$.value?"policy-model-opt--active":""}`,children:[o.jsx("input",{type:"radio",name:"modelMode",value:$.value,checked:ee===$.value,onChange:()=>Y($.value),style:{display:"none"}}),o.jsx("div",{style:{fontWeight:600,fontSize:"14px",marginBottom:"2px"},children:$.label}),o.jsx("div",{style:{fontSize:"11px",color:"var(--text-tertiary)"},children:$.desc})]},$.value))}),ee!=="none"&&o.jsxs("div",{children:[o.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"8px"},children:[o.jsxs("div",{style:{position:"relative",flex:1},children:[o.jsx("input",{ref:De,type:"text",value:le,onChange:$=>{D($.target.value),Pe(!0)},onFocus:()=>Pe(!0),onBlur:()=>setTimeout(()=>Pe(!1),150),placeholder:de.length>0?"搜索或输入模型名...":"输入模型名,回车确认...",autoFocus:!0,onKeyDown:$=>{$.key==="Enter"&&($.preventDefault(),ia(ee==="allow"?ye:ze,ee==="allow"?Ee:ht)),$.key==="Escape"&&Pe(!1)},style:{...Ht,width:"100%",padding:"8px 12px",borderRadius:"6px",fontSize:"13px"}}),Te&&St.length>0&&o.jsx("div",{className:"ak-model-suggest",children:St.map($=>o.jsxs("button",{className:"ak-model-suggest-item",onMouseDown:z=>{var Ie;z.preventDefault();const be=ee==="allow"?ye:ze,Ye=ee==="allow"?Ee:ht;be.includes($.name)||Ye([...be,$.name]),D(""),Pe(!1),(Ie=De.current)==null||Ie.focus()},children:[o.jsx("span",{children:$.name}),o.jsx("span",{children:$.vendors.join(", ")})]},$.name))})]}),o.jsx("button",{className:"btn btn-primary btn-sm",style:{padding:"8px 14px",borderRadius:"6px"},onClick:()=>ia(ee==="allow"?ye:ze,ee==="allow"?Ee:ht),children:"添加"})]}),o.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",minHeight:"24px"},children:[(ee==="allow"?ye:ze).length===0&&o.jsx("span",{style:{fontSize:"12px",color:"var(--text-tertiary)",padding:"4px 0"},children:ee==="allow"?"尚未添加模型,至少需要添加一个模型才能生效":"尚未添加模型,不添加则不对任何模型进行屏蔽"}),(ee==="allow"?ye:ze).map(($,z)=>o.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"4px 10px",background:"var(--bg-secondary)",borderRadius:"16px",fontSize:"13px",border:"1px solid var(--border-primary)"},children:[$,o.jsx("button",{style:{border:"none",background:"none",cursor:"pointer",padding:"0 2px",color:"var(--text-tertiary)",fontSize:"14px",lineHeight:1},onClick:()=>{(ee==="allow"?Ee:ht)((ee==="allow"?ye:ze).filter((Ie,mt)=>mt!==z))},children:"×"})]},z))]})]})]})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px"},children:[o.jsx("button",{onClick:()=>ce(!1),className:"ak-modal-btn-secondary",children:"取消"}),o.jsx("button",{onClick:Ga,className:"ak-modal-btn-primary",children:L?"保存修改":"创建策略"})]})]})}),je&&o.jsx(TM,{keyName:je.key.name,apiKey:je.key.apiKey,guide:je.guide,onClose:()=>Ae(null)}),o.jsx("style",{children:`
520
+ .dropdown-btn {
521
+ display: block; width: 100%; padding: 6px 10px; text-align: left;
522
+ border: none; background: none; cursor: pointer; font-size: 13px;
523
+ color: var(--text-primary);
524
+ }
525
+ .dropdown-btn:hover { background: var(--bg-secondary); }
526
+
527
+ /* 操作按钮 - 列表/策略面板中的小按钮 */
528
+ .ak-action-btn {
529
+ padding: 4px 10px; border-radius: 6px;
530
+ border: 1px solid var(--border-primary);
531
+ background: var(--bg-secondary);
532
+ color: var(--text-secondary);
533
+ cursor: pointer; font-size: 13px;
534
+ transition: all 0.15s;
535
+ }
536
+ .ak-action-btn:hover {
537
+ background: var(--bg-route-item-hover);
538
+ border-color: var(--text-secondary);
539
+ }
540
+ .ak-action-btn--danger {
541
+ color: var(--accent-danger);
542
+ }
543
+ .ak-action-btn--danger:hover {
544
+ background: rgba(220, 38, 38, 0.1);
545
+ border-color: var(--accent-danger);
546
+ }
547
+
548
+ /* 模型自动补全下拉 */
549
+ .ak-model-suggest {
550
+ position: absolute; left: 0; right: 0; bottom: 100%; z-index: 50;
551
+ margin-top: 4px; max-height: 240px; overflow-y: auto;
552
+ background: var(--bg-primary-solid); border: 1px solid var(--border-primary);
553
+ border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.12);
554
+ padding: 4px 0;
555
+ }
556
+ .ak-model-suggest-item {
557
+ display: flex; justify-content: space-between; align-items: center; gap: 8px;
558
+ width: 100%; padding: 7px 12px;
559
+ border: none; background: none; cursor: pointer;
560
+ font-size: 13px; color: var(--text-primary); text-align: left;
561
+ }
562
+ .ak-model-suggest-item > span:first-child {
563
+ font-family: "SF Mono", "Fira Code", monospace;
564
+ white-space: nowrap;
565
+ }
566
+ .ak-model-suggest-item > span:last-child {
567
+ color: #999; font-size: 11px; white-space: nowrap; flex-shrink: 0;
568
+ }
569
+ [data-theme="dark"] .ak-model-suggest-item > span:last-child {
570
+ color: #888;
571
+ }
572
+ .ak-model-suggest-item:hover {
573
+ background: var(--bg-secondary);
574
+ }
575
+ [data-theme="dark"] .ak-model-suggest {
576
+ background: #0C1F12;
577
+ border-color: rgba(167, 243, 208, 0.2);
578
+ }
579
+ [data-theme="dark"] .ak-model-suggest-item:hover {
580
+ background: rgba(30, 58, 40, 0.95);
581
+ }
582
+
583
+ /* 批量操作按钮 */
584
+ .ak-action-btn[onClick] {
585
+ padding: 6px 12px;
586
+ }
587
+
588
+ /* 下拉菜单 */
589
+ .ak-dropdown-menu {
590
+ position: absolute; right: 0; top: 100%; z-index: 100;
591
+ background: var(--bg-primary-solid);
592
+ border: 1px solid var(--border-primary);
593
+ border-radius: 6px;
594
+ box-shadow: 0 4px 12px rgba(0,0,0,0.15);
595
+ min-width: 140px; padding: 4px 0;
596
+ }
597
+
598
+ /* 弹窗按钮 */
599
+ .ak-modal-btn-primary {
600
+ padding: 10px 28px; border-radius: 8px; border: none;
601
+ background: var(--color-primary, #3b82f6); color: #fff;
602
+ cursor: pointer; font-size: 14px; font-weight: 600;
603
+ transition: opacity 0.15s;
604
+ }
605
+ .ak-modal-btn-primary:hover { opacity: 0.9; }
606
+
607
+ .ak-modal-btn-secondary {
608
+ padding: 10px 24px; border-radius: 8px;
609
+ border: 1px solid var(--border-primary);
610
+ background: var(--bg-secondary);
611
+ color: var(--text-primary);
612
+ cursor: pointer; font-size: 14px; font-weight: 500;
613
+ transition: all 0.15s;
614
+ }
615
+ .ak-modal-btn-secondary:hover {
616
+ background: var(--bg-route-item-hover);
617
+ }
618
+
619
+ /* 模型过滤选项 */
620
+ .policy-model-opt {
621
+ cursor: pointer; padding: 10px 14px; border-radius: 8px;
622
+ flex: 1; text-align: center; transition: all 0.2s;
623
+ border: 1px solid var(--border-primary);
624
+ background: transparent;
625
+ }
626
+ .policy-model-opt:hover {
627
+ background: rgba(59,130,246,0.05);
628
+ }
629
+ .policy-model-opt--active {
630
+ border: 2px solid var(--color-primary, #3b82f6);
631
+ background: rgba(59,130,246,0.12);
632
+ }
633
+ .policy-model-opt--active:hover {
634
+ background: rgba(59,130,246,0.18);
635
+ }
636
+
637
+ /* ========== 深色模式 ========== */
638
+ [data-theme="dark"] .ak-action-btn {
639
+ background: rgba(30, 58, 40, 0.95);
640
+ border-color: rgba(167, 243, 208, 0.2);
641
+ color: #A7F3D0;
642
+ }
643
+ [data-theme="dark"] .ak-action-btn:hover {
644
+ background: rgba(40, 75, 52, 0.95);
645
+ border-color: rgba(167, 243, 208, 0.4);
646
+ }
647
+ [data-theme="dark"] .ak-action-btn--danger {
648
+ color: #EF4444;
649
+ }
650
+ [data-theme="dark"] .ak-action-btn--danger:hover {
651
+ background: rgba(239, 68, 68, 0.15);
652
+ border-color: rgba(239, 68, 68, 0.5);
653
+ }
654
+ [data-theme="dark"] .ak-dropdown-menu {
655
+ background: #0C1F12;
656
+ border-color: rgba(167, 243, 208, 0.2);
657
+ }
658
+ [data-theme="dark"] .ak-modal-btn-secondary {
659
+ background: rgba(30, 58, 40, 0.95);
660
+ border-color: rgba(167, 243, 208, 0.2);
661
+ color: #ECFEF5;
662
+ }
663
+ [data-theme="dark"] .ak-modal-btn-secondary:hover {
664
+ background: rgba(40, 75, 52, 0.95);
665
+ border-color: rgba(167, 243, 208, 0.35);
666
+ }
667
+ [data-theme="dark"] .policy-model-opt:hover {
668
+ background: rgba(96,165,250,0.12);
669
+ }
670
+ [data-theme="dark"] .policy-model-opt--active {
671
+ background: rgba(96,165,250,0.28);
672
+ border-color: #60a5fa;
673
+ }
674
+ [data-theme="dark"] .policy-model-opt--active:hover {
675
+ background: rgba(96,165,250,0.38);
676
+ }
677
+ [data-theme="dark"] .page-container select option {
678
+ background: #0C1F12;
679
+ color: #ECFEF5;
680
+ }
681
+ [data-theme="dark"] .page-container textarea,
682
+ [data-theme="dark"] .page-container input[type="text"],
683
+ [data-theme="dark"] .page-container input[type="number"] {
684
+ color-scheme: dark;
685
+ }
686
+ `})]})}function Fie(){var Xa,aa,Ht,$;const{id:e}=uz(),t=Vp(),{confirm:n}=du(),[r,i]=h.useState(null),[a,l]=h.useState([]),[s,c]=h.useState([]),[u,f]=h.useState(!0),[d,p]=h.useState("info"),[m,g]=h.useState(null),[y,x]=h.useState([]),[v,b]=h.useState(30),[w,S]=h.useState([]),[C,j]=h.useState(0),[E,O]=h.useState(1),[R,A]=h.useState(20),[N,_]=h.useState(""),[q,W]=h.useState(""),[I,F]=h.useState(""),[K,M]=h.useState(""),[B,k]=h.useState(null),[L,Q]=h.useState(!1),[T,ce]=h.useState(10),ve=h.useRef(null),[X,oe]=h.useState(!1),[fe,te]=h.useState(""),[Z,se]=h.useState(""),[re,Oe]=h.useState(""),[ne,_e]=h.useState(null),[Re,Fe]=h.useState(!1),[rt,Be]=h.useState({"claude-code":!0,codex:!0}),[qe,ye]=h.useState(!1),[Ee,ze]=h.useState([]),[ht,ee]=h.useState(0),[Y,le]=h.useState(1),[D,de]=h.useState(20),[me,Te]=h.useState(""),[Pe,De]=h.useState(""),[Le,Ve]=h.useState(null),[We,Qe]=h.useState([]),[ut,fn]=h.useState(!1),[G,ge]=h.useState(!1),[je,Ae]=h.useState(10),Ue=h.useRef(null),Nt=h.useCallback(async()=>{if(e)try{const[z,be,Ye]=await Promise.all([V.getAccessKey(e).catch(()=>null),V.getPolicies().catch(()=>[]),V.getRoutes().catch(()=>[])]);if(!z){U.error("密钥不存在"),t("/access-keys");return}i(z),l(be),c(Ye),te(z.name),se(z.remark||""),Oe(z.policyId||"")}catch(z){U.error("加载数据失败: "+z.message)}finally{f(!1)}},[e,t]),_t=h.useCallback(async()=>{if(e)try{const[z,be]=await Promise.all([V.getAccessKeyUsage(e).catch(()=>null),V.getAccessKeyUsageTrend(e,v).catch(()=>[])]);g(z),x(be)}catch{}},[e,v]),nn=h.useCallback(async()=>{if(e)try{const z=await V.getAccessKeyLogs(e,{page:E,pageSize:R,startDate:N||void 0,endDate:q||void 0,contentType:I||void 0,search:K||void 0});S(z.data),j(z.total)}catch{}},[e,E,R,N,q,I,K]),Xt=h.useCallback(async()=>{if(e)try{const z=await V.getAccessKeySessions(e,{page:Y,pageSize:D,targetType:Pe||void 0,search:me||void 0});ze(z.data),ee(z.total)}catch{}},[e,Y,D,Pe,me]);h.useEffect(()=>{Nt()},[Nt]),h.useEffect(()=>{d==="stats"&&_t(),d==="logs"&&nn(),d==="sessions"&&Xt()},[d,_t,nn,Xt]),h.useEffect(()=>{if(L&&d==="logs")return ve.current=setInterval(()=>{ce(z=>z<=1?(nn(),10):z-1)},1e3),()=>{ve.current&&clearInterval(ve.current)};ve.current&&clearInterval(ve.current),ce(10)},[L,d,nn]),h.useEffect(()=>{if(G&&d==="sessions")return Ue.current=setInterval(()=>{Ae(z=>z<=1?(Xt(),10):z-1)},1e3),()=>{Ue.current&&clearInterval(Ue.current)};Ue.current&&clearInterval(Ue.current),Ae(10)},[G,d,Xt]);const Oi=async()=>{if(!(!e||!fe.trim()))try{await V.updateAccessKey(e,{name:fe.trim(),remark:Z||void 0,policyId:re||void 0}),U.success("已保存"),oe(!1),Nt()}catch(z){U.error("保存失败: "+z.message)}},Ln=async()=>{if(r)try{await V.updateAccessKey(r.id,{status:r.status==="active"?"disabled":"active"}),U.success(r.status==="active"?"已停用":"已启用"),Nt()}catch(z){U.error("操作失败: "+z.message)}},dt=async()=>{if(!(!r||!await n({message:"确定删除此密钥吗?删除后不可恢复。"})))try{await V.deleteAccessKey(r.id),U.success("已删除"),t("/access-keys")}catch(be){U.error("删除失败: "+be.message)}},Yn=async()=>{if(r)try{const z=await V.getAccessKeyGuide(r.id);_e({key:r,guide:z})}catch(z){U.error("获取指引失败: "+z.message)}},ei=async()=>{var z,be;if(r)try{const Ye=await V.getAccessKeyGuide(r.id),Ie=((be=(z=Ye==null?void 0:Ye.claudeCode)==null?void 0:z.envVars)==null?void 0:be.ANTHROPIC_AUTH_TOKEN)||r.apiKey;await navigator.clipboard.writeText(Ie),U.success("已复制到剪贴板")}catch{try{await navigator.clipboard.writeText(r.apiKey),U.success("已复制到剪贴板")}catch{U.error("复制失败")}}},Qt=async()=>{if(!r)return;const z=Object.entries(rt).filter(([,be])=>be).map(([be])=>be);if(z.length===0){U.error("请选择至少一个目标");return}ye(!0);try{await V.writeAccessKeyToLocal(r.id,z),U.success("已写入本地配置文件"),Fe(!1)}catch(be){U.error("写入失败: "+(be.message||"未知错误"))}finally{ye(!1)}},St=z=>z>=1e6?(z/1e6).toFixed(1)+"M":z>=1e3?(z/1e3).toFixed(1)+"k":String(z),Ya=z=>z?new Date(z).toLocaleString():"-",Ga={width:"100%",padding:"8px 12px",borderRadius:"8px",border:"1px solid var(--border-primary)",background:"var(--bg-secondary)",color:"var(--text-primary)",boxSizing:"border-box",fontSize:"14px"};if(u)return o.jsx("div",{style:{textAlign:"center",padding:"40px"},children:"加载中..."});if(!r)return null;const Qo=m&&m.lifetime.totalRequests>0?((m.lifetime.totalRequests-m.lifetime.errorCount)/m.lifetime.totalRequests*100).toFixed(1):"-",Jo=Math.max(...y.map(z=>z.tokens),1),ia=Math.max(...y.map(z=>z.requests),1),Zo=[{key:"info",label:"基本信息"},{key:"policy",label:"策略"},{key:"stats",label:"统计"},{key:"logs",label:"日志"},{key:"sessions",label:"会话"}];return o.jsxs("div",{className:"page-container",children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"20px"},children:[o.jsx("button",{className:"btn btn-secondary",onClick:()=>t("/access-keys"),children:"← 返回"}),o.jsx("h2",{style:{flex:1},children:r.name}),o.jsx("button",{className:"ak-action-btn",style:{padding:"6px 14px"},onClick:()=>oe(!0),children:"编辑"}),o.jsx("button",{className:"ak-action-btn",style:{padding:"6px 14px"},onClick:()=>Fe(!0),children:"💾 写入本地"}),o.jsx("button",{className:"ak-action-btn",style:{padding:"6px 14px"},onClick:Ln,children:r.status==="active"?"停用":"启用"}),o.jsx("button",{className:"ak-action-btn ak-action-btn--danger",style:{padding:"6px 14px"},onClick:dt,children:"删除"})]}),o.jsx("div",{className:"ak-tab-bar",style:{display:"flex",gap:"0",borderBottom:"2px solid var(--border-primary)",marginBottom:"20px"},children:Zo.map(z=>o.jsx("button",{className:`ak-tab-btn ${d===z.key?"ak-tab-btn--active":""}`,onClick:()=>p(z.key),children:z.label},z.key))}),d==="info"&&o.jsx("div",{className:"card",children:o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"140px 1fr",gap:"16px 20px",alignItems:"start"},children:[o.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:"14px",paddingTop:"4px"},children:"API Key"}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[o.jsx("code",{style:{fontSize:"14px",padding:"4px 8px",background:"var(--bg-secondary)",borderRadius:"4px"},children:r.apiKey}),o.jsx("button",{className:"ak-action-btn",onClick:ei,title:"复制",children:"📋"}),o.jsx("button",{className:"ak-action-btn",onClick:Yn,children:"接入指引"})]}),o.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:"14px",paddingTop:"4px"},children:"策略"}),o.jsx("div",{style:{fontSize:"14px"},children:r.policyName||o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"未配置"})}),o.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:"14px",paddingTop:"4px"},children:"状态"}),o.jsxs("div",{style:{fontSize:"14px",display:"flex",alignItems:"center",gap:"6px"},children:[o.jsx("span",{style:{display:"inline-block",width:"8px",height:"8px",borderRadius:"50%",background:r.status==="active"?"var(--color-success, #22c55e)":"var(--text-tertiary)"}}),r.status==="active"?"启用":"停用"]}),o.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:"14px",paddingTop:"4px"},children:"创建时间"}),o.jsx("div",{style:{fontSize:"14px"},children:Ya(r.createdAt)}),o.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:"14px",paddingTop:"4px"},children:"最后活跃"}),o.jsx("div",{style:{fontSize:"14px"},children:Ya(r.lastActiveAt)}),o.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:"14px",paddingTop:"4px"},children:"备注"}),o.jsx("div",{style:{fontSize:"14px",color:r.remark?"var(--text-primary)":"var(--text-tertiary)"},children:r.remark||"无"}),m&&o.jsxs(o.Fragment,{children:[o.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:"14px",paddingTop:"4px"},children:"累计 Token"}),o.jsx("div",{style:{fontSize:"14px"},children:St(m.lifetime.totalTokens)}),o.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:"14px",paddingTop:"4px"},children:"累计请求"}),o.jsx("div",{style:{fontSize:"14px"},children:m.lifetime.totalRequests})]})]})}),d==="policy"&&(()=>{var Lr,Qa,Ps,Ja,Es;const z=a.find(Ke=>Ke.id===r.policyId),be=z!=null&&z.routeId&&z.routeId!=="system"?(Lr=s.find(Ke=>Ke.id===z.routeId))==null?void 0:Lr.name:void 0,Ye=Ke=>{const Bt=[];return Ke.dailyTokenLimit&&Bt.push(`日 ${Ke.dailyTokenLimit}k Token`),Ke.weeklyTokenLimit&&Bt.push(`周 ${Ke.weeklyTokenLimit}k Token`),Ke.monthlyTokenLimit&&Bt.push(`月 ${Ke.monthlyTokenLimit}k Token`),Ke.customTokenLimit&&Ke.customTokenResetHours&&Bt.push(`${Ke.customTokenResetHours}h ${Ke.customTokenLimit}k Token`),Ke.dailyRequestLimit&&Bt.push(`日 ${Ke.dailyRequestLimit} 次请求`),Ke.weeklyRequestLimit&&Bt.push(`周 ${Ke.weeklyRequestLimit} 次请求`),Ke.monthlyRequestLimit&&Bt.push(`月 ${Ke.monthlyRequestLimit} 次请求`),Ke.customRequestLimit&&Ke.customRequestResetHours&&Bt.push(`${Ke.customRequestResetHours}h ${Ke.customRequestLimit} 次请求`),Ke.rpmLimit&&Bt.push(`RPM ${Ke.rpmLimit}`),Ke.concurrentLimit&&Bt.push(`并发 ${Ke.concurrentLimit}`),Bt.length>0?Bt:null},Ie=(Qa=z==null?void 0:z.allowedModels)!=null&&Qa.length?z.allowedModels:(Ps=z==null?void 0:z.blockedModels)!=null&&Ps.length?z.blockedModels:null,mt=(Ja=z==null?void 0:z.allowedModels)!=null&&Ja.length?"allow":(Es=z==null?void 0:z.blockedModels)!=null&&Es.length?"block":"none";if(!z)return o.jsxs("div",{className:"card",style:{textAlign:"center",padding:"60px 20px"},children:[o.jsx("div",{style:{fontSize:"36px",marginBottom:"12px"},children:"📋"}),o.jsx("div",{style:{fontSize:"16px",fontWeight:500,marginBottom:"8px"},children:"未绑定策略"}),o.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:"13px"},children:"可在「编辑」弹窗中为此密钥绑定策略,以启用配额限制和模型过滤"})]});const Vt=Ye(z);return o.jsxs("div",{className:"card",children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[o.jsxs("div",{children:[o.jsxs("h3",{style:{margin:"0 0 4px",fontSize:"18px"},children:["📋 ",z.name]}),z.description&&o.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:"13px"},children:z.description})]}),o.jsx("span",{style:{fontSize:"12px",color:"var(--text-tertiary)"},children:"只读 · 如需修改请前往策略管理"})]}),o.jsxs("div",{style:{display:"flex",gap:"4px",alignItems:"center",marginBottom:"20px",paddingBottom:"20px",borderBottom:"1px solid var(--border-primary)"},children:[o.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:"14px"},children:"绑定路由:"}),o.jsx("div",{style:{fontSize:"14px"},children:be?o.jsx("span",{children:be}):o.jsx("span",{style:{color:"var(--accent-color, #4a90d9)"},children:"按系统默认"})})]}),o.jsxs("div",{style:{marginBottom:"20px",paddingBottom:"20px",borderBottom:"1px solid var(--border-primary)"},children:[o.jsx("h4",{style:{margin:"0 0 12px",fontSize:"15px"},children:"📊 配额限制"}),Vt?o.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px"},children:Vt.map((Ke,Bt)=>o.jsx("span",{style:{display:"inline-block",padding:"6px 12px",borderRadius:"6px",background:"var(--bg-secondary)",fontSize:"13px",border:"1px solid var(--border-primary)"},children:Ke},Bt))}):o.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:"14px"},children:"无限制"})]}),o.jsxs("div",{children:[o.jsx("h4",{style:{margin:"0 0 12px",fontSize:"15px"},children:"🏷️ 模型过滤"}),mt==="none"?o.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:"14px"},children:"不限制,允许所有模型"}):o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:"13px",marginBottom:"10px",color:"var(--text-secondary)"},children:mt==="allow"?"✅ 白名单模式 — 仅允许以下模型":"🚫 黑名单模式 — 禁止以下模型"}),o.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:Ie.map((Ke,Bt)=>o.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"5px 12px",background:"var(--bg-secondary)",borderRadius:"16px",fontSize:"13px",border:"1px solid var(--border-primary)"},children:Ke},Bt))})]})]})]})})(),d==="stats"&&o.jsxs("div",{children:[m&&o.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"12px",marginBottom:"20px"},children:[{label:"累计 Token",value:St(m.lifetime.totalTokens)},{label:"累计请求",value:String(m.lifetime.totalRequests)},{label:"成功率",value:Qo+"%"},{label:"错误数",value:String(m.lifetime.errorCount)},{label:"输入 Token",value:St(m.lifetime.inputTokens)},{label:"输出 Token",value:St(m.lifetime.outputTokens)}].map(z=>o.jsxs("div",{className:"card",style:{padding:"16px",textAlign:"center",marginBottom:"0"},children:[o.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:"13px",marginBottom:"4px"},children:z.label}),o.jsx("div",{style:{fontSize:"20px",fontWeight:600},children:z.value})]},z.label))}),o.jsxs("div",{className:"card",children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[o.jsx("h4",{style:{margin:0},children:"消耗趋势"}),o.jsx("div",{style:{display:"flex",gap:"4px"},children:[7,30,90].map(z=>o.jsxs("button",{className:`ak-action-btn ${v===z?"ak-action-btn--active":""}`,style:{padding:"3px 10px",fontSize:"12px"},onClick:()=>b(z),children:[z,"天"]},z))})]}),y.length===0?o.jsx("div",{style:{textAlign:"center",padding:"20px",color:"var(--text-tertiary)"},children:"暂无趋势数据"}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{marginBottom:"20px"},children:[o.jsx("div",{style:{fontSize:"13px",color:"var(--text-tertiary)",marginBottom:"8px"},children:"Token 消耗"}),o.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:"2px",height:"80px"},children:y.slice(-v).map((z,be)=>o.jsx("div",{style:{flex:1,minWidth:0,height:Jo>0?`${Math.max(2,z.tokens/Jo*100)}%`:"2px",background:"var(--color-primary, #3b82f6)",borderRadius:"2px 2px 0 0",transition:"height 0.2s"},title:`${z.date}: ${St(z.tokens)}`},be))}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"11px",color:"var(--text-tertiary)",marginTop:"4px"},children:[o.jsx("span",{children:(Xa=y[0])==null?void 0:Xa.date}),o.jsx("span",{children:(aa=y[y.length-1])==null?void 0:aa.date})]})]}),o.jsxs("div",{style:{marginBottom:"8px"},children:[o.jsx("div",{style:{fontSize:"13px",color:"var(--text-tertiary)",marginBottom:"8px"},children:"请求量"}),o.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:"2px",height:"60px"},children:y.slice(-v).map((z,be)=>o.jsx("div",{style:{flex:1,minWidth:0,height:ia>0?`${Math.max(2,z.requests/ia*100)}%`:"2px",background:"var(--color-success, #22c55e)",borderRadius:"2px 2px 0 0",transition:"height 0.2s"},title:`${z.date}: ${z.requests} 请求`},be))}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"11px",color:"var(--text-tertiary)",marginTop:"4px"},children:[o.jsx("span",{children:(Ht=y[0])==null?void 0:Ht.date}),o.jsx("span",{children:($=y[y.length-1])==null?void 0:$.date})]})]}),o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:"13px",color:"var(--text-tertiary)",marginBottom:"8px"},children:"错误数"}),o.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:"2px",height:"40px"},children:y.slice(-v).map((z,be)=>{const Ye=Math.max(...y.map(Ie=>Ie.errors),1);return o.jsx("div",{style:{flex:1,minWidth:0,height:Ye>0?`${Math.max(2,z.errors/Ye*100)}%`:"2px",background:z.errors>0?"var(--accent-danger, #ef4444)":"var(--border-primary)",borderRadius:"2px 2px 0 0",transition:"height 0.2s"},title:`${z.date}: ${z.errors} 错误`},be)})})]})]})]})]}),d==="logs"&&o.jsxs("div",{children:[o.jsx("div",{className:"card",style:{marginBottom:"16px",padding:"12px 16px"},children:o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap",flex:1,minWidth:0},children:[o.jsx("input",{type:"text",placeholder:"搜索路径、模型...",value:K,onChange:z=>{M(z.target.value),O(1)},style:{padding:"4px 8px",borderRadius:"6px",border:"1px solid var(--border-primary)",background:"var(--bg-secondary)",color:"var(--text-primary)",fontSize:"13px",width:"180px"}}),o.jsxs("select",{value:I,onChange:z=>{F(z.target.value),O(1)},style:{padding:"4px 8px",borderRadius:"6px",border:"1px solid var(--border-primary)",background:"var(--bg-secondary)",color:"var(--text-primary)",fontSize:"13px"},children:[o.jsx("option",{value:"",children:"全部类型"}),o.jsx("option",{value:"default",children:"默认"}),o.jsx("option",{value:"thinking",children:"思考"}),o.jsx("option",{value:"long-context",children:"长上下文"}),o.jsx("option",{value:"image-understanding",children:"图像理解"}),o.jsx("option",{value:"background",children:"后台"}),o.jsx("option",{value:"compact",children:"压缩"}),o.jsx("option",{value:"high-iq",children:"高智商"})]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[o.jsx("label",{style:{fontSize:"13px",color:"var(--text-tertiary)"},children:"开始"}),o.jsx("input",{type:"date",value:N,onChange:z=>{_(z.target.value),O(1)},style:{padding:"4px 8px",borderRadius:"6px",border:"1px solid var(--border-primary)",background:"var(--bg-secondary)",color:"var(--text-primary)",fontSize:"13px"}})]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[o.jsx("label",{style:{fontSize:"13px",color:"var(--text-tertiary)"},children:"结束"}),o.jsx("input",{type:"date",value:q,onChange:z=>{W(z.target.value),O(1)},style:{padding:"4px 8px",borderRadius:"6px",border:"1px solid var(--border-primary)",background:"var(--bg-secondary)",color:"var(--text-primary)",fontSize:"13px"}})]})]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",flexShrink:0},children:[o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"13px",cursor:"pointer",color:"var(--text-tertiary)"},children:[o.jsx("input",{type:"checkbox",checked:L,onChange:z=>Q(z.target.checked)}),"自动刷新 ",L&&o.jsxs("span",{style:{color:"var(--color-primary)"},children:["(",T,"s)"]})]}),o.jsx("button",{className:"ak-action-btn",onClick:()=>nn(),style:{padding:"4px 12px"},children:"🔄 刷新"})]})]})}),o.jsx("div",{className:"card",children:w.length===0?o.jsx("div",{style:{textAlign:"center",padding:"20px",color:"var(--text-tertiary)"},children:"暂无请求记录"}):o.jsxs(o.Fragment,{children:[o.jsx("div",{style:{overflowX:"auto"},children:o.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[o.jsx("thead",{children:o.jsxs("tr",{style:{borderBottom:"1px solid var(--border-primary)"},children:[o.jsx("th",{style:{padding:"8px 6px",textAlign:"left"},children:"时间"}),o.jsx("th",{style:{padding:"8px 6px",textAlign:"left"},children:"路径"}),o.jsx("th",{style:{padding:"8px 6px",textAlign:"left"},children:"模型"}),o.jsx("th",{style:{padding:"8px 6px",textAlign:"right"},children:"Token"}),o.jsx("th",{style:{padding:"8px 6px",textAlign:"right"},children:"耗时"}),o.jsx("th",{style:{padding:"8px 6px",textAlign:"center"},children:"状态"}),o.jsx("th",{style:{padding:"8px 6px",textAlign:"left"},children:"类型"}),o.jsx("th",{style:{padding:"8px 6px",textAlign:"center"},children:"操作"})]})}),o.jsx("tbody",{children:w.map(z=>{var Ie,mt,Vt;const be=((Ie=z.usage)==null?void 0:Ie.totalTokens)||(((mt=z.usage)==null?void 0:mt.inputTokens)||0)+(((Vt=z.usage)==null?void 0:Vt.outputTokens)||0),Ye=(z.statusCode||200)<400;return o.jsxs("tr",{style:{borderBottom:"1px solid var(--border-primary)",cursor:"pointer"},onClick:()=>k(z),children:[o.jsx("td",{style:{padding:"8px 6px",whiteSpace:"nowrap"},children:new Date(z.timestamp).toLocaleString()}),o.jsx("td",{style:{padding:"8px 6px",maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:z.path||"-"}),o.jsx("td",{style:{padding:"8px 6px"},children:z.targetModel||z.requestModel||"-"}),o.jsx("td",{style:{padding:"8px 6px",textAlign:"right"},children:St(be)}),o.jsx("td",{style:{padding:"8px 6px",textAlign:"right"},children:z.responseTime?(z.responseTime/1e3).toFixed(1)+"s":"-"}),o.jsx("td",{style:{padding:"8px 6px",textAlign:"center"},children:o.jsx("span",{style:{display:"inline-block",padding:"2px 6px",borderRadius:"4px",fontSize:"12px",background:Ye?"rgba(34,197,94,0.1)":"rgba(239,68,68,0.1)",color:Ye?"var(--color-success, #22c55e)":"var(--accent-danger, #ef4444)"},children:z.statusCode||200})}),o.jsx("td",{style:{padding:"8px 6px"},children:z.contentType||"-"}),o.jsx("td",{style:{padding:"8px 6px",textAlign:"center"},children:o.jsx("button",{className:"ak-action-btn",style:{padding:"2px 8px",fontSize:"12px"},onClick:Lr=>{Lr.stopPropagation(),k(z)},children:"详情"})})]},z.id)})})]})}),o.jsx("div",{style:{marginTop:"12px"},children:o.jsx(Bc,{currentPage:E,totalItems:C,pageSize:R,onPageChange:O,onPageSizeChange:z=>{A(z),O(1)}})})]})})]}),d==="sessions"&&(()=>{const z=(Ie,mt)=>{const Vt=mt-Ie;return Vt<6e4?`${Math.floor(Vt/1e3)}秒`:Vt<36e5?`${Math.floor(Vt/6e4)}分钟`:`${Math.floor(Vt/36e5)}小时`},be=async Ie=>{Ve(Ie),fn(!0);try{const mt=await V.getAccessKeySessionLogs(e,Ie.id,1e4);Qe(mt)}catch{U.error("加载会话日志失败")}finally{fn(!1)}},Ye=async()=>{if(!(!Le||ut)){fn(!0);try{const Ie=await V.getAccessKeySessionLogs(e,Le.id,1e4);Qe(Ie)}catch{}finally{fn(!1)}}};return o.jsxs("div",{children:[o.jsx("div",{className:"card",style:{marginBottom:"16px",padding:"12px 16px"},children:o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap",flex:1,minWidth:0},children:[o.jsx("input",{type:"text",placeholder:"搜索标题或ID...",value:me,onChange:Ie=>{Te(Ie.target.value),le(1)},style:{padding:"4px 8px",borderRadius:"6px",border:"1px solid var(--border-primary)",background:"var(--bg-secondary)",color:"var(--text-primary)",fontSize:"13px",width:"200px"}}),o.jsxs("select",{value:Pe,onChange:Ie=>{De(Ie.target.value),le(1)},style:{padding:"4px 8px",borderRadius:"6px",border:"1px solid var(--border-primary)",background:"var(--bg-secondary)",color:"var(--text-primary)",fontSize:"13px"},children:[o.jsx("option",{value:"",children:"全部类型"}),o.jsx("option",{value:"claude-code",children:"Claude Code"}),o.jsx("option",{value:"codex",children:"Codex"})]})]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",flexShrink:0},children:[o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"13px",cursor:"pointer",color:"var(--text-tertiary)"},children:[o.jsx("input",{type:"checkbox",checked:G,onChange:Ie=>ge(Ie.target.checked)}),"自动刷新 ",G&&o.jsxs("span",{style:{color:"var(--color-primary)"},children:["(",je,"s)"]})]}),o.jsx("button",{className:"ak-action-btn",onClick:()=>Xt(),style:{padding:"4px 12px"},children:"🔄 刷新"})]})]})}),o.jsx("div",{className:"card",children:Ee.length===0?o.jsx("div",{style:{textAlign:"center",padding:"20px",color:"var(--text-tertiary)"},children:"暂无会话记录"}):o.jsxs(o.Fragment,{children:[o.jsx("div",{style:{overflowX:"auto"},children:o.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[o.jsx("thead",{children:o.jsxs("tr",{style:{borderBottom:"1px solid var(--border-primary)"},children:[o.jsx("th",{style:{padding:"8px 6px",textAlign:"left"},children:"标题"}),o.jsx("th",{style:{padding:"8px 6px",textAlign:"left"},children:"类型"}),o.jsx("th",{style:{padding:"8px 6px",textAlign:"right"},children:"请求数"}),o.jsx("th",{style:{padding:"8px 6px",textAlign:"right"},children:"Tokens"}),o.jsx("th",{style:{padding:"8px 6px",textAlign:"left"},children:"首次请求"}),o.jsx("th",{style:{padding:"8px 6px",textAlign:"left"},children:"最后请求"}),o.jsx("th",{style:{padding:"8px 6px",textAlign:"left"},children:"时长"}),o.jsx("th",{style:{padding:"8px 6px",textAlign:"center"},children:"操作"})]})}),o.jsx("tbody",{children:Ee.map(Ie=>o.jsxs("tr",{style:{borderBottom:"1px solid var(--border-primary)",cursor:"pointer"},onClick:()=>be(Ie),children:[o.jsx("td",{style:{padding:"8px 6px",maxWidth:"250px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:go(Ie.title)}),o.jsx("td",{style:{padding:"8px 6px"},children:o.jsx("span",{style:{display:"inline-block",padding:"2px 8px",borderRadius:"4px",fontSize:"12px",background:Ie.targetType==="claude-code"?"rgba(59,130,246,0.1)":"rgba(34,197,94,0.1)",color:Ie.targetType==="claude-code"?"var(--color-primary, #3b82f6)":"var(--color-success, #22c55e)"},children:Ie.targetType==="claude-code"?"Claude Code":"Codex"})}),o.jsx("td",{style:{padding:"8px 6px",textAlign:"right"},children:Ie.requestCount}),o.jsx("td",{style:{padding:"8px 6px",textAlign:"right"},children:St(Ie.totalTokens)}),o.jsx("td",{style:{padding:"8px 6px",whiteSpace:"nowrap"},children:new Date(Ie.firstRequestAt).toLocaleDateString(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}),o.jsx("td",{style:{padding:"8px 6px",whiteSpace:"nowrap"},children:new Date(Ie.lastRequestAt).toLocaleDateString(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}),o.jsx("td",{style:{padding:"8px 6px"},children:z(Ie.firstRequestAt,Ie.lastRequestAt)}),o.jsxs("td",{style:{padding:"8px 6px",textAlign:"center"},children:[o.jsx("button",{className:"ak-action-btn",style:{padding:"2px 8px",fontSize:"12px"},onClick:mt=>{mt.stopPropagation(),be(Ie)},children:"详情"}),o.jsx("button",{className:"ak-action-btn",style:{padding:"2px 8px",fontSize:"12px",marginLeft:"4px"},onClick:mt=>{mt.stopPropagation(),Ve(Ie),fn(!0),V.getAccessKeySessionLogs(e,Ie.id,1e4).then(Vt=>{Qe(Vt),fn(!1)}).catch(()=>fn(!1))},children:"对话"})]})]},Ie.id))})]})}),o.jsx("div",{style:{marginTop:"12px"},children:o.jsx(Bc,{currentPage:Y,totalItems:ht,pageSize:D,onPageChange:le,onPageSizeChange:Ie=>{de(Ie),le(1)}})})]})}),Le&&o.jsx(XT,{session:Le,logs:We,logsLoading:ut,onRefreshLogs:Ye,onFetchNewLogs:async()=>Le?await V.getAccessKeySessionLogs(e,Le.id,1e4):[],onClose:()=>{Ve(null),Qe([])}})]})})(),X&&o.jsx("div",{className:"modal-overlay",onClick:()=>oe(!1),children:o.jsxs("div",{className:"modal",style:{minWidth:"auto",width:"480px",padding:"28px"},onClick:z=>z.stopPropagation(),children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:()=>oe(!1),style:{top:"12px",right:"12px",width:"36px",height:"36px",fontSize:"24px"},"aria-label":"关闭",children:"×"}),o.jsx("h3",{style:{margin:"0 0 20px",fontSize:"20px"},children:"编辑密钥"}),o.jsxs("div",{style:{marginBottom:"14px"},children:[o.jsx("label",{style:{display:"block",marginBottom:"6px",fontWeight:600,fontSize:"14px"},children:"名称"}),o.jsx("input",{type:"text",value:fe,onChange:z=>te(z.target.value),style:Ga})]}),o.jsxs("div",{style:{marginBottom:"14px"},children:[o.jsx("label",{style:{display:"block",marginBottom:"6px",fontWeight:600,fontSize:"14px"},children:"备注"}),o.jsx("textarea",{value:Z,onChange:z=>se(z.target.value),style:{...Ga,minHeight:"60px",resize:"vertical"}})]}),o.jsxs("div",{style:{marginBottom:"24px"},children:[o.jsx("label",{style:{display:"block",marginBottom:"6px",fontWeight:600,fontSize:"14px"},children:"策略"}),o.jsxs("select",{value:re,onChange:z=>Oe(z.target.value),style:{...Ga,cursor:"pointer"},children:[o.jsx("option",{value:"",children:"未配置"}),a.map(z=>o.jsx("option",{value:z.id,children:z.name},z.id))]})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px"},children:[o.jsx("button",{onClick:()=>oe(!1),className:"ak-modal-btn-secondary",children:"取消"}),o.jsx("button",{onClick:Oi,className:"ak-modal-btn-primary",children:"保存"})]})]})}),B&&o.jsx(Ef,{log:B,onClose:()=>k(null)}),ne&&o.jsx(TM,{keyName:ne.key.name,apiKey:ne.key.apiKey,guide:ne.guide,onClose:()=>_e(null)}),Re&&o.jsx("div",{className:"modal-overlay",onClick:()=>Fe(!1),children:o.jsxs("div",{className:"modal",style:{minWidth:"auto",width:"420px",padding:"28px"},onClick:z=>z.stopPropagation(),children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:()=>Fe(!1),style:{top:"12px",right:"12px",width:"36px",height:"36px",fontSize:"24px"},"aria-label":"关闭",children:"×"}),o.jsx("h3",{style:{margin:"0 0 16px",fontSize:"20px"},children:"写入本地配置"}),o.jsx("p",{style:{margin:"0 0 16px",fontSize:"14px",color:"var(--text-secondary)"},children:"将此密钥写入本地工具配置文件(仅更新认证字段,不影响其他配置)"}),o.jsx("div",{style:{marginBottom:"20px"},children:[{key:"claude-code",label:"Claude Code",desc:"~/.claude/settings.json → ANTHROPIC_AUTH_TOKEN"},{key:"codex",label:"Codex",desc:"~/.codex/auth.json → OPENAI_API_KEY"}].map(z=>o.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"10px",padding:"12px",marginBottom:"8px",borderRadius:"8px",border:"1px solid var(--border-primary)",background:rt[z.key]?"var(--bg-secondary)":"transparent",cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",checked:rt[z.key],onChange:be=>Be(Ye=>({...Ye,[z.key]:be.target.checked})),style:{marginTop:"2px"}}),o.jsxs("div",{children:[o.jsx("div",{style:{fontWeight:600,fontSize:"14px"},children:z.label}),o.jsx("div",{style:{fontSize:"12px",color:"var(--text-tertiary)",marginTop:"2px"},children:z.desc})]})]},z.key))}),o.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px"},children:[o.jsx("button",{onClick:()=>Fe(!1),className:"ak-modal-btn-secondary",children:"取消"}),o.jsx("button",{onClick:Qt,className:"ak-modal-btn-primary",disabled:qe,children:qe?"写入中...":"确认写入"})]})]})}),o.jsx("style",{children:`
687
+ .ak-tab-btn {
688
+ padding: 10px 24px;
689
+ border: none;
690
+ background: transparent;
691
+ color: var(--text-tertiary);
692
+ font-size: 14px;
693
+ font-weight: 500;
694
+ cursor: pointer;
695
+ border-bottom: 2px solid transparent;
696
+ margin-bottom: -2px;
697
+ transition: all 0.15s;
698
+ }
699
+ .ak-tab-btn:hover {
700
+ color: var(--text-secondary);
701
+ }
702
+ .ak-tab-btn--active {
703
+ color: var(--color-primary, #3b82f6);
704
+ border-bottom-color: var(--color-primary, #3b82f6);
705
+ font-weight: 600;
706
+ }
707
+ .ak-action-btn {
708
+ padding: 4px 10px; border-radius: 6px;
709
+ border: 1px solid var(--border-primary);
710
+ background: var(--bg-secondary);
711
+ color: var(--text-secondary);
712
+ cursor: pointer; font-size: 13px;
713
+ transition: all 0.15s;
714
+ }
715
+ .ak-action-btn:hover {
716
+ background: var(--bg-route-item-hover);
717
+ border-color: var(--text-secondary);
718
+ }
719
+ .ak-action-btn--active {
720
+ background: var(--color-primary, #3b82f6);
721
+ color: #fff;
722
+ border-color: var(--color-primary, #3b82f6);
723
+ }
724
+ .ak-action-btn--danger {
725
+ color: var(--accent-danger);
726
+ }
727
+ .ak-action-btn--danger:hover {
728
+ background: rgba(220, 38, 38, 0.1);
729
+ border-color: var(--accent-danger);
730
+ }
731
+ .ak-modal-btn-primary {
732
+ padding: 10px 28px; border-radius: 8px; border: none;
733
+ background: var(--color-primary, #3b82f6); color: #fff;
734
+ cursor: pointer; font-size: 14px; font-weight: 600;
735
+ transition: opacity 0.15s;
736
+ }
737
+ .ak-modal-btn-primary:hover { opacity: 0.9; }
738
+ .ak-modal-btn-secondary {
739
+ padding: 10px 24px; border-radius: 8px;
740
+ border: 1px solid var(--border-primary);
741
+ background: var(--bg-secondary);
742
+ color: var(--text-primary);
743
+ cursor: pointer; font-size: 14px; font-weight: 500;
744
+ transition: all 0.15s;
745
+ }
746
+ .ak-modal-btn-secondary:hover {
747
+ background: var(--bg-route-item-hover);
748
+ }
749
+
750
+ /* 深色模式 */
751
+ [data-theme="dark"] .ak-action-btn {
752
+ background: rgba(30, 58, 40, 0.95);
753
+ border-color: rgba(167, 243, 208, 0.2);
754
+ color: #A7F3D0;
755
+ }
756
+ [data-theme="dark"] .ak-action-btn:hover {
757
+ background: rgba(40, 75, 52, 0.95);
758
+ border-color: rgba(167, 243, 208, 0.4);
759
+ }
760
+ [data-theme="dark"] .ak-action-btn--danger {
761
+ color: #EF4444;
762
+ }
763
+ [data-theme="dark"] .ak-action-btn--danger:hover {
764
+ background: rgba(239, 68, 68, 0.15);
765
+ border-color: rgba(239, 68, 68, 0.5);
766
+ }
767
+ [data-theme="dark"] .ak-modal-btn-secondary {
768
+ background: rgba(30, 58, 40, 0.95);
769
+ border-color: rgba(167, 243, 208, 0.2);
770
+ color: #ECFEF5;
771
+ }
772
+ [data-theme="dark"] .ak-modal-btn-secondary:hover {
773
+ background: rgba(40, 75, 52, 0.95);
774
+ border-color: rgba(167, 243, 208, 0.35);
775
+ }
776
+ [data-theme="dark"] .page-container select option {
777
+ background: #0C1F12;
778
+ color: #ECFEF5;
779
+ }
780
+ [data-theme="dark"] .page-container textarea,
781
+ [data-theme="dark"] .page-container input[type="text"],
782
+ [data-theme="dark"] .page-container input[type="date"] {
783
+ color-scheme: dark;
784
+ }
785
+ `})]})}function Uie({output:e,onInput:t,readOnly:n=!0,placeholder:r="$ ",waitingForInput:i=!1}){const a=h.useRef(null),l=h.useRef(null),[s,c]=h.useState("");h.useEffect(()=>{a.current&&(a.current.scrollTop=a.current.scrollHeight)},[e,s]),h.useEffect(()=>{i&&!n&&l.current&&l.current.focus()},[i,n]);const u=f=>{if(f.key==="Enter"&&t){const d=s;d.trim()&&(t(d+`
786
+ `),c(""))}};return o.jsxs("div",{ref:a,style:{backgroundColor:"#1e1e1e",color:"#d4d4d4",fontFamily:'Consolas, "Courier New", monospace',fontSize:"14px",padding:"16px",borderRadius:"8px",overflow:"auto",maxHeight:"400px",minHeight:"200px",border:i?"2px solid #4ec9b0":"1px solid #3e3e3e",cursor:"text",transition:"border-color 0.3s"},children:[e.map((f,d)=>o.jsx("div",{style:{marginBottom:"4px",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:f},d)),!n&&t&&o.jsxs("div",{style:{display:"flex",alignItems:"center",marginTop:"8px"},children:[o.jsx("span",{style:{marginRight:"8px",color:"#4ec9b0"},children:r}),o.jsx("input",{ref:l,type:"password",value:s,onChange:f=>c(f.target.value),onKeyDown:u,style:{backgroundColor:"transparent",border:"none",color:"#d4d4d4",fontFamily:'Consolas, "Courier New", monospace',fontSize:"14px",outline:"none",flex:1},autoFocus:!0,placeholder:i?"请输入密码...":""})]}),i&&o.jsx("div",{style:{marginTop:"8px",fontSize:"12px",color:"#4ec9b0"},children:"💡 请输入您的系统密码以继续安装"})]})}function Wie({status:e,onClose:t,onInstallComplete:n}){const[r,i]=h.useState("idle"),[a,l]=h.useState(null),[s,c]=h.useState([]),[u,f]=h.useState(""),[d,p]=h.useState(!1),m=h.useRef(null);h.useEffect(()=>()=>{m.current&&m.current()},[]);const g=h.useCallback(()=>{i("idle"),l(null),c([]),f(""),p(!1)},[]),y=h.useCallback(O=>{const R=O==="claude-code"?"@anthropic-ai/claude-code":"@openai/codex",A=window.navigator.platform;let N=[];return A.includes("Win")?N=["打开命令提示符(CMD)或 PowerShell","执行以下命令:",`npm install -g ${R}`]:N=["打开终端","执行以下命令(需要输入管理员密码):",`sudo npm install -g ${R}`,"输入您的系统密码"],N},[]),x=h.useCallback(O=>{if(r!=="installing"){console.log(`[Frontend] 开始安装 ${O}`),l(O),i("installing"),f(""),p(!1),c([`正在连接到服务器...
787
+ `,`准备安装 ${O==="claude-code"?"Claude Code":"Codex"}...
788
+ `,`请稍候...
789
+ `]);try{m.current=V.installTool(O,{onStdout:A=>{console.log("[Frontend] stdout:",A),c(N=>[...N,A])},onStderr:A=>{console.log("[Frontend] stderr:",A),c(N=>[...N,A]),(A.includes("password")||A.includes("Password")||A.includes("密码"))&&p(!0)},onClose:(A,N)=>{console.log(`[Frontend] 安装完成,退出码: ${A}, 成功: ${N}`),p(!1),c(_=>[..._,N?`
790
+ ✓ 安装成功!`:`
791
+ ✗ 安装失败 (退出码: ${A})`]),i(N?"completed":"error"),f(N?"":`安装失败,退出码: ${A}`),N&&setTimeout(()=>{n()},1500)},onError:A=>{console.error("[Frontend] 安装错误:",A),c(N=>[...N,`[ERROR] ${A}`]),p(!1),i("error"),f(A)}});const R=setTimeout(()=>{i(A=>A==="installing"&&s.length<=3?(console.error("[Frontend] 连接超时"),c(N=>[...N,`
792
+ [ERROR] 连接服务器超时!`]),f("连接服务器超时"),"error"):A)},15e3);m.current||(m.current=()=>clearTimeout(R))}catch(R){console.error("[Frontend] 启动安装失败:",R),c(A=>[...A,`[ERROR] 启动安装失败: ${R}`]),i("error"),f(String(R))}}},[r,n]),v=h.useCallback(O=>{var R;console.log("[Frontend] 发送用户输入:",O.slice(0,10)),(R=m.current)!=null&&R.sendInput&&(m.current.sendInput(O),c(A=>[...A,`
793
+ $ ${"•".repeat(O.length)}
794
+ `]),p(!1))},[]),b=!e.claudeCode.installed||!e.codex.installed,w=r==="idle",S=r==="installing",C=r==="completed",j=r==="error",E=a?y(a):[];return o.jsxs("div",{className:"modal-overlay",children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:t,"aria-label":"关闭",disabled:S,style:S?{opacity:.3,cursor:"not-allowed"}:void 0,children:"×"}),o.jsx("div",{className:"modal",style:{maxWidth:"800px"},children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:"🔧 工具安装检测"})}),o.jsxs("div",{style:{padding:"20px 0"},children:[w&&o.jsxs(o.Fragment,{children:[o.jsx("p",{style:{marginBottom:"16px",lineHeight:"1.6",color:"var(--text-secondary)"},children:"检测到您的系统中缺少以下 AI 编程工具。"}),o.jsxs("div",{style:{marginBottom:"20px"},children:[o.jsx("div",{style:{padding:"12px",marginBottom:"12px",borderRadius:"6px",backgroundColor:e.claudeCode.installed?"#f0fdf4":"#fef3c7",border:`1px solid ${e.claudeCode.installed?"#86efac":"#fbbf24"}`},children:o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o.jsxs("div",{children:[o.jsxs("div",{style:{fontWeight:"500",marginBottom:"4px"},children:["Claude Code ",e.claudeCode.installed&&`(${e.claudeCode.version})`]}),o.jsx("div",{style:{fontSize:"13px",color:"var(--text-secondary)"},children:e.claudeCode.installed?"✓ 已安装":"✗ 未安装"})]}),!e.claudeCode.installed&&o.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>x("claude-code"),disabled:S,style:{fontSize:"13px",padding:"6px 12px"},children:"安装"})]})}),o.jsx("div",{style:{padding:"12px",borderRadius:"6px",backgroundColor:e.codex.installed?"#f0fdf4":"#fef3c7",border:`1px solid ${e.codex.installed?"#86efac":"#fbbf24"}`},children:o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o.jsxs("div",{children:[o.jsxs("div",{style:{fontWeight:"500",marginBottom:"4px"},children:["Codex ",e.codex.installed&&`(${e.codex.version})`]}),o.jsx("div",{style:{fontSize:"13px",color:"var(--text-secondary)"},children:e.codex.installed?"✓ 已安装":"✗ 未安装"})]}),!e.codex.installed&&o.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>x("codex"),disabled:S,style:{fontSize:"13px",padding:"6px 12px"},children:"安装"})]})})]}),b&&o.jsxs("div",{style:{padding:"12px",borderRadius:"6px",backgroundColor:"#fffbeb",border:"1px solid #fbbf24",fontSize:"13px",lineHeight:"1.6"},children:[o.jsx("strong",{children:"⚠️ 注意:"}),o.jsxs("ul",{style:{margin:"8px 0 0 0",paddingLeft:"20px"},children:[o.jsx("li",{children:"在 macOS 和 Linux 上安装需要管理员权限,可能需要输入 sudo 密码"}),o.jsx("li",{children:"如果提示输入密码,请在下方的终端输入框中输入"}),o.jsx("li",{children:"Windows 用户通常会自动完成安装"}),o.jsx("li",{children:"安装过程可能需要几分钟时间,请耐心等待"})]})]})]}),(S||j)&&o.jsxs(o.Fragment,{children:[o.jsx("p",{style:{marginBottom:"16px",lineHeight:"1.6"},children:j?o.jsxs(o.Fragment,{children:["安装 ",o.jsx("strong",{children:a==="claude-code"?"Claude Code":"Codex"})," 时出错"]}):o.jsxs(o.Fragment,{children:["正在安装 ",o.jsx("strong",{children:a==="claude-code"?"Claude Code":"Codex"}),"..."]})}),o.jsx(Uie,{output:s,readOnly:!1,onInput:v,waitingForInput:d,placeholder:d?"密码:":"$ "}),j&&E.length>0&&o.jsxs("div",{style:{marginTop:"16px",padding:"16px",borderRadius:"6px",backgroundColor:"#f0f9ff",border:"1px solid #7dd3fc"},children:[o.jsx("div",{style:{fontWeight:"600",marginBottom:"12px",color:"#0369a1"},children:"📖 手动安装步骤"}),o.jsx("ol",{style:{margin:0,paddingLeft:"20px",lineHeight:"1.8"},children:E.map((O,R)=>o.jsx("li",{style:{marginBottom:R<E.length-1?"8px":"0"},children:O},R))}),o.jsx("div",{style:{marginTop:"12px",fontSize:"13px",color:"#0369a1"},children:"💡 如果自动安装失败,您可以在终端中手动执行上述命令来安装工具。"})]}),j&&u&&o.jsxs("div",{style:{marginTop:"12px",padding:"12px",borderRadius:"6px",backgroundColor:"#fee",border:"1px solid #fcc",fontSize:"13px"},children:[o.jsx("strong",{children:"错误:"})," ",u]})]}),C&&o.jsxs("div",{style:{padding:"20px",borderRadius:"6px",backgroundColor:"#f0fdf4",border:"1px solid #86efac",textAlign:"center"},children:[o.jsx("div",{style:{fontSize:"48px",marginBottom:"12px"},children:"✓"}),o.jsx("div",{style:{fontWeight:"500",marginBottom:"8px"},children:"安装完成!"}),o.jsx("div",{style:{fontSize:"13px",color:"var(--text-secondary)"},children:"您现在可以正常使用 AI Code Switch 了"})]})]}),w&&o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{type:"button",className:"btn btn-secondary",onClick:t,children:"稍后安装"}),o.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>{e.claudeCode.installed?e.codex.installed||x("codex"):x("claude-code")},disabled:e.claudeCode.installed&&e.codex.installed,children:"一键安装所需工具"})]}),C&&o.jsx("div",{className:"modal-footer",children:o.jsx("button",{type:"button",className:"btn btn-primary",onClick:t,children:"完成"})}),j&&o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{type:"button",className:"btn btn-secondary",onClick:t,children:"关闭"}),o.jsx("button",{type:"button",className:"btn btn-primary",onClick:g,children:"重试"})]})]})}),o.jsx("style",{children:`
795
+ @keyframes spin {
796
+ 0% { transform: rotate(0deg); }
797
+ 100% { transform: rotate(360deg); }
798
+ }
799
+ `})]})}function Kie({toolName:e="both",onInstallClick:t,onClose:n}){const[r,i]=h.useState(!1),a=()=>{i(!0),setTimeout(()=>{n()},300)},l=()=>e==="claude-code"?"Claude Code":e==="codex"?"Codex":"Claude Code / Codex";return o.jsx("div",{className:`notification-bar ${r?"notification-bar-closing":""}`,style:{position:"fixed",top:"20px",right:"20px",backgroundColor:"#fef3c7",border:"1px solid #fbbf24",borderRadius:"8px",padding:"16px 20px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",zIndex:9999,maxWidth:"400px",transition:"all 0.3s ease",opacity:r?0:1,transform:r?"translateX(100%)":"translateX(0)"},children:o.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px"},children:[o.jsx("div",{style:{fontSize:"24px",flexShrink:0},children:"⚠️"}),o.jsxs("div",{style:{flex:1},children:[o.jsx("div",{style:{fontWeight:"600",marginBottom:"4px",fontSize:"15px"},children:"工具未安装"}),o.jsxs("div",{style:{fontSize:"13px",color:"#666",marginBottom:"12px",lineHeight:"1.5"},children:["检测到您的系统中缺少 ",o.jsx("strong",{children:l()}),"。"]}),o.jsxs("div",{style:{display:"flex",gap:"8px"},children:[o.jsx("button",{type:"button",className:"btn btn-primary",onClick:t,style:{fontSize:"13px",padding:"6px 14px"},children:"立即安装"}),o.jsx("button",{type:"button",className:"btn btn-secondary",onClick:a,style:{fontSize:"13px",padding:"6px 14px"},children:"稍后"})]})]}),o.jsx("button",{type:"button",onClick:a,style:{background:"none",border:"none",fontSize:"20px",color:"#999",cursor:"pointer",padding:"0",width:"24px",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",flexShrink:0},onMouseEnter:s=>{s.currentTarget.style.backgroundColor="#f0f0f0"},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent"},children:"×"})]})})}function li({children:e,text:t,showTooltip:n}){const[r,i]=h.useState(!1);return o.jsxs("div",{className:"nav-item-with-tooltip",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[e,n&&r&&o.jsx("div",{className:"nav-tooltip",children:t})]})}const Hie=""+new URL("logo-CRx_w1Ov.png",import.meta.url).href,Vie="升级到 v5.0.0 版本将会有破坏性影响,你需要注意:\n\n* 我们移除了 `Deepseek` 类型的服务,它原本的 `reasoning_content` 特殊字段已被合并进入 `chat completions` 类型,升级会自动完成数据库迁移,你不需要手动修改。\n* 我们启用了新的数据流格式转化器,请你实时关注新版本,如遇到问题,我们会实时修复发布新版本。\n* 我们对路由管理进行了升级,现在你可以将 aicodeswitch 使用于其他**任意的编程工具**,之需要填写对应的 API 即可。升级后,路由本身不再绑定claude-code/codex,你需要在Claude Code配置、Codex配置中,激活想要用来服务的路由,让这两个最重要的编程工具能够正常工作(我们会在升级过程中帮你自动迁移数据库,因此,你不需要手动处理)。\n\n";function qie(){const e=Vp(),[t,n]=h.useState("light"),[r,i]=h.useState(!1),[a,l]=h.useState(!1),[s,c]=h.useState(!1),[u,f]=h.useState(!1),[d,p]=h.useState(!1),[m,g]=h.useState(null),[y,x]=h.useState(null),[v,b]=h.useState(!1),w=IB(),[S,C]=h.useState(!1),[j,E]=h.useState(!1),[O,R]=h.useState(""),[A,N]=h.useState(""),[_,q]=h.useState(!0),[W,I]=h.useState(!1),[F,K]=h.useState(""),[M,B]=h.useState(!1),[k,L]=h.useState(!1),[Q,T]=h.useState(!1),[ce,ve]=h.useState(null),[X,oe]=h.useState(!1);h.useEffect(()=>{const ye=localStorage.getItem("theme")||"light";n(ye),document.documentElement.setAttribute("data-theme",ye),localStorage.getItem("sidebar-collapsed")==="true"&&f(!0)},[]),h.useEffect(()=>{const ye=async()=>{try{const ze=await V.checkVersion();p(ze.hasUpdate),g(ze.latestVersion),x(ze.currentVersion)}catch(ze){console.error("Failed to check version:",ze)}};ye();const Ee=setInterval(ye,6e4);return()=>clearInterval(Ee)},[]),h.useEffect(()=>{(async()=>{try{const Ee=await V.getAuthStatus();if(C(Ee.enabled),!Ee.enabled){E(!0),q(!1);return}if(!localStorage.getItem("auth_token")){q(!1);return}try{await V.getVendors(),E(!0)}catch{}}catch(Ee){console.error("Failed to check auth status:",Ee)}finally{q(!1)}})()},[]),h.useEffect(()=>{(async()=>{if(!M)try{const Ee=await V.getUpgrade();Ee.shouldShow&&Ee.content&&(K(Ee.content),I(!0)),B(!0)}catch(Ee){console.error("Failed to check upgrade:",Ee)}})()},[M]),h.useEffect(()=>{const ye=async()=>{if(X)return;if(localStorage.getItem("tools_install_completed")==="true"){oe(!0);return}try{const ze=await V.getToolsStatus();ve(ze),!ze.claudeCode.installed||!ze.codex.installed?T(!0):localStorage.setItem("tools_install_completed","true"),oe(!0)}catch(ze){console.error("Failed to check tools status:",ze),oe(!0)}};(!_&&j||!_&&!S)&&ye()},[X,_,j,S]),h.useEffect(()=>{(async()=>{try{(await V.getVendors()).length===0&&!a&&(i(!0),l(!0))}catch(Ee){console.error("Failed to check vendors:",Ee)}})()},[a]);const fe=()=>{const ye=t==="light"?"dark":"light";n(ye),document.documentElement.setAttribute("data-theme",ye),localStorage.setItem("theme",ye)},te=()=>{f(!u),localStorage.setItem("sidebar-collapsed",(!u).toString())},Z=h.useRef(null),[se,re]=h.useState({scrollable:!1,atTop:!0,atBottom:!0});h.useEffect(()=>{const ye=Z.current;if(!ye)return;const Ee=()=>{const Y=ye.scrollHeight-ye.clientHeight>2;re({scrollable:Y,atTop:ye.scrollTop<=1,atBottom:ye.scrollTop+ye.clientHeight>=ye.scrollHeight-1})};Ee();let ze=0;const ht=()=>{cancelAnimationFrame(ze),ze=requestAnimationFrame(Ee)},ee=new ResizeObserver(ht);return ee.observe(ye),ye.addEventListener("scroll",ht,{passive:!0}),()=>{cancelAnimationFrame(ze),ee.disconnect(),ye.removeEventListener("scroll",ht)}},[S,u]);const Oe=!u&&se.scrollable,ne=()=>{i(!1),e("/vendors")},_e=async()=>{try{await V.acknowledgeUpgrade()}catch(ye){console.error("Failed to acknowledge upgrade:",ye)}I(!1)},Re=()=>{T(!1)},Fe=()=>{T(!1),L(!0)},rt=()=>{L(!1)},Be=async()=>{try{const ye=await V.getToolsStatus();ve(ye),ye.claudeCode.installed&&ye.codex.installed&&(localStorage.setItem("tools_install_completed","true"),T(!1)),setTimeout(()=>{L(!1),(!ye.claudeCode.installed||!ye.codex.installed)&&T(!0)},500)}catch(ye){console.error("Failed to refresh tools status:",ye)}},qe=async ye=>{if(ye.preventDefault(),N(""),!O.trim()){N("请输入鉴权码");return}try{const Ee=await V.login(O);localStorage.setItem("auth_token",Ee.token),E(!0),R("")}catch(Ee){Ee instanceof Error?N(Ee.message||"登录失败,请检查鉴权码"):N("登录失败,请检查鉴权码")}};return _?o.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh",fontSize:"18px",color:"var(--text-secondary)"},children:"加载中..."}):S&&!j?o.jsxs("div",{className:"modal-overlay",children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:()=>{},"aria-label":"关闭",disabled:!0,style:{opacity:.3,cursor:"not-allowed"},children:"×"}),o.jsx("div",{className:"modal",style:{maxWidth:"400px"},children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:"🔐 系统鉴权"})}),o.jsxs("form",{onSubmit:qe,children:[o.jsxs("div",{style:{padding:"20px 0"},children:[o.jsx("p",{style:{marginBottom:"16px",lineHeight:"1.6",color:"var(--text-secondary)"},children:"系统已启用鉴权保护,请输入鉴权码以继续访问。"}),o.jsxs("div",{style:{marginBottom:"16px"},children:[o.jsx("label",{style:{display:"block",marginBottom:"8px",fontWeight:"500"},children:"鉴权码"}),o.jsx("input",{type:"password",value:O,onChange:ye=>R(ye.target.value),placeholder:"请输入鉴权码",style:{width:"100%",padding:"10px 12px",border:"1px solid var(--border-color)",borderRadius:"6px",fontSize:"14px",boxSizing:"border-box"},autoFocus:!0})]}),A&&o.jsx("div",{style:{padding:"10px 12px",backgroundColor:"#fee",border:"1px solid #fcc",borderRadius:"6px",color:"#c33",fontSize:"14px",marginBottom:"16px"},children:A})]}),o.jsx("div",{className:"modal-footer",children:o.jsx("button",{type:"submit",className:"btn btn-primary",style:{width:"100%"},children:"登录"})})]})]})})]}):o.jsxs("div",{className:"app",children:[o.jsxs("nav",{className:`sidebar ${u?"collapsed":""}`,children:[o.jsxs("div",{className:"logo",children:[o.jsx("img",{src:Hie,alt:"AI Code Switch Logo",className:"logo-image"}),o.jsx("h2",{children:"AI Code Switch"})]}),o.jsxs("div",{className:"nav-menu-wrap",children:[o.jsxs("ul",{className:"nav-menu",ref:Z,children:[o.jsx("li",{children:o.jsx(li,{text:"路由管理",showTooltip:u,children:o.jsxs(ri,{to:"/",children:[o.jsx("span",{className:"nav-icon",children:"🌏"}),o.jsx("span",{className:"nav-text",children:"路由管理"})]})})}),o.jsx("li",{children:o.jsx(li,{text:"供应商管理",showTooltip:u,children:o.jsxs(ri,{to:"/vendors",children:[o.jsx("span",{className:"nav-icon",children:"🏭"}),o.jsx("span",{className:"nav-text",children:"供应商管理"})]})})}),o.jsx("li",{children:o.jsx(li,{text:"Skills 管理",showTooltip:u,children:o.jsxs(ri,{to:"/skills",children:[o.jsx("span",{className:"nav-icon",children:"🧩"}),o.jsx("span",{className:"nav-text",children:"Skills 管理"})]})})}),o.jsx("li",{children:o.jsx(li,{text:"MCP 管理",showTooltip:u,children:o.jsxs(ri,{to:"/mcp",children:[o.jsx("span",{className:"nav-icon",children:"🧰"}),o.jsx("span",{className:"nav-text",children:"MCP 管理"})]})})}),S&&o.jsxs(o.Fragment,{children:[o.jsx("li",{className:"nav-divider",children:o.jsx("hr",{style:{border:"none",borderTop:"1px solid var(--border-primary)",margin:"4px 8px"}})}),o.jsx("li",{children:o.jsx(li,{text:"API Key",showTooltip:u,children:o.jsxs(ri,{to:"/access-keys",children:[o.jsx("span",{className:"nav-icon",children:"🔑"}),o.jsx("span",{className:"nav-text",children:"API Key"})]})})})]}),o.jsx("li",{className:"nav-divider",children:o.jsx("hr",{style:{border:"none",borderTop:"1px solid var(--border-primary)",margin:"4px 8px"}})}),o.jsx("li",{children:o.jsx(li,{text:"数据统计",showTooltip:u,children:o.jsxs(ri,{to:"/statistics",children:[o.jsx("span",{className:"nav-icon",children:"📊"}),o.jsx("span",{className:"nav-text",children:"数据统计"})]})})}),!S&&o.jsxs(o.Fragment,{children:[o.jsx("li",{children:o.jsx(li,{text:"会话",showTooltip:u,children:o.jsxs(ri,{to:"/sessions",children:[o.jsx("span",{className:"nav-icon",children:"💬"}),o.jsx("span",{className:"nav-text",children:"会话"})]})})}),o.jsx("li",{children:o.jsx(li,{text:"日志",showTooltip:u,children:o.jsxs(ri,{to:"/logs",children:[o.jsx("span",{className:"nav-icon",children:"🪵"}),o.jsx("span",{className:"nav-text",children:"日志"})]})})})]}),o.jsx("li",{children:o.jsx(li,{text:"设置",showTooltip:u,children:o.jsxs(ri,{to:"/settings",children:[o.jsx("span",{className:"nav-icon",children:"⚙️"}),o.jsx("span",{className:"nav-text",children:"设置"})]})})}),o.jsx("li",{children:o.jsx(li,{text:"使用说明",showTooltip:u,children:o.jsxs(ri,{to:"/usage",children:[o.jsx("span",{className:"nav-icon",children:"📖"}),o.jsx("span",{className:"nav-text",children:"使用说明"})]})})})]}),Oe&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`nav-scroll-shadow nav-scroll-shadow--top${se.atTop?" is-hidden":""}`,"aria-hidden":"true"}),o.jsx("div",{className:`nav-scroll-shadow nav-scroll-shadow--bottom${se.atBottom?" is-hidden":""}`,"aria-hidden":"true",children:o.jsx("span",{className:"nav-scroll-wheel",children:o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"6",y:"3",width:"12",height:"18",rx:"6"}),o.jsx("line",{x1:"12",y1:"7",x2:"12",y2:"11"})]})})})]})]}),o.jsxs("div",{className:"theme-toggle",children:[o.jsx("button",{onClick:fe,className:"theme-mode-btn",children:t==="dark"?"🌙":"☀️"}),o.jsx("a",{href:"https://github.com/tangshuang/aicodeswitch",target:"_blank",rel:"noopener noreferrer",className:"github-link",title:"GitHub",children:o.jsx("svg",{viewBox:"0 0 16 16",width:"20",height:"20",fill:"currentColor",children:o.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"})})}),y&&o.jsx("div",{className:`version-info-wrapper ${d?"has-update":""}`,onClick:()=>b(!0),style:{cursor:"pointer"},children:o.jsxs("div",{className:"version-info",children:["v",y,d&&o.jsx("span",{className:"version-badge"})]})}),o.jsx("button",{onClick:te,className:"sidebar-toggle-btn",title:u?"展开侧边栏":"收起侧边栏",children:u?"»":"«"})]})]}),o.jsx("main",{className:"main-content",children:o.jsxs(Pz,{children:[o.jsx(Gn,{path:"/",element:o.jsx(Ij,{})}),o.jsx(Gn,{path:"/statistics",element:o.jsx(Die,{})}),o.jsx(Gn,{path:"/routes",element:o.jsx(Ij,{})}),o.jsx(Gn,{path:"/vendors",element:o.jsx(DB,{})}),o.jsx(Gn,{path:"/skills",element:o.jsx(Lie,{})}),o.jsx(Gn,{path:"/mcp",element:o.jsx($ie,{})}),o.jsx(Gn,{path:"/access-keys",element:S?o.jsx(Bie,{}):o.jsx(od,{to:"/"})}),o.jsx(Gn,{path:"/access-keys/:id",element:S?o.jsx(Fie,{}):o.jsx(od,{to:"/"})}),o.jsx(Gn,{path:"/sessions",element:S?o.jsx(od,{to:"/"}):o.jsx(k8,{})}),o.jsx(Gn,{path:"/logs",element:S?o.jsx(od,{to:"/"}):o.jsx(h8,{})}),o.jsx(Gn,{path:"/write-config",element:o.jsx(P8,{})}),o.jsx(Gn,{path:"/settings",element:o.jsx(C8,{})}),o.jsx(Gn,{path:"/usage",element:o.jsx(T8,{})})]})}),r&&o.jsxs("div",{className:"modal-overlay",children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:()=>i(!1),"aria-label":"关闭",children:"×"}),o.jsx("div",{className:"modal",children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:"⚠️ 需要配置供应商"})}),o.jsxs("div",{style:{padding:"20px 0"},children:[o.jsx("p",{style:{marginBottom:"16px",lineHeight:"1.6"},children:"检测到系统中没有配置任何API供应商。在没有供应商的情况下,路由将无法正常工作。"}),o.jsx("p",{style:{marginBottom:"0",lineHeight:"1.6",fontWeight:"500"},children:"请先添加至少一个供应商,然后再配置路由规则。"})]}),o.jsxs("div",{className:"modal-footer",style:{justifyContent:"space-between"},children:[o.jsx("button",{type:"button",className:"btn",style:{background:"linear-gradient(135deg, #8B5CF6, #7C3AED)",color:"white",position:"relative",overflow:"hidden"},onClick:()=>{i(!1),c(!0)},children:"一键配置"}),o.jsxs("div",{style:{display:"flex",gap:"10px"},children:[o.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>i(!1),children:"稍后"}),o.jsx("button",{type:"button",className:"btn btn-secondary",onClick:ne,children:"前往供应商管理"})]})]})]})})]}),o.jsx(KT,{show:s,onClose:()=>c(!1),onComplete:()=>l(!0)}),W&&o.jsx("div",{className:"modal-overlay",children:o.jsx("div",{className:"modal",style:{maxWidth:"800px",maxHeight:"80vh",overflow:"auto"},children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:"📋 升级提示"})}),o.jsx("div",{className:"modal-body",children:o.jsx("div",{className:"markdown-content",children:o.jsx(gc,{children:F})})}),o.jsx("div",{className:"modal-footer",children:o.jsx("button",{type:"button",className:"btn btn-primary",onClick:_e,children:"我知道了"})})]})})}),Q&&ce&&o.jsx(Kie,{toolName:!ce.claudeCode.installed&&!ce.codex.installed?"both":ce.claudeCode.installed?"codex":"claude-code",onInstallClick:Fe,onClose:Re}),k&&ce&&o.jsx(Wie,{status:ce,onClose:rt,onInstallComplete:Be}),v&&o.jsxs("div",{className:"modal-overlay",children:[o.jsx("button",{type:"button",className:"modal-close-btn",onClick:()=>b(!1),"aria-label":"关闭",children:"×"}),o.jsx("div",{className:"modal",style:{maxWidth:"700px",maxHeight:"80vh",overflow:"auto"},children:o.jsxs("div",{className:"modal-container",children:[o.jsx("div",{className:"modal-header",children:o.jsx("h2",{children:"📦 版本信息"})}),o.jsxs("div",{style:{padding:"20px 0"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px",backgroundColor:"var(--bg-secondary)",borderRadius:"8px",marginBottom:"20px"},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:"12px",color:"var(--text-secondary)",marginBottom:"4px"},children:"当前版本"}),o.jsxs("div",{style:{fontSize:"18px",fontWeight:"600"},children:["v",y]})]}),d?o.jsxs(o.Fragment,{children:[o.jsx("div",{style:{fontSize:"24px",color:"var(--text-secondary)"},children:"→"}),o.jsxs("div",{style:{textAlign:"right"},children:[o.jsx("div",{style:{fontSize:"12px",color:"var(--text-secondary)",marginBottom:"4px"},children:"最新版本"}),o.jsxs("div",{style:{fontSize:"18px",fontWeight:"600"},children:["v",m]})]})]}):o.jsx("div",{style:{padding:"6px 12px",backgroundColor:"#d4edda",color:"#155724",borderRadius:"4px",fontSize:"14px",fontWeight:"500"},children:"已是最新版本"})]}),d&&o.jsxs("div",{style:{padding:"16px",backgroundColor:"var(--bg-info-blue)",border:"1px solid var(--border-info-blue)",borderRadius:"8px",marginBottom:"20px"},children:[o.jsx("div",{style:{fontSize:"14px",marginBottom:"8px",fontWeight:"500",color:"var(--text-primary)"},children:"更新命令:"}),o.jsx("code",{style:{display:"block",padding:"8px 12px",backgroundColor:"var(--bg-secondary)",border:"1px solid var(--border-primary)",borderRadius:"4px",fontSize:"13px",color:"var(--accent-danger)"},children:"npm i -g aicodeswitch@latest"})]}),d?w?o.jsx("div",{className:"markdown-content",style:{maxHeight:"400px",overflow:"auto"},children:o.jsx(gc,{children:w})}):null:o.jsxs("div",{className:"markdown-content",children:[o.jsx("h4",{style:{marginBottom:12},children:"当前版本提示:"}),o.jsx(gc,{children:Vie})]})]}),o.jsx("div",{className:"modal-footer",children:o.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>b(!1),children:"关闭"})})]})})]})]})}function Yie(){return o.jsx(Mz,{children:o.jsx(NB,{children:o.jsxs(UB,{children:[o.jsx(qie,{}),o.jsx(MB,{})]})})})}jg.createRoot(document.getElementById("root")).render(o.jsx(FP.StrictMode,{children:o.jsx(Yie,{})}));