@danhachuel/leadmaster 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/backend/__pycache__/main.cpython-311.pyc +0 -0
- package/backend/main.py +36 -0
- package/backend/services/__pycache__/__init__.cpython-311.pyc +0 -0
- package/backend/services/__pycache__/agents.cpython-311.pyc +0 -0
- package/backend/services/__pycache__/crm_agent.cpython-311.pyc +0 -0
- package/backend/services/__pycache__/extractors.cpython-311.pyc +0 -0
- package/backend/services/__pycache__/flags.cpython-311.pyc +0 -0
- package/backend/services/__pycache__/llm.cpython-311.pyc +0 -0
- package/backend/services/__pycache__/storage.cpython-311.pyc +0 -0
- package/backend/tests/__pycache__/conftest.cpython-311-pytest-8.4.2.pyc +0 -0
- package/backend/tests/__pycache__/test_crm_routes.cpython-311-pytest-8.4.2.pyc +0 -0
- package/backend/tests/__pycache__/test_launcher_protections.cpython-311-pytest-8.4.2.pyc +0 -0
- package/backend/tests/__pycache__/test_process_flags.cpython-311-pytest-8.4.2.pyc +0 -0
- package/backend/tests/test_crm_routes.py +64 -0
- package/backend/tests/test_launcher_protections.py +46 -0
- package/frontend/dist/assets/{index-pSbjfRli.css → index-DVFFIa5O.css} +1 -1
- package/frontend/dist/assets/index-ZsRPRMCF.js +90 -0
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/scripts/cli.mjs +70 -6
- package/frontend/dist/assets/index-0xtgAs3t.js +0 -90
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
var Mv=Object.defineProperty;var mh=t=>{throw TypeError(t)};var Pv=(t,e,n)=>e in t?Mv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var B=(t,e,n)=>Pv(t,typeof e!="symbol"?e+"":e,n),Sc=(t,e,n)=>e.has(t)||mh("Cannot "+n);var C=(t,e,n)=>(Sc(t,e,"read from private field"),n?n.call(t):e.get(t)),z=(t,e,n)=>e.has(t)?mh("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),D=(t,e,n,s)=>(Sc(t,e,"write to private field"),s?s.call(t,n):e.set(t,n),n),X=(t,e,n)=>(Sc(t,e,"access private method"),n);var sa=(t,e,n,s)=>({set _(r){D(t,e,r,n)},get _(){return C(t,e,s)}});function Rv(t,e){for(var n=0;n<e.length;n++){const s=e[n];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in t)){const i=Object.getOwnPropertyDescriptor(s,r);i&&Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:()=>s[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();function Ov(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var km={exports:{}},Hl={},Cm={exports:{}},Q={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Wo=Symbol.for("react.element"),Tv=Symbol.for("react.portal"),Dv=Symbol.for("react.fragment"),Lv=Symbol.for("react.strict_mode"),Av=Symbol.for("react.profiler"),Fv=Symbol.for("react.provider"),Iv=Symbol.for("react.context"),zv=Symbol.for("react.forward_ref"),Bv=Symbol.for("react.suspense"),Wv=Symbol.for("react.memo"),Uv=Symbol.for("react.lazy"),xh=Symbol.iterator;function $v(t){return t===null||typeof t!="object"?null:(t=xh&&t[xh]||t["@@iterator"],typeof t=="function"?t:null)}var jm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Em=Object.assign,Nm={};function ui(t,e,n){this.props=t,this.context=e,this.refs=Nm,this.updater=n||jm}ui.prototype.isReactComponent={};ui.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};ui.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Mm(){}Mm.prototype=ui.prototype;function Ad(t,e,n){this.props=t,this.context=e,this.refs=Nm,this.updater=n||jm}var Fd=Ad.prototype=new Mm;Fd.constructor=Ad;Em(Fd,ui.prototype);Fd.isPureReactComponent=!0;var yh=Array.isArray,Pm=Object.prototype.hasOwnProperty,Id={current:null},Rm={key:!0,ref:!0,__self:!0,__source:!0};function Om(t,e,n){var s,r={},i=null,o=null;if(e!=null)for(s in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)Pm.call(e,s)&&!Rm.hasOwnProperty(s)&&(r[s]=e[s]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];r.children=l}if(t&&t.defaultProps)for(s in a=t.defaultProps,a)r[s]===void 0&&(r[s]=a[s]);return{$$typeof:Wo,type:t,key:i,ref:o,props:r,_owner:Id.current}}function Hv(t,e){return{$$typeof:Wo,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function zd(t){return typeof t=="object"&&t!==null&&t.$$typeof===Wo}function Vv(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var vh=/\/+/g;function _c(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Vv(""+t.key):e.toString(36)}function Aa(t,e,n,s,r){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case Wo:case Tv:o=!0}}if(o)return o=t,r=r(o),t=s===""?"."+_c(o,0):s,yh(r)?(n="",t!=null&&(n=t.replace(vh,"$&/")+"/"),Aa(r,e,n,"",function(c){return c})):r!=null&&(zd(r)&&(r=Hv(r,n+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(vh,"$&/")+"/")+t)),e.push(r)),1;if(o=0,s=s===""?".":s+":",yh(t))for(var a=0;a<t.length;a++){i=t[a];var l=s+_c(i,a);o+=Aa(i,e,n,l,r)}else if(l=$v(t),typeof l=="function")for(t=l.call(t),a=0;!(i=t.next()).done;)i=i.value,l=s+_c(i,a++),o+=Aa(i,e,n,l,r);else if(i==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function ra(t,e,n){if(t==null)return t;var s=[],r=0;return Aa(t,s,"","",function(i){return e.call(n,i,r++)}),s}function Qv(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var et={current:null},Fa={transition:null},Kv={ReactCurrentDispatcher:et,ReactCurrentBatchConfig:Fa,ReactCurrentOwner:Id};function Tm(){throw Error("act(...) is not supported in production builds of React.")}Q.Children={map:ra,forEach:function(t,e,n){ra(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return ra(t,function(){e++}),e},toArray:function(t){return ra(t,function(e){return e})||[]},only:function(t){if(!zd(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Q.Component=ui;Q.Fragment=Dv;Q.Profiler=Av;Q.PureComponent=Ad;Q.StrictMode=Lv;Q.Suspense=Bv;Q.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Kv;Q.act=Tm;Q.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var s=Em({},t.props),r=t.key,i=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,o=Id.current),e.key!==void 0&&(r=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(l in e)Pm.call(e,l)&&!Rm.hasOwnProperty(l)&&(s[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];s.children=a}return{$$typeof:Wo,type:t.type,key:r,ref:i,props:s,_owner:o}};Q.createContext=function(t){return t={$$typeof:Iv,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:Fv,_context:t},t.Consumer=t};Q.createElement=Om;Q.createFactory=function(t){var e=Om.bind(null,t);return e.type=t,e};Q.createRef=function(){return{current:null}};Q.forwardRef=function(t){return{$$typeof:zv,render:t}};Q.isValidElement=zd;Q.lazy=function(t){return{$$typeof:Uv,_payload:{_status:-1,_result:t},_init:Qv}};Q.memo=function(t,e){return{$$typeof:Wv,type:t,compare:e===void 0?null:e}};Q.startTransition=function(t){var e=Fa.transition;Fa.transition={};try{t()}finally{Fa.transition=e}};Q.unstable_act=Tm;Q.useCallback=function(t,e){return et.current.useCallback(t,e)};Q.useContext=function(t){return et.current.useContext(t)};Q.useDebugValue=function(){};Q.useDeferredValue=function(t){return et.current.useDeferredValue(t)};Q.useEffect=function(t,e){return et.current.useEffect(t,e)};Q.useId=function(){return et.current.useId()};Q.useImperativeHandle=function(t,e,n){return et.current.useImperativeHandle(t,e,n)};Q.useInsertionEffect=function(t,e){return et.current.useInsertionEffect(t,e)};Q.useLayoutEffect=function(t,e){return et.current.useLayoutEffect(t,e)};Q.useMemo=function(t,e){return et.current.useMemo(t,e)};Q.useReducer=function(t,e,n){return et.current.useReducer(t,e,n)};Q.useRef=function(t){return et.current.useRef(t)};Q.useState=function(t){return et.current.useState(t)};Q.useSyncExternalStore=function(t,e,n){return et.current.useSyncExternalStore(t,e,n)};Q.useTransition=function(){return et.current.useTransition()};Q.version="18.3.1";Cm.exports=Q;var w=Cm.exports;const be=Ov(w),Yv=Rv({__proto__:null,default:be},[w]);/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.production.min.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Xv=w,qv=Symbol.for("react.element"),Gv=Symbol.for("react.fragment"),Jv=Object.prototype.hasOwnProperty,Zv=Xv.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,eb={key:!0,ref:!0,__self:!0,__source:!0};function Dm(t,e,n){var s,r={},i=null,o=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(s in e)Jv.call(e,s)&&!eb.hasOwnProperty(s)&&(r[s]=e[s]);if(t&&t.defaultProps)for(s in e=t.defaultProps,e)r[s]===void 0&&(r[s]=e[s]);return{$$typeof:qv,type:t,key:i,ref:o,props:r,_owner:Zv.current}}Hl.Fragment=Gv;Hl.jsx=Dm;Hl.jsxs=Dm;km.exports=Hl;var d=km.exports,hu={},Lm={exports:{}},St={},Am={exports:{}},Fm={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.min.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/(function(t){function e(T,A){var F=T.length;T.push(A);e:for(;0<F;){var K=F-1>>>1,$=T[K];if(0<r($,A))T[K]=A,T[F]=$,F=K;else break e}}function n(T){return T.length===0?null:T[0]}function s(T){if(T.length===0)return null;var A=T[0],F=T.pop();if(F!==A){T[0]=F;e:for(var K=0,$=T.length,ue=$>>>1;K<ue;){var Y=2*(K+1)-1,Ne=T[Y],te=Y+1,Lt=T[te];if(0>r(Ne,F))te<$&&0>r(Lt,Ne)?(T[K]=Lt,T[te]=F,K=te):(T[K]=Ne,T[Y]=F,K=Y);else if(te<$&&0>r(Lt,F))T[K]=Lt,T[te]=F,K=te;else break e}}return A}function r(T,A){var F=T.sortIndex-A.sortIndex;return F!==0?F:T.id-A.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,f=null,h=3,p=!1,y=!1,m=!1,b=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(T){for(var A=n(c);A!==null;){if(A.callback===null)s(c);else if(A.startTime<=T)s(c),A.sortIndex=A.expirationTime,e(l,A);else break;A=n(c)}}function S(T){if(m=!1,v(T),!y)if(n(l)!==null)y=!0,oe(_);else{var A=n(c);A!==null&&se(S,A.startTime-T)}}function _(T,A){y=!1,m&&(m=!1,x(E),E=-1),p=!0;var F=h;try{for(v(A),f=n(l);f!==null&&(!(f.expirationTime>A)||T&&!O());){var K=f.callback;if(typeof K=="function"){f.callback=null,h=f.priorityLevel;var $=K(f.expirationTime<=A);A=t.unstable_now(),typeof $=="function"?f.callback=$:f===n(l)&&s(l),v(A)}else s(l);f=n(l)}if(f!==null)var ue=!0;else{var Y=n(c);Y!==null&&se(S,Y.startTime-A),ue=!1}return ue}finally{f=null,h=F,p=!1}}var k=!1,j=null,E=-1,P=5,M=-1;function O(){return!(t.unstable_now()-M<P)}function N(){if(j!==null){var T=t.unstable_now();M=T;var A=!0;try{A=j(!0,T)}finally{A?I():(k=!1,j=null)}}else k=!1}var I;if(typeof g=="function")I=function(){g(N)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,V=W.port2;W.port1.onmessage=N,I=function(){V.postMessage(null)}}else I=function(){b(N,0)};function oe(T){j=T,k||(k=!0,I())}function se(T,A){E=b(function(){T(t.unstable_now())},A)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(T){T.callback=null},t.unstable_continueExecution=function(){y||p||(y=!0,oe(_))},t.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<T?Math.floor(1e3/T):5},t.unstable_getCurrentPriorityLevel=function(){return h},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(T){switch(h){case 1:case 2:case 3:var A=3;break;default:A=h}var F=h;h=A;try{return T()}finally{h=F}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(T,A){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var F=h;h=T;try{return A()}finally{h=F}},t.unstable_scheduleCallback=function(T,A,F){var K=t.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?K+F:K):F=K,T){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=F+$,T={id:u++,callback:A,priorityLevel:T,startTime:F,expirationTime:$,sortIndex:-1},F>K?(T.sortIndex=F,e(c,T),n(l)===null&&T===n(c)&&(m?(x(E),E=-1):m=!0,se(S,F-K))):(T.sortIndex=$,e(l,T),y||p||(y=!0,oe(_))),T},t.unstable_shouldYield=O,t.unstable_wrapCallback=function(T){var A=h;return function(){var F=h;h=A;try{return T.apply(this,arguments)}finally{h=F}}}})(Fm);Am.exports=Fm;var tb=Am.exports;/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.min.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var nb=w,wt=tb;function R(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Im=new Set,lo={};function lr(t,e){ei(t,e),ei(t+"Capture",e)}function ei(t,e){for(lo[t]=e,t=0;t<e.length;t++)Im.add(e[t])}var En=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),pu=Object.prototype.hasOwnProperty,sb=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,bh={},wh={};function rb(t){return pu.call(wh,t)?!0:pu.call(bh,t)?!1:sb.test(t)?wh[t]=!0:(bh[t]=!0,!1)}function ib(t,e,n,s){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return s?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function ob(t,e,n,s){if(e===null||typeof e>"u"||ib(t,e,n,s))return!0;if(s)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function tt(t,e,n,s,r,i,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=s,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=o}var $e={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){$e[t]=new tt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];$e[e]=new tt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){$e[t]=new tt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){$e[t]=new tt(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){$e[t]=new tt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){$e[t]=new tt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){$e[t]=new tt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){$e[t]=new tt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){$e[t]=new tt(t,5,!1,t.toLowerCase(),null,!1,!1)});var Bd=/[\-:]([a-z])/g;function Wd(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Bd,Wd);$e[e]=new tt(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Bd,Wd);$e[e]=new tt(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Bd,Wd);$e[e]=new tt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){$e[t]=new tt(t,1,!1,t.toLowerCase(),null,!1,!1)});$e.xlinkHref=new tt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){$e[t]=new tt(t,1,!1,t.toLowerCase(),null,!0,!0)});function Ud(t,e,n,s){var r=$e.hasOwnProperty(e)?$e[e]:null;(r!==null?r.type!==0:s||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(ob(e,n,r,s)&&(n=null),s||r===null?rb(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):r.mustUseProperty?t[r.propertyName]=n===null?r.type===3?!1:"":n:(e=r.attributeName,s=r.attributeNamespace,n===null?t.removeAttribute(e):(r=r.type,n=r===3||r===4&&n===!0?"":""+n,s?t.setAttributeNS(s,e,n):t.setAttribute(e,n))))}var On=nb.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ia=Symbol.for("react.element"),yr=Symbol.for("react.portal"),vr=Symbol.for("react.fragment"),$d=Symbol.for("react.strict_mode"),gu=Symbol.for("react.profiler"),zm=Symbol.for("react.provider"),Bm=Symbol.for("react.context"),Hd=Symbol.for("react.forward_ref"),mu=Symbol.for("react.suspense"),xu=Symbol.for("react.suspense_list"),Vd=Symbol.for("react.memo"),Wn=Symbol.for("react.lazy"),Wm=Symbol.for("react.offscreen"),Sh=Symbol.iterator;function _i(t){return t===null||typeof t!="object"?null:(t=Sh&&t[Sh]||t["@@iterator"],typeof t=="function"?t:null)}var Se=Object.assign,kc;function Fi(t){if(kc===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);kc=e&&e[1]||""}return`
|
|
34
|
-
`+kc+t}var Cc=!1;function jc(t,e){if(!t||Cc)return"";Cc=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(c){var s=c}Reflect.construct(t,[],e)}else{try{e.call()}catch(c){s=c}t.call(e.prototype)}else{try{throw Error()}catch(c){s=c}t()}}catch(c){if(c&&s&&typeof c.stack=="string"){for(var r=c.stack.split(`
|
|
35
|
-
`),i=s.stack.split(`
|
|
36
|
-
`),o=r.length-1,a=i.length-1;1<=o&&0<=a&&r[o]!==i[a];)a--;for(;1<=o&&0<=a;o--,a--)if(r[o]!==i[a]){if(o!==1||a!==1)do if(o--,a--,0>a||r[o]!==i[a]){var l=`
|
|
37
|
-
`+r[o].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{Cc=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Fi(t):""}function ab(t){switch(t.tag){case 5:return Fi(t.type);case 16:return Fi("Lazy");case 13:return Fi("Suspense");case 19:return Fi("SuspenseList");case 0:case 2:case 15:return t=jc(t.type,!1),t;case 11:return t=jc(t.type.render,!1),t;case 1:return t=jc(t.type,!0),t;default:return""}}function yu(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case vr:return"Fragment";case yr:return"Portal";case gu:return"Profiler";case $d:return"StrictMode";case mu:return"Suspense";case xu:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Bm:return(t.displayName||"Context")+".Consumer";case zm:return(t._context.displayName||"Context")+".Provider";case Hd:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Vd:return e=t.displayName||null,e!==null?e:yu(t.type)||"Memo";case Wn:e=t._payload,t=t._init;try{return yu(t(e))}catch{}}return null}function lb(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return yu(e);case 8:return e===$d?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function vs(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Um(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function cb(t){var e=Um(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),s=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){s=""+o,i.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(o){s=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function oa(t){t._valueTracker||(t._valueTracker=cb(t))}function $m(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),s="";return t&&(s=Um(t)?t.checked?"true":"false":t.value),t=s,t!==n?(e.setValue(t),!0):!1}function el(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function vu(t,e){var n=e.checked;return Se({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function _h(t,e){var n=e.defaultValue==null?"":e.defaultValue,s=e.checked!=null?e.checked:e.defaultChecked;n=vs(e.value!=null?e.value:n),t._wrapperState={initialChecked:s,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Hm(t,e){e=e.checked,e!=null&&Ud(t,"checked",e,!1)}function bu(t,e){Hm(t,e);var n=vs(e.value),s=e.type;if(n!=null)s==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(s==="submit"||s==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?wu(t,e.type,n):e.hasOwnProperty("defaultValue")&&wu(t,e.type,vs(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function kh(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var s=e.type;if(!(s!=="submit"&&s!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function wu(t,e,n){(e!=="number"||el(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Ii=Array.isArray;function Rr(t,e,n,s){if(t=t.options,e){e={};for(var r=0;r<n.length;r++)e["$"+n[r]]=!0;for(n=0;n<t.length;n++)r=e.hasOwnProperty("$"+t[n].value),t[n].selected!==r&&(t[n].selected=r),r&&s&&(t[n].defaultSelected=!0)}else{for(n=""+vs(n),e=null,r=0;r<t.length;r++){if(t[r].value===n){t[r].selected=!0,s&&(t[r].defaultSelected=!0);return}e!==null||t[r].disabled||(e=t[r])}e!==null&&(e.selected=!0)}}function Su(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(R(91));return Se({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Ch(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(R(92));if(Ii(n)){if(1<n.length)throw Error(R(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:vs(n)}}function Vm(t,e){var n=vs(e.value),s=vs(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),s!=null&&(t.defaultValue=""+s)}function jh(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Qm(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function _u(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Qm(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var aa,Km=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,s,r){MSApp.execUnsafeLocalFunction(function(){return t(e,n,s,r)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(aa=aa||document.createElement("div"),aa.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=aa.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function co(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Ki={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ub=["Webkit","ms","Moz","O"];Object.keys(Ki).forEach(function(t){ub.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Ki[e]=Ki[t]})});function Ym(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Ki.hasOwnProperty(t)&&Ki[t]?(""+e).trim():e+"px"}function Xm(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var s=n.indexOf("--")===0,r=Ym(n,e[n],s);n==="float"&&(n="cssFloat"),s?t.setProperty(n,r):t[n]=r}}var db=Se({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ku(t,e){if(e){if(db[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(R(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(R(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(R(61))}if(e.style!=null&&typeof e.style!="object")throw Error(R(62))}}function Cu(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ju=null;function Qd(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Eu=null,Or=null,Tr=null;function Eh(t){if(t=Ho(t)){if(typeof Eu!="function")throw Error(R(280));var e=t.stateNode;e&&(e=Xl(e),Eu(t.stateNode,t.type,e))}}function qm(t){Or?Tr?Tr.push(t):Tr=[t]:Or=t}function Gm(){if(Or){var t=Or,e=Tr;if(Tr=Or=null,Eh(t),e)for(t=0;t<e.length;t++)Eh(e[t])}}function Jm(t,e){return t(e)}function Zm(){}var Ec=!1;function ex(t,e,n){if(Ec)return t(e,n);Ec=!0;try{return Jm(t,e,n)}finally{Ec=!1,(Or!==null||Tr!==null)&&(Zm(),Gm())}}function uo(t,e){var n=t.stateNode;if(n===null)return null;var s=Xl(n);if(s===null)return null;n=s[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(t=t.type,s=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!s;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(R(231,e,typeof n));return n}var Nu=!1;if(En)try{var ki={};Object.defineProperty(ki,"passive",{get:function(){Nu=!0}}),window.addEventListener("test",ki,ki),window.removeEventListener("test",ki,ki)}catch{Nu=!1}function fb(t,e,n,s,r,i,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(u){this.onError(u)}}var Yi=!1,tl=null,nl=!1,Mu=null,hb={onError:function(t){Yi=!0,tl=t}};function pb(t,e,n,s,r,i,o,a,l){Yi=!1,tl=null,fb.apply(hb,arguments)}function gb(t,e,n,s,r,i,o,a,l){if(pb.apply(this,arguments),Yi){if(Yi){var c=tl;Yi=!1,tl=null}else throw Error(R(198));nl||(nl=!0,Mu=c)}}function cr(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function tx(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function Nh(t){if(cr(t)!==t)throw Error(R(188))}function mb(t){var e=t.alternate;if(!e){if(e=cr(t),e===null)throw Error(R(188));return e!==t?null:t}for(var n=t,s=e;;){var r=n.return;if(r===null)break;var i=r.alternate;if(i===null){if(s=r.return,s!==null){n=s;continue}break}if(r.child===i.child){for(i=r.child;i;){if(i===n)return Nh(r),t;if(i===s)return Nh(r),e;i=i.sibling}throw Error(R(188))}if(n.return!==s.return)n=r,s=i;else{for(var o=!1,a=r.child;a;){if(a===n){o=!0,n=r,s=i;break}if(a===s){o=!0,s=r,n=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===n){o=!0,n=i,s=r;break}if(a===s){o=!0,s=i,n=r;break}a=a.sibling}if(!o)throw Error(R(189))}}if(n.alternate!==s)throw Error(R(190))}if(n.tag!==3)throw Error(R(188));return n.stateNode.current===n?t:e}function nx(t){return t=mb(t),t!==null?sx(t):null}function sx(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=sx(t);if(e!==null)return e;t=t.sibling}return null}var rx=wt.unstable_scheduleCallback,Mh=wt.unstable_cancelCallback,xb=wt.unstable_shouldYield,yb=wt.unstable_requestPaint,Ce=wt.unstable_now,vb=wt.unstable_getCurrentPriorityLevel,Kd=wt.unstable_ImmediatePriority,ix=wt.unstable_UserBlockingPriority,sl=wt.unstable_NormalPriority,bb=wt.unstable_LowPriority,ox=wt.unstable_IdlePriority,Vl=null,un=null;function wb(t){if(un&&typeof un.onCommitFiberRoot=="function")try{un.onCommitFiberRoot(Vl,t,void 0,(t.current.flags&128)===128)}catch{}}var $t=Math.clz32?Math.clz32:kb,Sb=Math.log,_b=Math.LN2;function kb(t){return t>>>=0,t===0?32:31-(Sb(t)/_b|0)|0}var la=64,ca=4194304;function zi(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function rl(t,e){var n=t.pendingLanes;if(n===0)return 0;var s=0,r=t.suspendedLanes,i=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~r;a!==0?s=zi(a):(i&=o,i!==0&&(s=zi(i)))}else o=n&~r,o!==0?s=zi(o):i!==0&&(s=zi(i));if(s===0)return 0;if(e!==0&&e!==s&&!(e&r)&&(r=s&-s,i=e&-e,r>=i||r===16&&(i&4194240)!==0))return e;if(s&4&&(s|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=s;0<e;)n=31-$t(e),r=1<<n,s|=t[n],e&=~r;return s}function Cb(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jb(t,e){for(var n=t.suspendedLanes,s=t.pingedLanes,r=t.expirationTimes,i=t.pendingLanes;0<i;){var o=31-$t(i),a=1<<o,l=r[o];l===-1?(!(a&n)||a&s)&&(r[o]=Cb(a,e)):l<=e&&(t.expiredLanes|=a),i&=~a}}function Pu(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function ax(){var t=la;return la<<=1,!(la&4194240)&&(la=64),t}function Nc(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function Uo(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-$t(e),t[e]=n}function Eb(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var s=t.eventTimes;for(t=t.expirationTimes;0<n;){var r=31-$t(n),i=1<<r;e[r]=0,s[r]=-1,t[r]=-1,n&=~i}}function Yd(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var s=31-$t(n),r=1<<s;r&e|t[s]&e&&(t[s]|=e),n&=~r}}var ie=0;function lx(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var cx,Xd,ux,dx,fx,Ru=!1,ua=[],as=null,ls=null,cs=null,fo=new Map,ho=new Map,Hn=[],Nb="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Ph(t,e){switch(t){case"focusin":case"focusout":as=null;break;case"dragenter":case"dragleave":ls=null;break;case"mouseover":case"mouseout":cs=null;break;case"pointerover":case"pointerout":fo.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":ho.delete(e.pointerId)}}function Ci(t,e,n,s,r,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:n,eventSystemFlags:s,nativeEvent:i,targetContainers:[r]},e!==null&&(e=Ho(e),e!==null&&Xd(e)),t):(t.eventSystemFlags|=s,e=t.targetContainers,r!==null&&e.indexOf(r)===-1&&e.push(r),t)}function Mb(t,e,n,s,r){switch(e){case"focusin":return as=Ci(as,t,e,n,s,r),!0;case"dragenter":return ls=Ci(ls,t,e,n,s,r),!0;case"mouseover":return cs=Ci(cs,t,e,n,s,r),!0;case"pointerover":var i=r.pointerId;return fo.set(i,Ci(fo.get(i)||null,t,e,n,s,r)),!0;case"gotpointercapture":return i=r.pointerId,ho.set(i,Ci(ho.get(i)||null,t,e,n,s,r)),!0}return!1}function hx(t){var e=Is(t.target);if(e!==null){var n=cr(e);if(n!==null){if(e=n.tag,e===13){if(e=tx(n),e!==null){t.blockedOn=e,fx(t.priority,function(){ux(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Ia(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Ou(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var s=new n.constructor(n.type,n);ju=s,n.target.dispatchEvent(s),ju=null}else return e=Ho(n),e!==null&&Xd(e),t.blockedOn=n,!1;e.shift()}return!0}function Rh(t,e,n){Ia(t)&&n.delete(e)}function Pb(){Ru=!1,as!==null&&Ia(as)&&(as=null),ls!==null&&Ia(ls)&&(ls=null),cs!==null&&Ia(cs)&&(cs=null),fo.forEach(Rh),ho.forEach(Rh)}function ji(t,e){t.blockedOn===e&&(t.blockedOn=null,Ru||(Ru=!0,wt.unstable_scheduleCallback(wt.unstable_NormalPriority,Pb)))}function po(t){function e(r){return ji(r,t)}if(0<ua.length){ji(ua[0],t);for(var n=1;n<ua.length;n++){var s=ua[n];s.blockedOn===t&&(s.blockedOn=null)}}for(as!==null&&ji(as,t),ls!==null&&ji(ls,t),cs!==null&&ji(cs,t),fo.forEach(e),ho.forEach(e),n=0;n<Hn.length;n++)s=Hn[n],s.blockedOn===t&&(s.blockedOn=null);for(;0<Hn.length&&(n=Hn[0],n.blockedOn===null);)hx(n),n.blockedOn===null&&Hn.shift()}var Dr=On.ReactCurrentBatchConfig,il=!0;function Rb(t,e,n,s){var r=ie,i=Dr.transition;Dr.transition=null;try{ie=1,qd(t,e,n,s)}finally{ie=r,Dr.transition=i}}function Ob(t,e,n,s){var r=ie,i=Dr.transition;Dr.transition=null;try{ie=4,qd(t,e,n,s)}finally{ie=r,Dr.transition=i}}function qd(t,e,n,s){if(il){var r=Ou(t,e,n,s);if(r===null)Ic(t,e,s,ol,n),Ph(t,s);else if(Mb(r,t,e,n,s))s.stopPropagation();else if(Ph(t,s),e&4&&-1<Nb.indexOf(t)){for(;r!==null;){var i=Ho(r);if(i!==null&&cx(i),i=Ou(t,e,n,s),i===null&&Ic(t,e,s,ol,n),i===r)break;r=i}r!==null&&s.stopPropagation()}else Ic(t,e,s,null,n)}}var ol=null;function Ou(t,e,n,s){if(ol=null,t=Qd(s),t=Is(t),t!==null)if(e=cr(t),e===null)t=null;else if(n=e.tag,n===13){if(t=tx(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return ol=t,null}function px(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(vb()){case Kd:return 1;case ix:return 4;case sl:case bb:return 16;case ox:return 536870912;default:return 16}default:return 16}}var es=null,Gd=null,za=null;function gx(){if(za)return za;var t,e=Gd,n=e.length,s,r="value"in es?es.value:es.textContent,i=r.length;for(t=0;t<n&&e[t]===r[t];t++);var o=n-t;for(s=1;s<=o&&e[n-s]===r[i-s];s++);return za=r.slice(t,1<s?1-s:void 0)}function Ba(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function da(){return!0}function Oh(){return!1}function _t(t){function e(n,s,r,i,o){this._reactName=n,this._targetInst=r,this.type=s,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(n=t[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?da:Oh,this.isPropagationStopped=Oh,this}return Se(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=da)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=da)},persist:function(){},isPersistent:da}),e}var di={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Jd=_t(di),$o=Se({},di,{view:0,detail:0}),Tb=_t($o),Mc,Pc,Ei,Ql=Se({},$o,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zd,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Ei&&(Ei&&t.type==="mousemove"?(Mc=t.screenX-Ei.screenX,Pc=t.screenY-Ei.screenY):Pc=Mc=0,Ei=t),Mc)},movementY:function(t){return"movementY"in t?t.movementY:Pc}}),Th=_t(Ql),Db=Se({},Ql,{dataTransfer:0}),Lb=_t(Db),Ab=Se({},$o,{relatedTarget:0}),Rc=_t(Ab),Fb=Se({},di,{animationName:0,elapsedTime:0,pseudoElement:0}),Ib=_t(Fb),zb=Se({},di,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Bb=_t(zb),Wb=Se({},di,{data:0}),Dh=_t(Wb),Ub={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},$b={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Hb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Vb(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=Hb[t])?!!e[t]:!1}function Zd(){return Vb}var Qb=Se({},$o,{key:function(t){if(t.key){var e=Ub[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Ba(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?$b[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zd,charCode:function(t){return t.type==="keypress"?Ba(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Ba(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Kb=_t(Qb),Yb=Se({},Ql,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lh=_t(Yb),Xb=Se({},$o,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zd}),qb=_t(Xb),Gb=Se({},di,{propertyName:0,elapsedTime:0,pseudoElement:0}),Jb=_t(Gb),Zb=Se({},Ql,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),ew=_t(Zb),tw=[9,13,27,32],ef=En&&"CompositionEvent"in window,Xi=null;En&&"documentMode"in document&&(Xi=document.documentMode);var nw=En&&"TextEvent"in window&&!Xi,mx=En&&(!ef||Xi&&8<Xi&&11>=Xi),Ah=" ",Fh=!1;function xx(t,e){switch(t){case"keyup":return tw.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yx(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var br=!1;function sw(t,e){switch(t){case"compositionend":return yx(e);case"keypress":return e.which!==32?null:(Fh=!0,Ah);case"textInput":return t=e.data,t===Ah&&Fh?null:t;default:return null}}function rw(t,e){if(br)return t==="compositionend"||!ef&&xx(t,e)?(t=gx(),za=Gd=es=null,br=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return mx&&e.locale!=="ko"?null:e.data;default:return null}}var iw={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Ih(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!iw[t.type]:e==="textarea"}function vx(t,e,n,s){qm(s),e=al(e,"onChange"),0<e.length&&(n=new Jd("onChange","change",null,n,s),t.push({event:n,listeners:e}))}var qi=null,go=null;function ow(t){Px(t,0)}function Kl(t){var e=_r(t);if($m(e))return t}function aw(t,e){if(t==="change")return e}var bx=!1;if(En){var Oc;if(En){var Tc="oninput"in document;if(!Tc){var zh=document.createElement("div");zh.setAttribute("oninput","return;"),Tc=typeof zh.oninput=="function"}Oc=Tc}else Oc=!1;bx=Oc&&(!document.documentMode||9<document.documentMode)}function Bh(){qi&&(qi.detachEvent("onpropertychange",wx),go=qi=null)}function wx(t){if(t.propertyName==="value"&&Kl(go)){var e=[];vx(e,go,t,Qd(t)),ex(ow,e)}}function lw(t,e,n){t==="focusin"?(Bh(),qi=e,go=n,qi.attachEvent("onpropertychange",wx)):t==="focusout"&&Bh()}function cw(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Kl(go)}function uw(t,e){if(t==="click")return Kl(e)}function dw(t,e){if(t==="input"||t==="change")return Kl(e)}function fw(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Vt=typeof Object.is=="function"?Object.is:fw;function mo(t,e){if(Vt(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),s=Object.keys(e);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var r=n[s];if(!pu.call(e,r)||!Vt(t[r],e[r]))return!1}return!0}function Wh(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Uh(t,e){var n=Wh(t);t=0;for(var s;n;){if(n.nodeType===3){if(s=t+n.textContent.length,t<=e&&s>=e)return{node:n,offset:e-t};t=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Wh(n)}}function Sx(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Sx(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function _x(){for(var t=window,e=el();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=el(t.document)}return e}function tf(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function hw(t){var e=_x(),n=t.focusedElem,s=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&Sx(n.ownerDocument.documentElement,n)){if(s!==null&&tf(n)){if(e=s.start,t=s.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var r=n.textContent.length,i=Math.min(s.start,r);s=s.end===void 0?i:Math.min(s.end,r),!t.extend&&i>s&&(r=s,s=i,i=r),r=Uh(n,i);var o=Uh(n,s);r&&o&&(t.rangeCount!==1||t.anchorNode!==r.node||t.anchorOffset!==r.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),t.removeAllRanges(),i>s?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var pw=En&&"documentMode"in document&&11>=document.documentMode,wr=null,Tu=null,Gi=null,Du=!1;function $h(t,e,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Du||wr==null||wr!==el(s)||(s=wr,"selectionStart"in s&&tf(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Gi&&mo(Gi,s)||(Gi=s,s=al(Tu,"onSelect"),0<s.length&&(e=new Jd("onSelect","select",null,e,n),t.push({event:e,listeners:s}),e.target=wr)))}function fa(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var Sr={animationend:fa("Animation","AnimationEnd"),animationiteration:fa("Animation","AnimationIteration"),animationstart:fa("Animation","AnimationStart"),transitionend:fa("Transition","TransitionEnd")},Dc={},kx={};En&&(kx=document.createElement("div").style,"AnimationEvent"in window||(delete Sr.animationend.animation,delete Sr.animationiteration.animation,delete Sr.animationstart.animation),"TransitionEvent"in window||delete Sr.transitionend.transition);function Yl(t){if(Dc[t])return Dc[t];if(!Sr[t])return t;var e=Sr[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in kx)return Dc[t]=e[n];return t}var Cx=Yl("animationend"),jx=Yl("animationiteration"),Ex=Yl("animationstart"),Nx=Yl("transitionend"),Mx=new Map,Hh="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function ks(t,e){Mx.set(t,e),lr(e,[t])}for(var Lc=0;Lc<Hh.length;Lc++){var Ac=Hh[Lc],gw=Ac.toLowerCase(),mw=Ac[0].toUpperCase()+Ac.slice(1);ks(gw,"on"+mw)}ks(Cx,"onAnimationEnd");ks(jx,"onAnimationIteration");ks(Ex,"onAnimationStart");ks("dblclick","onDoubleClick");ks("focusin","onFocus");ks("focusout","onBlur");ks(Nx,"onTransitionEnd");ei("onMouseEnter",["mouseout","mouseover"]);ei("onMouseLeave",["mouseout","mouseover"]);ei("onPointerEnter",["pointerout","pointerover"]);ei("onPointerLeave",["pointerout","pointerover"]);lr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));lr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));lr("onBeforeInput",["compositionend","keypress","textInput","paste"]);lr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));lr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));lr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Bi="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),xw=new Set("cancel close invalid load scroll toggle".split(" ").concat(Bi));function Vh(t,e,n){var s=t.type||"unknown-event";t.currentTarget=n,gb(s,e,void 0,t),t.currentTarget=null}function Px(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var s=t[n],r=s.event;s=s.listeners;e:{var i=void 0;if(e)for(var o=s.length-1;0<=o;o--){var a=s[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==i&&r.isPropagationStopped())break e;Vh(r,a,c),i=l}else for(o=0;o<s.length;o++){if(a=s[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==i&&r.isPropagationStopped())break e;Vh(r,a,c),i=l}}}if(nl)throw t=Mu,nl=!1,Mu=null,t}function de(t,e){var n=e[zu];n===void 0&&(n=e[zu]=new Set);var s=t+"__bubble";n.has(s)||(Rx(e,t,2,!1),n.add(s))}function Fc(t,e,n){var s=0;e&&(s|=4),Rx(n,t,s,e)}var ha="_reactListening"+Math.random().toString(36).slice(2);function xo(t){if(!t[ha]){t[ha]=!0,Im.forEach(function(n){n!=="selectionchange"&&(xw.has(n)||Fc(n,!1,t),Fc(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[ha]||(e[ha]=!0,Fc("selectionchange",!1,e))}}function Rx(t,e,n,s){switch(px(e)){case 1:var r=Rb;break;case 4:r=Ob;break;default:r=qd}n=r.bind(null,e,n,t),r=void 0,!Nu||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(r=!0),s?r!==void 0?t.addEventListener(e,n,{capture:!0,passive:r}):t.addEventListener(e,n,!0):r!==void 0?t.addEventListener(e,n,{passive:r}):t.addEventListener(e,n,!1)}function Ic(t,e,n,s,r){var i=s;if(!(e&1)&&!(e&2)&&s!==null)e:for(;;){if(s===null)return;var o=s.tag;if(o===3||o===4){var a=s.stateNode.containerInfo;if(a===r||a.nodeType===8&&a.parentNode===r)break;if(o===4)for(o=s.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===r||l.nodeType===8&&l.parentNode===r))return;o=o.return}for(;a!==null;){if(o=Is(a),o===null)return;if(l=o.tag,l===5||l===6){s=i=o;continue e}a=a.parentNode}}s=s.return}ex(function(){var c=i,u=Qd(n),f=[];e:{var h=Mx.get(t);if(h!==void 0){var p=Jd,y=t;switch(t){case"keypress":if(Ba(n)===0)break e;case"keydown":case"keyup":p=Kb;break;case"focusin":y="focus",p=Rc;break;case"focusout":y="blur",p=Rc;break;case"beforeblur":case"afterblur":p=Rc;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Th;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=Lb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=qb;break;case Cx:case jx:case Ex:p=Ib;break;case Nx:p=Jb;break;case"scroll":p=Tb;break;case"wheel":p=ew;break;case"copy":case"cut":case"paste":p=Bb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Lh}var m=(e&4)!==0,b=!m&&t==="scroll",x=m?h!==null?h+"Capture":null:h;m=[];for(var g=c,v;g!==null;){v=g;var S=v.stateNode;if(v.tag===5&&S!==null&&(v=S,x!==null&&(S=uo(g,x),S!=null&&m.push(yo(g,S,v)))),b)break;g=g.return}0<m.length&&(h=new p(h,y,null,n,u),f.push({event:h,listeners:m}))}}if(!(e&7)){e:{if(h=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",h&&n!==ju&&(y=n.relatedTarget||n.fromElement)&&(Is(y)||y[Nn]))break e;if((p||h)&&(h=u.window===u?u:(h=u.ownerDocument)?h.defaultView||h.parentWindow:window,p?(y=n.relatedTarget||n.toElement,p=c,y=y?Is(y):null,y!==null&&(b=cr(y),y!==b||y.tag!==5&&y.tag!==6)&&(y=null)):(p=null,y=c),p!==y)){if(m=Th,S="onMouseLeave",x="onMouseEnter",g="mouse",(t==="pointerout"||t==="pointerover")&&(m=Lh,S="onPointerLeave",x="onPointerEnter",g="pointer"),b=p==null?h:_r(p),v=y==null?h:_r(y),h=new m(S,g+"leave",p,n,u),h.target=b,h.relatedTarget=v,S=null,Is(u)===c&&(m=new m(x,g+"enter",y,n,u),m.target=v,m.relatedTarget=b,S=m),b=S,p&&y)t:{for(m=p,x=y,g=0,v=m;v;v=gr(v))g++;for(v=0,S=x;S;S=gr(S))v++;for(;0<g-v;)m=gr(m),g--;for(;0<v-g;)x=gr(x),v--;for(;g--;){if(m===x||x!==null&&m===x.alternate)break t;m=gr(m),x=gr(x)}m=null}else m=null;p!==null&&Qh(f,h,p,m,!1),y!==null&&b!==null&&Qh(f,b,y,m,!0)}}e:{if(h=c?_r(c):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var _=aw;else if(Ih(h))if(bx)_=dw;else{_=cw;var k=lw}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(_=uw);if(_&&(_=_(t,c))){vx(f,_,n,u);break e}k&&k(t,h,c),t==="focusout"&&(k=h._wrapperState)&&k.controlled&&h.type==="number"&&wu(h,"number",h.value)}switch(k=c?_r(c):window,t){case"focusin":(Ih(k)||k.contentEditable==="true")&&(wr=k,Tu=c,Gi=null);break;case"focusout":Gi=Tu=wr=null;break;case"mousedown":Du=!0;break;case"contextmenu":case"mouseup":case"dragend":Du=!1,$h(f,n,u);break;case"selectionchange":if(pw)break;case"keydown":case"keyup":$h(f,n,u)}var j;if(ef)e:{switch(t){case"compositionstart":var E="onCompositionStart";break e;case"compositionend":E="onCompositionEnd";break e;case"compositionupdate":E="onCompositionUpdate";break e}E=void 0}else br?xx(t,n)&&(E="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(E="onCompositionStart");E&&(mx&&n.locale!=="ko"&&(br||E!=="onCompositionStart"?E==="onCompositionEnd"&&br&&(j=gx()):(es=u,Gd="value"in es?es.value:es.textContent,br=!0)),k=al(c,E),0<k.length&&(E=new Dh(E,t,null,n,u),f.push({event:E,listeners:k}),j?E.data=j:(j=yx(n),j!==null&&(E.data=j)))),(j=nw?sw(t,n):rw(t,n))&&(c=al(c,"onBeforeInput"),0<c.length&&(u=new Dh("onBeforeInput","beforeinput",null,n,u),f.push({event:u,listeners:c}),u.data=j))}Px(f,e)})}function yo(t,e,n){return{instance:t,listener:e,currentTarget:n}}function al(t,e){for(var n=e+"Capture",s=[];t!==null;){var r=t,i=r.stateNode;r.tag===5&&i!==null&&(r=i,i=uo(t,n),i!=null&&s.unshift(yo(t,i,r)),i=uo(t,e),i!=null&&s.push(yo(t,i,r))),t=t.return}return s}function gr(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Qh(t,e,n,s,r){for(var i=e._reactName,o=[];n!==null&&n!==s;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===s)break;a.tag===5&&c!==null&&(a=c,r?(l=uo(n,i),l!=null&&o.unshift(yo(n,l,a))):r||(l=uo(n,i),l!=null&&o.push(yo(n,l,a)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var yw=/\r\n?/g,vw=/\u0000|\uFFFD/g;function Kh(t){return(typeof t=="string"?t:""+t).replace(yw,`
|
|
38
|
-
`).replace(vw,"")}function pa(t,e,n){if(e=Kh(e),Kh(t)!==e&&n)throw Error(R(425))}function ll(){}var Lu=null,Au=null;function Fu(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Iu=typeof setTimeout=="function"?setTimeout:void 0,bw=typeof clearTimeout=="function"?clearTimeout:void 0,Yh=typeof Promise=="function"?Promise:void 0,ww=typeof queueMicrotask=="function"?queueMicrotask:typeof Yh<"u"?function(t){return Yh.resolve(null).then(t).catch(Sw)}:Iu;function Sw(t){setTimeout(function(){throw t})}function zc(t,e){var n=e,s=0;do{var r=n.nextSibling;if(t.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(s===0){t.removeChild(r),po(e);return}s--}else n!=="$"&&n!=="$?"&&n!=="$!"||s++;n=r}while(n);po(e)}function us(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function Xh(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var fi=Math.random().toString(36).slice(2),cn="__reactFiber$"+fi,vo="__reactProps$"+fi,Nn="__reactContainer$"+fi,zu="__reactEvents$"+fi,_w="__reactListeners$"+fi,kw="__reactHandles$"+fi;function Is(t){var e=t[cn];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Nn]||n[cn]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=Xh(t);t!==null;){if(n=t[cn])return n;t=Xh(t)}return e}t=n,n=t.parentNode}return null}function Ho(t){return t=t[cn]||t[Nn],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function _r(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(R(33))}function Xl(t){return t[vo]||null}var Bu=[],kr=-1;function Cs(t){return{current:t}}function pe(t){0>kr||(t.current=Bu[kr],Bu[kr]=null,kr--)}function ce(t,e){kr++,Bu[kr]=t.current,t.current=e}var bs={},Xe=Cs(bs),ut=Cs(!1),tr=bs;function ti(t,e){var n=t.type.contextTypes;if(!n)return bs;var s=t.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===e)return s.__reactInternalMemoizedMaskedChildContext;var r={},i;for(i in n)r[i]=e[i];return s&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=r),r}function dt(t){return t=t.childContextTypes,t!=null}function cl(){pe(ut),pe(Xe)}function qh(t,e,n){if(Xe.current!==bs)throw Error(R(168));ce(Xe,e),ce(ut,n)}function Ox(t,e,n){var s=t.stateNode;if(e=e.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var r in s)if(!(r in e))throw Error(R(108,lb(t)||"Unknown",r));return Se({},n,s)}function ul(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||bs,tr=Xe.current,ce(Xe,t),ce(ut,ut.current),!0}function Gh(t,e,n){var s=t.stateNode;if(!s)throw Error(R(169));n?(t=Ox(t,e,tr),s.__reactInternalMemoizedMergedChildContext=t,pe(ut),pe(Xe),ce(Xe,t)):pe(ut),ce(ut,n)}var bn=null,ql=!1,Bc=!1;function Tx(t){bn===null?bn=[t]:bn.push(t)}function Cw(t){ql=!0,Tx(t)}function js(){if(!Bc&&bn!==null){Bc=!0;var t=0,e=ie;try{var n=bn;for(ie=1;t<n.length;t++){var s=n[t];do s=s(!0);while(s!==null)}bn=null,ql=!1}catch(r){throw bn!==null&&(bn=bn.slice(t+1)),rx(Kd,js),r}finally{ie=e,Bc=!1}}return null}var Cr=[],jr=0,dl=null,fl=0,Nt=[],Mt=0,nr=null,_n=1,kn="";function Ls(t,e){Cr[jr++]=fl,Cr[jr++]=dl,dl=t,fl=e}function Dx(t,e,n){Nt[Mt++]=_n,Nt[Mt++]=kn,Nt[Mt++]=nr,nr=t;var s=_n;t=kn;var r=32-$t(s)-1;s&=~(1<<r),n+=1;var i=32-$t(e)+r;if(30<i){var o=r-r%5;i=(s&(1<<o)-1).toString(32),s>>=o,r-=o,_n=1<<32-$t(e)+r|n<<r|s,kn=i+t}else _n=1<<i|n<<r|s,kn=t}function nf(t){t.return!==null&&(Ls(t,1),Dx(t,1,0))}function sf(t){for(;t===dl;)dl=Cr[--jr],Cr[jr]=null,fl=Cr[--jr],Cr[jr]=null;for(;t===nr;)nr=Nt[--Mt],Nt[Mt]=null,kn=Nt[--Mt],Nt[Mt]=null,_n=Nt[--Mt],Nt[Mt]=null}var bt=null,vt=null,me=!1,Wt=null;function Lx(t,e){var n=Pt(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function Jh(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,bt=t,vt=us(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,bt=t,vt=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=nr!==null?{id:_n,overflow:kn}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=Pt(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,bt=t,vt=null,!0):!1;default:return!1}}function Wu(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Uu(t){if(me){var e=vt;if(e){var n=e;if(!Jh(t,e)){if(Wu(t))throw Error(R(418));e=us(n.nextSibling);var s=bt;e&&Jh(t,e)?Lx(s,n):(t.flags=t.flags&-4097|2,me=!1,bt=t)}}else{if(Wu(t))throw Error(R(418));t.flags=t.flags&-4097|2,me=!1,bt=t}}}function Zh(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;bt=t}function ga(t){if(t!==bt)return!1;if(!me)return Zh(t),me=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Fu(t.type,t.memoizedProps)),e&&(e=vt)){if(Wu(t))throw Ax(),Error(R(418));for(;e;)Lx(t,e),e=us(e.nextSibling)}if(Zh(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(R(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){vt=us(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}vt=null}}else vt=bt?us(t.stateNode.nextSibling):null;return!0}function Ax(){for(var t=vt;t;)t=us(t.nextSibling)}function ni(){vt=bt=null,me=!1}function rf(t){Wt===null?Wt=[t]:Wt.push(t)}var jw=On.ReactCurrentBatchConfig;function Ni(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(R(309));var s=n.stateNode}if(!s)throw Error(R(147,t));var r=s,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(o){var a=r.refs;o===null?delete a[i]:a[i]=o},e._stringRef=i,e)}if(typeof t!="string")throw Error(R(284));if(!n._owner)throw Error(R(290,t))}return t}function ma(t,e){throw t=Object.prototype.toString.call(e),Error(R(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function ep(t){var e=t._init;return e(t._payload)}function Fx(t){function e(x,g){if(t){var v=x.deletions;v===null?(x.deletions=[g],x.flags|=16):v.push(g)}}function n(x,g){if(!t)return null;for(;g!==null;)e(x,g),g=g.sibling;return null}function s(x,g){for(x=new Map;g!==null;)g.key!==null?x.set(g.key,g):x.set(g.index,g),g=g.sibling;return x}function r(x,g){return x=ps(x,g),x.index=0,x.sibling=null,x}function i(x,g,v){return x.index=v,t?(v=x.alternate,v!==null?(v=v.index,v<g?(x.flags|=2,g):v):(x.flags|=2,g)):(x.flags|=1048576,g)}function o(x){return t&&x.alternate===null&&(x.flags|=2),x}function a(x,g,v,S){return g===null||g.tag!==6?(g=Kc(v,x.mode,S),g.return=x,g):(g=r(g,v),g.return=x,g)}function l(x,g,v,S){var _=v.type;return _===vr?u(x,g,v.props.children,S,v.key):g!==null&&(g.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Wn&&ep(_)===g.type)?(S=r(g,v.props),S.ref=Ni(x,g,v),S.return=x,S):(S=Ka(v.type,v.key,v.props,null,x.mode,S),S.ref=Ni(x,g,v),S.return=x,S)}function c(x,g,v,S){return g===null||g.tag!==4||g.stateNode.containerInfo!==v.containerInfo||g.stateNode.implementation!==v.implementation?(g=Yc(v,x.mode,S),g.return=x,g):(g=r(g,v.children||[]),g.return=x,g)}function u(x,g,v,S,_){return g===null||g.tag!==7?(g=Zs(v,x.mode,S,_),g.return=x,g):(g=r(g,v),g.return=x,g)}function f(x,g,v){if(typeof g=="string"&&g!==""||typeof g=="number")return g=Kc(""+g,x.mode,v),g.return=x,g;if(typeof g=="object"&&g!==null){switch(g.$$typeof){case ia:return v=Ka(g.type,g.key,g.props,null,x.mode,v),v.ref=Ni(x,null,g),v.return=x,v;case yr:return g=Yc(g,x.mode,v),g.return=x,g;case Wn:var S=g._init;return f(x,S(g._payload),v)}if(Ii(g)||_i(g))return g=Zs(g,x.mode,v,null),g.return=x,g;ma(x,g)}return null}function h(x,g,v,S){var _=g!==null?g.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return _!==null?null:a(x,g,""+v,S);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case ia:return v.key===_?l(x,g,v,S):null;case yr:return v.key===_?c(x,g,v,S):null;case Wn:return _=v._init,h(x,g,_(v._payload),S)}if(Ii(v)||_i(v))return _!==null?null:u(x,g,v,S,null);ma(x,v)}return null}function p(x,g,v,S,_){if(typeof S=="string"&&S!==""||typeof S=="number")return x=x.get(v)||null,a(g,x,""+S,_);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case ia:return x=x.get(S.key===null?v:S.key)||null,l(g,x,S,_);case yr:return x=x.get(S.key===null?v:S.key)||null,c(g,x,S,_);case Wn:var k=S._init;return p(x,g,v,k(S._payload),_)}if(Ii(S)||_i(S))return x=x.get(v)||null,u(g,x,S,_,null);ma(g,S)}return null}function y(x,g,v,S){for(var _=null,k=null,j=g,E=g=0,P=null;j!==null&&E<v.length;E++){j.index>E?(P=j,j=null):P=j.sibling;var M=h(x,j,v[E],S);if(M===null){j===null&&(j=P);break}t&&j&&M.alternate===null&&e(x,j),g=i(M,g,E),k===null?_=M:k.sibling=M,k=M,j=P}if(E===v.length)return n(x,j),me&&Ls(x,E),_;if(j===null){for(;E<v.length;E++)j=f(x,v[E],S),j!==null&&(g=i(j,g,E),k===null?_=j:k.sibling=j,k=j);return me&&Ls(x,E),_}for(j=s(x,j);E<v.length;E++)P=p(j,x,E,v[E],S),P!==null&&(t&&P.alternate!==null&&j.delete(P.key===null?E:P.key),g=i(P,g,E),k===null?_=P:k.sibling=P,k=P);return t&&j.forEach(function(O){return e(x,O)}),me&&Ls(x,E),_}function m(x,g,v,S){var _=_i(v);if(typeof _!="function")throw Error(R(150));if(v=_.call(v),v==null)throw Error(R(151));for(var k=_=null,j=g,E=g=0,P=null,M=v.next();j!==null&&!M.done;E++,M=v.next()){j.index>E?(P=j,j=null):P=j.sibling;var O=h(x,j,M.value,S);if(O===null){j===null&&(j=P);break}t&&j&&O.alternate===null&&e(x,j),g=i(O,g,E),k===null?_=O:k.sibling=O,k=O,j=P}if(M.done)return n(x,j),me&&Ls(x,E),_;if(j===null){for(;!M.done;E++,M=v.next())M=f(x,M.value,S),M!==null&&(g=i(M,g,E),k===null?_=M:k.sibling=M,k=M);return me&&Ls(x,E),_}for(j=s(x,j);!M.done;E++,M=v.next())M=p(j,x,E,M.value,S),M!==null&&(t&&M.alternate!==null&&j.delete(M.key===null?E:M.key),g=i(M,g,E),k===null?_=M:k.sibling=M,k=M);return t&&j.forEach(function(N){return e(x,N)}),me&&Ls(x,E),_}function b(x,g,v,S){if(typeof v=="object"&&v!==null&&v.type===vr&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case ia:e:{for(var _=v.key,k=g;k!==null;){if(k.key===_){if(_=v.type,_===vr){if(k.tag===7){n(x,k.sibling),g=r(k,v.props.children),g.return=x,x=g;break e}}else if(k.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Wn&&ep(_)===k.type){n(x,k.sibling),g=r(k,v.props),g.ref=Ni(x,k,v),g.return=x,x=g;break e}n(x,k);break}else e(x,k);k=k.sibling}v.type===vr?(g=Zs(v.props.children,x.mode,S,v.key),g.return=x,x=g):(S=Ka(v.type,v.key,v.props,null,x.mode,S),S.ref=Ni(x,g,v),S.return=x,x=S)}return o(x);case yr:e:{for(k=v.key;g!==null;){if(g.key===k)if(g.tag===4&&g.stateNode.containerInfo===v.containerInfo&&g.stateNode.implementation===v.implementation){n(x,g.sibling),g=r(g,v.children||[]),g.return=x,x=g;break e}else{n(x,g);break}else e(x,g);g=g.sibling}g=Yc(v,x.mode,S),g.return=x,x=g}return o(x);case Wn:return k=v._init,b(x,g,k(v._payload),S)}if(Ii(v))return y(x,g,v,S);if(_i(v))return m(x,g,v,S);ma(x,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,g!==null&&g.tag===6?(n(x,g.sibling),g=r(g,v),g.return=x,x=g):(n(x,g),g=Kc(v,x.mode,S),g.return=x,x=g),o(x)):n(x,g)}return b}var si=Fx(!0),Ix=Fx(!1),hl=Cs(null),pl=null,Er=null,of=null;function af(){of=Er=pl=null}function lf(t){var e=hl.current;pe(hl),t._currentValue=e}function $u(t,e,n){for(;t!==null;){var s=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,s!==null&&(s.childLanes|=e)):s!==null&&(s.childLanes&e)!==e&&(s.childLanes|=e),t===n)break;t=t.return}}function Lr(t,e){pl=t,of=Er=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(at=!0),t.firstContext=null)}function Ot(t){var e=t._currentValue;if(of!==t)if(t={context:t,memoizedValue:e,next:null},Er===null){if(pl===null)throw Error(R(308));Er=t,pl.dependencies={lanes:0,firstContext:t}}else Er=Er.next=t;return e}var zs=null;function cf(t){zs===null?zs=[t]:zs.push(t)}function zx(t,e,n,s){var r=e.interleaved;return r===null?(n.next=n,cf(e)):(n.next=r.next,r.next=n),e.interleaved=n,Mn(t,s)}function Mn(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Un=!1;function uf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Bx(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function jn(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function ds(t,e,n){var s=t.updateQueue;if(s===null)return null;if(s=s.shared,Z&2){var r=s.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),s.pending=e,Mn(t,n)}return r=s.interleaved,r===null?(e.next=e,cf(s)):(e.next=r.next,r.next=e),s.interleaved=e,Mn(t,n)}function Wa(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var s=e.lanes;s&=t.pendingLanes,n|=s,e.lanes=n,Yd(t,n)}}function tp(t,e){var n=t.updateQueue,s=t.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var r=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?r=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?r=i=e:i=i.next=e}else r=i=e;n={baseState:s.baseState,firstBaseUpdate:r,lastBaseUpdate:i,shared:s.shared,effects:s.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function gl(t,e,n,s){var r=t.updateQueue;Un=!1;var i=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?i=c:o.next=c,o=l;var u=t.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(i!==null){var f=r.baseState;o=0,u=c=l=null,a=i;do{var h=a.lane,p=a.eventTime;if((s&h)===h){u!==null&&(u=u.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=t,m=a;switch(h=e,p=n,m.tag){case 1:if(y=m.payload,typeof y=="function"){f=y.call(p,f,h);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=m.payload,h=typeof y=="function"?y.call(p,f,h):y,h==null)break e;f=Se({},f,h);break e;case 2:Un=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,h=r.effects,h===null?r.effects=[a]:h.push(a))}else p={eventTime:p,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=p,l=f):u=u.next=p,o|=h;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;h=a,a=h.next,h.next=null,r.lastBaseUpdate=h,r.shared.pending=null}}while(!0);if(u===null&&(l=f),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=u,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else i===null&&(r.shared.lanes=0);rr|=o,t.lanes=o,t.memoizedState=f}}function np(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var s=t[e],r=s.callback;if(r!==null){if(s.callback=null,s=n,typeof r!="function")throw Error(R(191,r));r.call(s)}}}var Vo={},dn=Cs(Vo),bo=Cs(Vo),wo=Cs(Vo);function Bs(t){if(t===Vo)throw Error(R(174));return t}function df(t,e){switch(ce(wo,e),ce(bo,t),ce(dn,Vo),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:_u(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=_u(e,t)}pe(dn),ce(dn,e)}function ri(){pe(dn),pe(bo),pe(wo)}function Wx(t){Bs(wo.current);var e=Bs(dn.current),n=_u(e,t.type);e!==n&&(ce(bo,t),ce(dn,n))}function ff(t){bo.current===t&&(pe(dn),pe(bo))}var ve=Cs(0);function ml(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Wc=[];function hf(){for(var t=0;t<Wc.length;t++)Wc[t]._workInProgressVersionPrimary=null;Wc.length=0}var Ua=On.ReactCurrentDispatcher,Uc=On.ReactCurrentBatchConfig,sr=0,we=null,Pe=null,Le=null,xl=!1,Ji=!1,So=0,Ew=0;function Ve(){throw Error(R(321))}function pf(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Vt(t[n],e[n]))return!1;return!0}function gf(t,e,n,s,r,i){if(sr=i,we=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Ua.current=t===null||t.memoizedState===null?Rw:Ow,t=n(s,r),Ji){i=0;do{if(Ji=!1,So=0,25<=i)throw Error(R(301));i+=1,Le=Pe=null,e.updateQueue=null,Ua.current=Tw,t=n(s,r)}while(Ji)}if(Ua.current=yl,e=Pe!==null&&Pe.next!==null,sr=0,Le=Pe=we=null,xl=!1,e)throw Error(R(300));return t}function mf(){var t=So!==0;return So=0,t}function nn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Le===null?we.memoizedState=Le=t:Le=Le.next=t,Le}function Tt(){if(Pe===null){var t=we.alternate;t=t!==null?t.memoizedState:null}else t=Pe.next;var e=Le===null?we.memoizedState:Le.next;if(e!==null)Le=e,Pe=t;else{if(t===null)throw Error(R(310));Pe=t,t={memoizedState:Pe.memoizedState,baseState:Pe.baseState,baseQueue:Pe.baseQueue,queue:Pe.queue,next:null},Le===null?we.memoizedState=Le=t:Le=Le.next=t}return Le}function _o(t,e){return typeof e=="function"?e(t):e}function $c(t){var e=Tt(),n=e.queue;if(n===null)throw Error(R(311));n.lastRenderedReducer=t;var s=Pe,r=s.baseQueue,i=n.pending;if(i!==null){if(r!==null){var o=r.next;r.next=i.next,i.next=o}s.baseQueue=r=i,n.pending=null}if(r!==null){i=r.next,s=s.baseState;var a=o=null,l=null,c=i;do{var u=c.lane;if((sr&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),s=c.hasEagerState?c.eagerState:t(s,c.action);else{var f={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=f,o=s):l=l.next=f,we.lanes|=u,rr|=u}c=c.next}while(c!==null&&c!==i);l===null?o=s:l.next=a,Vt(s,e.memoizedState)||(at=!0),e.memoizedState=s,e.baseState=o,e.baseQueue=l,n.lastRenderedState=s}if(t=n.interleaved,t!==null){r=t;do i=r.lane,we.lanes|=i,rr|=i,r=r.next;while(r!==t)}else r===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Hc(t){var e=Tt(),n=e.queue;if(n===null)throw Error(R(311));n.lastRenderedReducer=t;var s=n.dispatch,r=n.pending,i=e.memoizedState;if(r!==null){n.pending=null;var o=r=r.next;do i=t(i,o.action),o=o.next;while(o!==r);Vt(i,e.memoizedState)||(at=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,s]}function Ux(){}function $x(t,e){var n=we,s=Tt(),r=e(),i=!Vt(s.memoizedState,r);if(i&&(s.memoizedState=r,at=!0),s=s.queue,xf(Qx.bind(null,n,s,t),[t]),s.getSnapshot!==e||i||Le!==null&&Le.memoizedState.tag&1){if(n.flags|=2048,ko(9,Vx.bind(null,n,s,r,e),void 0,null),Ie===null)throw Error(R(349));sr&30||Hx(n,e,r)}return r}function Hx(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=we.updateQueue,e===null?(e={lastEffect:null,stores:null},we.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function Vx(t,e,n,s){e.value=n,e.getSnapshot=s,Kx(e)&&Yx(t)}function Qx(t,e,n){return n(function(){Kx(e)&&Yx(t)})}function Kx(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Vt(t,n)}catch{return!0}}function Yx(t){var e=Mn(t,1);e!==null&&Ht(e,t,1,-1)}function sp(t){var e=nn();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:_o,lastRenderedState:t},e.queue=t,t=t.dispatch=Pw.bind(null,we,t),[e.memoizedState,t]}function ko(t,e,n,s){return t={tag:t,create:e,destroy:n,deps:s,next:null},e=we.updateQueue,e===null?(e={lastEffect:null,stores:null},we.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(s=n.next,n.next=t,t.next=s,e.lastEffect=t)),t}function Xx(){return Tt().memoizedState}function $a(t,e,n,s){var r=nn();we.flags|=t,r.memoizedState=ko(1|e,n,void 0,s===void 0?null:s)}function Gl(t,e,n,s){var r=Tt();s=s===void 0?null:s;var i=void 0;if(Pe!==null){var o=Pe.memoizedState;if(i=o.destroy,s!==null&&pf(s,o.deps)){r.memoizedState=ko(e,n,i,s);return}}we.flags|=t,r.memoizedState=ko(1|e,n,i,s)}function rp(t,e){return $a(8390656,8,t,e)}function xf(t,e){return Gl(2048,8,t,e)}function qx(t,e){return Gl(4,2,t,e)}function Gx(t,e){return Gl(4,4,t,e)}function Jx(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function Zx(t,e,n){return n=n!=null?n.concat([t]):null,Gl(4,4,Jx.bind(null,e,t),n)}function yf(){}function e0(t,e){var n=Tt();e=e===void 0?null:e;var s=n.memoizedState;return s!==null&&e!==null&&pf(e,s[1])?s[0]:(n.memoizedState=[t,e],t)}function t0(t,e){var n=Tt();e=e===void 0?null:e;var s=n.memoizedState;return s!==null&&e!==null&&pf(e,s[1])?s[0]:(t=t(),n.memoizedState=[t,e],t)}function n0(t,e,n){return sr&21?(Vt(n,e)||(n=ax(),we.lanes|=n,rr|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,at=!0),t.memoizedState=n)}function Nw(t,e){var n=ie;ie=n!==0&&4>n?n:4,t(!0);var s=Uc.transition;Uc.transition={};try{t(!1),e()}finally{ie=n,Uc.transition=s}}function s0(){return Tt().memoizedState}function Mw(t,e,n){var s=hs(t);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},r0(t))i0(e,n);else if(n=zx(t,e,n,s),n!==null){var r=Ze();Ht(n,t,s,r),o0(n,e,s)}}function Pw(t,e,n){var s=hs(t),r={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(r0(t))i0(e,r);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var o=e.lastRenderedState,a=i(o,n);if(r.hasEagerState=!0,r.eagerState=a,Vt(a,o)){var l=e.interleaved;l===null?(r.next=r,cf(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}n=zx(t,e,r,s),n!==null&&(r=Ze(),Ht(n,t,s,r),o0(n,e,s))}}function r0(t){var e=t.alternate;return t===we||e!==null&&e===we}function i0(t,e){Ji=xl=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function o0(t,e,n){if(n&4194240){var s=e.lanes;s&=t.pendingLanes,n|=s,e.lanes=n,Yd(t,n)}}var yl={readContext:Ot,useCallback:Ve,useContext:Ve,useEffect:Ve,useImperativeHandle:Ve,useInsertionEffect:Ve,useLayoutEffect:Ve,useMemo:Ve,useReducer:Ve,useRef:Ve,useState:Ve,useDebugValue:Ve,useDeferredValue:Ve,useTransition:Ve,useMutableSource:Ve,useSyncExternalStore:Ve,useId:Ve,unstable_isNewReconciler:!1},Rw={readContext:Ot,useCallback:function(t,e){return nn().memoizedState=[t,e===void 0?null:e],t},useContext:Ot,useEffect:rp,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,$a(4194308,4,Jx.bind(null,e,t),n)},useLayoutEffect:function(t,e){return $a(4194308,4,t,e)},useInsertionEffect:function(t,e){return $a(4,2,t,e)},useMemo:function(t,e){var n=nn();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var s=nn();return e=n!==void 0?n(e):e,s.memoizedState=s.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},s.queue=t,t=t.dispatch=Mw.bind(null,we,t),[s.memoizedState,t]},useRef:function(t){var e=nn();return t={current:t},e.memoizedState=t},useState:sp,useDebugValue:yf,useDeferredValue:function(t){return nn().memoizedState=t},useTransition:function(){var t=sp(!1),e=t[0];return t=Nw.bind(null,t[1]),nn().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var s=we,r=nn();if(me){if(n===void 0)throw Error(R(407));n=n()}else{if(n=e(),Ie===null)throw Error(R(349));sr&30||Hx(s,e,n)}r.memoizedState=n;var i={value:n,getSnapshot:e};return r.queue=i,rp(Qx.bind(null,s,i,t),[t]),s.flags|=2048,ko(9,Vx.bind(null,s,i,n,e),void 0,null),n},useId:function(){var t=nn(),e=Ie.identifierPrefix;if(me){var n=kn,s=_n;n=(s&~(1<<32-$t(s)-1)).toString(32)+n,e=":"+e+"R"+n,n=So++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=Ew++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},Ow={readContext:Ot,useCallback:e0,useContext:Ot,useEffect:xf,useImperativeHandle:Zx,useInsertionEffect:qx,useLayoutEffect:Gx,useMemo:t0,useReducer:$c,useRef:Xx,useState:function(){return $c(_o)},useDebugValue:yf,useDeferredValue:function(t){var e=Tt();return n0(e,Pe.memoizedState,t)},useTransition:function(){var t=$c(_o)[0],e=Tt().memoizedState;return[t,e]},useMutableSource:Ux,useSyncExternalStore:$x,useId:s0,unstable_isNewReconciler:!1},Tw={readContext:Ot,useCallback:e0,useContext:Ot,useEffect:xf,useImperativeHandle:Zx,useInsertionEffect:qx,useLayoutEffect:Gx,useMemo:t0,useReducer:Hc,useRef:Xx,useState:function(){return Hc(_o)},useDebugValue:yf,useDeferredValue:function(t){var e=Tt();return Pe===null?e.memoizedState=t:n0(e,Pe.memoizedState,t)},useTransition:function(){var t=Hc(_o)[0],e=Tt().memoizedState;return[t,e]},useMutableSource:Ux,useSyncExternalStore:$x,useId:s0,unstable_isNewReconciler:!1};function Ft(t,e){if(t&&t.defaultProps){e=Se({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function Hu(t,e,n,s){e=t.memoizedState,n=n(s,e),n=n==null?e:Se({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var Jl={isMounted:function(t){return(t=t._reactInternals)?cr(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var s=Ze(),r=hs(t),i=jn(s,r);i.payload=e,n!=null&&(i.callback=n),e=ds(t,i,r),e!==null&&(Ht(e,t,r,s),Wa(e,t,r))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var s=Ze(),r=hs(t),i=jn(s,r);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=ds(t,i,r),e!==null&&(Ht(e,t,r,s),Wa(e,t,r))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=Ze(),s=hs(t),r=jn(n,s);r.tag=2,e!=null&&(r.callback=e),e=ds(t,r,s),e!==null&&(Ht(e,t,s,n),Wa(e,t,s))}};function ip(t,e,n,s,r,i,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(s,i,o):e.prototype&&e.prototype.isPureReactComponent?!mo(n,s)||!mo(r,i):!0}function a0(t,e,n){var s=!1,r=bs,i=e.contextType;return typeof i=="object"&&i!==null?i=Ot(i):(r=dt(e)?tr:Xe.current,s=e.contextTypes,i=(s=s!=null)?ti(t,r):bs),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Jl,t.stateNode=e,e._reactInternals=t,s&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=r,t.__reactInternalMemoizedMaskedChildContext=i),e}function op(t,e,n,s){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,s),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,s),e.state!==t&&Jl.enqueueReplaceState(e,e.state,null)}function Vu(t,e,n,s){var r=t.stateNode;r.props=n,r.state=t.memoizedState,r.refs={},uf(t);var i=e.contextType;typeof i=="object"&&i!==null?r.context=Ot(i):(i=dt(e)?tr:Xe.current,r.context=ti(t,i)),r.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(Hu(t,e,i,n),r.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(e=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),e!==r.state&&Jl.enqueueReplaceState(r,r.state,null),gl(t,n,r,s),r.state=t.memoizedState),typeof r.componentDidMount=="function"&&(t.flags|=4194308)}function ii(t,e){try{var n="",s=e;do n+=ab(s),s=s.return;while(s);var r=n}catch(i){r=`
|
|
39
|
-
Error generating stack: `+i.message+`
|
|
40
|
-
`+i.stack}return{value:t,source:e,stack:r,digest:null}}function Vc(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function Qu(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var Dw=typeof WeakMap=="function"?WeakMap:Map;function l0(t,e,n){n=jn(-1,n),n.tag=3,n.payload={element:null};var s=e.value;return n.callback=function(){bl||(bl=!0,nd=s),Qu(t,e)},n}function c0(t,e,n){n=jn(-1,n),n.tag=3;var s=t.type.getDerivedStateFromError;if(typeof s=="function"){var r=e.value;n.payload=function(){return s(r)},n.callback=function(){Qu(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Qu(t,e),typeof s!="function"&&(fs===null?fs=new Set([this]):fs.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function ap(t,e,n){var s=t.pingCache;if(s===null){s=t.pingCache=new Dw;var r=new Set;s.set(e,r)}else r=s.get(e),r===void 0&&(r=new Set,s.set(e,r));r.has(n)||(r.add(n),t=Yw.bind(null,t,e,n),e.then(t,t))}function lp(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function cp(t,e,n,s,r){return t.mode&1?(t.flags|=65536,t.lanes=r,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=jn(-1,1),e.tag=2,ds(n,e,1))),n.lanes|=1),t)}var Lw=On.ReactCurrentOwner,at=!1;function Je(t,e,n,s){e.child=t===null?Ix(e,null,n,s):si(e,t.child,n,s)}function up(t,e,n,s,r){n=n.render;var i=e.ref;return Lr(e,r),s=gf(t,e,n,s,i,r),n=mf(),t!==null&&!at?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~r,Pn(t,e,r)):(me&&n&&nf(e),e.flags|=1,Je(t,e,s,r),e.child)}function dp(t,e,n,s,r){if(t===null){var i=n.type;return typeof i=="function"&&!jf(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,u0(t,e,i,s,r)):(t=Ka(n.type,null,s,e,e.mode,r),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&r)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:mo,n(o,s)&&t.ref===e.ref)return Pn(t,e,r)}return e.flags|=1,t=ps(i,s),t.ref=e.ref,t.return=e,e.child=t}function u0(t,e,n,s,r){if(t!==null){var i=t.memoizedProps;if(mo(i,s)&&t.ref===e.ref)if(at=!1,e.pendingProps=s=i,(t.lanes&r)!==0)t.flags&131072&&(at=!0);else return e.lanes=t.lanes,Pn(t,e,r)}return Ku(t,e,n,s,r)}function d0(t,e,n){var s=e.pendingProps,r=s.children,i=t!==null?t.memoizedState:null;if(s.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},ce(Mr,yt),yt|=n;else{if(!(n&1073741824))return t=i!==null?i.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,ce(Mr,yt),yt|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=i!==null?i.baseLanes:n,ce(Mr,yt),yt|=s}else i!==null?(s=i.baseLanes|n,e.memoizedState=null):s=n,ce(Mr,yt),yt|=s;return Je(t,e,r,n),e.child}function f0(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function Ku(t,e,n,s,r){var i=dt(n)?tr:Xe.current;return i=ti(e,i),Lr(e,r),n=gf(t,e,n,s,i,r),s=mf(),t!==null&&!at?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~r,Pn(t,e,r)):(me&&s&&nf(e),e.flags|=1,Je(t,e,n,r),e.child)}function fp(t,e,n,s,r){if(dt(n)){var i=!0;ul(e)}else i=!1;if(Lr(e,r),e.stateNode===null)Ha(t,e),a0(e,n,s),Vu(e,n,s,r),s=!0;else if(t===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,c=n.contextType;typeof c=="object"&&c!==null?c=Ot(c):(c=dt(n)?tr:Xe.current,c=ti(e,c));var u=n.getDerivedStateFromProps,f=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==s||l!==c)&&op(e,o,s,c),Un=!1;var h=e.memoizedState;o.state=h,gl(e,s,o,r),l=e.memoizedState,a!==s||h!==l||ut.current||Un?(typeof u=="function"&&(Hu(e,n,u,s),l=e.memoizedState),(a=Un||ip(e,n,a,s,h,l,c))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=s,e.memoizedState=l),o.props=s,o.state=l,o.context=c,s=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),s=!1)}else{o=e.stateNode,Bx(t,e),a=e.memoizedProps,c=e.type===e.elementType?a:Ft(e.type,a),o.props=c,f=e.pendingProps,h=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=Ot(l):(l=dt(n)?tr:Xe.current,l=ti(e,l));var p=n.getDerivedStateFromProps;(u=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==f||h!==l)&&op(e,o,s,l),Un=!1,h=e.memoizedState,o.state=h,gl(e,s,o,r);var y=e.memoizedState;a!==f||h!==y||ut.current||Un?(typeof p=="function"&&(Hu(e,n,p,s),y=e.memoizedState),(c=Un||ip(e,n,c,s,h,y,l)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(s,y,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(s,y,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),e.memoizedProps=s,e.memoizedState=y),o.props=s,o.state=y,o.context=l,s=c):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),s=!1)}return Yu(t,e,n,s,i,r)}function Yu(t,e,n,s,r,i){f0(t,e);var o=(e.flags&128)!==0;if(!s&&!o)return r&&Gh(e,n,!1),Pn(t,e,i);s=e.stateNode,Lw.current=e;var a=o&&typeof n.getDerivedStateFromError!="function"?null:s.render();return e.flags|=1,t!==null&&o?(e.child=si(e,t.child,null,i),e.child=si(e,null,a,i)):Je(t,e,a,i),e.memoizedState=s.state,r&&Gh(e,n,!0),e.child}function h0(t){var e=t.stateNode;e.pendingContext?qh(t,e.pendingContext,e.pendingContext!==e.context):e.context&&qh(t,e.context,!1),df(t,e.containerInfo)}function hp(t,e,n,s,r){return ni(),rf(r),e.flags|=256,Je(t,e,n,s),e.child}var Xu={dehydrated:null,treeContext:null,retryLane:0};function qu(t){return{baseLanes:t,cachePool:null,transitions:null}}function p0(t,e,n){var s=e.pendingProps,r=ve.current,i=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=t!==null&&t.memoizedState===null?!1:(r&2)!==0),a?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(r|=1),ce(ve,r&1),t===null)return Uu(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=s.children,t=s.fallback,i?(s=e.mode,i=e.child,o={mode:"hidden",children:o},!(s&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=tc(o,s,0,null),t=Zs(t,s,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=qu(n),e.memoizedState=Xu,t):vf(e,o));if(r=t.memoizedState,r!==null&&(a=r.dehydrated,a!==null))return Aw(t,e,o,s,a,r,n);if(i){i=s.fallback,o=e.mode,r=t.child,a=r.sibling;var l={mode:"hidden",children:s.children};return!(o&1)&&e.child!==r?(s=e.child,s.childLanes=0,s.pendingProps=l,e.deletions=null):(s=ps(r,l),s.subtreeFlags=r.subtreeFlags&14680064),a!==null?i=ps(a,i):(i=Zs(i,o,n,null),i.flags|=2),i.return=e,s.return=e,s.sibling=i,e.child=s,s=i,i=e.child,o=t.child.memoizedState,o=o===null?qu(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=t.childLanes&~n,e.memoizedState=Xu,s}return i=t.child,t=i.sibling,s=ps(i,{mode:"visible",children:s.children}),!(e.mode&1)&&(s.lanes=n),s.return=e,s.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=s,e.memoizedState=null,s}function vf(t,e){return e=tc({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function xa(t,e,n,s){return s!==null&&rf(s),si(e,t.child,null,n),t=vf(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function Aw(t,e,n,s,r,i,o){if(n)return e.flags&256?(e.flags&=-257,s=Vc(Error(R(422))),xa(t,e,o,s)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=s.fallback,r=e.mode,s=tc({mode:"visible",children:s.children},r,0,null),i=Zs(i,r,o,null),i.flags|=2,s.return=e,i.return=e,s.sibling=i,e.child=s,e.mode&1&&si(e,t.child,null,o),e.child.memoizedState=qu(o),e.memoizedState=Xu,i);if(!(e.mode&1))return xa(t,e,o,null);if(r.data==="$!"){if(s=r.nextSibling&&r.nextSibling.dataset,s)var a=s.dgst;return s=a,i=Error(R(419)),s=Vc(i,s,void 0),xa(t,e,o,s)}if(a=(o&t.childLanes)!==0,at||a){if(s=Ie,s!==null){switch(o&-o){case 4:r=2;break;case 16:r=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}r=r&(s.suspendedLanes|o)?0:r,r!==0&&r!==i.retryLane&&(i.retryLane=r,Mn(t,r),Ht(s,t,r,-1))}return Cf(),s=Vc(Error(R(421))),xa(t,e,o,s)}return r.data==="$?"?(e.flags|=128,e.child=t.child,e=Xw.bind(null,t),r._reactRetry=e,null):(t=i.treeContext,vt=us(r.nextSibling),bt=e,me=!0,Wt=null,t!==null&&(Nt[Mt++]=_n,Nt[Mt++]=kn,Nt[Mt++]=nr,_n=t.id,kn=t.overflow,nr=e),e=vf(e,s.children),e.flags|=4096,e)}function pp(t,e,n){t.lanes|=e;var s=t.alternate;s!==null&&(s.lanes|=e),$u(t.return,e,n)}function Qc(t,e,n,s,r){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:r}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=s,i.tail=n,i.tailMode=r)}function g0(t,e,n){var s=e.pendingProps,r=s.revealOrder,i=s.tail;if(Je(t,e,s.children,n),s=ve.current,s&2)s=s&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&pp(t,n,e);else if(t.tag===19)pp(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}s&=1}if(ce(ve,s),!(e.mode&1))e.memoizedState=null;else switch(r){case"forwards":for(n=e.child,r=null;n!==null;)t=n.alternate,t!==null&&ml(t)===null&&(r=n),n=n.sibling;n=r,n===null?(r=e.child,e.child=null):(r=n.sibling,n.sibling=null),Qc(e,!1,r,n,i);break;case"backwards":for(n=null,r=e.child,e.child=null;r!==null;){if(t=r.alternate,t!==null&&ml(t)===null){e.child=r;break}t=r.sibling,r.sibling=n,n=r,r=t}Qc(e,!0,n,null,i);break;case"together":Qc(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Ha(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Pn(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),rr|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(R(153));if(e.child!==null){for(t=e.child,n=ps(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=ps(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function Fw(t,e,n){switch(e.tag){case 3:h0(e),ni();break;case 5:Wx(e);break;case 1:dt(e.type)&&ul(e);break;case 4:df(e,e.stateNode.containerInfo);break;case 10:var s=e.type._context,r=e.memoizedProps.value;ce(hl,s._currentValue),s._currentValue=r;break;case 13:if(s=e.memoizedState,s!==null)return s.dehydrated!==null?(ce(ve,ve.current&1),e.flags|=128,null):n&e.child.childLanes?p0(t,e,n):(ce(ve,ve.current&1),t=Pn(t,e,n),t!==null?t.sibling:null);ce(ve,ve.current&1);break;case 19:if(s=(n&e.childLanes)!==0,t.flags&128){if(s)return g0(t,e,n);e.flags|=128}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),ce(ve,ve.current),s)break;return null;case 22:case 23:return e.lanes=0,d0(t,e,n)}return Pn(t,e,n)}var m0,Gu,x0,y0;m0=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Gu=function(){};x0=function(t,e,n,s){var r=t.memoizedProps;if(r!==s){t=e.stateNode,Bs(dn.current);var i=null;switch(n){case"input":r=vu(t,r),s=vu(t,s),i=[];break;case"select":r=Se({},r,{value:void 0}),s=Se({},s,{value:void 0}),i=[];break;case"textarea":r=Su(t,r),s=Su(t,s),i=[];break;default:typeof r.onClick!="function"&&typeof s.onClick=="function"&&(t.onclick=ll)}ku(n,s);var o;n=null;for(c in r)if(!s.hasOwnProperty(c)&&r.hasOwnProperty(c)&&r[c]!=null)if(c==="style"){var a=r[c];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(lo.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in s){var l=s[c];if(a=r!=null?r[c]:void 0,s.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(i||(i=[]),i.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(lo.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&de("scroll",t),i||a===l||(i=[])):(i=i||[]).push(c,l))}n&&(i=i||[]).push("style",n);var c=i;(e.updateQueue=c)&&(e.flags|=4)}};y0=function(t,e,n,s){n!==s&&(e.flags|=4)};function Mi(t,e){if(!me)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:s.sibling=null}}function Qe(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,s=0;if(e)for(var r=t.child;r!==null;)n|=r.lanes|r.childLanes,s|=r.subtreeFlags&14680064,s|=r.flags&14680064,r.return=t,r=r.sibling;else for(r=t.child;r!==null;)n|=r.lanes|r.childLanes,s|=r.subtreeFlags,s|=r.flags,r.return=t,r=r.sibling;return t.subtreeFlags|=s,t.childLanes=n,e}function Iw(t,e,n){var s=e.pendingProps;switch(sf(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qe(e),null;case 1:return dt(e.type)&&cl(),Qe(e),null;case 3:return s=e.stateNode,ri(),pe(ut),pe(Xe),hf(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(t===null||t.child===null)&&(ga(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Wt!==null&&(id(Wt),Wt=null))),Gu(t,e),Qe(e),null;case 5:ff(e);var r=Bs(wo.current);if(n=e.type,t!==null&&e.stateNode!=null)x0(t,e,n,s,r),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!s){if(e.stateNode===null)throw Error(R(166));return Qe(e),null}if(t=Bs(dn.current),ga(e)){s=e.stateNode,n=e.type;var i=e.memoizedProps;switch(s[cn]=e,s[vo]=i,t=(e.mode&1)!==0,n){case"dialog":de("cancel",s),de("close",s);break;case"iframe":case"object":case"embed":de("load",s);break;case"video":case"audio":for(r=0;r<Bi.length;r++)de(Bi[r],s);break;case"source":de("error",s);break;case"img":case"image":case"link":de("error",s),de("load",s);break;case"details":de("toggle",s);break;case"input":_h(s,i),de("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!i.multiple},de("invalid",s);break;case"textarea":Ch(s,i),de("invalid",s)}ku(n,i),r=null;for(var o in i)if(i.hasOwnProperty(o)){var a=i[o];o==="children"?typeof a=="string"?s.textContent!==a&&(i.suppressHydrationWarning!==!0&&pa(s.textContent,a,t),r=["children",a]):typeof a=="number"&&s.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&pa(s.textContent,a,t),r=["children",""+a]):lo.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&de("scroll",s)}switch(n){case"input":oa(s),kh(s,i,!0);break;case"textarea":oa(s),jh(s);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(s.onclick=ll)}s=r,e.updateQueue=s,s!==null&&(e.flags|=4)}else{o=r.nodeType===9?r:r.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Qm(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof s.is=="string"?t=o.createElement(n,{is:s.is}):(t=o.createElement(n),n==="select"&&(o=t,s.multiple?o.multiple=!0:s.size&&(o.size=s.size))):t=o.createElementNS(t,n),t[cn]=e,t[vo]=s,m0(t,e,!1,!1),e.stateNode=t;e:{switch(o=Cu(n,s),n){case"dialog":de("cancel",t),de("close",t),r=s;break;case"iframe":case"object":case"embed":de("load",t),r=s;break;case"video":case"audio":for(r=0;r<Bi.length;r++)de(Bi[r],t);r=s;break;case"source":de("error",t),r=s;break;case"img":case"image":case"link":de("error",t),de("load",t),r=s;break;case"details":de("toggle",t),r=s;break;case"input":_h(t,s),r=vu(t,s),de("invalid",t);break;case"option":r=s;break;case"select":t._wrapperState={wasMultiple:!!s.multiple},r=Se({},s,{value:void 0}),de("invalid",t);break;case"textarea":Ch(t,s),r=Su(t,s),de("invalid",t);break;default:r=s}ku(n,r),a=r;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?Xm(t,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&Km(t,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&co(t,l):typeof l=="number"&&co(t,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(lo.hasOwnProperty(i)?l!=null&&i==="onScroll"&&de("scroll",t):l!=null&&Ud(t,i,l,o))}switch(n){case"input":oa(t),kh(t,s,!1);break;case"textarea":oa(t),jh(t);break;case"option":s.value!=null&&t.setAttribute("value",""+vs(s.value));break;case"select":t.multiple=!!s.multiple,i=s.value,i!=null?Rr(t,!!s.multiple,i,!1):s.defaultValue!=null&&Rr(t,!!s.multiple,s.defaultValue,!0);break;default:typeof r.onClick=="function"&&(t.onclick=ll)}switch(n){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Qe(e),null;case 6:if(t&&e.stateNode!=null)y0(t,e,t.memoizedProps,s);else{if(typeof s!="string"&&e.stateNode===null)throw Error(R(166));if(n=Bs(wo.current),Bs(dn.current),ga(e)){if(s=e.stateNode,n=e.memoizedProps,s[cn]=e,(i=s.nodeValue!==n)&&(t=bt,t!==null))switch(t.tag){case 3:pa(s.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&pa(s.nodeValue,n,(t.mode&1)!==0)}i&&(e.flags|=4)}else s=(n.nodeType===9?n:n.ownerDocument).createTextNode(s),s[cn]=e,e.stateNode=s}return Qe(e),null;case 13:if(pe(ve),s=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(me&&vt!==null&&e.mode&1&&!(e.flags&128))Ax(),ni(),e.flags|=98560,i=!1;else if(i=ga(e),s!==null&&s.dehydrated!==null){if(t===null){if(!i)throw Error(R(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(R(317));i[cn]=e}else ni(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Qe(e),i=!1}else Wt!==null&&(id(Wt),Wt=null),i=!0;if(!i)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(s=s!==null,s!==(t!==null&&t.memoizedState!==null)&&s&&(e.child.flags|=8192,e.mode&1&&(t===null||ve.current&1?Oe===0&&(Oe=3):Cf())),e.updateQueue!==null&&(e.flags|=4),Qe(e),null);case 4:return ri(),Gu(t,e),t===null&&xo(e.stateNode.containerInfo),Qe(e),null;case 10:return lf(e.type._context),Qe(e),null;case 17:return dt(e.type)&&cl(),Qe(e),null;case 19:if(pe(ve),i=e.memoizedState,i===null)return Qe(e),null;if(s=(e.flags&128)!==0,o=i.rendering,o===null)if(s)Mi(i,!1);else{if(Oe!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=ml(t),o!==null){for(e.flags|=128,Mi(i,!1),s=o.updateQueue,s!==null&&(e.updateQueue=s,e.flags|=4),e.subtreeFlags=0,s=n,n=e.child;n!==null;)i=n,t=s,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,t=o.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return ce(ve,ve.current&1|2),e.child}t=t.sibling}i.tail!==null&&Ce()>oi&&(e.flags|=128,s=!0,Mi(i,!1),e.lanes=4194304)}else{if(!s)if(t=ml(o),t!==null){if(e.flags|=128,s=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Mi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!me)return Qe(e),null}else 2*Ce()-i.renderingStartTime>oi&&n!==1073741824&&(e.flags|=128,s=!0,Mi(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(n=i.last,n!==null?n.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Ce(),e.sibling=null,n=ve.current,ce(ve,s?n&1|2:n&1),e):(Qe(e),null);case 22:case 23:return kf(),s=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==s&&(e.flags|=8192),s&&e.mode&1?yt&1073741824&&(Qe(e),e.subtreeFlags&6&&(e.flags|=8192)):Qe(e),null;case 24:return null;case 25:return null}throw Error(R(156,e.tag))}function zw(t,e){switch(sf(e),e.tag){case 1:return dt(e.type)&&cl(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return ri(),pe(ut),pe(Xe),hf(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return ff(e),null;case 13:if(pe(ve),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(R(340));ni()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return pe(ve),null;case 4:return ri(),null;case 10:return lf(e.type._context),null;case 22:case 23:return kf(),null;case 24:return null;default:return null}}var ya=!1,Ye=!1,Bw=typeof WeakSet=="function"?WeakSet:Set,L=null;function Nr(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){_e(t,e,s)}else n.current=null}function Ju(t,e,n){try{n()}catch(s){_e(t,e,s)}}var gp=!1;function Ww(t,e){if(Lu=il,t=_x(),tf(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var r=s.anchorOffset,i=s.focusNode;s=s.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,c=0,u=0,f=t,h=null;t:for(;;){for(var p;f!==n||r!==0&&f.nodeType!==3||(a=o+r),f!==i||s!==0&&f.nodeType!==3||(l=o+s),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===t)break t;if(h===n&&++c===r&&(a=o),h===i&&++u===s&&(l=o),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Au={focusedElem:t,selectionRange:n},il=!1,L=e;L!==null;)if(e=L,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,L=t;else for(;L!==null;){e=L;try{var y=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var m=y.memoizedProps,b=y.memoizedState,x=e.stateNode,g=x.getSnapshotBeforeUpdate(e.elementType===e.type?m:Ft(e.type,m),b);x.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var v=e.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(R(163))}}catch(S){_e(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,L=t;break}L=e.return}return y=gp,gp=!1,y}function Zi(t,e,n){var s=e.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var r=s=s.next;do{if((r.tag&t)===t){var i=r.destroy;r.destroy=void 0,i!==void 0&&Ju(e,n,i)}r=r.next}while(r!==s)}}function Zl(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var s=n.create;n.destroy=s()}n=n.next}while(n!==e)}}function Zu(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function v0(t){var e=t.alternate;e!==null&&(t.alternate=null,v0(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[cn],delete e[vo],delete e[zu],delete e[_w],delete e[kw])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function b0(t){return t.tag===5||t.tag===3||t.tag===4}function mp(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||b0(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function ed(t,e,n){var s=t.tag;if(s===5||s===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=ll));else if(s!==4&&(t=t.child,t!==null))for(ed(t,e,n),t=t.sibling;t!==null;)ed(t,e,n),t=t.sibling}function td(t,e,n){var s=t.tag;if(s===5||s===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(s!==4&&(t=t.child,t!==null))for(td(t,e,n),t=t.sibling;t!==null;)td(t,e,n),t=t.sibling}var Be=null,Bt=!1;function In(t,e,n){for(n=n.child;n!==null;)w0(t,e,n),n=n.sibling}function w0(t,e,n){if(un&&typeof un.onCommitFiberUnmount=="function")try{un.onCommitFiberUnmount(Vl,n)}catch{}switch(n.tag){case 5:Ye||Nr(n,e);case 6:var s=Be,r=Bt;Be=null,In(t,e,n),Be=s,Bt=r,Be!==null&&(Bt?(t=Be,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Be.removeChild(n.stateNode));break;case 18:Be!==null&&(Bt?(t=Be,n=n.stateNode,t.nodeType===8?zc(t.parentNode,n):t.nodeType===1&&zc(t,n),po(t)):zc(Be,n.stateNode));break;case 4:s=Be,r=Bt,Be=n.stateNode.containerInfo,Bt=!0,In(t,e,n),Be=s,Bt=r;break;case 0:case 11:case 14:case 15:if(!Ye&&(s=n.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){r=s=s.next;do{var i=r,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Ju(n,e,o),r=r.next}while(r!==s)}In(t,e,n);break;case 1:if(!Ye&&(Nr(n,e),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(a){_e(n,e,a)}In(t,e,n);break;case 21:In(t,e,n);break;case 22:n.mode&1?(Ye=(s=Ye)||n.memoizedState!==null,In(t,e,n),Ye=s):In(t,e,n);break;default:In(t,e,n)}}function xp(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new Bw),e.forEach(function(s){var r=qw.bind(null,t,s);n.has(s)||(n.add(s),s.then(r,r))})}}function At(t,e){var n=e.deletions;if(n!==null)for(var s=0;s<n.length;s++){var r=n[s];try{var i=t,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:Be=a.stateNode,Bt=!1;break e;case 3:Be=a.stateNode.containerInfo,Bt=!0;break e;case 4:Be=a.stateNode.containerInfo,Bt=!0;break e}a=a.return}if(Be===null)throw Error(R(160));w0(i,o,r),Be=null,Bt=!1;var l=r.alternate;l!==null&&(l.return=null),r.return=null}catch(c){_e(r,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)S0(e,t),e=e.sibling}function S0(t,e){var n=t.alternate,s=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(At(e,t),Gt(t),s&4){try{Zi(3,t,t.return),Zl(3,t)}catch(m){_e(t,t.return,m)}try{Zi(5,t,t.return)}catch(m){_e(t,t.return,m)}}break;case 1:At(e,t),Gt(t),s&512&&n!==null&&Nr(n,n.return);break;case 5:if(At(e,t),Gt(t),s&512&&n!==null&&Nr(n,n.return),t.flags&32){var r=t.stateNode;try{co(r,"")}catch(m){_e(t,t.return,m)}}if(s&4&&(r=t.stateNode,r!=null)){var i=t.memoizedProps,o=n!==null?n.memoizedProps:i,a=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&Hm(r,i),Cu(a,o);var c=Cu(a,i);for(o=0;o<l.length;o+=2){var u=l[o],f=l[o+1];u==="style"?Xm(r,f):u==="dangerouslySetInnerHTML"?Km(r,f):u==="children"?co(r,f):Ud(r,u,f,c)}switch(a){case"input":bu(r,i);break;case"textarea":Vm(r,i);break;case"select":var h=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Rr(r,!!i.multiple,p,!1):h!==!!i.multiple&&(i.defaultValue!=null?Rr(r,!!i.multiple,i.defaultValue,!0):Rr(r,!!i.multiple,i.multiple?[]:"",!1))}r[vo]=i}catch(m){_e(t,t.return,m)}}break;case 6:if(At(e,t),Gt(t),s&4){if(t.stateNode===null)throw Error(R(162));r=t.stateNode,i=t.memoizedProps;try{r.nodeValue=i}catch(m){_e(t,t.return,m)}}break;case 3:if(At(e,t),Gt(t),s&4&&n!==null&&n.memoizedState.isDehydrated)try{po(e.containerInfo)}catch(m){_e(t,t.return,m)}break;case 4:At(e,t),Gt(t);break;case 13:At(e,t),Gt(t),r=t.child,r.flags&8192&&(i=r.memoizedState!==null,r.stateNode.isHidden=i,!i||r.alternate!==null&&r.alternate.memoizedState!==null||(Sf=Ce())),s&4&&xp(t);break;case 22:if(u=n!==null&&n.memoizedState!==null,t.mode&1?(Ye=(c=Ye)||u,At(e,t),Ye=c):At(e,t),Gt(t),s&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!u&&t.mode&1)for(L=t,u=t.child;u!==null;){for(f=L=u;L!==null;){switch(h=L,p=h.child,h.tag){case 0:case 11:case 14:case 15:Zi(4,h,h.return);break;case 1:Nr(h,h.return);var y=h.stateNode;if(typeof y.componentWillUnmount=="function"){s=h,n=h.return;try{e=s,y.props=e.memoizedProps,y.state=e.memoizedState,y.componentWillUnmount()}catch(m){_e(s,n,m)}}break;case 5:Nr(h,h.return);break;case 22:if(h.memoizedState!==null){vp(f);continue}}p!==null?(p.return=h,L=p):vp(f)}u=u.sibling}e:for(u=null,f=t;;){if(f.tag===5){if(u===null){u=f;try{r=f.stateNode,c?(i=r.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=f.stateNode,l=f.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=Ym("display",o))}catch(m){_e(t,t.return,m)}}}else if(f.tag===6){if(u===null)try{f.stateNode.nodeValue=c?"":f.memoizedProps}catch(m){_e(t,t.return,m)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===t)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;u===f&&(u=null),f=f.return}u===f&&(u=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:At(e,t),Gt(t),s&4&&xp(t);break;case 21:break;default:At(e,t),Gt(t)}}function Gt(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(b0(n)){var s=n;break e}n=n.return}throw Error(R(160))}switch(s.tag){case 5:var r=s.stateNode;s.flags&32&&(co(r,""),s.flags&=-33);var i=mp(t);td(t,i,r);break;case 3:case 4:var o=s.stateNode.containerInfo,a=mp(t);ed(t,a,o);break;default:throw Error(R(161))}}catch(l){_e(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function Uw(t,e,n){L=t,_0(t)}function _0(t,e,n){for(var s=(t.mode&1)!==0;L!==null;){var r=L,i=r.child;if(r.tag===22&&s){var o=r.memoizedState!==null||ya;if(!o){var a=r.alternate,l=a!==null&&a.memoizedState!==null||Ye;a=ya;var c=Ye;if(ya=o,(Ye=l)&&!c)for(L=r;L!==null;)o=L,l=o.child,o.tag===22&&o.memoizedState!==null?bp(r):l!==null?(l.return=o,L=l):bp(r);for(;i!==null;)L=i,_0(i),i=i.sibling;L=r,ya=a,Ye=c}yp(t)}else r.subtreeFlags&8772&&i!==null?(i.return=r,L=i):yp(t)}}function yp(t){for(;L!==null;){var e=L;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:Ye||Zl(5,e);break;case 1:var s=e.stateNode;if(e.flags&4&&!Ye)if(n===null)s.componentDidMount();else{var r=e.elementType===e.type?n.memoizedProps:Ft(e.type,n.memoizedProps);s.componentDidUpdate(r,n.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&np(e,i,s);break;case 3:var o=e.updateQueue;if(o!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}np(e,o,n)}break;case 5:var a=e.stateNode;if(n===null&&e.flags&4){n=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var c=e.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var f=u.dehydrated;f!==null&&po(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(R(163))}Ye||e.flags&512&&Zu(e)}catch(h){_e(e,e.return,h)}}if(e===t){L=null;break}if(n=e.sibling,n!==null){n.return=e.return,L=n;break}L=e.return}}function vp(t){for(;L!==null;){var e=L;if(e===t){L=null;break}var n=e.sibling;if(n!==null){n.return=e.return,L=n;break}L=e.return}}function bp(t){for(;L!==null;){var e=L;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{Zl(4,e)}catch(l){_e(e,n,l)}break;case 1:var s=e.stateNode;if(typeof s.componentDidMount=="function"){var r=e.return;try{s.componentDidMount()}catch(l){_e(e,r,l)}}var i=e.return;try{Zu(e)}catch(l){_e(e,i,l)}break;case 5:var o=e.return;try{Zu(e)}catch(l){_e(e,o,l)}}}catch(l){_e(e,e.return,l)}if(e===t){L=null;break}var a=e.sibling;if(a!==null){a.return=e.return,L=a;break}L=e.return}}var $w=Math.ceil,vl=On.ReactCurrentDispatcher,bf=On.ReactCurrentOwner,Rt=On.ReactCurrentBatchConfig,Z=0,Ie=null,Ee=null,Ue=0,yt=0,Mr=Cs(0),Oe=0,Co=null,rr=0,ec=0,wf=0,eo=null,it=null,Sf=0,oi=1/0,vn=null,bl=!1,nd=null,fs=null,va=!1,ts=null,wl=0,to=0,sd=null,Va=-1,Qa=0;function Ze(){return Z&6?Ce():Va!==-1?Va:Va=Ce()}function hs(t){return t.mode&1?Z&2&&Ue!==0?Ue&-Ue:jw.transition!==null?(Qa===0&&(Qa=ax()),Qa):(t=ie,t!==0||(t=window.event,t=t===void 0?16:px(t.type)),t):1}function Ht(t,e,n,s){if(50<to)throw to=0,sd=null,Error(R(185));Uo(t,n,s),(!(Z&2)||t!==Ie)&&(t===Ie&&(!(Z&2)&&(ec|=n),Oe===4&&Vn(t,Ue)),ft(t,s),n===1&&Z===0&&!(e.mode&1)&&(oi=Ce()+500,ql&&js()))}function ft(t,e){var n=t.callbackNode;jb(t,e);var s=rl(t,t===Ie?Ue:0);if(s===0)n!==null&&Mh(n),t.callbackNode=null,t.callbackPriority=0;else if(e=s&-s,t.callbackPriority!==e){if(n!=null&&Mh(n),e===1)t.tag===0?Cw(wp.bind(null,t)):Tx(wp.bind(null,t)),ww(function(){!(Z&6)&&js()}),n=null;else{switch(lx(s)){case 1:n=Kd;break;case 4:n=ix;break;case 16:n=sl;break;case 536870912:n=ox;break;default:n=sl}n=R0(n,k0.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function k0(t,e){if(Va=-1,Qa=0,Z&6)throw Error(R(327));var n=t.callbackNode;if(Ar()&&t.callbackNode!==n)return null;var s=rl(t,t===Ie?Ue:0);if(s===0)return null;if(s&30||s&t.expiredLanes||e)e=Sl(t,s);else{e=s;var r=Z;Z|=2;var i=j0();(Ie!==t||Ue!==e)&&(vn=null,oi=Ce()+500,Js(t,e));do try{Qw();break}catch(a){C0(t,a)}while(!0);af(),vl.current=i,Z=r,Ee!==null?e=0:(Ie=null,Ue=0,e=Oe)}if(e!==0){if(e===2&&(r=Pu(t),r!==0&&(s=r,e=rd(t,r))),e===1)throw n=Co,Js(t,0),Vn(t,s),ft(t,Ce()),n;if(e===6)Vn(t,s);else{if(r=t.current.alternate,!(s&30)&&!Hw(r)&&(e=Sl(t,s),e===2&&(i=Pu(t),i!==0&&(s=i,e=rd(t,i))),e===1))throw n=Co,Js(t,0),Vn(t,s),ft(t,Ce()),n;switch(t.finishedWork=r,t.finishedLanes=s,e){case 0:case 1:throw Error(R(345));case 2:As(t,it,vn);break;case 3:if(Vn(t,s),(s&130023424)===s&&(e=Sf+500-Ce(),10<e)){if(rl(t,0)!==0)break;if(r=t.suspendedLanes,(r&s)!==s){Ze(),t.pingedLanes|=t.suspendedLanes&r;break}t.timeoutHandle=Iu(As.bind(null,t,it,vn),e);break}As(t,it,vn);break;case 4:if(Vn(t,s),(s&4194240)===s)break;for(e=t.eventTimes,r=-1;0<s;){var o=31-$t(s);i=1<<o,o=e[o],o>r&&(r=o),s&=~i}if(s=r,s=Ce()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*$w(s/1960))-s,10<s){t.timeoutHandle=Iu(As.bind(null,t,it,vn),s);break}As(t,it,vn);break;case 5:As(t,it,vn);break;default:throw Error(R(329))}}}return ft(t,Ce()),t.callbackNode===n?k0.bind(null,t):null}function rd(t,e){var n=eo;return t.current.memoizedState.isDehydrated&&(Js(t,e).flags|=256),t=Sl(t,e),t!==2&&(e=it,it=n,e!==null&&id(e)),t}function id(t){it===null?it=t:it.push.apply(it,t)}function Hw(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var s=0;s<n.length;s++){var r=n[s],i=r.getSnapshot;r=r.value;try{if(!Vt(i(),r))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Vn(t,e){for(e&=~wf,e&=~ec,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-$t(e),s=1<<n;t[n]=-1,e&=~s}}function wp(t){if(Z&6)throw Error(R(327));Ar();var e=rl(t,0);if(!(e&1))return ft(t,Ce()),null;var n=Sl(t,e);if(t.tag!==0&&n===2){var s=Pu(t);s!==0&&(e=s,n=rd(t,s))}if(n===1)throw n=Co,Js(t,0),Vn(t,e),ft(t,Ce()),n;if(n===6)throw Error(R(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,As(t,it,vn),ft(t,Ce()),null}function _f(t,e){var n=Z;Z|=1;try{return t(e)}finally{Z=n,Z===0&&(oi=Ce()+500,ql&&js())}}function ir(t){ts!==null&&ts.tag===0&&!(Z&6)&&Ar();var e=Z;Z|=1;var n=Rt.transition,s=ie;try{if(Rt.transition=null,ie=1,t)return t()}finally{ie=s,Rt.transition=n,Z=e,!(Z&6)&&js()}}function kf(){yt=Mr.current,pe(Mr)}function Js(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,bw(n)),Ee!==null)for(n=Ee.return;n!==null;){var s=n;switch(sf(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&cl();break;case 3:ri(),pe(ut),pe(Xe),hf();break;case 5:ff(s);break;case 4:ri();break;case 13:pe(ve);break;case 19:pe(ve);break;case 10:lf(s.type._context);break;case 22:case 23:kf()}n=n.return}if(Ie=t,Ee=t=ps(t.current,null),Ue=yt=e,Oe=0,Co=null,wf=ec=rr=0,it=eo=null,zs!==null){for(e=0;e<zs.length;e++)if(n=zs[e],s=n.interleaved,s!==null){n.interleaved=null;var r=s.next,i=n.pending;if(i!==null){var o=i.next;i.next=r,s.next=o}n.pending=s}zs=null}return t}function C0(t,e){do{var n=Ee;try{if(af(),Ua.current=yl,xl){for(var s=we.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}xl=!1}if(sr=0,Le=Pe=we=null,Ji=!1,So=0,bf.current=null,n===null||n.return===null){Oe=1,Co=e,Ee=null;break}e:{var i=t,o=n.return,a=n,l=e;if(e=Ue,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=a,f=u.tag;if(!(u.mode&1)&&(f===0||f===11||f===15)){var h=u.alternate;h?(u.updateQueue=h.updateQueue,u.memoizedState=h.memoizedState,u.lanes=h.lanes):(u.updateQueue=null,u.memoizedState=null)}var p=lp(o);if(p!==null){p.flags&=-257,cp(p,o,a,i,e),p.mode&1&&ap(i,c,e),e=p,l=c;var y=e.updateQueue;if(y===null){var m=new Set;m.add(l),e.updateQueue=m}else y.add(l);break e}else{if(!(e&1)){ap(i,c,e),Cf();break e}l=Error(R(426))}}else if(me&&a.mode&1){var b=lp(o);if(b!==null){!(b.flags&65536)&&(b.flags|=256),cp(b,o,a,i,e),rf(ii(l,a));break e}}i=l=ii(l,a),Oe!==4&&(Oe=2),eo===null?eo=[i]:eo.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var x=l0(i,l,e);tp(i,x);break e;case 1:a=l;var g=i.type,v=i.stateNode;if(!(i.flags&128)&&(typeof g.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(fs===null||!fs.has(v)))){i.flags|=65536,e&=-e,i.lanes|=e;var S=c0(i,a,e);tp(i,S);break e}}i=i.return}while(i!==null)}N0(n)}catch(_){e=_,Ee===n&&n!==null&&(Ee=n=n.return);continue}break}while(!0)}function j0(){var t=vl.current;return vl.current=yl,t===null?yl:t}function Cf(){(Oe===0||Oe===3||Oe===2)&&(Oe=4),Ie===null||!(rr&268435455)&&!(ec&268435455)||Vn(Ie,Ue)}function Sl(t,e){var n=Z;Z|=2;var s=j0();(Ie!==t||Ue!==e)&&(vn=null,Js(t,e));do try{Vw();break}catch(r){C0(t,r)}while(!0);if(af(),Z=n,vl.current=s,Ee!==null)throw Error(R(261));return Ie=null,Ue=0,Oe}function Vw(){for(;Ee!==null;)E0(Ee)}function Qw(){for(;Ee!==null&&!xb();)E0(Ee)}function E0(t){var e=P0(t.alternate,t,yt);t.memoizedProps=t.pendingProps,e===null?N0(t):Ee=e,bf.current=null}function N0(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=zw(n,e),n!==null){n.flags&=32767,Ee=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Oe=6,Ee=null;return}}else if(n=Iw(n,e,yt),n!==null){Ee=n;return}if(e=e.sibling,e!==null){Ee=e;return}Ee=e=t}while(e!==null);Oe===0&&(Oe=5)}function As(t,e,n){var s=ie,r=Rt.transition;try{Rt.transition=null,ie=1,Kw(t,e,n,s)}finally{Rt.transition=r,ie=s}return null}function Kw(t,e,n,s){do Ar();while(ts!==null);if(Z&6)throw Error(R(327));n=t.finishedWork;var r=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(R(177));t.callbackNode=null,t.callbackPriority=0;var i=n.lanes|n.childLanes;if(Eb(t,i),t===Ie&&(Ee=Ie=null,Ue=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||va||(va=!0,R0(sl,function(){return Ar(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Rt.transition,Rt.transition=null;var o=ie;ie=1;var a=Z;Z|=4,bf.current=null,Ww(t,n),S0(n,t),hw(Au),il=!!Lu,Au=Lu=null,t.current=n,Uw(n),yb(),Z=a,ie=o,Rt.transition=i}else t.current=n;if(va&&(va=!1,ts=t,wl=r),i=t.pendingLanes,i===0&&(fs=null),wb(n.stateNode),ft(t,Ce()),e!==null)for(s=t.onRecoverableError,n=0;n<e.length;n++)r=e[n],s(r.value,{componentStack:r.stack,digest:r.digest});if(bl)throw bl=!1,t=nd,nd=null,t;return wl&1&&t.tag!==0&&Ar(),i=t.pendingLanes,i&1?t===sd?to++:(to=0,sd=t):to=0,js(),null}function Ar(){if(ts!==null){var t=lx(wl),e=Rt.transition,n=ie;try{if(Rt.transition=null,ie=16>t?16:t,ts===null)var s=!1;else{if(t=ts,ts=null,wl=0,Z&6)throw Error(R(331));var r=Z;for(Z|=4,L=t.current;L!==null;){var i=L,o=i.child;if(L.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(L=c;L!==null;){var u=L;switch(u.tag){case 0:case 11:case 15:Zi(8,u,i)}var f=u.child;if(f!==null)f.return=u,L=f;else for(;L!==null;){u=L;var h=u.sibling,p=u.return;if(v0(u),u===c){L=null;break}if(h!==null){h.return=p,L=h;break}L=p}}}var y=i.alternate;if(y!==null){var m=y.child;if(m!==null){y.child=null;do{var b=m.sibling;m.sibling=null,m=b}while(m!==null)}}L=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,L=o;else e:for(;L!==null;){if(i=L,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Zi(9,i,i.return)}var x=i.sibling;if(x!==null){x.return=i.return,L=x;break e}L=i.return}}var g=t.current;for(L=g;L!==null;){o=L;var v=o.child;if(o.subtreeFlags&2064&&v!==null)v.return=o,L=v;else e:for(o=g;L!==null;){if(a=L,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Zl(9,a)}}catch(_){_e(a,a.return,_)}if(a===o){L=null;break e}var S=a.sibling;if(S!==null){S.return=a.return,L=S;break e}L=a.return}}if(Z=r,js(),un&&typeof un.onPostCommitFiberRoot=="function")try{un.onPostCommitFiberRoot(Vl,t)}catch{}s=!0}return s}finally{ie=n,Rt.transition=e}}return!1}function Sp(t,e,n){e=ii(n,e),e=l0(t,e,1),t=ds(t,e,1),e=Ze(),t!==null&&(Uo(t,1,e),ft(t,e))}function _e(t,e,n){if(t.tag===3)Sp(t,t,n);else for(;e!==null;){if(e.tag===3){Sp(e,t,n);break}else if(e.tag===1){var s=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(fs===null||!fs.has(s))){t=ii(n,t),t=c0(e,t,1),e=ds(e,t,1),t=Ze(),e!==null&&(Uo(e,1,t),ft(e,t));break}}e=e.return}}function Yw(t,e,n){var s=t.pingCache;s!==null&&s.delete(e),e=Ze(),t.pingedLanes|=t.suspendedLanes&n,Ie===t&&(Ue&n)===n&&(Oe===4||Oe===3&&(Ue&130023424)===Ue&&500>Ce()-Sf?Js(t,0):wf|=n),ft(t,e)}function M0(t,e){e===0&&(t.mode&1?(e=ca,ca<<=1,!(ca&130023424)&&(ca=4194304)):e=1);var n=Ze();t=Mn(t,e),t!==null&&(Uo(t,e,n),ft(t,n))}function Xw(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),M0(t,n)}function qw(t,e){var n=0;switch(t.tag){case 13:var s=t.stateNode,r=t.memoizedState;r!==null&&(n=r.retryLane);break;case 19:s=t.stateNode;break;default:throw Error(R(314))}s!==null&&s.delete(e),M0(t,n)}var P0;P0=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||ut.current)at=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return at=!1,Fw(t,e,n);at=!!(t.flags&131072)}else at=!1,me&&e.flags&1048576&&Dx(e,fl,e.index);switch(e.lanes=0,e.tag){case 2:var s=e.type;Ha(t,e),t=e.pendingProps;var r=ti(e,Xe.current);Lr(e,n),r=gf(null,e,s,t,r,n);var i=mf();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,dt(s)?(i=!0,ul(e)):i=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,uf(e),r.updater=Jl,e.stateNode=r,r._reactInternals=e,Vu(e,s,t,n),e=Yu(null,e,s,!0,i,n)):(e.tag=0,me&&i&&nf(e),Je(null,e,r,n),e=e.child),e;case 16:s=e.elementType;e:{switch(Ha(t,e),t=e.pendingProps,r=s._init,s=r(s._payload),e.type=s,r=e.tag=Jw(s),t=Ft(s,t),r){case 0:e=Ku(null,e,s,t,n);break e;case 1:e=fp(null,e,s,t,n);break e;case 11:e=up(null,e,s,t,n);break e;case 14:e=dp(null,e,s,Ft(s.type,t),n);break e}throw Error(R(306,s,""))}return e;case 0:return s=e.type,r=e.pendingProps,r=e.elementType===s?r:Ft(s,r),Ku(t,e,s,r,n);case 1:return s=e.type,r=e.pendingProps,r=e.elementType===s?r:Ft(s,r),fp(t,e,s,r,n);case 3:e:{if(h0(e),t===null)throw Error(R(387));s=e.pendingProps,i=e.memoizedState,r=i.element,Bx(t,e),gl(e,s,null,n);var o=e.memoizedState;if(s=o.element,i.isDehydrated)if(i={element:s,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){r=ii(Error(R(423)),e),e=hp(t,e,s,n,r);break e}else if(s!==r){r=ii(Error(R(424)),e),e=hp(t,e,s,n,r);break e}else for(vt=us(e.stateNode.containerInfo.firstChild),bt=e,me=!0,Wt=null,n=Ix(e,null,s,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ni(),s===r){e=Pn(t,e,n);break e}Je(t,e,s,n)}e=e.child}return e;case 5:return Wx(e),t===null&&Uu(e),s=e.type,r=e.pendingProps,i=t!==null?t.memoizedProps:null,o=r.children,Fu(s,r)?o=null:i!==null&&Fu(s,i)&&(e.flags|=32),f0(t,e),Je(t,e,o,n),e.child;case 6:return t===null&&Uu(e),null;case 13:return p0(t,e,n);case 4:return df(e,e.stateNode.containerInfo),s=e.pendingProps,t===null?e.child=si(e,null,s,n):Je(t,e,s,n),e.child;case 11:return s=e.type,r=e.pendingProps,r=e.elementType===s?r:Ft(s,r),up(t,e,s,r,n);case 7:return Je(t,e,e.pendingProps,n),e.child;case 8:return Je(t,e,e.pendingProps.children,n),e.child;case 12:return Je(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(s=e.type._context,r=e.pendingProps,i=e.memoizedProps,o=r.value,ce(hl,s._currentValue),s._currentValue=o,i!==null)if(Vt(i.value,o)){if(i.children===r.children&&!ut.current){e=Pn(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var l=a.firstContext;l!==null;){if(l.context===s){if(i.tag===1){l=jn(-1,n&-n),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),$u(i.return,n,e),a.lanes|=n;break}l=l.next}}else if(i.tag===10)o=i.type===e.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(R(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),$u(o,n,e),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}Je(t,e,r.children,n),e=e.child}return e;case 9:return r=e.type,s=e.pendingProps.children,Lr(e,n),r=Ot(r),s=s(r),e.flags|=1,Je(t,e,s,n),e.child;case 14:return s=e.type,r=Ft(s,e.pendingProps),r=Ft(s.type,r),dp(t,e,s,r,n);case 15:return u0(t,e,e.type,e.pendingProps,n);case 17:return s=e.type,r=e.pendingProps,r=e.elementType===s?r:Ft(s,r),Ha(t,e),e.tag=1,dt(s)?(t=!0,ul(e)):t=!1,Lr(e,n),a0(e,s,r),Vu(e,s,r,n),Yu(null,e,s,!0,t,n);case 19:return g0(t,e,n);case 22:return d0(t,e,n)}throw Error(R(156,e.tag))};function R0(t,e){return rx(t,e)}function Gw(t,e,n,s){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pt(t,e,n,s){return new Gw(t,e,n,s)}function jf(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Jw(t){if(typeof t=="function")return jf(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Hd)return 11;if(t===Vd)return 14}return 2}function ps(t,e){var n=t.alternate;return n===null?(n=Pt(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Ka(t,e,n,s,r,i){var o=2;if(s=t,typeof t=="function")jf(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case vr:return Zs(n.children,r,i,e);case $d:o=8,r|=8;break;case gu:return t=Pt(12,n,e,r|2),t.elementType=gu,t.lanes=i,t;case mu:return t=Pt(13,n,e,r),t.elementType=mu,t.lanes=i,t;case xu:return t=Pt(19,n,e,r),t.elementType=xu,t.lanes=i,t;case Wm:return tc(n,r,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case zm:o=10;break e;case Bm:o=9;break e;case Hd:o=11;break e;case Vd:o=14;break e;case Wn:o=16,s=null;break e}throw Error(R(130,t==null?t:typeof t,""))}return e=Pt(o,n,e,r),e.elementType=t,e.type=s,e.lanes=i,e}function Zs(t,e,n,s){return t=Pt(7,t,s,e),t.lanes=n,t}function tc(t,e,n,s){return t=Pt(22,t,s,e),t.elementType=Wm,t.lanes=n,t.stateNode={isHidden:!1},t}function Kc(t,e,n){return t=Pt(6,t,null,e),t.lanes=n,t}function Yc(t,e,n){return e=Pt(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Zw(t,e,n,s,r){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Nc(0),this.expirationTimes=Nc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nc(0),this.identifierPrefix=s,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Ef(t,e,n,s,r,i,o,a,l){return t=new Zw(t,e,n,a,l),e===1?(e=1,i===!0&&(e|=8)):e=0,i=Pt(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},uf(i),t}function eS(t,e,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:yr,key:s==null?null:""+s,children:t,containerInfo:e,implementation:n}}function O0(t){if(!t)return bs;t=t._reactInternals;e:{if(cr(t)!==t||t.tag!==1)throw Error(R(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(dt(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(R(171))}if(t.tag===1){var n=t.type;if(dt(n))return Ox(t,n,e)}return e}function T0(t,e,n,s,r,i,o,a,l){return t=Ef(n,s,!0,t,r,i,o,a,l),t.context=O0(null),n=t.current,s=Ze(),r=hs(n),i=jn(s,r),i.callback=e??null,ds(n,i,r),t.current.lanes=r,Uo(t,r,s),ft(t,s),t}function nc(t,e,n,s){var r=e.current,i=Ze(),o=hs(r);return n=O0(n),e.context===null?e.context=n:e.pendingContext=n,e=jn(i,o),e.payload={element:t},s=s===void 0?null:s,s!==null&&(e.callback=s),t=ds(r,e,o),t!==null&&(Ht(t,r,o,i),Wa(t,r,o)),o}function _l(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function _p(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function Nf(t,e){_p(t,e),(t=t.alternate)&&_p(t,e)}function tS(){return null}var D0=typeof reportError=="function"?reportError:function(t){console.error(t)};function Mf(t){this._internalRoot=t}sc.prototype.render=Mf.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(R(409));nc(t,e,null,null)};sc.prototype.unmount=Mf.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;ir(function(){nc(null,t,null,null)}),e[Nn]=null}};function sc(t){this._internalRoot=t}sc.prototype.unstable_scheduleHydration=function(t){if(t){var e=dx();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Hn.length&&e!==0&&e<Hn[n].priority;n++);Hn.splice(n,0,t),n===0&&hx(t)}};function Pf(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function rc(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function kp(){}function nS(t,e,n,s,r){if(r){if(typeof s=="function"){var i=s;s=function(){var c=_l(o);i.call(c)}}var o=T0(e,s,t,0,null,!1,!1,"",kp);return t._reactRootContainer=o,t[Nn]=o.current,xo(t.nodeType===8?t.parentNode:t),ir(),o}for(;r=t.lastChild;)t.removeChild(r);if(typeof s=="function"){var a=s;s=function(){var c=_l(l);a.call(c)}}var l=Ef(t,0,!1,null,null,!1,!1,"",kp);return t._reactRootContainer=l,t[Nn]=l.current,xo(t.nodeType===8?t.parentNode:t),ir(function(){nc(e,l,n,s)}),l}function ic(t,e,n,s,r){var i=n._reactRootContainer;if(i){var o=i;if(typeof r=="function"){var a=r;r=function(){var l=_l(o);a.call(l)}}nc(e,o,t,r)}else o=nS(n,e,t,r,s);return _l(o)}cx=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=zi(e.pendingLanes);n!==0&&(Yd(e,n|1),ft(e,Ce()),!(Z&6)&&(oi=Ce()+500,js()))}break;case 13:ir(function(){var s=Mn(t,1);if(s!==null){var r=Ze();Ht(s,t,1,r)}}),Nf(t,1)}};Xd=function(t){if(t.tag===13){var e=Mn(t,134217728);if(e!==null){var n=Ze();Ht(e,t,134217728,n)}Nf(t,134217728)}};ux=function(t){if(t.tag===13){var e=hs(t),n=Mn(t,e);if(n!==null){var s=Ze();Ht(n,t,e,s)}Nf(t,e)}};dx=function(){return ie};fx=function(t,e){var n=ie;try{return ie=t,e()}finally{ie=n}};Eu=function(t,e,n){switch(e){case"input":if(bu(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var s=n[e];if(s!==t&&s.form===t.form){var r=Xl(s);if(!r)throw Error(R(90));$m(s),bu(s,r)}}}break;case"textarea":Vm(t,n);break;case"select":e=n.value,e!=null&&Rr(t,!!n.multiple,e,!1)}};Jm=_f;Zm=ir;var sS={usingClientEntryPoint:!1,Events:[Ho,_r,Xl,qm,Gm,_f]},Pi={findFiberByHostInstance:Is,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},rS={bundleType:Pi.bundleType,version:Pi.version,rendererPackageName:Pi.rendererPackageName,rendererConfig:Pi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:On.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=nx(t),t===null?null:t.stateNode},findFiberByHostInstance:Pi.findFiberByHostInstance||tS,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ba=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ba.isDisabled&&ba.supportsFiber)try{Vl=ba.inject(rS),un=ba}catch{}}St.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=sS;St.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Pf(e))throw Error(R(200));return eS(t,e,null,n)};St.createRoot=function(t,e){if(!Pf(t))throw Error(R(299));var n=!1,s="",r=D0;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(s=e.identifierPrefix),e.onRecoverableError!==void 0&&(r=e.onRecoverableError)),e=Ef(t,1,!1,null,null,n,!1,s,r),t[Nn]=e.current,xo(t.nodeType===8?t.parentNode:t),new Mf(e)};St.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(R(188)):(t=Object.keys(t).join(","),Error(R(268,t)));return t=nx(e),t=t===null?null:t.stateNode,t};St.flushSync=function(t){return ir(t)};St.hydrate=function(t,e,n){if(!rc(e))throw Error(R(200));return ic(null,t,e,!0,n)};St.hydrateRoot=function(t,e,n){if(!Pf(t))throw Error(R(405));var s=n!=null&&n.hydratedSources||null,r=!1,i="",o=D0;if(n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=T0(e,null,t,1,n??null,r,!1,i,o),t[Nn]=e.current,xo(t),s)for(t=0;t<s.length;t++)n=s[t],r=n._getVersion,r=r(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,r]:e.mutableSourceEagerHydrationData.push(n,r);return new sc(e)};St.render=function(t,e,n){if(!rc(e))throw Error(R(200));return ic(null,t,e,!1,n)};St.unmountComponentAtNode=function(t){if(!rc(t))throw Error(R(40));return t._reactRootContainer?(ir(function(){ic(null,null,t,!1,function(){t._reactRootContainer=null,t[Nn]=null})}),!0):!1};St.unstable_batchedUpdates=_f;St.unstable_renderSubtreeIntoContainer=function(t,e,n,s){if(!rc(n))throw Error(R(200));if(t==null||t._reactInternals===void 0)throw Error(R(38));return ic(t,e,n,!1,s)};St.version="18.3.1-next-f1338f8080-20240426";function L0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(L0)}catch(t){console.error(t)}}L0(),Lm.exports=St;var Pr=Lm.exports,Cp=Pr;hu.createRoot=Cp.createRoot,hu.hydrateRoot=Cp.hydrateRoot;const A0=w.createContext(void 0),iS=t=>{const e=w.useContext(A0);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},oS=({client:t,children:e})=>(w.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),d.jsx(A0.Provider,{value:t,children:e})),aS={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)};var Qn,Ld,pm,lS=(pm=class{constructor(){z(this,Qn,aS);z(this,Ld,!1)}setTimeoutProvider(t){D(this,Qn,t)}setTimeout(t,e){return C(this,Qn).setTimeout(t,e)}clearTimeout(t){C(this,Qn).clearTimeout(t)}setInterval(t,e){return C(this,Qn).setInterval(t,e)}clearInterval(t){C(this,Qn).clearInterval(t)}},Qn=new WeakMap,Ld=new WeakMap,pm);const Ws=new lS;function cS(t){setTimeout(t,0)}const uS=typeof window>"u"||"Deno"in globalThis;function rt(){}function dS(t,e){return typeof t=="function"?t(e):t}function F0(t){return typeof t=="number"&&t>=0&&t!==1/0}function I0(t,e){return Math.max(t+(e||0)-Date.now(),0)}function ge(t,e){return typeof t=="function"?t(e):t}function jp(t,e){const{type:n="all",exact:s,fetchStatus:r,predicate:i,queryKey:o,stale:a}=t;if(o){if(s){if(e.queryHash!==Rf(o,e.options))return!1}else if(!ai(e.queryKey,o))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||r&&r!==e.state.fetchStatus||i&&!i(e))}function Ep(t,e){const{exact:n,status:s,predicate:r,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(n){if(jo(e.options.mutationKey)!==jo(i))return!1}else if(!ai(e.options.mutationKey,i))return!1}return!(s&&e.state.status!==s||r&&!r(e))}function Rf(t,e){return((e==null?void 0:e.queryKeyHashFn)||jo)(t)}function jo(t){return JSON.stringify(t,(e,n)=>od(n)?Object.keys(n).sort().reduce((s,r)=>(s[r]=n[r],s),{}):n)}function ai(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(Array.isArray(t)&&Array.isArray(e)){if(e.length>t.length)return!1;for(let s=0;s<e.length;s++)if(!ai(t[s],e[s]))return!1;return!0}const n=Object.keys(e);for(const s of n)if(!ai(t[s],e[s]))return!1;return!0}return!1}const fS=Object.prototype.hasOwnProperty;function z0(t,e,n=0){if(t===e)return t;if(n>500)return e;const s=Np(t)&&Np(e);if(!s&&!(od(t)&&od(e)))return e;const r=(s?t:Object.keys(t)).length,i=s?e:Object.keys(e),o=i.length,a=s?new Array(o):{};let l=0;for(let c=0;c<o;c++){const u=s?c:i[c],f=t[u],h=e[u];if(f===h){a[u]=f,(s?c<r:fS.call(t,u))&&l++;continue}if(f===null||h===null||typeof f!="object"||typeof h!="object"){a[u]=h;continue}const p=z0(f,h,n+1);a[u]=p,p===f&&l++}return r===o&&l===r?t:a}function Xc(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function Np(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function od(t){if(!Mp(t))return!1;const e=Object.getPrototypeOf(t),n=e==null?void 0:e.constructor;if(n===void 0)return!0;if(typeof n!="function")return!1;const s=n.prototype;return!(!Mp(s)||!s.hasOwnProperty("isPrototypeOf")||e!==Object.prototype)}function Mp(t){return Object.prototype.toString.call(t)==="[object Object]"}function hS(t){return new Promise(e=>{Ws.setTimeout(e,t)})}function ad(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?z0(t,e):e}function pS(t,e,n=0){const s=[...t,e];return n&&s.length>n?s.slice(1):s}function gS(t,e,n=0){const s=[e,...t];return n&&s.length>n?s.slice(0,-1):s}const Of=Symbol();function B0(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Of?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function W0(t,e){return typeof t=="function"?t(...e):!!t}function mS(t,e,n){let s=!1,r;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(r??(r=e()),s||(s=!0,r.aborted?n():r.addEventListener("abort",n,{once:!0})),r)}),t}let xS=()=>uS;const Tf=()=>xS();var Qo=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},$s,Kn,Wr,gm,yS=(gm=class extends Qo{constructor(){super();z(this,$s);z(this,Kn);z(this,Wr);D(this,Wr,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){C(this,Kn)||this.setEventListener(C(this,Wr))}onUnsubscribe(){var e;this.hasListeners()||((e=C(this,Kn))==null||e.call(this),D(this,Kn,void 0))}setEventListener(e){var n;D(this,Wr,e),(n=C(this,Kn))==null||n.call(this),D(this,Kn,e(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(e){C(this,$s)!==e&&(D(this,$s,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof C(this,$s)=="boolean"?C(this,$s):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},$s=new WeakMap,Kn=new WeakMap,Wr=new WeakMap,gm);const Df=new yS,vS=cS;function bS(){let t=[],e=0,n=a=>{a()},s=a=>{a()},r=vS;const i=a=>{e?t.push(a):r(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&r(()=>{s(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{s=a},setScheduler:a=>{r=a}}}const We=bS();var Ur,Yn,$r,mm,wS=(mm=class extends Qo{constructor(){super();z(this,Ur,!0);z(this,Yn);z(this,$r);D(this,$r,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e(!0),s=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",s)}}})}onSubscribe(){C(this,Yn)||this.setEventListener(C(this,$r))}onUnsubscribe(){var e;this.hasListeners()||((e=C(this,Yn))==null||e.call(this),D(this,Yn,void 0))}setEventListener(e){var n;D(this,$r,e),(n=C(this,Yn))==null||n.call(this),D(this,Yn,e(this.setOnline.bind(this)))}setOnline(e){C(this,Ur)!==e&&(D(this,Ur,e),this.listeners.forEach(n=>{n(e)}))}isOnline(){return C(this,Ur)}},Ur=new WeakMap,Yn=new WeakMap,$r=new WeakMap,mm);const kl=new wS;function SS(t){return Math.min(1e3*2**t,3e4)}function U0(t){return(t??"online")==="online"?kl.isOnline():!0}var ld=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function $0(t){let e=!1,n=0,s,r="pending",i,o;const a=new Promise((g,v)=>{i=g,o=v});a.catch(rt);const l=()=>r!=="pending",c=g=>{var v;if(!l()){const S=new ld(g);m(S),(v=t.onCancel)==null||v.call(t,S)}},u=()=>{e=!0},f=()=>{e=!1},h=()=>Df.isFocused()&&(t.networkMode==="always"||kl.isOnline())&&t.canRun(),p=()=>U0(t.networkMode)&&t.canRun(),y=g=>{l()||(s==null||s(),r="resolved",i(g))},m=g=>{l()||(s==null||s(),r="rejected",o(g))},b=g=>new Promise(v=>{var S;s=_=>{(l()||g())&&v(_)},(S=t.onPause)==null||S.call(t)}).then(()=>{var v;s=void 0,l()||(v=t.onContinue)==null||v.call(t)}),x=()=>{if(l())return;let g;const v=n===0?t.initialPromise:void 0;try{g=v??t.fn()}catch(S){g=Promise.reject(S)}Promise.resolve(g).then(y).catch(S=>{var P;if(l())return;const _=t.retry??(Tf()?0:3),k=t.retryDelay??SS,j=typeof k=="function"?k(n,S):k,E=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,S);if(e||!E){m(S);return}n++,(P=t.onFail)==null||P.call(t,n,S),hS(j).then(()=>h()?void 0:b(h)).then(()=>{e?m(S):x()})})};return{promise:a,status:()=>r,cancel:c,continue:()=>(s==null||s(),a),cancelRetry:u,continueRetry:f,canStart:p,start:()=>(p()?x():b(p).then(x),a)}}var Hs,xm,H0=(xm=class{constructor(){z(this,Hs)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),F0(this.gcTime)&&D(this,Hs,Ws.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Tf()?1/0:3e5))}clearGcTimeout(){C(this,Hs)!==void 0&&(Ws.clearTimeout(C(this,Hs)),D(this,Hs,void 0))}},Hs=new WeakMap,xm);function _S(t){return{onFetch:(e,n)=>{var u,f,h,p,y;const s=e.options,r=(h=(f=(u=e.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,i=((p=e.state.data)==null?void 0:p.pages)||[],o=((y=e.state.data)==null?void 0:y.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let m=!1;const b=v=>{mS(v,()=>e.signal,()=>m=!0)},x=B0(e.options,e.fetchOptions),g=async(v,S,_)=>{if(m)return Promise.reject(e.signal.reason);if(S==null&&v.pages.length)return Promise.resolve(v);const j=(()=>{const O={client:e.client,queryKey:e.queryKey,pageParam:S,direction:_?"backward":"forward",meta:e.options.meta};return b(O),O})(),E=await x(j),{maxPages:P}=e.options,M=_?gS:pS;return{pages:M(v.pages,E,P),pageParams:M(v.pageParams,S,P)}};if(r&&i.length){const v=r==="backward",S=v?kS:Pp,_={pages:i,pageParams:o};a=await g(_,S(s,_),v)}else{const v=t??i.length;do{const S=l===0?o[0]===void 0?s.initialPageParam:o[0]:Pp(s,a);if(l>0&&S==null)break;a=await g(a,S),l++}while(l<v)}return a};e.options.persister?e.fetchFn=()=>{var m,b;return(b=(m=e.options).persister)==null?void 0:b.call(m,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=c}}}function Pp(t,{pages:e,pageParams:n}){const s=e.length-1;return e.length>0?t.getNextPageParam(e[s],e,n[s],n):void 0}function kS(t,{pages:e,pageParams:n}){var s;return e.length>0?(s=t.getPreviousPageParam)==null?void 0:s.call(t,e[0],e,n[0],n):void 0}var Hr,Vs,Vr,jt,Qs,Me,Ao,Ks,It,mn,ym,CS=(ym=class extends H0{constructor(e){super();z(this,It);z(this,Hr);z(this,Vs);z(this,Vr);z(this,jt);z(this,Qs);z(this,Me);z(this,Ao);z(this,Ks);D(this,Ks,!1),D(this,Ao,e.defaultOptions),this.setOptions(e.options),this.observers=[],D(this,Qs,e.client),D(this,jt,C(this,Qs).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,D(this,Vs,Op(this.options)),this.state=e.state??C(this,Vs),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return C(this,Hr)}get promise(){var e;return(e=C(this,Me))==null?void 0:e.promise}setOptions(e){if(this.options={...C(this,Ao),...e},e!=null&&e._type&&D(this,Hr,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Op(this.options);n.data!==void 0&&(this.setState(Rp(n.data,n.dataUpdatedAt)),D(this,Vs,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&C(this,jt).remove(this)}setData(e,n){const s=ad(this.state.data,e,this.options);return X(this,It,mn).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(e){X(this,It,mn).call(this,{type:"setState",state:e})}cancel(e){var s,r;const n=(s=C(this,Me))==null?void 0:s.promise;return(r=C(this,Me))==null||r.cancel(e),n?n.then(rt).catch(rt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return C(this,Vs)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>ge(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Of||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>ge(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!I0(this.state.dataUpdatedAt,e)}onFocus(){var e,n;(e=this.observers.find(s=>s.shouldFetchOnWindowFocus()))==null||e.refetch({cancelRefetch:!1}),(n=C(this,Me))==null||n.continue()}onOnline(){var e,n;(e=this.observers.find(s=>s.shouldFetchOnReconnect()))==null||e.refetch({cancelRefetch:!1}),(n=C(this,Me))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),C(this,jt).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){const n=this.observers.indexOf(e);n!==-1&&(this.observers.splice(n,1),this.observers.length||(C(this,Me)&&(C(this,Ks)||this.state.fetchStatus==="paused"&&this.state.status==="pending"?C(this,Me).cancel({revert:!0}):C(this,Me).cancelRetry()),this.scheduleGc()),C(this,jt).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||X(this,It,mn).call(this,{type:"invalidate"})}async fetch(e,n){var c,u,f,h,p,y,m,b,x,g,v,S;if(this.state.fetchStatus!=="idle"&&((c=C(this,Me))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(C(this,Me))return C(this,Me).continueRetry(),C(this,Me).promise}if(e&&this.setOptions(e),!this.options.queryFn){const _=this.observers.find(k=>k.options.queryFn);_&&this.setOptions(_.options)}const s=new AbortController,r=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(D(this,Ks,!0),s.signal)})},i=()=>{const _=B0(this.options,n),j=(()=>{const E={client:C(this,Qs),queryKey:this.queryKey,meta:this.meta};return r(E),E})();return D(this,Ks,!1),this.options.persister?this.options.persister(_,j,this):_(j)},a=(()=>{const _={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:C(this,Qs),state:this.state,fetchFn:i};return r(_),_})();(u=C(this,Hr)==="infinite"?_S(this.options.pages):this.options.behavior)==null||u.onFetch(a,this),D(this,Vr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&X(this,It,mn).call(this,{type:"fetch",meta:(h=a.fetchOptions)==null?void 0:h.meta});const l=D(this,Me,$0({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:_=>{_ instanceof ld&&_.revert&&this.setState({...C(this,Vr),fetchStatus:"idle"}),s.abort()},onFail:(_,k)=>{X(this,It,mn).call(this,{type:"failed",failureCount:_,error:k})},onPause:()=>{X(this,It,mn).call(this,{type:"pause"})},onContinue:()=>{X(this,It,mn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const _=await l.start();if(_===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(_),(y=(p=C(this,jt).config).onSuccess)==null||y.call(p,_,this),(b=(m=C(this,jt).config).onSettled)==null||b.call(m,_,this.state.error,this),_}catch(_){if(_ instanceof ld){if(_.silent)return C(this,Me).promise;if(_.revert){if(this.state.data===void 0)throw _;return this.state.data}}throw X(this,It,mn).call(this,{type:"error",error:_}),(g=(x=C(this,jt).config).onError)==null||g.call(x,_,this),(S=(v=C(this,jt).config).onSettled)==null||S.call(v,this.state.data,_,this),_}finally{C(this,Me)===l&&D(this,Me,void 0),this.scheduleGc()}}},Hr=new WeakMap,Vs=new WeakMap,Vr=new WeakMap,jt=new WeakMap,Qs=new WeakMap,Me=new WeakMap,Ao=new WeakMap,Ks=new WeakMap,It=new WeakSet,mn=function(e){const n=s=>{switch(e.type){case"failed":return{...s,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...V0(s.data,this.options),fetchMeta:e.meta??null};case"success":const r={...s,...Rp(e.data,e.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return D(this,Vr,e.manual?r:void 0),r;case"error":const i=e.error;return{...s,error:i,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...e.state}}};this.state=n(this.state),We.batch(()=>{this.observers.slice().forEach(s=>{s.onQueryUpdate()}),C(this,jt).notify({query:this,type:"updated",action:e})})},ym);function V0(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:U0(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Rp(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Op(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,s=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var qe,q,Fo,Ge,Ys,Qr,Sn,Io,Kr,Yr,Xs,qs,Xn,Xr,ne,Wi,cd,ud,dd,fd,hd,pd,gd,md,vm,jS=(vm=class extends Qo{constructor(e,n){super();z(this,ne);z(this,qe);z(this,q);z(this,Fo);z(this,Ge);z(this,Ys);z(this,Qr);z(this,Sn);z(this,Io);z(this,Kr);z(this,Yr);z(this,Xs);z(this,qs);z(this,Xn);z(this,Xr,new Set);this.options=n,D(this,qe,e),D(this,Sn,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(C(this,q).addObserver(this),Tp(C(this,q),this.options)?X(this,ne,Wi).call(this):this.updateResult(),X(this,ne,hd).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return xd(C(this,q),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return xd(C(this,q),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,X(this,ne,pd).call(this),X(this,ne,gd).call(this),C(this,q).removeObserver(this)}setOptions(e){const n=this.options,s=C(this,q);if(this.options=C(this,qe).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ge(this.options.enabled,C(this,q))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");X(this,ne,md).call(this),C(this,q).setOptions(this.options),n._defaulted&&!Xc(this.options,n)&&C(this,qe).getQueryCache().notify({type:"observerOptionsUpdated",query:C(this,q),observer:this});const r=this.hasListeners();r&&Dp(C(this,q),s,this.options,n)&&X(this,ne,Wi).call(this),this.updateResult(),r&&(C(this,q)!==s||ge(this.options.enabled,C(this,q))!==ge(n.enabled,C(this,q))||ge(this.options.staleTime,C(this,q))!==ge(n.staleTime,C(this,q)))&&X(this,ne,ud).call(this);const i=X(this,ne,dd).call(this);r&&(C(this,q)!==s||ge(this.options.enabled,C(this,q))!==ge(n.enabled,C(this,q))||i!==C(this,Xn))&&X(this,ne,fd).call(this,i)}getOptimisticResult(e){const n=C(this,qe).getQueryCache().build(C(this,qe),e),s=this.createResult(n,e);return Xc(this.getCurrentResult(),s)||(D(this,Ge,s),D(this,Qr,this.options),D(this,Ys,C(this,q).state)),s}getCurrentResult(){return C(this,Ge)}trackResult(e,n){return new Proxy(e,{get:(s,r)=>(this.trackProp(r),n==null||n(r),Reflect.get(s,r))})}trackProp(e){C(this,Xr).add(e)}getCurrentQuery(){return C(this,q)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=C(this,qe).defaultQueryOptions(e),s=C(this,qe).getQueryCache().build(C(this,qe),n);let r=()=>{},i;const o=new Promise(a=>{i=a,r=C(this,qe).getQueryCache().subscribe(l=>{l.type==="updated"&&l.query.queryHash===s.queryHash&&s.state.data!==void 0&&(r(),a(this.createResult(s,n)))})});return Promise.race([s.fetch(n).then(()=>{const a=this.createResult(s,n);return i==null||i(a),a}).finally(()=>{r()}),o])}fetch(e){return X(this,ne,Wi).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),C(this,Ge)))}createResult(e,n){var k;const s=C(this,q),r=this.options,i=C(this,Ge),o=C(this,Ys),a=C(this,Qr),l=e!==s?e.state:C(this,Fo),{state:c}=e;let u={...c},f=!1,h;if(n._optimisticResults){const j=this.hasListeners(),E=!j&&Tp(e,n),P=j&&Dp(e,s,n,r);(E||P)&&(u={...u,...V0(c.data,e.options)}),n._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:p,errorUpdatedAt:y,status:m}=u;h=u.data;let b=!1;if(n.placeholderData!==void 0&&h===void 0&&m==="pending"){let j;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(j=i.data,b=!0):j=typeof n.placeholderData=="function"?n.placeholderData((k=C(this,Yr))==null?void 0:k.state.data,C(this,Yr)):n.placeholderData,j!==void 0&&(m="success",h=ad(i==null?void 0:i.data,j,n),f=!0)}if(n.select&&h!==void 0&&!b)if(i&&h===(o==null?void 0:o.data)&&n.select===C(this,Io))h=C(this,Kr);else try{D(this,Io,n.select),h=n.select(h),h=ad(i==null?void 0:i.data,h,n),D(this,Kr,h),D(this,Sn,null)}catch(j){D(this,Sn,j)}else h===void 0&&D(this,Sn,null);C(this,Sn)&&(p=C(this,Sn),h=C(this,Kr),y=Date.now(),m="error",f=!1);const x=u.fetchStatus==="fetching",g=m==="pending",v=m==="error",S=g&&x,_=h!==void 0;return{status:m,fetchStatus:u.fetchStatus,isPending:g,isSuccess:m==="success",isError:v,isInitialLoading:S,isLoading:S,data:h,dataUpdatedAt:u.dataUpdatedAt,error:p,errorUpdatedAt:y,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:u.dataUpdateCount>l.dataUpdateCount||u.errorUpdateCount>l.errorUpdateCount,isFetching:x,isRefetching:x&&!g,isLoadingError:v&&!_,isPaused:u.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:v&&_,isStale:Lf(e,n),refetch:this.refetch,isEnabled:ge(n.enabled,e)!==!1}}updateResult(){const e=C(this,Ge),n=this.createResult(C(this,q),this.options);if(D(this,Ys,C(this,q).state),D(this,Qr,this.options),C(this,Ys).data!==void 0&&D(this,Yr,C(this,q)),Xc(n,e))return;D(this,Ge,n);const r=(()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!C(this,Xr).size)return!0;const a=new Set(o??C(this,Xr));return this.options.throwOnError&&a.add("error"),Object.keys(C(this,Ge)).some(l=>{const c=l;return C(this,Ge)[c]!==e[c]&&a.has(c)})})();We.batch(()=>{r&&this.listeners.forEach(i=>{i(C(this,Ge))}),C(this,qe).getQueryCache().notify({query:C(this,q),type:"observerResultsUpdated"})})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&X(this,ne,hd).call(this)}},qe=new WeakMap,q=new WeakMap,Fo=new WeakMap,Ge=new WeakMap,Ys=new WeakMap,Qr=new WeakMap,Sn=new WeakMap,Io=new WeakMap,Kr=new WeakMap,Yr=new WeakMap,Xs=new WeakMap,qs=new WeakMap,Xn=new WeakMap,Xr=new WeakMap,ne=new WeakSet,Wi=function(e){X(this,ne,md).call(this);let n=C(this,q).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(rt)),n},cd=function(e){return!Tf()&&ge(this.options.enabled,C(this,q))!==!1&&F0(e)},ud=function(){X(this,ne,pd).call(this);const e=ge(this.options.staleTime,C(this,q));if(C(this,Ge).isStale||!X(this,ne,cd).call(this,e))return;const n=I0(C(this,Ge).dataUpdatedAt,e)+1;D(this,Xs,Ws.setTimeout(()=>{C(this,Ge).isStale||this.updateResult()},n))},dd=function(){return ge(this.options.refetchInterval,C(this,q))??!1},fd=function(e){X(this,ne,gd).call(this),D(this,Xn,e),!(C(this,Xn)===0||!X(this,ne,cd).call(this,C(this,Xn)))&&D(this,qs,Ws.setInterval(()=>{(this.options.refetchIntervalInBackground||Df.isFocused())&&X(this,ne,Wi).call(this)},C(this,Xn)))},hd=function(){X(this,ne,ud).call(this),X(this,ne,fd).call(this,X(this,ne,dd).call(this))},pd=function(){C(this,Xs)!==void 0&&(Ws.clearTimeout(C(this,Xs)),D(this,Xs,void 0))},gd=function(){C(this,qs)!==void 0&&(Ws.clearInterval(C(this,qs)),D(this,qs,void 0))},md=function(){const e=C(this,qe).getQueryCache().build(C(this,qe),this.options);if(e===C(this,q))return;const n=C(this,q);D(this,q,e),D(this,Fo,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},vm);function ES(t,e){return ge(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&ge(e.retryOnMount,t)===!1)}function Tp(t,e){return ES(t,e)||t.state.data!==void 0&&xd(t,e,e.refetchOnMount)}function xd(t,e,n){if(ge(e.enabled,t)!==!1&&ge(e.staleTime,t)!=="static"){const s=ge(n,t);return s==="always"||s!==!1&&Lf(t,e)}return!1}function Dp(t,e,n,s){return(t!==e||ge(s.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&Lf(t,n)}function Lf(t,e){return ge(e.enabled,t)!==!1&&t.isStaleByTime(ge(e.staleTime,t))}var zo,on,Ke,Gs,an,Bn,bm,NS=(bm=class extends H0{constructor(e){super();z(this,an);z(this,zo);z(this,on);z(this,Ke);z(this,Gs);D(this,zo,e.client),this.mutationId=e.mutationId,D(this,Ke,e.mutationCache),D(this,on,[]),this.state=e.state||MS(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){C(this,on).includes(e)||(C(this,on).push(e),this.clearGcTimeout(),C(this,Ke).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){D(this,on,C(this,on).filter(n=>n!==e)),this.scheduleGc(),C(this,Ke).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){C(this,on).length||(this.state.status==="pending"?this.scheduleGc():C(this,Ke).remove(this))}continue(){var e;return((e=C(this,Gs))==null?void 0:e.continue())??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(e){var a,l,c,u,f,h,p,y,m,b,x,g,v,S,_,k,j,E;const n=()=>{X(this,an,Bn).call(this,{type:"continue"})},s={client:C(this,zo),meta:this.options.meta,mutationKey:this.options.mutationKey},r=D(this,Gs,$0({fn:()=>this.options.mutationFn?this.options.mutationFn(e,s):Promise.reject(new Error("No mutationFn found")),onFail:(P,M)=>{X(this,an,Bn).call(this,{type:"failed",failureCount:P,error:M})},onPause:()=>{X(this,an,Bn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>C(this,Ke).canRun(this)})),i=this.state.status==="pending",o=!r.canStart();try{if(i)n();else{X(this,an,Bn).call(this,{type:"pending",variables:e,isPaused:o}),C(this,Ke).config.onMutate&&await C(this,Ke).config.onMutate(e,this,s);const M=await((l=(a=this.options).onMutate)==null?void 0:l.call(a,e,s));M!==this.state.context&&X(this,an,Bn).call(this,{type:"pending",context:M,variables:e,isPaused:o})}const P=await r.start();return await((u=(c=C(this,Ke).config).onSuccess)==null?void 0:u.call(c,P,e,this.state.context,this,s)),await((h=(f=this.options).onSuccess)==null?void 0:h.call(f,P,e,this.state.context,s)),await((y=(p=C(this,Ke).config).onSettled)==null?void 0:y.call(p,P,null,this.state.variables,this.state.context,this,s)),await((b=(m=this.options).onSettled)==null?void 0:b.call(m,P,null,e,this.state.context,s)),X(this,an,Bn).call(this,{type:"success",data:P}),P}catch(P){try{await((g=(x=C(this,Ke).config).onError)==null?void 0:g.call(x,P,e,this.state.context,this,s))}catch(M){Promise.reject(M)}try{await((S=(v=this.options).onError)==null?void 0:S.call(v,P,e,this.state.context,s))}catch(M){Promise.reject(M)}try{await((k=(_=C(this,Ke).config).onSettled)==null?void 0:k.call(_,void 0,P,this.state.variables,this.state.context,this,s))}catch(M){Promise.reject(M)}try{await((E=(j=this.options).onSettled)==null?void 0:E.call(j,void 0,P,e,this.state.context,s))}catch(M){Promise.reject(M)}throw X(this,an,Bn).call(this,{type:"error",error:P}),P}finally{C(this,Gs)===r&&D(this,Gs,void 0),C(this,Ke).runNext(this)}}},zo=new WeakMap,on=new WeakMap,Ke=new WeakMap,Gs=new WeakMap,an=new WeakSet,Bn=function(e){const n=s=>{switch(e.type){case"failed":return{...s,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...s,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:e.error,failureCount:s.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),We.batch(()=>{C(this,on).forEach(s=>{s.onMutationUpdate(e)}),C(this,Ke).notify({mutation:this,type:"updated",action:e})})},bm);function MS(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var qn,zt,Bo,wm,PS=(wm=class extends Qo{constructor(e={}){super();z(this,qn);z(this,zt);z(this,Bo);this.config=e,D(this,qn,new Set),D(this,zt,new Map),D(this,Bo,0)}build(e,n,s){const r=new NS({client:e,mutationCache:this,mutationId:++sa(this,Bo)._,options:e.defaultMutationOptions(n),state:s});return this.add(r),r}add(e){C(this,qn).add(e);const n=wa(e);if(typeof n=="string"){const s=C(this,zt).get(n);s?s.push(e):C(this,zt).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(C(this,qn).delete(e)){const n=wa(e);if(typeof n=="string"){const s=C(this,zt).get(n);if(s)if(s.length>1){const r=s.indexOf(e);r!==-1&&s.splice(r,1)}else s[0]===e&&C(this,zt).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){var s;const n=wa(e);if(typeof n=="string"){const r=(s=C(this,zt).get(n))==null?void 0:s.find(i=>i.state.status==="pending");return!r||r===e}else return!0}runNext(e){var s,r;const n=wa(e);return typeof n=="string"?((r=(s=C(this,zt).get(n))==null?void 0:s.find(i=>i!==e&&i.state.isPaused))==null?void 0:r.continue())??Promise.resolve():Promise.resolve()}clear(){We.batch(()=>{const e=this.getAll();C(this,qn).clear(),C(this,zt).clear(),e.forEach(n=>{this.notify({type:"removed",mutation:n})})})}getAll(){return Array.from(C(this,qn))}find(e){const n={exact:!0,...e};return this.getAll().find(s=>Ep(n,s))}findAll(e={}){return this.getAll().filter(n=>Ep(e,n))}notify(e){We.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return We.batch(()=>Promise.all(e.map(n=>n.continue().catch(rt))))}},qn=new WeakMap,zt=new WeakMap,Bo=new WeakMap,wm);function wa(t){var e;return(e=t.options.scope)==null?void 0:e.id}var ln,Sm,RS=(Sm=class extends Qo{constructor(e={}){super();z(this,ln);this.config=e,D(this,ln,new Map)}build(e,n,s){const r=n.queryKey,i=n.queryHash??Rf(r,n);let o=this.get(i);return o||(o=new CS({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(n),state:s,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){C(this,ln).has(e.queryHash)||(C(this,ln).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){C(this,ln).get(e.queryHash)===e&&(e.destroy(),C(this,ln).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){We.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return C(this,ln).get(e)}getAll(){return[...C(this,ln).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(s=>jp(n,s))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(s=>jp(e,s)):n}notify(e){We.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){We.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){We.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ln=new WeakMap,Sm),ye,Gn,Jn,qr,Gr,Zn,Jr,Zr,_m,OS=(_m=class{constructor(t={}){z(this,ye);z(this,Gn);z(this,Jn);z(this,qr);z(this,Gr);z(this,Zn);z(this,Jr);z(this,Zr);D(this,ye,t.queryCache||new RS),D(this,Gn,t.mutationCache||new PS),D(this,Jn,t.defaultOptions||{}),D(this,qr,new Map),D(this,Gr,new Map),D(this,Zn,0)}mount(){sa(this,Zn)._++,C(this,Zn)===1&&(D(this,Jr,Df.subscribe(async t=>{t&&(await this.resumePausedMutations(),C(this,ye).onFocus())})),D(this,Zr,kl.subscribe(async t=>{t&&(await this.resumePausedMutations(),C(this,ye).onOnline())})))}unmount(){var t,e;sa(this,Zn)._--,C(this,Zn)===0&&((t=C(this,Jr))==null||t.call(this),D(this,Jr,void 0),(e=C(this,Zr))==null||e.call(this),D(this,Zr,void 0))}isFetching(t){return C(this,ye).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return C(this,Gn).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=C(this,ye).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=C(this,ye).build(this,e),s=n.state.data;return s===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(ge(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(s))}getQueriesData(t){return C(this,ye).findAll(t).map(({queryKey:e,state:n})=>[e,n.data])}setQueryData(t,e,n){var o;const s=this.defaultQueryOptions({queryKey:t}),r=(o=C(this,ye).get(s.queryHash))==null?void 0:o.state.data,i=dS(e,r);if(i!==void 0)return C(this,ye).build(this,s).setData(i,{...n,manual:!0})}setQueriesData(t,e,n){return We.batch(()=>C(this,ye).findAll(t).map(({queryKey:s})=>[s,this.setQueryData(s,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=C(this,ye).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=C(this,ye);We.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=C(this,ye);return We.batch(()=>{const s=n.findAll(t),r=new Set(s);return s.forEach(i=>{i.reset()}),this.refetchQueries({type:"active",predicate:i=>r.has(i)},e)})}cancelQueries(t,e={}){const n={revert:!0,...e},s=We.batch(()=>C(this,ye).findAll(t).map(r=>r.cancel(n)));return Promise.all(s).then(rt).catch(rt)}invalidateQueries(t,e={}){return We.batch(()=>(C(this,ye).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},s=We.batch(()=>C(this,ye).findAll(t).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let i=r.fetch(void 0,n);return n.throwOnError||(i=i.catch(rt)),r.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(s).then(rt)}async query(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=C(this,ye).build(this,e),s=n.isStaleByTime(ge(e.staleTime,n))?await n.fetch(e):n.state.data,r=e.select;return r?r(s):s}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=C(this,ye).build(this,e);return n.isStaleByTime(ge(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(rt).catch(rt)}infiniteQuery(t){return t._type="infinite",this.query(t)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(rt).catch(rt)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return kl.isOnline()?C(this,Gn).resumePausedMutations():Promise.resolve()}getQueryCache(){return C(this,ye)}getMutationCache(){return C(this,Gn)}getDefaultOptions(){return C(this,Jn)}setDefaultOptions(t){D(this,Jn,t)}setQueryDefaults(t,e){C(this,qr).set(jo(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...C(this,qr).values()],n={};return e.forEach(s=>{ai(t,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(t,e){C(this,Gr).set(jo(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...C(this,Gr).values()],n={};return e.forEach(s=>{ai(t,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...C(this,Jn).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Rf(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Of&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...C(this,Jn).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){C(this,ye).clear(),C(this,Gn).clear()}},ye=new WeakMap,Gn=new WeakMap,Jn=new WeakMap,qr=new WeakMap,Gr=new WeakMap,Zn=new WeakMap,Jr=new WeakMap,Zr=new WeakMap,_m);const Q0=w.createContext(!1),TS=()=>w.useContext(Q0);Q0.Provider;function DS(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}const LS=w.createContext(DS()),AS=()=>w.useContext(LS),FS=(t,e,n)=>{const s=(n==null?void 0:n.state.status)==="error"&&typeof t.throwOnError=="function"?W0(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||s)&&(e.isReset()||(t.retryOnMount=!1))},IS=t=>{w.useEffect(()=>{t.clearReset()},[t])},zS=({result:t,errorResetBoundary:e,throwOnError:n,query:s,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&s&&(r&&t.data===void 0||W0(n,[t.error,s])),BS=t=>{if(t.suspense){const n=r=>r==="static"?r:Math.max(r??1e3,1e3),s=t.staleTime;t.staleTime=typeof s=="function"?(...r)=>n(s(...r)):n(s),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},WS=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,US=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function $S(t,e,n){const s=TS(),r=AS(),i=iS(),o=i.defaultQueryOptions(t),a=i.getQueryCache().get(o.queryHash),l=t.subscribed!==!1;o._optimisticResults=s?"isRestoring":l?"optimistic":void 0,BS(o),FS(o,r,a),IS(r);const[c]=w.useState(()=>new e(i,o)),u=c.getOptimisticResult(o),f=!s&&l;if(w.useSyncExternalStore(w.useCallback(h=>{const p=f?c.subscribe(We.batchCalls(h)):rt;return c.updateResult(),p},[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),w.useEffect(()=>{c.setOptions(o)},[o,c]),WS(o,u))throw US(o,c,r);if(zS({result:u,errorResetBoundary:r,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:c.trackResult(u)}function K0(t,e){return $S(t,jS)}/**
|
|
41
|
-
* @remix-run/router v1.23.4
|
|
42
|
-
*
|
|
43
|
-
* Copyright (c) Remix Software Inc.
|
|
44
|
-
*
|
|
45
|
-
* This source code is licensed under the MIT license found in the
|
|
46
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
47
|
-
*
|
|
48
|
-
* @license MIT
|
|
49
|
-
*/function Eo(){return Eo=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var s in n)({}).hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Eo.apply(null,arguments)}var ns;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(ns||(ns={}));const Lp="popstate";function HS(t){t===void 0&&(t={});function e(s,r){let{pathname:i,search:o,hash:a}=s.location;return yd("",{pathname:i,search:o,hash:a},r.state&&r.state.usr||null,r.state&&r.state.key||"default")}function n(s,r){return typeof r=="string"?r:Cl(r)}return QS(e,n,null,t)}function ke(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Y0(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function VS(){return Math.random().toString(36).substr(2,8)}function Ap(t,e){return{usr:t.state,key:t.key,idx:e}}function yd(t,e,n,s){return n===void 0&&(n=null),Eo({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?hi(e):e,{state:n,key:e&&e.key||s||VS()})}function Cl(t){let{pathname:e="/",search:n="",hash:s=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(e+=s.charAt(0)==="#"?s:"#"+s),e}function hi(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let s=t.indexOf("?");s>=0&&(e.search=t.substr(s),t=t.substr(0,s)),t&&(e.pathname=t)}return e}function QS(t,e,n,s){s===void 0&&(s={});let{window:r=document.defaultView,v5Compat:i=!1}=s,o=r.history,a=ns.Pop,l=null,c=u();c==null&&(c=0,o.replaceState(Eo({},o.state,{idx:c}),""));function u(){return(o.state||{idx:null}).idx}function f(){a=ns.Pop;let b=u(),x=b==null?null:b-c;c=b,l&&l({action:a,location:m.location,delta:x})}function h(b,x){a=ns.Push;let g=yd(m.location,b,x);c=u()+1;let v=Ap(g,c),S=m.createHref(g);try{o.pushState(v,"",S)}catch(_){if(_ instanceof DOMException&&_.name==="DataCloneError")throw _;r.location.assign(S)}i&&l&&l({action:a,location:m.location,delta:1})}function p(b,x){a=ns.Replace;let g=yd(m.location,b,x);c=u();let v=Ap(g,c),S=m.createHref(g);o.replaceState(v,"",S),i&&l&&l({action:a,location:m.location,delta:0})}function y(b){let x=r.location.origin!=="null"?r.location.origin:r.location.href,g=typeof b=="string"?b:Cl(b);return g=g.replace(/ $/,"%20"),ke(x,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,x)}let m={get action(){return a},get location(){return t(r,o)},listen(b){if(l)throw new Error("A history only accepts one active listener");return r.addEventListener(Lp,f),l=b,()=>{r.removeEventListener(Lp,f),l=null}},createHref(b){return e(r,b)},createURL:y,encodeLocation(b){let x=y(b);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:h,replace:p,go(b){return o.go(b)}};return m}var Fp;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Fp||(Fp={}));function KS(t,e,n){return n===void 0&&(n="/"),YS(t,e,n)}function YS(t,e,n,s){let r=typeof e=="string"?hi(e):e,i=li(r.pathname||"/",n);if(i==null)return null;let o=X0(t);XS(o);let a=null,l=o1(i);for(let c=0;a==null&&c<o.length;++c)a=r1(o[c],l);return a}function X0(t,e,n,s){e===void 0&&(e=[]),n===void 0&&(n=[]),s===void 0&&(s="");let r=(i,o,a)=>{let l={relativePath:a===void 0?i.path||"":a,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};l.relativePath.startsWith("/")&&(ke(l.relativePath.startsWith(s),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(s.length));let c=gs([s,l.relativePath]),u=n.concat(l);i.children&&i.children.length>0&&(ke(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),X0(i.children,e,u,c)),!(i.path==null&&!i.index)&&e.push({path:c,score:n1(c,i.index),routesMeta:u})};return t.forEach((i,o)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))r(i,o);else for(let l of q0(i.path))r(i,o,l)}),e}function q0(t){let e=t.split("/");if(e.length===0)return[];let[n,...s]=e,r=n.endsWith("?"),i=n.replace(/\?$/,"");if(s.length===0)return r?[i,""]:[i];let o=q0(s.join("/")),a=[];return a.push(...o.map(l=>l===""?i:[i,l].join("/"))),r&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function XS(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:s1(e.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const qS=/^:[\w-]+$/,GS=3,JS=2,ZS=1,e1=10,t1=-2,Ip=t=>t==="*";function n1(t,e){let n=t.split("/"),s=n.length;return n.some(Ip)&&(s+=t1),e&&(s+=JS),n.filter(r=>!Ip(r)).reduce((r,i)=>r+(qS.test(i)?GS:i===""?ZS:e1),s)}function s1(t,e){return t.length===e.length&&t.slice(0,-1).every((s,r)=>s===e[r])?t[t.length-1]-e[e.length-1]:0}function r1(t,e,n){let{routesMeta:s}=t,r={},i="/",o=[];for(let a=0;a<s.length;++a){let l=s[a],c=a===s.length-1,u=i==="/"?e:e.slice(i.length)||"/",f=vd({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},u),h=l.route;if(!f)return null;Object.assign(r,f.params),o.push({params:r,pathname:gs([i,f.pathname]),pathnameBase:c1(gs([i,f.pathnameBase])),route:h}),f.pathnameBase!=="/"&&(i=gs([i,f.pathnameBase]))}return o}function vd(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,s]=i1(t.path,t.caseSensitive,t.end),r=e.match(n);if(!r)return null;let i=r[0],o=i.replace(/(.)\/+$/,"$1"),a=r.slice(1);return{params:s.reduce((c,u,f)=>{let{paramName:h,isOptional:p}=u;if(h==="*"){let m=a[f]||"";o=i.slice(0,i.length-m.length).replace(/(.)\/+$/,"$1")}const y=a[f];return p&&!y?c[h]=void 0:c[h]=(y||"").replace(/%2F/g,"/"),c},{}),pathname:i,pathnameBase:o,pattern:t}}function i1(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),Y0(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let s=[],r="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(s.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(s.push({paramName:"*"}),r+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":t!==""&&t!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,e?void 0:"i"),s]}function o1(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Y0(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function li(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,s=t.charAt(n);return s&&s!=="/"?null:t.slice(n)||"/"}function a1(t,e){e===void 0&&(e="/");let{pathname:n,search:s="",hash:r=""}=typeof t=="string"?hi(t):t,i;return n?(n=Z0(n),n.startsWith("/")?i=zp(n.substring(1),"/"):i=zp(n,e)):i=e,{pathname:i,search:u1(s),hash:d1(r)}}function zp(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function qc(t,e,n,s){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(s)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function l1(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function G0(t,e){let n=l1(t);return e?n.map((s,r)=>r===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function J0(t,e,n,s){s===void 0&&(s=!1);let r;typeof t=="string"?r=hi(t):(r=Eo({},t),ke(!r.pathname||!r.pathname.includes("?"),qc("?","pathname","search",r)),ke(!r.pathname||!r.pathname.includes("#"),qc("#","pathname","hash",r)),ke(!r.search||!r.search.includes("#"),qc("#","search","hash",r)));let i=t===""||r.pathname==="",o=i?"/":r.pathname,a;if(o==null)a=n;else{let f=e.length-1;if(!s&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),f-=1;r.pathname=h.join("/")}a=f>=0?e[f]:"/"}let l=a1(r,a),c=o&&o!=="/"&&o.endsWith("/"),u=(i||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}const Z0=t=>t.replace(/\/\/+/g,"/"),gs=t=>Z0(t.join("/")),c1=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),u1=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,d1=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function f1(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const ey=["post","put","patch","delete"];new Set(ey);const h1=["get",...ey];new Set(h1);/**
|
|
50
|
-
* React Router v6.30.6
|
|
51
|
-
*
|
|
52
|
-
* Copyright (c) Remix Software Inc.
|
|
53
|
-
*
|
|
54
|
-
* This source code is licensed under the MIT license found in the
|
|
55
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
56
|
-
*
|
|
57
|
-
* @license MIT
|
|
58
|
-
*/function No(){return No=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var s in n)({}).hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},No.apply(null,arguments)}const oc=w.createContext(null),ty=w.createContext(null),Es=w.createContext(null),ac=w.createContext(null),ur=w.createContext({outlet:null,matches:[],isDataRoute:!1}),ny=w.createContext(null);function p1(t,e){let{relative:n}=e===void 0?{}:e;Ko()||ke(!1);let{basename:s,navigator:r}=w.useContext(Es),{hash:i,pathname:o,search:a}=lc(t,{relative:n}),l=o;return s!=="/"&&(l=o==="/"?s:gs([s,o])),r.createHref({pathname:l,search:a,hash:i})}function Ko(){return w.useContext(ac)!=null}function Ns(){return Ko()||ke(!1),w.useContext(ac).location}function sy(t){w.useContext(Es).static||w.useLayoutEffect(t)}function ry(){let{isDataRoute:t}=w.useContext(ur);return t?E1():g1()}function g1(){Ko()||ke(!1);let t=w.useContext(oc),{basename:e,future:n,navigator:s}=w.useContext(Es),{matches:r}=w.useContext(ur),{pathname:i}=Ns(),o=JSON.stringify(G0(r,n.v7_relativeSplatPath)),a=w.useRef(!1);return sy(()=>{a.current=!0}),w.useCallback(function(c,u){if(u===void 0&&(u={}),!a.current)return;if(typeof c=="number"){s.go(c);return}let f=J0(c,JSON.parse(o),i,u.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:gs([e,f.pathname])),(u.replace?s.replace:s.push)(f,u.state,u)},[e,s,o,i,t])}function lc(t,e){let{relative:n}=e===void 0?{}:e,{future:s}=w.useContext(Es),{matches:r}=w.useContext(ur),{pathname:i}=Ns(),o=JSON.stringify(G0(r,s.v7_relativeSplatPath));return w.useMemo(()=>J0(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function m1(t,e){return x1(t,e)}function x1(t,e,n,s){Ko()||ke(!1);let{navigator:r}=w.useContext(Es),{matches:i}=w.useContext(ur),o=i[i.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let c=Ns(),u;if(e){var f;let b=typeof e=="string"?hi(e):e;l==="/"||(f=b.pathname)!=null&&f.startsWith(l)||ke(!1),u=b}else u=c;let h=u.pathname||"/",p=h;if(l!=="/"){let b=l.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(b.length).join("/")}let y=KS(t,{pathname:p}),m=S1(y&&y.map(b=>Object.assign({},b,{params:Object.assign({},a,b.params),pathname:gs([l,r.encodeLocation?r.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?l:gs([l,r.encodeLocation?r.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),i,n,s);return e&&m?w.createElement(ac.Provider,{value:{location:No({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:ns.Pop}},m):m}function y1(){let t=j1(),e=f1(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,r={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},e),n?w.createElement("pre",{style:r},n):null,null)}const v1=w.createElement(y1,null);class b1 extends w.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?w.createElement(ur.Provider,{value:this.props.routeContext},w.createElement(ny.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function w1(t){let{routeContext:e,match:n,children:s}=t,r=w.useContext(oc);return r&&r.static&&r.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=n.route.id),w.createElement(ur.Provider,{value:e},s)}function S1(t,e,n,s){var r;if(e===void 0&&(e=[]),n===void 0&&(n=null),s===void 0&&(s=null),t==null){var i;if(!n)return null;if(n.errors)t=n.matches;else if((i=s)!=null&&i.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,a=(r=n)==null?void 0:r.errors;if(a!=null){let u=o.findIndex(f=>f.route.id&&(a==null?void 0:a[f.route.id])!==void 0);u>=0||ke(!1),o=o.slice(0,Math.min(o.length,u+1))}let l=!1,c=-1;if(n&&s&&s.v7_partialHydration)for(let u=0;u<o.length;u++){let f=o[u];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(c=u),f.route.id){let{loaderData:h,errors:p}=n,y=f.route.loader&&h[f.route.id]===void 0&&(!p||p[f.route.id]===void 0);if(f.route.lazy||y){l=!0,c>=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((u,f,h)=>{let p,y=!1,m=null,b=null;n&&(p=a&&f.route.id?a[f.route.id]:void 0,m=f.route.errorElement||v1,l&&(c<0&&h===0?(N1("route-fallback"),y=!0,b=null):c===h&&(y=!0,b=f.route.hydrateFallbackElement||null)));let x=e.concat(o.slice(0,h+1)),g=()=>{let v;return p?v=m:y?v=b:f.route.Component?v=w.createElement(f.route.Component,null):f.route.element?v=f.route.element:v=u,w.createElement(w1,{match:f,routeContext:{outlet:u,matches:x,isDataRoute:n!=null},children:v})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?w.createElement(b1,{location:n.location,revalidation:n.revalidation,component:m,error:p,children:g(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):g()},null)}var iy=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(iy||{}),oy=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(oy||{});function _1(t){let e=w.useContext(oc);return e||ke(!1),e}function k1(t){let e=w.useContext(ty);return e||ke(!1),e}function C1(t){let e=w.useContext(ur);return e||ke(!1),e}function ay(t){let e=C1(),n=e.matches[e.matches.length-1];return n.route.id||ke(!1),n.route.id}function j1(){var t;let e=w.useContext(ny),n=k1(),s=ay();return e!==void 0?e:(t=n.errors)==null?void 0:t[s]}function E1(){let{router:t}=_1(iy.UseNavigateStable),e=ay(oy.UseNavigateStable),n=w.useRef(!1);return sy(()=>{n.current=!0}),w.useCallback(function(r,i){i===void 0&&(i={}),n.current&&(typeof r=="number"?t.navigate(r):t.navigate(r,No({fromRouteId:e},i)))},[t,e])}const Bp={};function N1(t,e,n){Bp[t]||(Bp[t]=!0)}function M1(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function en(t){ke(!1)}function P1(t){let{basename:e="/",children:n=null,location:s,navigationType:r=ns.Pop,navigator:i,static:o=!1,future:a}=t;Ko()&&ke(!1);let l=e.replace(/^\/*/,"/"),c=w.useMemo(()=>({basename:l,navigator:i,static:o,future:No({v7_relativeSplatPath:!1},a)}),[l,a,i,o]);typeof s=="string"&&(s=hi(s));let{pathname:u="/",search:f="",hash:h="",state:p=null,key:y="default"}=s,m=w.useMemo(()=>{let b=li(u,l);return b==null?null:{location:{pathname:b,search:f,hash:h,state:p,key:y},navigationType:r}},[l,u,f,h,p,y,r]);return m==null?null:w.createElement(Es.Provider,{value:c},w.createElement(ac.Provider,{children:n,value:m}))}function R1(t){let{children:e,location:n}=t;return m1(bd(e),n)}new Promise(()=>{});function bd(t,e){e===void 0&&(e=[]);let n=[];return w.Children.forEach(t,(s,r)=>{if(!w.isValidElement(s))return;let i=[...e,r];if(s.type===w.Fragment){n.push.apply(n,bd(s.props.children,i));return}s.type!==en&&ke(!1),!s.props.index||!s.props.children||ke(!1);let o={id:s.props.id||i.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,loader:s.props.loader,action:s.props.action,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(o.children=bd(s.props.children,i)),n.push(o)}),n}/**
|
|
59
|
-
* React Router DOM v6.30.6
|
|
60
|
-
*
|
|
61
|
-
* Copyright (c) Remix Software Inc.
|
|
62
|
-
*
|
|
63
|
-
* This source code is licensed under the MIT license found in the
|
|
64
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
65
|
-
*
|
|
66
|
-
* @license MIT
|
|
67
|
-
*/function jl(){return jl=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var s in n)({}).hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},jl.apply(null,arguments)}function ly(t,e){if(t==null)return{};var n={};for(var s in t)if({}.hasOwnProperty.call(t,s)){if(e.indexOf(s)!==-1)continue;n[s]=t[s]}return n}function O1(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function T1(t,e){return t.button===0&&(!e||e==="_self")&&!O1(t)}function wd(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let s=t[n];return e.concat(Array.isArray(s)?s.map(r=>[n,r]):[[n,s]])},[]))}function D1(t,e){let n=wd(t);return e&&e.forEach((s,r)=>{n.has(r)||e.getAll(r).forEach(i=>{n.append(r,i)})}),n}const L1=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],A1=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],F1="6";try{window.__reactRouterVersion=F1}catch{}const I1=w.createContext({isTransitioning:!1}),z1="startTransition",Wp=Yv[z1];function B1(t){let{basename:e,children:n,future:s,window:r}=t,i=w.useRef();i.current==null&&(i.current=HS({window:r,v5Compat:!0}));let o=i.current,[a,l]=w.useState({action:o.action,location:o.location}),{v7_startTransition:c}=s||{},u=w.useCallback(f=>{c&&Wp?Wp(()=>l(f)):l(f)},[l,c]);return w.useLayoutEffect(()=>o.listen(u),[o,u]),w.useEffect(()=>M1(s),[s]),w.createElement(P1,{basename:e,children:n,location:a.location,navigationType:a.action,navigator:o,future:s})}const W1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",U1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,$1=w.forwardRef(function(e,n){let{onClick:s,relative:r,reloadDocument:i,replace:o,state:a,target:l,to:c,preventScrollReset:u,viewTransition:f}=e,h=ly(e,L1),{basename:p}=w.useContext(Es),y,m=!1;if(typeof c=="string"&&U1.test(c)&&(y=c,W1))try{let v=new URL(window.location.href),S=c.startsWith("//")?new URL(v.protocol+c):new URL(c),_=li(S.pathname,p);S.origin===v.origin&&_!=null?c=_+S.search+S.hash:m=!0}catch{}let b=p1(c,{relative:r}),x=V1(c,{replace:o,state:a,target:l,preventScrollReset:u,relative:r,viewTransition:f});function g(v){s&&s(v),v.defaultPrevented||x(v)}return w.createElement("a",jl({},h,{href:y||b,onClick:m||i?s:g,ref:n,target:l}))}),cy=w.forwardRef(function(e,n){let{"aria-current":s="page",caseSensitive:r=!1,className:i="",end:o=!1,style:a,to:l,viewTransition:c,children:u}=e,f=ly(e,A1),h=lc(l,{relative:f.relative}),p=Ns(),y=w.useContext(ty),{navigator:m,basename:b}=w.useContext(Es),x=y!=null&&Q1(h)&&c===!0,g=m.encodeLocation?m.encodeLocation(h).pathname:h.pathname,v=p.pathname,S=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;r||(v=v.toLowerCase(),S=S?S.toLowerCase():null,g=g.toLowerCase()),S&&b&&(S=li(S,b)||S);const _=g!=="/"&&g.endsWith("/")?g.length-1:g.length;let k=v===g||!o&&v.startsWith(g)&&v.charAt(_)==="/",j=S!=null&&(S===g||!o&&S.startsWith(g)&&S.charAt(g.length)==="/"),E={isActive:k,isPending:j,isTransitioning:x},P=k?s:void 0,M;typeof i=="function"?M=i(E):M=[i,k?"active":null,j?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let O=typeof a=="function"?a(E):a;return w.createElement($1,jl({},f,{"aria-current":P,className:M,ref:n,style:O,to:l,viewTransition:c}),typeof u=="function"?u(E):u)});var Sd;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Sd||(Sd={}));var Up;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Up||(Up={}));function H1(t){let e=w.useContext(oc);return e||ke(!1),e}function V1(t,e){let{target:n,replace:s,state:r,preventScrollReset:i,relative:o,viewTransition:a}=e===void 0?{}:e,l=ry(),c=Ns(),u=lc(t,{relative:o});return w.useCallback(f=>{if(T1(f,n)){f.preventDefault();let h=s!==void 0?s:Cl(c)===Cl(u);l(t,{replace:h,state:r,preventScrollReset:i,relative:o,viewTransition:a})}},[c,l,u,s,r,n,t,i,o,a])}function uy(t){let e=w.useRef(wd(t)),n=w.useRef(!1),s=Ns(),r=w.useMemo(()=>D1(s.search,n.current?null:e.current),[s.search]),i=ry(),o=w.useCallback((a,l)=>{const c=wd(typeof a=="function"?a(r):a);n.current=!0,i("?"+c,l)},[i,r]);return[r,o]}function Q1(t,e){e===void 0&&(e={});let n=w.useContext(I1);n==null&&ke(!1);let{basename:s}=H1(Sd.useViewTransitionState),r=lc(t,{relative:e.relative});if(!n.isTransitioning)return!1;let i=li(n.currentLocation.pathname,s)||n.currentLocation.pathname,o=li(n.nextLocation.pathname,s)||n.nextLocation.pathname;return vd(r.pathname,o)!=null||vd(r.pathname,i)!=null}const K1="/api";class Y1 extends Error{constructor(n,s){super(s);B(this,"status");this.status=n,this.name="ApiError"}}async function G(t,e={}){const n=await fetch(K1+t,{...e,headers:e.body?{"Content-Type":"application/json",...e.headers||{}}:e.headers});if(!n.ok){let s=`Erro HTTP ${n.status}`;try{const r=await n.json();s=String(r.detail||r.mensagem||s)}catch{}throw new Y1(n.status,s)}if(n.status!==204)return n.json()}const De=t=>({method:"POST",body:JSON.stringify(t)}),U={health:()=>G("/health"),doctor:()=>G("/doctor"),shutdown:()=>G("/shutdown",De({})),metricas:()=>G("/metrics"),leads:{listar:()=>G("/leads"),criar:t=>G("/leads",De(t)),atualizar:(t,e)=>G(`/leads/${t}`,{method:"PATCH",body:JSON.stringify(e)}),remover:t=>G(`/leads/${t}`,{method:"DELETE"}),importar:t=>G("/leads/import",De({leads:t})),enriquecer:t=>G(`/leads/${t}/enrich`,De({}))},crm:{sugestoes:()=>G("/crm/sugestoes"),aplicar:(t,e)=>G("/crm/sugestoes/aplicar",De({lead_id:t,para:e}))},campanhas:{listar:()=>G("/campaigns"),criar:t=>G("/campaigns",De(t)),iniciar:t=>G(`/campaigns/${t}/start`,De({})),pausar:t=>G(`/campaigns/${t}/pause`,De({})),parar:t=>G(`/campaigns/${t}/stop`,De({})),remover:t=>G(`/campaigns/${t}`,{method:"DELETE"})},extrair:{googleMaps:t=>G("/extract/google-maps",De(t)),instagram:t=>G("/extract/instagram",De({profile_url:t})),cnpj:t=>G("/extract/cnpj",De({cnpj:t})),cnpjBusca:t=>G("/extract/cnpj/search",De(t))},config:{obter:()=>G("/config"),salvar:t=>G("/config",{method:"PUT",body:JSON.stringify(t)}),testarLlm:()=>G("/config/test/llm",De({})),testarIntegracao:t=>G("/config/test/integracao",De({url:t}))},integracoes:()=>G("/integrations/status"),agentes:{templates:()=>G("/agents/templates"),salvarTemplates:t=>G("/agents/templates",{method:"PUT",body:JSON.stringify(t)}),testarTemplate:(t,e)=>G("/agents/templates/test",De({template:t,lead_id:e})),chat:t=>G("/agents/attendance/chat",De({mensagens:t}))},webhook:{obter:()=>G("/webhook"),salvar:t=>G("/webhook",{method:"PUT",body:JSON.stringify(t)}),testar:t=>G("/webhook/test",De({url:t}))}};function H(...t){return t.filter(Boolean).join(" ")}function X1(t){return(t||"?").trim().charAt(0).toUpperCase()||"?"}function _d(t){if(!t)return"—";try{return new Date(t).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return t}}function Af(t){const e=(t||"").replace(/\D/g,"");return e?e.length===11?`(${e.slice(0,2)}) ${e.slice(2,7)}-${e.slice(7)}`:e.length===10?`(${e.slice(0,2)}) ${e.slice(2,6)}-${e.slice(6)}`:t||"—":"—"}function q1(t){const e=["nome","telefone","email","empresa","cidade","observacoes"],n=e.filter(s=>String(t[s]||"").trim().length>0);return Math.round(n.length/e.length*100)}function G1(t){const e={nome:"nome",telefone:"telefone",email:"e-mail",empresa:"empresa",cidade:"cidade",observacoes:"observações"};return["nome","telefone","email","empresa","cidade","observacoes"].filter(s=>String(t[s]||"").trim().length===0).map(s=>e[s])}function J1(t,e){if(t>=100)return"Lead 100% completo — excelente! 🎉";const n=e.slice(0,2).join(" e ");return`Faltam ${100-t}% (${n}${e.length>2?"...":""}) para o lead ficar completo`}function Z1(t,e){const n=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),s=URL.createObjectURL(n),r=document.createElement("a");r.href=s,r.download=e,r.click(),URL.revokeObjectURL(s)}const e_={md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl"};function hn({aberto:t,onFechar:e,titulo:n,children:s,icone:r="fas fa-circle-info",largura:i="md"}){return w.useEffect(()=>{const o=a=>{a.key==="Escape"&&e()};return t&&window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t,e]),t?d.jsx("div",{className:"fixed inset-0 z-50 bg-black/40 flex items-center justify-center p-4",onMouseDown:o=>{o.target===o.currentTarget&&e()},children:d.jsxs("div",{className:H("bg-white rounded-2xl shadow-xl w-full",e_[i]),children:[d.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100",children:[d.jsxs("h3",{className:"text-base font-semibold text-gray-800 flex items-center gap-2",children:[d.jsx("i",{className:H(r,"text-indigo-500")})," ",n]}),d.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600","aria-label":"Fechar",children:d.jsx("i",{className:"fas fa-times"})})]}),d.jsx("div",{className:"px-6 py-5 max-h-[70vh] overflow-y-auto",children:s})]})}):null}const t_=[{icone:"fas fa-users",texto:"Cadastre leads manualmente ou importe pelos Extratores (Maps, Instagram, CNPJ)."},{icone:"fas fa-columns",texto:"Arraste os cards no CRM conforme avança no funil (Leads → Em contato → Proposta → Fechado)."},{icone:"fas fa-bullhorn",texto:"Monte campanhas de disparo com seus templates e acompanhe as taxas no Painel."},{icone:"fas fa-robot",texto:"Use os Agentes (disparo e atendimento) e configure o LLM em Ferramentas para turbiná-los."}];function n_({titulo:t,nomeUsuario:e}){const[n,s]=w.useState(!1);return d.jsxs("header",{className:"bg-white shadow-sm px-8 py-4 flex items-center justify-between shrink-0",children:[d.jsx("div",{children:d.jsx("h2",{className:"text-lg font-semibold text-gray-800",children:t})}),d.jsxs("div",{className:"flex items-center space-x-4",children:[d.jsxs("button",{onClick:()=>s(!0),className:"text-sm text-indigo-600 hover:text-indigo-800 font-medium",children:[d.jsx("i",{className:"fas fa-play-circle mr-1"})," Ver tutorial"]}),d.jsx("div",{className:"w-8 h-8 rounded-full bg-indigo-100 flex items-center justify-center text-indigo-600 font-bold text-sm",children:X1(e)}),d.jsx("span",{className:"text-sm font-medium text-gray-700",children:e})]}),d.jsxs(hn,{aberto:n,onFechar:()=>s(!1),titulo:"Tutorial rápido",icone:"fas fa-graduation-cap",children:[d.jsx("ol",{className:"space-y-4",children:t_.map((r,i)=>d.jsxs("li",{className:"flex gap-3 items-start",children:[d.jsx("span",{className:"w-8 h-8 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center shrink-0",children:d.jsx("i",{className:r.icone})}),d.jsx("p",{className:"text-sm text-gray-600 pt-1.5",children:r.texto})]},i))}),d.jsx("p",{className:"text-xs text-gray-400 mt-5",children:"Dica: o LLM (para enriquecimento e agentes) é configurado em Ferramentas."})]})]})}const s_=[{itens:[{para:"/",icone:"fas fa-chart-pie text-indigo-300",rotulo:"Painel",fim:!0}]},{secao:"Conexões",itens:[{para:"/leads",icone:"fas fa-users",rotulo:"Leads"},{para:"/agentes",icone:"fas fa-robot",rotulo:"Agentes"},{para:"/ferramentas",icone:"fas fa-tools",rotulo:"Ferramentas"}]},{itens:[{para:"/extratores?tab=maps",icone:"fas fa-map-marked-alt",rotulo:"Extrator Maps"},{para:"/extratores?tab=instagram",icone:"fab fa-instagram",rotulo:"Extrator Instagram"},{para:"/extratores?tab=cnpj",icone:"fas fa-building",rotulo:"Extrator CNPJ"}]},{secao:"Gestão",itens:[{para:"/disparos",icone:"fas fa-bullhorn",rotulo:"Disparos"},{para:"/crm",icone:"fas fa-columns",rotulo:"CRM"}]},{secao:"Integrações",itens:[{para:"/webhook",icone:"fas fa-link",rotulo:"Webhook"},{para:"/suporte",icone:"fas fa-headset",rotulo:"Suporte"}]}];function r_({onSair:t}){const e=Ns(),[n,s]=w.useState(!1);w.useEffect(()=>{e.pathname==="/agentes"&&s(!0)},[e.pathname]);const r=i=>{if(i.rotulo==="Agentes")return e.pathname==="/agentes";const[o,a]=i.para.split("?");return a?e.pathname===o&&e.search.includes(a):i.fim?e.pathname===o:e.pathname.startsWith(o)};return d.jsxs("aside",{className:"w-64 bg-[#1e1b4b] text-white flex flex-col shrink-0 h-screen sticky top-0",children:[d.jsx("div",{className:"p-6 border-b border-gray-700",children:d.jsxs("h1",{className:"text-2xl font-bold tracking-tight flex items-center gap-2",children:[d.jsx("span",{className:"text-2xl",children:"⚡"}),"LeadMaster"]})}),d.jsx("nav",{className:"flex-1 overflow-y-auto py-4",children:d.jsx("ul",{className:"space-y-1",children:s_.map((i,o)=>d.jsx("li",{children:d.jsxs("ul",{children:[i.secao&&d.jsx("li",{className:"px-6 py-2 text-xs font-semibold text-gray-400 uppercase tracking-wider list-none",children:i.secao}),i.itens.map(a=>a.rotulo==="Agentes"?d.jsxs("li",{children:[d.jsxs("button",{type:"button",onClick:()=>s(l=>!l),className:H("sidebar-link w-full flex items-center px-6 py-2.5 text-sm",r(a)&&"active"),children:[d.jsx("i",{className:H(a.icone,"w-5 text-gray-400")}),d.jsx("span",{className:"ml-3",children:a.rotulo}),d.jsx("i",{className:H("fas fa-chevron-down ml-auto text-xs text-gray-400 transition-transform",n&&"rotate-180")})]}),n&&d.jsxs("ul",{className:"pl-12 space-y-1 mt-1",children:[d.jsx("li",{children:d.jsx($p,{para:"/agentes?tab=disparo",rotulo:"Agente de Disparo",ativo:e.pathname==="/agentes"&&e.search.includes("disparo")})}),d.jsx("li",{children:d.jsx($p,{para:"/agentes?tab=atendimento",rotulo:"Agente de Atendimento",ativo:e.pathname==="/agentes"&&e.search.includes("atendimento")})})]})]},"agentes"):d.jsx("li",{children:d.jsxs(cy,{to:a.para,className:H("sidebar-link flex items-center px-6 py-2.5 text-sm",r(a)&&"active"),children:[d.jsx("i",{className:H(a.icone,"w-5 text-gray-400")}),d.jsx("span",{className:"ml-3",children:a.rotulo})]})},a.para))]})},o))})}),d.jsx("div",{className:"p-4 border-t border-gray-700",children:d.jsxs("button",{onClick:t,className:"w-full flex items-center justify-center px-4 py-2.5 bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg text-sm font-medium hover:opacity-90 transition",children:[d.jsx("i",{className:"fas fa-sign-out-alt mr-2"})," Sair"]})})]})}function $p({para:t,rotulo:e,ativo:n}){return d.jsx(cy,{to:t,className:H("sidebar-link block px-4 py-2 text-xs text-gray-300 rounded",n&&"active"),children:e})}const dy=w.createContext({toast:()=>{}});function Yt(){return w.useContext(dy)}const i_={sucesso:"bg-green-600",erro:"bg-red-600",info:"bg-indigo-600"},o_={sucesso:"fas fa-check-circle",erro:"fas fa-exclamation-circle",info:"fas fa-info-circle"};function a_({children:t}){const[e,n]=w.useState([]),s=w.useRef(0),r=w.useCallback((i,o)=>{const a=++s.current;n(l=>[...l,{id:a,tipo:i,mensagem:o}]),setTimeout(()=>n(l=>l.filter(c=>c.id!==a)),4500)},[]);return d.jsxs(dy.Provider,{value:{toast:r},children:[t,d.jsx("div",{className:"fixed top-4 right-4 z-[100] space-y-2 w-80",children:e.map(i=>d.jsxs("div",{className:H(i_[i.tipo],"text-white text-sm rounded-lg shadow-lg px-4 py-3 flex items-start gap-2 animate-pulse-once"),role:"status",children:[d.jsx("i",{className:H(o_[i.tipo],"mt-0.5")}),d.jsx("span",{className:"flex-1",children:i.mensagem}),d.jsx("button",{className:"opacity-70 hover:opacity-100",onClick:()=>n(o=>o.filter(a=>a.id!==i.id)),"aria-label":"Fechar",children:d.jsx("i",{className:"fas fa-times"})})]},i.id))})]})}function Sa({rotulo:t,valor:e,subtitulo:n,children:s,icone:r}){return d.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-5 border border-gray-100",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("p",{className:"text-sm text-gray-500 font-medium",children:t}),r&&d.jsx("i",{className:`${r} text-indigo-300`})]}),s??d.jsxs(d.Fragment,{children:[d.jsx("p",{className:"text-2xl font-bold text-gray-800 mt-1",children:e}),n&&d.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:n})]})]})}/*!
|
|
68
|
-
* @kurkle/color v0.3.4
|
|
69
|
-
* https://github.com/kurkle/color#readme
|
|
70
|
-
* (c) 2024 Jukka Kurkela
|
|
71
|
-
* Released under the MIT License
|
|
72
|
-
*/function Yo(t){return t+.5|0}const ss=(t,e,n)=>Math.max(Math.min(t,n),e);function Ui(t){return ss(Yo(t*2.55),0,255)}function ms(t){return ss(Yo(t*255),0,255)}function wn(t){return ss(Yo(t/2.55)/100,0,1)}function Hp(t){return ss(Yo(t*100),0,100)}const Ct={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},kd=[..."0123456789ABCDEF"],l_=t=>kd[t&15],c_=t=>kd[(t&240)>>4]+kd[t&15],_a=t=>(t&240)>>4===(t&15),u_=t=>_a(t.r)&&_a(t.g)&&_a(t.b)&&_a(t.a);function d_(t){var e=t.length,n;return t[0]==="#"&&(e===4||e===5?n={r:255&Ct[t[1]]*17,g:255&Ct[t[2]]*17,b:255&Ct[t[3]]*17,a:e===5?Ct[t[4]]*17:255}:(e===7||e===9)&&(n={r:Ct[t[1]]<<4|Ct[t[2]],g:Ct[t[3]]<<4|Ct[t[4]],b:Ct[t[5]]<<4|Ct[t[6]],a:e===9?Ct[t[7]]<<4|Ct[t[8]]:255})),n}const f_=(t,e)=>t<255?e(t):"";function h_(t){var e=u_(t)?l_:c_;return t?"#"+e(t.r)+e(t.g)+e(t.b)+f_(t.a,e):void 0}const p_=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function fy(t,e,n){const s=e*Math.min(n,1-n),r=(i,o=(i+t/30)%12)=>n-s*Math.max(Math.min(o-3,9-o,1),-1);return[r(0),r(8),r(4)]}function g_(t,e,n){const s=(r,i=(r+t/60)%6)=>n-n*e*Math.max(Math.min(i,4-i,1),0);return[s(5),s(3),s(1)]}function m_(t,e,n){const s=fy(t,1,.5);let r;for(e+n>1&&(r=1/(e+n),e*=r,n*=r),r=0;r<3;r++)s[r]*=1-e-n,s[r]+=e;return s}function x_(t,e,n,s,r){return t===r?(e-n)/s+(e<n?6:0):e===r?(n-t)/s+2:(t-e)/s+4}function Ff(t){const n=t.r/255,s=t.g/255,r=t.b/255,i=Math.max(n,s,r),o=Math.min(n,s,r),a=(i+o)/2;let l,c,u;return i!==o&&(u=i-o,c=a>.5?u/(2-i-o):u/(i+o),l=x_(n,s,r,u,i),l=l*60+.5),[l|0,c||0,a]}function If(t,e,n,s){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,n,s)).map(ms)}function zf(t,e,n){return If(fy,t,e,n)}function y_(t,e,n){return If(m_,t,e,n)}function v_(t,e,n){return If(g_,t,e,n)}function hy(t){return(t%360+360)%360}function b_(t){const e=p_.exec(t);let n=255,s;if(!e)return;e[5]!==s&&(n=e[6]?Ui(+e[5]):ms(+e[5]));const r=hy(+e[2]),i=+e[3]/100,o=+e[4]/100;return e[1]==="hwb"?s=y_(r,i,o):e[1]==="hsv"?s=v_(r,i,o):s=zf(r,i,o),{r:s[0],g:s[1],b:s[2],a:n}}function w_(t,e){var n=Ff(t);n[0]=hy(n[0]+e),n=zf(n),t.r=n[0],t.g=n[1],t.b=n[2]}function S_(t){if(!t)return;const e=Ff(t),n=e[0],s=Hp(e[1]),r=Hp(e[2]);return t.a<255?`hsla(${n}, ${s}%, ${r}%, ${wn(t.a)})`:`hsl(${n}, ${s}%, ${r}%)`}const Vp={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Qp={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function __(){const t={},e=Object.keys(Qp),n=Object.keys(Vp);let s,r,i,o,a;for(s=0;s<e.length;s++){for(o=a=e[s],r=0;r<n.length;r++)i=n[r],a=a.replace(i,Vp[i]);i=parseInt(Qp[o],16),t[a]=[i>>16&255,i>>8&255,i&255]}return t}let ka;function k_(t){ka||(ka=__(),ka.transparent=[0,0,0,0]);const e=ka[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}const C_=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function j_(t){const e=C_.exec(t);let n=255,s,r,i;if(e){if(e[7]!==s){const o=+e[7];n=e[8]?Ui(o):ss(o*255,0,255)}return s=+e[1],r=+e[3],i=+e[5],s=255&(e[2]?Ui(s):ss(s,0,255)),r=255&(e[4]?Ui(r):ss(r,0,255)),i=255&(e[6]?Ui(i):ss(i,0,255)),{r:s,g:r,b:i,a:n}}}function E_(t){return t&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${wn(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`)}const Gc=t=>t<=.0031308?t*12.92:Math.pow(t,1/2.4)*1.055-.055,mr=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function N_(t,e,n){const s=mr(wn(t.r)),r=mr(wn(t.g)),i=mr(wn(t.b));return{r:ms(Gc(s+n*(mr(wn(e.r))-s))),g:ms(Gc(r+n*(mr(wn(e.g))-r))),b:ms(Gc(i+n*(mr(wn(e.b))-i))),a:t.a+n*(e.a-t.a)}}function Ca(t,e,n){if(t){let s=Ff(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*n,e===0?360:1)),s=zf(s),t.r=s[0],t.g=s[1],t.b=s[2]}}function py(t,e){return t&&Object.assign(e||{},t)}function Kp(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=ms(t[3]))):(e=py(t,{r:0,g:0,b:0,a:1}),e.a=ms(e.a)),e}function M_(t){return t.charAt(0)==="r"?j_(t):b_(t)}class Mo{constructor(e){if(e instanceof Mo)return e;const n=typeof e;let s;n==="object"?s=Kp(e):n==="string"&&(s=d_(e)||k_(e)||M_(e)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var e=py(this._rgb);return e&&(e.a=wn(e.a)),e}set rgb(e){this._rgb=Kp(e)}rgbString(){return this._valid?E_(this._rgb):void 0}hexString(){return this._valid?h_(this._rgb):void 0}hslString(){return this._valid?S_(this._rgb):void 0}mix(e,n){if(e){const s=this.rgb,r=e.rgb;let i;const o=n===i?.5:n,a=2*o-1,l=s.a-r.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;i=1-c,s.r=255&c*s.r+i*r.r+.5,s.g=255&c*s.g+i*r.g+.5,s.b=255&c*s.b+i*r.b+.5,s.a=o*s.a+(1-o)*r.a,this.rgb=s}return this}interpolate(e,n){return e&&(this._rgb=N_(this._rgb,e._rgb,n)),this}clone(){return new Mo(this.rgb)}alpha(e){return this._rgb.a=ms(e),this}clearer(e){const n=this._rgb;return n.a*=1-e,this}greyscale(){const e=this._rgb,n=Yo(e.r*.3+e.g*.59+e.b*.11);return e.r=e.g=e.b=n,this}opaquer(e){const n=this._rgb;return n.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return Ca(this._rgb,2,e),this}darken(e){return Ca(this._rgb,2,-e),this}saturate(e){return Ca(this._rgb,1,e),this}desaturate(e){return Ca(this._rgb,1,-e),this}rotate(e){return w_(this._rgb,e),this}}/*!
|
|
73
|
-
* Chart.js v4.6.1
|
|
74
|
-
* https://www.chartjs.org
|
|
75
|
-
* (c) 2026 Chart.js Contributors
|
|
76
|
-
* Released under the MIT License
|
|
77
|
-
*/function gn(){}const P_=(()=>{let t=0;return()=>t++})();function le(t){return t==null}function Fe(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function ee(t){return t!==null&&Object.prototype.toString.call(t)==="[object Object]"}function Dt(t){return(typeof t=="number"||t instanceof Number)&&isFinite(+t)}function Jt(t,e){return Dt(t)?t:e}function J(t,e){return typeof t>"u"?e:t}const R_=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100:+t/e,gy=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100*e:+t;function fe(t,e,n){if(t&&typeof t.call=="function")return t.apply(n,e)}function re(t,e,n,s){let r,i,o;if(Fe(t))for(i=t.length,r=0;r<i;r++)e.call(n,t[r],r);else if(ee(t))for(o=Object.keys(t),i=o.length,r=0;r<i;r++)e.call(n,t[o[r]],o[r])}function El(t,e){let n,s,r,i;if(!t||!e||t.length!==e.length)return!1;for(n=0,s=t.length;n<s;++n)if(r=t[n],i=e[n],r.datasetIndex!==i.datasetIndex||r.index!==i.index)return!1;return!0}function Nl(t){if(Fe(t))return t.map(Nl);if(ee(t)){const e=Object.create(null),n=Object.keys(t),s=n.length;let r=0;for(;r<s;++r)e[n[r]]=Nl(t[n[r]]);return e}return t}function my(t){return["__proto__","prototype","constructor"].indexOf(t)===-1}function O_(t,e,n,s){if(!my(t))return;const r=e[t],i=n[t];ee(r)&&ee(i)?Po(r,i,s):e[t]=Nl(i)}function Po(t,e,n){const s=Fe(e)?e:[e],r=s.length;if(!ee(t))return t;n=n||{};const i=n.merger||O_;let o;for(let a=0;a<r;++a){if(o=s[a],!ee(o))continue;const l=Object.keys(o);for(let c=0,u=l.length;c<u;++c)i(l[c],t,o,n)}return t}function no(t,e){return Po(t,e,{merger:T_})}function T_(t,e,n){if(!my(t))return;const s=e[t],r=n[t];ee(s)&&ee(r)?no(s,r):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=Nl(r))}const Yp={"":t=>t,x:t=>t.x,y:t=>t.y};function D_(t){const e=t.split("."),n=[];let s="";for(const r of e)s+=r,s.endsWith("\\")?s=s.slice(0,-1)+".":(n.push(s),s="");return n}function L_(t){const e=D_(t);return n=>{for(const s of e){if(s==="")break;n=n&&n[s]}return n}}function or(t,e){return(Yp[e]||(Yp[e]=L_(e)))(t)}function Bf(t){return t.charAt(0).toUpperCase()+t.slice(1)}const Ro=t=>typeof t<"u",ws=t=>typeof t=="function",Xp=(t,e)=>{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0};function A_(t){return t.type==="mouseup"||t.type==="click"||t.type==="contextmenu"}const he=Math.PI,xe=2*he,Ml=Number.POSITIVE_INFINITY,F_=he/180,Te=he/2,Rs=he/4,qp=he*2/3,xy=Math.log10,xs=Math.sign;function Ya(t,e,n){return Math.abs(t-e)<n}function Gp(t){const e=Math.round(t);t=Ya(t,e,t/1e3)?e:t;const n=Math.pow(10,Math.floor(xy(t))),s=t/n;return(s<=1?1:s<=2?2:s<=5?5:10)*n}function I_(t){const e=[],n=Math.sqrt(t);let s;for(s=1;s<n;s++)t%s===0&&(e.push(s),e.push(t/s));return n===(n|0)&&e.push(n),e.sort((r,i)=>r-i).pop(),e}function z_(t){return typeof t=="symbol"||typeof t=="object"&&t!==null&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}function Pl(t){return!z_(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function B_(t,e){const n=Math.round(t);return n-e<=t&&n+e>=t}function W_(t,e,n){let s,r,i;for(s=0,r=t.length;s<r;s++)i=t[s][n],isNaN(i)||(e.min=Math.min(e.min,i),e.max=Math.max(e.max,i))}function Cn(t){return t*(he/180)}function U_(t){return t*(180/he)}function Jp(t){if(!Dt(t))return;let e=1,n=0;for(;Math.round(t*e)/e!==t;)e*=10,n++;return n}function yy(t,e){const n=e.x-t.x,s=e.y-t.y,r=Math.sqrt(n*n+s*s);let i=Math.atan2(s,n);return i<-.5*he&&(i+=xe),{angle:i,distance:r}}function $_(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function rn(t){return(t%xe+xe)%xe}function Rl(t,e,n,s){const r=rn(t),i=rn(e),o=rn(n),a=rn(i-r),l=rn(o-r),c=rn(r-i),u=rn(r-o);return r===i||r===o||s&&i===o||a>l&&c<u}function lt(t,e,n){return Math.max(e,Math.min(n,t))}function H_(t){return lt(t,-32768,32767)}function Us(t,e,n,s=1e-6){return t>=Math.min(e,n)-s&&t<=Math.max(e,n)+s}function Wf(t,e,n){n=n||(o=>t[o]<e);let s=t.length-1,r=0,i;for(;s-r>1;)i=r+s>>1,n(i)?r=i:s=i;return{lo:r,hi:s}}const Cd=(t,e,n,s)=>Wf(t,n,s?r=>{const i=t[r][e];return i<n||i===n&&t[r+1][e]===n}:r=>t[r][e]<n),V_=(t,e,n)=>Wf(t,n,s=>t[s][e]>=n);function Q_(t,e,n){let s=0,r=t.length;for(;s<r&&t[s]<e;)s++;for(;r>s&&t[r-1]>n;)r--;return s>0||r<t.length?t.slice(s,r):t}const vy=["push","pop","shift","splice","unshift"];function K_(t,e){if(t._chartjs){t._chartjs.listeners.push(e);return}Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),vy.forEach(n=>{const s="_onData"+Bf(n),r=t[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!1,value(...i){const o=r.apply(this,i);return t._chartjs.listeners.forEach(a=>{typeof a[s]=="function"&&a[s](...i)}),o}})})}function Zp(t,e){const n=t._chartjs;if(!n)return;const s=n.listeners,r=s.indexOf(e);r!==-1&&s.splice(r,1),!(s.length>0)&&(vy.forEach(i=>{delete t[i]}),delete t._chartjs)}function by(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const wy=function(){return typeof window>"u"?function(t){return t()}:window.requestAnimationFrame}();function Sy(t,e){let n=[],s=!1;return function(...r){n=r,s||(s=!0,wy.call(window,()=>{s=!1,t.apply(e,n)}))}}function Y_(t,e){let n;return function(...s){return e?(clearTimeout(n),n=setTimeout(t,e,s)):t.apply(this,s),e}}const _y=t=>t==="start"?"left":t==="end"?"right":"center",xt=(t,e,n)=>t==="start"?e:t==="end"?n:(e+n)/2,X_=(t,e,n,s)=>t===(s?"left":"right")?n:t==="center"?(e+n)/2:e,ja=t=>t===0||t===1,eg=(t,e,n)=>-(Math.pow(2,10*(t-=1))*Math.sin((t-e)*xe/n)),tg=(t,e,n)=>Math.pow(2,-10*t)*Math.sin((t-e)*xe/n)+1,so={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>-Math.cos(t*Te)+1,easeOutSine:t=>Math.sin(t*Te),easeInOutSine:t=>-.5*(Math.cos(he*t)-1),easeInExpo:t=>t===0?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>t===1?1:-Math.pow(2,-10*t)+1,easeInOutExpo:t=>ja(t)?t:t<.5?.5*Math.pow(2,10*(t*2-1)):.5*(-Math.pow(2,-10*(t*2-1))+2),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>ja(t)?t:eg(t,.075,.3),easeOutElastic:t=>ja(t)?t:tg(t,.075,.3),easeInOutElastic(t){return ja(t)?t:t<.5?.5*eg(t*2,.1125,.45):.5+.5*tg(t*2-1,.1125,.45)},easeInBack(t){return t*t*((1.70158+1)*t-1.70158)},easeOutBack(t){return(t-=1)*t*((1.70158+1)*t+1.70158)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?.5*(t*t*(((e*=1.525)+1)*t-e)):.5*((t-=2)*t*(((e*=1.525)+1)*t+e)+2)},easeInBounce:t=>1-so.easeOutBounce(1-t),easeOutBounce(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:t=>t<.5?so.easeInBounce(t*2)*.5:so.easeOutBounce(t*2-1)*.5+.5};function ky(t){if(t&&typeof t=="object"){const e=t.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function ng(t){return ky(t)?t:new Mo(t)}function Jc(t){return ky(t)?t:new Mo(t).saturate(.5).darken(.1).hexString()}const q_=["x","y","borderWidth","radius","tension"],G_=["color","borderColor","backgroundColor"];function J_(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:e=>e!=="onProgress"&&e!=="onComplete"&&e!=="fn"}),t.set("animations",{colors:{type:"color",properties:G_},numbers:{type:"number",properties:q_}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:e=>e|0}}}})}function Z_(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const sg=new Map;function ek(t,e){e=e||{};const n=t+JSON.stringify(e);let s=sg.get(n);return s||(s=new Intl.NumberFormat(t,e),sg.set(n,s)),s}function Uf(t,e,n){return ek(e,n).format(t)}const tk={values(t){return Fe(t)?t:""+t},numeric(t,e,n){if(t===0)return"0";const s=this.chart.options.locale;let r,i=t;if(n.length>1){const c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(r="scientific"),i=nk(t,n)}const o=xy(Math.abs(i)),a=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),l={notation:r,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Uf(t,s,l)}};function nk(t,e){let n=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(n)>=1&&t!==Math.floor(t)&&(n=t-Math.floor(t)),n}var Cy={formatters:tk};function sk(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(e,n)=>n.lineWidth,tickColor:(e,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Cy.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:e=>!e.startsWith("before")&&!e.startsWith("after")&&e!=="callback"&&e!=="parser",_indexable:e=>e!=="borderDash"&&e!=="tickBorderDash"&&e!=="dash"}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:e=>e!=="backdropPadding"&&e!=="callback",_indexable:e=>e!=="backdropPadding"})}const ar=Object.create(null),jd=Object.create(null);function ro(t,e){if(!e)return t;const n=e.split(".");for(let s=0,r=n.length;s<r;++s){const i=n[s];t=t[i]||(t[i]=Object.create(null))}return t}function Zc(t,e,n){return typeof e=="string"?Po(ro(t,e),n):Po(ro(t,""),e)}class rk{constructor(e,n){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=s=>s.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(s,r)=>Jc(r.backgroundColor),this.hoverBorderColor=(s,r)=>Jc(r.borderColor),this.hoverColor=(s,r)=>Jc(r.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e),this.apply(n)}set(e,n){return Zc(this,e,n)}get(e){return ro(this,e)}describe(e,n){return Zc(jd,e,n)}override(e,n){return Zc(ar,e,n)}route(e,n,s,r){const i=ro(this,e),o=ro(this,s),a="_"+n;Object.defineProperties(i,{[a]:{value:i[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[a],c=o[r];return ee(l)?Object.assign({},c,l):J(l,c)},set(l){this[a]=l}}})}apply(e){e.forEach(n=>n(this))}}var je=new rk({_scriptable:t=>!t.startsWith("on"),_indexable:t=>t!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[J_,Z_,sk]);function ik(t){return!t||le(t.size)||le(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function rg(t,e,n,s,r){let i=e[r];return i||(i=e[r]=t.measureText(r).width,n.push(r)),i>s&&(s=i),s}function Os(t,e,n){const s=t.currentDevicePixelRatio,r=n!==0?Math.max(n/2,.5):0;return Math.round((e-r)*s)/s+r}function ig(t,e){!e&&!t||(e=e||t.getContext("2d"),e.save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function og(t,e,n,s){jy(t,e,n,s,null)}function jy(t,e,n,s,r){let i,o,a,l,c,u,f,h;const p=e.pointStyle,y=e.rotation,m=e.radius;let b=(y||0)*F_;if(p&&typeof p=="object"&&(i=p.toString(),i==="[object HTMLImageElement]"||i==="[object HTMLCanvasElement]")){t.save(),t.translate(n,s),t.rotate(b),t.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),t.restore();return}if(!(isNaN(m)||m<=0)){switch(t.beginPath(),p){default:r?t.ellipse(n,s,r/2,m,0,0,xe):t.arc(n,s,m,0,xe),t.closePath();break;case"triangle":u=r?r/2:m,t.moveTo(n+Math.sin(b)*u,s-Math.cos(b)*m),b+=qp,t.lineTo(n+Math.sin(b)*u,s-Math.cos(b)*m),b+=qp,t.lineTo(n+Math.sin(b)*u,s-Math.cos(b)*m),t.closePath();break;case"rectRounded":c=m*.516,l=m-c,o=Math.cos(b+Rs)*l,f=Math.cos(b+Rs)*(r?r/2-c:l),a=Math.sin(b+Rs)*l,h=Math.sin(b+Rs)*(r?r/2-c:l),t.arc(n-f,s-a,c,b-he,b-Te),t.arc(n+h,s-o,c,b-Te,b),t.arc(n+f,s+a,c,b,b+Te),t.arc(n-h,s+o,c,b+Te,b+he),t.closePath();break;case"rect":if(!y){l=Math.SQRT1_2*m,u=r?r/2:l,t.rect(n-u,s-l,2*u,2*l);break}b+=Rs;case"rectRot":f=Math.cos(b)*(r?r/2:m),o=Math.cos(b)*m,a=Math.sin(b)*m,h=Math.sin(b)*(r?r/2:m),t.moveTo(n-f,s-a),t.lineTo(n+h,s-o),t.lineTo(n+f,s+a),t.lineTo(n-h,s+o),t.closePath();break;case"crossRot":b+=Rs;case"cross":f=Math.cos(b)*(r?r/2:m),o=Math.cos(b)*m,a=Math.sin(b)*m,h=Math.sin(b)*(r?r/2:m),t.moveTo(n-f,s-a),t.lineTo(n+f,s+a),t.moveTo(n+h,s-o),t.lineTo(n-h,s+o);break;case"star":f=Math.cos(b)*(r?r/2:m),o=Math.cos(b)*m,a=Math.sin(b)*m,h=Math.sin(b)*(r?r/2:m),t.moveTo(n-f,s-a),t.lineTo(n+f,s+a),t.moveTo(n+h,s-o),t.lineTo(n-h,s+o),b+=Rs,f=Math.cos(b)*(r?r/2:m),o=Math.cos(b)*m,a=Math.sin(b)*m,h=Math.sin(b)*(r?r/2:m),t.moveTo(n-f,s-a),t.lineTo(n+f,s+a),t.moveTo(n+h,s-o),t.lineTo(n-h,s+o);break;case"line":o=r?r/2:Math.cos(b)*m,a=Math.sin(b)*m,t.moveTo(n-o,s-a),t.lineTo(n+o,s+a);break;case"dash":t.moveTo(n,s),t.lineTo(n+Math.cos(b)*(r?r/2:m),s+Math.sin(b)*m);break;case!1:t.closePath();break}t.fill(),e.borderWidth>0&&t.stroke()}}function Ey(t,e,n){return n=n||.5,!e||t&&t.x>e.left-n&&t.x<e.right+n&&t.y>e.top-n&&t.y<e.bottom+n}function $f(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function Hf(t){t.restore()}function ok(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),le(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}function ak(t,e,n,s,r){if(r.strikethrough||r.underline){const i=t.measureText(s),o=e-i.actualBoundingBoxLeft,a=e+i.actualBoundingBoxRight,l=n-i.actualBoundingBoxAscent,c=n+i.actualBoundingBoxDescent,u=r.strikethrough?(l+c)/2:c;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=r.decorationWidth||2,t.moveTo(o,u),t.lineTo(a,u),t.stroke()}}function lk(t,e){const n=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=n}function Ol(t,e,n,s,r,i={}){const o=Fe(e)?e:[e],a=i.strokeWidth>0&&i.strokeColor!=="";let l,c;for(t.save(),t.font=r.string,ok(t,i),l=0;l<o.length;++l)c=o[l],i.backdrop&&lk(t,i.backdrop),a&&(i.strokeColor&&(t.strokeStyle=i.strokeColor),le(i.strokeWidth)||(t.lineWidth=i.strokeWidth),t.strokeText(c,n,s,i.maxWidth)),t.fillText(c,n,s,i.maxWidth),ak(t,n,s,c,i),s+=Number(r.lineHeight);t.restore()}function Tl(t,e){const{x:n,y:s,w:r,h:i,radius:o}=e;t.arc(n+o.topLeft,s+o.topLeft,o.topLeft,1.5*he,he,!0),t.lineTo(n,s+i-o.bottomLeft),t.arc(n+o.bottomLeft,s+i-o.bottomLeft,o.bottomLeft,he,Te,!0),t.lineTo(n+r-o.bottomRight,s+i),t.arc(n+r-o.bottomRight,s+i-o.bottomRight,o.bottomRight,Te,0,!0),t.lineTo(n+r,s+o.topRight),t.arc(n+r-o.topRight,s+o.topRight,o.topRight,0,-Te,!0),t.lineTo(n+o.topLeft,s)}const ck=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,uk=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function dk(t,e){const n=(""+t).match(ck);if(!n||n[1]==="normal")return e*1.2;switch(t=+n[2],n[3]){case"px":return t;case"%":t/=100;break}return e*t}const fk=t=>+t||0;function Vf(t,e){const n={},s=ee(e),r=s?Object.keys(e):e,i=ee(t)?s?o=>J(t[o],t[e[o]]):o=>t[o]:()=>t;for(const o of r)n[o]=fk(i(o));return n}function Ny(t){return Vf(t,{top:"y",right:"x",bottom:"y",left:"x"})}function Fr(t){return Vf(t,["topLeft","topRight","bottomLeft","bottomRight"])}function Qt(t){const e=Ny(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function ct(t,e){t=t||{},e=e||je.font;let n=J(t.size,e.size);typeof n=="string"&&(n=parseInt(n,10));let s=J(t.style,e.style);s&&!(""+s).match(uk)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const r={family:J(t.family,e.family),lineHeight:dk(J(t.lineHeight,e.lineHeight),n),size:n,style:s,weight:J(t.weight,e.weight),string:""};return r.string=ik(r),r}function Ea(t,e,n,s){let r,i,o;for(r=0,i=t.length;r<i;++r)if(o=t[r],o!==void 0&&o!==void 0)return o}function hk(t,e,n){const{min:s,max:r}=t,i=gy(e,(r-s)/2),o=(a,l)=>n&&a===0?0:a+l;return{min:o(s,-Math.abs(i)),max:o(r,i)}}function pi(t,e){return Object.assign(Object.create(t),e)}function Qf(t,e=[""],n,s,r=()=>t[0]){const i=n||t;typeof s>"u"&&(s=Oy("_fallback",t));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:i,_fallback:s,_getTarget:r,override:a=>Qf([a,...t],e,i,s)};return new Proxy(o,{deleteProperty(a,l){return delete a[l],delete a._keys,delete t[0][l],!0},get(a,l){return Py(a,l,()=>wk(l,e,t,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(t[0])},has(a,l){return lg(a).includes(l)},ownKeys(a){return lg(a)},set(a,l,c){const u=a._storage||(a._storage=r());return a[l]=u[l]=c,delete a._keys,!0}})}function ci(t,e,n,s){const r={_cacheable:!1,_proxy:t,_context:e,_subProxy:n,_stack:new Set,_descriptors:My(t,s),setContext:i=>ci(t,i,n,s),override:i=>ci(t.override(i),e,n,s)};return new Proxy(r,{deleteProperty(i,o){return delete i[o],delete t[o],!0},get(i,o,a){return Py(i,o,()=>gk(i,o,a))},getOwnPropertyDescriptor(i,o){return i._descriptors.allKeys?Reflect.has(t,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,o)},getPrototypeOf(){return Reflect.getPrototypeOf(t)},has(i,o){return Reflect.has(t,o)},ownKeys(){return Reflect.ownKeys(t)},set(i,o,a){return t[o]=a,delete i[o],!0}})}function My(t,e={scriptable:!0,indexable:!0}){const{_scriptable:n=e.scriptable,_indexable:s=e.indexable,_allKeys:r=e.allKeys}=t;return{allKeys:r,scriptable:n,indexable:s,isScriptable:ws(n)?n:()=>n,isIndexable:ws(s)?s:()=>s}}const pk=(t,e)=>t?t+Bf(e):e,Kf=(t,e)=>ee(e)&&t!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function Py(t,e,n){if(Object.prototype.hasOwnProperty.call(t,e)||e==="constructor")return t[e];const s=n();return t[e]=s,s}function gk(t,e,n){const{_proxy:s,_context:r,_subProxy:i,_descriptors:o}=t;let a=s[e];return ws(a)&&o.isScriptable(e)&&(a=mk(e,a,t,n)),Fe(a)&&a.length&&(a=xk(e,a,t,o.isIndexable)),Kf(e,a)&&(a=ci(a,r,i&&i[e],o)),a}function mk(t,e,n,s){const{_proxy:r,_context:i,_subProxy:o,_stack:a}=n;if(a.has(t))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+t);a.add(t);let l=e(i,o||s);return a.delete(t),Kf(t,l)&&(l=Yf(r._scopes,r,t,l)),l}function xk(t,e,n,s){const{_proxy:r,_context:i,_subProxy:o,_descriptors:a}=n;if(typeof i.index<"u"&&s(t))return e[i.index%e.length];if(ee(e[0])){const l=e,c=r._scopes.filter(u=>u!==l);e=[];for(const u of l){const f=Yf(c,r,t,u);e.push(ci(f,i,o&&o[t],a))}}return e}function Ry(t,e,n){return ws(t)?t(e,n):t}const yk=(t,e)=>t===!0?e:typeof t=="string"?or(e,t):void 0;function vk(t,e,n,s,r){for(const i of e){const o=yk(n,i);if(o){t.add(o);const a=Ry(o._fallback,n,r);if(typeof a<"u"&&a!==n&&a!==s)return a}else if(o===!1&&typeof s<"u"&&n!==s)return null}return!1}function Yf(t,e,n,s){const r=e._rootScopes,i=Ry(e._fallback,n,s),o=[...t,...r],a=new Set;a.add(s);let l=ag(a,o,n,i||n,s);return l===null||typeof i<"u"&&i!==n&&(l=ag(a,o,i,l,s),l===null)?!1:Qf(Array.from(a),[""],r,i,()=>bk(e,n,s))}function ag(t,e,n,s,r){for(;n;)n=vk(t,e,n,s,r);return n}function bk(t,e,n){const s=t._getTarget();e in s||(s[e]={});const r=s[e];return Fe(r)&&ee(n)?n:r||{}}function wk(t,e,n,s){let r;for(const i of e)if(r=Oy(pk(i,t),n),typeof r<"u")return Kf(t,r)?Yf(n,s,t,r):r}function Oy(t,e){for(const n of e){if(!n)continue;const s=n[t];if(typeof s<"u")return s}}function lg(t){let e=t._keys;return e||(e=t._keys=Sk(t._scopes)),e}function Sk(t){const e=new Set;for(const n of t)for(const s of Object.keys(n).filter(r=>!r.startsWith("_")))e.add(s);return Array.from(e)}function Xf(){return typeof window<"u"&&typeof document<"u"}function qf(t){let e=t.parentNode;return e&&e.toString()==="[object ShadowRoot]"&&(e=e.host),e}function Dl(t,e,n){let s;return typeof t=="string"?(s=parseInt(t,10),t.indexOf("%")!==-1&&(s=s/100*e.parentNode[n])):s=t,s}const cc=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);function _k(t,e){return cc(t).getPropertyValue(e)}const kk=["top","right","bottom","left"];function er(t,e,n){const s={};n=n?"-"+n:"";for(let r=0;r<4;r++){const i=kk[r];s[i]=parseFloat(t[e+"-"+i+n])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const Ck=(t,e,n)=>(t>0||e>0)&&(!n||!n.shadowRoot);function jk(t,e){const n=t.touches,s=n&&n.length?n[0]:t,{offsetX:r,offsetY:i}=s;let o=!1,a,l;if(Ck(r,i,t.target))a=r,l=i;else{const c=e.getBoundingClientRect();a=s.clientX-c.left,l=s.clientY-c.top,o=!0}return{x:a,y:l,box:o}}function Fs(t,e){if("native"in t)return t;const{canvas:n,currentDevicePixelRatio:s}=e,r=cc(n),i=r.boxSizing==="border-box",o=er(r,"padding"),a=er(r,"border","width"),{x:l,y:c,box:u}=jk(t,n),f=o.left+(u&&a.left),h=o.top+(u&&a.top);let{width:p,height:y}=e;return i&&(p-=o.width+a.width,y-=o.height+a.height),{x:Math.round((l-f)/p*n.width/s),y:Math.round((c-h)/y*n.height/s)}}function Ek(t,e,n){let s,r;if(e===void 0||n===void 0){const i=t&&qf(t);if(!i)e=t.clientWidth,n=t.clientHeight;else{const o=i.getBoundingClientRect(),a=cc(i),l=er(a,"border","width"),c=er(a,"padding");e=o.width-c.width-l.width,n=o.height-c.height-l.height,s=Dl(a.maxWidth,i,"clientWidth"),r=Dl(a.maxHeight,i,"clientHeight")}}return{width:e,height:n,maxWidth:s||Ml,maxHeight:r||Ml}}const rs=t=>Math.round(t*10)/10;function Nk(t,e,n,s){const r=cc(t),i=er(r,"margin"),o=Dl(r.maxWidth,t,"clientWidth")||Ml,a=Dl(r.maxHeight,t,"clientHeight")||Ml,l=Ek(t,e,n);let{width:c,height:u}=l;if(r.boxSizing==="content-box"){const h=er(r,"border","width"),p=er(r,"padding");c-=p.width+h.width,u-=p.height+h.height}return c=Math.max(0,c-i.width),u=Math.max(0,s?c/s:u-i.height),c=rs(Math.min(c,o,l.maxWidth)),u=rs(Math.min(u,a,l.maxHeight)),c&&!u&&(u=rs(c/2)),(e!==void 0||n!==void 0)&&s&&l.height&&u>l.height&&(u=l.height,c=rs(Math.floor(u*s))),{width:c,height:u}}function cg(t,e,n){const s=e||1,r=rs(t.height*s),i=rs(t.width*s);t.height=rs(t.height),t.width=rs(t.width);const o=t.canvas;o.style&&(n||!o.style.height&&!o.style.width)&&(o.style.height=`${t.height}px`,o.style.width=`${t.width}px`);const a=Math.floor(r),l=Math.floor(i);return t.currentDevicePixelRatio!==s||o.height!==a||o.width!==l?(t.currentDevicePixelRatio=s,o.height=a,o.width=l,t.ctx.setTransform(s,0,0,s,0,0),!0):!1}const Mk=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};Xf()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch{}return t}();function ug(t,e){const n=_k(t,e),s=n&&n.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}const Pk=function(t,e){return{x(n){return t+t+e-n},setWidth(n){e=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,s){return n-s},leftForLtr(n,s){return n-s}}},Rk=function(){return{x(t){return t},setWidth(t){},textAlign(t){return t},xPlus(t,e){return t+e},leftForLtr(t,e){return t}}};function Ir(t,e,n){return t?Pk(e,n):Rk()}function Ty(t,e){let n,s;(e==="ltr"||e==="rtl")&&(n=t.canvas.style,s=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",e,"important"),t.prevTextDirection=s)}function Dy(t,e){e!==void 0&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Na(t,e,n){return t.options.clip?t[n]:e[n]}function Ok(t,e){const{xScale:n,yScale:s}=t;return n&&s?{left:Na(n,e,"left"),right:Na(n,e,"right"),top:Na(s,e,"top"),bottom:Na(s,e,"bottom")}:e}function Tk(t,e){const n=e._clip;if(n.disabled)return!1;const s=Ok(e,t.chartArea);return{left:n.left===!1?0:s.left-(n.left===!0?0:n.left),right:n.right===!1?t.width:s.right+(n.right===!0?0:n.right),top:n.top===!1?0:s.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?t.height:s.bottom+(n.bottom===!0?0:n.bottom)}}/*!
|
|
78
|
-
* Chart.js v4.6.1
|
|
79
|
-
* https://www.chartjs.org
|
|
80
|
-
* (c) 2026 Chart.js Contributors
|
|
81
|
-
* Released under the MIT License
|
|
82
|
-
*/class Dk{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,n,s,r){const i=n.listeners[r],o=n.duration;i.forEach(a=>a({chart:e,initial:n.initial,numSteps:o,currentStep:Math.min(s-n.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=wy.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let n=0;this._charts.forEach((s,r)=>{if(!s.running||!s.items.length)return;const i=s.items;let o=i.length-1,a=!1,l;for(;o>=0;--o)l=i[o],l._active?(l._total>s.duration&&(s.duration=l._total),l.tick(e),a=!0):(i[o]=i[i.length-1],i.pop());a&&(r.draw(),this._notify(r,s,e,"progress")),i.length||(s.running=!1,this._notify(r,s,e,"complete"),s.initial=!1),n+=i.length}),this._lastDate=e,n===0&&(this._running=!1)}_getAnims(e){const n=this._charts;let s=n.get(e);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(e,s)),s}listen(e,n,s){this._getAnims(e).listeners[n].push(s)}add(e,n){!n||!n.length||this._getAnims(e).items.push(...n)}has(e){return this._getAnims(e).items.length>0}start(e){const n=this._charts.get(e);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((s,r)=>Math.max(s,r._duration),0),this._refresh())}running(e){if(!this._running)return!1;const n=this._charts.get(e);return!(!n||!n.running||!n.items.length)}stop(e){const n=this._charts.get(e);if(!n||!n.items.length)return;const s=n.items;let r=s.length-1;for(;r>=0;--r)s[r].cancel();n.items=[],this._notify(e,n,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var xn=new Dk;const dg="transparent",Lk={boolean(t,e,n){return n>.5?e:t},color(t,e,n){const s=ng(t||dg),r=s.valid&&ng(e||dg);return r&&r.valid?r.mix(s,n).hexString():e},number(t,e,n){return t+(e-t)*n}};class Ak{constructor(e,n,s,r){const i=n[s];r=Ea([e.to,r,i,e.from]);const o=Ea([e.from,i,r]);this._active=!0,this._fn=e.fn||Lk[e.type||typeof o],this._easing=so[e.easing]||so.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=n,this._prop=s,this._from=o,this._to=r,this._promises=void 0}active(){return this._active}update(e,n,s){if(this._active){this._notify(!1);const r=this._target[this._prop],i=s-this._start,o=this._duration-i;this._start=s,this._duration=Math.floor(Math.max(o,e.duration)),this._total+=i,this._loop=!!e.loop,this._to=Ea([e.to,n,r,e.from]),this._from=Ea([e.from,r,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const n=e-this._start,s=this._duration,r=this._prop,i=this._from,o=this._loop,a=this._to;let l;if(this._active=i!==a&&(o||n<s),!this._active){this._target[r]=a,this._notify(!0);return}if(n<0){this._target[r]=i;return}l=n/s%2,l=o&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[r]=this._fn(i,a,l)}wait(){const e=this._promises||(this._promises=[]);return new Promise((n,s)=>{e.push({res:n,rej:s})})}_notify(e){const n=e?"res":"rej",s=this._promises||[];for(let r=0;r<s.length;r++)s[r][n]()}}class Ly{constructor(e,n){this._chart=e,this._properties=new Map,this.configure(n)}configure(e){if(!ee(e))return;const n=Object.keys(je.animation),s=this._properties;Object.getOwnPropertyNames(e).forEach(r=>{const i=e[r];if(!ee(i))return;const o={};for(const a of n)o[a]=i[a];(Fe(i.properties)&&i.properties||[r]).forEach(a=>{(a===r||!s.has(a))&&s.set(a,o)})})}_animateOptions(e,n){const s=n.options,r=Ik(e,s);if(!r)return[];const i=this._createAnimations(r,s);return s.$shared&&Fk(e.options.$animations,s).then(()=>{e.options=s},()=>{}),i}_createAnimations(e,n){const s=this._properties,r=[],i=e.$animations||(e.$animations={}),o=Object.keys(n),a=Date.now();let l;for(l=o.length-1;l>=0;--l){const c=o[l];if(c.charAt(0)==="$")continue;if(c==="options"){r.push(...this._animateOptions(e,n));continue}const u=n[c];let f=i[c];const h=s.get(c);if(f)if(h&&f.active()){f.update(h,u,a);continue}else f.cancel();if(!h||!h.duration){e[c]=u;continue}i[c]=f=new Ak(h,e,c,u),r.push(f)}return r}update(e,n){if(this._properties.size===0){Object.assign(e,n);return}const s=this._createAnimations(e,n);if(s.length)return xn.add(this._chart,s),!0}}function Fk(t,e){const n=[],s=Object.keys(e);for(let r=0;r<s.length;r++){const i=t[s[r]];i&&i.active()&&n.push(i.wait())}return Promise.all(n)}function Ik(t,e){if(!e)return;let n=t.options;if(!n){t.options=e;return}return n.$shared&&(t.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function fg(t,e){const n=t&&t.options||{},s=n.reverse,r=n.min===void 0?e:0,i=n.max===void 0?e:0;return{start:s?i:r,end:s?r:i}}function zk(t,e,n){if(n===!1)return!1;const s=fg(t,n),r=fg(e,n);return{top:r.end,right:s.end,bottom:r.start,left:s.start}}function Bk(t){let e,n,s,r;return ee(t)?(e=t.top,n=t.right,s=t.bottom,r=t.left):e=n=s=r=t,{top:e,right:n,bottom:s,left:r,disabled:t===!1}}function Ay(t,e){const n=[],s=t._getSortedDatasetMetas(e);let r,i;for(r=0,i=s.length;r<i;++r)n.push(s[r].index);return n}function hg(t,e,n,s={}){const r=t.keys,i=s.mode==="single";let o,a,l,c;if(e===null)return;let u=!1;for(o=0,a=r.length;o<a;++o){if(l=+r[o],l===n){if(u=!0,s.all)continue;break}c=t.values[l],Dt(c)&&(i||e===0||xs(e)===xs(c))&&(e+=c)}return!u&&!s.all?0:e}function Wk(t,e){const{iScale:n,vScale:s}=e,r=n.axis==="x"?"x":"y",i=s.axis==="x"?"x":"y",o=Object.keys(t),a=new Array(o.length);let l,c,u;for(l=0,c=o.length;l<c;++l)u=o[l],a[l]={[r]:u,[i]:t[u]};return a}function eu(t,e){const n=t&&t.options.stacked;return n||n===void 0&&e.stack!==void 0}function Uk(t,e,n){return`${t.id}.${e.id}.${n.stack||n.type}`}function $k(t){const{min:e,max:n,minDefined:s,maxDefined:r}=t.getUserBounds();return{min:s?e:Number.NEGATIVE_INFINITY,max:r?n:Number.POSITIVE_INFINITY}}function Hk(t,e,n){const s=t[e]||(t[e]={});return s[n]||(s[n]={})}function pg(t,e,n,s){for(const r of e.getMatchingVisibleMetas(s).reverse()){const i=t[r.index];if(n&&i>0||!n&&i<0)return r.index}return null}function gg(t,e){const{chart:n,_cachedMeta:s}=t,r=n._stacks||(n._stacks={}),{iScale:i,vScale:o,index:a}=s,l=i.axis,c=o.axis,u=Uk(i,o,s),f=e.length;let h;for(let p=0;p<f;++p){const y=e[p],{[l]:m,[c]:b}=y,x=y._stacks||(y._stacks={});h=x[c]=Hk(r,u,m),h[a]=b,h._top=pg(h,o,!0,s.type),h._bottom=pg(h,o,!1,s.type);const g=h._visualValues||(h._visualValues={});g[a]=b}}function tu(t,e){const n=t.scales;return Object.keys(n).filter(s=>n[s].axis===e).shift()}function Vk(t,e){return pi(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function Qk(t,e,n){return pi(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:n,index:e,mode:"default",type:"data"})}function Ri(t,e){const n=t.controller.index,s=t.vScale&&t.vScale.axis;if(s){e=e||t._parsed;for(const r of e){const i=r._stacks;!i||i[s]===void 0||i[s][n]===void 0||(delete i[s][n],i[s]._visualValues!==void 0&&i[s]._visualValues[n]!==void 0&&delete i[s]._visualValues[n])}}}const nu=t=>t==="reset"||t==="none",mg=(t,e)=>e?t:Object.assign({},t),Kk=(t,e,n)=>t&&!e.hidden&&e._stacked&&{keys:Ay(n,!0),values:null};class zr{constructor(e,n){this.chart=e,this._ctx=e.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=eu(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(e){this.index!==e&&Ri(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,n=this._cachedMeta,s=this.getDataset(),r=(f,h,p,y)=>f==="x"?h:f==="r"?y:p,i=n.xAxisID=J(s.xAxisID,tu(e,"x")),o=n.yAxisID=J(s.yAxisID,tu(e,"y")),a=n.rAxisID=J(s.rAxisID,tu(e,"r")),l=n.indexAxis,c=n.iAxisID=r(l,i,o,a),u=n.vAxisID=r(l,o,i,a);n.xScale=this.getScaleForId(i),n.yScale=this.getScaleForId(o),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const n=this._cachedMeta;return e===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&Zp(this._data,this),e._stacked&&Ri(e)}_dataCheck(){const e=this.getDataset(),n=e.data||(e.data=[]),s=this._data;if(ee(n)){const r=this._cachedMeta;this._data=Wk(n,r)}else if(s!==n){if(s){Zp(s,this);const r=this._cachedMeta;Ri(r),r._parsed=[]}n&&Object.isExtensible(n)&&K_(n,this),this._syncList=[],this._data=n}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const n=this._cachedMeta,s=this.getDataset();let r=!1;this._dataCheck();const i=n._stacked;n._stacked=eu(n.vScale,n),n.stack!==s.stack&&(r=!0,Ri(n),n.stack=s.stack),this._resyncElements(e),(r||i!==n._stacked)&&(gg(this,n._parsed),n._stacked=eu(n.vScale,n))}configure(){const e=this.chart.config,n=e.datasetScopeKeys(this._type),s=e.getOptionScopes(this.getDataset(),n,!0);this.options=e.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,n){const{_cachedMeta:s,_data:r}=this,{iScale:i,_stacked:o}=s,a=i.axis;let l=e===0&&n===r.length?!0:s._sorted,c=e>0&&s._parsed[e-1],u,f,h;if(this._parsing===!1)s._parsed=r,s._sorted=!0,h=r;else{Fe(r[e])?h=this.parseArrayData(s,r,e,n):ee(r[e])?h=this.parseObjectData(s,r,e,n):h=this.parsePrimitiveData(s,r,e,n);const p=()=>f[a]===null||c&&f[a]<c[a];for(u=0;u<n;++u)s._parsed[u+e]=f=h[u],l&&(p()&&(l=!1),c=f);s._sorted=l}o&&gg(this,h)}parsePrimitiveData(e,n,s,r){const{iScale:i,vScale:o}=e,a=i.axis,l=o.axis,c=i.getLabels(),u=i===o,f=new Array(r);let h,p,y;for(h=0,p=r;h<p;++h)y=h+s,f[h]={[a]:u||i.parse(c[y],y),[l]:o.parse(n[y],y)};return f}parseArrayData(e,n,s,r){const{xScale:i,yScale:o}=e,a=new Array(r);let l,c,u,f;for(l=0,c=r;l<c;++l)u=l+s,f=n[u],a[l]={x:i.parse(f[0],u),y:o.parse(f[1],u)};return a}parseObjectData(e,n,s,r){const{xScale:i,yScale:o}=e,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(r);let u,f,h,p;for(u=0,f=r;u<f;++u)h=u+s,p=n[h],c[u]={x:i.parse(or(p,a),h),y:o.parse(or(p,l),h)};return c}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,n,s){const r=this.chart,i=this._cachedMeta,o=n[e.axis],a={keys:Ay(r,!0),values:n._stacks[e.axis]._visualValues};return hg(a,o,i.index,{mode:s})}updateRangeFromParsed(e,n,s,r){const i=s[n.axis];let o=i===null?NaN:i;const a=r&&s._stacks[n.axis];r&&a&&(r.values=a,o=hg(r,i,this._cachedMeta.index)),e.min=Math.min(e.min,o),e.max=Math.max(e.max,o)}getMinMax(e,n){const s=this._cachedMeta,r=s._parsed,i=s._sorted&&e===s.iScale,o=r.length,a=this._getOtherScale(e),l=Kk(n,s,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:f}=$k(a);let h,p;function y(){p=r[h];const m=p[a.axis];return!Dt(p[e.axis])||u>m||f<m}for(h=0;h<o&&!(!y()&&(this.updateRangeFromParsed(c,e,p,l),i));++h);if(i){for(h=o-1;h>=0;--h)if(!y()){this.updateRangeFromParsed(c,e,p,l);break}}return c}getAllParsedValues(e){const n=this._cachedMeta._parsed,s=[];let r,i,o;for(r=0,i=n.length;r<i;++r)o=n[r][e.axis],Dt(o)&&s.push(o);return s}getMaxOverflow(){return!1}getLabelAndValue(e){const n=this._cachedMeta,s=n.iScale,r=n.vScale,i=this.getParsed(e);return{label:s?""+s.getLabelForValue(i[s.axis]):"",value:r?""+r.getLabelForValue(i[r.axis]):""}}_update(e){const n=this._cachedMeta;this.update(e||"default"),n._clip=Bk(J(this.options.clip,zk(n.xScale,n.yScale,this.getMaxOverflow())))}update(e){}draw(){const e=this._ctx,n=this.chart,s=this._cachedMeta,r=s.data||[],i=n.chartArea,o=[],a=this._drawStart||0,l=this._drawCount||r.length-a,c=this.options.drawActiveElementsOnTop;let u;for(s.dataset&&s.dataset.draw(e,i,a,l),u=a;u<a+l;++u){const f=r[u];f.hidden||(f.active&&c?o.push(f):f.draw(e,i))}for(u=0;u<o.length;++u)o[u].draw(e,i)}getStyle(e,n){const s=n?"active":"default";return e===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(s):this.resolveDataElementOptions(e||0,s)}getContext(e,n,s){const r=this.getDataset();let i;if(e>=0&&e<this._cachedMeta.data.length){const o=this._cachedMeta.data[e];i=o.$context||(o.$context=Qk(this.getContext(),e,o)),i.parsed=this.getParsed(e),i.raw=r.data[e],i.index=i.dataIndex=e}else i=this.$context||(this.$context=Vk(this.chart.getContext(),this.index)),i.dataset=r,i.index=i.datasetIndex=this.index;return i.active=!!n,i.mode=s,i}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,n){return this._resolveElementOptions(this.dataElementType.id,n,e)}_resolveElementOptions(e,n="default",s){const r=n==="active",i=this._cachedDataOpts,o=e+"-"+n,a=i[o],l=this.enableOptionSharing&&Ro(s);if(a)return mg(a,l);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,e),f=r?[`${e}Hover`,"hover",e,""]:[e,""],h=c.getOptionScopes(this.getDataset(),u),p=Object.keys(je.elements[e]),y=()=>this.getContext(s,r,n),m=c.resolveNamedOptions(h,p,y,f);return m.$shared&&(m.$shared=l,i[o]=Object.freeze(mg(m,l))),m}_resolveAnimations(e,n,s){const r=this.chart,i=this._cachedDataOpts,o=`animation-${n}`,a=i[o];if(a)return a;let l;if(r.options.animation!==!1){const u=this.chart.config,f=u.datasetAnimationScopeKeys(this._type,n),h=u.getOptionScopes(this.getDataset(),f);l=u.createResolver(h,this.getContext(e,s,n))}const c=new Ly(r,l&&l.animations);return l&&l._cacheable&&(i[o]=Object.freeze(c)),c}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,n){return!n||nu(e)||this.chart._animationsDisabled}_getSharedOptions(e,n){const s=this.resolveDataElementOptions(e,n),r=this._sharedOptions,i=this.getSharedOptions(s),o=this.includeOptions(n,i)||i!==r;return this.updateSharedOptions(i,n,s),{sharedOptions:i,includeOptions:o}}updateElement(e,n,s,r){nu(r)?Object.assign(e,s):this._resolveAnimations(n,r).update(e,s)}updateSharedOptions(e,n,s){e&&!nu(n)&&this._resolveAnimations(void 0,n).update(e,s)}_setStyle(e,n,s,r){e.active=r;const i=this.getStyle(n,r);this._resolveAnimations(n,s,r).update(e,{options:!r&&this.getSharedOptions(i)||i})}removeHoverStyle(e,n,s){this._setStyle(e,s,"active",!1)}setHoverStyle(e,n,s){this._setStyle(e,s,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const n=this._data,s=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const r=s.length,i=n.length,o=Math.min(i,r);o&&this.parse(0,o),i>r?this._insertElements(r,i-r,e):i<r&&this._removeElements(i,r-i)}_insertElements(e,n,s=!0){const r=this._cachedMeta,i=r.data,o=e+n;let a;const l=c=>{for(c.length+=n,a=c.length-1;a>=o;a--)c[a]=c[a-n]};for(l(i),a=e;a<o;++a)i[a]=new this.dataElementType;this._parsing&&l(r._parsed),this.parse(e,n),s&&this.updateElements(i,e,n,"reset")}updateElements(e,n,s,r){}_removeElements(e,n){const s=this._cachedMeta;if(this._parsing){const r=s._parsed.splice(e,n);s._stacked&&Ri(s,r)}s.data.splice(e,n)}_sync(e){if(this._parsing)this._syncList.push(e);else{const[n,s,r]=e;this[n](s,r)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){const e=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-e,e])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(e,n){n&&this._sync(["_removeElements",e,n]);const s=arguments.length-2;s&&this._sync(["_insertElements",e,s])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}B(zr,"defaults",{}),B(zr,"datasetElementType",null),B(zr,"dataElementType",null);function Yk(t,e){if(!t._cache.$bar){const n=t.getMatchingVisibleMetas(e);let s=[];for(let r=0,i=n.length;r<i;r++)s=s.concat(n[r].controller.getAllParsedValues(t));t._cache.$bar=by(s.sort((r,i)=>r-i))}return t._cache.$bar}function Xk(t){const e=t.iScale,n=Yk(e,t.type);let s=e._length,r,i,o,a;const l=()=>{o===32767||o===-32768||(Ro(a)&&(s=Math.min(s,Math.abs(o-a)||s)),a=o)};for(r=0,i=n.length;r<i;++r)o=e.getPixelForValue(n[r]),l();for(a=void 0,r=0,i=e.ticks.length;r<i;++r)o=e.getPixelForTick(r),l();return s}function qk(t,e,n,s){const r=n.barThickness;let i,o;return le(r)?(i=e.min*n.categoryPercentage,o=n.barPercentage):(i=r*s,o=1),{chunk:i/s,ratio:o,start:e.pixels[t]-i/2}}function Gk(t,e,n,s){const r=e.pixels,i=r[t];let o=t>0?r[t-1]:null,a=t<r.length-1?r[t+1]:null;const l=n.categoryPercentage;o===null&&(o=i-(a===null?e.end-e.start:a-i)),a===null&&(a=i+i-o);const c=i-(i-Math.min(o,a))/2*l;return{chunk:Math.abs(a-o)/2*l/s,ratio:n.barPercentage,start:c}}function Jk(t,e,n,s){const r=n.parse(t[0],s),i=n.parse(t[1],s),o=Math.min(r,i),a=Math.max(r,i);let l=o,c=a;Math.abs(o)>Math.abs(a)&&(l=a,c=o),e[n.axis]=c,e._custom={barStart:l,barEnd:c,start:r,end:i,min:o,max:a}}function Fy(t,e,n,s){return Fe(t)?Jk(t,e,n,s):e[n.axis]=n.parse(t,s),e}function xg(t,e,n,s){const r=t.iScale,i=t.vScale,o=r.getLabels(),a=r===i,l=[];let c,u,f,h;for(c=n,u=n+s;c<u;++c)h=e[c],f={},f[r.axis]=a||r.parse(o[c],c),l.push(Fy(h,f,i,c));return l}function su(t){return t&&t.barStart!==void 0&&t.barEnd!==void 0}function Zk(t,e,n){return t!==0?xs(t):(e.isHorizontal()?1:-1)*(e.min>=n?1:-1)}function eC(t){let e,n,s,r,i;return t.horizontal?(e=t.base>t.x,n="left",s="right"):(e=t.base<t.y,n="bottom",s="top"),e?(r="end",i="start"):(r="start",i="end"),{start:n,end:s,reverse:e,top:r,bottom:i}}function tC(t,e,n,s){let r=e.borderSkipped;const i={};if(!r){t.borderSkipped=i;return}if(r===!0){t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:o,end:a,reverse:l,top:c,bottom:u}=eC(t);r==="middle"&&n&&(t.enableBorderRadius=!0,(n._top||0)===s?r=c:(n._bottom||0)===s?r=u:(i[yg(u,o,a,l)]=!0,r=c)),i[yg(r,o,a,l)]=!0,t.borderSkipped=i}function yg(t,e,n,s){return s?(t=nC(t,e,n),t=vg(t,n,e)):t=vg(t,e,n),t}function nC(t,e,n){return t===e?n:t===n?e:t}function vg(t,e,n){return t==="start"?e:t==="end"?n:t}function sC(t,{inflateAmount:e},n){t.inflateAmount=e==="auto"?n===1?.33:0:e}class Xa extends zr{parsePrimitiveData(e,n,s,r){return xg(e,n,s,r)}parseArrayData(e,n,s,r){return xg(e,n,s,r)}parseObjectData(e,n,s,r){const{iScale:i,vScale:o}=e,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=i.axis==="x"?a:l,u=o.axis==="x"?a:l,f=[];let h,p,y,m;for(h=s,p=s+r;h<p;++h)m=n[h],y={},y[i.axis]=i.parse(or(m,c),h),f.push(Fy(or(m,u),y,o,h));return f}updateRangeFromParsed(e,n,s,r){super.updateRangeFromParsed(e,n,s,r);const i=s._custom;i&&n===this._cachedMeta.vScale&&(e.min=Math.min(e.min,i.min),e.max=Math.max(e.max,i.max))}getMaxOverflow(){return 0}getLabelAndValue(e){const n=this._cachedMeta,{iScale:s,vScale:r}=n,i=this.getParsed(e),o=i._custom,a=su(o)?"["+o.start+", "+o.end+"]":""+r.getLabelForValue(i[r.axis]);return{label:""+s.getLabelForValue(i[s.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();const e=this._cachedMeta;e.stack=this.getDataset().stack}update(e){const n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,e)}updateElements(e,n,s,r){const i=r==="reset",{index:o,_cachedMeta:{vScale:a}}=this,l=a.getBasePixel(),c=a.isHorizontal(),u=this._getRuler(),{sharedOptions:f,includeOptions:h}=this._getSharedOptions(n,r);for(let p=n;p<n+s;p++){const y=this.getParsed(p),m=i||le(y[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(p),b=this._calculateBarIndexPixels(p,u),x=(y._stacks||{})[a.axis],g={horizontal:c,base:m.base,enableBorderRadius:!x||su(y._custom)||o===x._top||o===x._bottom,x:c?m.head:b.center,y:c?b.center:m.head,height:c?b.size:Math.abs(m.size),width:c?Math.abs(m.size):b.size};h&&(g.options=f||this.resolveDataElementOptions(p,e[p].active?"active":r));const v=g.options||e[p].options;tC(g,v,x,o),sC(g,v,u.ratio),this.updateElement(e[p],p,g,r)}}_getStacks(e,n){const{iScale:s}=this._cachedMeta,r=s.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),i=s.options.stacked,o=[],a=this._cachedMeta.controller.getParsed(n),l=a&&a[s.axis],c=u=>{const f=u._parsed.find(p=>p[s.axis]===l),h=f&&f[u.vScale.axis];if(le(h)||isNaN(h))return!0};for(const u of r)if(!(n!==void 0&&c(u))&&((i===!1||o.indexOf(u.stack)===-1||i===void 0&&u.stack===void 0)&&o.push(u.stack),u.index===e))break;return o.length||o.push(void 0),o}_getStackCount(e){return this._getStacks(void 0,e).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const e=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(e).filter(s=>e[s].axis===n).shift()}_getAxis(){const e={},n=this.getFirstScaleIdForIndexAxis();for(const s of this.chart.data.datasets)e[J(this.chart.options.indexAxis==="x"?s.xAxisID:s.yAxisID,n)]=!0;return Object.keys(e)}_getStackIndex(e,n,s){const r=this._getStacks(e,s),i=n!==void 0?r.indexOf(n):-1;return i===-1?r.length-1:i}_getRuler(){const e=this.options,n=this._cachedMeta,s=n.iScale,r=[];let i,o;for(i=0,o=n.data.length;i<o;++i)r.push(s.getPixelForValue(this.getParsed(i)[s.axis],i));const a=e.barThickness;return{min:a||Xk(n),pixels:r,start:s._startPixel,end:s._endPixel,stackCount:this._getStackCount(),scale:s,grouped:e.grouped,ratio:a?1:e.categoryPercentage*e.barPercentage}}_calculateBarValuePixels(e){const{_cachedMeta:{vScale:n,_stacked:s,index:r},options:{base:i,minBarLength:o}}=this,a=i||0,l=this.getParsed(e),c=l._custom,u=su(c);let f=l[n.axis],h=0,p=s?this.applyStack(n,l,s):f,y,m;p!==f&&(h=p-f,p=f),u&&(f=c.barStart,p=c.barEnd-c.barStart,f!==0&&xs(f)!==xs(c.barEnd)&&(h=0),h+=f);const b=!le(i)&&!u?i:h;let x=n.getPixelForValue(b);if(this.chart.getDataVisibility(e)?y=n.getPixelForValue(h+p):y=x,m=y-x,Math.abs(m)<o){m=Zk(m,n,a)*o,f===a&&(x-=m/2);const g=n.getPixelForDecimal(0),v=n.getPixelForDecimal(1),S=Math.min(g,v),_=Math.max(g,v);x=Math.max(Math.min(x,_),S),y=x+m,s&&!u&&(l._stacks[n.axis]._visualValues[r]=n.getValueForPixel(y)-n.getValueForPixel(x))}if(x===n.getPixelForValue(a)){const g=xs(m)*n.getLineWidthForValue(a)/2;x+=g,m-=g}return{size:m,base:x,head:y,center:y+m/2}}_calculateBarIndexPixels(e,n){const s=n.scale,r=this.options,i=r.skipNull,o=J(r.maxBarThickness,1/0);let a,l;const c=this._getAxisCount();if(n.grouped){const u=i?this._getStackCount(e):n.stackCount,f=r.barThickness==="flex"?Gk(e,n,r,u*c):qk(e,n,r,u*c),h=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,p=this._getAxis().indexOf(J(h,this.getFirstScaleIdForIndexAxis())),y=this._getStackIndex(this.index,this._cachedMeta.stack,i?e:void 0)+p;a=f.start+f.chunk*y+f.chunk/2,l=Math.min(o,f.chunk*f.ratio)}else a=s.getPixelForValue(this.getParsed(e)[s.axis],e),l=Math.min(o,n.min*n.ratio);return{base:a-l/2,head:a+l/2,center:a,size:l}}draw(){const e=this._cachedMeta,n=e.vScale,s=e.data,r=s.length;let i=0;for(;i<r;++i)this.getParsed(i)[n.axis]!==null&&!s[i].hidden&&s[i].draw(this._ctx)}}B(Xa,"id","bar"),B(Xa,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),B(Xa,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});function rC(t,e,n){let s=1,r=1,i=0,o=0;if(e<xe){const a=t,l=a+e,c=Math.cos(a),u=Math.sin(a),f=Math.cos(l),h=Math.sin(l),p=(v,S,_)=>Rl(v,a,l,!0)?1:Math.max(S,S*n,_,_*n),y=(v,S,_)=>Rl(v,a,l,!0)?-1:Math.min(S,S*n,_,_*n),m=p(0,c,f),b=p(Te,u,h),x=y(he,c,f),g=y(he+Te,u,h);s=(m-x)/2,r=(b-g)/2,i=-(m+x)/2,o=-(b+g)/2}return{ratioX:s,ratioY:r,offsetX:i,offsetY:o}}class $i extends zr{constructor(e,n){super(e,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,n){const s=this.getDataset().data,r=this._cachedMeta;if(this._parsing===!1)r._parsed=s;else{let i=l=>+s[l];if(ee(s[e])){const{key:l="value"}=this._parsing;i=c=>+or(s[c],l)}let o,a;for(o=e,a=e+n;o<a;++o)r._parsed[o]=i(o)}}_getRotation(){return Cn(this.options.rotation-90)}_getCircumference(){return Cn(this.options.circumference)}_getRotationExtents(){let e=xe,n=-xe;for(let s=0;s<this.chart.data.datasets.length;++s)if(this.chart.isDatasetVisible(s)&&this.chart.getDatasetMeta(s).type===this._type){const r=this.chart.getDatasetMeta(s).controller,i=r._getRotation(),o=r._getCircumference();e=Math.min(e,i),n=Math.max(n,i+o)}return{rotation:e,circumference:n-e}}update(e){const n=this.chart,{chartArea:s}=n,r=this._cachedMeta,i=r.data,o=this.getMaxBorderWidth()+this.getMaxOffset(i)+this.options.spacing,a=Math.max((Math.min(s.width,s.height)-o)/2,0),l=Math.min(R_(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:u,rotation:f}=this._getRotationExtents(),{ratioX:h,ratioY:p,offsetX:y,offsetY:m}=rC(f,u,l),b=(s.width-o)/h,x=(s.height-o)/p,g=Math.max(Math.min(b,x)/2,0),v=gy(this.options.radius,g),S=Math.max(v*l,0),_=(v-S)/this._getVisibleDatasetWeightTotal();this.offsetX=y*v,this.offsetY=m*v,r.total=this.calculateTotal(),this.outerRadius=v-_*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-_*c,0),this.updateElements(i,0,i.length,e)}_circumference(e,n){const s=this.options,r=this._cachedMeta,i=this._getCircumference();return n&&s.animation.animateRotate||!this.chart.getDataVisibility(e)||r._parsed[e]===null||r.data[e].hidden?0:this.calculateCircumference(r._parsed[e]*i/xe)}updateElements(e,n,s,r){const i=r==="reset",o=this.chart,a=o.chartArea,c=o.options.animation,u=(a.left+a.right)/2,f=(a.top+a.bottom)/2,h=i&&c.animateScale,p=h?0:this.innerRadius,y=h?0:this.outerRadius,{sharedOptions:m,includeOptions:b}=this._getSharedOptions(n,r);let x=this._getRotation(),g;for(g=0;g<n;++g)x+=this._circumference(g,i);for(g=n;g<n+s;++g){const v=this._circumference(g,i),S=e[g],_={x:u+this.offsetX,y:f+this.offsetY,startAngle:x,endAngle:x+v,circumference:v,outerRadius:y,innerRadius:p};b&&(_.options=m||this.resolveDataElementOptions(g,S.active?"active":r)),x+=v,this.updateElement(S,g,_,r)}}calculateTotal(){const e=this._cachedMeta,n=e.data;let s=0,r;for(r=0;r<n.length;r++){const i=e._parsed[r];i!==null&&!isNaN(i)&&this.chart.getDataVisibility(r)&&!n[r].hidden&&(s+=Math.abs(i))}return s}calculateCircumference(e){const n=this._cachedMeta.total;return n>0&&!isNaN(e)?xe*(Math.abs(e)/n):0}getLabelAndValue(e){const n=this._cachedMeta,s=this.chart,r=s.data.labels||[],i=Uf(n._parsed[e],s.options.locale);return{label:r[e]||"",value:i}}getMaxBorderWidth(e){let n=0;const s=this.chart;let r,i,o,a,l;if(!e){for(r=0,i=s.data.datasets.length;r<i;++r)if(s.isDatasetVisible(r)){o=s.getDatasetMeta(r),e=o.data,a=o.controller;break}}if(!e)return 0;for(r=0,i=e.length;r<i;++r)l=a.resolveDataElementOptions(r),l.borderAlign!=="inner"&&(n=Math.max(n,l.borderWidth||0,l.hoverBorderWidth||0));return n}getMaxOffset(e){let n=0;for(let s=0,r=e.length;s<r;++s){const i=this.resolveDataElementOptions(s);n=Math.max(n,i.offset||0,i.hoverOffset||0)}return n}_getRingWeightOffset(e){let n=0;for(let s=0;s<e;++s)this.chart.isDatasetVisible(s)&&(n+=this._getRingWeight(s));return n}_getRingWeight(e){return Math.max(J(this.chart.data.datasets[e].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}B($i,"id","doughnut"),B($i,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,spacingMode:"angular",indexAxis:"r"}),B($i,"descriptors",{_scriptable:e=>e!=="spacing"&&e!=="spacingMode",_indexable:e=>e!=="spacing"&&e!=="spacingMode"&&!e.startsWith("borderDash")&&!e.startsWith("hoverBorderDash")}),B($i,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){const n=e.data,{labels:{pointStyle:s,textAlign:r,color:i,useBorderRadius:o,borderRadius:a}}=e.legend.options;return n.labels.length&&n.datasets.length?n.labels.map((l,c)=>{const f=e.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:f.backgroundColor,fontColor:i,hidden:!e.getDataVisibility(c),lineDash:f.borderDash,lineDashOffset:f.borderDashOffset,lineJoin:f.borderJoinStyle,lineWidth:f.borderWidth,strokeStyle:f.borderColor,textAlign:r,pointStyle:s,borderRadius:o&&(a||f.borderRadius),index:c}}):[]}},onClick(e,n,s){s.chart.toggleDataVisibility(n.index),s.chart.update()}}}});function Ts(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Gf{constructor(e){B(this,"options");this.options=e||{}}static override(e){Object.assign(Gf.prototype,e)}init(){}formats(){return Ts()}parse(){return Ts()}format(){return Ts()}add(){return Ts()}diff(){return Ts()}startOf(){return Ts()}endOf(){return Ts()}}var iC={_date:Gf};function oC(t,e,n,s){const{controller:r,data:i,_sorted:o}=t,a=r._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(a&&e===a.axis&&e!=="r"&&o&&i.length){const c=a._reversePixels?V_:Cd;if(s){if(r._sharedOptions){const u=i[0],f=typeof u.getRange=="function"&&u.getRange(e);if(f){const h=c(i,e,n-f),p=c(i,e,n+f);return{lo:h.lo,hi:p.hi}}}}else{const u=c(i,e,n);if(l){const{vScale:f}=r._cachedMeta,{_parsed:h}=t,p=h.slice(0,u.lo+1).reverse().findIndex(m=>!le(m[f.axis]));u.lo-=Math.max(0,p);const y=h.slice(u.hi).findIndex(m=>!le(m[f.axis]));u.hi+=Math.max(0,y)}return u}}return{lo:0,hi:i.length-1}}function uc(t,e,n,s,r){const i=t.getSortedVisibleDatasetMetas(),o=n[e];for(let a=0,l=i.length;a<l;++a){const{index:c,data:u}=i[a],{lo:f,hi:h}=oC(i[a],e,o,r);for(let p=f;p<=h;++p){const y=u[p];y.skip||s(y,c,p)}}}function aC(t){const e=t.indexOf("x")!==-1,n=t.indexOf("y")!==-1;return function(s,r){const i=e?Math.abs(s.x-r.x):0,o=n?Math.abs(s.y-r.y):0;return Math.sqrt(Math.pow(i,2)+Math.pow(o,2))}}function ru(t,e,n,s,r){const i=[];return!r&&!t.isPointInArea(e)||uc(t,n,e,function(a,l,c){!r&&!Ey(a,t.chartArea,0)||a.inRange(e.x,e.y,s)&&i.push({element:a,datasetIndex:l,index:c})},!0),i}function lC(t,e,n,s){let r=[];function i(o,a,l){const{startAngle:c,endAngle:u}=o.getProps(["startAngle","endAngle"],s),{angle:f}=yy(o,{x:e.x,y:e.y});Rl(f,c,u)&&r.push({element:o,datasetIndex:a,index:l})}return uc(t,n,e,i),r}function cC(t,e,n,s,r,i){let o=[];const a=aC(n);let l=Number.POSITIVE_INFINITY;function c(u,f,h){const p=u.inRange(e.x,e.y,r);if(s&&!p)return;const y=u.getCenterPoint(r);if(!(!!i||t.isPointInArea(y))&&!p)return;const b=a(e,y);b<l?(o=[{element:u,datasetIndex:f,index:h}],l=b):b===l&&o.push({element:u,datasetIndex:f,index:h})}return uc(t,n,e,c),o}function iu(t,e,n,s,r,i){return!i&&!t.isPointInArea(e)?[]:n==="r"&&!s?lC(t,e,n,r):cC(t,e,n,s,r,i)}function bg(t,e,n,s,r){const i=[],o=n==="x"?"inXRange":"inYRange";let a=!1;return uc(t,n,e,(l,c,u)=>{l[o]&&l[o](e[n],r)&&(i.push({element:l,datasetIndex:c,index:u}),a=a||l.inRange(e.x,e.y,r))}),s&&!a?[]:i}var uC={modes:{index(t,e,n,s){const r=Fs(e,t),i=n.axis||"x",o=n.includeInvisible||!1,a=n.intersect?ru(t,r,i,s,o):iu(t,r,i,!1,s,o),l=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach(c=>{const u=a[0].index,f=c.data[u];f&&!f.skip&&l.push({element:f,datasetIndex:c.index,index:u})}),l):[]},dataset(t,e,n,s){const r=Fs(e,t),i=n.axis||"xy",o=n.includeInvisible||!1;let a=n.intersect?ru(t,r,i,s,o):iu(t,r,i,!1,s,o);if(a.length>0){const l=a[0].datasetIndex,c=t.getDatasetMeta(l).data;a=[];for(let u=0;u<c.length;++u)a.push({element:c[u],datasetIndex:l,index:u})}return a},point(t,e,n,s){const r=Fs(e,t),i=n.axis||"xy",o=n.includeInvisible||!1;return ru(t,r,i,s,o)},nearest(t,e,n,s){const r=Fs(e,t),i=n.axis||"xy",o=n.includeInvisible||!1;return iu(t,r,i,n.intersect,s,o)},x(t,e,n,s){const r=Fs(e,t);return bg(t,r,"x",n.intersect,s)},y(t,e,n,s){const r=Fs(e,t);return bg(t,r,"y",n.intersect,s)}}};const Iy=["left","top","right","bottom"];function Oi(t,e){return t.filter(n=>n.pos===e)}function wg(t,e){return t.filter(n=>Iy.indexOf(n.pos)===-1&&n.box.axis===e)}function Ti(t,e){return t.sort((n,s)=>{const r=e?s:n,i=e?n:s;return r.weight===i.weight?r.index-i.index:r.weight-i.weight})}function dC(t){const e=[];let n,s,r,i,o,a;for(n=0,s=(t||[]).length;n<s;++n)r=t[n],{position:i,options:{stack:o,stackWeight:a=1}}=r,e.push({index:n,box:r,pos:i,horizontal:r.isHorizontal(),weight:r.weight,stack:o&&i+o,stackWeight:a});return e}function fC(t){const e={};for(const n of t){const{stack:s,pos:r,stackWeight:i}=n;if(!s||!Iy.includes(r))continue;const o=e[s]||(e[s]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=i}return e}function hC(t,e){const n=fC(t),{vBoxMaxWidth:s,hBoxMaxHeight:r}=e;let i,o,a;for(i=0,o=t.length;i<o;++i){a=t[i];const{fullSize:l}=a.box,c=n[a.stack],u=c&&a.stackWeight/c.weight;a.horizontal?(a.width=u?u*s:l&&e.availableWidth,a.height=r):(a.width=s,a.height=u?u*r:l&&e.availableHeight)}return n}function pC(t){const e=dC(t),n=Ti(e.filter(c=>c.box.fullSize),!0),s=Ti(Oi(e,"left"),!0),r=Ti(Oi(e,"right")),i=Ti(Oi(e,"top"),!0),o=Ti(Oi(e,"bottom")),a=wg(e,"x"),l=wg(e,"y");return{fullSize:n,leftAndTop:s.concat(i),rightAndBottom:r.concat(l).concat(o).concat(a),chartArea:Oi(e,"chartArea"),vertical:s.concat(r).concat(l),horizontal:i.concat(o).concat(a)}}function Sg(t,e,n,s){return Math.max(t[n],e[n])+Math.max(t[s],e[s])}function zy(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function gC(t,e,n,s){const{pos:r,box:i}=n,o=t.maxPadding;if(!ee(r)){n.size&&(t[r]-=n.size);const f=s[n.stack]||{size:0,count:1};f.size=Math.max(f.size,n.horizontal?i.height:i.width),n.size=f.size/f.count,t[r]+=n.size}i.getPadding&&zy(o,i.getPadding());const a=Math.max(0,e.outerWidth-Sg(o,t,"left","right")),l=Math.max(0,e.outerHeight-Sg(o,t,"top","bottom")),c=a!==t.w,u=l!==t.h;return t.w=a,t.h=l,n.horizontal?{same:c,other:u}:{same:u,other:c}}function mC(t){const e=t.maxPadding;function n(s){const r=Math.max(e[s]-t[s],0);return t[s]+=r,r}t.y+=n("top"),t.x+=n("left"),n("right"),n("bottom")}function xC(t,e){const n=e.maxPadding;function s(r){const i={left:0,top:0,right:0,bottom:0};return r.forEach(o=>{i[o]=Math.max(e[o],n[o])}),i}return s(t?["left","right"]:["top","bottom"])}function Hi(t,e,n,s){const r=[];let i,o,a,l,c,u;for(i=0,o=t.length,c=0;i<o;++i){a=t[i],l=a.box,l.update(a.width||e.w,a.height||e.h,xC(a.horizontal,e));const{same:f,other:h}=gC(e,n,a,s);c|=f&&r.length,u=u||h,l.fullSize||r.push(a)}return c&&Hi(r,e,n,s)||u}function Ma(t,e,n,s,r){t.top=n,t.left=e,t.right=e+s,t.bottom=n+r,t.width=s,t.height=r}function _g(t,e,n,s){const r=n.padding;let{x:i,y:o}=e;for(const a of t){const l=a.box,c=s[a.stack]||{placed:0,weight:1},u=a.stackWeight/c.weight||1;if(a.horizontal){const f=e.w*u,h=c.size||l.height;Ro(c.start)&&(o=c.start),l.fullSize?Ma(l,r.left,o,n.outerWidth-r.right-r.left,h):Ma(l,e.left+c.placed,o,f,h),c.start=o,c.placed+=f,o=l.bottom}else{const f=e.h*u,h=c.size||l.width;Ro(c.start)&&(i=c.start),l.fullSize?Ma(l,i,r.top,h,n.outerHeight-r.bottom-r.top):Ma(l,i,e.top+c.placed,h,f),c.start=i,c.placed+=f,i=l.right}}e.x=i,e.y=o}var is={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(n){e.draw(n)}}]},t.boxes.push(e)},removeBox(t,e){const n=t.boxes?t.boxes.indexOf(e):-1;n!==-1&&t.boxes.splice(n,1)},configure(t,e,n){e.fullSize=n.fullSize,e.position=n.position,e.weight=n.weight},update(t,e,n,s){if(!t)return;const r=Qt(t.options.layout.padding),i=Math.max(e-r.width,0),o=Math.max(n-r.height,0),a=pC(t.boxes),l=a.vertical,c=a.horizontal;re(t.boxes,m=>{typeof m.beforeLayout=="function"&&m.beforeLayout()});const u=l.reduce((m,b)=>b.box.options&&b.box.options.display===!1?m:m+1,0)||1,f=Object.freeze({outerWidth:e,outerHeight:n,padding:r,availableWidth:i,availableHeight:o,vBoxMaxWidth:i/2/u,hBoxMaxHeight:o/2}),h=Object.assign({},r);zy(h,Qt(s));const p=Object.assign({maxPadding:h,w:i,h:o,x:r.left,y:r.top},r),y=hC(l.concat(c),f);Hi(a.fullSize,p,f,y),Hi(l,p,f,y),Hi(c,p,f,y)&&Hi(l,p,f,y),mC(p),_g(a.leftAndTop,p,f,y),p.x+=p.w,p.y+=p.h,_g(a.rightAndBottom,p,f,y),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},re(a.chartArea,m=>{const b=m.box;Object.assign(b,t.chartArea),b.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}};class By{acquireContext(e,n){}releaseContext(e){return!1}addEventListener(e,n,s){}removeEventListener(e,n,s){}getDevicePixelRatio(){return 1}getMaximumSize(e,n,s,r){return n=Math.max(0,n||e.width),s=s||e.height,{width:n,height:Math.max(0,r?Math.floor(n/r):s)}}isAttached(e){return!0}updateConfig(e){}}class yC extends By{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const qa="$chartjs",vC={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},kg=t=>t===null||t==="";function bC(t,e){const n=t.style,s=t.getAttribute("height"),r=t.getAttribute("width");if(t[qa]={initial:{height:s,width:r,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",kg(r)){const i=ug(t,"width");i!==void 0&&(t.width=i)}if(kg(s))if(t.style.height==="")t.height=t.width/(e||2);else{const i=ug(t,"height");i!==void 0&&(t.height=i)}return t}const Wy=Mk?{passive:!0}:!1;function wC(t,e,n){t&&t.addEventListener(e,n,Wy)}function SC(t,e,n){t&&t.canvas&&t.canvas.removeEventListener(e,n,Wy)}function _C(t,e){const n=vC[t.type]||t.type,{x:s,y:r}=Fs(t,e);return{type:n,chart:e,native:t,x:s!==void 0?s:null,y:r!==void 0?r:null}}function Ll(t,e){for(const n of t)if(n===e||n.contains(e))return!0}function kC(t,e,n){const s=t.canvas,r=new MutationObserver(i=>{let o=!1;for(const a of i)o=o||Ll(a.addedNodes,s),o=o&&!Ll(a.removedNodes,s);o&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}function CC(t,e,n){const s=t.canvas,r=new MutationObserver(i=>{let o=!1;for(const a of i)o=o||Ll(a.removedNodes,s),o=o&&!Ll(a.addedNodes,s);o&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}const Oo=new Map;let Cg=0;function Uy(){const t=window.devicePixelRatio;t!==Cg&&(Cg=t,Oo.forEach((e,n)=>{n.currentDevicePixelRatio!==t&&e()}))}function jC(t,e){Oo.size||window.addEventListener("resize",Uy),Oo.set(t,e)}function EC(t){Oo.delete(t),Oo.size||window.removeEventListener("resize",Uy)}function NC(t,e,n){const s=t.canvas,r=s&&qf(s);if(!r)return;const i=Sy((a,l)=>{const c=r.clientWidth;n(a,l),c<r.clientWidth&&n()},window),o=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||i(c,u)});return o.observe(r),jC(t,i),o}function ou(t,e,n){n&&n.disconnect(),e==="resize"&&EC(t)}function MC(t,e,n){const s=t.canvas,r=Sy(i=>{t.ctx!==null&&n(_C(i,t))},t);return wC(s,e,r),r}class PC extends By{acquireContext(e,n){const s=e&&e.getContext&&e.getContext("2d");return s&&s.canvas===e?(bC(e,n),s):null}releaseContext(e){const n=e.canvas;if(!n[qa])return!1;const s=n[qa].initial;["height","width"].forEach(i=>{const o=s[i];le(o)?n.removeAttribute(i):n.setAttribute(i,o)});const r=s.style||{};return Object.keys(r).forEach(i=>{n.style[i]=r[i]}),n.width=n.width,delete n[qa],!0}addEventListener(e,n,s){this.removeEventListener(e,n);const r=e.$proxies||(e.$proxies={}),o={attach:kC,detach:CC,resize:NC}[n]||MC;r[n]=o(e,n,s)}removeEventListener(e,n){const s=e.$proxies||(e.$proxies={}),r=s[n];if(!r)return;({attach:ou,detach:ou,resize:ou}[n]||SC)(e,n,r),s[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,n,s,r){return Nk(e,n,s,r)}isAttached(e){const n=e&&qf(e);return!!(n&&n.isConnected)}}function RC(t){return!Xf()||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas?yC:PC}class Ss{constructor(){B(this,"x");B(this,"y");B(this,"active",!1);B(this,"options");B(this,"$animations")}tooltipPosition(e){const{x:n,y:s}=this.getProps(["x","y"],e);return{x:n,y:s}}hasValue(){return Pl(this.x)&&Pl(this.y)}getProps(e,n){const s=this.$animations;if(!n||!s)return this;const r={};return e.forEach(i=>{r[i]=s[i]&&s[i].active()?s[i]._to:this[i]}),r}}B(Ss,"defaults",{}),B(Ss,"defaultRoutes");function OC(t,e){const n=t.options.ticks,s=TC(t),r=Math.min(n.maxTicksLimit||s,s),i=n.major.enabled?LC(e):[],o=i.length,a=i[0],l=i[o-1],c=[];if(o>r)return AC(e,c,i,o/r),c;const u=DC(i,e,r);if(o>0){let f,h;const p=o>1?Math.round((l-a)/(o-1)):null;for(Pa(e,c,u,le(p)?0:a-p,a),f=0,h=o-1;f<h;f++)Pa(e,c,u,i[f],i[f+1]);return Pa(e,c,u,l,le(p)?e.length:l+p),c}return Pa(e,c,u),c}function TC(t){const e=t.options.offset,n=t._tickSize(),s=t._length/n+(e?0:1),r=t._maxLength/n;return Math.floor(Math.min(s,r))}function DC(t,e,n){const s=FC(t),r=e.length/n;if(!s)return Math.max(r,1);const i=I_(s);for(let o=0,a=i.length-1;o<a;o++){const l=i[o];if(l>r)return l}return Math.max(r,1)}function LC(t){const e=[];let n,s;for(n=0,s=t.length;n<s;n++)t[n].major&&e.push(n);return e}function AC(t,e,n,s){let r=0,i=n[0],o;for(s=Math.ceil(s),o=0;o<t.length;o++)o===i&&(e.push(t[o]),r++,i=n[r*s])}function Pa(t,e,n,s,r){const i=J(s,0),o=Math.min(J(r,t.length),t.length);let a=0,l,c,u;for(n=Math.ceil(n),r&&(l=r-s,n=l/Math.floor(l/n)),u=i;u<0;)a++,u=Math.round(i+a*n);for(c=Math.max(i,0);c<o;c++)c===u&&(e.push(t[c]),a++,u=Math.round(i+a*n))}function FC(t){const e=t.length;let n,s;if(e<2)return!1;for(s=t[0],n=1;n<e;++n)if(t[n]-t[n-1]!==s)return!1;return s}const IC=t=>t==="left"?"right":t==="right"?"left":t,jg=(t,e,n)=>e==="top"||e==="left"?t[e]+n:t[e]-n,Eg=(t,e)=>Math.min(e||t,t);function Ng(t,e){const n=[],s=t.length/e,r=t.length;let i=0;for(;i<r;i+=s)n.push(t[Math.floor(i)]);return n}function zC(t,e,n){const s=t.ticks.length,r=Math.min(e,s-1),i=t._startPixel,o=t._endPixel,a=1e-6;let l=t.getPixelForTick(r),c;if(!(n&&(s===1?c=Math.max(l-i,o-l):e===0?c=(t.getPixelForTick(1)-l)/2:c=(l-t.getPixelForTick(r-1))/2,l+=r<e?c:-c,l<i-a||l>o+a)))return l}function BC(t,e){re(t,n=>{const s=n.gc,r=s.length/2;let i;if(r>e){for(i=0;i<r;++i)delete n.data[s[i]];s.splice(0,r)}})}function Di(t){return t.drawTicks?t.tickLength:0}function Mg(t,e){if(!t.display)return 0;const n=ct(t.font,e),s=Qt(t.padding);return(Fe(t.text)?t.text.length:1)*n.lineHeight+s.height}function WC(t,e){return pi(t,{scale:e,type:"scale"})}function UC(t,e,n){return pi(t,{tick:n,index:e,type:"tick"})}function $C(t,e,n){let s=_y(t);return(n&&e!=="right"||!n&&e==="right")&&(s=IC(s)),s}function HC(t,e,n,s){const{top:r,left:i,bottom:o,right:a,chart:l}=t,{chartArea:c,scales:u}=l;let f=0,h,p,y;const m=o-r,b=a-i;if(t.isHorizontal()){if(p=xt(s,i,a),ee(n)){const x=Object.keys(n)[0],g=n[x];y=u[x].getPixelForValue(g)+m-e}else n==="center"?y=(c.bottom+c.top)/2+m-e:y=jg(t,n,e);h=a-i}else{if(ee(n)){const x=Object.keys(n)[0],g=n[x];p=u[x].getPixelForValue(g)-b+e}else n==="center"?p=(c.left+c.right)/2-b+e:p=jg(t,n,e);y=xt(s,o,r),f=n==="left"?-Te:Te}return{titleX:p,titleY:y,maxWidth:h,rotation:f}}class gi extends Ss{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,n){return e}getUserBounds(){let{_userMin:e,_userMax:n,_suggestedMin:s,_suggestedMax:r}=this;return e=Jt(e,Number.POSITIVE_INFINITY),n=Jt(n,Number.NEGATIVE_INFINITY),s=Jt(s,Number.POSITIVE_INFINITY),r=Jt(r,Number.NEGATIVE_INFINITY),{min:Jt(e,s),max:Jt(n,r),minDefined:Dt(e),maxDefined:Dt(n)}}getMinMax(e){let{min:n,max:s,minDefined:r,maxDefined:i}=this.getUserBounds(),o;if(r&&i)return{min:n,max:s};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)o=a[l].controller.getMinMax(this,e),r||(n=Math.min(n,o.min)),i||(s=Math.max(s,o.max));return n=i&&n>s?s:n,s=r&&n>s?n:s,{min:Jt(n,Jt(s,n)),max:Jt(s,Jt(n,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){fe(this.options.beforeUpdate,[this])}update(e,n,s){const{beginAtZero:r,grace:i,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=n,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=hk(this,i,r),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?Ng(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||o.source==="auto")&&(this.ticks=OC(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,n,s;this.isHorizontal()?(n=this.left,s=this.right):(n=this.top,s=this.bottom,e=!e),this._startPixel=n,this._endPixel=s,this._reversePixels=e,this._length=s-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){fe(this.options.afterUpdate,[this])}beforeSetDimensions(){fe(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){fe(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),fe(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){fe(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){const n=this.options.ticks;let s,r,i;for(s=0,r=e.length;s<r;s++)i=e[s],i.label=fe(n.callback,[i.value,s,e],this)}afterTickToLabelConversion(){fe(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){fe(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,n=e.ticks,s=Eg(this.ticks.length,e.ticks.maxTicksLimit),r=n.minRotation||0,i=n.maxRotation;let o=r,a,l,c;if(!this._isVisible()||!n.display||r>=i||s<=1||!this.isHorizontal()){this.labelRotation=r;return}const u=this._getLabelSizes(),f=u.widest.width,h=u.highest.height,p=lt(this.chart.width-f,0,this.maxWidth);a=e.offset?this.maxWidth/s:p/(s-1),f+6>a&&(a=p/(s-(e.offset?.5:1)),l=this.maxHeight-Di(e.grid)-n.padding-Mg(e.title,this.chart.options.font),c=Math.sqrt(f*f+h*h),o=U_(Math.min(Math.asin(lt((u.highest.height+6)/a,-1,1)),Math.asin(lt(l/c,-1,1))-Math.asin(lt(h/c,-1,1)))),o=Math.max(r,Math.min(i,o))),this.labelRotation=o}afterCalculateLabelRotation(){fe(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){fe(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:n,options:{ticks:s,title:r,grid:i}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const l=Mg(r,n.options.font);if(a?(e.width=this.maxWidth,e.height=Di(i)+l):(e.height=this.maxHeight,e.width=Di(i)+l),s.display&&this.ticks.length){const{first:c,last:u,widest:f,highest:h}=this._getLabelSizes(),p=s.padding*2,y=Cn(this.labelRotation),m=Math.cos(y),b=Math.sin(y);if(a){const x=s.mirror?0:b*f.width+m*h.height;e.height=Math.min(this.maxHeight,e.height+x+p)}else{const x=s.mirror?0:m*f.width+b*h.height;e.width=Math.min(this.maxWidth,e.width+x+p)}this._calculatePadding(c,u,b,m)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,n,s,r){const{ticks:{align:i,padding:o},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,f=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,p=0;l?c?(h=r*e.width,p=s*n.height):(h=s*e.height,p=r*n.width):i==="start"?p=n.width:i==="end"?h=e.width:i!=="inner"&&(h=e.width/2,p=n.width/2),this.paddingLeft=Math.max((h-u+o)*this.width/(this.width-u),0),this.paddingRight=Math.max((p-f+o)*this.width/(this.width-f),0)}else{let u=n.height/2,f=e.height/2;i==="start"?(u=0,f=e.height):i==="end"&&(u=n.height,f=0),this.paddingTop=u+o,this.paddingBottom=f+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){fe(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:n}=this.options;return n==="top"||n==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let n,s;for(n=0,s=e.length;n<s;n++)le(e[n].label)&&(e.splice(n,1),s--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){const n=this.options.ticks.sampleSize;let s=this.ticks;n<s.length&&(s=Ng(s,n)),this._labelSizes=e=this._computeLabelSizes(s,s.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,n,s){const{ctx:r,_longestTextCache:i}=this,o=[],a=[],l=Math.floor(n/Eg(n,s));let c=0,u=0,f,h,p,y,m,b,x,g,v,S,_;for(f=0;f<n;f+=l){if(y=e[f].label,m=this._resolveTickFontOptions(f),r.font=b=m.string,x=i[b]=i[b]||{data:{},gc:[]},g=m.lineHeight,v=S=0,!le(y)&&!Fe(y))v=rg(r,x.data,x.gc,v,y),S=g;else if(Fe(y))for(h=0,p=y.length;h<p;++h)_=y[h],!le(_)&&!Fe(_)&&(v=rg(r,x.data,x.gc,v,_),S+=g);o.push(v),a.push(S),c=Math.max(v,c),u=Math.max(S,u)}BC(i,n);const k=o.indexOf(c),j=a.indexOf(u),E=P=>({width:o[P]||0,height:a[P]||0});return{first:E(0),last:E(n-1),widest:E(k),highest:E(j),widths:o,heights:a}}getLabelForValue(e){return e}getPixelForValue(e,n){return NaN}getValueForPixel(e){}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const n=this._startPixel+e*this._length;return H_(this._alignToPixels?Os(this.chart,n,0):n)}getDecimalForPixel(e){const n=(e-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:n}=this;return e<0&&n<0?n:e>0&&n>0?e:0}getContext(e){const n=this.ticks||[];if(e>=0&&e<n.length){const s=n[e];return s.$context||(s.$context=UC(this.getContext(),e,s))}return this.$context||(this.$context=WC(this.chart.getContext(),this))}_tickSize(){const e=this.options.ticks,n=Cn(this.labelRotation),s=Math.abs(Math.cos(n)),r=Math.abs(Math.sin(n)),i=this._getLabelSizes(),o=e.autoSkipPadding||0,a=i?i.widest.width+o:0,l=i?i.highest.height+o:0;return this.isHorizontal()?l*s>a*r?a/s:l/r:l*r<a*s?l/s:a/r}_isVisible(){const e=this.options.display;return e!=="auto"?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){const n=this.axis,s=this.chart,r=this.options,{grid:i,position:o,border:a}=r,l=i.offset,c=this.isHorizontal(),f=this.ticks.length+(l?1:0),h=Di(i),p=[],y=a.setContext(this.getContext()),m=y.display?y.width:0,b=m/2,x=function(oe){return Os(s,oe,m)};let g,v,S,_,k,j,E,P,M,O,N,I;if(o==="top")g=x(this.bottom),j=this.bottom-h,P=g-b,O=x(e.top)+b,I=e.bottom;else if(o==="bottom")g=x(this.top),O=e.top,I=x(e.bottom)-b,j=g+b,P=this.top+h;else if(o==="left")g=x(this.right),k=this.right-h,E=g-b,M=x(e.left)+b,N=e.right;else if(o==="right")g=x(this.left),M=e.left,N=x(e.right)-b,k=g+b,E=this.left+h;else if(n==="x"){if(o==="center")g=x((e.top+e.bottom)/2+.5);else if(ee(o)){const oe=Object.keys(o)[0],se=o[oe];g=x(this.chart.scales[oe].getPixelForValue(se))}O=e.top,I=e.bottom,j=g+b,P=j+h}else if(n==="y"){if(o==="center")g=x((e.left+e.right)/2);else if(ee(o)){const oe=Object.keys(o)[0],se=o[oe];g=x(this.chart.scales[oe].getPixelForValue(se))}k=g-b,E=k-h,M=e.left,N=e.right}const W=J(r.ticks.maxTicksLimit,f),V=Math.max(1,Math.ceil(f/W));for(v=0;v<f;v+=V){const oe=this.getContext(v),se=i.setContext(oe),T=a.setContext(oe),A=se.lineWidth,F=se.color,K=T.dash||[],$=T.dashOffset,ue=se.tickWidth,Y=se.tickColor,Ne=se.tickBorderDash||[],te=se.tickBorderDashOffset;S=zC(this,v,l),S!==void 0&&(_=Os(s,S,A),c?k=E=M=N=_:j=P=O=I=_,p.push({tx1:k,ty1:j,tx2:E,ty2:P,x1:M,y1:O,x2:N,y2:I,width:A,color:F,borderDash:K,borderDashOffset:$,tickWidth:ue,tickColor:Y,tickBorderDash:Ne,tickBorderDashOffset:te}))}return this._ticksLength=f,this._borderValue=g,p}_computeLabelItems(e){const n=this.axis,s=this.options,{position:r,ticks:i}=s,o=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:u,mirror:f}=i,h=Di(s.grid),p=h+u,y=f?-u:p,m=-Cn(this.labelRotation),b=[];let x,g,v,S,_,k,j,E,P,M,O,N,I="middle";if(r==="top")k=this.bottom-y,j=this._getXAxisLabelAlignment();else if(r==="bottom")k=this.top+y,j=this._getXAxisLabelAlignment();else if(r==="left"){const V=this._getYAxisLabelAlignment(h);j=V.textAlign,_=V.x}else if(r==="right"){const V=this._getYAxisLabelAlignment(h);j=V.textAlign,_=V.x}else if(n==="x"){if(r==="center")k=(e.top+e.bottom)/2+p;else if(ee(r)){const V=Object.keys(r)[0],oe=r[V];k=this.chart.scales[V].getPixelForValue(oe)+p}j=this._getXAxisLabelAlignment()}else if(n==="y"){if(r==="center")_=(e.left+e.right)/2-p;else if(ee(r)){const V=Object.keys(r)[0],oe=r[V];_=this.chart.scales[V].getPixelForValue(oe)}j=this._getYAxisLabelAlignment(h).textAlign}n==="y"&&(l==="start"?I="top":l==="end"&&(I="bottom"));const W=this._getLabelSizes();for(x=0,g=a.length;x<g;++x){v=a[x],S=v.label;const V=i.setContext(this.getContext(x));E=this.getPixelForTick(x)+i.labelOffset,P=this._resolveTickFontOptions(x),M=P.lineHeight,O=Fe(S)?S.length:1;const oe=O/2,se=V.color,T=V.textStrokeColor,A=V.textStrokeWidth;let F=j;o?(_=E,j==="inner"&&(x===g-1?F=this.options.reverse?"left":"right":x===0?F=this.options.reverse?"right":"left":F="center"),r==="top"?c==="near"||m!==0?N=-O*M+M/2:c==="center"?N=-W.highest.height/2-oe*M+M:N=-W.highest.height+M/2:c==="near"||m!==0?N=M/2:c==="center"?N=W.highest.height/2-oe*M:N=W.highest.height-O*M,f&&(N*=-1),m!==0&&!V.showLabelBackdrop&&(_+=M/2*Math.sin(m))):(k=E,N=(1-O)*M/2);let K;if(V.showLabelBackdrop){const $=Qt(V.backdropPadding),ue=W.heights[x],Y=W.widths[x];let Ne=N-$.top,te=0-$.left;switch(I){case"middle":Ne-=ue/2;break;case"bottom":Ne-=ue;break}switch(j){case"center":te-=Y/2;break;case"right":te-=Y;break;case"inner":x===g-1?te-=Y:x>0&&(te-=Y/2);break}K={left:te,top:Ne,width:Y+$.width,height:ue+$.height,color:V.backdropColor}}b.push({label:S,font:P,textOffset:N,options:{rotation:m,color:se,strokeColor:T,strokeWidth:A,textAlign:F,textBaseline:I,translation:[_,k],backdrop:K}})}return b}_getXAxisLabelAlignment(){const{position:e,ticks:n}=this.options;if(-Cn(this.labelRotation))return e==="top"?"left":"right";let r="center";return n.align==="start"?r="left":n.align==="end"?r="right":n.align==="inner"&&(r="inner"),r}_getYAxisLabelAlignment(e){const{position:n,ticks:{crossAlign:s,mirror:r,padding:i}}=this.options,o=this._getLabelSizes(),a=e+i,l=o.widest.width;let c,u;return n==="left"?r?(u=this.right+i,s==="near"?c="left":s==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-a,s==="near"?c="right":s==="center"?(c="center",u-=l/2):(c="left",u=this.left)):n==="right"?r?(u=this.left+i,s==="near"?c="right":s==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+a,s==="near"?c="left":s==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:n},left:s,top:r,width:i,height:o}=this;n&&(e.save(),e.fillStyle=n,e.fillRect(s,r,i,o),e.restore())}getLineWidthForValue(e){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const r=this.ticks.findIndex(i=>i.value===e);return r>=0?n.setContext(this.getContext(r)).lineWidth:0}drawGrid(e){const n=this.options.grid,s=this.ctx,r=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let i,o;const a=(l,c,u)=>{!u.width||!u.color||(s.save(),s.lineWidth=u.width,s.strokeStyle=u.color,s.setLineDash(u.borderDash||[]),s.lineDashOffset=u.borderDashOffset,s.beginPath(),s.moveTo(l.x,l.y),s.lineTo(c.x,c.y),s.stroke(),s.restore())};if(n.display)for(i=0,o=r.length;i<o;++i){const l=r[i];n.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),n.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:e,ctx:n,options:{border:s,grid:r}}=this,i=s.setContext(this.getContext()),o=s.display?i.width:0;if(!o)return;const a=r.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,u,f,h;this.isHorizontal()?(c=Os(e,this.left,o)-o/2,u=Os(e,this.right,a)+a/2,f=h=l):(f=Os(e,this.top,o)-o/2,h=Os(e,this.bottom,a)+a/2,c=u=l),n.save(),n.lineWidth=i.width,n.strokeStyle=i.color,n.beginPath(),n.moveTo(c,f),n.lineTo(u,h),n.stroke(),n.restore()}drawLabels(e){if(!this.options.ticks.display)return;const s=this.ctx,r=this._computeLabelArea();r&&$f(s,r);const i=this.getLabelItems(e);for(const o of i){const a=o.options,l=o.font,c=o.label,u=o.textOffset;Ol(s,c,0,u,l,a)}r&&Hf(s)}drawTitle(){const{ctx:e,options:{position:n,title:s,reverse:r}}=this;if(!s.display)return;const i=ct(s.font),o=Qt(s.padding),a=s.align;let l=i.lineHeight/2;n==="bottom"||n==="center"||ee(n)?(l+=o.bottom,Fe(s.text)&&(l+=i.lineHeight*(s.text.length-1))):l+=o.top;const{titleX:c,titleY:u,maxWidth:f,rotation:h}=HC(this,l,n,a);Ol(e,s.text,0,0,i,{color:s.color,maxWidth:f,rotation:h,textAlign:$C(a,n,r),textBaseline:"middle",translation:[c,u],strokeColor:s.strokeColor,strokeWidth:s.strokeWidth})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){const e=this.options,n=e.ticks&&e.ticks.z||0,s=J(e.grid&&e.grid.z,-1),r=J(e.border&&e.border.z,0);return!this._isVisible()||this.draw!==gi.prototype.draw?[{z:n,draw:i=>{this.draw(i)}}]:[{z:s,draw:i=>{this.drawBackground(),this.drawGrid(i),this.drawTitle()}},{z:r,draw:()=>{this.drawBorder()}},{z:n,draw:i=>{this.drawLabels(i)}}]}getMatchingVisibleMetas(e){const n=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",r=[];let i,o;for(i=0,o=n.length;i<o;++i){const a=n[i];a[s]===this.id&&(!e||a.type===e)&&r.push(a)}return r}_resolveTickFontOptions(e){const n=this.options.ticks.setContext(this.getContext(e));return ct(n.font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class Ra{constructor(e,n,s){this.type=e,this.scope=n,this.override=s,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){const n=Object.getPrototypeOf(e);let s;KC(n)&&(s=this.register(n));const r=this.items,i=e.id,o=this.scope+"."+i;if(!i)throw new Error("class does not have id: "+e);return i in r||(r[i]=e,VC(e,o,s),this.override&&je.override(e.id,e.overrides)),o}get(e){return this.items[e]}unregister(e){const n=this.items,s=e.id,r=this.scope;s in n&&delete n[s],r&&s in je[r]&&(delete je[r][s],this.override&&delete ar[s])}}function VC(t,e,n){const s=Po(Object.create(null),[n?je.get(n):{},je.get(e),t.defaults]);je.set(e,s),t.defaultRoutes&&QC(e,t.defaultRoutes),t.descriptors&&je.describe(e,t.descriptors)}function QC(t,e){Object.keys(e).forEach(n=>{const s=n.split("."),r=s.pop(),i=[t].concat(s).join("."),o=e[n].split("."),a=o.pop(),l=o.join(".");je.route(i,r,l,a)})}function KC(t){return"id"in t&&"defaults"in t}class YC{constructor(){this.controllers=new Ra(zr,"datasets",!0),this.elements=new Ra(Ss,"elements"),this.plugins=new Ra(Object,"plugins"),this.scales=new Ra(gi,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,n,s){[...n].forEach(r=>{const i=s||this._getRegistryForType(r);s||i.isForType(r)||i===this.plugins&&r.id?this._exec(e,i,r):re(r,o=>{const a=s||this._getRegistryForType(o);this._exec(e,a,o)})})}_exec(e,n,s){const r=Bf(e);fe(s["before"+r],[],s),n[e](s),fe(s["after"+r],[],s)}_getRegistryForType(e){for(let n=0;n<this._typedRegistries.length;n++){const s=this._typedRegistries[n];if(s.isForType(e))return s}return this.plugins}_get(e,n,s){const r=n.get(e);if(r===void 0)throw new Error('"'+e+'" is not a registered '+s+".");return r}}var sn=new YC;class XC{constructor(){this._init=void 0}notify(e,n,s,r){if(n==="beforeInit"&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install")),this._init===void 0)return;const i=r?this._descriptors(e).filter(r):this._descriptors(e),o=this._notify(i,e,n,s);return n==="afterDestroy"&&(this._notify(i,e,"stop"),this._notify(this._init,e,"uninstall"),this._init=void 0),o}_notify(e,n,s,r){r=r||{};for(const i of e){const o=i.plugin,a=o[s],l=[n,r,i.options];if(fe(a,l,o)===!1&&r.cancelable)return!1}return!0}invalidate(){le(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),n}_createDescriptors(e,n){const s=e&&e.config,r=J(s.options&&s.options.plugins,{}),i=qC(s);return r===!1&&!n?[]:JC(e,i,r,n)}_notifyStateChanges(e){const n=this._oldCache||[],s=this._cache,r=(i,o)=>i.filter(a=>!o.some(l=>a.plugin.id===l.plugin.id));this._notify(r(n,s),e,"stop"),this._notify(r(s,n),e,"start")}}function qC(t){const e={},n=[],s=Object.keys(sn.plugins.items);for(let i=0;i<s.length;i++)n.push(sn.getPlugin(s[i]));const r=t.plugins||[];for(let i=0;i<r.length;i++){const o=r[i];n.indexOf(o)===-1&&(n.push(o),e[o.id]=!0)}return{plugins:n,localIds:e}}function GC(t,e){return!e&&t===!1?null:t===!0?{}:t}function JC(t,{plugins:e,localIds:n},s,r){const i=[],o=t.getContext();for(const a of e){const l=a.id,c=GC(s[l],r);c!==null&&i.push({plugin:a,options:ZC(t.config,{plugin:a,local:n[l]},c,o)})}return i}function ZC(t,{plugin:e,local:n},s,r){const i=t.pluginScopeKeys(e),o=t.getOptionScopes(s,i);return n&&e.defaults&&o.push(e.defaults),t.createResolver(o,r,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Ed(t,e){const n=je.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||n.indexAxis||"x"}function ej(t,e){let n=t;return t==="_index_"?n=e:t==="_value_"&&(n=e==="x"?"y":"x"),n}function tj(t,e){return t===e?"_index_":"_value_"}function Pg(t){if(t==="x"||t==="y"||t==="r")return t}function nj(t){if(t==="top"||t==="bottom")return"x";if(t==="left"||t==="right")return"y"}function Nd(t,...e){if(Pg(t))return t;for(const n of e){const s=n.axis||nj(n.position)||t.length>1&&Pg(t[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function Rg(t,e,n){if(n[e+"AxisID"]===t)return{axis:e}}function sj(t,e){if(e.data&&e.data.datasets){const n=e.data.datasets.filter(s=>s.xAxisID===t||s.yAxisID===t);if(n.length)return Rg(t,"x",n[0])||Rg(t,"y",n[0])}return{}}function rj(t,e){const n=ar[t.type]||{scales:{}},s=e.scales||{},r=Ed(t.type,e),i=Object.create(null);return Object.keys(s).forEach(o=>{const a=s[o];if(!ee(a))return console.error(`Invalid scale configuration for scale: ${o}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${o}`);const l=Nd(o,a,sj(o,t),je.scales[a.type]),c=tj(l,r),u=n.scales||{};i[o]=no(Object.create(null),[{axis:l},a,u[l],u[c]])}),t.data.datasets.forEach(o=>{const a=o.type||t.type,l=o.indexAxis||Ed(a,e),u=(ar[a]||{}).scales||{};Object.keys(u).forEach(f=>{const h=ej(f,l),p=o[h+"AxisID"]||h;i[p]=i[p]||Object.create(null),no(i[p],[{axis:h},s[p],u[f]])})}),Object.keys(i).forEach(o=>{const a=i[o];no(a,[je.scales[a.type],je.scale])}),i}function $y(t){const e=t.options||(t.options={});e.plugins=J(e.plugins,{}),e.scales=rj(t,e)}function Hy(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function ij(t){return t=t||{},t.data=Hy(t.data),$y(t),t}const Og=new Map,Vy=new Set;function Oa(t,e){let n=Og.get(t);return n||(n=e(),Og.set(t,n),Vy.add(n)),n}const Li=(t,e,n)=>{const s=or(e,n);s!==void 0&&t.add(s)};class oj{constructor(e){this._config=ij(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=Hy(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),$y(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return Oa(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,n){return Oa(`${e}.transition.${n}`,()=>[[`datasets.${e}.transitions.${n}`,`transitions.${n}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,n){return Oa(`${e}-${n}`,()=>[[`datasets.${e}.elements.${n}`,`datasets.${e}`,`elements.${n}`,""]])}pluginScopeKeys(e){const n=e.id,s=this.type;return Oa(`${s}-plugin-${n}`,()=>[[`plugins.${n}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,n){const s=this._scopeCache;let r=s.get(e);return(!r||n)&&(r=new Map,s.set(e,r)),r}getOptionScopes(e,n,s){const{options:r,type:i}=this,o=this._cachedScopes(e,s),a=o.get(n);if(a)return a;const l=new Set;n.forEach(u=>{e&&(l.add(e),u.forEach(f=>Li(l,e,f))),u.forEach(f=>Li(l,r,f)),u.forEach(f=>Li(l,ar[i]||{},f)),u.forEach(f=>Li(l,je,f)),u.forEach(f=>Li(l,jd,f))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Vy.has(n)&&o.set(n,c),c}chartOptionScopes(){const{options:e,type:n}=this;return[e,ar[n]||{},je.datasets[n]||{},{type:n},je,jd]}resolveNamedOptions(e,n,s,r=[""]){const i={$shared:!0},{resolver:o,subPrefixes:a}=Tg(this._resolverCache,e,r);let l=o;if(lj(o,n)){i.$shared=!1,s=ws(s)?s():s;const c=this.createResolver(e,s,a);l=ci(o,s,c)}for(const c of n)i[c]=l[c];return i}createResolver(e,n,s=[""],r){const{resolver:i}=Tg(this._resolverCache,e,s);return ee(n)?ci(i,n,void 0,r):i}}function Tg(t,e,n){let s=t.get(e);s||(s=new Map,t.set(e,s));const r=n.join();let i=s.get(r);return i||(i={resolver:Qf(e,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},s.set(r,i)),i}const aj=t=>ee(t)&&Object.getOwnPropertyNames(t).some(e=>ws(t[e]));function lj(t,e){const{isScriptable:n,isIndexable:s}=My(t);for(const r of e){const i=n(r),o=s(r),a=(o||i)&&t[r];if(i&&(ws(a)||aj(a))||o&&Fe(a))return!0}return!1}var cj="4.6.1";const uj=["top","bottom","left","right","chartArea"];function Dg(t,e){return t==="top"||t==="bottom"||uj.indexOf(t)===-1&&e==="x"}function Lg(t,e){return function(n,s){return n[t]===s[t]?n[e]-s[e]:n[t]-s[t]}}function Ag(t){const e=t.chart,n=e.options.animation;e.notifyPlugins("afterRender"),fe(n&&n.onComplete,[t],e)}function dj(t){const e=t.chart,n=e.options.animation;fe(n&&n.onProgress,[t],e)}function Qy(t){return Xf()&&typeof t=="string"?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const Ga={},Fg=t=>{const e=Qy(t);return Object.values(Ga).filter(n=>n.canvas===e).pop()};function fj(t,e,n){const s=Object.keys(t);for(const r of s){const i=+r;if(i>=e){const o=t[r];delete t[r],(n>0||i>e)&&(t[i+n]=o)}}}function hj(t,e,n,s){return!n||t.type==="mouseout"?null:s?e:t}var zn;let dc=(zn=class{static register(...e){sn.add(...e),Ig()}static unregister(...e){sn.remove(...e),Ig()}constructor(e,n){const s=this.config=new oj(n),r=Qy(e),i=Fg(r);if(i)throw new Error("Canvas is already in use. Chart with ID '"+i.id+"' must be destroyed before the canvas with ID '"+i.canvas.id+"' can be reused.");const o=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||RC(r)),this.platform.updateConfig(s);const a=this.platform.acquireContext(r,o.aspectRatio),l=a&&a.canvas,c=l&&l.height,u=l&&l.width;if(this.id=P_(),this.ctx=a,this.canvas=l,this.width=u,this.height=c,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new XC,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Y_(f=>this.update(f),o.resizeDelay||0),this._dataChanges=[],Ga[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}xn.listen(this,"complete",Ag),xn.listen(this,"progress",dj),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:n},width:s,height:r,_aspectRatio:i}=this;return le(e)?n&&i?i:r?s/r:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return sn}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():cg(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return ig(this.canvas,this.ctx),this}stop(){return xn.stop(this),this}resize(e,n){xn.running(this)?this._resizeBeforeDraw={width:e,height:n}:this._resize(e,n)}_resize(e,n){const s=this.options,r=this.canvas,i=s.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(r,e,n,i),a=s.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,cg(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),fe(s.onResize,[this,o],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};re(n,(s,r)=>{s.id=r})}buildOrUpdateScales(){const e=this.options,n=e.scales,s=this.scales,r=Object.keys(s).reduce((o,a)=>(o[a]=!1,o),{});let i=[];n&&(i=i.concat(Object.keys(n).map(o=>{const a=n[o],l=Nd(o,a),c=l==="r",u=l==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),re(i,o=>{const a=o.options,l=a.id,c=Nd(l,a),u=J(a.type,o.dtype);(a.position===void 0||Dg(a.position,c)!==Dg(o.dposition))&&(a.position=o.dposition),r[l]=!0;let f=null;if(l in s&&s[l].type===u)f=s[l];else{const h=sn.getScale(u);f=new h({id:l,type:u,ctx:this.ctx,chart:this}),s[f.id]=f}f.init(a,e)}),re(r,(o,a)=>{o||delete s[a]}),re(s,o=>{is.configure(this,o,o.options),is.addBox(this,o)})}_updateMetasets(){const e=this._metasets,n=this.data.datasets.length,s=e.length;if(e.sort((r,i)=>r.index-i.index),s>n){for(let r=n;r<s;++r)this._destroyDatasetMeta(r);e.splice(n,s-n)}this._sortedMetasets=e.slice(0).sort(Lg("order","index"))}_removeUnreferencedMetasets(){const{_metasets:e,data:{datasets:n}}=this;e.length>n.length&&delete this._stacks,e.forEach((s,r)=>{n.filter(i=>i===s._dataset).length===0&&this._destroyDatasetMeta(r)})}buildOrUpdateControllers(){const e=[],n=this.data.datasets;let s,r;for(this._removeUnreferencedMetasets(),s=0,r=n.length;s<r;s++){const i=n[s];let o=this.getDatasetMeta(s);const a=i.type||this.config.type;if(o.type&&o.type!==a&&(this._destroyDatasetMeta(s),o=this.getDatasetMeta(s)),o.type=a,o.indexAxis=i.indexAxis||Ed(a,this.options),o.order=i.order||0,o.index=s,o.label=""+i.label,o.visible=this.isDatasetVisible(s),o.controller)o.controller.updateIndex(s),o.controller.linkScales();else{const l=sn.getController(a),{datasetElementType:c,dataElementType:u}=je.datasets[a];Object.assign(l,{dataElementType:sn.getElement(u),datasetElementType:c&&sn.getElement(c)}),o.controller=new l(this,s),e.push(o.controller)}}return this._updateMetasets(),e}_resetElements(){re(this.data.datasets,(e,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const n=this.config;n.update();const s=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const i=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let c=0,u=this.data.datasets.length;c<u;c++){const{controller:f}=this.getDatasetMeta(c),h=!r&&i.indexOf(f)===-1;f.buildOrUpdateElements(h),o=Math.max(+f.getMaxOverflow(),o)}o=this._minPadding=s.layout.autoPadding?o:0,this._updateLayout(o),r||re(i,c=>{c.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(Lg("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){re(this.scales,e=>{is.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,n=new Set(Object.keys(this._listeners)),s=new Set(e.events);(!Xp(n,s)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,n=this._getUniformDataChanges()||[];for(const{method:s,start:r,count:i}of n){const o=s==="_removeElements"?-i:i;fj(e,r,o)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const n=this.data.datasets.length,s=i=>new Set(e.filter(o=>o[0]===i).map((o,a)=>a+","+o.splice(1).join(","))),r=s(0);for(let i=1;i<n;i++)if(!Xp(r,s(i)))return;return Array.from(r).map(i=>i.split(",")).map(i=>({method:i[1],start:+i[2],count:+i[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;is.update(this,this.width,this.height,e);const n=this.chartArea,s=n.width<=0||n.height<=0;this._layers=[],re(this.boxes,r=>{s&&r.position==="chartArea"||(r.configure&&r.configure(),this._layers.push(...r._layers()))},this),this._layers.forEach((r,i)=>{r._idx=i}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let n=0,s=this.data.datasets.length;n<s;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,s=this.data.datasets.length;n<s;++n)this._updateDataset(n,ws(e)?e({datasetIndex:n}):e);this.notifyPlugins("afterDatasetsUpdate",{mode:e})}}_updateDataset(e,n){const s=this.getDatasetMeta(e),r={meta:s,index:e,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",r)!==!1&&(s.controller._update(n),r.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",r))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(xn.has(this)?this.attached&&!xn.running(this)&&xn.start(this):(this.draw(),Ag({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){const{width:s,height:r}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(s,r)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(e=0;e<n.length&&n[e].z<=0;++e)n[e].draw(this.chartArea);for(this._drawDatasets();e<n.length;++e)n[e].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(e){const n=this._sortedMetasets,s=[];let r,i;for(r=0,i=n.length;r<i;++r){const o=n[r];(!e||o.visible)&&s.push(o)}return s}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const e=this.getSortedVisibleDatasetMetas();for(let n=e.length-1;n>=0;--n)this._drawDataset(e[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const n=this.ctx,s={meta:e,index:e.index,cancelable:!0},r=Tk(this,e);this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(r&&$f(n,r),e.controller.draw(),r&&Hf(n),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(e){return Ey(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,n,s,r){const i=uC.modes[n];return typeof i=="function"?i(this,e,s,r):[]}getDatasetMeta(e){const n=this.data.datasets[e],s=this._metasets;let r=s.filter(i=>i&&i._dataset===n).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:e,_dataset:n,_parsed:[],_sorted:!1},s.push(r)),r}getContext(){return this.$context||(this.$context=pi(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const n=this.data.datasets[e];if(!n)return!1;const s=this.getDatasetMeta(e);return typeof s.hidden=="boolean"?!s.hidden:!n.hidden}setDatasetVisibility(e,n){const s=this.getDatasetMeta(e);s.hidden=!n}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,n,s){const r=s?"show":"hide",i=this.getDatasetMeta(e),o=i.controller._resolveAnimations(void 0,r);Ro(n)?(i.data[n].hidden=!s,this.update()):(this.setDatasetVisibility(e,s),o.update(i,{visible:s}),this.update(a=>a.datasetIndex===e?r:void 0))}hide(e,n){this._updateVisibility(e,n,!1)}show(e,n){this._updateVisibility(e,n,!0)}_destroyDatasetMeta(e){const n=this._metasets[e];n&&n.controller&&n.controller._destroy(),delete this._metasets[e]}_stop(){let e,n;for(this.stop(),xn.remove(this),e=0,n=this.data.datasets.length;e<n;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:e,ctx:n}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),ig(e,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete Ga[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const e=this._listeners,n=this.platform,s=(i,o)=>{n.addEventListener(this,i,o),e[i]=o},r=(i,o,a)=>{i.offsetX=o,i.offsetY=a,this._eventHandler(i)};re(this.options.events,i=>s(i,r))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,n=this.platform,s=(l,c)=>{n.addEventListener(this,l,c),e[l]=c},r=(l,c)=>{e[l]&&(n.removeEventListener(this,l,c),delete e[l])},i=(l,c)=>{this.canvas&&this.resize(l,c)};let o;const a=()=>{r("attach",a),this.attached=!0,this.resize(),s("resize",i),s("detach",o)};o=()=>{this.attached=!1,r("resize",i),this._stop(),this._resize(0,0),s("attach",a)},n.isAttached(this.canvas)?a():o()}unbindEvents(){re(this._listeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._listeners={},re(this._responsiveListeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,n,s){const r=s?"set":"remove";let i,o,a,l;for(n==="dataset"&&(i=this.getDatasetMeta(e[0].datasetIndex),i.controller["_"+r+"DatasetHoverStyle"]()),a=0,l=e.length;a<l;++a){o=e[a];const c=o&&this.getDatasetMeta(o.datasetIndex).controller;c&&c[r+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){const n=this._active||[],s=e.map(({datasetIndex:i,index:o})=>{const a=this.getDatasetMeta(i);if(!a)throw new Error("No dataset found at index "+i);return{datasetIndex:i,element:a.data[o],index:o}});!El(s,n)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,n))}notifyPlugins(e,n,s){return this._plugins.notify(this,e,n,s)}isPluginEnabled(e){return this._plugins._cache.filter(n=>n.plugin.id===e).length===1}_updateHoverStyles(e,n,s){const r=this.options.hover,i=(l,c)=>l.filter(u=>!c.some(f=>u.datasetIndex===f.datasetIndex&&u.index===f.index)),o=i(n,e),a=s?e:i(e,n);o.length&&this.updateHoverStyle(o,r.mode,!1),a.length&&r.mode&&this.updateHoverStyle(a,r.mode,!0)}_eventHandler(e,n){const s={event:e,replay:n,cancelable:!0,inChartArea:this.isPointInArea(e)},r=o=>(o.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",s,r)===!1)return;const i=this._handleEvent(e,n,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,r),(i||s.changed)&&this.render(),this}_handleEvent(e,n,s){const{_active:r=[],options:i}=this,o=n,a=this._getActiveElements(e,r,s,o),l=A_(e),c=hj(e,this._lastEvent,s,l);s&&(this._lastEvent=null,fe(i.onHover,[e,a,this],this),l&&fe(i.onClick,[e,a,this],this));const u=!El(a,r);return(u||n)&&(this._active=a,this._updateHoverStyles(a,r,n)),this._lastEvent=c,u}_getActiveElements(e,n,s,r){if(e.type==="mouseout")return[];if(!s)return n;const i=this.options.hover;return this.getElementsAtEventForMode(e,i.mode,i,r)}},B(zn,"defaults",je),B(zn,"instances",Ga),B(zn,"overrides",ar),B(zn,"registry",sn),B(zn,"version",cj),B(zn,"getChart",Fg),zn);function Ig(){return re(dc.instances,t=>t._plugins.invalidate())}function pj(t,e,n){const{startAngle:s,x:r,y:i,outerRadius:o,innerRadius:a,options:l}=e,{borderWidth:c,borderJoinStyle:u}=l,f=Math.min(c/o,rn(s-n));if(t.beginPath(),t.arc(r,i,o-c/2,s+f/2,n-f/2),a>0){const h=Math.min(c/a,rn(s-n));t.arc(r,i,a+c/2,n-h/2,s+h/2,!0)}else{const h=Math.min(c/2,o*rn(s-n));if(u==="round")t.arc(r,i,h,n-he/2,s+he/2,!0);else if(u==="bevel"){const p=2*h*h,y=-p*Math.cos(n+he/2)+r,m=-p*Math.sin(n+he/2)+i,b=p*Math.cos(s+he/2)+r,x=p*Math.sin(s+he/2)+i;t.lineTo(y,m),t.lineTo(b,x)}}t.closePath(),t.moveTo(0,0),t.rect(0,0,t.canvas.width,t.canvas.height),t.clip("evenodd")}function gj(t,e,n){const{startAngle:s,pixelMargin:r,x:i,y:o,outerRadius:a,innerRadius:l}=e;let c=r/a;t.beginPath(),t.arc(i,o,a,s-c,n+c),l>r?(c=r/l,t.arc(i,o,l,n+c,s-c,!0)):t.arc(i,o,r,n+Te,s-Te),t.closePath(),t.clip()}function mj(t){return Vf(t,["outerStart","outerEnd","innerStart","innerEnd"])}function xj(t,e,n,s){const r=mj(t.options.borderRadius),i=(n-e)/2,o=Math.min(i,s*e/2),a=l=>{const c=(n-Math.min(i,l))*s/2;return lt(l,0,Math.min(i,c))};return{outerStart:a(r.outerStart),outerEnd:a(r.outerEnd),innerStart:lt(r.innerStart,0,o),innerEnd:lt(r.innerEnd,0,o)}}function xr(t,e,n,s){return{x:n+t*Math.cos(e),y:s+t*Math.sin(e)}}function yj(t,e,n,s){const{x:r,y:i,startAngle:o,pixelMargin:a,innerRadius:l}=e,c=Math.max(e.outerRadius+s+n-a,0),u=l>0?l+s+n+a:0;t.beginPath(),t.arc(r,i,c,o,o+xe),u>0&&(t.moveTo(r+Math.cos(o)*u,i+Math.sin(o)*u),t.arc(r,i,u,o+xe,o,!0)),t.closePath()}function Al(t,e,n,s,r,i){const{x:o,y:a,startAngle:l,pixelMargin:c,innerRadius:u}=e,{spacingMode:f="angular"}=e.options,h=r-l;if(i&&e.options.selfJoin&&Math.abs(h)>=xe-1e-4){yj(t,e,n,s);return}const p=Math.max(e.outerRadius+s+n-c,0);let y=u>0?u+s+n+c:0,m=0,b=0;const x=p>0?Math.max(.001,h*p-n/he)/p:.001,g=(h-x)/2;if(s){const F=u>0?u-s:0,K=p>0?p-s:0,$=(F+K)/2,ue=(()=>{const Lt=$!==0?h*$/($+s):h;return(h-Lt)/2})(),Y=$>0?Math.asin(Math.min(1,s/$)):0,Ne=Math.max(0,x/2-.001),te=Math.sin(Ne);if(f==="parallel"){if(y===0&&te>0){const Zo=s/te,ht=Math.max(0,p-.001);y=Math.min(Zo,ht)}const Lt=Math.min(p>0?p*te:Number.POSITIVE_INFINITY,y>0?y*te:Number.POSITIVE_INFINITY),yi=Math.min(s,Lt);m=p>0?Math.asin(Math.min(1,yi/p)):Math.min(Ne,Y),b=y>0?Math.asin(Math.min(1,yi/y)):m}else f==="proportional"?(m=Math.min(Ne,ue),b=Math.min(Ne,ue)):(m=Math.min(Ne,Y),b=Math.min(Ne,Y))}const v=l+g+m,S=r-g-m,_=l+g+b,k=r-g-b,j=Math.min(S-v,k-_),{outerStart:E,outerEnd:P,innerStart:M,innerEnd:O}=xj(e,y,p,j),N=p-E,I=p-P,W=v+E/N,V=S-P/I,oe=y+M,se=y+O,T=_+M/oe,A=k-O/se;if(t.beginPath(),i){const F=(W+V)/2;if(t.arc(o,a,p,W,F),t.arc(o,a,p,F,V),P>0){const Y=xr(I,V,o,a);t.arc(Y.x,Y.y,P,V,S+Te)}const K=xr(se,k,o,a);if(t.lineTo(K.x,K.y),O>0){const Y=xr(se,A,o,a);t.arc(Y.x,Y.y,O,k+Te,A+Math.PI)}const $=(k-O/y+(_+M/y))/2;if(t.arc(o,a,y,k-O/y,$,!0),t.arc(o,a,y,$,_+M/y,!0),M>0){const Y=xr(oe,T,o,a);t.arc(Y.x,Y.y,M,T+Math.PI,_-Te)}const ue=xr(N,v,o,a);if(t.lineTo(ue.x,ue.y),E>0){const Y=xr(N,W,o,a);t.arc(Y.x,Y.y,E,v-Te,W)}}else{t.moveTo(o,a);const F=Math.cos(W)*p+o,K=Math.sin(W)*p+a;t.lineTo(F,K);const $=Math.cos(V)*p+o,ue=Math.sin(V)*p+a;t.lineTo($,ue)}t.closePath()}function vj(t,e,n,s,r){const{fullCircles:i,startAngle:o,circumference:a}=e;let l=e.endAngle;if(i){Al(t,e,n,s,l,r);for(let c=0;c<i;++c)t.fill();isNaN(a)||(l=o+(a%xe||xe))}return Al(t,e,n,s,l,r),t.fill(),l}function bj(t,e,n,s,r){const{fullCircles:i,startAngle:o,circumference:a,options:l}=e,{borderWidth:c,borderJoinStyle:u,borderDash:f,borderDashOffset:h,borderRadius:p}=l,y=l.borderAlign==="inner";if(!c)return;t.setLineDash(f||[]),t.lineDashOffset=h,y?(t.lineWidth=c*2,t.lineJoin=u||"round"):(t.lineWidth=c,t.lineJoin=u||"bevel");let m=e.endAngle;const b=Math.abs(m-o)>=xe-1e-4;if(i){Al(t,e,n,s,m,r);for(let g=0;g<i;++g)t.stroke();isNaN(a)||(m=o+(a%xe||xe))}y&&gj(t,e,m),!(b&&e.innerRadius>0)&&l.selfJoin&&m-o>=he&&p===0&&u!=="miter"&&pj(t,e,m),i||(Al(t,e,n,s,m,r),t.stroke())}class Vi extends Ss{constructor(n){super();B(this,"circumference");B(this,"endAngle");B(this,"fullCircles");B(this,"innerRadius");B(this,"outerRadius");B(this,"pixelMargin");B(this,"startAngle");B(this,"circular");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,this.circular=!1,n&&Object.assign(this,n)}inRange(n,s,r){const i=this.getProps(["x","y"],r),{angle:o,distance:a}=yy(i,{x:n,y:s}),{startAngle:l,endAngle:c,innerRadius:u,outerRadius:f,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],r),p=(this.options.spacing+this.options.borderWidth)/2,y=J(h,c-l),m=Rl(o,l,c)&&l!==c,b=y>=xe||m,x=Us(a,u+p,f+p);return b&&x}getCenterPoint(n){const{x:s,y:r,startAngle:i,endAngle:o,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:c,spacing:u}=this.options,f=(i+o)/2,h=(a+l+u+c)/2;return{x:s+Math.cos(f)*h,y:r+Math.sin(f)*h}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:s,circumference:r}=this,i=(s.offset||0)/4,o=(s.spacing||0)/2,a=s.circular;if(this.pixelMargin=s.borderAlign==="inner"?.33:0,this.fullCircles=r>xe?Math.floor(r/xe):0,r===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const l=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(l)*i,Math.sin(l)*i);const c=1-Math.sin(Math.min(he,r||0)),u=i*c;n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,vj(n,this,u,o,a),bj(n,this,u,o,a),n.restore()}}B(Vi,"id","arc"),B(Vi,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,spacingMode:"angular",angle:void 0,circular:!0,selfJoin:!1}),B(Vi,"defaultRoutes",{backgroundColor:"backgroundColor"}),B(Vi,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function Ky(t,e){const{x:n,y:s,base:r,width:i,height:o}=t.getProps(["x","y","base","width","height"],e);let a,l,c,u,f;return t.horizontal?(f=o/2,a=Math.min(n,r),l=Math.max(n,r),c=s-f,u=s+f):(f=i/2,a=n-f,l=n+f,c=Math.min(s,r),u=Math.max(s,r)),{left:a,top:c,right:l,bottom:u}}function os(t,e,n,s){return t?0:lt(e,n,s)}function wj(t,e,n){const s=t.options.borderWidth,r=t.borderSkipped,i=Ny(s);return{t:os(r.top,i.top,0,n),r:os(r.right,i.right,0,e),b:os(r.bottom,i.bottom,0,n),l:os(r.left,i.left,0,e)}}function Sj(t,e,n){const{enableBorderRadius:s}=t.getProps(["enableBorderRadius"]),r=t.options.borderRadius,i=Fr(r),o=Math.min(e,n),a=t.borderSkipped,l=s||ee(r);return{topLeft:os(!l||a.top||a.left,i.topLeft,0,o),topRight:os(!l||a.top||a.right,i.topRight,0,o),bottomLeft:os(!l||a.bottom||a.left,i.bottomLeft,0,o),bottomRight:os(!l||a.bottom||a.right,i.bottomRight,0,o)}}function _j(t){const e=Ky(t),n=e.right-e.left,s=e.bottom-e.top,r=wj(t,n/2,s/2),i=Sj(t,n/2,s/2);return{outer:{x:e.left,y:e.top,w:n,h:s,radius:i},inner:{x:e.left+r.l,y:e.top+r.t,w:n-r.l-r.r,h:s-r.t-r.b,radius:{topLeft:Math.max(0,i.topLeft-Math.max(r.t,r.l)),topRight:Math.max(0,i.topRight-Math.max(r.t,r.r)),bottomLeft:Math.max(0,i.bottomLeft-Math.max(r.b,r.l)),bottomRight:Math.max(0,i.bottomRight-Math.max(r.b,r.r))}}}}function au(t,e,n,s){const r=e===null,i=n===null,a=t&&!(r&&i)&&Ky(t,s);return a&&(r||Us(e,a.left,a.right))&&(i||Us(n,a.top,a.bottom))}function kj(t){return t.topLeft||t.topRight||t.bottomLeft||t.bottomRight}function Cj(t,e){t.rect(e.x,e.y,e.w,e.h)}function lu(t,e,n={}){const s=t.x!==n.x?-e:0,r=t.y!==n.y?-e:0,i=(t.x+t.w!==n.x+n.w?e:0)-s,o=(t.y+t.h!==n.y+n.h?e:0)-r;return{x:t.x+s,y:t.y+r,w:t.w+i,h:t.h+o,radius:t.radius}}class Ja extends Ss{constructor(e){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,e&&Object.assign(this,e)}draw(e){const{inflateAmount:n,options:{borderColor:s,backgroundColor:r}}=this,{inner:i,outer:o}=_j(this),a=kj(o.radius)?Tl:Cj;e.save(),(o.w!==i.w||o.h!==i.h)&&(e.beginPath(),a(e,lu(o,n,i)),e.clip(),a(e,lu(i,-n,o)),e.fillStyle=s,e.fill("evenodd")),e.beginPath(),a(e,lu(i,n)),e.fillStyle=r,e.fill(),e.restore()}inRange(e,n,s){return au(this,e,n,s)}inXRange(e,n){return au(this,e,null,n)}inYRange(e,n){return au(this,null,e,n)}getCenterPoint(e){const{x:n,y:s,base:r,horizontal:i}=this.getProps(["x","y","base","horizontal"],e);return{x:i?(n+r)/2:n,y:i?s:(s+r)/2}}getRange(e){return e==="x"?this.width/2:this.height/2}}B(Ja,"id","bar"),B(Ja,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),B(Ja,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});const zg=(t,e)=>{let{boxHeight:n=e,boxWidth:s=e}=t;return t.usePointStyle&&(n=Math.min(n,e),s=t.pointStyleWidth||Math.min(s,e)),{boxWidth:s,boxHeight:n,itemHeight:Math.max(e,n)}},jj=(t,e)=>t!==null&&e!==null&&t.datasetIndex===e.datasetIndex&&t.index===e.index;class Bg extends Ss{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,n,s){this.maxWidth=e,this.maxHeight=n,this._margins=s,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const e=this.options.labels||{};let n=fe(e.generateLabels,[this.chart],this)||[];e.filter&&(n=n.filter(s=>e.filter(s,this.chart.data))),e.sort&&(n=n.sort((s,r)=>e.sort(s,r,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:e,ctx:n}=this;if(!e.display){this.width=this.height=0;return}const s=e.labels,r=ct(s.font),i=r.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=zg(s,i);let c,u;n.font=r.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(o,i,a,l)+10):(u=this.maxHeight,c=this._fitCols(o,r,a,l)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(u,e.maxHeight||this.maxHeight)}_fitRows(e,n,s,r){const{ctx:i,maxWidth:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=r+a;let f=e;i.textAlign="left",i.textBaseline="middle";let h=-1,p=-u;return this.legendItems.forEach((y,m)=>{const b=s+n/2+i.measureText(y.text).width;(m===0||c[c.length-1]+b+2*a>o)&&(f+=u,c[c.length-(m>0?0:1)]=0,p+=u,h++),l[m]={left:0,top:p,row:h,width:b,height:r},c[c.length-1]+=b+a}),f}_fitCols(e,n,s,r){const{ctx:i,maxHeight:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=o-e;let f=a,h=0,p=0,y=0,m=0;return this.legendItems.forEach((b,x)=>{const{itemWidth:g,itemHeight:v}=Ej(s,n,i,b,r);x>0&&p+v+2*a>u&&(f+=h+a,c.push({width:h,height:p}),y+=h+a,m++,h=p=0),l[x]={left:y,top:p,col:m,width:g,height:v},h=Math.max(h,g),p+=v+a}),f+=h,c.push({width:h,height:p}),f}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:s,labels:{padding:r},rtl:i}}=this,o=Ir(i,this.left,this.width);if(this.isHorizontal()){let a=0,l=xt(s,this.left+r,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=xt(s,this.left+r,this.right-this.lineWidths[a])),c.top+=this.top+e+r,c.left=o.leftForLtr(o.x(l),c.width),l+=c.width+r}else{let a=0,l=xt(s,this.top+e+r,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=xt(s,this.top+e+r,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+r,c.left=o.leftForLtr(o.x(c.left),c.width),l+=c.height+r}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const e=this.ctx;$f(e,this),this._draw(),Hf(e)}}_draw(){const{options:e,columnSizes:n,lineWidths:s,ctx:r}=this,{align:i,labels:o}=e,a=je.color,l=Ir(e.rtl,this.left,this.width),c=ct(o.font),{padding:u}=o,f=c.size,h=f/2;let p;this.drawTitle(),r.textAlign=l.textAlign("left"),r.textBaseline="middle",r.lineWidth=.5,r.font=c.string;const{boxWidth:y,boxHeight:m,itemHeight:b}=zg(o,f),x=function(k,j,E){if(isNaN(y)||y<=0||isNaN(m)||m<0)return;r.save();const P=J(E.lineWidth,1);if(r.fillStyle=J(E.fillStyle,a),r.lineCap=J(E.lineCap,"butt"),r.lineDashOffset=J(E.lineDashOffset,0),r.lineJoin=J(E.lineJoin,"miter"),r.lineWidth=P,r.strokeStyle=J(E.strokeStyle,a),r.setLineDash(J(E.lineDash,[])),o.usePointStyle){const M={radius:m*Math.SQRT2/2,pointStyle:E.pointStyle,rotation:E.rotation,borderWidth:P},O=l.xPlus(k,y/2),N=j+h;jy(r,M,O,N,o.pointStyleWidth&&y)}else{const M=j+Math.max((f-m)/2,0),O=l.leftForLtr(k,y),N=Fr(E.borderRadius);r.beginPath(),Object.values(N).some(I=>I!==0)?Tl(r,{x:O,y:M,w:y,h:m,radius:N}):r.rect(O,M,y,m),r.fill(),P!==0&&r.stroke()}r.restore()},g=function(k,j,E){Ol(r,E.text,k,j+b/2,c,{strikethrough:E.hidden,textAlign:l.textAlign(E.textAlign)})},v=this.isHorizontal(),S=this._computeTitleHeight();v?p={x:xt(i,this.left+u,this.right-s[0]),y:this.top+u+S,line:0}:p={x:this.left+u,y:xt(i,this.top+S+u,this.bottom-n[0].height),line:0},Ty(this.ctx,e.textDirection);const _=b+u;this.legendItems.forEach((k,j)=>{r.strokeStyle=k.fontColor,r.fillStyle=k.fontColor;const E=r.measureText(k.text).width,P=l.textAlign(k.textAlign||(k.textAlign=o.textAlign)),M=y+h+E;let O=p.x,N=p.y;l.setWidth(this.width),v?j>0&&O+M+u>this.right&&(N=p.y+=_,p.line++,O=p.x=xt(i,this.left+u,this.right-s[p.line])):j>0&&N+_>this.bottom&&(O=p.x=O+n[p.line].width+u,p.line++,N=p.y=xt(i,this.top+S+u,this.bottom-n[p.line].height));const I=l.x(O);if(x(I,N,k),O=X_(P,O+y+h,v?O+M:this.right,e.rtl),g(l.x(O),N,k),v)p.x+=M+u;else if(typeof k.text!="string"){const W=c.lineHeight;p.y+=Yy(k,W)+u}else p.y+=_}),Dy(this.ctx,e.textDirection)}drawTitle(){const e=this.options,n=e.title,s=ct(n.font),r=Qt(n.padding);if(!n.display)return;const i=Ir(e.rtl,this.left,this.width),o=this.ctx,a=n.position,l=s.size/2,c=r.top+l;let u,f=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),u=this.top+c,f=xt(e.align,f,this.right-h);else{const y=this.columnSizes.reduce((m,b)=>Math.max(m,b.height),0);u=c+xt(e.align,this.top,this.bottom-y-e.labels.padding-this._computeTitleHeight())}const p=xt(a,f,f+h);o.textAlign=i.textAlign(_y(a)),o.textBaseline="middle",o.strokeStyle=n.color,o.fillStyle=n.color,o.font=s.string,Ol(o,n.text,p,u,s)}_computeTitleHeight(){const e=this.options.title,n=ct(e.font),s=Qt(e.padding);return e.display?n.lineHeight+s.height:0}_getLegendItemAt(e,n){let s,r,i;if(Us(e,this.left,this.right)&&Us(n,this.top,this.bottom)){for(i=this.legendHitBoxes,s=0;s<i.length;++s)if(r=i[s],Us(e,r.left,r.left+r.width)&&Us(n,r.top,r.top+r.height))return this.legendItems[s]}return null}handleEvent(e){const n=this.options;if(!Pj(e.type,n))return;const s=this._getLegendItemAt(e.x,e.y);if(e.type==="mousemove"||e.type==="mouseout"){const r=this._hoveredItem,i=jj(r,s);r&&!i&&fe(n.onLeave,[e,r,this],this),this._hoveredItem=s,s&&!i&&fe(n.onHover,[e,s,this],this)}else s&&fe(n.onClick,[e,s,this],this)}}function Ej(t,e,n,s,r){const i=Nj(s,t,e,n),o=Mj(r,s,e.lineHeight);return{itemWidth:i,itemHeight:o}}function Nj(t,e,n,s){let r=t.text;return r&&typeof r!="string"&&(r=r.reduce((i,o)=>i.length>o.length?i:o)),e+n.size/2+s.measureText(r).width}function Mj(t,e,n){let s=t;return typeof e.text!="string"&&(s=Yy(e,n)),s}function Yy(t,e){const n=t.text?t.text.length:0;return e*n}function Pj(t,e){return!!((t==="mousemove"||t==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(t==="click"||t==="mouseup"))}var Rj={id:"legend",_element:Bg,start(t,e,n){const s=t.legend=new Bg({ctx:t.ctx,options:n,chart:t});is.configure(t,s,n),is.addBox(t,s)},stop(t){is.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,n){const s=t.legend;is.configure(t,s,n),s.options=n},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,n){const s=e.datasetIndex,r=n.chart;r.isDatasetVisible(s)?(r.hide(s),e.hidden=!0):(r.show(s),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:n,pointStyle:s,textAlign:r,color:i,useBorderRadius:o,borderRadius:a}}=t.legend.options;return t._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),u=Qt(c.borderWidth);return{text:e[l.index].label,fillStyle:c.backgroundColor,fontColor:i,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:s||c.pointStyle,rotation:c.rotation,textAlign:r||c.textAlign,borderRadius:o&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};const Qi={average(t){if(!t.length)return!1;let e,n,s=new Set,r=0,i=0;for(e=0,n=t.length;e<n;++e){const a=t[e].element;if(a&&a.hasValue()){const l=a.tooltipPosition();s.add(l.x),r+=l.y,++i}}return i===0||s.size===0?!1:{x:[...s].reduce((a,l)=>a+l)/s.size,y:r/i}},nearest(t,e){if(!t.length)return!1;let n=e.x,s=e.y,r=Number.POSITIVE_INFINITY,i,o,a;for(i=0,o=t.length;i<o;++i){const l=t[i].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),u=$_(e,c);u<r&&(r=u,a=l)}}if(a){const l=a.tooltipPosition();n=l.x,s=l.y}return{x:n,y:s}}};function tn(t,e){return e&&(Fe(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function yn(t){return(typeof t=="string"||t instanceof String)&&t.indexOf(`
|
|
83
|
-
`)>-1?t.split(`
|
|
84
|
-
`):t}function Oj(t,e){const{element:n,datasetIndex:s,index:r}=e,i=t.getDatasetMeta(s).controller,{label:o,value:a}=i.getLabelAndValue(r);return{chart:t,label:o,parsed:i.getParsed(r),raw:t.data.datasets[s].data[r],formattedValue:a,dataset:i.getDataset(),dataIndex:r,datasetIndex:s,element:n}}function Wg(t,e){const n=t.chart.ctx,{body:s,footer:r,title:i}=t,{boxWidth:o,boxHeight:a}=e,l=ct(e.bodyFont),c=ct(e.titleFont),u=ct(e.footerFont),f=i.length,h=r.length,p=s.length,y=Qt(e.padding);let m=y.height,b=0,x=s.reduce((S,_)=>S+_.before.length+_.lines.length+_.after.length,0);if(x+=t.beforeBody.length+t.afterBody.length,f&&(m+=f*c.lineHeight+(f-1)*e.titleSpacing+e.titleMarginBottom),x){const S=e.displayColors?Math.max(a,l.lineHeight):l.lineHeight;m+=p*S+(x-p)*l.lineHeight+(x-1)*e.bodySpacing}h&&(m+=e.footerMarginTop+h*u.lineHeight+(h-1)*e.footerSpacing);let g=0;const v=function(S){b=Math.max(b,n.measureText(S).width+g)};return n.save(),n.font=c.string,re(t.title,v),n.font=l.string,re(t.beforeBody.concat(t.afterBody),v),g=e.displayColors?o+2+e.boxPadding:0,re(s,S=>{re(S.before,v),re(S.lines,v),re(S.after,v)}),g=0,n.font=u.string,re(t.footer,v),n.restore(),b+=y.width,{width:b,height:m}}function Tj(t,e){const{y:n,height:s}=e;return n<s/2?"top":n>t.height-s/2?"bottom":"center"}function Dj(t,e,n,s){const{x:r,width:i}=s,o=n.caretSize+n.caretPadding;if(t==="left"&&r+i+o>e.width||t==="right"&&r-i-o<0)return!0}function Lj(t,e,n,s){const{x:r,width:i}=n,{width:o,chartArea:{left:a,right:l}}=t;let c="center";return s==="center"?c=r<=(a+l)/2?"left":"right":r<=i/2?c="left":r>=o-i/2&&(c="right"),Dj(c,t,e,n)&&(c="center"),c}function Ug(t,e,n){const s=n.yAlign||e.yAlign||Tj(t,n);return{xAlign:n.xAlign||e.xAlign||Lj(t,e,n,s),yAlign:s}}function Aj(t,e){let{x:n,width:s}=t;return e==="right"?n-=s:e==="center"&&(n-=s/2),n}function Fj(t,e,n){let{y:s,height:r}=t;return e==="top"?s+=n:e==="bottom"?s-=r+n:s-=r/2,s}function $g(t,e,n,s){const{caretSize:r,caretPadding:i,cornerRadius:o}=t,{xAlign:a,yAlign:l}=n,c=r+i,{topLeft:u,topRight:f,bottomLeft:h,bottomRight:p}=Fr(o);let y=Aj(e,a);const m=Fj(e,l,c);return l==="center"?a==="left"?y+=c:a==="right"&&(y-=c):a==="left"?y-=Math.max(u,h)+r:a==="right"&&(y+=Math.max(f,p)+r),{x:lt(y,0,s.width-e.width),y:lt(m,0,s.height-e.height)}}function Ta(t,e,n){const s=Qt(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-s.right:t.x+s.left}function Hg(t){return tn([],yn(t))}function Ij(t,e,n){return pi(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function Vg(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const Xy={beforeTitle:gn,title(t){if(t.length>0){const e=t[0],n=e.chart.data.labels,s=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex<s)return n[e.dataIndex]}return""},afterTitle:gn,beforeBody:gn,beforeLabel:gn,label(t){if(this&&this.options&&this.options.mode==="dataset")return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const n=t.formattedValue;return le(n)||(e+=n),e},labelColor(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:gn,afterBody:gn,beforeFooter:gn,footer:gn,afterFooter:gn};function st(t,e,n,s){const r=t[e].call(n,s);return typeof r>"u"?Xy[e].call(n,s):r}class Md extends Ss{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const n=this.chart,s=this.options.setContext(this.getContext()),r=s.enabled&&n.options.animation&&s.animations,i=new Ly(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=Ij(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:s}=n,r=st(s,"beforeTitle",this,e),i=st(s,"title",this,e),o=st(s,"afterTitle",this,e);let a=[];return a=tn(a,yn(r)),a=tn(a,yn(i)),a=tn(a,yn(o)),a}getBeforeBody(e,n){return Hg(st(n.callbacks,"beforeBody",this,e))}getBody(e,n){const{callbacks:s}=n,r=[];return re(e,i=>{const o={before:[],lines:[],after:[]},a=Vg(s,i);tn(o.before,yn(st(a,"beforeLabel",this,i))),tn(o.lines,st(a,"label",this,i)),tn(o.after,yn(st(a,"afterLabel",this,i))),r.push(o)}),r}getAfterBody(e,n){return Hg(st(n.callbacks,"afterBody",this,e))}getFooter(e,n){const{callbacks:s}=n,r=st(s,"beforeFooter",this,e),i=st(s,"footer",this,e),o=st(s,"afterFooter",this,e);let a=[];return a=tn(a,yn(r)),a=tn(a,yn(i)),a=tn(a,yn(o)),a}_createItems(e){const n=this._active,s=this.chart.data,r=[],i=[],o=[];let a=[],l,c;for(l=0,c=n.length;l<c;++l)a.push(Oj(this.chart,n[l]));return e.filter&&(a=a.filter((u,f,h)=>e.filter(u,f,h,s))),e.itemSort&&(a=a.sort((u,f)=>e.itemSort(u,f,s))),re(a,u=>{const f=Vg(e.callbacks,u);r.push(st(f,"labelColor",this,u)),i.push(st(f,"labelPointStyle",this,u)),o.push(st(f,"labelTextColor",this,u))}),this.labelColors=r,this.labelPointStyles=i,this.labelTextColors=o,this.dataPoints=a,a}update(e,n){const s=this.options.setContext(this.getContext()),r=this._active;let i,o=[];if(!r.length)this.opacity!==0&&(i={opacity:0});else{const a=Qi[s.position].call(this,r,this._eventPosition);o=this._createItems(s),this.title=this.getTitle(o,s),this.beforeBody=this.getBeforeBody(o,s),this.body=this.getBody(o,s),this.afterBody=this.getAfterBody(o,s),this.footer=this.getFooter(o,s);const l=this._size=Wg(this,s),c=Object.assign({},a,l),u=Ug(this.chart,s,c),f=$g(s,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,i={opacity:1,x:f.x,y:f.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,i&&this._resolveAnimations().update(this,i),e&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(e,n,s,r){const i=this.getCaretPosition(e,s,r);n.lineTo(i.x1,i.y1),n.lineTo(i.x2,i.y2),n.lineTo(i.x3,i.y3)}getCaretPosition(e,n,s){const{xAlign:r,yAlign:i}=this,{caretSize:o,cornerRadius:a}=s,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:f}=Fr(a),{x:h,y:p}=e,{width:y,height:m}=n;let b,x,g,v,S,_;return i==="center"?(S=p+m/2,r==="left"?(b=h,x=b-o,v=S+o,_=S-o):(b=h+y,x=b+o,v=S-o,_=S+o),g=b):(r==="left"?x=h+Math.max(l,u)+o:r==="right"?x=h+y-Math.max(c,f)-o:x=this.caretX,i==="top"?(v=p,S=v-o,b=x-o,g=x+o):(v=p+m,S=v+o,b=x+o,g=x-o),_=v),{x1:b,x2:x,x3:g,y1:v,y2:S,y3:_}}drawTitle(e,n,s){const r=this.title,i=r.length;let o,a,l;if(i){const c=Ir(s.rtl,this.x,this.width);for(e.x=Ta(this,s.titleAlign,s),n.textAlign=c.textAlign(s.titleAlign),n.textBaseline="middle",o=ct(s.titleFont),a=s.titleSpacing,n.fillStyle=s.titleColor,n.font=o.string,l=0;l<i;++l)n.fillText(r[l],c.x(e.x),e.y+o.lineHeight/2),e.y+=o.lineHeight+a,l+1===i&&(e.y+=s.titleMarginBottom-a)}}_drawColorBox(e,n,s,r,i){const o=this.labelColors[s],a=this.labelPointStyles[s],{boxHeight:l,boxWidth:c}=i,u=ct(i.bodyFont),f=Ta(this,"left",i),h=r.x(f),p=l<u.lineHeight?(u.lineHeight-l)/2:0,y=n.y+p;if(i.usePointStyle){const m={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},b=r.leftForLtr(h,c)+c/2,x=y+l/2;e.strokeStyle=i.multiKeyBackground,e.fillStyle=i.multiKeyBackground,og(e,m,b,x),e.strokeStyle=o.borderColor,e.fillStyle=o.backgroundColor,og(e,m,b,x)}else{e.lineWidth=ee(o.borderWidth)?Math.max(...Object.values(o.borderWidth)):o.borderWidth||1,e.strokeStyle=o.borderColor,e.setLineDash(o.borderDash||[]),e.lineDashOffset=o.borderDashOffset||0;const m=r.leftForLtr(h,c),b=r.leftForLtr(r.xPlus(h,1),c-2),x=Fr(o.borderRadius);Object.values(x).some(g=>g!==0)?(e.beginPath(),e.fillStyle=i.multiKeyBackground,Tl(e,{x:m,y,w:c,h:l,radius:x}),e.fill(),e.stroke(),e.fillStyle=o.backgroundColor,e.beginPath(),Tl(e,{x:b,y:y+1,w:c-2,h:l-2,radius:x}),e.fill()):(e.fillStyle=i.multiKeyBackground,e.fillRect(m,y,c,l),e.strokeRect(m,y,c,l),e.fillStyle=o.backgroundColor,e.fillRect(b,y+1,c-2,l-2))}e.fillStyle=this.labelTextColors[s]}drawBody(e,n,s){const{body:r}=this,{bodySpacing:i,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=s,f=ct(s.bodyFont);let h=f.lineHeight,p=0;const y=Ir(s.rtl,this.x,this.width),m=function(E){n.fillText(E,y.x(e.x+p),e.y+h/2),e.y+=h+i},b=y.textAlign(o);let x,g,v,S,_,k,j;for(n.textAlign=o,n.textBaseline="middle",n.font=f.string,e.x=Ta(this,b,s),n.fillStyle=s.bodyColor,re(this.beforeBody,m),p=a&&b!=="right"?o==="center"?c/2+u:c+2+u:0,S=0,k=r.length;S<k;++S){for(x=r[S],g=this.labelTextColors[S],n.fillStyle=g,re(x.before,m),v=x.lines,a&&v.length&&(this._drawColorBox(n,e,S,y,s),h=Math.max(f.lineHeight,l)),_=0,j=v.length;_<j;++_)m(v[_]),h=f.lineHeight;re(x.after,m)}p=0,h=f.lineHeight,re(this.afterBody,m),e.y-=i}drawFooter(e,n,s){const r=this.footer,i=r.length;let o,a;if(i){const l=Ir(s.rtl,this.x,this.width);for(e.x=Ta(this,s.footerAlign,s),e.y+=s.footerMarginTop,n.textAlign=l.textAlign(s.footerAlign),n.textBaseline="middle",o=ct(s.footerFont),n.fillStyle=s.footerColor,n.font=o.string,a=0;a<i;++a)n.fillText(r[a],l.x(e.x),e.y+o.lineHeight/2),e.y+=o.lineHeight+s.footerSpacing}}drawBackground(e,n,s,r){const{xAlign:i,yAlign:o}=this,{x:a,y:l}=e,{width:c,height:u}=s,{topLeft:f,topRight:h,bottomLeft:p,bottomRight:y}=Fr(r.cornerRadius);n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,n.lineWidth=r.borderWidth,n.beginPath(),n.moveTo(a+f,l),o==="top"&&this.drawCaret(e,n,s,r),n.lineTo(a+c-h,l),n.quadraticCurveTo(a+c,l,a+c,l+h),o==="center"&&i==="right"&&this.drawCaret(e,n,s,r),n.lineTo(a+c,l+u-y),n.quadraticCurveTo(a+c,l+u,a+c-y,l+u),o==="bottom"&&this.drawCaret(e,n,s,r),n.lineTo(a+p,l+u),n.quadraticCurveTo(a,l+u,a,l+u-p),o==="center"&&i==="left"&&this.drawCaret(e,n,s,r),n.lineTo(a,l+f),n.quadraticCurveTo(a,l,a+f,l),n.closePath(),n.fill(),r.borderWidth>0&&n.stroke()}_updateAnimationTarget(e){const n=this.chart,s=this.$animations,r=s&&s.x,i=s&&s.y;if(r||i){const o=Qi[e.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=Wg(this,e),l=Object.assign({},o,this._size),c=Ug(n,e,l),u=$g(e,l,c,n);(r._to!==u.x||i._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(e){const n=this.options.setContext(this.getContext());let s=this.opacity;if(!s)return;this._updateAnimationTarget(n);const r={width:this.width,height:this.height},i={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;const o=Qt(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(e.save(),e.globalAlpha=s,this.drawBackground(i,e,r,n),Ty(e,n.textDirection),i.y+=o.top,this.drawTitle(i,e,n),this.drawBody(i,e,n),this.drawFooter(i,e,n),Dy(e,n.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,n){const s=this._active,r=e.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),i=!El(s,r),o=this._positionChanged(r,n);(i||o)&&(this._active=r,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,n,s=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const r=this.options,i=this._active||[],o=this._getActiveElements(e,i,n,s),a=this._positionChanged(o,e),l=n||!El(o,i)||a;return l&&(this._active=o,(r.enabled||r.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,n))),l}_getActiveElements(e,n,s,r){const i=this.options;if(e.type==="mouseout")return[];if(!r)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const o=this.chart.getElementsAtEventForMode(e,i.mode,i,s);return i.reverse&&o.reverse(),o}_positionChanged(e,n){const{caretX:s,caretY:r,options:i}=this,o=Qi[i.position].call(this,e,n);return o!==!1&&(s!==o.x||r!==o.y)}}B(Md,"positioners",Qi);var zj={id:"tooltip",_element:Md,positioners:Qi,afterInit(t,e,n){n&&(t.tooltip=new Md({chart:t,options:n}))},beforeUpdate(t,e,n){t.tooltip&&t.tooltip.initialize(n)},reset(t,e,n){t.tooltip&&t.tooltip.initialize(n)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const n={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",n)}},afterEvent(t,e){if(t.tooltip){const n=e.replay;t.tooltip.handleEvent(e.event,n,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Xy},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Bj=(t,e,n,s)=>(typeof e=="string"?(n=t.push(e)-1,s.unshift({index:n,label:e})):isNaN(e)&&(n=null),n);function Wj(t,e,n,s){const r=t.indexOf(e);if(r===-1)return Bj(t,e,n,s);const i=t.lastIndexOf(e);return r!==i?n:r}const Uj=(t,e)=>t===null?null:lt(Math.round(t),0,e);function Qg(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}class Pd extends gi{constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const n=this._addedLabels;if(n.length){const s=this.getLabels();for(const{index:r,label:i}of n)s[r]===i&&s.splice(r,1);this._addedLabels=[]}super.init(e)}parse(e,n){if(le(e))return null;const s=this.getLabels();return n=isFinite(n)&&s[n]===e?n:Wj(s,e,J(n,e),this._addedLabels),Uj(n,s.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:n}=this.getUserBounds();let{min:s,max:r}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(s=0),n||(r=this.getLabels().length-1)),this.min=s,this.max=r}buildTicks(){const e=this.min,n=this.max,s=this.options.offset,r=[];let i=this.getLabels();i=e===0&&n===i.length-1?i:i.slice(e,n+1),this._valueRange=Math.max(i.length-(s?0:1),1),this._startValue=this.min-(s?.5:0);for(let o=e;o<=n;o++)r.push({value:o});return r}getLabelForValue(e){return Qg.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!="number"&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}B(Pd,"id","category"),B(Pd,"defaults",{ticks:{callback:Qg}});function $j(t,e){const n=[],{bounds:r,step:i,min:o,max:a,precision:l,count:c,maxTicks:u,maxDigits:f,includeBounds:h}=t,p=i||1,y=u-1,{min:m,max:b}=e,x=!le(o),g=!le(a),v=!le(c),S=(b-m)/(f+1);let _=Gp((b-m)/y/p)*p,k,j,E,P;if(_<1e-14&&!x&&!g)return[{value:m},{value:b}];P=Math.ceil(b/_)-Math.floor(m/_),P>y&&(_=Gp(P*_/y/p)*p),le(l)||(k=Math.pow(10,l),_=Math.ceil(_*k)/k),r==="ticks"?(j=Math.floor(m/_)*_,E=Math.ceil(b/_)*_):(j=m,E=b),x&&g&&i&&B_((a-o)/i,_/1e3)?(P=Math.round(Math.min((a-o)/_,u)),_=(a-o)/P,j=o,E=a):v?(j=x?o:j,E=g?a:E,P=c-1,_=(E-j)/P):(P=(E-j)/_,Ya(P,Math.round(P),_/1e3)?P=Math.round(P):P=Math.ceil(P));const M=Math.max(Jp(_),Jp(j));k=Math.pow(10,le(l)?M:l),j=Math.round(j*k)/k,E=Math.round(E*k)/k;let O=0;for(x&&(h&&j!==o?(n.push({value:o}),j<o&&O++,Ya(Math.round((j+O*_)*k)/k,o,Kg(o,S,t))&&O++):j<o&&O++);O<P;++O){const N=Math.round((j+O*_)*k)/k;if(g&&N>a)break;n.push({value:N})}return g&&h&&E!==a?n.length&&Ya(n[n.length-1].value,a,Kg(a,S,t))?n[n.length-1].value=a:n.push({value:a}):(!g||E===a)&&n.push({value:E}),n}function Kg(t,e,{horizontal:n,minRotation:s}){const r=Cn(s),i=(n?Math.sin(r):Math.cos(r))||.001,o=.75*e*(""+t).length;return Math.min(e/i,o)}class Hj extends gi{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,n){return le(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:n,maxDefined:s}=this.getUserBounds();let{min:r,max:i}=this;const o=l=>r=n?r:l,a=l=>i=s?i:l;if(e){const l=xs(r),c=xs(i);l<0&&c<0?a(0):l>0&&c>0&&o(0)}if(r===i){let l=i===0?1:Math.abs(i*.05);a(i+l),e||o(r-l)}this.min=r,this.max=i}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:n,stepSize:s}=e,r;return s?(r=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,r>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${r} ticks. Limiting to 1000.`),r=1e3)):(r=this.computeTickLimit(),n=n||11),n&&(r=Math.min(n,r)),r}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,n=e.ticks;let s=this.getTickLimit();s=Math.max(2,s);const r={maxTicks:s,bounds:e.bounds,min:e.min,max:e.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},i=this._range||this,o=$j(r,i);return e.bounds==="ticks"&&W_(o,this,"value"),e.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const e=this.ticks;let n=this.min,s=this.max;if(super.configure(),this.options.offset&&e.length){const r=(s-n)/Math.max(e.length-1,1)/2;n-=r,s+=r}this._startValue=n,this._endValue=s,this._valueRange=s-n}getLabelForValue(e){return Uf(e,this.chart.options.locale,this.options.ticks.format)}}class Rd extends Hj{determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=Dt(e)?e:0,this.max=Dt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),n=e?this.width:this.height,s=Cn(this.options.ticks.minRotation),r=(e?Math.sin(s):Math.cos(s))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,i.lineHeight/r))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}B(Rd,"id","linear"),B(Rd,"defaults",{ticks:{callback:Cy.formatters.numeric}});const fc={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},ot=Object.keys(fc);function Yg(t,e){return t-e}function Xg(t,e){if(le(e))return null;const n=t._adapter,{parser:s,round:r,isoWeekday:i}=t._parseOpts;let o=e;return typeof s=="function"&&(o=s(o)),Dt(o)||(o=typeof s=="string"?n.parse(o,s):n.parse(o)),o===null?null:(r&&(o=r==="week"&&(Pl(i)||i===!0)?n.startOf(o,"isoWeek",i):n.startOf(o,r)),+o)}function qg(t,e,n,s){const r=ot.length;for(let i=ot.indexOf(t);i<r-1;++i){const o=fc[ot[i]],a=o.steps?o.steps:Number.MAX_SAFE_INTEGER;if(o.common&&Math.ceil((n-e)/(a*o.size))<=s)return ot[i]}return ot[r-1]}function Vj(t,e,n,s,r){for(let i=ot.length-1;i>=ot.indexOf(n);i--){const o=ot[i];if(fc[o].common&&t._adapter.diff(r,s,o)>=e-1)return o}return ot[n?ot.indexOf(n):0]}function Qj(t){for(let e=ot.indexOf(t)+1,n=ot.length;e<n;++e)if(fc[ot[e]].common)return ot[e]}function Gg(t,e,n){if(!n)t[e]=!0;else if(n.length){const{lo:s,hi:r}=Wf(n,e),i=n[s]>=e?n[s]:n[r];t[i]=!0}}function Kj(t,e,n,s){const r=t._adapter,i=+r.startOf(e[0].value,s),o=e[e.length-1].value;let a,l;for(a=i;a<=o;a=+r.add(a,1,s))l=n[a],l>=0&&(e[l].major=!0);return e}function Jg(t,e,n){const s=[],r={},i=e.length;let o,a;for(o=0;o<i;++o)a=e[o],r[a]=o,s.push({value:a,major:!1});return i===0||!n?s:Kj(t,s,r,n)}class Fl extends gi{constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,n={}){const s=e.time||(e.time={}),r=this._adapter=new iC._date(e.adapters.date);r.init(n),no(s.displayFormats,r.formats()),this._parseOpts={parser:s.parser,round:s.round,isoWeekday:s.isoWeekday},super.init(e),this._normalized=n.normalized}parse(e,n){return e===void 0?null:Xg(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const e=this.options,n=this._adapter,s=e.time.unit||"day";let{min:r,max:i,minDefined:o,maxDefined:a}=this.getUserBounds();function l(c){!o&&!isNaN(c.min)&&(r=Math.min(r,c.min)),!a&&!isNaN(c.max)&&(i=Math.max(i,c.max))}(!o||!a)&&(l(this._getLabelBounds()),(e.bounds!=="ticks"||e.ticks.source!=="labels")&&l(this.getMinMax(!1))),r=Dt(r)&&!isNaN(r)?r:+n.startOf(Date.now(),s),i=Dt(i)&&!isNaN(i)?i:+n.endOf(Date.now(),s)+1,this.min=Math.min(r,i-1),this.max=Math.max(r+1,i)}_getLabelBounds(){const e=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;return e.length&&(n=e[0],s=e[e.length-1]),{min:n,max:s}}buildTicks(){const e=this.options,n=e.time,s=e.ticks,r=s.source==="labels"?this.getLabelTimestamps():this._generate();e.bounds==="ticks"&&r.length&&(this.min=this._userMin||r[0],this.max=this._userMax||r[r.length-1]);const i=this.min,o=this.max,a=Q_(r,i,o);return this._unit=n.unit||(s.autoSkip?qg(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):Vj(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!s.major.enabled||this._unit==="year"?void 0:Qj(this._unit),this.initOffsets(r),e.reverse&&a.reverse(),Jg(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let n=0,s=0,r,i;this.options.offset&&e.length&&(r=this.getDecimalForValue(e[0]),e.length===1?n=1-r:n=(this.getDecimalForValue(e[1])-r)/2,i=this.getDecimalForValue(e[e.length-1]),e.length===1?s=i:s=(i-this.getDecimalForValue(e[e.length-2]))/2);const o=e.length<3?.5:.25;n=lt(n,0,o),s=lt(s,0,o),this._offsets={start:n,end:s,factor:1/(n+1+s)}}_generate(){const e=this._adapter,n=this.min,s=this.max,r=this.options,i=r.time,o=i.unit||qg(i.minUnit,n,s,this._getLabelCapacity(n)),a=J(r.ticks.stepSize,1),l=o==="week"?i.isoWeekday:!1,c=Pl(l)||l===!0,u={};let f=n,h,p;if(c&&(f=+e.startOf(f,"isoWeek",l)),f=+e.startOf(f,c?"day":o),e.diff(s,n,o)>1e5*a)throw new Error(n+" and "+s+" are too far apart with stepSize of "+a+" "+o);const y=r.ticks.source==="data"&&this.getDataTimestamps();for(h=f,p=0;h<s;h=+e.add(h,a,o),p++)Gg(u,h,y);return(h===s||r.bounds==="ticks"||p===1)&&Gg(u,h,y),Object.keys(u).sort(Yg).map(m=>+m)}getLabelForValue(e){const n=this._adapter,s=this.options.time;return s.tooltipFormat?n.format(e,s.tooltipFormat):n.format(e,s.displayFormats.datetime)}format(e,n){const r=this.options.time.displayFormats,i=this._unit,o=n||r[i];return this._adapter.format(e,o)}_tickFormatFunction(e,n,s,r){const i=this.options,o=i.ticks.callback;if(o)return fe(o,[e,n,s],this);const a=i.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],f=c&&a[c],h=s[n],p=c&&f&&h&&h.major;return this._adapter.format(e,r||(p?f:u))}generateTickLabels(e){let n,s,r;for(n=0,s=e.length;n<s;++n)r=e[n],r.label=this._tickFormatFunction(r.value,n,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){const n=this._offsets,s=this.getDecimalForValue(e);return this.getPixelForDecimal((n.start+s)*n.factor)}getValueForPixel(e){const n=this._offsets,s=this.getDecimalForPixel(e)/n.factor-n.end;return this.min+s*(this.max-this.min)}_getLabelSize(e){const n=this.options.ticks,s=this.ctx.measureText(e).width,r=Cn(this.isHorizontal()?n.maxRotation:n.minRotation),i=Math.cos(r),o=Math.sin(r),a=this._resolveTickFontOptions(0).size;return{w:s*i+a*o,h:s*o+a*i}}_getLabelCapacity(e){const n=this.options.time,s=n.displayFormats,r=s[n.unit]||s.millisecond,i=this._tickFormatFunction(e,0,Jg(this,[e],this._majorUnit),r),o=this._getLabelSize(i),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let e=this._cache.data||[],n,s;if(e.length)return e;const r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(n=0,s=r.length;n<s;++n)e=e.concat(r[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){const e=this._cache.labels||[];let n,s;if(e.length)return e;const r=this.getLabels();for(n=0,s=r.length;n<s;++n)e.push(Xg(this,r[n]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return by(e.sort(Yg))}}B(Fl,"id","time"),B(Fl,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Da(t,e,n){let s=0,r=t.length-1,i,o,a,l;n?(e>=t[s].pos&&e<=t[r].pos&&({lo:s,hi:r}=Cd(t,"pos",e)),{pos:i,time:a}=t[s],{pos:o,time:l}=t[r]):(e>=t[s].time&&e<=t[r].time&&({lo:s,hi:r}=Cd(t,"time",e)),{time:i,pos:a}=t[s],{time:o,pos:l}=t[r]);const c=o-i;return c?a+(l-a)*(e-i)/c:a}class Zg extends Fl{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(e);this._minPos=Da(n,this.min),this._tableRange=Da(n,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:n,max:s}=this,r=[],i=[];let o,a,l,c,u;for(o=0,a=e.length;o<a;++o)c=e[o],c>=n&&c<=s&&r.push(c);if(r.length<2)return[{time:n,pos:0},{time:s,pos:1}];for(o=0,a=r.length;o<a;++o)u=r[o+1],l=r[o-1],c=r[o],Math.round((u+l)/2)!==c&&i.push({time:c,pos:o/(a-1)});return i}_generate(){const e=this.min,n=this.max;let s=super.getDataTimestamps();return(!s.includes(e)||!s.length)&&s.splice(0,0,e),(!s.includes(n)||s.length===1)&&s.push(n),s.sort((r,i)=>r-i)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const n=this.getDataTimestamps(),s=this.getLabelTimestamps();return n.length&&s.length?e=this.normalize(n.concat(s)):e=n.length?n:s,e=this._cache.all=e,e}getDecimalForValue(e){return(Da(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const n=this._offsets,s=this.getDecimalForPixel(e)/n.factor-n.end;return Da(this._table,s*this._tableRange+this._minPos,!0)}}B(Zg,"id","timeseries"),B(Zg,"defaults",Fl.defaults);const qy="label";function em(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function Yj(t,e){const n=t.options;n&&e&&Object.assign(n,e)}function Gy(t,e){t.labels=e}function Jy(t,e,n=qy){const s=[];t.datasets=e.map(r=>{const i=t.datasets.find(o=>o[n]===r[n]);return!i||!r.data||s.includes(i)?{...r}:(s.push(i),Object.assign(i,r),i)})}function Xj(t,e=qy){const n={labels:[],datasets:[]};return Gy(n,t.labels),Jy(n,t.datasets,e),n}function qj(t,e){const{height:n=150,width:s=300,redraw:r=!1,datasetIdKey:i,type:o,data:a,options:l,plugins:c=[],fallbackContent:u,updateMode:f,...h}=t,p=w.useRef(null),y=w.useRef(null),m=()=>{p.current&&(y.current=new dc(p.current,{type:o,data:Xj(a,i),options:l&&{...l},plugins:c}),em(e,y.current))},b=()=>{em(e,null),y.current&&(y.current.destroy(),y.current=null)};return w.useEffect(()=>{!r&&y.current&&l&&Yj(y.current,l)},[r,l]),w.useEffect(()=>{!r&&y.current&&Gy(y.current.config.data,a.labels)},[r,a.labels]),w.useEffect(()=>{!r&&y.current&&a.datasets&&Jy(y.current.config.data,a.datasets,i)},[r,a.datasets]),w.useEffect(()=>{y.current&&(r?(b(),setTimeout(m)):y.current.update(f))},[r,l,a.labels,a.datasets,f]),w.useEffect(()=>{y.current&&(b(),setTimeout(m))},[o]),w.useEffect(()=>(m(),()=>b()),[]),d.jsx("canvas",{ref:p,role:"img",height:n,width:s,...h,children:u})}const Gj=w.forwardRef(qj);function Zy(t,e){return dc.register(e),w.forwardRef((n,s)=>d.jsx(Gj,{...n,ref:s,type:t}))}const Jj=Zy("bar",Xa),Zj=Zy("doughnut",$i),_s=["leads","em_contato","proposta","fechado"],ys={leads:"Leads",em_contato:"Em contato",proposta:"Proposta",fechado:"Fechado"};dc.register(Vi,Ja,Pd,Rd,Rj,zj);function eE({porEtapa:t}){const e=_s.map(s=>t[s]??0),n=Math.max(20,Math.ceil((Math.max(...e)+1)/20)*20);return d.jsx("div",{className:"mt-4 h-64",children:d.jsx(Jj,{data:{labels:_s.map(s=>ys[s]),datasets:[{label:"Quantidade",data:e,backgroundColor:["rgba(59, 130, 246, 0.8)","rgba(59, 130, 246, 0.6)","rgba(59, 130, 246, 0.4)","rgba(59, 130, 246, 0.3)"],borderRadius:4,barThickness:24}]},options:{indexAxis:"y",responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1}},scales:{x:{beginAtZero:!0,max:n,grid:{color:"#f3f4f6"},ticks:{stepSize:20}},y:{grid:{display:!1}}}}})})}function tE({enviadas:t,erros:e}){return d.jsx("div",{className:"mt-4 h-64 flex items-center justify-center",children:d.jsx(Zj,{data:{labels:["Enviadas","Erros"],datasets:[{data:[t,e],backgroundColor:["#3b82f6","#ef4444"],borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:"70%",plugins:{legend:{display:!1},tooltip:{callbacks:{label:n=>`${n.label}: ${n.parsed}`}}}}})})}const nE=1e4;function sE({nomeUsuario:t}){const{data:e,isPending:n,isError:s,error:r,refetch:i}=K0({queryKey:["metrics"],queryFn:()=>U.metricas(),refetchInterval:nE,refetchIntervalInBackground:!1}),o=n,a=s?r instanceof Error?r.message:"Falha ao carregar métricas.":"",l=e==null?void 0:e.perfil,c=l==null?void 0:l.licenca.restam_dias;return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{children:[d.jsxs("h1",{className:"text-2xl font-bold text-gray-800",children:["Olá, ",t," 👋 bem-vindo ao seu painel"]}),d.jsxs("div",{className:"mt-2 flex items-center justify-between text-sm text-gray-500",children:[d.jsxs("span",{children:[l!=null&&l.licenca.ativa?"Licença ativa":"Sem licença"," •"," ",l!=null&&l.licenca.expira_em?`expira em ${l.licenca.expira_em}`:"—"," • dados 100% locais"]}),c!=null&&d.jsxs("span",{children:["Restam ",d.jsx("strong",{className:"text-gray-700",children:c===null?"∞":`${c} dias`})]})]})]}),a&&d.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 rounded-xl px-4 py-3 text-sm",children:[d.jsx("i",{className:"fas fa-exclamation-triangle mr-2"}),a]}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[d.jsxs(Sa,{rotulo:"Status da Conexão",icone:"fas fa-plug",children:[d.jsx("div",{className:"mt-2 flex items-center",children:d.jsxs("span",{className:H("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",e!=null&&e.conexao.geral?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:[d.jsx("span",{className:H("w-2 h-2 mr-1.5 rounded-full",e!=null&&e.conexao.geral?"bg-green-500":"bg-red-500")}),e!=null&&e.conexao.geral?"Conectado":"Desconectado"]})}),d.jsxs("p",{className:"text-[11px] text-gray-400 mt-2",children:[d.jsx("i",{className:"fas fa-brain mr-1"}),e!=null&&e.conexao.llm?"LLM ✓":"LLM não configurado"," ·"," ",d.jsx("i",{className:"fas fa-paper-plane mr-1"}),e!=null&&e.conexao.openoutreach?"OpenOutreach ✓":"OpenOutreach não configurado"]})]}),d.jsx(Sa,{rotulo:"Taxa de entrega",valor:o?"—":`${(e==null?void 0:e.taxa_entrega)??0}%`,subtitulo:`${(e==null?void 0:e.total_enviadas)??0} enviadas • total`,icone:"fas fa-paper-plane"}),d.jsx(Sa,{rotulo:"Taxa de erro",valor:o?"—":`${(e==null?void 0:e.taxa_erro)??0}%`,subtitulo:`${(e==null?void 0:e.total_erros)??0} erros • total`,icone:"fas fa-triangle-exclamation"}),d.jsx(Sa,{rotulo:"Leads cadastrados",valor:o?"—":(e==null?void 0:e.leads_total)??0,subtitulo:"Total na base",icone:"fas fa-users"})]}),d.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[d.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6 border border-gray-100",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("h3",{className:"text-base font-semibold text-gray-800",children:"Leads por etapa (CRM)"}),d.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Quantidade de leads em cada coluna do Kanban"})]}),d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("span",{className:"text-[11px] text-gray-300 hidden sm:inline",title:"O painel atualiza sozinho",children:[d.jsx("i",{className:"fas fa-rotate mr-1"}),"a cada 10s"]}),d.jsx("button",{onClick:()=>i(),className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:"Atualizar"})]})]}),e?d.jsx(eE,{porEtapa:e.leads_por_etapa}):d.jsx(rE,{})]}),d.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6 border border-gray-100",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("h3",{className:"text-base font-semibold text-gray-800",children:"Desempenho das campanhas"}),d.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Agregação de todas as campanhas (Enviadas × Erros)"})]}),d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("span",{className:"text-[11px] text-gray-300 hidden sm:inline",title:"O painel atualiza sozinho",children:[d.jsx("i",{className:"fas fa-rotate mr-1"}),"a cada 10s"]}),d.jsx("button",{onClick:()=>i(),className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:"Atualizar"})]})]}),d.jsx(tE,{enviadas:(e==null?void 0:e.campanhas.enviadas)??0,erros:(e==null?void 0:e.campanhas.erros)??0}),d.jsxs("div",{className:"mt-4 flex items-center justify-center space-x-6 text-xs",children:[d.jsxs("span",{className:"flex items-center",children:[d.jsx("span",{className:"w-3 h-3 bg-blue-500 rounded-full mr-1.5"})," Enviadas (",(e==null?void 0:e.campanhas.enviadas)??0,")"]}),d.jsxs("span",{className:"flex items-center",children:[d.jsx("span",{className:"w-3 h-3 bg-red-500 rounded-full mr-1.5"})," Erros (",(e==null?void 0:e.campanhas.erros)??0,")"]})]})]})]})]})}function rE(){return d.jsx("div",{className:"mt-4 h-64 flex items-center justify-center text-gray-300",children:d.jsx("i",{className:"fas fa-spinner fa-spin text-2xl"})})}function Ut({titulo:t,icone:e="fas fa-sliders",children:n,abertoInicial:s=!1}){const[r,i]=w.useState(s);return d.jsxs("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:[d.jsxs("button",{type:"button",onClick:()=>i(o=>!o),className:"w-full flex items-center justify-between px-4 py-3 text-sm font-medium text-gray-600 bg-gray-50 hover:bg-gray-100 transition",children:[d.jsxs("span",{className:"flex items-center gap-2",children:[d.jsx("i",{className:H(e,"text-gray-400")})," ",t]}),d.jsx("i",{className:H("fas fa-chevron-down text-xs text-gray-400 transition-transform",r&&"rotate-180")})]}),r&&d.jsx("div",{className:"px-4 py-4 bg-white space-y-3",children:n})]})}function ev({valor:t,altura:e="md",mostrarLabel:n=!1,className:s}){const r=Math.max(0,Math.min(100,Math.round(t))),i={sm:"h-1.5",md:"h-2.5"};return d.jsxs("div",{className:H("w-full",s),children:[n&&d.jsxs("div",{className:"flex justify-between text-xs text-gray-500 mb-1",children:[d.jsx("span",{children:"Progresso"}),d.jsxs("span",{className:"font-semibold text-gray-700",children:[r,"%"]})]}),d.jsx("div",{className:H("w-full bg-gray-200 rounded-full overflow-hidden",i[e]),children:d.jsx("div",{className:H("h-full rounded-full bg-gradient-to-r from-indigo-500 to-purple-500 transition-all duration-500"),style:{width:`${r}%`}})})]})}const iE={leads:"bg-blue-100 text-blue-800",em_contato:"bg-amber-100 text-amber-800",proposta:"bg-violet-100 text-violet-800",fechado:"bg-green-100 text-green-800",rascunho:"bg-gray-100 text-gray-600",em_andamento:"bg-blue-100 text-blue-800",pausado:"bg-amber-100 text-amber-800",pausada:"bg-amber-100 text-amber-800",concluido:"bg-green-100 text-green-800",cancelado:"bg-gray-100 text-gray-600",erro:"bg-red-100 text-red-800",concluida:"bg-green-100 text-green-800",pendente:"bg-gray-100 text-gray-600",pulada:"bg-gray-100 text-gray-500",enviada:"bg-green-100 text-green-800",ativo:"bg-green-100 text-green-800",inativo:"bg-gray-100 text-gray-600"},oE={leads:"Leads",em_contato:"Em contato",proposta:"Proposta",fechado:"Fechado",rascunho:"Rascunho",em_andamento:"Em andamento",pausado:"Pausado",pausada:"Pausada",concluido:"Concluído",concluida:"Concluída",cancelado:"Cancelado",erro:"Erro",pendente:"Pendente",pulada:"Pulada",enviada:"Enviada",ativo:"Ativo",inativo:"Inativo",texto:"Texto",audio:"Áudio"};function fn({status:t,rotulo:e,className:n}){const s=iE[t]||"bg-gray-100 text-gray-600";return d.jsx("span",{className:H("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium whitespace-nowrap",s,n),children:e||oE[t]||t})}const aE={nome:"",telefone:"",email:"",fonte:"Manual",etapa:"leads"};function lE(){const{toast:t}=Yt(),[e,n]=w.useState([]),[s,r]=w.useState(""),[i,o]=w.useState("todas"),[a,l]=w.useState(!1),[c,u]=w.useState(null),[f,h]=w.useState(null),[p,y]=w.useState(null),m=w.useCallback(async()=>{n(await U.leads.listar())},[]);w.useEffect(()=>{m().catch(k=>t("erro",k.message))},[m,t]);const b=w.useMemo(()=>{const k=s.trim().toLowerCase();return e.filter(j=>{const E=!k||j.nome.toLowerCase().includes(k)||j.telefone.includes(k)||j.email.toLowerCase().includes(k),P=i==="todas"||j.etapa===i;return E&&P})},[e,s,i]),x=()=>{u({...aE}),l(!0)},g=k=>{u({...k}),l(!0)},v=async()=>{var k;if(!((k=c==null?void 0:c.nome)!=null&&k.trim())){t("erro","O nome do lead é obrigatório.");return}try{if(c.id){const{id:j,criado_em:E,atualizado_em:P,...M}=c;await U.leads.atualizar(j,M),t("sucesso","Lead atualizado.")}else await U.leads.criar(c),t("sucesso","Lead criado com sucesso.");l(!1),u(null),await m()}catch(j){t("erro",j instanceof Error?j.message:"Falha ao salvar lead.")}},S=async()=>{if(f)try{await U.leads.remover(f.id),t("sucesso",`Lead "${f.nome}" removido.`),h(null),await m()}catch(k){t("erro",k instanceof Error?k.message:"Falha ao remover.")}},_=async k=>{y(k.id);try{(await U.leads.enriquecer(k.id)).notas.forEach(E=>t("info",E)),t("sucesso","Lead enriquecido."),await m()}catch(j){t("erro",j instanceof Error?j.message:"Falha ao enriquecer.")}finally{y(null)}};return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[d.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-[280px]",children:[d.jsxs("div",{className:"relative flex-1 max-w-md",children:[d.jsx("i",{className:"fas fa-search absolute left-3 top-2.5 text-gray-400 text-sm"}),d.jsx("input",{value:s,onChange:k=>r(k.target.value),placeholder:"Buscar por nome, telefone ou e-mail...",className:"w-full pl-9 pr-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 focus:border-indigo-400 outline-none"})]}),d.jsxs("select",{value:i,onChange:k=>o(k.target.value),className:"text-sm border border-gray-200 rounded-lg px-3 py-2 bg-white focus:ring-2 focus:ring-indigo-400 outline-none",children:[d.jsx("option",{value:"todas",children:"Todas as etapas"}),_s.map(k=>d.jsx("option",{value:k,children:ys[k]},k))]})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs("button",{onClick:()=>Z1(e,"leadmaster-leads.json"),className:"px-4 py-2.5 text-sm font-medium text-gray-600 bg-white border border-gray-200 rounded-lg hover:bg-gray-50 transition",children:[d.jsx("i",{className:"fas fa-download mr-2"})," Exportar"]}),d.jsxs("button",{onClick:x,className:"px-6 py-2.5 text-sm font-medium text-white bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg hover:opacity-90 transition shadow-sm",children:[d.jsx("i",{className:"fas fa-plus mr-2"})," Novo Lead"]})]})]}),d.jsx("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden",children:d.jsx("div",{className:"overflow-x-auto",children:d.jsxs("table",{className:"w-full text-sm",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"text-left text-xs text-gray-500 uppercase border-b border-gray-100 bg-gray-50/50",children:[d.jsx("th",{className:"px-5 py-3 font-semibold",children:"Lead"}),d.jsx("th",{className:"px-5 py-3 font-semibold",children:"Contato"}),d.jsx("th",{className:"px-5 py-3 font-semibold",children:"Etapa"}),d.jsx("th",{className:"px-5 py-3 font-semibold",children:"Completude"}),d.jsx("th",{className:"px-5 py-3 font-semibold",children:"Atualizado"}),d.jsx("th",{className:"px-5 py-3 font-semibold text-right",children:"Ações"})]})}),d.jsxs("tbody",{children:[b.map(k=>{const j=q1(k),E=G1(k);return d.jsxs("tr",{className:"border-b border-gray-50 hover:bg-indigo-50/40 transition",children:[d.jsxs("td",{className:"px-5 py-3",children:[d.jsx("p",{className:"font-medium text-gray-800",children:k.nome}),d.jsxs("p",{className:"text-xs text-gray-400",children:[k.fonte,k.empresa?` · ${k.empresa}`:""]})]}),d.jsxs("td",{className:"px-5 py-3 text-gray-600",children:[d.jsx("p",{children:k.telefone||"—"}),d.jsx("p",{className:"text-xs text-gray-400",children:k.email||"sem e-mail"})]}),d.jsx("td",{className:"px-5 py-3",children:d.jsx(fn,{status:k.etapa})}),d.jsxs("td",{className:"px-5 py-3 w-52",children:[d.jsx(ev,{valor:j,altura:"sm"}),d.jsx("p",{className:"text-[11px] text-gray-400 mt-1",children:J1(j,E)})]}),d.jsx("td",{className:"px-5 py-3 text-xs text-gray-400",children:_d(k.atualizado_em)}),d.jsxs("td",{className:"px-5 py-3 text-right whitespace-nowrap",children:[d.jsx("button",{onClick:()=>_(k),disabled:p===k.id,title:" Enriquecer com IA / BrasilAPI",className:"text-gray-400 hover:text-indigo-600 px-1.5 disabled:opacity-40",children:d.jsx("i",{className:H("fas fa-wand-magic-sparkles",p===k.id&&"fa-spin")})}),d.jsx("button",{onClick:()=>g(k),title:"Editar",className:"text-gray-400 hover:text-indigo-600 px-1.5",children:d.jsx("i",{className:"fas fa-pen"})}),d.jsx("button",{onClick:()=>h(k),title:"Excluir",className:"text-gray-400 hover:text-red-600 px-1.5",children:d.jsx("i",{className:"fas fa-trash"})})]})]},k.id)}),b.length===0&&d.jsx("tr",{children:d.jsxs("td",{colSpan:6,className:"px-5 py-16 text-center text-gray-400",children:[d.jsx("i",{className:"fas fa-users text-3xl text-gray-200 block mb-3"}),"Nenhum lead encontrado. Crie um novo ou importe pelos Extratores."]})})]})]})})}),d.jsx(hn,{aberto:a,onFechar:()=>l(!1),titulo:c!=null&&c.id?"Editar lead":"Novo lead",icone:"fas fa-user-plus",children:c&&d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[d.jsx(Ds,{rotulo:"Nome *",valor:c.nome||"",onChange:k=>u({...c,nome:k})}),d.jsx(Ds,{rotulo:"Telefone",valor:c.telefone||"",onChange:k=>u({...c,telefone:k}),placeholder:"(11) 99999-9999"}),d.jsx(Ds,{rotulo:"E-mail",tipo:"email",valor:c.email||"",onChange:k=>u({...c,email:k}),placeholder:"contato@empresa.com.br"}),d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Etapa"}),d.jsx("select",{value:c.etapa||"leads",onChange:k=>u({...c,etapa:k.target.value}),className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none",children:_s.map(k=>d.jsx("option",{value:k,children:ys[k]},k))})]})]}),d.jsxs(Ut,{titulo:"Campos avançados",icone:"fas fa-sliders",children:[d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[d.jsx(Ds,{rotulo:"Empresa",valor:c.empresa||"",onChange:k=>u({...c,empresa:k})}),d.jsx(Ds,{rotulo:"CNPJ",valor:c.cnpj||"",onChange:k=>u({...c,cnpj:k}),placeholder:"00.000.000/0000-00"}),d.jsx(Ds,{rotulo:"Cidade",valor:c.cidade||"",onChange:k=>u({...c,cidade:k}),placeholder:"São Paulo/SP"}),d.jsx(Ds,{rotulo:"Fonte",valor:c.fonte||"",onChange:k=>u({...c,fonte:k}),placeholder:"Google Maps, Instagram, CNPJ..."})]}),d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Observações"}),d.jsx("textarea",{value:c.observacoes||"",onChange:k=>u({...c,observacoes:k.target.value}),rows:3,className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none",placeholder:"Histórico de conversas, próximos passos..."})]})]}),d.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[d.jsx("button",{onClick:()=>l(!1),className:"px-4 py-2.5 text-sm font-medium text-gray-600 bg-white border border-gray-200 rounded-lg hover:bg-gray-50",children:"Cancelar"}),d.jsxs("button",{onClick:v,className:"px-6 py-2.5 text-sm font-medium text-white bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg hover:opacity-90 transition",children:[d.jsx("i",{className:"fas fa-save mr-2"})," Salvar"]})]})]})}),d.jsxs(hn,{aberto:!!f,onFechar:()=>h(null),titulo:"Excluir lead",icone:"fas fa-trash",children:[d.jsxs("p",{className:"text-sm text-gray-600",children:["Tem certeza que deseja excluir ",d.jsx("strong",{children:f==null?void 0:f.nome}),"? Essa ação não pode ser desfeita."]}),d.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[d.jsx("button",{onClick:()=>h(null),className:"px-4 py-2.5 text-sm font-medium text-gray-600 bg-white border border-gray-200 rounded-lg hover:bg-gray-50",children:"Cancelar"}),d.jsx("button",{onClick:S,className:"px-6 py-2.5 text-sm font-medium text-white bg-red-600 rounded-lg hover:bg-red-700",children:"Excluir"})]})]})]})}function Ds({rotulo:t,valor:e,onChange:n,tipo:s="text",placeholder:r}){return d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:t}),d.jsx("input",{type:s,value:e,onChange:i=>n(i.target.value),placeholder:r,className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"})]})}const hc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function mi(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function Jf(t){return"nodeType"in t}function nt(t){var e,n;return t?mi(t)?t:Jf(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function Zf(t){const{Document:e}=nt(t);return t instanceof e}function Xo(t){return mi(t)?!1:t instanceof nt(t).HTMLElement}function tv(t){return t instanceof nt(t).SVGElement}function xi(t){return t?mi(t)?t.document:Jf(t)?Zf(t)?t:Xo(t)||tv(t)?t.ownerDocument:document:document:document}const Rn=hc?w.useLayoutEffect:w.useEffect;function pc(t){const e=w.useRef(t);return Rn(()=>{e.current=t}),w.useCallback(function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];return e.current==null?void 0:e.current(...s)},[])}function cE(){const t=w.useRef(null),e=w.useCallback((s,r)=>{t.current=setInterval(s,r)},[]),n=w.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function To(t,e){e===void 0&&(e=[t]);const n=w.useRef(t);return Rn(()=>{n.current!==t&&(n.current=t)},e),n}function qo(t,e){const n=w.useRef();return w.useMemo(()=>{const s=t(n.current);return n.current=s,s},[...e])}function Il(t){const e=pc(t),n=w.useRef(null),s=w.useCallback(r=>{r!==n.current&&(e==null||e(r,n.current)),n.current=r},[]);return[n,s]}function zl(t){const e=w.useRef();return w.useEffect(()=>{e.current=t},[t]),e.current}let cu={};function gc(t,e){return w.useMemo(()=>{if(e)return e;const n=cu[t]==null?0:cu[t]+1;return cu[t]=n,t+"-"+n},[t,e])}function nv(t){return function(e){for(var n=arguments.length,s=new Array(n>1?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];return s.reduce((i,o)=>{const a=Object.entries(o);for(const[l,c]of a){const u=i[l];u!=null&&(i[l]=u+t*c)}return i},{...e})}}const Br=nv(1),Bl=nv(-1);function uE(t){return"clientX"in t&&"clientY"in t}function eh(t){if(!t)return!1;const{KeyboardEvent:e}=nt(t.target);return e&&t instanceof e}function dE(t){if(!t)return!1;const{TouchEvent:e}=nt(t.target);return e&&t instanceof e}function Wl(t){if(dE(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return uE(t)?{x:t.clientX,y:t.clientY}:null}const Do=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[Do.Translate.toString(t),Do.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:s}=t;return e+" "+n+"ms "+s}}}),tm="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function fE(t){return t.matches(tm)?t:t.querySelector(tm)}const hE={display:"none"};function pE(t){let{id:e,value:n}=t;return be.createElement("div",{id:e,style:hE},n)}function gE(t){let{id:e,announcement:n,ariaLiveType:s="assertive"}=t;const r={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return be.createElement("div",{id:e,style:r,role:"status","aria-live":s,"aria-atomic":!0},n)}function mE(){const[t,e]=w.useState("");return{announce:w.useCallback(s=>{s!=null&&e(s)},[]),announcement:t}}const sv=w.createContext(null);function xE(t){const e=w.useContext(sv);w.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function yE(){const[t]=w.useState(()=>new Set),e=w.useCallback(s=>(t.add(s),()=>t.delete(s)),[t]);return[w.useCallback(s=>{let{type:r,event:i}=s;t.forEach(o=>{var a;return(a=o[r])==null?void 0:a.call(o,i)})},[t]),e]}const vE={draggable:`
|
|
85
|
-
To pick up a draggable item, press the space bar.
|
|
86
|
-
While dragging, use the arrow keys to move the item.
|
|
87
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
88
|
-
`},bE={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function wE(t){let{announcements:e=bE,container:n,hiddenTextDescribedById:s,screenReaderInstructions:r=vE}=t;const{announce:i,announcement:o}=mE(),a=gc("DndLiveRegion"),[l,c]=w.useState(!1);if(w.useEffect(()=>{c(!0)},[]),xE(w.useMemo(()=>({onDragStart(f){let{active:h}=f;i(e.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;e.onDragMove&&i(e.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;i(e.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;i(e.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;i(e.onDragCancel({active:h,over:p}))}}),[i,e])),!l)return null;const u=be.createElement(be.Fragment,null,be.createElement(pE,{id:s,value:r.draggable}),be.createElement(gE,{id:a,announcement:o}));return n?Pr.createPortal(u,n):u}var Re;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Re||(Re={}));function Ul(){}function SE(t,e){return w.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function _E(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return w.useMemo(()=>[...e].filter(s=>s!=null),[...e])}const Kt=Object.freeze({x:0,y:0});function kE(t,e){const n=Wl(t);if(!n)return"0 0";const s={x:(n.x-e.left)/e.width*100,y:(n.y-e.top)/e.height*100};return s.x+"% "+s.y+"%"}function CE(t,e){let{data:{value:n}}=t,{data:{value:s}}=e;return s-n}function jE(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function EE(t,e){const n=Math.max(e.top,t.top),s=Math.max(e.left,t.left),r=Math.min(e.left+e.width,t.left+t.width),i=Math.min(e.top+e.height,t.top+t.height),o=r-s,a=i-n;if(s<r&&n<i){const l=e.width*e.height,c=t.width*t.height,u=o*a,f=u/(l+c-u);return Number(f.toFixed(4))}return 0}const NE=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:s}=t;const r=[];for(const i of s){const{id:o}=i,a=n.get(o);if(a){const l=EE(a,e);l>0&&r.push({id:o,data:{droppableContainer:i,value:l}})}}return r.sort(CE)};function ME(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function rv(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Kt}function PE(t){return function(n){for(var s=arguments.length,r=new Array(s>1?s-1:0),i=1;i<s;i++)r[i-1]=arguments[i];return r.reduce((o,a)=>({...o,top:o.top+t*a.y,bottom:o.bottom+t*a.y,left:o.left+t*a.x,right:o.right+t*a.x}),{...n})}}const RE=PE(1);function iv(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function OE(t,e,n){const s=iv(e);if(!s)return t;const{scaleX:r,scaleY:i,x:o,y:a}=s,l=t.left-o-(1-r)*parseFloat(n),c=t.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=r?t.width/r:t.width,f=i?t.height/i:t.height;return{width:u,height:f,top:c,right:l+u,bottom:c+f,left:l}}const TE={ignoreTransform:!1};function Go(t,e){e===void 0&&(e=TE);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:u}=nt(t).getComputedStyle(t);c&&(n=OE(n,c,u))}const{top:s,left:r,width:i,height:o,bottom:a,right:l}=n;return{top:s,left:r,width:i,height:o,bottom:a,right:l}}function nm(t){return Go(t,{ignoreTransform:!0})}function DE(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function LE(t,e){return e===void 0&&(e=nt(t).getComputedStyle(t)),e.position==="fixed"}function AE(t,e){e===void 0&&(e=nt(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{const i=e[r];return typeof i=="string"?n.test(i):!1})}function th(t,e){const n=[];function s(r){if(e!=null&&n.length>=e||!r)return n;if(Zf(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!Xo(r)||tv(r)||n.includes(r))return n;const i=nt(t).getComputedStyle(r);return r!==t&&AE(r,i)&&n.push(r),LE(r,i)?n:s(r.parentNode)}return t?s(t):n}function ov(t){const[e]=th(t,1);return e??null}function uu(t){return!hc||!t?null:mi(t)?t:Jf(t)?Zf(t)||t===xi(t).scrollingElement?window:Xo(t)?t:null:null}function av(t){return mi(t)?t.scrollX:t.scrollLeft}function lv(t){return mi(t)?t.scrollY:t.scrollTop}function Od(t){return{x:av(t),y:lv(t)}}var Ae;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Ae||(Ae={}));function cv(t){return!hc||!t?!1:t===document.scrollingElement}function uv(t){const e={x:0,y:0},n=cv(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},s={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},r=t.scrollTop<=e.y,i=t.scrollLeft<=e.x,o=t.scrollTop>=s.y,a=t.scrollLeft>=s.x;return{isTop:r,isLeft:i,isBottom:o,isRight:a,maxScroll:s,minScroll:e}}const FE={x:.2,y:.2};function IE(t,e,n,s,r){let{top:i,left:o,right:a,bottom:l}=n;s===void 0&&(s=10),r===void 0&&(r=FE);const{isTop:c,isBottom:u,isLeft:f,isRight:h}=uv(t),p={x:0,y:0},y={x:0,y:0},m={height:e.height*r.y,width:e.width*r.x};return!c&&i<=e.top+m.height?(p.y=Ae.Backward,y.y=s*Math.abs((e.top+m.height-i)/m.height)):!u&&l>=e.bottom-m.height&&(p.y=Ae.Forward,y.y=s*Math.abs((e.bottom-m.height-l)/m.height)),!h&&a>=e.right-m.width?(p.x=Ae.Forward,y.x=s*Math.abs((e.right-m.width-a)/m.width)):!f&&o<=e.left+m.width&&(p.x=Ae.Backward,y.x=s*Math.abs((e.left+m.width-o)/m.width)),{direction:p,speed:y}}function zE(t){if(t===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:e,left:n,right:s,bottom:r}=t.getBoundingClientRect();return{top:e,left:n,right:s,bottom:r,width:t.clientWidth,height:t.clientHeight}}function dv(t){return t.reduce((e,n)=>Br(e,Od(n)),Kt)}function BE(t){return t.reduce((e,n)=>e+av(n),0)}function WE(t){return t.reduce((e,n)=>e+lv(n),0)}function fv(t,e){if(e===void 0&&(e=Go),!t)return;const{top:n,left:s,bottom:r,right:i}=e(t);ov(t)&&(r<=0||i<=0||n>=window.innerHeight||s>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const UE=[["x",["left","right"],BE],["y",["top","bottom"],WE]];class nh{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=th(n),r=dv(s);this.rect={...e},this.width=e.width,this.height=e.height;for(const[i,o,a]of UE)for(const l of o)Object.defineProperty(this,l,{get:()=>{const c=a(s),u=r[i]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class io{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=e}add(e,n,s){var r;(r=this.target)==null||r.addEventListener(e,n,s),this.listeners.push([e,n,s])}}function $E(t){const{EventTarget:e}=nt(t);return t instanceof e?t:xi(t)}function du(t,e){const n=Math.abs(t.x),s=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+s**2)>e:"x"in e&&"y"in e?n>e.x&&s>e.y:"x"in e?n>e.x:"y"in e?s>e.y:!1}var Et;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Et||(Et={}));function sm(t){t.preventDefault()}function HE(t){t.stopPropagation()}var ae;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(ae||(ae={}));const hv={start:[ae.Space,ae.Enter],cancel:[ae.Esc],end:[ae.Space,ae.Enter,ae.Tab]},VE=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case ae.Right:return{...n,x:n.x+25};case ae.Left:return{...n,x:n.x-25};case ae.Down:return{...n,y:n.y+25};case ae.Up:return{...n,y:n.y-25}}};class pv{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new io(xi(n)),this.windowListeners=new io(nt(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Et.Resize,this.handleCancel),this.windowListeners.add(Et.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Et.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,s=e.node.current;s&&fv(s),n(Kt)}handleKeyDown(e){if(eh(e)){const{active:n,context:s,options:r}=this.props,{keyboardCodes:i=hv,coordinateGetter:o=VE,scrollBehavior:a="smooth"}=r,{code:l}=e;if(i.end.includes(l)){this.handleEnd(e);return}if(i.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:c}=s.current,u=c?{x:c.left,y:c.top}:Kt;this.referenceCoordinates||(this.referenceCoordinates=u);const f=o(e,{active:n,context:s.current,currentCoordinates:u});if(f){const h=Bl(f,u),p={x:0,y:0},{scrollableAncestors:y}=s.current;for(const m of y){const b=e.code,{isTop:x,isRight:g,isLeft:v,isBottom:S,maxScroll:_,minScroll:k}=uv(m),j=zE(m),E={x:Math.min(b===ae.Right?j.right-j.width/2:j.right,Math.max(b===ae.Right?j.left:j.left+j.width/2,f.x)),y:Math.min(b===ae.Down?j.bottom-j.height/2:j.bottom,Math.max(b===ae.Down?j.top:j.top+j.height/2,f.y))},P=b===ae.Right&&!g||b===ae.Left&&!v,M=b===ae.Down&&!S||b===ae.Up&&!x;if(P&&E.x!==f.x){const O=m.scrollLeft+h.x,N=b===ae.Right&&O<=_.x||b===ae.Left&&O>=k.x;if(N&&!h.y){m.scrollTo({left:O,behavior:a});return}N?p.x=m.scrollLeft-O:p.x=b===ae.Right?m.scrollLeft-_.x:m.scrollLeft-k.x,p.x&&m.scrollBy({left:-p.x,behavior:a});break}else if(M&&E.y!==f.y){const O=m.scrollTop+h.y,N=b===ae.Down&&O<=_.y||b===ae.Up&&O>=k.y;if(N&&!h.x){m.scrollTo({top:O,behavior:a});return}N?p.y=m.scrollTop-O:p.y=b===ae.Down?m.scrollTop-_.y:m.scrollTop-k.y,p.y&&m.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(e,Br(Bl(f,this.referenceCoordinates),p))}}}handleMove(e,n){const{onMove:s}=this.props;e.preventDefault(),s(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}pv.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:s=hv,onActivation:r}=e,{active:i}=n;const{code:o}=t.nativeEvent;if(s.start.includes(o)){const a=i.activatorNode.current;return a&&t.target!==a?!1:(t.preventDefault(),r==null||r({event:t.nativeEvent}),!0)}return!1}}];function rm(t){return!!(t&&"distance"in t)}function im(t){return!!(t&&"delay"in t)}class sh{constructor(e,n,s){var r;s===void 0&&(s=$E(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:i}=e,{target:o}=i;this.props=e,this.events=n,this.document=xi(o),this.documentListeners=new io(this.document),this.listeners=new io(s),this.windowListeners=new io(nt(o)),this.initialCoordinates=(r=Wl(i))!=null?r:Kt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:s}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Et.Resize,this.handleCancel),this.windowListeners.add(Et.DragStart,sm),this.windowListeners.add(Et.VisibilityChange,this.handleCancel),this.windowListeners.add(Et.ContextMenu,sm),this.documentListeners.add(Et.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(im(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(rm(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:s,onPending:r}=this.props;r(s,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Et.Click,HE,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Et.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:s,initialCoordinates:r,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!r)return;const l=(n=Wl(e))!=null?n:Kt,c=Bl(r,l);if(!s&&a){if(rm(a)){if(a.tolerance!=null&&du(c,a.tolerance))return this.handleCancel();if(du(c,a.distance))return this.handleStart()}if(im(a)&&du(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}e.cancelable&&e.preventDefault(),o(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===ae.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const QE={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class rh extends sh{constructor(e){const{event:n}=e,s=xi(n.target);super(e,QE,s)}}rh.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:s}=e;return!n.isPrimary||n.button!==0?!1:(s==null||s({event:n}),!0)}}];const KE={move:{name:"mousemove"},end:{name:"mouseup"}};var Td;(function(t){t[t.RightClick=2]="RightClick"})(Td||(Td={}));class YE extends sh{constructor(e){super(e,KE,xi(e.event.target))}}YE.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:s}=e;return n.button===Td.RightClick?!1:(s==null||s({event:n}),!0)}}];const fu={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class XE extends sh{constructor(e){super(e,fu)}static setup(){return window.addEventListener(fu.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(fu.move.name,e)};function e(){}}}XE.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:s}=e;const{touches:r}=n;return r.length>1?!1:(s==null||s({event:n}),!0)}}];var oo;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(oo||(oo={}));var $l;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})($l||($l={}));function qE(t){let{acceleration:e,activator:n=oo.Pointer,canScroll:s,draggingRect:r,enabled:i,interval:o=5,order:a=$l.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:f,threshold:h}=t;const p=JE({delta:f,disabled:!i}),[y,m]=cE(),b=w.useRef({x:0,y:0}),x=w.useRef({x:0,y:0}),g=w.useMemo(()=>{switch(n){case oo.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case oo.DraggableRect:return r}},[n,r,l]),v=w.useRef(null),S=w.useCallback(()=>{const k=v.current;if(!k)return;const j=b.current.x*x.current.x,E=b.current.y*x.current.y;k.scrollBy(j,E)},[]),_=w.useMemo(()=>a===$l.TreeOrder?[...c].reverse():c,[a,c]);w.useEffect(()=>{if(!i||!c.length||!g){m();return}for(const k of _){if((s==null?void 0:s(k))===!1)continue;const j=c.indexOf(k),E=u[j];if(!E)continue;const{direction:P,speed:M}=IE(k,E,g,e,h);for(const O of["x","y"])p[O][P[O]]||(M[O]=0,P[O]=0);if(M.x>0||M.y>0){m(),v.current=k,y(S,o),b.current=M,x.current=P;return}}b.current={x:0,y:0},x.current={x:0,y:0},m()},[e,S,s,m,i,o,JSON.stringify(g),JSON.stringify(p),y,c,_,u,JSON.stringify(h)])}const GE={x:{[Ae.Backward]:!1,[Ae.Forward]:!1},y:{[Ae.Backward]:!1,[Ae.Forward]:!1}};function JE(t){let{delta:e,disabled:n}=t;const s=zl(e);return qo(r=>{if(n||!s||!r)return GE;const i={x:Math.sign(e.x-s.x),y:Math.sign(e.y-s.y)};return{x:{[Ae.Backward]:r.x[Ae.Backward]||i.x===-1,[Ae.Forward]:r.x[Ae.Forward]||i.x===1},y:{[Ae.Backward]:r.y[Ae.Backward]||i.y===-1,[Ae.Forward]:r.y[Ae.Forward]||i.y===1}}},[n,e,s])}function ZE(t,e){const n=e!=null?t.get(e):void 0,s=n?n.node.current:null;return qo(r=>{var i;return e==null?null:(i=s??r)!=null?i:null},[s,e])}function e2(t,e){return w.useMemo(()=>t.reduce((n,s)=>{const{sensor:r}=s,i=r.activators.map(o=>({eventName:o.eventName,handler:e(o.handler,s)}));return[...n,...i]},[]),[t,e])}var Lo;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Lo||(Lo={}));var Dd;(function(t){t.Optimized="optimized"})(Dd||(Dd={}));const om=new Map;function t2(t,e){let{dragging:n,dependencies:s,config:r}=e;const[i,o]=w.useState(null),{frequency:a,measure:l,strategy:c}=r,u=w.useRef(t),f=b(),h=To(f),p=w.useCallback(function(x){x===void 0&&(x=[]),!h.current&&o(g=>g===null?x:g.concat(x.filter(v=>!g.includes(v))))},[h]),y=w.useRef(null),m=qo(x=>{if(f&&!n)return om;if(!x||x===om||u.current!==t||i!=null){const g=new Map;for(let v of t){if(!v)continue;if(i&&i.length>0&&!i.includes(v.id)&&v.rect.current){g.set(v.id,v.rect.current);continue}const S=v.node.current,_=S?new nh(l(S),S):null;v.rect.current=_,_&&g.set(v.id,_)}return g}return x},[t,i,n,f,l]);return w.useEffect(()=>{u.current=t},[t]),w.useEffect(()=>{f||p()},[n,f]),w.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),w.useEffect(()=>{f||typeof a!="number"||y.current!==null||(y.current=setTimeout(()=>{p(),y.current=null},a))},[a,f,p,...s]),{droppableRects:m,measureDroppableContainers:p,measuringScheduled:i!=null};function b(){switch(c){case Lo.Always:return!1;case Lo.BeforeDragging:return n;default:return!n}}}function ih(t,e){return qo(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function n2(t,e){return ih(t,e)}function s2(t){let{callback:e,disabled:n}=t;const s=pc(e),r=w.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(s)},[s,n]);return w.useEffect(()=>()=>r==null?void 0:r.disconnect(),[r]),r}function mc(t){let{callback:e,disabled:n}=t;const s=pc(e),r=w.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(s)},[n]);return w.useEffect(()=>()=>r==null?void 0:r.disconnect(),[r]),r}function r2(t){return new nh(Go(t),t)}function am(t,e,n){e===void 0&&(e=r2);const[s,r]=w.useState(null);function i(){r(l=>{if(!t)return null;if(t.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=e(t);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const o=s2({callback(l){if(t)for(const c of l){const{type:u,target:f}=c;if(u==="childList"&&f instanceof HTMLElement&&f.contains(t)){i();break}}}}),a=mc({callback:i});return Rn(()=>{i(),t?(a==null||a.observe(t),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[t]),s}function i2(t){const e=ih(t);return rv(t,e)}const lm=[];function o2(t){const e=w.useRef(t),n=qo(s=>t?s&&s!==lm&&t&&e.current&&t.parentNode===e.current.parentNode?s:th(t):lm,[t]);return w.useEffect(()=>{e.current=t},[t]),n}function a2(t){const[e,n]=w.useState(null),s=w.useRef(t),r=w.useCallback(i=>{const o=uu(i.target);o&&n(a=>a?(a.set(o,Od(o)),new Map(a)):null)},[]);return w.useEffect(()=>{const i=s.current;if(t!==i){o(i);const a=t.map(l=>{const c=uu(l);return c?(c.addEventListener("scroll",r,{passive:!0}),[c,Od(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),s.current=t}return()=>{o(t),o(i)};function o(a){a.forEach(l=>{const c=uu(l);c==null||c.removeEventListener("scroll",r)})}},[r,t]),w.useMemo(()=>t.length?e?Array.from(e.values()).reduce((i,o)=>Br(i,o),Kt):dv(t):Kt,[t,e])}function cm(t,e){e===void 0&&(e=[]);const n=w.useRef(null);return w.useEffect(()=>{n.current=null},e),w.useEffect(()=>{const s=t!==Kt;s&&!n.current&&(n.current=t),!s&&n.current&&(n.current=null)},[t]),n.current?Bl(t,n.current):Kt}function l2(t){w.useEffect(()=>{if(!hc)return;const e=t.map(n=>{let{sensor:s}=n;return s.setup==null?void 0:s.setup()});return()=>{for(const n of e)n==null||n()}},t.map(e=>{let{sensor:n}=e;return n}))}function c2(t,e){return w.useMemo(()=>t.reduce((n,s)=>{let{eventName:r,handler:i}=s;return n[r]=o=>{i(o,e)},n},{}),[t,e])}function gv(t){return w.useMemo(()=>t?DE(t):null,[t])}const um=[];function u2(t,e){e===void 0&&(e=Go);const[n]=t,s=gv(n?nt(n):null),[r,i]=w.useState(um);function o(){i(()=>t.length?t.map(l=>cv(l)?s:new nh(e(l),l)):um)}const a=mc({callback:o});return Rn(()=>{a==null||a.disconnect(),o(),t.forEach(l=>a==null?void 0:a.observe(l))},[t]),r}function mv(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return Xo(e)?e:t}function d2(t){let{measure:e}=t;const[n,s]=w.useState(null),r=w.useCallback(c=>{for(const{target:u}of c)if(Xo(u)){s(f=>{const h=e(u);return f?{...f,width:h.width,height:h.height}:h});break}},[e]),i=mc({callback:r}),o=w.useCallback(c=>{const u=mv(c);i==null||i.disconnect(),u&&(i==null||i.observe(u)),s(u?e(u):null)},[e,i]),[a,l]=Il(o);return w.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const f2=[{sensor:rh,options:{}},{sensor:pv,options:{}}],h2={current:{}},Za={draggable:{measure:nm},droppable:{measure:nm,strategy:Lo.WhileDragging,frequency:Dd.Optimized},dragOverlay:{measure:Go}};class ao extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,s;return(n=(s=this.get(e))==null?void 0:s.node.current)!=null?n:void 0}}const p2={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ao,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ul},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Za,measureDroppableContainers:Ul,windowRect:null,measuringScheduled:!1},xv={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ul,draggableNodes:new Map,over:null,measureDroppableContainers:Ul},Jo=w.createContext(xv),yv=w.createContext(p2);function g2(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ao}}}function m2(t,e){switch(e.type){case Re.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Re.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case Re.DragEnd:case Re.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Re.RegisterDroppable:{const{element:n}=e,{id:s}=n,r=new ao(t.droppable.containers);return r.set(s,n),{...t,droppable:{...t.droppable,containers:r}}}case Re.SetDroppableDisabled:{const{id:n,key:s,disabled:r}=e,i=t.droppable.containers.get(n);if(!i||s!==i.key)return t;const o=new ao(t.droppable.containers);return o.set(n,{...i,disabled:r}),{...t,droppable:{...t.droppable,containers:o}}}case Re.UnregisterDroppable:{const{id:n,key:s}=e,r=t.droppable.containers.get(n);if(!r||s!==r.key)return t;const i=new ao(t.droppable.containers);return i.delete(n),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function x2(t){let{disabled:e}=t;const{active:n,activatorEvent:s,draggableNodes:r}=w.useContext(Jo),i=zl(s),o=zl(n==null?void 0:n.id);return w.useEffect(()=>{if(!e&&!s&&i&&o!=null){if(!eh(i)||document.activeElement===i.target)return;const a=r.get(o);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const f=fE(u);if(f){f.focus();break}}})}},[s,e,r,o,i]),null}function vv(t,e){let{transform:n,...s}=e;return t!=null&&t.length?t.reduce((r,i)=>i({transform:r,...s}),n):n}function y2(t){return w.useMemo(()=>({draggable:{...Za.draggable,...t==null?void 0:t.draggable},droppable:{...Za.droppable,...t==null?void 0:t.droppable},dragOverlay:{...Za.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function v2(t){let{activeNode:e,measure:n,initialRect:s,config:r=!0}=t;const i=w.useRef(!1),{x:o,y:a}=typeof r=="boolean"?{x:r,y:r}:r;Rn(()=>{if(!o&&!a||!e){i.current=!1;return}if(i.current||!s)return;const c=e==null?void 0:e.node.current;if(!c||c.isConnected===!1)return;const u=n(c),f=rv(u,s);if(o||(f.x=0),a||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=ov(c);h&&h.scrollBy({top:f.y,left:f.x})}},[e,o,a,s,n])}const xc=w.createContext({...Kt,scaleX:1,scaleY:1});var $n;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})($n||($n={}));const b2=w.memo(function(e){var n,s,r,i;let{id:o,accessibility:a,autoScroll:l=!0,children:c,sensors:u=f2,collisionDetection:f=NE,measuring:h,modifiers:p,...y}=e;const m=w.useReducer(m2,void 0,g2),[b,x]=m,[g,v]=yE(),[S,_]=w.useState($n.Uninitialized),k=S===$n.Initialized,{draggable:{active:j,nodes:E,translate:P},droppable:{containers:M}}=b,O=j!=null?E.get(j):null,N=w.useRef({initial:null,translated:null}),I=w.useMemo(()=>{var He;return j!=null?{id:j,data:(He=O==null?void 0:O.data)!=null?He:h2,rect:N}:null},[j,O]),W=w.useRef(null),[V,oe]=w.useState(null),[se,T]=w.useState(null),A=To(y,Object.values(y)),F=gc("DndDescribedBy",o),K=w.useMemo(()=>M.getEnabled(),[M]),$=y2(h),{droppableRects:ue,measureDroppableContainers:Y,measuringScheduled:Ne}=t2(K,{dragging:k,dependencies:[P.x,P.y],config:$.droppable}),te=ZE(E,j),Lt=w.useMemo(()=>se?Wl(se):null,[se]),yi=Nv(),Zo=n2(te,$.draggable.measure);v2({activeNode:j!=null?E.get(j):null,config:yi.layoutShiftCompensation,initialRect:Zo,measure:$.draggable.measure});const ht=am(te,$.draggable.measure,Zo),yc=am(te?te.parentElement:null),Ms=w.useRef({activatorEvent:null,active:null,activeNode:te,collisionRect:null,collisions:null,droppableRects:ue,draggableNodes:E,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ah=M.getNodeFor((n=Ms.current.over)==null?void 0:n.id),Ps=d2({measure:$.dragOverlay.measure}),ea=(s=Ps.nodeRef.current)!=null?s:te,dr=k?(r=Ps.rect)!=null?r:ht:null,lh=!!(Ps.nodeRef.current&&Ps.rect),ch=i2(lh?null:ht),vc=gv(ea?nt(ea):null),Tn=o2(k?ah??te:null),ta=u2(Tn),na=vv(p,{transform:{x:P.x-ch.x,y:P.y-ch.y,scaleX:1,scaleY:1},activatorEvent:se,active:I,activeNodeRect:ht,containerNodeRect:yc,draggingNodeRect:dr,over:Ms.current.over,overlayNodeRect:Ps.rect,scrollableAncestors:Tn,scrollableAncestorRects:ta,windowRect:vc}),uh=Lt?Br(Lt,P):null,dh=a2(Tn),wv=cm(dh),Sv=cm(dh,[ht]),fr=Br(na,wv),hr=dr?RE(dr,na):null,vi=I&&hr?f({active:I,collisionRect:hr,droppableRects:ue,droppableContainers:K,pointerCoordinates:uh}):null,fh=jE(vi,"id"),[Dn,hh]=w.useState(null),_v=lh?na:Br(na,Sv),kv=ME(_v,(i=Dn==null?void 0:Dn.rect)!=null?i:null,ht),bc=w.useRef(null),ph=w.useCallback((He,pt)=>{let{sensor:gt,options:Ln}=pt;if(W.current==null)return;const kt=E.get(W.current);if(!kt)return;const mt=He.nativeEvent,Xt=new gt({active:W.current,activeNode:kt,event:mt,options:Ln,context:Ms,onAbort(ze){if(!E.get(ze))return;const{onDragAbort:qt}=A.current,pn={id:ze};qt==null||qt(pn),g({type:"onDragAbort",event:pn})},onPending(ze,An,qt,pn){if(!E.get(ze))return;const{onDragPending:wi}=A.current,Fn={id:ze,constraint:An,initialCoordinates:qt,offset:pn};wi==null||wi(Fn),g({type:"onDragPending",event:Fn})},onStart(ze){const An=W.current;if(An==null)return;const qt=E.get(An);if(!qt)return;const{onDragStart:pn}=A.current,bi={activatorEvent:mt,active:{id:An,data:qt.data,rect:N}};Pr.unstable_batchedUpdates(()=>{pn==null||pn(bi),_($n.Initializing),x({type:Re.DragStart,initialCoordinates:ze,active:An}),g({type:"onDragStart",event:bi}),oe(bc.current),T(mt)})},onMove(ze){x({type:Re.DragMove,coordinates:ze})},onEnd:pr(Re.DragEnd),onCancel:pr(Re.DragCancel)});bc.current=Xt;function pr(ze){return async function(){const{active:qt,collisions:pn,over:bi,scrollAdjustedTranslate:wi}=Ms.current;let Fn=null;if(qt&&wi){const{cancelDrop:Si}=A.current;Fn={activatorEvent:mt,active:qt,collisions:pn,delta:wi,over:bi},ze===Re.DragEnd&&typeof Si=="function"&&await Promise.resolve(Si(Fn))&&(ze=Re.DragCancel)}W.current=null,Pr.unstable_batchedUpdates(()=>{x({type:ze}),_($n.Uninitialized),hh(null),oe(null),T(null),bc.current=null;const Si=ze===Re.DragEnd?"onDragEnd":"onDragCancel";if(Fn){const wc=A.current[Si];wc==null||wc(Fn),g({type:Si,event:Fn})}})}}},[E]),Cv=w.useCallback((He,pt)=>(gt,Ln)=>{const kt=gt.nativeEvent,mt=E.get(Ln);if(W.current!==null||!mt||kt.dndKit||kt.defaultPrevented)return;const Xt={active:mt};He(gt,pt.options,Xt)===!0&&(kt.dndKit={capturedBy:pt.sensor},W.current=Ln,ph(gt,pt))},[E,ph]),gh=e2(u,Cv);l2(u),Rn(()=>{ht&&S===$n.Initializing&&_($n.Initialized)},[ht,S]),w.useEffect(()=>{const{onDragMove:He}=A.current,{active:pt,activatorEvent:gt,collisions:Ln,over:kt}=Ms.current;if(!pt||!gt)return;const mt={active:pt,activatorEvent:gt,collisions:Ln,delta:{x:fr.x,y:fr.y},over:kt};Pr.unstable_batchedUpdates(()=>{He==null||He(mt),g({type:"onDragMove",event:mt})})},[fr.x,fr.y]),w.useEffect(()=>{const{active:He,activatorEvent:pt,collisions:gt,droppableContainers:Ln,scrollAdjustedTranslate:kt}=Ms.current;if(!He||W.current==null||!pt||!kt)return;const{onDragOver:mt}=A.current,Xt=Ln.get(fh),pr=Xt&&Xt.rect.current?{id:Xt.id,rect:Xt.rect.current,data:Xt.data,disabled:Xt.disabled}:null,ze={active:He,activatorEvent:pt,collisions:gt,delta:{x:kt.x,y:kt.y},over:pr};Pr.unstable_batchedUpdates(()=>{hh(pr),mt==null||mt(ze),g({type:"onDragOver",event:ze})})},[fh]),Rn(()=>{Ms.current={activatorEvent:se,active:I,activeNode:te,collisionRect:hr,collisions:vi,droppableRects:ue,draggableNodes:E,draggingNode:ea,draggingNodeRect:dr,droppableContainers:M,over:Dn,scrollableAncestors:Tn,scrollAdjustedTranslate:fr},N.current={initial:dr,translated:hr}},[I,te,vi,hr,E,ea,dr,ue,M,Dn,Tn,fr]),qE({...yi,delta:P,draggingRect:hr,pointerCoordinates:uh,scrollableAncestors:Tn,scrollableAncestorRects:ta});const jv=w.useMemo(()=>({active:I,activeNode:te,activeNodeRect:ht,activatorEvent:se,collisions:vi,containerNodeRect:yc,dragOverlay:Ps,draggableNodes:E,droppableContainers:M,droppableRects:ue,over:Dn,measureDroppableContainers:Y,scrollableAncestors:Tn,scrollableAncestorRects:ta,measuringConfiguration:$,measuringScheduled:Ne,windowRect:vc}),[I,te,ht,se,vi,yc,Ps,E,M,ue,Dn,Y,Tn,ta,$,Ne,vc]),Ev=w.useMemo(()=>({activatorEvent:se,activators:gh,active:I,activeNodeRect:ht,ariaDescribedById:{draggable:F},dispatch:x,draggableNodes:E,over:Dn,measureDroppableContainers:Y}),[se,gh,I,ht,x,F,E,Dn,Y]);return be.createElement(sv.Provider,{value:v},be.createElement(Jo.Provider,{value:Ev},be.createElement(yv.Provider,{value:jv},be.createElement(xc.Provider,{value:kv},c)),be.createElement(x2,{disabled:(a==null?void 0:a.restoreFocus)===!1})),be.createElement(wE,{...a,hiddenTextDescribedById:F}));function Nv(){const He=(V==null?void 0:V.autoScrollEnabled)===!1,pt=typeof l=="object"?l.enabled===!1:l===!1,gt=k&&!He&&!pt;return typeof l=="object"?{...l,enabled:gt}:{enabled:gt}}}),w2=w.createContext(null),dm="button",S2="Draggable";function _2(t){let{id:e,data:n,disabled:s=!1,attributes:r}=t;const i=gc(S2),{activators:o,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:f,over:h}=w.useContext(Jo),{role:p=dm,roleDescription:y="draggable",tabIndex:m=0}=r??{},b=(l==null?void 0:l.id)===e,x=w.useContext(b?xc:w2),[g,v]=Il(),[S,_]=Il(),k=c2(o,e),j=To(n);Rn(()=>(f.set(e,{id:e,key:i,node:g,activatorNode:S,data:j}),()=>{const P=f.get(e);P&&P.key===i&&f.delete(e)}),[f,e]);const E=w.useMemo(()=>({role:p,tabIndex:m,"aria-disabled":s,"aria-pressed":b&&p===dm?!0:void 0,"aria-roledescription":y,"aria-describedby":u.draggable}),[s,p,m,b,y,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:E,isDragging:b,listeners:s?void 0:k,node:g,over:h,setNodeRef:v,setActivatorNodeRef:_,transform:x}}function k2(){return w.useContext(yv)}const C2="Droppable",j2={timeout:25};function E2(t){let{data:e,disabled:n=!1,id:s,resizeObserverConfig:r}=t;const i=gc(C2),{active:o,dispatch:a,over:l,measureDroppableContainers:c}=w.useContext(Jo),u=w.useRef({disabled:n}),f=w.useRef(!1),h=w.useRef(null),p=w.useRef(null),{disabled:y,updateMeasurementsFor:m,timeout:b}={...j2,...r},x=To(m??s),g=w.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(x.current)?x.current:[x.current]),p.current=null},b)},[b]),v=mc({callback:g,disabled:y||!o}),S=w.useCallback((E,P)=>{v&&(P&&(v.unobserve(P),f.current=!1),E&&v.observe(E))},[v]),[_,k]=Il(S),j=To(e);return w.useEffect(()=>{!v||!_.current||(v.disconnect(),f.current=!1,v.observe(_.current))},[_,v]),w.useEffect(()=>(a({type:Re.RegisterDroppable,element:{id:s,key:i,disabled:n,node:_,rect:h,data:j}}),()=>a({type:Re.UnregisterDroppable,key:i,id:s})),[s]),w.useEffect(()=>{n!==u.current.disabled&&(a({type:Re.SetDroppableDisabled,id:s,key:i,disabled:n}),u.current.disabled=n)},[s,i,n,a]),{active:o,rect:h,isOver:(l==null?void 0:l.id)===s,node:_,over:l,setNodeRef:k}}function N2(t){let{animation:e,children:n}=t;const[s,r]=w.useState(null),[i,o]=w.useState(null),a=zl(n);return!n&&!s&&a&&r(a),Rn(()=>{if(!i)return;const l=s==null?void 0:s.key,c=s==null?void 0:s.props.id;if(l==null||c==null){r(null);return}Promise.resolve(e(c,i)).then(()=>{r(null)})},[e,s,i]),be.createElement(be.Fragment,null,n,s?w.cloneElement(s,{ref:o}):null)}const M2={x:0,y:0,scaleX:1,scaleY:1};function P2(t){let{children:e}=t;return be.createElement(Jo.Provider,{value:xv},be.createElement(xc.Provider,{value:M2},e))}const R2={position:"fixed",touchAction:"none"},O2=t=>eh(t)?"transform 250ms ease":void 0,T2=w.forwardRef((t,e)=>{let{as:n,activatorEvent:s,adjustScale:r,children:i,className:o,rect:a,style:l,transform:c,transition:u=O2}=t;if(!a)return null;const f=r?c:{...c,scaleX:1,scaleY:1},h={...R2,width:a.width,height:a.height,top:a.top,left:a.left,transform:Do.Transform.toString(f),transformOrigin:r&&s?kE(s,a):void 0,transition:typeof u=="function"?u(s):u,...l};return be.createElement(n,{className:o,style:h,ref:e},i)}),D2=t=>e=>{let{active:n,dragOverlay:s}=e;const r={},{styles:i,className:o}=t;if(i!=null&&i.active)for(const[a,l]of Object.entries(i.active))l!==void 0&&(r[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(i!=null&&i.dragOverlay)for(const[a,l]of Object.entries(i.dragOverlay))l!==void 0&&s.node.style.setProperty(a,l);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&s.node.classList.add(o.dragOverlay),function(){for(const[l,c]of Object.entries(r))n.node.style.setProperty(l,c);o!=null&&o.active&&n.node.classList.remove(o.active)}},L2=t=>{let{transform:{initial:e,final:n}}=t;return[{transform:Do.Transform.toString(e)},{transform:Do.Transform.toString(n)}]},A2={duration:250,easing:"ease",keyframes:L2,sideEffects:D2({styles:{active:{opacity:"0"}}})};function F2(t){let{config:e,draggableNodes:n,droppableContainers:s,measuringConfiguration:r}=t;return pc((i,o)=>{if(e===null)return;const a=n.get(i);if(!a)return;const l=a.node.current;if(!l)return;const c=mv(o);if(!c)return;const{transform:u}=nt(o).getComputedStyle(o),f=iv(u);if(!f)return;const h=typeof e=="function"?e:I2(e);return fv(l,r.draggable.measure),h({active:{id:i,data:a.data,node:l,rect:r.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:o,rect:r.dragOverlay.measure(c)},droppableContainers:s,measuringConfiguration:r,transform:f})})}function I2(t){const{duration:e,easing:n,sideEffects:s,keyframes:r}={...A2,...t};return i=>{let{active:o,dragOverlay:a,transform:l,...c}=i;if(!e)return;const u={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},f={scaleX:l.scaleX!==1?o.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?o.rect.height*l.scaleY/a.rect.height:1},h={x:l.x-u.x,y:l.y-u.y,...f},p=r({...c,active:o,dragOverlay:a,transform:{initial:l,final:h}}),[y]=p,m=p[p.length-1];if(JSON.stringify(y)===JSON.stringify(m))return;const b=s==null?void 0:s({active:o,dragOverlay:a,...c}),x=a.node.animate(p,{duration:e,easing:n,fill:"forwards"});return new Promise(g=>{x.onfinish=()=>{b==null||b(),g()}})}}let fm=0;function z2(t){return w.useMemo(()=>{if(t!=null)return fm++,fm},[t])}const B2=be.memo(t=>{let{adjustScale:e=!1,children:n,dropAnimation:s,style:r,transition:i,modifiers:o,wrapperElement:a="div",className:l,zIndex:c=999}=t;const{activatorEvent:u,active:f,activeNodeRect:h,containerNodeRect:p,draggableNodes:y,droppableContainers:m,dragOverlay:b,over:x,measuringConfiguration:g,scrollableAncestors:v,scrollableAncestorRects:S,windowRect:_}=k2(),k=w.useContext(xc),j=z2(f==null?void 0:f.id),E=vv(o,{activatorEvent:u,active:f,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:b.rect,over:x,overlayNodeRect:b.rect,scrollableAncestors:v,scrollableAncestorRects:S,transform:k,windowRect:_}),P=ih(h),M=F2({config:s,draggableNodes:y,droppableContainers:m,measuringConfiguration:g}),O=P?b.setRef:void 0;return be.createElement(P2,null,be.createElement(N2,{animation:M},f&&j?be.createElement(T2,{key:j,id:f.id,ref:O,as:a,activatorEvent:u,adjustScale:e,className:l,transition:i,rect:P,style:{zIndex:c,...r},transform:E},n):null))});function bv({lead:t,onAbrir:e,emOverlay:n=!1}){const{attributes:s,listeners:r,setNodeRef:i,transform:o,isDragging:a}=_2({id:t.id});return d.jsxs("div",{ref:i,...r,...s,style:o?{transform:`translate3d(${o.x}px, ${o.y}px, 0)`}:void 0,className:H("bg-white rounded-lg shadow-sm border border-gray-100 p-3 cursor-grab active:cursor-grabbing select-none",a&&!n&&"opacity-40",n&&"shadow-xl rotate-2"),onDoubleClick:()=>e==null?void 0:e(t),title:"Arraste para mudar de etapa · duplo clique para editar",children:[d.jsx("p",{className:"text-sm font-semibold text-gray-800 truncate",children:t.nome}),d.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:Af(t.telefone)}),d.jsxs("div",{className:"flex items-center justify-between mt-2",children:[d.jsx("span",{className:"text-[10px] uppercase tracking-wide bg-indigo-50 text-indigo-700 px-1.5 py-0.5 rounded font-medium",children:t.fonte}),d.jsxs("span",{className:"text-[10px] text-gray-400",children:[d.jsx("i",{className:"fas fa-star text-amber-400 mr-0.5"}),t.score??0]})]})]})}function W2({etapa:t,leads:e,onAbrirLead:n,cor:s}){const{setNodeRef:r,isOver:i}=E2({id:t});return d.jsxs("div",{ref:r,className:H("bg-gray-50 rounded-xl p-3 w-72 shrink-0 flex flex-col min-h-[420px] transition-colors",i&&"bg-indigo-50 ring-2 ring-indigo-300"),children:[d.jsxs("div",{className:"flex items-center justify-between px-1 pb-3",children:[d.jsxs("span",{className:"flex items-center gap-2 text-sm font-semibold text-gray-700",children:[d.jsx("span",{className:H("w-2.5 h-2.5 rounded-full",s)}),ys[t]]}),d.jsx("span",{className:"text-xs font-medium text-gray-500 bg-white border border-gray-200 rounded-full px-2 py-0.5",children:e.length})]}),d.jsxs("div",{className:"flex-1 space-y-2 overflow-y-auto pr-0.5",style:{maxHeight:"calc(100vh - 320px)"},children:[e.length===0&&d.jsxs("div",{className:"text-center text-xs text-gray-400 border-2 border-dashed border-gray-200 rounded-lg py-10 mt-8",children:[d.jsx("i",{className:"fas fa-inbox text-2xl text-gray-300 mb-2 block"}),"Arraste leads para cá"]}),e.map(o=>d.jsx(bv,{lead:o,onAbrir:n},o.id))]})]})}const U2={leads:"bg-blue-500",em_contato:"bg-amber-500",proposta:"bg-violet-500",fechado:"bg-green-500"};function $2({leads:t,onMover:e,onAbrirLead:n}){const[s,r]=w.useState(null),i=_E(SE(rh,{activationConstraint:{distance:6}})),o=l=>{const c=t.find(u=>u.id===l.active.id);r(c??null)},a=l=>{var f;r(null);const c=(f=l.over)==null?void 0:f.id;if(!c)return;const u=t.find(h=>h.id===l.active.id);!u||u.etapa===c||e(u.id,c)};return d.jsxs(b2,{sensors:i,onDragStart:o,onDragEnd:a,children:[d.jsx("div",{className:"flex gap-4 overflow-x-auto pb-2",children:_s.map(l=>d.jsx(W2,{etapa:l,cor:U2[l],leads:t.filter(c=>c.etapa===l),onAbrirLead:n},l))}),d.jsx(B2,{children:s?d.jsx(bv,{lead:s,emOverlay:!0}):null})]})}function H2(){const{toast:t}=Yt(),[e,n]=w.useState([]),[s,r]=w.useState(null),[i,o]=w.useState(!1),[a,l]=w.useState(null),[c,u]=w.useState(""),f=w.useCallback(async()=>{n(await U.leads.listar())},[]);w.useEffect(()=>{f().catch(g=>t("erro",g.message))},[f,t]);const h=async(g,v)=>{const S=e;n(_=>_.map(k=>k.id===g?{...k,etapa:v}:k));try{await U.leads.atualizar(g,{etapa:v}),t("sucesso",`Lead movido para "${ys[v]}".`)}catch(_){n(S),t("erro",_ instanceof Error?_.message:"Falha ao mover lead.")}},p=async()=>{o(!0);try{const g=await U.crm.sugestoes();r(g.sugestoes)}catch(g){t("erro",g instanceof Error?g.message:"Falha ao pedir sugestões.")}finally{o(!1)}},y=async g=>{try{await U.crm.aplicar(g.lead_id,g.para),r(v=>(v==null?void 0:v.filter(S=>S!==g))??null),await f(),t("sucesso",`Sugestão aplicada: ${g.lead_nome} → ${ys[g.para]}.`)}catch(v){t("erro",v instanceof Error?v.message:"Falha ao aplicar sugestão.")}},m=async g=>{try{(await U.leads.enriquecer(g.id)).notas.forEach(S=>t("info",S)),await f()}catch(v){t("erro",v instanceof Error?v.message:"Falha ao enriquecer.")}},b=async()=>{if(a)try{await U.leads.atualizar(a.id,{observacoes:c}),l(null),await f(),t("sucesso","Observações salvas.")}catch(g){t("erro",g instanceof Error?g.message:"Falha ao salvar.")}},x=w.useMemo(()=>Object.fromEntries(_s.map(g=>[g,e.filter(v=>v.etapa===g).length])),[e]);return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[d.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-500",children:[d.jsxs("span",{children:[d.jsx("strong",{className:"text-gray-800",children:e.length})," leads no funil"]}),_s.map(g=>d.jsxs("span",{className:"hidden md:inline",children:[ys[g],": ",d.jsx("strong",{className:"text-gray-700",children:x[g]})]},g))]}),d.jsxs("button",{onClick:p,disabled:i,className:"px-6 py-2.5 text-sm font-medium text-white bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg hover:opacity-90 transition disabled:opacity-60",children:[d.jsx("i",{className:H("fas fa-wand-magic-sparkles mr-2",i&&"fa-spin")}),"Sugestões da IA"]})]}),d.jsx($2,{leads:e,onMover:h,onAbrirLead:g=>{l(g),u(g.observacoes||"")}}),d.jsxs(hn,{aberto:s!==null,onFechar:()=>r(null),titulo:"Sugestões de movimentação (Agente de CRM)",icone:"fas fa-robot",largura:"lg",children:[s&&s.length===0&&d.jsxs("p",{className:"text-sm text-gray-500 text-center py-8",children:[d.jsx("i",{className:"fas fa-circle-check text-green-500 text-2xl block mb-3"}),"Nenhuma sugestão no momento — o funil está equilibrado. 🎯"]}),d.jsx("div",{className:"space-y-3",children:s==null?void 0:s.map((g,v)=>d.jsxs("div",{className:"border border-gray-100 rounded-xl p-4 flex items-start justify-between gap-4 hover:border-indigo-200 transition",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("p",{className:"text-sm font-semibold text-gray-800 truncate",children:g.lead_nome}),d.jsxs("p",{className:"text-xs text-gray-500 mt-1 flex items-center gap-2",children:[d.jsx(fn,{status:g.de})," ",d.jsx("i",{className:"fas fa-arrow-right text-gray-300"})," ",d.jsx(fn,{status:g.para}),d.jsxs("span",{className:"text-gray-400",children:["confiança ",Math.round(g.confianca*100),"%"]})]}),d.jsx("p",{className:"text-xs text-gray-600 mt-2",children:g.motivo})]}),d.jsx("button",{onClick:()=>y(g),className:"shrink-0 px-4 py-2 text-xs font-medium text-white bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg hover:opacity-90",children:"Aplicar"})]},v))})]}),d.jsx(hn,{aberto:!!a,onFechar:()=>l(null),titulo:"Lead",icone:"fas fa-address-card",children:a&&d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-base font-semibold text-gray-800",children:a.nome}),d.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:[Af(a.telefone)," · ",a.fonte]})]}),d.jsx(fn,{status:a.etapa})]}),d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Observações"}),d.jsx("textarea",{value:c,onChange:g=>u(g.target.value),rows:4,className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none",placeholder:"Ex.: ligou pedindo proposta, retorna na sexta..."})]}),d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("button",{onClick:()=>m(a),className:"text-sm text-indigo-600 hover:text-indigo-800 font-medium",children:[d.jsx("i",{className:"fas fa-wand-magic-sparkles mr-1"})," Enriquecer com IA"]}),d.jsxs("div",{className:"flex gap-3",children:[d.jsx("button",{onClick:()=>l(null),className:"px-4 py-2.5 text-sm font-medium text-gray-600 bg-white border border-gray-200 rounded-lg hover:bg-gray-50",children:"Cancelar"}),d.jsxs("button",{onClick:b,className:"px-6 py-2.5 text-sm font-medium text-white bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg hover:opacity-90",children:[d.jsx("i",{className:"fas fa-save mr-2"})," Salvar"]})]})]})]})})]})}function V2(){const{toast:t}=Yt(),[e,n]=w.useState([]),[s,r]=w.useState({}),[i,o]=w.useState(!1),[a,l]=w.useState(null),{data:c=[],refetch:u}=K0({queryKey:["campanhas"],queryFn:()=>U.campanhas.listar(),refetchInterval:N=>{var I;return(I=N.state.data)!=null&&I.some(W=>W.status==="em_andamento")?4e3:!1},refetchIntervalInBackground:!1}),f=w.useCallback(async()=>{const[N,I]=await Promise.all([U.leads.listar(),U.agentes.templates()]);n(N),r(I)},[]);w.useEffect(()=>{f().catch(N=>t("erro",N.message))},[f,t]);const[h,p]=w.useState(""),[y,m]=w.useState("texto"),[b,x]=w.useState("texto"),[g,v]=w.useState(new Set),[S,_]=w.useState("todas"),k=w.useMemo(()=>S==="todas"?e:e.filter(N=>N.etapa===S),[e,S]),j=N=>{v(I=>{const W=new Set(I);return W.has(N)?W.delete(N):W.add(N),W})},E=()=>{v(new Set(k.map(N=>N.id)))},P=async()=>{if(!h.trim()){t("erro","Dê um nome para a campanha.");return}if(g.size===0){t("erro","Selecione ao menos um lead para disparar.");return}try{await U.campanhas.criar({nome:h.trim(),canal:y,template:b,lead_ids:[...g]}),t("sucesso","Campanha criada — clique em Iniciar quando estiver pronto."),o(!1),p(""),v(new Set),await u()}catch(N){t("erro",N instanceof Error?N.message:"Falha ao criar campanha.")}},M=async(N,I)=>{try{const W=I==="iniciar"?await U.campanhas.iniciar(N.id):I==="pausar"?await U.campanhas.pausar(N.id):await U.campanhas.parar(N.id);t(W.ok?"sucesso":"info",W.mensagem),await u()}catch(W){t("erro",W instanceof Error?W.message:"Falha na ação.")}},O=async N=>{try{await U.campanhas.remover(N.id),t("sucesso",`Campanha "${N.nome}" removida.`),await u()}catch(I){t("erro",I instanceof Error?I.message:"Falha ao remover.")}};return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("p",{className:"text-sm text-gray-500",children:[d.jsx("strong",{className:"text-gray-800",children:c.length})," campanhas • templates configuráveis em Agentes"]}),d.jsxs("button",{onClick:()=>o(!0),className:"px-6 py-2.5 text-sm font-medium text-white bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg hover:opacity-90 transition shadow-sm",children:[d.jsx("i",{className:"fas fa-plus mr-2"})," Nova Campanha"]})]}),d.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[c.map(N=>{const I=Math.max(N.total,N.enviadas+N.erros),W=I?Math.round((N.enviadas+N.erros)/I*100):0,V=N.status==="em_andamento";return d.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-5 space-y-3",children:[d.jsxs("div",{className:"flex items-start justify-between gap-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("p",{className:"text-sm font-semibold text-gray-800 truncate",children:N.nome}),d.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:["criada em ",_d(N.criado_em),' · template "',N.template,'"']})]}),d.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[d.jsx(fn,{status:Q2(N.canal),rotulo:N.canal==="audio"?"Áudio":"Texto"}),d.jsx(fn,{status:N.status})]})]}),d.jsx(ev,{valor:W,mostrarLabel:!0}),d.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500",children:[d.jsxs("span",{children:[d.jsx("i",{className:"fas fa-paper-plane text-blue-500 mr-1"}),N.enviadas," enviadas"]}),d.jsxs("span",{children:[d.jsx("i",{className:"fas fa-circle-exclamation text-red-500 mr-1"}),N.erros," erros"]}),d.jsxs("span",{children:[I," leads"]})]}),d.jsxs("div",{className:"flex items-center justify-between pt-1",children:[d.jsxs("button",{onClick:()=>l(N),className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:[d.jsx("i",{className:"fas fa-list mr-1"})," Ver eventos"]}),d.jsxs("div",{className:"flex items-center gap-2",children:[(N.status==="rascunho"||N.status==="pausada"||N.status==="concluida")&&d.jsxs("button",{onClick:()=>M(N,"iniciar"),className:"px-4 py-2 text-xs font-medium text-white bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg hover:opacity-90",children:[d.jsx("i",{className:"fas fa-play mr-1"})," ",N.status==="pausada"?"Retomar":"Iniciar"]}),V&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{onClick:()=>M(N,"pausar"),className:"px-4 py-2 text-xs font-medium text-amber-700 bg-amber-50 border border-amber-200 rounded-lg hover:bg-amber-100",children:[d.jsx("i",{className:"fas fa-pause mr-1"})," Pausar"]}),d.jsxs("button",{onClick:()=>M(N,"parar"),className:"px-4 py-2 text-xs font-medium text-red-700 bg-red-50 border border-red-200 rounded-lg hover:bg-red-100",children:[d.jsx("i",{className:"fas fa-stop mr-1"})," Parar"]})]}),d.jsx("button",{onClick:()=>O(N),className:"text-gray-400 hover:text-red-600 px-2 py-2",title:"Excluir campanha",children:d.jsx("i",{className:"fas fa-trash"})})]})]})]},N.id)}),c.length===0&&d.jsxs("div",{className:"lg:col-span-2 bg-white rounded-xl border border-dashed border-gray-200 py-16 text-center text-gray-400",children:[d.jsx("i",{className:"fas fa-bullhorn text-3xl text-gray-200 block mb-3"}),'Nenhuma campanha ainda. Crie a primeira com "Nova Campanha".']})]}),d.jsx(hn,{aberto:i,onFechar:()=>o(!1),titulo:"Nova campanha de disparo",icone:"fas fa-bullhorn",largura:"lg",children:d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[d.jsxs("div",{className:"md:col-span-3",children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Nome da campanha *"}),d.jsx("input",{value:h,onChange:N=>p(N.target.value),placeholder:"Ex.: Reativação de leads de novembro",className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"})]}),d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Canal"}),d.jsxs("select",{value:y,onChange:N=>{const I=N.target.value;m(I),x(I)},className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none",children:[d.jsx("option",{value:"texto",children:"Texto"}),d.jsx("option",{value:"audio",children:"Áudio"})]})]}),d.jsxs("div",{className:"md:col-span-2",children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Template"}),d.jsx("select",{value:b,onChange:N=>x(N.target.value),className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none",children:Object.keys(s).map(N=>d.jsxs("option",{value:N,children:[N==="texto"?"Texto":"Áudio"," — ",s[N].slice(0,40),"..."]},N))})]})]}),d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center justify-between mb-2",children:[d.jsxs("label",{className:"text-xs font-medium text-gray-500",children:["Leads destinatários — ",g.size," selecionado(s)"]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs("select",{value:S,onChange:N=>_(N.target.value),className:"text-xs border border-gray-200 rounded-lg px-2 py-1.5 bg-white",children:[d.jsx("option",{value:"todas",children:"Todas as etapas"}),_s.map(N=>d.jsx("option",{value:N,children:ys[N]},N))]}),d.jsx("button",{onClick:E,className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:"Selecionar todos"})]})]}),d.jsxs("div",{className:"max-h-52 overflow-y-auto border border-gray-100 rounded-lg divide-y divide-gray-50",children:[k.map(N=>d.jsxs("label",{className:"flex items-center gap-3 px-3 py-2.5 text-sm cursor-pointer hover:bg-indigo-50/50",children:[d.jsx("input",{type:"checkbox",checked:g.has(N.id),onChange:()=>j(N.id),className:"w-4 h-4 accent-indigo-500"}),d.jsx("span",{className:"text-gray-700 flex-1 truncate",children:N.nome}),d.jsx("span",{className:"text-xs text-gray-400",children:N.telefone||N.email||"sem contato"})]},N.id)),k.length===0&&d.jsx("p",{className:"px-3 py-6 text-center text-xs text-gray-400",children:"Nenhum lead nesta etapa."})]})]}),d.jsx(Ut,{titulo:"Como funciona o disparo?",icone:"fas fa-circle-question",children:d.jsxs("p",{className:"text-xs text-gray-500",children:["O disparo é executado pelo ",d.jsx("strong",{children:"OpenOutreach"})," (eracle/OpenOutreach). Se ainda não configurou, a validação acontece na hora de iniciar — configure em ",d.jsx("strong",{children:"Ferramentas → OpenOutreach"}),"."]})}),d.jsxs("div",{className:"flex justify-end gap-3 pt-1",children:[d.jsx("button",{onClick:()=>o(!1),className:"px-4 py-2.5 text-sm font-medium text-gray-600 bg-white border border-gray-200 rounded-lg hover:bg-gray-50",children:"Cancelar"}),d.jsxs("button",{onClick:P,className:"px-6 py-2.5 text-sm font-medium text-white bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg hover:opacity-90",children:[d.jsx("i",{className:"fas fa-plus mr-2"})," Criar campanha"]})]})]})}),d.jsx(hn,{aberto:!!a,onFechar:()=>l(null),titulo:`Eventos — ${(a==null?void 0:a.nome)??""}`,icone:"fas fa-list",largura:"lg",children:a&&d.jsxs("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:[a.eventos.length===0&&d.jsx("p",{className:"text-sm text-gray-400 text-center py-8",children:"Nenhum evento ainda — inicie a campanha para gerar disparos."}),a.eventos.slice().reverse().map((N,I)=>{var W;return d.jsxs("div",{className:"flex items-start gap-3 text-sm border-b border-gray-50 pb-2",children:[d.jsx("i",{className:H("mt-1 text-xs",N.status==="enviado"?"fas fa-circle-check text-green-500":"fas fa-circle-xmark text-red-500")}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx("p",{className:"text-gray-700 truncate",children:((W=e.find(V=>V.id===N.lead_id))==null?void 0:W.nome)??N.lead_id}),N.mensagem&&d.jsx("p",{className:"text-xs text-gray-400 truncate",children:N.mensagem})]}),d.jsx("span",{className:"text-xs text-gray-300 shrink-0",children:_d(N.momento)})]},I)})]})})]})}function Q2(t){return t==="audio"?"audio":"texto"}const K2=[{id:"maps",rotulo:"Google Maps",icone:"fas fa-map-marked-alt"},{id:"instagram",rotulo:"Instagram",icone:"fab fa-instagram"},{id:"cnpj",rotulo:"CNPJ",icone:"fas fa-building"}];function Y2(){const[t,e]=uy(),n=t.get("tab")||"maps";return d.jsxs("div",{className:"space-y-6",children:[d.jsx("div",{className:"flex gap-2",children:K2.map(s=>d.jsxs("button",{onClick:()=>e({tab:s.id}),className:H("px-5 py-2.5 text-sm font-medium rounded-lg transition",n===s.id?"bg-[#1e1b4b] text-white shadow-sm":"bg-white text-gray-600 border border-gray-200 hover:bg-gray-50"),children:[d.jsx("i",{className:H(s.icone,"mr-2")}),s.rotulo]},s.id))}),n==="maps"&&d.jsx(q2,{}),n==="instagram"&&d.jsx(G2,{}),n==="cnpj"&&d.jsx(J2,{})]})}function oh({resultados:t,onImportar:e,importando:n}){const[s,r]=w.useState(()=>new Set(t.leads.map((a,l)=>l))),i=a=>r(l=>{const c=new Set(l);return c.has(a)?c.delete(a):c.add(a),c}),o=s.size===t.leads.length;return d.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-100 bg-gray-50/50",children:[d.jsxs("p",{className:"text-sm font-medium text-gray-700",children:[t.leads.length," resultado(s) — ",s.size," selecionado(s)"]}),d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("button",{onClick:()=>r(o?new Set:new Set(t.leads.map((a,l)=>l))),className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:o?"Limpar seleção":"Selecionar todos"}),d.jsxs("button",{onClick:()=>e(t.leads.filter((a,l)=>s.has(l))),disabled:s.size===0||n,className:"px-5 py-2 text-xs font-medium text-white bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg hover:opacity-90 disabled:opacity-50",children:[d.jsx("i",{className:"fas fa-file-import mr-1"})," ",n?"Importando...":`Importar ${s.size}`]})]})]}),d.jsx("div",{className:"overflow-x-auto max-h-[420px] overflow-y-auto",children:d.jsxs("table",{className:"w-full text-sm",children:[d.jsx("thead",{className:"sticky top-0",children:d.jsxs("tr",{className:"text-left text-xs text-gray-500 uppercase border-b border-gray-100 bg-white",children:[d.jsx("th",{className:"px-4 py-2 w-8"}),d.jsx("th",{className:"px-4 py-2 font-semibold",children:"Nome / Empresa"}),d.jsx("th",{className:"px-4 py-2 font-semibold",children:"Contato"}),d.jsx("th",{className:"px-4 py-2 font-semibold",children:"Cidade"}),d.jsx("th",{className:"px-4 py-2 font-semibold",children:"Detalhes"})]})}),d.jsx("tbody",{children:t.leads.map((a,l)=>d.jsxs("tr",{className:"border-b border-gray-50 hover:bg-indigo-50/40",children:[d.jsx("td",{className:"px-4 py-2",children:d.jsx("input",{type:"checkbox",checked:s.has(l),onChange:()=>i(l),className:"w-4 h-4 accent-indigo-500"})}),d.jsx("td",{className:"px-4 py-2 text-gray-800",children:a.nome||a.empresa||"—"}),d.jsxs("td",{className:"px-4 py-2 text-gray-600",children:[d.jsx("p",{children:Af(a.telefone)}),d.jsx("p",{className:"text-xs text-gray-400",children:a.email||"sem e-mail"})]}),d.jsx("td",{className:"px-4 py-2 text-gray-500 text-xs",children:a.cidade||"—"}),d.jsx("td",{className:"px-4 py-2 text-xs text-gray-400",children:X2(a)})]},l))})]})})]})}function X2(t){const e=t.extras;if(!e)return"—";const n=[];return e.seguidores!==void 0&&n.push(`${e.seguidores} seguidores`),e.avaliacao!==void 0&&n.push(`★ ${e.avaliacao}`),e.qtd_avaliacoes!==void 0&&n.push(`(${e.qtd_avaliacoes} avaliações)`),n.join(" · ")||"—"}function q2(){const{toast:t}=Yt(),[e,n]=w.useState(""),[s,r]=w.useState(""),[i,o]=w.useState(100),[a,l]=w.useState(null),[c,u]=w.useState(!1),[f,h]=w.useState(!1),[p,y]=w.useState(null);w.useEffect(()=>{U.config.obter().then(y).catch(()=>{})},[]);const m=async()=>{if(e.trim().length<2||s.trim().length<2){t("erro",'Preencha a palavra-chave e a localização (ex.: "dentista", "São Paulo").');return}u(!0),l(null);try{const g=await U.extrair.googleMaps({palavra_chave:e.trim(),localizacao:s.trim(),max_resultados:i});l(g),t("sucesso",`${g.leads.length} leads extraídos — revise e importe.`)}catch(g){t("erro",g instanceof Error?g.message:"Falha na extração.")}finally{u(!1)}},b=async g=>{h(!0);try{const v=await U.leads.importar(g);t("sucesso",`${v.importados.length} importados, ${v.duplicados.length} duplicados ignorados.`),l(null)}catch(v){t("erro",v instanceof Error?v.message:"Falha ao importar.")}finally{h(!1)}},x=!!(p!=null&&p.extratores.google_maps_cli);return d.jsxs("div",{className:"space-y-5",children:[d.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("p",{className:"text-sm text-gray-500",children:"Busque empresas por palavra-chave e localização (dados públicos do Google Maps)."}),d.jsx(fn,{status:x?"ativo":"inativo",rotulo:x?"Scraper configurado":"Scraper não configurado"})]}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[d.jsxs("div",{className:"md:col-span-2",children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Palavra-chave *"}),d.jsx("input",{value:e,onChange:g=>n(g.target.value),placeholder:"Ex.: dentista, barbearia, academia...",className:"w-full px-3 py-2.5 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"})]}),d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Localização *"}),d.jsx("input",{value:s,onChange:g=>r(g.target.value),placeholder:"Ex.: São Paulo, SP",className:"w-full px-3 py-2.5 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"})]}),d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Máx. resultados"}),d.jsx("input",{type:"number",min:1,max:500,value:i,onChange:g=>o(Number(g.target.value)||100),className:"w-full px-3 py-2.5 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"})]})]}),d.jsxs("button",{onClick:m,disabled:c,className:"w-full md:w-auto px-8 py-3 text-sm font-medium text-white bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg hover:opacity-90 transition disabled:opacity-60",children:[d.jsx("i",{className:H("fas fa-magnifying-glass mr-2",c&&"fa-spin")}),c?"Extraindo leads...":"Extrair Leads"]}),d.jsx(Ut,{titulo:"Como instalar o Google Maps Scraper",icone:"fas fa-circle-question",children:d.jsxs("ol",{className:"text-xs text-gray-500 space-y-1 list-decimal pl-4",children:[d.jsxs("li",{children:["Instale o scraper:"," ",d.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"github.com/gosom/google-maps-scraper"})]}),d.jsxs("li",{children:["Compile (Go) e informe o caminho do binário em ",d.jsx("strong",{children:"Ferramentas → Extratores"}),"."]}),d.jsx("li",{children:"As flags do comando são ajustáveis no template de argumentos em Ferramentas."})]})})]}),a&&d.jsx(oh,{resultados:a,onImportar:b,importando:f})]})}function G2(){const{toast:t}=Yt(),[e,n]=w.useState(""),[s,r]=w.useState(null),[i,o]=w.useState(!1),[a,l]=w.useState(!1),[c,u]=w.useState(null);w.useEffect(()=>{U.config.obter().then(u).catch(()=>{})},[]);const f=async()=>{if(!e.includes("instagram.com")){t("erro","Informe a URL do perfil (ex.: https://instagram.com/perfil).");return}o(!0),r(null);try{const y=await U.extrair.instagram(e.trim());r(y),t("sucesso","Dados extraídos — revise e importe.")}catch(y){t("erro",y instanceof Error?y.message:"Falha na extração.")}finally{o(!1)}},h=async y=>{l(!0);try{const m=await U.leads.importar(y);t("sucesso",`${m.importados.length} importados, ${m.duplicados.length} duplicados ignorados.`),r(null)}catch(m){t("erro",m instanceof Error?m.message:"Falha ao importar.")}finally{l(!1)}},p=!!(c!=null&&c.extratores.igmapper_cli);return d.jsxs("div",{className:"space-y-5",children:[d.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("p",{className:"text-sm text-gray-500",children:"Extraia contatos públicos de um perfil do Instagram."}),d.jsx(fn,{status:p?"ativo":"inativo",rotulo:p?"igmapper configurado":"igmapper não configurado"})]}),d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:d.jsxs("div",{className:"md:col-span-3",children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"URL do perfil *"}),d.jsx("input",{value:e,onChange:y=>n(y.target.value),placeholder:"https://www.instagram.com/perfil_do_negocio/",className:"w-full px-3 py-2.5 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"})]})}),d.jsxs("button",{onClick:f,disabled:i,className:"w-full md:w-auto px-8 py-3 text-sm font-medium text-white bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg hover:opacity-90 transition disabled:opacity-60",children:[d.jsx("i",{className:H("fab fa-instagram mr-2",i&&"fa-spin")}),i?"Extraindo...":"Extrair do Instagram"]}),d.jsx(Ut,{titulo:"Como instalar o igmapper",icone:"fas fa-circle-question",children:d.jsxs("ol",{className:"text-xs text-gray-500 space-y-1 list-decimal pl-4",children:[d.jsxs("li",{children:["Instale: ",d.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"github.com/lucasoal/igmapper"})]}),d.jsxs("li",{children:["Informe o caminho do CLI em ",d.jsx("strong",{children:"Ferramentas → Extratores"}),"."]})]})})]}),s&&d.jsx(oh,{resultados:s,onImportar:h,importando:a})]})}function J2(){const{toast:t}=Yt(),[e,n]=w.useState("cnpj"),[s,r]=w.useState(""),[i,o]=w.useState(""),[a,l]=w.useState("SP"),[c,u]=w.useState(20),[f,h]=w.useState(null),[p,y]=w.useState(!1),[m,b]=w.useState(!1),x=w.useCallback(async()=>{y(!0),h(null);try{if(e==="cnpj"){const S=await U.extrair.cnpj(s.trim());h({leads:[S]}),t("sucesso","CNPJ localizado — revise e importe.")}else{const S=await U.extrair.cnpjBusca({cnae:i.trim(),uf:a.trim(),quantidade:c});h(S),t("sucesso",`${S.leads.length} empresas encontradas via ${S.provedor}.`)}}catch(S){t("erro",S instanceof Error?S.message:"Falha na consulta.")}finally{y(!1)}},[e,s,i,a,c,t]),g=async S=>{b(!0);try{const _=await U.leads.importar(S);t("sucesso",`${_.importados.length} importados, ${_.duplicados.length} duplicados ignorados.`),h(null)}catch(_){t("erro",_ instanceof Error?_.message:"Falha ao importar.")}finally{b(!1)}},v=w.useMemo(()=>["AC","AL","AP","AM","BA","CE","DF","ES","GO","MA","MT","MS","MG","PA","PB","PR","PE","PI","RJ","RN","RS","RO","RR","SC","SP","SE","TO"],[]);return d.jsxs("div",{className:"space-y-5",children:[d.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-4",children:[d.jsxs("div",{className:"flex gap-2",children:[d.jsx("button",{onClick:()=>n("cnpj"),className:H("px-4 py-2 text-xs font-medium rounded-lg transition",e==="cnpj"?"bg-indigo-100 text-indigo-700":"text-gray-500 hover:bg-gray-50"),children:"Consulta por CNPJ"}),d.jsx("button",{onClick:()=>n("cnae"),className:H("px-4 py-2 text-xs font-medium rounded-lg transition",e==="cnae"?"bg-indigo-100 text-indigo-700":"text-gray-500 hover:bg-gray-50"),children:"Busca por CNAE + UF"})]}),e==="cnpj"?d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:d.jsxs("div",{className:"md:col-span-2",children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"CNPJ *"}),d.jsx("input",{value:s,onChange:S=>r(S.target.value),placeholder:"00.000.000/0000-00 (a BrasilAPI aceita com ou sem pontuação)",className:"w-full px-3 py-2.5 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"})]})}):d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"CNAE (código) *"}),d.jsx("input",{value:i,onChange:S=>o(S.target.value),placeholder:"Ex.: 6202-3/01 (desenvolvimento de software)",className:"w-full px-3 py-2.5 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"})]}),d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"UF *"}),d.jsx("select",{value:a,onChange:S=>l(S.target.value),className:"w-full px-3 py-2.5 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none",children:v.map(S=>d.jsx("option",{children:S},S))})]}),d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Quantidade"}),d.jsx("input",{type:"number",min:1,max:100,value:c,onChange:S=>u(Number(S.target.value)||20),className:"w-full px-3 py-2.5 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"})]})]}),d.jsxs("button",{onClick:x,disabled:p,className:"w-full md:w-auto px-8 py-3 text-sm font-medium text-white bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg hover:opacity-90 transition disabled:opacity-60",children:[d.jsx("i",{className:H("fas fa-building mr-2",p&&"fa-spin")}),p?"Consultando...":e==="cnpj"?"Consultar CNPJ":"Buscar empresas"]}),d.jsx(Ut,{titulo:"Fontes e scraping profundo",icone:"fas fa-circle-question",children:d.jsxs("ul",{className:"text-xs text-gray-500 space-y-1 list-disc pl-4",children:[d.jsxs("li",{children:["Consulta direta usa a ",d.jsx("strong",{children:"BrasilAPI"})," (brasilapi.com.br) — sem chave."]}),d.jsxs("li",{children:["A busca por CNAE/UF usa um ",d.jsx("strong",{children:"provedor configurável"})," (padrão: OpenCNPJ) — ajuste a URL em"," ",d.jsx("strong",{children:"Ferramentas → Extratores"})," conforme o provedor que você usa."]}),d.jsxs("li",{children:["Scraping profundo de contatos no site da empresa via ",d.jsx("strong",{children:"Scrapling"})," (D4Vinci/Scrapling), se configurado."]})]})})]}),f&&d.jsx(oh,{resultados:f,onImportar:g,importando:m})]})}function Z2(){const[t,e]=uy(),n=t.get("tab")||"disparo";return d.jsxs("div",{className:"space-y-6",children:[d.jsx("div",{className:"flex gap-2",children:[{id:"disparo",rotulo:"Agente de Disparo",icone:"fas fa-paper-plane"},{id:"atendimento",rotulo:"Agente de Atendimento",icone:"fas fa-headset"}].map(s=>d.jsxs("button",{onClick:()=>e({tab:s.id}),className:H("px-5 py-2.5 text-sm font-medium rounded-lg transition",n===s.id?"bg-[#1e1b4b] text-white shadow-sm":"bg-white text-gray-600 border border-gray-200 hover:bg-gray-50"),children:[d.jsx("i",{className:H(s.icone,"mr-2")}),s.rotulo]},s.id))}),n==="disparo"?d.jsx(eN,{}):d.jsx(tN,{})]})}function eN(){const{toast:t}=Yt(),[e,n]=w.useState({texto:"",audio:""}),[s,r]=w.useState("LeadMaster"),[i,o]=w.useState(""),[a,l]=w.useState(!1),[c,u]=w.useState(!1),[f,h]=w.useState(null),p=w.useCallback(async()=>{const[b,x]=await Promise.all([U.agentes.templates(),U.config.obter()]);n({texto:b.texto??"",audio:b.audio??""}),r(x.agentes.disparo.minha_empresa??"LeadMaster"),h(x.integracoes.openoutreach)},[]);w.useEffect(()=>{p().catch(b=>t("erro",b.message))},[p,t]);const y=async()=>{u(!0);try{await U.agentes.salvarTemplates(e),await U.config.salvar({agentes:{disparo:{templates:e,minha_empresa:s}}}),t("sucesso","Templates do agente de disparo salvos."),await p()}catch(b){t("erro",b instanceof Error?b.message:"Falha ao salvar templates.")}finally{u(!1)}},m=async()=>{try{const b=await U.agentes.testarTemplate(e.texto);o(b.renderizado),l(!0)}catch(b){t("erro",b instanceof Error?b.message:"Falha ao renderizar template.")}};return d.jsxs("div",{className:"space-y-5 max-w-3xl",children:[d.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h3",{className:"text-sm font-semibold text-gray-800",children:"Templates de mensagem"}),d.jsx(fn,{status:f!=null&&f.url&&f.enabled!==!1?"ativo":"inativo",rotulo:f!=null&&f.url&&f.enabled!==!1?"OpenOutreach configurado":"OpenOutreach não configurado"})]}),d.jsxs("p",{className:"text-xs text-gray-500",children:["Variáveis disponíveis: ",d.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"{{nome}}"}),","," ",d.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"{{primeiro_nome}}"}),","," ",d.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"{{empresa}}"}),","," ",d.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"{{cidade}}"}),","," ",d.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"{{minha_empresa}}"}),"."]}),d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Template — texto"}),d.jsx("textarea",{value:e.texto,onChange:b=>n({...e,texto:b.target.value}),rows:4,className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"})]}),d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Template — áudio (texto para gravação)"}),d.jsx("textarea",{value:e.audio,onChange:b=>n({...e,audio:b.target.value}),rows:4,className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"})]}),d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Nome da sua empresa"}),d.jsx("input",{value:s,onChange:b=>r(b.target.value),className:"w-full max-w-xs px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"})]}),d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("button",{onClick:y,disabled:c,className:"px-6 py-2.5 text-sm font-medium text-white bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg hover:opacity-90 disabled:opacity-60",children:[d.jsx("i",{className:"fas fa-save mr-2"})," Salvar templates"]}),d.jsxs("button",{onClick:m,className:"px-4 py-2.5 text-sm font-medium text-indigo-600 bg-indigo-50 border border-indigo-200 rounded-lg hover:bg-indigo-100",children:[d.jsx("i",{className:"fas fa-vial mr-2"})," Testar com lead de exemplo"]})]})]}),d.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 text-sm text-gray-500 space-y-2",children:[d.jsx("p",{className:"font-medium text-gray-700 text-xs uppercase tracking-wide",children:"Como funciona"}),d.jsxs("p",{children:["O envio em massa é executado pelo ",d.jsx("strong",{children:"OpenOutreach"})," (eracle/OpenOutreach). As campanhas ficam na página ",d.jsx("strong",{children:"Disparos"}),"; a validação da integração acontece na hora de iniciar a campanha — sem travas de pré-registro."]})]}),d.jsx(hn,{aberto:a,onFechar:()=>l(!1),titulo:"Pré-visualização do template",icone:"fas fa-comment-dots",children:d.jsx("div",{className:"bg-gray-50 border border-gray-100 rounded-lg p-4 text-sm text-gray-700 whitespace-pre-wrap",children:i})})]})}function tN(){const{toast:t}=Yt(),[e,n]=w.useState("texto"),[s,r]=w.useState(""),[i,o]=w.useState([{role:"assistant",content:"Olá! Sou o assistente de atendimento do LeadMaster. Como posso ajudar?"}]),[a,l]=w.useState(""),[c,u]=w.useState(!1),f=w.useCallback(async()=>{const y=await U.config.obter();n(y.agentes.atendimento.modo==="voz"?"voz":"texto"),r(y.integracoes.pipecat.url||"")},[]);w.useEffect(()=>{f().catch(y=>t("erro",y.message))},[f,t]);const h=async y=>{n(y);try{await U.config.salvar({agentes:{atendimento:{modo:y}},integracoes:{pipecat:{url:s}}}),t("sucesso",`Modo de atendimento: ${y==="voz"?"voz (pipecat)":"texto (LLM)"}.`)}catch(m){t("erro",m instanceof Error?m.message:"Falha ao salvar modo.")}},p=async()=>{const y=a.trim();if(!y)return;const m=[...i,{role:"user",content:y}];o(m),l(""),u(!0);try{const b=await U.agentes.chat(m.map(x=>({role:x.role==="assistant"?"assistant":"user",content:x.content})));b.ok&&b.resposta?o([...m,{role:"assistant",content:b.resposta}]):(o([...m,{role:"assistant",content:`⚠ ${b.mensagem??"Sem resposta."}`}]),t("erro",b.mensagem??"Sem resposta do agente."))}catch(b){t("erro",b instanceof Error?b.message:"Falha no chat.")}finally{u(!1)}};return d.jsxs("div",{className:"space-y-5 max-w-3xl",children:[d.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-4",children:[d.jsx("h3",{className:"text-sm font-semibold text-gray-800",children:"Modo do agente de atendimento"}),d.jsx("div",{className:"flex gap-3",children:[{id:"texto",rotulo:"Texto (LLM)",icone:"fas fa-keyboard",descricao:"Chat via LLM configurado"},{id:"voz",rotulo:"Voz (pipecat)",icone:"fas fa-microphone",descricao:"Atendimento por voz"}].map(y=>d.jsxs("button",{onClick:()=>h(y.id),className:H("flex-1 px-4 py-3 rounded-lg border text-left transition",e===y.id?"bg-indigo-50 border-indigo-400":"bg-white border-gray-200 hover:bg-gray-50"),children:[d.jsxs("p",{className:H("text-sm font-medium flex items-center gap-2",e===y.id?"text-indigo-700":"text-gray-600"),children:[d.jsx("i",{className:y.icone})," ",y.rotulo]}),d.jsx("p",{className:"text-xs text-gray-400 mt-1",children:y.descricao})]},y.id))}),e==="voz"&&d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"URL do serviço pipecat"}),d.jsx("input",{value:s,onChange:y=>r(y.target.value),onBlur:()=>h("voz"),placeholder:"http://localhost:5000",className:"w-full max-w-md px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"})]})]}),d.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6",children:[d.jsx("h3",{className:"text-sm font-semibold text-gray-800 mb-3",children:"Testar conversa"}),d.jsxs("div",{className:"space-y-3 max-h-80 overflow-y-auto mb-4",children:[i.map((y,m)=>d.jsx("div",{className:H("flex",y.role==="user"?"justify-end":"justify-start"),children:d.jsx("div",{className:H("max-w-[80%] px-4 py-2.5 rounded-2xl text-sm",y.role==="user"?"bg-indigo-500 text-white rounded-br-sm":"bg-gray-100 text-gray-700 rounded-bl-sm"),children:y.content})},m)),c&&d.jsxs("div",{className:"text-xs text-gray-400 flex items-center gap-2",children:[d.jsx("i",{className:"fas fa-spinner fa-spin"})," pensando..."]})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("input",{value:a,onChange:y=>l(y.target.value),onKeyDown:y=>y.key==="Enter"&&p(),placeholder:"Digite uma mensagem do cliente para testar...",className:"flex-1 px-3 py-2.5 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"}),d.jsx("button",{onClick:p,disabled:c,className:"px-5 py-2.5 text-sm font-medium text-white bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg hover:opacity-90 disabled:opacity-60",children:d.jsx("i",{className:"fas fa-paper-plane"})})]})]})]})}function nN({onConfigSalva:t}){const{toast:e}=Yt(),[n,s]=w.useState(null),[r,i]=w.useState(!1),[o,a]=w.useState(""),l=w.useCallback(async()=>{const h=await U.config.obter();s(h)},[]);if(w.useEffect(()=>{l().catch(h=>e("erro",h.message))},[l,e]),!n)return d.jsx("div",{className:"text-center text-gray-400 py-16",children:d.jsx("i",{className:"fas fa-spinner fa-spin text-2xl"})});const c=h=>{s(p=>{if(!p)return p;const y=JSON.parse(JSON.stringify(p));return h(y),y})},u=async()=>{i(!0);try{const h=await U.config.salvar(n);s(h),t==null||t(h),e("sucesso","Configurações salvas localmente (config.json).")}catch(h){e("erro",h instanceof Error?h.message:"Falha ao salvar configurações.")}finally{i(!1)}},f=async()=>{a("llm");try{const h=await U.config.testarLlm();e(h.ok?"sucesso":"erro",h.ok?`LLM respondeu: ${h.resposta}`:h.mensagem??"Falha no teste.")}finally{a("")}};return d.jsxs("div",{className:"space-y-6 max-w-4xl",children:[d.jsxs(La,{titulo:"LLM (agentes de IA)",icone:"fas fa-brain",children:[d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[d.jsx(Zt,{rotulo:"Base URL",valor:n.llm.base_url,onChange:h=>c(p=>{p.llm.base_url=h}),placeholder:"https://api.openai.com/v1"}),d.jsx(Zt,{rotulo:"Modelo",valor:n.llm.modelo,onChange:h=>c(p=>{p.llm.modelo=h}),placeholder:"gpt-4o-mini"}),d.jsx(rN,{rotulo:"API Key",configurado:!!n.llm.api_key_configurado,onChange:h=>c(p=>{p.llm.api_key=h})})]}),d.jsx(iN,{rotulo:"Testar conexão LLM",carregando:o==="llm",onClick:f})]}),d.jsxs(La,{titulo:"Extratores de leads",icone:"fas fa-magnifying-glass-location",children:[d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[d.jsx(Zt,{rotulo:"Google Maps Scraper — binário",valor:n.extratores.google_maps_cli,onChange:h=>c(p=>{p.extratores.google_maps_cli=h}),placeholder:"C:\\ferramentas\\google-maps-scraper.exe"}),d.jsx(Zt,{rotulo:"igmapper — binário",valor:n.extratores.igmapper_cli,onChange:h=>c(p=>{p.extratores.igmapper_cli=h}),placeholder:"Caminho do CLI igmapper"})]}),d.jsxs(Ut,{titulo:"Argumentos dos scrapers (templates)",icone:"fas fa-terminal",children:[d.jsx(hm,{rotulo:"Google Maps — template de argumentos",valor:n.extratores.google_maps_args,onChange:h=>c(p=>{p.extratores.google_maps_args=h}),linhas:2}),d.jsx(hm,{rotulo:"igmapper — template de argumentos",valor:n.extratores.igmapper_args,onChange:h=>c(p=>{p.extratores.igmapper_args=h}),linhas:2})]}),d.jsxs(Ut,{titulo:"CNPJ e Scrapling",icone:"fas fa-building",children:[d.jsx(Zt,{rotulo:"Provedor de busca CNAE/UF — URL",valor:n.extratores.cnpj_provedor_busca,onChange:h=>c(p=>{p.extratores.cnpj_provedor_busca=h}),placeholder:"https://api.opencnpj.org"}),d.jsx(Zt,{rotulo:"Scrapling — binário (scraping profundo)",valor:n.extratores.scrapling_cli,onChange:h=>c(p=>{p.extratores.scrapling_cli=h}),placeholder:"Caminho do CLI Scrapling"})]})]}),d.jsxs(La,{titulo:"Agentes — integrações",icone:"fas fa-robot",children:[d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[d.jsx(Zt,{rotulo:"OpenOutreach — URL",valor:n.integracoes.openoutreach.url,onChange:h=>c(p=>{p.integracoes.openoutreach.url=h}),placeholder:"http://localhost:9090"}),d.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-600 bg-indigo-50 border border-indigo-100 rounded-lg px-3 py-2.5 cursor-pointer h-fit mt-5",children:[d.jsx("input",{type:"checkbox",checked:n.integracoes.openoutreach.enabled,onChange:h=>c(p=>{p.integracoes.openoutreach.enabled=h.target.checked}),className:"w-4 h-4 accent-indigo-500"}),"OpenOutreach ativo"]})]}),d.jsx(Zt,{rotulo:"pipecat — URL (atendimento por voz)",valor:n.integracoes.pipecat.url,onChange:h=>c(p=>{p.integracoes.pipecat.url=h}),placeholder:"http://localhost:5000"})]}),d.jsx(La,{titulo:"Perfil e licença",icone:"fas fa-user",children:d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[d.jsx(Zt,{rotulo:"Seu nome",valor:n.perfil.nome,onChange:h=>c(p=>{p.perfil.nome=h})}),d.jsx(Zt,{rotulo:"Expira em",valor:n.perfil.licenca.expira_em,onChange:h=>c(p=>{p.perfil.licenca.expira_em=h})}),d.jsx(sN,{rotulo:"Dias restantes (vazio = infinito)",valor:n.perfil.licenca.restam_dias??0,onChange:h=>c(p=>{p.perfil.licenca.restam_dias=h>0?h:null})})]})}),d.jsx("div",{className:"flex justify-end",children:d.jsxs("button",{onClick:u,disabled:r,className:"px-8 py-3 text-sm font-medium text-white bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg hover:opacity-90 transition disabled:opacity-60 shadow-sm",children:[d.jsx("i",{className:H("fas fa-save mr-2",r&&"fa-spin")}),r?"Salvando...":"Salvar configurações"]})})]})}function La({titulo:t,icone:e,children:n}){return d.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-4",children:[d.jsxs("h3",{className:"text-sm font-semibold text-gray-800 flex items-center gap-2",children:[d.jsx("i",{className:H(e,"text-indigo-400")})," ",t]}),n]})}function Zt({rotulo:t,valor:e,onChange:n,placeholder:s,tipo:r="text"}){return d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:t}),d.jsx("input",{type:r,value:e,onChange:i=>n(i.target.value),placeholder:s,className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"})]})}function sN({rotulo:t,valor:e,onChange:n}){return d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:t}),d.jsx("input",{type:"number",value:e??0,onChange:s=>n(Number(s.target.value)||0),className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"})]})}function rN({rotulo:t,configurado:e,onChange:n}){return d.jsxs("div",{children:[d.jsxs("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:[t," ",e&&d.jsx("span",{className:"text-green-600",children:"• configurado"})]}),d.jsx("input",{type:"password",onChange:s=>n(s.target.value),placeholder:e?"•••••••• (deixe vazio para manter)":"cole a chave aqui",className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"})]})}function hm({rotulo:t,valor:e,onChange:n,linhas:s=3}){return d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:t}),d.jsx("textarea",{value:e,onChange:r=>n(r.target.value),rows:s,className:"w-full px-3 py-2 text-xs font-mono border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"})]})}function iN({rotulo:t,onClick:e,carregando:n}){return d.jsxs("button",{onClick:e,disabled:n,className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium disabled:opacity-50",children:[d.jsx("i",{className:H("fas fa-vial-circle-check mr-1",n&&"fa-spin")})," ",t]})}const oN=[{id:"lead.criado",rotulo:"Lead criado"},{id:"lead.etapa",rotulo:"Lead mudou de etapa"},{id:"campanha.concluida",rotulo:"Campanha concluída"}];function aN(){const{toast:t}=Yt(),[e,n]=w.useState(""),[s,r]=w.useState(new Set),[i,o]=w.useState(""),[a,l]=w.useState(!1),[c,u]=w.useState(!1),f=w.useCallback(async()=>{const m=await U.webhook.obter();n(m.url),r(new Set(m.eventos))},[]);w.useEffect(()=>{f().catch(m=>t("erro",m.message))},[f,t]);const h=m=>r(b=>{const x=new Set(b);return x.has(m)?x.delete(m):x.add(m),x}),p=async()=>{u(!0);try{await U.webhook.salvar({url:e.trim(),eventos:[...s]}),t("sucesso","Webhook salvo.")}catch(m){t("erro",m instanceof Error?m.message:"Falha ao salvar webhook.")}finally{u(!1)}},y=async()=>{if(!e.trim()){t("erro","Informe a URL do webhook antes de testar.");return}try{const m=await U.webhook.testar(e.trim());m.ok?o(`✅ HTTP ${m.status_http} — o endpoint recebeu o evento de teste.
|
|
89
|
-
|
|
90
|
-
${m.resposta??""}`):o(`❌ ${m.mensagem??"Falha no teste."}`),l(!0)}catch(m){t("erro",m instanceof Error?m.message:"Falha no teste.")}};return d.jsxs("div",{className:"space-y-6 max-w-3xl",children:[d.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-5",children:[d.jsx("p",{className:"text-sm text-gray-500",children:"Receba eventos do LeadMaster (lead criado, mudança de etapa, campanha concluída) em qualquer endpoint local ou externo — útil para integrar com automações (n8n, Make, Zapier etc.)."}),d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"URL do webhook"}),d.jsx("input",{value:e,onChange:m=>n(m.target.value),placeholder:"https://seu-endpoint.com/webhook",className:"w-full px-3 py-2.5 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"})]}),d.jsxs("div",{children:[d.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-2",children:"Eventos enviados"}),d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:oN.map(m=>d.jsxs("label",{className:H("flex items-center gap-3 px-4 py-3 rounded-lg border text-sm cursor-pointer transition",s.has(m.id)?"bg-indigo-50 border-indigo-300 text-indigo-700":"bg-white border-gray-200 text-gray-500 hover:bg-gray-50"),children:[d.jsx("input",{type:"checkbox",checked:s.has(m.id),onChange:()=>h(m.id),className:"w-4 h-4 accent-indigo-500"}),m.rotulo,d.jsx("code",{className:"text-[10px] text-gray-400 ml-auto",children:m.id})]},m.id))})]}),d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("button",{onClick:p,disabled:c,className:"px-6 py-2.5 text-sm font-medium text-white bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg hover:opacity-90 disabled:opacity-60",children:[d.jsx("i",{className:"fas fa-save mr-2"})," Salvar"]}),d.jsxs("button",{onClick:y,className:"px-4 py-2.5 text-sm font-medium text-indigo-600 bg-indigo-50 border border-indigo-200 rounded-lg hover:bg-indigo-100",children:[d.jsx("i",{className:"fas fa-paper-plane mr-2"})," Enviar evento de teste"]})]})]}),d.jsx(hn,{aberto:a,onFechar:()=>l(!1),titulo:"Resultado do teste",icone:"fas fa-satellite-dish",children:d.jsx("pre",{className:"text-xs text-gray-600 bg-gray-50 rounded-lg p-4 whitespace-pre-wrap",children:i})})]})}function lN(){const{toast:t}=Yt(),[e,n]=w.useState(null),[s,r]=w.useState(!1),i=async()=>{r(!0);try{n(await U.doctor()),t("sucesso","Diagnóstico concluído.")}catch(o){t("erro",o instanceof Error?o.message:"Falha no diagnóstico.")}finally{r(!1)}};return w.useEffect(()=>{i()},[]),d.jsxs("div",{className:"space-y-6 max-w-3xl",children:[d.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("h3",{className:"text-sm font-semibold text-gray-800 flex items-center gap-2",children:[d.jsx("i",{className:"fas fa-heart-pulse text-indigo-400"})," Diagnóstico do ambiente"]}),d.jsxs("button",{onClick:i,disabled:s,className:"px-4 py-2 text-xs font-medium text-white bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg hover:opacity-90 disabled:opacity-60",children:[d.jsx("i",{className:H("fas fa-rotate mr-1",s&&"fa-spin")})," Executar novamente"]})]}),e&&d.jsxs("div",{className:"mt-4 space-y-2 text-sm",children:[d.jsx(Ai,{rotulo:"Versão do LeadMaster",valor:e.versao}),d.jsx(Ai,{rotulo:"Python",valor:e.python}),d.jsx(Ai,{rotulo:"Sistema",valor:e.sistema}),d.jsx(Ai,{rotulo:"Interface construída (dist)",valor:e.dist_frontend?"presente":"ausente (modo dev)"}),d.jsx(Ai,{rotulo:"Pasta de dados",valor:e.storage}),d.jsx("div",{className:"pt-2 flex flex-wrap gap-2",children:Object.entries(e.integracoes).map(([o,a])=>d.jsx(fn,{status:a?"ativo":"inativo",rotulo:`${cN(o)}: ${a?"ativo":"inativo"}`},o))})]})]}),d.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6",children:[d.jsxs("h3",{className:"text-sm font-semibold text-gray-800 mb-3",children:[d.jsx("i",{className:"fas fa-circle-question text-indigo-400 mr-2"})," Perguntas frequentes"]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Ut,{titulo:"Meus dados ficam na nuvem?",icone:"fas fa-cloud",children:"Não. O LeadMaster é 100% local: todos os dados (leads, campanhas e configuração) ficam em arquivos JSON na sua pasta de dados."}),d.jsx(Ut,{titulo:"Como turbinar os agentes com IA?",icone:"fas fa-brain",children:"Em Ferramentas → LLM, informe base URL, modelo e API key de qualquer API OpenAI-compatível. O agente de CRM passa a enriquecer e sugerir com mais contexto, e o de atendimento conversa por texto. Sem LLM, as heurísticas locais continuam funcionando."}),d.jsx(Ut,{titulo:"Como funcionam os disparos?",icone:"fas fa-paper-plane",children:"As campanhas de Disparos usam o OpenOutreach (eracle/OpenOutreach). Configure a URL em Ferramentas → Agentes — a validação acontece só na hora de iniciar a campanha."}),d.jsx(Ut,{titulo:"Onde reporto problemas?",icone:"fas fa-bug",children:"Abra uma issue em github.com/DanHachuel/LeadMaster ou use a página de diagnóstico acima ao pedir ajuda — ela resume todo o ambiente."})]})]}),d.jsxs("div",{className:"bg-[#1e1b4b] text-white rounded-xl p-6 flex items-center justify-between flex-wrap gap-4",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-semibold",children:"LeadMaster — SaaS local de prospecção e automação de conteúdo"}),d.jsx("p",{className:"text-xs text-gray-300 mt-1",children:"Instalável via npx · dados 100% locais · sem mensalidade de nuvem"})]}),d.jsxs("a",{href:"https://github.com/DanHachuel/LeadMaster",target:"_blank",rel:"noreferrer",className:"px-4 py-2.5 text-sm font-medium bg-white/10 hover:bg-white/20 rounded-lg transition",children:[d.jsx("i",{className:"fab fa-github mr-2"})," Repositório"]})]})]})}function Ai({rotulo:t,valor:e}){return d.jsxs("div",{className:"flex items-center justify-between border-b border-gray-50 pb-2",children:[d.jsx("span",{className:"text-xs text-gray-500",children:t}),d.jsx("span",{className:"text-xs font-medium text-gray-700 text-right break-all max-w-[60%]",children:e})]})}function cN(t){return{llm_configurado:"LLM",openoutreach:"OpenOutreach",pipecat:"pipecat"}[t]??t}const uN={"/":"Painel","/leads":"Leads","/agentes":"Agentes","/ferramentas":"Ferramentas","/extratores":"Extratores de Leads","/disparos":"Disparos","/crm":"CRM — Kanban","/webhook":"Webhook","/suporte":"Suporte"};function dN(){const[t,e]=w.useState(null),[n,s]=w.useState(!1),[r,i]=w.useState(!1),o=w.useCallback(async()=>{try{e(await U.config.obter())}catch{}},[]);return w.useEffect(()=>{o()},[o]),r?d.jsx("div",{className:"min-h-screen bg-[#1e1b4b] text-white flex items-center justify-center p-8",children:d.jsxs("div",{className:"text-center max-w-md",children:[d.jsx("i",{className:"fas fa-power-off text-4xl text-indigo-300 mb-4 block"}),d.jsx("h1",{className:"text-xl font-bold",children:"LeadMaster encerrado"}),d.jsx("p",{className:"text-sm text-gray-300 mt-3",children:"O servidor local foi desligado com sucesso. Seus dados estão salvos na pasta de dados."}),d.jsxs("p",{className:"text-xs text-gray-400 mt-6",children:["Para voltar, execute: ",d.jsx("code",{className:"bg-white/10 px-2 py-1 rounded",children:"npx --yes @danhachuel/leadmaster"})]})]})}):d.jsx(a_,{children:d.jsxs(B1,{children:[d.jsx(fN,{nomeUsuario:(t==null?void 0:t.perfil.nome)??"...",onSair:()=>s(!0),onConfigSalva:a=>e(a)}),d.jsxs(hn,{aberto:n,onFechar:()=>s(!1),titulo:"Encerrar o LeadMaster",icone:"fas fa-power-off",children:[d.jsx("p",{className:"text-sm text-gray-600",children:"Isso encerra o servidor local (os processos do terminal também fecham). Seus dados permanecem salvos nos arquivos JSON da pasta de dados. Deseja continuar?"}),d.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[d.jsx("button",{onClick:()=>s(!1),className:"px-4 py-2.5 text-sm font-medium text-gray-600 bg-white border border-gray-200 rounded-lg hover:bg-gray-50",children:"Cancelar"}),d.jsxs("button",{onClick:async()=>{s(!1);try{await U.shutdown()}catch{}setTimeout(()=>i(!0),400)},className:"px-6 py-2.5 text-sm font-medium text-white bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg hover:opacity-90",children:[d.jsx("i",{className:"fas fa-power-off mr-2"})," Encerrar"]})]})]})]})})}function fN({nomeUsuario:t,onSair:e,onConfigSalva:n}){const s=Ns(),r=uN[s.pathname]??"LeadMaster";return d.jsxs("div",{className:"bg-gray-100 min-h-screen flex",children:[d.jsx(r_,{onSair:e}),d.jsxs("main",{className:"flex-1 flex flex-col min-w-0",children:[d.jsx(n_,{titulo:r,nomeUsuario:t}),d.jsxs("div",{className:"p-8 space-y-6 overflow-y-auto flex-1",children:[d.jsxs(R1,{children:[d.jsx(en,{path:"/",element:d.jsx(sE,{nomeUsuario:t})}),d.jsx(en,{path:"/leads",element:d.jsx(lE,{})}),d.jsx(en,{path:"/crm",element:d.jsx(H2,{})}),d.jsx(en,{path:"/disparos",element:d.jsx(V2,{})}),d.jsx(en,{path:"/extratores",element:d.jsx(Y2,{})}),d.jsx(en,{path:"/agentes",element:d.jsx(Z2,{})}),d.jsx(en,{path:"/ferramentas",element:d.jsx(nN,{onConfigSalva:n})}),d.jsx(en,{path:"/webhook",element:d.jsx(aN,{})}),d.jsx(en,{path:"/suporte",element:d.jsx(lN,{})})]}),d.jsxs("footer",{className:"flex items-center justify-between text-xs text-gray-400 pt-4 border-t border-gray-200",children:[d.jsx("span",{children:"© 2026 LeadMaster. Todos os direitos reservados."}),d.jsx("span",{children:"Dados 100% locais — sem nuvem"})]})]})]})]})}const hN=new OS({defaultOptions:{queries:{retry:1,staleTime:5e3,refetchOnWindowFocus:!0}}});hu.createRoot(document.getElementById("root")).render(d.jsx(be.StrictMode,{children:d.jsx(oS,{client:hN,children:d.jsx(dN,{})})}));
|