function UV(e,t){for(var n=0;nr[a]})}}}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 a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();var xp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function St(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var b0={exports:{}},Ud={};var zk;function HV(){if(zk)return Ud;zk=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,o){var l=null;if(o!==void 0&&(l=""+o),a.key!==void 0&&(l=""+a.key),"key"in a){o={};for(var u in a)u!=="key"&&(o[u]=a[u])}else o=a;return a=o.ref,{$$typeof:e,type:r,key:l,ref:a!==void 0?a:null,props:o}}return Ud.Fragment=t,Ud.jsx=n,Ud.jsxs=n,Ud}var qk;function WV(){return qk||(qk=1,b0.exports=HV()),b0.exports}var i=WV(),w0={exports:{}},Ve={};var Fk;function VV(){if(Fk)return Ve;Fk=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),g=Symbol.iterator;function x($){return $===null||typeof $!="object"?null:($=g&&$[g]||$["@@iterator"],typeof $=="function"?$:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,w={};function N($,B,Y){this.props=$,this.context=B,this.refs=w,this.updater=Y||j}N.prototype.isReactComponent={},N.prototype.setState=function($,B){if(typeof $!="object"&&typeof $!="function"&&$!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,$,B,"setState")},N.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function A(){}A.prototype=N.prototype;function E($,B,Y){this.props=$,this.context=B,this.refs=w,this.updater=Y||j}var T=E.prototype=new A;T.constructor=E,b(T,N.prototype),T.isPureReactComponent=!0;var C=Array.isArray;function k(){}var O={H:null,A:null,T:null,S:null},M=Object.prototype.hasOwnProperty;function I($,B,Y){var ne=Y.ref;return{$$typeof:e,type:$,key:B,ref:ne!==void 0?ne:null,props:Y}}function z($,B){return I($.type,B,$.props)}function D($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function H($){var B={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(Y){return B[Y]})}var V=/\/+/g;function F($,B){return typeof $=="object"&&$!==null&&$.key!=null?H(""+$.key):B.toString(36)}function G($){switch($.status){case"fulfilled":return $.value;case"rejected":throw $.reason;default:switch(typeof $.status=="string"?$.then(k,k):($.status="pending",$.then(function(B){$.status==="pending"&&($.status="fulfilled",$.value=B)},function(B){$.status==="pending"&&($.status="rejected",$.reason=B)})),$.status){case"fulfilled":return $.value;case"rejected":throw $.reason}}throw $}function L($,B,Y,ne,oe){var xe=typeof $;(xe==="undefined"||xe==="boolean")&&($=null);var ee=!1;if($===null)ee=!0;else switch(xe){case"bigint":case"string":case"number":ee=!0;break;case"object":switch($.$$typeof){case e:case t:ee=!0;break;case m:return ee=$._init,L(ee($._payload),B,Y,ne,oe)}}if(ee)return oe=oe($),ee=ne===""?"."+F($,0):ne,C(oe)?(Y="",ee!=null&&(Y=ee.replace(V,"$&/")+"/"),L(oe,B,Y,"",function(pe){return pe})):oe!=null&&(D(oe)&&(oe=z(oe,Y+(oe.key==null||$&&$.key===oe.key?"":(""+oe.key).replace(V,"$&/")+"/")+ee)),B.push(oe)),1;ee=0;var ae=ne===""?".":ne+":";if(C($))for(var Z=0;Z<$.length;Z++)ne=$[Z],xe=ae+F(ne,Z),ee+=L(ne,B,Y,xe,oe);else if(Z=x($),typeof Z=="function")for($=Z.call($),Z=0;!(ne=$.next()).done;)ne=ne.value,xe=ae+F(ne,Z++),ee+=L(ne,B,Y,xe,oe);else if(xe==="object"){if(typeof $.then=="function")return L(G($),B,Y,ne,oe);throw B=String($),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return ee}function R($,B,Y){if($==null)return $;var ne=[],oe=0;return L($,ne,"","",function(xe){return B.call(Y,xe,oe++)}),ne}function U($){if($._status===-1){var B=$._result;B=B(),B.then(function(Y){($._status===0||$._status===-1)&&($._status=1,$._result=Y)},function(Y){($._status===0||$._status===-1)&&($._status=2,$._result=Y)}),$._status===-1&&($._status=0,$._result=B)}if($._status===1)return $._result.default;throw $._result}var K=typeof reportError=="function"?reportError:function($){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof $=="object"&&$!==null&&typeof $.message=="string"?String($.message):String($),error:$});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",$);return}console.error($)},te={map:R,forEach:function($,B,Y){R($,function(){B.apply(this,arguments)},Y)},count:function($){var B=0;return R($,function(){B++}),B},toArray:function($){return R($,function(B){return B})||[]},only:function($){if(!D($))throw Error("React.Children.only expected to receive a single React element child.");return $}};return Ve.Activity=p,Ve.Children=te,Ve.Component=N,Ve.Fragment=n,Ve.Profiler=a,Ve.PureComponent=E,Ve.StrictMode=r,Ve.Suspense=d,Ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,Ve.__COMPILER_RUNTIME={__proto__:null,c:function($){return O.H.useMemoCache($)}},Ve.cache=function($){return function(){return $.apply(null,arguments)}},Ve.cacheSignal=function(){return null},Ve.cloneElement=function($,B,Y){if($==null)throw Error("The argument must be a React element, but you passed "+$+".");var ne=b({},$.props),oe=$.key;if(B!=null)for(xe in B.key!==void 0&&(oe=""+B.key),B)!M.call(B,xe)||xe==="key"||xe==="__self"||xe==="__source"||xe==="ref"&&B.ref===void 0||(ne[xe]=B[xe]);var xe=arguments.length-2;if(xe===1)ne.children=Y;else if(1>>1,te=L[K];if(0>>1;K<$;){var B=2*(K+1)-1,Y=L[B],ne=B+1,oe=L[ne];if(0>a(Y,U))nea(oe,Y)?(L[K]=oe,L[ne]=U,K=ne):(L[K]=Y,L[B]=U,K=B);else if(nea(oe,U))L[K]=oe,L[ne]=U,K=ne;else break e}}return R}function a(L,R){var U=L.sortIndex-R.sortIndex;return U!==0?U:L.id-R.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var d=[],f=[],m=1,p=null,g=3,x=!1,j=!1,b=!1,w=!1,N=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function T(L){for(var R=n(f);R!==null;){if(R.callback===null)r(f);else if(R.startTime<=L)r(f),R.sortIndex=R.expirationTime,t(d,R);else break;R=n(f)}}function C(L){if(b=!1,T(L),!j)if(n(d)!==null)j=!0,k||(k=!0,H());else{var R=n(f);R!==null&&G(C,R.startTime-L)}}var k=!1,O=-1,M=5,I=-1;function z(){return w?!0:!(e.unstable_now()-IL&&z());){var K=p.callback;if(typeof K=="function"){p.callback=null,g=p.priorityLevel;var te=K(p.expirationTime<=L);if(L=e.unstable_now(),typeof te=="function"){p.callback=te,T(L),R=!0;break t}p===n(d)&&r(d),T(L)}else r(d);p=n(d)}if(p!==null)R=!0;else{var $=n(f);$!==null&&G(C,$.startTime-L),R=!1}}break e}finally{p=null,g=U,x=!1}R=void 0}}finally{R?H():k=!1}}}var H;if(typeof E=="function")H=function(){E(D)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,F=V.port2;V.port1.onmessage=D,H=function(){F.postMessage(null)}}else H=function(){N(D,0)};function G(L,R){O=N(function(){L(e.unstable_now())},R)}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(L){L.callback=null},e.unstable_forceFrameRate=function(L){0>L||125K?(L.sortIndex=U,t(f,L),n(d)===null&&L===n(f)&&(b?(A(O),O=-1):b=!0,G(C,U-K))):(L.sortIndex=te,t(d,L),j||x||(j=!0,k||(k=!0,H()))),L},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(L){var R=g;return function(){var U=g;g=R;try{return L.apply(this,arguments)}finally{g=U}}}})(_0)),_0}var Wk;function YV(){return Wk||(Wk=1,S0.exports=GV()),S0.exports}var N0={exports:{}},ir={};var Vk;function KV(){if(Vk)return ir;Vk=1;var e=wh();function t(d){var f="https://react.dev/errors/"+d;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),N0.exports=KV(),N0.exports}var Yk;function XV(){if(Yk)return Hd;Yk=1;var e=YV(),t=wh(),n=HL();function r(s){var c="https://react.dev/errors/"+s;if(1te||(s.current=K[te],K[te]=null,te--)}function Y(s,c){te++,K[te]=s.current,s.current=c}var ne=$(null),oe=$(null),xe=$(null),ee=$(null);function ae(s,c){switch(Y(xe,c),Y(oe,s),Y(ne,null),c.nodeType){case 9:case 11:s=(s=c.documentElement)&&(s=s.namespaceURI)?ck(s):0;break;default:if(s=c.tagName,c=c.namespaceURI)c=ck(c),s=uk(c,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}B(ne),Y(ne,s)}function Z(){B(ne),B(oe),B(xe)}function pe(s){s.memoizedState!==null&&Y(ee,s);var c=ne.current,h=uk(c,s.type);c!==h&&(Y(oe,s),Y(ne,h))}function je(s){oe.current===s&&(B(ne),B(oe)),ee.current===s&&(B(ee),Bd._currentValue=U)}var le,Re;function _e(s){if(le===void 0)try{throw Error()}catch(h){var c=h.stack.trim().match(/\n( *(at )?)/);le=c&&c[1]||"",Re=-1)":-1S||X[v]!==se[S]){var ge=` `+X[v].replace(" at new "," at ");return s.displayName&&ge.includes("")&&(ge=ge.replace("",s.displayName)),ge}while(1<=v&&0<=S);break}}}finally{me=!1,Error.prepareStackTrace=h}return(h=s?s.displayName||s.name:"")?_e(h):""}function Le(s,c){switch(s.tag){case 26:case 27:case 5:return _e(s.type);case 16:return _e("Lazy");case 13:return s.child!==c&&c!==null?_e("Suspense Fallback"):_e("Suspense");case 19:return _e("SuspenseList");case 0:case 15:return ve(s.type,!1);case 11:return ve(s.type.render,!1);case 1:return ve(s.type,!0);case 31:return _e("Activity");default:return""}}function It(s){try{var c="",h=null;do c+=Le(s,h),h=s,s=s.return;while(s);return c}catch(v){return` Error generating stack: `+v.message+` `+v.stack}}var Cn=Object.prototype.hasOwnProperty,vr=e.unstable_scheduleCallback,rr=e.unstable_cancelCallback,gr=e.unstable_shouldYield,ct=e.unstable_requestPaint,rt=e.unstable_now,$n=e.unstable_getCurrentPriorityLevel,gs=e.unstable_ImmediatePriority,im=e.unstable_UserBlockingPriority,Rl=e.unstable_NormalPriority,ax=e.unstable_LowPriority,om=e.unstable_IdlePriority,ix=e.log,ox=e.unstable_setDisableYieldValue,ys=null,yr=null;function Ka(s){if(typeof ix=="function"&&ox(s),yr&&typeof yr.setStrictMode=="function")try{yr.setStrictMode(ys,s)}catch{}}var ar=Math.clz32?Math.clz32:zt,sx=Math.log,et=Math.LN2;function zt(s){return s>>>=0,s===0?32:31-(sx(s)/et|0)|0}var He=256,gt=262144,In=4194304;function tt(s){var c=s&42;if(c!==0)return c;switch(s&-s){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Dl(s,c,h){var v=s.pendingLanes;if(v===0)return 0;var S=0,_=s.suspendedLanes,P=s.pingedLanes;s=s.warmLanes;var q=v&134217727;return q!==0?(v=q&~_,v!==0?S=tt(v):(P&=q,P!==0?S=tt(P):h||(h=q&~s,h!==0&&(S=tt(h))))):(q=v&~_,q!==0?S=tt(q):P!==0?S=tt(P):h||(h=v&~s,h!==0&&(S=tt(h)))),S===0?0:c!==0&&c!==S&&(c&_)===0&&(_=S&-S,h=c&-c,_>=h||_===32&&(h&4194048)!==0)?c:S}function xs(s,c){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&c)===0}function lx(s,c){switch(s){case 1:case 2:case 4:case 8:case 64:return c+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return c+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function $l(){var s=In;return In<<=1,(In&62914560)===0&&(In=4194304),s}function bs(s){for(var c=[],h=0;31>h;h++)c.push(s);return c}function Ju(s,c){s.pendingLanes|=c,c!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function kW(s,c,h,v,S,_){var P=s.pendingLanes;s.pendingLanes=h,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=h,s.entangledLanes&=h,s.errorRecoveryDisabledLanes&=h,s.shellSuspendCounter=0;var q=s.entanglements,X=s.expirationTimes,se=s.hiddenUpdates;for(h=P&~h;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var IW=/[\n"\\]/g;function la(s){return s.replace(IW,function(c){return"\\"+c.charCodeAt(0).toString(16)+" "})}function mx(s,c,h,v,S,_,P,q){s.name="",P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?s.type=P:s.removeAttribute("type"),c!=null?P==="number"?(c===0&&s.value===""||s.value!=c)&&(s.value=""+sa(c)):s.value!==""+sa(c)&&(s.value=""+sa(c)):P!=="submit"&&P!=="reset"||s.removeAttribute("value"),c!=null?px(s,P,sa(c)):h!=null?px(s,P,sa(h)):v!=null&&s.removeAttribute("value"),S==null&&_!=null&&(s.defaultChecked=!!_),S!=null&&(s.checked=S&&typeof S!="function"&&typeof S!="symbol"),q!=null&&typeof q!="function"&&typeof q!="symbol"&&typeof q!="boolean"?s.name=""+sa(q):s.removeAttribute("name")}function rA(s,c,h,v,S,_,P,q){if(_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(s.type=_),c!=null||h!=null){if(!(_!=="submit"&&_!=="reset"||c!=null)){hx(s);return}h=h!=null?""+sa(h):"",c=c!=null?""+sa(c):h,q||c===s.value||(s.value=c),s.defaultValue=c}v=v??S,v=typeof v!="function"&&typeof v!="symbol"&&!!v,s.checked=q?s.checked:!!v,s.defaultChecked=!!v,P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"&&(s.name=P),hx(s)}function px(s,c,h){c==="number"&&cm(s.ownerDocument)===s||s.defaultValue===""+h||(s.defaultValue=""+h)}function Fl(s,c,h,v){if(s=s.options,c){c={};for(var S=0;S"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bx=!1;if(Ci)try{var rd={};Object.defineProperty(rd,"passive",{get:function(){bx=!0}}),window.addEventListener("test",rd,rd),window.removeEventListener("test",rd,rd)}catch{bx=!1}var po=null,wx=null,dm=null;function uA(){if(dm)return dm;var s,c=wx,h=c.length,v,S="value"in po?po.value:po.textContent,_=S.length;for(s=0;s=od),vA=" ",gA=!1;function yA(s,c){switch(s){case"keyup":return d7.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xA(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Vl=!1;function h7(s,c){switch(s){case"compositionend":return xA(c);case"keypress":return c.which!==32?null:(gA=!0,vA);case"textInput":return s=c.data,s===vA&&gA?null:s;default:return null}}function m7(s,c){if(Vl)return s==="compositionend"||!Cx&&yA(s,c)?(s=uA(),dm=wx=po=null,Vl=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1=c)return{node:h,offset:c-s};s=v}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=OA(h)}}function AA(s,c){return s&&c?s===c?!0:s&&s.nodeType===3?!1:c&&c.nodeType===3?AA(s,c.parentNode):"contains"in s?s.contains(c):s.compareDocumentPosition?!!(s.compareDocumentPosition(c)&16):!1:!1}function TA(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var c=cm(s.document);c instanceof s.HTMLIFrameElement;){try{var h=typeof c.contentWindow.location.href=="string"}catch{h=!1}if(h)s=c.contentWindow;else break;c=cm(s.document)}return c}function Ax(s){var c=s&&s.nodeName&&s.nodeName.toLowerCase();return c&&(c==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||c==="textarea"||s.contentEditable==="true")}var j7=Ci&&"documentMode"in document&&11>=document.documentMode,Gl=null,Tx=null,ud=null,kx=!1;function kA(s,c,h){var v=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;kx||Gl==null||Gl!==cm(v)||(v=Gl,"selectionStart"in v&&Ax(v)?v={start:v.selectionStart,end:v.selectionEnd}:(v=(v.ownerDocument&&v.ownerDocument.defaultView||window).getSelection(),v={anchorNode:v.anchorNode,anchorOffset:v.anchorOffset,focusNode:v.focusNode,focusOffset:v.focusOffset}),ud&&cd(ud,v)||(ud=v,v=ap(Tx,"onSelect"),0>=P,S-=P,Xa=1<<32-ar(c)+S|h<Je?(dt=De,De=null):dt=De.sibling;var mt=ce(re,De,ie[Je],be);if(mt===null){De===null&&(De=dt);break}s&&De&&mt.alternate===null&&c(re,De),Q=_(mt,Q,Je),ht===null?Ie=mt:ht.sibling=mt,ht=mt,De=dt}if(Je===ie.length)return h(re,De),ft&&Ei(re,Je),Ie;if(De===null){for(;JeJe?(dt=De,De=null):dt=De.sibling;var Io=ce(re,De,mt.value,be);if(Io===null){De===null&&(De=dt);break}s&&De&&Io.alternate===null&&c(re,De),Q=_(Io,Q,Je),ht===null?Ie=Io:ht.sibling=Io,ht=Io,De=dt}if(mt.done)return h(re,De),ft&&Ei(re,Je),Ie;if(De===null){for(;!mt.done;Je++,mt=ie.next())mt=we(re,mt.value,be),mt!==null&&(Q=_(mt,Q,Je),ht===null?Ie=mt:ht.sibling=mt,ht=mt);return ft&&Ei(re,Je),Ie}for(De=v(De);!mt.done;Je++,mt=ie.next())mt=he(De,re,Je,mt.value,be),mt!==null&&(s&&mt.alternate!==null&&De.delete(mt.key===null?Je:mt.key),Q=_(mt,Q,Je),ht===null?Ie=mt:ht.sibling=mt,ht=mt);return s&&De.forEach(function(FV){return c(re,FV)}),ft&&Ei(re,Je),Ie}function Pt(re,Q,ie,be){if(typeof ie=="object"&&ie!==null&&ie.type===b&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case x:e:{for(var Ie=ie.key;Q!==null;){if(Q.key===Ie){if(Ie=ie.type,Ie===b){if(Q.tag===7){h(re,Q.sibling),be=S(Q,ie.props.children),be.return=re,re=be;break e}}else if(Q.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===M&&ks(Ie)===Q.type){h(re,Q.sibling),be=S(Q,ie.props),vd(be,ie),be.return=re,re=be;break e}h(re,Q);break}else c(re,Q);Q=Q.sibling}ie.type===b?(be=Cs(ie.props.children,re.mode,be,ie.key),be.return=re,re=be):(be=wm(ie.type,ie.key,ie.props,null,re.mode,be),vd(be,ie),be.return=re,re=be)}return P(re);case j:e:{for(Ie=ie.key;Q!==null;){if(Q.key===Ie)if(Q.tag===4&&Q.stateNode.containerInfo===ie.containerInfo&&Q.stateNode.implementation===ie.implementation){h(re,Q.sibling),be=S(Q,ie.children||[]),be.return=re,re=be;break e}else{h(re,Q);break}else c(re,Q);Q=Q.sibling}be=Lx(ie,re.mode,be),be.return=re,re=be}return P(re);case M:return ie=ks(ie),Pt(re,Q,ie,be)}if(G(ie))return Ae(re,Q,ie,be);if(H(ie)){if(Ie=H(ie),typeof Ie!="function")throw Error(r(150));return ie=Ie.call(ie),ze(re,Q,ie,be)}if(typeof ie.then=="function")return Pt(re,Q,Em(ie),be);if(ie.$$typeof===E)return Pt(re,Q,_m(re,ie),be);Am(re,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,Q!==null&&Q.tag===6?(h(re,Q.sibling),be=S(Q,ie),be.return=re,re=be):(h(re,Q),be=Ix(ie,re.mode,be),be.return=re,re=be),P(re)):h(re,Q)}return function(re,Q,ie,be){try{pd=0;var Ie=Pt(re,Q,ie,be);return ac=null,Ie}catch(De){if(De===rc||De===Cm)throw De;var ht=qr(29,De,null,re.mode);return ht.lanes=be,ht.return=re,ht}finally{}}}var Ps=eT(!0),tT=eT(!1),bo=!1;function Xx(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Zx(s,c){s=s.updateQueue,c.updateQueue===s&&(c.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function wo(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function jo(s,c,h){var v=s.updateQueue;if(v===null)return null;if(v=v.shared,(yt&2)!==0){var S=v.pending;return S===null?c.next=c:(c.next=S.next,S.next=c),v.pending=c,c=bm(s),LA(s,null,h),c}return xm(s,v,c,h),bm(s)}function gd(s,c,h){if(c=c.updateQueue,c!==null&&(c=c.shared,(h&4194048)!==0)){var v=c.lanes;v&=s.pendingLanes,h|=v,c.lanes=h,VE(s,h)}}function Qx(s,c){var h=s.updateQueue,v=s.alternate;if(v!==null&&(v=v.updateQueue,h===v)){var S=null,_=null;if(h=h.firstBaseUpdate,h!==null){do{var P={lane:h.lane,tag:h.tag,payload:h.payload,callback:null,next:null};_===null?S=_=P:_=_.next=P,h=h.next}while(h!==null);_===null?S=_=c:_=_.next=c}else S=_=c;h={baseState:v.baseState,firstBaseUpdate:S,lastBaseUpdate:_,shared:v.shared,callbacks:v.callbacks},s.updateQueue=h;return}s=h.lastBaseUpdate,s===null?h.firstBaseUpdate=c:s.next=c,h.lastBaseUpdate=c}var Jx=!1;function yd(){if(Jx){var s=nc;if(s!==null)throw s}}function xd(s,c,h,v){Jx=!1;var S=s.updateQueue;bo=!1;var _=S.firstBaseUpdate,P=S.lastBaseUpdate,q=S.shared.pending;if(q!==null){S.shared.pending=null;var X=q,se=X.next;X.next=null,P===null?_=se:P.next=se,P=X;var ge=s.alternate;ge!==null&&(ge=ge.updateQueue,q=ge.lastBaseUpdate,q!==P&&(q===null?ge.firstBaseUpdate=se:q.next=se,ge.lastBaseUpdate=X))}if(_!==null){var we=S.baseState;P=0,ge=se=X=null,q=_;do{var ce=q.lane&-536870913,he=ce!==q.lane;if(he?(ut&ce)===ce:(v&ce)===ce){ce!==0&&ce===tc&&(Jx=!0),ge!==null&&(ge=ge.next={lane:0,tag:q.tag,payload:q.payload,callback:null,next:null});e:{var Ae=s,ze=q;ce=c;var Pt=h;switch(ze.tag){case 1:if(Ae=ze.payload,typeof Ae=="function"){we=Ae.call(Pt,we,ce);break e}we=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=ze.payload,ce=typeof Ae=="function"?Ae.call(Pt,we,ce):Ae,ce==null)break e;we=p({},we,ce);break e;case 2:bo=!0}}ce=q.callback,ce!==null&&(s.flags|=64,he&&(s.flags|=8192),he=S.callbacks,he===null?S.callbacks=[ce]:he.push(ce))}else he={lane:ce,tag:q.tag,payload:q.payload,callback:q.callback,next:null},ge===null?(se=ge=he,X=we):ge=ge.next=he,P|=ce;if(q=q.next,q===null){if(q=S.shared.pending,q===null)break;he=q,q=he.next,he.next=null,S.lastBaseUpdate=he,S.shared.pending=null}}while(!0);ge===null&&(X=we),S.baseState=X,S.firstBaseUpdate=se,S.lastBaseUpdate=ge,_===null&&(S.shared.lanes=0),Oo|=P,s.lanes=P,s.memoizedState=we}}function nT(s,c){if(typeof s!="function")throw Error(r(191,s));s.call(c)}function rT(s,c){var h=s.callbacks;if(h!==null)for(s.callbacks=null,s=0;s_?_:8;var P=L.T,q={};L.T=q,yb(s,!1,c,h);try{var X=S(),se=L.S;if(se!==null&&se(q,X),X!==null&&typeof X=="object"&&typeof X.then=="function"){var ge=k7(X,v);jd(s,c,ge,Vr(s))}else jd(s,c,v,Vr(s))}catch(we){jd(s,c,{then:function(){},status:"rejected",reason:we},Vr())}finally{R.p=_,P!==null&&q.types!==null&&(P.types=q.types),L.T=P}}function I7(){}function vb(s,c,h,v){if(s.tag!==5)throw Error(r(476));var S=DT(s).queue;RT(s,S,c,U,h===null?I7:function(){return $T(s),h(v)})}function DT(s){var c=s.memoizedState;if(c!==null)return c;c={memoizedState:U,baseState:U,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mi,lastRenderedState:U},next:null};var h={};return c.next={memoizedState:h,baseState:h,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mi,lastRenderedState:h},next:null},s.memoizedState=c,s=s.alternate,s!==null&&(s.memoizedState=c),c}function $T(s){var c=DT(s);c.next===null&&(c=s.alternate.memoizedState),jd(s,c.next.queue,{},Vr())}function gb(){return Xn(Bd)}function IT(){return un().memoizedState}function LT(){return un().memoizedState}function L7(s){for(var c=s.return;c!==null;){switch(c.tag){case 24:case 3:var h=Vr();s=wo(h);var v=jo(c,s,h);v!==null&&(Tr(v,c,h),gd(v,c,h)),c={cache:Vx()},s.payload=c;return}c=c.return}}function B7(s,c,h){var v=Vr();h={lane:v,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Bm(s)?zT(c,h):(h=Dx(s,c,h,v),h!==null&&(Tr(h,s,v),qT(h,c,v)))}function BT(s,c,h){var v=Vr();jd(s,c,h,v)}function jd(s,c,h,v){var S={lane:v,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null};if(Bm(s))zT(c,S);else{var _=s.alternate;if(s.lanes===0&&(_===null||_.lanes===0)&&(_=c.lastRenderedReducer,_!==null))try{var P=c.lastRenderedState,q=_(P,h);if(S.hasEagerState=!0,S.eagerState=q,zr(q,P))return xm(s,c,S,0),Lt===null&&ym(),!1}catch{}finally{}if(h=Dx(s,c,S,v),h!==null)return Tr(h,s,v),qT(h,c,v),!0}return!1}function yb(s,c,h,v){if(v={lane:2,revertLane:Xb(),gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},Bm(s)){if(c)throw Error(r(479))}else c=Dx(s,h,v,2),c!==null&&Tr(c,s,2)}function Bm(s){var c=s.alternate;return s===Ke||c!==null&&c===Ke}function zT(s,c){oc=Mm=!0;var h=s.pending;h===null?c.next=c:(c.next=h.next,h.next=c),s.pending=c}function qT(s,c,h){if((h&4194048)!==0){var v=c.lanes;v&=s.pendingLanes,h|=v,c.lanes=h,VE(s,h)}}var Sd={readContext:Xn,use:Dm,useCallback:rn,useContext:rn,useEffect:rn,useImperativeHandle:rn,useLayoutEffect:rn,useInsertionEffect:rn,useMemo:rn,useReducer:rn,useRef:rn,useState:rn,useDebugValue:rn,useDeferredValue:rn,useTransition:rn,useSyncExternalStore:rn,useId:rn,useHostTransitionStatus:rn,useFormState:rn,useActionState:rn,useOptimistic:rn,useMemoCache:rn,useCacheRefresh:rn};Sd.useEffectEvent=rn;var FT={readContext:Xn,use:Dm,useCallback:function(s,c){return xr().memoizedState=[s,c===void 0?null:c],s},useContext:Xn,useEffect:NT,useImperativeHandle:function(s,c,h){h=h!=null?h.concat([s]):null,Im(4194308,4,AT.bind(null,c,s),h)},useLayoutEffect:function(s,c){return Im(4194308,4,s,c)},useInsertionEffect:function(s,c){Im(4,2,s,c)},useMemo:function(s,c){var h=xr();c=c===void 0?null:c;var v=s();if(Rs){Ka(!0);try{s()}finally{Ka(!1)}}return h.memoizedState=[v,c],v},useReducer:function(s,c,h){var v=xr();if(h!==void 0){var S=h(c);if(Rs){Ka(!0);try{h(c)}finally{Ka(!1)}}}else S=c;return v.memoizedState=v.baseState=S,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:S},v.queue=s,s=s.dispatch=B7.bind(null,Ke,s),[v.memoizedState,s]},useRef:function(s){var c=xr();return s={current:s},c.memoizedState=s},useState:function(s){s=db(s);var c=s.queue,h=BT.bind(null,Ke,c);return c.dispatch=h,[s.memoizedState,h]},useDebugValue:mb,useDeferredValue:function(s,c){var h=xr();return pb(h,s,c)},useTransition:function(){var s=db(!1);return s=RT.bind(null,Ke,s.queue,!0,!1),xr().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,c,h){var v=Ke,S=xr();if(ft){if(h===void 0)throw Error(r(407));h=h()}else{if(h=c(),Lt===null)throw Error(r(349));(ut&127)!==0||cT(v,c,h)}S.memoizedState=h;var _={value:h,getSnapshot:c};return S.queue=_,NT(dT.bind(null,v,_,s),[s]),v.flags|=2048,lc(9,{destroy:void 0},uT.bind(null,v,_,h,c),null),h},useId:function(){var s=xr(),c=Lt.identifierPrefix;if(ft){var h=Za,v=Xa;h=(v&~(1<<32-ar(v)-1)).toString(32)+h,c="_"+c+"R_"+h,h=Pm++,0<\/script>",_=_.removeChild(_.firstChild);break;case"select":_=typeof v.is=="string"?P.createElement("select",{is:v.is}):P.createElement("select"),v.multiple?_.multiple=!0:v.size&&(_.size=v.size);break;default:_=typeof v.is=="string"?P.createElement(S,{is:v.is}):P.createElement(S)}}_[Yn]=c,_[_r]=v;e:for(P=c.child;P!==null;){if(P.tag===5||P.tag===6)_.appendChild(P.stateNode);else if(P.tag!==4&&P.tag!==27&&P.child!==null){P.child.return=P,P=P.child;continue}if(P===c)break e;for(;P.sibling===null;){if(P.return===null||P.return===c)break e;P=P.return}P.sibling.return=P.return,P=P.sibling}c.stateNode=_;e:switch(Qn(_,S,v),S){case"button":case"input":case"select":case"textarea":v=!!v.autoFocus;break e;case"img":v=!0;break e;default:v=!1}v&&Ri(c)}}return Kt(c),Mb(c,c.type,s===null?null:s.memoizedProps,c.pendingProps,h),null;case 6:if(s&&c.stateNode!=null)s.memoizedProps!==v&&Ri(c);else{if(typeof v!="string"&&c.stateNode===null)throw Error(r(166));if(s=xe.current,Jl(c)){if(s=c.stateNode,h=c.memoizedProps,v=null,S=Kn,S!==null)switch(S.tag){case 27:case 5:v=S.memoizedProps}s[Yn]=c,s=!!(s.nodeValue===h||v!==null&&v.suppressHydrationWarning===!0||sk(s.nodeValue,h)),s||yo(c,!0)}else s=ip(s).createTextNode(v),s[Yn]=c,c.stateNode=s}return Kt(c),null;case 31:if(h=c.memoizedState,s===null||s.memoizedState!==null){if(v=Jl(c),h!==null){if(s===null){if(!v)throw Error(r(318));if(s=c.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));s[Yn]=c}else Os(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Kt(c),s=!1}else h=Fx(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=h),s=!0;if(!s)return c.flags&256?(Ur(c),c):(Ur(c),null);if((c.flags&128)!==0)throw Error(r(558))}return Kt(c),null;case 13:if(v=c.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(S=Jl(c),v!==null&&v.dehydrated!==null){if(s===null){if(!S)throw Error(r(318));if(S=c.memoizedState,S=S!==null?S.dehydrated:null,!S)throw Error(r(317));S[Yn]=c}else Os(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Kt(c),S=!1}else S=Fx(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=S),S=!0;if(!S)return c.flags&256?(Ur(c),c):(Ur(c),null)}return Ur(c),(c.flags&128)!==0?(c.lanes=h,c):(h=v!==null,s=s!==null&&s.memoizedState!==null,h&&(v=c.child,S=null,v.alternate!==null&&v.alternate.memoizedState!==null&&v.alternate.memoizedState.cachePool!==null&&(S=v.alternate.memoizedState.cachePool.pool),_=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(_=v.memoizedState.cachePool.pool),_!==S&&(v.flags|=2048)),h!==s&&h&&(c.child.flags|=8192),Hm(c,c.updateQueue),Kt(c),null);case 4:return Z(),s===null&&e0(c.stateNode.containerInfo),Kt(c),null;case 10:return Ti(c.type),Kt(c),null;case 19:if(B(cn),v=c.memoizedState,v===null)return Kt(c),null;if(S=(c.flags&128)!==0,_=v.rendering,_===null)if(S)Nd(v,!1);else{if(an!==0||s!==null&&(s.flags&128)!==0)for(s=c.child;s!==null;){if(_=km(s),_!==null){for(c.flags|=128,Nd(v,!1),s=_.updateQueue,c.updateQueue=s,Hm(c,s),c.subtreeFlags=0,s=h,h=c.child;h!==null;)BA(h,s),h=h.sibling;return Y(cn,cn.current&1|2),ft&&Ei(c,v.treeForkCount),c.child}s=s.sibling}v.tail!==null&&rt()>Km&&(c.flags|=128,S=!0,Nd(v,!1),c.lanes=4194304)}else{if(!S)if(s=km(_),s!==null){if(c.flags|=128,S=!0,s=s.updateQueue,c.updateQueue=s,Hm(c,s),Nd(v,!0),v.tail===null&&v.tailMode==="hidden"&&!_.alternate&&!ft)return Kt(c),null}else 2*rt()-v.renderingStartTime>Km&&h!==536870912&&(c.flags|=128,S=!0,Nd(v,!1),c.lanes=4194304);v.isBackwards?(_.sibling=c.child,c.child=_):(s=v.last,s!==null?s.sibling=_:c.child=_,v.last=_)}return v.tail!==null?(s=v.tail,v.rendering=s,v.tail=s.sibling,v.renderingStartTime=rt(),s.sibling=null,h=cn.current,Y(cn,S?h&1|2:h&1),ft&&Ei(c,v.treeForkCount),s):(Kt(c),null);case 22:case 23:return Ur(c),tb(),v=c.memoizedState!==null,s!==null?s.memoizedState!==null!==v&&(c.flags|=8192):v&&(c.flags|=8192),v?(h&536870912)!==0&&(c.flags&128)===0&&(Kt(c),c.subtreeFlags&6&&(c.flags|=8192)):Kt(c),h=c.updateQueue,h!==null&&Hm(c,h.retryQueue),h=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(h=s.memoizedState.cachePool.pool),v=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(v=c.memoizedState.cachePool.pool),v!==h&&(c.flags|=2048),s!==null&&B(Ts),null;case 24:return h=null,s!==null&&(h=s.memoizedState.cache),c.memoizedState.cache!==h&&(c.flags|=2048),Ti(dn),Kt(c),null;case 25:return null;case 30:return null}throw Error(r(156,c.tag))}function H7(s,c){switch(zx(c),c.tag){case 1:return s=c.flags,s&65536?(c.flags=s&-65537|128,c):null;case 3:return Ti(dn),Z(),s=c.flags,(s&65536)!==0&&(s&128)===0?(c.flags=s&-65537|128,c):null;case 26:case 27:case 5:return je(c),null;case 31:if(c.memoizedState!==null){if(Ur(c),c.alternate===null)throw Error(r(340));Os()}return s=c.flags,s&65536?(c.flags=s&-65537|128,c):null;case 13:if(Ur(c),s=c.memoizedState,s!==null&&s.dehydrated!==null){if(c.alternate===null)throw Error(r(340));Os()}return s=c.flags,s&65536?(c.flags=s&-65537|128,c):null;case 19:return B(cn),null;case 4:return Z(),null;case 10:return Ti(c.type),null;case 22:case 23:return Ur(c),tb(),s!==null&&B(Ts),s=c.flags,s&65536?(c.flags=s&-65537|128,c):null;case 24:return Ti(dn),null;case 25:return null;default:return null}}function f2(s,c){switch(zx(c),c.tag){case 3:Ti(dn),Z();break;case 26:case 27:case 5:je(c);break;case 4:Z();break;case 31:c.memoizedState!==null&&Ur(c);break;case 13:Ur(c);break;case 19:B(cn);break;case 10:Ti(c.type);break;case 22:case 23:Ur(c),tb(),s!==null&&B(Ts);break;case 24:Ti(dn)}}function Cd(s,c){try{var h=c.updateQueue,v=h!==null?h.lastEffect:null;if(v!==null){var S=v.next;h=S;do{if((h.tag&s)===s){v=void 0;var _=h.create,P=h.inst;v=_(),P.destroy=v}h=h.next}while(h!==S)}}catch(q){Nt(c,c.return,q)}}function No(s,c,h){try{var v=c.updateQueue,S=v!==null?v.lastEffect:null;if(S!==null){var _=S.next;v=_;do{if((v.tag&s)===s){var P=v.inst,q=P.destroy;if(q!==void 0){P.destroy=void 0,S=c;var X=h,se=q;try{se()}catch(ge){Nt(S,X,ge)}}}v=v.next}while(v!==_)}}catch(ge){Nt(c,c.return,ge)}}function h2(s){var c=s.updateQueue;if(c!==null){var h=s.stateNode;try{rT(c,h)}catch(v){Nt(s,s.return,v)}}}function m2(s,c,h){h.props=Ds(s.type,s.memoizedProps),h.state=s.memoizedState;try{h.componentWillUnmount()}catch(v){Nt(s,c,v)}}function Od(s,c){try{var h=s.ref;if(h!==null){switch(s.tag){case 26:case 27:case 5:var v=s.stateNode;break;case 30:v=s.stateNode;break;default:v=s.stateNode}typeof h=="function"?s.refCleanup=h(v):h.current=v}}catch(S){Nt(s,c,S)}}function Qa(s,c){var h=s.ref,v=s.refCleanup;if(h!==null)if(typeof v=="function")try{v()}catch(S){Nt(s,c,S)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof h=="function")try{h(null)}catch(S){Nt(s,c,S)}else h.current=null}function p2(s){var c=s.type,h=s.memoizedProps,v=s.stateNode;try{e:switch(c){case"button":case"input":case"select":case"textarea":h.autoFocus&&v.focus();break e;case"img":h.src?v.src=h.src:h.srcSet&&(v.srcset=h.srcSet)}}catch(S){Nt(s,s.return,S)}}function Pb(s,c,h){try{var v=s.stateNode;fV(v,s.type,h,c),v[_r]=c}catch(S){Nt(s,s.return,S)}}function v2(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Mo(s.type)||s.tag===4}function Rb(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||v2(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Mo(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Db(s,c,h){var v=s.tag;if(v===5||v===6)s=s.stateNode,c?(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h).insertBefore(s,c):(c=h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,c.appendChild(s),h=h._reactRootContainer,h!=null||c.onclick!==null||(c.onclick=Ni));else if(v!==4&&(v===27&&Mo(s.type)&&(h=s.stateNode,c=null),s=s.child,s!==null))for(Db(s,c,h),s=s.sibling;s!==null;)Db(s,c,h),s=s.sibling}function Wm(s,c,h){var v=s.tag;if(v===5||v===6)s=s.stateNode,c?h.insertBefore(s,c):h.appendChild(s);else if(v!==4&&(v===27&&Mo(s.type)&&(h=s.stateNode),s=s.child,s!==null))for(Wm(s,c,h),s=s.sibling;s!==null;)Wm(s,c,h),s=s.sibling}function g2(s){var c=s.stateNode,h=s.memoizedProps;try{for(var v=s.type,S=c.attributes;S.length;)c.removeAttributeNode(S[0]);Qn(c,v,h),c[Yn]=s,c[_r]=h}catch(_){Nt(s,s.return,_)}}var Di=!1,mn=!1,$b=!1,y2=typeof WeakSet=="function"?WeakSet:Set,Bn=null;function W7(s,c){if(s=s.containerInfo,r0=fp,s=TA(s),Ax(s)){if("selectionStart"in s)var h={start:s.selectionStart,end:s.selectionEnd};else e:{h=(h=s.ownerDocument)&&h.defaultView||window;var v=h.getSelection&&h.getSelection();if(v&&v.rangeCount!==0){h=v.anchorNode;var S=v.anchorOffset,_=v.focusNode;v=v.focusOffset;try{h.nodeType,_.nodeType}catch{h=null;break e}var P=0,q=-1,X=-1,se=0,ge=0,we=s,ce=null;t:for(;;){for(var he;we!==h||S!==0&&we.nodeType!==3||(q=P+S),we!==_||v!==0&&we.nodeType!==3||(X=P+v),we.nodeType===3&&(P+=we.nodeValue.length),(he=we.firstChild)!==null;)ce=we,we=he;for(;;){if(we===s)break t;if(ce===h&&++se===S&&(q=P),ce===_&&++ge===v&&(X=P),(he=we.nextSibling)!==null)break;we=ce,ce=we.parentNode}we=he}h=q===-1||X===-1?null:{start:q,end:X}}else h=null}h=h||{start:0,end:0}}else h=null;for(a0={focusedElem:s,selectionRange:h},fp=!1,Bn=c;Bn!==null;)if(c=Bn,s=c.child,(c.subtreeFlags&1028)!==0&&s!==null)s.return=c,Bn=s;else for(;Bn!==null;){switch(c=Bn,_=c.alternate,s=c.flags,c.tag){case 0:if((s&4)!==0&&(s=c.updateQueue,s=s!==null?s.events:null,s!==null))for(h=0;h title"))),Qn(_,v,h),_[Yn]=s,Ln(_),v=_;break e;case"link":var P=_k("link","href",S).get(v+(h.href||""));if(P){for(var q=0;qPt&&(P=Pt,Pt=ze,ze=P);var re=EA(q,ze),Q=EA(q,Pt);if(re&&Q&&(he.rangeCount!==1||he.anchorNode!==re.node||he.anchorOffset!==re.offset||he.focusNode!==Q.node||he.focusOffset!==Q.offset)){var ie=we.createRange();ie.setStart(re.node,re.offset),he.removeAllRanges(),ze>Pt?(he.addRange(ie),he.extend(Q.node,Q.offset)):(ie.setEnd(Q.node,Q.offset),he.addRange(ie))}}}}for(we=[],he=q;he=he.parentNode;)he.nodeType===1&&we.push({element:he,left:he.scrollLeft,top:he.scrollTop});for(typeof q.focus=="function"&&q.focus(),q=0;qh?32:h,L.T=null,h=Ub,Ub=null;var _=Ao,P=zi;if(On=0,hc=Ao=null,zi=0,(yt&6)!==0)throw Error(r(331));var q=yt;if(yt|=4,A2(_.current),C2(_,_.current,P,h),yt=q,Pd(0,!1),yr&&typeof yr.onPostCommitFiberRoot=="function")try{yr.onPostCommitFiberRoot(ys,_)}catch{}return!0}finally{R.p=S,L.T=v,G2(s,c)}}function K2(s,c,h){c=ua(h,c),c=jb(s.stateNode,c,2),s=jo(s,c,2),s!==null&&(Ju(s,2),Ja(s))}function Nt(s,c,h){if(s.tag===3)K2(s,s,h);else for(;c!==null;){if(c.tag===3){K2(c,s,h);break}else if(c.tag===1){var v=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(Eo===null||!Eo.has(v))){s=ua(h,s),h=XT(2),v=jo(c,h,2),v!==null&&(ZT(h,v,c,s),Ju(v,2),Ja(v));break}}c=c.return}}function Gb(s,c,h){var v=s.pingCache;if(v===null){v=s.pingCache=new Y7;var S=new Set;v.set(c,S)}else S=v.get(c),S===void 0&&(S=new Set,v.set(c,S));S.has(h)||(Bb=!0,S.add(h),s=J7.bind(null,s,c,h),c.then(s,s))}function J7(s,c,h){var v=s.pingCache;v!==null&&v.delete(c),s.pingedLanes|=s.suspendedLanes&h,s.warmLanes&=~h,Lt===s&&(ut&h)===h&&(an===4||an===3&&(ut&62914560)===ut&&300>rt()-Ym?(yt&2)===0&&mc(s,0):zb|=h,fc===ut&&(fc=0)),Ja(s)}function X2(s,c){c===0&&(c=$l()),s=Ns(s,c),s!==null&&(Ju(s,c),Ja(s))}function eV(s){var c=s.memoizedState,h=0;c!==null&&(h=c.retryLane),X2(s,h)}function tV(s,c){var h=0;switch(s.tag){case 31:case 13:var v=s.stateNode,S=s.memoizedState;S!==null&&(h=S.retryLane);break;case 19:v=s.stateNode;break;case 22:v=s.stateNode._retryCache;break;default:throw Error(r(314))}v!==null&&v.delete(c),X2(s,h)}function nV(s,c){return vr(s,c)}var tp=null,vc=null,Yb=!1,np=!1,Kb=!1,ko=0;function Ja(s){s!==vc&&s.next===null&&(vc===null?tp=vc=s:vc=vc.next=s),np=!0,Yb||(Yb=!0,aV())}function Pd(s,c){if(!Kb&&np){Kb=!0;do for(var h=!1,v=tp;v!==null;){if(s!==0){var S=v.pendingLanes;if(S===0)var _=0;else{var P=v.suspendedLanes,q=v.pingedLanes;_=(1<<31-ar(42|s)+1)-1,_&=S&~(P&~q),_=_&201326741?_&201326741|1:_?_|2:0}_!==0&&(h=!0,ek(v,_))}else _=ut,_=Dl(v,v===Lt?_:0,v.cancelPendingCommit!==null||v.timeoutHandle!==-1),(_&3)===0||xs(v,_)||(h=!0,ek(v,_));v=v.next}while(h);Kb=!1}}function rV(){Z2()}function Z2(){np=Yb=!1;var s=0;ko!==0&&mV()&&(s=ko);for(var c=rt(),h=null,v=tp;v!==null;){var S=v.next,_=Q2(v,c);_===0?(v.next=null,h===null?tp=S:h.next=S,S===null&&(vc=h)):(h=v,(s!==0||(_&3)!==0)&&(np=!0)),v=S}On!==0&&On!==5||Pd(s),ko!==0&&(ko=0)}function Q2(s,c){for(var h=s.suspendedLanes,v=s.pingedLanes,S=s.expirationTimes,_=s.pendingLanes&-62914561;0<_;){var P=31-ar(_),q=1<q)break;var ge=X.transferSize,we=X.initiatorType;ge&&lk(we)&&(X=X.responseEnd,P+=ge*(X"u"?null:document;function bk(s,c,h){var v=gc;if(v&&typeof c=="string"&&c){var S=la(c);S='link[rel="'+s+'"][href="'+S+'"]',typeof h=="string"&&(S+='[crossorigin="'+h+'"]'),xk.has(S)||(xk.add(S),s={rel:s,crossOrigin:h,href:c},v.querySelector(S)===null&&(c=v.createElement("link"),Qn(c,"link",s),Ln(c),v.head.appendChild(c)))}}function SV(s){qi.D(s),bk("dns-prefetch",s,null)}function _V(s,c){qi.C(s,c),bk("preconnect",s,c)}function NV(s,c,h){qi.L(s,c,h);var v=gc;if(v&&s&&c){var S='link[rel="preload"][as="'+la(c)+'"]';c==="image"&&h&&h.imageSrcSet?(S+='[imagesrcset="'+la(h.imageSrcSet)+'"]',typeof h.imageSizes=="string"&&(S+='[imagesizes="'+la(h.imageSizes)+'"]')):S+='[href="'+la(s)+'"]';var _=S;switch(c){case"style":_=yc(s);break;case"script":_=xc(s)}va.has(_)||(s=p({rel:"preload",href:c==="image"&&h&&h.imageSrcSet?void 0:s,as:c},h),va.set(_,s),v.querySelector(S)!==null||c==="style"&&v.querySelector(Id(_))||c==="script"&&v.querySelector(Ld(_))||(c=v.createElement("link"),Qn(c,"link",s),Ln(c),v.head.appendChild(c)))}}function CV(s,c){qi.m(s,c);var h=gc;if(h&&s){var v=c&&typeof c.as=="string"?c.as:"script",S='link[rel="modulepreload"][as="'+la(v)+'"][href="'+la(s)+'"]',_=S;switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":_=xc(s)}if(!va.has(_)&&(s=p({rel:"modulepreload",href:s},c),va.set(_,s),h.querySelector(S)===null)){switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(h.querySelector(Ld(_)))return}v=h.createElement("link"),Qn(v,"link",s),Ln(v),h.head.appendChild(v)}}}function OV(s,c,h){qi.S(s,c,h);var v=gc;if(v&&s){var S=zl(v).hoistableStyles,_=yc(s);c=c||"default";var P=S.get(_);if(!P){var q={loading:0,preload:null};if(P=v.querySelector(Id(_)))q.loading=5;else{s=p({rel:"stylesheet",href:s,"data-precedence":c},h),(h=va.get(_))&&d0(s,h);var X=P=v.createElement("link");Ln(X),Qn(X,"link",s),X._p=new Promise(function(se,ge){X.onload=se,X.onerror=ge}),X.addEventListener("load",function(){q.loading|=1}),X.addEventListener("error",function(){q.loading|=2}),q.loading|=4,sp(P,c,v)}P={type:"stylesheet",instance:P,count:1,state:q},S.set(_,P)}}}function EV(s,c){qi.X(s,c);var h=gc;if(h&&s){var v=zl(h).hoistableScripts,S=xc(s),_=v.get(S);_||(_=h.querySelector(Ld(S)),_||(s=p({src:s,async:!0},c),(c=va.get(S))&&f0(s,c),_=h.createElement("script"),Ln(_),Qn(_,"link",s),h.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},v.set(S,_))}}function AV(s,c){qi.M(s,c);var h=gc;if(h&&s){var v=zl(h).hoistableScripts,S=xc(s),_=v.get(S);_||(_=h.querySelector(Ld(S)),_||(s=p({src:s,async:!0,type:"module"},c),(c=va.get(S))&&f0(s,c),_=h.createElement("script"),Ln(_),Qn(_,"link",s),h.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},v.set(S,_))}}function wk(s,c,h,v){var S=(S=xe.current)?op(S):null;if(!S)throw Error(r(446));switch(s){case"meta":case"title":return null;case"style":return typeof h.precedence=="string"&&typeof h.href=="string"?(c=yc(h.href),h=zl(S).hoistableStyles,v=h.get(c),v||(v={type:"style",instance:null,count:0,state:null},h.set(c,v)),v):{type:"void",instance:null,count:0,state:null};case"link":if(h.rel==="stylesheet"&&typeof h.href=="string"&&typeof h.precedence=="string"){s=yc(h.href);var _=zl(S).hoistableStyles,P=_.get(s);if(P||(S=S.ownerDocument||S,P={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},_.set(s,P),(_=S.querySelector(Id(s)))&&!_._p&&(P.instance=_,P.state.loading=5),va.has(s)||(h={rel:"preload",as:"style",href:h.href,crossOrigin:h.crossOrigin,integrity:h.integrity,media:h.media,hrefLang:h.hrefLang,referrerPolicy:h.referrerPolicy},va.set(s,h),_||TV(S,s,h,P.state))),c&&v===null)throw Error(r(528,""));return P}if(c&&v!==null)throw Error(r(529,""));return null;case"script":return c=h.async,h=h.src,typeof h=="string"&&c&&typeof c!="function"&&typeof c!="symbol"?(c=xc(h),h=zl(S).hoistableScripts,v=h.get(c),v||(v={type:"script",instance:null,count:0,state:null},h.set(c,v)),v):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function yc(s){return'href="'+la(s)+'"'}function Id(s){return'link[rel="stylesheet"]['+s+"]"}function jk(s){return p({},s,{"data-precedence":s.precedence,precedence:null})}function TV(s,c,h,v){s.querySelector('link[rel="preload"][as="style"]['+c+"]")?v.loading=1:(c=s.createElement("link"),v.preload=c,c.addEventListener("load",function(){return v.loading|=1}),c.addEventListener("error",function(){return v.loading|=2}),Qn(c,"link",h),Ln(c),s.head.appendChild(c))}function xc(s){return'[src="'+la(s)+'"]'}function Ld(s){return"script[async]"+s}function Sk(s,c,h){if(c.count++,c.instance===null)switch(c.type){case"style":var v=s.querySelector('style[data-href~="'+la(h.href)+'"]');if(v)return c.instance=v,Ln(v),v;var S=p({},h,{"data-href":h.href,"data-precedence":h.precedence,href:null,precedence:null});return v=(s.ownerDocument||s).createElement("style"),Ln(v),Qn(v,"style",S),sp(v,h.precedence,s),c.instance=v;case"stylesheet":S=yc(h.href);var _=s.querySelector(Id(S));if(_)return c.state.loading|=4,c.instance=_,Ln(_),_;v=jk(h),(S=va.get(S))&&d0(v,S),_=(s.ownerDocument||s).createElement("link"),Ln(_);var P=_;return P._p=new Promise(function(q,X){P.onload=q,P.onerror=X}),Qn(_,"link",v),c.state.loading|=4,sp(_,h.precedence,s),c.instance=_;case"script":return _=xc(h.src),(S=s.querySelector(Ld(_)))?(c.instance=S,Ln(S),S):(v=h,(S=va.get(_))&&(v=p({},h),f0(v,S)),s=s.ownerDocument||s,S=s.createElement("script"),Ln(S),Qn(S,"link",v),s.head.appendChild(S),c.instance=S);case"void":return null;default:throw Error(r(443,c.type))}else c.type==="stylesheet"&&(c.state.loading&4)===0&&(v=c.instance,c.state.loading|=4,sp(v,h.precedence,s));return c.instance}function sp(s,c,h){for(var v=h.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),S=v.length?v[v.length-1]:null,_=S,P=0;P title"):null)}function kV(s,c,h){if(h===1||c.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof c.precedence!="string"||typeof c.href!="string"||c.href==="")break;return!0;case"link":if(typeof c.rel!="string"||typeof c.href!="string"||c.href===""||c.onLoad||c.onError)break;switch(c.rel){case"stylesheet":return s=c.disabled,typeof c.precedence=="string"&&s==null;default:return!0}case"script":if(c.async&&typeof c.async!="function"&&typeof c.async!="symbol"&&!c.onLoad&&!c.onError&&c.src&&typeof c.src=="string")return!0}return!1}function Ck(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function MV(s,c,h,v){if(h.type==="stylesheet"&&(typeof v.media!="string"||matchMedia(v.media).matches!==!1)&&(h.state.loading&4)===0){if(h.instance===null){var S=yc(v.href),_=c.querySelector(Id(S));if(_){c=_._p,c!==null&&typeof c=="object"&&typeof c.then=="function"&&(s.count++,s=cp.bind(s),c.then(s,s)),h.state.loading|=4,h.instance=_,Ln(_);return}_=c.ownerDocument||c,v=jk(v),(S=va.get(S))&&d0(v,S),_=_.createElement("link"),Ln(_);var P=_;P._p=new Promise(function(q,X){P.onload=q,P.onerror=X}),Qn(_,"link",v),h.instance=_}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(h,c),(c=h.state.preload)&&(h.state.loading&3)===0&&(s.count++,h=cp.bind(s),c.addEventListener("load",h),c.addEventListener("error",h))}}var h0=0;function PV(s,c){return s.stylesheets&&s.count===0&&dp(s,s.stylesheets),0h0?50:800)+c);return s.unsuspend=h,function(){s.unsuspend=null,clearTimeout(v),clearTimeout(S)}}:null}function cp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)dp(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var up=null;function dp(s,c){s.stylesheets=null,s.unsuspend!==null&&(s.count++,up=new Map,c.forEach(RV,s),up=null,cp.call(s))}function RV(s,c){if(!(c.state.loading&4)){var h=up.get(s);if(h)var v=h.get(null);else{h=new Map,up.set(s,h);for(var S=s.querySelectorAll("link[data-precedence],style[data-precedence]"),_=0;_"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),j0.exports=XV(),j0.exports}var QV=ZV();const c_=new WeakMap,JV=new WeakMap,dv={current:[]};let C0=!1,gf=0;const lf=new Set,bp=new Map;function WL(e){for(const t of e){if(dv.current.includes(t))continue;dv.current.push(t),t.recompute();const n=JV.get(t);if(n)for(const r of n){const a=c_.get(r);a?.length&&WL(a)}}}function eG(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function tG(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function VL(e){if(gf>0&&!bp.has(e)&&bp.set(e,e.prevState),lf.add(e),!(gf>0)&&!C0)try{for(C0=!0;lf.size>0;){const t=Array.from(lf);lf.clear();for(const n of t){const r=bp.get(n)??n.prevState;n.prevState=r,eG(n)}for(const n of t){const r=c_.get(n);r&&(dv.current.push(n),WL(r))}for(const n of t){const r=c_.get(n);if(r)for(const a of r)tG(a)}}}finally{C0=!1,dv.current=[],bp.clear()}}function yf(e){gf++;try{e()}finally{if(gf--,gf===0){const t=lf.values().next().value;t&&VL(t)}}}function nG(e){return typeof e=="function"}class rG{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var a,o;this.listeners.add(r);const l=(o=(a=this.options)==null?void 0:a.onSubscribe)==null?void 0:o.call(a,r,this);return()=>{this.listeners.delete(r),l?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,a;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):nG(t)?this.state=t(this.prevState):this.state=t,(a=(r=this.options)==null?void 0:r.onUpdate)==null||a.call(r),VL(this)}}const Go="__TSR_index",Xk="popstate",Zk="beforeunload";function aG(e){let t=e.getLocation();const n=new Set,r=l=>{t=e.getLocation(),n.forEach(u=>u({location:t,action:l}))},a=l=>{e.notifyOnIndexChange??!0?r(l):t=e.getLocation()},o=async({task:l,navigateOpts:u,...d})=>{if(u?.ignoreBlocker??!1){l();return}const m=e.getBlockers?.()??[],p=d.type==="PUSH"||d.type==="REPLACE";if(typeof document<"u"&&m.length&&p)for(const g of m){const x=fv(d.path,d.state);if(await g.blockerFn({currentLocation:t,nextLocation:x,action:d.type})){e.onBlocked?.();return}}l()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:l=>(n.add(l),()=>{n.delete(l)}),push:(l,u,d)=>{const f=t.state[Go];u=Qk(f+1,u),o({task:()=>{e.pushState(l,u),r({type:"PUSH"})},navigateOpts:d,type:"PUSH",path:l,state:u})},replace:(l,u,d)=>{const f=t.state[Go];u=Qk(f,u),o({task:()=>{e.replaceState(l,u),r({type:"REPLACE"})},navigateOpts:d,type:"REPLACE",path:l,state:u})},go:(l,u)=>{o({task:()=>{e.go(l),a({type:"GO",index:l})},navigateOpts:u,type:"GO"})},back:l=>{o({task:()=>{e.back(l?.ignoreBlocker??!1),a({type:"BACK"})},navigateOpts:l,type:"BACK"})},forward:l=>{o({task:()=>{e.forward(l?.ignoreBlocker??!1),a({type:"FORWARD"})},navigateOpts:l,type:"FORWARD"})},canGoBack:()=>t.state[Go]!==0,createHref:l=>e.createHref(l),block:l=>{if(!e.setBlockers)return()=>{};const u=e.getBlockers?.()??[];return e.setBlockers([...u,l]),()=>{const d=e.getBlockers?.()??[];e.setBlockers?.(d.filter(f=>f!==l))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Qk(e,t){t||(t={});const n=SC();return{...t,key:n,__TSR_key:n,[Go]:e}}function iG(e){const t=typeof document<"u"?window:void 0,n=t.history.pushState,r=t.history.replaceState;let a=[];const o=()=>a,l=M=>a=M,u=(M=>M),d=(()=>fv(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const M=SC();t.history.replaceState({[Go]:0,key:M,__TSR_key:M},"")}let f=d(),m,p=!1,g=!1,x=!1,j=!1;const b=()=>f;let w,N;const A=()=>{w&&(O._ignoreSubscribers=!0,(w.isPush?t.history.pushState:t.history.replaceState)(w.state,"",w.href),O._ignoreSubscribers=!1,w=void 0,N=void 0,m=void 0)},E=(M,I,z)=>{const D=u(I);N||(m=f),f=fv(I,z),w={href:D,state:z,isPush:w?.isPush||M==="push"},N||(N=Promise.resolve().then(()=>A()))},T=M=>{f=d(),O.notify({type:M})},C=async()=>{if(g){g=!1;return}const M=d(),I=M.state[Go]-f.state[Go],z=I===1,D=I===-1,H=!z&&!D||p;p=!1;const V=H?"GO":D?"BACK":"FORWARD",F=H?{type:"GO",index:I}:{type:D?"BACK":"FORWARD"};if(x)x=!1;else{const G=o();if(typeof document<"u"&&G.length){for(const L of G)if(await L.blockerFn({currentLocation:f,nextLocation:M,action:V})){g=!0,t.history.go(1),O.notify(F);return}}}f=d(),O.notify(F)},k=M=>{if(j){j=!1;return}let I=!1;const z=o();if(typeof document<"u"&&z.length)for(const D of z){const H=D.enableBeforeUnload??!0;if(H===!0){I=!0;break}if(typeof H=="function"&&H()===!0){I=!0;break}}if(I)return M.preventDefault(),M.returnValue=""},O=aG({getLocation:b,getLength:()=>t.history.length,pushState:(M,I)=>E("push",M,I),replaceState:(M,I)=>E("replace",M,I),back:M=>(M&&(x=!0),j=!0,t.history.back()),forward:M=>{M&&(x=!0),j=!0,t.history.forward()},go:M=>{p=!0,t.history.go(M)},createHref:M=>u(M),flush:A,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Zk,k,{capture:!0}),t.removeEventListener(Xk,C)},onBlocked:()=>{m&&f!==m&&(f=m)},getBlockers:o,setBlockers:l,notifyOnIndexChange:!1});return t.addEventListener(Zk,k,{capture:!0}),t.addEventListener(Xk,C),t.history.pushState=function(...M){const I=n.apply(t.history,M);return O._ignoreSubscribers||T("PUSH"),I},t.history.replaceState=function(...M){const I=r.apply(t.history,M);return O._ignoreSubscribers||T("REPLACE"),I},O}function fv(e,t){const n=e.indexOf("#"),r=e.indexOf("?"),a=SC();return{href:e,pathname:e.substring(0,n>0?r>0?Math.min(n,r):n:r>0?r:e.length),hash:n>-1?e.substring(n):"",search:r>-1?e.slice(r,n===-1?void 0:n):"",state:t||{[Go]:0,key:a,__TSR_key:a}}}function SC(){return(Math.random()+1).toString(36).substring(7)}function u_(e){return e[e.length-1]}function oG(e){return typeof e=="function"}function Qs(e,t){return oG(e)?e(t):e}const sG=Object.prototype.hasOwnProperty;function wa(e,t){if(e===t)return e;const n=t,r=tM(e)&&tM(n);if(!r&&!(hv(e)&&hv(n)))return n;const a=r?e:Jk(e);if(!a)return n;const o=r?n:Jk(n);if(!o)return n;const l=a.length,u=o.length,d=r?new Array(u):{};let f=0;for(let m=0;m"u")return!0;const n=t.prototype;return!(!eM(n)||!n.hasOwnProperty("isPrototypeOf"))}function eM(e){return Object.prototype.toString.call(e)==="[object Object]"}function tM(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Js(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,a=e.length;ra||!Js(e[l],t[l],n)))return!1;return a===o}return!1}function Qc(e){let t,n;const r=new Promise((a,o)=>{t=a,n=o});return r.status="pending",r.resolve=a=>{r.status="resolved",r.value=a,t(a),e?.(a)},r.reject=a=>{r.status="rejected",n(a)},r}function Yo(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}const lG=Array.from(new Map([["%","%25"],["\\","%5C"]]).values());function nM(e,t=lG){function n(a,o,l=0){for(let u=l;u{try{return decodeURI(u)}catch{return u}})}}if(e===""||!/%[0-9A-Fa-f]{2}/g.test(e))return e;const r=e.replaceAll(/%[0-9a-f]{2}/g,a=>a.toUpperCase());return n(r,t)}var cG="Invariant failed";function ur(e,t){if(!e)throw new Error(cG)}const di=0,ll=1,Jc=2,eu=3;function Qi(e){return _C(e.filter(t=>t!==void 0).join("/"))}function _C(e){return e.replace(/\/{2,}/g,"/")}function NC(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Ko(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function Qp(e){return Ko(NC(e))}function mv(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function uG(e,t,n){return mv(e,n)===mv(t,n)}function dG(e){const{type:t,value:n}=e;if(t===di)return n;const{prefixSegment:r,suffixSegment:a}=e;if(t===ll){const o=n.substring(1);if(r&&a)return`${r}{$${o}}${a}`;if(r)return`${r}{$${o}}`;if(a)return`{$${o}}${a}`}if(t===eu){const o=n.substring(1);return r&&a?`${r}{-$${o}}${a}`:r?`${r}{-$${o}}`:a?`{-$${o}}${a}`:`{-$${o}}`}if(t===Jc){if(r&&a)return`${r}{$}${a}`;if(r)return`${r}{$}`;if(a)return`{$}${a}`}return n}function fG({base:e,to:t,trailingSlash:n="never",parseCache:r}){let a=tu(e,r).slice();const o=tu(t,r);a.length>1&&u_(a)?.value==="/"&&a.pop();for(let d=0,f=o.length;d1&&(u_(a).value==="/"?n==="never"&&a.pop():n==="always"&&a.push({type:di,value:"/"}));const l=a.map(dG);return Qi(l)}const tu=(e,t)=>{if(!e)return[];const n=t?.get(e);if(n)return n;const r=yG(e);return t?.set(e,r),r},hG=/^\$.{1,}$/,mG=/^(.*?)\{(\$[a-zA-Z_$][a-zA-Z0-9_$]*)\}(.*)$/,pG=/^(.*?)\{-(\$[a-zA-Z_$][a-zA-Z0-9_$]*)\}(.*)$/,vG=/^\$$/,gG=/^(.*?)\{\$\}(.*)$/;function yG(e){e=_C(e);const t=[];if(e.slice(0,1)==="/"&&(e=e.substring(1),t.push({type:di,value:"/"})),!e)return t;const n=e.split("/").filter(Boolean);return t.push(...n.map(r=>{const a=r.match(gG);if(a){const u=a[1],d=a[2];return{type:Jc,value:"$",prefixSegment:u||void 0,suffixSegment:d||void 0}}const o=r.match(pG);if(o){const u=o[1],d=o[2],f=o[3];return{type:eu,value:d,prefixSegment:u||void 0,suffixSegment:f||void 0}}const l=r.match(mG);if(l){const u=l[1],d=l[2],f=l[3];return{type:ll,value:""+d,prefixSegment:u||void 0,suffixSegment:f||void 0}}if(hG.test(r)){const u=r.substring(1);return{type:ll,value:"$"+u,prefixSegment:void 0,suffixSegment:void 0}}return vG.test(r)?{type:Jc,value:"$",prefixSegment:void 0,suffixSegment:void 0}:{type:di,value:r}})),e.slice(-1)==="/"&&(e=e.substring(1),t.push({type:di,value:"/"})),t}function O0({path:e,params:t,decodeCharMap:n,parseCache:r}){const a=tu(e,r);function o(f){const m=t[f],p=typeof m=="string";return f==="*"||f==="_splat"?p?encodeURI(m):m:p?xG(m,n):m}let l=!1;const u={},d=Qi(a.map(f=>{if(f.type===di)return f.value;if(f.type===Jc){u._splat=t._splat,u["*"]=t._splat;const m=f.prefixSegment||"",p=f.suffixSegment||"";if(!t._splat)return l=!0,m||p?`${m}${p}`:void 0;const g=o("_splat");return`${m}${g}${p}`}if(f.type===ll){const m=f.value.substring(1);!l&&!(m in t)&&(l=!0),u[m]=t[m];const p=f.prefixSegment||"",g=f.suffixSegment||"";return`${p}${o(m)??"undefined"}${g}`}if(f.type===eu){const m=f.value.substring(1),p=f.prefixSegment||"",g=f.suffixSegment||"";return!(m in t)||t[m]==null?p||g?`${p}${g}`:void 0:(u[m]=t[m],`${p}${o(m)??""}${g}`)}return f.value}));return{usedParams:u,interpolatedPath:d,isMissingParams:l}}function xG(e,t){let n=encodeURIComponent(e);if(t)for(const[r,a]of t)n=n.replaceAll(r,a);return n}function d_(e,t,n){const r=bG(e,t,n);if(!(t.to&&!r))return r??{}}function bG(e,{to:t,fuzzy:n,caseSensitive:r},a){const o=t,l=tu(e.startsWith("/")?e:`/${e}`,a),u=tu(o.startsWith("/")?o:`/${o}`,a),d={};return wG(l,u,d,n,r)?d:void 0}function wG(e,t,n,r,a){let o=0,l=0;for(;ob.value)));p&&j.startsWith(p)&&(j=j.slice(p.length)),g&&j.endsWith(g)&&(j=j.slice(0,j.length-g.length)),m=j}else m=decodeURI(Qi(f.map(p=>p.value)));return n["*"]=m,n._splat=m,!0}if(d.type===di){if(d.value==="/"&&!u?.value){l++;continue}if(u){if(a){if(d.value!==u.value)return!1}else if(d.value.toLowerCase()!==u.value.toLowerCase())return!1;o++,l++;continue}else return!1}if(d.type===ll){if(!u||u.value==="/")return!1;let f="",m=!1;if(d.prefixSegment||d.suffixSegment){const p=d.prefixSegment||"",g=d.suffixSegment||"",x=u.value;if(p&&!x.startsWith(p)||g&&!x.endsWith(g))return!1;let j=x;p&&j.startsWith(p)&&(j=j.slice(p.length)),g&&j.endsWith(g)&&(j=j.slice(0,j.length-g.length)),f=decodeURIComponent(j),m=!0}else f=decodeURIComponent(u.value),m=!0;m&&(n[d.value.substring(1)]=f,o++),l++;continue}if(d.type===eu){if(!u){l++;continue}if(u.value==="/"){l++;continue}let f="",m=!1;if(d.prefixSegment||d.suffixSegment){const p=d.prefixSegment||"",g=d.suffixSegment||"",x=u.value;if((!p||x.startsWith(p))&&(!g||x.endsWith(g))){let j=x;p&&j.startsWith(p)&&(j=j.slice(p.length)),g&&j.endsWith(g)&&(j=j.slice(0,j.length-g.length)),f=decodeURIComponent(j),m=!0}}else{let p=!0;for(let g=l+1;g=t.length)return n["**"]=Qi(e.slice(o).map(f=>f.value)),!!r&&t[t.length-1]?.value!=="/";if(l=e.length){for(let f=l;f{if(r.isRoot||!r.path)return;const o=NC(r.fullPath);let l=tu(o),u=0;for(;l.length>u+1&&l[u]?.value==="/";)u++;u>0&&(l=l.slice(u));let d=0,f=!1;const m=l.map((p,g)=>{if(p.value==="/")return jG;if(p.type===di)return SG;let x;p.type===ll?x=_G:p.type===eu?(x=NG,d++):x=CG;for(let j=g+1;j{const o=Math.min(r.scores.length,a.scores.length);for(let l=0;la.parsed[l].value?1:-1;return r.index-a.index}).map((r,a)=>(r.child.rank=a,r.child))}function MG({routeTree:e,initRoute:t}){const n={},r={},a=l=>{l.forEach((u,d)=>{t?.(u,d);const f=n[u.id];if(ur(!f,`Duplicate routes found with id: ${String(u.id)}`),n[u.id]=u,!u.isRoot&&u.path){const p=Ko(u.fullPath);(!r[p]||u.fullPath.endsWith("/"))&&(r[p]=u)}const m=u.children;m?.length&&a(m)})};a([e]);const o=kG(Object.values(n));return{routesById:n,routesByPath:r,flatRoutes:o}}function Fa(e){return!!e?.isNotFound}function PG(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}const pv="tsr-scroll-restoration-v1_3",RG=(e,t)=>{let n;return(...r)=>{n||(n=setTimeout(()=>{e(...r),n=null},t))}};function DG(){const e=PG();if(!e)return null;const t=e.getItem(pv);let n=t?JSON.parse(t):{};return{state:n,set:r=>(n=Qs(r,n)||n,e.setItem(pv,JSON.stringify(n)))}}const wp=DG(),f_=e=>e.state.__TSR_key||e.href;function $G(e){const t=[];let n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(" > ")}`.toLowerCase()}let vv=!1;function GL({storageKey:e,key:t,behavior:n,shouldScrollRestoration:r,scrollToTopSelectors:a,location:o}){let l;try{l=JSON.parse(sessionStorage.getItem(e)||"{}")}catch(f){console.error(f);return}const u=t||window.history.state?.__TSR_key,d=l[u];vv=!0;e:{if(r&&d&&Object.keys(d).length>0){for(const p in d){const g=d[p];if(p==="window")window.scrollTo({top:g.scrollY,left:g.scrollX,behavior:n});else if(p){const x=document.querySelector(p);x&&(x.scrollLeft=g.scrollX,x.scrollTop=g.scrollY)}}break e}const f=(o??window.location).hash.split("#",2)[1];if(f){const p=window.history.state?.__hashScrollIntoViewOptions??!0;if(p){const g=document.getElementById(f);g&&g.scrollIntoView(p)}break e}const m={top:0,left:0,behavior:n};if(window.scrollTo(m),a)for(const p of a){if(p==="window")continue;const g=typeof p=="function"?p():document.querySelector(p);g&&g.scrollTo(m)}}vv=!1}function IG(e,t){if(!wp&&!e.isServer||((e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isServer||e.isScrollRestorationSetup||!wp))return;e.isScrollRestorationSetup=!0,vv=!1;const r=e.options.getScrollRestorationKey||f_;window.history.scrollRestoration="manual";const a=o=>{if(vv||!e.isScrollRestoring)return;let l="";if(o.target===document||o.target===window)l="window";else{const d=o.target.getAttribute("data-scroll-restoration-id");d?l=`[data-scroll-restoration-id="${d}"]`:l=$G(o.target)}const u=r(e.state.location);wp.set(d=>{const f=d[u]||={},m=f[l]||={};if(l==="window")m.scrollX=window.scrollX||0,m.scrollY=window.scrollY||0;else if(l){const p=document.querySelector(l);p&&(m.scrollX=p.scrollLeft||0,m.scrollY=p.scrollTop||0)}return d})};typeof document<"u"&&document.addEventListener("scroll",RG(a,100),!0),e.subscribe("onRendered",o=>{const l=r(o.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation})||(GL({storageKey:pv,key:l,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&wp.set(u=>(u[l]||={},u)))})}function LG(e){if(typeof document<"u"&&document.querySelector){const t=e.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&e.state.location.hash!==""){const n=document.getElementById(e.state.location.hash);n&&n.scrollIntoView(t)}}}function BG(e,t=String){const n=new URLSearchParams;for(const r in e){const a=e[r];a!==void 0&&n.set(r,t(a))}return n.toString()}function E0(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function zG(e){const t=new URLSearchParams(e),n={};for(const[r,a]of t.entries()){const o=n[r];o==null?n[r]=E0(a):Array.isArray(o)?o.push(E0(a)):n[r]=[o,E0(a)]}return n}const qG=UG(JSON.parse),FG=HG(JSON.stringify,JSON.parse);function UG(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=zG(t);for(const r in n){const a=n[r];if(typeof a=="string")try{n[r]=e(a)}catch{}}return n}}function HG(e,t){const n=typeof t=="function";function r(a){if(typeof a=="object"&&a!==null)try{return e(a)}catch{}else if(n&&typeof a=="string")try{return t(a),e(a)}catch{}return a}return a=>{const o=BG(a,r);return o?`?${o}`:""}}const Zr="__root__";function YL(e){if(e.statusCode=e.statusCode||e.code||307,!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function oi(e){return e instanceof Response&&!!e.options}function WG(e){const t=new Map;let n,r;const a=o=>{o.next&&(o.prev?(o.prev.next=o.next,o.next.prev=o.prev,o.next=void 0,r&&(r.next=o,o.prev=r)):(o.next.prev=void 0,n=o.next,o.next=void 0,r&&(o.prev=r,r.next=o)),r=o)};return{get(o){const l=t.get(o);if(l)return a(l),l.value},set(o,l){if(t.size>=e&&n){const d=n;t.delete(d.key),d.next&&(n=d.next,d.next.prev=void 0),d===r&&(r=void 0)}const u=t.get(o);if(u)u.value=l,a(u);else{const d={key:o,value:l,prev:r};r&&(r.next=d),r=d,n||(n=d),t.set(o,d)}}}}const Jp=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Dg=(e,t)=>!!(e.preload&&!e.router.state.matches.some(n=>n.id===t)),KL=(e,t)=>{const n=e.router.routesById[t.routeId??""]??e.router.routeTree;!n.options.notFoundComponent&&e.router.options?.defaultNotFoundComponent&&(n.options.notFoundComponent=e.router.options.defaultNotFoundComponent),ur(n.options.notFoundComponent);const r=e.matches.find(a=>a.routeId===n.id);ur(r,"Could not find match for route: "+n.id),e.updateMatch(r.id,a=>({...a,status:"notFound",error:t,isFetching:!1})),t.routerCode==="BEFORE_LOAD"&&n.parentRoute&&(t.routeId=n.parentRoute.id,KL(e,t))},Uo=(e,t,n)=>{if(!(!oi(n)&&!Fa(n))){if(oi(n)&&n.redirectHandled&&!n.options.reloadDocument)throw n;if(t){t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0;const r=oi(n)?"redirected":"notFound";t._nonReactive.error=n,e.updateMatch(t.id,a=>({...a,status:r,isFetching:!1,error:n})),Fa(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()}throw oi(n)?(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n),n):(KL(e,n),n)}},XL=(e,t)=>{const n=e.router.getMatch(t);return!!(!e.router.isServer&&n._nonReactive.dehydrated||e.router.isServer&&n.ssr===!1)},Wd=(e,t,n,r)=>{const{id:a,routeId:o}=e.matches[t],l=e.router.looseRoutesById[o];if(n instanceof Promise)throw n;n.routerCode=r,e.firstBadMatchIndex??=t,Uo(e,e.router.getMatch(a),n);try{l.options.onError?.(n)}catch(u){n=u,Uo(e,e.router.getMatch(a),n)}e.updateMatch(a,u=>(u._nonReactive.beforeLoadPromise?.resolve(),u._nonReactive.beforeLoadPromise=void 0,u._nonReactive.loadPromise?.resolve(),{...u,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}))},VG=(e,t,n,r)=>{const a=e.router.getMatch(t),o=e.matches[n-1]?.id,l=o?e.router.getMatch(o):void 0;if(e.router.isShell()){a.ssr=r.id===Zr;return}if(l?.ssr===!1){a.ssr=!1;return}const u=x=>x===!0&&l?.ssr==="data-only"?"data-only":x,d=e.router.options.defaultSsr??!0;if(r.options.ssr===void 0){a.ssr=u(d);return}if(typeof r.options.ssr!="function"){a.ssr=u(r.options.ssr);return}const{search:f,params:m}=a,p={search:jp(f,a.searchError),params:jp(m,a.paramsError),location:e.location,matches:e.matches.map(x=>({index:x.index,pathname:x.pathname,fullPath:x.fullPath,staticData:x.staticData,id:x.id,routeId:x.routeId,search:jp(x.search,x.searchError),params:jp(x.params,x.paramsError),ssr:x.ssr}))},g=r.options.ssr(p);if(Yo(g))return g.then(x=>{a.ssr=u(x??d)});a.ssr=u(g??d)},ZL=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;const a=n.options.pendingMs??e.router.options.defaultPendingMs;if(!!(e.onReady&&!e.router.isServer&&!Dg(e,t)&&(n.options.loader||n.options.beforeLoad||e5(n))&&typeof a=="number"&&a!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent))){const l=setTimeout(()=>{Jp(e)},a);r._nonReactive.pendingTimeout=l}},GG=(e,t,n)=>{const r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;ZL(e,t,n,r);const a=()=>{const o=e.router.getMatch(t);o.preload&&(o.status==="redirected"||o.status==="notFound")&&Uo(e,o,o.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(a):a()},YG=(e,t,n,r)=>{const a=e.router.getMatch(t),o=a._nonReactive.loadPromise;a._nonReactive.loadPromise=Qc(()=>{o?.resolve()});const{paramsError:l,searchError:u}=a;l&&Wd(e,n,l,"PARSE_PARAMS"),u&&Wd(e,n,u,"VALIDATE_SEARCH"),ZL(e,t,r,a);const d=new AbortController,f=e.matches[n-1]?.id,g={...(f?e.router.getMatch(f):void 0)?.context??e.router.options.context??void 0,...a.__routeContext};let x=!1;const j=()=>{x||(x=!0,e.updateMatch(t,O=>({...O,isFetching:"beforeLoad",fetchCount:O.fetchCount+1,abortController:d,context:g})))},b=()=>{a._nonReactive.beforeLoadPromise?.resolve(),a._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,O=>({...O,isFetching:!1}))};if(!r.options.beforeLoad){yf(()=>{j(),b()});return}a._nonReactive.beforeLoadPromise=Qc();const{search:w,params:N,cause:A}=a,E=Dg(e,t),T={search:w,abortController:d,params:N,preload:E,context:g,location:e.location,navigate:O=>e.router.navigate({...O,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:E?"preload":A,matches:e.matches,...e.router.options.additionalContext},C=O=>{if(O===void 0){yf(()=>{j(),b()});return}(oi(O)||Fa(O))&&(j(),Wd(e,n,O,"BEFORE_LOAD")),yf(()=>{j(),e.updateMatch(t,M=>({...M,__beforeLoadContext:O,context:{...M.context,...O}})),b()})};let k;try{if(k=r.options.beforeLoad(T),Yo(k))return j(),k.catch(O=>{Wd(e,n,O,"BEFORE_LOAD")}).then(C)}catch(O){j(),Wd(e,n,O,"BEFORE_LOAD")}C(k)},KG=(e,t)=>{const{id:n,routeId:r}=e.matches[t],a=e.router.looseRoutesById[r],o=()=>{if(e.router.isServer){const d=VG(e,n,t,a);if(Yo(d))return d.then(u)}return u()},l=()=>YG(e,n,t,a),u=()=>{if(XL(e,n))return;const d=GG(e,n,a);return Yo(d)?d.then(l):l()};return o()},xf=(e,t,n)=>{const r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const a={matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(a),n.options.scripts?.(a),n.options.headers?.(a)]).then(([o,l,u])=>{const d=o?.meta,f=o?.links,m=o?.scripts,p=o?.styles;return{meta:d,links:f,headScripts:m,headers:u,scripts:l,styles:p}})},QL=(e,t,n,r)=>{const a=e.matchPromises[n-1],{params:o,loaderDeps:l,abortController:u,cause:d}=e.router.getMatch(t);let f=e.router.options.context??{};for(let p=0;p<=n;p++){const g=e.matches[p];if(!g)continue;const x=e.router.getMatch(g.id);x&&(f={...f,...x.__routeContext??{},...x.__beforeLoadContext??{}})}const m=Dg(e,t);return{params:o,deps:l,preload:!!m,parentMatchPromise:a,abortController:u,context:f,location:e.location,navigate:p=>e.router.navigate({...p,_fromLocation:e.location}),cause:m?"preload":d,route:r,...e.router.options.additionalContext}},oM=async(e,t,n,r)=>{try{const a=e.router.getMatch(t);try{(!e.router.isServer||a.ssr===!0)&&JL(r);const o=r.options.loader?.(QL(e,t,n,r)),l=r.options.loader&&Yo(o);if(!!(l||r._lazyPromise||r._componentsPromise||r.options.head||r.options.scripts||r.options.headers||a._nonReactive.minPendingPromise)&&e.updateMatch(t,p=>({...p,isFetching:"loader"})),r.options.loader){const p=l?await o:o;Uo(e,e.router.getMatch(t),p),p!==void 0&&e.updateMatch(t,g=>({...g,loaderData:p}))}r._lazyPromise&&await r._lazyPromise;const d=xf(e,t,r),f=d?await d:void 0,m=a._nonReactive.minPendingPromise;m&&await m,r._componentsPromise&&await r._componentsPromise,e.updateMatch(t,p=>({...p,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),...f}))}catch(o){let l=o;const u=a._nonReactive.minPendingPromise;u&&await u,Fa(o)&&await r.options.notFoundComponent?.preload?.(),Uo(e,e.router.getMatch(t),o);try{r.options.onError?.(o)}catch(m){l=m,Uo(e,e.router.getMatch(t),m)}const d=xf(e,t,r),f=d?await d:void 0;e.updateMatch(t,m=>({...m,error:l,status:"error",isFetching:!1,...f}))}}catch(a){const o=e.router.getMatch(t);if(o){const l=xf(e,t,r);if(l){const u=await l;e.updateMatch(t,d=>({...d,...u}))}o._nonReactive.loaderPromise=void 0}Uo(e,o,a)}},XG=async(e,t)=>{const{id:n,routeId:r}=e.matches[t];let a=!1,o=!1;const l=e.router.looseRoutesById[r];if(XL(e,n)){if(e.router.isServer){const f=xf(e,n,l);if(f){const m=await f;e.updateMatch(n,p=>({...p,...m}))}return e.router.getMatch(n)}}else{const f=e.router.getMatch(n);if(f._nonReactive.loaderPromise){if(f.status==="success"&&!e.sync&&!f.preload)return f;await f._nonReactive.loaderPromise;const m=e.router.getMatch(n),p=m._nonReactive.error||m.error;p&&Uo(e,m,p)}else{const m=Date.now()-f.updatedAt,p=Dg(e,n),g=p?l.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:l.options.staleTime??e.router.options.defaultStaleTime??0,x=l.options.shouldReload,j=typeof x=="function"?x(QL(e,n,t,l)):x,b=!!p&&!e.router.state.matches.some(E=>E.id===n),w=e.router.getMatch(n);w._nonReactive.loaderPromise=Qc(),b!==w.preload&&e.updateMatch(n,E=>({...E,preload:b}));const{status:N,invalid:A}=w;if(a=N==="success"&&(A||(j??m>g)),!(p&&l.options.preload===!1))if(a&&!e.sync)o=!0,(async()=>{try{await oM(e,n,t,l);const E=e.router.getMatch(n);E._nonReactive.loaderPromise?.resolve(),E._nonReactive.loadPromise?.resolve(),E._nonReactive.loaderPromise=void 0}catch(E){oi(E)&&await e.router.navigate(E.options)}})();else if(N!=="success"||a&&e.sync)await oM(e,n,t,l);else{const E=xf(e,n,l);if(E){const T=await E;e.updateMatch(n,C=>({...C,...T}))}}}}const u=e.router.getMatch(n);o||(u._nonReactive.loaderPromise?.resolve(),u._nonReactive.loadPromise?.resolve()),clearTimeout(u._nonReactive.pendingTimeout),u._nonReactive.pendingTimeout=void 0,o||(u._nonReactive.loaderPromise=void 0),u._nonReactive.dehydrated=void 0;const d=o?u.isFetching:!1;return d!==u.isFetching||u.invalid!==!1?(e.updateMatch(n,f=>({...f,isFetching:d,invalid:!1})),e.router.getMatch(n)):u};async function sM(e){const t=Object.assign(e,{matchPromises:[]});!t.router.isServer&&t.router.state.matches.some(n=>n._forcePending)&&Jp(t);try{for(let a=0;a{const{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0),!e._componentsLoaded&&e._componentsPromise===void 0){const t=()=>{const n=[];for(const r of t5){const a=e.options[r]?.preload;a&&n.push(a())}if(n.length)return Promise.all(n).then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0});e._componentsLoaded=!0,e._componentsPromise=void 0};e._componentsPromise=e._lazyPromise?e._lazyPromise.then(t):t()}return e._componentsPromise}function jp(e,t){return t?{status:"error",error:t}:{status:"success",value:e}}function e5(e){for(const t of t5)if(e.options[t]?.preload)return!0;return!1}const t5=["component","errorComponent","pendingComponent","notFoundComponent"];function ZG(e){return{input:({url:t})=>{for(const n of e)t=n5(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=r5(e[n],t);return t}}}function QG(e){const t=Qp(e.basepath),n=`/${t}`,r=`${n}/`,a=e.caseSensitive?n:n.toLowerCase(),o=e.caseSensitive?r:r.toLowerCase();return{input:({url:l})=>{const u=e.caseSensitive?l.pathname:l.pathname.toLowerCase();return u===a?l.pathname="/":u.startsWith(o)&&(l.pathname=l.pathname.slice(n.length)),l},output:({url:l})=>(l.pathname=Qi(["/",t,l.pathname]),l)}}function n5(e,t){const n=e?.input?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function r5(e,t){const n=e?.output?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function el(e){const t=e.resolvedLocation,n=e.location,r=t?.pathname!==n.pathname,a=t?.href!==n.href,o=t?.hash!==n.hash;return{fromLocation:t,toLocation:n,pathChanged:r,hrefChanged:a,hashChanged:o}}class JG{constructor(t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=n=>n(),this.update=n=>{n.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const r=this.options,a=this.basepath??r?.basepath??"/",o=this.basepath===void 0,l=r?.rewrite;this.options={...r,...n},this.isServer=this.options.isServer??typeof document>"u",this.pathParamsDecodeCharMap=this.options.pathParamsAllowedCharacters?new Map(this.options.pathParamsAllowedCharacters.map(g=>[encodeURIComponent(g),g])):void 0,(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.isServer||(this.history=iG())),this.origin=this.options.origin,this.origin||(!this.isServer&&window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),!this.__store&&this.latestLocation&&(this.__store=new rG(tY(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(g=>!["redirected"].includes(g.status))}}}),IG(this));let u=!1;const d=this.options.basepath??"/",f=this.options.rewrite;if(o||a!==d||l!==f){this.basepath=d;const g=[];Qp(d)!==""&&g.push(QG({basepath:d})),f&&g.push(f),this.rewrite=g.length===0?void 0:g.length===1?g[0]:ZG(g),this.history&&this.updateLatestLocation(),u=!0}u&&this.__store&&(this.__store.state={...this.state,location:this.latestLocation}),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const{routesById:n,routesByPath:r,flatRoutes:a}=MG({routeTree:this.routeTree,initRoute:(l,u)=>{l.init({originalIndex:u})}});this.routesById=n,this.routesByPath=r,this.flatRoutes=a;const o=this.options.notFoundRoute;o&&(o.init({originalIndex:99999999999}),this.routesById[o.id]=o)},this.subscribe=(n,r)=>{const a={eventType:n,fn:r};return this.subscribers.add(a),()=>{this.subscribers.delete(a)}},this.emit=n=>{this.subscribers.forEach(r=>{r.eventType===n.type&&r.fn(n)})},this.parseLocation=(n,r)=>{const a=({href:d,state:f})=>{const m=new URL(d,this.origin),p=n5(this.rewrite,m),g=this.options.parseSearch(p.search),x=this.options.stringifySearch(g);p.search=x;const j=p.href.replace(p.origin,""),{pathname:b,hash:w}=p;return{href:j,publicHref:d,url:p.href,pathname:nM(b),searchStr:x,search:wa(r?.search,g),hash:w.split("#").reverse()[0]??"",state:wa(r?.state,f)}},o=a(n),{__tempLocation:l,__tempKey:u}=o.state;if(l&&(!u||u===this.tempLocationKey)){const d=a(l);return d.state.key=o.state.key,d.state.__TSR_key=o.state.__TSR_key,delete d.state.__tempLocation,{...d,maskedLocation:o}}return o},this.resolvePathWithBase=(n,r)=>fG({base:n,to:_C(r),trailingSlash:this.options.trailingSlash,parseCache:this.parsePathnameCache}),this.matchRoutes=(n,r,a)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:r},a):this.matchRoutesInternal(n,r),this.parsePathnameCache=WG(1e3),this.getMatchedRoutes=(n,r)=>nY({pathname:n,routePathname:r,caseSensitive:this.options.caseSensitive,routesByPath:this.routesByPath,routesById:this.routesById,flatRoutes:this.flatRoutes,parseCache:this.parsePathnameCache}),this.cancelMatch=n=>{const r=this.getMatch(n);r&&(r.abortController.abort(),clearTimeout(r._nonReactive.pendingTimeout),r._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const n=this.state.matches.filter(o=>o.status==="pending"),r=this.state.matches.filter(o=>o.isFetching==="loader");new Set([...this.state.pendingMatches??[],...n,...r]).forEach(o=>{this.cancelMatch(o.id)})},this.buildLocation=n=>{const r=(o={})=>{const l=o._fromLocation||this.pendingBuiltLocation||this.latestLocation,u=this.matchRoutes(l,{_buildLocation:!0}),d=u_(u);o.from;const f=o.unsafeRelative==="path"?l.pathname:o.from??d.fullPath,m=this.resolvePathWithBase(f,"."),p=d.search,g={...d.params},x=o.to?this.resolvePathWithBase(m,`${o.to}`):this.resolvePathWithBase(m,"."),j=o.params===!1||o.params===null?{}:(o.params??!0)===!0?g:Object.assign(g,Qs(o.params,g)),b=O0({path:x,params:j,parseCache:this.parsePathnameCache}).interpolatedPath,w=this.matchRoutes(b,void 0,{_buildLocation:!0}).map(z=>this.looseRoutesById[z.routeId]);if(Object.keys(j).length>0)for(const z of w){const D=z.options.params?.stringify??z.options.stringifyParams;D&&Object.assign(j,D(j))}const N=n.leaveParams?x:nM(O0({path:x,params:j,decodeCharMap:this.pathParamsDecodeCharMap,parseCache:this.parsePathnameCache}).interpolatedPath);let A=p;if(n._includeValidateSearch&&this.options.search?.strict){const z={};w.forEach(D=>{if(D.options.validateSearch)try{Object.assign(z,h_(D.options.validateSearch,{...z,...A}))}catch{}}),A=z}A=rY({search:A,dest:o,destRoutes:w,_includeValidateSearch:n._includeValidateSearch}),A=wa(p,A);const E=this.options.stringifySearch(A),T=o.hash===!0?l.hash:o.hash?Qs(o.hash,l.hash):void 0,C=T?`#${T}`:"";let k=o.state===!0?l.state:o.state?Qs(o.state,l.state):{};k=wa(l.state,k);const O=`${N}${E}${C}`,M=new URL(O,this.origin),I=r5(this.rewrite,M);return{publicHref:I.pathname+I.search+I.hash,href:O,url:I.href,pathname:N,search:A,searchStr:E,state:k,hash:T??"",unmaskOnReload:o.unmaskOnReload}},a=(o={},l)=>{const u=r(o);let d=l?r(l):void 0;if(!d){let f={};const m=this.options.routeMasks?.find(p=>{const g=d_(u.pathname,{to:p.from,caseSensitive:!1,fuzzy:!1},this.parsePathnameCache);return g?(f=g,!0):!1});if(m){const{from:p,...g}=m;l={from:n.from,...g,params:f},d=r(l)}}return d&&(u.maskedLocation=d),u};return n.mask?a(n,{from:n.from,...n.mask}):a(n)},this.commitLocation=({viewTransition:n,ignoreBlocker:r,...a})=>{const o=()=>{const d=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];d.forEach(m=>{a.state[m]=this.latestLocation.state[m]});const f=Js(a.state,this.latestLocation.state);return d.forEach(m=>{delete a.state[m]}),f},l=Ko(this.latestLocation.href)===Ko(a.href),u=this.commitLocationPromise;if(this.commitLocationPromise=Qc(()=>{u?.resolve()}),l&&o())this.load();else{let{maskedLocation:d,hashScrollIntoView:f,...m}=a;d&&(m={...d,state:{...d.state,__tempKey:void 0,__tempLocation:{...m,search:m.searchStr,state:{...m.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(m.unmaskOnReload??this.options.unmaskOnReload??!1)&&(m.state.__tempKey=this.tempLocationKey)),m.state.__hashScrollIntoViewOptions=f??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,this.history[a.replace?"replace":"push"](m.publicHref,m.state,{ignoreBlocker:r})}return this.resetNextScroll=a.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:r,hashScrollIntoView:a,viewTransition:o,ignoreBlocker:l,href:u,...d}={})=>{if(u){const p=this.history.location.state.__TSR_index,g=fv(u,{__TSR_index:n?p:p+1});d.to=g.pathname,d.search=this.options.parseSearch(g.search),d.hash=g.hash.slice(1)}const f=this.buildLocation({...d,_includeValidateSearch:!0});this.pendingBuiltLocation=f;const m=this.commitLocation({...f,viewTransition:o,replace:n,resetScroll:r,hashScrollIntoView:a,ignoreBlocker:l});return Promise.resolve().then(()=>{this.pendingBuiltLocation===f&&(this.pendingBuiltLocation=void 0)}),m},this.navigate=({to:n,reloadDocument:r,href:a,...o})=>{if(!r&&a)try{new URL(`${a}`),r=!0}catch{}return r?(a||(a=this.buildLocation({to:n,...o}).url),o.replace?window.location.replace(a):window.location.href=a,Promise.resolve()):this.buildAndCommitLocation({...o,href:a,to:n,_isNavigate:!0})},this.beforeLoad=()=>{if(this.cancelMatches(),this.updateLatestLocation(),this.isServer){const r=this.buildLocation({to:this.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0}),a=o=>{try{return encodeURI(decodeURI(o))}catch{return o}};if(Qp(a(this.latestLocation.href))!==Qp(a(r.href))){let o=r.url;throw this.origin&&o.startsWith(this.origin)&&(o=o.replace(this.origin,"")||"/"),YL({href:o})}}const n=this.matchRoutes(this.latestLocation);this.__store.setState(r=>({...r,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:n,cachedMatches:r.cachedMatches.filter(a=>!n.some(o=>o.id===a.id))}))},this.load=async n=>{let r,a,o;for(o=new Promise(u=>{this.startTransition(async()=>{try{this.beforeLoad();const d=this.latestLocation,f=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...el({resolvedLocation:f,location:d})}),this.emit({type:"onBeforeLoad",...el({resolvedLocation:f,location:d})}),await sM({router:this,sync:n?.sync,matches:this.state.pendingMatches,location:d,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let m=[],p=[],g=[];yf(()=>{this.__store.setState(x=>{const j=x.matches,b=x.pendingMatches||x.matches;return m=j.filter(w=>!b.some(N=>N.id===w.id)),p=b.filter(w=>!j.some(N=>N.id===w.id)),g=b.filter(w=>j.some(N=>N.id===w.id)),{...x,isLoading:!1,loadedAt:Date.now(),matches:b,pendingMatches:void 0,cachedMatches:[...x.cachedMatches,...m.filter(w=>w.status!=="error")]}}),this.clearExpiredCache()}),[[m,"onLeave"],[p,"onEnter"],[g,"onStay"]].forEach(([x,j])=>{x.forEach(b=>{this.looseRoutesById[b.routeId].options[j]?.(b)})})})})}})}catch(d){oi(d)?(r=d,this.isServer||this.navigate({...r.options,replace:!0,ignoreBlocker:!0})):Fa(d)&&(a=d),this.__store.setState(f=>({...f,statusCode:r?r.status:a?404:f.matches.some(m=>m.status==="error")?500:200,redirect:r}))}this.latestLoadPromise===o&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),u()})}),this.latestLoadPromise=o,await o;this.latestLoadPromise&&o!==this.latestLoadPromise;)await this.latestLoadPromise;let l;this.hasNotFoundMatch()?l=404:this.__store.state.matches.some(u=>u.status==="error")&&(l=500),l!==void 0&&this.__store.setState(u=>({...u,statusCode:l}))},this.startViewTransition=n=>{const r=this.shouldViewTransition??this.options.defaultViewTransition;if(delete this.shouldViewTransition,r&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let a;if(typeof r=="object"&&this.isViewTransitionTypesSupported){const o=this.latestLocation,l=this.state.resolvedLocation,u=typeof r.types=="function"?r.types(el({resolvedLocation:l,location:o})):r.types;if(u===!1){n();return}a={update:n,types:u}}else a=n;document.startViewTransition(a)}else n()},this.updateMatch=(n,r)=>{this.startTransition(()=>{const a=this.state.pendingMatches?.some(o=>o.id===n)?"pendingMatches":this.state.matches.some(o=>o.id===n)?"matches":this.state.cachedMatches.some(o=>o.id===n)?"cachedMatches":"";a&&this.__store.setState(o=>({...o,[a]:o[a]?.map(l=>l.id===n?r(l):l)}))})},this.getMatch=n=>{const r=a=>a.id===n;return this.state.cachedMatches.find(r)??this.state.pendingMatches?.find(r)??this.state.matches.find(r)},this.invalidate=n=>{const r=a=>n?.filter?.(a)??!0?{...a,invalid:!0,...n?.forcePending||a.status==="error"?{status:"pending",error:void 0}:void 0}:a;return this.__store.setState(a=>({...a,matches:a.matches.map(r),cachedMatches:a.cachedMatches.map(r),pendingMatches:a.pendingMatches?.map(r)})),this.shouldViewTransition=!1,this.load({sync:n?.sync})},this.resolveRedirect=n=>{if(!n.options.href){const r=this.buildLocation(n.options);let a=r.url;this.origin&&a.startsWith(this.origin)&&(a=a.replace(this.origin,"")||"/"),n.options.href=r.href,n.headers.set("Location",a)}return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const r=n?.filter;r!==void 0?this.__store.setState(a=>({...a,cachedMatches:a.cachedMatches.filter(o=>!r(o))})):this.__store.setState(a=>({...a,cachedMatches:[]}))},this.clearExpiredCache=()=>{const n=r=>{const a=this.looseRoutesById[r.routeId];if(!a.options.loader)return!0;const o=(r.preload?a.options.preloadGcTime??this.options.defaultPreloadGcTime:a.options.gcTime??this.options.defaultGcTime)??300*1e3;return r.status==="error"?!0:Date.now()-r.updatedAt>=o};this.clearCache({filter:n})},this.loadRouteChunk=JL,this.preloadRoute=async n=>{const r=this.buildLocation(n);let a=this.matchRoutes(r,{throwOnError:!0,preload:!0,dest:n});const o=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(u=>u.id)),l=new Set([...o,...this.state.cachedMatches.map(u=>u.id)]);yf(()=>{a.forEach(u=>{l.has(u.id)||this.__store.setState(d=>({...d,cachedMatches:[...d.cachedMatches,u]}))})});try{return a=await sM({router:this,matches:a,location:r,preload:!0,updateMatch:(u,d)=>{o.has(u)?a=a.map(f=>f.id===u?d(f):f):this.updateMatch(u,d)}}),a}catch(u){if(oi(u))return u.options.reloadDocument?void 0:await this.preloadRoute({...u.options,_fromLocation:r});Fa(u)||console.error(u);return}},this.matchRoute=(n,r)=>{const a={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},o=this.buildLocation(a);if(r?.pending&&this.state.status!=="pending")return!1;const u=(r?.pending===void 0?!this.state.isLoading:r.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,d=d_(u.pathname,{...r,to:o.pathname},this.parsePathnameCache);return!d||n.params&&!Js(d,n.params,{partial:!0})?!1:d&&(r?.includeSearch??!0)?Js(u.search,o.search,{partial:!0})?d:!1:d},this.hasNotFoundMatch=()=>this.__store.state.matches.some(n=>n.status==="notFound"||n.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...t,caseSensitive:t.caseSensitive??!1,notFoundMode:t.notFoundMode??"fuzzy",stringifySearch:t.stringifySearch??FG,parseSearch:t.parseSearch??qG}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}get looseRoutesById(){return this.routesById}matchRoutesInternal(t,n){const{foundRoute:r,matchedRoutes:a,routeParams:o}=this.getMatchedRoutes(t.pathname,n?.dest?.to);let l=!1;(r?r.path!=="/"&&o["**"]:Ko(t.pathname))&&(this.options.notFoundRoute?a.push(this.options.notFoundRoute):l=!0);const u=(()=>{if(l){if(this.options.notFoundMode!=="root")for(let m=a.length-1;m>=0;m--){const p=a[m];if(p.children)return p.id}return Zr}})(),d=[],f=m=>m?.id?m.context??this.options.context??void 0:this.options.context??void 0;return a.forEach((m,p)=>{const g=d[p-1],[x,j,b]=(()=>{const H=g?.search??t.search,V=g?._strictSearch??void 0;try{const F=h_(m.options.validateSearch,{...H})??void 0;return[{...H,...F},{...V,...F},void 0]}catch(F){let G=F;if(F instanceof gv||(G=new gv(F.message,{cause:F})),n?.throwOnError)throw G;return[H,{},G]}})(),w=m.options.loaderDeps?.({search:x})??"",N=w?JSON.stringify(w):"",{interpolatedPath:A,usedParams:E}=O0({path:m.fullPath,params:o,decodeCharMap:this.pathParamsDecodeCharMap}),T=m.id+A+N,C=this.getMatch(T),k=this.state.matches.find(H=>H.routeId===m.id),O=C?._strictParams??E;let M;if(!C){const H=m.options.params?.parse??m.options.parseParams;if(H)try{Object.assign(O,H(O))}catch(V){if(M=new eY(V.message,{cause:V}),n?.throwOnError)throw M}}Object.assign(o,O);const I=k?"stay":"enter";let z;if(C)z={...C,cause:I,params:k?wa(k.params,o):o,_strictParams:O,search:wa(k?k.search:C.search,x),_strictSearch:j};else{const H=m.options.loader||m.options.beforeLoad||m.lazyFn||e5(m)?"pending":"success";z={id:T,index:p,routeId:m.id,params:k?wa(k.params,o):o,_strictParams:O,pathname:A,updatedAt:Date.now(),search:k?wa(k.search,x):x,_strictSearch:j,searchError:void 0,status:H,isFetching:!1,error:void 0,paramsError:M,__routeContext:void 0,_nonReactive:{loadPromise:Qc()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:I,loaderDeps:k?wa(k.loaderDeps,w):w,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:m.options.staticData||{},fullPath:m.fullPath}}n?.preload||(z.globalNotFound=u===m.id),z.searchError=b;const D=f(g);z.context={...D,...z.__routeContext,...z.__beforeLoadContext},d.push(z)}),d.forEach((m,p)=>{const g=this.looseRoutesById[m.routeId];if(!this.getMatch(m.id)&&n?._buildLocation!==!0){const j=d[p-1],b=f(j);if(g.options.context){const w={deps:m.loaderDeps,params:m.params,context:b??{},location:t,navigate:N=>this.navigate({...N,_fromLocation:t}),buildLocation:this.buildLocation,cause:m.cause,abortController:m.abortController,preload:!!m.preload,matches:d};m.__routeContext=g.options.context(w)??void 0}m.context={...b,...m.__routeContext,...m.__beforeLoadContext}}}),d}}class gv extends Error{}class eY extends Error{}function tY(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function h_(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new gv("Async validation not supported");if(n.issues)throw new gv(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function nY({pathname:e,routePathname:t,caseSensitive:n,routesByPath:r,routesById:a,flatRoutes:o,parseCache:l}){let u={};const d=Ko(e),f=x=>d_(d,{to:x.fullPath,caseSensitive:x.options?.caseSensitive??n,fuzzy:!0},l);let m=t!==void 0?r[t]:void 0;if(m)u=f(m);else{let x;for(const j of o){const b=f(j);if(b)if(j.path!=="/"&&b["**"])x||(x={foundRoute:j,routeParams:b});else{m=j,u=b;break}}!m&&x&&(m=x.foundRoute,u=x.routeParams)}let p=m||a[Zr];const g=[p];for(;p.parentRoute;)p=p.parentRoute,g.push(p);return g.reverse(),{matchedRoutes:g,routeParams:u,foundRoute:m}}function rY({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){const a=n.reduce((u,d)=>{const f=[];if("search"in d.options)d.options.search?.middlewares&&f.push(...d.options.search.middlewares);else if(d.options.preSearchFilters||d.options.postSearchFilters){const m=({search:p,next:g})=>{let x=p;"preSearchFilters"in d.options&&d.options.preSearchFilters&&(x=d.options.preSearchFilters.reduce((b,w)=>w(b),p));const j=g(x);return"postSearchFilters"in d.options&&d.options.postSearchFilters?d.options.postSearchFilters.reduce((b,w)=>w(b),j):j};f.push(m)}if(r&&d.options.validateSearch){const m=({search:p,next:g})=>{const x=g(p);try{return{...x,...h_(d.options.validateSearch,x)??void 0}}catch{return x}};f.push(m)}return u.concat(f)},[])??[],o=({search:u})=>t.search?t.search===!0?u:Qs(t.search,u):{};a.push(o);const l=(u,d)=>{if(u>=a.length)return d;const f=a[u];return f({search:d,next:p=>l(u+1,p)})};return l(0,e)}const aY="Error preloading route! ☝️";class a5{constructor(t){if(this.init=n=>{this.originalIndex=n.originalIndex;const r=this.options,a=!r?.path&&!r?.id;this.parentRoute=this.options.getParentRoute?.(),a?this._path=Zr:this.parentRoute||ur(!1);let o=a?Zr:r?.path;o&&o!=="/"&&(o=NC(o));const l=r?.id||o;let u=a?Zr:Qi([this.parentRoute.id===Zr?"":this.parentRoute.id,l]);o===Zr&&(o="/"),u!==Zr&&(u=Qi(["/",u]));const d=u===Zr?"/":Qi([this.parentRoute.fullPath,o]);this._path=o,this._id=u,this._fullPath=d,this._to=d},this.addChildren=n=>this._addFileChildren(n),this._addFileChildren=n=>(Array.isArray(n)&&(this.children=n),typeof n=="object"&&n!==null&&(this.children=Object.values(n)),this),this._addFileTypes=()=>this,this.updateLoader=n=>(Object.assign(this.options,n),this),this.update=n=>(Object.assign(this.options,n),this),this.lazy=n=>(this.lazyFn=n,this),this.options=t||{},this.isRoot=!t?.getParentRoute,t?.id&&t?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class iY extends a5{constructor(t){super(t)}}function CC(e){const t=e.errorComponent??$g;return i.jsx(oY,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?y.createElement(t,{error:n,reset:r}):e.children})}class oY extends y.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(t){return{resetKey:t.getResetKey()}}static getDerivedStateFromError(t){return{error:t}}reset(){this.setState({error:null})}componentDidUpdate(t,n){n.error&&n.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(t,n){this.props.onCatch&&this.props.onCatch(t,n)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function $g({error:e}){const[t,n]=y.useState(!1);return i.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[i.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),i.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(r=>!r),children:t?"Hide Error":"Show Error"})]}),i.jsx("div",{style:{height:".25rem"}}),t?i.jsx("div",{children:i.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?i.jsx("code",{children:e.message}):null})}):null]})}function sY({children:e,fallback:t=null}){return lY()?i.jsx(W.Fragment,{children:e}):i.jsx(W.Fragment,{children:t})}function lY(){return W.useSyncExternalStore(cY,()=>!0,()=>!1)}function cY(){return()=>{}}var A0={exports:{}},T0={},k0={exports:{}},M0={};var lM;function uY(){if(lM)return M0;lM=1;var e=wh();function t(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,a=e.useEffect,o=e.useLayoutEffect,l=e.useDebugValue;function u(p,g){var x=g(),j=r({inst:{value:x,getSnapshot:g}}),b=j[0].inst,w=j[1];return o(function(){b.value=x,b.getSnapshot=g,d(b)&&w({inst:b})},[p,x,g]),a(function(){return d(b)&&w({inst:b}),p(function(){d(b)&&w({inst:b})})},[p]),l(x),x}function d(p){var g=p.getSnapshot;p=p.value;try{var x=g();return!n(p,x)}catch{return!0}}function f(p,g){return g()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:u;return M0.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,M0}var cM;function dY(){return cM||(cM=1,k0.exports=uY()),k0.exports}var uM;function fY(){if(uM)return T0;uM=1;var e=wh(),t=dY();function n(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var r=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,o=e.useRef,l=e.useEffect,u=e.useMemo,d=e.useDebugValue;return T0.useSyncExternalStoreWithSelector=function(f,m,p,g,x){var j=o(null);if(j.current===null){var b={hasValue:!1,value:null};j.current=b}else b=j.current;j=u(function(){function N(k){if(!A){if(A=!0,E=k,k=g(k),x!==void 0&&b.hasValue){var O=b.value;if(x(O,k))return T=O}return T=k}if(O=T,r(E,k))return O;var M=g(k);return x!==void 0&&x(O,M)?(E=k,O):(E=k,T=M)}var A=!1,E,T,C=p===void 0?null:p;return[function(){return N(m())},C===null?void 0:function(){return N(C())}]},[m,p,g,x]);var w=a(f,j[0],j[1]);return l(function(){b.hasValue=!0,b.value=w},[w]),d(w),w},T0}var dM;function hY(){return dM||(dM=1,A0.exports=fY()),A0.exports}var mY=hY();function pY(e,t=r=>r,n={}){const r=n.equal??vY;return mY.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function vY(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,a]of e)if(!t.has(r)||!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=fM(e);if(n.length!==fM(t).length)return!1;for(let r=0;r"u"?P0:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=P0,P0)}function Ir(e){const t=y.useContext(i5());return e?.warn,t}function Sr(e){const t=Ir({warn:e?.router===void 0}),n=e?.router||t,r=y.useRef(void 0);return pY(n.__store,a=>{if(e?.select){if(e.structuralSharing??n.options.defaultStructuralSharing){const o=wa(r.current,e.select(a));return r.current=o,o}return e.select(a)}return a})}const Ig=y.createContext(void 0),gY=y.createContext(void 0);function pi(e){const t=y.useContext(e.from?gY:Ig);return Sr({select:r=>{const a=r.matches.find(o=>e.from?e.from===o.routeId:o.id===t);if(ur(!((e.shouldThrow??!0)&&!a),`Could not find ${e.from?`an active match from "${e.from}"`:"a nearest match!"}`),a!==void 0)return e.select?e.select(a):a},structuralSharing:e.structuralSharing})}function OC(e){return pi({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function EC(e){const{select:t,...n}=e;return pi({...n,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function AC(e){return pi({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function TC(e){return pi({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function oa(e){const t=Ir();return y.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}var wl=HL();const yY=St(wl),Sp=typeof window<"u"?y.useLayoutEffect:y.useEffect;function R0(e){const t=y.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function xY(e,t,n={},r={}){y.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!="function")return;const a=new IntersectionObserver(([o])=>{t(o)},n);return a.observe(e.current),()=>{a.disconnect()}},[t,n,r.disabled,e])}function bY(e){const t=y.useRef(null);return y.useImperativeHandle(e,()=>t.current,[]),t}function wY(e,t){const n=Ir(),[r,a]=y.useState(!1),o=y.useRef(!1),l=bY(t),{activeProps:u,inactiveProps:d,activeOptions:f,to:m,preload:p,preloadDelay:g,hashScrollIntoView:x,replace:j,startTransition:b,resetScroll:w,viewTransition:N,children:A,target:E,disabled:T,style:C,className:k,onClick:O,onFocus:M,onMouseEnter:I,onMouseLeave:z,onTouchStart:D,ignoreBlocker:H,params:V,search:F,hash:G,state:L,mask:R,reloadDocument:U,unsafeRelative:K,from:te,_fromLocation:$,...B}=e,Y=Sr({select:ct=>ct.location.search,structuralSharing:!0}),ne=e.from,oe=y.useMemo(()=>({...e,from:ne}),[n,Y,ne,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),xe=y.useMemo(()=>n.buildLocation({...oe}),[n,oe]),ee=y.useMemo(()=>{if(T)return;let ct=xe.maskedLocation?xe.maskedLocation.url:xe.url,rt=!1;return n.origin&&(ct.startsWith(n.origin)?ct=n.history.createHref(ct.replace(n.origin,""))||"/":rt=!0),{href:ct,external:rt}},[T,xe.maskedLocation,xe.url,n.origin,n.history]),ae=y.useMemo(()=>{if(ee?.external)return ee.href;try{return new URL(m),m}catch{}},[m,ee]),Z=e.reloadDocument||ae?!1:p??n.options.defaultPreload,pe=g??n.options.defaultPreloadDelay??0,je=Sr({select:ct=>{if(ae)return!1;if(f?.exact){if(!uG(ct.location.pathname,xe.pathname,n.basepath))return!1}else{const rt=mv(ct.location.pathname,n.basepath),$n=mv(xe.pathname,n.basepath);if(!(rt.startsWith($n)&&(rt.length===$n.length||rt[$n.length]==="/")))return!1}return(f?.includeSearch??!0)&&!Js(ct.location.search,xe.search,{partial:!f?.exact,ignoreUndefined:!f?.explicitUndefined})?!1:f?.includeHash?ct.location.hash===xe.hash:!0}}),le=y.useCallback(()=>{n.preloadRoute({...oe}).catch(ct=>{console.warn(ct),console.warn(aY)})},[n,oe]),Re=y.useCallback(ct=>{ct?.isIntersecting&&le()},[le]);xY(l,Re,CY,{disabled:!!T||Z!=="viewport"}),y.useEffect(()=>{o.current||!T&&Z==="render"&&(le(),o.current=!0)},[T,le,Z]);const _e=ct=>{const rt=ct.currentTarget.getAttribute("target"),$n=E!==void 0?E:rt;if(!T&&!OY(ct)&&!ct.defaultPrevented&&(!$n||$n==="_self")&&ct.button===0){ct.preventDefault(),wl.flushSync(()=>{a(!0)});const gs=n.subscribe("onResolved",()=>{gs(),a(!1)});n.navigate({...oe,replace:j,resetScroll:w,hashScrollIntoView:x,startTransition:b,viewTransition:N,ignoreBlocker:H})}};if(ae)return{...B,ref:l,href:ae,...A&&{children:A},...E&&{target:E},...T&&{disabled:T},...C&&{style:C},...k&&{className:k},...O&&{onClick:O},...M&&{onFocus:M},...I&&{onMouseEnter:I},...z&&{onMouseLeave:z},...D&&{onTouchStart:D}};const me=ct=>{T||Z&&le()},ve=me,Le=ct=>{if(!(T||!Z))if(!pe)le();else{const rt=ct.target;if(Vd.has(rt))return;const $n=setTimeout(()=>{Vd.delete(rt),le()},pe);Vd.set(rt,$n)}},It=ct=>{if(T||!Z||!pe)return;const rt=ct.target,$n=Vd.get(rt);$n&&(clearTimeout($n),Vd.delete(rt))},Cn=je?Qs(u,{})??jY:D0,vr=je?D0:Qs(d,{})??D0,rr=[k,Cn.className,vr.className].filter(Boolean).join(" "),gr=(C||Cn.style||vr.style)&&{...C,...Cn.style,...vr.style};return{...B,...Cn,...vr,href:ee?.href,ref:l,onClick:Gd([O,_e]),onFocus:Gd([M,me]),onMouseEnter:Gd([I,Le]),onMouseLeave:Gd([z,It]),onTouchStart:Gd([D,ve]),disabled:!!T,target:E,...gr&&{style:gr},...rr&&{className:rr},...T&&SY,...je&&_Y,...r&&NY}}const D0={},jY={className:"active"},SY={role:"link","aria-disabled":!0},_Y={"data-status":"active","aria-current":"page"},NY={"data-transitioning":"transitioning"},Vd=new WeakMap,CY={rootMargin:"100px"},Gd=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}},kC=y.forwardRef((e,t)=>{const{_asChild:n,...r}=e,{type:a,ref:o,...l}=wY(r,t),u=typeof r.children=="function"?r.children({isActive:l["data-status"]==="active"}):r.children;return n===void 0&&delete l.disabled,y.createElement(n||"a",{...l,ref:o},u)});function OY(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}class EY extends a5{constructor(t){super(t),this.useMatch=n=>pi({select:n?.select,from:this.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>pi({...n,from:this.id,select:r=>n?.select?n.select(r.context):r.context}),this.useSearch=n=>TC({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useParams=n=>AC({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useLoaderDeps=n=>EC({...n,from:this.id}),this.useLoaderData=n=>OC({...n,from:this.id}),this.useNavigate=()=>oa({from:this.fullPath}),this.Link=W.forwardRef((n,r)=>i.jsx(kC,{ref:r,from:this.fullPath,...n})),this.$$typeof=Symbol.for("react.memo")}}function fr(e){return new EY(e)}class AY extends iY{constructor(t){super(t),this.useMatch=n=>pi({select:n?.select,from:this.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>pi({...n,from:this.id,select:r=>n?.select?n.select(r.context):r.context}),this.useSearch=n=>TC({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useParams=n=>AC({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useLoaderDeps=n=>EC({...n,from:this.id}),this.useLoaderData=n=>OC({...n,from:this.id}),this.useNavigate=()=>oa({from:this.fullPath}),this.Link=W.forwardRef((n,r)=>i.jsx(kC,{ref:r,from:this.fullPath,...n})),this.$$typeof=Symbol.for("react.memo")}}function TY(e){return new AY(e)}function hM(e){return typeof e=="object"?new mM(e,{silent:!0}).createRoute(e):new mM(e,{silent:!0}).createRoute}class mM{constructor(t,n){this.path=t,this.createRoute=r=>{this.silent;const a=fr(r);return a.isRoot=!1,a},this.silent=n?.silent}}class pM{constructor(t){this.useMatch=n=>pi({select:n?.select,from:this.options.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>pi({from:this.options.id,select:r=>n?.select?n.select(r.context):r.context}),this.useSearch=n=>TC({select:n?.select,structuralSharing:n?.structuralSharing,from:this.options.id}),this.useParams=n=>AC({select:n?.select,structuralSharing:n?.structuralSharing,from:this.options.id}),this.useLoaderDeps=n=>EC({...n,from:this.options.id}),this.useLoaderData=n=>OC({...n,from:this.options.id}),this.useNavigate=()=>{const n=Ir();return oa({from:n.routesById[this.options.id].fullPath})},this.options=t,this.$$typeof=Symbol.for("react.memo")}}function vM(e){return typeof e=="object"?new pM(e):t=>new pM({id:e,...t})}function kY(){const e=Ir(),t=y.useRef({router:e,mounted:!1}),[n,r]=y.useState(!1),{hasPendingMatches:a,isLoading:o}=Sr({select:p=>({isLoading:p.isLoading,hasPendingMatches:p.matches.some(g=>g.status==="pending")}),structuralSharing:!0}),l=R0(o),u=o||n||a,d=R0(u),f=o||a,m=R0(f);return e.startTransition=p=>{r(!0),y.startTransition(()=>{p(),r(!1)})},y.useEffect(()=>{const p=e.history.subscribe(e.load),g=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Ko(e.latestLocation.href)!==Ko(g.href)&&e.commitLocation({...g,replace:!0}),()=>{p()}},[e,e.history]),Sp(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(g){console.error(g)}})()},[e]),Sp(()=>{l&&!o&&e.emit({type:"onLoad",...el(e.state)})},[l,e,o]),Sp(()=>{m&&!f&&e.emit({type:"onBeforeRouteMount",...el(e.state)})},[f,m,e]),Sp(()=>{d&&!u&&(e.emit({type:"onResolved",...el(e.state)}),e.__store.setState(p=>({...p,status:"idle",resolvedLocation:p.location})),LG(e))},[u,d,e]),null}function MY(e){const t=Sr({select:n=>`not-found-${n.location.pathname}-${n.status}`});return i.jsx(CC,{getResetKey:()=>t,onCatch:(n,r)=>{if(Fa(n))e.onCatch?.(n,r);else throw n},errorComponent:({error:n})=>{if(Fa(n))return e.fallback?.(n);throw n},children:e.children})}function PY(){return i.jsx("p",{children:"Not Found"})}function kc(e){return i.jsx(i.Fragment,{children:e.children})}function o5(e,t,n){return t.options.notFoundComponent?i.jsx(t.options.notFoundComponent,{data:n}):e.options.defaultNotFoundComponent?i.jsx(e.options.defaultNotFoundComponent,{data:n}):i.jsx(PY,{})}function RY({children:e}){const t=Ir();return t.isServer?i.jsx("script",{nonce:t.options.ssr?.nonce,className:"$tsr",dangerouslySetInnerHTML:{__html:[e].filter(Boolean).join(` `)+";$_TSR.c()"}}):null}function DY(){const e=Ir();if(!e.isScrollRestoring||!e.isServer||typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))return null;const n=(e.options.getScrollRestorationKey||f_)(e.latestLocation),r=n!==f_(e.latestLocation)?n:void 0,a={storageKey:pv,shouldScrollRestoration:!0};return r&&(a.key=r),i.jsx(RY,{children:`(${GL.toString()})(${JSON.stringify(a)})`})}const s5=y.memo(function({matchId:t}){const n=Ir(),r=Sr({select:N=>{const A=N.matches.find(E=>E.id===t);return ur(A),{routeId:A.routeId,ssr:A.ssr,_displayPending:A._displayPending}},structuralSharing:!0}),a=n.routesById[r.routeId],o=a.options.pendingComponent??n.options.defaultPendingComponent,l=o?i.jsx(o,{}):null,u=a.options.errorComponent??n.options.defaultErrorComponent,d=a.options.onCatch??n.options.defaultOnCatch,f=a.isRoot?a.options.notFoundComponent??n.options.notFoundRoute?.options.component:a.options.notFoundComponent,m=r.ssr===!1||r.ssr==="data-only",p=(!a.isRoot||a.options.wrapInSuspense||m)&&(a.options.wrapInSuspense??o??(a.options.errorComponent?.preload||m))?y.Suspense:kc,g=u?CC:kc,x=f?MY:kc,j=Sr({select:N=>N.loadedAt}),b=Sr({select:N=>{const A=N.matches.findIndex(E=>E.id===t);return N.matches[A-1]?.routeId}}),w=a.isRoot?a.options.shellComponent??kc:kc;return i.jsxs(w,{children:[i.jsx(Ig.Provider,{value:t,children:i.jsx(p,{fallback:l,children:i.jsx(g,{getResetKey:()=>j,errorComponent:u||$g,onCatch:(N,A)=>{if(Fa(N))throw N;d?.(N,A)},children:i.jsx(x,{fallback:N=>{if(!f||N.routeId&&N.routeId!==r.routeId||!N.routeId&&!a.isRoot)throw N;return y.createElement(f,N)},children:m||r._displayPending?i.jsx(sY,{fallback:l,children:i.jsx(gM,{matchId:t})}):i.jsx(gM,{matchId:t})})})})}),b===Zr&&n.options.scrollRestoration?i.jsxs(i.Fragment,{children:[i.jsx($Y,{}),i.jsx(DY,{})]}):null]})});function $Y(){const e=Ir(),t=y.useRef(void 0);return i.jsx("script",{suppressHydrationWarning:!0,ref:n=>{n&&(t.current===void 0||t.current.href!==e.latestLocation.href)&&(e.emit({type:"onRendered",...el(e.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}const gM=y.memo(function({matchId:t}){const n=Ir(),{match:r,key:a,routeId:o}=Sr({select:d=>{const f=d.matches.find(j=>j.id===t),m=f.routeId,g=(n.routesById[m].options.remountDeps??n.options.defaultRemountDeps)?.({routeId:m,loaderDeps:f.loaderDeps,params:f._strictParams,search:f._strictSearch});return{key:g?JSON.stringify(g):void 0,routeId:m,match:{id:f.id,status:f.status,error:f.error,_forcePending:f._forcePending,_displayPending:f._displayPending}}},structuralSharing:!0}),l=n.routesById[o],u=y.useMemo(()=>{const d=l.options.component??n.options.defaultComponent;return d?i.jsx(d,{},a):i.jsx(MC,{})},[a,l.options.component,n.options.defaultComponent]);if(r._displayPending)throw n.getMatch(r.id)?._nonReactive.displayPendingPromise;if(r._forcePending)throw n.getMatch(r.id)?._nonReactive.minPendingPromise;if(r.status==="pending"){const d=l.options.pendingMinMs??n.options.defaultPendingMinMs;if(d){const f=n.getMatch(r.id);if(f&&!f._nonReactive.minPendingPromise&&!n.isServer){const m=Qc();f._nonReactive.minPendingPromise=m,setTimeout(()=>{m.resolve(),f._nonReactive.minPendingPromise=void 0},d)}}throw n.getMatch(r.id)?._nonReactive.loadPromise}if(r.status==="notFound")return ur(Fa(r.error)),o5(n,l,r.error);if(r.status==="redirected")throw ur(oi(r.error)),n.getMatch(r.id)?._nonReactive.loadPromise;if(r.status==="error"){if(n.isServer){const d=(l.options.errorComponent??n.options.defaultErrorComponent)||$g;return i.jsx(d,{error:r.error,reset:void 0,info:{componentStack:""}})}throw r.error}return u}),MC=y.memo(function(){const t=Ir(),n=y.useContext(Ig),r=Sr({select:f=>f.matches.find(m=>m.id===n)?.routeId}),a=t.routesById[r],o=Sr({select:f=>{const p=f.matches.find(g=>g.id===n);return ur(p),p.globalNotFound}}),l=Sr({select:f=>{const m=f.matches,p=m.findIndex(g=>g.id===n);return m[p+1]?.id}}),u=t.options.defaultPendingComponent?i.jsx(t.options.defaultPendingComponent,{}):null;if(o)return o5(t,a,void 0);if(!l)return null;const d=i.jsx(s5,{matchId:l});return r===Zr?i.jsx(y.Suspense,{fallback:u,children:d}):d});function IY(){const e=Ir(),n=e.routesById[Zr].options.pendingComponent??e.options.defaultPendingComponent,r=n?i.jsx(n,{}):null,a=e.isServer||typeof document<"u"&&e.ssr?kc:y.Suspense,o=i.jsxs(a,{fallback:r,children:[!e.isServer&&i.jsx(kY,{}),i.jsx(LY,{})]});return e.options.InnerWrap?i.jsx(e.options.InnerWrap,{children:o}):o}function LY(){const e=Ir(),t=Sr({select:a=>a.matches[0]?.id}),n=Sr({select:a=>a.loadedAt}),r=t?i.jsx(s5,{matchId:t}):null;return i.jsx(Ig.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:i.jsx(CC,{getResetKey:()=>n,errorComponent:$g,onCatch:a=>{a.message||a.toString()},children:r})})}function BY(){const e=Ir();return Sr({select:t=>[t.location.href,t.resolvedLocation?.href,t.status],structuralSharing:!0}),y.useCallback(t=>{const{pending:n,caseSensitive:r,fuzzy:a,includeSearch:o,...l}=t;return e.matchRoute(l,{pending:n,caseSensitive:r,fuzzy:a,includeSearch:o})},[e])}const zY=e=>new qY(e);class qY extends JG{constructor(t){super(t)}}typeof globalThis<"u"?(globalThis.createFileRoute=hM,globalThis.createLazyFileRoute=vM):typeof window<"u"&&(window.createFileRoute=hM,window.createLazyFileRoute=vM);function FY({router:e,children:t,...n}){Object.keys(n).length>0&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const r=i5(),a=i.jsx(r.Provider,{value:e,children:t});return e.options.Wrap?i.jsx(e.options.Wrap,{children:a}):a}function UY({router:e,...t}){return i.jsx(FY,{router:e,...t,children:i.jsx(IY,{})})}function l5(e,t){return function(){return e.apply(t,arguments)}}const{toString:HY}=Object.prototype,{getPrototypeOf:PC}=Object,{iterator:Lg,toStringTag:c5}=Symbol,Bg=(e=>t=>{const n=HY.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Va=e=>(e=e.toLowerCase(),t=>Bg(t)===e),zg=e=>t=>typeof t===e,{isArray:Ru}=Array,nu=zg("undefined");function jh(e){return e!==null&&!nu(e)&&e.constructor!==null&&!nu(e.constructor)&&Mr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const u5=Va("ArrayBuffer");function WY(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&u5(e.buffer),t}const VY=zg("string"),Mr=zg("function"),d5=zg("number"),Sh=e=>e!==null&&typeof e=="object",GY=e=>e===!0||e===!1,ev=e=>{if(Bg(e)!=="object")return!1;const t=PC(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(c5 in e)&&!(Lg in e)},YY=e=>{if(!Sh(e)||jh(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},KY=Va("Date"),XY=Va("File"),ZY=Va("Blob"),QY=Va("FileList"),JY=e=>Sh(e)&&Mr(e.pipe),eK=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Mr(e.append)&&((t=Bg(e))==="formdata"||t==="object"&&Mr(e.toString)&&e.toString()==="[object FormData]"))},tK=Va("URLSearchParams"),[nK,rK,aK,iK]=["ReadableStream","Request","Response","Headers"].map(Va),oK=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function _h(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,a;if(typeof e!="object"&&(e=[e]),Ru(e))for(r=0,a=e.length;r0;)if(a=n[r],t===a.toLowerCase())return a;return null}const Vs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,h5=e=>!nu(e)&&e!==Vs;function m_(){const{caseless:e,skipUndefined:t}=h5(this)&&this||{},n={},r=(a,o)=>{const l=e&&f5(n,o)||o;ev(n[l])&&ev(a)?n[l]=m_(n[l],a):ev(a)?n[l]=m_({},a):Ru(a)?n[l]=a.slice():(!t||!nu(a))&&(n[l]=a)};for(let a=0,o=arguments.length;a(_h(t,(a,o)=>{n&&Mr(a)?e[o]=l5(a,n):e[o]=a},{allOwnKeys:r}),e),lK=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),cK=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},uK=(e,t,n,r)=>{let a,o,l;const u={};if(t=t||{},e==null)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)l=a[o],(!r||r(l,e,t))&&!u[l]&&(t[l]=e[l],u[l]=!0);e=n!==!1&&PC(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},dK=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},fK=e=>{if(!e)return null;if(Ru(e))return e;let t=e.length;if(!d5(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},hK=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&PC(Uint8Array)),mK=(e,t)=>{const r=(e&&e[Lg]).call(e);let a;for(;(a=r.next())&&!a.done;){const o=a.value;t.call(e,o[0],o[1])}},pK=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},vK=Va("HTMLFormElement"),gK=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,a){return r.toUpperCase()+a}),yM=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),yK=Va("RegExp"),m5=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};_h(n,(a,o)=>{let l;(l=t(a,o,e))!==!1&&(r[o]=l||a)}),Object.defineProperties(e,r)},xK=e=>{m5(e,(t,n)=>{if(Mr(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Mr(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},bK=(e,t)=>{const n={},r=a=>{a.forEach(o=>{n[o]=!0})};return Ru(e)?r(e):r(String(e).split(t)),n},wK=()=>{},jK=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function SK(e){return!!(e&&Mr(e.append)&&e[c5]==="FormData"&&e[Lg])}const _K=e=>{const t=new Array(10),n=(r,a)=>{if(Sh(r)){if(t.indexOf(r)>=0)return;if(jh(r))return r;if(!("toJSON"in r)){t[a]=r;const o=Ru(r)?[]:{};return _h(r,(l,u)=>{const d=n(l,a+1);!nu(d)&&(o[u]=d)}),t[a]=void 0,o}}return r};return n(e,0)},NK=Va("AsyncFunction"),CK=e=>e&&(Sh(e)||Mr(e))&&Mr(e.then)&&Mr(e.catch),p5=((e,t)=>e?setImmediate:t?((n,r)=>(Vs.addEventListener("message",({source:a,data:o})=>{a===Vs&&o===n&&r.length&&r.shift()()},!1),a=>{r.push(a),Vs.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Mr(Vs.postMessage)),OK=typeof queueMicrotask<"u"?queueMicrotask.bind(Vs):typeof process<"u"&&process.nextTick||p5,EK=e=>e!=null&&Mr(e[Lg]),fe={isArray:Ru,isArrayBuffer:u5,isBuffer:jh,isFormData:eK,isArrayBufferView:WY,isString:VY,isNumber:d5,isBoolean:GY,isObject:Sh,isPlainObject:ev,isEmptyObject:YY,isReadableStream:nK,isRequest:rK,isResponse:aK,isHeaders:iK,isUndefined:nu,isDate:KY,isFile:XY,isBlob:ZY,isRegExp:yK,isFunction:Mr,isStream:JY,isURLSearchParams:tK,isTypedArray:hK,isFileList:QY,forEach:_h,merge:m_,extend:sK,trim:oK,stripBOM:lK,inherits:cK,toFlatObject:uK,kindOf:Bg,kindOfTest:Va,endsWith:dK,toArray:fK,forEachEntry:mK,matchAll:pK,isHTMLForm:vK,hasOwnProperty:yM,hasOwnProp:yM,reduceDescriptors:m5,freezeMethods:xK,toObjectSet:bK,toCamelCase:gK,noop:wK,toFiniteNumber:jK,findKey:f5,global:Vs,isContextDefined:h5,isSpecCompliantForm:SK,toJSONObject:_K,isAsyncFn:NK,isThenable:CK,setImmediate:p5,asap:OK,isIterable:EK};function Xe(e,t,n,r,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),a&&(this.response=a,this.status=a.status?a.status:null)}fe.inherits(Xe,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:fe.toJSONObject(this.config),code:this.code,status:this.status}}});const v5=Xe.prototype,g5={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{g5[e]={value:e}});Object.defineProperties(Xe,g5);Object.defineProperty(v5,"isAxiosError",{value:!0});Xe.from=(e,t,n,r,a,o)=>{const l=Object.create(v5);fe.toFlatObject(e,l,function(m){return m!==Error.prototype},f=>f!=="isAxiosError");const u=e&&e.message?e.message:"Error",d=t==null&&e?e.code:t;return Xe.call(l,u,d,n,r,a),e&&l.cause==null&&Object.defineProperty(l,"cause",{value:e,configurable:!0}),l.name=e&&e.name||"Error",o&&Object.assign(l,o),l};const AK=null;function p_(e){return fe.isPlainObject(e)||fe.isArray(e)}function y5(e){return fe.endsWith(e,"[]")?e.slice(0,-2):e}function xM(e,t,n){return e?e.concat(t).map(function(a,o){return a=y5(a),!n&&o?"["+a+"]":a}).join(n?".":""):t}function TK(e){return fe.isArray(e)&&!e.some(p_)}const kK=fe.toFlatObject(fe,{},null,function(t){return/^is[A-Z]/.test(t)});function qg(e,t,n){if(!fe.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=fe.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,w){return!fe.isUndefined(w[b])});const r=n.metaTokens,a=n.visitor||m,o=n.dots,l=n.indexes,d=(n.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(t);if(!fe.isFunction(a))throw new TypeError("visitor must be a function");function f(j){if(j===null)return"";if(fe.isDate(j))return j.toISOString();if(fe.isBoolean(j))return j.toString();if(!d&&fe.isBlob(j))throw new Xe("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(j)||fe.isTypedArray(j)?d&&typeof Blob=="function"?new Blob([j]):Buffer.from(j):j}function m(j,b,w){let N=j;if(j&&!w&&typeof j=="object"){if(fe.endsWith(b,"{}"))b=r?b:b.slice(0,-2),j=JSON.stringify(j);else if(fe.isArray(j)&&TK(j)||(fe.isFileList(j)||fe.endsWith(b,"[]"))&&(N=fe.toArray(j)))return b=y5(b),N.forEach(function(E,T){!(fe.isUndefined(E)||E===null)&&t.append(l===!0?xM([b],T,o):l===null?b:b+"[]",f(E))}),!1}return p_(j)?!0:(t.append(xM(w,b,o),f(j)),!1)}const p=[],g=Object.assign(kK,{defaultVisitor:m,convertValue:f,isVisitable:p_});function x(j,b){if(!fe.isUndefined(j)){if(p.indexOf(j)!==-1)throw Error("Circular reference detected in "+b.join("."));p.push(j),fe.forEach(j,function(N,A){(!(fe.isUndefined(N)||N===null)&&a.call(t,N,fe.isString(A)?A.trim():A,b,g))===!0&&x(N,b?b.concat(A):[A])}),p.pop()}}if(!fe.isObject(e))throw new TypeError("data must be an object");return x(e),t}function bM(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function RC(e,t){this._pairs=[],e&&qg(e,this,t)}const x5=RC.prototype;x5.append=function(t,n){this._pairs.push([t,n])};x5.toString=function(t){const n=t?function(r){return t.call(this,r,bM)}:bM;return this._pairs.map(function(a){return n(a[0])+"="+n(a[1])},"").join("&")};function MK(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function b5(e,t,n){if(!t)return e;const r=n&&n.encode||MK;fe.isFunction(n)&&(n={serialize:n});const a=n&&n.serialize;let o;if(a?o=a(t,n):o=fe.isURLSearchParams(t)?t.toString():new RC(t,n).toString(r),o){const l=e.indexOf("#");l!==-1&&(e=e.slice(0,l)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class wM{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){fe.forEach(this.handlers,function(r){r!==null&&t(r)})}}const w5={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},PK=typeof URLSearchParams<"u"?URLSearchParams:RC,RK=typeof FormData<"u"?FormData:null,DK=typeof Blob<"u"?Blob:null,$K={isBrowser:!0,classes:{URLSearchParams:PK,FormData:RK,Blob:DK},protocols:["http","https","file","blob","url","data"]},DC=typeof window<"u"&&typeof document<"u",v_=typeof navigator=="object"&&navigator||void 0,IK=DC&&(!v_||["ReactNative","NativeScript","NS"].indexOf(v_.product)<0),LK=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",BK=DC&&window.location.href||"http://localhost",zK=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:DC,hasStandardBrowserEnv:IK,hasStandardBrowserWebWorkerEnv:LK,navigator:v_,origin:BK},Symbol.toStringTag,{value:"Module"})),cr={...zK,...$K};function qK(e,t){return qg(e,new cr.classes.URLSearchParams,{visitor:function(n,r,a,o){return cr.isNode&&fe.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function FK(e){return fe.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function UK(e){const t={},n=Object.keys(e);let r;const a=n.length;let o;for(r=0;r=n.length;return l=!l&&fe.isArray(a)?a.length:l,d?(fe.hasOwnProp(a,l)?a[l]=[a[l],r]:a[l]=r,!u):((!a[l]||!fe.isObject(a[l]))&&(a[l]=[]),t(n,r,a[l],o)&&fe.isArray(a[l])&&(a[l]=UK(a[l])),!u)}if(fe.isFormData(e)&&fe.isFunction(e.entries)){const n={};return fe.forEachEntry(e,(r,a)=>{t(FK(r),a,n,0)}),n}return null}function HK(e,t,n){if(fe.isString(e))try{return(t||JSON.parse)(e),fe.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Nh={transitional:w5,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",a=r.indexOf("application/json")>-1,o=fe.isObject(t);if(o&&fe.isHTMLForm(t)&&(t=new FormData(t)),fe.isFormData(t))return a?JSON.stringify(j5(t)):t;if(fe.isArrayBuffer(t)||fe.isBuffer(t)||fe.isStream(t)||fe.isFile(t)||fe.isBlob(t)||fe.isReadableStream(t))return t;if(fe.isArrayBufferView(t))return t.buffer;if(fe.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let u;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return qK(t,this.formSerializer).toString();if((u=fe.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return qg(u?{"files[]":t}:t,d&&new d,this.formSerializer)}}return o||a?(n.setContentType("application/json",!1),HK(t)):t}],transformResponse:[function(t){const n=this.transitional||Nh.transitional,r=n&&n.forcedJSONParsing,a=this.responseType==="json";if(fe.isResponse(t)||fe.isReadableStream(t))return t;if(t&&fe.isString(t)&&(r&&!this.responseType||a)){const l=!(n&&n.silentJSONParsing)&&a;try{return JSON.parse(t,this.parseReviver)}catch(u){if(l)throw u.name==="SyntaxError"?Xe.from(u,Xe.ERR_BAD_RESPONSE,this,null,this.response):u}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:cr.classes.FormData,Blob:cr.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],e=>{Nh.headers[e]={}});const WK=fe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),VK=e=>{const t={};let n,r,a;return e&&e.split(` `).forEach(function(l){a=l.indexOf(":"),n=l.substring(0,a).trim().toLowerCase(),r=l.substring(a+1).trim(),!(!n||t[n]&&WK[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},jM=Symbol("internals");function Yd(e){return e&&String(e).trim().toLowerCase()}function tv(e){return e===!1||e==null?e:fe.isArray(e)?e.map(tv):String(e)}function GK(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const YK=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function $0(e,t,n,r,a){if(fe.isFunction(r))return r.call(this,t,n);if(a&&(t=n),!!fe.isString(t)){if(fe.isString(r))return t.indexOf(r)!==-1;if(fe.isRegExp(r))return r.test(t)}}function KK(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function XK(e,t){const n=fe.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(a,o,l){return this[r].call(this,t,a,o,l)},configurable:!0})})}let Pr=class{constructor(t){t&&this.set(t)}set(t,n,r){const a=this;function o(u,d,f){const m=Yd(d);if(!m)throw new Error("header name must be a non-empty string");const p=fe.findKey(a,m);(!p||a[p]===void 0||f===!0||f===void 0&&a[p]!==!1)&&(a[p||d]=tv(u))}const l=(u,d)=>fe.forEach(u,(f,m)=>o(f,m,d));if(fe.isPlainObject(t)||t instanceof this.constructor)l(t,n);else if(fe.isString(t)&&(t=t.trim())&&!YK(t))l(VK(t),n);else if(fe.isObject(t)&&fe.isIterable(t)){let u={},d,f;for(const m of t){if(!fe.isArray(m))throw TypeError("Object iterator must return a key-value pair");u[f=m[0]]=(d=u[f])?fe.isArray(d)?[...d,m[1]]:[d,m[1]]:m[1]}l(u,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=Yd(t),t){const r=fe.findKey(this,t);if(r){const a=this[r];if(!n)return a;if(n===!0)return GK(a);if(fe.isFunction(n))return n.call(this,a,r);if(fe.isRegExp(n))return n.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Yd(t),t){const r=fe.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||$0(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let a=!1;function o(l){if(l=Yd(l),l){const u=fe.findKey(r,l);u&&(!n||$0(r,r[u],u,n))&&(delete r[u],a=!0)}}return fe.isArray(t)?t.forEach(o):o(t),a}clear(t){const n=Object.keys(this);let r=n.length,a=!1;for(;r--;){const o=n[r];(!t||$0(this,this[o],o,t,!0))&&(delete this[o],a=!0)}return a}normalize(t){const n=this,r={};return fe.forEach(this,(a,o)=>{const l=fe.findKey(r,o);if(l){n[l]=tv(a),delete n[o];return}const u=t?KK(o):String(o).trim();u!==o&&delete n[o],n[u]=tv(a),r[u]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return fe.forEach(this,(r,a)=>{r!=null&&r!==!1&&(n[a]=t&&fe.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(a=>r.set(a)),r}static accessor(t){const r=(this[jM]=this[jM]={accessors:{}}).accessors,a=this.prototype;function o(l){const u=Yd(l);r[u]||(XK(a,l),r[u]=!0)}return fe.isArray(t)?t.forEach(o):o(t),this}};Pr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);fe.reduceDescriptors(Pr.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});fe.freezeMethods(Pr);function I0(e,t){const n=this||Nh,r=t||n,a=Pr.from(r.headers);let o=r.data;return fe.forEach(e,function(u){o=u.call(n,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function S5(e){return!!(e&&e.__CANCEL__)}function Du(e,t,n){Xe.call(this,e??"canceled",Xe.ERR_CANCELED,t,n),this.name="CanceledError"}fe.inherits(Du,Xe,{__CANCEL__:!0});function _5(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Xe("Request failed with status code "+n.status,[Xe.ERR_BAD_REQUEST,Xe.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function ZK(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function QK(e,t){e=e||10;const n=new Array(e),r=new Array(e);let a=0,o=0,l;return t=t!==void 0?t:1e3,function(d){const f=Date.now(),m=r[o];l||(l=f),n[a]=d,r[a]=f;let p=o,g=0;for(;p!==a;)g+=n[p++],p=p%e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),f-l{n=m,a=null,o&&(clearTimeout(o),o=null),e(...f)};return[(...f)=>{const m=Date.now(),p=m-n;p>=r?l(f,m):(a=f,o||(o=setTimeout(()=>{o=null,l(a)},r-p)))},()=>a&&l(a)]}const yv=(e,t,n=3)=>{let r=0;const a=QK(50,250);return JK(o=>{const l=o.loaded,u=o.lengthComputable?o.total:void 0,d=l-r,f=a(d),m=l<=u;r=l;const p={loaded:l,total:u,progress:u?l/u:void 0,bytes:d,rate:f||void 0,estimated:f&&u&&m?(u-l)/f:void 0,event:o,lengthComputable:u!=null,[t?"download":"upload"]:!0};e(p)},n)},SM=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},_M=e=>(...t)=>fe.asap(()=>e(...t)),eX=cr.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,cr.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(cr.origin),cr.navigator&&/(msie|trident)/i.test(cr.navigator.userAgent)):()=>!0,tX=cr.hasStandardBrowserEnv?{write(e,t,n,r,a,o,l){if(typeof document>"u")return;const u=[`${e}=${encodeURIComponent(t)}`];fe.isNumber(n)&&u.push(`expires=${new Date(n).toUTCString()}`),fe.isString(r)&&u.push(`path=${r}`),fe.isString(a)&&u.push(`domain=${a}`),o===!0&&u.push("secure"),fe.isString(l)&&u.push(`SameSite=${l}`),document.cookie=u.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function nX(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function rX(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function N5(e,t,n){let r=!nX(t);return e&&(r||n==!1)?rX(e,t):t}const NM=e=>e instanceof Pr?{...e}:e;function cl(e,t){t=t||{};const n={};function r(f,m,p,g){return fe.isPlainObject(f)&&fe.isPlainObject(m)?fe.merge.call({caseless:g},f,m):fe.isPlainObject(m)?fe.merge({},m):fe.isArray(m)?m.slice():m}function a(f,m,p,g){if(fe.isUndefined(m)){if(!fe.isUndefined(f))return r(void 0,f,p,g)}else return r(f,m,p,g)}function o(f,m){if(!fe.isUndefined(m))return r(void 0,m)}function l(f,m){if(fe.isUndefined(m)){if(!fe.isUndefined(f))return r(void 0,f)}else return r(void 0,m)}function u(f,m,p){if(p in t)return r(f,m);if(p in e)return r(void 0,f)}const d={url:o,method:o,data:o,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:u,headers:(f,m,p)=>a(NM(f),NM(m),p,!0)};return fe.forEach(Object.keys({...e,...t}),function(m){const p=d[m]||a,g=p(e[m],t[m],m);fe.isUndefined(g)&&p!==u||(n[m]=g)}),n}const C5=e=>{const t=cl({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:o,headers:l,auth:u}=t;if(t.headers=l=Pr.from(l),t.url=b5(N5(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),u&&l.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):""))),fe.isFormData(n)){if(cr.hasStandardBrowserEnv||cr.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if(fe.isFunction(n.getHeaders)){const d=n.getHeaders(),f=["content-type","content-length"];Object.entries(d).forEach(([m,p])=>{f.includes(m.toLowerCase())&&l.set(m,p)})}}if(cr.hasStandardBrowserEnv&&(r&&fe.isFunction(r)&&(r=r(t)),r||r!==!1&&eX(t.url))){const d=a&&o&&tX.read(o);d&&l.set(a,d)}return t},aX=typeof XMLHttpRequest<"u",iX=aX&&function(e){return new Promise(function(n,r){const a=C5(e);let o=a.data;const l=Pr.from(a.headers).normalize();let{responseType:u,onUploadProgress:d,onDownloadProgress:f}=a,m,p,g,x,j;function b(){x&&x(),j&&j(),a.cancelToken&&a.cancelToken.unsubscribe(m),a.signal&&a.signal.removeEventListener("abort",m)}let w=new XMLHttpRequest;w.open(a.method.toUpperCase(),a.url,!0),w.timeout=a.timeout;function N(){if(!w)return;const E=Pr.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders()),C={data:!u||u==="text"||u==="json"?w.responseText:w.response,status:w.status,statusText:w.statusText,headers:E,config:e,request:w};_5(function(O){n(O),b()},function(O){r(O),b()},C),w=null}"onloadend"in w?w.onloadend=N:w.onreadystatechange=function(){!w||w.readyState!==4||w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)||setTimeout(N)},w.onabort=function(){w&&(r(new Xe("Request aborted",Xe.ECONNABORTED,e,w)),w=null)},w.onerror=function(T){const C=T&&T.message?T.message:"Network Error",k=new Xe(C,Xe.ERR_NETWORK,e,w);k.event=T||null,r(k),w=null},w.ontimeout=function(){let T=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const C=a.transitional||w5;a.timeoutErrorMessage&&(T=a.timeoutErrorMessage),r(new Xe(T,C.clarifyTimeoutError?Xe.ETIMEDOUT:Xe.ECONNABORTED,e,w)),w=null},o===void 0&&l.setContentType(null),"setRequestHeader"in w&&fe.forEach(l.toJSON(),function(T,C){w.setRequestHeader(C,T)}),fe.isUndefined(a.withCredentials)||(w.withCredentials=!!a.withCredentials),u&&u!=="json"&&(w.responseType=a.responseType),f&&([g,j]=yv(f,!0),w.addEventListener("progress",g)),d&&w.upload&&([p,x]=yv(d),w.upload.addEventListener("progress",p),w.upload.addEventListener("loadend",x)),(a.cancelToken||a.signal)&&(m=E=>{w&&(r(!E||E.type?new Du(null,e,w):E),w.abort(),w=null)},a.cancelToken&&a.cancelToken.subscribe(m),a.signal&&(a.signal.aborted?m():a.signal.addEventListener("abort",m)));const A=ZK(a.url);if(A&&cr.protocols.indexOf(A)===-1){r(new Xe("Unsupported protocol "+A+":",Xe.ERR_BAD_REQUEST,e));return}w.send(o||null)})},oX=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,a;const o=function(f){if(!a){a=!0,u();const m=f instanceof Error?f:this.reason;r.abort(m instanceof Xe?m:new Du(m instanceof Error?m.message:m))}};let l=t&&setTimeout(()=>{l=null,o(new Xe(`timeout ${t} of ms exceeded`,Xe.ETIMEDOUT))},t);const u=()=>{e&&(l&&clearTimeout(l),l=null,e.forEach(f=>{f.unsubscribe?f.unsubscribe(o):f.removeEventListener("abort",o)}),e=null)};e.forEach(f=>f.addEventListener("abort",o));const{signal:d}=r;return d.unsubscribe=()=>fe.asap(u),d}},sX=function*(e,t){let n=e.byteLength;if(n{const a=lX(e,t);let o=0,l,u=d=>{l||(l=!0,r&&r(d))};return new ReadableStream({async pull(d){try{const{done:f,value:m}=await a.next();if(f){u(),d.close();return}let p=m.byteLength;if(n){let g=o+=p;n(g)}d.enqueue(new Uint8Array(m))}catch(f){throw u(f),f}},cancel(d){return u(d),a.return()}},{highWaterMark:2})},OM=64*1024,{isFunction:_p}=fe,uX=(({Request:e,Response:t})=>({Request:e,Response:t}))(fe.global),{ReadableStream:EM,TextEncoder:AM}=fe.global,TM=(e,...t)=>{try{return!!e(...t)}catch{return!1}},dX=e=>{e=fe.merge.call({skipUndefined:!0},uX,e);const{fetch:t,Request:n,Response:r}=e,a=t?_p(t):typeof fetch=="function",o=_p(n),l=_p(r);if(!a)return!1;const u=a&&_p(EM),d=a&&(typeof AM=="function"?(j=>b=>j.encode(b))(new AM):async j=>new Uint8Array(await new n(j).arrayBuffer())),f=o&&u&&TM(()=>{let j=!1;const b=new n(cr.origin,{body:new EM,method:"POST",get duplex(){return j=!0,"half"}}).headers.has("Content-Type");return j&&!b}),m=l&&u&&TM(()=>fe.isReadableStream(new r("").body)),p={stream:m&&(j=>j.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(j=>{!p[j]&&(p[j]=(b,w)=>{let N=b&&b[j];if(N)return N.call(b);throw new Xe(`Response type '${j}' is not supported`,Xe.ERR_NOT_SUPPORT,w)})});const g=async j=>{if(j==null)return 0;if(fe.isBlob(j))return j.size;if(fe.isSpecCompliantForm(j))return(await new n(cr.origin,{method:"POST",body:j}).arrayBuffer()).byteLength;if(fe.isArrayBufferView(j)||fe.isArrayBuffer(j))return j.byteLength;if(fe.isURLSearchParams(j)&&(j=j+""),fe.isString(j))return(await d(j)).byteLength},x=async(j,b)=>{const w=fe.toFiniteNumber(j.getContentLength());return w??g(b)};return async j=>{let{url:b,method:w,data:N,signal:A,cancelToken:E,timeout:T,onDownloadProgress:C,onUploadProgress:k,responseType:O,headers:M,withCredentials:I="same-origin",fetchOptions:z}=C5(j),D=t||fetch;O=O?(O+"").toLowerCase():"text";let H=oX([A,E&&E.toAbortSignal()],T),V=null;const F=H&&H.unsubscribe&&(()=>{H.unsubscribe()});let G;try{if(k&&f&&w!=="get"&&w!=="head"&&(G=await x(M,N))!==0){let $=new n(b,{method:"POST",body:N,duplex:"half"}),B;if(fe.isFormData(N)&&(B=$.headers.get("content-type"))&&M.setContentType(B),$.body){const[Y,ne]=SM(G,yv(_M(k)));N=CM($.body,OM,Y,ne)}}fe.isString(I)||(I=I?"include":"omit");const L=o&&"credentials"in n.prototype,R={...z,signal:H,method:w.toUpperCase(),headers:M.normalize().toJSON(),body:N,duplex:"half",credentials:L?I:void 0};V=o&&new n(b,R);let U=await(o?D(V,z):D(b,R));const K=m&&(O==="stream"||O==="response");if(m&&(C||K&&F)){const $={};["status","statusText","headers"].forEach(oe=>{$[oe]=U[oe]});const B=fe.toFiniteNumber(U.headers.get("content-length")),[Y,ne]=C&&SM(B,yv(_M(C),!0))||[];U=new r(CM(U.body,OM,Y,()=>{ne&&ne(),F&&F()}),$)}O=O||"text";let te=await p[fe.findKey(p,O)||"text"](U,j);return!K&&F&&F(),await new Promise(($,B)=>{_5($,B,{data:te,headers:Pr.from(U.headers),status:U.status,statusText:U.statusText,config:j,request:V})})}catch(L){throw F&&F(),L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)?Object.assign(new Xe("Network Error",Xe.ERR_NETWORK,j,V),{cause:L.cause||L}):Xe.from(L,L&&L.code,j,V)}}},fX=new Map,O5=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:a}=t,o=[r,a,n];let l=o.length,u=l,d,f,m=fX;for(;u--;)d=o[u],f=m.get(d),f===void 0&&m.set(d,f=u?new Map:dX(t)),m=f;return f};O5();const $C={http:AK,xhr:iX,fetch:{get:O5}};fe.forEach($C,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const kM=e=>`- ${e}`,hX=e=>fe.isFunction(e)||e===null||e===!1;function mX(e,t){e=fe.isArray(e)?e:[e];const{length:n}=e;let r,a;const o={};for(let l=0;l`adapter ${d} `+(f===!1?"is not supported by the environment":"is not available in the build"));let u=n?l.length>1?`since : `+l.map(kM).join(` `):" "+kM(l[0]):"as no adapter specified";throw new Xe("There is no suitable adapter to dispatch the request "+u,"ERR_NOT_SUPPORT")}return a}const E5={getAdapter:mX,adapters:$C};function L0(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Du(null,e)}function MM(e){return L0(e),e.headers=Pr.from(e.headers),e.data=I0.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),E5.getAdapter(e.adapter||Nh.adapter,e)(e).then(function(r){return L0(e),r.data=I0.call(e,e.transformResponse,r),r.headers=Pr.from(r.headers),r},function(r){return S5(r)||(L0(e),r&&r.response&&(r.response.data=I0.call(e,e.transformResponse,r.response),r.response.headers=Pr.from(r.response.headers))),Promise.reject(r)})}const A5="1.13.2",Fg={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Fg[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const PM={};Fg.transitional=function(t,n,r){function a(o,l){return"[Axios v"+A5+"] Transitional option '"+o+"'"+l+(r?". "+r:"")}return(o,l,u)=>{if(t===!1)throw new Xe(a(l," has been removed"+(n?" in "+n:"")),Xe.ERR_DEPRECATED);return n&&!PM[l]&&(PM[l]=!0,console.warn(a(l," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,l,u):!0}};Fg.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function pX(e,t,n){if(typeof e!="object")throw new Xe("options must be an object",Xe.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let a=r.length;for(;a-- >0;){const o=r[a],l=t[o];if(l){const u=e[o],d=u===void 0||l(u,o,e);if(d!==!0)throw new Xe("option "+o+" must be "+d,Xe.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Xe("Unknown option "+o,Xe.ERR_BAD_OPTION)}}const nv={assertOptions:pX,validators:Fg},ei=nv.validators;let tl=class{constructor(t){this.defaults=t||{},this.interceptors={request:new wM,response:new wM}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const o=a.stack?a.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=` `+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=cl(this.defaults,n);const{transitional:r,paramsSerializer:a,headers:o}=n;r!==void 0&&nv.assertOptions(r,{silentJSONParsing:ei.transitional(ei.boolean),forcedJSONParsing:ei.transitional(ei.boolean),clarifyTimeoutError:ei.transitional(ei.boolean)},!1),a!=null&&(fe.isFunction(a)?n.paramsSerializer={serialize:a}:nv.assertOptions(a,{encode:ei.function,serialize:ei.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),nv.assertOptions(n,{baseUrl:ei.spelling("baseURL"),withXsrfToken:ei.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=o&&fe.merge(o.common,o[n.method]);o&&fe.forEach(["delete","get","head","post","put","patch","common"],j=>{delete o[j]}),n.headers=Pr.concat(l,o);const u=[];let d=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(n)===!1||(d=d&&b.synchronous,u.unshift(b.fulfilled,b.rejected))});const f=[];this.interceptors.response.forEach(function(b){f.push(b.fulfilled,b.rejected)});let m,p=0,g;if(!d){const j=[MM.bind(this),void 0];for(j.unshift(...u),j.push(...f),g=j.length,m=Promise.resolve(n);p{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](a);r._listeners=null}),this.promise.then=a=>{let o;const l=new Promise(u=>{r.subscribe(u),o=u}).then(a);return l.cancel=function(){r.unsubscribe(o)},l},t(function(o,l,u){r.reason||(r.reason=new Du(o,l,u),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new T5(function(a){t=a}),cancel:t}}};function gX(e){return function(n){return e.apply(null,n)}}function yX(e){return fe.isObject(e)&&e.isAxiosError===!0}const g_={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(g_).forEach(([e,t])=>{g_[t]=e});function k5(e){const t=new tl(e),n=l5(tl.prototype.request,t);return fe.extend(n,tl.prototype,t,{allOwnKeys:!0}),fe.extend(n,t,null,{allOwnKeys:!0}),n.create=function(a){return k5(cl(e,a))},n}const ln=k5(Nh);ln.Axios=tl;ln.CanceledError=Du;ln.CancelToken=vX;ln.isCancel=S5;ln.VERSION=A5;ln.toFormData=qg;ln.AxiosError=Xe;ln.Cancel=ln.CanceledError;ln.all=function(t){return Promise.all(t)};ln.spread=gX;ln.isAxiosError=yX;ln.mergeConfig=cl;ln.AxiosHeaders=Pr;ln.formToJSON=e=>j5(fe.isHTMLForm(e)?new FormData(e):e);ln.getAdapter=E5.getAdapter;ln.HttpStatusCode=g_;ln.default=ln;const{Axios:fAe,AxiosError:hAe,CanceledError:mAe,isCancel:pAe,CancelToken:vAe,VERSION:gAe,all:yAe,Cancel:xAe,isAxiosError:bAe,spread:wAe,toFormData:jAe,AxiosHeaders:SAe,HttpStatusCode:_Ae,formToJSON:NAe,getAdapter:CAe,mergeConfig:OAe}=ln;function M5(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t{const n=new Array(e.length+t.length);for(let r=0;r({classGroupId:e,validator:t}),P5=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),xv="-",RM=[],wX="arbitrary..",jX=e=>{const t=_X(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return SX(l);const u=l.split(xv),d=u[0]===""&&u.length>1?1:0;return R5(u,d,t)},getConflictingClassGroupIds:(l,u)=>{if(u){const d=r[l],f=n[l];return d?f?xX(f,d):d:f||RM}return n[l]||RM}}},R5=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const a=e[t],o=n.nextPart.get(a);if(o){const f=R5(e,t+1,o);if(f)return f}const l=n.validators;if(l===null)return;const u=t===0?e.join(xv):e.slice(t).join(xv),d=l.length;for(let f=0;fe.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?wX+r:void 0})(),_X=e=>{const{theme:t,classGroups:n}=e;return NX(n,t)},NX=(e,t)=>{const n=P5();for(const r in e){const a=e[r];IC(a,n,r,t)}return n},IC=(e,t,n,r)=>{const a=e.length;for(let o=0;o{if(typeof e=="string"){OX(e,t,n);return}if(typeof e=="function"){EX(e,t,n,r);return}AX(e,t,n,r)},OX=(e,t,n)=>{const r=e===""?t:D5(t,e);r.classGroupId=n},EX=(e,t,n,r)=>{if(TX(e)){IC(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(bX(n,e))},AX=(e,t,n,r)=>{const a=Object.entries(e),o=a.length;for(let l=0;l{let n=e;const r=t.split(xv),a=r.length;for(let o=0;o"isThemeGetter"in e&&e.isThemeGetter===!0,kX=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const a=(o,l)=>{n[o]=l,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let l=n[o];if(l!==void 0)return l;if((l=r[o])!==void 0)return a(o,l),l},set(o,l){o in n?n[o]=l:a(o,l)}}},y_="!",DM=":",MX=[],$M=(e,t,n,r,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),PX=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=a=>{const o=[];let l=0,u=0,d=0,f;const m=a.length;for(let b=0;bd?f-d:void 0;return $M(o,x,g,j)};if(t){const a=t+DM,o=r;r=l=>l.startsWith(a)?o(l.slice(a.length)):$M(MX,!1,l,void 0,!0)}if(n){const a=r;r=o=>n({className:o,parseClassName:a})}return r},RX=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let a=[];for(let o=0;o0&&(a.sort(),r.push(...a),a=[]),r.push(l)):a.push(l)}return a.length>0&&(a.sort(),r.push(...a)),r}},DX=e=>({cache:kX(e.cacheSize),parseClassName:PX(e),sortModifiers:RX(e),...jX(e)}),$X=/\s+/,IX=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:o}=t,l=[],u=e.trim().split($X);let d="";for(let f=u.length-1;f>=0;f-=1){const m=u[f],{isExternal:p,modifiers:g,hasImportantModifier:x,baseClassName:j,maybePostfixModifierPosition:b}=n(m);if(p){d=m+(d.length>0?" "+d:d);continue}let w=!!b,N=r(w?j.substring(0,b):j);if(!N){if(!w){d=m+(d.length>0?" "+d:d);continue}if(N=r(j),!N){d=m+(d.length>0?" "+d:d);continue}w=!1}const A=g.length===0?"":g.length===1?g[0]:o(g).join(":"),E=x?A+y_:A,T=E+N;if(l.indexOf(T)>-1)continue;l.push(T);const C=a(N,w);for(let k=0;k0?" "+d:d)}return d},LX=(...e)=>{let t=0,n,r,a="";for(;t{if(typeof e=="string")return e;let t,n="";for(let r=0;r{let n,r,a,o;const l=d=>{const f=t.reduce((m,p)=>p(m),e());return n=DX(f),r=n.cache.get,a=n.cache.set,o=u,u(d)},u=d=>{const f=r(d);if(f)return f;const m=IX(d,n);return a(d,m),m};return o=l,(...d)=>o(LX(...d))},zX=[],En=e=>{const t=n=>n[e]||zX;return t.isThemeGetter=!0,t},I5=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,L5=/^\((?:(\w[\w-]*):)?(.+)\)$/i,qX=/^\d+\/\d+$/,FX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,UX=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,HX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,WX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,VX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wc=e=>qX.test(e),nt=e=>!!e&&!Number.isNaN(Number(e)),Lo=e=>!!e&&Number.isInteger(Number(e)),B0=e=>e.endsWith("%")&&nt(e.slice(0,-1)),Fi=e=>FX.test(e),GX=()=>!0,YX=e=>UX.test(e)&&!HX.test(e),B5=()=>!1,KX=e=>WX.test(e),XX=e=>VX.test(e),ZX=e=>!Te(e)&&!ke(e),QX=e=>$u(e,F5,B5),Te=e=>I5.test(e),Ls=e=>$u(e,U5,YX),z0=e=>$u(e,rZ,nt),IM=e=>$u(e,z5,B5),JX=e=>$u(e,q5,XX),Np=e=>$u(e,H5,KX),ke=e=>L5.test(e),Kd=e=>Iu(e,U5),eZ=e=>Iu(e,aZ),LM=e=>Iu(e,z5),tZ=e=>Iu(e,F5),nZ=e=>Iu(e,q5),Cp=e=>Iu(e,H5,!0),$u=(e,t,n)=>{const r=I5.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Iu=(e,t,n=!1)=>{const r=L5.exec(e);return r?r[1]?t(r[1]):n:!1},z5=e=>e==="position"||e==="percentage",q5=e=>e==="image"||e==="url",F5=e=>e==="length"||e==="size"||e==="bg-size",U5=e=>e==="length",rZ=e=>e==="number",aZ=e=>e==="family-name",H5=e=>e==="shadow",iZ=()=>{const e=En("color"),t=En("font"),n=En("text"),r=En("font-weight"),a=En("tracking"),o=En("leading"),l=En("breakpoint"),u=En("container"),d=En("spacing"),f=En("radius"),m=En("shadow"),p=En("inset-shadow"),g=En("text-shadow"),x=En("drop-shadow"),j=En("blur"),b=En("perspective"),w=En("aspect"),N=En("ease"),A=En("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...T(),ke,Te],k=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],M=()=>[ke,Te,d],I=()=>[wc,"full","auto",...M()],z=()=>[Lo,"none","subgrid",ke,Te],D=()=>["auto",{span:["full",Lo,ke,Te]},Lo,ke,Te],H=()=>[Lo,"auto",ke,Te],V=()=>["auto","min","max","fr",ke,Te],F=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],G=()=>["start","end","center","stretch","center-safe","end-safe"],L=()=>["auto",...M()],R=()=>[wc,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...M()],U=()=>[e,ke,Te],K=()=>[...T(),LM,IM,{position:[ke,Te]}],te=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",tZ,QX,{size:[ke,Te]}],B=()=>[B0,Kd,Ls],Y=()=>["","none","full",f,ke,Te],ne=()=>["",nt,Kd,Ls],oe=()=>["solid","dashed","dotted","double"],xe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ee=()=>[nt,B0,LM,IM],ae=()=>["","none",j,ke,Te],Z=()=>["none",nt,ke,Te],pe=()=>["none",nt,ke,Te],je=()=>[nt,ke,Te],le=()=>[wc,"full",...M()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fi],breakpoint:[Fi],color:[GX],container:[Fi],"drop-shadow":[Fi],ease:["in","out","in-out"],font:[ZX],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fi],shadow:[Fi],spacing:["px",nt],text:[Fi],"text-shadow":[Fi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",wc,Te,ke,w]}],container:["container"],columns:[{columns:[nt,Te,ke,u]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{start:I()}],end:[{end:I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[Lo,"auto",ke,Te]}],basis:[{basis:[wc,"full","auto",u,...M()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[nt,wc,"auto","initial","none",Te]}],grow:[{grow:["",nt,ke,Te]}],shrink:[{shrink:["",nt,ke,Te]}],order:[{order:[Lo,"first","last","none",ke,Te]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":H()}],"col-end":[{"col-end":H()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":H()}],"row-end":[{"row-end":H()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":V()}],"auto-rows":[{"auto-rows":V()}],gap:[{gap:M()}],"gap-x":[{"gap-x":M()}],"gap-y":[{"gap-y":M()}],"justify-content":[{justify:[...F(),"normal"]}],"justify-items":[{"justify-items":[...G(),"normal"]}],"justify-self":[{"justify-self":["auto",...G()]}],"align-content":[{content:["normal",...F()]}],"align-items":[{items:[...G(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...G(),{baseline:["","last"]}]}],"place-content":[{"place-content":F()}],"place-items":[{"place-items":[...G(),"baseline"]}],"place-self":[{"place-self":["auto",...G()]}],p:[{p:M()}],px:[{px:M()}],py:[{py:M()}],ps:[{ps:M()}],pe:[{pe:M()}],pt:[{pt:M()}],pr:[{pr:M()}],pb:[{pb:M()}],pl:[{pl:M()}],m:[{m:L()}],mx:[{mx:L()}],my:[{my:L()}],ms:[{ms:L()}],me:[{me:L()}],mt:[{mt:L()}],mr:[{mr:L()}],mb:[{mb:L()}],ml:[{ml:L()}],"space-x":[{"space-x":M()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":M()}],"space-y-reverse":["space-y-reverse"],size:[{size:R()}],w:[{w:[u,"screen",...R()]}],"min-w":[{"min-w":[u,"screen","none",...R()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[l]},...R()]}],h:[{h:["screen","lh",...R()]}],"min-h":[{"min-h":["screen","lh","none",...R()]}],"max-h":[{"max-h":["screen","lh",...R()]}],"font-size":[{text:["base",n,Kd,Ls]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ke,z0]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",B0,Te]}],"font-family":[{font:[eZ,Te,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,ke,Te]}],"line-clamp":[{"line-clamp":[nt,"none",ke,z0]}],leading:[{leading:[o,...M()]}],"list-image":[{"list-image":["none",ke,Te]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ke,Te]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[nt,"from-font","auto",ke,Ls]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[nt,"auto",ke,Te]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke,Te]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ke,Te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:K()}],"bg-repeat":[{bg:te()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Lo,ke,Te],radial:["",ke,Te],conic:[Lo,ke,Te]},nZ,JX]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:B()}],"gradient-via-pos":[{via:B()}],"gradient-to-pos":[{to:B()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:Y()}],"rounded-s":[{"rounded-s":Y()}],"rounded-e":[{"rounded-e":Y()}],"rounded-t":[{"rounded-t":Y()}],"rounded-r":[{"rounded-r":Y()}],"rounded-b":[{"rounded-b":Y()}],"rounded-l":[{"rounded-l":Y()}],"rounded-ss":[{"rounded-ss":Y()}],"rounded-se":[{"rounded-se":Y()}],"rounded-ee":[{"rounded-ee":Y()}],"rounded-es":[{"rounded-es":Y()}],"rounded-tl":[{"rounded-tl":Y()}],"rounded-tr":[{"rounded-tr":Y()}],"rounded-br":[{"rounded-br":Y()}],"rounded-bl":[{"rounded-bl":Y()}],"border-w":[{border:ne()}],"border-w-x":[{"border-x":ne()}],"border-w-y":[{"border-y":ne()}],"border-w-s":[{"border-s":ne()}],"border-w-e":[{"border-e":ne()}],"border-w-t":[{"border-t":ne()}],"border-w-r":[{"border-r":ne()}],"border-w-b":[{"border-b":ne()}],"border-w-l":[{"border-l":ne()}],"divide-x":[{"divide-x":ne()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ne()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[nt,ke,Te]}],"outline-w":[{outline:["",nt,Kd,Ls]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",m,Cp,Np]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",p,Cp,Np]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[nt,Ls]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":ne()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",g,Cp,Np]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[nt,ke,Te]}],"mix-blend":[{"mix-blend":[...xe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":xe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[nt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ee()}],"mask-image-linear-to-pos":[{"mask-linear-to":ee()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":ee()}],"mask-image-t-to-pos":[{"mask-t-to":ee()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":ee()}],"mask-image-r-to-pos":[{"mask-r-to":ee()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":ee()}],"mask-image-b-to-pos":[{"mask-b-to":ee()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":ee()}],"mask-image-l-to-pos":[{"mask-l-to":ee()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":ee()}],"mask-image-x-to-pos":[{"mask-x-to":ee()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":ee()}],"mask-image-y-to-pos":[{"mask-y-to":ee()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[ke,Te]}],"mask-image-radial-from-pos":[{"mask-radial-from":ee()}],"mask-image-radial-to-pos":[{"mask-radial-to":ee()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[nt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ee()}],"mask-image-conic-to-pos":[{"mask-conic-to":ee()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:K()}],"mask-repeat":[{mask:te()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ke,Te]}],filter:[{filter:["","none",ke,Te]}],blur:[{blur:ae()}],brightness:[{brightness:[nt,ke,Te]}],contrast:[{contrast:[nt,ke,Te]}],"drop-shadow":[{"drop-shadow":["","none",x,Cp,Np]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",nt,ke,Te]}],"hue-rotate":[{"hue-rotate":[nt,ke,Te]}],invert:[{invert:["",nt,ke,Te]}],saturate:[{saturate:[nt,ke,Te]}],sepia:[{sepia:["",nt,ke,Te]}],"backdrop-filter":[{"backdrop-filter":["","none",ke,Te]}],"backdrop-blur":[{"backdrop-blur":ae()}],"backdrop-brightness":[{"backdrop-brightness":[nt,ke,Te]}],"backdrop-contrast":[{"backdrop-contrast":[nt,ke,Te]}],"backdrop-grayscale":[{"backdrop-grayscale":["",nt,ke,Te]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[nt,ke,Te]}],"backdrop-invert":[{"backdrop-invert":["",nt,ke,Te]}],"backdrop-opacity":[{"backdrop-opacity":[nt,ke,Te]}],"backdrop-saturate":[{"backdrop-saturate":[nt,ke,Te]}],"backdrop-sepia":[{"backdrop-sepia":["",nt,ke,Te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":M()}],"border-spacing-x":[{"border-spacing-x":M()}],"border-spacing-y":[{"border-spacing-y":M()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ke,Te]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[nt,"initial",ke,Te]}],ease:[{ease:["linear","initial",N,ke,Te]}],delay:[{delay:[nt,ke,Te]}],animate:[{animate:["none",A,ke,Te]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,ke,Te]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:Z()}],"rotate-x":[{"rotate-x":Z()}],"rotate-y":[{"rotate-y":Z()}],"rotate-z":[{"rotate-z":Z()}],scale:[{scale:pe()}],"scale-x":[{"scale-x":pe()}],"scale-y":[{"scale-y":pe()}],"scale-z":[{"scale-z":pe()}],"scale-3d":["scale-3d"],skew:[{skew:je()}],"skew-x":[{"skew-x":je()}],"skew-y":[{"skew-y":je()}],transform:[{transform:[ke,Te,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":["translate-none"],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ke,Te]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ke,Te]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[nt,Kd,Ls,z0]}],stroke:[{stroke:["none",...U()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},oZ=BX(iZ);function de(...e){return oZ(Ye(e))}const st=y.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:de("rounded-xl border bg-card text-card-foreground shadow",e),...t}));st.displayName="Card";const qt=y.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:de("flex flex-col space-y-1.5 p-6",e),...t}));qt.displayName="CardHeader";const Ft=y.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:de("font-semibold leading-none tracking-tight",e),...t}));Ft.displayName="CardTitle";const er=y.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:de("text-sm text-muted-foreground",e),...t}));er.displayName="CardDescription";const on=y.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:de("p-6 pt-0",e),...t}));on.displayName="CardContent";const W5=y.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:de("flex items-center p-6 pt-0",e),...t}));W5.displayName="CardFooter";function Se(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e?.(a),n===!1||!a.defaultPrevented)return t?.(a)}}function sZ(e,t){const n=y.createContext(t),r=o=>{const{children:l,...u}=o,d=y.useMemo(()=>u,Object.values(u));return i.jsx(n.Provider,{value:d,children:l})};r.displayName=e+"Provider";function a(o){const l=y.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,a]}function hr(e,t=[]){let n=[];function r(o,l){const u=y.createContext(l),d=n.length;n=[...n,l];const f=p=>{const{scope:g,children:x,...j}=p,b=g?.[e]?.[d]||u,w=y.useMemo(()=>j,Object.values(j));return i.jsx(b.Provider,{value:w,children:x})};f.displayName=o+"Provider";function m(p,g){const x=g?.[e]?.[d]||u,j=y.useContext(x);if(j)return j;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[f,m]}const a=()=>{const o=n.map(l=>y.createContext(l));return function(u){const d=u?.[e]||o;return y.useMemo(()=>({[`__scope${e}`]:{...u,[e]:d}}),[u,d])}};return a.scopeName=e,[r,lZ(a,...t)]}function lZ(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){const l=r.reduce((u,{useScope:d,scopeName:f})=>{const p=d(o)[`__scope${f}`];return{...u,...p}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}function BM(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Rr(...e){return t=>{let n=!1;const r=e.map(a=>{const o=BM(a,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let a=0;a{const{children:o,...l}=r,u=y.Children.toArray(o),d=u.find(dZ);if(d){const f=d.props.children,m=u.map(p=>p===d?y.Children.count(f)>1?y.Children.only(null):y.isValidElement(f)?f.props.children:null:p);return i.jsx(t,{...l,ref:a,children:y.isValidElement(f)?y.cloneElement(f,void 0,m):null})}return i.jsx(t,{...l,ref:a,children:o})});return n.displayName=`${e}.Slot`,n}function cZ(e){const t=y.forwardRef((n,r)=>{const{children:a,...o}=n;if(y.isValidElement(a)){const l=hZ(a),u=fZ(o,a.props);return a.type!==y.Fragment&&(u.ref=r?Rr(r,l):l),y.cloneElement(a,u)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var uZ=Symbol("radix.slottable");function dZ(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===uZ}function fZ(e,t){const n={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...u)=>{const d=o(...u);return a(...u),d}:a&&(n[r]=a):r==="style"?n[r]={...a,...o}:r==="className"&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function hZ(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Ch(e){const t=e+"CollectionProvider",[n,r]=hr(t),[a,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=b=>{const{scope:w,children:N}=b,A=W.useRef(null),E=W.useRef(new Map).current;return i.jsx(a,{scope:w,itemMap:E,collectionRef:A,children:N})};l.displayName=t;const u=e+"CollectionSlot",d=zM(u),f=W.forwardRef((b,w)=>{const{scope:N,children:A}=b,E=o(u,N),T=qe(w,E.collectionRef);return i.jsx(d,{ref:T,children:A})});f.displayName=u;const m=e+"CollectionItemSlot",p="data-radix-collection-item",g=zM(m),x=W.forwardRef((b,w)=>{const{scope:N,children:A,...E}=b,T=W.useRef(null),C=qe(w,T),k=o(m,N);return W.useEffect(()=>(k.itemMap.set(T,{ref:T,...E}),()=>void k.itemMap.delete(T))),i.jsx(g,{[p]:"",ref:C,children:A})});x.displayName=m;function j(b){const w=o(e+"CollectionConsumer",b);return W.useCallback(()=>{const A=w.collectionRef.current;if(!A)return[];const E=Array.from(A.querySelectorAll(`[${p}]`));return Array.from(w.itemMap.values()).sort((k,O)=>E.indexOf(k.ref.current)-E.indexOf(O.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:l,Slot:f,ItemSlot:x},j,r]}var Un=globalThis?.document?y.useLayoutEffect:()=>{},mZ=jC[" useId ".trim().toString()]||(()=>{}),pZ=0;function Fn(e){const[t,n]=y.useState(mZ());return Un(()=>{n(r=>r??String(pZ++))},[e]),t?`radix-${t}`:""}function vZ(e){const t=gZ(e),n=y.forwardRef((r,a)=>{const{children:o,...l}=r,u=y.Children.toArray(o),d=u.find(xZ);if(d){const f=d.props.children,m=u.map(p=>p===d?y.Children.count(f)>1?y.Children.only(null):y.isValidElement(f)?f.props.children:null:p);return i.jsx(t,{...l,ref:a,children:y.isValidElement(f)?y.cloneElement(f,void 0,m):null})}return i.jsx(t,{...l,ref:a,children:o})});return n.displayName=`${e}.Slot`,n}function gZ(e){const t=y.forwardRef((n,r)=>{const{children:a,...o}=n;if(y.isValidElement(a)){const l=wZ(a),u=bZ(o,a.props);return a.type!==y.Fragment&&(u.ref=r?Rr(r,l):l),y.cloneElement(a,u)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var yZ=Symbol("radix.slottable");function xZ(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===yZ}function bZ(e,t){const n={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...u)=>{const d=o(...u);return a(...u),d}:a&&(n[r]=a):r==="style"?n[r]={...a,...o}:r==="className"&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function wZ(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var jZ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Pe=jZ.reduce((e,t)=>{const n=vZ(`Primitive.${t}`),r=y.forwardRef((a,o)=>{const{asChild:l,...u}=a,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(d,{...u,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function LC(e,t){e&&wl.flushSync(()=>e.dispatchEvent(t))}function nn(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e}),y.useMemo(()=>(...n)=>t.current?.(...n),[])}var SZ=jC[" useInsertionEffect ".trim().toString()]||Un;function Na({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,o,l]=_Z({defaultProp:t,onChange:n}),u=e!==void 0,d=u?e:a;{const m=y.useRef(e!==void 0);y.useEffect(()=>{const p=m.current;p!==u&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),m.current=u},[u,r])}const f=y.useCallback(m=>{if(u){const p=NZ(m)?m(e):m;p!==e&&l.current?.(p)}else o(m)},[u,e,o,l]);return[d,f]}function _Z({defaultProp:e,onChange:t}){const[n,r]=y.useState(e),a=y.useRef(n),o=y.useRef(t);return SZ(()=>{o.current=t},[t]),y.useEffect(()=>{a.current!==n&&(o.current?.(n),a.current=n)},[n,a]),[n,r,o]}function NZ(e){return typeof e=="function"}var CZ=y.createContext(void 0);function Lu(e){const t=y.useContext(CZ);return e||t||"ltr"}var q0="rovingFocusGroup.onEntryFocus",OZ={bubbles:!1,cancelable:!0},Oh="RovingFocusGroup",[x_,V5,EZ]=Ch(Oh),[AZ,Ug]=hr(Oh,[EZ]),[TZ,kZ]=AZ(Oh),G5=y.forwardRef((e,t)=>i.jsx(x_.Provider,{scope:e.__scopeRovingFocusGroup,children:i.jsx(x_.Slot,{scope:e.__scopeRovingFocusGroup,children:i.jsx(MZ,{...e,ref:t})})}));G5.displayName=Oh;var MZ=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:o,currentTabStopId:l,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:d,onEntryFocus:f,preventScrollOnEntryFocus:m=!1,...p}=e,g=y.useRef(null),x=qe(t,g),j=Lu(o),[b,w]=Na({prop:l,defaultProp:u??null,onChange:d,caller:Oh}),[N,A]=y.useState(!1),E=nn(f),T=V5(n),C=y.useRef(!1),[k,O]=y.useState(0);return y.useEffect(()=>{const M=g.current;if(M)return M.addEventListener(q0,E),()=>M.removeEventListener(q0,E)},[E]),i.jsx(TZ,{scope:n,orientation:r,dir:j,loop:a,currentTabStopId:b,onItemFocus:y.useCallback(M=>w(M),[w]),onItemShiftTab:y.useCallback(()=>A(!0),[]),onFocusableItemAdd:y.useCallback(()=>O(M=>M+1),[]),onFocusableItemRemove:y.useCallback(()=>O(M=>M-1),[]),children:i.jsx(Pe.div,{tabIndex:N||k===0?-1:0,"data-orientation":r,...p,ref:x,style:{outline:"none",...e.style},onMouseDown:Se(e.onMouseDown,()=>{C.current=!0}),onFocus:Se(e.onFocus,M=>{const I=!C.current;if(M.target===M.currentTarget&&I&&!N){const z=new CustomEvent(q0,OZ);if(M.currentTarget.dispatchEvent(z),!z.defaultPrevented){const D=T().filter(L=>L.focusable),H=D.find(L=>L.active),V=D.find(L=>L.id===b),G=[H,V,...D].filter(Boolean).map(L=>L.ref.current);X5(G,m)}}C.current=!1}),onBlur:Se(e.onBlur,()=>A(!1))})})}),Y5="RovingFocusGroupItem",K5=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:o,children:l,...u}=e,d=Fn(),f=o||d,m=kZ(Y5,n),p=m.currentTabStopId===f,g=V5(n),{onFocusableItemAdd:x,onFocusableItemRemove:j,currentTabStopId:b}=m;return y.useEffect(()=>{if(r)return x(),()=>j()},[r,x,j]),i.jsx(x_.ItemSlot,{scope:n,id:f,focusable:r,active:a,children:i.jsx(Pe.span,{tabIndex:p?0:-1,"data-orientation":m.orientation,...u,ref:t,onMouseDown:Se(e.onMouseDown,w=>{r?m.onItemFocus(f):w.preventDefault()}),onFocus:Se(e.onFocus,()=>m.onItemFocus(f)),onKeyDown:Se(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){m.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const N=DZ(w,m.orientation,m.dir);if(N!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let E=g().filter(T=>T.focusable).map(T=>T.ref.current);if(N==="last")E.reverse();else if(N==="prev"||N==="next"){N==="prev"&&E.reverse();const T=E.indexOf(w.currentTarget);E=m.loop?$Z(E,T+1):E.slice(T+1)}setTimeout(()=>X5(E))}}),children:typeof l=="function"?l({isCurrentTabStop:p,hasTabStop:b!=null}):l})})});K5.displayName=Y5;var PZ={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function RZ(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function DZ(e,t,n){const r=RZ(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return PZ[r]}function X5(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function $Z(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Z5=G5,Q5=K5;function IZ(e,t){return y.useReducer((n,r)=>t[n][r]??n,e)}var Rn=e=>{const{present:t,children:n}=e,r=LZ(t),a=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),o=qe(r.ref,BZ(a));return typeof n=="function"||r.isPresent?y.cloneElement(a,{ref:o}):null};Rn.displayName="Presence";function LZ(e){const[t,n]=y.useState(),r=y.useRef(null),a=y.useRef(e),o=y.useRef("none"),l=e?"mounted":"unmounted",[u,d]=IZ(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const f=Op(r.current);o.current=u==="mounted"?f:"none"},[u]),Un(()=>{const f=r.current,m=a.current;if(m!==e){const g=o.current,x=Op(f);e?d("MOUNT"):x==="none"||f?.display==="none"?d("UNMOUNT"):d(m&&g!==x?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,d]),Un(()=>{if(t){let f;const m=t.ownerDocument.defaultView??window,p=x=>{const b=Op(r.current).includes(CSS.escape(x.animationName));if(x.target===t&&b&&(d("ANIMATION_END"),!a.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",f=m.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},g=x=>{x.target===t&&(o.current=Op(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{m.clearTimeout(f),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:y.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function Op(e){return e?.animationName||"none"}function BZ(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Hg="Tabs",[zZ]=hr(Hg,[Ug]),J5=Ug(),[qZ,BC]=zZ(Hg),eB=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:o,orientation:l="horizontal",dir:u,activationMode:d="automatic",...f}=e,m=Lu(u),[p,g]=Na({prop:r,onChange:a,defaultProp:o??"",caller:Hg});return i.jsx(qZ,{scope:n,baseId:Fn(),value:p,onValueChange:g,orientation:l,dir:m,activationMode:d,children:i.jsx(Pe.div,{dir:m,"data-orientation":l,...f,ref:t})})});eB.displayName=Hg;var tB="TabsList",nB=y.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...a}=e,o=BC(tB,n),l=J5(n);return i.jsx(Z5,{asChild:!0,...l,orientation:o.orientation,dir:o.dir,loop:r,children:i.jsx(Pe.div,{role:"tablist","aria-orientation":o.orientation,...a,ref:t})})});nB.displayName=tB;var rB="TabsTrigger",aB=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...o}=e,l=BC(rB,n),u=J5(n),d=sB(l.baseId,r),f=lB(l.baseId,r),m=r===l.value;return i.jsx(Q5,{asChild:!0,...u,focusable:!a,active:m,children:i.jsx(Pe.button,{type:"button",role:"tab","aria-selected":m,"aria-controls":f,"data-state":m?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:d,...o,ref:t,onMouseDown:Se(e.onMouseDown,p=>{!a&&p.button===0&&p.ctrlKey===!1?l.onValueChange(r):p.preventDefault()}),onKeyDown:Se(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&l.onValueChange(r)}),onFocus:Se(e.onFocus,()=>{const p=l.activationMode!=="manual";!m&&!a&&p&&l.onValueChange(r)})})})});aB.displayName=rB;var iB="TabsContent",oB=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:a,children:o,...l}=e,u=BC(iB,n),d=sB(u.baseId,r),f=lB(u.baseId,r),m=r===u.value,p=y.useRef(m);return y.useEffect(()=>{const g=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(g)},[]),i.jsx(Rn,{present:a||m,children:({present:g})=>i.jsx(Pe.div,{"data-state":m?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":d,hidden:!g,id:f,tabIndex:0,...l,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:g&&o})})});oB.displayName=iB;function sB(e,t){return`${e}-trigger-${t}`}function lB(e,t){return`${e}-content-${t}`}var FZ=eB,cB=nB,uB=aB,dB=oB;const ul=FZ,Qo=y.forwardRef(({className:e,...t},n)=>i.jsx(cB,{ref:n,className:de("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));Qo.displayName=cB.displayName;const Ot=y.forwardRef(({className:e,...t},n)=>i.jsx(uB,{ref:n,className:de("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));Ot.displayName=uB.displayName;const en=y.forwardRef(({className:e,...t},n)=>i.jsx(dB,{ref:n,className:de("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",e),...t}));en.displayName=dB.displayName;function Ef(e,[t,n]){return Math.min(n,Math.max(t,e))}function UZ(e,t){return y.useReducer((n,r)=>t[n][r]??n,e)}var zC="ScrollArea",[fB]=hr(zC),[HZ,Oa]=fB(zC),hB=y.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:a,scrollHideDelay:o=600,...l}=e,[u,d]=y.useState(null),[f,m]=y.useState(null),[p,g]=y.useState(null),[x,j]=y.useState(null),[b,w]=y.useState(null),[N,A]=y.useState(0),[E,T]=y.useState(0),[C,k]=y.useState(!1),[O,M]=y.useState(!1),I=qe(t,D=>d(D)),z=Lu(a);return i.jsx(HZ,{scope:n,type:r,dir:z,scrollHideDelay:o,scrollArea:u,viewport:f,onViewportChange:m,content:p,onContentChange:g,scrollbarX:x,onScrollbarXChange:j,scrollbarXEnabled:C,onScrollbarXEnabledChange:k,scrollbarY:b,onScrollbarYChange:w,scrollbarYEnabled:O,onScrollbarYEnabledChange:M,onCornerWidthChange:A,onCornerHeightChange:T,children:i.jsx(Pe.div,{dir:z,...l,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":N+"px","--radix-scroll-area-corner-height":E+"px",...e.style}})})});hB.displayName=zC;var mB="ScrollAreaViewport",pB=y.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:a,...o}=e,l=Oa(mB,n),u=y.useRef(null),d=qe(t,u,l.onViewportChange);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),i.jsx(Pe.div,{"data-radix-scroll-area-viewport":"",...o,ref:d,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:i.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});pB.displayName=mB;var xi="ScrollAreaScrollbar",qC=y.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=Oa(xi,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:l}=a,u=e.orientation==="horizontal";return y.useEffect(()=>(u?o(!0):l(!0),()=>{u?o(!1):l(!1)}),[u,o,l]),a.type==="hover"?i.jsx(WZ,{...r,ref:t,forceMount:n}):a.type==="scroll"?i.jsx(VZ,{...r,ref:t,forceMount:n}):a.type==="auto"?i.jsx(vB,{...r,ref:t,forceMount:n}):a.type==="always"?i.jsx(FC,{...r,ref:t}):null});qC.displayName=xi;var WZ=y.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=Oa(xi,e.__scopeScrollArea),[o,l]=y.useState(!1);return y.useEffect(()=>{const u=a.scrollArea;let d=0;if(u){const f=()=>{window.clearTimeout(d),l(!0)},m=()=>{d=window.setTimeout(()=>l(!1),a.scrollHideDelay)};return u.addEventListener("pointerenter",f),u.addEventListener("pointerleave",m),()=>{window.clearTimeout(d),u.removeEventListener("pointerenter",f),u.removeEventListener("pointerleave",m)}}},[a.scrollArea,a.scrollHideDelay]),i.jsx(Rn,{present:n||o,children:i.jsx(vB,{"data-state":o?"visible":"hidden",...r,ref:t})})}),VZ=y.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=Oa(xi,e.__scopeScrollArea),o=e.orientation==="horizontal",l=Vg(()=>d("SCROLL_END"),100),[u,d]=UZ("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return y.useEffect(()=>{if(u==="idle"){const f=window.setTimeout(()=>d("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(f)}},[u,a.scrollHideDelay,d]),y.useEffect(()=>{const f=a.viewport,m=o?"scrollLeft":"scrollTop";if(f){let p=f[m];const g=()=>{const x=f[m];p!==x&&(d("SCROLL"),l()),p=x};return f.addEventListener("scroll",g),()=>f.removeEventListener("scroll",g)}},[a.viewport,o,d,l]),i.jsx(Rn,{present:n||u!=="hidden",children:i.jsx(FC,{"data-state":u==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Se(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Se(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),vB=y.forwardRef((e,t)=>{const n=Oa(xi,e.__scopeScrollArea),{forceMount:r,...a}=e,[o,l]=y.useState(!1),u=e.orientation==="horizontal",d=Vg(()=>{if(n.viewport){const f=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,a=Oa(xi,e.__scopeScrollArea),o=y.useRef(null),l=y.useRef(0),[u,d]=y.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),f=wB(u.viewport,u.content),m={...r,sizes:u,onSizesChange:d,hasThumb:f>0&&f<1,onThumbChange:g=>o.current=g,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:g=>l.current=g};function p(g,x){return QZ(g,l.current,u,x)}return n==="horizontal"?i.jsx(GZ,{...m,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const g=a.viewport.scrollLeft,x=qM(g,u,a.dir);o.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:g=>{a.viewport&&(a.viewport.scrollLeft=g)},onDragScroll:g=>{a.viewport&&(a.viewport.scrollLeft=p(g,a.dir))}}):n==="vertical"?i.jsx(YZ,{...m,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const g=a.viewport.scrollTop,x=qM(g,u);o.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:g=>{a.viewport&&(a.viewport.scrollTop=g)},onDragScroll:g=>{a.viewport&&(a.viewport.scrollTop=p(g))}}):null}),GZ=y.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...a}=e,o=Oa(xi,e.__scopeScrollArea),[l,u]=y.useState(),d=y.useRef(null),f=qe(t,d,o.onScrollbarXChange);return y.useEffect(()=>{d.current&&u(getComputedStyle(d.current))},[d]),i.jsx(yB,{"data-orientation":"horizontal",...a,ref:f,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Wg(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.x),onDragScroll:m=>e.onDragScroll(m.x),onWheelScroll:(m,p)=>{if(o.viewport){const g=o.viewport.scrollLeft+m.deltaX;e.onWheelScroll(g),SB(g,p)&&m.preventDefault()}},onResize:()=>{d.current&&o.viewport&&l&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:wv(l.paddingLeft),paddingEnd:wv(l.paddingRight)}})}})}),YZ=y.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...a}=e,o=Oa(xi,e.__scopeScrollArea),[l,u]=y.useState(),d=y.useRef(null),f=qe(t,d,o.onScrollbarYChange);return y.useEffect(()=>{d.current&&u(getComputedStyle(d.current))},[d]),i.jsx(yB,{"data-orientation":"vertical",...a,ref:f,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Wg(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.y),onDragScroll:m=>e.onDragScroll(m.y),onWheelScroll:(m,p)=>{if(o.viewport){const g=o.viewport.scrollTop+m.deltaY;e.onWheelScroll(g),SB(g,p)&&m.preventDefault()}},onResize:()=>{d.current&&o.viewport&&l&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:wv(l.paddingTop),paddingEnd:wv(l.paddingBottom)}})}})}),[KZ,gB]=fB(xi),yB=y.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:a,onThumbChange:o,onThumbPointerUp:l,onThumbPointerDown:u,onThumbPositionChange:d,onDragScroll:f,onWheelScroll:m,onResize:p,...g}=e,x=Oa(xi,n),[j,b]=y.useState(null),w=qe(t,I=>b(I)),N=y.useRef(null),A=y.useRef(""),E=x.viewport,T=r.content-r.viewport,C=nn(m),k=nn(d),O=Vg(p,10);function M(I){if(N.current){const z=I.clientX-N.current.left,D=I.clientY-N.current.top;f({x:z,y:D})}}return y.useEffect(()=>{const I=z=>{const D=z.target;j?.contains(D)&&C(z,T)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[E,j,T,C]),y.useEffect(k,[r,k]),ru(j,O),ru(x.content,O),i.jsx(KZ,{scope:n,scrollbar:j,hasThumb:a,onThumbChange:nn(o),onThumbPointerUp:nn(l),onThumbPositionChange:k,onThumbPointerDown:nn(u),children:i.jsx(Pe.div,{...g,ref:w,style:{position:"absolute",...g.style},onPointerDown:Se(e.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),N.current=j.getBoundingClientRect(),A.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),M(I))}),onPointerMove:Se(e.onPointerMove,M),onPointerUp:Se(e.onPointerUp,I=>{const z=I.target;z.hasPointerCapture(I.pointerId)&&z.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=A.current,x.viewport&&(x.viewport.style.scrollBehavior=""),N.current=null})})})}),bv="ScrollAreaThumb",xB=y.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=gB(bv,e.__scopeScrollArea);return i.jsx(Rn,{present:n||a.hasThumb,children:i.jsx(XZ,{ref:t,...r})})}),XZ=y.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...a}=e,o=Oa(bv,n),l=gB(bv,n),{onThumbPositionChange:u}=l,d=qe(t,p=>l.onThumbChange(p)),f=y.useRef(void 0),m=Vg(()=>{f.current&&(f.current(),f.current=void 0)},100);return y.useEffect(()=>{const p=o.viewport;if(p){const g=()=>{if(m(),!f.current){const x=JZ(p,u);f.current=x,u()}};return u(),p.addEventListener("scroll",g),()=>p.removeEventListener("scroll",g)}},[o.viewport,m,u]),i.jsx(Pe.div,{"data-state":l.hasThumb?"visible":"hidden",...a,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Se(e.onPointerDownCapture,p=>{const x=p.target.getBoundingClientRect(),j=p.clientX-x.left,b=p.clientY-x.top;l.onThumbPointerDown({x:j,y:b})}),onPointerUp:Se(e.onPointerUp,l.onThumbPointerUp)})});xB.displayName=bv;var UC="ScrollAreaCorner",bB=y.forwardRef((e,t)=>{const n=Oa(UC,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?i.jsx(ZZ,{...e,ref:t}):null});bB.displayName=UC;var ZZ=y.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,a=Oa(UC,n),[o,l]=y.useState(0),[u,d]=y.useState(0),f=!!(o&&u);return ru(a.scrollbarX,()=>{const m=a.scrollbarX?.offsetHeight||0;a.onCornerHeightChange(m),d(m)}),ru(a.scrollbarY,()=>{const m=a.scrollbarY?.offsetWidth||0;a.onCornerWidthChange(m),l(m)}),f?i.jsx(Pe.div,{...r,ref:t,style:{width:o,height:u,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function wv(e){return e?parseInt(e,10):0}function wB(e,t){const n=e/t;return isNaN(n)?0:n}function Wg(e){const t=wB(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function QZ(e,t,n,r="ltr"){const a=Wg(n),o=a/2,l=t||o,u=a-l,d=n.scrollbar.paddingStart+l,f=n.scrollbar.size-n.scrollbar.paddingEnd-u,m=n.content-n.viewport,p=r==="ltr"?[0,m]:[m*-1,0];return jB([d,f],p)(e)}function qM(e,t,n="ltr"){const r=Wg(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,l=t.content-t.viewport,u=o-r,d=n==="ltr"?[0,l]:[l*-1,0],f=Ef(e,d);return jB([0,l],[0,u])(f)}function jB(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function SB(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function a(){const o={left:e.scrollLeft,top:e.scrollTop},l=n.left!==o.left,u=n.top!==o.top;(l||u)&&t(),n=o,r=window.requestAnimationFrame(a)})(),()=>window.cancelAnimationFrame(r)};function Vg(e,t){const n=nn(e),r=y.useRef(0);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),y.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function ru(e,t){const n=nn(t);Un(()=>{let r=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return a.observe(e),()=>{window.cancelAnimationFrame(r),a.unobserve(e)}}},[e,n])}var _B=hB,eQ=pB,tQ=bB;const Vt=y.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(_B,{ref:r,className:de("relative overflow-hidden",e),...n,children:[i.jsx(eQ,{className:"h-full w-full rounded-[inherit]",children:t}),i.jsx(NB,{}),i.jsx(tQ,{})]}));Vt.displayName=_B.displayName;const NB=y.forwardRef(({className:e,orientation:t="vertical",...n},r)=>i.jsx(qC,{ref:r,orientation:t,className:de("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:i.jsx(xB,{className:"relative flex-1 rounded-full bg-border"})}));NB.displayName=qC.displayName;function FM({className:e,...t}){return i.jsx("div",{className:de("animate-pulse rounded-md bg-primary/10",e),...t})}var F0,UM;function Lr(){if(UM)return F0;UM=1;var e=Array.isArray;return F0=e,F0}var U0,HM;function CB(){if(HM)return U0;HM=1;var e=typeof xp=="object"&&xp&&xp.Object===Object&&xp;return U0=e,U0}var H0,WM;function bi(){if(WM)return H0;WM=1;var e=CB(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return H0=n,H0}var W0,VM;function Eh(){if(VM)return W0;VM=1;var e=bi(),t=e.Symbol;return W0=t,W0}var V0,GM;function nQ(){if(GM)return V0;GM=1;var e=Eh(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,a=e?e.toStringTag:void 0;function o(l){var u=n.call(l,a),d=l[a];try{l[a]=void 0;var f=!0}catch{}var m=r.call(l);return f&&(u?l[a]=d:delete l[a]),m}return V0=o,V0}var G0,YM;function rQ(){if(YM)return G0;YM=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return G0=n,G0}var Y0,KM;function lo(){if(KM)return Y0;KM=1;var e=Eh(),t=nQ(),n=rQ(),r="[object Null]",a="[object Undefined]",o=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?a:r:o&&o in Object(u)?t(u):n(u)}return Y0=l,Y0}var K0,XM;function co(){if(XM)return K0;XM=1;function e(t){return t!=null&&typeof t=="object"}return K0=e,K0}var X0,ZM;function Bu(){if(ZM)return X0;ZM=1;var e=lo(),t=co(),n="[object Symbol]";function r(a){return typeof a=="symbol"||t(a)&&e(a)==n}return X0=r,X0}var Z0,QM;function HC(){if(QM)return Z0;QM=1;var e=Lr(),t=Bu(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function a(o,l){if(e(o))return!1;var u=typeof o;return u=="number"||u=="symbol"||u=="boolean"||o==null||t(o)?!0:r.test(o)||!n.test(o)||l!=null&&o in Object(l)}return Z0=a,Z0}var Q0,JM;function os(){if(JM)return Q0;JM=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Q0=e,Q0}var J0,eP;function WC(){if(eP)return J0;eP=1;var e=lo(),t=os(),n="[object AsyncFunction]",r="[object Function]",a="[object GeneratorFunction]",o="[object Proxy]";function l(u){if(!t(u))return!1;var d=e(u);return d==r||d==a||d==n||d==o}return J0=l,J0}var ew,tP;function aQ(){if(tP)return ew;tP=1;var e=bi(),t=e["__core-js_shared__"];return ew=t,ew}var tw,nP;function iQ(){if(nP)return tw;nP=1;var e=aQ(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return tw=n,tw}var nw,rP;function OB(){if(rP)return nw;rP=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return nw=n,nw}var rw,aP;function oQ(){if(aP)return rw;aP=1;var e=WC(),t=iQ(),n=os(),r=OB(),a=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,d=l.toString,f=u.hasOwnProperty,m=RegExp("^"+d.call(f).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p(g){if(!n(g)||t(g))return!1;var x=e(g)?m:o;return x.test(r(g))}return rw=p,rw}var aw,iP;function sQ(){if(iP)return aw;iP=1;function e(t,n){return t?.[n]}return aw=e,aw}var iw,oP;function jl(){if(oP)return iw;oP=1;var e=oQ(),t=sQ();function n(r,a){var o=t(r,a);return e(o)?o:void 0}return iw=n,iw}var ow,sP;function Gg(){if(sP)return ow;sP=1;var e=jl(),t=e(Object,"create");return ow=t,ow}var sw,lP;function lQ(){if(lP)return sw;lP=1;var e=Gg();function t(){this.__data__=e?e(null):{},this.size=0}return sw=t,sw}var lw,cP;function cQ(){if(cP)return lw;cP=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return lw=e,lw}var cw,uP;function uQ(){if(uP)return cw;uP=1;var e=Gg(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function a(o){var l=this.__data__;if(e){var u=l[o];return u===t?void 0:u}return r.call(l,o)?l[o]:void 0}return cw=a,cw}var uw,dP;function dQ(){if(dP)return uw;dP=1;var e=Gg(),t=Object.prototype,n=t.hasOwnProperty;function r(a){var o=this.__data__;return e?o[a]!==void 0:n.call(o,a)}return uw=r,uw}var dw,fP;function fQ(){if(fP)return dw;fP=1;var e=Gg(),t="__lodash_hash_undefined__";function n(r,a){var o=this.__data__;return this.size+=this.has(r)?0:1,o[r]=e&&a===void 0?t:a,this}return dw=n,dw}var fw,hP;function hQ(){if(hP)return fw;hP=1;var e=lQ(),t=cQ(),n=uQ(),r=dQ(),a=fQ();function o(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u-1}return yw=t,yw}var xw,bP;function yQ(){if(bP)return xw;bP=1;var e=Yg();function t(n,r){var a=this.__data__,o=e(a,n);return o<0?(++this.size,a.push([n,r])):a[o][1]=r,this}return xw=t,xw}var bw,wP;function Kg(){if(wP)return bw;wP=1;var e=mQ(),t=pQ(),n=vQ(),r=gQ(),a=yQ();function o(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u0?1:-1},Gs=function(t){return dl(t)&&t.indexOf("%")===t.length-1},Ce=function(t){return qQ(t)&&!Ah(t)},FQ=function(t){return Ge(t)},Mn=function(t){return Ce(t)||dl(t)},UQ=0,qu=function(t){var n=++UQ;return"".concat(t||"").concat(n)},wr=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Ce(t)&&!dl(t))return r;var o;if(Gs(t)){var l=t.indexOf("%");o=n*parseFloat(t.slice(0,l))/100}else o=+t;return Ah(o)&&(o=r),a&&o>n&&(o=n),o},Fo=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},HQ=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ZQ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function w_(e){"@babel/helpers - typeof";return w_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},w_(e)}var KP={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},Ji=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},XP=null,Vw=null,QC=function e(t){if(t===XP&&Array.isArray(Vw))return Vw;var n=[];return y.Children.forEach(t,function(r){Ge(r)||(IQ.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),Vw=n,XP=t,n};function na(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(a){return Ji(a)}):r=[Ji(t)],QC(e).forEach(function(a){var o=ta(a,"type.displayName")||ta(a,"type.name");r.indexOf(o)!==-1&&n.push(a)}),n}function Kr(e,t){var n=na(e,t);return n&&n[0]}var ZP=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,a=n.height;return!(!Ce(r)||r<=0||!Ce(a)||a<=0)},QQ=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],JQ=function(t){return t&&t.type&&dl(t.type)&&QQ.indexOf(t.type)>=0},eJ=function(t){return t&&w_(t)==="object"&&"clipDot"in t},tJ=function(t,n,r,a){var o,l=(o=Ww?.[a])!==null&&o!==void 0?o:[];return n.startsWith("data-")||!We(t)&&(a&&l.includes(n)||GQ.includes(n))||r&&ZC.includes(n)},Be=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var a=t;if(y.isValidElement(t)&&(a=t.props),!zu(a))return null;var o={};return Object.keys(a).forEach(function(l){var u;tJ((u=a)===null||u===void 0?void 0:u[l],l,n,r)&&(o[l]=a[l])}),o},j_=function e(t,n){if(t===n)return!0;var r=y.Children.count(t);if(r!==y.Children.count(n))return!1;if(r===0)return!0;if(r===1)return QP(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function oJ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function __(e){var t=e.children,n=e.width,r=e.height,a=e.viewBox,o=e.className,l=e.style,u=e.title,d=e.desc,f=iJ(e,aJ),m=a||{width:n,height:r,x:0,y:0},p=Ye("recharts-surface",o);return W.createElement("svg",S_({},Be(f,!0,"svg"),{className:p,width:n,height:r,style:l,viewBox:"".concat(m.x," ").concat(m.y," ").concat(m.width," ").concat(m.height)}),W.createElement("title",null,u),W.createElement("desc",null,d),t)}var sJ=["children","className"];function N_(){return N_=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function cJ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var pt=W.forwardRef(function(e,t){var n=e.children,r=e.className,a=lJ(e,sJ),o=Ye("recharts-layer",r);return W.createElement("g",N_({className:o},Be(a,!0),{ref:t}),n)}),qa=function(t,n){for(var r=arguments.length,a=new Array(r>2?r-2:0),o=2;oo?0:o+n),r=r>o?o:r,r<0&&(r+=o),o=n>r?0:r-n>>>0,n>>>=0;for(var l=Array(o);++a=o?n:e(n,r,a)}return Yw=t,Yw}var Kw,nR;function PB(){if(nR)return Kw;nR=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,o="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+a+o+"]");function d(f){return u.test(f)}return Kw=d,Kw}var Xw,rR;function fJ(){if(rR)return Xw;rR=1;function e(t){return t.split("")}return Xw=e,Xw}var Zw,aR;function hJ(){if(aR)return Zw;aR=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,o="\\ufe0e\\ufe0f",l="["+e+"]",u="["+a+"]",d="\\ud83c[\\udffb-\\udfff]",f="(?:"+u+"|"+d+")",m="[^"+e+"]",p="(?:\\ud83c[\\udde6-\\uddff]){2}",g="[\\ud800-\\udbff][\\udc00-\\udfff]",x="\\u200d",j=f+"?",b="["+o+"]?",w="(?:"+x+"(?:"+[m,p,g].join("|")+")"+b+j+")*",N=b+j+w,A="(?:"+[m+u+"?",u,p,g,l].join("|")+")",E=RegExp(d+"(?="+d+")|"+A+N,"g");function T(C){return C.match(E)||[]}return Zw=T,Zw}var Qw,iR;function mJ(){if(iR)return Qw;iR=1;var e=fJ(),t=PB(),n=hJ();function r(a){return t(a)?n(a):e(a)}return Qw=r,Qw}var Jw,oR;function pJ(){if(oR)return Jw;oR=1;var e=dJ(),t=PB(),n=mJ(),r=AB();function a(o){return function(l){l=r(l);var u=t(l)?n(l):void 0,d=u?u[0]:l.charAt(0),f=u?e(u,1).join(""):l.slice(1);return d[o]()+f}}return Jw=a,Jw}var ej,sR;function vJ(){if(sR)return ej;sR=1;var e=pJ(),t=e("toUpperCase");return ej=t,ej}var gJ=vJ();const Qg=St(gJ);function Ht(e){return function(){return e}}const RB=Math.cos,_v=Math.sin,Ga=Math.sqrt,Nv=Math.PI,Jg=2*Nv,C_=Math.PI,O_=2*C_,Fs=1e-6,yJ=O_-Fs;function DB(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return DB;const n=10**t;return function(r){this._+=r[0];for(let a=1,o=r.length;aFs)if(!(Math.abs(p*d-f*m)>Fs)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let x=r-l,j=a-u,b=d*d+f*f,w=x*x+j*j,N=Math.sqrt(b),A=Math.sqrt(g),E=o*Math.tan((C_-Math.acos((b+g-w)/(2*N*A)))/2),T=E/A,C=E/N;Math.abs(T-1)>Fs&&this._append`L${t+T*m},${n+T*p}`,this._append`A${o},${o},0,0,${+(p*x>m*j)},${this._x1=t+C*d},${this._y1=n+C*f}`}}arc(t,n,r,a,o,l){if(t=+t,n=+n,r=+r,l=!!l,r<0)throw new Error(`negative radius: ${r}`);let u=r*Math.cos(a),d=r*Math.sin(a),f=t+u,m=n+d,p=1^l,g=l?a-o:o-a;this._x1===null?this._append`M${f},${m}`:(Math.abs(this._x1-f)>Fs||Math.abs(this._y1-m)>Fs)&&this._append`L${f},${m}`,r&&(g<0&&(g=g%O_+O_),g>yJ?this._append`A${r},${r},0,1,${p},${t-u},${n-d}A${r},${r},0,1,${p},${this._x1=f},${this._y1=m}`:g>Fs&&this._append`A${r},${r},0,${+(g>=C_)},${p},${this._x1=t+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}rect(t,n,r,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+a}h${-r}Z`}toString(){return this._}}function JC(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 bJ(t)}function eO(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function $B(e){this._context=e}$B.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 ey(e){return new $B(e)}function IB(e){return e[0]}function LB(e){return e[1]}function BB(e,t){var n=Ht(!0),r=null,a=ey,o=null,l=JC(u);e=typeof e=="function"?e:e===void 0?IB:Ht(e),t=typeof t=="function"?t:t===void 0?LB:Ht(t);function u(d){var f,m=(d=eO(d)).length,p,g=!1,x;for(r==null&&(o=a(x=l())),f=0;f<=m;++f)!(f=x;--j)u.point(E[j],T[j]);u.lineEnd(),u.areaEnd()}N&&(E[g]=+e(w,g,p),T[g]=+t(w,g,p),u.point(r?+r(w,g,p):E[g],n?+n(w,g,p):T[g]))}if(A)return u=null,A+""||null}function m(){return BB().defined(a).curve(l).context(o)}return f.x=function(p){return arguments.length?(e=typeof p=="function"?p:Ht(+p),r=null,f):e},f.x0=function(p){return arguments.length?(e=typeof p=="function"?p:Ht(+p),f):e},f.x1=function(p){return arguments.length?(r=p==null?null:typeof p=="function"?p:Ht(+p),f):r},f.y=function(p){return arguments.length?(t=typeof p=="function"?p:Ht(+p),n=null,f):t},f.y0=function(p){return arguments.length?(t=typeof p=="function"?p:Ht(+p),f):t},f.y1=function(p){return arguments.length?(n=p==null?null:typeof p=="function"?p:Ht(+p),f):n},f.lineX0=f.lineY0=function(){return m().x(e).y(t)},f.lineY1=function(){return m().x(e).y(n)},f.lineX1=function(){return m().x(r).y(t)},f.defined=function(p){return arguments.length?(a=typeof p=="function"?p:Ht(!!p),f):a},f.curve=function(p){return arguments.length?(l=p,o!=null&&(u=l(o)),f):l},f.context=function(p){return arguments.length?(p==null?o=u=null:u=l(o=p),f):o},f}class zB{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 wJ(e){return new zB(e,!0)}function jJ(e){return new zB(e,!1)}const tO={draw(e,t){const n=Ga(t/Nv);e.moveTo(n,0),e.arc(0,0,n,0,Jg)}},SJ={draw(e,t){const n=Ga(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()}},qB=Ga(1/3),_J=qB*2,NJ={draw(e,t){const n=Ga(t/_J),r=n*qB;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},CJ={draw(e,t){const n=Ga(t),r=-n/2;e.rect(r,r,n,n)}},OJ=.8908130915292852,FB=_v(Nv/10)/_v(7*Nv/10),EJ=_v(Jg/10)*FB,AJ=-RB(Jg/10)*FB,TJ={draw(e,t){const n=Ga(t*OJ),r=EJ*n,a=AJ*n;e.moveTo(0,-n),e.lineTo(r,a);for(let o=1;o<5;++o){const l=Jg*o/5,u=RB(l),d=_v(l);e.lineTo(d*n,-u*n),e.lineTo(u*r-d*a,d*r+u*a)}e.closePath()}},tj=Ga(3),kJ={draw(e,t){const n=-Ga(t/(tj*3));e.moveTo(0,n*2),e.lineTo(-tj*n,-n),e.lineTo(tj*n,-n),e.closePath()}},ga=-.5,ya=Ga(3)/2,E_=1/Ga(12),MJ=(E_/2+1)*3,PJ={draw(e,t){const n=Ga(t/MJ),r=n/2,a=n*E_,o=r,l=n*E_+n,u=-o,d=l;e.moveTo(r,a),e.lineTo(o,l),e.lineTo(u,d),e.lineTo(ga*r-ya*a,ya*r+ga*a),e.lineTo(ga*o-ya*l,ya*o+ga*l),e.lineTo(ga*u-ya*d,ya*u+ga*d),e.lineTo(ga*r+ya*a,ga*a-ya*r),e.lineTo(ga*o+ya*l,ga*l-ya*o),e.lineTo(ga*u+ya*d,ga*d-ya*u),e.closePath()}};function RJ(e,t){let n=null,r=JC(a);e=typeof e=="function"?e:Ht(e||tO),t=typeof t=="function"?t:Ht(t===void 0?64:+t);function a(){let o;if(n||(n=o=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),o)return n=null,o+""||null}return a.type=function(o){return arguments.length?(e=typeof o=="function"?o:Ht(o),a):e},a.size=function(o){return arguments.length?(t=typeof o=="function"?o:Ht(+o),a):t},a.context=function(o){return arguments.length?(n=o??null,a):n},a}function Cv(){}function Ov(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 UB(e){this._context=e}UB.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:Ov(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:Ov(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function DJ(e){return new UB(e)}function HB(e){this._context=e}HB.prototype={areaStart:Cv,areaEnd:Cv,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:Ov(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function $J(e){return new HB(e)}function WB(e){this._context=e}WB.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:Ov(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function IJ(e){return new WB(e)}function VB(e){this._context=e}VB.prototype={areaStart:Cv,areaEnd:Cv,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 LJ(e){return new VB(e)}function lR(e){return e<0?-1:1}function cR(e,t,n){var r=e._x1-e._x0,a=t-e._x1,o=(e._y1-e._y0)/(r||a<0&&-0),l=(n-e._y1)/(a||r<0&&-0),u=(o*a+l*r)/(r+a);return(lR(o)+lR(l))*Math.min(Math.abs(o),Math.abs(l),.5*Math.abs(u))||0}function uR(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function nj(e,t,n){var r=e._x0,a=e._y0,o=e._x1,l=e._y1,u=(o-r)/3;e._context.bezierCurveTo(r+u,a+u*t,o-u,l-u*n,o,l)}function Ev(e){this._context=e}Ev.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:nj(this,this._t0,uR(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,nj(this,uR(this,n=cR(this,e,t)),n);break;default:nj(this,this._t0,n=cR(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function GB(e){this._context=new YB(e)}(GB.prototype=Object.create(Ev.prototype)).point=function(e,t){Ev.prototype.point.call(this,t,e)};function YB(e){this._context=e}YB.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,a,o){this._context.bezierCurveTo(t,e,r,n,o,a)}};function BJ(e){return new Ev(e)}function zJ(e){return new GB(e)}function KB(e){this._context=e}KB.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=dR(e),a=dR(t),o=0,l=1;l=0;--t)a[t]=(l[t]-a[t+1])/o[t];for(o[n-1]=(e[n]+a[n-1])/2,t=0;t=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 FJ(e){return new ty(e,.5)}function UJ(e){return new ty(e,0)}function HJ(e){return new ty(e,1)}function au(e,t){if((l=e.length)>1)for(var n=1,r,a,o=e[t[0]],l,u=o.length;n=0;)n[t]=t;return n}function WJ(e,t){return e[t]}function VJ(e){const t=[];return t.key=e,t}function GJ(){var e=Ht([]),t=A_,n=au,r=WJ;function a(o){var l=Array.from(e.apply(this,arguments),VJ),u,d=l.length,f=-1,m;for(const p of o)for(u=0,++f;u0){for(var n,r,a=0,o=e[0].length,l;a0){for(var n=0,r=e[t[0]],a,o=r.length;n0)||!((o=(a=e[t[0]]).length)>0))){for(var n=0,r=1,a,o,l;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function nee(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var XB={symbolCircle:tO,symbolCross:SJ,symbolDiamond:NJ,symbolSquare:CJ,symbolStar:TJ,symbolTriangle:kJ,symbolWye:PJ},ree=Math.PI/180,aee=function(t){var n="symbol".concat(Qg(t));return XB[n]||tO},iee=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var a=18*ree;return 1.25*t*t*(Math.tan(a)-Math.tan(a*2)*Math.pow(Math.tan(a),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},oee=function(t,n){XB["symbol".concat(Qg(t))]=n},nO=function(t){var n=t.type,r=n===void 0?"circle":n,a=t.size,o=a===void 0?64:a,l=t.sizeType,u=l===void 0?"area":l,d=tee(t,ZJ),f=hR(hR({},d),{},{type:r,size:o,sizeType:u}),m=function(){var w=aee(r),N=RJ().type(w).size(iee(o,u,r));return N()},p=f.className,g=f.cx,x=f.cy,j=Be(f,!0);return g===+g&&x===+x&&o===+o?W.createElement("path",T_({},j,{className:Ye("recharts-symbols",p),transform:"translate(".concat(g,", ").concat(x,")"),d:m()})):null};nO.registerSymbol=oee;function iu(e){"@babel/helpers - typeof";return iu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},iu(e)}function k_(){return k_=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var A=x.inactive?f:x.color;return W.createElement("li",k_({className:w,style:p,key:"legend-item-".concat(j)},fl(r.props,x,j)),W.createElement(__,{width:l,height:l,viewBox:m,style:g},r.renderIcon(x)),W.createElement("span",{className:"recharts-legend-item-text",style:{color:A}},b?b(N,x,j):N))})}},{key:"render",value:function(){var r=this.props,a=r.payload,o=r.layout,l=r.align;if(!a||!a.length)return null;var u={padding:0,margin:0,textAlign:o==="horizontal"?l:"left"};return W.createElement("ul",{className:"recharts-default-legend",style:u},this.renderItems())}}])})(y.PureComponent);Tf(rO,"displayName","Legend");Tf(rO,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var rj,pR;function vee(){if(pR)return rj;pR=1;var e=Kg();function t(){this.__data__=new e,this.size=0}return rj=t,rj}var aj,vR;function gee(){if(vR)return aj;vR=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return aj=e,aj}var ij,gR;function yee(){if(gR)return ij;gR=1;function e(t){return this.__data__.get(t)}return ij=e,ij}var oj,yR;function xee(){if(yR)return oj;yR=1;function e(t){return this.__data__.has(t)}return oj=e,oj}var sj,xR;function bee(){if(xR)return sj;xR=1;var e=Kg(),t=GC(),n=YC(),r=200;function a(o,l){var u=this.__data__;if(u instanceof e){var d=u.__data__;if(!t||d.lengthx))return!1;var b=p.get(l),w=p.get(u);if(b&&w)return b==u&&w==l;var N=-1,A=!0,E=d&a?new e:void 0;for(p.set(l,u),p.set(u,l);++N-1&&r%1==0&&r-1&&n%1==0&&n<=e}return Aj=t,Aj}var Tj,UR;function Pee(){if(UR)return Tj;UR=1;var e=lo(),t=sO(),n=co(),r="[object Arguments]",a="[object Array]",o="[object Boolean]",l="[object Date]",u="[object Error]",d="[object Function]",f="[object Map]",m="[object Number]",p="[object Object]",g="[object RegExp]",x="[object Set]",j="[object String]",b="[object WeakMap]",w="[object ArrayBuffer]",N="[object DataView]",A="[object Float32Array]",E="[object Float64Array]",T="[object Int8Array]",C="[object Int16Array]",k="[object Int32Array]",O="[object Uint8Array]",M="[object Uint8ClampedArray]",I="[object Uint16Array]",z="[object Uint32Array]",D={};D[A]=D[E]=D[T]=D[C]=D[k]=D[O]=D[M]=D[I]=D[z]=!0,D[r]=D[a]=D[w]=D[o]=D[N]=D[l]=D[u]=D[d]=D[f]=D[m]=D[p]=D[g]=D[x]=D[j]=D[b]=!1;function H(V){return n(V)&&t(V.length)&&!!D[e(V)]}return Tj=H,Tj}var kj,HR;function oz(){if(HR)return kj;HR=1;function e(t){return function(n){return t(n)}}return kj=e,kj}var uf={exports:{}};uf.exports;var WR;function Ree(){return WR||(WR=1,(function(e,t){var n=CB(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,o=a&&a.exports===r,l=o&&n.process,u=(function(){try{var d=a&&a.require&&a.require("util").types;return d||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(uf,uf.exports)),uf.exports}var Mj,VR;function sz(){if(VR)return Mj;VR=1;var e=Pee(),t=oz(),n=Ree(),r=n&&n.isTypedArray,a=r?t(r):e;return Mj=a,Mj}var Pj,GR;function Dee(){if(GR)return Pj;GR=1;var e=Tee(),t=iO(),n=Lr(),r=iz(),a=oO(),o=sz(),l=Object.prototype,u=l.hasOwnProperty;function d(f,m){var p=n(f),g=!p&&t(f),x=!p&&!g&&r(f),j=!p&&!g&&!x&&o(f),b=p||g||x||j,w=b?e(f.length,String):[],N=w.length;for(var A in f)(m||u.call(f,A))&&!(b&&(A=="length"||x&&(A=="offset"||A=="parent")||j&&(A=="buffer"||A=="byteLength"||A=="byteOffset")||a(A,N)))&&w.push(A);return w}return Pj=d,Pj}var Rj,YR;function $ee(){if(YR)return Rj;YR=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,a=typeof r=="function"&&r.prototype||e;return n===a}return Rj=t,Rj}var Dj,KR;function lz(){if(KR)return Dj;KR=1;function e(t,n){return function(r){return t(n(r))}}return Dj=e,Dj}var $j,XR;function Iee(){if(XR)return $j;XR=1;var e=lz(),t=e(Object.keys,Object);return $j=t,$j}var Ij,ZR;function Lee(){if(ZR)return Ij;ZR=1;var e=$ee(),t=Iee(),n=Object.prototype,r=n.hasOwnProperty;function a(o){if(!e(o))return t(o);var l=[];for(var u in Object(o))r.call(o,u)&&u!="constructor"&&l.push(u);return l}return Ij=a,Ij}var Lj,QR;function Th(){if(QR)return Lj;QR=1;var e=WC(),t=sO();function n(r){return r!=null&&t(r.length)&&!e(r)}return Lj=n,Lj}var Bj,JR;function ny(){if(JR)return Bj;JR=1;var e=Dee(),t=Lee(),n=Th();function r(a){return n(a)?e(a):t(a)}return Bj=r,Bj}var zj,eD;function Bee(){if(eD)return zj;eD=1;var e=Cee(),t=Aee(),n=ny();function r(a){return e(a,n,t)}return zj=r,zj}var qj,tD;function zee(){if(tD)return qj;tD=1;var e=Bee(),t=1,n=Object.prototype,r=n.hasOwnProperty;function a(o,l,u,d,f,m){var p=u&t,g=e(o),x=g.length,j=e(l),b=j.length;if(x!=b&&!p)return!1;for(var w=x;w--;){var N=g[w];if(!(p?N in l:r.call(l,N)))return!1}var A=m.get(o),E=m.get(l);if(A&&E)return A==l&&E==o;var T=!0;m.set(o,l),m.set(l,o);for(var C=p;++w-1}return h1=t,h1}var m1,ED;function ote(){if(ED)return m1;ED=1;function e(t,n,r){for(var a=-1,o=t==null?0:t.length;++a=l){var N=f?null:a(d);if(N)return o(N);j=!1,g=r,w=new e}else w=f?[]:b;e:for(;++p=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function wte(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function jte(e){return e.value}function Ste(e,t){if(W.isValidElement(e))return W.cloneElement(e,t);if(typeof e=="function")return W.createElement(e,t);t.ref;var n=bte(t,fte);return W.createElement(rO,n)}var $D=1,nl=(function(e){function t(){var n;hte(this,t);for(var r=arguments.length,a=new Array(r),o=0;o$D||Math.abs(a.height-this.lastBoundingBox.height)>$D)&&(this.lastBoundingBox.width=a.width,this.lastBoundingBox.height=a.height,r&&r(a)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Ui({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var a=this.props,o=a.layout,l=a.align,u=a.verticalAlign,d=a.margin,f=a.chartWidth,m=a.chartHeight,p,g;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(l==="center"&&o==="vertical"){var x=this.getBBoxSnapshot();p={left:((f||0)-x.width)/2}}else p=l==="right"?{right:d&&d.right||0}:{left:d&&d.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(u==="middle"){var j=this.getBBoxSnapshot();g={top:((m||0)-j.height)/2}}else g=u==="bottom"?{bottom:d&&d.bottom||0}:{top:d&&d.top||0};return Ui(Ui({},p),g)}},{key:"render",value:function(){var r=this,a=this.props,o=a.content,l=a.width,u=a.height,d=a.wrapperStyle,f=a.payloadUniqBy,m=a.payload,p=Ui(Ui({position:"absolute",width:l||"auto",height:u||"auto"},this.getDefaultPosition(d)),d);return W.createElement("div",{className:"recharts-legend-wrapper",style:p,ref:function(x){r.wrapperNode=x}},Ste(o,Ui(Ui({},this.props),{},{payload:hz(m,f,jte)})))}}],[{key:"getWithHeight",value:function(r,a){var o=Ui(Ui({},this.defaultProps),r.props),l=o.layout;return l==="vertical"&&Ce(r.props.height)?{height:r.props.height}:l==="horizontal"?{width:r.props.width||a}:null}}])})(y.PureComponent);ry(nl,"displayName","Legend");ry(nl,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var x1,ID;function _te(){if(ID)return x1;ID=1;var e=Eh(),t=iO(),n=Lr(),r=e?e.isConcatSpreadable:void 0;function a(o){return n(o)||t(o)||!!(r&&o&&o[r])}return x1=a,x1}var b1,LD;function vz(){if(LD)return b1;LD=1;var e=az(),t=_te();function n(r,a,o,l,u){var d=-1,f=r.length;for(o||(o=t),u||(u=[]);++d0&&o(m)?a>1?n(m,a-1,o,l,u):e(u,m):l||(u[u.length]=m)}return u}return b1=n,b1}var w1,BD;function Nte(){if(BD)return w1;BD=1;function e(t){return function(n,r,a){for(var o=-1,l=Object(n),u=a(n),d=u.length;d--;){var f=u[t?d:++o];if(r(l[f],f,l)===!1)break}return n}}return w1=e,w1}var j1,zD;function Cte(){if(zD)return j1;zD=1;var e=Nte(),t=e();return j1=t,j1}var S1,qD;function gz(){if(qD)return S1;qD=1;var e=Cte(),t=ny();function n(r,a){return r&&e(r,a,t)}return S1=n,S1}var _1,FD;function Ote(){if(FD)return _1;FD=1;var e=Th();function t(n,r){return function(a,o){if(a==null)return a;if(!e(a))return n(a,o);for(var l=a.length,u=r?l:-1,d=Object(a);(r?u--:++ur||u&&d&&m&&!f&&!p||o&&d&&m||!a&&m||!l)return 1;if(!o&&!u&&!p&&n=f)return m;var p=a[o];return m*(p=="desc"?-1:1)}}return n.index-r.index}return A1=t,A1}var T1,YD;function kte(){if(YD)return T1;YD=1;var e=KC(),t=XC(),n=wi(),r=yz(),a=Ete(),o=oz(),l=Tte(),u=Fu(),d=Lr();function f(m,p,g){p.length?p=e(p,function(b){return d(b)?function(w){return t(w,b.length===1?b[0]:b)}:b}):p=[u];var x=-1;p=e(p,o(n));var j=r(m,function(b,w,N){var A=e(p,function(E){return E(b)});return{criteria:A,index:++x,value:b}});return a(j,function(b,w){return l(b,w,g)})}return T1=f,T1}var k1,KD;function Mte(){if(KD)return k1;KD=1;function e(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}return k1=e,k1}var M1,XD;function Pte(){if(XD)return M1;XD=1;var e=Mte(),t=Math.max;function n(r,a,o){return a=t(a===void 0?r.length-1:a,0),function(){for(var l=arguments,u=-1,d=t(l.length-a,0),f=Array(d);++u0){if(++o>=e)return arguments[0]}else o=0;return a.apply(void 0,arguments)}}return $1=r,$1}var I1,t4;function Ite(){if(t4)return I1;t4=1;var e=Dte(),t=$te(),n=t(e);return I1=n,I1}var L1,n4;function Lte(){if(n4)return L1;n4=1;var e=Fu(),t=Pte(),n=Ite();function r(a,o){return n(t(a,o,e),a+"")}return L1=r,L1}var B1,r4;function ay(){if(r4)return B1;r4=1;var e=VC(),t=Th(),n=oO(),r=os();function a(o,l,u){if(!r(u))return!1;var d=typeof l;return(d=="number"?t(u)&&n(l,u.length):d=="string"&&l in u)?e(u[l],o):!1}return B1=a,B1}var z1,a4;function Bte(){if(a4)return z1;a4=1;var e=vz(),t=kte(),n=Lte(),r=ay(),a=n(function(o,l){if(o==null)return[];var u=l.length;return u>1&&r(o,l[0],l[1])?l=[]:u>2&&r(l[0],l[1],l[2])&&(l=[l[0]]),t(o,e(l,1),[])});return z1=a,z1}var zte=Bte();const uO=St(zte);function kf(e){"@babel/helpers - typeof";return kf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kf(e)}function R_(){return R_=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t.x),"".concat(Xd,"-left"),Ce(n)&&t&&Ce(t.x)&&n=t.y),"".concat(Xd,"-top"),Ce(r)&&t&&Ce(t.y)&&rb?Math.max(m,d[r]):Math.max(p,d[r])}function tne(e){var t=e.translateX,n=e.translateY,r=e.useTranslate3d;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function nne(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,a=e.position,o=e.reverseDirection,l=e.tooltipBox,u=e.useTranslate3d,d=e.viewBox,f,m,p;return l.height>0&&l.width>0&&n?(m=s4({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:r,position:a,reverseDirection:o,tooltipDimension:l.width,viewBox:d,viewBoxDimension:d.width}),p=s4({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:r,position:a,reverseDirection:o,tooltipDimension:l.height,viewBox:d,viewBoxDimension:d.height}),f=tne({translateX:m,translateY:p,useTranslate3d:u})):f=Jte,{cssProperties:f,cssClasses:ene({translateX:m,translateY:p,coordinate:n})}}function su(e){"@babel/helpers - typeof";return su=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},su(e)}function l4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function c4(e){for(var t=1;tu4||Math.abs(r.height-this.state.lastBoundingBox.height)>u4)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,a;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,a=this.props,o=a.active,l=a.allowEscapeViewBox,u=a.animationDuration,d=a.animationEasing,f=a.children,m=a.coordinate,p=a.hasPayload,g=a.isAnimationActive,x=a.offset,j=a.position,b=a.reverseDirection,w=a.useTranslate3d,N=a.viewBox,A=a.wrapperStyle,E=nne({allowEscapeViewBox:l,coordinate:m,offsetTopLeft:x,position:j,reverseDirection:b,tooltipBox:this.state.lastBoundingBox,useTranslate3d:w,viewBox:N}),T=E.cssClasses,C=E.cssProperties,k=c4(c4({transition:g&&o?"transform ".concat(u,"ms ").concat(d):void 0},C),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&p?"visible":"hidden",position:"absolute",top:0,left:0},A);return W.createElement("div",{tabIndex:-1,className:T,style:k,ref:function(M){r.wrapperNode=M}},f)}}])})(y.PureComponent),fne=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Sl={isSsr:fne()};function lu(e){"@babel/helpers - typeof";return lu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lu(e)}function d4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function f4(e){for(var t=1;t0;return W.createElement(dne,{allowEscapeViewBox:l,animationDuration:u,animationEasing:d,isAnimationActive:g,active:o,coordinate:m,hasPayload:k,offset:x,position:w,reverseDirection:N,useTranslate3d:A,viewBox:E,wrapperStyle:T},jne(f,f4(f4({},this.props),{},{payload:C})))}}])})(y.PureComponent);dO(ni,"displayName","Tooltip");dO(ni,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Sl.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var F1,h4;function Sne(){if(h4)return F1;h4=1;var e=bi(),t=function(){return e.Date.now()};return F1=t,F1}var U1,m4;function _ne(){if(m4)return U1;m4=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return U1=t,U1}var H1,p4;function Nne(){if(p4)return H1;p4=1;var e=_ne(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return H1=n,H1}var W1,v4;function _z(){if(v4)return W1;v4=1;var e=Nne(),t=os(),n=Bu(),r=NaN,a=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function d(f){if(typeof f=="number")return f;if(n(f))return r;if(t(f)){var m=typeof f.valueOf=="function"?f.valueOf():f;f=t(m)?m+"":m}if(typeof f!="string")return f===0?f:+f;f=e(f);var p=o.test(f);return p||l.test(f)?u(f.slice(2),p?2:8):a.test(f)?r:+f}return W1=d,W1}var V1,g4;function Cne(){if(g4)return V1;g4=1;var e=os(),t=Sne(),n=_z(),r="Expected a function",a=Math.max,o=Math.min;function l(u,d,f){var m,p,g,x,j,b,w=0,N=!1,A=!1,E=!0;if(typeof u!="function")throw new TypeError(r);d=n(d)||0,e(f)&&(N=!!f.leading,A="maxWait"in f,g=A?a(n(f.maxWait)||0,d):g,E="trailing"in f?!!f.trailing:E);function T(V){var F=m,G=p;return m=p=void 0,w=V,x=u.apply(G,F),x}function C(V){return w=V,j=setTimeout(M,d),N?T(V):x}function k(V){var F=V-b,G=V-w,L=d-F;return A?o(L,g-G):L}function O(V){var F=V-b,G=V-w;return b===void 0||F>=d||F<0||A&&G>=g}function M(){var V=t();if(O(V))return I(V);j=setTimeout(M,k(V))}function I(V){return j=void 0,E&&m?T(V):(m=p=void 0,x)}function z(){j!==void 0&&clearTimeout(j),w=0,m=b=p=j=void 0}function D(){return j===void 0?x:I(t())}function H(){var V=t(),F=O(V);if(m=arguments,p=this,b=V,F){if(j===void 0)return C(b);if(A)return clearTimeout(j),j=setTimeout(M,d),T(b)}return j===void 0&&(j=setTimeout(M,d)),x}return H.cancel=z,H.flush=D,H}return V1=l,V1}var G1,y4;function One(){if(y4)return G1;y4=1;var e=Cne(),t=os(),n="Expected a function";function r(a,o,l){var u=!0,d=!0;if(typeof a!="function")throw new TypeError(n);return t(l)&&(u="leading"in l?!!l.leading:u,d="trailing"in l?!!l.trailing:d),e(a,o,{leading:u,maxWait:o,trailing:d})}return G1=r,G1}var Ene=One();const Nz=St(Ene);function Pf(e){"@babel/helpers - typeof";return Pf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pf(e)}function x4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Tp(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(V=Nz(V,b,{trailing:!0,leading:!1}));var F=new ResizeObserver(V),G=C.current.getBoundingClientRect(),L=G.width,R=G.height;return D(L,R),F.observe(C.current),function(){F.disconnect()}},[D,b]);var H=y.useMemo(function(){var V=I.containerWidth,F=I.containerHeight;if(V<0||F<0)return null;qa(Gs(l)||Gs(d),`The width(%s) and height(%s) are both fixed numbers, maybe you don't need to use a ResponsiveContainer.`,l,d),qa(!n||n>0,"The aspect(%s) must be greater than zero.",n);var G=Gs(l)?V:l,L=Gs(d)?F:d;n&&n>0&&(G?L=G/n:L&&(G=L*n),g&&L>g&&(L=g)),qa(G>0||L>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the height and width.`,G,L,l,d,m,p,n);var R=!Array.isArray(x)&&Ji(x.type).endsWith("Chart");return W.Children.map(x,function(U){return W.isValidElement(U)?y.cloneElement(U,Tp({width:G,height:L},R?{style:Tp({height:"100%",width:"100%",maxHeight:L,maxWidth:G},U.props.style)}:{})):U})},[n,x,d,g,p,m,I,l]);return W.createElement("div",{id:w?"".concat(w):void 0,className:Ye("recharts-responsive-container",N),style:Tp(Tp({},T),{},{width:l,height:d,minWidth:m,minHeight:p,maxHeight:g}),ref:C},H)}),iy=function(t){return null};iy.displayName="Cell";function Rf(e){"@babel/helpers - typeof";return Rf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rf(e)}function w4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function L_(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Sl.isSsr)return{width:0,height:0};var r=Une(n),a=JSON.stringify({text:t,copyStyle:r});if(jc.widthCache[a])return jc.widthCache[a];try{var o=document.getElementById(j4);o||(o=document.createElement("span"),o.setAttribute("id",j4),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var l=L_(L_({},Fne),r);Object.assign(o.style,l),o.textContent="".concat(t);var u=o.getBoundingClientRect(),d={width:u.width,height:u.height};return jc.widthCache[a]=d,++jc.cacheCount>qne&&(jc.cacheCount=0,jc.widthCache={}),d}catch{return{width:0,height:0}}},Hne=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Df(e){"@babel/helpers - typeof";return Df=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Df(e)}function Pv(e,t){return Yne(e)||Gne(e,t)||Vne(e,t)||Wne()}function Wne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vne(e,t){if(e){if(typeof e=="string")return S4(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return S4(e,t)}}function S4(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function lre(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function A4(e,t){return fre(e)||dre(e,t)||ure(e,t)||cre()}function cre(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ure(e,t){if(e){if(typeof e=="string")return T4(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return T4(e,t)}}function T4(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[];return G.reduce(function(L,R){var U=R.word,K=R.width,te=L[L.length-1];if(te&&(a==null||o||te.width+K+rR.width?L:R})};if(!m)return x;for(var b="…",w=function(G){var L=p.slice(0,G),R=Az({breakAll:f,style:d,children:L+b}).wordsWithComputedWidth,U=g(R),K=U.length>l||j(U).width>Number(a);return[K,U]},N=0,A=p.length-1,E=0,T;N<=A&&E<=p.length-1;){var C=Math.floor((N+A)/2),k=C-1,O=w(k),M=A4(O,2),I=M[0],z=M[1],D=w(C),H=A4(D,1),V=H[0];if(!I&&!V&&(N=C+1),I&&V&&(A=C-1),!I&&V){T=z;break}E++}return T||x},k4=function(t){var n=Ge(t)?[]:t.toString().split(Ez);return[{words:n}]},mre=function(t){var n=t.width,r=t.scaleToFit,a=t.children,o=t.style,l=t.breakAll,u=t.maxLines;if((n||r)&&!Sl.isSsr){var d,f,m=Az({breakAll:l,children:a,style:o});if(m){var p=m.wordsWithComputedWidth,g=m.spaceWidth;d=p,f=g}else return k4(a);return hre({breakAll:l,children:a,maxLines:u,style:o},d,f,n,r)}return k4(a)},M4="#808080",hl=function(t){var n=t.x,r=n===void 0?0:n,a=t.y,o=a===void 0?0:a,l=t.lineHeight,u=l===void 0?"1em":l,d=t.capHeight,f=d===void 0?"0.71em":d,m=t.scaleToFit,p=m===void 0?!1:m,g=t.textAnchor,x=g===void 0?"start":g,j=t.verticalAnchor,b=j===void 0?"end":j,w=t.fill,N=w===void 0?M4:w,A=E4(t,ore),E=y.useMemo(function(){return mre({breakAll:A.breakAll,children:A.children,maxLines:A.maxLines,scaleToFit:p,style:A.style,width:A.width})},[A.breakAll,A.children,A.maxLines,p,A.style,A.width]),T=A.dx,C=A.dy,k=A.angle,O=A.className,M=A.breakAll,I=E4(A,sre);if(!Mn(r)||!Mn(o))return null;var z=r+(Ce(T)?T:0),D=o+(Ce(C)?C:0),H;switch(b){case"start":H=Y1("calc(".concat(f,")"));break;case"middle":H=Y1("calc(".concat((E.length-1)/2," * -").concat(u," + (").concat(f," / 2))"));break;default:H=Y1("calc(".concat(E.length-1," * -").concat(u,")"));break}var V=[];if(p){var F=E[0].width,G=A.width;V.push("scale(".concat((Ce(G)?G/F:1)/F,")"))}return k&&V.push("rotate(".concat(k,", ").concat(z,", ").concat(D,")")),V.length&&(I.transform=V.join(" ")),W.createElement("text",B_({},Be(I,!0),{x:z,y:D,className:Ye("recharts-text",O),textAnchor:x,fill:N.includes("url")?M4:N}),E.map(function(L,R){var U=L.words.join(M?"":" ");return W.createElement("tspan",{x:z,dy:R===0?H:u,key:"".concat(U,"-").concat(R)},U)}))};function Xo(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function pre(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function fO(e){let t,n,r;e.length!==2?(t=Xo,n=(u,d)=>Xo(e(u),d),r=(u,d)=>e(u)-d):(t=e===Xo||e===pre?e:vre,n=e,r=e);function a(u,d,f=0,m=u.length){if(f>>1;n(u[p],d)<0?f=p+1:m=p}while(f>>1;n(u[p],d)<=0?f=p+1:m=p}while(ff&&r(u[p-1],d)>-r(u[p],d)?p-1:p}return{left:a,center:l,right:o}}function vre(){return 0}function Tz(e){return e===null?NaN:+e}function*gre(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const yre=fO(Xo),kh=yre.right;fO(Tz).center;class P4 extends Map{constructor(t,n=wre){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,a]of t)this.set(r,a)}get(t){return super.get(R4(this,t))}has(t){return super.has(R4(this,t))}set(t,n){return super.set(xre(this,t),n)}delete(t){return super.delete(bre(this,t))}}function R4({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function xre({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function bre({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function wre(e){return e!==null&&typeof e=="object"?e.valueOf():e}function jre(e=Xo){if(e===Xo)return kz;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 kz(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const Sre=Math.sqrt(50),_re=Math.sqrt(10),Nre=Math.sqrt(2);function Rv(e,t,n){const r=(t-e)/Math.max(0,n),a=Math.floor(Math.log10(r)),o=r/Math.pow(10,a),l=o>=Sre?10:o>=_re?5:o>=Nre?2:1;let u,d,f;return a<0?(f=Math.pow(10,-a)/l,u=Math.round(e*f),d=Math.round(t*f),u/ft&&--d,f=-f):(f=Math.pow(10,a)*l,u=Math.round(e/f),d=Math.round(t/f),u*ft&&--d),d0))return[];if(e===t)return[e];const r=t=a))return[];const u=o-a+1,d=new Array(u);if(r)if(l<0)for(let f=0;f=r)&&(n=r);return n}function $4(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function Mz(e,t,n=0,r=1/0,a){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(a=a===void 0?kz:jre(a);r>n;){if(r-n>600){const d=r-n+1,f=t-n+1,m=Math.log(d),p=.5*Math.exp(2*m/3),g=.5*Math.sqrt(m*p*(d-p)/d)*(f-d/2<0?-1:1),x=Math.max(n,Math.floor(t-f*p/d+g)),j=Math.min(r,Math.floor(t+(d-f)*p/d+g));Mz(e,t,x,j,a)}const o=e[t];let l=n,u=r;for(Zd(e,n,t),a(e[r],o)>0&&Zd(e,n,r);l0;)--u}a(e[n],o)===0?Zd(e,n,u):(++u,Zd(e,u,r)),u<=t&&(n=u+1),t<=u&&(r=u-1)}return e}function Zd(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Cre(e,t,n){if(e=Float64Array.from(gre(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return $4(e);if(t>=1)return D4(e);var r,a=(r-1)*t,o=Math.floor(a),l=D4(Mz(e,o).subarray(0,o+1)),u=$4(e.subarray(o+1));return l+(u-l)*(a-o)}}function Ore(e,t,n=Tz){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,a=(r-1)*t,o=Math.floor(a),l=+n(e[o],o,e),u=+n(e[o+1],o+1,e);return l+(u-l)*(a-o)}}function Ere(e,t,n){e=+e,t=+t,n=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+n;for(var r=-1,a=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(a);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Mp(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Mp(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=Tre.exec(e))?new kr(t[1],t[2],t[3],1):(t=kre.exec(e))?new kr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Mre.exec(e))?Mp(t[1],t[2],t[3],t[4]):(t=Pre.exec(e))?Mp(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Rre.exec(e))?U4(t[1],t[2]/100,t[3]/100,1):(t=Dre.exec(e))?U4(t[1],t[2]/100,t[3]/100,t[4]):I4.hasOwnProperty(e)?z4(I4[e]):e==="transparent"?new kr(NaN,NaN,NaN,0):null}function z4(e){return new kr(e>>16&255,e>>8&255,e&255,1)}function Mp(e,t,n,r){return r<=0&&(e=t=n=NaN),new kr(e,t,n,r)}function Lre(e){return e instanceof Mh||(e=Bf(e)),e?(e=e.rgb(),new kr(e.r,e.g,e.b,e.opacity)):new kr}function H_(e,t,n,r){return arguments.length===1?Lre(e):new kr(e,t,n,r??1)}function kr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}mO(kr,H_,Rz(Mh,{brighter(e){return e=e==null?Dv:Math.pow(Dv,e),new kr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?If:Math.pow(If,e),new kr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new kr(rl(this.r),rl(this.g),rl(this.b),$v(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:q4,formatHex:q4,formatHex8:Bre,formatRgb:F4,toString:F4}));function q4(){return`#${Ys(this.r)}${Ys(this.g)}${Ys(this.b)}`}function Bre(){return`#${Ys(this.r)}${Ys(this.g)}${Ys(this.b)}${Ys((isNaN(this.opacity)?1:this.opacity)*255)}`}function F4(){const e=$v(this.opacity);return`${e===1?"rgb(":"rgba("}${rl(this.r)}, ${rl(this.g)}, ${rl(this.b)}${e===1?")":`, ${e})`}`}function $v(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function rl(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ys(e){return e=rl(e),(e<16?"0":"")+e.toString(16)}function U4(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ba(e,t,n,r)}function Dz(e){if(e instanceof Ba)return new Ba(e.h,e.s,e.l,e.opacity);if(e instanceof Mh||(e=Bf(e)),!e)return new Ba;if(e instanceof Ba)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),o=Math.max(t,n,r),l=NaN,u=o-a,d=(o+a)/2;return u?(t===o?l=(n-r)/u+(n0&&d<1?0:l,new Ba(l,u,d,e.opacity)}function zre(e,t,n,r){return arguments.length===1?Dz(e):new Ba(e,t,n,r??1)}function Ba(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}mO(Ba,zre,Rz(Mh,{brighter(e){return e=e==null?Dv:Math.pow(Dv,e),new Ba(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?If:Math.pow(If,e),new Ba(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,a=2*n-r;return new kr(K1(e>=240?e-240:e+120,a,r),K1(e,a,r),K1(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new Ba(H4(this.h),Pp(this.s),Pp(this.l),$v(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=$v(this.opacity);return`${e===1?"hsl(":"hsla("}${H4(this.h)}, ${Pp(this.s)*100}%, ${Pp(this.l)*100}%${e===1?")":`, ${e})`}`}}));function H4(e){return e=(e||0)%360,e<0?e+360:e}function Pp(e){return Math.max(0,Math.min(1,e||0))}function K1(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 pO=e=>()=>e;function qre(e,t){return function(n){return e+n*t}}function Fre(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 Ure(e){return(e=+e)==1?$z:function(t,n){return n-t?Fre(t,n,e):pO(isNaN(t)?n:t)}}function $z(e,t){var n=t-e;return n?qre(e,n):pO(isNaN(e)?t:e)}const W4=(function e(t){var n=Ure(t);function r(a,o){var l=n((a=H_(a)).r,(o=H_(o)).r),u=n(a.g,o.g),d=n(a.b,o.b),f=$z(a.opacity,o.opacity);return function(m){return a.r=l(m),a.g=u(m),a.b=d(m),a.opacity=f(m),a+""}}return r.gamma=e,r})(1);function Hre(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),a;return function(o){for(a=0;an&&(o=t.slice(n,o),u[l]?u[l]+=o:u[++l]=o),(r=r[0])===(a=a[0])?u[l]?u[l]+=a:u[++l]=a:(u[++l]=null,d.push({i:l,x:Iv(r,a)})),n=X1.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function tae(e,t,n){var r=e[0],a=e[1],o=t[0],l=t[1];return a2?nae:tae,d=f=null,p}function p(g){return g==null||isNaN(g=+g)?o:(d||(d=u(e.map(r),t,n)))(r(l(g)))}return p.invert=function(g){return l(a((f||(f=u(t,e.map(r),Iv)))(g)))},p.domain=function(g){return arguments.length?(e=Array.from(g,Lv),m()):e.slice()},p.range=function(g){return arguments.length?(t=Array.from(g),m()):t.slice()},p.rangeRound=function(g){return t=Array.from(g),n=vO,m()},p.clamp=function(g){return arguments.length?(l=g?!0:jr,m()):l!==jr},p.interpolate=function(g){return arguments.length?(n=g,m()):n},p.unknown=function(g){return arguments.length?(o=g,p):o},function(g,x){return r=g,a=x,m()}}function gO(){return oy()(jr,jr)}function rae(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Bv(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function cu(e){return e=Bv(Math.abs(e)),e?e[1]:NaN}function aae(e,t){return function(n,r){for(var a=n.length,o=[],l=0,u=e[0],d=0;a>0&&u>0&&(d+u+1>r&&(u=Math.max(1,r-d)),o.push(n.substring(a-=u,a+u)),!((d+=u+1)>r));)u=e[l=(l+1)%e.length];return o.reverse().join(t)}}function iae(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var oae=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function zf(e){if(!(t=oae.exec(e)))throw new Error("invalid format: "+e);var t;return new yO({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]})}zf.prototype=yO.prototype;function yO(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+""}yO.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 sae(e){e:for(var t=e.length,n=1,r=-1,a;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(a+1):e}var Iz;function lae(e,t){var n=Bv(e,t);if(!n)return e+"";var r=n[0],a=n[1],o=a-(Iz=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,l=r.length;return o===l?r:o>l?r+new Array(o-l+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Bv(e,Math.max(0,t+o-1))[0]}function G4(e,t){var n=Bv(e,t);if(!n)return e+"";var r=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}const Y4={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:rae,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)=>G4(e*100,t),r:G4,s:lae,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function K4(e){return e}var X4=Array.prototype.map,Z4=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function cae(e){var t=e.grouping===void 0||e.thousands===void 0?K4:aae(X4.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?K4:iae(X4.call(e.numerals,String)),l=e.percent===void 0?"%":e.percent+"",u=e.minus===void 0?"−":e.minus+"",d=e.nan===void 0?"NaN":e.nan+"";function f(p){p=zf(p);var g=p.fill,x=p.align,j=p.sign,b=p.symbol,w=p.zero,N=p.width,A=p.comma,E=p.precision,T=p.trim,C=p.type;C==="n"?(A=!0,C="g"):Y4[C]||(E===void 0&&(E=12),T=!0,C="g"),(w||g==="0"&&x==="=")&&(w=!0,g="0",x="=");var k=b==="$"?n:b==="#"&&/[boxX]/.test(C)?"0"+C.toLowerCase():"",O=b==="$"?r:/[%p]/.test(C)?l:"",M=Y4[C],I=/[defgprs%]/.test(C);E=E===void 0?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,E)):Math.max(0,Math.min(20,E));function z(D){var H=k,V=O,F,G,L;if(C==="c")V=M(D)+V,D="";else{D=+D;var R=D<0||1/D<0;if(D=isNaN(D)?d:M(Math.abs(D),E),T&&(D=sae(D)),R&&+D==0&&j!=="+"&&(R=!1),H=(R?j==="("?j:u:j==="-"||j==="("?"":j)+H,V=(C==="s"?Z4[8+Iz/3]:"")+V+(R&&j==="("?")":""),I){for(F=-1,G=D.length;++FL||L>57){V=(L===46?a+D.slice(F+1):D.slice(F))+V,D=D.slice(0,F);break}}}A&&!w&&(D=t(D,1/0));var U=H.length+D.length+V.length,K=U>1)+H+D+V+K.slice(U);break;default:D=K+H+D+V;break}return o(D)}return z.toString=function(){return p+""},z}function m(p,g){var x=f((p=zf(p),p.type="f",p)),j=Math.max(-8,Math.min(8,Math.floor(cu(g)/3)))*3,b=Math.pow(10,-j),w=Z4[8+j/3];return function(N){return x(b*N)+w}}return{format:f,formatPrefix:m}}var Rp,xO,Lz;uae({thousands:",",grouping:[3],currency:["$",""]});function uae(e){return Rp=cae(e),xO=Rp.format,Lz=Rp.formatPrefix,Rp}function dae(e){return Math.max(0,-cu(Math.abs(e)))}function fae(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(cu(t)/3)))*3-cu(Math.abs(e)))}function hae(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,cu(t)-cu(e))+1}function Bz(e,t,n,r){var a=F_(e,t,n),o;switch(r=zf(r??",f"),r.type){case"s":{var l=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=fae(a,l))&&(r.precision=o),Lz(r,l)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=hae(a,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=dae(a))&&(r.precision=o-(r.type==="%")*2);break}}return xO(r)}function ss(e){var t=e.domain;return e.ticks=function(n){var r=t();return z_(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var a=t();return Bz(a[0],a[a.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),a=0,o=r.length-1,l=r[a],u=r[o],d,f,m=10;for(u0;){if(f=q_(l,u,n),f===d)return r[a]=l,r[o]=u,t(r);if(f>0)l=Math.floor(l/f)*f,u=Math.ceil(u/f)*f;else if(f<0)l=Math.ceil(l*f)/f,u=Math.floor(u*f)/f;else break;d=f}return e},e}function zv(){var e=gO();return e.copy=function(){return Ph(e,zv())},Ea.apply(e,arguments),ss(e)}function zz(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,Lv),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return zz(e).unknown(t)},e=arguments.length?Array.from(e,Lv):[0,1],ss(n)}function qz(e,t){e=e.slice();var n=0,r=e.length-1,a=e[n],o=e[r],l;return oMath.pow(e,t)}function yae(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 e$(e){return(t,n)=>-e(-t,n)}function bO(e){const t=e(Q4,J4),n=t.domain;let r=10,a,o;function l(){return a=yae(r),o=gae(r),n()[0]<0?(a=e$(a),o=e$(o),e(mae,pae)):e(Q4,J4),t}return t.base=function(u){return arguments.length?(r=+u,l()):r},t.domain=function(u){return arguments.length?(n(u),l()):n()},t.ticks=u=>{const d=n();let f=d[0],m=d[d.length-1];const p=m0){for(;g<=x;++g)for(j=1;jm)break;N.push(b)}}else for(;g<=x;++g)for(j=r-1;j>=1;--j)if(b=g>0?j/o(-g):j*o(g),!(bm)break;N.push(b)}N.length*2{if(u==null&&(u=10),d==null&&(d=r===10?"s":","),typeof d!="function"&&(!(r%1)&&(d=zf(d)).precision==null&&(d.trim=!0),d=xO(d)),u===1/0)return d;const f=Math.max(1,r*u/t.ticks().length);return m=>{let p=m/o(Math.round(a(m)));return p*rn(qz(n(),{floor:u=>o(Math.floor(a(u))),ceil:u=>o(Math.ceil(a(u)))})),t}function Fz(){const e=bO(oy()).domain([1,10]);return e.copy=()=>Ph(e,Fz()).base(e.base()),Ea.apply(e,arguments),e}function t$(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function n$(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function wO(e){var t=1,n=e(t$(t),n$(t));return n.constant=function(r){return arguments.length?e(t$(t=+r),n$(t)):t},ss(n)}function Uz(){var e=wO(oy());return e.copy=function(){return Ph(e,Uz()).constant(e.constant())},Ea.apply(e,arguments)}function r$(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function xae(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function bae(e){return e<0?-e*e:e*e}function jO(e){var t=e(jr,jr),n=1;function r(){return n===1?e(jr,jr):n===.5?e(xae,bae):e(r$(n),r$(1/n))}return t.exponent=function(a){return arguments.length?(n=+a,r()):n},ss(t)}function SO(){var e=jO(oy());return e.copy=function(){return Ph(e,SO()).exponent(e.exponent())},Ea.apply(e,arguments),e}function wae(){return SO.apply(null,arguments).exponent(.5)}function a$(e){return Math.sign(e)*e*e}function jae(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function Hz(){var e=gO(),t=[0,1],n=!1,r;function a(o){var l=jae(e(o));return isNaN(l)?r:n?Math.round(l):l}return a.invert=function(o){return e.invert(a$(o))},a.domain=function(o){return arguments.length?(e.domain(o),a):e.domain()},a.range=function(o){return arguments.length?(e.range((t=Array.from(o,Lv)).map(a$)),a):t.slice()},a.rangeRound=function(o){return a.range(o).round(!0)},a.round=function(o){return arguments.length?(n=!!o,a):n},a.clamp=function(o){return arguments.length?(e.clamp(o),a):e.clamp()},a.unknown=function(o){return arguments.length?(r=o,a):r},a.copy=function(){return Hz(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},Ea.apply(a,arguments),ss(a)}function Wz(){var e=[],t=[],n=[],r;function a(){var l=0,u=Math.max(1,t.length);for(n=new Array(u-1);++l0?n[u-1]:e[0],u=n?[r[n-1],t]:[r[f-1],r[f]]},l.unknown=function(d){return arguments.length&&(o=d),l},l.thresholds=function(){return r.slice()},l.copy=function(){return Vz().domain([e,t]).range(a).unknown(o)},Ea.apply(ss(l),arguments)}function Gz(){var e=[.5],t=[0,1],n,r=1;function a(o){return o!=null&&o<=o?t[kh(e,o,0,r)]:n}return a.domain=function(o){return arguments.length?(e=Array.from(o),r=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(o){return arguments.length?(t=Array.from(o),r=Math.min(e.length,t.length-1),a):t.slice()},a.invertExtent=function(o){var l=t.indexOf(o);return[e[l-1],e[l]]},a.unknown=function(o){return arguments.length?(n=o,a):n},a.copy=function(){return Gz().domain(e).range(t).unknown(n)},Ea.apply(a,arguments)}const Z1=new Date,Q1=new Date;function Dn(e,t,n,r){function a(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return a.floor=o=>(e(o=new Date(+o)),o),a.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),a.round=o=>{const l=a(o),u=a.ceil(o);return o-l(t(o=new Date(+o),l==null?1:Math.floor(l)),o),a.range=(o,l,u)=>{const d=[];if(o=a.ceil(o),u=u==null?1:Math.floor(u),!(o0))return d;let f;do d.push(f=new Date(+o)),t(o,u),e(o);while(fDn(l=>{if(l>=l)for(;e(l),!o(l);)l.setTime(l-1)},(l,u)=>{if(l>=l)if(u<0)for(;++u<=0;)for(;t(l,-1),!o(l););else for(;--u>=0;)for(;t(l,1),!o(l););}),n&&(a.count=(o,l)=>(Z1.setTime(+o),Q1.setTime(+l),e(Z1),e(Q1),Math.floor(n(Z1,Q1))),a.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?a.filter(r?l=>r(l)%o===0:l=>a.count(0,l)%o===0):a)),a}const qv=Dn(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);qv.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Dn(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):qv);qv.range;const Gi=1e3,Sa=Gi*60,Yi=Sa*60,no=Yi*24,_O=no*7,i$=no*30,J1=no*365,Ks=Dn(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Gi)},(e,t)=>(t-e)/Gi,e=>e.getUTCSeconds());Ks.range;const NO=Dn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Gi)},(e,t)=>{e.setTime(+e+t*Sa)},(e,t)=>(t-e)/Sa,e=>e.getMinutes());NO.range;const CO=Dn(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Sa)},(e,t)=>(t-e)/Sa,e=>e.getUTCMinutes());CO.range;const OO=Dn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Gi-e.getMinutes()*Sa)},(e,t)=>{e.setTime(+e+t*Yi)},(e,t)=>(t-e)/Yi,e=>e.getHours());OO.range;const EO=Dn(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Yi)},(e,t)=>(t-e)/Yi,e=>e.getUTCHours());EO.range;const Rh=Dn(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Sa)/no,e=>e.getDate()-1);Rh.range;const sy=Dn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/no,e=>e.getUTCDate()-1);sy.range;const Yz=Dn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/no,e=>Math.floor(e/no));Yz.range;function _l(e){return Dn(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())*Sa)/_O)}const ly=_l(0),Fv=_l(1),Sae=_l(2),_ae=_l(3),uu=_l(4),Nae=_l(5),Cae=_l(6);ly.range;Fv.range;Sae.range;_ae.range;uu.range;Nae.range;Cae.range;function Nl(e){return Dn(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)/_O)}const cy=Nl(0),Uv=Nl(1),Oae=Nl(2),Eae=Nl(3),du=Nl(4),Aae=Nl(5),Tae=Nl(6);cy.range;Uv.range;Oae.range;Eae.range;du.range;Aae.range;Tae.range;const AO=Dn(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());AO.range;const TO=Dn(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());TO.range;const ro=Dn(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());ro.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Dn(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)});ro.range;const ao=Dn(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());ao.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Dn(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)});ao.range;function Kz(e,t,n,r,a,o){const l=[[Ks,1,Gi],[Ks,5,5*Gi],[Ks,15,15*Gi],[Ks,30,30*Gi],[o,1,Sa],[o,5,5*Sa],[o,15,15*Sa],[o,30,30*Sa],[a,1,Yi],[a,3,3*Yi],[a,6,6*Yi],[a,12,12*Yi],[r,1,no],[r,2,2*no],[n,1,_O],[t,1,i$],[t,3,3*i$],[e,1,J1]];function u(f,m,p){const g=mw).right(l,g);if(x===l.length)return e.every(F_(f/J1,m/J1,p));if(x===0)return qv.every(Math.max(F_(f,m,p),1));const[j,b]=l[g/l[x-1][2]53)return null;"w"in le||(le.w=1),"Z"in le?(_e=tS(Qd(le.y,0,1)),me=_e.getUTCDay(),_e=me>4||me===0?Uv.ceil(_e):Uv(_e),_e=sy.offset(_e,(le.V-1)*7),le.y=_e.getUTCFullYear(),le.m=_e.getUTCMonth(),le.d=_e.getUTCDate()+(le.w+6)%7):(_e=eS(Qd(le.y,0,1)),me=_e.getDay(),_e=me>4||me===0?Fv.ceil(_e):Fv(_e),_e=Rh.offset(_e,(le.V-1)*7),le.y=_e.getFullYear(),le.m=_e.getMonth(),le.d=_e.getDate()+(le.w+6)%7)}else("W"in le||"U"in le)&&("w"in le||(le.w="u"in le?le.u%7:"W"in le?1:0),me="Z"in le?tS(Qd(le.y,0,1)).getUTCDay():eS(Qd(le.y,0,1)).getDay(),le.m=0,le.d="W"in le?(le.w+6)%7+le.W*7-(me+5)%7:le.w+le.U*7-(me+6)%7);return"Z"in le?(le.H+=le.Z/100|0,le.M+=le.Z%100,tS(le)):eS(le)}}function M(Z,pe,je,le){for(var Re=0,_e=pe.length,me=je.length,ve,Le;Re<_e;){if(le>=me)return-1;if(ve=pe.charCodeAt(Re++),ve===37){if(ve=pe.charAt(Re++),Le=C[ve in o$?pe.charAt(Re++):ve],!Le||(le=Le(Z,je,le))<0)return-1}else if(ve!=je.charCodeAt(le++))return-1}return le}function I(Z,pe,je){var le=f.exec(pe.slice(je));return le?(Z.p=m.get(le[0].toLowerCase()),je+le[0].length):-1}function z(Z,pe,je){var le=x.exec(pe.slice(je));return le?(Z.w=j.get(le[0].toLowerCase()),je+le[0].length):-1}function D(Z,pe,je){var le=p.exec(pe.slice(je));return le?(Z.w=g.get(le[0].toLowerCase()),je+le[0].length):-1}function H(Z,pe,je){var le=N.exec(pe.slice(je));return le?(Z.m=A.get(le[0].toLowerCase()),je+le[0].length):-1}function V(Z,pe,je){var le=b.exec(pe.slice(je));return le?(Z.m=w.get(le[0].toLowerCase()),je+le[0].length):-1}function F(Z,pe,je){return M(Z,t,pe,je)}function G(Z,pe,je){return M(Z,n,pe,je)}function L(Z,pe,je){return M(Z,r,pe,je)}function R(Z){return l[Z.getDay()]}function U(Z){return o[Z.getDay()]}function K(Z){return d[Z.getMonth()]}function te(Z){return u[Z.getMonth()]}function $(Z){return a[+(Z.getHours()>=12)]}function B(Z){return 1+~~(Z.getMonth()/3)}function Y(Z){return l[Z.getUTCDay()]}function ne(Z){return o[Z.getUTCDay()]}function oe(Z){return d[Z.getUTCMonth()]}function xe(Z){return u[Z.getUTCMonth()]}function ee(Z){return a[+(Z.getUTCHours()>=12)]}function ae(Z){return 1+~~(Z.getUTCMonth()/3)}return{format:function(Z){var pe=k(Z+="",E);return pe.toString=function(){return Z},pe},parse:function(Z){var pe=O(Z+="",!1);return pe.toString=function(){return Z},pe},utcFormat:function(Z){var pe=k(Z+="",T);return pe.toString=function(){return Z},pe},utcParse:function(Z){var pe=O(Z+="",!0);return pe.toString=function(){return Z},pe}}}var o$={"-":"",_:" ",0:"0"},Gn=/^\s*\d+/,$ae=/^%/,Iae=/[\\^$*+?|[\]().{}]/g;function vt(e,t,n){var r=e<0?"-":"",a=(r?-e:e)+"",o=a.length;return r+(o[t.toLowerCase(),n]))}function Bae(e,t,n){var r=Gn.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function zae(e,t,n){var r=Gn.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function qae(e,t,n){var r=Gn.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Fae(e,t,n){var r=Gn.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Uae(e,t,n){var r=Gn.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function s$(e,t,n){var r=Gn.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function l$(e,t,n){var r=Gn.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Hae(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 Wae(e,t,n){var r=Gn.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function Vae(e,t,n){var r=Gn.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function c$(e,t,n){var r=Gn.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Gae(e,t,n){var r=Gn.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function u$(e,t,n){var r=Gn.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Yae(e,t,n){var r=Gn.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Kae(e,t,n){var r=Gn.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Xae(e,t,n){var r=Gn.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Zae(e,t,n){var r=Gn.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Qae(e,t,n){var r=$ae.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Jae(e,t,n){var r=Gn.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function eie(e,t,n){var r=Gn.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function d$(e,t){return vt(e.getDate(),t,2)}function tie(e,t){return vt(e.getHours(),t,2)}function nie(e,t){return vt(e.getHours()%12||12,t,2)}function rie(e,t){return vt(1+Rh.count(ro(e),e),t,3)}function Xz(e,t){return vt(e.getMilliseconds(),t,3)}function aie(e,t){return Xz(e,t)+"000"}function iie(e,t){return vt(e.getMonth()+1,t,2)}function oie(e,t){return vt(e.getMinutes(),t,2)}function sie(e,t){return vt(e.getSeconds(),t,2)}function lie(e){var t=e.getDay();return t===0?7:t}function cie(e,t){return vt(ly.count(ro(e)-1,e),t,2)}function Zz(e){var t=e.getDay();return t>=4||t===0?uu(e):uu.ceil(e)}function uie(e,t){return e=Zz(e),vt(uu.count(ro(e),e)+(ro(e).getDay()===4),t,2)}function die(e){return e.getDay()}function fie(e,t){return vt(Fv.count(ro(e)-1,e),t,2)}function hie(e,t){return vt(e.getFullYear()%100,t,2)}function mie(e,t){return e=Zz(e),vt(e.getFullYear()%100,t,2)}function pie(e,t){return vt(e.getFullYear()%1e4,t,4)}function vie(e,t){var n=e.getDay();return e=n>=4||n===0?uu(e):uu.ceil(e),vt(e.getFullYear()%1e4,t,4)}function gie(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+vt(t/60|0,"0",2)+vt(t%60,"0",2)}function f$(e,t){return vt(e.getUTCDate(),t,2)}function yie(e,t){return vt(e.getUTCHours(),t,2)}function xie(e,t){return vt(e.getUTCHours()%12||12,t,2)}function bie(e,t){return vt(1+sy.count(ao(e),e),t,3)}function Qz(e,t){return vt(e.getUTCMilliseconds(),t,3)}function wie(e,t){return Qz(e,t)+"000"}function jie(e,t){return vt(e.getUTCMonth()+1,t,2)}function Sie(e,t){return vt(e.getUTCMinutes(),t,2)}function _ie(e,t){return vt(e.getUTCSeconds(),t,2)}function Nie(e){var t=e.getUTCDay();return t===0?7:t}function Cie(e,t){return vt(cy.count(ao(e)-1,e),t,2)}function Jz(e){var t=e.getUTCDay();return t>=4||t===0?du(e):du.ceil(e)}function Oie(e,t){return e=Jz(e),vt(du.count(ao(e),e)+(ao(e).getUTCDay()===4),t,2)}function Eie(e){return e.getUTCDay()}function Aie(e,t){return vt(Uv.count(ao(e)-1,e),t,2)}function Tie(e,t){return vt(e.getUTCFullYear()%100,t,2)}function kie(e,t){return e=Jz(e),vt(e.getUTCFullYear()%100,t,2)}function Mie(e,t){return vt(e.getUTCFullYear()%1e4,t,4)}function Pie(e,t){var n=e.getUTCDay();return e=n>=4||n===0?du(e):du.ceil(e),vt(e.getUTCFullYear()%1e4,t,4)}function Rie(){return"+0000"}function h$(){return"%"}function m$(e){return+e}function p$(e){return Math.floor(+e/1e3)}var Sc,e6,t6;Die({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 Die(e){return Sc=Dae(e),e6=Sc.format,Sc.parse,t6=Sc.utcFormat,Sc.utcParse,Sc}function $ie(e){return new Date(e)}function Iie(e){return e instanceof Date?+e:+new Date(+e)}function kO(e,t,n,r,a,o,l,u,d,f){var m=gO(),p=m.invert,g=m.domain,x=f(".%L"),j=f(":%S"),b=f("%I:%M"),w=f("%I %p"),N=f("%a %d"),A=f("%b %d"),E=f("%B"),T=f("%Y");function C(k){return(d(k)t(a/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(a,o)=>Cre(e,o/r))},n.copy=function(){return i6(t).domain(e)},uo.apply(n,arguments)}function dy(){var e=0,t=.5,n=1,r=1,a,o,l,u,d,f=jr,m,p=!1,g;function x(b){return isNaN(b=+b)?g:(b=.5+((b=+m(b))-o)*(r*bn}return rS=e,rS}var aS,x$;function Fie(){if(x$)return aS;x$=1;var e=fy(),t=c6(),n=Fu();function r(a){return a&&a.length?e(a,n,t):void 0}return aS=r,aS}var Uie=Fie();const hy=St(Uie);var iS,b$;function u6(){if(b$)return iS;b$=1;function e(t,n){return te.e^o.s<0?1:-1;for(r=o.d.length,a=e.d.length,t=0,n=re.d[t]^o.s<0?1:-1;return r===a?0:r>a^o.s<0?1:-1};Ee.decimalPlaces=Ee.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*Xt;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};Ee.dividedBy=Ee.div=function(e){return eo(this,new this.constructor(e))};Ee.dividedToIntegerBy=Ee.idiv=function(e){var t=this,n=t.constructor;return Bt(eo(t,new n(e),0,1),n.precision)};Ee.equals=Ee.eq=function(e){return!this.cmp(e)};Ee.exponent=function(){return gn(this)};Ee.greaterThan=Ee.gt=function(e){return this.cmp(e)>0};Ee.greaterThanOrEqualTo=Ee.gte=function(e){return this.cmp(e)>=0};Ee.isInteger=Ee.isint=function(){return this.e>this.d.length-2};Ee.isNegative=Ee.isneg=function(){return this.s<0};Ee.isPositive=Ee.ispos=function(){return this.s>0};Ee.isZero=function(){return this.s===0};Ee.lessThan=Ee.lt=function(e){return this.cmp(e)<0};Ee.lessThanOrEqualTo=Ee.lte=function(e){return this.cmp(e)<1};Ee.logarithm=Ee.log=function(e){var t,n=this,r=n.constructor,a=r.precision,o=a+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(ea))throw Error(Ca+"NaN");if(n.s<1)throw Error(Ca+(n.s?"NaN":"-Infinity"));return n.eq(ea)?new r(0):(Qt=!1,t=eo(qf(n,o),qf(e,o),o),Qt=!0,Bt(t,a))};Ee.minus=Ee.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?m6(t,e):f6(t,(e.s=-e.s,e))};Ee.modulo=Ee.mod=function(e){var t,n=this,r=n.constructor,a=r.precision;if(e=new r(e),!e.s)throw Error(Ca+"NaN");return n.s?(Qt=!1,t=eo(n,e,0,1).times(e),Qt=!0,n.minus(t)):Bt(new r(n),a)};Ee.naturalExponential=Ee.exp=function(){return h6(this)};Ee.naturalLogarithm=Ee.ln=function(){return qf(this)};Ee.negated=Ee.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Ee.plus=Ee.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?f6(t,e):m6(t,(e.s=-e.s,e))};Ee.precision=Ee.sd=function(e){var t,n,r,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(al+e);if(t=gn(a)+1,r=a.d.length-1,n=r*Xt+1,r=a.d[r],r){for(;r%10==0;r/=10)n--;for(r=a.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};Ee.squareRoot=Ee.sqrt=function(){var e,t,n,r,a,o,l,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(Ca+"NaN")}for(e=gn(u),Qt=!1,a=Math.sqrt(+u),a==0||a==1/0?(t=si(u.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=Wu((e+1)/2)-(e<0||e%2),a==1/0?t="5e"+e:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new d(t)):r=new d(a.toString()),n=d.precision,a=l=n+3;;)if(o=r,r=o.plus(eo(u,o,l+2)).times(.5),si(o.d).slice(0,l)===(t=si(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),a==l&&t=="4999"){if(Bt(o,n+1,0),o.times(o).eq(u)){r=o;break}}else if(t!="9999")break;l+=4}return Qt=!0,Bt(r,n)};Ee.times=Ee.mul=function(e){var t,n,r,a,o,l,u,d,f,m=this,p=m.constructor,g=m.d,x=(e=new p(e)).d;if(!m.s||!e.s)return new p(0);for(e.s*=m.s,n=m.e+e.e,d=g.length,f=x.length,d=0;){for(t=0,a=d+r;a>r;)u=o[a]+x[r]*g[a-r-1]+t,o[a--]=u%zn|0,t=u/zn|0;o[a]=(o[a]+t)%zn|0}for(;!o[--l];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,Qt?Bt(e,p.precision):e};Ee.toDecimalPlaces=Ee.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(vi(e,0,Hu),t===void 0?t=r.rounding:vi(t,0,8),Bt(n,e+gn(n)+1,t))};Ee.toExponential=function(e,t){var n,r=this,a=r.constructor;return e===void 0?n=ml(r,!0):(vi(e,0,Hu),t===void 0?t=a.rounding:vi(t,0,8),r=Bt(new a(r),e+1,t),n=ml(r,!0,e+1)),n};Ee.toFixed=function(e,t){var n,r,a=this,o=a.constructor;return e===void 0?ml(a):(vi(e,0,Hu),t===void 0?t=o.rounding:vi(t,0,8),r=Bt(new o(a),e+gn(a)+1,t),n=ml(r.abs(),!1,e+gn(r)+1),a.isneg()&&!a.isZero()?"-"+n:n)};Ee.toInteger=Ee.toint=function(){var e=this,t=e.constructor;return Bt(new t(e),gn(e)+1,t.rounding)};Ee.toNumber=function(){return+this};Ee.toPower=Ee.pow=function(e){var t,n,r,a,o,l,u=this,d=u.constructor,f=12,m=+(e=new d(e));if(!e.s)return new d(ea);if(u=new d(u),!u.s){if(e.s<1)throw Error(Ca+"Infinity");return u}if(u.eq(ea))return u;if(r=d.precision,e.eq(ea))return Bt(u,r);if(t=e.e,n=e.d.length-1,l=t>=n,o=u.s,l){if((n=m<0?-m:m)<=d6){for(a=new d(ea),t=Math.ceil(r/Xt+4),Qt=!1;n%2&&(a=a.times(u),C$(a.d,t)),n=Wu(n/2),n!==0;)u=u.times(u),C$(u.d,t);return Qt=!0,e.s<0?new d(ea).div(a):Bt(a,r)}}else if(o<0)throw Error(Ca+"NaN");return o=o<0&&e.d[Math.max(t,n)]&1?-1:1,u.s=1,Qt=!1,a=e.times(qf(u,r+f)),Qt=!0,a=h6(a),a.s=o,a};Ee.toPrecision=function(e,t){var n,r,a=this,o=a.constructor;return e===void 0?(n=gn(a),r=ml(a,n<=o.toExpNeg||n>=o.toExpPos)):(vi(e,1,Hu),t===void 0?t=o.rounding:vi(t,0,8),a=Bt(new o(a),e,t),n=gn(a),r=ml(a,e<=n||n<=o.toExpNeg,e)),r};Ee.toSignificantDigits=Ee.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(vi(e,1,Hu),t===void 0?t=r.rounding:vi(t,0,8)),Bt(new r(n),e,t)};Ee.toString=Ee.valueOf=Ee.val=Ee.toJSON=Ee[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=gn(e),n=e.constructor;return ml(e,t<=n.toExpNeg||t>=n.toExpPos)};function f6(e,t){var n,r,a,o,l,u,d,f,m=e.constructor,p=m.precision;if(!e.s||!t.s)return t.s||(t=new m(e)),Qt?Bt(t,p):t;if(d=e.d,f=t.d,l=e.e,a=t.e,d=d.slice(),o=l-a,o){for(o<0?(r=d,o=-o,u=f.length):(r=f,a=l,u=d.length),l=Math.ceil(p/Xt),u=l>u?l+1:u+1,o>u&&(o=u,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(u=d.length,o=f.length,u-o<0&&(o=u,r=f,f=d,d=r),n=0;o;)n=(d[--o]=d[o]+f[o]+n)/zn|0,d[o]%=zn;for(n&&(d.unshift(n),++a),u=d.length;d[--u]==0;)d.pop();return t.d=d,t.e=a,Qt?Bt(t,p):t}function vi(e,t,n){if(e!==~~e||en)throw Error(al+e)}function si(e){var t,n,r,a=e.length-1,o="",l=e[0];if(a>0){for(o+=l,t=1;tl?1:-1;else for(u=d=0;ua[u]?1:-1;break}return d}function n(r,a,o){for(var l=0;o--;)r[o]-=l,l=r[o]1;)r.shift()}return function(r,a,o,l){var u,d,f,m,p,g,x,j,b,w,N,A,E,T,C,k,O,M,I=r.constructor,z=r.s==a.s?1:-1,D=r.d,H=a.d;if(!r.s)return new I(r);if(!a.s)throw Error(Ca+"Division by zero");for(d=r.e-a.e,O=H.length,C=D.length,x=new I(z),j=x.d=[],f=0;H[f]==(D[f]||0);)++f;if(H[f]>(D[f]||0)&&--d,o==null?A=o=I.precision:l?A=o+(gn(r)-gn(a))+1:A=o,A<0)return new I(0);if(A=A/Xt+2|0,f=0,O==1)for(m=0,H=H[0],A++;(f1&&(H=e(H,m),D=e(D,m),O=H.length,C=D.length),T=O,b=D.slice(0,O),w=b.length;w=zn/2&&++k;do m=0,u=t(H,b,O,w),u<0?(N=b[0],O!=w&&(N=N*zn+(b[1]||0)),m=N/k|0,m>1?(m>=zn&&(m=zn-1),p=e(H,m),g=p.length,w=b.length,u=t(p,b,g,w),u==1&&(m--,n(p,O16)throw Error(RO+gn(e));if(!e.s)return new m(ea);for(Qt=!1,u=p,l=new m(.03125);e.abs().gte(.1);)e=e.times(l),f+=5;for(r=Math.log(Us(2,f))/Math.LN10*2+5|0,u+=r,n=a=o=new m(ea),m.precision=u;;){if(a=Bt(a.times(e),u),n=n.times(++d),l=o.plus(eo(a,n,u)),si(l.d).slice(0,u)===si(o.d).slice(0,u)){for(;f--;)o=Bt(o.times(o),u);return m.precision=p,t==null?(Qt=!0,Bt(o,p)):o}o=l}}function gn(e){for(var t=e.e*Xt,n=e.d[0];n>=10;n/=10)t++;return t}function uS(e,t,n){if(t>e.LN10.sd())throw Qt=!0,n&&(e.precision=n),Error(Ca+"LN10 precision limit exceeded");return Bt(new e(e.LN10),t)}function qo(e){for(var t="";e--;)t+="0";return t}function qf(e,t){var n,r,a,o,l,u,d,f,m,p=1,g=10,x=e,j=x.d,b=x.constructor,w=b.precision;if(x.s<1)throw Error(Ca+(x.s?"NaN":"-Infinity"));if(x.eq(ea))return new b(0);if(t==null?(Qt=!1,f=w):f=t,x.eq(10))return t==null&&(Qt=!0),uS(b,f);if(f+=g,b.precision=f,n=si(j),r=n.charAt(0),o=gn(x),Math.abs(o)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)x=x.times(e),n=si(x.d),r=n.charAt(0),p++;o=gn(x),r>1?(x=new b("0."+n),o++):x=new b(r+"."+n.slice(1))}else return d=uS(b,f+2,w).times(o+""),x=qf(new b(r+"."+n.slice(1)),f-g).plus(d),b.precision=w,t==null?(Qt=!0,Bt(x,w)):x;for(u=l=x=eo(x.minus(ea),x.plus(ea),f),m=Bt(x.times(x),f),a=3;;){if(l=Bt(l.times(m),f),d=u.plus(eo(l,new b(a),f)),si(d.d).slice(0,f)===si(u.d).slice(0,f))return u=u.times(2),o!==0&&(u=u.plus(uS(b,f+2,w).times(o+""))),u=eo(u,new b(p),f),b.precision=w,t==null?(Qt=!0,Bt(u,w)):u;u=d,a+=2}}function N$(e,t){var n,r,a;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(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=Wu(n/Xt),e.d=[],r=(n+1)%Xt,n<0&&(r+=Xt),rHv||e.e<-Hv))throw Error(RO+n)}else e.s=0,e.e=0,e.d=[0];return e}function Bt(e,t,n){var r,a,o,l,u,d,f,m,p=e.d;for(l=1,o=p[0];o>=10;o/=10)l++;if(r=t-l,r<0)r+=Xt,a=t,f=p[m=0];else{if(m=Math.ceil((r+1)/Xt),o=p.length,m>=o)return e;for(f=o=p[m],l=1;o>=10;o/=10)l++;r%=Xt,a=r-Xt+l}if(n!==void 0&&(o=Us(10,l-a-1),u=f/o%10|0,d=t<0||p[m+1]!==void 0||f%o,d=n<4?(u||d)&&(n==0||n==(e.s<0?3:2)):u>5||u==5&&(n==4||d||n==6&&(r>0?a>0?f/Us(10,l-a):0:p[m-1])%10&1||n==(e.s<0?8:7))),t<1||!p[0])return d?(o=gn(e),p.length=1,t=t-o-1,p[0]=Us(10,(Xt-t%Xt)%Xt),e.e=Wu(-t/Xt)||0):(p.length=1,p[0]=e.e=e.s=0),e;if(r==0?(p.length=m,o=1,m--):(p.length=m+1,o=Us(10,Xt-r),p[m]=a>0?(f/Us(10,l-a)%Us(10,a)|0)*o:0),d)for(;;)if(m==0){(p[0]+=o)==zn&&(p[0]=1,++e.e);break}else{if(p[m]+=o,p[m]!=zn)break;p[m--]=0,o=1}for(r=p.length;p[--r]===0;)p.pop();if(Qt&&(e.e>Hv||e.e<-Hv))throw Error(RO+gn(e));return e}function m6(e,t){var n,r,a,o,l,u,d,f,m,p,g=e.constructor,x=g.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new g(e),Qt?Bt(t,x):t;if(d=e.d,p=t.d,r=t.e,f=e.e,d=d.slice(),l=f-r,l){for(m=l<0,m?(n=d,l=-l,u=p.length):(n=p,r=f,u=d.length),a=Math.max(Math.ceil(x/Xt),u)+2,l>a&&(l=a,n.length=1),n.reverse(),a=l;a--;)n.push(0);n.reverse()}else{for(a=d.length,u=p.length,m=a0;--a)d[u++]=0;for(a=p.length;a>l;){if(d[--a]0?o=o.charAt(0)+"."+o.slice(1)+qo(r):l>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(a<0?"e":"e+")+a):a<0?(o="0."+qo(-a-1)+o,n&&(r=n-l)>0&&(o+=qo(r))):a>=l?(o+=qo(a+1-l),n&&(r=n-a-1)>0&&(o=o+"."+qo(r))):((r=a+1)0&&(a+1===l&&(o+="."),o+=qo(r))),e.s<0?"-"+o:o}function C$(e,t){if(e.length>t)return e.length=t,!0}function p6(e){var t,n,r;function a(o){var l=this;if(!(l instanceof a))return new a(o);if(l.constructor=a,o instanceof a){l.s=o.s,l.e=o.e,l.d=(o=o.d)?o.slice():o;return}if(typeof o=="number"){if(o*0!==0)throw Error(al+o);if(o>0)l.s=1;else if(o<0)o=-o,l.s=-1;else{l.s=0,l.e=0,l.d=[0];return}if(o===~~o&&o<1e7){l.e=0,l.d=[o];return}return N$(l,o.toString())}else if(typeof o!="string")throw Error(al+o);if(o.charCodeAt(0)===45?(o=o.slice(1),l.s=-1):l.s=1,Jie.test(o))N$(l,o);else throw Error(al+o)}if(a.prototype=Ee,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=p6,a.config=a.set=eoe,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=a[t+1]&&r<=a[t+2])this[n]=r;else throw Error(al+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(al+n+": "+r);return this}var DO=p6(Qie);ea=new DO(1);const Rt=DO;function toe(e){return ioe(e)||aoe(e)||roe(e)||noe()}function noe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function roe(e,t){if(e){if(typeof e=="string")return G_(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G_(e,t)}}function aoe(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function ioe(e){if(Array.isArray(e))return G_(e)}function G_(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t?n.apply(void 0,a):e(t-l,O$(function(){for(var u=arguments.length,d=new Array(u),f=0;fe.length)&&(t=e.length);for(var n=0,r=new Array(t);n"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,a=!1,o=void 0;try{for(var l=e[Symbol.iterator](),u;!(r=(u=l.next()).done)&&(n.push(u.value),!(t&&n.length===t));r=!0);}catch(d){a=!0,o=d}finally{try{!r&&l.return!=null&&l.return()}finally{if(a)throw o}}return n}}function boe(e){if(Array.isArray(e))return e}function b6(e){var t=Ff(e,2),n=t[0],r=t[1],a=n,o=r;return n>r&&(a=r,o=n),[a,o]}function w6(e,t,n){if(e.lte(0))return new Rt(0);var r=vy.getDigitCount(e.toNumber()),a=new Rt(10).pow(r),o=e.div(a),l=r!==1?.05:.1,u=new Rt(Math.ceil(o.div(l).toNumber())).add(n).mul(l),d=u.mul(a);return t?d:new Rt(Math.ceil(d))}function woe(e,t,n){var r=1,a=new Rt(e);if(!a.isint()&&n){var o=Math.abs(e);o<1?(r=new Rt(10).pow(vy.getDigitCount(e)-1),a=new Rt(Math.floor(a.div(r).toNumber())).mul(r)):o>1&&(a=new Rt(Math.floor(e)))}else e===0?a=new Rt(Math.floor((t-1)/2)):n||(a=new Rt(Math.floor(e)));var l=Math.floor((t-1)/2),u=coe(loe(function(d){return a.add(new Rt(d-l).mul(r)).toNumber()}),Y_);return u(0,t)}function j6(e,t,n,r){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new Rt(0),tickMin:new Rt(0),tickMax:new Rt(0)};var o=w6(new Rt(t).sub(e).div(n-1),r,a),l;e<=0&&t>=0?l=new Rt(0):(l=new Rt(e).add(t).div(2),l=l.sub(new Rt(l).mod(o)));var u=Math.ceil(l.sub(e).div(o).toNumber()),d=Math.ceil(new Rt(t).sub(l).div(o).toNumber()),f=u+d+1;return f>n?j6(e,t,n,r,a+1):(f0?d+(n-f):d,u=t>0?u:u+(n-f)),{step:o,tickMin:l.sub(new Rt(u).mul(o)),tickMax:l.add(new Rt(d).mul(o))})}function joe(e){var t=Ff(e,2),n=t[0],r=t[1],a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=Math.max(a,2),u=b6([n,r]),d=Ff(u,2),f=d[0],m=d[1];if(f===-1/0||m===1/0){var p=m===1/0?[f].concat(X_(Y_(0,a-1).map(function(){return 1/0}))):[].concat(X_(Y_(0,a-1).map(function(){return-1/0})),[m]);return n>r?K_(p):p}if(f===m)return woe(f,a,o);var g=j6(f,m,l,o),x=g.step,j=g.tickMin,b=g.tickMax,w=vy.rangeStep(j,b.add(new Rt(.1).mul(x)),x);return n>r?K_(w):w}function Soe(e,t){var n=Ff(e,2),r=n[0],a=n[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=b6([r,a]),u=Ff(l,2),d=u[0],f=u[1];if(d===-1/0||f===1/0)return[r,a];if(d===f)return[d];var m=Math.max(t,2),p=w6(new Rt(f).sub(d).div(m-1),o,0),g=[].concat(X_(vy.rangeStep(new Rt(d),new Rt(f).sub(new Rt(.99).mul(p)),p)),[f]);return r>a?K_(g):g}var _oe=y6(joe),Noe=y6(Soe),Coe=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function fu(e){"@babel/helpers - typeof";return fu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fu(e)}function Wv(){return Wv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Poe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Roe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Doe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&arguments[1]!==void 0?arguments[1]:[],a=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,l=-1,u=(n=r?.length)!==null&&n!==void 0?n:0;if(u<=1)return 0;if(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var d=o.range,f=0;f0?a[f-1].coordinate:a[u-1].coordinate,p=a[f].coordinate,g=f>=u-1?a[0].coordinate:a[f+1].coordinate,x=void 0;if(br(p-m)!==br(g-p)){var j=[];if(br(g-p)===br(d[1]-d[0])){x=g;var b=p+d[1]-d[0];j[0]=Math.min(b,(b+m)/2),j[1]=Math.max(b,(b+m)/2)}else{x=m;var w=g+d[1]-d[0];j[0]=Math.min(p,(w+p)/2),j[1]=Math.max(p,(w+p)/2)}var N=[Math.min(p,(x+p)/2),Math.max(p,(x+p)/2)];if(t>N[0]&&t<=N[1]||t>=j[0]&&t<=j[1]){l=a[f].index;break}}else{var A=Math.min(m,g),E=Math.max(m,g);if(t>(A+p)/2&&t<=(E+p)/2){l=a[f].index;break}}}else for(var T=0;T0&&T(r[T].coordinate+r[T-1].coordinate)/2&&t<=(r[T].coordinate+r[T+1].coordinate)/2||T===u-1&&t>(r[T].coordinate+r[T-1].coordinate)/2){l=r[T].index;break}return l},$O=function(t){var n,r=t,a=r.type.displayName,o=(n=t.type)!==null&&n!==void 0&&n.defaultProps?sn(sn({},t.type.defaultProps),t.props):t.props,l=o.stroke,u=o.fill,d;switch(a){case"Line":d=l;break;case"Area":case"Radar":d=l&&l!=="none"?l:u;break;default:d=u;break}return d},Qoe=function(t){var n=t.barSize,r=t.totalSize,a=t.stackGroups,o=a===void 0?{}:a;if(!o)return{};for(var l={},u=Object.keys(o),d=0,f=u.length;d=0});if(N&&N.length){var A=N[0].type.defaultProps,E=A!==void 0?sn(sn({},A),N[0].props):N[0].props,T=E.barSize,C=E[w];l[C]||(l[C]=[]);var k=Ge(T)?n:T;l[C].push({item:N[0],stackList:N.slice(1),barSize:Ge(k)?void 0:wr(k,r,0)})}}return l},Joe=function(t){var n=t.barGap,r=t.barCategoryGap,a=t.bandSize,o=t.sizeList,l=o===void 0?[]:o,u=t.maxBarSize,d=l.length;if(d<1)return null;var f=wr(n,a,0,!0),m,p=[];if(l[0].barSize===+l[0].barSize){var g=!1,x=a/d,j=l.reduce(function(T,C){return T+C.barSize||0},0);j+=(d-1)*f,j>=a&&(j-=(d-1)*f,f=0),j>=a&&x>0&&(g=!0,x*=.9,j=d*x);var b=(a-j)/2>>0,w={offset:b-f,size:0};m=l.reduce(function(T,C){var k={item:C.item,position:{offset:w.offset+w.size+f,size:g?x:C.barSize}},O=[].concat(T$(T),[k]);return w=O[O.length-1].position,C.stackList&&C.stackList.length&&C.stackList.forEach(function(M){O.push({item:M,position:w})}),O},p)}else{var N=wr(r,a,0,!0);a-2*N-(d-1)*f<=0&&(f=0);var A=(a-2*N-(d-1)*f)/d;A>1&&(A>>=0);var E=u===+u?Math.min(A,u):A;m=l.reduce(function(T,C,k){var O=[].concat(T$(T),[{item:C.item,position:{offset:N+(A+f)*k+(A-E)/2,size:E}}]);return C.stackList&&C.stackList.length&&C.stackList.forEach(function(M){O.push({item:M,position:O[O.length-1].position})}),O},p)}return m},ese=function(t,n,r,a){var o=r.children,l=r.width,u=r.margin,d=l-(u.left||0)-(u.right||0),f=C6({children:o,legendWidth:d});if(f){var m=a||{},p=m.width,g=m.height,x=f.align,j=f.verticalAlign,b=f.layout;if((b==="vertical"||b==="horizontal"&&j==="middle")&&x!=="center"&&Ce(t[x]))return sn(sn({},t),{},Wc({},x,t[x]+(p||0)));if((b==="horizontal"||b==="vertical"&&x==="center")&&j!=="middle"&&Ce(t[j]))return sn(sn({},t),{},Wc({},j,t[j]+(g||0)))}return t},tse=function(t,n,r){return Ge(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},O6=function(t,n,r,a,o){var l=n.props.children,u=na(l,$h).filter(function(f){return tse(a,o,f.props.direction)});if(u&&u.length){var d=u.map(function(f){return f.props.dataKey});return t.reduce(function(f,m){var p=kn(m,r);if(Ge(p))return f;var g=Array.isArray(p)?[my(p),hy(p)]:[p,p],x=d.reduce(function(j,b){var w=kn(m,b,0),N=g[0]-Math.abs(Array.isArray(w)?w[0]:w),A=g[1]+Math.abs(Array.isArray(w)?w[1]:w);return[Math.min(N,j[0]),Math.max(A,j[1])]},[1/0,-1/0]);return[Math.min(x[0],f[0]),Math.max(x[1],f[1])]},[1/0,-1/0])}return null},nse=function(t,n,r,a,o){var l=n.map(function(u){return O6(t,u,r,o,a)}).filter(function(u){return!Ge(u)});return l&&l.length?l.reduce(function(u,d){return[Math.min(u[0],d[0]),Math.max(u[1],d[1])]},[1/0,-1/0]):null},E6=function(t,n,r,a,o){var l=n.map(function(d){var f=d.props.dataKey;return r==="number"&&f&&O6(t,d,f,a)||jf(t,f,r,o)});if(r==="number")return l.reduce(function(d,f){return[Math.min(d[0],f[0]),Math.max(d[1],f[1])]},[1/0,-1/0]);var u={};return l.reduce(function(d,f){for(var m=0,p=f.length;m=2?br(u[0]-u[1])*2*f:f,n&&(t.ticks||t.niceTicks)){var m=(t.ticks||t.niceTicks).map(function(p){var g=o?o.indexOf(p):p;return{coordinate:a(g)+f,value:p,offset:f}});return m.filter(function(p){return!Ah(p.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(p,g){return{coordinate:a(p)+f,value:p,index:g,offset:f}}):a.ticks&&!r?a.ticks(t.tickCount).map(function(p){return{coordinate:a(p)+f,value:p,offset:f}}):a.domain().map(function(p,g){return{coordinate:a(p)+f,value:o?o[p]:p,index:g,offset:f}})},dS=new WeakMap,Dp=function(t,n){if(typeof n!="function")return t;dS.has(t)||dS.set(t,new WeakMap);var r=dS.get(t);if(r.has(n))return r.get(n);var a=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,a),a},k6=function(t,n,r){var a=t.scale,o=t.type,l=t.layout,u=t.axisType;if(a==="auto")return l==="radial"&&u==="radiusAxis"?{scale:$f(),realScaleType:"band"}:l==="radial"&&u==="angleAxis"?{scale:zv(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:wf(),realScaleType:"point"}:o==="category"?{scale:$f(),realScaleType:"band"}:{scale:zv(),realScaleType:"linear"};if(dl(a)){var d="scale".concat(Qg(a));return{scale:(v$[d]||wf)(),realScaleType:v$[d]?d:"point"}}return We(a)?{scale:a}:{scale:wf(),realScaleType:"point"}},M$=1e-4,M6=function(t){var n=t.domain();if(!(!n||n.length<=2)){var r=n.length,a=t.range(),o=Math.min(a[0],a[1])-M$,l=Math.max(a[0],a[1])+M$,u=t(n[0]),d=t(n[r-1]);(ul||dl)&&t.domain([n[0],n[r-1]])}},rse=function(t,n){if(!t)return null;for(var r=0,a=t.length;ra)&&(o[1]=a),o[0]>a&&(o[0]=a),o[1]=0?(t[u][r][0]=o,t[u][r][1]=o+d,o=t[u][r][1]):(t[u][r][0]=l,t[u][r][1]=l+d,l=t[u][r][1])}},ose=function(t){var n=t.length;if(!(n<=0))for(var r=0,a=t[0].length;r=0?(t[l][r][0]=o,t[l][r][1]=o+u,o=t[l][r][1]):(t[l][r][0]=0,t[l][r][1]=0)}},sse={sign:ise,expand:YJ,none:au,silhouette:KJ,wiggle:XJ,positive:ose},lse=function(t,n,r){var a=n.map(function(u){return u.props.dataKey}),o=sse[r],l=GJ().keys(a).value(function(u,d){return+kn(u,d,0)}).order(A_).offset(o);return l(t)},cse=function(t,n,r,a,o,l){if(!t)return null;var u=l?n.reverse():n,d={},f=u.reduce(function(p,g){var x,j=(x=g.type)!==null&&x!==void 0&&x.defaultProps?sn(sn({},g.type.defaultProps),g.props):g.props,b=j.stackId,w=j.hide;if(w)return p;var N=j[r],A=p[N]||{hasStack:!1,stackGroups:{}};if(Mn(b)){var E=A.stackGroups[b]||{numericAxisId:r,cateAxisId:a,items:[]};E.items.push(g),A.hasStack=!0,A.stackGroups[b]=E}else A.stackGroups[qu("_stackId_")]={numericAxisId:r,cateAxisId:a,items:[g]};return sn(sn({},p),{},Wc({},N,A))},d),m={};return Object.keys(f).reduce(function(p,g){var x=f[g];if(x.hasStack){var j={};x.stackGroups=Object.keys(x.stackGroups).reduce(function(b,w){var N=x.stackGroups[w];return sn(sn({},b),{},Wc({},w,{numericAxisId:r,cateAxisId:a,items:N.items,stackedData:lse(t,N.items,o)}))},j)}return sn(sn({},p),{},Wc({},g,x))},m)},P6=function(t,n){var r=n.realScaleType,a=n.type,o=n.tickCount,l=n.originalDomain,u=n.allowDecimals,d=r||n.scale;if(d!=="auto"&&d!=="linear")return null;if(o&&a==="number"&&l&&(l[0]==="auto"||l[1]==="auto")){var f=t.domain();if(!f.length)return null;var m=_oe(f,o,u);return t.domain([my(m),hy(m)]),{niceTicks:m}}if(o&&a==="number"){var p=t.domain(),g=Noe(p,o,u);return{niceTicks:g}}return null};function P$(e){var t=e.axis,n=e.ticks,r=e.bandSize,a=e.entry,o=e.index,l=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Ge(a[t.dataKey])){var u=jv(n,"value",a[t.dataKey]);if(u)return u.coordinate+r/2}return n[o]?n[o].coordinate+r/2:null}var d=kn(a,Ge(l)?t.dataKey:l);return Ge(d)?null:t.scale(d)}var R$=function(t){var n=t.axis,r=t.ticks,a=t.offset,o=t.bandSize,l=t.entry,u=t.index;if(n.type==="category")return r[u]?r[u].coordinate+a:null;var d=kn(l,n.dataKey,n.domain[u]);return Ge(d)?null:n.scale(d)-o/2+a},use=function(t){var n=t.numericAxis,r=n.scale.domain();if(n.type==="number"){var a=Math.min(r[0],r[1]),o=Math.max(r[0],r[1]);return a<=0&&o>=0?0:o<0?o:a}return r[0]},dse=function(t,n){var r,a=(r=t.type)!==null&&r!==void 0&&r.defaultProps?sn(sn({},t.type.defaultProps),t.props):t.props,o=a.stackId;if(Mn(o)){var l=n[o];if(l){var u=l.items.indexOf(t);return u>=0?l.stackedData[u]:null}}return null},fse=function(t){return t.reduce(function(n,r){return[my(r.concat([n[0]]).filter(Ce)),hy(r.concat([n[1]]).filter(Ce))]},[1/0,-1/0])},R6=function(t,n,r){return Object.keys(t).reduce(function(a,o){var l=t[o],u=l.stackedData,d=u.reduce(function(f,m){var p=fse(m.slice(n,r+1));return[Math.min(f[0],p[0]),Math.max(f[1],p[1])]},[1/0,-1/0]);return[Math.min(d[0],a[0]),Math.max(d[1],a[1])]},[1/0,-1/0]).map(function(a){return a===1/0||a===-1/0?0:a})},D$=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,$$=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,eN=function(t,n,r){if(We(t))return t(n,r);if(!Array.isArray(t))return n;var a=[];if(Ce(t[0]))a[0]=r?t[0]:Math.min(t[0],n[0]);else if(D$.test(t[0])){var o=+D$.exec(t[0])[1];a[0]=n[0]-o}else We(t[0])?a[0]=t[0](n[0]):a[0]=n[0];if(Ce(t[1]))a[1]=r?t[1]:Math.max(t[1],n[1]);else if($$.test(t[1])){var l=+$$.exec(t[1])[1];a[1]=n[1]+l}else We(t[1])?a[1]=t[1](n[1]):a[1]=n[1];return a},Gv=function(t,n,r){if(t&&t.scale&&t.scale.bandwidth){var a=t.scale.bandwidth();if(!r||a>0)return a}if(t&&n&&n.length>=2){for(var o=uO(n,function(p){return p.coordinate}),l=1/0,u=1,d=o.length;ue.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&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},wse=function(t,n,r,a,o){var l=t.width,u=t.height,d=t.startAngle,f=t.endAngle,m=wr(t.cx,l,l/2),p=wr(t.cy,u,u/2),g=I6(l,u,r),x=wr(t.innerRadius,g,0),j=wr(t.outerRadius,g,g*.8),b=Object.keys(n);return b.reduce(function(w,N){var A=n[N],E=A.domain,T=A.reversed,C;if(Ge(A.range))a==="angleAxis"?C=[d,f]:a==="radiusAxis"&&(C=[x,j]),T&&(C=[C[1],C[0]]);else{C=A.range;var k=C,O=pse(k,2);d=O[0],f=O[1]}var M=k6(A,o),I=M.realScaleType,z=M.scale;z.domain(E).range(C),M6(z);var D=P6(z,Wi(Wi({},A),{},{realScaleType:I})),H=Wi(Wi(Wi({},A),D),{},{range:C,radius:j,realScaleType:I,scale:z,cx:m,cy:p,innerRadius:x,outerRadius:j,startAngle:d,endAngle:f});return Wi(Wi({},w),{},$6({},N,H))},{})},jse=function(t,n){var r=t.x,a=t.y,o=n.x,l=n.y;return Math.sqrt(Math.pow(r-o,2)+Math.pow(a-l,2))},Sse=function(t,n){var r=t.x,a=t.y,o=n.cx,l=n.cy,u=jse({x:r,y:a},{x:o,y:l});if(u<=0)return{radius:u};var d=(r-o)/u,f=Math.acos(d);return a>l&&(f=2*Math.PI-f),{radius:u,angle:bse(f),angleInRadian:f}},_se=function(t){var n=t.startAngle,r=t.endAngle,a=Math.floor(n/360),o=Math.floor(r/360),l=Math.min(a,o);return{startAngle:n-l*360,endAngle:r-l*360}},Nse=function(t,n){var r=n.startAngle,a=n.endAngle,o=Math.floor(r/360),l=Math.floor(a/360),u=Math.min(o,l);return t+u*360},z$=function(t,n){var r=t.x,a=t.y,o=Sse({x:r,y:a},n),l=o.radius,u=o.angle,d=n.innerRadius,f=n.outerRadius;if(lf)return!1;if(l===0)return!0;var m=_se(n),p=m.startAngle,g=m.endAngle,x=u,j;if(p<=g){for(;x>g;)x-=360;for(;x=p&&x<=g}else{for(;x>p;)x-=360;for(;x=g&&x<=p}return j?Wi(Wi({},n),{},{radius:l,angle:Nse(x,n)}):null},L6=function(t){return!y.isValidElement(t)&&!We(t)&&typeof t!="boolean"?t.className:""};function Vf(e){"@babel/helpers - typeof";return Vf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vf(e)}var Cse=["offset"];function Ose(e){return kse(e)||Tse(e)||Ase(e)||Ese()}function Ese(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ase(e,t){if(e){if(typeof e=="string")return tN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tN(e,t)}}function Tse(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function kse(e){if(Array.isArray(e))return tN(e)}function tN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Pse(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function q$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Tn(e){for(var t=1;t=0?1:-1,E,T;a==="insideStart"?(E=x+A*l,T=b):a==="insideEnd"?(E=j-A*l,T=!b):a==="end"&&(E=j+A*l,T=b),T=N<=0?T:!T;var C=Gt(f,m,w,E),k=Gt(f,m,w,E+(T?1:-1)*359),O="M".concat(C.x,",").concat(C.y,` A`).concat(w,",").concat(w,",0,1,").concat(T?0:1,`, `).concat(k.x,",").concat(k.y),M=Ge(t.id)?qu("recharts-radial-line-"):t.id;return W.createElement("text",Gf({},r,{dominantBaseline:"central",className:Ye("recharts-radial-bar-label",u)}),W.createElement("defs",null,W.createElement("path",{id:M,d:O})),W.createElement("textPath",{xlinkHref:"#".concat(M)},n))},zse=function(t){var n=t.viewBox,r=t.offset,a=t.position,o=n,l=o.cx,u=o.cy,d=o.innerRadius,f=o.outerRadius,m=o.startAngle,p=o.endAngle,g=(m+p)/2;if(a==="outside"){var x=Gt(l,u,f+r,g),j=x.x,b=x.y;return{x:j,y:b,textAnchor:j>=l?"start":"end",verticalAnchor:"middle"}}if(a==="center")return{x:l,y:u,textAnchor:"middle",verticalAnchor:"middle"};if(a==="centerTop")return{x:l,y:u,textAnchor:"middle",verticalAnchor:"start"};if(a==="centerBottom")return{x:l,y:u,textAnchor:"middle",verticalAnchor:"end"};var w=(d+f)/2,N=Gt(l,u,w,g),A=N.x,E=N.y;return{x:A,y:E,textAnchor:"middle",verticalAnchor:"middle"}},qse=function(t){var n=t.viewBox,r=t.parentViewBox,a=t.offset,o=t.position,l=n,u=l.x,d=l.y,f=l.width,m=l.height,p=m>=0?1:-1,g=p*a,x=p>0?"end":"start",j=p>0?"start":"end",b=f>=0?1:-1,w=b*a,N=b>0?"end":"start",A=b>0?"start":"end";if(o==="top"){var E={x:u+f/2,y:d-p*a,textAnchor:"middle",verticalAnchor:x};return Tn(Tn({},E),r?{height:Math.max(d-r.y,0),width:f}:{})}if(o==="bottom"){var T={x:u+f/2,y:d+m+g,textAnchor:"middle",verticalAnchor:j};return Tn(Tn({},T),r?{height:Math.max(r.y+r.height-(d+m),0),width:f}:{})}if(o==="left"){var C={x:u-w,y:d+m/2,textAnchor:N,verticalAnchor:"middle"};return Tn(Tn({},C),r?{width:Math.max(C.x-r.x,0),height:m}:{})}if(o==="right"){var k={x:u+f+w,y:d+m/2,textAnchor:A,verticalAnchor:"middle"};return Tn(Tn({},k),r?{width:Math.max(r.x+r.width-k.x,0),height:m}:{})}var O=r?{width:f,height:m}:{};return o==="insideLeft"?Tn({x:u+w,y:d+m/2,textAnchor:A,verticalAnchor:"middle"},O):o==="insideRight"?Tn({x:u+f-w,y:d+m/2,textAnchor:N,verticalAnchor:"middle"},O):o==="insideTop"?Tn({x:u+f/2,y:d+g,textAnchor:"middle",verticalAnchor:j},O):o==="insideBottom"?Tn({x:u+f/2,y:d+m-g,textAnchor:"middle",verticalAnchor:x},O):o==="insideTopLeft"?Tn({x:u+w,y:d+g,textAnchor:A,verticalAnchor:j},O):o==="insideTopRight"?Tn({x:u+f-w,y:d+g,textAnchor:N,verticalAnchor:j},O):o==="insideBottomLeft"?Tn({x:u+w,y:d+m-g,textAnchor:A,verticalAnchor:x},O):o==="insideBottomRight"?Tn({x:u+f-w,y:d+m-g,textAnchor:N,verticalAnchor:x},O):zu(o)&&(Ce(o.x)||Gs(o.x))&&(Ce(o.y)||Gs(o.y))?Tn({x:u+wr(o.x,f),y:d+wr(o.y,m),textAnchor:"end",verticalAnchor:"end"},O):Tn({x:u+f/2,y:d+m/2,textAnchor:"middle",verticalAnchor:"middle"},O)},Fse=function(t){return"cx"in t&&Ce(t.cx)};function qn(e){var t=e.offset,n=t===void 0?5:t,r=Mse(e,Cse),a=Tn({offset:n},r),o=a.viewBox,l=a.position,u=a.value,d=a.children,f=a.content,m=a.className,p=m===void 0?"":m,g=a.textBreakAll;if(!o||Ge(u)&&Ge(d)&&!y.isValidElement(f)&&!We(f))return null;if(y.isValidElement(f))return y.cloneElement(f,a);var x;if(We(f)){if(x=y.createElement(f,a),y.isValidElement(x))return x}else x=Ise(a);var j=Fse(o),b=Be(a,!0);if(j&&(l==="insideStart"||l==="insideEnd"||l==="end"))return Bse(a,x,b);var w=j?zse(a):qse(a);return W.createElement(hl,Gf({className:Ye("recharts-label",p)},b,w,{breakAll:g}),x)}qn.displayName="Label";var B6=function(t){var n=t.cx,r=t.cy,a=t.angle,o=t.startAngle,l=t.endAngle,u=t.r,d=t.radius,f=t.innerRadius,m=t.outerRadius,p=t.x,g=t.y,x=t.top,j=t.left,b=t.width,w=t.height,N=t.clockWise,A=t.labelViewBox;if(A)return A;if(Ce(b)&&Ce(w)){if(Ce(p)&&Ce(g))return{x:p,y:g,width:b,height:w};if(Ce(x)&&Ce(j))return{x,y:j,width:b,height:w}}return Ce(p)&&Ce(g)?{x:p,y:g,width:0,height:0}:Ce(n)&&Ce(r)?{cx:n,cy:r,startAngle:o||a||0,endAngle:l||a||0,innerRadius:f||0,outerRadius:m||d||u||0,clockWise:N}:t.viewBox?t.viewBox:{}},Use=function(t,n){return t?t===!0?W.createElement(qn,{key:"label-implicit",viewBox:n}):Mn(t)?W.createElement(qn,{key:"label-implicit",viewBox:n,value:t}):y.isValidElement(t)?t.type===qn?y.cloneElement(t,{key:"label-implicit",viewBox:n}):W.createElement(qn,{key:"label-implicit",content:t,viewBox:n}):We(t)?W.createElement(qn,{key:"label-implicit",content:t,viewBox:n}):zu(t)?W.createElement(qn,Gf({viewBox:n},t,{key:"label-implicit"})):null:null},Hse=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var a=t.children,o=B6(t),l=na(a,qn).map(function(d,f){return y.cloneElement(d,{viewBox:n||o,key:"label-".concat(f)})});if(!r)return l;var u=Use(t.label,n||o);return[u].concat(Ose(l))};qn.parseViewBox=B6;qn.renderCallByParent=Hse;var fS,F$;function Wse(){if(F$)return fS;F$=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return fS=e,fS}var Vse=Wse();const Gse=St(Vse);function Yf(e){"@babel/helpers - typeof";return Yf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yf(e)}var Yse=["valueAccessor"],Kse=["data","dataKey","clockWise","id","textBreakAll"];function Xse(e){return ele(e)||Jse(e)||Qse(e)||Zse()}function Zse(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qse(e,t){if(e){if(typeof e=="string")return nN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nN(e,t)}}function Jse(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ele(e){if(Array.isArray(e))return nN(e)}function nN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ale(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var ile=function(t){return Array.isArray(t.value)?Gse(t.value):t.value};function to(e){var t=e.valueAccessor,n=t===void 0?ile:t,r=W$(e,Yse),a=r.data,o=r.dataKey,l=r.clockWise,u=r.id,d=r.textBreakAll,f=W$(r,Kse);return!a||!a.length?null:W.createElement(pt,{className:"recharts-label-list"},a.map(function(m,p){var g=Ge(o)?n(m,p):kn(m&&m.payload,o),x=Ge(u)?{}:{id:"".concat(u,"-").concat(p)};return W.createElement(qn,Kv({},Be(m,!0),f,x,{parentViewBox:m.parentViewBox,value:g,textBreakAll:d,viewBox:qn.parseViewBox(Ge(l)?m:H$(H$({},m),{},{clockWise:l})),key:"label-".concat(p),index:p}))}))}to.displayName="LabelList";function ole(e,t){return e?e===!0?W.createElement(to,{key:"labelList-implicit",data:t}):W.isValidElement(e)||We(e)?W.createElement(to,{key:"labelList-implicit",data:t,content:e}):zu(e)?W.createElement(to,Kv({data:t},e,{key:"labelList-implicit"})):null:null}function sle(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,a=na(r,to).map(function(l,u){return y.cloneElement(l,{data:t,key:"labelList-".concat(u)})});if(!n)return a;var o=ole(e.label,t);return[o].concat(Xse(a))}to.renderCallByParent=sle;function Kf(e){"@babel/helpers - typeof";return Kf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kf(e)}function rN(){return rN=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(l>f),`, `).concat(p.x,",").concat(p.y,` `);if(a>0){var x=Gt(n,r,a,l),j=Gt(n,r,a,f);g+="L ".concat(j.x,",").concat(j.y,` A `).concat(a,",").concat(a,`,0, `).concat(+(Math.abs(d)>180),",").concat(+(l<=f),`, `).concat(x.x,",").concat(x.y," Z")}else g+="L ".concat(n,",").concat(r," Z");return g},fle=function(t){var n=t.cx,r=t.cy,a=t.innerRadius,o=t.outerRadius,l=t.cornerRadius,u=t.forceCornerRadius,d=t.cornerIsExternal,f=t.startAngle,m=t.endAngle,p=br(m-f),g=$p({cx:n,cy:r,radius:o,angle:f,sign:p,cornerRadius:l,cornerIsExternal:d}),x=g.circleTangency,j=g.lineTangency,b=g.theta,w=$p({cx:n,cy:r,radius:o,angle:m,sign:-p,cornerRadius:l,cornerIsExternal:d}),N=w.circleTangency,A=w.lineTangency,E=w.theta,T=d?Math.abs(f-m):Math.abs(f-m)-b-E;if(T<0)return u?"M ".concat(j.x,",").concat(j.y,` a`).concat(l,",").concat(l,",0,0,1,").concat(l*2,`,0 a`).concat(l,",").concat(l,",0,0,1,").concat(-l*2,`,0 `):z6({cx:n,cy:r,innerRadius:a,outerRadius:o,startAngle:f,endAngle:m});var C="M ".concat(j.x,",").concat(j.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(p<0),",").concat(x.x,",").concat(x.y,` A`).concat(o,",").concat(o,",0,").concat(+(T>180),",").concat(+(p<0),",").concat(N.x,",").concat(N.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(p<0),",").concat(A.x,",").concat(A.y,` `);if(a>0){var k=$p({cx:n,cy:r,radius:a,angle:f,sign:p,isExternal:!0,cornerRadius:l,cornerIsExternal:d}),O=k.circleTangency,M=k.lineTangency,I=k.theta,z=$p({cx:n,cy:r,radius:a,angle:m,sign:-p,isExternal:!0,cornerRadius:l,cornerIsExternal:d}),D=z.circleTangency,H=z.lineTangency,V=z.theta,F=d?Math.abs(f-m):Math.abs(f-m)-I-V;if(F<0&&l===0)return"".concat(C,"L").concat(n,",").concat(r,"Z");C+="L".concat(H.x,",").concat(H.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(p<0),",").concat(D.x,",").concat(D.y,` A`).concat(a,",").concat(a,",0,").concat(+(F>180),",").concat(+(p>0),",").concat(O.x,",").concat(O.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(p<0),",").concat(M.x,",").concat(M.y,"Z")}else C+="L".concat(n,",").concat(r,"Z");return C},hle={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},q6=function(t){var n=G$(G$({},hle),t),r=n.cx,a=n.cy,o=n.innerRadius,l=n.outerRadius,u=n.cornerRadius,d=n.forceCornerRadius,f=n.cornerIsExternal,m=n.startAngle,p=n.endAngle,g=n.className;if(l0&&Math.abs(m-p)<360?w=fle({cx:r,cy:a,innerRadius:o,outerRadius:l,cornerRadius:Math.min(b,j/2),forceCornerRadius:d,cornerIsExternal:f,startAngle:m,endAngle:p}):w=z6({cx:r,cy:a,innerRadius:o,outerRadius:l,startAngle:m,endAngle:p}),W.createElement("path",rN({},Be(n,!0),{className:x,d:w,role:"img"}))};function Xf(e){"@babel/helpers - typeof";return Xf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xf(e)}function aN(){return aN=Object.assign?Object.assign.bind():function(e){for(var t=1;t0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Mle(e,t){return Cl(e.getTime(),t.getTime())}function Ple(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Rle(e,t){return e===t}function a3(e,t,n){var r=e.size;if(r!==t.size)return!1;if(!r)return!0;for(var a=new Array(r),o=e.entries(),l,u,d=0;(l=o.next())&&!l.done;){for(var f=t.entries(),m=!1,p=0;(u=f.next())&&!u.done;){if(a[p]){p++;continue}var g=l.value,x=u.value;if(n.equals(g[0],x[0],d,p,e,t,n)&&n.equals(g[1],x[1],g[0],x[0],e,t,n)){m=a[p]=!0;break}p++}if(!m)return!1;d++}return!0}var Dle=Cl;function $le(e,t,n){var r=r3(e),a=r.length;if(r3(t).length!==a)return!1;for(;a-- >0;)if(!F6(e,t,n,r[a]))return!1;return!0}function rf(e,t,n){var r=t3(e),a=r.length;if(t3(t).length!==a)return!1;for(var o,l,u;a-- >0;)if(o=r[a],!F6(e,t,n,o)||(l=n3(e,o),u=n3(t,o),(l||u)&&(!l||!u||l.configurable!==u.configurable||l.enumerable!==u.enumerable||l.writable!==u.writable)))return!1;return!0}function Ile(e,t){return Cl(e.valueOf(),t.valueOf())}function Lle(e,t){return e.source===t.source&&e.flags===t.flags}function i3(e,t,n){var r=e.size;if(r!==t.size)return!1;if(!r)return!0;for(var a=new Array(r),o=e.values(),l,u;(l=o.next())&&!l.done;){for(var d=t.values(),f=!1,m=0;(u=d.next())&&!u.done;){if(!a[m]&&n.equals(l.value,u.value,l.value,u.value,e,t,n)){f=a[m]=!0;break}m++}if(!f)return!1}return!0}function Ble(e,t){var n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function zle(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function F6(e,t,n,r){return(r===Tle||r===Ale||r===Ele)&&(e.$$typeof||t.$$typeof)?!0:Ole(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var qle="[object Arguments]",Fle="[object Boolean]",Ule="[object Date]",Hle="[object Error]",Wle="[object Map]",Vle="[object Number]",Gle="[object Object]",Yle="[object RegExp]",Kle="[object Set]",Xle="[object String]",Zle="[object URL]",Qle=Array.isArray,o3=typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView:null,s3=Object.assign,Jle=Object.prototype.toString.call.bind(Object.prototype.toString);function ece(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areErrorsEqual,a=e.areFunctionsEqual,o=e.areMapsEqual,l=e.areNumbersEqual,u=e.areObjectsEqual,d=e.arePrimitiveWrappersEqual,f=e.areRegExpsEqual,m=e.areSetsEqual,p=e.areTypedArraysEqual,g=e.areUrlsEqual,x=e.unknownTagComparators;return function(b,w,N){if(b===w)return!0;if(b==null||w==null)return!1;var A=typeof b;if(A!==typeof w)return!1;if(A!=="object")return A==="number"?l(b,w,N):A==="function"?a(b,w,N):!1;var E=b.constructor;if(E!==w.constructor)return!1;if(E===Object)return u(b,w,N);if(Qle(b))return t(b,w,N);if(o3!=null&&o3(b))return p(b,w,N);if(E===Date)return n(b,w,N);if(E===RegExp)return f(b,w,N);if(E===Map)return o(b,w,N);if(E===Set)return m(b,w,N);var T=Jle(b);if(T===Ule)return n(b,w,N);if(T===Yle)return f(b,w,N);if(T===Wle)return o(b,w,N);if(T===Kle)return m(b,w,N);if(T===Gle)return typeof b.then!="function"&&typeof w.then!="function"&&u(b,w,N);if(T===Zle)return g(b,w,N);if(T===Hle)return r(b,w,N);if(T===qle)return u(b,w,N);if(T===Fle||T===Vle||T===Xle)return d(b,w,N);if(x){var C=x[T];if(!C){var k=Cle(b);k&&(C=x[k])}if(C)return C(b,w,N)}return!1}}function tce(e){var t=e.circular,n=e.createCustomConfig,r=e.strict,a={areArraysEqual:r?rf:kle,areDatesEqual:Mle,areErrorsEqual:Ple,areFunctionsEqual:Rle,areMapsEqual:r?e3(a3,rf):a3,areNumbersEqual:Dle,areObjectsEqual:r?rf:$le,arePrimitiveWrappersEqual:Ile,areRegExpsEqual:Lle,areSetsEqual:r?e3(i3,rf):i3,areTypedArraysEqual:r?rf:Ble,areUrlsEqual:zle,unknownTagComparators:void 0};if(n&&(a=s3({},a,n(a))),t){var o=Lp(a.areArraysEqual),l=Lp(a.areMapsEqual),u=Lp(a.areObjectsEqual),d=Lp(a.areSetsEqual);a=s3({},a,{areArraysEqual:o,areMapsEqual:l,areObjectsEqual:u,areSetsEqual:d})}return a}function nce(e){return function(t,n,r,a,o,l,u){return e(t,n,u)}}function rce(e){var t=e.circular,n=e.comparator,r=e.createState,a=e.equals,o=e.strict;if(r)return function(d,f){var m=r(),p=m.cache,g=p===void 0?t?new WeakMap:void 0:p,x=m.meta;return n(d,f,{cache:g,equals:a,meta:x,strict:o})};if(t)return function(d,f){return n(d,f,{cache:new WeakMap,equals:a,meta:void 0,strict:o})};var l={cache:void 0,equals:a,meta:void 0,strict:o};return function(d,f){return n(d,f,l)}}var ace=cs();cs({strict:!0});cs({circular:!0});cs({circular:!0,strict:!0});cs({createInternalComparator:function(){return Cl}});cs({strict:!0,createInternalComparator:function(){return Cl}});cs({circular:!0,createInternalComparator:function(){return Cl}});cs({circular:!0,createInternalComparator:function(){return Cl},strict:!0});function cs(e){e===void 0&&(e={});var t=e.circular,n=t===void 0?!1:t,r=e.createInternalComparator,a=e.createState,o=e.strict,l=o===void 0?!1:o,u=tce(e),d=ece(u),f=r?r(d):nce(d);return rce({circular:n,comparator:d,createState:a,equals:f,strict:l})}function ice(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function l3(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function a(o){n<0&&(n=o),o-n>t?(e(o),n=-1):ice(a)};requestAnimationFrame(r)}function iN(e){"@babel/helpers - typeof";return iN=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},iN(e)}function oce(e){return uce(e)||cce(e)||lce(e)||sce()}function sce(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lce(e,t){if(e){if(typeof e=="string")return c3(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c3(e,t)}}function c3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?1:N<0?0:N},b=function(N){for(var A=N>1?1:N,E=A,T=0;T<8;++T){var C=p(E)-A,k=x(E);if(Math.abs(C-A)0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,r=n===void 0?100:n,a=t.damping,o=a===void 0?8:a,l=t.dt,u=l===void 0?17:l,d=function(m,p,g){var x=-(m-p)*r,j=g*o,b=g+(x-j)*u/1e3,w=g*u/1e3+m;return Math.abs(w-p)e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function qce(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,o;for(o=0;o=0)&&(n[a]=e[a]);return n}function vS(e){return Wce(e)||Hce(e)||Uce(e)||Fce()}function Fce(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Uce(e,t){if(e){if(typeof e=="string")return uN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return uN(e,t)}}function Hce(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Wce(e){if(Array.isArray(e))return uN(e)}function uN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Jv(e){return Jv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Jv(e)}var gi=(function(e){Xce(n,e);var t=Zce(n);function n(r,a){var o;Vce(this,n),o=t.call(this,r,a);var l=o.props,u=l.isActive,d=l.attributeName,f=l.from,m=l.to,p=l.steps,g=l.children,x=l.duration;if(o.handleStyleChange=o.handleStyleChange.bind(hN(o)),o.changeStyle=o.changeStyle.bind(hN(o)),!u||x<=0)return o.state={style:{}},typeof g=="function"&&(o.state={style:m}),fN(o);if(p&&p.length)o.state={style:p[0].style};else if(f){if(typeof g=="function")return o.state={style:f},fN(o);o.state={style:d?df({},d,f):f}}else o.state={style:{}};return o}return Yce(n,[{key:"componentDidMount",value:function(){var a=this.props,o=a.isActive,l=a.canBegin;this.mounted=!0,!(!o||!l)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(a){var o=this.props,l=o.isActive,u=o.canBegin,d=o.attributeName,f=o.shouldReAnimate,m=o.to,p=o.from,g=this.state.style;if(u){if(!l){var x={style:d?df({},d,m):m};this.state&&g&&(d&&g[d]!==m||!d&&g!==m)&&this.setState(x);return}if(!(ace(a.to,m)&&a.canBegin&&a.isActive)){var j=!a.canBegin||!a.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var b=j||f?p:a.to;if(this.state&&g){var w={style:d?df({},d,b):b};(d&&g[d]!==b||!d&&g!==b)&&this.setState(w)}this.runAnimation(Pa(Pa({},this.props),{},{from:b,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var a=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),a&&a()}},{key:"handleStyleChange",value:function(a){this.changeStyle(a)}},{key:"changeStyle",value:function(a){this.mounted&&this.setState({style:a})}},{key:"runJSAnimation",value:function(a){var o=this,l=a.from,u=a.to,d=a.duration,f=a.easing,m=a.begin,p=a.onAnimationEnd,g=a.onAnimationStart,x=Lce(l,u,Oce(f),d,this.changeStyle),j=function(){o.stopJSAnimation=x()};this.manager.start([g,m,j,d,p])}},{key:"runStepAnimation",value:function(a){var o=this,l=a.steps,u=a.begin,d=a.onAnimationStart,f=l[0],m=f.style,p=f.duration,g=p===void 0?0:p,x=function(b,w,N){if(N===0)return b;var A=w.duration,E=w.easing,T=E===void 0?"ease":E,C=w.style,k=w.properties,O=w.onAnimationEnd,M=N>0?l[N-1]:w,I=k||Object.keys(C);if(typeof T=="function"||T==="spring")return[].concat(vS(b),[o.runJSAnimation.bind(o,{from:M.style,to:C,duration:A,easing:T}),A]);var z=f3(I,A,T),D=Pa(Pa(Pa({},M.style),C),{},{transition:z});return[].concat(vS(b),[D,A,O]).filter(pce)};return this.manager.start([d].concat(vS(l.reduce(x,[m,Math.max(g,u)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=dce());var o=a.begin,l=a.duration,u=a.attributeName,d=a.to,f=a.easing,m=a.onAnimationStart,p=a.onAnimationEnd,g=a.steps,x=a.children,j=this.manager;if(this.unSubscribe=j.subscribe(this.handleStyleChange),typeof f=="function"||typeof x=="function"||f==="spring"){this.runJSAnimation(a);return}if(g.length>1){this.runStepAnimation(a);return}var b=u?df({},u,d):d,w=f3(Object.keys(b),l,f);j.start([m,o,Pa(Pa({},b),{},{transition:w}),l,p])}},{key:"render",value:function(){var a=this.props,o=a.children;a.begin;var l=a.duration;a.attributeName,a.easing;var u=a.isActive;a.steps,a.from,a.to,a.canBegin,a.onAnimationEnd,a.shouldReAnimate,a.onAnimationReStart;var d=zce(a,Bce),f=y.Children.count(o),m=this.state.style;if(typeof o=="function")return o(m);if(!u||f===0||l<=0)return o;var p=function(x){var j=x.props,b=j.style,w=b===void 0?{}:b,N=j.className,A=y.cloneElement(x,Pa(Pa({},d),{},{style:Pa(Pa({},w),m),className:N}));return A};return f===1?p(y.Children.only(o)):W.createElement("div",null,y.Children.map(o,function(g){return p(g)}))}}]),n})(y.PureComponent);gi.displayName="Animate";gi.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};gi.propTypes={from:bt.oneOfType([bt.object,bt.string]),to:bt.oneOfType([bt.object,bt.string]),attributeName:bt.string,duration:bt.number,begin:bt.number,easing:bt.oneOfType([bt.string,bt.func]),steps:bt.arrayOf(bt.shape({duration:bt.number.isRequired,style:bt.object.isRequired,easing:bt.oneOfType([bt.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),bt.func]),properties:bt.arrayOf("string"),onAnimationEnd:bt.func})),children:bt.oneOfType([bt.node,bt.func]),isActive:bt.bool,canBegin:bt.bool,onAnimationEnd:bt.func,shouldReAnimate:bt.bool,onAnimationStart:bt.func,onAnimationReStart:bt.func};function Jf(e){"@babel/helpers - typeof";return Jf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jf(e)}function eg(){return eg=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?1:-1,d=r>=0?1:-1,f=a>=0&&r>=0||a<0&&r<0?1:0,m;if(l>0&&o instanceof Array){for(var p=[0,0,0,0],g=0,x=4;gl?l:o[g];m="M".concat(t,",").concat(n+u*p[0]),p[0]>0&&(m+="A ".concat(p[0],",").concat(p[0],",0,0,").concat(f,",").concat(t+d*p[0],",").concat(n)),m+="L ".concat(t+r-d*p[1],",").concat(n),p[1]>0&&(m+="A ".concat(p[1],",").concat(p[1],",0,0,").concat(f,`, `).concat(t+r,",").concat(n+u*p[1])),m+="L ".concat(t+r,",").concat(n+a-u*p[2]),p[2]>0&&(m+="A ".concat(p[2],",").concat(p[2],",0,0,").concat(f,`, `).concat(t+r-d*p[2],",").concat(n+a)),m+="L ".concat(t+d*p[3],",").concat(n+a),p[3]>0&&(m+="A ".concat(p[3],",").concat(p[3],",0,0,").concat(f,`, `).concat(t,",").concat(n+a-u*p[3])),m+="Z"}else if(l>0&&o===+o&&o>0){var j=Math.min(l,o);m="M ".concat(t,",").concat(n+u*j,` A `).concat(j,",").concat(j,",0,0,").concat(f,",").concat(t+d*j,",").concat(n,` L `).concat(t+r-d*j,",").concat(n,` A `).concat(j,",").concat(j,",0,0,").concat(f,",").concat(t+r,",").concat(n+u*j,` L `).concat(t+r,",").concat(n+a-u*j,` A `).concat(j,",").concat(j,",0,0,").concat(f,",").concat(t+r-d*j,",").concat(n+a,` L `).concat(t+d*j,",").concat(n+a,` A `).concat(j,",").concat(j,",0,0,").concat(f,",").concat(t,",").concat(n+a-u*j," Z")}else m="M ".concat(t,",").concat(n," h ").concat(r," v ").concat(a," h ").concat(-r," Z");return m},sue=function(t,n){if(!t||!n)return!1;var r=t.x,a=t.y,o=n.x,l=n.y,u=n.width,d=n.height;if(Math.abs(u)>0&&Math.abs(d)>0){var f=Math.min(o,o+u),m=Math.max(o,o+u),p=Math.min(l,l+d),g=Math.max(l,l+d);return r>=f&&r<=m&&a>=p&&a<=g}return!1},lue={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},IO=function(t){var n=b3(b3({},lue),t),r=y.useRef(),a=y.useState(-1),o=Jce(a,2),l=o[0],u=o[1];y.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var T=r.current.getTotalLength();T&&u(T)}catch{}},[]);var d=n.x,f=n.y,m=n.width,p=n.height,g=n.radius,x=n.className,j=n.animationEasing,b=n.animationDuration,w=n.animationBegin,N=n.isAnimationActive,A=n.isUpdateAnimationActive;if(d!==+d||f!==+f||m!==+m||p!==+p||m===0||p===0)return null;var E=Ye("recharts-rectangle",x);return A?W.createElement(gi,{canBegin:l>0,from:{width:m,height:p,x:d,y:f},to:{width:m,height:p,x:d,y:f},duration:b,animationEasing:j,isActive:A},function(T){var C=T.width,k=T.height,O=T.x,M=T.y;return W.createElement(gi,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:w,duration:b,isActive:N,easing:j},W.createElement("path",eg({},Be(n,!0),{className:E,d:w3(O,M,C,k,g),ref:r})))}):W.createElement("path",eg({},Be(n,!0),{className:E,d:w3(d,f,m,p,g)}))},cue=["points","className","baseLinePoints","connectNulls"];function Bc(){return Bc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function due(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function j3(e){return pue(e)||mue(e)||hue(e)||fue()}function fue(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hue(e,t){if(e){if(typeof e=="string")return mN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mN(e,t)}}function mue(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function pue(e){if(Array.isArray(e))return mN(e)}function mN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return t.forEach(function(r){S3(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),S3(t[0])&&n[n.length-1].push(t[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},_f=function(t,n){var r=vue(t);n&&(r=[r.reduce(function(o,l){return[].concat(j3(o),j3(l))},[])]);var a=r.map(function(o){return o.reduce(function(l,u,d){return"".concat(l).concat(d===0?"M":"L").concat(u.x,",").concat(u.y)},"")}).join("");return r.length===1?"".concat(a,"Z"):a},gue=function(t,n,r){var a=_f(t,r);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(_f(n.reverse(),r).slice(1))},yue=function(t){var n=t.points,r=t.className,a=t.baseLinePoints,o=t.connectNulls,l=uue(t,cue);if(!n||!n.length)return null;var u=Ye("recharts-polygon",r);if(a&&a.length){var d=l.stroke&&l.stroke!=="none",f=gue(n,a,o);return W.createElement("g",{className:u},W.createElement("path",Bc({},Be(l,!0),{fill:f.slice(-1)==="Z"?l.fill:"none",stroke:"none",d:f})),d?W.createElement("path",Bc({},Be(l,!0),{fill:"none",d:_f(n,o)})):null,d?W.createElement("path",Bc({},Be(l,!0),{fill:"none",d:_f(a,o)})):null)}var m=_f(n,o);return W.createElement("path",Bc({},Be(l,!0),{fill:m.slice(-1)==="Z"?l.fill:"none",className:u,d:m}))};function pN(){return pN=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Nue(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Cue=function(t,n,r,a,o,l){return"M".concat(t,",").concat(o,"v").concat(a,"M").concat(l,",").concat(n,"h").concat(r)},Oue=function(t){var n=t.x,r=n===void 0?0:n,a=t.y,o=a===void 0?0:a,l=t.top,u=l===void 0?0:l,d=t.left,f=d===void 0?0:d,m=t.width,p=m===void 0?0:m,g=t.height,x=g===void 0?0:g,j=t.className,b=_ue(t,xue),w=bue({x:r,y:o,top:u,left:f,width:p,height:x},b);return!Ce(r)||!Ce(o)||!Ce(p)||!Ce(x)||!Ce(u)||!Ce(f)?null:W.createElement("path",vN({},Be(w,!0),{className:Ye("recharts-cross",j),d:Cue(r,o,p,x,u,f)}))},gS,N3;function Eue(){if(N3)return gS;N3=1;var e=fy(),t=c6(),n=wi();function r(a,o){return a&&a.length?e(a,n(o,2),t):void 0}return gS=r,gS}var Aue=Eue();const Tue=St(Aue);var yS,C3;function kue(){if(C3)return yS;C3=1;var e=fy(),t=wi(),n=u6();function r(a,o){return a&&a.length?e(a,t(o,2),n):void 0}return yS=r,yS}var Mue=kue();const Pue=St(Mue);var Rue=["cx","cy","angle","ticks","axisLine"],Due=["ticks","tick","angle","tickFormatter","stroke"];function mu(e){"@babel/helpers - typeof";return mu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mu(e)}function Nf(){return Nf=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function $ue(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Iue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A3(e,t){for(var n=0;nM3?l=a==="outer"?"start":"end":o<-M3?l=a==="outer"?"end":"start":l="middle",l}},{key:"renderAxisLine",value:function(){var r=this.props,a=r.cx,o=r.cy,l=r.radius,u=r.axisLine,d=r.axisLineType,f=qs(qs({},Be(this.props,!1)),{},{fill:"none"},Be(u,!1));if(d==="circle")return W.createElement(gy,Ws({className:"recharts-polar-angle-axis-line"},f,{cx:a,cy:o,r:l}));var m=this.props.ticks,p=m.map(function(g){return Gt(a,o,l,g.coordinate)});return W.createElement(yue,Ws({className:"recharts-polar-angle-axis-line"},f,{points:p}))}},{key:"renderTicks",value:function(){var r=this,a=this.props,o=a.ticks,l=a.tick,u=a.tickLine,d=a.tickFormatter,f=a.stroke,m=Be(this.props,!1),p=Be(l,!1),g=qs(qs({},m),{},{fill:"none"},Be(u,!1)),x=o.map(function(j,b){var w=r.getTickLineCoord(j),N=r.getTickTextAnchor(j),A=qs(qs(qs({textAnchor:N},m),{},{stroke:"none",fill:f},p),{},{index:b,payload:j,x:w.x2,y:w.y2});return W.createElement(pt,Ws({className:Ye("recharts-polar-angle-axis-tick",L6(l)),key:"tick-".concat(j.coordinate)},fl(r.props,j,b)),u&&W.createElement("line",Ws({className:"recharts-polar-angle-axis-tick-line"},g,w)),l&&t.renderTickItem(l,A,d?d(j.value,b):j.value))});return W.createElement(pt,{className:"recharts-polar-angle-axis-ticks"},x)}},{key:"render",value:function(){var r=this.props,a=r.ticks,o=r.radius,l=r.axisLine;return o<=0||!a||!a.length?null:W.createElement(pt,{className:Ye("recharts-polar-angle-axis",this.props.className)},l&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,a,o){var l;return W.isValidElement(r)?l=W.cloneElement(r,a):We(r)?l=r(a):l=W.createElement(hl,Ws({},a,{className:"recharts-polar-angle-axis-tick-value"}),o),l}}])})(y.PureComponent);by(wy,"displayName","PolarAngleAxis");by(wy,"axisType","angleAxis");by(wy,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var xS,P3;function Que(){if(P3)return xS;P3=1;var e=lz(),t=e(Object.getPrototypeOf,Object);return xS=t,xS}var bS,R3;function Jue(){if(R3)return bS;R3=1;var e=lo(),t=Que(),n=co(),r="[object Object]",a=Function.prototype,o=Object.prototype,l=a.toString,u=o.hasOwnProperty,d=l.call(Object);function f(m){if(!n(m)||e(m)!=r)return!1;var p=t(m);if(p===null)return!0;var g=u.call(p,"constructor")&&p.constructor;return typeof g=="function"&&g instanceof g&&l.call(g)==d}return bS=f,bS}var ede=Jue();const tde=St(ede);var wS,D3;function nde(){if(D3)return wS;D3=1;var e=lo(),t=co(),n="[object Boolean]";function r(a){return a===!0||a===!1||t(a)&&e(a)==n}return wS=r,wS}var rde=nde();const ade=St(rde);function th(e){"@babel/helpers - typeof";return th=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},th(e)}function rg(){return rg=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:g,x:d,y:f},to:{upperWidth:m,lowerWidth:p,height:g,x:d,y:f},duration:b,animationEasing:j,isActive:N},function(E){var T=E.upperWidth,C=E.lowerWidth,k=E.height,O=E.x,M=E.y;return W.createElement(gi,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:w,duration:b,easing:j},W.createElement("path",rg({},Be(n,!0),{className:A,d:B3(O,M,T,C,k),ref:r})))}):W.createElement("g",null,W.createElement("path",rg({},Be(n,!0),{className:A,d:B3(d,f,m,p,g)})))},pde=["option","shapeType","propTransformer","activeClassName","isActive"];function nh(e){"@babel/helpers - typeof";return nh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nh(e)}function vde(e,t){if(e==null)return{};var n=gde(e,t),r,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function gde(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function z3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ag(e){for(var t=1;t0?ta(E,"paddingAngle",0):0;if(C){var O=Qr(C.endAngle-C.startAngle,E.endAngle-E.startAngle),M=Ut(Ut({},E),{},{startAngle:A+k,endAngle:A+O(b)+k});w.push(M),A=M.endAngle}else{var I=E.endAngle,z=E.startAngle,D=Qr(0,I-z),H=D(b),V=Ut(Ut({},E),{},{startAngle:A+k,endAngle:A+H+k});w.push(V),A=V.endAngle}}),W.createElement(pt,null,r.renderSectorsStatically(w))})}},{key:"attachKeyboardHandlers",value:function(r){var a=this;r.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var l=++a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[l].focus(),a.setState({sectorToFocus:l});break}case"ArrowRight":{var u=--a.state.sectorToFocus<0?a.sectorRefs.length-1:a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[u].focus(),a.setState({sectorToFocus:u});break}case"Escape":{a.sectorRefs[a.state.sectorToFocus].blur(),a.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,a=r.sectors,o=r.isAnimationActive,l=this.state.prevSectors;return o&&a&&a.length&&(!l||!Dh(l,a))?this.renderSectorsWithAnimation():this.renderSectorsStatically(a)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,a=this.props,o=a.hide,l=a.sectors,u=a.className,d=a.label,f=a.cx,m=a.cy,p=a.innerRadius,g=a.outerRadius,x=a.isAnimationActive,j=this.state.isAnimationFinished;if(o||!l||!l.length||!Ce(f)||!Ce(m)||!Ce(p)||!Ce(g))return null;var b=Ye("recharts-pie",u);return W.createElement(pt,{tabIndex:this.props.rootTabIndex,className:b,ref:function(N){r.pieRef=N}},this.renderSectors(),d&&this.renderLabels(l),qn.renderCallByParent(this.props,null,!1),(!x||j)&&to.renderCallByParent(this.props,l,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,a){return a.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==a.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:a.curSectors,isAnimationFinished:!0}:r.sectors!==a.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,a){return r>a?"start":r=360?A:A-1)*d,T=w-A*x-E,C=a.reduce(function(M,I){var z=kn(I,N,0);return M+(Ce(z)?z:0)},0),k;if(C>0){var O;k=a.map(function(M,I){var z=kn(M,N,0),D=kn(M,m,I),H=(Ce(z)?z:0)/C,V;I?V=O.endAngle+br(b)*d*(z!==0?1:0):V=l;var F=V+br(b)*((z!==0?x:0)+H*T),G=(V+F)/2,L=(j.innerRadius+j.outerRadius)/2,R=[{name:D,value:z,payload:M,dataKey:N,type:g}],U=Gt(j.cx,j.cy,L,G);return O=Ut(Ut(Ut({percent:H,cornerRadius:o,name:D,tooltipPayload:R,midAngle:G,middleRadius:L,tooltipPosition:U},M),j),{},{value:kn(M,N),startAngle:V,endAngle:F,payload:M,paddingAngle:br(b)*d}),O})}return Ut(Ut({},j),{},{sectors:k,data:a})});var jS,H3;function Lde(){if(H3)return jS;H3=1;var e=Math.ceil,t=Math.max;function n(r,a,o,l){for(var u=-1,d=t(e((a-r)/(o||1)),0),f=Array(d);d--;)f[l?d:++u]=r,r+=o;return f}return jS=n,jS}var SS,W3;function nq(){if(W3)return SS;W3=1;var e=_z(),t=1/0,n=17976931348623157e292;function r(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var o=a<0?-1:1;return o*n}return a===a?a:0}return SS=r,SS}var _S,V3;function Bde(){if(V3)return _S;V3=1;var e=Lde(),t=ay(),n=nq();function r(a){return function(o,l,u){return u&&typeof u!="number"&&t(o,l,u)&&(l=u=void 0),o=n(o),l===void 0?(l=o,o=0):l=n(l),u=u===void 0?o0&&r.handleDrag(a.changedTouches[0])}),Yr(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var a=r.props,o=a.endIndex,l=a.onDragEnd,u=a.startIndex;l?.({endIndex:o,startIndex:u})}),r.detachDragEndListener()}),Yr(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Yr(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Yr(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Yr(r,"handleSlideDragStart",function(a){var o=Q3(a)?a.changedTouches[0]:a;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:o.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return Zde(t,e),Gde(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var a=r.startX,o=r.endX,l=this.state.scaleValues,u=this.props,d=u.gap,f=u.data,m=f.length-1,p=Math.min(a,o),g=Math.max(a,o),x=t.getIndexInRange(l,p),j=t.getIndexInRange(l,g);return{startIndex:x-x%d,endIndex:j===m?m:j-j%d}}},{key:"getTextOfTick",value:function(r){var a=this.props,o=a.data,l=a.tickFormatter,u=a.dataKey,d=kn(o[r],u,r);return We(l)?l(d,r):d}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var a=this.state,o=a.slideMoveStartX,l=a.startX,u=a.endX,d=this.props,f=d.x,m=d.width,p=d.travellerWidth,g=d.startIndex,x=d.endIndex,j=d.onChange,b=r.pageX-o;b>0?b=Math.min(b,f+m-p-u,f+m-p-l):b<0&&(b=Math.max(b,f-l,f-u));var w=this.getIndex({startX:l+b,endX:u+b});(w.startIndex!==g||w.endIndex!==x)&&j&&j(w),this.setState({startX:l+b,endX:u+b,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,a){var o=Q3(a)?a.changedTouches[0]:a;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var a=this.state,o=a.brushMoveStartX,l=a.movingTravellerId,u=a.endX,d=a.startX,f=this.state[l],m=this.props,p=m.x,g=m.width,x=m.travellerWidth,j=m.onChange,b=m.gap,w=m.data,N={startX:this.state.startX,endX:this.state.endX},A=r.pageX-o;A>0?A=Math.min(A,p+g-x-f):A<0&&(A=Math.max(A,p-f)),N[l]=f+A;var E=this.getIndex(N),T=E.startIndex,C=E.endIndex,k=function(){var M=w.length-1;return l==="startX"&&(u>d?T%b===0:C%b===0)||ud?C%b===0:T%b===0)||u>d&&C===M};this.setState(Yr(Yr({},l,f+A),"brushMoveStartX",r.pageX),function(){j&&k()&&j(E)})}},{key:"handleTravellerMoveKeyboard",value:function(r,a){var o=this,l=this.state,u=l.scaleValues,d=l.startX,f=l.endX,m=this.state[a],p=u.indexOf(m);if(p!==-1){var g=p+r;if(!(g===-1||g>=u.length)){var x=u[g];a==="startX"&&x>=f||a==="endX"&&x<=d||this.setState(Yr({},a,x),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,a=r.x,o=r.y,l=r.width,u=r.height,d=r.fill,f=r.stroke;return W.createElement("rect",{stroke:f,fill:d,x:a,y:o,width:l,height:u})}},{key:"renderPanorama",value:function(){var r=this.props,a=r.x,o=r.y,l=r.width,u=r.height,d=r.data,f=r.children,m=r.padding,p=y.Children.only(f);return p?W.cloneElement(p,{x:a,y:o,width:l,height:u,margin:m,compact:!0,data:d}):null}},{key:"renderTravellerLayer",value:function(r,a){var o,l,u=this,d=this.props,f=d.y,m=d.travellerWidth,p=d.height,g=d.traveller,x=d.ariaLabel,j=d.data,b=d.startIndex,w=d.endIndex,N=Math.max(r,this.props.x),A=CS(CS({},Be(this.props,!1)),{},{x:N,y:f,width:m,height:p}),E=x||"Min value: ".concat((o=j[b])===null||o===void 0?void 0:o.name,", Max value: ").concat((l=j[w])===null||l===void 0?void 0:l.name);return W.createElement(pt,{tabIndex:0,role:"slider","aria-label":E,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[a],onTouchStart:this.travellerDragStartHandlers[a],onKeyDown:function(C){["ArrowLeft","ArrowRight"].includes(C.key)&&(C.preventDefault(),C.stopPropagation(),u.handleTravellerMoveKeyboard(C.key==="ArrowRight"?1:-1,a))},onFocus:function(){u.setState({isTravellerFocused:!0})},onBlur:function(){u.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(g,A))}},{key:"renderSlide",value:function(r,a){var o=this.props,l=o.y,u=o.height,d=o.stroke,f=o.travellerWidth,m=Math.min(r,a)+f,p=Math.max(Math.abs(a-r)-f,0);return W.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:d,fillOpacity:.2,x:m,y:l,width:p,height:u})}},{key:"renderText",value:function(){var r=this.props,a=r.startIndex,o=r.endIndex,l=r.y,u=r.height,d=r.travellerWidth,f=r.stroke,m=this.state,p=m.startX,g=m.endX,x=5,j={pointerEvents:"none",fill:f};return W.createElement(pt,{className:"recharts-brush-texts"},W.createElement(hl,sg({textAnchor:"end",verticalAnchor:"middle",x:Math.min(p,g)-x,y:l+u/2},j),this.getTextOfTick(a)),W.createElement(hl,sg({textAnchor:"start",verticalAnchor:"middle",x:Math.max(p,g)+d+x,y:l+u/2},j),this.getTextOfTick(o)))}},{key:"render",value:function(){var r=this.props,a=r.data,o=r.className,l=r.children,u=r.x,d=r.y,f=r.width,m=r.height,p=r.alwaysShowText,g=this.state,x=g.startX,j=g.endX,b=g.isTextActive,w=g.isSlideMoving,N=g.isTravellerMoving,A=g.isTravellerFocused;if(!a||!a.length||!Ce(u)||!Ce(d)||!Ce(f)||!Ce(m)||f<=0||m<=0)return null;var E=Ye("recharts-brush",o),T=W.Children.count(l)===1,C=Wde("userSelect","none");return W.createElement(pt,{className:E,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:C},this.renderBackground(),T&&this.renderPanorama(),this.renderSlide(x,j),this.renderTravellerLayer(x,"startX"),this.renderTravellerLayer(j,"endX"),(b||w||N||A||p)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var a=r.x,o=r.y,l=r.width,u=r.height,d=r.stroke,f=Math.floor(o+u/2)-1;return W.createElement(W.Fragment,null,W.createElement("rect",{x:a,y:o,width:l,height:u,fill:d,stroke:"none"}),W.createElement("line",{x1:a+1,y1:f,x2:a+l-1,y2:f,fill:"none",stroke:"#fff"}),W.createElement("line",{x1:a+1,y1:f+2,x2:a+l-1,y2:f+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,a){var o;return W.isValidElement(r)?o=W.cloneElement(r,a):We(r)?o=r(a):o=t.renderDefaultTraveller(a),o}},{key:"getDerivedStateFromProps",value:function(r,a){var o=r.data,l=r.width,u=r.x,d=r.travellerWidth,f=r.updateId,m=r.startIndex,p=r.endIndex;if(o!==a.prevData||f!==a.prevUpdateId)return CS({prevData:o,prevTravellerWidth:d,prevUpdateId:f,prevX:u,prevWidth:l},o&&o.length?Jde({data:o,width:l,x:u,travellerWidth:d,startIndex:m,endIndex:p}):{scale:null,scaleValues:null});if(a.scale&&(l!==a.prevWidth||u!==a.prevX||d!==a.prevTravellerWidth)){a.scale.range([u,u+l-d]);var g=a.scale.domain().map(function(x){return a.scale(x)});return{prevData:o,prevTravellerWidth:d,prevUpdateId:f,prevX:u,prevWidth:l,startX:a.scale(r.startIndex),endX:a.scale(r.endIndex),scaleValues:g}}return null}},{key:"getIndexInRange",value:function(r,a){for(var o=r.length,l=0,u=o-1;u-l>1;){var d=Math.floor((l+u)/2);r[d]>a?u=d:l=d}return a>=r[u]?u:l}}])})(y.PureComponent);Yr(yu,"displayName","Brush");Yr(yu,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var OS,J3;function efe(){if(J3)return OS;J3=1;var e=cO();function t(n,r){var a;return e(n,function(o,l,u){return a=r(o,l,u),!a}),!!a}return OS=t,OS}var ES,eI;function tfe(){if(eI)return ES;eI=1;var e=tz(),t=wi(),n=efe(),r=Lr(),a=ay();function o(l,u,d){var f=r(l)?e:n;return d&&a(l,u,d)&&(u=void 0),f(l,t(u,3))}return ES=o,ES}var nfe=tfe();const rfe=St(nfe);var hi=function(t,n){var r=t.alwaysShow,a=t.ifOverflow;return r&&(a="extendDomain"),a===n},AS,tI;function afe(){if(tI)return AS;tI=1;var e=xz();function t(n,r,a){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[r]=a}return AS=t,AS}var TS,nI;function ife(){if(nI)return TS;nI=1;var e=afe(),t=gz(),n=wi();function r(a,o){var l={};return o=n(o,3),t(a,function(u,d,f){e(l,d,o(u,d,f))}),l}return TS=r,TS}var ofe=ife();const sfe=St(ofe);var kS,rI;function lfe(){if(rI)return kS;rI=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function gfe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function yfe(e,t){var n=e.x,r=e.y,a=vfe(e,ffe),o="".concat(n),l=parseInt(o,10),u="".concat(r),d=parseInt(u,10),f="".concat(t.height||a.height),m=parseInt(f,10),p="".concat(t.width||a.width),g=parseInt(p,10);return af(af(af(af(af({},t),a),l?{x:l}:{}),d?{y:d}:{}),{},{height:m,width:g,name:t.name,radius:t.radius})}function sI(e){return W.createElement(J6,wN({shapeType:"rectangle",propTransformer:yfe,activeClassName:"recharts-active-bar"},e))}var xfe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,a){if(typeof t=="number")return t;var o=Ce(r)||FQ(r);return o?t(r,a):(o||ur(!1),n)}},bfe=["value","background"],sq;function xu(e){"@babel/helpers - typeof";return xu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xu(e)}function wfe(e,t){if(e==null)return{};var n=jfe(e,t),r,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function jfe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function cg(){return cg=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(G)0&&Math.abs(F)0&&(V=Math.min((ne||0)-(F[oe-1]||0),V))}),Number.isFinite(V)){var G=V/H,L=b.layout==="vertical"?r.height:r.width;if(b.padding==="gap"&&(O=G*L/2),b.padding==="no-gap"){var R=wr(t.barCategoryGap,G*L),U=G*L/2;O=U-R-(U-R)/L*R}}}a==="xAxis"?M=[r.left+(E.left||0)+(O||0),r.left+r.width-(E.right||0)-(O||0)]:a==="yAxis"?M=d==="horizontal"?[r.top+r.height-(E.bottom||0),r.top+(E.top||0)]:[r.top+(E.top||0)+(O||0),r.top+r.height-(E.bottom||0)-(O||0)]:M=b.range,C&&(M=[M[1],M[0]]);var K=k6(b,o,g),te=K.scale,$=K.realScaleType;te.domain(N).range(M),M6(te);var B=P6(te,Ia(Ia({},b),{},{realScaleType:$}));a==="xAxis"?(D=w==="top"&&!T||w==="bottom"&&T,I=r.left,z=p[k]-D*b.height):a==="yAxis"&&(D=w==="left"&&!T||w==="right"&&T,I=p[k]-D*b.width,z=r.top);var Y=Ia(Ia(Ia({},b),B),{},{realScaleType:$,x:I,y:z,scale:te,width:a==="xAxis"?r.width:b.width,height:a==="yAxis"?r.height:b.height});return Y.bandSize=Gv(Y,B),!b.hide&&a==="xAxis"?p[k]+=(D?-1:1)*Y.height:b.hide||(p[k]+=(D?-1:1)*Y.width),Ia(Ia({},x),{},_y({},j,Y))},{})},fq=function(t,n){var r=t.x,a=t.y,o=n.x,l=n.y;return{x:Math.min(r,o),y:Math.min(a,l),width:Math.abs(o-r),height:Math.abs(l-a)}},Pfe=function(t){var n=t.x1,r=t.y1,a=t.x2,o=t.y2;return fq({x:n,y:r},{x:a,y:o})},hq=(function(){function e(t){Tfe(this,e),this.scale=t}return kfe(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=r.bandAware,o=r.position;if(n!==void 0){if(o)switch(o){case"start":return this.scale(n);case"middle":{var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+l}case"end":{var u=this.bandwidth?this.bandwidth():0;return this.scale(n)+u}default:return this.scale(n)}if(a){var d=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+d}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),a=r[0],o=r[r.length-1];return a<=o?n>=a&&n<=o:n>=o&&n<=a}}],[{key:"create",value:function(n){return new e(n)}}])})();_y(hq,"EPS",1e-4);var LO=function(t){var n=Object.keys(t).reduce(function(r,a){return Ia(Ia({},r),{},_y({},a,hq.create(t[a])))},{});return Ia(Ia({},n),{},{apply:function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=o.bandAware,u=o.position;return sfe(a,function(d,f){return n[f].apply(d,{bandAware:l,position:u})})},isInRange:function(a){return oq(a,function(o,l){return n[l].isInRange(o)})}})};function Rfe(e){return(e%180+180)%180}var Dfe=function(t){var n=t.width,r=t.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=Rfe(a),l=o*Math.PI/180,u=Math.atan(r/n),d=l>u&&l-1?d[f?o[m]:m]:void 0}}return RS=r,RS}var DS,hI;function Ife(){if(hI)return DS;hI=1;var e=nq();function t(n){var r=e(n),a=r%1;return r===r?a?r-a:r:0}return DS=t,DS}var $S,mI;function Lfe(){if(mI)return $S;mI=1;var e=fz(),t=wi(),n=Ife(),r=Math.max;function a(o,l,u){var d=o==null?0:o.length;if(!d)return-1;var f=u==null?0:n(u);return f<0&&(f=r(d+f,0)),e(o,t(l,3),f)}return $S=a,$S}var IS,pI;function Bfe(){if(pI)return IS;pI=1;var e=$fe(),t=Lfe(),n=e(t);return IS=n,IS}var zfe=Bfe();const qfe=St(zfe);var Ffe=EB();const Ufe=St(Ffe);var Hfe=Ufe(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),BO=y.createContext(void 0),zO=y.createContext(void 0),mq=y.createContext(void 0),pq=y.createContext({}),vq=y.createContext(void 0),gq=y.createContext(0),yq=y.createContext(0),vI=function(t){var n=t.state,r=n.xAxisMap,a=n.yAxisMap,o=n.offset,l=t.clipPathId,u=t.children,d=t.width,f=t.height,m=Hfe(o);return W.createElement(BO.Provider,{value:r},W.createElement(zO.Provider,{value:a},W.createElement(pq.Provider,{value:o},W.createElement(mq.Provider,{value:m},W.createElement(vq.Provider,{value:l},W.createElement(gq.Provider,{value:f},W.createElement(yq.Provider,{value:d},u)))))))},Wfe=function(){return y.useContext(vq)},xq=function(t){var n=y.useContext(BO);n==null&&ur(!1);var r=n[t];return r==null&&ur(!1),r},Vfe=function(){var t=y.useContext(BO);return Fo(t)},Gfe=function(){var t=y.useContext(zO),n=qfe(t,function(r){return oq(r.domain,Number.isFinite)});return n||Fo(t)},bq=function(t){var n=y.useContext(zO);n==null&&ur(!1);var r=n[t];return r==null&&ur(!1),r},Yfe=function(){var t=y.useContext(mq);return t},Kfe=function(){return y.useContext(pq)},qO=function(){return y.useContext(yq)},FO=function(){return y.useContext(gq)};function bu(e){"@babel/helpers - typeof";return bu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bu(e)}function Xfe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zfe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne*a)return!1;var o=n();return e*(t-e*o/2-r)>=0&&e*(t+e*o/2-a)<=0}function Mhe(e,t){return Oq(e,t+1)}function Phe(e,t,n,r,a){for(var o=(r||[]).slice(),l=t.start,u=t.end,d=0,f=1,m=l,p=function(){var j=r?.[d];if(j===void 0)return{v:Oq(r,f)};var b=d,w,N=function(){return w===void 0&&(w=n(j,b)),w},A=j.coordinate,E=d===0||mg(e,A,N,m,u);E||(d=0,m=l,f+=1),E&&(m=A+e*(N()/2+a),d+=f)},g;f<=o.length;)if(g=p(),g)return g.v;return[]}function sh(e){"@babel/helpers - typeof";return sh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sh(e)}function _I(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function or(e){for(var t=1;t0?x.coordinate-w*e:x.coordinate})}else o[g]=x=or(or({},x),{},{tickCoord:x.coordinate});var N=mg(e,x.tickCoord,b,u,d);N&&(d=x.tickCoord-e*(b()/2+a),o[g]=or(or({},x),{},{isShow:!0}))},m=l-1;m>=0;m--)f(m);return o}function Lhe(e,t,n,r,a,o){var l=(r||[]).slice(),u=l.length,d=t.start,f=t.end;if(o){var m=r[u-1],p=n(m,u-1),g=e*(m.coordinate+e*p/2-f);l[u-1]=m=or(or({},m),{},{tickCoord:g>0?m.coordinate-g*e:m.coordinate});var x=mg(e,m.tickCoord,function(){return p},d,f);x&&(f=m.tickCoord-e*(p/2+a),l[u-1]=or(or({},m),{},{isShow:!0}))}for(var j=o?u-1:u,b=function(A){var E=l[A],T,C=function(){return T===void 0&&(T=n(E,A)),T};if(A===0){var k=e*(E.coordinate-e*C()/2-d);l[A]=E=or(or({},E),{},{tickCoord:k<0?E.coordinate-k*e:E.coordinate})}else l[A]=E=or(or({},E),{},{tickCoord:E.coordinate});var O=mg(e,E.tickCoord,C,d,f);O&&(d=E.tickCoord+e*(C()/2+a),l[A]=or(or({},E),{},{isShow:!0}))},w=0;w=2?br(a[1].coordinate-a[0].coordinate):1,N=khe(o,w,x);return d==="equidistantPreserveStart"?Phe(w,N,b,a,l):(d==="preserveStart"||d==="preserveStartEnd"?g=Lhe(w,N,b,a,l,d==="preserveStartEnd"):g=Ihe(w,N,b,a,l),g.filter(function(A){return A.isShow}))}var Bhe=["viewBox"],zhe=["viewBox"],qhe=["ticks"];function Su(e){"@babel/helpers - typeof";return Su=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Su(e)}function qc(){return qc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Fhe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Uhe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function CI(e,t){for(var n=0;n0?d(this.props):d(x)),l<=0||u<=0||!j||!j.length?null:W.createElement(pt,{className:Ye("recharts-cartesian-axis",f),ref:function(w){r.layerReference=w}},o&&this.renderAxisLine(),this.renderTicks(j,this.state.fontSize,this.state.letterSpacing),qn.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,a,o){var l,u=Ye(a.className,"recharts-cartesian-axis-tick-value");return W.isValidElement(r)?l=W.cloneElement(r,An(An({},a),{},{className:u})):We(r)?l=r(An(An({},a),{},{className:u})):l=W.createElement(hl,qc({},a,{className:"recharts-cartesian-axis-tick-value"}),o),l}}])})(y.Component);VO(Vu,"displayName","CartesianAxis");VO(Vu,"defaultProps",{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"});var Xhe=["x1","y1","x2","y2","key"],Zhe=["offset"];function pl(e){"@babel/helpers - typeof";return pl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pl(e)}function OI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function lr(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function tme(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var nme=function(t){var n=t.fill;if(!n||n==="none")return null;var r=t.fillOpacity,a=t.x,o=t.y,l=t.width,u=t.height,d=t.ry;return W.createElement("rect",{x:a,y:o,ry:d,width:l,height:u,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function Tq(e,t){var n;if(W.isValidElement(e))n=W.cloneElement(e,t);else if(We(e))n=e(t);else{var r=t.x1,a=t.y1,o=t.x2,l=t.y2,u=t.key,d=EI(t,Xhe),f=Be(d,!1);f.offset;var m=EI(f,Zhe);n=W.createElement("line",Xs({},m,{x1:r,y1:a,x2:o,y2:l,fill:"none",key:u}))}return n}function rme(e){var t=e.x,n=e.width,r=e.horizontal,a=r===void 0?!0:r,o=e.horizontalPoints;if(!a||!o||!o.length)return null;var l=o.map(function(u,d){var f=lr(lr({},e),{},{x1:t,y1:u,x2:t+n,y2:u,key:"line-".concat(d),index:d});return Tq(a,f)});return W.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function ame(e){var t=e.y,n=e.height,r=e.vertical,a=r===void 0?!0:r,o=e.verticalPoints;if(!a||!o||!o.length)return null;var l=o.map(function(u,d){var f=lr(lr({},e),{},{x1:u,y1:t,x2:u,y2:t+n,key:"line-".concat(d),index:d});return Tq(a,f)});return W.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function ime(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,a=e.y,o=e.width,l=e.height,u=e.horizontalPoints,d=e.horizontal,f=d===void 0?!0:d;if(!f||!t||!t.length)return null;var m=u.map(function(g){return Math.round(g+a-a)}).sort(function(g,x){return g-x});a!==m[0]&&m.unshift(0);var p=m.map(function(g,x){var j=!m[x+1],b=j?a+l-g:m[x+1]-g;if(b<=0)return null;var w=x%t.length;return W.createElement("rect",{key:"react-".concat(x),y:g,x:r,height:b,width:o,stroke:"none",fill:t[w],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return W.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},p)}function ome(e){var t=e.vertical,n=t===void 0?!0:t,r=e.verticalFill,a=e.fillOpacity,o=e.x,l=e.y,u=e.width,d=e.height,f=e.verticalPoints;if(!n||!r||!r.length)return null;var m=f.map(function(g){return Math.round(g+o-o)}).sort(function(g,x){return g-x});o!==m[0]&&m.unshift(0);var p=m.map(function(g,x){var j=!m[x+1],b=j?o+u-g:m[x+1]-g;if(b<=0)return null;var w=x%r.length;return W.createElement("rect",{key:"react-".concat(x),x:g,y:l,width:b,height:d,stroke:"none",fill:r[w],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return W.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},p)}var sme=function(t,n){var r=t.xAxis,a=t.width,o=t.height,l=t.offset;return T6(WO(lr(lr(lr({},Vu.defaultProps),r),{},{ticks:Ki(r,!0),viewBox:{x:0,y:0,width:a,height:o}})),l.left,l.left+l.width,n)},lme=function(t,n){var r=t.yAxis,a=t.width,o=t.height,l=t.offset;return T6(WO(lr(lr(lr({},Vu.defaultProps),r),{},{ticks:Ki(r,!0),viewBox:{x:0,y:0,width:a,height:o}})),l.top,l.top+l.height,n)},_c={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function ff(e){var t,n,r,a,o,l,u=qO(),d=FO(),f=Kfe(),m=lr(lr({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:_c.stroke,fill:(n=e.fill)!==null&&n!==void 0?n:_c.fill,horizontal:(r=e.horizontal)!==null&&r!==void 0?r:_c.horizontal,horizontalFill:(a=e.horizontalFill)!==null&&a!==void 0?a:_c.horizontalFill,vertical:(o=e.vertical)!==null&&o!==void 0?o:_c.vertical,verticalFill:(l=e.verticalFill)!==null&&l!==void 0?l:_c.verticalFill,x:Ce(e.x)?e.x:f.left,y:Ce(e.y)?e.y:f.top,width:Ce(e.width)?e.width:f.width,height:Ce(e.height)?e.height:f.height}),p=m.x,g=m.y,x=m.width,j=m.height,b=m.syncWithTicks,w=m.horizontalValues,N=m.verticalValues,A=Vfe(),E=Gfe();if(!Ce(x)||x<=0||!Ce(j)||j<=0||!Ce(p)||p!==+p||!Ce(g)||g!==+g)return null;var T=m.verticalCoordinatesGenerator||sme,C=m.horizontalCoordinatesGenerator||lme,k=m.horizontalPoints,O=m.verticalPoints;if((!k||!k.length)&&We(C)){var M=w&&w.length,I=C({yAxis:E?lr(lr({},E),{},{ticks:M?w:E.ticks}):void 0,width:u,height:d,offset:f},M?!0:b);qa(Array.isArray(I),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(pl(I),"]")),Array.isArray(I)&&(k=I)}if((!O||!O.length)&&We(T)){var z=N&&N.length,D=T({xAxis:A?lr(lr({},A),{},{ticks:z?N:A.ticks}):void 0,width:u,height:d,offset:f},z?!0:b);qa(Array.isArray(D),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(pl(D),"]")),Array.isArray(D)&&(O=D)}return W.createElement("g",{className:"recharts-cartesian-grid"},W.createElement(nme,{fill:m.fill,fillOpacity:m.fillOpacity,x:m.x,y:m.y,width:m.width,height:m.height,ry:m.ry}),W.createElement(rme,Xs({},m,{offset:f,horizontalPoints:k,xAxis:A,yAxis:E})),W.createElement(ame,Xs({},m,{offset:f,verticalPoints:O,xAxis:A,yAxis:E})),W.createElement(ime,Xs({},m,{horizontalPoints:k})),W.createElement(ome,Xs({},m,{verticalPoints:O})))}ff.displayName="CartesianGrid";var cme=["type","layout","connectNulls","ref"],ume=["key"];function _u(e){"@babel/helpers - typeof";return _u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_u(e)}function AI(e,t){if(e==null)return{};var n=dme(e,t),r,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function dme(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Cf(){return Cf=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);np){x=[].concat(Nc(d.slice(0,j)),[p-b]);break}var w=x.length%2===0?[0,g]:[g];return[].concat(Nc(t.repeat(d,m)),Nc(x),w).map(function(N){return"".concat(N,"px")}).join(", ")}),La(n,"id",qu("recharts-line-")),La(n,"pathRef",function(l){n.mainCurve=l}),La(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),La(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return wme(t,e),gme(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,a){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,l=o.points,u=o.xAxis,d=o.yAxis,f=o.layout,m=o.children,p=na(m,$h);if(!p)return null;var g=function(b,w){return{x:b.x,y:b.y,value:b.value,errorVal:kn(b.payload,w)}},x={clipPath:r?"url(#clipPath-".concat(a,")"):null};return W.createElement(pt,x,p.map(function(j){return W.cloneElement(j,{key:"bar-".concat(j.props.dataKey),data:l,xAxis:u,yAxis:d,layout:f,dataPointFormatter:g})}))}},{key:"renderDots",value:function(r,a,o){var l=this.props.isAnimationActive;if(l&&!this.state.isAnimationFinished)return null;var u=this.props,d=u.dot,f=u.points,m=u.dataKey,p=Be(this.props,!1),g=Be(d,!0),x=f.map(function(b,w){var N=Gr(Gr(Gr({key:"dot-".concat(w),r:3},p),g),{},{index:w,cx:b.x,cy:b.y,value:b.value,dataKey:m,payload:b.payload,points:f});return t.renderDotItem(d,N)}),j={clipPath:r?"url(#clipPath-".concat(a?"":"dots-").concat(o,")"):null};return W.createElement(pt,Cf({className:"recharts-line-dots",key:"dots"},j),x)}},{key:"renderCurveStatically",value:function(r,a,o,l){var u=this.props,d=u.type,f=u.layout,m=u.connectNulls;u.ref;var p=AI(u,cme),g=Gr(Gr(Gr({},Be(p,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:a?"url(#clipPath-".concat(o,")"):null,points:r},l),{},{type:d,layout:f,connectNulls:m});return W.createElement(Xv,Cf({},g,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,a){var o=this,l=this.props,u=l.points,d=l.strokeDasharray,f=l.isAnimationActive,m=l.animationBegin,p=l.animationDuration,g=l.animationEasing,x=l.animationId,j=l.animateNewValues,b=l.width,w=l.height,N=this.state,A=N.prevPoints,E=N.totalLength;return W.createElement(gi,{begin:m,duration:p,isActive:f,easing:g,from:{t:0},to:{t:1},key:"line-".concat(x),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(T){var C=T.t;if(A){var k=A.length/u.length,O=u.map(function(H,V){var F=Math.floor(V*k);if(A[F]){var G=A[F],L=Qr(G.x,H.x),R=Qr(G.y,H.y);return Gr(Gr({},H),{},{x:L(C),y:R(C)})}if(j){var U=Qr(b*2,H.x),K=Qr(w/2,H.y);return Gr(Gr({},H),{},{x:U(C),y:K(C)})}return Gr(Gr({},H),{},{x:H.x,y:H.y})});return o.renderCurveStatically(O,r,a)}var M=Qr(0,E),I=M(C),z;if(d){var D="".concat(d).split(/[,\s]+/gim).map(function(H){return parseFloat(H)});z=o.getStrokeDasharray(I,E,D)}else z=o.generateSimpleStrokeDasharray(E,I);return o.renderCurveStatically(u,r,a,{strokeDasharray:z})})}},{key:"renderCurve",value:function(r,a){var o=this.props,l=o.points,u=o.isAnimationActive,d=this.state,f=d.prevPoints,m=d.totalLength;return u&&l&&l.length&&(!f&&m>0||!Dh(f,l))?this.renderCurveWithAnimation(r,a):this.renderCurveStatically(l,r,a)}},{key:"render",value:function(){var r,a=this.props,o=a.hide,l=a.dot,u=a.points,d=a.className,f=a.xAxis,m=a.yAxis,p=a.top,g=a.left,x=a.width,j=a.height,b=a.isAnimationActive,w=a.id;if(o||!u||!u.length)return null;var N=this.state.isAnimationFinished,A=u.length===1,E=Ye("recharts-line",d),T=f&&f.allowDataOverflow,C=m&&m.allowDataOverflow,k=T||C,O=Ge(w)?this.id:w,M=(r=Be(l,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},I=M.r,z=I===void 0?3:I,D=M.strokeWidth,H=D===void 0?2:D,V=eJ(l)?l:{},F=V.clipDot,G=F===void 0?!0:F,L=z*2+H;return W.createElement(pt,{className:E},T||C?W.createElement("defs",null,W.createElement("clipPath",{id:"clipPath-".concat(O)},W.createElement("rect",{x:T?g:g-x/2,y:C?p:p-j/2,width:T?x:x*2,height:C?j:j*2})),!G&&W.createElement("clipPath",{id:"clipPath-dots-".concat(O)},W.createElement("rect",{x:g-L/2,y:p-L/2,width:x+L,height:j+L}))):null,!A&&this.renderCurve(k,O),this.renderErrorBar(k,O),(A||l)&&this.renderDots(k,G,O),(!b||N)&&to.renderCallByParent(this.props,u))}}],[{key:"getDerivedStateFromProps",value:function(r,a){return r.animationId!==a.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:a.curPoints}:r.points!==a.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,a){for(var o=r.length%2!==0?[].concat(Nc(r),[0]):r,l=[],u=0;ue.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function dpe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function fpe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hpe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?l:t&&t.length&&Ce(a)&&Ce(o)?t.slice(a,o+1):[]};function Wq(e){return e==="number"?[0,"auto"]:void 0}var zN=function(t,n,r,a){var o=t.graphicalItems,l=t.tooltipAxis,u=Ay(n,t);return r<0||!o||!o.length||r>=u.length?null:o.reduce(function(d,f){var m,p=(m=f.props.data)!==null&&m!==void 0?m:n;p&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(p=p.slice(t.dataStartIndex,t.dataEndIndex+1));var g;if(l.dataKey&&!l.allowDuplicatedCategory){var x=p===void 0?u:p;g=jv(x,l.dataKey,a)}else g=p&&p[r]||u[r];return g?[].concat(Eu(d),[D6(f,g)]):d},[])},LI=function(t,n,r,a){var o=a||{x:t.chartX,y:t.chartY},l=Npe(o,r),u=t.orderedTooltipTicks,d=t.tooltipAxis,f=t.tooltipTicks,m=Zoe(l,u,f,d);if(m>=0&&f){var p=f[m]&&f[m].value,g=zN(t,n,m,p),x=Cpe(r,u,m,o);return{activeTooltipIndex:m,activeLabel:p,activePayload:g,activeCoordinate:x}}return null},Ope=function(t,n){var r=n.axes,a=n.graphicalItems,o=n.axisType,l=n.axisIdKey,u=n.stackGroups,d=n.dataStartIndex,f=n.dataEndIndex,m=t.layout,p=t.children,g=t.stackOffset,x=A6(m,o);return r.reduce(function(j,b){var w,N=b.type.defaultProps!==void 0?ye(ye({},b.type.defaultProps),b.props):b.props,A=N.type,E=N.dataKey,T=N.allowDataOverflow,C=N.allowDuplicatedCategory,k=N.scale,O=N.ticks,M=N.includeHidden,I=N[l];if(j[I])return j;var z=Ay(t.data,{graphicalItems:a.filter(function(B){var Y,ne=l in B.props?B.props[l]:(Y=B.type.defaultProps)===null||Y===void 0?void 0:Y[l];return ne===I}),dataStartIndex:d,dataEndIndex:f}),D=z.length,H,V,F;Jme(N.domain,T,A)&&(H=eN(N.domain,null,T),x&&(A==="number"||k!=="auto")&&(F=jf(z,E,"category")));var G=Wq(A);if(!H||H.length===0){var L,R=(L=N.domain)!==null&&L!==void 0?L:G;if(E){if(H=jf(z,E,A),A==="category"&&x){var U=HQ(H);C&&U?(V=H,H=og(0,D)):C||(H=I$(R,H,b).reduce(function(B,Y){return B.indexOf(Y)>=0?B:[].concat(Eu(B),[Y])},[]))}else if(A==="category")C?H=H.filter(function(B){return B!==""&&!Ge(B)}):H=I$(R,H,b).reduce(function(B,Y){return B.indexOf(Y)>=0||Y===""||Ge(Y)?B:[].concat(Eu(B),[Y])},[]);else if(A==="number"){var K=nse(z,a.filter(function(B){var Y,ne,oe=l in B.props?B.props[l]:(Y=B.type.defaultProps)===null||Y===void 0?void 0:Y[l],xe="hide"in B.props?B.props.hide:(ne=B.type.defaultProps)===null||ne===void 0?void 0:ne.hide;return oe===I&&(M||!xe)}),E,o,m);K&&(H=K)}x&&(A==="number"||k!=="auto")&&(F=jf(z,E,"category"))}else x?H=og(0,D):u&&u[I]&&u[I].hasStack&&A==="number"?H=g==="expand"?[0,1]:R6(u[I].stackGroups,d,f):H=E6(z,a.filter(function(B){var Y=l in B.props?B.props[l]:B.type.defaultProps[l],ne="hide"in B.props?B.props.hide:B.type.defaultProps.hide;return Y===I&&(M||!ne)}),A,m,!0);if(A==="number")H=IN(p,H,I,o,O),R&&(H=eN(R,H,T));else if(A==="category"&&R){var te=R,$=H.every(function(B){return te.indexOf(B)>=0});$&&(H=te)}}return ye(ye({},j),{},Fe({},I,ye(ye({},N),{},{axisType:o,domain:H,categoricalDomain:F,duplicateDomain:V,originalDomain:(w=N.domain)!==null&&w!==void 0?w:G,isCategorical:x,layout:m})))},{})},Epe=function(t,n){var r=n.graphicalItems,a=n.Axis,o=n.axisType,l=n.axisIdKey,u=n.stackGroups,d=n.dataStartIndex,f=n.dataEndIndex,m=t.layout,p=t.children,g=Ay(t.data,{graphicalItems:r,dataStartIndex:d,dataEndIndex:f}),x=g.length,j=A6(m,o),b=-1;return r.reduce(function(w,N){var A=N.type.defaultProps!==void 0?ye(ye({},N.type.defaultProps),N.props):N.props,E=A[l],T=Wq("number");if(!w[E]){b++;var C;return j?C=og(0,x):u&&u[E]&&u[E].hasStack?(C=R6(u[E].stackGroups,d,f),C=IN(p,C,E,o)):(C=eN(T,E6(g,r.filter(function(k){var O,M,I=l in k.props?k.props[l]:(O=k.type.defaultProps)===null||O===void 0?void 0:O[l],z="hide"in k.props?k.props.hide:(M=k.type.defaultProps)===null||M===void 0?void 0:M.hide;return I===E&&!z}),"number",m),a.defaultProps.allowDataOverflow),C=IN(p,C,E,o)),ye(ye({},w),{},Fe({},E,ye(ye({axisType:o},a.defaultProps),{},{hide:!0,orientation:ta(Spe,"".concat(o,".").concat(b%2),null),domain:C,originalDomain:T,isCategorical:j,layout:m})))}return w},{})},Ape=function(t,n){var r=n.axisType,a=r===void 0?"xAxis":r,o=n.AxisComp,l=n.graphicalItems,u=n.stackGroups,d=n.dataStartIndex,f=n.dataEndIndex,m=t.children,p="".concat(a,"Id"),g=na(m,o),x={};return g&&g.length?x=Ope(t,{axes:g,graphicalItems:l,axisType:a,axisIdKey:p,stackGroups:u,dataStartIndex:d,dataEndIndex:f}):l&&l.length&&(x=Epe(t,{Axis:o,graphicalItems:l,axisType:a,axisIdKey:p,stackGroups:u,dataStartIndex:d,dataEndIndex:f})),x},Tpe=function(t){var n=Fo(t),r=Ki(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:uO(r,function(a){return a.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Gv(n,r)}},BI=function(t){var n=t.children,r=t.defaultShowTooltip,a=Kr(n,yu),o=0,l=0;return t.data&&t.data.length!==0&&(l=t.data.length-1),a&&a.props&&(a.props.startIndex>=0&&(o=a.props.startIndex),a.props.endIndex>=0&&(l=a.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:l,activeTooltipIndex:-1,isTooltipActive:!!r}},kpe=function(t){return!t||!t.length?!1:t.some(function(n){var r=Ji(n&&n.type);return r&&r.indexOf("Bar")>=0})},zI=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Mpe=function(t,n){var r=t.props,a=t.graphicalItems,o=t.xAxisMap,l=o===void 0?{}:o,u=t.yAxisMap,d=u===void 0?{}:u,f=r.width,m=r.height,p=r.children,g=r.margin||{},x=Kr(p,yu),j=Kr(p,nl),b=Object.keys(d).reduce(function(C,k){var O=d[k],M=O.orientation;return!O.mirror&&!O.hide?ye(ye({},C),{},Fe({},M,C[M]+O.width)):C},{left:g.left||0,right:g.right||0}),w=Object.keys(l).reduce(function(C,k){var O=l[k],M=O.orientation;return!O.mirror&&!O.hide?ye(ye({},C),{},Fe({},M,ta(C,"".concat(M))+O.height)):C},{top:g.top||0,bottom:g.bottom||0}),N=ye(ye({},w),b),A=N.bottom;x&&(N.bottom+=x.props.height||yu.defaultProps.height),j&&n&&(N=ese(N,a,r,n));var E=f-N.left-N.right,T=m-N.top-N.bottom;return ye(ye({brushBottom:A},N),{},{width:Math.max(E,0),height:Math.max(T,0)})},Ppe=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},GO=function(t){var n=t.chartName,r=t.GraphicalChild,a=t.defaultTooltipEventType,o=a===void 0?"axis":a,l=t.validateTooltipEventTypes,u=l===void 0?["axis"]:l,d=t.axisComponents,f=t.legendContent,m=t.formatAxisMap,p=t.defaultProps,g=function(N,A){var E=A.graphicalItems,T=A.stackGroups,C=A.offset,k=A.updateId,O=A.dataStartIndex,M=A.dataEndIndex,I=N.barSize,z=N.layout,D=N.barGap,H=N.barCategoryGap,V=N.maxBarSize,F=zI(z),G=F.numericAxisName,L=F.cateAxisName,R=kpe(E),U=[];return E.forEach(function(K,te){var $=Ay(N.data,{graphicalItems:[K],dataStartIndex:O,dataEndIndex:M}),B=K.type.defaultProps!==void 0?ye(ye({},K.type.defaultProps),K.props):K.props,Y=B.dataKey,ne=B.maxBarSize,oe=B["".concat(G,"Id")],xe=B["".concat(L,"Id")],ee={},ae=d.reduce(function(rr,gr){var ct=A["".concat(gr.axisType,"Map")],rt=B["".concat(gr.axisType,"Id")];ct&&ct[rt]||gr.axisType==="zAxis"||ur(!1);var $n=ct[rt];return ye(ye({},rr),{},Fe(Fe({},gr.axisType,$n),"".concat(gr.axisType,"Ticks"),Ki($n)))},ee),Z=ae[L],pe=ae["".concat(L,"Ticks")],je=T&&T[oe]&&T[oe].hasStack&&dse(K,T[oe].stackGroups),le=Ji(K.type).indexOf("Bar")>=0,Re=Gv(Z,pe),_e=[],me=R&&Qoe({barSize:I,stackGroups:T,totalSize:Ppe(ae,L)});if(le){var ve,Le,It=Ge(ne)?V:ne,Cn=(ve=(Le=Gv(Z,pe,!0))!==null&&Le!==void 0?Le:It)!==null&&ve!==void 0?ve:0;_e=Joe({barGap:D,barCategoryGap:H,bandSize:Cn!==Re?Cn:Re,sizeList:me[xe],maxBarSize:It}),Cn!==Re&&(_e=_e.map(function(rr){return ye(ye({},rr),{},{position:ye(ye({},rr.position),{},{offset:rr.position.offset-Cn/2})})}))}var vr=K&&K.type&&K.type.getComposedData;vr&&U.push({props:ye(ye({},vr(ye(ye({},ae),{},{displayedData:$,props:N,dataKey:Y,item:K,bandSize:Re,barPosition:_e,offset:C,stackedData:je,layout:z,dataStartIndex:O,dataEndIndex:M}))),{},Fe(Fe(Fe({key:K.key||"item-".concat(te)},G,ae[G]),L,ae[L]),"animationId",k)),childIndex:rJ(K,N.children),item:K})}),U},x=function(N,A){var E=N.props,T=N.dataStartIndex,C=N.dataEndIndex,k=N.updateId;if(!ZP({props:E}))return null;var O=E.children,M=E.layout,I=E.stackOffset,z=E.data,D=E.reverseStackOrder,H=zI(M),V=H.numericAxisName,F=H.cateAxisName,G=na(O,r),L=cse(z,G,"".concat(V,"Id"),"".concat(F,"Id"),I,D),R=d.reduce(function(B,Y){var ne="".concat(Y.axisType,"Map");return ye(ye({},B),{},Fe({},ne,Ape(E,ye(ye({},Y),{},{graphicalItems:G,stackGroups:Y.axisType===V&&L,dataStartIndex:T,dataEndIndex:C}))))},{}),U=Mpe(ye(ye({},R),{},{props:E,graphicalItems:G}),A?.legendBBox);Object.keys(R).forEach(function(B){R[B]=m(E,R[B],U,B.replace("Map",""),n)});var K=R["".concat(F,"Map")],te=Tpe(K),$=g(E,ye(ye({},R),{},{dataStartIndex:T,dataEndIndex:C,updateId:k,graphicalItems:G,stackGroups:L,offset:U}));return ye(ye({formattedGraphicalItems:$,graphicalItems:G,offset:U,stackGroups:L},te),R)},j=(function(w){function N(A){var E,T,C;return fpe(this,N),C=ppe(this,N,[A]),Fe(C,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Fe(C,"accessibilityManager",new Qme),Fe(C,"handleLegendBBoxUpdate",function(k){if(k){var O=C.state,M=O.dataStartIndex,I=O.dataEndIndex,z=O.updateId;C.setState(ye({legendBBox:k},x({props:C.props,dataStartIndex:M,dataEndIndex:I,updateId:z},ye(ye({},C.state),{},{legendBBox:k}))))}}),Fe(C,"handleReceiveSyncEvent",function(k,O,M){if(C.props.syncId===k){if(M===C.eventEmitterSymbol&&typeof C.props.syncMethod!="function")return;C.applySyncEvent(O)}}),Fe(C,"handleBrushChange",function(k){var O=k.startIndex,M=k.endIndex;if(O!==C.state.dataStartIndex||M!==C.state.dataEndIndex){var I=C.state.updateId;C.setState(function(){return ye({dataStartIndex:O,dataEndIndex:M},x({props:C.props,dataStartIndex:O,dataEndIndex:M,updateId:I},C.state))}),C.triggerSyncEvent({dataStartIndex:O,dataEndIndex:M})}}),Fe(C,"handleMouseEnter",function(k){var O=C.getMouseInfo(k);if(O){var M=ye(ye({},O),{},{isTooltipActive:!0});C.setState(M),C.triggerSyncEvent(M);var I=C.props.onMouseEnter;We(I)&&I(M,k)}}),Fe(C,"triggeredAfterMouseMove",function(k){var O=C.getMouseInfo(k),M=O?ye(ye({},O),{},{isTooltipActive:!0}):{isTooltipActive:!1};C.setState(M),C.triggerSyncEvent(M);var I=C.props.onMouseMove;We(I)&&I(M,k)}),Fe(C,"handleItemMouseEnter",function(k){C.setState(function(){return{isTooltipActive:!0,activeItem:k,activePayload:k.tooltipPayload,activeCoordinate:k.tooltipPosition||{x:k.cx,y:k.cy}}})}),Fe(C,"handleItemMouseLeave",function(){C.setState(function(){return{isTooltipActive:!1}})}),Fe(C,"handleMouseMove",function(k){k.persist(),C.throttleTriggeredAfterMouseMove(k)}),Fe(C,"handleMouseLeave",function(k){C.throttleTriggeredAfterMouseMove.cancel();var O={isTooltipActive:!1};C.setState(O),C.triggerSyncEvent(O);var M=C.props.onMouseLeave;We(M)&&M(O,k)}),Fe(C,"handleOuterEvent",function(k){var O=nJ(k),M=ta(C.props,"".concat(O));if(O&&We(M)){var I,z;/.*touch.*/i.test(O)?z=C.getMouseInfo(k.changedTouches[0]):z=C.getMouseInfo(k),M((I=z)!==null&&I!==void 0?I:{},k)}}),Fe(C,"handleClick",function(k){var O=C.getMouseInfo(k);if(O){var M=ye(ye({},O),{},{isTooltipActive:!0});C.setState(M),C.triggerSyncEvent(M);var I=C.props.onClick;We(I)&&I(M,k)}}),Fe(C,"handleMouseDown",function(k){var O=C.props.onMouseDown;if(We(O)){var M=C.getMouseInfo(k);O(M,k)}}),Fe(C,"handleMouseUp",function(k){var O=C.props.onMouseUp;if(We(O)){var M=C.getMouseInfo(k);O(M,k)}}),Fe(C,"handleTouchMove",function(k){k.changedTouches!=null&&k.changedTouches.length>0&&C.throttleTriggeredAfterMouseMove(k.changedTouches[0])}),Fe(C,"handleTouchStart",function(k){k.changedTouches!=null&&k.changedTouches.length>0&&C.handleMouseDown(k.changedTouches[0])}),Fe(C,"handleTouchEnd",function(k){k.changedTouches!=null&&k.changedTouches.length>0&&C.handleMouseUp(k.changedTouches[0])}),Fe(C,"handleDoubleClick",function(k){var O=C.props.onDoubleClick;if(We(O)){var M=C.getMouseInfo(k);O(M,k)}}),Fe(C,"handleContextMenu",function(k){var O=C.props.onContextMenu;if(We(O)){var M=C.getMouseInfo(k);O(M,k)}}),Fe(C,"triggerSyncEvent",function(k){C.props.syncId!==void 0&&zS.emit(qS,C.props.syncId,k,C.eventEmitterSymbol)}),Fe(C,"applySyncEvent",function(k){var O=C.props,M=O.layout,I=O.syncMethod,z=C.state.updateId,D=k.dataStartIndex,H=k.dataEndIndex;if(k.dataStartIndex!==void 0||k.dataEndIndex!==void 0)C.setState(ye({dataStartIndex:D,dataEndIndex:H},x({props:C.props,dataStartIndex:D,dataEndIndex:H,updateId:z},C.state)));else if(k.activeTooltipIndex!==void 0){var V=k.chartX,F=k.chartY,G=k.activeTooltipIndex,L=C.state,R=L.offset,U=L.tooltipTicks;if(!R)return;if(typeof I=="function")G=I(U,k);else if(I==="value"){G=-1;for(var K=0;K=0){var je,le;if(V.dataKey&&!V.allowDuplicatedCategory){var Re=typeof V.dataKey=="function"?pe:"payload.".concat(V.dataKey.toString());je=jv(K,Re,G),le=te&&$&&jv($,Re,G)}else je=K?.[F],le=te&&$&&$[F];if(xe||oe){var _e=k.props.activeIndex!==void 0?k.props.activeIndex:F;return[y.cloneElement(k,ye(ye(ye({},I.props),ae),{},{activeIndex:_e})),null,null]}if(!Ge(je))return[Z].concat(Eu(C.renderActivePoints({item:I,activePoint:je,basePoint:le,childIndex:F,isRange:te})))}else{var me,ve=(me=C.getItemByXY(C.state.activeCoordinate))!==null&&me!==void 0?me:{graphicalItem:Z},Le=ve.graphicalItem,It=Le.item,Cn=It===void 0?k:It,vr=Le.childIndex,rr=ye(ye(ye({},I.props),ae),{},{activeIndex:vr});return[y.cloneElement(Cn,rr),null,null]}return te?[Z,null,null]:[Z,null]}),Fe(C,"renderCustomized",function(k,O,M){return y.cloneElement(k,ye(ye({key:"recharts-customized-".concat(M)},C.props),C.state))}),Fe(C,"renderMap",{CartesianGrid:{handler:zp,once:!0},ReferenceArea:{handler:C.renderReferenceElement},ReferenceLine:{handler:zp},ReferenceDot:{handler:C.renderReferenceElement},XAxis:{handler:zp},YAxis:{handler:zp},Brush:{handler:C.renderBrush,once:!0},Bar:{handler:C.renderGraphicChild},Line:{handler:C.renderGraphicChild},Area:{handler:C.renderGraphicChild},Radar:{handler:C.renderGraphicChild},RadialBar:{handler:C.renderGraphicChild},Scatter:{handler:C.renderGraphicChild},Pie:{handler:C.renderGraphicChild},Funnel:{handler:C.renderGraphicChild},Tooltip:{handler:C.renderCursor,once:!0},PolarGrid:{handler:C.renderPolarGrid,once:!0},PolarAngleAxis:{handler:C.renderPolarAxis},PolarRadiusAxis:{handler:C.renderPolarAxis},Customized:{handler:C.renderCustomized}}),C.clipPathId="".concat((E=A.id)!==null&&E!==void 0?E:qu("recharts"),"-clip"),C.throttleTriggeredAfterMouseMove=Nz(C.triggeredAfterMouseMove,(T=A.throttleDelay)!==null&&T!==void 0?T:1e3/60),C.state={},C}return ype(N,w),mpe(N,[{key:"componentDidMount",value:function(){var E,T;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(E=this.props.margin.left)!==null&&E!==void 0?E:0,top:(T=this.props.margin.top)!==null&&T!==void 0?T:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var E=this.props,T=E.children,C=E.data,k=E.height,O=E.layout,M=Kr(T,ni);if(M){var I=M.props.defaultIndex;if(!(typeof I!="number"||I<0||I>this.state.tooltipTicks.length-1)){var z=this.state.tooltipTicks[I]&&this.state.tooltipTicks[I].value,D=zN(this.state,C,I,z),H=this.state.tooltipTicks[I].coordinate,V=(this.state.offset.top+k)/2,F=O==="horizontal",G=F?{x:H,y:V}:{y:H,x:V},L=this.state.formattedGraphicalItems.find(function(U){var K=U.item;return K.type.name==="Scatter"});L&&(G=ye(ye({},G),L.props.points[I].tooltipPosition),D=L.props.points[I].tooltipPayload);var R={activeTooltipIndex:I,isTooltipActive:!0,activeLabel:z,activePayload:D,activeCoordinate:G};this.setState(R),this.renderCursor(M),this.accessibilityManager.setIndex(I)}}}},{key:"getSnapshotBeforeUpdate",value:function(E,T){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==T.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==E.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==E.margin){var C,k;this.accessibilityManager.setDetails({offset:{left:(C=this.props.margin.left)!==null&&C!==void 0?C:0,top:(k=this.props.margin.top)!==null&&k!==void 0?k:0}})}return null}},{key:"componentDidUpdate",value:function(E){j_([Kr(E.children,ni)],[Kr(this.props.children,ni)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var E=Kr(this.props.children,ni);if(E&&typeof E.props.shared=="boolean"){var T=E.props.shared?"axis":"item";return u.indexOf(T)>=0?T:o}return o}},{key:"getMouseInfo",value:function(E){if(!this.container)return null;var T=this.container,C=T.getBoundingClientRect(),k=Hne(C),O={chartX:Math.round(E.pageX-k.left),chartY:Math.round(E.pageY-k.top)},M=C.width/T.offsetWidth||1,I=this.inRange(O.chartX,O.chartY,M);if(!I)return null;var z=this.state,D=z.xAxisMap,H=z.yAxisMap,V=this.getTooltipEventType(),F=LI(this.state,this.props.data,this.props.layout,I);if(V!=="axis"&&D&&H){var G=Fo(D).scale,L=Fo(H).scale,R=G&&G.invert?G.invert(O.chartX):null,U=L&&L.invert?L.invert(O.chartY):null;return ye(ye({},O),{},{xValue:R,yValue:U},F)}return F?ye(ye({},O),F):null}},{key:"inRange",value:function(E,T){var C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,k=this.props.layout,O=E/C,M=T/C;if(k==="horizontal"||k==="vertical"){var I=this.state.offset,z=O>=I.left&&O<=I.left+I.width&&M>=I.top&&M<=I.top+I.height;return z?{x:O,y:M}:null}var D=this.state,H=D.angleAxisMap,V=D.radiusAxisMap;if(H&&V){var F=Fo(H);return z$({x:O,y:M},F)}return null}},{key:"parseEventsOfWrapper",value:function(){var E=this.props.children,T=this.getTooltipEventType(),C=Kr(E,ni),k={};C&&T==="axis"&&(C.props.trigger==="click"?k={onClick:this.handleClick}:k={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var O=Sv(this.props,this.handleOuterEvent);return ye(ye({},O),k)}},{key:"addListener",value:function(){zS.on(qS,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){zS.removeListener(qS,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(E,T,C){for(var k=this.state.formattedGraphicalItems,O=0,M=k.length;O");return e}const Mc=y.forwardRef(({id:e,className:t,children:n,config:r,...a},o)=>{const l=y.useId(),u=`chart-${e||l.replace(/:/g,"")}`;return i.jsx(Vq.Provider,{value:{config:r},children:i.jsxs("div",{"data-chart":u,ref:o,className:de("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",t),...a,children:[i.jsx(Ipe,{id:u,config:r}),i.jsx(Ine,{children:n})]})})});Mc.displayName="Chart";const Ipe=({id:e,config:t})=>{const n=Object.entries(t).filter(([,r])=>r.theme||r.color);return n.length?i.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries($pe).map(([r,a])=>` ${a} [data-chart=${e}] { ${n.map(([o,l])=>{const u=l.theme?.[r]||l.color;return u?` --color-${o}: ${u};`:null}).join(` `)} } `).join(` `)}}):null},of=ni,Pc=y.forwardRef(({active:e,payload:t,className:n,indicator:r="dot",hideLabel:a=!1,hideIndicator:o=!1,label:l,labelFormatter:u,labelClassName:d,formatter:f,color:m,nameKey:p,labelKey:g},x)=>{const{config:j}=Gq(),b=y.useMemo(()=>{if(a||!t?.length)return null;const[N]=t,A=`${g||N?.dataKey||N?.name||"value"}`,E=qN(j,N,A),T=!g&&typeof l=="string"?j[l]?.label||l:E?.label;return u?i.jsx("div",{className:de("font-medium",d),children:u(T,t)}):T?i.jsx("div",{className:de("font-medium",d),children:T}):null},[l,u,t,a,d,j,g]);if(!e||!t?.length)return null;const w=t.length===1&&r!=="dot";return i.jsxs("div",{ref:x,className:de("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[w?null:b,i.jsx("div",{className:"grid gap-1.5",children:t.filter(N=>N.type!=="none").map((N,A)=>{const E=`${p||N.name||N.dataKey||"value"}`,T=qN(j,N,E),C=m||N.payload.fill||N.color;return i.jsx("div",{className:de("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",r==="dot"&&"items-center"),children:f&&N?.value!==void 0&&N.name?f(N.value,N.name,N,A,N.payload):i.jsxs(i.Fragment,{children:[T?.icon?i.jsx(T.icon,{}):!o&&i.jsx("div",{className:de("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":w&&r==="dashed"}),style:{"--color-bg":C,"--color-border":C}}),i.jsxs("div",{className:de("flex flex-1 justify-between leading-none",w?"items-end":"items-center"),children:[i.jsxs("div",{className:"grid gap-1.5",children:[w?b:null,i.jsx("span",{className:"text-muted-foreground",children:T?.label||N.name})]}),N.value&&i.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:N.value.toLocaleString()})]})]})},N.dataKey)})})]})});Pc.displayName="ChartTooltip";const Lpe=nl,Yq=y.forwardRef(({className:e,hideIcon:t=!1,payload:n,verticalAlign:r="bottom",nameKey:a},o)=>{const{config:l}=Gq();return n?.length?i.jsx("div",{ref:o,className:de("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",e),children:n.filter(u=>u.type!=="none").map(u=>{const d=`${a||u.dataKey||"value"}`,f=qN(l,u,d);return i.jsxs("div",{className:de("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[f?.icon&&!t?i.jsx(f.icon,{}):i.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:u.color}}),f?.label]},u.value)})}):null});Yq.displayName="ChartLegend";function qN(e,t,n){if(typeof t!="object"||t===null)return;const r="payload"in t&&typeof t.payload=="object"&&t.payload!==null?t.payload:void 0;let a=n;return n in t&&typeof t[n]=="string"?a=t[n]:r&&n in r&&typeof r[n]=="string"&&(a=r[n]),a in e?e[a]:e[n]}const Bpe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),zpe=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),qI=e=>{const t=zpe(e);return t.charAt(0).toUpperCase()+t.slice(1)},Kq=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),qpe=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Fpe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Upe=y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:o,iconNode:l,...u},d)=>y.createElement("svg",{ref:d,...Fpe,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Kq("lucide",a),...!o&&!qpe(u)&&{"aria-hidden":"true"},...u},[...l.map(([f,m])=>y.createElement(f,m)),...Array.isArray(o)?o:[o]]));const Oe=(e,t)=>{const n=y.forwardRef(({className:r,...a},o)=>y.createElement(Upe,{ref:o,iconNode:t,className:Kq(`lucide-${Bpe(qI(e))}`,`lucide-${e}`,r),...a}));return n.displayName=qI(e),n};const Hpe=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Wpe=Oe("activity",Hpe);const Vpe=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Xq=Oe("arrow-left",Vpe);const Gpe=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ype=Oe("arrow-right",Gpe);const Kpe=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],FI=Oe("ban",Kpe);const Xpe=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Zpe=Oe("book-open",Xpe);const Qpe=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Jpe=Oe("bot",Qpe);const eve=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],Zq=Oe("boxes",eve);const tve=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],UI=Oe("calendar",tve);const nve=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],rve=Oe("chart-column",nve);const ave=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],il=Oe("check",ave);const ive=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],uh=Oe("chevron-down",ive);const ove=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],YO=Oe("chevron-left",ove);const sve=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],KO=Oe("chevron-right",sve);const lve=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],FN=Oe("chevron-up",lve);const cve=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],uve=Oe("chevrons-up-down",cve);const dve=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],bg=Oe("circle-alert",dve);const fve=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Vo=Oe("circle-check",fve);const hve=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],mve=Oe("circle-question-mark",hve);const pve=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],Qq=Oe("circle-user",pve);const vve=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],UN=Oe("circle-x",vve);const gve=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],yve=Oe("circle",gve);const xve=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ol=Oe("clock",xve);const bve=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],HN=Oe("copy",bve);const wve=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],jve=Oe("database",wve);const Sve=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],_ve=Oe("dollar-sign",Sve);const Nve=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],WN=Oe("download",Nve);const Cve=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],av=Oe("external-link",Cve);const Ove=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],VN=Oe("eye-off",Ove);const Eve=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Ua=Oe("eye",Eve);const Ave=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],wg=Oe("file-search",Ave);const Tve=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],XO=Oe("file-text",Tve);const kve=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],GN=Oe("funnel",kve);const Mve=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],jg=Oe("hash",Mve);const Pve=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],Sg=Oe("house",Pve);const Rve=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],YN=Oe("info",Rve);const Dve=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],$ve=Oe("key",Dve);const Ive=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],KN=Oe("loader-circle",Ive);const Lve=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],HI=Oe("lock",Lve);const Bve=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],WI=Oe("log-out",Bve);const zve=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],qve=Oe("menu",zve);const Fve=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Lh=Oe("message-square",Fve);const Uve=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],XN=Oe("moon",Uve);const Hve=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Jq=Oe("package",Hve);const Wve=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],eF=Oe("palette",Wve);const Vve=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Gve=Oe("pause",Vve);const Yve=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Au=Oe("pencil",Yve);const Kve=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Xve=Oe("play",Kve);const Zve=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],tr=Oe("plus",Zve);const Qve=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],sl=Oe("refresh-cw",Qve);const Jve=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],ege=Oe("rotate-ccw",Jve);const tge=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],nge=Oe("rotate-cw",tge);const rge=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],ZO=Oe("save",rge);const age=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Dr=Oe("search",age);const ige=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],tF=Oe("server",ige);const oge=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],sge=Oe("settings-2",oge);const lge=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Vc=Oe("settings",lge);const cge=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],uge=Oe("shield",cge);const dge=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],fge=Oe("skip-forward",dge);const hge=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],QO=Oe("smile",hge);const mge=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],pge=Oe("sparkles",mge);const vge=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Tu=Oe("square-pen",vge);const gge=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],VI=Oe("star",gge);const yge=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],ZN=Oe("sun",yge);const xge=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],bge=Oe("terminal",xge);const wge=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Tt=Oe("trash-2",wge);const jge=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Sge=Oe("trending-up",jge);const _ge=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Gc=Oe("triangle-alert",_ge);const Nge=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],nF=Oe("user",Nge);const Cge=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Oge=Oe("users",Cge);const Ege=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Bh=Oe("x",Ege);const Age=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],dh=Oe("zap",Age);var Tge=Symbol.for("react.lazy"),_g=jC[" use ".trim().toString()];function kge(e){return typeof e=="object"&&e!==null&&"then"in e}function rF(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Tge&&"_payload"in e&&kge(e._payload)}function zh(e){const t=Pge(e),n=y.forwardRef((r,a)=>{let{children:o,...l}=r;rF(o)&&typeof _g=="function"&&(o=_g(o._payload));const u=y.Children.toArray(o),d=u.find(Dge);if(d){const f=d.props.children,m=u.map(p=>p===d?y.Children.count(f)>1?y.Children.only(null):y.isValidElement(f)?f.props.children:null:p);return i.jsx(t,{...l,ref:a,children:y.isValidElement(f)?y.cloneElement(f,void 0,m):null})}return i.jsx(t,{...l,ref:a,children:o})});return n.displayName=`${e}.Slot`,n}var Mge=zh("Slot");function Pge(e){const t=y.forwardRef((n,r)=>{let{children:a,...o}=n;if(rF(a)&&typeof _g=="function"&&(a=_g(a._payload)),y.isValidElement(a)){const l=Ige(a),u=$ge(o,a.props);return a.type!==y.Fragment&&(u.ref=r?Rr(r,l):l),y.cloneElement(a,u)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Rge=Symbol("radix.slottable");function Dge(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Rge}function $ge(e,t){const n={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...u)=>{const d=o(...u);return a(...u),d}:a&&(n[r]=a):r==="style"?n[r]={...a,...o}:r==="className"&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function Ige(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const GI=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,YI=Ye,qh=(e,t)=>n=>{var r;if(t?.variants==null)return YI(e,n?.class,n?.className);const{variants:a,defaultVariants:o}=t,l=Object.keys(a).map(f=>{const m=n?.[f],p=o?.[f];if(m===null)return null;const g=GI(m)||GI(p);return a[f][g]}),u=n&&Object.entries(n).reduce((f,m)=>{let[p,g]=m;return g===void 0||(f[p]=g),f},{}),d=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,m)=>{let{class:p,className:g,...x}=m;return Object.entries(x).every(j=>{let[b,w]=j;return Array.isArray(w)?w.includes({...o,...u}[b]):{...o,...u}[b]===w})?[...f,p,g]:f},[]);return YI(e,l,d,n?.class,n?.className)},fh=qh("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ue=y.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...a},o)=>{const l=r?Mge:"button";return i.jsx(l,{className:de(fh({variant:t,size:n,className:e})),ref:o,...a})});ue.displayName="Button";function Lge(){const[e,t]=y.useState(null),[n,r]=y.useState(!0),[a,o]=y.useState(24),[l,u]=y.useState(!0),[d,f]=y.useState(null),[m,p]=y.useState(!0),g=y.useCallback(async()=>{try{p(!0);const O=await ln.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");f({hitokoto:O.data.hitokoto,from:O.data.from||O.data.from_who||"未知"})}catch(O){console.error("获取一言失败:",O),f({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{p(!1)}},[]),x=y.useCallback(async()=>{try{const O=localStorage.getItem("token"),M=await ln.get(`/api/webui/statistics/dashboard?hours=${a}`,{headers:{Authorization:`Bearer ${O}`}});t(M.data),r(!1)}catch(O){console.error("Failed to fetch dashboard data:",O),r(!1)}},[a]);if(y.useEffect(()=>{x(),g()},[x,g]),y.useEffect(()=>{if(!l)return;const O=setInterval(()=>{x()},3e4);return()=>clearInterval(O)},[l,x]),n||!e)return i.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:i.jsxs("div",{className:"text-center space-y-4",children:[i.jsx(sl,{className:"h-12 w-12 animate-spin mx-auto text-muted-foreground"}),i.jsx("p",{className:"text-muted-foreground",children:"加载统计数据中..."})]})});const{summary:j,model_stats:b,hourly_data:w,daily_data:N,recent_activity:A}=e,E=O=>{const M=Math.floor(O/3600),I=Math.floor(O%3600/60);return`${M}小时${I}分钟`},T=O=>new Date(O).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),C=b.slice(0,6).map(O=>({name:O.model_name,value:O.request_count,fill:`hsl(var(--chart-${b.indexOf(O)%5+1}))`})),k={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return i.jsx(Vt,{className:"h-full",children:i.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(ul,{value:a.toString(),onValueChange:O=>o(Number(O)),children:i.jsxs(Qo,{className:"grid grid-cols-3 w-full sm:w-auto",children:[i.jsx(Ot,{value:"24",children:"24小时"}),i.jsx(Ot,{value:"168",children:"7天"}),i.jsx(Ot,{value:"720",children:"30天"})]})}),i.jsxs(ue,{variant:l?"default":"outline",size:"sm",onClick:()=>u(!l),className:"gap-2",children:[i.jsx(sl,{className:`h-4 w-4 ${l?"animate-spin":""}`}),i.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),i.jsx(ue,{variant:"outline",size:"sm",onClick:x,children:i.jsx(sl,{className:"h-4 w-4"})})]})]}),i.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[i.jsxs(st,{children:[i.jsxs(qt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[i.jsx(Ft,{className:"text-sm font-medium",children:"总请求数"}),i.jsx(Wpe,{className:"h-4 w-4 text-muted-foreground"})]}),i.jsxs(on,{children:[i.jsx("div",{className:"text-2xl font-bold",children:j.total_requests.toLocaleString()}),i.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",a<48?a+"小时":Math.floor(a/24)+"天"]})]})]}),i.jsxs(st,{children:[i.jsxs(qt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[i.jsx(Ft,{className:"text-sm font-medium",children:"总花费"}),i.jsx(_ve,{className:"h-4 w-4 text-muted-foreground"})]}),i.jsxs(on,{children:[i.jsxs("div",{className:"text-2xl font-bold",children:["¥",j.total_cost.toFixed(2)]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:j.cost_per_hour>0?`¥${j.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),i.jsxs(st,{children:[i.jsxs(qt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[i.jsx(Ft,{className:"text-sm font-medium",children:"Token消耗"}),i.jsx(jve,{className:"h-4 w-4 text-muted-foreground"})]}),i.jsxs(on,{children:[i.jsxs("div",{className:"text-2xl font-bold",children:[(j.total_tokens/1e3).toFixed(1),"K"]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:j.tokens_per_hour>0?`${(j.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),i.jsxs(st,{children:[i.jsxs(qt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[i.jsx(Ft,{className:"text-sm font-medium",children:"平均响应"}),i.jsx(dh,{className:"h-4 w-4 text-muted-foreground"})]}),i.jsxs(on,{children:[i.jsxs("div",{className:"text-2xl font-bold",children:[j.avg_response_time.toFixed(2),"s"]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),i.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[i.jsxs(st,{children:[i.jsxs(qt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[i.jsx(Ft,{className:"text-sm font-medium",children:"在线时长"}),i.jsx(ol,{className:"h-4 w-4 text-muted-foreground"})]}),i.jsx(on,{children:i.jsx("div",{className:"text-xl font-bold",children:E(j.online_time)})})]}),i.jsxs(st,{children:[i.jsxs(qt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[i.jsx(Ft,{className:"text-sm font-medium",children:"消息处理"}),i.jsx(Lh,{className:"h-4 w-4 text-muted-foreground"})]}),i.jsxs(on,{children:[i.jsx("div",{className:"text-xl font-bold",children:j.total_messages.toLocaleString()}),i.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",j.total_replies.toLocaleString()," 条"]})]})]}),i.jsxs(st,{children:[i.jsxs(qt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[i.jsx(Ft,{className:"text-sm font-medium",children:"成本效率"}),i.jsx(Sge,{className:"h-4 w-4 text-muted-foreground"})]}),i.jsxs(on,{children:[i.jsx("div",{className:"text-xl font-bold",children:j.total_messages>0?`¥${(j.total_cost/j.total_messages*100).toFixed(2)}`:"¥0.00"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),i.jsxs(ul,{defaultValue:"trends",className:"space-y-4",children:[i.jsxs(Qo,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[i.jsx(Ot,{value:"trends",children:"趋势"}),i.jsx(Ot,{value:"models",children:"模型"}),i.jsx(Ot,{value:"activity",children:"活动"}),i.jsx(Ot,{value:"daily",children:"日统计"})]}),i.jsxs(en,{value:"trends",className:"space-y-4",children:[i.jsxs(st,{children:[i.jsxs(qt,{children:[i.jsx(Ft,{children:"请求趋势"}),i.jsxs(er,{children:["最近",a,"小时的请求量变化"]})]}),i.jsx(on,{children:i.jsx(Mc,{config:k,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:i.jsxs(Rpe,{data:w,children:[i.jsx(ff,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),i.jsx(Wo,{dataKey:"timestamp",tickFormatter:O=>T(O),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),i.jsx(Vi,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),i.jsx(of,{content:i.jsx(Pc,{labelFormatter:O=>T(O)})}),i.jsx(Ih,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),i.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[i.jsxs(st,{children:[i.jsxs(qt,{children:[i.jsx(Ft,{children:"花费趋势"}),i.jsx(er,{children:"API调用成本变化"})]}),i.jsx(on,{children:i.jsx(Mc,{config:k,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:i.jsxs(US,{data:w,children:[i.jsx(ff,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),i.jsx(Wo,{dataKey:"timestamp",tickFormatter:O=>T(O),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),i.jsx(Vi,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),i.jsx(of,{content:i.jsx(Pc,{labelFormatter:O=>T(O)})}),i.jsx(li,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),i.jsxs(st,{children:[i.jsxs(qt,{children:[i.jsx(Ft,{children:"Token消耗"}),i.jsx(er,{children:"Token使用量变化"})]}),i.jsx(on,{children:i.jsx(Mc,{config:k,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:i.jsxs(US,{data:w,children:[i.jsx(ff,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),i.jsx(Wo,{dataKey:"timestamp",tickFormatter:O=>T(O),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),i.jsx(Vi,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),i.jsx(of,{content:i.jsx(Pc,{labelFormatter:O=>T(O)})}),i.jsx(li,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),i.jsx(en,{value:"models",className:"space-y-4",children:i.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[i.jsxs(st,{children:[i.jsxs(qt,{children:[i.jsx(Ft,{children:"模型请求分布"}),i.jsx(er,{children:"各模型使用占比"})]}),i.jsx(on,{children:i.jsx(Mc,{config:Object.fromEntries(b.slice(0,6).map((O,M)=>[O.model_name,{label:O.model_name,color:`hsl(var(--chart-${M%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:i.jsxs(Dpe,{children:[i.jsx(of,{content:i.jsx(Pc,{})}),i.jsx(fo,{data:C,cx:"50%",cy:"50%",labelLine:!1,label:({name:O,percent:M})=>`${O} ${M?(M*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:C.map((O,M)=>i.jsx(iy,{fill:O.fill},`cell-${M}`))})]})})})]}),i.jsxs(st,{children:[i.jsxs(qt,{children:[i.jsx(Ft,{children:"模型详细统计"}),i.jsx(er,{children:"请求数、花费和性能"})]}),i.jsx(on,{children:i.jsx(Vt,{className:"h-[300px] sm:h-[400px]",children:i.jsx("div",{className:"space-y-3",children:b.map((O,M)=>i.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:O.model_name}),i.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${M%5+1}))`}})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),i.jsx("span",{className:"ml-1 font-medium",children:O.request_count.toLocaleString()})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground",children:"花费:"}),i.jsxs("span",{className:"ml-1 font-medium",children:["¥",O.total_cost.toFixed(2)]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),i.jsxs("span",{className:"ml-1 font-medium",children:[(O.total_tokens/1e3).toFixed(1),"K"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),i.jsxs("span",{className:"ml-1 font-medium",children:[O.avg_response_time.toFixed(2),"s"]})]})]})]},M))})})})]})]})}),i.jsx(en,{value:"activity",children:i.jsxs(st,{children:[i.jsxs(qt,{children:[i.jsx(Ft,{children:"最近活动"}),i.jsx(er,{children:"最新的API调用记录"})]}),i.jsx(on,{children:i.jsx(Vt,{className:"h-[400px] sm:h-[500px]",children:i.jsx("div",{className:"space-y-2",children:A.map((O,M)=>i.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"font-medium text-sm truncate",children:O.model}),i.jsx("div",{className:"text-xs text-muted-foreground",children:O.request_type})]}),i.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:T(O.timestamp)})]}),i.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),i.jsx("span",{className:"ml-1",children:O.tokens})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground",children:"花费:"}),i.jsxs("span",{className:"ml-1",children:["¥",O.cost.toFixed(4)]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),i.jsxs("span",{className:"ml-1",children:[O.time_cost.toFixed(2),"s"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground",children:"状态:"}),i.jsx("span",{className:`ml-1 ${O.status==="success"?"text-green-600":"text-red-600"}`,children:O.status})]})]})]},M))})})})]})}),i.jsx(en,{value:"daily",children:i.jsxs(st,{children:[i.jsxs(qt,{children:[i.jsx(Ft,{children:"每日统计"}),i.jsx(er,{children:"最近7天的数据汇总"})]}),i.jsx(on,{children:i.jsx(Mc,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:i.jsxs(US,{data:N,children:[i.jsx(ff,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),i.jsx(Wo,{dataKey:"timestamp",tickFormatter:O=>{const M=new Date(O);return`${M.getMonth()+1}/${M.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),i.jsx(Vi,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),i.jsx(Vi,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),i.jsx(of,{content:i.jsx(Pc,{labelFormatter:O=>new Date(O).toLocaleDateString("zh-CN")})}),i.jsx(Lpe,{content:i.jsx(Yq,{})}),i.jsx(li,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),i.jsx(li,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),i.jsxs(st,{className:"border-2 border-primary/20",children:[i.jsx(qt,{className:"pb-3",children:i.jsx(Ft,{className:"text-lg",children:"每日一言"})}),i.jsx(on,{children:m?i.jsxs("div",{className:"space-y-2",children:[i.jsx(FM,{className:"h-6 w-3/4"}),i.jsx(FM,{className:"h-4 w-1/4"})]}):d?i.jsxs("div",{className:"space-y-2",children:[i.jsxs("p",{className:"text-lg font-medium leading-relaxed italic",children:['"',d.hitokoto,'"']}),i.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["—— ",d.from]})]}):null})]})]})})}const Bge={theme:"system",setTheme:()=>null},aF=y.createContext(Bge),JO=()=>{const e=y.useContext(aF);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},zge=(e,t,n)=>{const r=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||r){t(e);return}const a=n.clientX,o=n.clientY,l=Math.hypot(Math.max(a,innerWidth-a),Math.max(o,innerHeight-o));document.startViewTransition(()=>{t(e)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${a}px ${o}px)`,`circle(${l}px at ${a}px ${o}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},iF=y.createContext(void 0),oF=()=>{const e=y.useContext(iF);if(e===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return e};function Ty(e){const t=y.useRef({value:e,previous:e});return y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function ky(e){const[t,n]=y.useState(void 0);return Un(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const o=a[0];let l,u;if("borderBoxSize"in o){const d=o.borderBoxSize,f=Array.isArray(d)?d[0]:d;l=f.inlineSize,u=f.blockSize}else l=e.offsetWidth,u=e.offsetHeight;n({width:l,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var My="Switch",[qge]=hr(My),[Fge,Uge]=qge(My),sF=y.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:o,required:l,disabled:u,value:d="on",onCheckedChange:f,form:m,...p}=e,[g,x]=y.useState(null),j=qe(t,E=>x(E)),b=y.useRef(!1),w=g?m||!!g.closest("form"):!0,[N,A]=Na({prop:a,defaultProp:o??!1,onChange:f,caller:My});return i.jsxs(Fge,{scope:n,checked:N,disabled:u,children:[i.jsx(Pe.button,{type:"button",role:"switch","aria-checked":N,"aria-required":l,"data-state":dF(N),"data-disabled":u?"":void 0,disabled:u,value:d,...p,ref:j,onClick:Se(e.onClick,E=>{A(T=>!T),w&&(b.current=E.isPropagationStopped(),b.current||E.stopPropagation())})}),w&&i.jsx(uF,{control:g,bubbles:!b.current,name:r,value:d,checked:N,required:l,disabled:u,form:m,style:{transform:"translateX(-100%)"}})]})});sF.displayName=My;var lF="SwitchThumb",cF=y.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,a=Uge(lF,n);return i.jsx(Pe.span,{"data-state":dF(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:t})});cF.displayName=lF;var Hge="SwitchBubbleInput",uF=y.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...a},o)=>{const l=y.useRef(null),u=qe(l,o),d=Ty(n),f=ky(t);return y.useEffect(()=>{const m=l.current;if(!m)return;const p=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(p,"checked").set;if(d!==n&&x){const j=new Event("click",{bubbles:r});x.call(m,n),m.dispatchEvent(j)}},[d,n,r]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:u,style:{...a.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});uF.displayName=Hge;function dF(e){return e?"checked":"unchecked"}var fF=sF,Wge=cF;const at=y.forwardRef(({className:e,...t},n)=>i.jsx(fF,{className:de("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:i.jsx(Wge,{className:de("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));at.displayName=fF.displayName;var Vge=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Gge=Vge.reduce((e,t)=>{const n=zh(`Primitive.${t}`),r=y.forwardRef((a,o)=>{const{asChild:l,...u}=a,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(d,{...u,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Yge="Label",hF=y.forwardRef((e,t)=>i.jsx(Gge.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));hF.displayName=Yge;var mF=hF;const Kge=qh("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),J=y.forwardRef(({className:e,...t},n)=>i.jsx(mF,{ref:n,className:de(Kge(),e),...t}));J.displayName=mF.displayName;const Ne=y.forwardRef(({className:e,type:t,...n},r)=>i.jsx("input",{type:t,className:de("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));Ne.displayName="Input";const Xge=1,Zge=1e6;let HS=0;function Qge(){return HS=(HS+1)%Number.MAX_SAFE_INTEGER,HS.toString()}const WS=new Map,KI=e=>{if(WS.has(e))return;const t=setTimeout(()=>{WS.delete(e),Of({type:"REMOVE_TOAST",toastId:e})},Zge);WS.set(e,t)},Jge=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,Xge)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?KI(n):e.toasts.forEach(r=>{KI(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},iv=[];let ov={toasts:[]};function Of(e){ov=Jge(ov,e),iv.forEach(t=>{t(ov)})}function eye({...e}){const t=Qge(),n=a=>Of({type:"UPDATE_TOAST",toast:{...a,id:t}}),r=()=>Of({type:"DISMISS_TOAST",toastId:t});return Of({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:a=>{a||r()}}}),{id:t,dismiss:r,update:n}}function mr(){const[e,t]=y.useState(ov);return y.useEffect(()=>(iv.push(t),()=>{const n=iv.indexOf(t);n>-1&&iv.splice(n,1)}),[e]),{...e,toast:eye,dismiss:n=>Of({type:"DISMISS_TOAST",toastId:n})}}const tye=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:e=>e.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:e=>/[A-Z]/.test(e)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:e=>/[a-z]/.test(e)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:e=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(e)}];function nye(e){const t=tye.map(r=>({id:r.id,label:r.label,description:r.description,passed:r.validate(e)}));return{isValid:t.every(r=>r.passed),rules:t}}const eE="0.11.5 Beta",tE="MaiBot Dashboard",rye=`${tE} v${eE}`,aye=(e="v")=>`${e}${eE}`;function iye(e,t=globalThis?.document){const n=nn(e);y.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var oye="DismissableLayer",QN="dismissableLayer.update",sye="dismissableLayer.pointerDownOutside",lye="dismissableLayer.focusOutside",XI,pF=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ol=y.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:l,onDismiss:u,...d}=e,f=y.useContext(pF),[m,p]=y.useState(null),g=m?.ownerDocument??globalThis?.document,[,x]=y.useState({}),j=qe(t,O=>p(O)),b=Array.from(f.layers),[w]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),N=b.indexOf(w),A=m?b.indexOf(m):-1,E=f.layersWithOutsidePointerEventsDisabled.size>0,T=A>=N,C=uye(O=>{const M=O.target,I=[...f.branches].some(z=>z.contains(M));!T||I||(a?.(O),l?.(O),O.defaultPrevented||u?.())},g),k=dye(O=>{const M=O.target;[...f.branches].some(z=>z.contains(M))||(o?.(O),l?.(O),O.defaultPrevented||u?.())},g);return iye(O=>{A===f.layers.size-1&&(r?.(O),!O.defaultPrevented&&u&&(O.preventDefault(),u()))},g),y.useEffect(()=>{if(m)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(XI=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(m)),f.layers.add(m),ZI(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=XI)}},[m,g,n,f]),y.useEffect(()=>()=>{m&&(f.layers.delete(m),f.layersWithOutsidePointerEventsDisabled.delete(m),ZI())},[m,f]),y.useEffect(()=>{const O=()=>x({});return document.addEventListener(QN,O),()=>document.removeEventListener(QN,O)},[]),i.jsx(Pe.div,{...d,ref:j,style:{pointerEvents:E?T?"auto":"none":void 0,...e.style},onFocusCapture:Se(e.onFocusCapture,k.onFocusCapture),onBlurCapture:Se(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Se(e.onPointerDownCapture,C.onPointerDownCapture)})});Ol.displayName=oye;var cye="DismissableLayerBranch",vF=y.forwardRef((e,t)=>{const n=y.useContext(pF),r=y.useRef(null),a=qe(t,r);return y.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),i.jsx(Pe.div,{...e,ref:a})});vF.displayName=cye;function uye(e,t=globalThis?.document){const n=nn(e),r=y.useRef(!1),a=y.useRef(()=>{});return y.useEffect(()=>{const o=u=>{if(u.target&&!r.current){let d=function(){gF(sye,n,f,{discrete:!0})};const f={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=d,t.addEventListener("click",a.current,{once:!0})):d()}else t.removeEventListener("click",a.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",o),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function dye(e,t=globalThis?.document){const n=nn(e),r=y.useRef(!1);return y.useEffect(()=>{const a=o=>{o.target&&!r.current&&gF(lye,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ZI(){const e=new CustomEvent(QN);document.dispatchEvent(e)}function gF(e,t,n,{discrete:r}){const a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?LC(a,o):a.dispatchEvent(o)}var fye=Ol,hye=vF,VS="focusScope.autoFocusOnMount",GS="focusScope.autoFocusOnUnmount",QI={bubbles:!1,cancelable:!0},mye="FocusScope",Fh=y.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...l}=e,[u,d]=y.useState(null),f=nn(a),m=nn(o),p=y.useRef(null),g=qe(t,b=>d(b)),x=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let b=function(E){if(x.paused||!u)return;const T=E.target;u.contains(T)?p.current=T:zo(p.current,{select:!0})},w=function(E){if(x.paused||!u)return;const T=E.relatedTarget;T!==null&&(u.contains(T)||zo(p.current,{select:!0}))},N=function(E){if(document.activeElement===document.body)for(const C of E)C.removedNodes.length>0&&zo(u)};document.addEventListener("focusin",b),document.addEventListener("focusout",w);const A=new MutationObserver(N);return u&&A.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",w),A.disconnect()}}},[r,u,x.paused]),y.useEffect(()=>{if(u){eL.add(x);const b=document.activeElement;if(!u.contains(b)){const N=new CustomEvent(VS,QI);u.addEventListener(VS,f),u.dispatchEvent(N),N.defaultPrevented||(pye(bye(yF(u)),{select:!0}),document.activeElement===b&&zo(u))}return()=>{u.removeEventListener(VS,f),setTimeout(()=>{const N=new CustomEvent(GS,QI);u.addEventListener(GS,m),u.dispatchEvent(N),N.defaultPrevented||zo(b??document.body,{select:!0}),u.removeEventListener(GS,m),eL.remove(x)},0)}}},[u,f,m,x]);const j=y.useCallback(b=>{if(!n&&!r||x.paused)return;const w=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,N=document.activeElement;if(w&&N){const A=b.currentTarget,[E,T]=vye(A);E&&T?!b.shiftKey&&N===T?(b.preventDefault(),n&&zo(E,{select:!0})):b.shiftKey&&N===E&&(b.preventDefault(),n&&zo(T,{select:!0})):N===A&&b.preventDefault()}},[n,r,x.paused]);return i.jsx(Pe.div,{tabIndex:-1,...l,ref:g,onKeyDown:j})});Fh.displayName=mye;function pye(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(zo(r,{select:t}),document.activeElement!==n)return}function vye(e){const t=yF(e),n=JI(t,e),r=JI(t.reverse(),e);return[n,r]}function yF(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function JI(e,t){for(const n of e)if(!gye(n,{upTo:t}))return n}function gye(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function yye(e){return e instanceof HTMLInputElement&&"select"in e}function zo(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&yye(e)&&t&&e.select()}}var eL=xye();function xye(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=tL(e,t),e.unshift(t)},remove(t){e=tL(e,t),e[0]?.resume()}}}function tL(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function bye(e){return e.filter(t=>t.tagName!=="A")}var wye="Portal",El=y.forwardRef((e,t)=>{const{container:n,...r}=e,[a,o]=y.useState(!1);Un(()=>o(!0),[]);const l=n||a&&globalThis?.document?.body;return l?yY.createPortal(i.jsx(Pe.div,{...r,ref:t}),l):null});El.displayName=wye;var YS=0;function Py(){y.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??nL()),document.body.insertAdjacentElement("beforeend",e[1]??nL()),YS++,()=>{YS===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),YS--}},[])}function nL(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ri=function(){return ri=Object.assign||function(t){for(var n,r=1,a=arguments.length;r"u")return Lye;var t=Bye(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},qye=jF(),Yc="data-scroll-locked",Fye=function(e,t,n,r){var a=e.left,o=e.top,l=e.right,u=e.gap;return n===void 0&&(n="margin"),` .`.concat(Sye,` { overflow: hidden `).concat(r,`; padding-right: `).concat(u,"px ").concat(r,`; } body[`).concat(Yc,`] { overflow: hidden `).concat(r,`; overscroll-behavior: contain; `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` padding-left: `.concat(a,`px; padding-top: `).concat(o,`px; padding-right: `).concat(l,`px; margin-left:0; margin-top:0; margin-right: `).concat(u,"px ").concat(r,`; `),n==="padding"&&"padding-right: ".concat(u,"px ").concat(r,";")].filter(Boolean).join(""),` } .`).concat(sv,` { right: `).concat(u,"px ").concat(r,`; } .`).concat(lv,` { margin-right: `).concat(u,"px ").concat(r,`; } .`).concat(sv," .").concat(sv,` { right: 0 `).concat(r,`; } .`).concat(lv," .").concat(lv,` { margin-right: 0 `).concat(r,`; } body[`).concat(Yc,`] { `).concat(_ye,": ").concat(u,`px; } `)},aL=function(){var e=parseInt(document.body.getAttribute(Yc)||"0",10);return isFinite(e)?e:0},Uye=function(){y.useEffect(function(){return document.body.setAttribute(Yc,(aL()+1).toString()),function(){var e=aL()-1;e<=0?document.body.removeAttribute(Yc):document.body.setAttribute(Yc,e.toString())}},[])},Hye=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;Uye();var o=y.useMemo(function(){return zye(a)},[a]);return y.createElement(qye,{styles:Fye(o,!t,a,n?"":"!important")})},JN=!1;if(typeof window<"u")try{var qp=Object.defineProperty({},"passive",{get:function(){return JN=!0,!0}});window.addEventListener("test",qp,qp),window.removeEventListener("test",qp,qp)}catch{JN=!1}var Cc=JN?{passive:!1}:!1,Wye=function(e){return e.tagName==="TEXTAREA"},SF=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Wye(e)&&n[t]==="visible")},Vye=function(e){return SF(e,"overflowY")},Gye=function(e){return SF(e,"overflowX")},iL=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=_F(e,r);if(a){var o=NF(e,r),l=o[1],u=o[2];if(l>u)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Yye=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Kye=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},_F=function(e,t){return e==="v"?Vye(t):Gye(t)},NF=function(e,t){return e==="v"?Yye(t):Kye(t)},Xye=function(e,t){return e==="h"&&t==="rtl"?-1:1},Zye=function(e,t,n,r,a){var o=Xye(e,window.getComputedStyle(t).direction),l=o*r,u=n.target,d=t.contains(u),f=!1,m=l>0,p=0,g=0;do{if(!u)break;var x=NF(e,u),j=x[0],b=x[1],w=x[2],N=b-w-o*j;(j||N)&&_F(e,u)&&(p+=N,g+=j);var A=u.parentNode;u=A&&A.nodeType===Node.DOCUMENT_FRAGMENT_NODE?A.host:A}while(!d&&u!==document.body||d&&(t.contains(u)||t===u));return(m&&Math.abs(p)<1||!m&&Math.abs(g)<1)&&(f=!0),f},Fp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},oL=function(e){return[e.deltaX,e.deltaY]},sL=function(e){return e&&"current"in e?e.current:e},Qye=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Jye=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},exe=0,Oc=[];function txe(e){var t=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),a=y.useState(exe++)[0],o=y.useState(jF)[0],l=y.useRef(e);y.useEffect(function(){l.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var b=jye([e.lockRef.current],(e.shards||[]).map(sL),!0).filter(Boolean);return b.forEach(function(w){return w.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),b.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var u=y.useCallback(function(b,w){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!l.current.allowPinchZoom;var N=Fp(b),A=n.current,E="deltaX"in b?b.deltaX:A[0]-N[0],T="deltaY"in b?b.deltaY:A[1]-N[1],C,k=b.target,O=Math.abs(E)>Math.abs(T)?"h":"v";if("touches"in b&&O==="h"&&k.type==="range")return!1;var M=iL(O,k);if(!M)return!0;if(M?C=O:(C=O==="v"?"h":"v",M=iL(O,k)),!M)return!1;if(!r.current&&"changedTouches"in b&&(E||T)&&(r.current=C),!C)return!0;var I=r.current||C;return Zye(I,w,b,I==="h"?E:T)},[]),d=y.useCallback(function(b){var w=b;if(!(!Oc.length||Oc[Oc.length-1]!==o)){var N="deltaY"in w?oL(w):Fp(w),A=t.current.filter(function(C){return C.name===w.type&&(C.target===w.target||w.target===C.shadowParent)&&Qye(C.delta,N)})[0];if(A&&A.should){w.cancelable&&w.preventDefault();return}if(!A){var E=(l.current.shards||[]).map(sL).filter(Boolean).filter(function(C){return C.contains(w.target)}),T=E.length>0?u(w,E[0]):!l.current.noIsolation;T&&w.cancelable&&w.preventDefault()}}},[]),f=y.useCallback(function(b,w,N,A){var E={name:b,delta:w,target:N,should:A,shadowParent:nxe(N)};t.current.push(E),setTimeout(function(){t.current=t.current.filter(function(T){return T!==E})},1)},[]),m=y.useCallback(function(b){n.current=Fp(b),r.current=void 0},[]),p=y.useCallback(function(b){f(b.type,oL(b),b.target,u(b,e.lockRef.current))},[]),g=y.useCallback(function(b){f(b.type,Fp(b),b.target,u(b,e.lockRef.current))},[]);y.useEffect(function(){return Oc.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:g}),document.addEventListener("wheel",d,Cc),document.addEventListener("touchmove",d,Cc),document.addEventListener("touchstart",m,Cc),function(){Oc=Oc.filter(function(b){return b!==o}),document.removeEventListener("wheel",d,Cc),document.removeEventListener("touchmove",d,Cc),document.removeEventListener("touchstart",m,Cc)}},[]);var x=e.removeScrollBar,j=e.inert;return y.createElement(y.Fragment,null,j?y.createElement(o,{styles:Jye(a)}):null,x?y.createElement(Hye,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function nxe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const rxe=kye(wF,txe);var Uh=y.forwardRef(function(e,t){return y.createElement(Ry,ri({},e,{ref:t,sideCar:rxe}))});Uh.classNames=Ry.classNames;var axe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ec=new WeakMap,Up=new WeakMap,Hp={},QS=0,CF=function(e){return e&&(e.host||CF(e.parentNode))},ixe=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=CF(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},oxe=function(e,t,n,r){var a=ixe(t,Array.isArray(e)?e:[e]);Hp[n]||(Hp[n]=new WeakMap);var o=Hp[n],l=[],u=new Set,d=new Set(a),f=function(p){!p||u.has(p)||(u.add(p),f(p.parentNode))};a.forEach(f);var m=function(p){!p||d.has(p)||Array.prototype.forEach.call(p.children,function(g){if(u.has(g))m(g);else try{var x=g.getAttribute(r),j=x!==null&&x!=="false",b=(Ec.get(g)||0)+1,w=(o.get(g)||0)+1;Ec.set(g,b),o.set(g,w),l.push(g),b===1&&j&&Up.set(g,!0),w===1&&g.setAttribute(n,"true"),j||g.setAttribute(r,"true")}catch(N){console.error("aria-hidden: cannot operate on ",g,N)}})};return m(t),u.clear(),QS++,function(){l.forEach(function(p){var g=Ec.get(p)-1,x=o.get(p)-1;Ec.set(p,g),o.set(p,x),g||(Up.has(p)||p.removeAttribute(r),Up.delete(p)),x||p.removeAttribute(n)}),QS--,QS||(Ec=new WeakMap,Ec=new WeakMap,Up=new WeakMap,Hp={})}},Dy=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=axe(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),oxe(r,a,n,"aria-hidden")):function(){return null}};function sxe(e){const t=lxe(e),n=y.forwardRef((r,a)=>{const{children:o,...l}=r,u=y.Children.toArray(o),d=u.find(uxe);if(d){const f=d.props.children,m=u.map(p=>p===d?y.Children.count(f)>1?y.Children.only(null):y.isValidElement(f)?f.props.children:null:p);return i.jsx(t,{...l,ref:a,children:y.isValidElement(f)?y.cloneElement(f,void 0,m):null})}return i.jsx(t,{...l,ref:a,children:o})});return n.displayName=`${e}.Slot`,n}function lxe(e){const t=y.forwardRef((n,r)=>{const{children:a,...o}=n;if(y.isValidElement(a)){const l=fxe(a),u=dxe(o,a.props);return a.type!==y.Fragment&&(u.ref=r?Rr(r,l):l),y.cloneElement(a,u)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var cxe=Symbol("radix.slottable");function uxe(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===cxe}function dxe(e,t){const n={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...u)=>{const d=o(...u);return a(...u),d}:a&&(n[r]=a):r==="style"?n[r]={...a,...o}:r==="className"&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function fxe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var $y="Dialog",[OF,EF]=hr($y),[hxe,Ya]=OF($y),AF=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:l=!0}=e,u=y.useRef(null),d=y.useRef(null),[f,m]=Na({prop:r,defaultProp:a??!1,onChange:o,caller:$y});return i.jsx(hxe,{scope:t,triggerRef:u,contentRef:d,contentId:Fn(),titleId:Fn(),descriptionId:Fn(),open:f,onOpenChange:m,onOpenToggle:y.useCallback(()=>m(p=>!p),[m]),modal:l,children:n})};AF.displayName=$y;var TF="DialogTrigger",kF=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Ya(TF,n),o=qe(t,a.triggerRef);return i.jsx(Pe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":aE(a.open),...r,ref:o,onClick:Se(e.onClick,a.onOpenToggle)})});kF.displayName=TF;var nE="DialogPortal",[mxe,MF]=OF(nE,{forceMount:void 0}),PF=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,o=Ya(nE,t);return i.jsx(mxe,{scope:t,forceMount:n,children:y.Children.map(r,l=>i.jsx(Rn,{present:n||o.open,children:i.jsx(El,{asChild:!0,container:a,children:l})}))})};PF.displayName=nE;var Ng="DialogOverlay",RF=y.forwardRef((e,t)=>{const n=MF(Ng,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=Ya(Ng,e.__scopeDialog);return o.modal?i.jsx(Rn,{present:r||o.open,children:i.jsx(vxe,{...a,ref:t})}):null});RF.displayName=Ng;var pxe=sxe("DialogOverlay.RemoveScroll"),vxe=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Ya(Ng,n);return i.jsx(Uh,{as:pxe,allowPinchZoom:!0,shards:[a.contentRef],children:i.jsx(Pe.div,{"data-state":aE(a.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),vl="DialogContent",DF=y.forwardRef((e,t)=>{const n=MF(vl,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=Ya(vl,e.__scopeDialog);return i.jsx(Rn,{present:r||o.open,children:o.modal?i.jsx(gxe,{...a,ref:t}):i.jsx(yxe,{...a,ref:t})})});DF.displayName=vl;var gxe=y.forwardRef((e,t)=>{const n=Ya(vl,e.__scopeDialog),r=y.useRef(null),a=qe(t,n.contentRef,r);return y.useEffect(()=>{const o=r.current;if(o)return Dy(o)},[]),i.jsx($F,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Se(e.onCloseAutoFocus,o=>{o.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Se(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0;(l.button===2||u)&&o.preventDefault()}),onFocusOutside:Se(e.onFocusOutside,o=>o.preventDefault())})}),yxe=y.forwardRef((e,t)=>{const n=Ya(vl,e.__scopeDialog),r=y.useRef(!1),a=y.useRef(!1);return i.jsx($F,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(r.current||n.triggerRef.current?.focus(),o.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=o.target;n.triggerRef.current?.contains(l)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),$F=y.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:o,...l}=e,u=Ya(vl,n),d=y.useRef(null),f=qe(t,d);return Py(),i.jsxs(i.Fragment,{children:[i.jsx(Fh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:o,children:i.jsx(Ol,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":aE(u.open),...l,ref:f,onDismiss:()=>u.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(bxe,{titleId:u.titleId}),i.jsx(jxe,{contentRef:d,descriptionId:u.descriptionId})]})]})}),rE="DialogTitle",IF=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Ya(rE,n);return i.jsx(Pe.h2,{id:a.titleId,...r,ref:t})});IF.displayName=rE;var LF="DialogDescription",BF=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Ya(LF,n);return i.jsx(Pe.p,{id:a.descriptionId,...r,ref:t})});BF.displayName=LF;var zF="DialogClose",qF=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Ya(zF,n);return i.jsx(Pe.button,{type:"button",...r,ref:t,onClick:Se(e.onClick,()=>a.onOpenChange(!1))})});qF.displayName=zF;function aE(e){return e?"open":"closed"}var FF="DialogTitleWarning",[xxe,UF]=sZ(FF,{contentName:vl,titleName:rE,docsSlug:"dialog"}),bxe=({titleId:e})=>{const t=UF(FF),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return y.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},wxe="DialogDescriptionWarning",jxe=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${UF(wxe).contentName}}.`;return y.useEffect(()=>{const a=e.current?.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},iE=AF,HF=kF,oE=PF,Iy=RF,Ly=DF,sE=IF,lE=BF,cE=qF;const nr=iE,WF=HF,Sxe=oE,VF=y.forwardRef(({className:e,...t},n)=>i.jsx(Iy,{ref:n,className:de("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));VF.displayName=Iy.displayName;const Hn=y.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(Sxe,{children:[i.jsx(VF,{}),i.jsxs(Ly,{ref:r,className:de("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,i.jsxs(cE,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[i.jsx(Bh,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Hn.displayName=Ly.displayName;const Wn=({className:e,...t})=>i.jsx("div",{className:de("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Wn.displayName="DialogHeader";const $r=({className:e,...t})=>i.jsx("div",{className:de("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});$r.displayName="DialogFooter";const Vn=y.forwardRef(({className:e,...t},n)=>i.jsx(sE,{ref:n,className:de("text-lg font-semibold leading-none tracking-tight",e),...t}));Vn.displayName=sE.displayName;const dr=y.forwardRef(({className:e,...t},n)=>i.jsx(lE,{ref:n,className:de("text-sm text-muted-foreground",e),...t}));dr.displayName=lE.displayName;var _xe=Symbol("radix.slottable");function Nxe(e){const t=({children:n})=>i.jsx(i.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=_xe,t}var GF="AlertDialog",[Cxe]=hr(GF,[EF]),ho=EF(),YF=e=>{const{__scopeAlertDialog:t,...n}=e,r=ho(t);return i.jsx(iE,{...r,...n,modal:!0})};YF.displayName=GF;var Oxe="AlertDialogTrigger",KF=y.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=ho(n);return i.jsx(HF,{...a,...r,ref:t})});KF.displayName=Oxe;var Exe="AlertDialogPortal",XF=e=>{const{__scopeAlertDialog:t,...n}=e,r=ho(t);return i.jsx(oE,{...r,...n})};XF.displayName=Exe;var Axe="AlertDialogOverlay",ZF=y.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=ho(n);return i.jsx(Iy,{...a,...r,ref:t})});ZF.displayName=Axe;var Kc="AlertDialogContent",[Txe,kxe]=Cxe(Kc),Mxe=Nxe("AlertDialogContent"),QF=y.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...a}=e,o=ho(n),l=y.useRef(null),u=qe(t,l),d=y.useRef(null);return i.jsx(xxe,{contentName:Kc,titleName:JF,docsSlug:"alert-dialog",children:i.jsx(Txe,{scope:n,cancelRef:d,children:i.jsxs(Ly,{role:"alertdialog",...o,...a,ref:u,onOpenAutoFocus:Se(a.onOpenAutoFocus,f=>{f.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[i.jsx(Mxe,{children:r}),i.jsx(Rxe,{contentRef:l})]})})})});QF.displayName=Kc;var JF="AlertDialogTitle",e8=y.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=ho(n);return i.jsx(sE,{...a,...r,ref:t})});e8.displayName=JF;var t8="AlertDialogDescription",n8=y.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=ho(n);return i.jsx(lE,{...a,...r,ref:t})});n8.displayName=t8;var Pxe="AlertDialogAction",r8=y.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=ho(n);return i.jsx(cE,{...a,...r,ref:t})});r8.displayName=Pxe;var a8="AlertDialogCancel",i8=y.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=kxe(a8,n),o=ho(n),l=qe(t,a);return i.jsx(cE,{...o,...r,ref:l})});i8.displayName=a8;var Rxe=({contentRef:e})=>{const t=`\`${Kc}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${Kc}\` by passing a \`${t8}\` component as a child, which also benefits sighted users by adding visible context to the dialog. Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Kc}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return y.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Dxe=YF,$xe=KF,Ixe=XF,o8=ZF,s8=QF,l8=r8,c8=i8,u8=e8,d8=n8;const Pn=Dxe,ra=$xe,Lxe=Ixe,f8=y.forwardRef(({className:e,...t},n)=>i.jsx(o8,{className:de("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));f8.displayName=o8.displayName;const yn=y.forwardRef(({className:e,...t},n)=>i.jsxs(Lxe,{children:[i.jsx(f8,{}),i.jsx(s8,{ref:n,className:de("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));yn.displayName=s8.displayName;const xn=({className:e,...t})=>i.jsx("div",{className:de("flex flex-col space-y-2 text-center sm:text-left",e),...t});xn.displayName="AlertDialogHeader";const bn=({className:e,...t})=>i.jsx("div",{className:de("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});bn.displayName="AlertDialogFooter";const wn=y.forwardRef(({className:e,...t},n)=>i.jsx(u8,{ref:n,className:de("text-lg font-semibold",e),...t}));wn.displayName=u8.displayName;const jn=y.forwardRef(({className:e,...t},n)=>i.jsx(d8,{ref:n,className:de("text-sm text-muted-foreground",e),...t}));jn.displayName=d8.displayName;const Sn=y.forwardRef(({className:e,...t},n)=>i.jsx(l8,{ref:n,className:de(fh(),e),...t}));Sn.displayName=l8.displayName;const _n=y.forwardRef(({className:e,...t},n)=>i.jsx(c8,{ref:n,className:de(fh({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));_n.displayName=c8.displayName;function Bxe(){return i.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[i.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),i.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),i.jsxs(ul,{defaultValue:"appearance",className:"w-full",children:[i.jsxs(Qo,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[i.jsxs(Ot,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[i.jsx(eF,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),i.jsx("span",{children:"外观"})]}),i.jsxs(Ot,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[i.jsx(uge,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),i.jsx("span",{children:"安全"})]}),i.jsxs(Ot,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[i.jsx(Vc,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),i.jsx("span",{children:"其他"})]}),i.jsxs(Ot,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[i.jsx(YN,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),i.jsx("span",{children:"关于"})]})]}),i.jsxs(Vt,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[i.jsx(en,{value:"appearance",className:"mt-0",children:i.jsx(zxe,{})}),i.jsx(en,{value:"security",className:"mt-0",children:i.jsx(qxe,{})}),i.jsx(en,{value:"other",className:"mt-0",children:i.jsx(Fxe,{})}),i.jsx(en,{value:"about",className:"mt-0",children:i.jsx(Uxe,{})})]})]})]})}function lL(e){const t=document.documentElement,r={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[e];if(r)t.style.setProperty("--primary",r.hsl),r.gradient?(t.style.setProperty("--primary-gradient",r.gradient),t.classList.add("has-gradient")):(t.style.removeProperty("--primary-gradient"),t.classList.remove("has-gradient"));else if(e.startsWith("#")){const a=o=>{o=o.replace("#","");const l=parseInt(o.substring(0,2),16)/255,u=parseInt(o.substring(2,4),16)/255,d=parseInt(o.substring(4,6),16)/255,f=Math.max(l,u,d),m=Math.min(l,u,d);let p=0,g=0;const x=(f+m)/2;if(f!==m){const j=f-m;switch(g=x>.5?j/(2-f-m):j/(f+m),f){case l:p=((u-d)/j+(ulocalStorage.getItem("accent-color")||"blue");y.useEffect(()=>{const f=localStorage.getItem("accent-color")||"blue";lL(f)},[]);const d=f=>{u(f),localStorage.setItem("accent-color",f),lL(f)};return i.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[i.jsx(JS,{value:"light",current:e,onChange:t,label:"浅色",description:"始终使用浅色主题"}),i.jsx(JS,{value:"dark",current:e,onChange:t,label:"深色",description:"始终使用深色主题"}),i.jsx(JS,{value:"system",current:e,onChange:t,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),i.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[i.jsxs("div",{children:[i.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),i.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[i.jsx(ba,{value:"blue",current:l,onChange:d,label:"蓝色",colorClass:"bg-blue-500"}),i.jsx(ba,{value:"purple",current:l,onChange:d,label:"紫色",colorClass:"bg-purple-500"}),i.jsx(ba,{value:"green",current:l,onChange:d,label:"绿色",colorClass:"bg-green-500"}),i.jsx(ba,{value:"orange",current:l,onChange:d,label:"橙色",colorClass:"bg-orange-500"}),i.jsx(ba,{value:"pink",current:l,onChange:d,label:"粉色",colorClass:"bg-pink-500"}),i.jsx(ba,{value:"red",current:l,onChange:d,label:"红色",colorClass:"bg-red-500"})]})]}),i.jsxs("div",{children:[i.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),i.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[i.jsx(ba,{value:"gradient-sunset",current:l,onChange:d,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),i.jsx(ba,{value:"gradient-ocean",current:l,onChange:d,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),i.jsx(ba,{value:"gradient-forest",current:l,onChange:d,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),i.jsx(ba,{value:"gradient-aurora",current:l,onChange:d,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),i.jsx(ba,{value:"gradient-fire",current:l,onChange:d,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),i.jsx(ba,{value:"gradient-twilight",current:l,onChange:d,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),i.jsxs("div",{children:[i.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),i.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[i.jsx("div",{className:"flex-1",children:i.jsx("input",{type:"color",value:l.startsWith("#")?l:"#3b82f6",onChange:f=>d(f.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),i.jsx("div",{className:"flex-1",children:i.jsx(Ne,{type:"text",value:l,onChange:f=>d(f.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),i.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),i.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[i.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"space-y-0.5 flex-1",children:[i.jsx(J,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),i.jsx(at,{id:"animations",checked:n,onCheckedChange:r})]})}),i.jsx("div",{className:"rounded-lg border bg-card p-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"space-y-0.5 flex-1",children:[i.jsx(J,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),i.jsx(at,{id:"waves-background",checked:a,onCheckedChange:o})]})})]})]})]})}function qxe(){const e=oa(),[t,n]=y.useState(""),[r,a]=y.useState(""),[o,l]=y.useState(!1),[u,d]=y.useState(!1),[f,m]=y.useState(!1),[p,g]=y.useState(!1),[x,j]=y.useState(!1),[b,w]=y.useState(!1),[N,A]=y.useState(""),[E,T]=y.useState(!1),{toast:C}=mr(),k=y.useMemo(()=>nye(r),[r]),O=()=>localStorage.getItem("access-token")||"",M=async F=>{try{await navigator.clipboard.writeText(F),j(!0),C({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>j(!1),2e3)}catch{C({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},I=async()=>{if(!r.trim()){C({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!k.isValid){const F=k.rules.filter(G=>!G.passed).map(G=>G.label).join(", ");C({title:"格式错误",description:`Token 不符合要求: ${F}`,variant:"destructive"});return}m(!0);try{const F=O(),G=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${F}`},body:JSON.stringify({new_token:r.trim()})}),L=await G.json();G.ok&&L.success?(localStorage.setItem("access-token",r.trim()),a(""),t&&n(r.trim()),C({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),e({to:"/auth"})},1500)):C({title:"更新失败",description:L.message||"无法更新 Token",variant:"destructive"})}catch(F){console.error("更新 Token 错误:",F),C({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{m(!1)}},z=async()=>{g(!0);try{const F=O(),G=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${F}`}}),L=await G.json();G.ok&&L.success?(localStorage.setItem("access-token",L.token),n(L.token),A(L.token),w(!0),T(!1),C({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):C({title:"生成失败",description:L.message||"无法生成新 Token",variant:"destructive"})}catch(F){console.error("生成 Token 错误:",F),C({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{g(!1)}},D=async()=>{try{await navigator.clipboard.writeText(N),T(!0),C({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{C({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},H=()=>{w(!1),setTimeout(()=>{A(""),T(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),e({to:"/auth"})},500)},V=F=>{F||H()};return i.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[i.jsx(nr,{open:b,onOpenChange:V,children:i.jsxs(Hn,{className:"sm:max-w-md",children:[i.jsxs(Wn,{children:[i.jsxs(Vn,{className:"flex items-center gap-2",children:[i.jsx(Gc,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),i.jsx(dr,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[i.jsx(J,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),i.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:N})]}),i.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Gc,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[i.jsx("p",{className:"font-semibold",children:"重要提示"}),i.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[i.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),i.jsx("li",{children:"请立即复制并保存到安全的位置"}),i.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),i.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),i.jsxs($r,{className:"gap-2 sm:gap-0",children:[i.jsx(ue,{variant:"outline",onClick:D,className:"gap-2",children:E?i.jsxs(i.Fragment,{children:[i.jsx(il,{className:"h-4 w-4 text-green-500"}),"已复制"]}):i.jsxs(i.Fragment,{children:[i.jsx(HN,{className:"h-4 w-4"}),"复制 Token"]})}),i.jsx(ue,{onClick:H,children:"我已保存,关闭"})]})]})}),i.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[i.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),i.jsx("div",{className:"space-y-3 sm:space-y-4",children:i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),i.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Ne,{id:"current-token",type:o?"text":"password",value:t||O(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),i.jsx("button",{onClick:()=>{t||n(O()),l(!o)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:o?"隐藏":"显示",children:o?i.jsx(VN,{className:"h-4 w-4 text-muted-foreground"}):i.jsx(Ua,{className:"h-4 w-4 text-muted-foreground"})})]}),i.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[i.jsx(ue,{variant:"outline",size:"icon",onClick:()=>M(O()),title:"复制到剪贴板",className:"flex-shrink-0",children:x?i.jsx(il,{className:"h-4 w-4 text-green-500"}):i.jsx(HN,{className:"h-4 w-4"})}),i.jsxs(Pn,{children:[i.jsx(ra,{asChild:!0,children:i.jsxs(ue,{variant:"outline",disabled:p,className:"gap-2 flex-1 sm:flex-none",children:[i.jsx(sl,{className:de("h-4 w-4",p&&"animate-spin")}),i.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),i.jsx("span",{className:"sm:hidden",children:"生成"})]})}),i.jsxs(yn,{children:[i.jsxs(xn,{children:[i.jsx(wn,{children:"确认重新生成 Token"}),i.jsx(jn,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),i.jsxs(bn,{children:[i.jsx(_n,{children:"取消"}),i.jsx(Sn,{onClick:z,children:"确认生成"})]})]})]})]})]}),i.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),i.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[i.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),i.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),i.jsxs("div",{className:"relative",children:[i.jsx(Ne,{id:"new-token",type:u?"text":"password",value:r,onChange:F=>a(F.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),i.jsx("button",{onClick:()=>d(!u),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:u?"隐藏":"显示",children:u?i.jsx(VN,{className:"h-4 w-4 text-muted-foreground"}):i.jsx(Ua,{className:"h-4 w-4 text-muted-foreground"})})]}),r&&i.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[i.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),i.jsx("div",{className:"space-y-1.5",children:k.rules.map(F=>i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[F.passed?i.jsx(Vo,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):i.jsx(UN,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),i.jsx("span",{className:de(F.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:F.label})]},F.id))}),k.isValid&&i.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:i.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[i.jsx(il,{className:"h-4 w-4"}),i.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),i.jsx(ue,{onClick:I,disabled:f||!k.isValid||!r,className:"w-full sm:w-auto",children:f?"更新中...":"更新自定义 Token"})]})]}),i.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[i.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),i.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[i.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),i.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),i.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),i.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),i.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),i.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function Fxe(){const e=oa(),{toast:t}=mr(),[n,r]=y.useState(!1),a=async()=>{r(!0);try{const o=localStorage.getItem("access-token"),l=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${o}`}}),u=await l.json();l.ok&&u.success?(t({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{e({to:"/setup"})},1e3)):t({title:"重置失败",description:u.message||"无法重置配置状态",variant:"destructive"})}catch(o){console.error("重置配置状态错误:",o),t({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{r(!1)}};return i.jsx("div",{className:"space-y-4 sm:space-y-6",children:i.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[i.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),i.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[i.jsx("div",{className:"space-y-2",children:i.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),i.jsxs(Pn,{children:[i.jsx(ra,{asChild:!0,children:i.jsxs(ue,{variant:"outline",disabled:n,className:"gap-2",children:[i.jsx(ege,{className:de("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),i.jsxs(yn,{children:[i.jsxs(xn,{children:[i.jsx(wn,{children:"确认重新配置"}),i.jsx(jn,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),i.jsxs(bn,{children:[i.jsx(_n,{children:"取消"}),i.jsx(Sn,{onClick:a,children:"确认重置"})]})]})]})]})]})})}function Uxe(){return i.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[i.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[i.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",tE]}),i.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[i.jsxs("p",{children:["版本: ",eE]}),i.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),i.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[i.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),i.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),i.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",i.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),i.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[i.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),i.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[i.jsx("li",{children:"React 19.2.0"}),i.jsx("li",{children:"TypeScript 5.7.2"}),i.jsx("li",{children:"Vite 6.0.7"}),i.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),i.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[i.jsx("li",{children:"shadcn/ui"}),i.jsx("li",{children:"Radix UI"}),i.jsx("li",{children:"Tailwind CSS 3.4.17"}),i.jsx("li",{children:"Lucide Icons"})]})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("p",{className:"font-medium text-foreground",children:"后端"}),i.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[i.jsx("li",{children:"Python 3.12+"}),i.jsx("li",{children:"FastAPI"}),i.jsx("li",{children:"Uvicorn"}),i.jsx("li",{children:"WebSocket"})]})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),i.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[i.jsx("li",{children:"Bun / npm"}),i.jsx("li",{children:"ESLint 9.17.0"}),i.jsx("li",{children:"PostCSS"})]})]})]})]}),i.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[i.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),i.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),i.jsx(Vt,{className:"h-[300px] sm:h-[400px]",children:i.jsxs("div",{className:"space-y-4 pr-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),i.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[i.jsx(Jt,{name:"React",description:"用户界面构建库",license:"MIT"}),i.jsx(Jt,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),i.jsx(Jt,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),i.jsx(Jt,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),i.jsx(Jt,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),i.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[i.jsx(Jt,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),i.jsx(Jt,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),i.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[i.jsx(Jt,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),i.jsx(Jt,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),i.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[i.jsx(Jt,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),i.jsx(Jt,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),i.jsx(Jt,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),i.jsx(Jt,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),i.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[i.jsx(Jt,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),i.jsx(Jt,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),i.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[i.jsx(Jt,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),i.jsx(Jt,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),i.jsx(Jt,{name:"Pydantic",description:"数据验证库",license:"MIT"}),i.jsx(Jt,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),i.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[i.jsx(Jt,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),i.jsx(Jt,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),i.jsx(Jt,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),i.jsx(Jt,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),i.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[i.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),i.jsxs("div",{className:"space-y-3",children:[i.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:i.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[i.jsx("div",{className:"flex-shrink-0 mt-0.5",children:i.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:i.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),i.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),i.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Jt({name:e,description:t,license:n}){return i.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"font-medium text-foreground truncate",children:e}),i.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:t})]}),i.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:n})]})}function JS({value:e,current:t,onChange:n,label:r,description:a}){const o=t===e;return i.jsxs("button",{onClick:()=>n(e),className:de("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",o?"border-primary bg-accent":"border-border"),children:[o&&i.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("div",{className:"text-sm sm:text-base font-medium",children:r}),i.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:a})]}),i.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[e==="light"&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),i.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),i.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),e==="dark"&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),i.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),i.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),e==="system"&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),i.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),i.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function ba({value:e,current:t,onChange:n,label:r,colorClass:a}){const o=t===e;return i.jsxs("button",{onClick:()=>n(e),className:de("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",o?"border-primary bg-accent":"border-border"),children:[o&&i.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),i.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[i.jsx("div",{className:de("h-8 w-8 sm:h-10 sm:w-10 rounded-full",a)}),i.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:r})]})]})}class Hxe{grad3;p;perm;constructor(t=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let n=0;n<256;n++)this.p[n]=Math.floor(Math.random()*256);this.perm=[];for(let n=0;n<512;n++)this.perm[n]=this.p[n&255]}dot(t,n,r){return t[0]*n+t[1]*r}mix(t,n,r){return(1-r)*t+r*n}fade(t){return t*t*t*(t*(t*6-15)+10)}perlin2(t,n){const r=Math.floor(t)&255,a=Math.floor(n)&255;t-=Math.floor(t),n-=Math.floor(n);const o=this.fade(t),l=this.fade(n),u=this.perm[r]+a,d=this.perm[u],f=this.perm[u+1],m=this.perm[r+1]+a,p=this.perm[m],g=this.perm[m+1];return this.mix(this.mix(this.dot(this.grad3[d%12],t,n),this.dot(this.grad3[p%12],t-1,n),o),this.mix(this.dot(this.grad3[f%12],t,n-1),this.dot(this.grad3[g%12],t-1,n-1),o),l)}}function Wxe(){const e=y.useRef(null),t=y.useRef(null),n=y.useRef(void 0),r=y.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new Hxe(Math.random()),bounding:null});return y.useEffect(()=>{const a=t.current,o=e.current;if(!a||!o)return;const l=r.current,u=()=>{const b=a.getBoundingClientRect();l.bounding=b,o.style.width=`${b.width}px`,o.style.height=`${b.height}px`},d=()=>{if(!l.bounding)return;const{width:b,height:w}=l.bounding;l.lines=[],l.paths.forEach(I=>I.remove()),l.paths=[];const N=10,A=32,E=b+200,T=w+30,C=Math.ceil(E/N),k=Math.ceil(T/A),O=(b-N*C)/2,M=(w-A*k)/2;for(let I=0;I<=C;I++){const z=[];for(let H=0;H<=k;H++){const V={x:O+N*I,y:M+A*H,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};z.push(V)}const D=document.createElementNS("http://www.w3.org/2000/svg","path");o.appendChild(D),l.paths.push(D),l.lines.push(z)}},f=b=>{const{lines:w,mouse:N,noise:A}=l;w.forEach(E=>{E.forEach(T=>{const C=A.perlin2((T.x+b*.0125)*.002,(T.y+b*.005)*.0015)*12;T.wave.x=Math.cos(C)*32,T.wave.y=Math.sin(C)*16;const k=T.x-N.sx,O=T.y-N.sy,M=Math.hypot(k,O),I=Math.max(175,N.vs);if(M{const N={x:b.x+b.wave.x+(w?b.cursor.x:0),y:b.y+b.wave.y+(w?b.cursor.y:0)};return N.x=Math.round(N.x*10)/10,N.y=Math.round(N.y*10)/10,N},p=()=>{const{lines:b,paths:w}=l;b.forEach((N,A)=>{let E=m(N[0],!1),T=`M ${E.x} ${E.y}`;N.forEach((C,k)=>{const O=k===N.length-1;E=m(C,!O),T+=`L ${E.x} ${E.y}`}),w[A].setAttribute("d",T)})},g=b=>{const{mouse:w}=l;w.sx+=(w.x-w.sx)*.1,w.sy+=(w.y-w.sy)*.1;const N=w.x-w.lx,A=w.y-w.ly,E=Math.hypot(N,A);w.v=E,w.vs+=(E-w.vs)*.1,w.vs=Math.min(100,w.vs),w.lx=w.x,w.ly=w.y,w.a=Math.atan2(A,N),a&&(a.style.setProperty("--x",`${w.sx}px`),a.style.setProperty("--y",`${w.sy}px`)),f(b),p(),n.current=requestAnimationFrame(g)},x=b=>{if(!l.bounding)return;const{mouse:w}=l;w.x=b.pageX-l.bounding.left,w.y=b.pageY-l.bounding.top+window.scrollY,w.set||(w.sx=w.x,w.sy=w.y,w.lx=w.x,w.ly=w.y,w.set=!0)},j=()=>{u(),d()};return u(),d(),window.addEventListener("resize",j),window.addEventListener("mousemove",x),n.current=requestAnimationFrame(g),()=>{window.removeEventListener("resize",j),window.removeEventListener("mousemove",x),n.current&&cancelAnimationFrame(n.current)}},[]),i.jsxs("div",{ref:t,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[i.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),i.jsx("svg",{ref:e,style:{display:"block",width:"100%",height:"100%"},children:i.jsx("style",{children:` path { fill: none; stroke: hsl(var(--primary) / 0.20); stroke-width: 1px; } `})})]})}function Vxe(){const e=oa();y.useEffect(()=>{localStorage.getItem("access-token")||e({to:"/auth"})},[e])}function h8(){return!!localStorage.getItem("access-token")}function Gxe(){const[e,t]=y.useState(""),[n,r]=y.useState(!1),[a,o]=y.useState(""),l=oa(),{enableWavesBackground:u,setEnableWavesBackground:d}=oF(),{theme:f,setTheme:m}=JO();y.useEffect(()=>{h8()&&l({to:"/"})},[l]);const g=f==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":f,x=()=>{m(g==="dark"?"light":"dark")},j=async b=>{if(b.preventDefault(),o(""),!e.trim()){o("请输入 Access Token");return}r(!0);try{const w=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e.trim()})}),N=await w.json();if(w.ok&&N.valid){localStorage.setItem("access-token",e.trim());const A=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${e.trim()}`}}),E=await A.json();A.ok&&E.is_first_setup?l({to:"/setup"}):l({to:"/"})}else o(N.message||"Token 验证失败,请检查后重试")}catch(w){console.error("Token 验证错误:",w),o("连接服务器失败,请检查网络连接")}finally{r(!1)}};return i.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[u&&i.jsx(Wxe,{}),i.jsxs(st,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[i.jsx("button",{onClick:x,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:g==="dark"?"切换到浅色模式":"切换到深色模式",children:g==="dark"?i.jsx(ZN,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):i.jsx(XN,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),i.jsxs(qt,{className:"space-y-4 text-center",children:[i.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:i.jsx(HI,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Ft,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),i.jsx(er,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),i.jsx(on,{children:i.jsxs("form",{onSubmit:j,className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),i.jsxs("div",{className:"relative",children:[i.jsx($ve,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),i.jsx(Ne,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:e,onChange:b=>t(b.target.value),className:de("pl-10",a&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),a&&i.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[i.jsx(bg,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),i.jsx("span",{children:a})]}),i.jsx(ue,{type:"submit",className:"w-full",disabled:n,children:n?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),i.jsxs(nr,{children:[i.jsx(WF,{asChild:!0,children:i.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[i.jsx(mve,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),i.jsxs(Hn,{className:"sm:max-w-md",children:[i.jsxs(Wn,{children:[i.jsxs(Vn,{className:"flex items-center gap-2",children:[i.jsx(HI,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),i.jsx(dr,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(bge,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),i.jsxs("div",{className:"flex-1 space-y-2",children:[i.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),i.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[i.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),i.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),i.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(XO,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),i.jsxs("div",{className:"flex-1 space-y-2",children:[i.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),i.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:i.jsx("code",{className:"text-primary",children:"data/webui.json"})}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",i.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),i.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:i.jsxs("div",{className:"flex gap-2",children:[i.jsx(bg,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),i.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[i.jsx("p",{className:"font-semibold",children:"安全提示"}),i.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[i.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),i.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),i.jsxs(Pn,{children:[i.jsx(ra,{asChild:!0,children:i.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[i.jsx(dh,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),i.jsxs(yn,{children:[i.jsxs(xn,{children:[i.jsxs(wn,{className:"flex items-center gap-2",children:[i.jsx(dh,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),i.jsx(jn,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),i.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:i.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),i.jsxs(bn,{children:[i.jsx(_n,{children:"取消"}),i.jsx(Sn,{onClick:()=>d(!1),children:"关闭动画"})]})]})]})]})})]}),i.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:i.jsx("p",{children:rye})})]})}function Yxe(e,t=[]){let n=[];function r(o,l){const u=y.createContext(l);u.displayName=o+"Context";const d=n.length;n=[...n,l];const f=p=>{const{scope:g,children:x,...j}=p,b=g?.[e]?.[d]||u,w=y.useMemo(()=>j,Object.values(j));return i.jsx(b.Provider,{value:w,children:x})};f.displayName=o+"Provider";function m(p,g){const x=g?.[e]?.[d]||u,j=y.useContext(x);if(j)return j;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[f,m]}const a=()=>{const o=n.map(l=>y.createContext(l));return function(u){const d=u?.[e]||o;return y.useMemo(()=>({[`__scope${e}`]:{...u,[e]:d}}),[u,d])}};return a.scopeName=e,[r,Kxe(a,...t)]}function Kxe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){const l=r.reduce((u,{useScope:d,scopeName:f})=>{const p=d(o)[`__scope${f}`];return{...u,...p}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}var Xxe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],m8=Xxe.reduce((e,t)=>{const n=zh(`Primitive.${t}`),r=y.forwardRef((a,o)=>{const{asChild:l,...u}=a,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(d,{...u,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),uE="Progress",dE=100,[Zxe]=Yxe(uE),[Qxe,Jxe]=Zxe(uE),p8=y.forwardRef((e,t)=>{const{__scopeProgress:n,value:r=null,max:a,getValueLabel:o=ebe,...l}=e;(a||a===0)&&!cL(a)&&console.error(tbe(`${a}`,"Progress"));const u=cL(a)?a:dE;r!==null&&!uL(r,u)&&console.error(nbe(`${r}`,"Progress"));const d=uL(r,u)?r:null,f=Cg(d)?o(d,u):void 0;return i.jsx(Qxe,{scope:n,value:d,max:u,children:i.jsx(m8.div,{"aria-valuemax":u,"aria-valuemin":0,"aria-valuenow":Cg(d)?d:void 0,"aria-valuetext":f,role:"progressbar","data-state":y8(d,u),"data-value":d??void 0,"data-max":u,...l,ref:t})})});p8.displayName=uE;var v8="ProgressIndicator",g8=y.forwardRef((e,t)=>{const{__scopeProgress:n,...r}=e,a=Jxe(v8,n);return i.jsx(m8.div,{"data-state":y8(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...r,ref:t})});g8.displayName=v8;function ebe(e,t){return`${Math.round(e/t*100)}%`}function y8(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Cg(e){return typeof e=="number"}function cL(e){return Cg(e)&&!isNaN(e)&&e>0}function uL(e,t){return Cg(e)&&!isNaN(e)&&e<=t&&e>=0}function tbe(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${dE}\`.`}function nbe(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or ${dE} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. Defaulting to \`null\`.`}var x8=p8,rbe=g8;const fE=y.forwardRef(({className:e,value:t,...n},r)=>i.jsx(x8,{ref:r,className:de("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...n,children:i.jsx(rbe,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));fE.displayName=x8.displayName;const Wt=y.forwardRef(({className:e,...t},n)=>i.jsx("textarea",{className:de("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));Wt.displayName="Textarea";var abe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ibe=abe.reduce((e,t)=>{const n=zh(`Primitive.${t}`),r=y.forwardRef((a,o)=>{const{asChild:l,...u}=a,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(d,{...u,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),obe="Separator",dL="horizontal",sbe=["horizontal","vertical"],b8=y.forwardRef((e,t)=>{const{decorative:n,orientation:r=dL,...a}=e,o=lbe(r)?r:dL,u=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return i.jsx(ibe.div,{"data-orientation":o,...u,...a,ref:t})});b8.displayName=obe;function lbe(e){return sbe.includes(e)}var w8=b8;const hh=y.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},a)=>i.jsx(w8,{ref:a,decorative:n,orientation:t,className:de("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));hh.displayName=w8.displayName;const cbe=qh("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Dt({className:e,variant:t,...n}){return i.jsx("div",{className:de(cbe({variant:t}),e),...n})}function ube({config:e,onChange:t}){const n=a=>{a.trim()&&!e.alias_names.includes(a.trim())&&t({...e,alias_names:[...e.alias_names,a.trim()]})},r=a=>{t({...e,alias_names:e.alias_names.filter((o,l)=>l!==a)})};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"space-y-3",children:[i.jsx(J,{htmlFor:"qq_account",children:"QQ账号 *"}),i.jsx(Ne,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:e.qq_account||"",onChange:a=>t({...e,qq_account:Number(a.target.value)})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsx(J,{htmlFor:"nickname",children:"昵称 *"}),i.jsx(Ne,{id:"nickname",placeholder:"请输入机器人的昵称",value:e.nickname,onChange:a=>t({...e,nickname:a.target.value})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsx(J,{children:"别名"}),i.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:e.alias_names.map((a,o)=>i.jsxs(Dt,{variant:"secondary",className:"gap-1",children:[a,i.jsx("button",{type:"button",onClick:()=>r(o),className:"ml-1 hover:text-destructive",children:i.jsx(Bh,{className:"h-3 w-3"})})]},o))}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Ne,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:a=>{a.key==="Enter"&&(n(a.target.value),a.target.value="")}}),i.jsx(ue,{type:"button",variant:"outline",onClick:()=>{const a=document.getElementById("alias_input");a&&(n(a.value),a.value="")},children:"添加"})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function dbe({config:e,onChange:t}){return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"space-y-3",children:[i.jsx(J,{htmlFor:"personality",children:"人格特征 *"}),i.jsx(Wt,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:e.personality,onChange:n=>t({...e,personality:n.target.value}),rows:3}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsx(J,{htmlFor:"reply_style",children:"表达风格 *"}),i.jsx(Wt,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:e.reply_style,onChange:n=>t({...e,reply_style:n.target.value}),rows:3}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsx(J,{htmlFor:"interest",children:"兴趣 *"}),i.jsx(Wt,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:e.interest,onChange:n=>t({...e,interest:n.target.value}),rows:2}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),i.jsx(hh,{}),i.jsxs("div",{className:"space-y-3",children:[i.jsx(J,{htmlFor:"plan_style",children:"群聊说话规则 *"}),i.jsx(Wt,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:e.plan_style,onChange:n=>t({...e,plan_style:n.target.value}),rows:4}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsx(J,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),i.jsx(Wt,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:e.private_plan_style,onChange:n=>t({...e,private_plan_style:n.target.value}),rows:3}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function fbe({config:e,onChange:t}){return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(J,{htmlFor:"emoji_chance",children:"表情包激活概率"}),i.jsxs("span",{className:"text-sm text-muted-foreground",children:[(e.emoji_chance*100).toFixed(0),"%"]})]}),i.jsx(Ne,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:e.emoji_chance,onChange:n=>t({...e,emoji_chance:Number(n.target.value)})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsx(J,{htmlFor:"max_reg_num",children:"最大表情包数量"}),i.jsx(Ne,{id:"max_reg_num",type:"number",min:"1",max:"200",value:e.max_reg_num,onChange:n=>t({...e,max_reg_num:Number(n.target.value)})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(J,{htmlFor:"do_replace",children:"达到最大数量时替换"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),i.jsx(at,{id:"do_replace",checked:e.do_replace,onCheckedChange:n=>t({...e,do_replace:n})})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsx(J,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),i.jsx(Ne,{id:"check_interval",type:"number",min:"1",max:"120",value:e.check_interval,onChange:n=>t({...e,check_interval:Number(n.target.value)})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),i.jsx(hh,{}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(J,{htmlFor:"steal_emoji",children:"偷取表情包"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),i.jsx(at,{id:"steal_emoji",checked:e.steal_emoji,onCheckedChange:n=>t({...e,steal_emoji:n})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(J,{htmlFor:"content_filtration",children:"启用表情包过滤"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),i.jsx(at,{id:"content_filtration",checked:e.content_filtration,onCheckedChange:n=>t({...e,content_filtration:n})})]}),e.content_filtration&&i.jsxs("div",{className:"space-y-3",children:[i.jsx(J,{htmlFor:"filtration_prompt",children:"过滤要求"}),i.jsx(Ne,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:e.filtration_prompt,onChange:n=>t({...e,filtration_prompt:n.target.value})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function hbe({config:e,onChange:t}){return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(J,{htmlFor:"enable_tool",children:"启用工具系统"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),i.jsx(at,{id:"enable_tool",checked:e.enable_tool,onCheckedChange:n=>t({...e,enable_tool:n})})]}),i.jsx(hh,{}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(J,{htmlFor:"enable_mood",children:"启用情绪系统"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),i.jsx(at,{id:"enable_mood",checked:e.enable_mood,onCheckedChange:n=>t({...e,enable_mood:n})})]}),e.enable_mood&&i.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[i.jsxs("div",{className:"space-y-3",children:[i.jsx(J,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),i.jsx(Ne,{id:"mood_update_threshold",type:"number",min:"0.1",max:"10",step:"0.1",value:e.mood_update_threshold||1,onChange:n=>t({...e,mood_update_threshold:Number(n.target.value)})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsx(J,{htmlFor:"emotion_style",children:"情感特征"}),i.jsx(Wt,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:e.emotion_style||"",onChange:n=>t({...e,emotion_style:n.target.value}),rows:2}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),i.jsx(hh,{}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(J,{htmlFor:"all_global",children:"启用全局黑话模式"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),i.jsx(at,{id:"all_global",checked:e.all_global,onCheckedChange:n=>t({...e,all_global:n})})]})]})}async function Qe(e,t){const n=await fetch(e,t);if(n.status===401)throw localStorage.removeItem("access-token"),window.location.href="/auth",new Error("认证失败,请重新登录");return n}function lt(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function mbe(){const e=await Qe("/api/webui/config/bot",{method:"GET",headers:lt()});if(!e.ok)throw new Error("读取Bot配置失败");const n=(await e.json()).config.bot||{};return{qq_account:n.qq_account||0,nickname:n.nickname||"",alias_names:n.alias_names||[]}}async function pbe(){const e=await Qe("/api/webui/config/bot",{method:"GET",headers:lt()});if(!e.ok)throw new Error("读取人格配置失败");const n=(await e.json()).config.personality||{};return{personality:n.personality||"",reply_style:n.reply_style||"",interest:n.interest||"",plan_style:n.plan_style||"",private_plan_style:n.private_plan_style||""}}async function vbe(){const e=await Qe("/api/webui/config/bot",{method:"GET",headers:lt()});if(!e.ok)throw new Error("读取表情包配置失败");const n=(await e.json()).config.emoji||{};return{emoji_chance:n.emoji_chance??.4,max_reg_num:n.max_reg_num??40,do_replace:n.do_replace??!0,check_interval:n.check_interval??10,steal_emoji:n.steal_emoji??!0,content_filtration:n.content_filtration??!1,filtration_prompt:n.filtration_prompt||""}}async function gbe(){const e=await Qe("/api/webui/config/bot",{method:"GET",headers:lt()});if(!e.ok)throw new Error("读取其他配置失败");const n=(await e.json()).config,r=n.tool||{},a=n.mood||{},o=n.jargon||{};return{enable_tool:r.enable_tool??!0,enable_mood:a.enable_mood??!1,mood_update_threshold:a.mood_update_threshold,emotion_style:a.emotion_style,all_global:o.all_global??!0}}async function ybe(e){const t=await Qe("/api/webui/config/bot/section/bot",{method:"POST",headers:lt(),body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await t.json()}async function xbe(e){const t=await Qe("/api/webui/config/bot/section/personality",{method:"POST",headers:lt(),body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.detail||"保存人格配置失败")}return await t.json()}async function bbe(e){const t=await Qe("/api/webui/config/bot/section/emoji",{method:"POST",headers:lt(),body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.detail||"保存表情包配置失败")}return await t.json()}async function wbe(e){const t=[];t.push(Qe("/api/webui/config/bot/section/tool",{method:"POST",headers:lt(),body:JSON.stringify({enable_tool:e.enable_tool})})),t.push(Qe("/api/webui/config/bot/section/jargon",{method:"POST",headers:lt(),body:JSON.stringify({all_global:e.all_global})}));const n={enable_mood:e.enable_mood};e.enable_mood&&(n.mood_update_threshold=e.mood_update_threshold||1,n.emotion_style=e.emotion_style||""),t.push(Qe("/api/webui/config/bot/section/mood",{method:"POST",headers:lt(),body:JSON.stringify(n)}));const r=await Promise.all(t);for(const a of r)if(!a.ok){const o=await a.json();throw new Error(o.detail||"保存其他配置失败")}return{success:!0}}async function fL(){const e=localStorage.getItem("access-token"),t=await Qe("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${e}`}});if(!t.ok){const n=await t.json();throw new Error(n.message||"标记配置完成失败")}return await t.json()}function jbe(){const e=oa(),{toast:t}=mr(),[n,r]=y.useState(0),[a,o]=y.useState(!1),[l,u]=y.useState(!1),[d,f]=y.useState(!0),[m,p]=y.useState({qq_account:0,nickname:"",alias_names:[]}),[g,x]=y.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 3.请控制你的发言频率,不要太过频繁的发言 4.如果有人对你感到厌烦,请减少回复 5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 3.某句话如果已经被回复过,不要重复回复`}),[j,b]=y.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[w,N]=y.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遭遇特定事件的时候起伏较大",all_global:!0}),A=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:Jpe},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:nF},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:QO},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:Vc},{id:"complete",title:"完成设置",description:"后续配置提示",icon:dh}],E=(n+1)/A.length*100;y.useEffect(()=>{(async()=>{try{f(!0);const[D,H,V,F]=await Promise.all([mbe(),pbe(),vbe(),gbe()]);p(D),x(H),b(V),N(F)}catch(D){t({title:"加载配置失败",description:D instanceof Error?D.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{f(!1)}})()},[t]);const T=async()=>{u(!0);try{switch(n){case 0:await ybe(m);break;case 1:await xbe(g);break;case 2:await bbe(j);break;case 3:await wbe(w);break}return t({title:"保存成功",description:`${A[n].title}配置已保存`}),!0}catch(z){return t({title:"保存失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"}),!1}finally{u(!1)}},C=async()=>{await T()&&n{n>0&&r(n-1)},O=async()=>{o(!0);try{if(!await T()){o(!1);return}await fL(),t({title:"配置完成",description:"所有配置已保存,正在跳转..."}),setTimeout(()=>{e({to:"/"})},500)}catch(z){t({title:"完成失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"})}finally{o(!1)}},M=async()=>{try{await fL(),e({to:"/"})}catch(z){t({title:"跳过失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"})}},I=()=>{switch(n){case 0:return i.jsx(ube,{config:m,onChange:p});case 1:return i.jsx(dbe,{config:g,onChange:x});case 2:return i.jsx(fbe,{config:j,onChange:b});case 3:return i.jsx(hbe,{config:w,onChange:N});case 4:return i.jsxs("div",{className:"space-y-6 text-center py-8",children:[i.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:i.jsx(dh,{className:"h-8 w-8 text-primary",strokeWidth:2})}),i.jsxs("div",{className:"space-y-3",children:[i.jsx("h3",{className:"text-xl font-semibold",children:"模型配置"}),i.jsx("p",{className:"text-muted-foreground max-w-md mx-auto",children:"为了让机器人正常工作,您需要配置 AI 模型提供商和模型。"})]}),i.jsxs("div",{className:"rounded-lg border bg-muted/50 p-6 max-w-md mx-auto text-left space-y-4",children:[i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("div",{className:"mt-0.5",children:i.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"1"})}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium",children:"配置 API 提供商"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → API 提供商"中添加您的 API 提供商信息'})]})]}),i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("div",{className:"mt-0.5",children:i.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"2"})}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium",children:"添加模型"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型列表"中添加需要使用的模型'})]})]}),i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("div",{className:"mt-0.5",children:i.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"3"})}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium",children:"配置模型任务"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型任务配置"中为不同任务分配模型'})]})]})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"💡 提示:完成向导后,您可以在系统设置中进行详细的模型配置"})]});default:return null}};return i.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[i.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[i.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),i.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),d?i.jsxs("div",{className:"relative z-10 text-center",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:i.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),i.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),i.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[i.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:i.jsx(pge,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),i.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),i.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",tE," 的初始配置"]})]}),i.jsxs("div",{className:"mb-6 md:mb-8",children:[i.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[i.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",A.length]}),i.jsxs("span",{className:"font-medium text-primary",children:[Math.round(E),"%"]})]}),i.jsx(fE,{value:E,className:"h-2"})]}),i.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:A.map((z,D)=>{const H=z.icon;return i.jsxs("div",{className:de("flex flex-1 flex-col items-center gap-1 md:gap-2",De({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[i.jsx(Sg,{className:"h-4 w-4"}),"返回首页"]}),i.jsxs(ue,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[i.jsx(Xq,{className:"h-4 w-4"}),"返回上一页"]})]}),i.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:i.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var S8=["PageUp","PageDown"],_8=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],N8={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Gu="Slider",[eC,Sbe,_be]=Ch(Gu),[C8]=hr(Gu,[_be]),[Nbe,By]=C8(Gu),O8=y.forwardRef((e,t)=>{const{name:n,min:r=0,max:a=100,step:o=1,orientation:l="horizontal",disabled:u=!1,minStepsBetweenThumbs:d=0,defaultValue:f=[r],value:m,onValueChange:p=()=>{},onValueCommit:g=()=>{},inverted:x=!1,form:j,...b}=e,w=y.useRef(new Set),N=y.useRef(0),E=l==="horizontal"?Cbe:Obe,[T=[],C]=Na({prop:m,defaultProp:f,onChange:D=>{[...w.current][N.current]?.focus(),p(D)}}),k=y.useRef(T);function O(D){const H=Mbe(T,D);z(D,H)}function M(D){z(D,N.current)}function I(){const D=k.current[N.current];T[N.current]!==D&&g(T)}function z(D,H,{commit:V}={commit:!1}){const F=$be(o),G=Ibe(Math.round((D-r)/o)*o+r,F),L=Ef(G,[r,a]);C((R=[])=>{const U=Tbe(R,L,H);if(Dbe(U,d*o)){N.current=U.indexOf(L);const K=String(U)!==String(R);return K&&V&&g(U),K?U:R}else return R})}return i.jsx(Nbe,{scope:e.__scopeSlider,name:n,disabled:u,min:r,max:a,valueIndexToChangeRef:N,thumbs:w.current,values:T,orientation:l,form:j,children:i.jsx(eC.Provider,{scope:e.__scopeSlider,children:i.jsx(eC.Slot,{scope:e.__scopeSlider,children:i.jsx(E,{"aria-disabled":u,"data-disabled":u?"":void 0,...b,ref:t,onPointerDown:Se(b.onPointerDown,()=>{u||(k.current=T)}),min:r,max:a,inverted:x,onSlideStart:u?void 0:O,onSlideMove:u?void 0:M,onSlideEnd:u?void 0:I,onHomeKeyDown:()=>!u&&z(r,0,{commit:!0}),onEndKeyDown:()=>!u&&z(a,T.length-1,{commit:!0}),onStepKeyDown:({event:D,direction:H})=>{if(!u){const G=S8.includes(D.key)||D.shiftKey&&_8.includes(D.key)?10:1,L=N.current,R=T[L],U=o*G*H;z(R+U,L,{commit:!0})}}})})})})});O8.displayName=Gu;var[E8,A8]=C8(Gu,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Cbe=y.forwardRef((e,t)=>{const{min:n,max:r,dir:a,inverted:o,onSlideStart:l,onSlideMove:u,onSlideEnd:d,onStepKeyDown:f,...m}=e,[p,g]=y.useState(null),x=qe(t,E=>g(E)),j=y.useRef(void 0),b=Lu(a),w=b==="ltr",N=w&&!o||!w&&o;function A(E){const T=j.current||p.getBoundingClientRect(),C=[0,T.width],O=hE(C,N?[n,r]:[r,n]);return j.current=T,O(E-T.left)}return i.jsx(E8,{scope:e.__scopeSlider,startEdge:N?"left":"right",endEdge:N?"right":"left",direction:N?1:-1,size:"width",children:i.jsx(T8,{dir:b,"data-orientation":"horizontal",...m,ref:x,style:{...m.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:E=>{const T=A(E.clientX);l?.(T)},onSlideMove:E=>{const T=A(E.clientX);u?.(T)},onSlideEnd:()=>{j.current=void 0,d?.()},onStepKeyDown:E=>{const C=N8[N?"from-left":"from-right"].includes(E.key);f?.({event:E,direction:C?-1:1})}})})}),Obe=y.forwardRef((e,t)=>{const{min:n,max:r,inverted:a,onSlideStart:o,onSlideMove:l,onSlideEnd:u,onStepKeyDown:d,...f}=e,m=y.useRef(null),p=qe(t,m),g=y.useRef(void 0),x=!a;function j(b){const w=g.current||m.current.getBoundingClientRect(),N=[0,w.height],E=hE(N,x?[r,n]:[n,r]);return g.current=w,E(b-w.top)}return i.jsx(E8,{scope:e.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:i.jsx(T8,{"data-orientation":"vertical",...f,ref:p,style:{...f.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:b=>{const w=j(b.clientY);o?.(w)},onSlideMove:b=>{const w=j(b.clientY);l?.(w)},onSlideEnd:()=>{g.current=void 0,u?.()},onStepKeyDown:b=>{const N=N8[x?"from-bottom":"from-top"].includes(b.key);d?.({event:b,direction:N?-1:1})}})})}),T8=y.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:o,onHomeKeyDown:l,onEndKeyDown:u,onStepKeyDown:d,...f}=e,m=By(Gu,n);return i.jsx(Pe.span,{...f,ref:t,onKeyDown:Se(e.onKeyDown,p=>{p.key==="Home"?(l(p),p.preventDefault()):p.key==="End"?(u(p),p.preventDefault()):S8.concat(_8).includes(p.key)&&(d(p),p.preventDefault())}),onPointerDown:Se(e.onPointerDown,p=>{const g=p.target;g.setPointerCapture(p.pointerId),p.preventDefault(),m.thumbs.has(g)?g.focus():r(p)}),onPointerMove:Se(e.onPointerMove,p=>{p.target.hasPointerCapture(p.pointerId)&&a(p)}),onPointerUp:Se(e.onPointerUp,p=>{const g=p.target;g.hasPointerCapture(p.pointerId)&&(g.releasePointerCapture(p.pointerId),o(p))})})}),k8="SliderTrack",M8=y.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,a=By(k8,n);return i.jsx(Pe.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:t})});M8.displayName=k8;var tC="SliderRange",P8=y.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,a=By(tC,n),o=A8(tC,n),l=y.useRef(null),u=qe(t,l),d=a.values.length,f=a.values.map(g=>$8(g,a.min,a.max)),m=d>1?Math.min(...f):0,p=100-Math.max(...f);return i.jsx(Pe.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:u,style:{...e.style,[o.startEdge]:m+"%",[o.endEdge]:p+"%"}})});P8.displayName=tC;var nC="SliderThumb",R8=y.forwardRef((e,t)=>{const n=Sbe(e.__scopeSlider),[r,a]=y.useState(null),o=qe(t,u=>a(u)),l=y.useMemo(()=>r?n().findIndex(u=>u.ref.current===r):-1,[n,r]);return i.jsx(Ebe,{...e,ref:o,index:l})}),Ebe=y.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:a,...o}=e,l=By(nC,n),u=A8(nC,n),[d,f]=y.useState(null),m=qe(t,A=>f(A)),p=d?l.form||!!d.closest("form"):!0,g=ky(d),x=l.values[r],j=x===void 0?0:$8(x,l.min,l.max),b=kbe(r,l.values.length),w=g?.[u.size],N=w?Pbe(w,j,u.direction):0;return y.useEffect(()=>{if(d)return l.thumbs.add(d),()=>{l.thumbs.delete(d)}},[d,l.thumbs]),i.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[u.startEdge]:`calc(${j}% + ${N}px)`},children:[i.jsx(eC.ItemSlot,{scope:e.__scopeSlider,children:i.jsx(Pe.span,{role:"slider","aria-label":e["aria-label"]||b,"aria-valuemin":l.min,"aria-valuenow":x,"aria-valuemax":l.max,"aria-orientation":l.orientation,"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,tabIndex:l.disabled?void 0:0,...o,ref:m,style:x===void 0?{display:"none"}:e.style,onFocus:Se(e.onFocus,()=>{l.valueIndexToChangeRef.current=r})})}),p&&i.jsx(D8,{name:a??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:x},r)]})});R8.displayName=nC;var Abe="RadioBubbleInput",D8=y.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{const a=y.useRef(null),o=qe(a,r),l=Ty(t);return y.useEffect(()=>{const u=a.current;if(!u)return;const d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==t&&m){const p=new Event("input",{bubbles:!0});m.call(u,t),u.dispatchEvent(p)}},[l,t]),i.jsx(Pe.input,{style:{display:"none"},...n,ref:o,defaultValue:t})});D8.displayName=Abe;function Tbe(e=[],t,n){const r=[...e];return r[n]=t,r.sort((a,o)=>a-o)}function $8(e,t,n){const o=100/(n-t)*(e-t);return Ef(o,[0,100])}function kbe(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function Mbe(e,t){if(e.length===1)return 0;const n=e.map(a=>Math.abs(a-t)),r=Math.min(...n);return n.indexOf(r)}function Pbe(e,t,n){const r=e/2,o=hE([0,50],[0,r]);return(r-o(t)*n)*n}function Rbe(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Dbe(e,t){if(t>0){const n=Rbe(e);return Math.min(...n)>=t}return!0}function hE(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function $be(e){return(String(e).split(".")[1]||"").length}function Ibe(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var I8=O8,Lbe=M8,Bbe=P8,zbe=R8;const mE=y.forwardRef(({className:e,...t},n)=>i.jsxs(I8,{ref:n,className:de("relative flex w-full touch-none select-none items-center",e),...t,children:[i.jsx(Lbe,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:i.jsx(Bbe,{className:"absolute h-full bg-primary"})}),i.jsx(zbe,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));mE.displayName=I8.displayName;const qbe=["top","right","bottom","left"],Jo=Math.min,Jr=Math.max,Og=Math.round,Wp=Math.floor,mi=e=>({x:e,y:e}),Fbe={left:"right",right:"left",bottom:"top",top:"bottom"},Ube={start:"end",end:"start"};function rC(e,t,n){return Jr(e,Jo(t,n))}function io(e,t){return typeof e=="function"?e(t):e}function oo(e){return e.split("-")[0]}function Yu(e){return e.split("-")[1]}function pE(e){return e==="x"?"y":"x"}function vE(e){return e==="y"?"height":"width"}const Hbe=new Set(["top","bottom"]);function ci(e){return Hbe.has(oo(e))?"y":"x"}function gE(e){return pE(ci(e))}function Wbe(e,t,n){n===void 0&&(n=!1);const r=Yu(e),a=gE(e),o=vE(a);let l=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(l=Eg(l)),[l,Eg(l)]}function Vbe(e){const t=Eg(e);return[aC(e),t,aC(t)]}function aC(e){return e.replace(/start|end/g,t=>Ube[t])}const hL=["left","right"],mL=["right","left"],Gbe=["top","bottom"],Ybe=["bottom","top"];function Kbe(e,t,n){switch(e){case"top":case"bottom":return n?t?mL:hL:t?hL:mL;case"left":case"right":return t?Gbe:Ybe;default:return[]}}function Xbe(e,t,n,r){const a=Yu(e);let o=Kbe(oo(e),n==="start",r);return a&&(o=o.map(l=>l+"-"+a),t&&(o=o.concat(o.map(aC)))),o}function Eg(e){return e.replace(/left|right|bottom|top/g,t=>Fbe[t])}function Zbe(e){return{top:0,right:0,bottom:0,left:0,...e}}function L8(e){return typeof e!="number"?Zbe(e):{top:e,right:e,bottom:e,left:e}}function Ag(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function pL(e,t,n){let{reference:r,floating:a}=e;const o=ci(t),l=gE(t),u=vE(l),d=oo(t),f=o==="y",m=r.x+r.width/2-a.width/2,p=r.y+r.height/2-a.height/2,g=r[u]/2-a[u]/2;let x;switch(d){case"top":x={x:m,y:r.y-a.height};break;case"bottom":x={x:m,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:p};break;case"left":x={x:r.x-a.width,y:p};break;default:x={x:r.x,y:r.y}}switch(Yu(t)){case"start":x[l]-=g*(n&&f?-1:1);break;case"end":x[l]+=g*(n&&f?-1:1);break}return x}const Qbe=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:o=[],platform:l}=n,u=o.filter(Boolean),d=await(l.isRTL==null?void 0:l.isRTL(t));let f=await l.getElementRects({reference:e,floating:t,strategy:a}),{x:m,y:p}=pL(f,r,d),g=r,x={},j=0;for(let b=0;b({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:o,platform:l,elements:u,middlewareData:d}=t,{element:f,padding:m=0}=io(e,t)||{};if(f==null)return{};const p=L8(m),g={x:n,y:r},x=gE(a),j=vE(x),b=await l.getDimensions(f),w=x==="y",N=w?"top":"left",A=w?"bottom":"right",E=w?"clientHeight":"clientWidth",T=o.reference[j]+o.reference[x]-g[x]-o.floating[j],C=g[x]-o.reference[x],k=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f));let O=k?k[E]:0;(!O||!await(l.isElement==null?void 0:l.isElement(k)))&&(O=u.floating[E]||o.floating[j]);const M=T/2-C/2,I=O/2-b[j]/2-1,z=Jo(p[N],I),D=Jo(p[A],I),H=z,V=O-b[j]-D,F=O/2-b[j]/2+M,G=rC(H,F,V),L=!d.arrow&&Yu(a)!=null&&F!==G&&o.reference[j]/2-(FF<=0)){var D,H;const F=(((D=o.flip)==null?void 0:D.index)||0)+1,G=O[F];if(G&&(!(p==="alignment"?A!==ci(G):!1)||z.every(U=>ci(U.placement)===A?U.overflows[0]>0:!0)))return{data:{index:F,overflows:z},reset:{placement:G}};let L=(H=z.filter(R=>R.overflows[0]<=0).sort((R,U)=>R.overflows[1]-U.overflows[1])[0])==null?void 0:H.placement;if(!L)switch(x){case"bestFit":{var V;const R=(V=z.filter(U=>{if(k){const K=ci(U.placement);return K===A||K==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(K=>K>0).reduce((K,te)=>K+te,0)]).sort((U,K)=>U[1]-K[1])[0])==null?void 0:V[0];R&&(L=R);break}case"initialPlacement":L=u;break}if(a!==L)return{reset:{placement:L}}}return{}}}};function vL(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function gL(e){return qbe.some(t=>e[t]>=0)}const t0e=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...a}=io(e,t);switch(r){case"referenceHidden":{const o=await mh(t,{...a,elementContext:"reference"}),l=vL(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:gL(l)}}}case"escaped":{const o=await mh(t,{...a,altBoundary:!0}),l=vL(o,n.floating);return{data:{escapedOffsets:l,escaped:gL(l)}}}default:return{}}}}},B8=new Set(["left","top"]);async function n0e(e,t){const{placement:n,platform:r,elements:a}=e,o=await(r.isRTL==null?void 0:r.isRTL(a.floating)),l=oo(n),u=Yu(n),d=ci(n)==="y",f=B8.has(l)?-1:1,m=o&&d?-1:1,p=io(t,e);let{mainAxis:g,crossAxis:x,alignmentAxis:j}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return u&&typeof j=="number"&&(x=u==="end"?j*-1:j),d?{x:x*m,y:g*f}:{x:g*f,y:x*m}}const r0e=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:o,placement:l,middlewareData:u}=t,d=await n0e(t,e);return l===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:a+d.x,y:o+d.y,data:{...d,placement:l}}}}},a0e=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:u={fn:w=>{let{x:N,y:A}=w;return{x:N,y:A}}},...d}=io(e,t),f={x:n,y:r},m=await mh(t,d),p=ci(oo(a)),g=pE(p);let x=f[g],j=f[p];if(o){const w=g==="y"?"top":"left",N=g==="y"?"bottom":"right",A=x+m[w],E=x-m[N];x=rC(A,x,E)}if(l){const w=p==="y"?"top":"left",N=p==="y"?"bottom":"right",A=j+m[w],E=j-m[N];j=rC(A,j,E)}const b=u.fn({...t,[g]:x,[p]:j});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[g]:o,[p]:l}}}}}},i0e=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:a,rects:o,middlewareData:l}=t,{offset:u=0,mainAxis:d=!0,crossAxis:f=!0}=io(e,t),m={x:n,y:r},p=ci(a),g=pE(p);let x=m[g],j=m[p];const b=io(u,t),w=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(d){const E=g==="y"?"height":"width",T=o.reference[g]-o.floating[E]+w.mainAxis,C=o.reference[g]+o.reference[E]-w.mainAxis;xC&&(x=C)}if(f){var N,A;const E=g==="y"?"width":"height",T=B8.has(oo(a)),C=o.reference[p]-o.floating[E]+(T&&((N=l.offset)==null?void 0:N[p])||0)+(T?0:w.crossAxis),k=o.reference[p]+o.reference[E]+(T?0:((A=l.offset)==null?void 0:A[p])||0)-(T?w.crossAxis:0);jk&&(j=k)}return{[g]:x,[p]:j}}}},o0e=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:o,platform:l,elements:u}=t,{apply:d=()=>{},...f}=io(e,t),m=await mh(t,f),p=oo(a),g=Yu(a),x=ci(a)==="y",{width:j,height:b}=o.floating;let w,N;p==="top"||p==="bottom"?(w=p,N=g===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(N=p,w=g==="end"?"top":"bottom");const A=b-m.top-m.bottom,E=j-m.left-m.right,T=Jo(b-m[w],A),C=Jo(j-m[N],E),k=!t.middlewareData.shift;let O=T,M=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(M=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(O=A),k&&!g){const z=Jr(m.left,0),D=Jr(m.right,0),H=Jr(m.top,0),V=Jr(m.bottom,0);x?M=j-2*(z!==0||D!==0?z+D:Jr(m.left,m.right)):O=b-2*(H!==0||V!==0?H+V:Jr(m.top,m.bottom))}await d({...t,availableWidth:M,availableHeight:O});const I=await l.getDimensions(u.floating);return j!==I.width||b!==I.height?{reset:{rects:!0}}:{}}}};function zy(){return typeof window<"u"}function Ku(e){return z8(e)?(e.nodeName||"").toLowerCase():"#document"}function aa(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ji(e){var t;return(t=(z8(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function z8(e){return zy()?e instanceof Node||e instanceof aa(e).Node:!1}function Ha(e){return zy()?e instanceof Element||e instanceof aa(e).Element:!1}function yi(e){return zy()?e instanceof HTMLElement||e instanceof aa(e).HTMLElement:!1}function yL(e){return!zy()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof aa(e).ShadowRoot}const s0e=new Set(["inline","contents"]);function Hh(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=Wa(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!s0e.has(a)}const l0e=new Set(["table","td","th"]);function c0e(e){return l0e.has(Ku(e))}const u0e=[":popover-open",":modal"];function qy(e){return u0e.some(t=>{try{return e.matches(t)}catch{return!1}})}const d0e=["transform","translate","scale","rotate","perspective"],f0e=["transform","translate","scale","rotate","perspective","filter"],h0e=["paint","layout","strict","content"];function yE(e){const t=xE(),n=Ha(e)?Wa(e):e;return d0e.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||f0e.some(r=>(n.willChange||"").includes(r))||h0e.some(r=>(n.contain||"").includes(r))}function m0e(e){let t=es(e);for(;yi(t)&&!ku(t);){if(yE(t))return t;if(qy(t))return null;t=es(t)}return null}function xE(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const p0e=new Set(["html","body","#document"]);function ku(e){return p0e.has(Ku(e))}function Wa(e){return aa(e).getComputedStyle(e)}function Fy(e){return Ha(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function es(e){if(Ku(e)==="html")return e;const t=e.assignedSlot||e.parentNode||yL(e)&&e.host||ji(e);return yL(t)?t.host:t}function q8(e){const t=es(e);return ku(t)?e.ownerDocument?e.ownerDocument.body:e.body:yi(t)&&Hh(t)?t:q8(t)}function ph(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=q8(e),o=a===((r=e.ownerDocument)==null?void 0:r.body),l=aa(a);if(o){const u=iC(l);return t.concat(l,l.visualViewport||[],Hh(a)?a:[],u&&n?ph(u):[])}return t.concat(a,ph(a,[],n))}function iC(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function F8(e){const t=Wa(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=yi(e),o=a?e.offsetWidth:n,l=a?e.offsetHeight:r,u=Og(n)!==o||Og(r)!==l;return u&&(n=o,r=l),{width:n,height:r,$:u}}function bE(e){return Ha(e)?e:e.contextElement}function Xc(e){const t=bE(e);if(!yi(t))return mi(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:o}=F8(t);let l=(o?Og(n.width):n.width)/r,u=(o?Og(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const v0e=mi(0);function U8(e){const t=aa(e);return!xE()||!t.visualViewport?v0e:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function g0e(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==aa(e)?!1:t}function gl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),o=bE(e);let l=mi(1);t&&(r?Ha(r)&&(l=Xc(r)):l=Xc(e));const u=g0e(o,n,r)?U8(o):mi(0);let d=(a.left+u.x)/l.x,f=(a.top+u.y)/l.y,m=a.width/l.x,p=a.height/l.y;if(o){const g=aa(o),x=r&&Ha(r)?aa(r):r;let j=g,b=iC(j);for(;b&&r&&x!==j;){const w=Xc(b),N=b.getBoundingClientRect(),A=Wa(b),E=N.left+(b.clientLeft+parseFloat(A.paddingLeft))*w.x,T=N.top+(b.clientTop+parseFloat(A.paddingTop))*w.y;d*=w.x,f*=w.y,m*=w.x,p*=w.y,d+=E,f+=T,j=aa(b),b=iC(j)}}return Ag({width:m,height:p,x:d,y:f})}function Uy(e,t){const n=Fy(e).scrollLeft;return t?t.left+n:gl(ji(e)).left+n}function H8(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Uy(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function y0e(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const o=a==="fixed",l=ji(r),u=t?qy(t.floating):!1;if(r===l||u&&o)return n;let d={scrollLeft:0,scrollTop:0},f=mi(1);const m=mi(0),p=yi(r);if((p||!p&&!o)&&((Ku(r)!=="body"||Hh(l))&&(d=Fy(r)),yi(r))){const x=gl(r);f=Xc(r),m.x=x.x+r.clientLeft,m.y=x.y+r.clientTop}const g=l&&!p&&!o?H8(l,d):mi(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-d.scrollLeft*f.x+m.x+g.x,y:n.y*f.y-d.scrollTop*f.y+m.y+g.y}}function x0e(e){return Array.from(e.getClientRects())}function b0e(e){const t=ji(e),n=Fy(e),r=e.ownerDocument.body,a=Jr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Jr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Uy(e);const u=-n.scrollTop;return Wa(r).direction==="rtl"&&(l+=Jr(t.clientWidth,r.clientWidth)-a),{width:a,height:o,x:l,y:u}}const xL=25;function w0e(e,t){const n=aa(e),r=ji(e),a=n.visualViewport;let o=r.clientWidth,l=r.clientHeight,u=0,d=0;if(a){o=a.width,l=a.height;const m=xE();(!m||m&&t==="fixed")&&(u=a.offsetLeft,d=a.offsetTop)}const f=Uy(r);if(f<=0){const m=r.ownerDocument,p=m.body,g=getComputedStyle(p),x=m.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,j=Math.abs(r.clientWidth-p.clientWidth-x);j<=xL&&(o-=j)}else f<=xL&&(o+=f);return{width:o,height:l,x:u,y:d}}const j0e=new Set(["absolute","fixed"]);function S0e(e,t){const n=gl(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,o=yi(e)?Xc(e):mi(1),l=e.clientWidth*o.x,u=e.clientHeight*o.y,d=a*o.x,f=r*o.y;return{width:l,height:u,x:d,y:f}}function bL(e,t,n){let r;if(t==="viewport")r=w0e(e,n);else if(t==="document")r=b0e(ji(e));else if(Ha(t))r=S0e(t,n);else{const a=U8(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Ag(r)}function W8(e,t){const n=es(e);return n===t||!Ha(n)||ku(n)?!1:Wa(n).position==="fixed"||W8(n,t)}function _0e(e,t){const n=t.get(e);if(n)return n;let r=ph(e,[],!1).filter(u=>Ha(u)&&Ku(u)!=="body"),a=null;const o=Wa(e).position==="fixed";let l=o?es(e):e;for(;Ha(l)&&!ku(l);){const u=Wa(l),d=yE(l);!d&&u.position==="fixed"&&(a=null),(o?!d&&!a:!d&&u.position==="static"&&!!a&&j0e.has(a.position)||Hh(l)&&!d&&W8(e,l))?r=r.filter(m=>m!==l):a=u,l=es(l)}return t.set(e,r),r}function N0e(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const l=[...n==="clippingAncestors"?qy(t)?[]:_0e(t,this._c):[].concat(n),r],u=l[0],d=l.reduce((f,m)=>{const p=bL(t,m,a);return f.top=Jr(p.top,f.top),f.right=Jo(p.right,f.right),f.bottom=Jo(p.bottom,f.bottom),f.left=Jr(p.left,f.left),f},bL(t,u,a));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function C0e(e){const{width:t,height:n}=F8(e);return{width:t,height:n}}function O0e(e,t,n){const r=yi(t),a=ji(t),o=n==="fixed",l=gl(e,!0,o,t);let u={scrollLeft:0,scrollTop:0};const d=mi(0);function f(){d.x=Uy(a)}if(r||!r&&!o)if((Ku(t)!=="body"||Hh(a))&&(u=Fy(t)),r){const x=gl(t,!0,o,t);d.x=x.x+t.clientLeft,d.y=x.y+t.clientTop}else a&&f();o&&!r&&a&&f();const m=a&&!r&&!o?H8(a,u):mi(0),p=l.left+u.scrollLeft-d.x-m.x,g=l.top+u.scrollTop-d.y-m.y;return{x:p,y:g,width:l.width,height:l.height}}function e_(e){return Wa(e).position==="static"}function wL(e,t){if(!yi(e)||Wa(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ji(e)===n&&(n=n.ownerDocument.body),n}function V8(e,t){const n=aa(e);if(qy(e))return n;if(!yi(e)){let a=es(e);for(;a&&!ku(a);){if(Ha(a)&&!e_(a))return a;a=es(a)}return n}let r=wL(e,t);for(;r&&c0e(r)&&e_(r);)r=wL(r,t);return r&&ku(r)&&e_(r)&&!yE(r)?n:r||m0e(e)||n}const E0e=async function(e){const t=this.getOffsetParent||V8,n=this.getDimensions,r=await n(e.floating);return{reference:O0e(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function A0e(e){return Wa(e).direction==="rtl"}const T0e={convertOffsetParentRelativeRectToViewportRelativeRect:y0e,getDocumentElement:ji,getClippingRect:N0e,getOffsetParent:V8,getElementRects:E0e,getClientRects:x0e,getDimensions:C0e,getScale:Xc,isElement:Ha,isRTL:A0e};function G8(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function k0e(e,t){let n=null,r;const a=ji(e);function o(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function l(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),o();const f=e.getBoundingClientRect(),{left:m,top:p,width:g,height:x}=f;if(u||t(),!g||!x)return;const j=Wp(p),b=Wp(a.clientWidth-(m+g)),w=Wp(a.clientHeight-(p+x)),N=Wp(m),E={rootMargin:-j+"px "+-b+"px "+-w+"px "+-N+"px",threshold:Jr(0,Jo(1,d))||1};let T=!0;function C(k){const O=k[0].intersectionRatio;if(O!==d){if(!T)return l();O?l(!1,O):r=setTimeout(()=>{l(!1,1e-7)},1e3)}O===1&&!G8(f,e.getBoundingClientRect())&&l(),T=!1}try{n=new IntersectionObserver(C,{...E,root:a.ownerDocument})}catch{n=new IntersectionObserver(C,E)}n.observe(e)}return l(!0),o}function M0e(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,f=bE(e),m=a||o?[...f?ph(f):[],...ph(t)]:[];m.forEach(N=>{a&&N.addEventListener("scroll",n,{passive:!0}),o&&N.addEventListener("resize",n)});const p=f&&u?k0e(f,n):null;let g=-1,x=null;l&&(x=new ResizeObserver(N=>{let[A]=N;A&&A.target===f&&x&&(x.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var E;(E=x)==null||E.observe(t)})),n()}),f&&!d&&x.observe(f),x.observe(t));let j,b=d?gl(e):null;d&&w();function w(){const N=gl(e);b&&!G8(b,N)&&n(),b=N,j=requestAnimationFrame(w)}return n(),()=>{var N;m.forEach(A=>{a&&A.removeEventListener("scroll",n),o&&A.removeEventListener("resize",n)}),p?.(),(N=x)==null||N.disconnect(),x=null,d&&cancelAnimationFrame(j)}}const P0e=r0e,R0e=a0e,D0e=e0e,$0e=o0e,I0e=t0e,jL=Jbe,L0e=i0e,B0e=(e,t,n)=>{const r=new Map,a={platform:T0e,...n},o={...a.platform,_c:r};return Qbe(e,t,{...a,platform:o})};var z0e=typeof document<"u",q0e=function(){},cv=z0e?y.useLayoutEffect:q0e;function Tg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Tg(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const o=a[r];if(!(o==="_owner"&&e.$$typeof)&&!Tg(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Y8(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function SL(e,t){const n=Y8(e);return Math.round(t*n)/n}function t_(e){const t=y.useRef(e);return cv(()=>{t.current=e}),t}function F0e(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:o,floating:l}={},transform:u=!0,whileElementsMounted:d,open:f}=e,[m,p]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,x]=y.useState(r);Tg(g,r)||x(r);const[j,b]=y.useState(null),[w,N]=y.useState(null),A=y.useCallback(U=>{U!==k.current&&(k.current=U,b(U))},[]),E=y.useCallback(U=>{U!==O.current&&(O.current=U,N(U))},[]),T=o||j,C=l||w,k=y.useRef(null),O=y.useRef(null),M=y.useRef(m),I=d!=null,z=t_(d),D=t_(a),H=t_(f),V=y.useCallback(()=>{if(!k.current||!O.current)return;const U={placement:t,strategy:n,middleware:g};D.current&&(U.platform=D.current),B0e(k.current,O.current,U).then(K=>{const te={...K,isPositioned:H.current!==!1};F.current&&!Tg(M.current,te)&&(M.current=te,wl.flushSync(()=>{p(te)}))})},[g,t,n,D,H]);cv(()=>{f===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,p(U=>({...U,isPositioned:!1})))},[f]);const F=y.useRef(!1);cv(()=>(F.current=!0,()=>{F.current=!1}),[]),cv(()=>{if(T&&(k.current=T),C&&(O.current=C),T&&C){if(z.current)return z.current(T,C,V);V()}},[T,C,V,z,I]);const G=y.useMemo(()=>({reference:k,floating:O,setReference:A,setFloating:E}),[A,E]),L=y.useMemo(()=>({reference:T,floating:C}),[T,C]),R=y.useMemo(()=>{const U={position:n,left:0,top:0};if(!L.floating)return U;const K=SL(L.floating,m.x),te=SL(L.floating,m.y);return u?{...U,transform:"translate("+K+"px, "+te+"px)",...Y8(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:K,top:te}},[n,u,L.floating,m.x,m.y]);return y.useMemo(()=>({...m,update:V,refs:G,elements:L,floatingStyles:R}),[m,V,G,L,R])}const U0e=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?jL({element:r.current,padding:a}).fn(n):{}:r?jL({element:r,padding:a}).fn(n):{}}}},H0e=(e,t)=>({...P0e(e),options:[e,t]}),W0e=(e,t)=>({...R0e(e),options:[e,t]}),V0e=(e,t)=>({...L0e(e),options:[e,t]}),G0e=(e,t)=>({...D0e(e),options:[e,t]}),Y0e=(e,t)=>({...$0e(e),options:[e,t]}),K0e=(e,t)=>({...I0e(e),options:[e,t]}),X0e=(e,t)=>({...U0e(e),options:[e,t]});var Z0e="Arrow",K8=y.forwardRef((e,t)=>{const{children:n,width:r=10,height:a=5,...o}=e;return i.jsx(Pe.svg,{...o,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});K8.displayName=Z0e;var Q0e=K8,wE="Popper",[X8,us]=hr(wE),[J0e,Z8]=X8(wE),Q8=e=>{const{__scopePopper:t,children:n}=e,[r,a]=y.useState(null);return i.jsx(J0e,{scope:t,anchor:r,onAnchorChange:a,children:n})};Q8.displayName=wE;var J8="PopperAnchor",eU=y.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...a}=e,o=Z8(J8,n),l=y.useRef(null),u=qe(t,l),d=y.useRef(null);return y.useEffect(()=>{const f=d.current;d.current=r?.current||l.current,f!==d.current&&o.onAnchorChange(d.current)}),r?null:i.jsx(Pe.div,{...a,ref:u})});eU.displayName=J8;var jE="PopperContent",[ewe,twe]=X8(jE),tU=y.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:o="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:m=0,sticky:p="partial",hideWhenDetached:g=!1,updatePositionStrategy:x="optimized",onPlaced:j,...b}=e,w=Z8(jE,n),[N,A]=y.useState(null),E=qe(t,ee=>A(ee)),[T,C]=y.useState(null),k=ky(T),O=k?.width??0,M=k?.height??0,I=r+(o!=="center"?"-"+o:""),z=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},D=Array.isArray(f)?f:[f],H=D.length>0,V={padding:z,boundary:D.filter(rwe),altBoundary:H},{refs:F,floatingStyles:G,placement:L,isPositioned:R,middlewareData:U}=F0e({strategy:"fixed",placement:I,whileElementsMounted:(...ee)=>M0e(...ee,{animationFrame:x==="always"}),elements:{reference:w.anchor},middleware:[H0e({mainAxis:a+M,alignmentAxis:l}),d&&W0e({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?V0e():void 0,...V}),d&&G0e({...V}),Y0e({...V,apply:({elements:ee,rects:ae,availableWidth:Z,availableHeight:pe})=>{const{width:je,height:le}=ae.reference,Re=ee.floating.style;Re.setProperty("--radix-popper-available-width",`${Z}px`),Re.setProperty("--radix-popper-available-height",`${pe}px`),Re.setProperty("--radix-popper-anchor-width",`${je}px`),Re.setProperty("--radix-popper-anchor-height",`${le}px`)}}),T&&X0e({element:T,padding:u}),awe({arrowWidth:O,arrowHeight:M}),g&&K0e({strategy:"referenceHidden",...V})]}),[K,te]=aU(L),$=nn(j);Un(()=>{R&&$?.()},[R,$]);const B=U.arrow?.x,Y=U.arrow?.y,ne=U.arrow?.centerOffset!==0,[oe,xe]=y.useState();return Un(()=>{N&&xe(window.getComputedStyle(N).zIndex)},[N]),i.jsx("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...G,transform:R?G.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[U.transformOrigin?.x,U.transformOrigin?.y].join(" "),...U.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:i.jsx(ewe,{scope:n,placedSide:K,onArrowChange:C,arrowX:B,arrowY:Y,shouldHideArrow:ne,children:i.jsx(Pe.div,{"data-side":K,"data-align":te,...b,ref:E,style:{...b.style,animation:R?void 0:"none"}})})})});tU.displayName=jE;var nU="PopperArrow",nwe={top:"bottom",right:"left",bottom:"top",left:"right"},rU=y.forwardRef(function(t,n){const{__scopePopper:r,...a}=t,o=twe(nU,r),l=nwe[o.placedSide];return i.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:i.jsx(Q0e,{...a,ref:n,style:{...a.style,display:"block"}})})});rU.displayName=nU;function rwe(e){return e!==null}var awe=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:a}=t,l=a.arrow?.centerOffset!==0,u=l?0:e.arrowWidth,d=l?0:e.arrowHeight,[f,m]=aU(n),p={start:"0%",center:"50%",end:"100%"}[m],g=(a.arrow?.x??0)+u/2,x=(a.arrow?.y??0)+d/2;let j="",b="";return f==="bottom"?(j=l?p:`${g}px`,b=`${-d}px`):f==="top"?(j=l?p:`${g}px`,b=`${r.floating.height+d}px`):f==="right"?(j=`${-d}px`,b=l?p:`${x}px`):f==="left"&&(j=`${r.floating.width+d}px`,b=l?p:`${x}px`),{data:{x:j,y:b}}}});function aU(e){const[t,n="center"]=e.split("-");return[t,n]}var Wh=Q8,Vh=eU,Hy=tU,Wy=rU;function iwe(e){const t=owe(e),n=y.forwardRef((r,a)=>{const{children:o,...l}=r,u=y.Children.toArray(o),d=u.find(lwe);if(d){const f=d.props.children,m=u.map(p=>p===d?y.Children.count(f)>1?y.Children.only(null):y.isValidElement(f)?f.props.children:null:p);return i.jsx(t,{...l,ref:a,children:y.isValidElement(f)?y.cloneElement(f,void 0,m):null})}return i.jsx(t,{...l,ref:a,children:o})});return n.displayName=`${e}.Slot`,n}function owe(e){const t=y.forwardRef((n,r)=>{const{children:a,...o}=n;if(y.isValidElement(a)){const l=uwe(a),u=cwe(o,a.props);return a.type!==y.Fragment&&(u.ref=r?Rr(r,l):l),y.cloneElement(a,u)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var swe=Symbol("radix.slottable");function lwe(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===swe}function cwe(e,t){const n={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...u)=>{const d=o(...u);return a(...u),d}:a&&(n[r]=a):r==="style"?n[r]={...a,...o}:r==="className"&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function uwe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var iU=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),dwe="VisuallyHidden",Vy=y.forwardRef((e,t)=>i.jsx(Pe.span,{...e,ref:t,style:{...iU,...e.style}}));Vy.displayName=dwe;var fwe=Vy,hwe=[" ","Enter","ArrowUp","ArrowDown"],mwe=[" ","Enter"],yl="Select",[Gy,Yy,pwe]=Ch(yl),[Xu]=hr(yl,[pwe,us]),Ky=us(),[vwe,ds]=Xu(yl),[gwe,ywe]=Xu(yl),oU=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:o,value:l,defaultValue:u,onValueChange:d,dir:f,name:m,autoComplete:p,disabled:g,required:x,form:j}=e,b=Ky(t),[w,N]=y.useState(null),[A,E]=y.useState(null),[T,C]=y.useState(!1),k=Lu(f),[O,M]=Na({prop:r,defaultProp:a??!1,onChange:o,caller:yl}),[I,z]=Na({prop:l,defaultProp:u,onChange:d,caller:yl}),D=y.useRef(null),H=w?j||!!w.closest("form"):!0,[V,F]=y.useState(new Set),G=Array.from(V).map(L=>L.props.value).join(";");return i.jsx(Wh,{...b,children:i.jsxs(vwe,{required:x,scope:t,trigger:w,onTriggerChange:N,valueNode:A,onValueNodeChange:E,valueNodeHasChildren:T,onValueNodeHasChildrenChange:C,contentId:Fn(),value:I,onValueChange:z,open:O,onOpenChange:M,dir:k,triggerPointerDownPosRef:D,disabled:g,children:[i.jsx(Gy.Provider,{scope:t,children:i.jsx(gwe,{scope:e.__scopeSelect,onNativeOptionAdd:y.useCallback(L=>{F(R=>new Set(R).add(L))},[]),onNativeOptionRemove:y.useCallback(L=>{F(R=>{const U=new Set(R);return U.delete(L),U})},[]),children:n})}),H?i.jsxs(TU,{"aria-hidden":!0,required:x,tabIndex:-1,name:m,autoComplete:p,value:I,onChange:L=>z(L.target.value),disabled:g,form:j,children:[I===void 0?i.jsx("option",{value:""}):null,Array.from(V)]},G):null]})})};oU.displayName=yl;var sU="SelectTrigger",lU=y.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...a}=e,o=Ky(n),l=ds(sU,n),u=l.disabled||r,d=qe(t,l.onTriggerChange),f=Yy(n),m=y.useRef("touch"),[p,g,x]=MU(b=>{const w=f().filter(E=>!E.disabled),N=w.find(E=>E.value===l.value),A=PU(w,b,N);A!==void 0&&l.onValueChange(A.value)}),j=b=>{u||(l.onOpenChange(!0),x()),b&&(l.triggerPointerDownPosRef.current={x:Math.round(b.pageX),y:Math.round(b.pageY)})};return i.jsx(Vh,{asChild:!0,...o,children:i.jsx(Pe.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":kU(l.value)?"":void 0,...a,ref:d,onClick:Se(a.onClick,b=>{b.currentTarget.focus(),m.current!=="mouse"&&j(b)}),onPointerDown:Se(a.onPointerDown,b=>{m.current=b.pointerType;const w=b.target;w.hasPointerCapture(b.pointerId)&&w.releasePointerCapture(b.pointerId),b.button===0&&b.ctrlKey===!1&&b.pointerType==="mouse"&&(j(b),b.preventDefault())}),onKeyDown:Se(a.onKeyDown,b=>{const w=p.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&g(b.key),!(w&&b.key===" ")&&hwe.includes(b.key)&&(j(),b.preventDefault())})})})});lU.displayName=sU;var cU="SelectValue",uU=y.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,children:o,placeholder:l="",...u}=e,d=ds(cU,n),{onValueNodeHasChildrenChange:f}=d,m=o!==void 0,p=qe(t,d.onValueNodeChange);return Un(()=>{f(m)},[f,m]),i.jsx(Pe.span,{...u,ref:p,style:{pointerEvents:"none"},children:kU(d.value)?i.jsx(i.Fragment,{children:l}):o})});uU.displayName=cU;var xwe="SelectIcon",dU=y.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...a}=e;return i.jsx(Pe.span,{"aria-hidden":!0,...a,ref:t,children:r||"▼"})});dU.displayName=xwe;var bwe="SelectPortal",fU=e=>i.jsx(El,{asChild:!0,...e});fU.displayName=bwe;var xl="SelectContent",hU=y.forwardRef((e,t)=>{const n=ds(xl,e.__scopeSelect),[r,a]=y.useState();if(Un(()=>{a(new DocumentFragment)},[]),!n.open){const o=r;return o?wl.createPortal(i.jsx(mU,{scope:e.__scopeSelect,children:i.jsx(Gy.Slot,{scope:e.__scopeSelect,children:i.jsx("div",{children:e.children})})}),o):null}return i.jsx(pU,{...e,ref:t})});hU.displayName=xl;var $a=10,[mU,fs]=Xu(xl),wwe="SelectContentImpl",jwe=iwe("SelectContent.RemoveScroll"),pU=y.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:l,side:u,sideOffset:d,align:f,alignOffset:m,arrowPadding:p,collisionBoundary:g,collisionPadding:x,sticky:j,hideWhenDetached:b,avoidCollisions:w,...N}=e,A=ds(xl,n),[E,T]=y.useState(null),[C,k]=y.useState(null),O=qe(t,ee=>T(ee)),[M,I]=y.useState(null),[z,D]=y.useState(null),H=Yy(n),[V,F]=y.useState(!1),G=y.useRef(!1);y.useEffect(()=>{if(E)return Dy(E)},[E]),Py();const L=y.useCallback(ee=>{const[ae,...Z]=H().map(le=>le.ref.current),[pe]=Z.slice(-1),je=document.activeElement;for(const le of ee)if(le===je||(le?.scrollIntoView({block:"nearest"}),le===ae&&C&&(C.scrollTop=0),le===pe&&C&&(C.scrollTop=C.scrollHeight),le?.focus(),document.activeElement!==je))return},[H,C]),R=y.useCallback(()=>L([M,E]),[L,M,E]);y.useEffect(()=>{V&&R()},[V,R]);const{onOpenChange:U,triggerPointerDownPosRef:K}=A;y.useEffect(()=>{if(E){let ee={x:0,y:0};const ae=pe=>{ee={x:Math.abs(Math.round(pe.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(pe.pageY)-(K.current?.y??0))}},Z=pe=>{ee.x<=10&&ee.y<=10?pe.preventDefault():E.contains(pe.target)||U(!1),document.removeEventListener("pointermove",ae),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",ae),document.addEventListener("pointerup",Z,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ae),document.removeEventListener("pointerup",Z,{capture:!0})}}},[E,U,K]),y.useEffect(()=>{const ee=()=>U(!1);return window.addEventListener("blur",ee),window.addEventListener("resize",ee),()=>{window.removeEventListener("blur",ee),window.removeEventListener("resize",ee)}},[U]);const[te,$]=MU(ee=>{const ae=H().filter(je=>!je.disabled),Z=ae.find(je=>je.ref.current===document.activeElement),pe=PU(ae,ee,Z);pe&&setTimeout(()=>pe.ref.current.focus())}),B=y.useCallback((ee,ae,Z)=>{const pe=!G.current&&!Z;(A.value!==void 0&&A.value===ae||pe)&&(I(ee),pe&&(G.current=!0))},[A.value]),Y=y.useCallback(()=>E?.focus(),[E]),ne=y.useCallback((ee,ae,Z)=>{const pe=!G.current&&!Z;(A.value!==void 0&&A.value===ae||pe)&&D(ee)},[A.value]),oe=r==="popper"?oC:vU,xe=oe===oC?{side:u,sideOffset:d,align:f,alignOffset:m,arrowPadding:p,collisionBoundary:g,collisionPadding:x,sticky:j,hideWhenDetached:b,avoidCollisions:w}:{};return i.jsx(mU,{scope:n,content:E,viewport:C,onViewportChange:k,itemRefCallback:B,selectedItem:M,onItemLeave:Y,itemTextRefCallback:ne,focusSelectedItem:R,selectedItemText:z,position:r,isPositioned:V,searchRef:te,children:i.jsx(Uh,{as:jwe,allowPinchZoom:!0,children:i.jsx(Fh,{asChild:!0,trapped:A.open,onMountAutoFocus:ee=>{ee.preventDefault()},onUnmountAutoFocus:Se(a,ee=>{A.trigger?.focus({preventScroll:!0}),ee.preventDefault()}),children:i.jsx(Ol,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:ee=>ee.preventDefault(),onDismiss:()=>A.onOpenChange(!1),children:i.jsx(oe,{role:"listbox",id:A.contentId,"data-state":A.open?"open":"closed",dir:A.dir,onContextMenu:ee=>ee.preventDefault(),...N,...xe,onPlaced:()=>F(!0),ref:O,style:{display:"flex",flexDirection:"column",outline:"none",...N.style},onKeyDown:Se(N.onKeyDown,ee=>{const ae=ee.ctrlKey||ee.altKey||ee.metaKey;if(ee.key==="Tab"&&ee.preventDefault(),!ae&&ee.key.length===1&&$(ee.key),["ArrowUp","ArrowDown","Home","End"].includes(ee.key)){let pe=H().filter(je=>!je.disabled).map(je=>je.ref.current);if(["ArrowUp","End"].includes(ee.key)&&(pe=pe.slice().reverse()),["ArrowUp","ArrowDown"].includes(ee.key)){const je=ee.target,le=pe.indexOf(je);pe=pe.slice(le+1)}setTimeout(()=>L(pe)),ee.preventDefault()}})})})})})})});pU.displayName=wwe;var Swe="SelectItemAlignedPosition",vU=y.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...a}=e,o=ds(xl,n),l=fs(xl,n),[u,d]=y.useState(null),[f,m]=y.useState(null),p=qe(t,O=>m(O)),g=Yy(n),x=y.useRef(!1),j=y.useRef(!0),{viewport:b,selectedItem:w,selectedItemText:N,focusSelectedItem:A}=l,E=y.useCallback(()=>{if(o.trigger&&o.valueNode&&u&&f&&b&&w&&N){const O=o.trigger.getBoundingClientRect(),M=f.getBoundingClientRect(),I=o.valueNode.getBoundingClientRect(),z=N.getBoundingClientRect();if(o.dir!=="rtl"){const je=z.left-M.left,le=I.left-je,Re=O.left-le,_e=O.width+Re,me=Math.max(_e,M.width),ve=window.innerWidth-$a,Le=Ef(le,[$a,Math.max($a,ve-me)]);u.style.minWidth=_e+"px",u.style.left=Le+"px"}else{const je=M.right-z.right,le=window.innerWidth-I.right-je,Re=window.innerWidth-O.right-le,_e=O.width+Re,me=Math.max(_e,M.width),ve=window.innerWidth-$a,Le=Ef(le,[$a,Math.max($a,ve-me)]);u.style.minWidth=_e+"px",u.style.right=Le+"px"}const D=g(),H=window.innerHeight-$a*2,V=b.scrollHeight,F=window.getComputedStyle(f),G=parseInt(F.borderTopWidth,10),L=parseInt(F.paddingTop,10),R=parseInt(F.borderBottomWidth,10),U=parseInt(F.paddingBottom,10),K=G+L+V+U+R,te=Math.min(w.offsetHeight*5,K),$=window.getComputedStyle(b),B=parseInt($.paddingTop,10),Y=parseInt($.paddingBottom,10),ne=O.top+O.height/2-$a,oe=H-ne,xe=w.offsetHeight/2,ee=w.offsetTop+xe,ae=G+L+ee,Z=K-ae;if(ae<=ne){const je=D.length>0&&w===D[D.length-1].ref.current;u.style.bottom="0px";const le=f.clientHeight-b.offsetTop-b.offsetHeight,Re=Math.max(oe,xe+(je?Y:0)+le+R),_e=ae+Re;u.style.height=_e+"px"}else{const je=D.length>0&&w===D[0].ref.current;u.style.top="0px";const Re=Math.max(ne,G+b.offsetTop+(je?B:0)+xe)+Z;u.style.height=Re+"px",b.scrollTop=ae-ne+b.offsetTop}u.style.margin=`${$a}px 0`,u.style.minHeight=te+"px",u.style.maxHeight=H+"px",r?.(),requestAnimationFrame(()=>x.current=!0)}},[g,o.trigger,o.valueNode,u,f,b,w,N,o.dir,r]);Un(()=>E(),[E]);const[T,C]=y.useState();Un(()=>{f&&C(window.getComputedStyle(f).zIndex)},[f]);const k=y.useCallback(O=>{O&&j.current===!0&&(E(),A?.(),j.current=!1)},[E,A]);return i.jsx(Nwe,{scope:n,contentWrapper:u,shouldExpandOnScrollRef:x,onScrollButtonChange:k,children:i.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:i.jsx(Pe.div,{...a,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});vU.displayName=Swe;var _we="SelectPopperPosition",oC=y.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=$a,...o}=e,l=Ky(n);return i.jsx(Hy,{...l,...o,ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});oC.displayName=_we;var[Nwe,SE]=Xu(xl,{}),sC="SelectViewport",gU=y.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...a}=e,o=fs(sC,n),l=SE(sC,n),u=qe(t,o.onViewportChange),d=y.useRef(0);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),i.jsx(Gy.Slot,{scope:n,children:i.jsx(Pe.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Se(a.onScroll,f=>{const m=f.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:g}=l;if(g?.current&&p){const x=Math.abs(d.current-m.scrollTop);if(x>0){const j=window.innerHeight-$a*2,b=parseFloat(p.style.minHeight),w=parseFloat(p.style.height),N=Math.max(b,w);if(N0?T:0,p.style.justifyContent="flex-end")}}}d.current=m.scrollTop})})})]})});gU.displayName=sC;var yU="SelectGroup",[Cwe,Owe]=Xu(yU),Ewe=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=Fn();return i.jsx(Cwe,{scope:n,id:a,children:i.jsx(Pe.div,{role:"group","aria-labelledby":a,...r,ref:t})})});Ewe.displayName=yU;var xU="SelectLabel",bU=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=Owe(xU,n);return i.jsx(Pe.div,{id:a.id,...r,ref:t})});bU.displayName=xU;var kg="SelectItem",[Awe,wU]=Xu(kg),jU=y.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:o,...l}=e,u=ds(kg,n),d=fs(kg,n),f=u.value===r,[m,p]=y.useState(o??""),[g,x]=y.useState(!1),j=qe(t,A=>d.itemRefCallback?.(A,r,a)),b=Fn(),w=y.useRef("touch"),N=()=>{a||(u.onValueChange(r),u.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return i.jsx(Awe,{scope:n,value:r,disabled:a,textId:b,isSelected:f,onItemTextChange:y.useCallback(A=>{p(E=>E||(A?.textContent??"").trim())},[]),children:i.jsx(Gy.ItemSlot,{scope:n,value:r,disabled:a,textValue:m,children:i.jsx(Pe.div,{role:"option","aria-labelledby":b,"data-highlighted":g?"":void 0,"aria-selected":f&&g,"data-state":f?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:j,onFocus:Se(l.onFocus,()=>x(!0)),onBlur:Se(l.onBlur,()=>x(!1)),onClick:Se(l.onClick,()=>{w.current!=="mouse"&&N()}),onPointerUp:Se(l.onPointerUp,()=>{w.current==="mouse"&&N()}),onPointerDown:Se(l.onPointerDown,A=>{w.current=A.pointerType}),onPointerMove:Se(l.onPointerMove,A=>{w.current=A.pointerType,a?d.onItemLeave?.():w.current==="mouse"&&A.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Se(l.onPointerLeave,A=>{A.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:Se(l.onKeyDown,A=>{d.searchRef?.current!==""&&A.key===" "||(mwe.includes(A.key)&&N(),A.key===" "&&A.preventDefault())})})})})});jU.displayName=kg;var hf="SelectItemText",SU=y.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,...o}=e,l=ds(hf,n),u=fs(hf,n),d=wU(hf,n),f=ywe(hf,n),[m,p]=y.useState(null),g=qe(t,N=>p(N),d.onItemTextChange,N=>u.itemTextRefCallback?.(N,d.value,d.disabled)),x=m?.textContent,j=y.useMemo(()=>i.jsx("option",{value:d.value,disabled:d.disabled,children:x},d.value),[d.disabled,d.value,x]),{onNativeOptionAdd:b,onNativeOptionRemove:w}=f;return Un(()=>(b(j),()=>w(j)),[b,w,j]),i.jsxs(i.Fragment,{children:[i.jsx(Pe.span,{id:d.textId,...o,ref:g}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren?wl.createPortal(o.children,l.valueNode):null]})});SU.displayName=hf;var _U="SelectItemIndicator",NU=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return wU(_U,n).isSelected?i.jsx(Pe.span,{"aria-hidden":!0,...r,ref:t}):null});NU.displayName=_U;var lC="SelectScrollUpButton",CU=y.forwardRef((e,t)=>{const n=fs(lC,e.__scopeSelect),r=SE(lC,e.__scopeSelect),[a,o]=y.useState(!1),l=qe(t,r.onScrollButtonChange);return Un(()=>{if(n.viewport&&n.isPositioned){let u=function(){const f=d.scrollTop>0;o(f)};const d=n.viewport;return u(),d.addEventListener("scroll",u),()=>d.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),a?i.jsx(EU,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=n;u&&d&&(u.scrollTop=u.scrollTop-d.offsetHeight)}}):null});CU.displayName=lC;var cC="SelectScrollDownButton",OU=y.forwardRef((e,t)=>{const n=fs(cC,e.__scopeSelect),r=SE(cC,e.__scopeSelect),[a,o]=y.useState(!1),l=qe(t,r.onScrollButtonChange);return Un(()=>{if(n.viewport&&n.isPositioned){let u=function(){const f=d.scrollHeight-d.clientHeight,m=Math.ceil(d.scrollTop)d.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),a?i.jsx(EU,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=n;u&&d&&(u.scrollTop=u.scrollTop+d.offsetHeight)}}):null});OU.displayName=cC;var EU=y.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=e,o=fs("SelectScrollButton",n),l=y.useRef(null),u=Yy(n),d=y.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return y.useEffect(()=>()=>d(),[d]),Un(()=>{u().find(m=>m.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[u]),i.jsx(Pe.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Se(a.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:Se(a.onPointerMove,()=>{o.onItemLeave?.(),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:Se(a.onPointerLeave,()=>{d()})})}),Twe="SelectSeparator",AU=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return i.jsx(Pe.div,{"aria-hidden":!0,...r,ref:t})});AU.displayName=Twe;var uC="SelectArrow",kwe=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=Ky(n),o=ds(uC,n),l=fs(uC,n);return o.open&&l.position==="popper"?i.jsx(Wy,{...a,...r,ref:t}):null});kwe.displayName=uC;var Mwe="SelectBubbleInput",TU=y.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const a=y.useRef(null),o=qe(r,a),l=Ty(t);return y.useEffect(()=>{const u=a.current;if(!u)return;const d=window.HTMLSelectElement.prototype,m=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==t&&m){const p=new Event("change",{bubbles:!0});m.call(u,t),u.dispatchEvent(p)}},[l,t]),i.jsx(Pe.select,{...n,style:{...iU,...n.style},ref:o,defaultValue:t})});TU.displayName=Mwe;function kU(e){return e===""||e===void 0}function MU(e){const t=nn(e),n=y.useRef(""),r=y.useRef(0),a=y.useCallback(l=>{const u=n.current+l;t(u),(function d(f){n.current=f,window.clearTimeout(r.current),f!==""&&(r.current=window.setTimeout(()=>d(""),1e3))})(u)},[t]),o=y.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,o]}function PU(e,t,n){const a=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let l=Pwe(e,Math.max(o,0));a.length===1&&(l=l.filter(f=>f!==n));const d=l.find(f=>f.textValue.toLowerCase().startsWith(a.toLowerCase()));return d!==n?d:void 0}function Pwe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Rwe=oU,RU=lU,Dwe=uU,$we=dU,Iwe=fU,DU=hU,Lwe=gU,$U=bU,IU=jU,Bwe=SU,zwe=NU,LU=CU,BU=OU,zU=AU;const Et=Rwe,At=Dwe,wt=y.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(RU,{ref:r,className:de("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,i.jsx($we,{asChild:!0,children:i.jsx(uh,{className:"h-4 w-4 opacity-50"})})]}));wt.displayName=RU.displayName;const qU=y.forwardRef(({className:e,...t},n)=>i.jsx(LU,{ref:n,className:de("flex cursor-default items-center justify-center py-1",e),...t,children:i.jsx(FN,{className:"h-4 w-4"})}));qU.displayName=LU.displayName;const FU=y.forwardRef(({className:e,...t},n)=>i.jsx(BU,{ref:n,className:de("flex cursor-default items-center justify-center py-1",e),...t,children:i.jsx(uh,{className:"h-4 w-4"})}));FU.displayName=BU.displayName;const jt=y.forwardRef(({className:e,children:t,position:n="popper",...r},a)=>i.jsx(Iwe,{children:i.jsxs(DU,{ref:a,className:de("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[i.jsx(qU,{}),i.jsx(Lwe,{className:de("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),i.jsx(FU,{})]})}));jt.displayName=DU.displayName;const qwe=y.forwardRef(({className:e,...t},n)=>i.jsx($U,{ref:n,className:de("px-2 py-1.5 text-sm font-semibold",e),...t}));qwe.displayName=$U.displayName;const Me=y.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(IU,{ref:r,className:de("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[i.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(zwe,{children:i.jsx(il,{className:"h-4 w-4"})})}),i.jsx(Bwe,{children:t})]}));Me.displayName=IU.displayName;const Fwe=y.forwardRef(({className:e,...t},n)=>i.jsx(zU,{ref:n,className:de("-mx-1 my-1 h-px bg-muted",e),...t}));Fwe.displayName=zU.displayName;function Uwe(e){const t=Hwe(e),n=y.forwardRef((r,a)=>{const{children:o,...l}=r,u=y.Children.toArray(o),d=u.find(Vwe);if(d){const f=d.props.children,m=u.map(p=>p===d?y.Children.count(f)>1?y.Children.only(null):y.isValidElement(f)?f.props.children:null:p);return i.jsx(t,{...l,ref:a,children:y.isValidElement(f)?y.cloneElement(f,void 0,m):null})}return i.jsx(t,{...l,ref:a,children:o})});return n.displayName=`${e}.Slot`,n}function Hwe(e){const t=y.forwardRef((n,r)=>{const{children:a,...o}=n;if(y.isValidElement(a)){const l=Ywe(a),u=Gwe(o,a.props);return a.type!==y.Fragment&&(u.ref=r?Rr(r,l):l),y.cloneElement(a,u)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Wwe=Symbol("radix.slottable");function Vwe(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Wwe}function Gwe(e,t){const n={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...u)=>{const d=o(...u);return a(...u),d}:a&&(n[r]=a):r==="style"?n[r]={...a,...o}:r==="className"&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function Ywe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Xy="Popover",[UU]=hr(Xy,[us]),Gh=us(),[Kwe,hs]=UU(Xy),HU=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:l=!1}=e,u=Gh(t),d=y.useRef(null),[f,m]=y.useState(!1),[p,g]=Na({prop:r,defaultProp:a??!1,onChange:o,caller:Xy});return i.jsx(Wh,{...u,children:i.jsx(Kwe,{scope:t,contentId:Fn(),triggerRef:d,open:p,onOpenChange:g,onOpenToggle:y.useCallback(()=>g(x=>!x),[g]),hasCustomAnchor:f,onCustomAnchorAdd:y.useCallback(()=>m(!0),[]),onCustomAnchorRemove:y.useCallback(()=>m(!1),[]),modal:l,children:n})})};HU.displayName=Xy;var WU="PopoverAnchor",Xwe=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=hs(WU,n),o=Gh(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:u}=a;return y.useEffect(()=>(l(),()=>u()),[l,u]),i.jsx(Vh,{...o,...r,ref:t})});Xwe.displayName=WU;var VU="PopoverTrigger",GU=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=hs(VU,n),o=Gh(n),l=qe(t,a.triggerRef),u=i.jsx(Pe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":QU(a.open),...r,ref:l,onClick:Se(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?u:i.jsx(Vh,{asChild:!0,...o,children:u})});GU.displayName=VU;var _E="PopoverPortal",[Zwe,Qwe]=UU(_E,{forceMount:void 0}),YU=e=>{const{__scopePopover:t,forceMount:n,children:r,container:a}=e,o=hs(_E,t);return i.jsx(Zwe,{scope:t,forceMount:n,children:i.jsx(Rn,{present:n||o.open,children:i.jsx(El,{asChild:!0,container:a,children:r})})})};YU.displayName=_E;var Mu="PopoverContent",KU=y.forwardRef((e,t)=>{const n=Qwe(Mu,e.__scopePopover),{forceMount:r=n.forceMount,...a}=e,o=hs(Mu,e.__scopePopover);return i.jsx(Rn,{present:r||o.open,children:o.modal?i.jsx(eje,{...a,ref:t}):i.jsx(tje,{...a,ref:t})})});KU.displayName=Mu;var Jwe=Uwe("PopoverContent.RemoveScroll"),eje=y.forwardRef((e,t)=>{const n=hs(Mu,e.__scopePopover),r=y.useRef(null),a=qe(t,r),o=y.useRef(!1);return y.useEffect(()=>{const l=r.current;if(l)return Dy(l)},[]),i.jsx(Uh,{as:Jwe,allowPinchZoom:!0,children:i.jsx(XU,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Se(e.onCloseAutoFocus,l=>{l.preventDefault(),o.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Se(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,f=u.button===2||d;o.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:Se(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),tje=y.forwardRef((e,t)=>{const n=hs(Mu,e.__scopePopover),r=y.useRef(!1),a=y.useRef(!1);return i.jsx(XU,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(r.current||n.triggerRef.current?.focus(),o.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=o.target;n.triggerRef.current?.contains(l)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),XU=y.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,...p}=e,g=hs(Mu,n),x=Gh(n);return Py(),i.jsx(Fh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:o,children:i.jsx(Ol,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:m,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onDismiss:()=>g.onOpenChange(!1),children:i.jsx(Hy,{"data-state":QU(g.open),role:"dialog",id:g.contentId,...x,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),ZU="PopoverClose",nje=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=hs(ZU,n);return i.jsx(Pe.button,{type:"button",...r,ref:t,onClick:Se(e.onClick,()=>a.onOpenChange(!1))})});nje.displayName=ZU;var rje="PopoverArrow",aje=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=Gh(n);return i.jsx(Wy,{...a,...r,ref:t})});aje.displayName=rje;function QU(e){return e?"open":"closed"}var ije=HU,oje=GU,sje=YU,JU=KU;const ts=ije,ns=oje,so=y.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},a)=>i.jsx(sje,{children:i.jsx(JU,{ref:a,align:t,sideOffset:n,className:de("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",e),...r})}));so.displayName=JU.displayName;const Zu="/api/webui/config";async function lje(){const t=await(await Qe(`${Zu}/bot`)).json();if(!t.success)throw new Error("获取配置数据失败");return t.config}async function Mg(){const t=await(await Qe(`${Zu}/model`)).json();if(!t.success)throw new Error("获取模型配置数据失败");return t.config}async function cje(e){const n=await(await Qe(`${Zu}/bot`,{method:"POST",headers:lt(),body:JSON.stringify(e)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function eH(e){const n=await(await Qe(`${Zu}/model`,{method:"POST",headers:lt(),body:JSON.stringify(e)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function uje(e,t){const r=await(await Qe(`${Zu}/bot/section/${e}`,{method:"POST",headers:lt(),body:JSON.stringify(t)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${e} 失败`)}async function dC(e,t){const r=await(await Qe(`${Zu}/model/section/${e}`,{method:"POST",headers:lt(),body:JSON.stringify(t)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${e} 失败`)}function dje(){const[e,t]=y.useState(!0),[n,r]=y.useState(!1),[a,o]=y.useState(!1),[l,u]=y.useState(!1),{toast:d}=mr(),[f,m]=y.useState(null),[p,g]=y.useState(null),[x,j]=y.useState(null),[b,w]=y.useState(null),[N,A]=y.useState(null),[E,T]=y.useState(null),[C,k]=y.useState(null),[O,M]=y.useState(null),[I,z]=y.useState(null),[D,H]=y.useState(null),[V,F]=y.useState(null),[G,L]=y.useState(null),[R,U]=y.useState(null),[K,te]=y.useState(null),[$,B]=y.useState(null),[Y,ne]=y.useState(null),[oe,xe]=y.useState(null),[ee,ae]=y.useState(null),Z=y.useRef(null),pe=y.useRef(!0),je=y.useRef({}),le=y.useCallback(async()=>{try{t(!0);const ve=await lje();je.current=ve,m(ve.bot),g(ve.personality);const Le=ve.chat;Le.talk_value_rules||(Le.talk_value_rules=[]),j(Le),w(ve.expression),A(ve.emoji),T(ve.memory),k(ve.tool),M(ve.mood),z(ve.voice),H(ve.lpmm_knowledge),F(ve.keyword_reaction),L(ve.response_post_process),U(ve.chinese_typo),te(ve.response_splitter),B(ve.log),ne(ve.debug),xe(ve.maim_message),ae(ve.telemetry),u(!1),pe.current=!1}catch(ve){console.error("加载配置失败:",ve),d({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{t(!1)}},[d]);y.useEffect(()=>{le()},[le]);const Re=y.useCallback(async(ve,Le)=>{if(!pe.current)try{o(!0),await uje(ve,Le),u(!1)}catch(It){console.error(`自动保存 ${ve} 失败:`,It),u(!0)}finally{o(!1)}},[]),_e=y.useCallback((ve,Le)=>{pe.current||(u(!0),Z.current&&clearTimeout(Z.current),Z.current=setTimeout(()=>{Re(ve,Le)},2e3))},[Re]);y.useEffect(()=>{f&&!pe.current&&_e("bot",f)},[f,_e]),y.useEffect(()=>{p&&!pe.current&&_e("personality",p)},[p,_e]),y.useEffect(()=>{x&&!pe.current&&_e("chat",x)},[x,_e]),y.useEffect(()=>{b&&!pe.current&&_e("expression",b)},[b,_e]),y.useEffect(()=>{N&&!pe.current&&_e("emoji",N)},[N,_e]),y.useEffect(()=>{E&&!pe.current&&_e("memory",E)},[E,_e]),y.useEffect(()=>{C&&!pe.current&&_e("tool",C)},[C,_e]),y.useEffect(()=>{O&&!pe.current&&_e("mood",O)},[O,_e]),y.useEffect(()=>{I&&!pe.current&&_e("voice",I)},[I,_e]),y.useEffect(()=>{D&&!pe.current&&_e("lpmm_knowledge",D)},[D,_e]),y.useEffect(()=>{V&&!pe.current&&_e("keyword_reaction",V)},[V,_e]),y.useEffect(()=>{G&&!pe.current&&_e("response_post_process",G)},[G,_e]),y.useEffect(()=>{R&&!pe.current&&_e("chinese_typo",R)},[R,_e]),y.useEffect(()=>{K&&!pe.current&&_e("response_splitter",K)},[K,_e]),y.useEffect(()=>{$&&!pe.current&&_e("log",$)},[$,_e]),y.useEffect(()=>{Y&&!pe.current&&_e("debug",Y)},[Y,_e]),y.useEffect(()=>{oe&&!pe.current&&_e("maim_message",oe)},[oe,_e]),y.useEffect(()=>{ee&&!pe.current&&_e("telemetry",ee)},[ee,_e]);const me=async()=>{try{r(!0),Z.current&&clearTimeout(Z.current);const ve={...je.current,bot:f,personality:p,chat:x,expression:b,emoji:N,memory:E,tool:C,mood:O,voice:I,lpmm_knowledge:D,keyword_reaction:V,response_post_process:G,chinese_typo:R,response_splitter:K,log:$,debug:Y,maim_message:oe,telemetry:ee};await cje(ve),u(!1),d({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(ve){console.error("保存配置失败:",ve),d({title:"保存失败",description:ve.message,variant:"destructive"})}finally{r(!1)}};return e?i.jsx(Vt,{className:"h-full",children:i.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:i.jsx("div",{className:"flex items-center justify-center h-64",children:i.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):i.jsx(Vt,{className:"h-full",children:i.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),i.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),i.jsxs(ue,{onClick:me,disabled:n||a||!l,size:"sm",className:"w-full sm:w-auto",children:[i.jsx(ZO,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":a?"自动保存中...":l?"保存配置":"已保存"]})]}),i.jsxs(ul,{defaultValue:"bot",className:"w-full",children:[i.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:i.jsxs(Qo,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[i.jsx(Ot,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),i.jsx(Ot,{value:"personality",className:"flex-shrink-0",children:"人格"}),i.jsx(Ot,{value:"chat",className:"flex-shrink-0",children:"聊天"}),i.jsx(Ot,{value:"expression",className:"flex-shrink-0",children:"表达"}),i.jsx(Ot,{value:"features",className:"flex-shrink-0",children:"功能"}),i.jsx(Ot,{value:"processing",className:"flex-shrink-0",children:"处理"}),i.jsx(Ot,{value:"mood",className:"flex-shrink-0",children:"情绪"}),i.jsx(Ot,{value:"voice",className:"flex-shrink-0",children:"语音"}),i.jsx(Ot,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),i.jsx(Ot,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),i.jsx(en,{value:"bot",className:"space-y-4",children:f&&i.jsx(fje,{config:f,onChange:m})}),i.jsx(en,{value:"personality",className:"space-y-4",children:p&&i.jsx(hje,{config:p,onChange:g})}),i.jsx(en,{value:"chat",className:"space-y-4",children:x&&i.jsx(mje,{config:x,onChange:j})}),i.jsx(en,{value:"expression",className:"space-y-4",children:b&&i.jsx(pje,{config:b,onChange:w})}),i.jsx(en,{value:"features",className:"space-y-4",children:N&&E&&C&&i.jsx(vje,{emojiConfig:N,memoryConfig:E,toolConfig:C,onEmojiChange:A,onMemoryChange:T,onToolChange:k})}),i.jsx(en,{value:"processing",className:"space-y-4",children:V&&G&&R&&K&&i.jsx(gje,{keywordReactionConfig:V,responsePostProcessConfig:G,chineseTypoConfig:R,responseSplitterConfig:K,onKeywordReactionChange:F,onResponsePostProcessChange:L,onChineseTypoChange:U,onResponseSplitterChange:te})}),i.jsx(en,{value:"mood",className:"space-y-4",children:O&&i.jsx(yje,{config:O,onChange:M})}),i.jsx(en,{value:"voice",className:"space-y-4",children:I&&i.jsx(xje,{config:I,onChange:z})}),i.jsx(en,{value:"lpmm",className:"space-y-4",children:D&&i.jsx(bje,{config:D,onChange:H})}),i.jsxs(en,{value:"other",className:"space-y-4",children:[$&&i.jsx(wje,{config:$,onChange:B}),Y&&i.jsx(jje,{config:Y,onChange:ne}),oe&&i.jsx(Sje,{config:oe,onChange:xe}),ee&&i.jsx(_je,{config:ee,onChange:ae})]})]})]})})}function fje({config:e,onChange:t}){const n=()=>{t({...e,platforms:[...e.platforms,""]})},r=d=>{t({...e,platforms:e.platforms.filter((f,m)=>m!==d)})},a=(d,f)=>{const m=[...e.platforms];m[d]=f,t({...e,platforms:m})},o=()=>{t({...e,alias_names:[...e.alias_names,""]})},l=d=>{t({...e,alias_names:e.alias_names.filter((f,m)=>m!==d)})},u=(d,f)=>{const m=[...e.alias_names];m[d]=f,t({...e,alias_names:m})};return i.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),i.jsxs("div",{className:"grid gap-4",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"platform",children:"平台"}),i.jsx(Ne,{id:"platform",value:e.platform,onChange:d=>t({...e,platform:d.target.value}),placeholder:"qq"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"qq_account",children:"QQ账号"}),i.jsx(Ne,{id:"qq_account",value:e.qq_account,onChange:d=>t({...e,qq_account:d.target.value}),placeholder:"123456789"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"nickname",children:"昵称"}),i.jsx(Ne,{id:"nickname",value:e.nickname,onChange:d=>t({...e,nickname:d.target.value}),placeholder:"麦麦"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(J,{children:"其他平台账号"}),i.jsxs(ue,{onClick:n,size:"sm",variant:"outline",children:[i.jsx(tr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),i.jsxs("div",{className:"space-y-2",children:[e.platforms.map((d,f)=>i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Ne,{value:d,onChange:m=>a(f,m.target.value),placeholder:"wx:114514"}),i.jsxs(Pn,{children:[i.jsx(ra,{asChild:!0,children:i.jsx(ue,{size:"icon",variant:"outline",children:i.jsx(Tt,{className:"h-4 w-4"})})}),i.jsxs(yn,{children:[i.jsxs(xn,{children:[i.jsx(wn,{children:"确认删除"}),i.jsxs(jn,{children:['确定要删除平台账号 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),i.jsxs(bn,{children:[i.jsx(_n,{children:"取消"}),i.jsx(Sn,{onClick:()=>r(f),children:"删除"})]})]})]})]},f)),e.platforms.length===0&&i.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(J,{children:"别名"}),i.jsxs(ue,{onClick:o,size:"sm",variant:"outline",children:[i.jsx(tr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),i.jsxs("div",{className:"space-y-2",children:[e.alias_names.map((d,f)=>i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Ne,{value:d,onChange:m=>u(f,m.target.value),placeholder:"小麦"}),i.jsxs(Pn,{children:[i.jsx(ra,{asChild:!0,children:i.jsx(ue,{size:"icon",variant:"outline",children:i.jsx(Tt,{className:"h-4 w-4"})})}),i.jsxs(yn,{children:[i.jsxs(xn,{children:[i.jsx(wn,{children:"确认删除"}),i.jsxs(jn,{children:['确定要删除别名 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),i.jsxs(bn,{children:[i.jsx(_n,{children:"取消"}),i.jsx(Sn,{onClick:()=>l(f),children:"删除"})]})]})]})]},f)),e.alias_names.length===0&&i.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function hje({config:e,onChange:t}){const n=()=>{t({...e,states:[...e.states,""]})},r=o=>{t({...e,states:e.states.filter((l,u)=>u!==o)})},a=(o,l)=>{const u=[...e.states];u[o]=l,t({...e,states:u})};return i.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),i.jsxs("div",{className:"grid gap-4",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"personality",children:"人格特质"}),i.jsx(Wt,{id:"personality",value:e.personality,onChange:o=>t({...e,personality:o.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"reply_style",children:"表达风格"}),i.jsx(Wt,{id:"reply_style",value:e.reply_style,onChange:o=>t({...e,reply_style:o.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"interest",children:"兴趣"}),i.jsx(Wt,{id:"interest",value:e.interest,onChange:o=>t({...e,interest:o.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"plan_style",children:"说话规则与行为风格"}),i.jsx(Wt,{id:"plan_style",value:e.plan_style,onChange:o=>t({...e,plan_style:o.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"visual_style",children:"识图规则"}),i.jsx(Wt,{id:"visual_style",value:e.visual_style,onChange:o=>t({...e,visual_style:o.target.value}),placeholder:"识图时的处理规则",rows:3})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"private_plan_style",children:"私聊规则"}),i.jsx(Wt,{id:"private_plan_style",value:e.private_plan_style,onChange:o=>t({...e,private_plan_style:o.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(J,{children:"状态列表(人格多样性)"}),i.jsxs(ue,{onClick:n,size:"sm",variant:"outline",children:[i.jsx(tr,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),i.jsx("div",{className:"space-y-2",children:e.states.map((o,l)=>i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Wt,{value:o,onChange:u=>a(l,u.target.value),placeholder:"描述一个人格状态",rows:2}),i.jsxs(Pn,{children:[i.jsx(ra,{asChild:!0,children:i.jsx(ue,{size:"icon",variant:"outline",children:i.jsx(Tt,{className:"h-4 w-4"})})}),i.jsxs(yn,{children:[i.jsxs(xn,{children:[i.jsx(wn,{children:"确认删除"}),i.jsx(jn,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),i.jsxs(bn,{children:[i.jsx(_n,{children:"取消"}),i.jsx(Sn,{onClick:()=>r(l),children:"删除"})]})]})]})]},l))})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"state_probability",children:"状态替换概率"}),i.jsx(Ne,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:e.state_probability,onChange:o=>t({...e,state_probability:parseFloat(o.target.value)})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function mje({config:e,onChange:t}){const n=()=>{t({...e,talk_value_rules:[...e.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},r=u=>{t({...e,talk_value_rules:e.talk_value_rules.filter((d,f)=>f!==u)})},a=(u,d,f)=>{const m=[...e.talk_value_rules];m[u]={...m[u],[d]:f},t({...e,talk_value_rules:m})},o=({value:u,onChange:d})=>{const[f,m]=y.useState("00"),[p,g]=y.useState("00"),[x,j]=y.useState("23"),[b,w]=y.useState("59");y.useEffect(()=>{const A=u.split("-");if(A.length===2){const[E,T]=A,[C,k]=E.split(":"),[O,M]=T.split(":");C&&m(C.padStart(2,"0")),k&&g(k.padStart(2,"0")),O&&j(O.padStart(2,"0")),M&&w(M.padStart(2,"0"))}},[u]);const N=(A,E,T,C)=>{const k=`${A}:${E}-${T}:${C}`;d(k)};return i.jsxs(ts,{children:[i.jsx(ns,{asChild:!0,children:i.jsxs(ue,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[i.jsx(ol,{className:"h-4 w-4 mr-2"}),u||"选择时间段"]})}),i.jsx(so,{className:"w-80",children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[i.jsxs("div",{children:[i.jsx(J,{className:"text-xs",children:"小时"}),i.jsxs(Et,{value:f,onValueChange:A=>{m(A),N(A,p,x,b)},children:[i.jsx(wt,{children:i.jsx(At,{})}),i.jsx(jt,{children:Array.from({length:24},(A,E)=>E).map(A=>i.jsx(Me,{value:A.toString().padStart(2,"0"),children:A.toString().padStart(2,"0")},A))})]})]}),i.jsxs("div",{children:[i.jsx(J,{className:"text-xs",children:"分钟"}),i.jsxs(Et,{value:p,onValueChange:A=>{g(A),N(f,A,x,b)},children:[i.jsx(wt,{children:i.jsx(At,{})}),i.jsx(jt,{children:Array.from({length:60},(A,E)=>E).map(A=>i.jsx(Me,{value:A.toString().padStart(2,"0"),children:A.toString().padStart(2,"0")},A))})]})]})]})]}),i.jsxs("div",{children:[i.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[i.jsxs("div",{children:[i.jsx(J,{className:"text-xs",children:"小时"}),i.jsxs(Et,{value:x,onValueChange:A=>{j(A),N(f,p,A,b)},children:[i.jsx(wt,{children:i.jsx(At,{})}),i.jsx(jt,{children:Array.from({length:24},(A,E)=>E).map(A=>i.jsx(Me,{value:A.toString().padStart(2,"0"),children:A.toString().padStart(2,"0")},A))})]})]}),i.jsxs("div",{children:[i.jsx(J,{className:"text-xs",children:"分钟"}),i.jsxs(Et,{value:b,onValueChange:A=>{w(A),N(f,p,x,A)},children:[i.jsx(wt,{children:i.jsx(At,{})}),i.jsx(jt,{children:Array.from({length:60},(A,E)=>E).map(A=>i.jsx(Me,{value:A.toString().padStart(2,"0"),children:A.toString().padStart(2,"0")},A))})]})]})]})]})]})})]})},l=({rule:u})=>{const d=`{ target = "${u.target}", time = "${u.time}", value = ${u.value.toFixed(1)} }`;return i.jsxs(ts,{children:[i.jsx(ns,{asChild:!0,children:i.jsxs(ue,{variant:"outline",size:"sm",children:[i.jsx(Ua,{className:"h-4 w-4 mr-1"}),"预览"]})}),i.jsx(so,{className:"w-96",children:i.jsxs("div",{className:"space-y-2",children:[i.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),i.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:d}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return i.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),i.jsxs("div",{className:"grid gap-4",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),i.jsx(Ne,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:e.talk_value,onChange:u=>t({...e,talk_value:parseFloat(u.target.value)})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"mentioned_bot_reply",children:"提及回复增幅"}),i.jsx(Ne,{id:"mentioned_bot_reply",type:"number",step:"0.1",min:"0",max:"1",value:e.mentioned_bot_reply,onChange:u=>t({...e,mentioned_bot_reply:parseFloat(u.target.value)})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"提及时回复概率增幅,1 为 100% 回复"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"max_context_size",children:"上下文长度"}),i.jsx(Ne,{id:"max_context_size",type:"number",min:"1",value:e.max_context_size,onChange:u=>t({...e,max_context_size:parseInt(u.target.value)})})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"planner_smooth",children:"规划器平滑"}),i.jsx(Ne,{id:"planner_smooth",type:"number",step:"1",min:"0",value:e.planner_smooth,onChange:u=>t({...e,planner_smooth:parseFloat(u.target.value)})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(at,{id:"enable_talk_value_rules",checked:e.enable_talk_value_rules,onCheckedChange:u=>t({...e,enable_talk_value_rules:u})}),i.jsx(J,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(at,{id:"include_planner_reasoning",checked:e.include_planner_reasoning,onCheckedChange:u=>t({...e,include_planner_reasoning:u})}),i.jsx(J,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),e.enable_talk_value_rules&&i.jsxs("div",{className:"border-t pt-6",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{children:[i.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),i.jsxs(ue,{onClick:n,size:"sm",children:[i.jsx(tr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),e.talk_value_rules&&e.talk_value_rules.length>0?i.jsx("div",{className:"space-y-4",children:e.talk_value_rules.map((u,d)=>i.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",d+1]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(l,{rule:u}),i.jsxs(Pn,{children:[i.jsx(ra,{asChild:!0,children:i.jsx(ue,{variant:"ghost",size:"sm",children:i.jsx(Tt,{className:"h-4 w-4 text-destructive"})})}),i.jsxs(yn,{children:[i.jsxs(xn,{children:[i.jsx(wn,{children:"确认删除"}),i.jsxs(jn,{children:["确定要删除规则 #",d+1," 吗?此操作无法撤销。"]})]}),i.jsxs(bn,{children:[i.jsx(_n,{children:"取消"}),i.jsx(Sn,{onClick:()=>r(d),children:"删除"})]})]})]})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{className:"text-xs font-medium",children:"配置类型"}),i.jsxs(Et,{value:u.target===""?"global":"specific",onValueChange:f=>{f==="global"?a(d,"target",""):a(d,"target","qq::group")},children:[i.jsx(wt,{children:i.jsx(At,{})}),i.jsxs(jt,{children:[i.jsx(Me,{value:"global",children:"全局配置"}),i.jsx(Me,{value:"specific",children:"详细配置"})]})]})]}),u.target!==""&&(()=>{const f=u.target.split(":"),m=f[0]||"qq",p=f[1]||"",g=f[2]||"group";return i.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[i.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{className:"text-xs font-medium",children:"平台"}),i.jsxs(Et,{value:m,onValueChange:x=>{a(d,"target",`${x}:${p}:${g}`)},children:[i.jsx(wt,{children:i.jsx(At,{})}),i.jsxs(jt,{children:[i.jsx(Me,{value:"qq",children:"QQ"}),i.jsx(Me,{value:"wx",children:"微信"})]})]})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{className:"text-xs font-medium",children:"群 ID"}),i.jsx(Ne,{value:p,onChange:x=>{a(d,"target",`${m}:${x.target.value}:${g}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{className:"text-xs font-medium",children:"类型"}),i.jsxs(Et,{value:g,onValueChange:x=>{a(d,"target",`${m}:${p}:${x}`)},children:[i.jsx(wt,{children:i.jsx(At,{})}),i.jsxs(jt,{children:[i.jsx(Me,{value:"group",children:"群组(group)"}),i.jsx(Me,{value:"private",children:"私聊(private)"})]})]})]})]}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",u.target||"(未设置)"]})]})})(),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{className:"text-xs font-medium",children:"时间段 (Time)"}),i.jsx(o,{value:u.time,onChange:f=>a(d,"time",f)}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),i.jsxs("div",{className:"grid gap-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(J,{htmlFor:`rule-value-${d}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),i.jsx(Ne,{id:`rule-value-${d}`,type:"number",step:"0.01",min:"0",max:"1",value:u.value,onChange:f=>{const m=parseFloat(f.target.value);isNaN(m)||a(d,"value",Math.max(0,Math.min(1,m)))},className:"w-20 h-8 text-xs"})]}),i.jsx(mE,{value:[u.value],onValueChange:f=>a(d,"value",f[0]),min:0,max:1,step:.01,className:"w-full"}),i.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[i.jsx("span",{children:"0 (完全沉默)"}),i.jsx("span",{children:"0.5"}),i.jsx("span",{children:"1.0 (正常)"})]})]})]})]},d))}):i.jsx("div",{className:"text-center py-8 text-muted-foreground",children:i.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),i.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[i.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),i.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[i.jsxs("li",{children:["• ",i.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),i.jsxs("li",{children:["• ",i.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),i.jsxs("li",{children:["• ",i.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),i.jsxs("li",{children:["• ",i.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),i.jsxs("li",{children:["• ",i.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function pje({config:e,onChange:t}){const n=()=>{t({...e,learning_list:[...e.learning_list,["","enable","enable","1.0"]]})},r=g=>{t({...e,learning_list:e.learning_list.filter((x,j)=>j!==g)})},a=(g,x,j)=>{const b=[...e.learning_list];b[g][x]=j,t({...e,learning_list:b})},o=({rule:g})=>{const x=`["${g[0]}", "${g[1]}", "${g[2]}", "${g[3]}"]`;return i.jsxs(ts,{children:[i.jsx(ns,{asChild:!0,children:i.jsxs(ue,{variant:"outline",size:"sm",children:[i.jsx(Ua,{className:"h-4 w-4 mr-1"}),"预览"]})}),i.jsx(so,{className:"w-96",children:i.jsxs("div",{className:"space-y-2",children:[i.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),i.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:x}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},l=({member:g,groupIndex:x,memberIndex:j,availableChatIds:b})=>{const w=b.includes(g)||g==="*",[N,A]=y.useState(!w);return i.jsxs("div",{className:"flex gap-2",children:[i.jsx("div",{className:"flex-1 flex gap-2",children:N?i.jsxs(i.Fragment,{children:[i.jsx(Ne,{value:g,onChange:E=>p(x,j,E.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),b.length>0&&i.jsx(ue,{size:"sm",variant:"outline",onClick:()=>A(!1),title:"切换到下拉选择",children:"下拉"})]}):i.jsxs(i.Fragment,{children:[i.jsxs(Et,{value:g,onValueChange:E=>p(x,j,E),children:[i.jsx(wt,{className:"flex-1",children:i.jsx(At,{placeholder:"选择聊天流"})}),i.jsxs(jt,{children:[i.jsx(Me,{value:"*",children:"* (全局共享)"}),b.map((E,T)=>i.jsx(Me,{value:E,children:E},T))]})]}),i.jsx(ue,{size:"sm",variant:"outline",onClick:()=>A(!0),title:"切换到手动输入",children:"输入"})]})}),i.jsxs(Pn,{children:[i.jsx(ra,{asChild:!0,children:i.jsx(ue,{size:"icon",variant:"outline",children:i.jsx(Tt,{className:"h-4 w-4"})})}),i.jsxs(yn,{children:[i.jsxs(xn,{children:[i.jsx(wn,{children:"确认删除"}),i.jsxs(jn,{children:['确定要删除组成员 "',g||"(空)",'" 吗?此操作无法撤销。']})]}),i.jsxs(bn,{children:[i.jsx(_n,{children:"取消"}),i.jsx(Sn,{onClick:()=>m(x,j),children:"删除"})]})]})]})]})},u=()=>{t({...e,expression_groups:[...e.expression_groups,[]]})},d=g=>{t({...e,expression_groups:e.expression_groups.filter((x,j)=>j!==g)})},f=g=>{const x=[...e.expression_groups];x[g]=[...x[g],""],t({...e,expression_groups:x})},m=(g,x)=>{const j=[...e.expression_groups];j[g]=j[g].filter((b,w)=>w!==x),t({...e,expression_groups:j})},p=(g,x,j)=>{const b=[...e.expression_groups];b[g][x]=j,t({...e,expression_groups:b})};return i.jsxs("div",{className:"space-y-6",children:[i.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),i.jsxs(ue,{onClick:n,size:"sm",variant:"outline",children:[i.jsx(tr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),i.jsxs("div",{className:"space-y-4",children:[e.learning_list.map((g,x)=>{const j=e.learning_list.some((T,C)=>C!==x&&T[0]===""),b=g[0]==="",w=g[0].split(":"),N=w[0]||"qq",A=w[1]||"",E=w[2]||"group";return i.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("span",{className:"text-sm font-medium",children:["规则 ",x+1," ",b&&"(全局配置)"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(o,{rule:g}),i.jsxs(Pn,{children:[i.jsx(ra,{asChild:!0,children:i.jsx(ue,{size:"sm",variant:"ghost",children:i.jsx(Tt,{className:"h-4 w-4"})})}),i.jsxs(yn,{children:[i.jsxs(xn,{children:[i.jsx(wn,{children:"确认删除"}),i.jsxs(jn,{children:["确定要删除学习规则 ",x+1," 吗?此操作无法撤销。"]})]}),i.jsxs(bn,{children:[i.jsx(_n,{children:"取消"}),i.jsx(Sn,{onClick:()=>r(x),children:"删除"})]})]})]})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{className:"text-xs font-medium",children:"配置类型"}),i.jsxs(Et,{value:b?"global":"specific",onValueChange:T=>{T==="global"?a(x,0,""):a(x,0,"qq::group")},disabled:j&&!b,children:[i.jsx(wt,{children:i.jsx(At,{})}),i.jsxs(jt,{children:[i.jsx(Me,{value:"global",children:"全局配置"}),i.jsx(Me,{value:"specific",disabled:j&&!b,children:"详细配置"})]})]}),j&&!b&&i.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!b&&i.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[i.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{className:"text-xs font-medium",children:"平台"}),i.jsxs(Et,{value:N,onValueChange:T=>{a(x,0,`${T}:${A}:${E}`)},children:[i.jsx(wt,{children:i.jsx(At,{})}),i.jsxs(jt,{children:[i.jsx(Me,{value:"qq",children:"QQ"}),i.jsx(Me,{value:"wx",children:"微信"})]})]})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{className:"text-xs font-medium",children:"群 ID"}),i.jsx(Ne,{value:A,onChange:T=>{a(x,0,`${N}:${T.target.value}:${E}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{className:"text-xs font-medium",children:"类型"}),i.jsxs(Et,{value:E,onValueChange:T=>{a(x,0,`${N}:${A}:${T}`)},children:[i.jsx(wt,{children:i.jsx(At,{})}),i.jsxs(jt,{children:[i.jsx(Me,{value:"group",children:"群组(group)"}),i.jsx(Me,{value:"private",children:"私聊(private)"})]})]})]})]}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",g[0]||"(未设置)"]})]}),i.jsx("div",{className:"grid gap-2",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx(J,{className:"text-xs font-medium",children:"使用学到的表达"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),i.jsx(at,{checked:g[1]==="enable",onCheckedChange:T=>a(x,1,T?"enable":"disable")})]})}),i.jsx("div",{className:"grid gap-2",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx(J,{className:"text-xs font-medium",children:"学习表达"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),i.jsx(at,{checked:g[2]==="enable",onCheckedChange:T=>a(x,2,T?"enable":"disable")})]})}),i.jsxs("div",{className:"grid gap-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(J,{className:"text-xs font-medium",children:"学习强度"}),i.jsx(Ne,{type:"number",step:"0.1",min:"0",max:"5",value:g[3],onChange:T=>{const C=parseFloat(T.target.value);isNaN(C)||a(x,3,Math.max(0,Math.min(5,C)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),i.jsx(mE,{value:[parseFloat(g[3])||1],onValueChange:T=>a(x,3,T[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),i.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[i.jsx("span",{children:"0 (不学习)"}),i.jsx("span",{children:"2.5"}),i.jsx("span",{children:"5.0 (快速学习)"})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},x)}),e.learning_list.length===0&&i.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),i.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),i.jsxs(ue,{onClick:u,size:"sm",variant:"outline",children:[i.jsx(tr,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),i.jsxs("div",{className:"space-y-4",children:[e.expression_groups.map((g,x)=>{const j=e.learning_list.map(b=>b[0]).filter(b=>b!=="");return i.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",x+1,g.length===1&&g[0]==="*"&&"(全局共享)"]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ue,{onClick:()=>f(x),size:"sm",variant:"outline",children:i.jsx(tr,{className:"h-4 w-4"})}),i.jsxs(Pn,{children:[i.jsx(ra,{asChild:!0,children:i.jsx(ue,{size:"sm",variant:"ghost",children:i.jsx(Tt,{className:"h-4 w-4"})})}),i.jsxs(yn,{children:[i.jsxs(xn,{children:[i.jsx(wn,{children:"确认删除"}),i.jsxs(jn,{children:["确定要删除共享组 ",x+1," 吗?此操作无法撤销。"]})]}),i.jsxs(bn,{children:[i.jsx(_n,{children:"取消"}),i.jsx(Sn,{onClick:()=>d(x),children:"删除"})]})]})]})]})]}),i.jsx("div",{className:"space-y-2",children:g.map((b,w)=>i.jsx(l,{member:b,groupIndex:x,memberIndex:w,availableChatIds:j},w))}),i.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},x)}),e.expression_groups.length===0&&i.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function vje({emojiConfig:e,memoryConfig:t,toolConfig:n,onEmojiChange:r,onMemoryChange:a,onToolChange:o}){return i.jsxs("div",{className:"space-y-6",children:[i.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(at,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:l=>o({...n,enable_tool:l})}),i.jsx(J,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),i.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),i.jsx(Ne,{id:"max_agent_iterations",type:"number",min:"1",value:t.max_agent_iterations,onChange:l=>a({...t,max_agent_iterations:parseInt(l.target.value)})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),i.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),i.jsxs("div",{className:"grid gap-4",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"emoji_chance",children:"表情包激活概率"}),i.jsx(Ne,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:e.emoji_chance,onChange:l=>r({...e,emoji_chance:parseFloat(l.target.value)})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"max_reg_num",children:"最大注册数量"}),i.jsx(Ne,{id:"max_reg_num",type:"number",min:"1",value:e.max_reg_num,onChange:l=>r({...e,max_reg_num:parseInt(l.target.value)})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),i.jsx(Ne,{id:"check_interval",type:"number",min:"1",value:e.check_interval,onChange:l=>r({...e,check_interval:parseInt(l.target.value)})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(at,{id:"do_replace",checked:e.do_replace,onCheckedChange:l=>r({...e,do_replace:l})}),i.jsx(J,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(at,{id:"steal_emoji",checked:e.steal_emoji,onCheckedChange:l=>r({...e,steal_emoji:l})}),i.jsx(J,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),i.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(at,{id:"content_filtration",checked:e.content_filtration,onCheckedChange:l=>r({...e,content_filtration:l})}),i.jsx(J,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),e.content_filtration&&i.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[i.jsx(J,{htmlFor:"filtration_prompt",children:"过滤要求"}),i.jsx(Ne,{id:"filtration_prompt",value:e.filtration_prompt,onChange:l=>r({...e,filtration_prompt:l.target.value}),placeholder:"符合公序良俗"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function gje({keywordReactionConfig:e,responsePostProcessConfig:t,chineseTypoConfig:n,responseSplitterConfig:r,onKeywordReactionChange:a,onResponsePostProcessChange:o,onChineseTypoChange:l,onResponseSplitterChange:u}){const d=()=>{a({...e,regex_rules:[...e.regex_rules,{regex:[""],reaction:""}]})},f=T=>{a({...e,regex_rules:e.regex_rules.filter((C,k)=>k!==T)})},m=(T,C,k)=>{const O=[...e.regex_rules];C==="regex"&&typeof k=="string"?O[T]={...O[T],regex:[k]}:C==="reaction"&&typeof k=="string"&&(O[T]={...O[T],reaction:k}),a({...e,regex_rules:O})},p=({regex:T,reaction:C,onRegexChange:k,onReactionChange:O})=>{const[M,I]=y.useState(!1),[z,D]=y.useState(""),[H,V]=y.useState(null),[F,G]=y.useState(""),[L,R]=y.useState({}),[U,K]=y.useState(""),te=y.useRef(null),[$,B]=y.useState("build"),Y=ee=>ee.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),ne=(ee,ae=0)=>{const Z=te.current;if(!Z)return;const pe=Z.selectionStart||0,je=Z.selectionEnd||0,le=T.substring(0,pe)+ee+T.substring(je);k(le),setTimeout(()=>{const Re=pe+ee.length+ae;Z.setSelectionRange(Re,Re),Z.focus()},0)};y.useEffect(()=>{if(!T||!z){V(null),R({}),K(C),G("");return}try{const ee=Y(T),ae=new RegExp(ee,"g"),Z=z.match(ae);V(Z),G("");const je=new RegExp(ee).exec(z);if(je&&je.groups){R(je.groups);let le=C;Object.entries(je.groups).forEach(([Re,_e])=>{le=le.replace(new RegExp(`\\[${Re}\\]`,"g"),_e||"")}),K(le)}else R({}),K(C)}catch(ee){G(ee.message),V(null),R({}),K(C)}},[T,z,C]);const oe=()=>{if(!z||!H||H.length===0)return i.jsx("span",{className:"text-muted-foreground",children:z||"请输入测试文本"});try{const ee=Y(T),ae=new RegExp(ee,"g");let Z=0;const pe=[];let je;for(;(je=ae.exec(z))!==null;)je.index>Z&&pe.push(i.jsx("span",{children:z.substring(Z,je.index)},`text-${Z}`)),pe.push(i.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:je[0]},`match-${je.index}`)),Z=je.index+je[0].length;return Z)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return i.jsxs(nr,{open:M,onOpenChange:I,children:[i.jsx(WF,{asChild:!0,children:i.jsxs(ue,{variant:"outline",size:"sm",children:[i.jsx(wg,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),i.jsxs(Hn,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[i.jsxs(Wn,{children:[i.jsx(Vn,{children:"正则表达式编辑器"}),i.jsx(dr,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),i.jsx(Vt,{className:"max-h-[calc(90vh-120px)]",children:i.jsxs(ul,{value:$,onValueChange:ee=>B(ee),className:"w-full",children:[i.jsxs(Qo,{className:"grid w-full grid-cols-2",children:[i.jsx(Ot,{value:"build",children:"🔧 构建器"}),i.jsx(Ot,{value:"test",children:"🧪 测试器"})]}),i.jsxs(en,{value:"build",className:"space-y-4 mt-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{className:"text-sm font-medium",children:"正则表达式"}),i.jsx(Ne,{ref:te,value:T,onChange:ee=>k(ee.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{className:"text-sm font-medium",children:"Reaction 内容"}),i.jsx(Wt,{value:C,onChange:ee=>O(ee.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),i.jsxs("div",{className:"space-y-4 border-t pt-4",children:[xe.map(ee=>i.jsxs("div",{className:"space-y-2",children:[i.jsx("h5",{className:"text-xs font-semibold text-primary",children:ee.category}),i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:ee.items.map(ae=>i.jsx(ue,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>ne(ae.pattern,ae.moveCursor||0),children:i.jsxs("div",{className:"flex flex-col items-start w-full",children:[i.jsxs("div",{className:"flex items-center gap-2 w-full",children:[i.jsx("span",{className:"text-xs font-medium",children:ae.label}),i.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:ae.pattern})]}),i.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:ae.desc})]})},ae.label))})]},ee.category)),i.jsxs("div",{className:"space-y-2 border-t pt-4",children:[i.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(ue,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>k("^(?P\\S{1,20})是这样的$"),children:i.jsxs("div",{className:"flex flex-col items-start w-full",children:[i.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),i.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),i.jsx(ue,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>k("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:i.jsxs("div",{className:"flex flex-col items-start w-full",children:[i.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),i.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),i.jsx(ue,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>k("(?P.+?)(?:是|为什么|怎么)"),children:i.jsxs("div",{className:"flex flex-col items-start w-full",children:[i.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),i.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),i.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[i.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),i.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[i.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),i.jsxs("li",{children:["命名捕获组格式:",i.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),i.jsxs("li",{children:["在 reaction 中使用 ",i.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),i.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),i.jsxs(en,{value:"test",className:"space-y-4 mt-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{className:"text-sm font-medium",children:"当前正则表达式"}),i.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:T||"(未设置)"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),i.jsx(Wt,{id:"test-text",value:z,onChange:ee=>D(ee.target.value),placeholder:`在此输入要测试的文本... 例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),F&&i.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[i.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),i.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:F})]}),!F&&z&&i.jsxs("div",{className:"space-y-3",children:[i.jsx("div",{className:"flex items-center gap-2",children:H&&H.length>0?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),i.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",H.length," 处)"]})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),i.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{className:"text-sm font-medium",children:"匹配高亮"}),i.jsx(Vt,{className:"h-40 rounded-md bg-muted p-3",children:i.jsx("div",{className:"text-sm break-words",children:oe()})})]}),Object.keys(L).length>0&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{className:"text-sm font-medium",children:"命名捕获组"}),i.jsx(Vt,{className:"h-32 rounded-md border p-3",children:i.jsx("div",{className:"space-y-2",children:Object.entries(L).map(([ee,ae])=>i.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[i.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",ee,"]"]}),i.jsx("span",{className:"text-muted-foreground",children:"="}),i.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:ae})]},ee))})})]}),Object.keys(L).length>0&&C&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{className:"text-sm font-medium",children:"Reaction 替换预览"}),i.jsx(Vt,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:i.jsx("div",{className:"text-sm break-words",children:U})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),i.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[i.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),i.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[i.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),i.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),i.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),i.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},g=()=>{a({...e,keyword_rules:[...e.keyword_rules,{keywords:[],reaction:""}]})},x=T=>{a({...e,keyword_rules:e.keyword_rules.filter((C,k)=>k!==T)})},j=(T,C,k)=>{const O=[...e.keyword_rules];typeof k=="string"&&(O[T]={...O[T],reaction:k}),a({...e,keyword_rules:O})},b=T=>{const C=[...e.keyword_rules];C[T]={...C[T],keywords:[...C[T].keywords||[],""]},a({...e,keyword_rules:C})},w=(T,C)=>{const k=[...e.keyword_rules];k[T]={...k[T],keywords:(k[T].keywords||[]).filter((O,M)=>M!==C)},a({...e,keyword_rules:k})},N=(T,C,k)=>{const O=[...e.keyword_rules],M=[...O[T].keywords||[]];M[C]=k,O[T]={...O[T],keywords:M},a({...e,keyword_rules:O})},A=({rule:T})=>{const C=`{ regex = [${(T.regex||[]).map(k=>`"${k}"`).join(", ")}], reaction = "${T.reaction}" }`;return i.jsxs(ts,{children:[i.jsx(ns,{asChild:!0,children:i.jsxs(ue,{variant:"outline",size:"sm",children:[i.jsx(Ua,{className:"h-4 w-4 mr-1"}),"预览"]})}),i.jsx(so,{className:"w-[95vw] sm:w-[500px]",children:i.jsxs("div",{className:"space-y-2",children:[i.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),i.jsx(Vt,{className:"h-60 rounded-md bg-muted p-3",children:i.jsx("pre",{className:"font-mono text-xs break-all",children:C})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},E=({rule:T})=>{const C=`[[keyword_reaction.keyword_rules]] keywords = [${(T.keywords||[]).map(k=>`"${k}"`).join(", ")}] reaction = "${T.reaction}"`;return i.jsxs(ts,{children:[i.jsx(ns,{asChild:!0,children:i.jsxs(ue,{variant:"outline",size:"sm",children:[i.jsx(Ua,{className:"h-4 w-4 mr-1"}),"预览"]})}),i.jsx(so,{className:"w-[95vw] sm:w-[500px]",children:i.jsxs("div",{className:"space-y-2",children:[i.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),i.jsx(Vt,{className:"h-60 rounded-md bg-muted p-3",children:i.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:C})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),i.jsxs(ue,{onClick:d,size:"sm",variant:"outline",children:[i.jsx(tr,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),i.jsxs("div",{className:"space-y-3",children:[e.regex_rules.map((T,C)=>i.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",C+1]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(p,{regex:T.regex&&T.regex[0]||"",reaction:T.reaction,onRegexChange:k=>m(C,"regex",k),onReactionChange:k=>m(C,"reaction",k)}),i.jsx(A,{rule:T}),i.jsxs(Pn,{children:[i.jsx(ra,{asChild:!0,children:i.jsx(ue,{size:"sm",variant:"ghost",children:i.jsx(Tt,{className:"h-4 w-4"})})}),i.jsxs(yn,{children:[i.jsxs(xn,{children:[i.jsx(wn,{children:"确认删除"}),i.jsxs(jn,{children:["确定要删除正则规则 ",C+1," 吗?此操作无法撤销。"]})]}),i.jsxs(bn,{children:[i.jsx(_n,{children:"取消"}),i.jsx(Sn,{onClick:()=>f(C),children:"删除"})]})]})]})]})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),i.jsx(Ne,{value:T.regex&&T.regex[0]||"",onChange:k=>m(C,"regex",k.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{className:"text-xs font-medium",children:"反应内容"}),i.jsx(Wt,{value:T.reaction,onChange:k=>m(C,"reaction",k.target.value),placeholder:`触发后麦麦的反应... 可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},C)),e.regex_rules.length===0&&i.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),i.jsxs("div",{className:"space-y-4 border-t pt-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),i.jsxs(ue,{onClick:g,size:"sm",variant:"outline",children:[i.jsx(tr,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),i.jsxs("div",{className:"space-y-3",children:[e.keyword_rules.map((T,C)=>i.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",C+1]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(E,{rule:T}),i.jsxs(Pn,{children:[i.jsx(ra,{asChild:!0,children:i.jsx(ue,{size:"sm",variant:"ghost",children:i.jsx(Tt,{className:"h-4 w-4"})})}),i.jsxs(yn,{children:[i.jsxs(xn,{children:[i.jsx(wn,{children:"确认删除"}),i.jsxs(jn,{children:["确定要删除关键词规则 ",C+1," 吗?此操作无法撤销。"]})]}),i.jsxs(bn,{children:[i.jsx(_n,{children:"取消"}),i.jsx(Sn,{onClick:()=>x(C),children:"删除"})]})]})]})]})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(J,{className:"text-xs font-medium",children:"关键词列表"}),i.jsxs(ue,{onClick:()=>b(C),size:"sm",variant:"ghost",children:[i.jsx(tr,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),i.jsxs("div",{className:"space-y-2",children:[(T.keywords||[]).map((k,O)=>i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ne,{value:k,onChange:M=>N(C,O,M.target.value),placeholder:"关键词",className:"flex-1"}),i.jsx(ue,{onClick:()=>w(C,O),size:"sm",variant:"ghost",children:i.jsx(Tt,{className:"h-4 w-4"})})]},O)),(!T.keywords||T.keywords.length===0)&&i.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{className:"text-xs font-medium",children:"反应内容"}),i.jsx(Wt,{value:T.reaction,onChange:k=>j(C,"reaction",k.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},C)),e.keyword_rules.length===0&&i.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),i.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(at,{id:"enable_response_post_process",checked:t.enable_response_post_process,onCheckedChange:T=>o({...t,enable_response_post_process:T})}),i.jsx(J,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),t.enable_response_post_process&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"border-t pt-6 space-y-4",children:i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[i.jsx(at,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:T=>l({...n,enable:T})}),i.jsx(J,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),i.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&i.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),i.jsx(Ne,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:T=>l({...n,error_rate:parseFloat(T.target.value)})})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),i.jsx(Ne,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:T=>l({...n,min_freq:parseInt(T.target.value)})})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),i.jsx(Ne,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:T=>l({...n,tone_error_rate:parseFloat(T.target.value)})})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),i.jsx(Ne,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:T=>l({...n,word_replace_rate:parseFloat(T.target.value)})})]})]})]})}),i.jsx("div",{className:"border-t pt-6 space-y-4",children:i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[i.jsx(at,{id:"enable_response_splitter",checked:r.enable,onCheckedChange:T=>u({...r,enable:T})}),i.jsx(J,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),i.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),r.enable&&i.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),i.jsx(Ne,{id:"max_length",type:"number",min:"1",value:r.max_length,onChange:T=>u({...r,max_length:parseInt(T.target.value)})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),i.jsx(Ne,{id:"max_sentence_num",type:"number",min:"1",value:r.max_sentence_num,onChange:T=>u({...r,max_sentence_num:parseInt(T.target.value)})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(at,{id:"enable_kaomoji_protection",checked:r.enable_kaomoji_protection,onCheckedChange:T=>u({...r,enable_kaomoji_protection:T})}),i.jsx(J,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(at,{id:"enable_overflow_return_all",checked:r.enable_overflow_return_all,onCheckedChange:T=>u({...r,enable_overflow_return_all:T})}),i.jsx(J,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),i.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function yje({config:e,onChange:t}){return i.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[i.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),i.jsxs("div",{className:"grid gap-4",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(at,{checked:e.enable_mood,onCheckedChange:n=>t({...e,enable_mood:n})}),i.jsx(J,{className:"cursor-pointer",children:"启用情绪系统"})]}),e.enable_mood&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"情绪更新阈值"}),i.jsx(Ne,{type:"number",min:"1",value:e.mood_update_threshold,onChange:n=>t({...e,mood_update_threshold:parseInt(n.target.value)})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"情感特征"}),i.jsx(Wt,{value:e.emotion_style,onChange:n=>t({...e,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function xje({config:e,onChange:t}){return i.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[i.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(at,{checked:e.enable_asr,onCheckedChange:n=>t({...e,enable_asr:n})}),i.jsx(J,{className:"cursor-pointer",children:"启用语音识别"})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function bje({config:e,onChange:t}){return i.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[i.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),i.jsxs("div",{className:"grid gap-4",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(at,{checked:e.enable,onCheckedChange:n=>t({...e,enable:n})}),i.jsx(J,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),e.enable&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"LPMM 模式"}),i.jsxs(Et,{value:e.lpmm_mode,onValueChange:n=>t({...e,lpmm_mode:n}),children:[i.jsx(wt,{children:i.jsx(At,{placeholder:"选择 LPMM 模式"})}),i.jsxs(jt,{children:[i.jsx(Me,{value:"classic",children:"经典模式"}),i.jsx(Me,{value:"agent",children:"Agent 模式"})]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"同义词搜索 TopK"}),i.jsx(Ne,{type:"number",min:"1",value:e.rag_synonym_search_top_k,onChange:n=>t({...e,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"同义词阈值"}),i.jsx(Ne,{type:"number",step:"0.1",min:"0",max:"1",value:e.rag_synonym_threshold,onChange:n=>t({...e,rag_synonym_threshold:parseFloat(n.target.value)})})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"实体提取线程数"}),i.jsx(Ne,{type:"number",min:"1",value:e.info_extraction_workers,onChange:n=>t({...e,info_extraction_workers:parseInt(n.target.value)})})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"嵌入向量维度"}),i.jsx(Ne,{type:"number",min:"1",value:e.embedding_dimension,onChange:n=>t({...e,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function wje({config:e,onChange:t}){const[n,r]=y.useState(""),[a,o]=y.useState("WARNING"),l=()=>{n&&!e.suppress_libraries.includes(n)&&(t({...e,suppress_libraries:[...e.suppress_libraries,n]}),r(""))},u=x=>{t({...e,suppress_libraries:e.suppress_libraries.filter(j=>j!==x)})},d=()=>{n&&!e.library_log_levels[n]&&(t({...e,library_log_levels:{...e.library_log_levels,[n]:a}}),r(""),o("WARNING"))},f=x=>{const j={...e.library_log_levels};delete j[x],t({...e,library_log_levels:j})},m=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],p=["FULL","compact","lite"],g=["none","title","full"];return i.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"日期格式"}),i.jsx(Ne,{value:e.date_style,onChange:x=>t({...e,date_style:x.target.value}),placeholder:"例如: m-d H:i:s"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"日志级别样式"}),i.jsxs(Et,{value:e.log_level_style,onValueChange:x=>t({...e,log_level_style:x}),children:[i.jsx(wt,{children:i.jsx(At,{})}),i.jsx(jt,{children:p.map(x=>i.jsx(Me,{value:x,children:x},x))})]})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"日志文本颜色"}),i.jsxs(Et,{value:e.color_text,onValueChange:x=>t({...e,color_text:x}),children:[i.jsx(wt,{children:i.jsx(At,{})}),i.jsx(jt,{children:g.map(x=>i.jsx(Me,{value:x,children:x},x))})]})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"全局日志级别"}),i.jsxs(Et,{value:e.log_level,onValueChange:x=>t({...e,log_level:x}),children:[i.jsx(wt,{children:i.jsx(At,{})}),i.jsx(jt,{children:m.map(x=>i.jsx(Me,{value:x,children:x},x))})]})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"控制台日志级别"}),i.jsxs(Et,{value:e.console_log_level,onValueChange:x=>t({...e,console_log_level:x}),children:[i.jsx(wt,{children:i.jsx(At,{})}),i.jsx(jt,{children:m.map(x=>i.jsx(Me,{value:x,children:x},x))})]})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"文件日志级别"}),i.jsxs(Et,{value:e.file_log_level,onValueChange:x=>t({...e,file_log_level:x}),children:[i.jsx(wt,{children:i.jsx(At,{})}),i.jsx(jt,{children:m.map(x=>i.jsx(Me,{value:x,children:x},x))})]})]})]})]}),i.jsxs("div",{children:[i.jsx(J,{className:"mb-2 block",children:"完全屏蔽的库"}),i.jsxs("div",{className:"flex gap-2 mb-2",children:[i.jsx(Ne,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),l())}}),i.jsx(ue,{onClick:l,size:"sm",className:"flex-shrink-0",children:i.jsx(tr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),i.jsx("div",{className:"flex flex-wrap gap-2",children:e.suppress_libraries.map(x=>i.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[i.jsx("span",{className:"text-sm",children:x}),i.jsx(ue,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>u(x),children:i.jsx(Tt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},x))})]}),i.jsxs("div",{children:[i.jsx(J,{className:"mb-2 block",children:"特定库的日志级别"}),i.jsxs("div",{className:"flex gap-2 mb-2",children:[i.jsx(Ne,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1"}),i.jsxs(Et,{value:a,onValueChange:o,children:[i.jsx(wt,{className:"w-32",children:i.jsx(At,{})}),i.jsx(jt,{children:m.map(x=>i.jsx(Me,{value:x,children:x},x))})]}),i.jsx(ue,{onClick:d,size:"sm",children:i.jsx(tr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),i.jsx("div",{className:"space-y-2",children:Object.entries(e.library_log_levels).map(([x,j])=>i.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[i.jsx("span",{className:"text-sm font-medium",children:x}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-sm text-muted-foreground",children:j}),i.jsx(ue,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>f(x),children:i.jsx(Tt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},x))})]})]})}function jje({config:e,onChange:t}){return i.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[i.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(J,{children:"显示 Prompt"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),i.jsx(at,{checked:e.show_prompt,onCheckedChange:n=>t({...e,show_prompt:n})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(J,{children:"显示回复器 Prompt"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),i.jsx(at,{checked:e.show_replyer_prompt,onCheckedChange:n=>t({...e,show_replyer_prompt:n})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(J,{children:"显示回复器推理"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),i.jsx(at,{checked:e.show_replyer_reasoning,onCheckedChange:n=>t({...e,show_replyer_reasoning:n})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(J,{children:"显示 Jargon Prompt"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),i.jsx(at,{checked:e.show_jargon_prompt,onCheckedChange:n=>t({...e,show_jargon_prompt:n})})]})]})]})}function Sje({config:e,onChange:t}){const[n,r]=y.useState(""),a=()=>{n&&!e.auth_token.includes(n)&&(t({...e,auth_token:[...e.auth_token,n]}),r(""))},o=l=>{t({...e,auth_token:e.auth_token.filter((u,d)=>d!==l)})};return i.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(J,{children:"启用自定义服务器"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),i.jsx(at,{checked:e.use_custom,onCheckedChange:l=>t({...e,use_custom:l})})]}),e.use_custom&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"主机地址"}),i.jsx(Ne,{value:e.host,onChange:l=>t({...e,host:l.target.value}),placeholder:"127.0.0.1"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"端口号"}),i.jsx(Ne,{type:"number",value:e.port,onChange:l=>t({...e,port:parseInt(l.target.value)}),placeholder:"8090"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"连接模式"}),i.jsxs(Et,{value:e.mode,onValueChange:l=>t({...e,mode:l}),children:[i.jsx(wt,{children:i.jsx(At,{})}),i.jsxs(jt,{children:[i.jsx(Me,{value:"ws",children:"WebSocket (ws)"}),i.jsx(Me,{value:"tcp",children:"TCP"})]})]})]}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(at,{checked:e.use_wss,onCheckedChange:l=>t({...e,use_wss:l}),disabled:e.mode!=="ws"}),i.jsx(J,{children:"使用 WSS 安全连接"})]})]}),e.use_wss&&e.mode==="ws"&&i.jsxs("div",{className:"grid gap-4",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"SSL 证书文件路径"}),i.jsx(Ne,{value:e.cert_file,onChange:l=>t({...e,cert_file:l.target.value}),placeholder:"cert.pem"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"SSL 密钥文件路径"}),i.jsx(Ne,{value:e.key_file,onChange:l=>t({...e,key_file:l.target.value}),placeholder:"key.pem"})]})]})]})]})]}),i.jsxs("div",{children:[i.jsx(J,{className:"mb-2 block",children:"认证令牌"}),i.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),i.jsxs("div",{className:"flex gap-2 mb-2",children:[i.jsx(Ne,{value:n,onChange:l=>r(l.target.value),placeholder:"输入认证令牌",onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),a())}}),i.jsx(ue,{onClick:a,size:"sm",children:i.jsx(tr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),i.jsx("div",{className:"space-y-2",children:e.auth_token.map((l,u)=>i.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[i.jsx("span",{className:"text-sm font-mono",children:l}),i.jsx(ue,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>o(u),children:i.jsx(Tt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},u))})]})]})}function _je({config:e,onChange:t}){return i.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[i.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(J,{children:"启用统计信息发送"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),i.jsx(at,{checked:e.enable,onCheckedChange:n=>t({...e,enable:n})})]})]})}const Al=y.forwardRef(({className:e,...t},n)=>i.jsx("div",{className:"relative w-full overflow-auto",children:i.jsx("table",{ref:n,className:de("w-full caption-bottom text-sm",e),...t})}));Al.displayName="Table";const Tl=y.forwardRef(({className:e,...t},n)=>i.jsx("thead",{ref:n,className:de("[&_tr]:border-b",e),...t}));Tl.displayName="TableHeader";const kl=y.forwardRef(({className:e,...t},n)=>i.jsx("tbody",{ref:n,className:de("[&_tr:last-child]:border-0",e),...t}));kl.displayName="TableBody";const Nje=y.forwardRef(({className:e,...t},n)=>i.jsx("tfoot",{ref:n,className:de("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));Nje.displayName="TableFooter";const vn=y.forwardRef(({className:e,...t},n)=>i.jsx("tr",{ref:n,className:de("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));vn.displayName="TableRow";const Ze=y.forwardRef(({className:e,...t},n)=>i.jsx("th",{ref:n,className:de("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));Ze.displayName="TableHead";const Ue=y.forwardRef(({className:e,...t},n)=>i.jsx("td",{ref:n,className:de("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));Ue.displayName="TableCell";const Cje=y.forwardRef(({className:e,...t},n)=>i.jsx("caption",{ref:n,className:de("mt-4 text-sm text-muted-foreground",e),...t}));Cje.displayName="TableCaption";var Zy="Checkbox",[Oje]=hr(Zy),[Eje,NE]=Oje(Zy);function Aje(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:a,disabled:o,form:l,name:u,onCheckedChange:d,required:f,value:m="on",internal_do_not_use_render:p}=e,[g,x]=Na({prop:n,defaultProp:a??!1,onChange:d,caller:Zy}),[j,b]=y.useState(null),[w,N]=y.useState(null),A=y.useRef(!1),E=j?!!l||!!j.closest("form"):!0,T={checked:g,disabled:o,setChecked:x,control:j,setControl:b,name:u,form:l,value:m,hasConsumerStoppedPropagationRef:A,required:f,defaultChecked:Zo(a)?!1:a,isFormControl:E,bubbleInput:w,setBubbleInput:N};return i.jsx(Eje,{scope:t,...T,children:Tje(p)?p(T):r})}var tH="CheckboxTrigger",nH=y.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},a)=>{const{control:o,value:l,disabled:u,checked:d,required:f,setControl:m,setChecked:p,hasConsumerStoppedPropagationRef:g,isFormControl:x,bubbleInput:j}=NE(tH,e),b=qe(a,m),w=y.useRef(d);return y.useEffect(()=>{const N=o?.form;if(N){const A=()=>p(w.current);return N.addEventListener("reset",A),()=>N.removeEventListener("reset",A)}},[o,p]),i.jsx(Pe.button,{type:"button",role:"checkbox","aria-checked":Zo(d)?"mixed":d,"aria-required":f,"data-state":sH(d),"data-disabled":u?"":void 0,disabled:u,value:l,...r,ref:b,onKeyDown:Se(t,N=>{N.key==="Enter"&&N.preventDefault()}),onClick:Se(n,N=>{p(A=>Zo(A)?!0:!A),j&&x&&(g.current=N.isPropagationStopped(),g.current||N.stopPropagation())})})});nH.displayName=tH;var CE=y.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:a,defaultChecked:o,required:l,disabled:u,value:d,onCheckedChange:f,form:m,...p}=e;return i.jsx(Aje,{__scopeCheckbox:n,checked:a,defaultChecked:o,disabled:u,required:l,onCheckedChange:f,name:r,form:m,value:d,internal_do_not_use_render:({isFormControl:g})=>i.jsxs(i.Fragment,{children:[i.jsx(nH,{...p,ref:t,__scopeCheckbox:n}),g&&i.jsx(oH,{__scopeCheckbox:n})]})})});CE.displayName=Zy;var rH="CheckboxIndicator",aH=y.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...a}=e,o=NE(rH,n);return i.jsx(Rn,{present:r||Zo(o.checked)||o.checked===!0,children:i.jsx(Pe.span,{"data-state":sH(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});aH.displayName=rH;var iH="CheckboxBubbleInput",oH=y.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:a,checked:o,defaultChecked:l,required:u,disabled:d,name:f,value:m,form:p,bubbleInput:g,setBubbleInput:x}=NE(iH,e),j=qe(n,x),b=Ty(o),w=ky(r);y.useEffect(()=>{const A=g;if(!A)return;const E=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(E,"checked").set,k=!a.current;if(b!==o&&C){const O=new Event("click",{bubbles:k});A.indeterminate=Zo(o),C.call(A,Zo(o)?!1:o),A.dispatchEvent(O)}},[g,b,o,a]);const N=y.useRef(Zo(o)?!1:o);return i.jsx(Pe.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??N.current,required:u,disabled:d,name:f,value:m,form:p,...t,tabIndex:-1,ref:j,style:{...t.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});oH.displayName=iH;function Tje(e){return typeof e=="function"}function Zo(e){return e==="indeterminate"}function sH(e){return Zo(e)?"indeterminate":e?"checked":"unchecked"}const rs=y.forwardRef(({className:e,...t},n)=>i.jsx(CE,{ref:n,className:de("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:i.jsx(aH,{className:de("grid place-content-center text-current"),children:i.jsx(il,{className:"h-4 w-4"})})}));rs.displayName=CE.displayName;function kje(){const[e,t]=y.useState([]),[n,r]=y.useState(!0),[a,o]=y.useState(!1),[l,u]=y.useState(!1),[d,f]=y.useState(!1),[m,p]=y.useState(!1),[g,x]=y.useState(null),[j,b]=y.useState(null),[w,N]=y.useState(!1),[A,E]=y.useState(null),[T,C]=y.useState(!1),[k,O]=y.useState(""),[M,I]=y.useState(new Set),[z,D]=y.useState(!1),{toast:H}=mr(),V=y.useRef(null),F=y.useRef(!0);y.useEffect(()=>{G()},[]);const G=async()=>{try{r(!0);const ae=await Mg();t(ae.api_providers||[]),f(!1),F.current=!1}catch(ae){console.error("加载配置失败:",ae)}finally{r(!1)}},L=y.useCallback(async ae=>{if(!F.current)try{u(!0),await dC("api_providers",ae),f(!1)}catch(Z){console.error("自动保存失败:",Z),f(!0)}finally{u(!1)}},[]);y.useEffect(()=>{if(!F.current)return f(!0),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{L(e)},2e3),()=>{V.current&&clearTimeout(V.current)}},[e,L]);const R=async()=>{try{o(!0),V.current&&clearTimeout(V.current);const ae=await Mg();ae.api_providers=e,await eH(ae),f(!1),H({title:"保存成功",description:"模型提供商配置已保存"})}catch(ae){console.error("保存配置失败:",ae),H({title:"保存失败",description:ae.message,variant:"destructive"})}finally{o(!1)}},U=(ae,Z)=>{x(ae||{name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),b(Z),C(!1),p(!0)},K=async()=>{if(g?.api_key)try{await navigator.clipboard.writeText(g.api_key),H({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{H({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},te=()=>{if(g){if(j!==null){const ae=[...e];ae[j]=g,t(ae)}else t([...e,g]);p(!1),x(null),b(null)}},$=ae=>{E(ae),N(!0)},B=()=>{if(A!==null){const ae=e.filter((Z,pe)=>pe!==A);t(ae),H({title:"删除成功",description:"提供商已从列表中移除"})}N(!1),E(null)},Y=ae=>{const Z=new Set(M);Z.has(ae)?Z.delete(ae):Z.add(ae),I(Z)},ne=()=>{if(M.size===ee.length)I(new Set);else{const ae=ee.map((Z,pe)=>e.findIndex(je=>je===ee[pe]));I(new Set(ae))}},oe=()=>{if(M.size===0){H({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}D(!0)},xe=()=>{const ae=e.filter((Z,pe)=>!M.has(pe));t(ae),I(new Set),D(!1),H({title:"批量删除成功",description:`已删除 ${M.size} 个提供商`})},ee=e.filter(ae=>{if(!k)return!0;const Z=k.toLowerCase();return ae.name.toLowerCase().includes(Z)||ae.base_url.toLowerCase().includes(Z)||ae.client_type.toLowerCase().includes(Z)});return n?i.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:i.jsx("div",{className:"flex items-center justify-center h-64",children:i.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):i.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型提供商配置"}),i.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 API 提供商配置"})]}),i.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[M.size>0&&i.jsxs(ue,{onClick:oe,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[i.jsx(Tt,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",M.size,")"]}),i.jsxs(ue,{onClick:()=>U(null,null),size:"sm",className:"w-full sm:w-auto",children:[i.jsx(tr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),i.jsxs(ue,{onClick:R,disabled:a||l||!d,size:"sm",variant:"default",className:"w-full sm:w-auto",children:[i.jsx(ZO,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),a?"保存中...":l?"自动保存中...":d?"保存配置":"已保存"]})]})]}),i.jsxs(Vt,{className:"h-[calc(100vh-260px)]",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[i.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),i.jsx(Ne,{placeholder:"搜索提供商名称、URL 或类型...",value:k,onChange:ae=>O(ae.target.value),className:"pl-9"})]}),k&&i.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",ee.length," 个结果"]})]}),i.jsx("div",{className:"md:hidden space-y-3",children:ee.length===0?i.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:k?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):ee.map((ae,Z)=>i.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("h3",{className:"font-semibold text-base truncate",children:ae.name}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:ae.base_url})]}),i.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[i.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>U(ae,Z),children:i.jsx(Au,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),i.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>$(Z),children:i.jsx(Tt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),i.jsx("p",{className:"font-medium",children:ae.client_type})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),i.jsx("p",{className:"font-medium",children:ae.max_retry})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),i.jsx("p",{className:"font-medium",children:ae.timeout})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),i.jsx("p",{className:"font-medium",children:ae.retry_interval})]})]})]},Z))}),i.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:i.jsxs(Al,{children:[i.jsx(Tl,{children:i.jsxs(vn,{children:[i.jsx(Ze,{className:"w-12",children:i.jsx(rs,{checked:M.size===ee.length&&ee.length>0,onCheckedChange:ne})}),i.jsx(Ze,{children:"名称"}),i.jsx(Ze,{children:"基础URL"}),i.jsx(Ze,{children:"客户端类型"}),i.jsx(Ze,{className:"text-right",children:"最大重试"}),i.jsx(Ze,{className:"text-right",children:"超时(秒)"}),i.jsx(Ze,{className:"text-right",children:"重试间隔(秒)"}),i.jsx(Ze,{className:"text-right",children:"操作"})]})}),i.jsx(kl,{children:ee.length===0?i.jsx(vn,{children:i.jsx(Ue,{colSpan:8,className:"text-center text-muted-foreground py-8",children:k?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):ee.map((ae,Z)=>{const pe=e.findIndex(je=>je===ae);return i.jsxs(vn,{children:[i.jsx(Ue,{children:i.jsx(rs,{checked:M.has(pe),onCheckedChange:()=>Y(pe)})}),i.jsx(Ue,{className:"font-medium",children:ae.name}),i.jsx(Ue,{className:"max-w-xs truncate",title:ae.base_url,children:ae.base_url}),i.jsx(Ue,{children:ae.client_type}),i.jsx(Ue,{className:"text-right",children:ae.max_retry}),i.jsx(Ue,{className:"text-right",children:ae.timeout}),i.jsx(Ue,{className:"text-right",children:ae.retry_interval}),i.jsx(Ue,{className:"text-right",children:i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>U(ae,pe),children:i.jsx(Au,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),i.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>$(pe),children:i.jsx(Tt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]})})]},Z)})})]})})]}),i.jsx(nr,{open:m,onOpenChange:p,children:i.jsxs(Hn,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[i.jsxs(Wn,{children:[i.jsx(Vn,{children:j!==null?"编辑提供商":"添加提供商"}),i.jsx(dr,{children:"配置 API 提供商的连接信息和参数"})]}),i.jsxs("div",{className:"grid gap-4 py-4",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"name",children:"名称 *"}),i.jsx(Ne,{id:"name",value:g?.name||"",onChange:ae=>x(Z=>Z?{...Z,name:ae.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"base_url",children:"基础 URL *"}),i.jsx(Ne,{id:"base_url",value:g?.base_url||"",onChange:ae=>x(Z=>Z?{...Z,base_url:ae.target.value}:null),placeholder:"https://api.example.com/v1"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"api_key",children:"API Key *"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Ne,{id:"api_key",type:T?"text":"password",value:g?.api_key||"",onChange:ae=>x(Z=>Z?{...Z,api_key:ae.target.value}:null),placeholder:"sk-...",className:"flex-1"}),i.jsx(ue,{type:"button",variant:"outline",size:"icon",onClick:()=>C(!T),title:T?"隐藏密钥":"显示密钥",children:T?i.jsx(VN,{className:"h-4 w-4"}):i.jsx(Ua,{className:"h-4 w-4"})}),i.jsx(ue,{type:"button",variant:"outline",size:"icon",onClick:K,title:"复制密钥",children:i.jsx(HN,{className:"h-4 w-4"})})]})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"client_type",children:"客户端类型"}),i.jsxs(Et,{value:g?.client_type||"openai",onValueChange:ae=>x(Z=>Z?{...Z,client_type:ae}:null),children:[i.jsx(wt,{id:"client_type",children:i.jsx(At,{placeholder:"选择客户端类型"})}),i.jsxs(jt,{children:[i.jsx(Me,{value:"openai",children:"OpenAI"}),i.jsx(Me,{value:"gemini",children:"Gemini"})]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"max_retry",children:"最大重试"}),i.jsx(Ne,{id:"max_retry",type:"number",min:"0",value:g?.max_retry||2,onChange:ae=>x(Z=>Z?{...Z,max_retry:parseInt(ae.target.value)}:null)})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"timeout",children:"超时(秒)"}),i.jsx(Ne,{id:"timeout",type:"number",min:"1",value:g?.timeout||30,onChange:ae=>x(Z=>Z?{...Z,timeout:parseInt(ae.target.value)}:null)})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),i.jsx(Ne,{id:"retry_interval",type:"number",min:"1",value:g?.retry_interval||10,onChange:ae=>x(Z=>Z?{...Z,retry_interval:parseInt(ae.target.value)}:null)})]})]})]}),i.jsxs($r,{children:[i.jsx(ue,{variant:"outline",onClick:()=>p(!1),children:"取消"}),i.jsx(ue,{onClick:te,children:"保存"})]})]})}),i.jsx(Pn,{open:w,onOpenChange:N,children:i.jsxs(yn,{children:[i.jsxs(xn,{children:[i.jsx(wn,{children:"确认删除"}),i.jsxs(jn,{children:['确定要删除提供商 "',A!==null?e[A]?.name:"",'" 吗? 此操作无法撤销。']})]}),i.jsxs(bn,{children:[i.jsx(_n,{children:"取消"}),i.jsx(Sn,{onClick:B,children:"删除"})]})]})}),i.jsx(Pn,{open:z,onOpenChange:D,children:i.jsxs(yn,{children:[i.jsxs(xn,{children:[i.jsx(wn,{children:"确认批量删除"}),i.jsxs(jn,{children:["确定要删除选中的 ",M.size," 个提供商吗? 此操作无法撤销。"]})]}),i.jsxs(bn,{children:[i.jsx(_n,{children:"取消"}),i.jsx(Sn,{onClick:xe,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}var _L=1,Mje=.9,Pje=.8,Rje=.17,n_=.1,r_=.999,Dje=.9999,$je=.99,Ije=/[\\\/_+.#"@\[\(\{&]/,Lje=/[\\\/_+.#"@\[\(\{&]/g,Bje=/[\s-]/,lH=/[\s-]/g;function fC(e,t,n,r,a,o,l){if(o===t.length)return a===e.length?_L:$je;var u=`${a},${o}`;if(l[u]!==void 0)return l[u];for(var d=r.charAt(o),f=n.indexOf(d,a),m=0,p,g,x,j;f>=0;)p=fC(e,t,n,r,f+1,o+1,l),p>m&&(f===a?p*=_L:Ije.test(e.charAt(f-1))?(p*=Pje,x=e.slice(a,f-1).match(Lje),x&&a>0&&(p*=Math.pow(r_,x.length))):Bje.test(e.charAt(f-1))?(p*=Mje,j=e.slice(a,f-1).match(lH),j&&a>0&&(p*=Math.pow(r_,j.length))):(p*=Rje,a>0&&(p*=Math.pow(r_,f-a))),e.charAt(f)!==t.charAt(o)&&(p*=Dje)),(pp&&(p=g*n_)),p>m&&(m=p),f=n.indexOf(d,f+1);return l[u]=m,m}function NL(e){return e.toLowerCase().replace(lH," ")}function zje(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,fC(e,t,NL(e),NL(t),0,0,{})}var qje=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ms=qje.reduce((e,t)=>{const n=zh(`Primitive.${t}`),r=y.forwardRef((a,o)=>{const{asChild:l,...u}=a,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(d,{...u,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),sf='[cmdk-group=""]',a_='[cmdk-group-items=""]',Fje='[cmdk-group-heading=""]',cH='[cmdk-item=""]',CL=`${cH}:not([aria-disabled="true"])`,hC="cmdk-item-select",Rc="data-value",Uje=(e,t,n)=>zje(e,t,n),uH=y.createContext(void 0),Yh=()=>y.useContext(uH),dH=y.createContext(void 0),OE=()=>y.useContext(dH),fH=y.createContext(void 0),hH=y.forwardRef((e,t)=>{let n=Dc(()=>{var B,Y;return{search:"",value:(Y=(B=e.value)!=null?B:e.defaultValue)!=null?Y:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Dc(()=>new Set),a=Dc(()=>new Map),o=Dc(()=>new Map),l=Dc(()=>new Set),u=mH(e),{label:d,children:f,value:m,onValueChange:p,filter:g,shouldFilter:x,loop:j,disablePointerSelection:b=!1,vimBindings:w=!0,...N}=e,A=Fn(),E=Fn(),T=Fn(),C=y.useRef(null),k=e1e();bl(()=>{if(m!==void 0){let B=m.trim();n.current.value=B,O.emit()}},[m]),bl(()=>{k(6,V)},[]);let O=y.useMemo(()=>({subscribe:B=>(l.current.add(B),()=>l.current.delete(B)),snapshot:()=>n.current,setState:(B,Y,ne)=>{var oe,xe,ee,ae;if(!Object.is(n.current[B],Y)){if(n.current[B]=Y,B==="search")H(),z(),k(1,D);else if(B==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Z=document.getElementById(T);Z?Z.focus():(oe=document.getElementById(A))==null||oe.focus()}if(k(7,()=>{var Z;n.current.selectedItemId=(Z=F())==null?void 0:Z.id,O.emit()}),ne||k(5,V),((xe=u.current)==null?void 0:xe.value)!==void 0){let Z=Y??"";(ae=(ee=u.current).onValueChange)==null||ae.call(ee,Z);return}}O.emit()}},emit:()=>{l.current.forEach(B=>B())}}),[]),M=y.useMemo(()=>({value:(B,Y,ne)=>{var oe;Y!==((oe=o.current.get(B))==null?void 0:oe.value)&&(o.current.set(B,{value:Y,keywords:ne}),n.current.filtered.items.set(B,I(Y,ne)),k(2,()=>{z(),O.emit()}))},item:(B,Y)=>(r.current.add(B),Y&&(a.current.has(Y)?a.current.get(Y).add(B):a.current.set(Y,new Set([B]))),k(3,()=>{H(),z(),n.current.value||D(),O.emit()}),()=>{o.current.delete(B),r.current.delete(B),n.current.filtered.items.delete(B);let ne=F();k(4,()=>{H(),ne?.getAttribute("id")===B&&D(),O.emit()})}),group:B=>(a.current.has(B)||a.current.set(B,new Set),()=>{o.current.delete(B),a.current.delete(B)}),filter:()=>u.current.shouldFilter,label:d||e["aria-label"],getDisablePointerSelection:()=>u.current.disablePointerSelection,listId:A,inputId:T,labelId:E,listInnerRef:C}),[]);function I(B,Y){var ne,oe;let xe=(oe=(ne=u.current)==null?void 0:ne.filter)!=null?oe:Uje;return B?xe(B,n.current.search,Y):0}function z(){if(!n.current.search||u.current.shouldFilter===!1)return;let B=n.current.filtered.items,Y=[];n.current.filtered.groups.forEach(oe=>{let xe=a.current.get(oe),ee=0;xe.forEach(ae=>{let Z=B.get(ae);ee=Math.max(Z,ee)}),Y.push([oe,ee])});let ne=C.current;G().sort((oe,xe)=>{var ee,ae;let Z=oe.getAttribute("id"),pe=xe.getAttribute("id");return((ee=B.get(pe))!=null?ee:0)-((ae=B.get(Z))!=null?ae:0)}).forEach(oe=>{let xe=oe.closest(a_);xe?xe.appendChild(oe.parentElement===xe?oe:oe.closest(`${a_} > *`)):ne.appendChild(oe.parentElement===ne?oe:oe.closest(`${a_} > *`))}),Y.sort((oe,xe)=>xe[1]-oe[1]).forEach(oe=>{var xe;let ee=(xe=C.current)==null?void 0:xe.querySelector(`${sf}[${Rc}="${encodeURIComponent(oe[0])}"]`);ee?.parentElement.appendChild(ee)})}function D(){let B=G().find(ne=>ne.getAttribute("aria-disabled")!=="true"),Y=B?.getAttribute(Rc);O.setState("value",Y||void 0)}function H(){var B,Y,ne,oe;if(!n.current.search||u.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let xe=0;for(let ee of r.current){let ae=(Y=(B=o.current.get(ee))==null?void 0:B.value)!=null?Y:"",Z=(oe=(ne=o.current.get(ee))==null?void 0:ne.keywords)!=null?oe:[],pe=I(ae,Z);n.current.filtered.items.set(ee,pe),pe>0&&xe++}for(let[ee,ae]of a.current)for(let Z of ae)if(n.current.filtered.items.get(Z)>0){n.current.filtered.groups.add(ee);break}n.current.filtered.count=xe}function V(){var B,Y,ne;let oe=F();oe&&(((B=oe.parentElement)==null?void 0:B.firstChild)===oe&&((ne=(Y=oe.closest(sf))==null?void 0:Y.querySelector(Fje))==null||ne.scrollIntoView({block:"nearest"})),oe.scrollIntoView({block:"nearest"}))}function F(){var B;return(B=C.current)==null?void 0:B.querySelector(`${cH}[aria-selected="true"]`)}function G(){var B;return Array.from(((B=C.current)==null?void 0:B.querySelectorAll(CL))||[])}function L(B){let Y=G()[B];Y&&O.setState("value",Y.getAttribute(Rc))}function R(B){var Y;let ne=F(),oe=G(),xe=oe.findIndex(ae=>ae===ne),ee=oe[xe+B];(Y=u.current)!=null&&Y.loop&&(ee=xe+B<0?oe[oe.length-1]:xe+B===oe.length?oe[0]:oe[xe+B]),ee&&O.setState("value",ee.getAttribute(Rc))}function U(B){let Y=F(),ne=Y?.closest(sf),oe;for(;ne&&!oe;)ne=B>0?Qje(ne,sf):Jje(ne,sf),oe=ne?.querySelector(CL);oe?O.setState("value",oe.getAttribute(Rc)):R(B)}let K=()=>L(G().length-1),te=B=>{B.preventDefault(),B.metaKey?K():B.altKey?U(1):R(1)},$=B=>{B.preventDefault(),B.metaKey?L(0):B.altKey?U(-1):R(-1)};return y.createElement(ms.div,{ref:t,tabIndex:-1,...N,"cmdk-root":"",onKeyDown:B=>{var Y;(Y=N.onKeyDown)==null||Y.call(N,B);let ne=B.nativeEvent.isComposing||B.keyCode===229;if(!(B.defaultPrevented||ne))switch(B.key){case"n":case"j":{w&&B.ctrlKey&&te(B);break}case"ArrowDown":{te(B);break}case"p":case"k":{w&&B.ctrlKey&&$(B);break}case"ArrowUp":{$(B);break}case"Home":{B.preventDefault(),L(0);break}case"End":{B.preventDefault(),K();break}case"Enter":{B.preventDefault();let oe=F();if(oe){let xe=new Event(hC);oe.dispatchEvent(xe)}}}}},y.createElement("label",{"cmdk-label":"",htmlFor:M.inputId,id:M.labelId,style:n1e},d),Qy(e,B=>y.createElement(dH.Provider,{value:O},y.createElement(uH.Provider,{value:M},B))))}),Hje=y.forwardRef((e,t)=>{var n,r;let a=Fn(),o=y.useRef(null),l=y.useContext(fH),u=Yh(),d=mH(e),f=(r=(n=d.current)==null?void 0:n.forceMount)!=null?r:l?.forceMount;bl(()=>{if(!f)return u.item(a,l?.id)},[f]);let m=pH(a,o,[e.value,e.children,o],e.keywords),p=OE(),g=as(k=>k.value&&k.value===m.current),x=as(k=>f||u.filter()===!1?!0:k.search?k.filtered.items.get(a)>0:!0);y.useEffect(()=>{let k=o.current;if(!(!k||e.disabled))return k.addEventListener(hC,j),()=>k.removeEventListener(hC,j)},[x,e.onSelect,e.disabled]);function j(){var k,O;b(),(O=(k=d.current).onSelect)==null||O.call(k,m.current)}function b(){p.setState("value",m.current,!0)}if(!x)return null;let{disabled:w,value:N,onSelect:A,forceMount:E,keywords:T,...C}=e;return y.createElement(ms.div,{ref:Rr(o,t),...C,id:a,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!g,"data-disabled":!!w,"data-selected":!!g,onPointerMove:w||u.getDisablePointerSelection()?void 0:b,onClick:w?void 0:j},e.children)}),Wje=y.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:a,...o}=e,l=Fn(),u=y.useRef(null),d=y.useRef(null),f=Fn(),m=Yh(),p=as(x=>a||m.filter()===!1?!0:x.search?x.filtered.groups.has(l):!0);bl(()=>m.group(l),[]),pH(l,u,[e.value,e.heading,d]);let g=y.useMemo(()=>({id:l,forceMount:a}),[a]);return y.createElement(ms.div,{ref:Rr(u,t),...o,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},n&&y.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),Qy(e,x=>y.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},y.createElement(fH.Provider,{value:g},x))))}),Vje=y.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,a=y.useRef(null),o=as(l=>!l.search);return!n&&!o?null:y.createElement(ms.div,{ref:Rr(a,t),...r,"cmdk-separator":"",role:"separator"})}),Gje=y.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,a=e.value!=null,o=OE(),l=as(f=>f.search),u=as(f=>f.selectedItemId),d=Yh();return y.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),y.createElement(ms.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":u,id:d.inputId,type:"text",value:a?e.value:l,onChange:f=>{a||o.setState("search",f.target.value),n?.(f.target.value)}})}),Yje=y.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...a}=e,o=y.useRef(null),l=y.useRef(null),u=as(f=>f.selectedItemId),d=Yh();return y.useEffect(()=>{if(l.current&&o.current){let f=l.current,m=o.current,p,g=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let x=f.offsetHeight;m.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return g.observe(f),()=>{cancelAnimationFrame(p),g.unobserve(f)}}},[]),y.createElement(ms.div,{ref:Rr(o,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":u,"aria-label":r,id:d.listId},Qy(e,f=>y.createElement("div",{ref:Rr(l,d.listInnerRef),"cmdk-list-sizer":""},f)))}),Kje=y.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:o,container:l,...u}=e;return y.createElement(iE,{open:n,onOpenChange:r},y.createElement(oE,{container:l},y.createElement(Iy,{"cmdk-overlay":"",className:a}),y.createElement(Ly,{"aria-label":e.label,"cmdk-dialog":"",className:o},y.createElement(hH,{ref:t,...u}))))}),Xje=y.forwardRef((e,t)=>as(n=>n.filtered.count===0)?y.createElement(ms.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Zje=y.forwardRef((e,t)=>{let{progress:n,children:r,label:a="Loading...",...o}=e;return y.createElement(ms.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Qy(e,l=>y.createElement("div",{"aria-hidden":!0},l)))}),Br=Object.assign(hH,{List:Yje,Item:Hje,Input:Gje,Group:Wje,Separator:Vje,Dialog:Kje,Empty:Xje,Loading:Zje});function Qje(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Jje(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function mH(e){let t=y.useRef(e);return bl(()=>{t.current=e}),t}var bl=typeof window>"u"?y.useEffect:y.useLayoutEffect;function Dc(e){let t=y.useRef();return t.current===void 0&&(t.current=e()),t}function as(e){let t=OE(),n=()=>e(t.snapshot());return y.useSyncExternalStore(t.subscribe,n,n)}function pH(e,t,n,r=[]){let a=y.useRef(),o=Yh();return bl(()=>{var l;let u=(()=>{var f;for(let m of n){if(typeof m=="string")return m.trim();if(typeof m=="object"&&"current"in m)return m.current?(f=m.current.textContent)==null?void 0:f.trim():a.current}})(),d=r.map(f=>f.trim());o.value(e,u,d),(l=t.current)==null||l.setAttribute(Rc,u),a.current=u}),a}var e1e=()=>{let[e,t]=y.useState(),n=Dc(()=>new Map);return bl(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,a)=>{n.current.set(r,a),t({})}};function t1e(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Qy({asChild:e,children:t},n){return e&&y.isValidElement(t)?y.cloneElement(t1e(t),{ref:t.ref},n(t.props.children)):n(t)}var n1e={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const vH=y.forwardRef(({className:e,...t},n)=>i.jsx(Br,{ref:n,className:de("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));vH.displayName=Br.displayName;const gH=y.forwardRef(({className:e,...t},n)=>i.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[i.jsx(Dr,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),i.jsx(Br.Input,{ref:n,className:de("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));gH.displayName=Br.Input.displayName;const yH=y.forwardRef(({className:e,...t},n)=>i.jsx(Br.List,{ref:n,className:de("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));yH.displayName=Br.List.displayName;const xH=y.forwardRef((e,t)=>i.jsx(Br.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));xH.displayName=Br.Empty.displayName;const bH=y.forwardRef(({className:e,...t},n)=>i.jsx(Br.Group,{ref:n,className:de("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));bH.displayName=Br.Group.displayName;const r1e=y.forwardRef(({className:e,...t},n)=>i.jsx(Br.Separator,{ref:n,className:de("-mx-1 h-px bg-border",e),...t}));r1e.displayName=Br.Separator.displayName;const wH=y.forwardRef(({className:e,...t},n)=>i.jsx(Br.Item,{ref:n,className:de("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));wH.displayName=Br.Item.displayName;function a1e({options:e,selected:t,onChange:n,placeholder:r="选择选项...",emptyText:a="未找到选项",className:o}){const[l,u]=y.useState(!1),d=m=>{t.includes(m)?n(t.filter(p=>p!==m)):n([...t,m])},f=m=>{n(t.filter(p=>p!==m))};return i.jsxs(ts,{open:l,onOpenChange:u,children:[i.jsx(ns,{asChild:!0,children:i.jsxs(ue,{variant:"outline",role:"combobox","aria-expanded":l,className:de("w-full justify-between min-h-10 h-auto",o),children:[i.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:t.length===0?i.jsx("span",{className:"text-muted-foreground",children:r}):t.map(m=>{const p=e.find(g=>g.value===m);return i.jsxs(Dt,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80",onClick:g=>{g.stopPropagation(),f(m)},children:[p?.label||m,i.jsx(Bh,{className:"ml-1 h-3 w-3",strokeWidth:2,fill:"none"})]},m)})}),i.jsx(uve,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),i.jsx(so,{className:"w-full p-0",align:"start",children:i.jsxs(vH,{children:[i.jsx(gH,{placeholder:"搜索...",className:"h-9"}),i.jsxs(yH,{children:[i.jsx(xH,{children:a}),i.jsx(bH,{children:e.map(m=>{const p=t.includes(m.value);return i.jsxs(wH,{value:m.value,onSelect:()=>d(m.value),children:[i.jsx("div",{className:de("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",p?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:i.jsx(il,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),i.jsx("span",{children:m.label})]},m.value)})})]})]})})]})}function i1e(){const[e,t]=y.useState([]),[n,r]=y.useState([]),[a,o]=y.useState([]),[l,u]=y.useState(null),[d,f]=y.useState(!0),[m,p]=y.useState(!1),[g,x]=y.useState(!1),[j,b]=y.useState(!1),[w,N]=y.useState(!1),[A,E]=y.useState(null),[T,C]=y.useState(null),[k,O]=y.useState(!1),[M,I]=y.useState(null),[z,D]=y.useState(""),[H,V]=y.useState(new Set),[F,G]=y.useState(!1),{toast:L}=mr(),R=y.useRef(null),U=y.useRef(null),K=y.useRef(!0);y.useEffect(()=>{te()},[]);const te=async()=>{try{f(!0);const me=await Mg(),ve=me.models||[];t(ve),o(ve.map(It=>It.name));const Le=me.api_providers||[];r(Le.map(It=>It.name)),u(me.model_task_config||null),b(!1),K.current=!1}catch(me){console.error("加载配置失败:",me)}finally{f(!1)}},$=y.useCallback(async me=>{if(!K.current)try{x(!0),await dC("models",me),b(!1)}catch(ve){console.error("自动保存模型列表失败:",ve),b(!0)}finally{x(!1)}},[]),B=y.useCallback(async me=>{if(!K.current)try{x(!0),await dC("model_task_config",me),b(!1)}catch(ve){console.error("自动保存任务配置失败:",ve),b(!0)}finally{x(!1)}},[]);y.useEffect(()=>{if(!K.current)return b(!0),R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{$(e)},2e3),()=>{R.current&&clearTimeout(R.current)}},[e,$]),y.useEffect(()=>{if(!(K.current||!l))return b(!0),U.current&&clearTimeout(U.current),U.current=setTimeout(()=>{B(l)},2e3),()=>{U.current&&clearTimeout(U.current)}},[l,B]);const Y=async()=>{try{p(!0),R.current&&clearTimeout(R.current),U.current&&clearTimeout(U.current);const me=await Mg();me.models=e,me.model_task_config=l,await eH(me),b(!1),L({title:"保存成功",description:"模型配置已保存"}),await te()}catch(me){console.error("保存配置失败:",me),L({title:"保存失败",description:me.message,variant:"destructive"})}finally{p(!1)}},ne=(me,ve)=>{E(me||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),C(ve),N(!0)},oe=()=>{if(A){if(T!==null){const me=[...e];me[T]=A,t(me)}else t([...e,A]);N(!1),E(null),C(null)}},xe=me=>{I(me),O(!0)},ee=()=>{if(M!==null){const me=e.filter((ve,Le)=>Le!==M);t(me),L({title:"删除成功",description:"模型已从列表中移除"})}O(!1),I(null)},ae=me=>{const ve=new Set(H);ve.has(me)?ve.delete(me):ve.add(me),V(ve)},Z=()=>{if(H.size===Re.length)V(new Set);else{const me=Re.map((ve,Le)=>e.findIndex(It=>It===Re[Le]));V(new Set(me))}},pe=()=>{if(H.size===0){L({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}G(!0)},je=()=>{const me=e.filter((ve,Le)=>!H.has(Le));t(me),V(new Set),G(!1),L({title:"批量删除成功",description:`已删除 ${H.size} 个模型`})},le=(me,ve,Le)=>{l&&u({...l,[me]:{...l[me],[ve]:Le}})},Re=e.filter(me=>{if(!z)return!0;const ve=z.toLowerCase();return me.name.toLowerCase().includes(ve)||me.model_identifier.toLowerCase().includes(ve)||me.api_provider.toLowerCase().includes(ve)}),_e=me=>l?[l.utils?.model_list||[],l.utils_small?.model_list||[],l.tool_use?.model_list||[],l.replyer?.model_list||[],l.planner?.model_list||[],l.vlm?.model_list||[],l.voice?.model_list||[],l.embedding?.model_list||[],l.lpmm_entity_extract?.model_list||[],l.lpmm_rdf_build?.model_list||[],l.lpmm_qa?.model_list||[]].some(Le=>Le.includes(me)):!1;return d?i.jsx(Vt,{className:"h-full",children:i.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:i.jsx("div",{className:"flex items-center justify-center h-64",children:i.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):i.jsx(Vt,{className:"h-full",children:i.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型配置"}),i.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理模型和任务配置"})]}),i.jsxs(ue,{onClick:Y,disabled:m||g||!j,size:"sm",className:"w-full sm:w-auto",children:[i.jsx(ZO,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),m?"保存中...":g?"自动保存中...":j?"保存配置":"已保存"]})]}),i.jsxs(ul,{defaultValue:"models",className:"w-full",children:[i.jsxs(Qo,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[i.jsx(Ot,{value:"models",children:"模型配置"}),i.jsx(Ot,{value:"tasks",children:"模型任务配置"})]}),i.jsxs(en,{value:"models",className:"space-y-4 mt-0",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),i.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[H.size>0&&i.jsxs(ue,{onClick:pe,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[i.jsx(Tt,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",H.size,")"]}),i.jsxs(ue,{onClick:()=>ne(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[i.jsx(tr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),i.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[i.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),i.jsx(Ne,{placeholder:"搜索模型名称、标识符或提供商...",value:z,onChange:me=>D(me.target.value),className:"pl-9"})]}),z&&i.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Re.length," 个结果"]})]}),i.jsx("div",{className:"md:hidden space-y-3",children:Re.length===0?i.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:z?"未找到匹配的模型":"暂无模型配置"}):Re.map((me,ve)=>{const Le=_e(me.name);return i.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("h3",{className:"font-semibold text-base",children:me.name}),i.jsx(Dt,{variant:Le?"default":"secondary",className:Le?"bg-green-600 hover:bg-green-700":"",children:Le?"已使用":"未使用"})]}),i.jsx("p",{className:"text-xs text-muted-foreground break-all",title:me.model_identifier,children:me.model_identifier})]}),i.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[i.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>ne(me,ve),children:i.jsx(Au,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),i.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>xe(ve),children:i.jsx(Tt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),i.jsx("p",{className:"font-medium",children:me.api_provider})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),i.jsx("p",{className:"font-medium",children:me.force_stream_mode?"是":"否"})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),i.jsxs("p",{className:"font-medium",children:["¥",me.price_in,"/M"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),i.jsxs("p",{className:"font-medium",children:["¥",me.price_out,"/M"]})]})]})]},ve)})}),i.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:i.jsxs(Al,{children:[i.jsx(Tl,{children:i.jsxs(vn,{children:[i.jsx(Ze,{className:"w-12",children:i.jsx(rs,{checked:H.size===Re.length&&Re.length>0,onCheckedChange:Z})}),i.jsx(Ze,{className:"w-24",children:"使用状态"}),i.jsx(Ze,{children:"模型名称"}),i.jsx(Ze,{children:"模型标识符"}),i.jsx(Ze,{children:"提供商"}),i.jsx(Ze,{className:"text-right",children:"输入价格"}),i.jsx(Ze,{className:"text-right",children:"输出价格"}),i.jsx(Ze,{className:"text-center",children:"强制流式"}),i.jsx(Ze,{className:"text-right",children:"操作"})]})}),i.jsx(kl,{children:Re.length===0?i.jsx(vn,{children:i.jsx(Ue,{colSpan:9,className:"text-center text-muted-foreground py-8",children:z?"未找到匹配的模型":"暂无模型配置"})}):Re.map((me,ve)=>{const Le=e.findIndex(Cn=>Cn===me),It=_e(me.name);return i.jsxs(vn,{children:[i.jsx(Ue,{children:i.jsx(rs,{checked:H.has(Le),onCheckedChange:()=>ae(Le)})}),i.jsx(Ue,{children:i.jsx(Dt,{variant:It?"default":"secondary",className:It?"bg-green-600 hover:bg-green-700":"",children:It?"已使用":"未使用"})}),i.jsx(Ue,{className:"font-medium",children:me.name}),i.jsx(Ue,{className:"max-w-xs truncate",title:me.model_identifier,children:me.model_identifier}),i.jsx(Ue,{children:me.api_provider}),i.jsxs(Ue,{className:"text-right",children:["¥",me.price_in,"/M"]}),i.jsxs(Ue,{className:"text-right",children:["¥",me.price_out,"/M"]}),i.jsx(Ue,{className:"text-center",children:me.force_stream_mode?"是":"否"}),i.jsx(Ue,{className:"text-right",children:i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>ne(me,Le),children:i.jsx(Au,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),i.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>xe(Le),children:i.jsx(Tt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]})})]},ve)})})]})})]}),i.jsxs(en,{value:"tasks",className:"space-y-6 mt-0",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),l&&i.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[i.jsx(Ra,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:l.utils,modelNames:a,onChange:(me,ve)=>le("utils",me,ve)}),i.jsx(Ra,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:l.utils_small,modelNames:a,onChange:(me,ve)=>le("utils_small",me,ve)}),i.jsx(Ra,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:l.tool_use,modelNames:a,onChange:(me,ve)=>le("tool_use",me,ve)}),i.jsx(Ra,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:l.replyer,modelNames:a,onChange:(me,ve)=>le("replyer",me,ve)}),i.jsx(Ra,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:l.planner,modelNames:a,onChange:(me,ve)=>le("planner",me,ve)}),i.jsx(Ra,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:l.vlm,modelNames:a,onChange:(me,ve)=>le("vlm",me,ve),hideTemperature:!0}),i.jsx(Ra,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:l.voice,modelNames:a,onChange:(me,ve)=>le("voice",me,ve),hideTemperature:!0,hideMaxTokens:!0}),i.jsx(Ra,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:l.embedding,modelNames:a,onChange:(me,ve)=>le("embedding",me,ve),hideTemperature:!0,hideMaxTokens:!0}),i.jsxs("div",{className:"space-y-4",children:[i.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),i.jsx(Ra,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:l.lpmm_entity_extract,modelNames:a,onChange:(me,ve)=>le("lpmm_entity_extract",me,ve)}),i.jsx(Ra,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:l.lpmm_rdf_build,modelNames:a,onChange:(me,ve)=>le("lpmm_rdf_build",me,ve)}),i.jsx(Ra,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:l.lpmm_qa,modelNames:a,onChange:(me,ve)=>le("lpmm_qa",me,ve)})]})]})]})]}),i.jsx(nr,{open:w,onOpenChange:N,children:i.jsxs(Hn,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[i.jsxs(Wn,{children:[i.jsx(Vn,{children:T!==null?"编辑模型":"添加模型"}),i.jsx(dr,{children:"配置模型的基本信息和参数"})]}),i.jsxs("div",{className:"grid gap-4 py-4",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"model_name",children:"模型名称 *"}),i.jsx(Ne,{id:"model_name",value:A?.name||"",onChange:me=>E(ve=>ve?{...ve,name:me.target.value}:null),placeholder:"例如: qwen3-30b"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"model_identifier",children:"模型标识符 *"}),i.jsx(Ne,{id:"model_identifier",value:A?.model_identifier||"",onChange:me=>E(ve=>ve?{...ve,model_identifier:me.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"API 提供商提供的模型 ID"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"api_provider",children:"API 提供商 *"}),i.jsxs(Et,{value:A?.api_provider||"",onValueChange:me=>E(ve=>ve?{...ve,api_provider:me}:null),children:[i.jsx(wt,{id:"api_provider",children:i.jsx(At,{placeholder:"选择提供商"})}),i.jsx(jt,{children:n.map(me=>i.jsx(Me,{value:me,children:me},me))})]})]}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),i.jsx(Ne,{id:"price_in",type:"number",step:"0.1",min:"0",value:A?.price_in||0,onChange:me=>E(ve=>ve?{...ve,price_in:parseFloat(me.target.value)}:null)})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),i.jsx(Ne,{id:"price_out",type:"number",step:"0.1",min:"0",value:A?.price_out||0,onChange:me=>E(ve=>ve?{...ve,price_out:parseFloat(me.target.value)}:null)})]})]}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(at,{id:"force_stream_mode",checked:A?.force_stream_mode||!1,onCheckedChange:me=>E(ve=>ve?{...ve,force_stream_mode:me}:null)}),i.jsx(J,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),i.jsxs($r,{children:[i.jsx(ue,{variant:"outline",onClick:()=>N(!1),children:"取消"}),i.jsx(ue,{onClick:oe,children:"保存"})]})]})}),i.jsx(Pn,{open:k,onOpenChange:O,children:i.jsxs(yn,{children:[i.jsxs(xn,{children:[i.jsx(wn,{children:"确认删除"}),i.jsxs(jn,{children:['确定要删除模型 "',M!==null?e[M]?.name:"",'" 吗? 此操作无法撤销。']})]}),i.jsxs(bn,{children:[i.jsx(_n,{children:"取消"}),i.jsx(Sn,{onClick:ee,children:"删除"})]})]})}),i.jsx(Pn,{open:F,onOpenChange:G,children:i.jsxs(yn,{children:[i.jsxs(xn,{children:[i.jsx(wn,{children:"确认批量删除"}),i.jsxs(jn,{children:["确定要删除选中的 ",H.size," 个模型吗? 此操作无法撤销。"]})]}),i.jsxs(bn,{children:[i.jsx(_n,{children:"取消"}),i.jsx(Sn,{onClick:je,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})})}function Ra({title:e,description:t,taskConfig:n,modelNames:r,onChange:a,hideTemperature:o=!1,hideMaxTokens:l=!1}){const u=d=>{a("model_list",d)};return i.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[i.jsxs("div",{children:[i.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:e}),i.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:t})]}),i.jsxs("div",{className:"grid gap-4",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"模型列表"}),i.jsx(a1e,{options:r.map(d=>({label:d,value:d})),selected:n.model_list||[],onChange:u,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!o&&i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"温度"}),i.jsx(Ne,{type:"number",step:"0.1",min:"0",max:"2",value:n.temperature||.3,onChange:d=>a("temperature",parseFloat(d.target.value))})]}),!l&&i.jsxs("div",{className:"grid gap-2",children:[i.jsx(J,{children:"最大 Token"}),i.jsx(Ne,{type:"number",step:"1",min:"1",value:n.max_tokens||1024,onChange:d=>a("max_tokens",parseInt(d.target.value))})]})]})]})]})}const ps="/api/webui/emoji";async function o1e(e){const t=new URLSearchParams;e.page&&t.append("page",e.page.toString()),e.page_size&&t.append("page_size",e.page_size.toString()),e.search&&t.append("search",e.search),e.is_registered!==void 0&&t.append("is_registered",e.is_registered.toString()),e.is_banned!==void 0&&t.append("is_banned",e.is_banned.toString()),e.format&&t.append("format",e.format),e.sort_by&&t.append("sort_by",e.sort_by),e.sort_order&&t.append("sort_order",e.sort_order);const n=await Qe(`${ps}/list?${t}`,{headers:lt()});if(!n.ok)throw new Error(`获取表情包列表失败: ${n.statusText}`);return n.json()}async function s1e(e){const t=await Qe(`${ps}/${e}`,{headers:lt()});if(!t.ok)throw new Error(`获取表情包详情失败: ${t.statusText}`);return t.json()}async function l1e(e,t){const n=await Qe(`${ps}/${e}`,{method:"PATCH",headers:lt(),body:JSON.stringify(t)});if(!n.ok)throw new Error(`更新表情包失败: ${n.statusText}`);return n.json()}async function c1e(e){const t=await Qe(`${ps}/${e}`,{method:"DELETE",headers:lt()});if(!t.ok)throw new Error(`删除表情包失败: ${t.statusText}`);return t.json()}async function u1e(){const e=await Qe(`${ps}/stats/summary`,{headers:lt()});if(!e.ok)throw new Error(`获取统计数据失败: ${e.statusText}`);return e.json()}async function d1e(e){const t=await Qe(`${ps}/${e}/register`,{method:"POST",headers:lt()});if(!t.ok)throw new Error(`注册表情包失败: ${t.statusText}`);return t.json()}async function f1e(e){const t=await Qe(`${ps}/${e}/ban`,{method:"POST",headers:lt()});if(!t.ok)throw new Error(`封禁表情包失败: ${t.statusText}`);return t.json()}function mC(e){const t=localStorage.getItem("access-token");return`${ps}/${e}/thumbnail?token=${encodeURIComponent(t||"")}`}function h1e(){const[e,t]=y.useState([]),[n,r]=y.useState(null),[a,o]=y.useState(!1),[l,u]=y.useState(1),[d,f]=y.useState(0),[m]=y.useState(20),[p,g]=y.useState(""),[x,j]=y.useState("all"),[b,w]=y.useState("all"),[N,A]=y.useState("all"),[E,T]=y.useState(null),[C,k]=y.useState(!1),[O,M]=y.useState(!1),[I,z]=y.useState(!1),{toast:D}=mr(),H=y.useCallback(async()=>{try{o(!0);const $=await o1e({page:l,page_size:m,search:p||void 0,is_registered:x==="all"?void 0:x==="registered",is_banned:b==="all"?void 0:b==="banned",format:N==="all"?void 0:N,sort_by:"usage_count",sort_order:"desc"});t($.data),f($.total)}catch($){const B=$ instanceof Error?$.message:"加载表情包列表失败";D({title:"错误",description:B,variant:"destructive"})}finally{o(!1)}},[l,m,p,x,b,N,D]),V=async()=>{try{const $=await u1e();r($.data)}catch($){console.error("加载统计数据失败:",$)}};y.useEffect(()=>{H()},[H]),y.useEffect(()=>{V()},[]);const F=async $=>{try{const B=await s1e($.id);T(B.data),k(!0)}catch(B){const Y=B instanceof Error?B.message:"加载详情失败";D({title:"错误",description:Y,variant:"destructive"})}},G=$=>{T($),M(!0)},L=$=>{T($),z(!0)},R=async()=>{if(E)try{await c1e(E.id),D({title:"成功",description:"表情包已删除"}),z(!1),T(null),H(),V()}catch($){const B=$ instanceof Error?$.message:"删除失败";D({title:"错误",description:B,variant:"destructive"})}},U=async $=>{try{await d1e($.id),D({title:"成功",description:"表情包已注册"}),H(),V()}catch(B){const Y=B instanceof Error?B.message:"注册失败";D({title:"错误",description:Y,variant:"destructive"})}},K=async $=>{try{await f1e($.id),D({title:"成功",description:"表情包已封禁"}),H(),V()}catch(B){const Y=B instanceof Error?B.message:"封禁失败";D({title:"错误",description:Y,variant:"destructive"})}},te=n?.formats?Object.keys(n.formats):[];return i.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[i.jsxs("div",{className:"mb-4 sm:mb-6",children:[i.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),i.jsx(Vt,{className:"flex-1",children:i.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&i.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[i.jsx(st,{children:i.jsxs(qt,{className:"pb-2",children:[i.jsx(er,{children:"总数"}),i.jsx(Ft,{className:"text-2xl",children:n.total})]})}),i.jsx(st,{children:i.jsxs(qt,{className:"pb-2",children:[i.jsx(er,{children:"已注册"}),i.jsx(Ft,{className:"text-2xl text-green-600",children:n.registered})]})}),i.jsx(st,{children:i.jsxs(qt,{className:"pb-2",children:[i.jsx(er,{children:"已封禁"}),i.jsx(Ft,{className:"text-2xl text-red-600",children:n.banned})]})}),i.jsx(st,{children:i.jsxs(qt,{className:"pb-2",children:[i.jsx(er,{children:"未注册"}),i.jsx(Ft,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),i.jsxs(st,{children:[i.jsx(qt,{children:i.jsxs(Ft,{className:"flex items-center gap-2",children:[i.jsx(GN,{className:"h-5 w-5"}),"搜索和筛选"]})}),i.jsxs(on,{className:"space-y-4",children:[i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{children:"搜索"}),i.jsxs("div",{className:"relative",children:[i.jsx(Dr,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),i.jsx(Ne,{placeholder:"描述或哈希值...",value:p,onChange:$=>{g($.target.value),u(1)},className:"pl-8"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{children:"注册状态"}),i.jsxs(Et,{value:x,onValueChange:$=>{j($),u(1)},children:[i.jsx(wt,{children:i.jsx(At,{})}),i.jsxs(jt,{children:[i.jsx(Me,{value:"all",children:"全部"}),i.jsx(Me,{value:"registered",children:"已注册"}),i.jsx(Me,{value:"unregistered",children:"未注册"})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{children:"封禁状态"}),i.jsxs(Et,{value:b,onValueChange:$=>{w($),u(1)},children:[i.jsx(wt,{children:i.jsx(At,{})}),i.jsxs(jt,{children:[i.jsx(Me,{value:"all",children:"全部"}),i.jsx(Me,{value:"banned",children:"已封禁"}),i.jsx(Me,{value:"unbanned",children:"未封禁"})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{children:"格式"}),i.jsxs(Et,{value:N,onValueChange:$=>{A($),u(1)},children:[i.jsx(wt,{children:i.jsx(At,{})}),i.jsxs(jt,{children:[i.jsx(Me,{value:"all",children:"全部"}),te.map($=>i.jsxs(Me,{value:$,children:[$.toUpperCase()," (",n?.formats[$],")"]},$))]})]})]})]}),i.jsx("div",{className:"flex justify-end",children:i.jsxs(ue,{variant:"outline",size:"sm",onClick:H,disabled:a,children:[i.jsx(sl,{className:`h-4 w-4 mr-2 ${a?"animate-spin":""}`}),"刷新"]})})]})]}),i.jsxs(st,{children:[i.jsxs(qt,{children:[i.jsx(Ft,{children:"表情包列表"}),i.jsxs(er,{children:["共 ",d," 个表情包,当前第 ",l," 页"]})]}),i.jsxs(on,{children:[i.jsx("div",{className:"hidden md:block rounded-md border overflow-hidden",children:i.jsxs(Al,{children:[i.jsx(Tl,{children:i.jsxs(vn,{children:[i.jsx(Ze,{className:"w-16",children:"预览"}),i.jsx(Ze,{children:"描述"}),i.jsx(Ze,{children:"格式"}),i.jsx(Ze,{children:"情绪标签"}),i.jsx(Ze,{className:"text-center",children:"状态"}),i.jsx(Ze,{className:"text-right",children:"使用次数"}),i.jsx(Ze,{className:"text-right",children:"操作"})]})}),i.jsx(kl,{children:e.length===0?i.jsx(vn,{children:i.jsx(Ue,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):e.map($=>i.jsxs(vn,{children:[i.jsx(Ue,{children:i.jsx("div",{className:"w-20 h-20 bg-muted rounded flex items-center justify-center overflow-hidden",children:i.jsx("img",{src:mC($.id),alt:$.description||"表情包",className:"w-full h-full object-cover",onError:B=>{const Y=B.target;Y.style.display="none";const ne=Y.parentElement;ne&&(ne.innerHTML='')}})})}),i.jsx(Ue,{children:i.jsxs("div",{className:"space-y-1 max-w-xs",children:[i.jsx("div",{className:"font-medium truncate",title:$.description||"无描述",children:$.description||"无描述"}),i.jsxs("div",{className:"text-xs text-muted-foreground font-mono",children:[$.emoji_hash.slice(0,16),"..."]})]})}),i.jsx(Ue,{children:i.jsx(Dt,{variant:"outline",children:$.format.toUpperCase()})}),i.jsx(Ue,{children:i.jsx(OL,{emotions:$.emotion})}),i.jsx(Ue,{className:"align-middle",children:i.jsxs("div",{className:"flex gap-2 justify-center",children:[$.is_registered&&i.jsxs(Dt,{variant:"default",className:"bg-green-600",children:[i.jsx(Vo,{className:"h-3 w-3 mr-1"}),"已注册"]}),$.is_banned&&i.jsxs(Dt,{variant:"destructive",children:[i.jsx(UN,{className:"h-3 w-3 mr-1"}),"已封禁"]})]})}),i.jsx(Ue,{className:"text-right font-mono",children:$.usage_count}),i.jsx(Ue,{children:i.jsxs("div",{className:"flex items-center justify-end gap-1 flex-wrap",children:[i.jsxs(ue,{variant:"ghost",size:"sm",onClick:()=>F($),children:[i.jsx(YN,{className:"h-4 w-4 mr-1"}),"详情"]}),i.jsxs(ue,{variant:"ghost",size:"sm",onClick:()=>G($),children:[i.jsx(Tu,{className:"h-4 w-4 mr-1"}),"编辑"]}),!$.is_registered&&i.jsxs(ue,{variant:"ghost",size:"sm",onClick:()=>U($),className:"text-green-600 hover:text-green-700",children:[i.jsx(Vo,{className:"h-4 w-4 mr-1"}),"注册"]}),!$.is_banned&&i.jsxs(ue,{variant:"ghost",size:"sm",onClick:()=>K($),className:"text-orange-600 hover:text-orange-700",children:[i.jsx(FI,{className:"h-4 w-4 mr-1"}),"封禁"]}),i.jsxs(ue,{variant:"ghost",size:"sm",onClick:()=>L($),className:"text-red-600 hover:text-red-700",children:[i.jsx(Tt,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},$.id))})]})}),i.jsx("div",{className:"md:hidden space-y-3",children:e.length===0?i.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):e.map($=>i.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[i.jsxs("div",{className:"flex gap-3",children:[i.jsx("div",{className:"flex-shrink-0",children:i.jsx("div",{className:"w-16 h-16 bg-muted rounded flex items-center justify-center overflow-hidden",children:i.jsx("img",{src:mC($.id),alt:$.description||"表情包",className:"w-full h-full object-cover",onError:B=>{const Y=B.target;Y.style.display="none";const ne=Y.parentElement;ne&&(ne.innerHTML='')}})})}),i.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[i.jsxs("div",{className:"min-w-0 w-full overflow-hidden",children:[i.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",title:$.description||"无描述",children:$.description||"无描述"}),i.jsxs("p",{className:"text-xs text-muted-foreground font-mono line-clamp-1 w-full break-all",children:[$.emoji_hash.slice(0,16),"..."]})]}),i.jsxs("div",{className:"flex flex-wrap gap-1 items-center min-w-0",children:[i.jsx(Dt,{variant:"outline",className:"text-xs flex-shrink-0",children:$.format.toUpperCase()}),$.is_registered&&i.jsxs(Dt,{variant:"default",className:"bg-green-600 text-xs flex-shrink-0",children:[i.jsx(Vo,{className:"h-3 w-3 mr-1"}),"已注册"]}),$.is_banned&&i.jsxs(Dt,{variant:"destructive",className:"text-xs flex-shrink-0",children:[i.jsx(UN,{className:"h-3 w-3 mr-1"}),"已封禁"]}),i.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:["使用: ",$.usage_count]})]}),$.emotion&&$.emotion.length>0&&i.jsx("div",{className:"min-w-0 overflow-hidden",children:i.jsx(OL,{emotions:$.emotion})})]})]}),i.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[i.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>F($),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[i.jsx(YN,{className:"h-3 w-3 mr-1"}),"详情"]}),i.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>G($),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[i.jsx(Tu,{className:"h-3 w-3 mr-1"}),"编辑"]}),!$.is_registered&&i.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>U($),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-green-600 hover:text-green-700",children:[i.jsx(Vo,{className:"h-3 w-3 mr-1"}),"注册"]}),!$.is_banned&&i.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>K($),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-orange-600 hover:text-orange-700",children:[i.jsx(FI,{className:"h-3 w-3 mr-1"}),"封禁"]}),i.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>L($),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-red-600 hover:text-red-700",children:[i.jsx(Tt,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},$.id))}),d>m&&i.jsxs("div",{className:"flex items-center justify-between mt-4",children:[i.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(l-1)*m+1," 到"," ",Math.min(l*m,d)," 条,共 ",d," 条"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>u($=>Math.max(1,$-1)),disabled:l===1,children:[i.jsx(YO,{className:"h-4 w-4"}),"上一页"]}),i.jsxs("div",{className:"text-sm",children:["第 ",l," / ",Math.ceil(d/m)," 页"]}),i.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>u($=>$+1),disabled:l>=Math.ceil(d/m),children:["下一页",i.jsx(KO,{className:"h-4 w-4"})]})]})]})]})]}),i.jsx(m1e,{emoji:E,open:C,onOpenChange:k}),i.jsx(p1e,{emoji:E,open:O,onOpenChange:M,onSuccess:()=>{H(),V()}})]})}),i.jsx(nr,{open:I,onOpenChange:z,children:i.jsxs(Hn,{children:[i.jsxs(Wn,{children:[i.jsx(Vn,{children:"确认删除"}),i.jsx(dr,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),i.jsxs($r,{children:[i.jsx(ue,{variant:"outline",onClick:()=>z(!1),children:"取消"}),i.jsx(ue,{variant:"destructive",onClick:R,children:"删除"})]})]})})]})}function m1e({emoji:e,open:t,onOpenChange:n}){if(!e)return null;const r=a=>a?new Date(a*1e3).toLocaleString("zh-CN"):"-";return i.jsx(nr,{open:t,onOpenChange:n,children:i.jsxs(Hn,{className:"max-w-2xl",children:[i.jsx(Wn,{children:i.jsx(Vn,{children:"表情包详情"})}),i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"flex justify-center",children:i.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:i.jsx("img",{src:mC(e.id),alt:e.description||"表情包",className:"w-full h-full object-cover",onError:a=>{const o=a.target;o.style.display="none";const l=o.parentElement;l&&(l.innerHTML='')}})})}),i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[i.jsxs("div",{children:[i.jsx(J,{className:"text-muted-foreground",children:"ID"}),i.jsx("div",{className:"mt-1 font-mono",children:e.id})]}),i.jsxs("div",{children:[i.jsx(J,{className:"text-muted-foreground",children:"格式"}),i.jsx("div",{className:"mt-1",children:i.jsx(Dt,{variant:"outline",children:e.format.toUpperCase()})})]})]}),i.jsxs("div",{children:[i.jsx(J,{className:"text-muted-foreground",children:"文件路径"}),i.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:e.full_path})]}),i.jsxs("div",{children:[i.jsx(J,{className:"text-muted-foreground",children:"哈希值"}),i.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:e.emoji_hash})]}),i.jsxs("div",{children:[i.jsx(J,{className:"text-muted-foreground",children:"描述"}),i.jsx("div",{className:"mt-1",children:e.description||"-"})]}),i.jsxs("div",{children:[i.jsx(J,{className:"text-muted-foreground",children:"情绪标签"}),i.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:e.emotion&&e.emotion.length>0?e.emotion.map((a,o)=>i.jsx(Dt,{variant:"secondary",children:a},o)):i.jsx("span",{className:"text-sm text-muted-foreground",children:"无"})})]}),i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[i.jsxs("div",{children:[i.jsx(J,{className:"text-muted-foreground",children:"状态"}),i.jsxs("div",{className:"mt-2 flex gap-2",children:[e.is_registered&&i.jsx(Dt,{variant:"default",className:"bg-green-600",children:"已注册"}),e.is_banned&&i.jsx(Dt,{variant:"destructive",children:"已封禁"}),!e.is_registered&&!e.is_banned&&i.jsx(Dt,{variant:"outline",children:"未注册"})]})]}),i.jsxs("div",{children:[i.jsx(J,{className:"text-muted-foreground",children:"使用次数"}),i.jsx("div",{className:"mt-1 font-mono text-lg",children:e.usage_count})]})]}),i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[i.jsxs("div",{children:[i.jsx(J,{className:"text-muted-foreground",children:"记录时间"}),i.jsx("div",{className:"mt-1 text-sm",children:r(e.record_time)})]}),i.jsxs("div",{children:[i.jsx(J,{className:"text-muted-foreground",children:"注册时间"}),i.jsx("div",{className:"mt-1 text-sm",children:r(e.register_time)})]})]}),i.jsxs("div",{children:[i.jsx(J,{className:"text-muted-foreground",children:"最后使用"}),i.jsx("div",{className:"mt-1 text-sm",children:r(e.last_used_time)})]})]})]})})}function p1e({emoji:e,open:t,onOpenChange:n,onSuccess:r}){const[a,o]=y.useState(""),[l,u]=y.useState(""),[d,f]=y.useState(!1),[m,p]=y.useState(!1),[g,x]=y.useState(!1),{toast:j}=mr();y.useEffect(()=>{e&&(o(e.description||""),u(e.emotion?e.emotion.join(", "):""),f(e.is_registered),p(e.is_banned))},[e]);const b=async()=>{if(e)try{x(!0);const w=l.split(/[,,]/).map(N=>N.trim()).filter(Boolean);await l1e(e.id,{description:a||void 0,emotion:w.length>0?w:void 0,is_registered:d,is_banned:m}),j({title:"成功",description:"表情包信息已更新"}),n(!1),r()}catch(w){const N=w instanceof Error?w.message:"保存失败";j({title:"错误",description:N,variant:"destructive"})}finally{x(!1)}};return e?i.jsx(nr,{open:t,onOpenChange:n,children:i.jsxs(Hn,{className:"max-w-2xl",children:[i.jsxs(Wn,{children:[i.jsx(Vn,{children:"编辑表情包"}),i.jsx(dr,{children:"修改表情包的描述和标签信息"})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx(J,{children:"描述"}),i.jsx(Wt,{value:a,onChange:w=>o(w.target.value),placeholder:"输入表情包描述...",rows:3,className:"mt-1"})]}),i.jsxs("div",{children:[i.jsx(J,{children:"情绪标签"}),i.jsx(Ne,{value:l,onChange:w=>u(w.target.value),placeholder:"使用逗号分隔多个标签,如:开心, 微笑, 快乐",className:"mt-1"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入多个标签时使用逗号分隔(支持中英文逗号)"})]}),i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(rs,{id:"is_registered",checked:d,onCheckedChange:w=>f(w===!0)}),i.jsx(J,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(rs,{id:"is_banned",checked:m,onCheckedChange:w=>p(w===!0)}),i.jsx(J,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),i.jsxs($r,{children:[i.jsx(ue,{variant:"outline",onClick:()=>n(!1),children:"取消"}),i.jsx(ue,{onClick:b,disabled:g,children:g?"保存中...":"保存"})]})]})}):null}function OL({emotions:e}){if(!e||e.length===0)return i.jsx("span",{className:"text-xs text-muted-foreground",children:"-"});const t=(a,o=6)=>a.length<=o?a:a.slice(0,o)+"...",n=e.slice(0,3),r=e.length-3;return i.jsxs("div",{className:"flex flex-wrap gap-1 max-w-full overflow-hidden",children:[n.map((a,o)=>i.jsx(Dt,{variant:"secondary",className:"text-xs flex-shrink-0",title:a,children:t(a)},o)),r>0&&i.jsxs(Dt,{variant:"outline",className:"text-xs flex-shrink-0",title:`还有 ${r} 个标签: ${e.slice(3).join(", ")}`,children:["+",r]})]})}const Qu="/api/webui/expression";async function v1e(e){const t=new URLSearchParams;e.page&&t.append("page",e.page.toString()),e.page_size&&t.append("page_size",e.page_size.toString()),e.search&&t.append("search",e.search),e.chat_id&&t.append("chat_id",e.chat_id);const n=await Qe(`${Qu}/list?${t}`,{headers:lt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取表达方式列表失败")}return n.json()}async function g1e(e){const t=await Qe(`${Qu}/${e}`,{headers:lt()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"获取表达方式详情失败")}return t.json()}async function y1e(e){const t=await Qe(`${Qu}/`,{method:"POST",headers:lt(),body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.detail||"创建表达方式失败")}return t.json()}async function x1e(e,t){const n=await Qe(`${Qu}/${e}`,{method:"PATCH",headers:lt(),body:JSON.stringify(t)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新表达方式失败")}return n.json()}async function b1e(e){const t=await Qe(`${Qu}/${e}`,{method:"DELETE",headers:lt()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"删除表达方式失败")}return t.json()}async function w1e(){const e=await Qe(`${Qu}/stats/summary`,{headers:lt()});if(!e.ok){const t=await e.json();throw new Error(t.detail||"获取统计数据失败")}return e.json()}function j1e(){const[e,t]=y.useState([]),[n,r]=y.useState(!0),[a,o]=y.useState(0),[l,u]=y.useState(1),[d]=y.useState(20),[f,m]=y.useState(""),[p,g]=y.useState(null),[x,j]=y.useState(!1),[b,w]=y.useState(!1),[N,A]=y.useState(!1),[E,T]=y.useState(null),[C,k]=y.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),{toast:O}=mr(),M=async()=>{try{r(!0);const F=await v1e({page:l,page_size:d,search:f||void 0});t(F.data),o(F.total)}catch(F){O({title:"加载失败",description:F instanceof Error?F.message:"无法加载表达方式",variant:"destructive"})}finally{r(!1)}},I=async()=>{try{const F=await w1e();k(F.data)}catch(F){console.error("加载统计数据失败:",F)}};y.useEffect(()=>{M(),I()},[l,d,f]);const z=async F=>{try{const G=await g1e(F.id);g(G.data),j(!0)}catch(G){O({title:"加载详情失败",description:G instanceof Error?G.message:"无法加载表达方式详情",variant:"destructive"})}},D=F=>{g(F),w(!0)},H=async F=>{try{await b1e(F.id),O({title:"删除成功",description:`已删除表达方式: ${F.situation}`}),T(null),M(),I()}catch(G){O({title:"删除失败",description:G instanceof Error?G.message:"无法删除表达方式",variant:"destructive"})}},V=F=>F?new Date(F*1e3).toLocaleString("zh-CN"):"-";return i.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[i.jsx("div",{className:"mb-4 sm:mb-6",children:i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[i.jsxs("div",{children:[i.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[i.jsx(Lh,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),i.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),i.jsxs(ue,{onClick:()=>A(!0),className:"gap-2",children:[i.jsx(tr,{className:"h-4 w-4"}),"新增表达方式"]})]})}),i.jsx(Vt,{className:"flex-1",children:i.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[i.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),i.jsx("div",{className:"text-2xl font-bold mt-1",children:C.total})]}),i.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),i.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:C.recent_7days})]}),i.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),i.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:C.chat_count})]})]}),i.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[i.jsx(J,{htmlFor:"search",children:"搜索"}),i.jsxs("div",{className:"relative mt-1.5",children:[i.jsx(Dr,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),i.jsx(Ne,{id:"search",placeholder:"搜索情境、风格或上下文...",value:f,onChange:F=>m(F.target.value),className:"pl-9"})]})]}),i.jsxs("div",{className:"rounded-lg border bg-card",children:[i.jsx("div",{className:"hidden md:block",children:i.jsxs(Al,{children:[i.jsx(Tl,{children:i.jsxs(vn,{children:[i.jsx(Ze,{children:"情境"}),i.jsx(Ze,{children:"风格"}),i.jsx(Ze,{children:"聊天ID"}),i.jsx(Ze,{children:"最后活跃"}),i.jsx(Ze,{className:"text-right",children:"操作"})]})}),i.jsx(kl,{children:n?i.jsx(vn,{children:i.jsx(Ue,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):e.length===0?i.jsx(vn,{children:i.jsx(Ue,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):e.map(F=>i.jsxs(vn,{children:[i.jsx(Ue,{className:"font-medium max-w-xs truncate",children:F.situation}),i.jsx(Ue,{className:"max-w-xs truncate",children:F.style}),i.jsx(Ue,{className:"font-mono text-sm",children:F.chat_id}),i.jsx(Ue,{className:"text-sm text-muted-foreground",children:V(F.last_active_time)}),i.jsx(Ue,{className:"text-right",children:i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>z(F),children:i.jsx(Ua,{className:"h-4 w-4"})}),i.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>D(F),children:i.jsx(Tu,{className:"h-4 w-4"})}),i.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>T(F),children:i.jsx(Tt,{className:"h-4 w-4 text-destructive"})})]})})]},F.id))})]})}),i.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?i.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):e.length===0?i.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):e.map(F=>i.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[i.jsxs("div",{className:"min-w-0 w-full overflow-hidden space-y-2",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),i.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:F.situation,children:F.situation})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),i.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:F.style,children:F.style})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天ID"}),i.jsx("p",{className:"font-mono text-xs truncate",children:F.chat_id})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后活跃"}),i.jsx("p",{className:"text-xs",children:V(F.last_active_time)})]})]}),i.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[i.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>z(F),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[i.jsx(Ua,{className:"h-3 w-3 mr-1"}),"查看"]}),i.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>D(F),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[i.jsx(Tu,{className:"h-3 w-3 mr-1"}),"编辑"]}),i.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>T(F),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[i.jsx(Tt,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},F.id))}),a>d&&i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t",children:[i.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",a," 条记录,第 ",l," / ",Math.ceil(a/d)," 页"]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ue,{variant:"outline",size:"sm",onClick:()=>u(l-1),disabled:l===1,children:"上一页"}),i.jsx(ue,{variant:"outline",size:"sm",onClick:()=>u(l+1),disabled:l>=Math.ceil(a/d),children:"下一页"})]})]})]})]})}),i.jsx(S1e,{expression:p,open:x,onOpenChange:j}),i.jsx(_1e,{open:N,onOpenChange:A,onSuccess:()=>{M(),I(),A(!1)}}),i.jsx(N1e,{expression:p,open:b,onOpenChange:w,onSuccess:()=>{M(),I(),w(!1)}}),i.jsx(Pn,{open:!!E,onOpenChange:()=>T(null),children:i.jsxs(yn,{children:[i.jsxs(xn,{children:[i.jsx(wn,{children:"确认删除"}),i.jsxs(jn,{children:['确定要删除表达方式 "',E?.situation,'" 吗? 此操作不可撤销。']})]}),i.jsxs(bn,{children:[i.jsx(_n,{children:"取消"}),i.jsx(Sn,{onClick:()=>E&&H(E),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})})]})}function S1e({expression:e,open:t,onOpenChange:n}){if(!e)return null;const r=a=>a?new Date(a*1e3).toLocaleString("zh-CN"):"-";return i.jsx(nr,{open:t,onOpenChange:n,children:i.jsxs(Hn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[i.jsxs(Wn,{children:[i.jsx(Vn,{children:"表达方式详情"}),i.jsx(dr,{children:"查看表达方式的完整信息"})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Ac,{label:"情境",value:e.situation}),i.jsx(Ac,{label:"风格",value:e.style}),i.jsx(Ac,{icon:jg,label:"聊天ID",value:e.chat_id,mono:!0}),i.jsx(Ac,{icon:jg,label:"记录ID",value:e.id.toString(),mono:!0})]}),e.context&&i.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[i.jsx(J,{className:"text-xs text-muted-foreground",children:"上下文"}),i.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:e.context})]}),e.up_content&&i.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[i.jsx(J,{className:"text-xs text-muted-foreground",children:"上文内容"}),i.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:e.up_content})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Ac,{icon:ol,label:"最后活跃",value:r(e.last_active_time)}),i.jsx(Ac,{icon:ol,label:"创建时间",value:r(e.create_date)})]})]}),i.jsx($r,{children:i.jsx(ue,{onClick:()=>n(!1),children:"关闭"})})]})})}function Ac({icon:e,label:t,value:n,mono:r=!1}){return i.jsxs("div",{className:"space-y-1",children:[i.jsxs(J,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e&&i.jsx(e,{className:"h-3 w-3"}),t]}),i.jsx("div",{className:de("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function _1e({open:e,onOpenChange:t,onSuccess:n}){const[r,a]=y.useState({situation:"",style:"",context:"",up_content:"",chat_id:""}),[o,l]=y.useState(!1),{toast:u}=mr(),d=async()=>{if(!r.situation||!r.style||!r.chat_id){u({title:"验证失败",description:"请填写必填字段:情境、风格和聊天ID",variant:"destructive"});return}try{l(!0),await y1e(r),u({title:"创建成功",description:"表达方式已创建"}),a({situation:"",style:"",context:"",up_content:"",chat_id:""}),n()}catch(f){u({title:"创建失败",description:f instanceof Error?f.message:"无法创建表达方式",variant:"destructive"})}finally{l(!1)}};return i.jsx(nr,{open:e,onOpenChange:t,children:i.jsxs(Hn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[i.jsxs(Wn,{children:[i.jsx(Vn,{children:"新增表达方式"}),i.jsx(dr,{children:"创建新的表达方式记录"})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(J,{htmlFor:"situation",children:["情境 ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(Ne,{id:"situation",value:r.situation,onChange:f=>a({...r,situation:f.target.value}),placeholder:"描述使用场景"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(J,{htmlFor:"style",children:["风格 ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(Ne,{id:"style",value:r.style,onChange:f=>a({...r,style:f.target.value}),placeholder:"描述表达风格"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(J,{htmlFor:"chat_id",children:["聊天ID ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(Ne,{id:"chat_id",value:r.chat_id,onChange:f=>a({...r,chat_id:f.target.value}),placeholder:"关联的聊天ID"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"context",children:"上下文"}),i.jsx(Wt,{id:"context",value:r.context,onChange:f=>a({...r,context:f.target.value}),placeholder:"上下文信息(可选)",rows:3})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"up_content",children:"上文内容"}),i.jsx(Wt,{id:"up_content",value:r.up_content,onChange:f=>a({...r,up_content:f.target.value}),placeholder:"上文内容(可选)",rows:3})]})]}),i.jsxs($r,{children:[i.jsx(ue,{variant:"outline",onClick:()=>t(!1),children:"取消"}),i.jsx(ue,{onClick:d,disabled:o,children:o?"创建中...":"创建"})]})]})})}function N1e({expression:e,open:t,onOpenChange:n,onSuccess:r}){const[a,o]=y.useState({}),[l,u]=y.useState(!1),{toast:d}=mr();y.useEffect(()=>{e&&o({situation:e.situation,style:e.style,context:e.context||"",up_content:e.up_content||"",chat_id:e.chat_id})},[e]);const f=async()=>{if(e)try{u(!0),await x1e(e.id,a),d({title:"保存成功",description:"表达方式已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新表达方式",variant:"destructive"})}finally{u(!1)}};return e?i.jsx(nr,{open:t,onOpenChange:n,children:i.jsxs(Hn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[i.jsxs(Wn,{children:[i.jsx(Vn,{children:"编辑表达方式"}),i.jsx(dr,{children:"修改表达方式的信息"})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"edit_situation",children:"情境"}),i.jsx(Ne,{id:"edit_situation",value:a.situation||"",onChange:m=>o({...a,situation:m.target.value}),placeholder:"描述使用场景"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"edit_style",children:"风格"}),i.jsx(Ne,{id:"edit_style",value:a.style||"",onChange:m=>o({...a,style:m.target.value}),placeholder:"描述表达风格"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"edit_chat_id",children:"聊天ID"}),i.jsx(Ne,{id:"edit_chat_id",value:a.chat_id||"",onChange:m=>o({...a,chat_id:m.target.value}),placeholder:"关联的聊天ID"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"edit_context",children:"上下文"}),i.jsx(Wt,{id:"edit_context",value:a.context||"",onChange:m=>o({...a,context:m.target.value}),placeholder:"上下文信息",rows:3})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"edit_up_content",children:"上文内容"}),i.jsx(Wt,{id:"edit_up_content",value:a.up_content||"",onChange:m=>o({...a,up_content:m.target.value}),placeholder:"上文内容",rows:3})]})]}),i.jsxs($r,{children:[i.jsx(ue,{variant:"outline",onClick:()=>n(!1),children:"取消"}),i.jsx(ue,{onClick:f,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}const Kh="/api/webui/person";async function C1e(e){const t=new URLSearchParams;e.page&&t.append("page",e.page.toString()),e.page_size&&t.append("page_size",e.page_size.toString()),e.search&&t.append("search",e.search),e.is_known!==void 0&&t.append("is_known",e.is_known.toString()),e.platform&&t.append("platform",e.platform);const n=await Qe(`${Kh}/list?${t}`,{headers:lt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取人物列表失败")}return n.json()}async function O1e(e){const t=await Qe(`${Kh}/${e}`,{headers:lt()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"获取人物详情失败")}return t.json()}async function E1e(e,t){const n=await Qe(`${Kh}/${e}`,{method:"PATCH",headers:lt(),body:JSON.stringify(t)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新人物信息失败")}return n.json()}async function A1e(e){const t=await Qe(`${Kh}/${e}`,{method:"DELETE",headers:lt()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"删除人物信息失败")}return t.json()}async function T1e(){const e=await Qe(`${Kh}/stats/summary`,{headers:lt()});if(!e.ok){const t=await e.json();throw new Error(t.detail||"获取统计数据失败")}return e.json()}function k1e(){const[e,t]=y.useState([]),[n,r]=y.useState(!0),[a,o]=y.useState(0),[l,u]=y.useState(1),[d]=y.useState(20),[f,m]=y.useState(""),[p,g]=y.useState(void 0),[x,j]=y.useState(void 0),[b,w]=y.useState(null),[N,A]=y.useState(!1),[E,T]=y.useState(!1),[C,k]=y.useState(null),[O,M]=y.useState({total:0,known:0,unknown:0,platforms:{}}),{toast:I}=mr(),z=async()=>{try{r(!0);const R=await C1e({page:l,page_size:d,search:f||void 0,is_known:p,platform:x});t(R.data),o(R.total)}catch(R){I({title:"加载失败",description:R instanceof Error?R.message:"无法加载人物信息",variant:"destructive"})}finally{r(!1)}},D=async()=>{try{const R=await T1e();M(R.data)}catch(R){console.error("加载统计数据失败:",R)}};y.useEffect(()=>{z(),D()},[l,d,f,p,x]);const H=async R=>{try{const U=await O1e(R.person_id);w(U.data),A(!0)}catch(U){I({title:"加载详情失败",description:U instanceof Error?U.message:"无法加载人物详情",variant:"destructive"})}},V=R=>{w(R),T(!0)},F=async R=>{try{await A1e(R.person_id),I({title:"删除成功",description:`已删除人物信息: ${R.person_name||R.nickname||R.user_id}`}),k(null),z(),D()}catch(U){I({title:"删除失败",description:U instanceof Error?U.message:"无法删除人物信息",variant:"destructive"})}},G=y.useMemo(()=>Object.keys(O.platforms),[O.platforms]),L=R=>R?new Date(R*1e3).toLocaleString("zh-CN"):"-";return i.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[i.jsx("div",{className:"mb-4 sm:mb-6",children:i.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:i.jsxs("div",{children:[i.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[i.jsx(Oge,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),i.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),i.jsx(Vt,{className:"flex-1",children:i.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[i.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),i.jsx("div",{className:"text-2xl font-bold mt-1",children:O.total})]}),i.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),i.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:O.known})]}),i.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),i.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:O.unknown})]})]}),i.jsx("div",{className:"rounded-lg border bg-card p-4",children:i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx(J,{htmlFor:"search",children:"搜索"}),i.jsxs("div",{className:"relative mt-1.5",children:[i.jsx(Dr,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),i.jsx(Ne,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:f,onChange:R=>m(R.target.value),className:"pl-9"})]})]}),i.jsxs("div",{children:[i.jsx(J,{htmlFor:"filter-known",children:"认识状态"}),i.jsxs(Et,{value:p===void 0?"all":p.toString(),onValueChange:R=>{g(R==="all"?void 0:R==="true"),u(1)},children:[i.jsx(wt,{id:"filter-known",className:"mt-1.5",children:i.jsx(At,{})}),i.jsxs(jt,{children:[i.jsx(Me,{value:"all",children:"全部"}),i.jsx(Me,{value:"true",children:"已认识"}),i.jsx(Me,{value:"false",children:"未认识"})]})]})]}),i.jsxs("div",{children:[i.jsx(J,{htmlFor:"filter-platform",children:"平台"}),i.jsxs(Et,{value:x||"all",onValueChange:R=>{j(R==="all"?void 0:R),u(1)},children:[i.jsx(wt,{id:"filter-platform",className:"mt-1.5",children:i.jsx(At,{})}),i.jsxs(jt,{children:[i.jsx(Me,{value:"all",children:"全部平台"}),G.map(R=>i.jsxs(Me,{value:R,children:[R," (",O.platforms[R],")"]},R))]})]})]})]})}),i.jsxs("div",{className:"rounded-lg border bg-card",children:[i.jsx("div",{className:"hidden md:block",children:i.jsxs(Al,{children:[i.jsx(Tl,{children:i.jsxs(vn,{children:[i.jsx(Ze,{children:"状态"}),i.jsx(Ze,{children:"名称"}),i.jsx(Ze,{children:"昵称"}),i.jsx(Ze,{children:"平台"}),i.jsx(Ze,{children:"用户ID"}),i.jsx(Ze,{children:"最后更新"}),i.jsx(Ze,{className:"text-right",children:"操作"})]})}),i.jsx(kl,{children:n?i.jsx(vn,{children:i.jsx(Ue,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):e.length===0?i.jsx(vn,{children:i.jsx(Ue,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):e.map(R=>i.jsxs(vn,{children:[i.jsx(Ue,{children:i.jsx("div",{className:de("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",R.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:R.is_known?"已认识":"未认识"})}),i.jsx(Ue,{className:"font-medium",children:R.person_name||i.jsx("span",{className:"text-muted-foreground",children:"-"})}),i.jsx(Ue,{children:R.nickname||"-"}),i.jsx(Ue,{children:R.platform}),i.jsx(Ue,{className:"font-mono text-sm",children:R.user_id}),i.jsx(Ue,{className:"text-sm text-muted-foreground",children:L(R.last_know)}),i.jsx(Ue,{className:"text-right",children:i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>H(R),children:i.jsx(Ua,{className:"h-4 w-4"})}),i.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>V(R),children:i.jsx(Tu,{className:"h-4 w-4"})}),i.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>k(R),children:i.jsx(Tt,{className:"h-4 w-4 text-destructive"})})]})})]},R.id))})]})}),i.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?i.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):e.length===0?i.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):e.map(R=>i.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[i.jsx("div",{className:"flex items-start justify-between gap-2",children:i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:de("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",R.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:R.is_known?"已认识":"未认识"}),i.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:R.person_name||i.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),R.nickname&&i.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",R.nickname]})]})}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),i.jsx("p",{className:"font-medium text-xs",children:R.platform})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),i.jsx("p",{className:"font-mono text-xs truncate",title:R.user_id,children:R.user_id})]}),i.jsxs("div",{className:"col-span-2",children:[i.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),i.jsx("p",{className:"text-xs",children:L(R.last_know)})]})]}),i.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[i.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>H(R),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[i.jsx(Ua,{className:"h-3 w-3 mr-1"}),"查看"]}),i.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>V(R),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[i.jsx(Tu,{className:"h-3 w-3 mr-1"}),"编辑"]}),i.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>k(R),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[i.jsx(Tt,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},R.id))}),a>d&&i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t",children:[i.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",a," 条记录,第 ",l," / ",Math.ceil(a/d)," 页"]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ue,{variant:"outline",size:"sm",onClick:()=>u(l-1),disabled:l===1,children:"上一页"}),i.jsx(ue,{variant:"outline",size:"sm",onClick:()=>u(l+1),disabled:l>=Math.ceil(a/d),children:"下一页"})]})]})]})]})}),i.jsx(M1e,{person:b,open:N,onOpenChange:A}),i.jsx(P1e,{person:b,open:E,onOpenChange:T,onSuccess:()=>{z(),D(),T(!1)}}),i.jsx(Pn,{open:!!C,onOpenChange:()=>k(null),children:i.jsxs(yn,{children:[i.jsxs(xn,{children:[i.jsx(wn,{children:"确认删除"}),i.jsxs(jn,{children:['确定要删除人物信息 "',C?.person_name||C?.nickname||C?.user_id,'" 吗? 此操作不可撤销。']})]}),i.jsxs(bn,{children:[i.jsx(_n,{children:"取消"}),i.jsx(Sn,{onClick:()=>C&&F(C),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})})]})}function M1e({person:e,open:t,onOpenChange:n}){if(!e)return null;const r=a=>a?new Date(a*1e3).toLocaleString("zh-CN"):"-";return i.jsx(nr,{open:t,onOpenChange:n,children:i.jsxs(Hn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[i.jsxs(Wn,{children:[i.jsx(Vn,{children:"人物详情"}),i.jsxs(dr,{children:["查看 ",e.person_name||e.nickname||e.user_id," 的完整信息"]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Hi,{icon:nF,label:"人物名称",value:e.person_name}),i.jsx(Hi,{icon:Lh,label:"昵称",value:e.nickname}),i.jsx(Hi,{icon:jg,label:"用户ID",value:e.user_id,mono:!0}),i.jsx(Hi,{icon:jg,label:"人物ID",value:e.person_id,mono:!0}),i.jsx(Hi,{label:"平台",value:e.platform}),i.jsx(Hi,{label:"状态",value:e.is_known?"已认识":"未认识"})]}),e.name_reason&&i.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[i.jsx(J,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),i.jsx("p",{className:"mt-1 text-sm",children:e.name_reason})]}),e.memory_points&&i.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[i.jsx(J,{className:"text-xs text-muted-foreground",children:"个人印象"}),i.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:e.memory_points})]}),e.group_nick_name&&e.group_nick_name.length>0&&i.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[i.jsx(J,{className:"text-xs text-muted-foreground",children:"群昵称"}),i.jsx("div",{className:"mt-2 space-y-1",children:e.group_nick_name.map((a,o)=>i.jsxs("div",{className:"text-sm flex items-center gap-2",children:[i.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:a.group_id}),i.jsx("span",{children:"→"}),i.jsx("span",{children:a.group_nick_name})]},o))})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsx(Hi,{icon:ol,label:"认识时间",value:r(e.know_times)}),i.jsx(Hi,{icon:ol,label:"首次记录",value:r(e.know_since)}),i.jsx(Hi,{icon:ol,label:"最后更新",value:r(e.last_know)})]})]}),i.jsx($r,{children:i.jsx(ue,{onClick:()=>n(!1),children:"关闭"})})]})})}function Hi({icon:e,label:t,value:n,mono:r=!1}){return i.jsxs("div",{className:"space-y-1",children:[i.jsxs(J,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e&&i.jsx(e,{className:"h-3 w-3"}),t]}),i.jsx("div",{className:de("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function P1e({person:e,open:t,onOpenChange:n,onSuccess:r}){const[a,o]=y.useState({}),[l,u]=y.useState(!1),{toast:d}=mr();y.useEffect(()=>{e&&o({person_name:e.person_name||"",name_reason:e.name_reason||"",nickname:e.nickname||"",memory_points:e.memory_points||"",is_known:e.is_known})},[e]);const f=async()=>{if(e)try{u(!0),await E1e(e.person_id,a),d({title:"保存成功",description:"人物信息已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新人物信息",variant:"destructive"})}finally{u(!1)}};return e?i.jsx(nr,{open:t,onOpenChange:n,children:i.jsxs(Hn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[i.jsxs(Wn,{children:[i.jsx(Vn,{children:"编辑人物信息"}),i.jsxs(dr,{children:["修改 ",e.person_name||e.nickname||e.user_id," 的信息"]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"person_name",children:"人物名称"}),i.jsx(Ne,{id:"person_name",value:a.person_name||"",onChange:m=>o({...a,person_name:m.target.value}),placeholder:"为这个人设置一个名称"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"nickname",children:"昵称"}),i.jsx(Ne,{id:"nickname",value:a.nickname||"",onChange:m=>o({...a,nickname:m.target.value}),placeholder:"昵称"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"name_reason",children:"名称设定原因"}),i.jsx(Wt,{id:"name_reason",value:a.name_reason||"",onChange:m=>o({...a,name_reason:m.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"memory_points",children:"个人印象"}),i.jsx(Wt,{id:"memory_points",value:a.memory_points||"",onChange:m=>o({...a,memory_points:m.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),i.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[i.jsxs("div",{children:[i.jsx(J,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),i.jsx(at,{id:"is_known",checked:a.is_known,onCheckedChange:m=>o({...a,is_known:m})})]})]}),i.jsxs($r,{children:[i.jsx(ue,{variant:"outline",onClick:()=>n(!1),children:"取消"}),i.jsx(ue,{onClick:f,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function R1e(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}const D1e={},mf={};function Zs(e,t){try{const r=(D1e[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];return r in mf?mf[r]:EL(r,r.split(":"))}catch{if(e in mf)return mf[e];const n=e?.match($1e);return n?EL(e,n.slice(1)):NaN}}const $1e=/([+-]\d\d):?(\d\d)?/;function EL(e,t){const n=+(t[0]||0),r=+(t[1]||0),a=+(t[2]||0)/60;return mf[e]=n*60+r>0?n*60+r+a:n*60-r-a}class ui extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(Zs(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),jH(this),pC(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new ui(...n,t):new ui(Date.now(),t)}withTimeZone(t){return new ui(+this,t)}getTimezoneOffset(){const t=-Zs(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),pC(this),+this}[Symbol.for("constructDateFrom")](t){return new ui(+new Date(t),this.timeZone)}}const AL=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!AL.test(e))return;const t=e.replace(AL,"$1UTC");ui.prototype[t]&&(e.startsWith("get")?ui.prototype[e]=function(){return this.internal[t]()}:(ui.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),I1e(this),+this},ui.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),pC(this),+this}))});function pC(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-Zs(e.timeZone,e)*60))}function I1e(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),jH(e)}function jH(e){const t=Zs(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);const a=-new Date(+e).getTimezoneOffset(),o=-new Date(+r).getTimezoneOffset(),l=a-o,u=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();l&&u&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+l);const d=a-n;d&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+d);const f=new Date(+e);f.setUTCSeconds(0);const m=a>0?f.getSeconds():(f.getSeconds()-60)%60,p=Math.round(-(Zs(e.timeZone,e)*60))%60;(p||m)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+p),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+p+m));const g=Zs(e.timeZone,e),x=g>0?Math.floor(g):Math.ceil(g),b=-new Date(+e).getTimezoneOffset()-x,w=x!==n,N=b-d;if(w&&N){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+N);const A=Zs(e.timeZone,e),E=A>0?Math.floor(A):Math.ceil(A),T=x-E;T&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+T),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+T))}}class sr extends ui{static tz(t,...n){return n.length?new sr(...n,t):new sr(Date.now(),t)}toISOString(){const[t,n,r]=this.tzComponents(),a=`${t}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+a}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,r,a]=this.internal.toUTCString().split(" ");return`${t?.slice(0,-1)} ${r} ${n} ${a}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,r,a]=this.tzComponents();return`${t} GMT${n}${r}${a} (${R1e(this.timeZone,this)})`}toLocaleString(t,n){return Date.prototype.toLocaleString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(t,n){return Date.prototype.toLocaleDateString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(t,n){return Date.prototype.toLocaleTimeString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),n=t>0?"-":"+",r=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),a=String(Math.abs(t)%60).padStart(2,"0");return[n,r,a]}withTimeZone(t){return new sr(+this,t)}[Symbol.for("constructDateFrom")](t){return new sr(+new Date(t),this.timeZone)}}const SH=6048e5,L1e=864e5,TL=Symbol.for("constructDateFrom");function Nn(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&TL in e?e[TL](t):e instanceof Date?new e.constructor(t):new Date(t)}function $t(e,t){return Nn(t||e,e)}function _H(e,t,n){const r=$t(e,n?.in);return isNaN(t)?Nn(e,NaN):(t&&r.setDate(r.getDate()+t),r)}function NH(e,t,n){const r=$t(e,n?.in);if(isNaN(t))return Nn(e,NaN);if(!t)return r;const a=r.getDate(),o=Nn(e,r.getTime());o.setMonth(r.getMonth()+t+1,0);const l=o.getDate();return a>=l?o:(r.setFullYear(o.getFullYear(),o.getMonth(),a),r)}let B1e={};function Xh(){return B1e}function is(e,t){const n=Xh(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,a=$t(e,t?.in),o=a.getDay(),l=(o=o.getTime()?r+1:n.getTime()>=u.getTime()?r:r-1}function kL(e){const t=$t(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Ml(e,...t){const n=Nn.bind(null,e||t.find(r=>typeof r=="object"));return t.map(n)}function gh(e,t){const n=$t(e,t?.in);return n.setHours(0,0,0,0),n}function OH(e,t,n){const[r,a]=Ml(n?.in,e,t),o=gh(r),l=gh(a),u=+o-kL(o),d=+l-kL(l);return Math.round((u-d)/L1e)}function z1e(e,t){const n=CH(e,t),r=Nn(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),vh(r)}function q1e(e,t,n){return _H(e,t*7,n)}function F1e(e,t,n){return NH(e,t*12,n)}function U1e(e,t){let n,r=t?.in;return e.forEach(a=>{!r&&typeof a=="object"&&(r=Nn.bind(null,a));const o=$t(a,r);(!n||n{!r&&typeof a=="object"&&(r=Nn.bind(null,a));const o=$t(a,r);(!n||n>o||isNaN(+o))&&(n=o)}),Nn(r,n||NaN)}function W1e(e,t,n){const[r,a]=Ml(n?.in,e,t);return+gh(r)==+gh(a)}function EH(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function V1e(e){return!(!EH(e)&&typeof e!="number"||isNaN(+$t(e)))}function G1e(e,t,n){const[r,a]=Ml(n?.in,e,t),o=r.getFullYear()-a.getFullYear(),l=r.getMonth()-a.getMonth();return o*12+l}function Y1e(e,t){const n=$t(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function AH(e,t){const[n,r]=Ml(e,t.start,t.end);return{start:n,end:r}}function K1e(e,t){const{start:n,end:r}=AH(t?.in,e);let a=+n>+r;const o=a?+n:+r,l=a?r:n;l.setHours(0,0,0,0),l.setDate(1);let u=1;const d=[];for(;+l<=o;)d.push(Nn(n,l)),l.setMonth(l.getMonth()+u);return a?d.reverse():d}function X1e(e,t){const n=$t(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Z1e(e,t){const n=$t(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function TH(e,t){const n=$t(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Q1e(e,t){const{start:n,end:r}=AH(t?.in,e);let a=+n>+r;const o=a?+n:+r,l=a?r:n;l.setHours(0,0,0,0),l.setMonth(0,1);let u=1;const d=[];for(;+l<=o;)d.push(Nn(n,l)),l.setFullYear(l.getFullYear()+u);return a?d.reverse():d}function kH(e,t){const n=Xh(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,a=$t(e,t?.in),o=a.getDay(),l=(o{let r;const a=eSe[e];return typeof a=="string"?r=a:t===1?r=a.one:r=a.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Zc(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const nSe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},rSe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},aSe={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},iSe={date:Zc({formats:nSe,defaultWidth:"full"}),time:Zc({formats:rSe,defaultWidth:"full"}),dateTime:Zc({formats:aSe,defaultWidth:"full"})},oSe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},sSe=(e,t,n,r)=>oSe[e];function ai(e){return(t,n)=>{const r=n?.context?String(n.context):"standalone";let a;if(r==="formatting"&&e.formattingValues){const l=e.defaultFormattingWidth||e.defaultWidth,u=n?.width?String(n.width):l;a=e.formattingValues[u]||e.formattingValues[l]}else{const l=e.defaultWidth,u=n?.width?String(n.width):e.defaultWidth;a=e.values[u]||e.values[l]}const o=e.argumentCallback?e.argumentCallback(t):t;return a[o]}}const lSe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},cSe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},uSe={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},dSe={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},fSe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},hSe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},mSe=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},pSe={ordinalNumber:mSe,era:ai({values:lSe,defaultWidth:"wide"}),quarter:ai({values:cSe,defaultWidth:"wide",argumentCallback:e=>e-1}),month:ai({values:uSe,defaultWidth:"wide"}),day:ai({values:dSe,defaultWidth:"wide"}),dayPeriod:ai({values:fSe,defaultWidth:"wide",formattingValues:hSe,defaultFormattingWidth:"wide"})};function ii(e){return(t,n={})=>{const r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],o=t.match(a);if(!o)return null;const l=o[0],u=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],d=Array.isArray(u)?gSe(u,p=>p.test(l)):vSe(u,p=>p.test(l));let f;f=e.valueCallback?e.valueCallback(d):d,f=n.valueCallback?n.valueCallback(f):f;const m=t.slice(l.length);return{value:f,rest:m}}}function vSe(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function gSe(e,t){for(let n=0;n{const r=t.match(e.matchPattern);if(!r)return null;const a=r[0],o=t.match(e.parsePattern);if(!o)return null;let l=e.valueCallback?e.valueCallback(o[0]):o[0];l=n.valueCallback?n.valueCallback(l):l;const u=t.slice(a.length);return{value:l,rest:u}}}const ySe=/^(\d+)(th|st|nd|rd)?/i,xSe=/\d+/i,bSe={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},wSe={any:[/^b/i,/^(a|c)/i]},jSe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},SSe={any:[/1/i,/2/i,/3/i,/4/i]},_Se={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},NSe={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},CSe={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},OSe={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},ESe={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},ASe={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},TSe={ordinalNumber:MH({matchPattern:ySe,parsePattern:xSe,valueCallback:e=>parseInt(e,10)}),era:ii({matchPatterns:bSe,defaultMatchWidth:"wide",parsePatterns:wSe,defaultParseWidth:"any"}),quarter:ii({matchPatterns:jSe,defaultMatchWidth:"wide",parsePatterns:SSe,defaultParseWidth:"any",valueCallback:e=>e+1}),month:ii({matchPatterns:_Se,defaultMatchWidth:"wide",parsePatterns:NSe,defaultParseWidth:"any"}),day:ii({matchPatterns:CSe,defaultMatchWidth:"wide",parsePatterns:OSe,defaultParseWidth:"any"}),dayPeriod:ii({matchPatterns:ESe,defaultMatchWidth:"any",parsePatterns:ASe,defaultParseWidth:"any"})},EE={code:"en-US",formatDistance:tSe,formatLong:iSe,formatRelative:sSe,localize:pSe,match:TSe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function kSe(e,t){const n=$t(e,t?.in);return OH(n,TH(n))+1}function PH(e,t){const n=$t(e,t?.in),r=+vh(n)-+z1e(n);return Math.round(r/SH)+1}function RH(e,t){const n=$t(e,t?.in),r=n.getFullYear(),a=Xh(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,l=Nn(t?.in||e,0);l.setFullYear(r+1,0,o),l.setHours(0,0,0,0);const u=is(l,t),d=Nn(t?.in||e,0);d.setFullYear(r,0,o),d.setHours(0,0,0,0);const f=is(d,t);return+n>=+u?r+1:+n>=+f?r:r-1}function MSe(e,t){const n=Xh(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=RH(e,t),o=Nn(t?.in||e,0);return o.setFullYear(a,0,r),o.setHours(0,0,0,0),is(o,t)}function DH(e,t){const n=$t(e,t?.in),r=+is(n,t)-+MSe(n,t);return Math.round(r/SH)+1}function Ct(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const Bo={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return Ct(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):Ct(n+1,2)},d(e,t){return Ct(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return Ct(e.getHours()%12||12,t.length)},H(e,t){return Ct(e.getHours(),t.length)},m(e,t){return Ct(e.getMinutes(),t.length)},s(e,t){return Ct(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return Ct(a,t.length)}},Tc={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ML={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return Bo.y(e,t)},Y:function(e,t,n,r){const a=RH(e,r),o=a>0?a:1-a;if(t==="YY"){const l=o%100;return Ct(l,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):Ct(o,t.length)},R:function(e,t){const n=CH(e);return Ct(n,t.length)},u:function(e,t){const n=e.getFullYear();return Ct(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return Ct(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return Ct(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return Bo.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return Ct(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const a=DH(e,r);return t==="wo"?n.ordinalNumber(a,{unit:"week"}):Ct(a,t.length)},I:function(e,t,n){const r=PH(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):Ct(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Bo.d(e,t)},D:function(e,t,n){const r=kSe(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Ct(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const a=e.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return Ct(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const a=e.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return Ct(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),a=r===0?7:r;switch(t){case"i":return String(a);case"ii":return Ct(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let a;switch(r===12?a=Tc.noon:r===0?a=Tc.midnight:a=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let a;switch(r>=17?a=Tc.evening:r>=12?a=Tc.afternoon:r>=4?a=Tc.morning:a=Tc.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Bo.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Bo.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Ct(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):Ct(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Bo.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Bo.s(e,t)},S:function(e,t){return Bo.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return RL(r);case"XXXX":case"XX":return Hs(r);case"XXXXX":case"XXX":default:return Hs(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return RL(r);case"xxxx":case"xx":return Hs(r);case"xxxxx":case"xxx":default:return Hs(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+PL(r,":");case"OOOO":default:return"GMT"+Hs(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+PL(r,":");case"zzzz":default:return"GMT"+Hs(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return Ct(r,t.length)},T:function(e,t,n){return Ct(+e,t.length)}};function PL(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=Math.trunc(r/60),o=r%60;return o===0?n+String(a):n+String(a)+t+Ct(o,2)}function RL(e,t){return e%60===0?(e>0?"-":"+")+Ct(Math.abs(e)/60,2):Hs(e,t)}function Hs(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=Ct(Math.trunc(r/60),2),o=Ct(r%60,2);return n+a+t+o}const DL=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},$H=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},PSe=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return DL(e,t);let o;switch(r){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",DL(r,t)).replace("{{time}}",$H(a,t))},RSe={p:$H,P:PSe},DSe=/^D+$/,$Se=/^Y+$/,ISe=["D","DD","YY","YYYY"];function LSe(e){return DSe.test(e)}function BSe(e){return $Se.test(e)}function zSe(e,t,n){const r=qSe(e,t,n);if(console.warn(r),ISe.includes(e))throw new RangeError(r)}function qSe(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const FSe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,USe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,HSe=/^'([^]*?)'?$/,WSe=/''/g,VSe=/[a-zA-Z]/;function uv(e,t,n){const r=Xh(),a=n?.locale??r.locale??EE,o=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,l=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,u=$t(e,n?.in);if(!V1e(u))throw new RangeError("Invalid time value");let d=t.match(USe).map(m=>{const p=m[0];if(p==="p"||p==="P"){const g=RSe[p];return g(m,a.formatLong)}return m}).join("").match(FSe).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const p=m[0];if(p==="'")return{isToken:!1,value:GSe(m)};if(ML[p])return{isToken:!0,value:m};if(p.match(VSe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+p+"`");return{isToken:!1,value:m}});a.localize.preprocessor&&(d=a.localize.preprocessor(u,d));const f={firstWeekContainsDate:o,weekStartsOn:l,locale:a};return d.map(m=>{if(!m.isToken)return m.value;const p=m.value;(!n?.useAdditionalWeekYearTokens&&BSe(p)||!n?.useAdditionalDayOfYearTokens&&LSe(p))&&zSe(p,t,String(e));const g=ML[p[0]];return g(u,p,a.localize,f)}).join("")}function GSe(e){const t=e.match(HSe);return t?t[1].replace(WSe,"'"):e}function YSe(e,t){const n=$t(e,t?.in),r=n.getFullYear(),a=n.getMonth(),o=Nn(n,0);return o.setFullYear(r,a+1,0),o.setHours(0,0,0,0),o.getDate()}function KSe(e,t){return $t(e,t?.in).getMonth()}function XSe(e,t){return $t(e,t?.in).getFullYear()}function ZSe(e,t){return+$t(e)>+$t(t)}function QSe(e,t){return+$t(e)<+$t(t)}function JSe(e,t,n){const[r,a]=Ml(n?.in,e,t);return+is(r,n)==+is(a,n)}function e_e(e,t,n){const[r,a]=Ml(n?.in,e,t);return r.getFullYear()===a.getFullYear()&&r.getMonth()===a.getMonth()}function t_e(e,t,n){const[r,a]=Ml(n?.in,e,t);return r.getFullYear()===a.getFullYear()}function n_e(e,t,n){const r=$t(e,n?.in),a=r.getFullYear(),o=r.getDate(),l=Nn(e,0);l.setFullYear(a,t,15),l.setHours(0,0,0,0);const u=YSe(l);return r.setMonth(t,Math.min(o,u)),r}function r_e(e,t,n){const r=$t(e,n?.in);return isNaN(+r)?Nn(e,NaN):(r.setFullYear(t),r)}const $L=5,a_e=4;function i_e(e,t){const n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,a=t.addDays(e,-r+1),o=t.addDays(a,$L*7-1);return t.getMonth(e)===t.getMonth(o)?$L:a_e}function IH(e,t){const n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function o_e(e,t){const n=IH(e,t),r=i_e(e,t);return t.addDays(n,r*7-1)}class ia{constructor(t,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?sr.tz(this.options.timeZone):new this.Date,this.newDate=(r,a,o)=>this.overrides?.newDate?this.overrides.newDate(r,a,o):this.options.timeZone?new sr(r,a,o,this.options.timeZone):new Date(r,a,o),this.addDays=(r,a)=>this.overrides?.addDays?this.overrides.addDays(r,a):_H(r,a),this.addMonths=(r,a)=>this.overrides?.addMonths?this.overrides.addMonths(r,a):NH(r,a),this.addWeeks=(r,a)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,a):q1e(r,a),this.addYears=(r,a)=>this.overrides?.addYears?this.overrides.addYears(r,a):F1e(r,a),this.differenceInCalendarDays=(r,a)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,a):OH(r,a),this.differenceInCalendarMonths=(r,a)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,a):G1e(r,a),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):K1e(r),this.eachYearOfInterval=r=>{const a=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):Q1e(r),o=new Set(a.map(u=>this.getYear(u)));if(o.size===a.length)return a;const l=[];return o.forEach(u=>{l.push(new Date(u,0,1))}),l},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):o_e(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):J1e(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):Y1e(r),this.endOfWeek=(r,a)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,a):kH(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):Z1e(r),this.format=(r,a,o)=>{const l=this.overrides?.format?this.overrides.format(r,a,this.options):uv(r,a,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(l):l},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):PH(r),this.getMonth=(r,a)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):KSe(r,this.options),this.getYear=(r,a)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):XSe(r,this.options),this.getWeek=(r,a)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):DH(r,this.options),this.isAfter=(r,a)=>this.overrides?.isAfter?this.overrides.isAfter(r,a):ZSe(r,a),this.isBefore=(r,a)=>this.overrides?.isBefore?this.overrides.isBefore(r,a):QSe(r,a),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):EH(r),this.isSameDay=(r,a)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,a):W1e(r,a),this.isSameMonth=(r,a)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,a):e_e(r,a),this.isSameYear=(r,a)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,a):t_e(r,a),this.max=r=>this.overrides?.max?this.overrides.max(r):U1e(r),this.min=r=>this.overrides?.min?this.overrides.min(r):H1e(r),this.setMonth=(r,a)=>this.overrides?.setMonth?this.overrides.setMonth(r,a):n_e(r,a),this.setYear=(r,a)=>this.overrides?.setYear?this.overrides.setYear(r,a):r_e(r,a),this.startOfBroadcastWeek=(r,a)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):IH(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):gh(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):vh(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):X1e(r),this.startOfWeek=(r,a)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):is(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):TH(r),this.options={locale:EE,...t},this.overrides=n}getDigitMap(){const{numerals:t="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:t}),r={};for(let a=0;a<10;a++)r[a.toString()]=n.format(a);return r}replaceDigits(t){const n=this.getDigitMap();return t.replace(/\d/g,r=>n[r]||r)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){const t=this.options.locale?.code;return t&&ia.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:n,timeZone:r,numerals:a}=this.options,o=n?.code;if(o&&ia.yearFirstLocales.has(o))try{return new Intl.DateTimeFormat(o,{month:"long",year:"numeric",timeZone:r,numberingSystem:a}).format(t)}catch{}const l=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,l)}}ia.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Si=new ia;class LH{constructor(t,n,r=Si){this.date=t,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(t,n)),this.dateLib=r}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class s_e{constructor(t,n){this.date=t,this.weeks=n}}class l_e{constructor(t,n){this.days=n,this.weekNumber=t}}function c_e(e){return W.createElement("button",{...e})}function u_e(e){return W.createElement("span",{...e})}function d_e(e){const{size:t=24,orientation:n="left",className:r}=e;return W.createElement("svg",{className:r,width:t,height:t,viewBox:"0 0 24 24"},n==="up"&&W.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&W.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&W.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&W.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function f_e(e){const{day:t,modifiers:n,...r}=e;return W.createElement("td",{...r})}function h_e(e){const{day:t,modifiers:n,...r}=e,a=W.useRef(null);return W.useEffect(()=>{n.focused&&a.current?.focus()},[n.focused]),W.createElement("button",{ref:a,...r})}var $e;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})($e||($e={}));var tn;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(tn||(tn={}));var za;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(za||(za={}));var Xr;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(Xr||(Xr={}));function m_e(e){const{options:t,className:n,components:r,classNames:a,...o}=e,l=[a[$e.Dropdown],n].join(" "),u=t?.find(({value:d})=>d===o.value);return W.createElement("span",{"data-disabled":o.disabled,className:a[$e.DropdownRoot]},W.createElement(r.Select,{className:l,...o},t?.map(({value:d,label:f,disabled:m})=>W.createElement(r.Option,{key:d,value:d,disabled:m},f))),W.createElement("span",{className:a[$e.CaptionLabel],"aria-hidden":!0},u?.label,W.createElement(r.Chevron,{orientation:"down",size:18,className:a[$e.Chevron]})))}function p_e(e){return W.createElement("div",{...e})}function v_e(e){return W.createElement("div",{...e})}function g_e(e){const{calendarMonth:t,displayIndex:n,...r}=e;return W.createElement("div",{...r},e.children)}function y_e(e){const{calendarMonth:t,displayIndex:n,...r}=e;return W.createElement("div",{...r})}function x_e(e){return W.createElement("table",{...e})}function b_e(e){return W.createElement("div",{...e})}const BH=y.createContext(void 0);function Zh(){const e=y.useContext(BH);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function w_e(e){const{components:t}=Zh();return W.createElement(t.Dropdown,{...e})}function j_e(e){const{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:a,...o}=e,{components:l,classNames:u,labels:{labelPrevious:d,labelNext:f}}=Zh(),m=y.useCallback(g=>{a&&n?.(g)},[a,n]),p=y.useCallback(g=>{r&&t?.(g)},[r,t]);return W.createElement("nav",{...o},W.createElement(l.PreviousMonthButton,{type:"button",className:u[$e.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":d(r),onClick:p},W.createElement(l.Chevron,{disabled:r?void 0:!0,className:u[$e.Chevron],orientation:"left"})),W.createElement(l.NextMonthButton,{type:"button",className:u[$e.NextMonthButton],tabIndex:a?void 0:-1,"aria-disabled":a?void 0:!0,"aria-label":f(a),onClick:m},W.createElement(l.Chevron,{disabled:a?void 0:!0,orientation:"right",className:u[$e.Chevron]})))}function S_e(e){const{components:t}=Zh();return W.createElement(t.Button,{...e})}function __e(e){return W.createElement("option",{...e})}function N_e(e){const{components:t}=Zh();return W.createElement(t.Button,{...e})}function C_e(e){const{rootRef:t,...n}=e;return W.createElement("div",{...n,ref:t})}function O_e(e){return W.createElement("select",{...e})}function E_e(e){const{week:t,...n}=e;return W.createElement("tr",{...n})}function A_e(e){return W.createElement("th",{...e})}function T_e(e){return W.createElement("thead",{"aria-hidden":!0},W.createElement("tr",{...e}))}function k_e(e){const{week:t,...n}=e;return W.createElement("th",{...n})}function M_e(e){return W.createElement("th",{...e})}function P_e(e){return W.createElement("tbody",{...e})}function R_e(e){const{components:t}=Zh();return W.createElement(t.Dropdown,{...e})}const D_e=Object.freeze(Object.defineProperty({__proto__:null,Button:c_e,CaptionLabel:u_e,Chevron:d_e,Day:f_e,DayButton:h_e,Dropdown:m_e,DropdownNav:p_e,Footer:v_e,Month:g_e,MonthCaption:y_e,MonthGrid:x_e,Months:b_e,MonthsDropdown:w_e,Nav:j_e,NextMonthButton:S_e,Option:__e,PreviousMonthButton:N_e,Root:C_e,Select:O_e,Week:E_e,WeekNumber:k_e,WeekNumberHeader:M_e,Weekday:A_e,Weekdays:T_e,Weeks:P_e,YearsDropdown:R_e},Symbol.toStringTag,{value:"Module"}));function Xi(e,t,n=!1,r=Si){let{from:a,to:o}=e;const{differenceInCalendarDays:l,isSameDay:u}=r;return a&&o?(l(o,a)<0&&([a,o]=[o,a]),l(t,a)>=(n?1:0)&&l(o,t)>=(n?1:0)):!n&&o?u(o,t):!n&&a?u(a,t):!1}function zH(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function AE(e){return!!(e&&typeof e=="object"&&"from"in e)}function qH(e){return!!(e&&typeof e=="object"&&"after"in e)}function FH(e){return!!(e&&typeof e=="object"&&"before"in e)}function UH(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function HH(e,t){return Array.isArray(e)&&e.every(t.isDate)}function Zi(e,t,n=Si){const r=Array.isArray(t)?t:[t],{isSameDay:a,differenceInCalendarDays:o,isAfter:l}=n;return r.some(u=>{if(typeof u=="boolean")return u;if(n.isDate(u))return a(e,u);if(HH(u,n))return u.includes(e);if(AE(u))return Xi(u,e,!1,n);if(UH(u))return Array.isArray(u.dayOfWeek)?u.dayOfWeek.includes(e.getDay()):u.dayOfWeek===e.getDay();if(zH(u)){const d=o(u.before,e),f=o(u.after,e),m=d>0,p=f<0;return l(u.before,u.after)?p&&m:m||p}return qH(u)?o(e,u.after)>0:FH(u)?o(u.before,e)>0:typeof u=="function"?u(e):!1})}function $_e(e,t,n,r,a){const{disabled:o,hidden:l,modifiers:u,showOutsideDays:d,broadcastCalendar:f,today:m}=t,{isSameDay:p,isSameMonth:g,startOfMonth:x,isBefore:j,endOfMonth:b,isAfter:w}=a,N=n&&x(n),A=r&&b(r),E={[tn.focused]:[],[tn.outside]:[],[tn.disabled]:[],[tn.hidden]:[],[tn.today]:[]},T={};for(const C of e){const{date:k,displayMonth:O}=C,M=!!(O&&!g(k,O)),I=!!(N&&j(k,N)),z=!!(A&&w(k,A)),D=!!(o&&Zi(k,o,a)),H=!!(l&&Zi(k,l,a))||I||z||!f&&!d&&M||f&&d===!1&&M,V=p(k,m??a.today());M&&E.outside.push(C),D&&E.disabled.push(C),H&&E.hidden.push(C),V&&E.today.push(C),u&&Object.keys(u).forEach(F=>{const G=u?.[F];G&&Zi(k,G,a)&&(T[F]?T[F].push(C):T[F]=[C])})}return C=>{const k={[tn.focused]:!1,[tn.disabled]:!1,[tn.hidden]:!1,[tn.outside]:!1,[tn.today]:!1},O={};for(const M in E){const I=E[M];k[M]=I.some(z=>z===C)}for(const M in T)O[M]=T[M].some(I=>I===C);return{...k,...O}}}function I_e(e,t,n={}){return Object.entries(e).filter(([,a])=>a===!0).reduce((a,[o])=>(n[o]?a.push(n[o]):t[tn[o]]?a.push(t[tn[o]]):t[za[o]]&&a.push(t[za[o]]),a),[t[$e.Day]])}function L_e(e){return{...D_e,...e}}function B_e(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([n,r])=>{n.startsWith("data-")&&(t[n]=r)}),t}function TE(){const e={};for(const t in $e)e[$e[t]]=`rdp-${$e[t]}`;for(const t in tn)e[tn[t]]=`rdp-${tn[t]}`;for(const t in za)e[za[t]]=`rdp-${za[t]}`;for(const t in Xr)e[Xr[t]]=`rdp-${Xr[t]}`;return e}function WH(e,t,n){return(n??new ia(t)).formatMonthYear(e)}const z_e=WH;function q_e(e,t,n){return(n??new ia(t)).format(e,"d")}function F_e(e,t=Si){return t.format(e,"LLLL")}function U_e(e,t,n){return(n??new ia(t)).format(e,"cccccc")}function H_e(e,t=Si){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function W_e(){return""}function VH(e,t=Si){return t.format(e,"yyyy")}const V_e=VH,G_e=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:WH,formatDay:q_e,formatMonthCaption:z_e,formatMonthDropdown:F_e,formatWeekNumber:H_e,formatWeekNumberHeader:W_e,formatWeekdayName:U_e,formatYearCaption:V_e,formatYearDropdown:VH},Symbol.toStringTag,{value:"Module"}));function Y_e(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...G_e,...e}}function K_e(e,t,n,r,a){const{startOfMonth:o,startOfYear:l,endOfYear:u,eachMonthOfInterval:d,getMonth:f}=a;return d({start:l(e),end:u(e)}).map(g=>{const x=r.formatMonthDropdown(g,a),j=f(g),b=t&&go(n)||!1;return{value:j,label:x,disabled:b}})}function X_e(e,t={},n={}){let r={...t?.[$e.Day]};return Object.entries(e).filter(([,a])=>a===!0).forEach(([a])=>{r={...r,...n?.[a]}}),r}function Z_e(e,t,n){const r=e.today(),a=t?e.startOfISOWeek(r):e.startOfWeek(r),o=[];for(let l=0;l<7;l++){const u=e.addDays(a,l);o.push(u)}return o}function Q_e(e,t,n,r,a=!1){if(!e||!t)return;const{startOfYear:o,endOfYear:l,eachYearOfInterval:u,getYear:d}=r,f=o(e),m=l(t),p=u({start:f,end:m});return a&&p.reverse(),p.map(g=>{const x=n.formatYearDropdown(g,r);return{value:d(g),label:x,disabled:!1}})}function GH(e,t,n,r){let a=(r??new ia(n)).format(e,"PPPP");return t.today&&(a=`Today, ${a}`),t.selected&&(a=`${a}, selected`),a}const J_e=GH;function YH(e,t,n){return(n??new ia(t)).formatMonthYear(e)}const eNe=YH;function tNe(e,t,n,r){let a=(r??new ia(n)).format(e,"PPPP");return t?.today&&(a=`Today, ${a}`),a}function nNe(e){return"Choose the Month"}function rNe(){return""}function aNe(e){return"Go to the Next Month"}function iNe(e){return"Go to the Previous Month"}function oNe(e,t,n){return(n??new ia(t)).format(e,"cccc")}function sNe(e,t){return`Week ${e}`}function lNe(e){return"Week Number"}function cNe(e){return"Choose the Year"}const uNe=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:eNe,labelDay:J_e,labelDayButton:GH,labelGrid:YH,labelGridcell:tNe,labelMonthDropdown:nNe,labelNav:rNe,labelNext:aNe,labelPrevious:iNe,labelWeekNumber:sNe,labelWeekNumberHeader:lNe,labelWeekday:oNe,labelYearDropdown:cNe},Symbol.toStringTag,{value:"Module"})),Qh=e=>e instanceof HTMLElement?e:null,i_=e=>[...e.querySelectorAll("[data-animated-month]")??[]],dNe=e=>Qh(e.querySelector("[data-animated-month]")),o_=e=>Qh(e.querySelector("[data-animated-caption]")),s_=e=>Qh(e.querySelector("[data-animated-weeks]")),fNe=e=>Qh(e.querySelector("[data-animated-nav]")),hNe=e=>Qh(e.querySelector("[data-animated-weekdays]"));function mNe(e,t,{classNames:n,months:r,focused:a,dateLib:o}){const l=y.useRef(null),u=y.useRef(r),d=y.useRef(!1);y.useLayoutEffect(()=>{const f=u.current;if(u.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||f.length===0||r.length!==f.length)return;const m=o.isSameMonth(r[0].date,f[0].date),p=o.isAfter(r[0].date,f[0].date),g=p?n[Xr.caption_after_enter]:n[Xr.caption_before_enter],x=p?n[Xr.weeks_after_enter]:n[Xr.weeks_before_enter],j=l.current,b=e.current.cloneNode(!0);if(b instanceof HTMLElement?(i_(b).forEach(E=>{if(!(E instanceof HTMLElement))return;const T=dNe(E);T&&E.contains(T)&&E.removeChild(T);const C=o_(E);C&&C.classList.remove(g);const k=s_(E);k&&k.classList.remove(x)}),l.current=b):l.current=null,d.current||m||a)return;const w=j instanceof HTMLElement?i_(j):[],N=i_(e.current);if(N?.every(A=>A instanceof HTMLElement)&&w&&w.every(A=>A instanceof HTMLElement)){d.current=!0,e.current.style.isolation="isolate";const A=fNe(e.current);A&&(A.style.zIndex="1"),N.forEach((E,T)=>{const C=w[T];if(!C)return;E.style.position="relative",E.style.overflow="hidden";const k=o_(E);k&&k.classList.add(g);const O=s_(E);O&&O.classList.add(x);const M=()=>{d.current=!1,e.current&&(e.current.style.isolation=""),A&&(A.style.zIndex=""),k&&k.classList.remove(g),O&&O.classList.remove(x),E.style.position="",E.style.overflow="",E.contains(C)&&E.removeChild(C)};C.style.pointerEvents="none",C.style.position="absolute",C.style.overflow="hidden",C.setAttribute("aria-hidden","true");const I=hNe(C);I&&(I.style.opacity="0");const z=o_(C);z&&(z.classList.add(p?n[Xr.caption_before_exit]:n[Xr.caption_after_exit]),z.addEventListener("animationend",M));const D=s_(C);D&&D.classList.add(p?n[Xr.weeks_before_exit]:n[Xr.weeks_after_exit]),E.insertBefore(C,E.firstChild)})}})}function pNe(e,t,n,r){const a=e[0],o=e[e.length-1],{ISOWeek:l,fixedWeeks:u,broadcastCalendar:d}=n??{},{addDays:f,differenceInCalendarDays:m,differenceInCalendarMonths:p,endOfBroadcastWeek:g,endOfISOWeek:x,endOfMonth:j,endOfWeek:b,isAfter:w,startOfBroadcastWeek:N,startOfISOWeek:A,startOfWeek:E}=r,T=d?N(a,r):l?A(a):E(a),C=d?g(o):l?x(j(o)):b(j(o)),k=m(C,T),O=p(o,a)+1,M=[];for(let D=0;D<=k;D++){const H=f(T,D);if(t&&w(H,t))break;M.push(H)}const z=(d?35:42)*O;if(u&&M.length{const a=r.weeks.reduce((o,l)=>o.concat(l.days.slice()),t.slice());return n.concat(a.slice())},t.slice())}function gNe(e,t,n,r){const{numberOfMonths:a=1}=n,o=[];for(let l=0;lt)break;o.push(u)}return o}function IL(e,t,n,r){const{month:a,defaultMonth:o,today:l=r.today(),numberOfMonths:u=1}=e;let d=a||o||l;const{differenceInCalendarMonths:f,addMonths:m,startOfMonth:p}=r;if(n&&f(n,d){const N=n.broadcastCalendar?p(w,r):n.ISOWeek?g(w):x(w),A=n.broadcastCalendar?o(w):n.ISOWeek?l(u(w)):d(u(w)),E=t.filter(O=>O>=N&&O<=A),T=n.broadcastCalendar?35:42;if(n.fixedWeeks&&E.length{const I=T-E.length;return M>A&&M<=a(A,I)});E.push(...O)}const C=E.reduce((O,M)=>{const I=n.ISOWeek?f(M):m(M),z=O.find(H=>H.weekNumber===I),D=new LH(M,w,r);return z?z.days.push(D):O.push(new l_e(I,[D])),O},[]),k=new s_e(w,C);return b.push(k),b},[]);return n.reverseMonths?j.reverse():j}function xNe(e,t){let{startMonth:n,endMonth:r}=e;const{startOfYear:a,startOfDay:o,startOfMonth:l,endOfMonth:u,addYears:d,endOfYear:f,newDate:m,today:p}=t,{fromYear:g,toYear:x,fromMonth:j,toMonth:b}=e;!n&&j&&(n=j),!n&&g&&(n=t.newDate(g,0,1)),!r&&b&&(r=b),!r&&x&&(r=m(x,11,31));const w=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return n?n=l(n):g?n=m(g,0,1):!n&&w&&(n=a(d(e.today??p(),-100))),r?r=u(r):x?r=m(x,11,31):!r&&w&&(r=f(e.today??p())),[n&&o(n),r&&o(r)]}function bNe(e,t,n,r){if(n.disableNavigation)return;const{pagedNavigation:a,numberOfMonths:o=1}=n,{startOfMonth:l,addMonths:u,differenceInCalendarMonths:d}=r,f=a?o:1,m=l(e);if(!t)return u(m,f);if(!(d(t,e)n.concat(r.weeks.slice()),t.slice())}function Jy(e,t){const[n,r]=y.useState(e);return[t===void 0?n:t,r]}function SNe(e,t){const[n,r]=xNe(e,t),{startOfMonth:a,endOfMonth:o}=t,l=IL(e,n,r,t),[u,d]=Jy(l,e.month?l:void 0);y.useEffect(()=>{const k=IL(e,n,r,t);d(k)},[e.timeZone]);const f=gNe(u,r,e,t),m=pNe(f,e.endMonth?o(e.endMonth):void 0,e,t),p=yNe(f,m,e,t),g=jNe(p),x=vNe(p),j=wNe(u,n,e,t),b=bNe(u,r,e,t),{disableNavigation:w,onMonthChange:N}=e,A=k=>g.some(O=>O.days.some(M=>M.isEqualTo(k))),E=k=>{if(w)return;let O=a(k);n&&Oa(r)&&(O=a(r)),d(O),N?.(O)};return{months:p,weeks:g,days:x,navStart:n,navEnd:r,previousMonth:j,nextMonth:b,goToMonth:E,goToDay:k=>{A(k)||E(k.date)}}}var ti;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(ti||(ti={}));function LL(e){return!e[tn.disabled]&&!e[tn.hidden]&&!e[tn.outside]}function _Ne(e,t,n,r){let a,o=-1;for(const l of e){const u=t(l);LL(u)&&(u[tn.focused]&&oLL(t(l)))),a}function NNe(e,t,n,r,a,o,l){const{ISOWeek:u,broadcastCalendar:d}=o,{addDays:f,addMonths:m,addWeeks:p,addYears:g,endOfBroadcastWeek:x,endOfISOWeek:j,endOfWeek:b,max:w,min:N,startOfBroadcastWeek:A,startOfISOWeek:E,startOfWeek:T}=l;let k={day:f,week:p,month:m,year:g,startOfWeek:O=>d?A(O,l):u?E(O):T(O),endOfWeek:O=>d?x(O):u?j(O):b(O)}[e](n,t==="after"?1:-1);return t==="before"&&r?k=w([r,k]):t==="after"&&a&&(k=N([a,k])),k}function KH(e,t,n,r,a,o,l,u=0){if(u>365)return;const d=NNe(e,t,n.date,r,a,o,l),f=!!(o.disabled&&Zi(d,o.disabled,l)),m=!!(o.hidden&&Zi(d,o.hidden,l)),p=d,g=new LH(d,p,l);return!f&&!m?g:KH(e,t,g,r,a,o,l,u+1)}function CNe(e,t,n,r,a){const{autoFocus:o}=e,[l,u]=y.useState(),d=_Ne(t.days,n,r||(()=>!1),l),[f,m]=y.useState(o?d:void 0);return{isFocusTarget:b=>!!d?.isEqualTo(b),setFocused:m,focused:f,blur:()=>{u(f),m(void 0)},moveFocus:(b,w)=>{if(!f)return;const N=KH(b,w,f,t.navStart,t.navEnd,e,a);N&&(e.disableNavigation&&!t.days.some(E=>E.isEqualTo(N))||(t.goToDay(N),m(N)))}}}function ONe(e,t){const{selected:n,required:r,onSelect:a}=e,[o,l]=Jy(n,a?n:void 0),u=a?n:o,{isSameDay:d}=t,f=x=>u?.some(j=>d(j,x))??!1,{min:m,max:p}=e;return{selected:u,select:(x,j,b)=>{let w=[...u??[]];if(f(x)){if(u?.length===m||r&&u?.length===1)return;w=u?.filter(N=>!d(N,x))}else u?.length===p?w=[x]:w=[...w,x];return a||l(w),a?.(w,x,j,b),w},isSelected:f}}function ENe(e,t,n=0,r=0,a=!1,o=Si){const{from:l,to:u}=t||{},{isSameDay:d,isAfter:f,isBefore:m}=o;let p;if(!l&&!u)p={from:e,to:n>0?void 0:e};else if(l&&!u)d(l,e)?n===0?p={from:l,to:e}:a?p={from:l,to:void 0}:p=void 0:m(e,l)?p={from:e,to:l}:p={from:l,to:e};else if(l&&u)if(d(l,e)&&d(u,e))a?p={from:l,to:u}:p=void 0;else if(d(l,e))p={from:l,to:n>0?void 0:e};else if(d(u,e))p={from:e,to:n>0?void 0:e};else if(m(e,l))p={from:e,to:u};else if(f(e,l))p={from:l,to:e};else if(f(e,u))p={from:l,to:e};else throw new Error("Invalid range");if(p?.from&&p?.to){const g=o.differenceInCalendarDays(p.to,p.from);r>0&&g>r?p={from:e,to:void 0}:n>1&&gtypeof u!="function").some(u=>typeof u=="boolean"?u:n.isDate(u)?Xi(e,u,!1,n):HH(u,n)?u.some(d=>Xi(e,d,!1,n)):AE(u)?u.from&&u.to?BL(e,{from:u.from,to:u.to},n):!1:UH(u)?ANe(e,u.dayOfWeek,n):zH(u)?n.isAfter(u.before,u.after)?BL(e,{from:n.addDays(u.after,1),to:n.addDays(u.before,-1)},n):Zi(e.from,u,n)||Zi(e.to,u,n):qH(u)||FH(u)?Zi(e.from,u,n)||Zi(e.to,u,n):!1))return!0;const l=r.filter(u=>typeof u=="function");if(l.length){let u=e.from;const d=n.differenceInCalendarDays(e.to,e.from);for(let f=0;f<=d;f++){if(l.some(m=>m(u)))return!0;u=n.addDays(u,1)}}return!1}function kNe(e,t){const{disabled:n,excludeDisabled:r,selected:a,required:o,onSelect:l}=e,[u,d]=Jy(a,l?a:void 0),f=l?a:u;return{selected:f,select:(g,x,j)=>{const{min:b,max:w}=e,N=g?ENe(g,f,b,w,o,t):void 0;return r&&n&&N?.from&&N.to&&TNe({from:N.from,to:N.to},n,t)&&(N.from=g,N.to=void 0),l||d(N),l?.(N,g,x,j),N},isSelected:g=>f&&Xi(f,g,!1,t)}}function MNe(e,t){const{selected:n,required:r,onSelect:a}=e,[o,l]=Jy(n,a?n:void 0),u=a?n:o,{isSameDay:d}=t;return{selected:u,select:(p,g,x)=>{let j=p;return!r&&u&&u&&d(p,u)&&(j=void 0),a||l(j),a?.(j,p,g,x),j},isSelected:p=>u?d(u,p):!1}}function PNe(e,t){const n=MNe(e,t),r=ONe(e,t),a=kNe(e,t);switch(e.mode){case"single":return n;case"multiple":return r;case"range":return a;default:return}}function RNe(e){let t=e;t.timeZone&&(t={...e},t.today&&(t.today=new sr(t.today,t.timeZone)),t.month&&(t.month=new sr(t.month,t.timeZone)),t.defaultMonth&&(t.defaultMonth=new sr(t.defaultMonth,t.timeZone)),t.startMonth&&(t.startMonth=new sr(t.startMonth,t.timeZone)),t.endMonth&&(t.endMonth=new sr(t.endMonth,t.timeZone)),t.mode==="single"&&t.selected?t.selected=new sr(t.selected,t.timeZone):t.mode==="multiple"&&t.selected?t.selected=t.selected?.map(et=>new sr(et,t.timeZone)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?new sr(t.selected.from,t.timeZone):void 0,to:t.selected.to?new sr(t.selected.to,t.timeZone):void 0}));const{components:n,formatters:r,labels:a,dateLib:o,locale:l,classNames:u}=y.useMemo(()=>{const et={...EE,...t.locale};return{dateLib:new ia({locale:et,weekStartsOn:t.broadcastCalendar?1:t.weekStartsOn,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},t.dateLib),components:L_e(t.components),formatters:Y_e(t.formatters),labels:{...uNe,...t.labels},locale:et,classNames:{...TE(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.components,t.formatters,t.labels,t.classNames]),{captionLayout:d,mode:f,navLayout:m,numberOfMonths:p=1,onDayBlur:g,onDayClick:x,onDayFocus:j,onDayKeyDown:b,onDayMouseEnter:w,onDayMouseLeave:N,onNextClick:A,onPrevClick:E,showWeekNumber:T,styles:C}=t,{formatCaption:k,formatDay:O,formatMonthDropdown:M,formatWeekNumber:I,formatWeekNumberHeader:z,formatWeekdayName:D,formatYearDropdown:H}=r,V=SNe(t,o),{days:F,months:G,navStart:L,navEnd:R,previousMonth:U,nextMonth:K,goToMonth:te}=V,$=$_e(F,t,L,R,o),{isSelected:B,select:Y,selected:ne}=PNe(t,o)??{},{blur:oe,focused:xe,isFocusTarget:ee,moveFocus:ae,setFocused:Z}=CNe(t,V,$,B??(()=>!1),o),{labelDayButton:pe,labelGridcell:je,labelGrid:le,labelMonthDropdown:Re,labelNav:_e,labelPrevious:me,labelNext:ve,labelWeekday:Le,labelWeekNumber:It,labelWeekNumberHeader:Cn,labelYearDropdown:vr}=a,rr=y.useMemo(()=>Z_e(o,t.ISOWeek),[o,t.ISOWeek]),gr=f!==void 0||x!==void 0,ct=y.useCallback(()=>{U&&(te(U),E?.(U))},[U,te,E]),rt=y.useCallback(()=>{K&&(te(K),A?.(K))},[te,K,A]),$n=y.useCallback((et,zt)=>He=>{He.preventDefault(),He.stopPropagation(),Z(et),Y?.(et.date,zt,He),x?.(et.date,zt,He)},[Y,x,Z]),gs=y.useCallback((et,zt)=>He=>{Z(et),j?.(et.date,zt,He)},[j,Z]),im=y.useCallback((et,zt)=>He=>{oe(),g?.(et.date,zt,He)},[oe,g]),Rl=y.useCallback((et,zt)=>He=>{const gt={ArrowLeft:[He.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[He.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[He.shiftKey?"year":"week","after"],ArrowUp:[He.shiftKey?"year":"week","before"],PageUp:[He.shiftKey?"year":"month","before"],PageDown:[He.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(gt[He.key]){He.preventDefault(),He.stopPropagation();const[In,tt]=gt[He.key];ae(In,tt)}b?.(et.date,zt,He)},[ae,b,t.dir]),ax=y.useCallback((et,zt)=>He=>{w?.(et.date,zt,He)},[w]),om=y.useCallback((et,zt)=>He=>{N?.(et.date,zt,He)},[N]),ix=y.useCallback(et=>zt=>{const He=Number(zt.target.value),gt=o.setMonth(o.startOfMonth(et),He);te(gt)},[o,te]),ox=y.useCallback(et=>zt=>{const He=Number(zt.target.value),gt=o.setYear(o.startOfMonth(et),He);te(gt)},[o,te]),{className:ys,style:yr}=y.useMemo(()=>({className:[u[$e.Root],t.className].filter(Boolean).join(" "),style:{...C?.[$e.Root],...t.style}}),[u,t.className,t.style,C]),Ka=B_e(t),ar=y.useRef(null);mNe(ar,!!t.animate,{classNames:u,months:G,focused:xe,dateLib:o});const sx={dayPickerProps:t,selected:ne,select:Y,isSelected:B,months:G,nextMonth:K,previousMonth:U,goToMonth:te,getModifiers:$,components:n,classNames:u,styles:C,labels:a,formatters:r};return W.createElement(BH.Provider,{value:sx},W.createElement(n.Root,{rootRef:t.animate?ar:void 0,className:ys,style:yr,dir:t.dir,id:t.id,lang:t.lang,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...Ka},W.createElement(n.Months,{className:u[$e.Months],style:C?.[$e.Months]},!t.hideNavigation&&!m&&W.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:u[$e.Nav],style:C?.[$e.Nav],"aria-label":_e(),onPreviousClick:ct,onNextClick:rt,previousMonth:U,nextMonth:K}),G.map((et,zt)=>W.createElement(n.Month,{"data-animated-month":t.animate?"true":void 0,className:u[$e.Month],style:C?.[$e.Month],key:zt,displayIndex:zt,calendarMonth:et},m==="around"&&!t.hideNavigation&&zt===0&&W.createElement(n.PreviousMonthButton,{type:"button",className:u[$e.PreviousMonthButton],tabIndex:U?void 0:-1,"aria-disabled":U?void 0:!0,"aria-label":me(U),onClick:ct,"data-animated-button":t.animate?"true":void 0},W.createElement(n.Chevron,{disabled:U?void 0:!0,className:u[$e.Chevron],orientation:t.dir==="rtl"?"right":"left"})),W.createElement(n.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:u[$e.MonthCaption],style:C?.[$e.MonthCaption],calendarMonth:et,displayIndex:zt},d?.startsWith("dropdown")?W.createElement(n.DropdownNav,{className:u[$e.Dropdowns],style:C?.[$e.Dropdowns]},(()=>{const He=d==="dropdown"||d==="dropdown-months"?W.createElement(n.MonthsDropdown,{key:"month",className:u[$e.MonthsDropdown],"aria-label":Re(),classNames:u,components:n,disabled:!!t.disableNavigation,onChange:ix(et.date),options:K_e(et.date,L,R,r,o),style:C?.[$e.Dropdown],value:o.getMonth(et.date)}):W.createElement("span",{key:"month"},M(et.date,o)),gt=d==="dropdown"||d==="dropdown-years"?W.createElement(n.YearsDropdown,{key:"year",className:u[$e.YearsDropdown],"aria-label":vr(o.options),classNames:u,components:n,disabled:!!t.disableNavigation,onChange:ox(et.date),options:Q_e(L,R,r,o,!!t.reverseYears),style:C?.[$e.Dropdown],value:o.getYear(et.date)}):W.createElement("span",{key:"year"},H(et.date,o));return o.getMonthYearOrder()==="year-first"?[gt,He]:[He,gt]})(),W.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},k(et.date,o.options,o))):W.createElement(n.CaptionLabel,{className:u[$e.CaptionLabel],role:"status","aria-live":"polite"},k(et.date,o.options,o))),m==="around"&&!t.hideNavigation&&zt===p-1&&W.createElement(n.NextMonthButton,{type:"button",className:u[$e.NextMonthButton],tabIndex:K?void 0:-1,"aria-disabled":K?void 0:!0,"aria-label":ve(K),onClick:rt,"data-animated-button":t.animate?"true":void 0},W.createElement(n.Chevron,{disabled:K?void 0:!0,className:u[$e.Chevron],orientation:t.dir==="rtl"?"left":"right"})),zt===p-1&&m==="after"&&!t.hideNavigation&&W.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:u[$e.Nav],style:C?.[$e.Nav],"aria-label":_e(),onPreviousClick:ct,onNextClick:rt,previousMonth:U,nextMonth:K}),W.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":f==="multiple"||f==="range","aria-label":le(et.date,o.options,o)||void 0,className:u[$e.MonthGrid],style:C?.[$e.MonthGrid]},!t.hideWeekdays&&W.createElement(n.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:u[$e.Weekdays],style:C?.[$e.Weekdays]},T&&W.createElement(n.WeekNumberHeader,{"aria-label":Cn(o.options),className:u[$e.WeekNumberHeader],style:C?.[$e.WeekNumberHeader],scope:"col"},z()),rr.map(He=>W.createElement(n.Weekday,{"aria-label":Le(He,o.options,o),className:u[$e.Weekday],key:String(He),style:C?.[$e.Weekday],scope:"col"},D(He,o.options,o)))),W.createElement(n.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:u[$e.Weeks],style:C?.[$e.Weeks]},et.weeks.map(He=>W.createElement(n.Week,{className:u[$e.Week],key:He.weekNumber,style:C?.[$e.Week],week:He},T&&W.createElement(n.WeekNumber,{week:He,style:C?.[$e.WeekNumber],"aria-label":It(He.weekNumber,{locale:l}),className:u[$e.WeekNumber],scope:"row",role:"rowheader"},I(He.weekNumber,o)),He.days.map(gt=>{const{date:In}=gt,tt=$(gt);if(tt[tn.focused]=!tt.hidden&&!!xe?.isEqualTo(gt),tt[za.selected]=B?.(In)||tt.selected,AE(ne)){const{from:$l,to:bs}=ne;tt[za.range_start]=!!($l&&bs&&o.isSameDay(In,$l)),tt[za.range_end]=!!($l&&bs&&o.isSameDay(In,bs)),tt[za.range_middle]=Xi(ne,In,!0,o)}const Dl=X_e(tt,C,t.modifiersStyles),xs=I_e(tt,u,t.modifiersClassNames),lx=!gr&&!tt.hidden?je(In,tt,o.options,o):void 0;return W.createElement(n.Day,{key:`${o.format(In,"yyyy-MM-dd")}_${o.format(gt.displayMonth,"yyyy-MM")}`,day:gt,modifiers:tt,className:xs.join(" "),style:Dl,role:"gridcell","aria-selected":tt.selected||void 0,"aria-label":lx,"data-day":o.format(In,"yyyy-MM-dd"),"data-month":gt.outside?o.format(In,"yyyy-MM"):void 0,"data-selected":tt.selected||void 0,"data-disabled":tt.disabled||void 0,"data-hidden":tt.hidden||void 0,"data-outside":gt.outside||void 0,"data-focused":tt.focused||void 0,"data-today":tt.today||void 0},!tt.hidden&&gr?W.createElement(n.DayButton,{className:u[$e.DayButton],style:C?.[$e.DayButton],type:"button",day:gt,modifiers:tt,disabled:tt.disabled||void 0,tabIndex:ee(gt)?0:-1,"aria-label":pe(In,tt,o.options,o),onClick:$n(gt,tt),onBlur:im(gt,tt),onFocus:gs(gt,tt),onKeyDown:Rl(gt,tt),onMouseEnter:ax(gt,tt),onMouseLeave:om(gt,tt)},O(In,o.options,o)):!tt.hidden&&O(gt.date,o.options,o))})))))))),t.footer&&W.createElement(n.Footer,{className:u[$e.Footer],style:C?.[$e.Footer],role:"status","aria-live":"polite"},t.footer)))}function zL({className:e,classNames:t,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:a="ghost",formatters:o,components:l,...u}){const d=TE();return i.jsx(RNe,{showOutsideDays:n,className:de("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:r,formatters:{formatMonthDropdown:f=>f.toLocaleString("default",{month:"short"}),...o},classNames:{root:de("w-fit",d.root),months:de("relative flex flex-col gap-4 md:flex-row",d.months),month:de("flex w-full flex-col gap-4",d.month),nav:de("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",d.nav),button_previous:de(fh({variant:a}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_previous),button_next:de(fh({variant:a}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_next),month_caption:de("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",d.month_caption),dropdowns:de("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",d.dropdowns),dropdown_root:de("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",d.dropdown_root),dropdown:de("bg-popover absolute inset-0 opacity-0",d.dropdown),caption_label:de("select-none font-medium",r==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",d.caption_label),table:"w-full border-collapse",weekdays:de("flex",d.weekdays),weekday:de("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",d.weekday),week:de("mt-2 flex w-full",d.week),week_number_header:de("w-[--cell-size] select-none",d.week_number_header),week_number:de("text-muted-foreground select-none text-[0.8rem]",d.week_number),day:de("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",d.day),range_start:de("bg-accent rounded-l-md",d.range_start),range_middle:de("rounded-none",d.range_middle),range_end:de("bg-accent rounded-r-md",d.range_end),today:de("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",d.today),outside:de("text-muted-foreground aria-selected:text-muted-foreground",d.outside),disabled:de("text-muted-foreground opacity-50",d.disabled),hidden:de("invisible",d.hidden),...t},components:{Root:({className:f,rootRef:m,...p})=>i.jsx("div",{"data-slot":"calendar",ref:m,className:de(f),...p}),Chevron:({className:f,orientation:m,...p})=>m==="left"?i.jsx(YO,{className:de("size-4",f),...p}):m==="right"?i.jsx(KO,{className:de("size-4",f),...p}):i.jsx(uh,{className:de("size-4",f),...p}),DayButton:DNe,WeekNumber:({children:f,...m})=>i.jsx("td",{...m,children:i.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:f})}),...l},...u})}function DNe({className:e,day:t,modifiers:n,...r}){const a=TE(),o=y.useRef(null);return y.useEffect(()=>{n.focused&&o.current?.focus()},[n.focused]),i.jsx(ue,{ref:o,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:de("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",a.day,e),...r})}class $Ne{ws=null;reconnectTimeout=null;reconnectAttempts=0;maxReconnectAttempts=10;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];maxCacheSize=1e3;getWebSocketUrl(){{const t=window.location.protocol==="https:"?"wss:":"ws:",n=window.location.host;return`${t}//${n}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const t=this.getWebSocketUrl();try{this.ws=new WebSocket(t),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=n=>{try{if(n.data==="pong")return;const r=JSON.parse(n.data);this.notifyLog(r)}catch(r){console.error("解析日志消息失败:",r)}},this.ws.onerror=n=>{console.error("❌ WebSocket 错误:",n),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(n){console.error("创建 WebSocket 连接失败:",n),this.attemptReconnect()}}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return;this.reconnectAttempts+=1;const t=Math.min(1e3*this.reconnectAttempts,1e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},t)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(t){return this.logCallbacks.add(t),()=>this.logCallbacks.delete(t)}onConnectionChange(t){return this.connectionCallbacks.add(t),t(this.isConnected),()=>this.connectionCallbacks.delete(t)}notifyLog(t){this.logCache.some(r=>r.id===t.id)||(this.logCache.push(t),this.logCache.length>this.maxCacheSize&&(this.logCache=this.logCache.slice(-this.maxCacheSize)),this.logCallbacks.forEach(r=>{try{r(t)}catch(a){console.error("日志回调执行失败:",a)}}))}notifyConnection(t){this.connectionCallbacks.forEach(n=>{try{n(t)}catch(r){console.error("连接状态回调执行失败:",r)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const $c=new $Ne;typeof window<"u"&&$c.connect();const INe={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},LNe=(e,t,n)=>{let r;const a=INe[e];return typeof a=="string"?r=a:t===1?r=a.one:r=a.other.replace("{{count}}",String(t)),n?.addSuffix?n.comparison&&n.comparison>0?r+"内":r+"前":r},BNe={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},zNe={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},qNe={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},FNe={date:Zc({formats:BNe,defaultWidth:"full"}),time:Zc({formats:zNe,defaultWidth:"full"}),dateTime:Zc({formats:qNe,defaultWidth:"full"})};function qL(e,t,n){const r="eeee p";return JSe(e,t,n)?r:e.getTime()>t.getTime()?"'下个'"+r:"'上个'"+r}const UNe={lastWeek:qL,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:qL,other:"PP p"},HNe=(e,t,n,r)=>{const a=UNe[e];return typeof a=="function"?a(t,n,r):a},WNe={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},VNe={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},GNe={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},YNe={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},KNe={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},XNe={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},ZNe=(e,t)=>{const n=Number(e);switch(t?.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},QNe={ordinalNumber:ZNe,era:ai({values:WNe,defaultWidth:"wide"}),quarter:ai({values:VNe,defaultWidth:"wide",argumentCallback:e=>e-1}),month:ai({values:GNe,defaultWidth:"wide"}),day:ai({values:YNe,defaultWidth:"wide"}),dayPeriod:ai({values:KNe,defaultWidth:"wide",formattingValues:XNe,defaultFormattingWidth:"wide"})},JNe=/^(第\s*)?\d+(日|时|分|秒)?/i,eCe=/\d+/i,tCe={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},nCe={any:[/^(前)/i,/^(公元)/i]},rCe={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},aCe={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},iCe={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},oCe={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},sCe={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},lCe={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},cCe={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},uCe={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},dCe={ordinalNumber:MH({matchPattern:JNe,parsePattern:eCe,valueCallback:e=>parseInt(e,10)}),era:ii({matchPatterns:tCe,defaultMatchWidth:"wide",parsePatterns:nCe,defaultParseWidth:"any"}),quarter:ii({matchPatterns:rCe,defaultMatchWidth:"wide",parsePatterns:aCe,defaultParseWidth:"any",valueCallback:e=>e+1}),month:ii({matchPatterns:iCe,defaultMatchWidth:"wide",parsePatterns:oCe,defaultParseWidth:"any"}),day:ii({matchPatterns:sCe,defaultMatchWidth:"wide",parsePatterns:lCe,defaultParseWidth:"any"}),dayPeriod:ii({matchPatterns:cCe,defaultMatchWidth:"any",parsePatterns:uCe,defaultParseWidth:"any"})},Vp={code:"zh-CN",formatDistance:LNe,formatLong:FNe,formatRelative:HNe,localize:QNe,match:dCe,options:{weekStartsOn:1,firstWeekContainsDate:4}};function fCe(){const[e,t]=y.useState([]),[n,r]=y.useState(""),[a,o]=y.useState("all"),[l,u]=y.useState("all"),[d,f]=y.useState(void 0),[m,p]=y.useState(void 0),[g,x]=y.useState(!0),[j,b]=y.useState(!1),w=y.useRef(null),N=y.useRef(null);y.useEffect(()=>{const D=$c.getAllLogs();t(D);const H=$c.onLog(()=>{t($c.getAllLogs())}),V=$c.onConnectionChange(F=>{b(F)});return()=>{H(),V()}},[]),y.useEffect(()=>{g&&N.current&&N.current.scrollIntoView({behavior:"smooth",block:"end"})},[e,g]);const A=y.useMemo(()=>{const D=new Set(e.map(H=>H.module));return Array.from(D).sort()},[e]),E=D=>{switch(D){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},T=D=>{switch(D){case"DEBUG":return"bg-secondary/50";case"INFO":return"bg-blue-500/10 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-500/10 dark:bg-yellow-500/20";case"ERROR":return"bg-red-500/10 dark:bg-red-500/20";case"CRITICAL":return"bg-red-600/20 dark:bg-red-600/30";default:return"bg-muted/50"}},C=()=>{window.location.reload()},k=()=>{$c.clearLogs(),t([])},O=()=>{const D=z.map(G=>`${G.timestamp} [${G.level.padEnd(8)}] [${G.module}] ${G.message}`).join(` `),H=new Blob([D],{type:"text/plain;charset=utf-8"}),V=URL.createObjectURL(H),F=document.createElement("a");F.href=V,F.download=`logs-${uv(new Date,"yyyy-MM-dd-HHmmss")}.txt`,F.click(),URL.revokeObjectURL(V)},M=()=>{x(!g)},I=()=>{f(void 0),p(void 0)},z=y.useMemo(()=>e.filter(D=>{const H=n===""||D.message.toLowerCase().includes(n.toLowerCase())||D.module.toLowerCase().includes(n.toLowerCase()),V=a==="all"||D.level===a,F=l==="all"||D.module===l;let G=!0;if(d||m){const L=new Date(D.timestamp);if(d){const R=new Date(d);R.setHours(0,0,0,0),G=G&&L>=R}if(m){const R=new Date(m);R.setHours(23,59,59,999),G=G&&L<=R}}return H&&V&&F&&G}),[e,n,a,l,d,m]);return i.jsx(Vt,{className:"h-full",children:i.jsxs("div",{className:"space-y-4 p-3 sm:p-4 lg:p-6",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),i.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:de("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",j?"bg-green-500 animate-pulse":"bg-red-500")}),i.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:j?"已连接":"未连接"})]})]}),i.jsx(st,{className:"p-3 sm:p-4",children:i.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[i.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[i.jsxs("div",{className:"flex-1 relative",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),i.jsx(Ne,{placeholder:"搜索日志...",value:n,onChange:D=>r(D.target.value),className:"pl-9 h-9 text-sm"})]}),i.jsxs(Et,{value:a,onValueChange:o,children:[i.jsxs(wt,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[i.jsx(GN,{className:"h-4 w-4 mr-2"}),i.jsx(At,{placeholder:"级别"})]}),i.jsxs(jt,{children:[i.jsx(Me,{value:"all",children:"全部级别"}),i.jsx(Me,{value:"DEBUG",children:"DEBUG"}),i.jsx(Me,{value:"INFO",children:"INFO"}),i.jsx(Me,{value:"WARNING",children:"WARNING"}),i.jsx(Me,{value:"ERROR",children:"ERROR"}),i.jsx(Me,{value:"CRITICAL",children:"CRITICAL"})]})]}),i.jsxs(Et,{value:l,onValueChange:u,children:[i.jsxs(wt,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[i.jsx(GN,{className:"h-4 w-4 mr-2"}),i.jsx(At,{placeholder:"模块"})]}),i.jsxs(jt,{children:[i.jsx(Me,{value:"all",children:"全部模块"}),A.map(D=>i.jsx(Me,{value:D,children:D},D))]})]})]}),i.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[i.jsxs(ts,{children:[i.jsx(ns,{asChild:!0,children:i.jsxs(ue,{variant:"outline",size:"sm",className:de("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!d&&"text-muted-foreground"),children:[i.jsx(UI,{className:"mr-2 h-4 w-4"}),i.jsx("span",{className:"text-xs sm:text-sm",children:d?uv(d,"PPP",{locale:Vp}):"开始日期"})]})}),i.jsx(so,{className:"w-auto p-0",align:"start",children:i.jsx(zL,{mode:"single",selected:d,onSelect:f,initialFocus:!0,locale:Vp})})]}),i.jsxs(ts,{children:[i.jsx(ns,{asChild:!0,children:i.jsxs(ue,{variant:"outline",size:"sm",className:de("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!m&&"text-muted-foreground"),children:[i.jsx(UI,{className:"mr-2 h-4 w-4"}),i.jsx("span",{className:"text-xs sm:text-sm",children:m?uv(m,"PPP",{locale:Vp}):"结束日期"})]})}),i.jsx(so,{className:"w-auto p-0",align:"start",children:i.jsx(zL,{mode:"single",selected:m,onSelect:p,initialFocus:!0,locale:Vp})})]}),(d||m)&&i.jsxs(ue,{variant:"outline",size:"sm",onClick:I,className:"w-full sm:w-auto h-9",children:[i.jsx(Bh,{className:"h-4 w-4 sm:mr-2"}),i.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),i.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),i.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[i.jsxs("div",{className:"flex gap-2 flex-wrap",children:[i.jsxs(ue,{variant:g?"default":"outline",size:"sm",onClick:M,className:"flex-1 sm:flex-none h-9",children:[g?i.jsx(Gve,{className:"h-4 w-4"}):i.jsx(Xve,{className:"h-4 w-4"}),i.jsx("span",{className:"ml-2 text-sm",children:g?"自动滚动":"已暂停"})]}),i.jsxs(ue,{variant:"outline",size:"sm",onClick:C,className:"flex-1 sm:flex-none h-9",children:[i.jsx(sl,{className:"h-4 w-4"}),i.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),i.jsxs(ue,{variant:"outline",size:"sm",onClick:k,className:"flex-1 sm:flex-none h-9",children:[i.jsx(Tt,{className:"h-4 w-4"}),i.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),i.jsxs(ue,{variant:"outline",size:"sm",onClick:O,className:"flex-1 sm:flex-none h-9",children:[i.jsx(WN,{className:"h-4 w-4"}),i.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),i.jsx("div",{className:"flex-1 hidden sm:block"}),i.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[i.jsxs("span",{className:"font-mono",children:[z.length," / ",e.length]}),i.jsx("span",{className:"ml-1",children:"条日志"})]})]})]})}),i.jsx(st,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900",children:i.jsx(Vt,{className:"h-[calc(100vh-280px)] sm:h-[calc(100vh-320px)] lg:h-[calc(100vh-400px)]",children:i.jsxs("div",{ref:w,className:"p-2 sm:p-3 lg:p-4 font-mono text-xs sm:text-sm space-y-1",children:[z.length===0?i.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):z.map(D=>i.jsxs("div",{className:de("py-2 px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",T(D.level)),children:[i.jsxs("div",{className:"flex flex-col gap-1 sm:hidden",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-gray-500 dark:text-gray-600 text-xs",children:D.timestamp}),i.jsxs("span",{className:de("text-xs font-semibold",E(D.level)),children:["[",D.level,"]"]})]}),i.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 text-xs truncate",children:D.module}),i.jsx("div",{className:"text-gray-300 dark:text-gray-400 text-xs break-all",children:D.message})]}),i.jsxs("div",{className:"hidden sm:flex gap-3 items-start",children:[i.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[140px] lg:w-[180px] text-xs lg:text-sm",children:D.timestamp}),i.jsxs("span",{className:de("flex-shrink-0 w-[70px] lg:w-[80px] font-semibold text-xs lg:text-sm",E(D.level)),children:["[",D.level,"]"]}),i.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[120px] lg:w-[150px] truncate text-xs lg:text-sm",children:D.module}),i.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 break-all text-xs lg:text-sm",children:D.message})]})]},D.id)),i.jsx("div",{ref:N,className:"h-4"})]})})})]})})}const hCe="Mai-with-u",mCe="plugin-repo",pCe="main",vCe="plugin_details.json";async function gCe(){try{const e=await Qe("/api/webui/plugins/fetch-raw",{method:"POST",headers:lt(),body:JSON.stringify({owner:hCe,repo:mCe,branch:pCe,file_path:vCe})});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const t=await e.json();if(!t.success||!t.data)throw new Error(t.error||"获取插件列表失败");return JSON.parse(t.data).filter(a=>!a?.id||!a?.manifest?(console.warn("跳过无效插件数据:",a),!1):!a.manifest.name||!a.manifest.version?(console.warn("跳过缺少必需字段的插件:",a.id),!1):!0).map(a=>({id:a.id,manifest:{manifest_version:a.manifest.manifest_version||1,name:a.manifest.name,version:a.manifest.version,description:a.manifest.description||"",author:a.manifest.author||{name:"Unknown"},license:a.manifest.license||"Unknown",host_application:a.manifest.host_application||{min_version:"0.0.0"},homepage_url:a.manifest.homepage_url,repository_url:a.manifest.repository_url,keywords:a.manifest.keywords||[],categories:a.manifest.categories||[],default_locale:a.manifest.default_locale||"zh-CN",locales_path:a.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(e){throw console.error("Failed to fetch plugin list:",e),e}}async function yCe(){try{const e=await Qe("/api/webui/plugins/git-status");if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch(e){return console.error("Failed to check Git status:",e),{installed:!1,error:"无法检测 Git 安装状态"}}}async function xCe(){try{const e=await Qe("/api/webui/plugins/version");if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch(e){return console.error("Failed to get Maimai version:",e),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function bCe(e,t,n){const r=e.split(".").map(u=>parseInt(u)||0),a=r[0]||0,o=r[1]||0,l=r[2]||0;if(n.version_majorparseInt(p)||0),d=u[0]||0,f=u[1]||0,m=u[2]||0;if(n.version_major>d||n.version_major===d&&n.version_minor>f||n.version_major===d&&n.version_minor===f&&n.version_patch>m)return!1}return!0}function wCe(e,t){const n=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host,a=new WebSocket(`${n}//${r}/api/webui/ws/plugin-progress`);return a.onopen=()=>{console.log("Plugin progress WebSocket connected");const o=setInterval(()=>{a.readyState===WebSocket.OPEN?a.send("ping"):clearInterval(o)},3e4)},a.onmessage=o=>{try{if(o.data==="pong")return;const l=JSON.parse(o.data);e(l)}catch(l){console.error("Failed to parse progress data:",l)}},a.onerror=o=>{console.error("Plugin progress WebSocket error:",o),t?.(o)},a.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},a}async function Gp(){try{const e=await Qe("/api/webui/plugins/installed",{headers:lt()});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const t=await e.json();if(!t.success)throw new Error(t.message||"获取已安装插件列表失败");return t.plugins||[]}catch(e){return console.error("Failed to get installed plugins:",e),[]}}function Yp(e,t){return t.some(n=>n.id===e)}function Kp(e,t){const n=t.find(r=>r.id===e);if(n)return n.manifest?.version||n.version}async function jCe(e,t,n="main"){const r=await Qe("/api/webui/plugins/install",{method:"POST",headers:lt(),body:JSON.stringify({plugin_id:e,repository_url:t,branch:n})});if(!r.ok){const a=await r.json();throw new Error(a.detail||"安装失败")}return await r.json()}async function SCe(e){const t=await Qe("/api/webui/plugins/uninstall",{method:"POST",headers:lt(),body:JSON.stringify({plugin_id:e})});if(!t.ok){const n=await t.json();throw new Error(n.detail||"卸载失败")}return await t.json()}async function _Ce(e,t,n="main"){const r=await Qe("/api/webui/plugins/update",{method:"POST",headers:lt(),body:JSON.stringify({plugin_id:e,repository_url:t,branch:n})});if(!r.ok){const a=await r.json();throw new Error(a.detail||"更新失败")}return await r.json()}function NCe(){const e=oa(),[t,n]=y.useState(null),[r,a]=y.useState(""),[o,l]=y.useState("all"),[u,d]=y.useState("all"),[f,m]=y.useState(!1),[p,g]=y.useState([]),[x,j]=y.useState(!0),[b,w]=y.useState(null),[N,A]=y.useState(null),[E,T]=y.useState(null),[C,k]=y.useState(null),[,O]=y.useState([]),{toast:M}=mr();y.useEffect(()=>{let R=null,U=!1;return(async()=>{if(R=wCe(te=>{U||(T(te),te.stage==="success"?setTimeout(()=>{U||T(null)},2e3):te.stage==="error"&&(j(!1),w(te.error||"加载失败")))},te=>{console.error("WebSocket error:",te),U||M({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(te=>{if(!R){te();return}const $=()=>{R&&R.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),te()):R&&R.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),te()):setTimeout($,100)};$()}),!U){const te=await yCe();A(te),te.installed||M({title:"Git 未安装",description:te.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!U){const te=await xCe();k(te)}if(!U)try{j(!0),w(null);const te=await gCe();if(!U){const $=await Gp();O($);const B=te.map(Y=>{const ne=Yp(Y.id,$),oe=Kp(Y.id,$);return{...Y,installed:ne,installed_version:oe}});for(const Y of $)!B.some(oe=>oe.id===Y.id)&&Y.manifest&&B.push({id:Y.id,manifest:{manifest_version:Y.manifest.manifest_version||1,name:Y.manifest.name,version:Y.manifest.version,description:Y.manifest.description||"",author:Y.manifest.author,license:Y.manifest.license||"Unknown",host_application:Y.manifest.host_application,homepage_url:Y.manifest.homepage_url,repository_url:Y.manifest.repository_url,keywords:Y.manifest.keywords||[],categories:Y.manifest.categories||[],default_locale:Y.manifest.default_locale||"zh-CN",locales_path:Y.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:Y.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});g(B)}}catch(te){if(!U){const $=te instanceof Error?te.message:"加载插件列表失败";w($),M({title:"加载失败",description:$,variant:"destructive"})}}finally{U||j(!1)}})(),()=>{U=!0,R&&R.close()}},[M]);const I=R=>{if(!R.installed&&C&&!z(R))return i.jsxs(Dt,{variant:"destructive",className:"gap-1",children:[i.jsx(bg,{className:"h-3 w-3"}),"不兼容"]});if(R.installed){const U=R.installed_version?.trim(),K=R.manifest.version?.trim();if(U!==K){const te=U?.split(".").map(Number)||[0,0,0],$=K?.split(".").map(Number)||[0,0,0];for(let B=0;B<3;B++){if(($[B]||0)>(te[B]||0))return i.jsxs(Dt,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[i.jsx(bg,{className:"h-3 w-3"}),"可更新"]});if(($[B]||0)<(te[B]||0))break}}return i.jsxs(Dt,{variant:"default",className:"gap-1",children:[i.jsx(Vo,{className:"h-3 w-3"}),"已安装"]})}return null},z=R=>!C||!R.manifest?.host_application?!0:bCe(R.manifest.host_application.min_version,R.manifest.host_application.max_version,C),D=R=>{if(!R.installed||!R.installed_version||!R.manifest?.version)return!1;const U=R.installed_version.trim(),K=R.manifest.version.trim();if(U===K)return!1;const te=U.split(".").map(Number),$=K.split(".").map(Number);for(let B=0;B<3;B++){if(($[B]||0)>(te[B]||0))return!0;if(($[B]||0)<(te[B]||0))return!1}return!1},H=p.filter(R=>{if(!R.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",R.id),!1;const U=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(B=>B.toLowerCase().includes(r.toLowerCase())),K=o==="all"||R.manifest.categories&&R.manifest.categories.includes(o);let te=!0;u==="installed"?te=R.installed===!0:u==="updates"&&(te=R.installed===!0&&D(R));const $=!f||!C||z(R);return U&&K&&te&&$}),V=()=>{n(null)},F=async R=>{if(!N?.installed){M({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(C&&!z(R)){M({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await jCe(R.id,R.manifest.repository_url||"","main"),M({title:"安装成功",description:`${R.manifest.name} 已成功安装`});const U=await Gp();O(U),g(K=>K.map(te=>{if(te.id===R.id){const $=Yp(te.id,U),B=Kp(te.id,U);return{...te,installed:$,installed_version:B}}return te}))}catch(U){M({title:"安装失败",description:U instanceof Error?U.message:"未知错误",variant:"destructive"})}},G=async R=>{try{await SCe(R.id),M({title:"卸载成功",description:`${R.manifest.name} 已成功卸载`});const U=await Gp();O(U),g(K=>K.map(te=>{if(te.id===R.id){const $=Yp(te.id,U),B=Kp(te.id,U);return{...te,installed:$,installed_version:B}}return te}))}catch(U){M({title:"卸载失败",description:U instanceof Error?U.message:"未知错误",variant:"destructive"})}},L=async R=>{if(!N?.installed){M({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const U=await _Ce(R.id,R.manifest.repository_url||"","main");M({title:"更新成功",description:`${R.manifest.name} 已从 ${U.old_version} 更新到 ${U.new_version}`});const K=await Gp();O(K),g(te=>te.map($=>{if($.id===R.id){const B=Yp($.id,K),Y=Kp($.id,K);return{...$,installed:B,installed_version:Y}}return $}))}catch(U){M({title:"更新失败",description:U instanceof Error?U.message:"未知错误",variant:"destructive"})}};return i.jsx(Vt,{className:"h-full",children:i.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),i.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),i.jsxs(ue,{onClick:()=>e({to:"/plugin-mirrors"}),children:[i.jsx(sge,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),N&&!N.installed&&i.jsxs(st,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[i.jsx(qt,{children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Gc,{className:"h-5 w-5 text-orange-600"}),i.jsxs("div",{children:[i.jsx(Ft,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),i.jsx(er,{className:"text-orange-800 dark:text-orange-200",children:N.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),i.jsx(on,{children:i.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",i.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),i.jsx(st,{className:"p-4",children:i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[i.jsxs("div",{className:"flex-1 relative",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),i.jsx(Ne,{placeholder:"搜索插件...",value:r,onChange:R=>a(R.target.value),className:"pl-9"})]}),i.jsxs(Et,{value:o,onValueChange:l,children:[i.jsx(wt,{className:"w-full sm:w-[200px]",children:i.jsx(At,{placeholder:"选择分类"})}),i.jsxs(jt,{children:[i.jsx(Me,{value:"all",children:"全部分类"}),i.jsx(Me,{value:"Developer Tools",children:"开发工具"}),i.jsx(Me,{value:"AI Enhancement",children:"AI 增强"}),i.jsx(Me,{value:"Utility",children:"工具类"}),i.jsx(Me,{value:"Entertainment",children:"娱乐"}),i.jsx(Me,{value:"Integration",children:"集成"}),i.jsx(Me,{value:"Data Analysis",children:"数据分析"}),i.jsx(Me,{value:"Automation",children:"自动化"}),i.jsx(Me,{value:"Other",children:"其他"})]})]})]}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(rs,{id:"compatible-only",checked:f,onCheckedChange:R=>m(R===!0)}),i.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),i.jsx(ul,{value:u,onValueChange:d,className:"w-full",children:i.jsxs(Qo,{className:"grid w-full grid-cols-3",children:[i.jsxs(Ot,{value:"all",children:["全部插件 (",p.length,")"]}),i.jsxs(Ot,{value:"installed",children:["已安装 (",p.filter(R=>R.installed).length,")"]}),i.jsxs(Ot,{value:"updates",children:["可更新 (",p.filter(R=>R.installed&&D(R)).length,")"]})]})}),E&&E.stage==="loading"&&i.jsx(st,{className:"p-4",children:i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(KN,{className:"h-4 w-4 animate-spin"}),i.jsxs("span",{className:"text-sm font-medium",children:[E.operation==="fetch"&&"加载插件列表",E.operation==="install"&&`安装插件${E.plugin_id?`: ${E.plugin_id}`:""}`,E.operation==="uninstall"&&`卸载插件${E.plugin_id?`: ${E.plugin_id}`:""}`,E.operation==="update"&&`更新插件${E.plugin_id?`: ${E.plugin_id}`:""}`]})]}),i.jsxs("span",{className:"text-sm font-medium",children:[E.progress,"%"]})]}),i.jsx(fE,{value:E.progress,className:"h-2"}),i.jsx("div",{className:"text-xs text-muted-foreground",children:E.message}),E.operation==="fetch"&&E.total_plugins>0&&i.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",E.loaded_plugins," / ",E.total_plugins," 个插件"]})]})}),E&&E.stage==="error"&&E.error&&i.jsx(st,{className:"border-destructive bg-destructive/10",children:i.jsx(qt,{children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Gc,{className:"h-5 w-5 text-destructive"}),i.jsxs("div",{children:[i.jsx(Ft,{className:"text-lg text-destructive",children:"加载失败"}),i.jsx(er,{className:"text-destructive/80",children:E.error})]})]})})}),x?i.jsxs("div",{className:"flex items-center justify-center py-12",children:[i.jsx(KN,{className:"h-8 w-8 animate-spin text-muted-foreground"}),i.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):b?i.jsx(st,{className:"p-6",children:i.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[i.jsx(Gc,{className:"h-12 w-12 text-destructive mb-4"}),i.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),i.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:b}),i.jsx(ue,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):H.length===0?i.jsx(st,{className:"p-6",children:i.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[i.jsx(Dr,{className:"h-12 w-12 text-muted-foreground mb-4"}),i.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:r||o!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:H.map(R=>i.jsxs(st,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[i.jsxs(qt,{children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsx(Ft,{className:"text-xl",children:R.manifest?.name||R.id}),i.jsxs("div",{className:"flex flex-col gap-1",children:[R.manifest?.categories&&R.manifest.categories[0]&&i.jsx(Dt,{variant:"secondary",className:"text-xs whitespace-nowrap",children:R.manifest.categories[0]}),I(R)]})]}),i.jsx(er,{className:"line-clamp-2",children:R.manifest?.description||"无描述"})]}),i.jsx(on,{className:"flex-1",children:i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(WN,{className:"h-4 w-4"}),i.jsx("span",{children:R.downloads.toLocaleString()})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(VI,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),i.jsx("span",{children:R.rating.toFixed(1)})]})]}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[R.manifest?.keywords&&R.manifest.keywords.slice(0,3).map(U=>i.jsx(Dt,{variant:"outline",className:"text-xs",children:U},U)),R.manifest?.keywords&&R.manifest.keywords.length>3&&i.jsxs(Dt,{variant:"outline",className:"text-xs",children:["+",R.manifest.keywords.length-3]})]}),i.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[i.jsxs("div",{children:["v",R.manifest?.version||"unknown"," · ",R.manifest?.author?.name||"Unknown"]}),R.manifest?.host_application&&i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{children:"支持:"}),i.jsxs("span",{className:"font-medium",children:[R.manifest.host_application.min_version,R.manifest.host_application.max_version?` - ${R.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),i.jsx(W5,{className:"pt-4",children:i.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[i.jsx(ue,{variant:"outline",size:"sm",onClick:()=>n(R),children:"查看详情"}),R.installed?D(R)?i.jsxs(ue,{size:"sm",disabled:!N?.installed,title:N?.installed?void 0:"Git 未安装",onClick:()=>L(R),children:[i.jsx(sl,{className:"h-4 w-4 mr-1"}),"更新"]}):i.jsxs(ue,{variant:"destructive",size:"sm",disabled:!N?.installed,title:N?.installed?void 0:"Git 未安装",onClick:()=>G(R),children:[i.jsx(Tt,{className:"h-4 w-4 mr-1"}),"卸载"]}):i.jsxs(ue,{size:"sm",disabled:!N?.installed||E?.operation==="install"||C!==null&&!z(R),title:N?.installed?C!==null&&!z(R)?`不兼容当前版本 (需要 ${R.manifest?.host_application?.min_version||"未知"}${R.manifest?.host_application?.max_version?` - ${R.manifest.host_application.max_version}`:"+"},当前 ${C?.version})`:void 0:"Git 未安装",onClick:()=>F(R),children:[i.jsx(WN,{className:"h-4 w-4 mr-1"}),E?.operation==="install"&&E?.plugin_id===R.id?"安装中...":"安装"]})]})})]},R.id))}),i.jsx(nr,{open:t!==null,onOpenChange:V,children:t&&t.manifest&&i.jsxs(Hn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-start justify-between gap-4",children:[i.jsxs("div",{className:"space-y-2 flex-1",children:[i.jsx(Vn,{className:"text-2xl",children:t.manifest.name}),i.jsxs(dr,{children:["作者: ",t.manifest.author?.name||"Unknown",t.manifest.author?.url&&i.jsx("a",{href:t.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:i.jsx(av,{className:"h-3 w-3 inline"})})]})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[t.manifest.categories&&t.manifest.categories[0]&&i.jsx(Dt,{variant:"secondary",children:t.manifest.categories[0]}),I(t)]})]})}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium",children:"版本"}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",t.manifest?.version||"unknown"]}),t.installed&&t.installed_version&&i.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",t.installed_version]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium",children:"下载量"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:t.downloads.toLocaleString()})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium",children:"评分"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(VI,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),i.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.rating.toFixed(1)," (",t.review_count,")"]})]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium",children:"许可证"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:t.manifest.license||"Unknown"})]}),i.jsxs("div",{className:"col-span-2",children:[i.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.manifest.host_application?.min_version||"未知",t.manifest.host_application?.max_version?` - ${t.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),i.jsx("div",{className:"flex flex-wrap gap-2",children:t.manifest.keywords&&t.manifest.keywords.map(R=>i.jsx(Dt,{variant:"outline",children:R},R))})]}),t.detailed_description&&i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),i.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:t.detailed_description})]}),!t.detailed_description&&i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:t.manifest.description||"无描述"})]}),i.jsxs("div",{className:"space-y-2",children:[t.manifest.homepage_url&&i.jsxs("div",{className:"text-sm",children:[i.jsx("span",{className:"font-medium",children:"主页: "}),i.jsx("a",{href:t.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:t.manifest.homepage_url})]}),t.manifest.repository_url&&i.jsxs("div",{className:"text-sm",children:[i.jsx("span",{className:"font-medium",children:"仓库: "}),i.jsx("a",{href:t.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:t.manifest.repository_url})]})]})]}),i.jsxs($r,{children:[t.manifest.homepage_url&&i.jsxs(ue,{onClick:()=>window.open(t.manifest.homepage_url,"_blank"),children:[i.jsx(av,{className:"h-4 w-4 mr-2"}),"访问主页"]}),t.manifest.repository_url&&i.jsxs(ue,{variant:"outline",onClick:()=>window.open(t.manifest.repository_url,"_blank"),children:[i.jsx(av,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function CCe(){const e=oa(),{toast:t}=mr(),[n,r]=y.useState([]),[a,o]=y.useState(!0),[l,u]=y.useState(null),[d,f]=y.useState(null),[m,p]=y.useState(!1),[g,x]=y.useState(!1),[j,b]=y.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),w=y.useCallback(async()=>{try{o(!0),u(null);const O=localStorage.getItem("access-token"),M=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${O}`}});if(!M.ok)throw new Error("获取镜像源列表失败");const I=await M.json();r(I.mirrors||[])}catch(O){const M=O instanceof Error?O.message:"加载镜像源失败";u(M),t({title:"加载失败",description:M,variant:"destructive"})}finally{o(!1)}},[t]);y.useEffect(()=>{w()},[w]);const N=async()=>{try{const O=localStorage.getItem("access-token"),M=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${O}`,"Content-Type":"application/json"},body:JSON.stringify(j)});if(!M.ok){const I=await M.json();throw new Error(I.detail||"添加镜像源失败")}t({title:"添加成功",description:"镜像源已添加"}),p(!1),b({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),w()}catch(O){t({title:"添加失败",description:O instanceof Error?O.message:"未知错误",variant:"destructive"})}},A=async()=>{if(d)try{const O=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${d.id}`,{method:"PUT",headers:{Authorization:`Bearer ${O}`,"Content-Type":"application/json"},body:JSON.stringify({name:j.name,raw_prefix:j.raw_prefix,clone_prefix:j.clone_prefix,enabled:j.enabled,priority:j.priority})})).ok)throw new Error("更新镜像源失败");t({title:"更新成功",description:"镜像源已更新"}),x(!1),f(null),w()}catch(O){t({title:"更新失败",description:O instanceof Error?O.message:"未知错误",variant:"destructive"})}},E=async O=>{if(confirm("确定要删除这个镜像源吗?"))try{const M=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${O}`,{method:"DELETE",headers:{Authorization:`Bearer ${M}`}})).ok)throw new Error("删除镜像源失败");t({title:"删除成功",description:"镜像源已删除"}),w()}catch(M){t({title:"删除失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},T=async O=>{try{const M=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${O.id}`,{method:"PUT",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!O.enabled})})).ok)throw new Error("更新状态失败");w()}catch(M){t({title:"更新失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},C=O=>{f(O),b({id:O.id,name:O.name,raw_prefix:O.raw_prefix,clone_prefix:O.clone_prefix,enabled:O.enabled,priority:O.priority}),x(!0)},k=async(O,M)=>{const I=M==="up"?O.priority-1:O.priority+1;if(!(I<1))try{const z=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${O.id}`,{method:"PUT",headers:{Authorization:`Bearer ${z}`,"Content-Type":"application/json"},body:JSON.stringify({priority:I})})).ok)throw new Error("更新优先级失败");w()}catch(z){t({title:"更新失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"})}};return i.jsx(Vt,{className:"h-full",children:i.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(ue,{variant:"ghost",size:"icon",onClick:()=>e({to:"/plugins"}),children:i.jsx(Xq,{className:"h-5 w-5"})}),i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),i.jsxs(ue,{onClick:()=>p(!0),children:[i.jsx(tr,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),a?i.jsx(st,{className:"p-6",children:i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx(KN,{className:"h-8 w-8 animate-spin text-primary"})})}):l?i.jsx(st,{className:"p-6",children:i.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[i.jsx(Gc,{className:"h-12 w-12 text-destructive mb-4"}),i.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),i.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:l}),i.jsx(ue,{onClick:w,children:"重新加载"})]})}):i.jsxs(st,{children:[i.jsx("div",{className:"hidden md:block",children:i.jsxs(Al,{children:[i.jsx(Tl,{children:i.jsxs(vn,{children:[i.jsx(Ze,{children:"状态"}),i.jsx(Ze,{children:"名称"}),i.jsx(Ze,{children:"ID"}),i.jsx(Ze,{children:"优先级"}),i.jsx(Ze,{className:"text-right",children:"操作"})]})}),i.jsx(kl,{children:n.map(O=>i.jsxs(vn,{children:[i.jsx(Ue,{children:i.jsx(at,{checked:O.enabled,onCheckedChange:()=>T(O)})}),i.jsx(Ue,{children:i.jsxs("div",{children:[i.jsx("div",{className:"font-medium",children:O.name}),i.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",O.raw_prefix]})]})}),i.jsx(Ue,{children:i.jsx(Dt,{variant:"outline",children:O.id})}),i.jsx(Ue,{children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"font-mono",children:O.priority}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx(ue,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>k(O,"up"),disabled:O.priority===1,children:i.jsx(FN,{className:"h-3 w-3"})}),i.jsx(ue,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>k(O,"down"),children:i.jsx(uh,{className:"h-3 w-3"})})]})]})}),i.jsx(Ue,{className:"text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[i.jsx(ue,{variant:"ghost",size:"icon",onClick:()=>C(O),children:i.jsx(Au,{className:"h-4 w-4"})}),i.jsx(ue,{variant:"ghost",size:"icon",onClick:()=>E(O.id),children:i.jsx(Tt,{className:"h-4 w-4 text-destructive"})})]})})]},O.id))})]})}),i.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(O=>i.jsx(st,{className:"p-4",children:i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h3",{className:"font-semibold",children:O.name}),O.enabled&&i.jsx(Dt,{variant:"default",className:"text-xs",children:"启用"})]}),i.jsx(Dt,{variant:"outline",className:"mt-1 text-xs",children:O.id})]}),i.jsx(at,{checked:O.enabled,onCheckedChange:()=>T(O)})]}),i.jsxs("div",{className:"text-sm space-y-1",children:[i.jsxs("div",{className:"text-muted-foreground",children:[i.jsx("span",{className:"font-medium",children:"Raw: "}),i.jsx("span",{className:"break-all",children:O.raw_prefix})]}),i.jsxs("div",{className:"text-muted-foreground",children:[i.jsx("span",{className:"font-medium",children:"优先级: "}),i.jsx("span",{className:"font-mono",children:O.priority})]})]}),i.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[i.jsxs(ue,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>C(O),children:[i.jsx(Au,{className:"h-4 w-4 mr-1"}),"编辑"]}),i.jsx(ue,{variant:"outline",size:"sm",onClick:()=>k(O,"up"),disabled:O.priority===1,children:i.jsx(FN,{className:"h-4 w-4"})}),i.jsx(ue,{variant:"outline",size:"sm",onClick:()=>k(O,"down"),children:i.jsx(uh,{className:"h-4 w-4"})}),i.jsx(ue,{variant:"destructive",size:"sm",onClick:()=>E(O.id),children:i.jsx(Tt,{className:"h-4 w-4"})})]})]})},O.id))})]}),i.jsx(nr,{open:m,onOpenChange:p,children:i.jsxs(Hn,{className:"max-w-lg",children:[i.jsxs(Wn,{children:[i.jsx(Vn,{children:"添加镜像源"}),i.jsx(dr,{children:"添加新的 Git 镜像源配置"})]}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"add-id",children:"镜像源 ID *"}),i.jsx(Ne,{id:"add-id",placeholder:"例如: my-mirror",value:j.id,onChange:O=>b({...j,id:O.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"add-name",children:"名称 *"}),i.jsx(Ne,{id:"add-name",placeholder:"例如: 我的镜像源",value:j.name,onChange:O=>b({...j,name:O.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),i.jsx(Ne,{id:"add-raw",placeholder:"https://example.com/raw",value:j.raw_prefix,onChange:O=>b({...j,raw_prefix:O.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"add-clone",children:"克隆前缀 *"}),i.jsx(Ne,{id:"add-clone",placeholder:"https://example.com/clone",value:j.clone_prefix,onChange:O=>b({...j,clone_prefix:O.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"add-priority",children:"优先级"}),i.jsx(Ne,{id:"add-priority",type:"number",min:"1",value:j.priority,onChange:O=>b({...j,priority:parseInt(O.target.value)||1})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(at,{id:"add-enabled",checked:j.enabled,onCheckedChange:O=>b({...j,enabled:O})}),i.jsx(J,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),i.jsxs($r,{children:[i.jsx(ue,{variant:"outline",onClick:()=>p(!1),children:"取消"}),i.jsx(ue,{onClick:N,children:"添加"})]})]})}),i.jsx(nr,{open:g,onOpenChange:x,children:i.jsxs(Hn,{className:"max-w-lg",children:[i.jsxs(Wn,{children:[i.jsx(Vn,{children:"编辑镜像源"}),i.jsx(dr,{children:"修改镜像源配置"})]}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{children:"镜像源 ID"}),i.jsx(Ne,{value:j.id,disabled:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"edit-name",children:"名称 *"}),i.jsx(Ne,{id:"edit-name",value:j.name,onChange:O=>b({...j,name:O.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),i.jsx(Ne,{id:"edit-raw",value:j.raw_prefix,onChange:O=>b({...j,raw_prefix:O.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"edit-clone",children:"克隆前缀 *"}),i.jsx(Ne,{id:"edit-clone",value:j.clone_prefix,onChange:O=>b({...j,clone_prefix:O.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(J,{htmlFor:"edit-priority",children:"优先级"}),i.jsx(Ne,{id:"edit-priority",type:"number",min:"1",value:j.priority,onChange:O=>b({...j,priority:parseInt(O.target.value)||1})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(at,{id:"edit-enabled",checked:j.enabled,onCheckedChange:O=>b({...j,enabled:O})}),i.jsx(J,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),i.jsxs($r,{children:[i.jsx(ue,{variant:"outline",onClick:()=>x(!1),children:"取消"}),i.jsx(ue,{onClick:A,children:"保存"})]})]})})]})})}const OCe=qh("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),XH=y.forwardRef(({className:e,size:t,abbrTitle:n,children:r,...a},o)=>i.jsx("kbd",{className:de(OCe({size:t,className:e})),ref:o,...a,children:n?i.jsx("abbr",{title:n,children:r}):r}));XH.displayName="Kbd";const ECe=[{icon:Sg,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:XO,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:tF,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:Zq,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:QO,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Lh,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:Qq,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:rve,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:Jq,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:wg,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:Vc,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function ACe({open:e,onOpenChange:t}){const[n,r]=y.useState(""),[a,o]=y.useState(0),l=oa(),u=ECe.filter(m=>m.title.toLowerCase().includes(n.toLowerCase())||m.description.toLowerCase().includes(n.toLowerCase())||m.category.toLowerCase().includes(n.toLowerCase()));y.useEffect(()=>{e&&(r(""),o(0))},[e]);const d=y.useCallback(m=>{l({to:m}),t(!1)},[l,t]),f=y.useCallback(m=>{m.key==="ArrowDown"?(m.preventDefault(),o(p=>(p+1)%u.length)):m.key==="ArrowUp"?(m.preventDefault(),o(p=>(p-1+u.length)%u.length)):m.key==="Enter"&&u[a]&&(m.preventDefault(),d(u[a].path))},[u,a,d]);return i.jsx(nr,{open:e,onOpenChange:t,children:i.jsxs(Hn,{className:"max-w-2xl p-0 gap-0",children:[i.jsxs(Wn,{className:"px-4 pt-4 pb-0",children:[i.jsx(Vn,{className:"sr-only",children:"搜索"}),i.jsxs("div",{className:"relative",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),i.jsx(Ne,{value:n,onChange:m=>{r(m.target.value),o(0)},onKeyDown:f,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),i.jsx("div",{className:"border-t",children:i.jsx(Vt,{className:"h-[400px]",children:u.length>0?i.jsx("div",{className:"p-2",children:u.map((m,p)=>{const g=m.icon;return i.jsxs("button",{onClick:()=>d(m.path),onMouseEnter:()=>o(p),className:de("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",p===a?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[i.jsx(g,{className:"h-5 w-5 flex-shrink-0"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"font-medium text-sm",children:m.title}),i.jsx("div",{className:"text-xs text-muted-foreground truncate",children:m.description})]}),i.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:m.category})]},m.path)})}):i.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[i.jsx(Dr,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),i.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),i.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function TCe(e){const t=kCe(e),n=y.forwardRef((r,a)=>{const{children:o,...l}=r,u=y.Children.toArray(o),d=u.find(PCe);if(d){const f=d.props.children,m=u.map(p=>p===d?y.Children.count(f)>1?y.Children.only(null):y.isValidElement(f)?f.props.children:null:p);return i.jsx(t,{...l,ref:a,children:y.isValidElement(f)?y.cloneElement(f,void 0,m):null})}return i.jsx(t,{...l,ref:a,children:o})});return n.displayName=`${e}.Slot`,n}function kCe(e){const t=y.forwardRef((n,r)=>{const{children:a,...o}=n;if(y.isValidElement(a)){const l=DCe(a),u=RCe(o,a.props);return a.type!==y.Fragment&&(u.ref=r?Rr(r,l):l),y.cloneElement(a,u)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var MCe=Symbol("radix.slottable");function PCe(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===MCe}function RCe(e,t){const n={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...u)=>{const d=o(...u);return a(...u),d}:a&&(n[r]=a):r==="style"?n[r]={...a,...o}:r==="className"&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function DCe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var vC=["Enter"," "],$Ce=["ArrowDown","PageUp","Home"],ZH=["ArrowUp","PageDown","End"],ICe=[...$Ce,...ZH],LCe={ltr:[...vC,"ArrowRight"],rtl:[...vC,"ArrowLeft"]},BCe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Jh="Menu",[yh,zCe,qCe]=Ch(Jh),[Pl,QH]=hr(Jh,[qCe,us,Ug]),em=us(),JH=Ug(),[e9,vs]=Pl(Jh),[FCe,tm]=Pl(Jh),t9=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:o,modal:l=!0}=e,u=em(t),[d,f]=y.useState(null),m=y.useRef(!1),p=nn(o),g=Lu(a);return y.useEffect(()=>{const x=()=>{m.current=!0,document.addEventListener("pointerdown",j,{capture:!0,once:!0}),document.addEventListener("pointermove",j,{capture:!0,once:!0})},j=()=>m.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",j,{capture:!0}),document.removeEventListener("pointermove",j,{capture:!0})}},[]),i.jsx(Wh,{...u,children:i.jsx(e9,{scope:t,open:n,onOpenChange:p,content:d,onContentChange:f,children:i.jsx(FCe,{scope:t,onClose:y.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:m,dir:g,modal:l,children:r})})})};t9.displayName=Jh;var UCe="MenuAnchor",kE=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=em(n);return i.jsx(Vh,{...a,...r,ref:t})});kE.displayName=UCe;var ME="MenuPortal",[HCe,n9]=Pl(ME,{forceMount:void 0}),r9=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:a}=e,o=vs(ME,t);return i.jsx(HCe,{scope:t,forceMount:n,children:i.jsx(Rn,{present:n||o.open,children:i.jsx(El,{asChild:!0,container:a,children:r})})})};r9.displayName=ME;var _a="MenuContent",[WCe,PE]=Pl(_a),a9=y.forwardRef((e,t)=>{const n=n9(_a,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,o=vs(_a,e.__scopeMenu),l=tm(_a,e.__scopeMenu);return i.jsx(yh.Provider,{scope:e.__scopeMenu,children:i.jsx(Rn,{present:r||o.open,children:i.jsx(yh.Slot,{scope:e.__scopeMenu,children:l.modal?i.jsx(VCe,{...a,ref:t}):i.jsx(GCe,{...a,ref:t})})})})}),VCe=y.forwardRef((e,t)=>{const n=vs(_a,e.__scopeMenu),r=y.useRef(null),a=qe(t,r);return y.useEffect(()=>{const o=r.current;if(o)return Dy(o)},[]),i.jsx(RE,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Se(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),GCe=y.forwardRef((e,t)=>{const n=vs(_a,e.__scopeMenu);return i.jsx(RE,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),YCe=TCe("MenuContent.ScrollLock"),RE=y.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEntryFocus:d,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:g,onDismiss:x,disableOutsideScroll:j,...b}=e,w=vs(_a,n),N=tm(_a,n),A=em(n),E=JH(n),T=zCe(n),[C,k]=y.useState(null),O=y.useRef(null),M=qe(t,O,w.onContentChange),I=y.useRef(0),z=y.useRef(""),D=y.useRef(0),H=y.useRef(null),V=y.useRef("right"),F=y.useRef(0),G=j?Uh:y.Fragment,L=j?{as:YCe,allowPinchZoom:!0}:void 0,R=K=>{const te=z.current+K,$=T().filter(ee=>!ee.disabled),B=document.activeElement,Y=$.find(ee=>ee.ref.current===B)?.textValue,ne=$.map(ee=>ee.textValue),oe=oOe(ne,te,Y),xe=$.find(ee=>ee.textValue===oe)?.ref.current;(function ee(ae){z.current=ae,window.clearTimeout(I.current),ae!==""&&(I.current=window.setTimeout(()=>ee(""),1e3))})(te),xe&&setTimeout(()=>xe.focus())};y.useEffect(()=>()=>window.clearTimeout(I.current),[]),Py();const U=y.useCallback(K=>V.current===H.current?.side&&lOe(K,H.current?.area),[]);return i.jsx(WCe,{scope:n,searchRef:z,onItemEnter:y.useCallback(K=>{U(K)&&K.preventDefault()},[U]),onItemLeave:y.useCallback(K=>{U(K)||(O.current?.focus(),k(null))},[U]),onTriggerLeave:y.useCallback(K=>{U(K)&&K.preventDefault()},[U]),pointerGraceTimerRef:D,onPointerGraceIntentChange:y.useCallback(K=>{H.current=K},[]),children:i.jsx(G,{...L,children:i.jsx(Fh,{asChild:!0,trapped:a,onMountAutoFocus:Se(o,K=>{K.preventDefault(),O.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:i.jsx(Ol,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:g,onDismiss:x,children:i.jsx(Z5,{asChild:!0,...E,dir:N.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:k,onEntryFocus:Se(d,K=>{N.isUsingKeyboardRef.current||K.preventDefault()}),preventScrollOnEntryFocus:!0,children:i.jsx(Hy,{role:"menu","aria-orientation":"vertical","data-state":w9(w.open),"data-radix-menu-content":"",dir:N.dir,...A,...b,ref:M,style:{outline:"none",...b.style},onKeyDown:Se(b.onKeyDown,K=>{const $=K.target.closest("[data-radix-menu-content]")===K.currentTarget,B=K.ctrlKey||K.altKey||K.metaKey,Y=K.key.length===1;$&&(K.key==="Tab"&&K.preventDefault(),!B&&Y&&R(K.key));const ne=O.current;if(K.target!==ne||!ICe.includes(K.key))return;K.preventDefault();const xe=T().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);ZH.includes(K.key)&&xe.reverse(),aOe(xe)}),onBlur:Se(e.onBlur,K=>{K.currentTarget.contains(K.target)||(window.clearTimeout(I.current),z.current="")}),onPointerMove:Se(e.onPointerMove,xh(K=>{const te=K.target,$=F.current!==K.clientX;if(K.currentTarget.contains(te)&&$){const B=K.clientX>F.current?"right":"left";V.current=B,F.current=K.clientX}}))})})})})})})});a9.displayName=_a;var KCe="MenuGroup",DE=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(Pe.div,{role:"group",...r,ref:t})});DE.displayName=KCe;var XCe="MenuLabel",i9=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(Pe.div,{...r,ref:t})});i9.displayName=XCe;var Pg="MenuItem",FL="menu.itemSelect",ex=y.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...a}=e,o=y.useRef(null),l=tm(Pg,e.__scopeMenu),u=PE(Pg,e.__scopeMenu),d=qe(t,o),f=y.useRef(!1),m=()=>{const p=o.current;if(!n&&p){const g=new CustomEvent(FL,{bubbles:!0,cancelable:!0});p.addEventListener(FL,x=>r?.(x),{once:!0}),LC(p,g),g.defaultPrevented?f.current=!1:l.onClose()}};return i.jsx(o9,{...a,ref:d,disabled:n,onClick:Se(e.onClick,m),onPointerDown:p=>{e.onPointerDown?.(p),f.current=!0},onPointerUp:Se(e.onPointerUp,p=>{f.current||p.currentTarget?.click()}),onKeyDown:Se(e.onKeyDown,p=>{const g=u.searchRef.current!=="";n||g&&p.key===" "||vC.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});ex.displayName=Pg;var o9=y.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...o}=e,l=PE(Pg,n),u=JH(n),d=y.useRef(null),f=qe(t,d),[m,p]=y.useState(!1),[g,x]=y.useState("");return y.useEffect(()=>{const j=d.current;j&&x((j.textContent??"").trim())},[o.children]),i.jsx(yh.ItemSlot,{scope:n,disabled:r,textValue:a??g,children:i.jsx(Q5,{asChild:!0,...u,focusable:!r,children:i.jsx(Pe.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:f,onPointerMove:Se(e.onPointerMove,xh(j=>{r?l.onItemLeave(j):(l.onItemEnter(j),j.defaultPrevented||j.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Se(e.onPointerLeave,xh(j=>l.onItemLeave(j))),onFocus:Se(e.onFocus,()=>p(!0)),onBlur:Se(e.onBlur,()=>p(!1))})})})}),ZCe="MenuCheckboxItem",s9=y.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...a}=e;return i.jsx(f9,{scope:e.__scopeMenu,checked:n,children:i.jsx(ex,{role:"menuitemcheckbox","aria-checked":Rg(n)?"mixed":n,...a,ref:t,"data-state":LE(n),onSelect:Se(a.onSelect,()=>r?.(Rg(n)?!0:!n),{checkForDefaultPrevented:!1})})})});s9.displayName=ZCe;var l9="MenuRadioGroup",[QCe,JCe]=Pl(l9,{value:void 0,onValueChange:()=>{}}),c9=y.forwardRef((e,t)=>{const{value:n,onValueChange:r,...a}=e,o=nn(r);return i.jsx(QCe,{scope:e.__scopeMenu,value:n,onValueChange:o,children:i.jsx(DE,{...a,ref:t})})});c9.displayName=l9;var u9="MenuRadioItem",d9=y.forwardRef((e,t)=>{const{value:n,...r}=e,a=JCe(u9,e.__scopeMenu),o=n===a.value;return i.jsx(f9,{scope:e.__scopeMenu,checked:o,children:i.jsx(ex,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":LE(o),onSelect:Se(r.onSelect,()=>a.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});d9.displayName=u9;var $E="MenuItemIndicator",[f9,eOe]=Pl($E,{checked:!1}),h9=y.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...a}=e,o=eOe($E,n);return i.jsx(Rn,{present:r||Rg(o.checked)||o.checked===!0,children:i.jsx(Pe.span,{...a,ref:t,"data-state":LE(o.checked)})})});h9.displayName=$E;var tOe="MenuSeparator",m9=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(Pe.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});m9.displayName=tOe;var nOe="MenuArrow",p9=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=em(n);return i.jsx(Wy,{...a,...r,ref:t})});p9.displayName=nOe;var IE="MenuSub",[rOe,v9]=Pl(IE),g9=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:a}=e,o=vs(IE,t),l=em(t),[u,d]=y.useState(null),[f,m]=y.useState(null),p=nn(a);return y.useEffect(()=>(o.open===!1&&p(!1),()=>p(!1)),[o.open,p]),i.jsx(Wh,{...l,children:i.jsx(e9,{scope:t,open:r,onOpenChange:p,content:f,onContentChange:m,children:i.jsx(rOe,{scope:t,contentId:Fn(),triggerId:Fn(),trigger:u,onTriggerChange:d,children:n})})})};g9.displayName=IE;var pf="MenuSubTrigger",y9=y.forwardRef((e,t)=>{const n=vs(pf,e.__scopeMenu),r=tm(pf,e.__scopeMenu),a=v9(pf,e.__scopeMenu),o=PE(pf,e.__scopeMenu),l=y.useRef(null),{pointerGraceTimerRef:u,onPointerGraceIntentChange:d}=o,f={__scopeMenu:e.__scopeMenu},m=y.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return y.useEffect(()=>m,[m]),y.useEffect(()=>{const p=u.current;return()=>{window.clearTimeout(p),d(null)}},[u,d]),i.jsx(kE,{asChild:!0,...f,children:i.jsx(o9,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":w9(n.open),...e,ref:Rr(t,a.onTriggerChange),onClick:p=>{e.onClick?.(p),!(e.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Se(e.onPointerMove,xh(p=>{o.onItemEnter(p),!p.defaultPrevented&&!e.disabled&&!n.open&&!l.current&&(o.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:Se(e.onPointerLeave,xh(p=>{m();const g=n.content?.getBoundingClientRect();if(g){const x=n.content?.dataset.side,j=x==="right",b=j?-5:5,w=g[j?"left":"right"],N=g[j?"right":"left"];o.onPointerGraceIntentChange({area:[{x:p.clientX+b,y:p.clientY},{x:w,y:g.top},{x:N,y:g.top},{x:N,y:g.bottom},{x:w,y:g.bottom}],side:x}),window.clearTimeout(u.current),u.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(p),p.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Se(e.onKeyDown,p=>{const g=o.searchRef.current!=="";e.disabled||g&&p.key===" "||LCe[r.dir].includes(p.key)&&(n.onOpenChange(!0),n.content?.focus(),p.preventDefault())})})})});y9.displayName=pf;var x9="MenuSubContent",b9=y.forwardRef((e,t)=>{const n=n9(_a,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,o=vs(_a,e.__scopeMenu),l=tm(_a,e.__scopeMenu),u=v9(x9,e.__scopeMenu),d=y.useRef(null),f=qe(t,d);return i.jsx(yh.Provider,{scope:e.__scopeMenu,children:i.jsx(Rn,{present:r||o.open,children:i.jsx(yh.Slot,{scope:e.__scopeMenu,children:i.jsx(RE,{id:u.contentId,"aria-labelledby":u.triggerId,...a,ref:f,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{l.isUsingKeyboardRef.current&&d.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:Se(e.onFocusOutside,m=>{m.target!==u.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Se(e.onEscapeKeyDown,m=>{l.onClose(),m.preventDefault()}),onKeyDown:Se(e.onKeyDown,m=>{const p=m.currentTarget.contains(m.target),g=BCe[l.dir].includes(m.key);p&&g&&(o.onOpenChange(!1),u.trigger?.focus(),m.preventDefault())})})})})})});b9.displayName=x9;function w9(e){return e?"open":"closed"}function Rg(e){return e==="indeterminate"}function LE(e){return Rg(e)?"indeterminate":e?"checked":"unchecked"}function aOe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function iOe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function oOe(e,t,n){const a=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let l=iOe(e,Math.max(o,0));a.length===1&&(l=l.filter(f=>f!==n));const d=l.find(f=>f.toLowerCase().startsWith(a.toLowerCase()));return d!==n?d:void 0}function sOe(e,t){const{x:n,y:r}=e;let a=!1;for(let o=0,l=t.length-1;or!=g>r&&n<(p-f)*(r-m)/(g-m)+f&&(a=!a)}return a}function lOe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return sOe(n,t)}function xh(e){return t=>t.pointerType==="mouse"?e(t):void 0}var cOe=t9,uOe=kE,dOe=r9,fOe=a9,hOe=DE,mOe=i9,pOe=ex,vOe=s9,gOe=c9,yOe=d9,xOe=h9,bOe=m9,wOe=p9,jOe=g9,SOe=y9,_Oe=b9,BE="ContextMenu",[NOe]=hr(BE,[QH]),pr=QH(),[COe,j9]=NOe(BE),S9=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:a,modal:o=!0}=e,[l,u]=y.useState(!1),d=pr(t),f=nn(r),m=y.useCallback(p=>{u(p),f(p)},[f]);return i.jsx(COe,{scope:t,open:l,onOpenChange:m,modal:o,children:i.jsx(cOe,{...d,dir:a,open:l,onOpenChange:m,modal:o,children:n})})};S9.displayName=BE;var _9="ContextMenuTrigger",N9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...a}=e,o=j9(_9,n),l=pr(n),u=y.useRef({x:0,y:0}),d=y.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...u.current})}),f=y.useRef(0),m=y.useCallback(()=>window.clearTimeout(f.current),[]),p=g=>{u.current={x:g.clientX,y:g.clientY},o.onOpenChange(!0)};return y.useEffect(()=>m,[m]),y.useEffect(()=>void(r&&m()),[r,m]),i.jsxs(i.Fragment,{children:[i.jsx(uOe,{...l,virtualRef:d}),i.jsx(Pe.span,{"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,...a,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:Se(e.onContextMenu,g=>{m(),p(g),g.preventDefault()}),onPointerDown:r?e.onPointerDown:Se(e.onPointerDown,Xp(g=>{m(),f.current=window.setTimeout(()=>p(g),700)})),onPointerMove:r?e.onPointerMove:Se(e.onPointerMove,Xp(m)),onPointerCancel:r?e.onPointerCancel:Se(e.onPointerCancel,Xp(m)),onPointerUp:r?e.onPointerUp:Se(e.onPointerUp,Xp(m))})]})});N9.displayName=_9;var OOe="ContextMenuPortal",C9=e=>{const{__scopeContextMenu:t,...n}=e,r=pr(t);return i.jsx(dOe,{...r,...n})};C9.displayName=OOe;var O9="ContextMenuContent",E9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=j9(O9,n),o=pr(n),l=y.useRef(!1);return i.jsx(fOe,{...o,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:u=>{e.onCloseAutoFocus?.(u),!u.defaultPrevented&&l.current&&u.preventDefault(),l.current=!1},onInteractOutside:u=>{e.onInteractOutside?.(u),!u.defaultPrevented&&!a.modal&&(l.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});E9.displayName=O9;var EOe="ContextMenuGroup",AOe=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=pr(n);return i.jsx(hOe,{...a,...r,ref:t})});AOe.displayName=EOe;var TOe="ContextMenuLabel",A9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=pr(n);return i.jsx(mOe,{...a,...r,ref:t})});A9.displayName=TOe;var kOe="ContextMenuItem",T9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=pr(n);return i.jsx(pOe,{...a,...r,ref:t})});T9.displayName=kOe;var MOe="ContextMenuCheckboxItem",k9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=pr(n);return i.jsx(vOe,{...a,...r,ref:t})});k9.displayName=MOe;var POe="ContextMenuRadioGroup",ROe=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=pr(n);return i.jsx(gOe,{...a,...r,ref:t})});ROe.displayName=POe;var DOe="ContextMenuRadioItem",M9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=pr(n);return i.jsx(yOe,{...a,...r,ref:t})});M9.displayName=DOe;var $Oe="ContextMenuItemIndicator",P9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=pr(n);return i.jsx(xOe,{...a,...r,ref:t})});P9.displayName=$Oe;var IOe="ContextMenuSeparator",R9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=pr(n);return i.jsx(bOe,{...a,...r,ref:t})});R9.displayName=IOe;var LOe="ContextMenuArrow",BOe=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=pr(n);return i.jsx(wOe,{...a,...r,ref:t})});BOe.displayName=LOe;var D9="ContextMenuSub",$9=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,open:a,defaultOpen:o}=e,l=pr(t),[u,d]=Na({prop:a,defaultProp:o??!1,onChange:r,caller:D9});return i.jsx(jOe,{...l,open:u,onOpenChange:d,children:n})};$9.displayName=D9;var zOe="ContextMenuSubTrigger",I9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=pr(n);return i.jsx(SOe,{...a,...r,ref:t})});I9.displayName=zOe;var qOe="ContextMenuSubContent",L9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=pr(n);return i.jsx(_Oe,{...a,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});L9.displayName=qOe;function Xp(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var FOe=S9,UOe=N9,HOe=C9,B9=E9,z9=A9,q9=T9,F9=k9,U9=M9,H9=P9,W9=R9,WOe=$9,V9=I9,G9=L9;const VOe=FOe,GOe=UOe,YOe=WOe,Y9=y.forwardRef(({className:e,inset:t,children:n,...r},a)=>i.jsxs(V9,{ref:a,className:de("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...r,children:[n,i.jsx(KO,{className:"ml-auto h-4 w-4"})]}));Y9.displayName=V9.displayName;const K9=y.forwardRef(({className:e,...t},n)=>i.jsx(G9,{ref:n,className:de("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",e),...t}));K9.displayName=G9.displayName;const X9=y.forwardRef(({className:e,...t},n)=>i.jsx(HOe,{children:i.jsx(B9,{ref:n,className:de("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",e),...t})}));X9.displayName=B9.displayName;const Da=y.forwardRef(({className:e,inset:t,...n},r)=>i.jsx(q9,{ref:r,className:de("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Da.displayName=q9.displayName;const KOe=y.forwardRef(({className:e,children:t,checked:n,...r},a)=>i.jsxs(F9,{ref:a,className:de("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(H9,{children:i.jsx(il,{className:"h-4 w-4"})})}),t]}));KOe.displayName=F9.displayName;const XOe=y.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(U9,{ref:r,className:de("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(H9,{children:i.jsx(yve,{className:"h-2 w-2 fill-current"})})}),t]}));XOe.displayName=U9.displayName;const ZOe=y.forwardRef(({className:e,inset:t,...n},r)=>i.jsx(z9,{ref:r,className:de("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...n}));ZOe.displayName=z9.displayName;const vf=y.forwardRef(({className:e,...t},n)=>i.jsx(W9,{ref:n,className:de("-mx-1 my-1 h-px bg-border",e),...t}));vf.displayName=W9.displayName;const Ic=({className:e,...t})=>i.jsx("span",{className:de("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});Ic.displayName="ContextMenuShortcut";var QOe=Symbol("radix.slottable");function JOe(e){const t=({children:n})=>i.jsx(i.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=QOe,t}var[tx]=hr("Tooltip",[us]),nx=us(),Z9="TooltipProvider",eEe=700,gC="tooltip.open",[tEe,zE]=tx(Z9),Q9=e=>{const{__scopeTooltip:t,delayDuration:n=eEe,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:o}=e,l=y.useRef(!0),u=y.useRef(!1),d=y.useRef(0);return y.useEffect(()=>{const f=d.current;return()=>window.clearTimeout(f)},[]),i.jsx(tEe,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:y.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:y.useCallback(f=>{u.current=f},[]),disableHoverableContent:a,children:o})};Q9.displayName=Z9;var bh="Tooltip",[nEe,nm]=tx(bh),J9=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:a,onOpenChange:o,disableHoverableContent:l,delayDuration:u}=e,d=zE(bh,e.__scopeTooltip),f=nx(t),[m,p]=y.useState(null),g=Fn(),x=y.useRef(0),j=l??d.disableHoverableContent,b=u??d.delayDuration,w=y.useRef(!1),[N,A]=Na({prop:r,defaultProp:a??!1,onChange:O=>{O?(d.onOpen(),document.dispatchEvent(new CustomEvent(gC))):d.onClose(),o?.(O)},caller:bh}),E=y.useMemo(()=>N?w.current?"delayed-open":"instant-open":"closed",[N]),T=y.useCallback(()=>{window.clearTimeout(x.current),x.current=0,w.current=!1,A(!0)},[A]),C=y.useCallback(()=>{window.clearTimeout(x.current),x.current=0,A(!1)},[A]),k=y.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{w.current=!0,A(!0),x.current=0},b)},[b,A]);return y.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),i.jsx(Wh,{...f,children:i.jsx(nEe,{scope:t,contentId:g,open:N,stateAttribute:E,trigger:m,onTriggerChange:p,onTriggerEnter:y.useCallback(()=>{d.isOpenDelayedRef.current?k():T()},[d.isOpenDelayedRef,k,T]),onTriggerLeave:y.useCallback(()=>{j?C():(window.clearTimeout(x.current),x.current=0)},[C,j]),onOpen:T,onClose:C,disableHoverableContent:j,children:n})})};J9.displayName=bh;var yC="TooltipTrigger",eW=y.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=nm(yC,n),o=zE(yC,n),l=nx(n),u=y.useRef(null),d=qe(t,u,a.onTriggerChange),f=y.useRef(!1),m=y.useRef(!1),p=y.useCallback(()=>f.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),i.jsx(Vh,{asChild:!0,...l,children:i.jsx(Pe.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:d,onPointerMove:Se(e.onPointerMove,g=>{g.pointerType!=="touch"&&!m.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),m.current=!0)}),onPointerLeave:Se(e.onPointerLeave,()=>{a.onTriggerLeave(),m.current=!1}),onPointerDown:Se(e.onPointerDown,()=>{a.open&&a.onClose(),f.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Se(e.onFocus,()=>{f.current||a.onOpen()}),onBlur:Se(e.onBlur,a.onClose),onClick:Se(e.onClick,a.onClose)})})});eW.displayName=yC;var qE="TooltipPortal",[rEe,aEe]=tx(qE,{forceMount:void 0}),tW=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:a}=e,o=nm(qE,t);return i.jsx(rEe,{scope:t,forceMount:n,children:i.jsx(Rn,{present:n||o.open,children:i.jsx(El,{asChild:!0,container:a,children:r})})})};tW.displayName=qE;var Pu="TooltipContent",nW=y.forwardRef((e,t)=>{const n=aEe(Pu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...o}=e,l=nm(Pu,e.__scopeTooltip);return i.jsx(Rn,{present:r||l.open,children:l.disableHoverableContent?i.jsx(rW,{side:a,...o,ref:t}):i.jsx(iEe,{side:a,...o,ref:t})})}),iEe=y.forwardRef((e,t)=>{const n=nm(Pu,e.__scopeTooltip),r=zE(Pu,e.__scopeTooltip),a=y.useRef(null),o=qe(t,a),[l,u]=y.useState(null),{trigger:d,onClose:f}=n,m=a.current,{onPointerInTransitChange:p}=r,g=y.useCallback(()=>{u(null),p(!1)},[p]),x=y.useCallback((j,b)=>{const w=j.currentTarget,N={x:j.clientX,y:j.clientY},A=uEe(N,w.getBoundingClientRect()),E=dEe(N,A),T=fEe(b.getBoundingClientRect()),C=mEe([...E,...T]);u(C),p(!0)},[p]);return y.useEffect(()=>()=>g(),[g]),y.useEffect(()=>{if(d&&m){const j=w=>x(w,m),b=w=>x(w,d);return d.addEventListener("pointerleave",j),m.addEventListener("pointerleave",b),()=>{d.removeEventListener("pointerleave",j),m.removeEventListener("pointerleave",b)}}},[d,m,x,g]),y.useEffect(()=>{if(l){const j=b=>{const w=b.target,N={x:b.clientX,y:b.clientY},A=d?.contains(w)||m?.contains(w),E=!hEe(N,l);A?g():E&&(g(),f())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[d,m,l,f,g]),i.jsx(rW,{...e,ref:o})}),[oEe,sEe]=tx(bh,{isInside:!1}),lEe=JOe("TooltipContent"),rW=y.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:l,...u}=e,d=nm(Pu,n),f=nx(n),{onClose:m}=d;return y.useEffect(()=>(document.addEventListener(gC,m),()=>document.removeEventListener(gC,m)),[m]),y.useEffect(()=>{if(d.trigger){const p=g=>{g.target?.contains(d.trigger)&&m()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[d.trigger,m]),i.jsx(Ol,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:p=>p.preventDefault(),onDismiss:m,children:i.jsxs(Hy,{"data-state":d.stateAttribute,...f,...u,ref:t,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[i.jsx(lEe,{children:r}),i.jsx(oEe,{scope:n,isInside:!0,children:i.jsx(fwe,{id:d.contentId,role:"tooltip",children:a||r})})]})})});nW.displayName=Pu;var aW="TooltipArrow",cEe=y.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=nx(n);return sEe(aW,n).isInside?null:i.jsx(Wy,{...a,...r,ref:t})});cEe.displayName=aW;function uEe(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,a,o)){case o:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function dEe(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function fEe(e){const{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}function hEe(e,t){const{x:n,y:r}=e;let a=!1;for(let o=0,l=t.length-1;or!=g>r&&n<(p-f)*(r-m)/(g-m)+f&&(a=!a)}return a}function mEe(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),pEe(t)}function pEe(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const o=t[t.length-1],l=t[t.length-2];if((o.x-l.x)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const a=e[r];for(;n.length>=2;){const o=n[n.length-1],l=n[n.length-2];if((o.x-l.x)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))n.pop();else break}n.push(a)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var vEe=Q9,gEe=J9,yEe=eW,xEe=tW,iW=nW;const bEe=vEe,wEe=gEe,jEe=yEe,oW=y.forwardRef(({className:e,sideOffset:t=4,...n},r)=>i.jsx(xEe,{children:i.jsx(iW,{ref:r,sideOffset:t,className:de("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...n})}));oW.displayName=iW.displayName;function SEe({children:e}){Vxe();const[t,n]=y.useState(!0),[r,a]=y.useState(!1),[o,l]=y.useState(!1),{theme:u,setTheme:d}=JO(),f=BY(),m=oa();y.useEffect(()=>{const b=w=>{(w.metaKey||w.ctrlKey)&&w.key==="k"&&(w.preventDefault(),l(!0))};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[]);const p=[{title:"概览",items:[{icon:Sg,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:XO,label:"麦麦主程序配置",path:"/config/bot"},{icon:tF,label:"麦麦模型提供商配置",path:"/config/modelProvider"},{icon:Zq,label:"麦麦模型配置",path:"/config/model"}]},{title:"麦麦资源管理",items:[{icon:QO,label:"表情包管理",path:"/resource/emoji"},{icon:Lh,label:"表达方式管理",path:"/resource/expression"},{icon:Qq,label:"人物信息管理",path:"/resource/person"}]},{title:"扩展与监控",items:[{icon:Jq,label:"插件市场",path:"/plugins"},{icon:wg,label:"日志查看器",path:"/logs"}]},{title:"系统",items:[{icon:Vc,label:"系统设置",path:"/settings"}]}],x=u==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":u,j=()=>{localStorage.removeItem("access-token"),m({to:"/auth"})};return i.jsx(bEe,{delayDuration:300,children:i.jsxs("div",{className:"flex h-screen overflow-hidden",children:[i.jsxs("aside",{className:de("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",t?"lg:w-64":"lg:w-16",r?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[i.jsx("div",{className:"flex h-16 items-center border-b px-4",children:i.jsxs("div",{className:de("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!t&&"lg:flex-none lg:w-8"),children:[i.jsxs("div",{className:de("flex items-baseline gap-2",!t&&"lg:hidden"),children:[i.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),i.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:aye()})]}),!t&&i.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),i.jsx("nav",{className:"flex-1 overflow-y-auto p-4",children:i.jsx("ul",{className:de("space-y-6",!t&&"lg:space-y-3"),children:p.map((b,w)=>i.jsxs("li",{children:[i.jsx("div",{className:de("px-3 h-[1.25rem]","mb-2",!t&&"lg:mb-1 lg:invisible"),children:i.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:b.title})}),!t&&w>0&&i.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),i.jsx("ul",{className:"space-y-1",children:b.items.map(N=>{const A=f({to:N.path}),E=N.icon,T=i.jsxs(i.Fragment,{children:[A&&i.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),i.jsxs("div",{className:de("flex items-center transition-all duration-300",t?"gap-3":"lg:gap-0"),children:[i.jsx(E,{className:de("h-5 w-5 flex-shrink-0",A&&"text-primary"),strokeWidth:2,fill:"none"}),i.jsx("span",{className:de("text-sm font-medium whitespace-nowrap transition-all duration-300",A&&"font-semibold",t?"opacity-100 max-w-[200px]":"lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:N.label})]})]});return i.jsx("li",{className:"relative",children:i.jsxs(wEe,{children:[i.jsx(jEe,{asChild:!0,children:i.jsx(kC,{to:N.path,className:de("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",A?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",t?"px-3":"lg:px-0 lg:justify-center"),onClick:()=>a(!1),children:T})}),!t&&i.jsx(oW,{side:"right",className:"hidden lg:block",children:i.jsx("p",{children:N.label})})]})},N.path)})})]},b.title))})})]}),r&&i.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>a(!1)}),i.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("button",{onClick:()=>a(!r),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:i.jsx(qve,{className:"h-5 w-5"})}),i.jsx("button",{onClick:()=>n(!t),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:t?"收起侧边栏":"展开侧边栏",children:i.jsx(YO,{className:de("h-5 w-5 transition-transform",!t&&"rotate-180")})})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{onClick:()=>l(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),i.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),i.jsxs(XH,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[i.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),i.jsx(ACe,{open:o,onOpenChange:l}),i.jsxs(ue,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[i.jsx(Zpe,{className:"h-4 w-4"}),i.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),i.jsx("button",{onClick:b=>{zge(x==="dark"?"light":"dark",d,b)},className:"rounded-lg p-2 hover:bg-accent",title:x==="dark"?"切换到浅色模式":"切换到深色模式",children:x==="dark"?i.jsx(ZN,{className:"h-5 w-5"}):i.jsx(XN,{className:"h-5 w-5"})}),i.jsx("div",{className:"h-6 w-px bg-border"}),i.jsxs(ue,{variant:"ghost",size:"sm",onClick:j,className:"gap-2",title:"登出系统",children:[i.jsx(WI,{className:"h-4 w-4"}),i.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),i.jsxs(VOe,{children:[i.jsx(GOe,{asChild:!0,children:i.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:e})}),i.jsxs(X9,{className:"w-64",children:[i.jsxs(Da,{onClick:()=>m({to:"/"}),children:[i.jsx(Sg,{className:"mr-2 h-4 w-4"}),"首页"]}),i.jsxs(Da,{onClick:()=>m({to:"/settings"}),children:[i.jsx(Vc,{className:"mr-2 h-4 w-4"}),"系统设置"]}),i.jsxs(Da,{onClick:()=>m({to:"/logs"}),children:[i.jsx(wg,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),i.jsx(vf,{}),i.jsxs(YOe,{children:[i.jsxs(Y9,{children:[i.jsx(eF,{className:"mr-2 h-4 w-4"}),"切换主题"]}),i.jsxs(K9,{className:"w-48",children:[i.jsxs(Da,{onClick:()=>d("light"),disabled:u==="light",children:[i.jsx(ZN,{className:"mr-2 h-4 w-4"}),"浅色",u==="light"&&i.jsx(Ic,{children:"✓"})]}),i.jsxs(Da,{onClick:()=>d("dark"),disabled:u==="dark",children:[i.jsx(XN,{className:"mr-2 h-4 w-4"}),"深色",u==="dark"&&i.jsx(Ic,{children:"✓"})]}),i.jsxs(Da,{onClick:()=>d("system"),disabled:u==="system",children:[i.jsx(Vc,{className:"mr-2 h-4 w-4"}),"跟随系统",u==="system"&&i.jsx(Ic,{children:"✓"})]})]})]}),i.jsx(vf,{}),i.jsxs(Da,{onClick:()=>window.location.reload(),children:[i.jsx(nge,{className:"mr-2 h-4 w-4"}),"刷新页面",i.jsx(Ic,{children:"⌘R"})]}),i.jsxs(Da,{onClick:()=>l(!0),children:[i.jsx(Dr,{className:"mr-2 h-4 w-4"}),"搜索",i.jsx(Ic,{children:"⌘K"})]}),i.jsx(vf,{}),i.jsxs(Da,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[i.jsx(av,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),i.jsx(vf,{}),i.jsxs(Da,{onClick:j,className:"text-destructive focus:text-destructive",children:[i.jsx(WI,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}const rm=TY({component:()=>i.jsxs(i.Fragment,{children:[i.jsx(MC,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!h8())throw YL({to:"/auth"})}}),_Ee=fr({getParentRoute:()=>rm,path:"/auth",component:Gxe}),NEe=fr({getParentRoute:()=>rm,path:"/setup",component:jbe}),Aa=fr({getParentRoute:()=>rm,id:"protected",component:()=>i.jsx(SEe,{children:i.jsx(MC,{})})}),CEe=fr({getParentRoute:()=>Aa,path:"/",component:Lge}),OEe=fr({getParentRoute:()=>Aa,path:"/config/bot",component:dje}),EEe=fr({getParentRoute:()=>Aa,path:"/config/modelProvider",component:kje}),AEe=fr({getParentRoute:()=>Aa,path:"/config/model",component:i1e}),TEe=fr({getParentRoute:()=>Aa,path:"/resource/emoji",component:h1e}),kEe=fr({getParentRoute:()=>Aa,path:"/resource/expression",component:j1e}),MEe=fr({getParentRoute:()=>Aa,path:"/resource/person",component:k1e}),PEe=fr({getParentRoute:()=>Aa,path:"/logs",component:fCe}),REe=fr({getParentRoute:()=>Aa,path:"/plugins",component:NCe}),DEe=fr({getParentRoute:()=>Aa,path:"/plugin-mirrors",component:CCe}),$Ee=fr({getParentRoute:()=>Aa,path:"/settings",component:Bxe}),IEe=fr({getParentRoute:()=>rm,path:"*",component:j8}),LEe=rm.addChildren([_Ee,NEe,Aa.addChildren([CEe,OEe,EEe,AEe,TEe,kEe,MEe,REe,DEe,PEe,$Ee]),IEe]),BEe=zY({routeTree:LEe,defaultNotFoundComponent:j8});function zEe({children:e,defaultTheme:t="system",storageKey:n="ui-theme",...r}){const[a,o]=y.useState(()=>localStorage.getItem(n)||t);y.useEffect(()=>{const u=window.document.documentElement;if(u.classList.remove("light","dark"),a==="system"){const d=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";u.classList.add(d);return}u.classList.add(a)},[a]),y.useEffect(()=>{const u=localStorage.getItem("accent-color");if(u){const d=document.documentElement,m={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%"},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%"},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%"},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%"},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%"}}[u];m&&d.style.setProperty("--primary",m.hsl)}},[]);const l={theme:a,setTheme:u=>{localStorage.setItem(n,u),o(u)}};return i.jsx(aF.Provider,{...r,value:l,children:e})}function qEe({children:e,defaultEnabled:t=!0,defaultWavesEnabled:n=!0,storageKey:r="enable-animations",wavesStorageKey:a="enable-waves-background"}){const[o,l]=y.useState(()=>{const m=localStorage.getItem(r);return m!==null?m==="true":t}),[u,d]=y.useState(()=>{const m=localStorage.getItem(a);return m!==null?m==="true":n});y.useEffect(()=>{const m=document.documentElement;o?m.classList.remove("no-animations"):m.classList.add("no-animations"),localStorage.setItem(r,String(o))},[o,r]),y.useEffect(()=>{localStorage.setItem(a,String(u))},[u,a]);const f={enableAnimations:o,setEnableAnimations:l,enableWavesBackground:u,setEnableWavesBackground:d};return i.jsx(iF.Provider,{value:f,children:e})}var FE="ToastProvider",[UE,FEe,UEe]=Ch("Toast"),[sW]=hr("Toast",[UEe]),[HEe,rx]=sW(FE),lW=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:a="right",swipeThreshold:o=50,children:l}=e,[u,d]=y.useState(null),[f,m]=y.useState(0),p=y.useRef(!1),g=y.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${FE}\`. Expected non-empty \`string\`.`),i.jsx(UE.Provider,{scope:t,children:i.jsx(HEe,{scope:t,label:n,duration:r,swipeDirection:a,swipeThreshold:o,toastCount:f,viewport:u,onViewportChange:d,onToastAdd:y.useCallback(()=>m(x=>x+1),[]),onToastRemove:y.useCallback(()=>m(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:g,children:l})})};lW.displayName=FE;var cW="ToastViewport",WEe=["F8"],xC="toast.viewportPause",bC="toast.viewportResume",uW=y.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=WEe,label:a="Notifications ({hotkey})",...o}=e,l=rx(cW,n),u=FEe(n),d=y.useRef(null),f=y.useRef(null),m=y.useRef(null),p=y.useRef(null),g=qe(t,p,l.onViewportChange),x=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),j=l.toastCount>0;y.useEffect(()=>{const w=N=>{r.length!==0&&r.every(E=>N[E]||N.code===E)&&p.current?.focus()};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[r]),y.useEffect(()=>{const w=d.current,N=p.current;if(j&&w&&N){const A=()=>{if(!l.isClosePausedRef.current){const k=new CustomEvent(xC);N.dispatchEvent(k),l.isClosePausedRef.current=!0}},E=()=>{if(l.isClosePausedRef.current){const k=new CustomEvent(bC);N.dispatchEvent(k),l.isClosePausedRef.current=!1}},T=k=>{!w.contains(k.relatedTarget)&&E()},C=()=>{w.contains(document.activeElement)||E()};return w.addEventListener("focusin",A),w.addEventListener("focusout",T),w.addEventListener("pointermove",A),w.addEventListener("pointerleave",C),window.addEventListener("blur",A),window.addEventListener("focus",E),()=>{w.removeEventListener("focusin",A),w.removeEventListener("focusout",T),w.removeEventListener("pointermove",A),w.removeEventListener("pointerleave",C),window.removeEventListener("blur",A),window.removeEventListener("focus",E)}}},[j,l.isClosePausedRef]);const b=y.useCallback(({tabbingDirection:w})=>{const A=u().map(E=>{const T=E.ref.current,C=[T,...aAe(T)];return w==="forwards"?C:C.reverse()});return(w==="forwards"?A.reverse():A).flat()},[u]);return y.useEffect(()=>{const w=p.current;if(w){const N=A=>{const E=A.altKey||A.ctrlKey||A.metaKey;if(A.key==="Tab"&&!E){const C=document.activeElement,k=A.shiftKey;if(A.target===w&&k){f.current?.focus();return}const I=b({tabbingDirection:k?"backwards":"forwards"}),z=I.findIndex(D=>D===C);l_(I.slice(z+1))?A.preventDefault():k?f.current?.focus():m.current?.focus()}};return w.addEventListener("keydown",N),()=>w.removeEventListener("keydown",N)}},[u,b]),i.jsxs(hye,{ref:d,role:"region","aria-label":a.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:j?void 0:"none"},children:[j&&i.jsx(wC,{ref:f,onFocusFromOutsideViewport:()=>{const w=b({tabbingDirection:"forwards"});l_(w)}}),i.jsx(UE.Slot,{scope:n,children:i.jsx(Pe.ol,{tabIndex:-1,...o,ref:g})}),j&&i.jsx(wC,{ref:m,onFocusFromOutsideViewport:()=>{const w=b({tabbingDirection:"backwards"});l_(w)}})]})});uW.displayName=cW;var dW="ToastFocusProxy",wC=y.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...a}=e,o=rx(dW,n);return i.jsx(Vy,{tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:l=>{const u=l.relatedTarget;!o.viewport?.contains(u)&&r()}})});wC.displayName=dW;var am="Toast",VEe="toast.swipeStart",GEe="toast.swipeMove",YEe="toast.swipeCancel",KEe="toast.swipeEnd",fW=y.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:a,onOpenChange:o,...l}=e,[u,d]=Na({prop:r,defaultProp:a??!0,onChange:o,caller:am});return i.jsx(Rn,{present:n||u,children:i.jsx(QEe,{open:u,...l,ref:t,onClose:()=>d(!1),onPause:nn(e.onPause),onResume:nn(e.onResume),onSwipeStart:Se(e.onSwipeStart,f=>{f.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Se(e.onSwipeMove,f=>{const{x:m,y:p}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","move"),f.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${m}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:Se(e.onSwipeCancel,f=>{f.currentTarget.setAttribute("data-swipe","cancel"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Se(e.onSwipeEnd,f=>{const{x:m,y:p}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","end"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${m}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),d(!1)})})})});fW.displayName=am;var[XEe,ZEe]=sW(am,{onClose(){}}),QEe=y.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:a,open:o,onClose:l,onEscapeKeyDown:u,onPause:d,onResume:f,onSwipeStart:m,onSwipeMove:p,onSwipeCancel:g,onSwipeEnd:x,...j}=e,b=rx(am,n),[w,N]=y.useState(null),A=qe(t,F=>N(F)),E=y.useRef(null),T=y.useRef(null),C=a||b.duration,k=y.useRef(0),O=y.useRef(C),M=y.useRef(0),{onToastAdd:I,onToastRemove:z}=b,D=nn(()=>{w?.contains(document.activeElement)&&b.viewport?.focus(),l()}),H=y.useCallback(F=>{!F||F===1/0||(window.clearTimeout(M.current),k.current=new Date().getTime(),M.current=window.setTimeout(D,F))},[D]);y.useEffect(()=>{const F=b.viewport;if(F){const G=()=>{H(O.current),f?.()},L=()=>{const R=new Date().getTime()-k.current;O.current=O.current-R,window.clearTimeout(M.current),d?.()};return F.addEventListener(xC,L),F.addEventListener(bC,G),()=>{F.removeEventListener(xC,L),F.removeEventListener(bC,G)}}},[b.viewport,C,d,f,H]),y.useEffect(()=>{o&&!b.isClosePausedRef.current&&H(C)},[o,C,b.isClosePausedRef,H]),y.useEffect(()=>(I(),()=>z()),[I,z]);const V=y.useMemo(()=>w?xW(w):null,[w]);return b.viewport?i.jsxs(i.Fragment,{children:[V&&i.jsx(JEe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:V}),i.jsx(XEe,{scope:n,onClose:D,children:wl.createPortal(i.jsx(UE.ItemSlot,{scope:n,children:i.jsx(fye,{asChild:!0,onEscapeKeyDown:Se(u,()=>{b.isFocusedToastEscapeKeyDownRef.current||D(),b.isFocusedToastEscapeKeyDownRef.current=!1}),children:i.jsx(Pe.li,{tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":b.swipeDirection,...j,ref:A,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Se(e.onKeyDown,F=>{F.key==="Escape"&&(u?.(F.nativeEvent),F.nativeEvent.defaultPrevented||(b.isFocusedToastEscapeKeyDownRef.current=!0,D()))}),onPointerDown:Se(e.onPointerDown,F=>{F.button===0&&(E.current={x:F.clientX,y:F.clientY})}),onPointerMove:Se(e.onPointerMove,F=>{if(!E.current)return;const G=F.clientX-E.current.x,L=F.clientY-E.current.y,R=!!T.current,U=["left","right"].includes(b.swipeDirection),K=["left","up"].includes(b.swipeDirection)?Math.min:Math.max,te=U?K(0,G):0,$=U?0:K(0,L),B=F.pointerType==="touch"?10:2,Y={x:te,y:$},ne={originalEvent:F,delta:Y};R?(T.current=Y,Zp(GEe,p,ne,{discrete:!1})):UL(Y,b.swipeDirection,B)?(T.current=Y,Zp(VEe,m,ne,{discrete:!1}),F.target.setPointerCapture(F.pointerId)):(Math.abs(G)>B||Math.abs(L)>B)&&(E.current=null)}),onPointerUp:Se(e.onPointerUp,F=>{const G=T.current,L=F.target;if(L.hasPointerCapture(F.pointerId)&&L.releasePointerCapture(F.pointerId),T.current=null,E.current=null,G){const R=F.currentTarget,U={originalEvent:F,delta:G};UL(G,b.swipeDirection,b.swipeThreshold)?Zp(KEe,x,U,{discrete:!0}):Zp(YEe,g,U,{discrete:!0}),R.addEventListener("click",K=>K.preventDefault(),{once:!0})}})})})}),b.viewport)})]}):null}),JEe=e=>{const{__scopeToast:t,children:n,...r}=e,a=rx(am,t),[o,l]=y.useState(!1),[u,d]=y.useState(!1);return nAe(()=>l(!0)),y.useEffect(()=>{const f=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(f)},[]),u?null:i.jsx(El,{asChild:!0,children:i.jsx(Vy,{...r,children:o&&i.jsxs(i.Fragment,{children:[a.label," ",n]})})})},eAe="ToastTitle",hW=y.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return i.jsx(Pe.div,{...r,ref:t})});hW.displayName=eAe;var tAe="ToastDescription",mW=y.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return i.jsx(Pe.div,{...r,ref:t})});mW.displayName=tAe;var pW="ToastAction",vW=y.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?i.jsx(yW,{altText:n,asChild:!0,children:i.jsx(HE,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${pW}\`. Expected non-empty \`string\`.`),null)});vW.displayName=pW;var gW="ToastClose",HE=y.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,a=ZEe(gW,n);return i.jsx(yW,{asChild:!0,children:i.jsx(Pe.button,{type:"button",...r,ref:t,onClick:Se(e.onClick,a.onClose)})})});HE.displayName=gW;var yW=y.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...a}=e;return i.jsx(Pe.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...a,ref:t})});function xW(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),rAe(r)){const a=r.ariaHidden||r.hidden||r.style.display==="none",o=r.dataset.radixToastAnnounceExclude==="";if(!a)if(o){const l=r.dataset.radixToastAnnounceAlt;l&&t.push(l)}else t.push(...xW(r))}}),t}function Zp(e,t,n,{discrete:r}){const a=n.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?LC(a,o):a.dispatchEvent(o)}var UL=(e,t,n=0)=>{const r=Math.abs(e.x),a=Math.abs(e.y),o=r>a;return t==="left"||t==="right"?o&&r>n:!o&&a>n};function nAe(e=()=>{}){const t=nn(e);Un(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function rAe(e){return e.nodeType===e.ELEMENT_NODE}function aAe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function l_(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var iAe=lW,bW=uW,wW=fW,jW=hW,SW=mW,_W=vW,NW=HE;const oAe=iAe,CW=y.forwardRef(({className:e,...t},n)=>i.jsx(bW,{ref:n,className:de("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));CW.displayName=bW.displayName;const sAe=qh("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),OW=y.forwardRef(({className:e,variant:t,...n},r)=>i.jsx(wW,{ref:r,className:de(sAe({variant:t}),e),...n}));OW.displayName=wW.displayName;const lAe=y.forwardRef(({className:e,...t},n)=>i.jsx(_W,{ref:n,className:de("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));lAe.displayName=_W.displayName;const EW=y.forwardRef(({className:e,...t},n)=>i.jsx(NW,{ref:n,className:de("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:i.jsx(Bh,{className:"h-4 w-4"})}));EW.displayName=NW.displayName;const AW=y.forwardRef(({className:e,...t},n)=>i.jsx(jW,{ref:n,className:de("text-sm font-semibold [&+div]:text-xs",e),...t}));AW.displayName=jW.displayName;const TW=y.forwardRef(({className:e,...t},n)=>i.jsx(SW,{ref:n,className:de("text-sm opacity-90",e),...t}));TW.displayName=SW.displayName;function cAe(){const{toasts:e}=mr();return i.jsxs(oAe,{children:[e.map(function({id:t,title:n,description:r,action:a,...o}){return i.jsxs(OW,{...o,children:[i.jsxs("div",{className:"grid gap-1",children:[n&&i.jsx(AW,{children:n}),r&&i.jsx(TW,{children:r})]}),a,i.jsx(EW,{})]},t)}),i.jsx(CW,{})]})}QV.createRoot(document.getElementById("root")).render(i.jsx(y.StrictMode,{children:i.jsx(zEe,{defaultTheme:"system",children:i.jsxs(qEe,{children:[i.jsx(UY,{router:BEe}),i.jsx(cAe,{})]})})}));