@danhachuel/leadmaster 0.1.12 → 0.1.14

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.
Files changed (24) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/backend/__pycache__/main.cpython-311.pyc +0 -0
  3. package/backend/main.py +47 -0
  4. package/backend/services/__pycache__/__init__.cpython-311.pyc +0 -0
  5. package/backend/services/__pycache__/agents.cpython-311.pyc +0 -0
  6. package/backend/services/__pycache__/crm_agent.cpython-311.pyc +0 -0
  7. package/backend/services/__pycache__/extractors.cpython-311.pyc +0 -0
  8. package/backend/services/__pycache__/flags.cpython-311.pyc +0 -0
  9. package/backend/services/__pycache__/llm.cpython-311.pyc +0 -0
  10. package/backend/services/__pycache__/storage.cpython-311.pyc +0 -0
  11. package/backend/services/extractors.py +68 -1
  12. package/backend/tests/__pycache__/conftest.cpython-311-pytest-8.4.2.pyc +0 -0
  13. package/backend/tests/__pycache__/test_cnpj_extractor.cpython-311-pytest-8.4.2.pyc +0 -0
  14. package/backend/tests/__pycache__/test_crm_routes.cpython-311-pytest-8.4.2.pyc +0 -0
  15. package/backend/tests/__pycache__/test_instagram_extractor.cpython-311-pytest-8.4.2.pyc +0 -0
  16. package/backend/tests/__pycache__/test_launcher_protections.cpython-311-pytest-8.4.2.pyc +0 -0
  17. package/backend/tests/__pycache__/test_maps_extractor.cpython-311-pytest-8.4.2.pyc +0 -0
  18. package/backend/tests/__pycache__/test_process_flags.cpython-311-pytest-8.4.2.pyc +0 -0
  19. package/backend/tests/test_cnpj_extractor.py +64 -0
  20. package/frontend/dist/assets/{index-D6u6-7Rs.css → index-Bf28IekR.css} +1 -1
  21. package/frontend/dist/assets/{index-CLRV7oRl.js → index-DgsUzQ92.js} +18 -18
  22. package/frontend/dist/index.html +2 -2
  23. package/package.json +1 -1
  24. package/scripts/cli.mjs +5 -13
@@ -1,4 +1,4 @@
1
- var $v=Object.defineProperty;var wh=t=>{throw TypeError(t)};var Uv=(t,e,n)=>e in t?$v(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var $=(t,e,n)=>Uv(t,typeof e!="symbol"?e+"":e,n),Oc=(t,e,n)=>e.has(t)||wh("Cannot "+n);var j=(t,e,n)=>(Oc(t,e,"read from private field"),n?n.call(t):e.get(t)),B=(t,e,n)=>e.has(t)?wh("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),T=(t,e,n,s)=>(Oc(t,e,"write to private field"),s?s.call(t,n):e.set(t,n),n),q=(t,e,n)=>(Oc(t,e,"access private method"),n);var ua=(t,e,n,s)=>({set _(r){T(t,e,r,n)},get _(){return j(t,e,s)}});function Wv(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 Hv(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Rm={exports:{}},ec={},Om={exports:{}},X={};/**
1
+ var Bv=Object.defineProperty;var wh=t=>{throw TypeError(t)};var $v=(t,e,n)=>e in t?Bv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var $=(t,e,n)=>$v(t,typeof e!="symbol"?e+"":e,n),Oc=(t,e,n)=>e.has(t)||wh("Cannot "+n);var N=(t,e,n)=>(Oc(t,e,"read from private field"),n?n.call(t):e.get(t)),B=(t,e,n)=>e.has(t)?wh("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),D=(t,e,n,s)=>(Oc(t,e,"write to private field"),s?s.call(t,n):e.set(t,n),n),q=(t,e,n)=>(Oc(t,e,"access private method"),n);var da=(t,e,n,s)=>({set _(r){D(t,e,r,n)},get _(){return N(t,e,s)}});function Uv(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 Wv(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Rm={exports:{}},tc={},Om={exports:{}},X={};/**
2
2
  * @license React
3
3
  * react.production.min.js
4
4
  *
@@ -6,7 +6,7 @@ var $v=Object.defineProperty;var wh=t=>{throw TypeError(t)};var Uv=(t,e,n)=>e in
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Yo=Symbol.for("react.element"),Vv=Symbol.for("react.portal"),Qv=Symbol.for("react.fragment"),Kv=Symbol.for("react.strict_mode"),Yv=Symbol.for("react.profiler"),Xv=Symbol.for("react.provider"),qv=Symbol.for("react.context"),Gv=Symbol.for("react.forward_ref"),Jv=Symbol.for("react.suspense"),Zv=Symbol.for("react.memo"),eb=Symbol.for("react.lazy"),Sh=Symbol.iterator;function tb(t){return t===null||typeof t!="object"?null:(t=Sh&&t[Sh]||t["@@iterator"],typeof t=="function"?t:null)}var Dm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Tm=Object.assign,Lm={};function mi(t,e,n){this.props=t,this.context=e,this.refs=Lm,this.updater=n||Dm}mi.prototype.isReactComponent={};mi.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")};mi.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Am(){}Am.prototype=mi.prototype;function Vd(t,e,n){this.props=t,this.context=e,this.refs=Lm,this.updater=n||Dm}var Qd=Vd.prototype=new Am;Qd.constructor=Vd;Tm(Qd,mi.prototype);Qd.isPureReactComponent=!0;var _h=Array.isArray,Im=Object.prototype.hasOwnProperty,Kd={current:null},Fm={key:!0,ref:!0,__self:!0,__source:!0};function zm(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)Im.call(e,s)&&!Fm.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:Yo,type:t,key:i,ref:o,props:r,_owner:Kd.current}}function nb(t,e){return{$$typeof:Yo,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Yd(t){return typeof t=="object"&&t!==null&&t.$$typeof===Yo}function sb(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var kh=/\/+/g;function Dc(t,e){return typeof t=="object"&&t!==null&&t.key!=null?sb(""+t.key):e.toString(36)}function Va(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 Yo:case Vv:o=!0}}if(o)return o=t,r=r(o),t=s===""?"."+Dc(o,0):s,_h(r)?(n="",t!=null&&(n=t.replace(kh,"$&/")+"/"),Va(r,e,n,"",function(c){return c})):r!=null&&(Yd(r)&&(r=nb(r,n+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(kh,"$&/")+"/")+t)),e.push(r)),1;if(o=0,s=s===""?".":s+":",_h(t))for(var a=0;a<t.length;a++){i=t[a];var l=s+Dc(i,a);o+=Va(i,e,n,l,r)}else if(l=tb(t),typeof l=="function")for(t=l.call(t),a=0;!(i=t.next()).done;)i=i.value,l=s+Dc(i,a++),o+=Va(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 da(t,e,n){if(t==null)return t;var s=[],r=0;return Va(t,s,"","",function(i){return e.call(n,i,r++)}),s}function rb(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 tt={current:null},Qa={transition:null},ib={ReactCurrentDispatcher:tt,ReactCurrentBatchConfig:Qa,ReactCurrentOwner:Kd};function Bm(){throw Error("act(...) is not supported in production builds of React.")}X.Children={map:da,forEach:function(t,e,n){da(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return da(t,function(){e++}),e},toArray:function(t){return da(t,function(e){return e})||[]},only:function(t){if(!Yd(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};X.Component=mi;X.Fragment=Qv;X.Profiler=Yv;X.PureComponent=Vd;X.StrictMode=Kv;X.Suspense=Jv;X.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ib;X.act=Bm;X.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=Tm({},t.props),r=t.key,i=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,o=Kd.current),e.key!==void 0&&(r=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(l in e)Im.call(e,l)&&!Fm.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:Yo,type:t.type,key:r,ref:i,props:s,_owner:o}};X.createContext=function(t){return t={$$typeof:qv,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:Xv,_context:t},t.Consumer=t};X.createElement=zm;X.createFactory=function(t){var e=zm.bind(null,t);return e.type=t,e};X.createRef=function(){return{current:null}};X.forwardRef=function(t){return{$$typeof:Gv,render:t}};X.isValidElement=Yd;X.lazy=function(t){return{$$typeof:eb,_payload:{_status:-1,_result:t},_init:rb}};X.memo=function(t,e){return{$$typeof:Zv,type:t,compare:e===void 0?null:e}};X.startTransition=function(t){var e=Qa.transition;Qa.transition={};try{t()}finally{Qa.transition=e}};X.unstable_act=Bm;X.useCallback=function(t,e){return tt.current.useCallback(t,e)};X.useContext=function(t){return tt.current.useContext(t)};X.useDebugValue=function(){};X.useDeferredValue=function(t){return tt.current.useDeferredValue(t)};X.useEffect=function(t,e){return tt.current.useEffect(t,e)};X.useId=function(){return tt.current.useId()};X.useImperativeHandle=function(t,e,n){return tt.current.useImperativeHandle(t,e,n)};X.useInsertionEffect=function(t,e){return tt.current.useInsertionEffect(t,e)};X.useLayoutEffect=function(t,e){return tt.current.useLayoutEffect(t,e)};X.useMemo=function(t,e){return tt.current.useMemo(t,e)};X.useReducer=function(t,e,n){return tt.current.useReducer(t,e,n)};X.useRef=function(t){return tt.current.useRef(t)};X.useState=function(t){return tt.current.useState(t)};X.useSyncExternalStore=function(t,e,n){return tt.current.useSyncExternalStore(t,e,n)};X.useTransition=function(){return tt.current.useTransition()};X.version="18.3.1";Om.exports=X;var w=Om.exports;const pe=Hv(w),ob=Wv({__proto__:null,default:pe},[w]);/**
9
+ */var Xo=Symbol.for("react.element"),Hv=Symbol.for("react.portal"),Vv=Symbol.for("react.fragment"),Qv=Symbol.for("react.strict_mode"),Kv=Symbol.for("react.profiler"),Yv=Symbol.for("react.provider"),Xv=Symbol.for("react.context"),qv=Symbol.for("react.forward_ref"),Gv=Symbol.for("react.suspense"),Jv=Symbol.for("react.memo"),Zv=Symbol.for("react.lazy"),Sh=Symbol.iterator;function eb(t){return t===null||typeof t!="object"?null:(t=Sh&&t[Sh]||t["@@iterator"],typeof t=="function"?t:null)}var Tm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Dm=Object.assign,Lm={};function mi(t,e,n){this.props=t,this.context=e,this.refs=Lm,this.updater=n||Tm}mi.prototype.isReactComponent={};mi.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")};mi.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Am(){}Am.prototype=mi.prototype;function Vd(t,e,n){this.props=t,this.context=e,this.refs=Lm,this.updater=n||Tm}var Qd=Vd.prototype=new Am;Qd.constructor=Vd;Dm(Qd,mi.prototype);Qd.isPureReactComponent=!0;var _h=Array.isArray,Im=Object.prototype.hasOwnProperty,Kd={current:null},Fm={key:!0,ref:!0,__self:!0,__source:!0};function zm(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)Im.call(e,s)&&!Fm.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:Xo,type:t,key:i,ref:o,props:r,_owner:Kd.current}}function tb(t,e){return{$$typeof:Xo,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Yd(t){return typeof t=="object"&&t!==null&&t.$$typeof===Xo}function nb(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var kh=/\/+/g;function Tc(t,e){return typeof t=="object"&&t!==null&&t.key!=null?nb(""+t.key):e.toString(36)}function Qa(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 Xo:case Hv:o=!0}}if(o)return o=t,r=r(o),t=s===""?"."+Tc(o,0):s,_h(r)?(n="",t!=null&&(n=t.replace(kh,"$&/")+"/"),Qa(r,e,n,"",function(c){return c})):r!=null&&(Yd(r)&&(r=tb(r,n+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(kh,"$&/")+"/")+t)),e.push(r)),1;if(o=0,s=s===""?".":s+":",_h(t))for(var a=0;a<t.length;a++){i=t[a];var l=s+Tc(i,a);o+=Qa(i,e,n,l,r)}else if(l=eb(t),typeof l=="function")for(t=l.call(t),a=0;!(i=t.next()).done;)i=i.value,l=s+Tc(i,a++),o+=Qa(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 fa(t,e,n){if(t==null)return t;var s=[],r=0;return Qa(t,s,"","",function(i){return e.call(n,i,r++)}),s}function sb(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 tt={current:null},Ka={transition:null},rb={ReactCurrentDispatcher:tt,ReactCurrentBatchConfig:Ka,ReactCurrentOwner:Kd};function Bm(){throw Error("act(...) is not supported in production builds of React.")}X.Children={map:fa,forEach:function(t,e,n){fa(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return fa(t,function(){e++}),e},toArray:function(t){return fa(t,function(e){return e})||[]},only:function(t){if(!Yd(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};X.Component=mi;X.Fragment=Vv;X.Profiler=Kv;X.PureComponent=Vd;X.StrictMode=Qv;X.Suspense=Gv;X.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=rb;X.act=Bm;X.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=Dm({},t.props),r=t.key,i=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,o=Kd.current),e.key!==void 0&&(r=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(l in e)Im.call(e,l)&&!Fm.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:Xo,type:t.type,key:r,ref:i,props:s,_owner:o}};X.createContext=function(t){return t={$$typeof:Xv,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:Yv,_context:t},t.Consumer=t};X.createElement=zm;X.createFactory=function(t){var e=zm.bind(null,t);return e.type=t,e};X.createRef=function(){return{current:null}};X.forwardRef=function(t){return{$$typeof:qv,render:t}};X.isValidElement=Yd;X.lazy=function(t){return{$$typeof:Zv,_payload:{_status:-1,_result:t},_init:sb}};X.memo=function(t,e){return{$$typeof:Jv,type:t,compare:e===void 0?null:e}};X.startTransition=function(t){var e=Ka.transition;Ka.transition={};try{t()}finally{Ka.transition=e}};X.unstable_act=Bm;X.useCallback=function(t,e){return tt.current.useCallback(t,e)};X.useContext=function(t){return tt.current.useContext(t)};X.useDebugValue=function(){};X.useDeferredValue=function(t){return tt.current.useDeferredValue(t)};X.useEffect=function(t,e){return tt.current.useEffect(t,e)};X.useId=function(){return tt.current.useId()};X.useImperativeHandle=function(t,e,n){return tt.current.useImperativeHandle(t,e,n)};X.useInsertionEffect=function(t,e){return tt.current.useInsertionEffect(t,e)};X.useLayoutEffect=function(t,e){return tt.current.useLayoutEffect(t,e)};X.useMemo=function(t,e){return tt.current.useMemo(t,e)};X.useReducer=function(t,e,n){return tt.current.useReducer(t,e,n)};X.useRef=function(t){return tt.current.useRef(t)};X.useState=function(t){return tt.current.useState(t)};X.useSyncExternalStore=function(t,e,n){return tt.current.useSyncExternalStore(t,e,n)};X.useTransition=function(){return tt.current.useTransition()};X.version="18.3.1";Om.exports=X;var w=Om.exports;const pe=Wv(w),ib=Uv({__proto__:null,default:pe},[w]);/**
10
10
  * @license React
11
11
  * react-jsx-runtime.production.min.js
12
12
  *
@@ -14,7 +14,7 @@ var $v=Object.defineProperty;var wh=t=>{throw TypeError(t)};var Uv=(t,e,n)=>e in
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var ab=w,lb=Symbol.for("react.element"),cb=Symbol.for("react.fragment"),ub=Object.prototype.hasOwnProperty,db=ab.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,fb={key:!0,ref:!0,__self:!0,__source:!0};function $m(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)ub.call(e,s)&&!fb.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:lb,type:t,key:i,ref:o,props:r,_owner:db.current}}ec.Fragment=cb;ec.jsx=$m;ec.jsxs=$m;Rm.exports=ec;var u=Rm.exports,_u={},Um={exports:{}},kt={},Wm={exports:{}},Hm={};/**
17
+ */var ob=w,ab=Symbol.for("react.element"),lb=Symbol.for("react.fragment"),cb=Object.prototype.hasOwnProperty,ub=ob.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,db={key:!0,ref:!0,__self:!0,__source:!0};function $m(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)cb.call(e,s)&&!db.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:ab,type:t,key:i,ref:o,props:r,_owner:ub.current}}tc.Fragment=lb;tc.jsx=$m;tc.jsxs=$m;Rm.exports=tc;var u=Rm.exports,_u={},Um={exports:{}},Ct={},Wm={exports:{}},Hm={};/**
18
18
  * @license React
19
19
  * scheduler.production.min.js
20
20
  *
@@ -22,7 +22,7 @@ var $v=Object.defineProperty;var wh=t=>{throw TypeError(t)};var Uv=(t,e,n)=>e in
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */(function(t){function e(D,A){var I=D.length;D.push(A);e:for(;0<I;){var K=I-1>>>1,z=D[K];if(0<r(z,A))D[K]=A,D[I]=z,I=K;else break e}}function n(D){return D.length===0?null:D[0]}function s(D){if(D.length===0)return null;var A=D[0],I=D.pop();if(I!==A){D[0]=I;e:for(var K=0,z=D.length,ce=z>>>1;K<ce;){var Q=2*(K+1)-1,ke=D[Q],Z=Q+1,pt=D[Z];if(0>r(ke,I))Z<z&&0>r(pt,ke)?(D[K]=pt,D[Z]=I,K=Z):(D[K]=ke,D[Q]=I,K=Q);else if(Z<z&&0>r(pt,I))D[K]=pt,D[Z]=I,K=Z;else break e}}return A}function r(D,A){var I=D.sortIndex-A.sortIndex;return I!==0?I:D.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=[],d=1,f=null,h=3,p=!1,x=!1,g=!1,b=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,m=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(D){for(var A=n(c);A!==null;){if(A.callback===null)s(c);else if(A.startTime<=D)s(c),A.sortIndex=A.expirationTime,e(l,A);else break;A=n(c)}}function S(D){if(g=!1,v(D),!x)if(n(l)!==null)x=!0,oe(_);else{var A=n(c);A!==null&&J(S,A.startTime-D)}}function _(D,A){x=!1,g&&(g=!1,y(N),N=-1),p=!0;var I=h;try{for(v(A),f=n(l);f!==null&&(!(f.expirationTime>A)||D&&!O());){var K=f.callback;if(typeof K=="function"){f.callback=null,h=f.priorityLevel;var z=K(f.expirationTime<=A);A=t.unstable_now(),typeof z=="function"?f.callback=z:f===n(l)&&s(l),v(A)}else s(l);f=n(l)}if(f!==null)var ce=!0;else{var Q=n(c);Q!==null&&J(S,Q.startTime-A),ce=!1}return ce}finally{f=null,h=I,p=!1}}var k=!1,C=null,N=-1,P=5,M=-1;function O(){return!(t.unstable_now()-M<P)}function E(){if(C!==null){var D=t.unstable_now();M=D;var A=!0;try{A=C(!0,D)}finally{A?F():(k=!1,C=null)}}else k=!1}var F;if(typeof m=="function")F=function(){m(E)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,V=U.port2;U.port1.onmessage=E,F=function(){V.postMessage(null)}}else F=function(){b(E,0)};function oe(D){C=D,k||(k=!0,F())}function J(D,A){N=b(function(){D(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(D){D.callback=null},t.unstable_continueExecution=function(){x||p||(x=!0,oe(_))},t.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<D?Math.floor(1e3/D):5},t.unstable_getCurrentPriorityLevel=function(){return h},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(D){switch(h){case 1:case 2:case 3:var A=3;break;default:A=h}var I=h;h=A;try{return D()}finally{h=I}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(D,A){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var I=h;h=D;try{return A()}finally{h=I}},t.unstable_scheduleCallback=function(D,A,I){var K=t.unstable_now();switch(typeof I=="object"&&I!==null?(I=I.delay,I=typeof I=="number"&&0<I?K+I:K):I=K,D){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=I+z,D={id:d++,callback:A,priorityLevel:D,startTime:I,expirationTime:z,sortIndex:-1},I>K?(D.sortIndex=I,e(c,D),n(l)===null&&D===n(c)&&(g?(y(N),N=-1):g=!0,J(S,I-K))):(D.sortIndex=z,e(l,D),x||p||(x=!0,oe(_))),D},t.unstable_shouldYield=O,t.unstable_wrapCallback=function(D){var A=h;return function(){var I=h;h=A;try{return D.apply(this,arguments)}finally{h=I}}}})(Hm);Wm.exports=Hm;var hb=Wm.exports;/**
25
+ */(function(t){function e(T,I){var F=T.length;T.push(I);e:for(;0<F;){var K=F-1>>>1,z=T[K];if(0<r(z,I))T[K]=I,T[F]=z,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 I=T[0],F=T.pop();if(F!==I){T[0]=F;e:for(var K=0,z=T.length,ce=z>>>1;K<ce;){var V=2*(K+1)-1,ke=T[V],Z=V+1,pt=T[Z];if(0>r(ke,F))Z<z&&0>r(pt,ke)?(T[K]=pt,T[Z]=F,K=Z):(T[K]=ke,T[V]=F,K=V);else if(Z<z&&0>r(pt,F))T[K]=pt,T[Z]=F,K=Z;else break e}}return I}function r(T,I){var F=T.sortIndex-I.sortIndex;return F!==0?F:T.id-I.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=[],d=1,f=null,h=3,p=!1,x=!1,g=!1,b=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,m=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 I=n(c);I!==null;){if(I.callback===null)s(c);else if(I.startTime<=T)s(c),I.sortIndex=I.expirationTime,e(l,I);else break;I=n(c)}}function S(T){if(g=!1,v(T),!x)if(n(l)!==null)x=!0,oe(_);else{var I=n(c);I!==null&&J(S,I.startTime-T)}}function _(T,I){x=!1,g&&(g=!1,y(j),j=-1),p=!0;var F=h;try{for(v(I),f=n(l);f!==null&&(!(f.expirationTime>I)||T&&!R());){var K=f.callback;if(typeof K=="function"){f.callback=null,h=f.priorityLevel;var z=K(f.expirationTime<=I);I=t.unstable_now(),typeof z=="function"?f.callback=z:f===n(l)&&s(l),v(I)}else s(l);f=n(l)}if(f!==null)var ce=!0;else{var V=n(c);V!==null&&J(S,V.startTime-I),ce=!1}return ce}finally{f=null,h=F,p=!1}}var k=!1,C=null,j=-1,P=5,E=-1;function R(){return!(t.unstable_now()-E<P)}function M(){if(C!==null){var T=t.unstable_now();E=T;var I=!0;try{I=C(!0,T)}finally{I?A():(k=!1,C=null)}}else k=!1}var A;if(typeof m=="function")A=function(){m(M)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,H=U.port2;U.port1.onmessage=M,A=function(){H.postMessage(null)}}else A=function(){b(M,0)};function oe(T){C=T,k||(k=!0,A())}function J(T,I){j=b(function(){T(t.unstable_now())},I)}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(){x||p||(x=!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 I=3;break;default:I=h}var F=h;h=I;try{return T()}finally{h=F}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(T,I){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var F=h;h=T;try{return I()}finally{h=F}},t.unstable_scheduleCallback=function(T,I,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 z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=F+z,T={id:d++,callback:I,priorityLevel:T,startTime:F,expirationTime:z,sortIndex:-1},F>K?(T.sortIndex=F,e(c,T),n(l)===null&&T===n(c)&&(g?(y(j),j=-1):g=!0,J(S,F-K))):(T.sortIndex=z,e(l,T),x||p||(x=!0,oe(_))),T},t.unstable_shouldYield=R,t.unstable_wrapCallback=function(T){var I=h;return function(){var F=h;h=I;try{return T.apply(this,arguments)}finally{h=F}}}})(Hm);Wm.exports=Hm;var fb=Wm.exports;/**
26
26
  * @license React
27
27
  * react-dom.production.min.js
28
28
  *
@@ -30,14 +30,14 @@ var $v=Object.defineProperty;var wh=t=>{throw TypeError(t)};var Uv=(t,e,n)=>e in
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var pb=w,_t=hb;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 Vm=new Set,xo={};function dr(t,e){oi(t,e),oi(t+"Capture",e)}function oi(t,e){for(xo[t]=e,t=0;t<e.length;t++)Vm.add(e[t])}var Dn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ku=Object.prototype.hasOwnProperty,gb=/^[: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]*$/,Ch={},jh={};function mb(t){return ku.call(jh,t)?!0:ku.call(Ch,t)?!1:gb.test(t)?jh[t]=!0:(Ch[t]=!0,!1)}function xb(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 yb(t,e,n,s){if(e===null||typeof e>"u"||xb(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 nt(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 He={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){He[t]=new nt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];He[e]=new nt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){He[t]=new nt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){He[t]=new nt(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){He[t]=new nt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){He[t]=new nt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){He[t]=new nt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){He[t]=new nt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){He[t]=new nt(t,5,!1,t.toLowerCase(),null,!1,!1)});var Xd=/[\-:]([a-z])/g;function qd(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(Xd,qd);He[e]=new nt(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(Xd,qd);He[e]=new nt(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(Xd,qd);He[e]=new nt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){He[t]=new nt(t,1,!1,t.toLowerCase(),null,!1,!1)});He.xlinkHref=new nt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){He[t]=new nt(t,1,!1,t.toLowerCase(),null,!0,!0)});function Gd(t,e,n,s){var r=He.hasOwnProperty(e)?He[e]:null;(r!==null?r.type!==0:s||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(yb(e,n,r,s)&&(n=null),s||r===null?mb(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 In=pb.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,fa=Symbol.for("react.element"),kr=Symbol.for("react.portal"),Cr=Symbol.for("react.fragment"),Jd=Symbol.for("react.strict_mode"),Cu=Symbol.for("react.profiler"),Qm=Symbol.for("react.provider"),Km=Symbol.for("react.context"),Zd=Symbol.for("react.forward_ref"),ju=Symbol.for("react.suspense"),Nu=Symbol.for("react.suspense_list"),ef=Symbol.for("react.memo"),Qn=Symbol.for("react.lazy"),Ym=Symbol.for("react.offscreen"),Nh=Symbol.iterator;function Pi(t){return t===null||typeof t!="object"?null:(t=Nh&&t[Nh]||t["@@iterator"],typeof t=="function"?t:null)}var _e=Object.assign,Tc;function Vi(t){if(Tc===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Tc=e&&e[1]||""}return`
34
- `+Tc+t}var Lc=!1;function Ac(t,e){if(!t||Lc)return"";Lc=!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(`
33
+ */var hb=w,kt=fb;function O(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 Vm=new Set,yo={};function dr(t,e){oi(t,e),oi(t+"Capture",e)}function oi(t,e){for(yo[t]=e,t=0;t<e.length;t++)Vm.add(e[t])}var Tn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ku=Object.prototype.hasOwnProperty,pb=/^[: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]*$/,Ch={},jh={};function gb(t){return ku.call(jh,t)?!0:ku.call(Ch,t)?!1:pb.test(t)?jh[t]=!0:(Ch[t]=!0,!1)}function mb(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 xb(t,e,n,s){if(e===null||typeof e>"u"||mb(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 nt(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 He={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){He[t]=new nt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];He[e]=new nt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){He[t]=new nt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){He[t]=new nt(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){He[t]=new nt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){He[t]=new nt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){He[t]=new nt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){He[t]=new nt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){He[t]=new nt(t,5,!1,t.toLowerCase(),null,!1,!1)});var Xd=/[\-:]([a-z])/g;function qd(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(Xd,qd);He[e]=new nt(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(Xd,qd);He[e]=new nt(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(Xd,qd);He[e]=new nt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){He[t]=new nt(t,1,!1,t.toLowerCase(),null,!1,!1)});He.xlinkHref=new nt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){He[t]=new nt(t,1,!1,t.toLowerCase(),null,!0,!0)});function Gd(t,e,n,s){var r=He.hasOwnProperty(e)?He[e]:null;(r!==null?r.type!==0:s||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(xb(e,n,r,s)&&(n=null),s||r===null?gb(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 In=hb.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ha=Symbol.for("react.element"),kr=Symbol.for("react.portal"),Cr=Symbol.for("react.fragment"),Jd=Symbol.for("react.strict_mode"),Cu=Symbol.for("react.profiler"),Qm=Symbol.for("react.provider"),Km=Symbol.for("react.context"),Zd=Symbol.for("react.forward_ref"),ju=Symbol.for("react.suspense"),Nu=Symbol.for("react.suspense_list"),ef=Symbol.for("react.memo"),Qn=Symbol.for("react.lazy"),Ym=Symbol.for("react.offscreen"),Nh=Symbol.iterator;function Ri(t){return t===null||typeof t!="object"?null:(t=Nh&&t[Nh]||t["@@iterator"],typeof t=="function"?t:null)}var _e=Object.assign,Dc;function Qi(t){if(Dc===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Dc=e&&e[1]||""}return`
34
+ `+Dc+t}var Lc=!1;function Ac(t,e){if(!t||Lc)return"";Lc=!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
35
  `),i=s.stack.split(`
36
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{Lc=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Vi(t):""}function vb(t){switch(t.tag){case 5:return Vi(t.type);case 16:return Vi("Lazy");case 13:return Vi("Suspense");case 19:return Vi("SuspenseList");case 0:case 2:case 15:return t=Ac(t.type,!1),t;case 11:return t=Ac(t.type.render,!1),t;case 1:return t=Ac(t.type,!0),t;default:return""}}function Eu(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 Cr:return"Fragment";case kr:return"Portal";case Cu:return"Profiler";case Jd:return"StrictMode";case ju:return"Suspense";case Nu:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Km:return(t.displayName||"Context")+".Consumer";case Qm:return(t._context.displayName||"Context")+".Provider";case Zd:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case ef:return e=t.displayName||null,e!==null?e:Eu(t.type)||"Memo";case Qn:e=t._payload,t=t._init;try{return Eu(t(e))}catch{}}return null}function bb(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 Eu(e);case 8:return e===Jd?"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 ks(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Xm(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function wb(t){var e=Xm(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 ha(t){t._valueTracker||(t._valueTracker=wb(t))}function qm(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),s="";return t&&(s=Xm(t)?t.checked?"true":"false":t.value),t=s,t!==n?(e.setValue(t),!0):!1}function cl(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 Mu(t,e){var n=e.checked;return _e({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Eh(t,e){var n=e.defaultValue==null?"":e.defaultValue,s=e.checked!=null?e.checked:e.defaultChecked;n=ks(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 Gm(t,e){e=e.checked,e!=null&&Gd(t,"checked",e,!1)}function Pu(t,e){Gm(t,e);var n=ks(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")?Ru(t,e.type,n):e.hasOwnProperty("defaultValue")&&Ru(t,e.type,ks(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Mh(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 Ru(t,e,n){(e!=="number"||cl(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Qi=Array.isArray;function Ir(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=""+ks(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 Ou(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(R(91));return _e({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Ph(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(Qi(n)){if(1<n.length)throw Error(R(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:ks(n)}}function Jm(t,e){var n=ks(e.value),s=ks(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 Rh(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Zm(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 Du(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Zm(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var pa,ex=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(pa=pa||document.createElement("div"),pa.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=pa.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function yo(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var to={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},Sb=["Webkit","ms","Moz","O"];Object.keys(to).forEach(function(t){Sb.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),to[e]=to[t]})});function tx(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||to.hasOwnProperty(t)&&to[t]?(""+e).trim():e+"px"}function nx(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var s=n.indexOf("--")===0,r=tx(n,e[n],s);n==="float"&&(n="cssFloat"),s?t.setProperty(n,r):t[n]=r}}var _b=_e({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 Tu(t,e){if(e){if(_b[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 Lu(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 Au=null;function tf(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Iu=null,Fr=null,zr=null;function Oh(t){if(t=Go(t)){if(typeof Iu!="function")throw Error(R(280));var e=t.stateNode;e&&(e=ic(e),Iu(t.stateNode,t.type,e))}}function sx(t){Fr?zr?zr.push(t):zr=[t]:Fr=t}function rx(){if(Fr){var t=Fr,e=zr;if(zr=Fr=null,Oh(t),e)for(t=0;t<e.length;t++)Oh(e[t])}}function ix(t,e){return t(e)}function ox(){}var Ic=!1;function ax(t,e,n){if(Ic)return t(e,n);Ic=!0;try{return ix(t,e,n)}finally{Ic=!1,(Fr!==null||zr!==null)&&(ox(),rx())}}function vo(t,e){var n=t.stateNode;if(n===null)return null;var s=ic(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 Fu=!1;if(Dn)try{var Ri={};Object.defineProperty(Ri,"passive",{get:function(){Fu=!0}}),window.addEventListener("test",Ri,Ri),window.removeEventListener("test",Ri,Ri)}catch{Fu=!1}function kb(t,e,n,s,r,i,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(d){this.onError(d)}}var no=!1,ul=null,dl=!1,zu=null,Cb={onError:function(t){no=!0,ul=t}};function jb(t,e,n,s,r,i,o,a,l){no=!1,ul=null,kb.apply(Cb,arguments)}function Nb(t,e,n,s,r,i,o,a,l){if(jb.apply(this,arguments),no){if(no){var c=ul;no=!1,ul=null}else throw Error(R(198));dl||(dl=!0,zu=c)}}function fr(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 lx(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 Dh(t){if(fr(t)!==t)throw Error(R(188))}function Eb(t){var e=t.alternate;if(!e){if(e=fr(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 Dh(r),t;if(i===s)return Dh(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 cx(t){return t=Eb(t),t!==null?ux(t):null}function ux(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=ux(t);if(e!==null)return e;t=t.sibling}return null}var dx=_t.unstable_scheduleCallback,Th=_t.unstable_cancelCallback,Mb=_t.unstable_shouldYield,Pb=_t.unstable_requestPaint,Ne=_t.unstable_now,Rb=_t.unstable_getCurrentPriorityLevel,nf=_t.unstable_ImmediatePriority,fx=_t.unstable_UserBlockingPriority,fl=_t.unstable_NormalPriority,Ob=_t.unstable_LowPriority,hx=_t.unstable_IdlePriority,tc=null,mn=null;function Db(t){if(mn&&typeof mn.onCommitFiberRoot=="function")try{mn.onCommitFiberRoot(tc,t,void 0,(t.current.flags&128)===128)}catch{}}var Kt=Math.clz32?Math.clz32:Ab,Tb=Math.log,Lb=Math.LN2;function Ab(t){return t>>>=0,t===0?32:31-(Tb(t)/Lb|0)|0}var ga=64,ma=4194304;function Ki(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 hl(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=Ki(a):(i&=o,i!==0&&(s=Ki(i)))}else o=n&~r,o!==0?s=Ki(o):i!==0&&(s=Ki(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-Kt(e),r=1<<n,s|=t[n],e&=~r;return s}function Ib(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 Fb(t,e){for(var n=t.suspendedLanes,s=t.pingedLanes,r=t.expirationTimes,i=t.pendingLanes;0<i;){var o=31-Kt(i),a=1<<o,l=r[o];l===-1?(!(a&n)||a&s)&&(r[o]=Ib(a,e)):l<=e&&(t.expiredLanes|=a),i&=~a}}function Bu(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function px(){var t=ga;return ga<<=1,!(ga&4194240)&&(ga=64),t}function Fc(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function Xo(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Kt(e),t[e]=n}function zb(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-Kt(n),i=1<<r;e[r]=0,s[r]=-1,t[r]=-1,n&=~i}}function sf(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var s=31-Kt(n),r=1<<s;r&e|t[s]&e&&(t[s]|=e),n&=~r}}var le=0;function gx(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var mx,rf,xx,yx,vx,$u=!1,xa=[],fs=null,hs=null,ps=null,bo=new Map,wo=new Map,Xn=[],Bb="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 Lh(t,e){switch(t){case"focusin":case"focusout":fs=null;break;case"dragenter":case"dragleave":hs=null;break;case"mouseover":case"mouseout":ps=null;break;case"pointerover":case"pointerout":bo.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":wo.delete(e.pointerId)}}function Oi(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=Go(e),e!==null&&rf(e)),t):(t.eventSystemFlags|=s,e=t.targetContainers,r!==null&&e.indexOf(r)===-1&&e.push(r),t)}function $b(t,e,n,s,r){switch(e){case"focusin":return fs=Oi(fs,t,e,n,s,r),!0;case"dragenter":return hs=Oi(hs,t,e,n,s,r),!0;case"mouseover":return ps=Oi(ps,t,e,n,s,r),!0;case"pointerover":var i=r.pointerId;return bo.set(i,Oi(bo.get(i)||null,t,e,n,s,r)),!0;case"gotpointercapture":return i=r.pointerId,wo.set(i,Oi(wo.get(i)||null,t,e,n,s,r)),!0}return!1}function bx(t){var e=$s(t.target);if(e!==null){var n=fr(e);if(n!==null){if(e=n.tag,e===13){if(e=lx(n),e!==null){t.blockedOn=e,vx(t.priority,function(){xx(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 Ka(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Uu(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var s=new n.constructor(n.type,n);Au=s,n.target.dispatchEvent(s),Au=null}else return e=Go(n),e!==null&&rf(e),t.blockedOn=n,!1;e.shift()}return!0}function Ah(t,e,n){Ka(t)&&n.delete(e)}function Ub(){$u=!1,fs!==null&&Ka(fs)&&(fs=null),hs!==null&&Ka(hs)&&(hs=null),ps!==null&&Ka(ps)&&(ps=null),bo.forEach(Ah),wo.forEach(Ah)}function Di(t,e){t.blockedOn===e&&(t.blockedOn=null,$u||($u=!0,_t.unstable_scheduleCallback(_t.unstable_NormalPriority,Ub)))}function So(t){function e(r){return Di(r,t)}if(0<xa.length){Di(xa[0],t);for(var n=1;n<xa.length;n++){var s=xa[n];s.blockedOn===t&&(s.blockedOn=null)}}for(fs!==null&&Di(fs,t),hs!==null&&Di(hs,t),ps!==null&&Di(ps,t),bo.forEach(e),wo.forEach(e),n=0;n<Xn.length;n++)s=Xn[n],s.blockedOn===t&&(s.blockedOn=null);for(;0<Xn.length&&(n=Xn[0],n.blockedOn===null);)bx(n),n.blockedOn===null&&Xn.shift()}var Br=In.ReactCurrentBatchConfig,pl=!0;function Wb(t,e,n,s){var r=le,i=Br.transition;Br.transition=null;try{le=1,of(t,e,n,s)}finally{le=r,Br.transition=i}}function Hb(t,e,n,s){var r=le,i=Br.transition;Br.transition=null;try{le=4,of(t,e,n,s)}finally{le=r,Br.transition=i}}function of(t,e,n,s){if(pl){var r=Uu(t,e,n,s);if(r===null)Yc(t,e,s,gl,n),Lh(t,s);else if($b(r,t,e,n,s))s.stopPropagation();else if(Lh(t,s),e&4&&-1<Bb.indexOf(t)){for(;r!==null;){var i=Go(r);if(i!==null&&mx(i),i=Uu(t,e,n,s),i===null&&Yc(t,e,s,gl,n),i===r)break;r=i}r!==null&&s.stopPropagation()}else Yc(t,e,s,null,n)}}var gl=null;function Uu(t,e,n,s){if(gl=null,t=tf(s),t=$s(t),t!==null)if(e=fr(t),e===null)t=null;else if(n=e.tag,n===13){if(t=lx(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 gl=t,null}function wx(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(Rb()){case nf:return 1;case fx:return 4;case fl:case Ob:return 16;case hx:return 536870912;default:return 16}default:return 16}}var is=null,af=null,Ya=null;function Sx(){if(Ya)return Ya;var t,e=af,n=e.length,s,r="value"in is?is.value:is.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 Ya=r.slice(t,1<s?1-s:void 0)}function Xa(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 ya(){return!0}function Ih(){return!1}function Ct(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)?ya:Ih,this.isPropagationStopped=Ih,this}return _e(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=ya)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ya)},persist:function(){},isPersistent:ya}),e}var xi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},lf=Ct(xi),qo=_e({},xi,{view:0,detail:0}),Vb=Ct(qo),zc,Bc,Ti,nc=_e({},qo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:cf,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!==Ti&&(Ti&&t.type==="mousemove"?(zc=t.screenX-Ti.screenX,Bc=t.screenY-Ti.screenY):Bc=zc=0,Ti=t),zc)},movementY:function(t){return"movementY"in t?t.movementY:Bc}}),Fh=Ct(nc),Qb=_e({},nc,{dataTransfer:0}),Kb=Ct(Qb),Yb=_e({},qo,{relatedTarget:0}),$c=Ct(Yb),Xb=_e({},xi,{animationName:0,elapsedTime:0,pseudoElement:0}),qb=Ct(Xb),Gb=_e({},xi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Jb=Ct(Gb),Zb=_e({},xi,{data:0}),zh=Ct(Zb),ew={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},tw={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"},nw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function sw(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=nw[t])?!!e[t]:!1}function cf(){return sw}var rw=_e({},qo,{key:function(t){if(t.key){var e=ew[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Xa(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?tw[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:cf,charCode:function(t){return t.type==="keypress"?Xa(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Xa(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),iw=Ct(rw),ow=_e({},nc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Bh=Ct(ow),aw=_e({},qo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:cf}),lw=Ct(aw),cw=_e({},xi,{propertyName:0,elapsedTime:0,pseudoElement:0}),uw=Ct(cw),dw=_e({},nc,{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}),fw=Ct(dw),hw=[9,13,27,32],uf=Dn&&"CompositionEvent"in window,so=null;Dn&&"documentMode"in document&&(so=document.documentMode);var pw=Dn&&"TextEvent"in window&&!so,_x=Dn&&(!uf||so&&8<so&&11>=so),$h=" ",Uh=!1;function kx(t,e){switch(t){case"keyup":return hw.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cx(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var jr=!1;function gw(t,e){switch(t){case"compositionend":return Cx(e);case"keypress":return e.which!==32?null:(Uh=!0,$h);case"textInput":return t=e.data,t===$h&&Uh?null:t;default:return null}}function mw(t,e){if(jr)return t==="compositionend"||!uf&&kx(t,e)?(t=Sx(),Ya=af=is=null,jr=!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 _x&&e.locale!=="ko"?null:e.data;default:return null}}var xw={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 Wh(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!xw[t.type]:e==="textarea"}function jx(t,e,n,s){sx(s),e=ml(e,"onChange"),0<e.length&&(n=new lf("onChange","change",null,n,s),t.push({event:n,listeners:e}))}var ro=null,_o=null;function yw(t){Ix(t,0)}function sc(t){var e=Mr(t);if(qm(e))return t}function vw(t,e){if(t==="change")return e}var Nx=!1;if(Dn){var Uc;if(Dn){var Wc="oninput"in document;if(!Wc){var Hh=document.createElement("div");Hh.setAttribute("oninput","return;"),Wc=typeof Hh.oninput=="function"}Uc=Wc}else Uc=!1;Nx=Uc&&(!document.documentMode||9<document.documentMode)}function Vh(){ro&&(ro.detachEvent("onpropertychange",Ex),_o=ro=null)}function Ex(t){if(t.propertyName==="value"&&sc(_o)){var e=[];jx(e,_o,t,tf(t)),ax(yw,e)}}function bw(t,e,n){t==="focusin"?(Vh(),ro=e,_o=n,ro.attachEvent("onpropertychange",Ex)):t==="focusout"&&Vh()}function ww(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return sc(_o)}function Sw(t,e){if(t==="click")return sc(e)}function _w(t,e){if(t==="input"||t==="change")return sc(e)}function kw(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var qt=typeof Object.is=="function"?Object.is:kw;function ko(t,e){if(qt(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(!ku.call(e,r)||!qt(t[r],e[r]))return!1}return!0}function Qh(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Kh(t,e){var n=Qh(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=Qh(n)}}function Mx(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Mx(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Px(){for(var t=window,e=cl();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=cl(t.document)}return e}function df(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 Cw(t){var e=Px(),n=t.focusedElem,s=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&Mx(n.ownerDocument.documentElement,n)){if(s!==null&&df(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=Kh(n,i);var o=Kh(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 jw=Dn&&"documentMode"in document&&11>=document.documentMode,Nr=null,Wu=null,io=null,Hu=!1;function Yh(t,e,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Hu||Nr==null||Nr!==cl(s)||(s=Nr,"selectionStart"in s&&df(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}),io&&ko(io,s)||(io=s,s=ml(Wu,"onSelect"),0<s.length&&(e=new lf("onSelect","select",null,e,n),t.push({event:e,listeners:s}),e.target=Nr)))}function va(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var Er={animationend:va("Animation","AnimationEnd"),animationiteration:va("Animation","AnimationIteration"),animationstart:va("Animation","AnimationStart"),transitionend:va("Transition","TransitionEnd")},Hc={},Rx={};Dn&&(Rx=document.createElement("div").style,"AnimationEvent"in window||(delete Er.animationend.animation,delete Er.animationiteration.animation,delete Er.animationstart.animation),"TransitionEvent"in window||delete Er.transitionend.transition);function rc(t){if(Hc[t])return Hc[t];if(!Er[t])return t;var e=Er[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in Rx)return Hc[t]=e[n];return t}var Ox=rc("animationend"),Dx=rc("animationiteration"),Tx=rc("animationstart"),Lx=rc("transitionend"),Ax=new Map,Xh="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 Ms(t,e){Ax.set(t,e),dr(e,[t])}for(var Vc=0;Vc<Xh.length;Vc++){var Qc=Xh[Vc],Nw=Qc.toLowerCase(),Ew=Qc[0].toUpperCase()+Qc.slice(1);Ms(Nw,"on"+Ew)}Ms(Ox,"onAnimationEnd");Ms(Dx,"onAnimationIteration");Ms(Tx,"onAnimationStart");Ms("dblclick","onDoubleClick");Ms("focusin","onFocus");Ms("focusout","onBlur");Ms(Lx,"onTransitionEnd");oi("onMouseEnter",["mouseout","mouseover"]);oi("onMouseLeave",["mouseout","mouseover"]);oi("onPointerEnter",["pointerout","pointerover"]);oi("onPointerLeave",["pointerout","pointerover"]);dr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));dr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));dr("onBeforeInput",["compositionend","keypress","textInput","paste"]);dr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));dr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));dr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Yi="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(" "),Mw=new Set("cancel close invalid load scroll toggle".split(" ").concat(Yi));function qh(t,e,n){var s=t.type||"unknown-event";t.currentTarget=n,Nb(s,e,void 0,t),t.currentTarget=null}function Ix(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;qh(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;qh(r,a,c),i=l}}}if(dl)throw t=zu,dl=!1,zu=null,t}function fe(t,e){var n=e[Xu];n===void 0&&(n=e[Xu]=new Set);var s=t+"__bubble";n.has(s)||(Fx(e,t,2,!1),n.add(s))}function Kc(t,e,n){var s=0;e&&(s|=4),Fx(n,t,s,e)}var ba="_reactListening"+Math.random().toString(36).slice(2);function Co(t){if(!t[ba]){t[ba]=!0,Vm.forEach(function(n){n!=="selectionchange"&&(Mw.has(n)||Kc(n,!1,t),Kc(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[ba]||(e[ba]=!0,Kc("selectionchange",!1,e))}}function Fx(t,e,n,s){switch(wx(e)){case 1:var r=Wb;break;case 4:r=Hb;break;default:r=of}n=r.bind(null,e,n,t),r=void 0,!Fu||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 Yc(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=$s(a),o===null)return;if(l=o.tag,l===5||l===6){s=i=o;continue e}a=a.parentNode}}s=s.return}ax(function(){var c=i,d=tf(n),f=[];e:{var h=Ax.get(t);if(h!==void 0){var p=lf,x=t;switch(t){case"keypress":if(Xa(n)===0)break e;case"keydown":case"keyup":p=iw;break;case"focusin":x="focus",p=$c;break;case"focusout":x="blur",p=$c;break;case"beforeblur":case"afterblur":p=$c;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=Fh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=Kb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=lw;break;case Ox:case Dx:case Tx:p=qb;break;case Lx:p=uw;break;case"scroll":p=Vb;break;case"wheel":p=fw;break;case"copy":case"cut":case"paste":p=Jb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Bh}var g=(e&4)!==0,b=!g&&t==="scroll",y=g?h!==null?h+"Capture":null:h;g=[];for(var m=c,v;m!==null;){v=m;var S=v.stateNode;if(v.tag===5&&S!==null&&(v=S,y!==null&&(S=vo(m,y),S!=null&&g.push(jo(m,S,v)))),b)break;m=m.return}0<g.length&&(h=new p(h,x,null,n,d),f.push({event:h,listeners:g}))}}if(!(e&7)){e:{if(h=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",h&&n!==Au&&(x=n.relatedTarget||n.fromElement)&&($s(x)||x[Tn]))break e;if((p||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,p?(x=n.relatedTarget||n.toElement,p=c,x=x?$s(x):null,x!==null&&(b=fr(x),x!==b||x.tag!==5&&x.tag!==6)&&(x=null)):(p=null,x=c),p!==x)){if(g=Fh,S="onMouseLeave",y="onMouseEnter",m="mouse",(t==="pointerout"||t==="pointerover")&&(g=Bh,S="onPointerLeave",y="onPointerEnter",m="pointer"),b=p==null?h:Mr(p),v=x==null?h:Mr(x),h=new g(S,m+"leave",p,n,d),h.target=b,h.relatedTarget=v,S=null,$s(d)===c&&(g=new g(y,m+"enter",x,n,d),g.target=v,g.relatedTarget=b,S=g),b=S,p&&x)t:{for(g=p,y=x,m=0,v=g;v;v=br(v))m++;for(v=0,S=y;S;S=br(S))v++;for(;0<m-v;)g=br(g),m--;for(;0<v-m;)y=br(y),v--;for(;m--;){if(g===y||y!==null&&g===y.alternate)break t;g=br(g),y=br(y)}g=null}else g=null;p!==null&&Gh(f,h,p,g,!1),x!==null&&b!==null&&Gh(f,b,x,g,!0)}}e:{if(h=c?Mr(c):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var _=vw;else if(Wh(h))if(Nx)_=_w;else{_=ww;var k=bw}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(_=Sw);if(_&&(_=_(t,c))){jx(f,_,n,d);break e}k&&k(t,h,c),t==="focusout"&&(k=h._wrapperState)&&k.controlled&&h.type==="number"&&Ru(h,"number",h.value)}switch(k=c?Mr(c):window,t){case"focusin":(Wh(k)||k.contentEditable==="true")&&(Nr=k,Wu=c,io=null);break;case"focusout":io=Wu=Nr=null;break;case"mousedown":Hu=!0;break;case"contextmenu":case"mouseup":case"dragend":Hu=!1,Yh(f,n,d);break;case"selectionchange":if(jw)break;case"keydown":case"keyup":Yh(f,n,d)}var C;if(uf)e:{switch(t){case"compositionstart":var N="onCompositionStart";break e;case"compositionend":N="onCompositionEnd";break e;case"compositionupdate":N="onCompositionUpdate";break e}N=void 0}else jr?kx(t,n)&&(N="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(N="onCompositionStart");N&&(_x&&n.locale!=="ko"&&(jr||N!=="onCompositionStart"?N==="onCompositionEnd"&&jr&&(C=Sx()):(is=d,af="value"in is?is.value:is.textContent,jr=!0)),k=ml(c,N),0<k.length&&(N=new zh(N,t,null,n,d),f.push({event:N,listeners:k}),C?N.data=C:(C=Cx(n),C!==null&&(N.data=C)))),(C=pw?gw(t,n):mw(t,n))&&(c=ml(c,"onBeforeInput"),0<c.length&&(d=new zh("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:c}),d.data=C))}Ix(f,e)})}function jo(t,e,n){return{instance:t,listener:e,currentTarget:n}}function ml(t,e){for(var n=e+"Capture",s=[];t!==null;){var r=t,i=r.stateNode;r.tag===5&&i!==null&&(r=i,i=vo(t,n),i!=null&&s.unshift(jo(t,i,r)),i=vo(t,e),i!=null&&s.push(jo(t,i,r))),t=t.return}return s}function br(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Gh(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=vo(n,i),l!=null&&o.unshift(jo(n,l,a))):r||(l=vo(n,i),l!=null&&o.push(jo(n,l,a)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var Pw=/\r\n?/g,Rw=/\u0000|\uFFFD/g;function Jh(t){return(typeof t=="string"?t:""+t).replace(Pw,`
38
- `).replace(Rw,"")}function wa(t,e,n){if(e=Jh(e),Jh(t)!==e&&n)throw Error(R(425))}function xl(){}var Vu=null,Qu=null;function Ku(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 Yu=typeof setTimeout=="function"?setTimeout:void 0,Ow=typeof clearTimeout=="function"?clearTimeout:void 0,Zh=typeof Promise=="function"?Promise:void 0,Dw=typeof queueMicrotask=="function"?queueMicrotask:typeof Zh<"u"?function(t){return Zh.resolve(null).then(t).catch(Tw)}:Yu;function Tw(t){setTimeout(function(){throw t})}function Xc(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),So(e);return}s--}else n!=="$"&&n!=="$?"&&n!=="$!"||s++;n=r}while(n);So(e)}function gs(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 ep(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 yi=Math.random().toString(36).slice(2),gn="__reactFiber$"+yi,No="__reactProps$"+yi,Tn="__reactContainer$"+yi,Xu="__reactEvents$"+yi,Lw="__reactListeners$"+yi,Aw="__reactHandles$"+yi;function $s(t){var e=t[gn];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Tn]||n[gn]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=ep(t);t!==null;){if(n=t[gn])return n;t=ep(t)}return e}t=n,n=t.parentNode}return null}function Go(t){return t=t[gn]||t[Tn],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Mr(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(R(33))}function ic(t){return t[No]||null}var qu=[],Pr=-1;function Ps(t){return{current:t}}function me(t){0>Pr||(t.current=qu[Pr],qu[Pr]=null,Pr--)}function de(t,e){Pr++,qu[Pr]=t.current,t.current=e}var Cs={},qe=Ps(Cs),dt=Ps(!1),rr=Cs;function ai(t,e){var n=t.type.contextTypes;if(!n)return Cs;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 ft(t){return t=t.childContextTypes,t!=null}function yl(){me(dt),me(qe)}function tp(t,e,n){if(qe.current!==Cs)throw Error(R(168));de(qe,e),de(dt,n)}function zx(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,bb(t)||"Unknown",r));return _e({},n,s)}function vl(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Cs,rr=qe.current,de(qe,t),de(dt,dt.current),!0}function np(t,e,n){var s=t.stateNode;if(!s)throw Error(R(169));n?(t=zx(t,e,rr),s.__reactInternalMemoizedMergedChildContext=t,me(dt),me(qe),de(qe,t)):me(dt),de(dt,n)}var Cn=null,oc=!1,qc=!1;function Bx(t){Cn===null?Cn=[t]:Cn.push(t)}function Iw(t){oc=!0,Bx(t)}function Rs(){if(!qc&&Cn!==null){qc=!0;var t=0,e=le;try{var n=Cn;for(le=1;t<n.length;t++){var s=n[t];do s=s(!0);while(s!==null)}Cn=null,oc=!1}catch(r){throw Cn!==null&&(Cn=Cn.slice(t+1)),dx(nf,Rs),r}finally{le=e,qc=!1}}return null}var Rr=[],Or=0,bl=null,wl=0,Rt=[],Ot=0,ir=null,En=1,Mn="";function Fs(t,e){Rr[Or++]=wl,Rr[Or++]=bl,bl=t,wl=e}function $x(t,e,n){Rt[Ot++]=En,Rt[Ot++]=Mn,Rt[Ot++]=ir,ir=t;var s=En;t=Mn;var r=32-Kt(s)-1;s&=~(1<<r),n+=1;var i=32-Kt(e)+r;if(30<i){var o=r-r%5;i=(s&(1<<o)-1).toString(32),s>>=o,r-=o,En=1<<32-Kt(e)+r|n<<r|s,Mn=i+t}else En=1<<i|n<<r|s,Mn=t}function ff(t){t.return!==null&&(Fs(t,1),$x(t,1,0))}function hf(t){for(;t===bl;)bl=Rr[--Or],Rr[Or]=null,wl=Rr[--Or],Rr[Or]=null;for(;t===ir;)ir=Rt[--Ot],Rt[Ot]=null,Mn=Rt[--Ot],Rt[Ot]=null,En=Rt[--Ot],Rt[Ot]=null}var wt=null,bt=null,ye=!1,Qt=null;function Ux(t,e){var n=Dt(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 sp(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,wt=t,bt=gs(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,wt=t,bt=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=ir!==null?{id:En,overflow:Mn}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=Dt(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,wt=t,bt=null,!0):!1;default:return!1}}function Gu(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Ju(t){if(ye){var e=bt;if(e){var n=e;if(!sp(t,e)){if(Gu(t))throw Error(R(418));e=gs(n.nextSibling);var s=wt;e&&sp(t,e)?Ux(s,n):(t.flags=t.flags&-4097|2,ye=!1,wt=t)}}else{if(Gu(t))throw Error(R(418));t.flags=t.flags&-4097|2,ye=!1,wt=t}}}function rp(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;wt=t}function Sa(t){if(t!==wt)return!1;if(!ye)return rp(t),ye=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Ku(t.type,t.memoizedProps)),e&&(e=bt)){if(Gu(t))throw Wx(),Error(R(418));for(;e;)Ux(t,e),e=gs(e.nextSibling)}if(rp(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){bt=gs(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}bt=null}}else bt=wt?gs(t.stateNode.nextSibling):null;return!0}function Wx(){for(var t=bt;t;)t=gs(t.nextSibling)}function li(){bt=wt=null,ye=!1}function pf(t){Qt===null?Qt=[t]:Qt.push(t)}var Fw=In.ReactCurrentBatchConfig;function Li(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 _a(t,e){throw t=Object.prototype.toString.call(e),Error(R(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function ip(t){var e=t._init;return e(t._payload)}function Hx(t){function e(y,m){if(t){var v=y.deletions;v===null?(y.deletions=[m],y.flags|=16):v.push(m)}}function n(y,m){if(!t)return null;for(;m!==null;)e(y,m),m=m.sibling;return null}function s(y,m){for(y=new Map;m!==null;)m.key!==null?y.set(m.key,m):y.set(m.index,m),m=m.sibling;return y}function r(y,m){return y=vs(y,m),y.index=0,y.sibling=null,y}function i(y,m,v){return y.index=v,t?(v=y.alternate,v!==null?(v=v.index,v<m?(y.flags|=2,m):v):(y.flags|=2,m)):(y.flags|=1048576,m)}function o(y){return t&&y.alternate===null&&(y.flags|=2),y}function a(y,m,v,S){return m===null||m.tag!==6?(m=su(v,y.mode,S),m.return=y,m):(m=r(m,v),m.return=y,m)}function l(y,m,v,S){var _=v.type;return _===Cr?d(y,m,v.props.children,S,v.key):m!==null&&(m.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Qn&&ip(_)===m.type)?(S=r(m,v.props),S.ref=Li(y,m,v),S.return=y,S):(S=nl(v.type,v.key,v.props,null,y.mode,S),S.ref=Li(y,m,v),S.return=y,S)}function c(y,m,v,S){return m===null||m.tag!==4||m.stateNode.containerInfo!==v.containerInfo||m.stateNode.implementation!==v.implementation?(m=ru(v,y.mode,S),m.return=y,m):(m=r(m,v.children||[]),m.return=y,m)}function d(y,m,v,S,_){return m===null||m.tag!==7?(m=nr(v,y.mode,S,_),m.return=y,m):(m=r(m,v),m.return=y,m)}function f(y,m,v){if(typeof m=="string"&&m!==""||typeof m=="number")return m=su(""+m,y.mode,v),m.return=y,m;if(typeof m=="object"&&m!==null){switch(m.$$typeof){case fa:return v=nl(m.type,m.key,m.props,null,y.mode,v),v.ref=Li(y,null,m),v.return=y,v;case kr:return m=ru(m,y.mode,v),m.return=y,m;case Qn:var S=m._init;return f(y,S(m._payload),v)}if(Qi(m)||Pi(m))return m=nr(m,y.mode,v,null),m.return=y,m;_a(y,m)}return null}function h(y,m,v,S){var _=m!==null?m.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return _!==null?null:a(y,m,""+v,S);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case fa:return v.key===_?l(y,m,v,S):null;case kr:return v.key===_?c(y,m,v,S):null;case Qn:return _=v._init,h(y,m,_(v._payload),S)}if(Qi(v)||Pi(v))return _!==null?null:d(y,m,v,S,null);_a(y,v)}return null}function p(y,m,v,S,_){if(typeof S=="string"&&S!==""||typeof S=="number")return y=y.get(v)||null,a(m,y,""+S,_);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case fa:return y=y.get(S.key===null?v:S.key)||null,l(m,y,S,_);case kr:return y=y.get(S.key===null?v:S.key)||null,c(m,y,S,_);case Qn:var k=S._init;return p(y,m,v,k(S._payload),_)}if(Qi(S)||Pi(S))return y=y.get(v)||null,d(m,y,S,_,null);_a(m,S)}return null}function x(y,m,v,S){for(var _=null,k=null,C=m,N=m=0,P=null;C!==null&&N<v.length;N++){C.index>N?(P=C,C=null):P=C.sibling;var M=h(y,C,v[N],S);if(M===null){C===null&&(C=P);break}t&&C&&M.alternate===null&&e(y,C),m=i(M,m,N),k===null?_=M:k.sibling=M,k=M,C=P}if(N===v.length)return n(y,C),ye&&Fs(y,N),_;if(C===null){for(;N<v.length;N++)C=f(y,v[N],S),C!==null&&(m=i(C,m,N),k===null?_=C:k.sibling=C,k=C);return ye&&Fs(y,N),_}for(C=s(y,C);N<v.length;N++)P=p(C,y,N,v[N],S),P!==null&&(t&&P.alternate!==null&&C.delete(P.key===null?N:P.key),m=i(P,m,N),k===null?_=P:k.sibling=P,k=P);return t&&C.forEach(function(O){return e(y,O)}),ye&&Fs(y,N),_}function g(y,m,v,S){var _=Pi(v);if(typeof _!="function")throw Error(R(150));if(v=_.call(v),v==null)throw Error(R(151));for(var k=_=null,C=m,N=m=0,P=null,M=v.next();C!==null&&!M.done;N++,M=v.next()){C.index>N?(P=C,C=null):P=C.sibling;var O=h(y,C,M.value,S);if(O===null){C===null&&(C=P);break}t&&C&&O.alternate===null&&e(y,C),m=i(O,m,N),k===null?_=O:k.sibling=O,k=O,C=P}if(M.done)return n(y,C),ye&&Fs(y,N),_;if(C===null){for(;!M.done;N++,M=v.next())M=f(y,M.value,S),M!==null&&(m=i(M,m,N),k===null?_=M:k.sibling=M,k=M);return ye&&Fs(y,N),_}for(C=s(y,C);!M.done;N++,M=v.next())M=p(C,y,N,M.value,S),M!==null&&(t&&M.alternate!==null&&C.delete(M.key===null?N:M.key),m=i(M,m,N),k===null?_=M:k.sibling=M,k=M);return t&&C.forEach(function(E){return e(y,E)}),ye&&Fs(y,N),_}function b(y,m,v,S){if(typeof v=="object"&&v!==null&&v.type===Cr&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case fa:e:{for(var _=v.key,k=m;k!==null;){if(k.key===_){if(_=v.type,_===Cr){if(k.tag===7){n(y,k.sibling),m=r(k,v.props.children),m.return=y,y=m;break e}}else if(k.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Qn&&ip(_)===k.type){n(y,k.sibling),m=r(k,v.props),m.ref=Li(y,k,v),m.return=y,y=m;break e}n(y,k);break}else e(y,k);k=k.sibling}v.type===Cr?(m=nr(v.props.children,y.mode,S,v.key),m.return=y,y=m):(S=nl(v.type,v.key,v.props,null,y.mode,S),S.ref=Li(y,m,v),S.return=y,y=S)}return o(y);case kr:e:{for(k=v.key;m!==null;){if(m.key===k)if(m.tag===4&&m.stateNode.containerInfo===v.containerInfo&&m.stateNode.implementation===v.implementation){n(y,m.sibling),m=r(m,v.children||[]),m.return=y,y=m;break e}else{n(y,m);break}else e(y,m);m=m.sibling}m=ru(v,y.mode,S),m.return=y,y=m}return o(y);case Qn:return k=v._init,b(y,m,k(v._payload),S)}if(Qi(v))return x(y,m,v,S);if(Pi(v))return g(y,m,v,S);_a(y,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,m!==null&&m.tag===6?(n(y,m.sibling),m=r(m,v),m.return=y,y=m):(n(y,m),m=su(v,y.mode,S),m.return=y,y=m),o(y)):n(y,m)}return b}var ci=Hx(!0),Vx=Hx(!1),Sl=Ps(null),_l=null,Dr=null,gf=null;function mf(){gf=Dr=_l=null}function xf(t){var e=Sl.current;me(Sl),t._currentValue=e}function Zu(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 $r(t,e){_l=t,gf=Dr=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(lt=!0),t.firstContext=null)}function At(t){var e=t._currentValue;if(gf!==t)if(t={context:t,memoizedValue:e,next:null},Dr===null){if(_l===null)throw Error(R(308));Dr=t,_l.dependencies={lanes:0,firstContext:t}}else Dr=Dr.next=t;return e}var Us=null;function yf(t){Us===null?Us=[t]:Us.push(t)}function Qx(t,e,n,s){var r=e.interleaved;return r===null?(n.next=n,yf(e)):(n.next=r.next,r.next=n),e.interleaved=n,Ln(t,s)}function Ln(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 Kn=!1;function vf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Kx(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 On(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function ms(t,e,n){var s=t.updateQueue;if(s===null)return null;if(s=s.shared,te&2){var r=s.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),s.pending=e,Ln(t,n)}return r=s.interleaved,r===null?(e.next=e,yf(s)):(e.next=r.next,r.next=e),s.interleaved=e,Ln(t,n)}function qa(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,sf(t,n)}}function op(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 kl(t,e,n,s){var r=t.updateQueue;Kn=!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 d=t.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=c:a.next=c,d.lastBaseUpdate=l))}if(i!==null){var f=r.baseState;o=0,d=c=l=null,a=i;do{var h=a.lane,p=a.eventTime;if((s&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var x=t,g=a;switch(h=e,p=n,g.tag){case 1:if(x=g.payload,typeof x=="function"){f=x.call(p,f,h);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=g.payload,h=typeof x=="function"?x.call(p,f,h):x,h==null)break e;f=_e({},f,h);break e;case 2:Kn=!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},d===null?(c=d=p,l=f):d=d.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(d===null&&(l=f),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=d,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);ar|=o,t.lanes=o,t.memoizedState=f}}function ap(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 Jo={},xn=Ps(Jo),Eo=Ps(Jo),Mo=Ps(Jo);function Ws(t){if(t===Jo)throw Error(R(174));return t}function bf(t,e){switch(de(Mo,e),de(Eo,t),de(xn,Jo),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Du(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Du(e,t)}me(xn),de(xn,e)}function ui(){me(xn),me(Eo),me(Mo)}function Yx(t){Ws(Mo.current);var e=Ws(xn.current),n=Du(e,t.type);e!==n&&(de(Eo,t),de(xn,n))}function wf(t){Eo.current===t&&(me(xn),me(Eo))}var we=Ps(0);function Cl(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 Gc=[];function Sf(){for(var t=0;t<Gc.length;t++)Gc[t]._workInProgressVersionPrimary=null;Gc.length=0}var Ga=In.ReactCurrentDispatcher,Jc=In.ReactCurrentBatchConfig,or=0,Se=null,Oe=null,Ae=null,jl=!1,oo=!1,Po=0,zw=0;function Qe(){throw Error(R(321))}function _f(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!qt(t[n],e[n]))return!1;return!0}function kf(t,e,n,s,r,i){if(or=i,Se=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Ga.current=t===null||t.memoizedState===null?Ww:Hw,t=n(s,r),oo){i=0;do{if(oo=!1,Po=0,25<=i)throw Error(R(301));i+=1,Ae=Oe=null,e.updateQueue=null,Ga.current=Vw,t=n(s,r)}while(oo)}if(Ga.current=Nl,e=Oe!==null&&Oe.next!==null,or=0,Ae=Oe=Se=null,jl=!1,e)throw Error(R(300));return t}function Cf(){var t=Po!==0;return Po=0,t}function cn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ae===null?Se.memoizedState=Ae=t:Ae=Ae.next=t,Ae}function It(){if(Oe===null){var t=Se.alternate;t=t!==null?t.memoizedState:null}else t=Oe.next;var e=Ae===null?Se.memoizedState:Ae.next;if(e!==null)Ae=e,Oe=t;else{if(t===null)throw Error(R(310));Oe=t,t={memoizedState:Oe.memoizedState,baseState:Oe.baseState,baseQueue:Oe.baseQueue,queue:Oe.queue,next:null},Ae===null?Se.memoizedState=Ae=t:Ae=Ae.next=t}return Ae}function Ro(t,e){return typeof e=="function"?e(t):e}function Zc(t){var e=It(),n=e.queue;if(n===null)throw Error(R(311));n.lastRenderedReducer=t;var s=Oe,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 d=c.lane;if((or&d)===d)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:d,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=f,o=s):l=l.next=f,Se.lanes|=d,ar|=d}c=c.next}while(c!==null&&c!==i);l===null?o=s:l.next=a,qt(s,e.memoizedState)||(lt=!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,Se.lanes|=i,ar|=i,r=r.next;while(r!==t)}else r===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function eu(t){var e=It(),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);qt(i,e.memoizedState)||(lt=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,s]}function Xx(){}function qx(t,e){var n=Se,s=It(),r=e(),i=!qt(s.memoizedState,r);if(i&&(s.memoizedState=r,lt=!0),s=s.queue,jf(Zx.bind(null,n,s,t),[t]),s.getSnapshot!==e||i||Ae!==null&&Ae.memoizedState.tag&1){if(n.flags|=2048,Oo(9,Jx.bind(null,n,s,r,e),void 0,null),ze===null)throw Error(R(349));or&30||Gx(n,e,r)}return r}function Gx(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Se.updateQueue,e===null?(e={lastEffect:null,stores:null},Se.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function Jx(t,e,n,s){e.value=n,e.getSnapshot=s,e0(e)&&t0(t)}function Zx(t,e,n){return n(function(){e0(e)&&t0(t)})}function e0(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!qt(t,n)}catch{return!0}}function t0(t){var e=Ln(t,1);e!==null&&Yt(e,t,1,-1)}function lp(t){var e=cn();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:t},e.queue=t,t=t.dispatch=Uw.bind(null,Se,t),[e.memoizedState,t]}function Oo(t,e,n,s){return t={tag:t,create:e,destroy:n,deps:s,next:null},e=Se.updateQueue,e===null?(e={lastEffect:null,stores:null},Se.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 n0(){return It().memoizedState}function Ja(t,e,n,s){var r=cn();Se.flags|=t,r.memoizedState=Oo(1|e,n,void 0,s===void 0?null:s)}function ac(t,e,n,s){var r=It();s=s===void 0?null:s;var i=void 0;if(Oe!==null){var o=Oe.memoizedState;if(i=o.destroy,s!==null&&_f(s,o.deps)){r.memoizedState=Oo(e,n,i,s);return}}Se.flags|=t,r.memoizedState=Oo(1|e,n,i,s)}function cp(t,e){return Ja(8390656,8,t,e)}function jf(t,e){return ac(2048,8,t,e)}function s0(t,e){return ac(4,2,t,e)}function r0(t,e){return ac(4,4,t,e)}function i0(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 o0(t,e,n){return n=n!=null?n.concat([t]):null,ac(4,4,i0.bind(null,e,t),n)}function Nf(){}function a0(t,e){var n=It();e=e===void 0?null:e;var s=n.memoizedState;return s!==null&&e!==null&&_f(e,s[1])?s[0]:(n.memoizedState=[t,e],t)}function l0(t,e){var n=It();e=e===void 0?null:e;var s=n.memoizedState;return s!==null&&e!==null&&_f(e,s[1])?s[0]:(t=t(),n.memoizedState=[t,e],t)}function c0(t,e,n){return or&21?(qt(n,e)||(n=px(),Se.lanes|=n,ar|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,lt=!0),t.memoizedState=n)}function Bw(t,e){var n=le;le=n!==0&&4>n?n:4,t(!0);var s=Jc.transition;Jc.transition={};try{t(!1),e()}finally{le=n,Jc.transition=s}}function u0(){return It().memoizedState}function $w(t,e,n){var s=ys(t);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},d0(t))f0(e,n);else if(n=Qx(t,e,n,s),n!==null){var r=et();Yt(n,t,s,r),h0(n,e,s)}}function Uw(t,e,n){var s=ys(t),r={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(d0(t))f0(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,qt(a,o)){var l=e.interleaved;l===null?(r.next=r,yf(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}n=Qx(t,e,r,s),n!==null&&(r=et(),Yt(n,t,s,r),h0(n,e,s))}}function d0(t){var e=t.alternate;return t===Se||e!==null&&e===Se}function f0(t,e){oo=jl=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function h0(t,e,n){if(n&4194240){var s=e.lanes;s&=t.pendingLanes,n|=s,e.lanes=n,sf(t,n)}}var Nl={readContext:At,useCallback:Qe,useContext:Qe,useEffect:Qe,useImperativeHandle:Qe,useInsertionEffect:Qe,useLayoutEffect:Qe,useMemo:Qe,useReducer:Qe,useRef:Qe,useState:Qe,useDebugValue:Qe,useDeferredValue:Qe,useTransition:Qe,useMutableSource:Qe,useSyncExternalStore:Qe,useId:Qe,unstable_isNewReconciler:!1},Ww={readContext:At,useCallback:function(t,e){return cn().memoizedState=[t,e===void 0?null:e],t},useContext:At,useEffect:cp,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Ja(4194308,4,i0.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Ja(4194308,4,t,e)},useInsertionEffect:function(t,e){return Ja(4,2,t,e)},useMemo:function(t,e){var n=cn();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var s=cn();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=$w.bind(null,Se,t),[s.memoizedState,t]},useRef:function(t){var e=cn();return t={current:t},e.memoizedState=t},useState:lp,useDebugValue:Nf,useDeferredValue:function(t){return cn().memoizedState=t},useTransition:function(){var t=lp(!1),e=t[0];return t=Bw.bind(null,t[1]),cn().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var s=Se,r=cn();if(ye){if(n===void 0)throw Error(R(407));n=n()}else{if(n=e(),ze===null)throw Error(R(349));or&30||Gx(s,e,n)}r.memoizedState=n;var i={value:n,getSnapshot:e};return r.queue=i,cp(Zx.bind(null,s,i,t),[t]),s.flags|=2048,Oo(9,Jx.bind(null,s,i,n,e),void 0,null),n},useId:function(){var t=cn(),e=ze.identifierPrefix;if(ye){var n=Mn,s=En;n=(s&~(1<<32-Kt(s)-1)).toString(32)+n,e=":"+e+"R"+n,n=Po++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=zw++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},Hw={readContext:At,useCallback:a0,useContext:At,useEffect:jf,useImperativeHandle:o0,useInsertionEffect:s0,useLayoutEffect:r0,useMemo:l0,useReducer:Zc,useRef:n0,useState:function(){return Zc(Ro)},useDebugValue:Nf,useDeferredValue:function(t){var e=It();return c0(e,Oe.memoizedState,t)},useTransition:function(){var t=Zc(Ro)[0],e=It().memoizedState;return[t,e]},useMutableSource:Xx,useSyncExternalStore:qx,useId:u0,unstable_isNewReconciler:!1},Vw={readContext:At,useCallback:a0,useContext:At,useEffect:jf,useImperativeHandle:o0,useInsertionEffect:s0,useLayoutEffect:r0,useMemo:l0,useReducer:eu,useRef:n0,useState:function(){return eu(Ro)},useDebugValue:Nf,useDeferredValue:function(t){var e=It();return Oe===null?e.memoizedState=t:c0(e,Oe.memoizedState,t)},useTransition:function(){var t=eu(Ro)[0],e=It().memoizedState;return[t,e]},useMutableSource:Xx,useSyncExternalStore:qx,useId:u0,unstable_isNewReconciler:!1};function Ut(t,e){if(t&&t.defaultProps){e=_e({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function ed(t,e,n,s){e=t.memoizedState,n=n(s,e),n=n==null?e:_e({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var lc={isMounted:function(t){return(t=t._reactInternals)?fr(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var s=et(),r=ys(t),i=On(s,r);i.payload=e,n!=null&&(i.callback=n),e=ms(t,i,r),e!==null&&(Yt(e,t,r,s),qa(e,t,r))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var s=et(),r=ys(t),i=On(s,r);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=ms(t,i,r),e!==null&&(Yt(e,t,r,s),qa(e,t,r))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=et(),s=ys(t),r=On(n,s);r.tag=2,e!=null&&(r.callback=e),e=ms(t,r,s),e!==null&&(Yt(e,t,s,n),qa(e,t,s))}};function up(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?!ko(n,s)||!ko(r,i):!0}function p0(t,e,n){var s=!1,r=Cs,i=e.contextType;return typeof i=="object"&&i!==null?i=At(i):(r=ft(e)?rr:qe.current,s=e.contextTypes,i=(s=s!=null)?ai(t,r):Cs),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=lc,t.stateNode=e,e._reactInternals=t,s&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=r,t.__reactInternalMemoizedMaskedChildContext=i),e}function dp(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&&lc.enqueueReplaceState(e,e.state,null)}function td(t,e,n,s){var r=t.stateNode;r.props=n,r.state=t.memoizedState,r.refs={},vf(t);var i=e.contextType;typeof i=="object"&&i!==null?r.context=At(i):(i=ft(e)?rr:qe.current,r.context=ai(t,i)),r.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(ed(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&&lc.enqueueReplaceState(r,r.state,null),kl(t,n,r,s),r.state=t.memoizedState),typeof r.componentDidMount=="function"&&(t.flags|=4194308)}function di(t,e){try{var n="",s=e;do n+=vb(s),s=s.return;while(s);var r=n}catch(i){r=`
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{Lc=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Qi(t):""}function yb(t){switch(t.tag){case 5:return Qi(t.type);case 16:return Qi("Lazy");case 13:return Qi("Suspense");case 19:return Qi("SuspenseList");case 0:case 2:case 15:return t=Ac(t.type,!1),t;case 11:return t=Ac(t.type.render,!1),t;case 1:return t=Ac(t.type,!0),t;default:return""}}function Eu(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 Cr:return"Fragment";case kr:return"Portal";case Cu:return"Profiler";case Jd:return"StrictMode";case ju:return"Suspense";case Nu:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Km:return(t.displayName||"Context")+".Consumer";case Qm:return(t._context.displayName||"Context")+".Provider";case Zd:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case ef:return e=t.displayName||null,e!==null?e:Eu(t.type)||"Memo";case Qn:e=t._payload,t=t._init;try{return Eu(t(e))}catch{}}return null}function vb(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 Eu(e);case 8:return e===Jd?"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 ks(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Xm(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function bb(t){var e=Xm(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 pa(t){t._valueTracker||(t._valueTracker=bb(t))}function qm(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),s="";return t&&(s=Xm(t)?t.checked?"true":"false":t.value),t=s,t!==n?(e.setValue(t),!0):!1}function ul(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 Mu(t,e){var n=e.checked;return _e({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Eh(t,e){var n=e.defaultValue==null?"":e.defaultValue,s=e.checked!=null?e.checked:e.defaultChecked;n=ks(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 Gm(t,e){e=e.checked,e!=null&&Gd(t,"checked",e,!1)}function Pu(t,e){Gm(t,e);var n=ks(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")?Ru(t,e.type,n):e.hasOwnProperty("defaultValue")&&Ru(t,e.type,ks(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Mh(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 Ru(t,e,n){(e!=="number"||ul(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Ki=Array.isArray;function Ir(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=""+ks(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 Ou(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(O(91));return _e({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Ph(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(O(92));if(Ki(n)){if(1<n.length)throw Error(O(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:ks(n)}}function Jm(t,e){var n=ks(e.value),s=ks(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 Rh(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Zm(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 Tu(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Zm(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var ga,ex=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(ga=ga||document.createElement("div"),ga.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=ga.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function vo(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var no={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},wb=["Webkit","ms","Moz","O"];Object.keys(no).forEach(function(t){wb.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),no[e]=no[t]})});function tx(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||no.hasOwnProperty(t)&&no[t]?(""+e).trim():e+"px"}function nx(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var s=n.indexOf("--")===0,r=tx(n,e[n],s);n==="float"&&(n="cssFloat"),s?t.setProperty(n,r):t[n]=r}}var Sb=_e({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 Du(t,e){if(e){if(Sb[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(O(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(O(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(O(61))}if(e.style!=null&&typeof e.style!="object")throw Error(O(62))}}function Lu(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 Au=null;function tf(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Iu=null,Fr=null,zr=null;function Oh(t){if(t=Jo(t)){if(typeof Iu!="function")throw Error(O(280));var e=t.stateNode;e&&(e=oc(e),Iu(t.stateNode,t.type,e))}}function sx(t){Fr?zr?zr.push(t):zr=[t]:Fr=t}function rx(){if(Fr){var t=Fr,e=zr;if(zr=Fr=null,Oh(t),e)for(t=0;t<e.length;t++)Oh(e[t])}}function ix(t,e){return t(e)}function ox(){}var Ic=!1;function ax(t,e,n){if(Ic)return t(e,n);Ic=!0;try{return ix(t,e,n)}finally{Ic=!1,(Fr!==null||zr!==null)&&(ox(),rx())}}function bo(t,e){var n=t.stateNode;if(n===null)return null;var s=oc(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(O(231,e,typeof n));return n}var Fu=!1;if(Tn)try{var Oi={};Object.defineProperty(Oi,"passive",{get:function(){Fu=!0}}),window.addEventListener("test",Oi,Oi),window.removeEventListener("test",Oi,Oi)}catch{Fu=!1}function _b(t,e,n,s,r,i,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(d){this.onError(d)}}var so=!1,dl=null,fl=!1,zu=null,kb={onError:function(t){so=!0,dl=t}};function Cb(t,e,n,s,r,i,o,a,l){so=!1,dl=null,_b.apply(kb,arguments)}function jb(t,e,n,s,r,i,o,a,l){if(Cb.apply(this,arguments),so){if(so){var c=dl;so=!1,dl=null}else throw Error(O(198));fl||(fl=!0,zu=c)}}function fr(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 lx(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 Th(t){if(fr(t)!==t)throw Error(O(188))}function Nb(t){var e=t.alternate;if(!e){if(e=fr(t),e===null)throw Error(O(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 Th(r),t;if(i===s)return Th(r),e;i=i.sibling}throw Error(O(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(O(189))}}if(n.alternate!==s)throw Error(O(190))}if(n.tag!==3)throw Error(O(188));return n.stateNode.current===n?t:e}function cx(t){return t=Nb(t),t!==null?ux(t):null}function ux(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=ux(t);if(e!==null)return e;t=t.sibling}return null}var dx=kt.unstable_scheduleCallback,Dh=kt.unstable_cancelCallback,Eb=kt.unstable_shouldYield,Mb=kt.unstable_requestPaint,Ne=kt.unstable_now,Pb=kt.unstable_getCurrentPriorityLevel,nf=kt.unstable_ImmediatePriority,fx=kt.unstable_UserBlockingPriority,hl=kt.unstable_NormalPriority,Rb=kt.unstable_LowPriority,hx=kt.unstable_IdlePriority,nc=null,mn=null;function Ob(t){if(mn&&typeof mn.onCommitFiberRoot=="function")try{mn.onCommitFiberRoot(nc,t,void 0,(t.current.flags&128)===128)}catch{}}var Kt=Math.clz32?Math.clz32:Lb,Tb=Math.log,Db=Math.LN2;function Lb(t){return t>>>=0,t===0?32:31-(Tb(t)/Db|0)|0}var ma=64,xa=4194304;function Yi(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 pl(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=Yi(a):(i&=o,i!==0&&(s=Yi(i)))}else o=n&~r,o!==0?s=Yi(o):i!==0&&(s=Yi(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-Kt(e),r=1<<n,s|=t[n],e&=~r;return s}function Ab(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 Ib(t,e){for(var n=t.suspendedLanes,s=t.pingedLanes,r=t.expirationTimes,i=t.pendingLanes;0<i;){var o=31-Kt(i),a=1<<o,l=r[o];l===-1?(!(a&n)||a&s)&&(r[o]=Ab(a,e)):l<=e&&(t.expiredLanes|=a),i&=~a}}function Bu(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function px(){var t=ma;return ma<<=1,!(ma&4194240)&&(ma=64),t}function Fc(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function qo(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Kt(e),t[e]=n}function Fb(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-Kt(n),i=1<<r;e[r]=0,s[r]=-1,t[r]=-1,n&=~i}}function sf(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var s=31-Kt(n),r=1<<s;r&e|t[s]&e&&(t[s]|=e),n&=~r}}var le=0;function gx(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var mx,rf,xx,yx,vx,$u=!1,ya=[],fs=null,hs=null,ps=null,wo=new Map,So=new Map,Xn=[],zb="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 Lh(t,e){switch(t){case"focusin":case"focusout":fs=null;break;case"dragenter":case"dragleave":hs=null;break;case"mouseover":case"mouseout":ps=null;break;case"pointerover":case"pointerout":wo.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":So.delete(e.pointerId)}}function Ti(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=Jo(e),e!==null&&rf(e)),t):(t.eventSystemFlags|=s,e=t.targetContainers,r!==null&&e.indexOf(r)===-1&&e.push(r),t)}function Bb(t,e,n,s,r){switch(e){case"focusin":return fs=Ti(fs,t,e,n,s,r),!0;case"dragenter":return hs=Ti(hs,t,e,n,s,r),!0;case"mouseover":return ps=Ti(ps,t,e,n,s,r),!0;case"pointerover":var i=r.pointerId;return wo.set(i,Ti(wo.get(i)||null,t,e,n,s,r)),!0;case"gotpointercapture":return i=r.pointerId,So.set(i,Ti(So.get(i)||null,t,e,n,s,r)),!0}return!1}function bx(t){var e=$s(t.target);if(e!==null){var n=fr(e);if(n!==null){if(e=n.tag,e===13){if(e=lx(n),e!==null){t.blockedOn=e,vx(t.priority,function(){xx(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 Ya(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Uu(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var s=new n.constructor(n.type,n);Au=s,n.target.dispatchEvent(s),Au=null}else return e=Jo(n),e!==null&&rf(e),t.blockedOn=n,!1;e.shift()}return!0}function Ah(t,e,n){Ya(t)&&n.delete(e)}function $b(){$u=!1,fs!==null&&Ya(fs)&&(fs=null),hs!==null&&Ya(hs)&&(hs=null),ps!==null&&Ya(ps)&&(ps=null),wo.forEach(Ah),So.forEach(Ah)}function Di(t,e){t.blockedOn===e&&(t.blockedOn=null,$u||($u=!0,kt.unstable_scheduleCallback(kt.unstable_NormalPriority,$b)))}function _o(t){function e(r){return Di(r,t)}if(0<ya.length){Di(ya[0],t);for(var n=1;n<ya.length;n++){var s=ya[n];s.blockedOn===t&&(s.blockedOn=null)}}for(fs!==null&&Di(fs,t),hs!==null&&Di(hs,t),ps!==null&&Di(ps,t),wo.forEach(e),So.forEach(e),n=0;n<Xn.length;n++)s=Xn[n],s.blockedOn===t&&(s.blockedOn=null);for(;0<Xn.length&&(n=Xn[0],n.blockedOn===null);)bx(n),n.blockedOn===null&&Xn.shift()}var Br=In.ReactCurrentBatchConfig,gl=!0;function Ub(t,e,n,s){var r=le,i=Br.transition;Br.transition=null;try{le=1,of(t,e,n,s)}finally{le=r,Br.transition=i}}function Wb(t,e,n,s){var r=le,i=Br.transition;Br.transition=null;try{le=4,of(t,e,n,s)}finally{le=r,Br.transition=i}}function of(t,e,n,s){if(gl){var r=Uu(t,e,n,s);if(r===null)Yc(t,e,s,ml,n),Lh(t,s);else if(Bb(r,t,e,n,s))s.stopPropagation();else if(Lh(t,s),e&4&&-1<zb.indexOf(t)){for(;r!==null;){var i=Jo(r);if(i!==null&&mx(i),i=Uu(t,e,n,s),i===null&&Yc(t,e,s,ml,n),i===r)break;r=i}r!==null&&s.stopPropagation()}else Yc(t,e,s,null,n)}}var ml=null;function Uu(t,e,n,s){if(ml=null,t=tf(s),t=$s(t),t!==null)if(e=fr(t),e===null)t=null;else if(n=e.tag,n===13){if(t=lx(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 ml=t,null}function wx(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(Pb()){case nf:return 1;case fx:return 4;case hl:case Rb:return 16;case hx:return 536870912;default:return 16}default:return 16}}var is=null,af=null,Xa=null;function Sx(){if(Xa)return Xa;var t,e=af,n=e.length,s,r="value"in is?is.value:is.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 Xa=r.slice(t,1<s?1-s:void 0)}function qa(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 va(){return!0}function Ih(){return!1}function jt(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)?va:Ih,this.isPropagationStopped=Ih,this}return _e(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=va)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=va)},persist:function(){},isPersistent:va}),e}var xi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},lf=jt(xi),Go=_e({},xi,{view:0,detail:0}),Hb=jt(Go),zc,Bc,Li,sc=_e({},Go,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:cf,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!==Li&&(Li&&t.type==="mousemove"?(zc=t.screenX-Li.screenX,Bc=t.screenY-Li.screenY):Bc=zc=0,Li=t),zc)},movementY:function(t){return"movementY"in t?t.movementY:Bc}}),Fh=jt(sc),Vb=_e({},sc,{dataTransfer:0}),Qb=jt(Vb),Kb=_e({},Go,{relatedTarget:0}),$c=jt(Kb),Yb=_e({},xi,{animationName:0,elapsedTime:0,pseudoElement:0}),Xb=jt(Yb),qb=_e({},xi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Gb=jt(qb),Jb=_e({},xi,{data:0}),zh=jt(Jb),Zb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ew={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"},tw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function nw(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=tw[t])?!!e[t]:!1}function cf(){return nw}var sw=_e({},Go,{key:function(t){if(t.key){var e=Zb[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=qa(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?ew[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:cf,charCode:function(t){return t.type==="keypress"?qa(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?qa(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),rw=jt(sw),iw=_e({},sc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Bh=jt(iw),ow=_e({},Go,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:cf}),aw=jt(ow),lw=_e({},xi,{propertyName:0,elapsedTime:0,pseudoElement:0}),cw=jt(lw),uw=_e({},sc,{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}),dw=jt(uw),fw=[9,13,27,32],uf=Tn&&"CompositionEvent"in window,ro=null;Tn&&"documentMode"in document&&(ro=document.documentMode);var hw=Tn&&"TextEvent"in window&&!ro,_x=Tn&&(!uf||ro&&8<ro&&11>=ro),$h=" ",Uh=!1;function kx(t,e){switch(t){case"keyup":return fw.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cx(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var jr=!1;function pw(t,e){switch(t){case"compositionend":return Cx(e);case"keypress":return e.which!==32?null:(Uh=!0,$h);case"textInput":return t=e.data,t===$h&&Uh?null:t;default:return null}}function gw(t,e){if(jr)return t==="compositionend"||!uf&&kx(t,e)?(t=Sx(),Xa=af=is=null,jr=!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 _x&&e.locale!=="ko"?null:e.data;default:return null}}var mw={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 Wh(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!mw[t.type]:e==="textarea"}function jx(t,e,n,s){sx(s),e=xl(e,"onChange"),0<e.length&&(n=new lf("onChange","change",null,n,s),t.push({event:n,listeners:e}))}var io=null,ko=null;function xw(t){Ix(t,0)}function rc(t){var e=Mr(t);if(qm(e))return t}function yw(t,e){if(t==="change")return e}var Nx=!1;if(Tn){var Uc;if(Tn){var Wc="oninput"in document;if(!Wc){var Hh=document.createElement("div");Hh.setAttribute("oninput","return;"),Wc=typeof Hh.oninput=="function"}Uc=Wc}else Uc=!1;Nx=Uc&&(!document.documentMode||9<document.documentMode)}function Vh(){io&&(io.detachEvent("onpropertychange",Ex),ko=io=null)}function Ex(t){if(t.propertyName==="value"&&rc(ko)){var e=[];jx(e,ko,t,tf(t)),ax(xw,e)}}function vw(t,e,n){t==="focusin"?(Vh(),io=e,ko=n,io.attachEvent("onpropertychange",Ex)):t==="focusout"&&Vh()}function bw(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return rc(ko)}function ww(t,e){if(t==="click")return rc(e)}function Sw(t,e){if(t==="input"||t==="change")return rc(e)}function _w(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var qt=typeof Object.is=="function"?Object.is:_w;function Co(t,e){if(qt(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(!ku.call(e,r)||!qt(t[r],e[r]))return!1}return!0}function Qh(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Kh(t,e){var n=Qh(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=Qh(n)}}function Mx(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Mx(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Px(){for(var t=window,e=ul();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=ul(t.document)}return e}function df(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 kw(t){var e=Px(),n=t.focusedElem,s=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&Mx(n.ownerDocument.documentElement,n)){if(s!==null&&df(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=Kh(n,i);var o=Kh(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 Cw=Tn&&"documentMode"in document&&11>=document.documentMode,Nr=null,Wu=null,oo=null,Hu=!1;function Yh(t,e,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Hu||Nr==null||Nr!==ul(s)||(s=Nr,"selectionStart"in s&&df(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}),oo&&Co(oo,s)||(oo=s,s=xl(Wu,"onSelect"),0<s.length&&(e=new lf("onSelect","select",null,e,n),t.push({event:e,listeners:s}),e.target=Nr)))}function ba(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var Er={animationend:ba("Animation","AnimationEnd"),animationiteration:ba("Animation","AnimationIteration"),animationstart:ba("Animation","AnimationStart"),transitionend:ba("Transition","TransitionEnd")},Hc={},Rx={};Tn&&(Rx=document.createElement("div").style,"AnimationEvent"in window||(delete Er.animationend.animation,delete Er.animationiteration.animation,delete Er.animationstart.animation),"TransitionEvent"in window||delete Er.transitionend.transition);function ic(t){if(Hc[t])return Hc[t];if(!Er[t])return t;var e=Er[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in Rx)return Hc[t]=e[n];return t}var Ox=ic("animationend"),Tx=ic("animationiteration"),Dx=ic("animationstart"),Lx=ic("transitionend"),Ax=new Map,Xh="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 Ms(t,e){Ax.set(t,e),dr(e,[t])}for(var Vc=0;Vc<Xh.length;Vc++){var Qc=Xh[Vc],jw=Qc.toLowerCase(),Nw=Qc[0].toUpperCase()+Qc.slice(1);Ms(jw,"on"+Nw)}Ms(Ox,"onAnimationEnd");Ms(Tx,"onAnimationIteration");Ms(Dx,"onAnimationStart");Ms("dblclick","onDoubleClick");Ms("focusin","onFocus");Ms("focusout","onBlur");Ms(Lx,"onTransitionEnd");oi("onMouseEnter",["mouseout","mouseover"]);oi("onMouseLeave",["mouseout","mouseover"]);oi("onPointerEnter",["pointerout","pointerover"]);oi("onPointerLeave",["pointerout","pointerover"]);dr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));dr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));dr("onBeforeInput",["compositionend","keypress","textInput","paste"]);dr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));dr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));dr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xi="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(" "),Ew=new Set("cancel close invalid load scroll toggle".split(" ").concat(Xi));function qh(t,e,n){var s=t.type||"unknown-event";t.currentTarget=n,jb(s,e,void 0,t),t.currentTarget=null}function Ix(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;qh(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;qh(r,a,c),i=l}}}if(fl)throw t=zu,fl=!1,zu=null,t}function fe(t,e){var n=e[Xu];n===void 0&&(n=e[Xu]=new Set);var s=t+"__bubble";n.has(s)||(Fx(e,t,2,!1),n.add(s))}function Kc(t,e,n){var s=0;e&&(s|=4),Fx(n,t,s,e)}var wa="_reactListening"+Math.random().toString(36).slice(2);function jo(t){if(!t[wa]){t[wa]=!0,Vm.forEach(function(n){n!=="selectionchange"&&(Ew.has(n)||Kc(n,!1,t),Kc(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[wa]||(e[wa]=!0,Kc("selectionchange",!1,e))}}function Fx(t,e,n,s){switch(wx(e)){case 1:var r=Ub;break;case 4:r=Wb;break;default:r=of}n=r.bind(null,e,n,t),r=void 0,!Fu||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 Yc(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=$s(a),o===null)return;if(l=o.tag,l===5||l===6){s=i=o;continue e}a=a.parentNode}}s=s.return}ax(function(){var c=i,d=tf(n),f=[];e:{var h=Ax.get(t);if(h!==void 0){var p=lf,x=t;switch(t){case"keypress":if(qa(n)===0)break e;case"keydown":case"keyup":p=rw;break;case"focusin":x="focus",p=$c;break;case"focusout":x="blur",p=$c;break;case"beforeblur":case"afterblur":p=$c;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=Fh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=Qb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=aw;break;case Ox:case Tx:case Dx:p=Xb;break;case Lx:p=cw;break;case"scroll":p=Hb;break;case"wheel":p=dw;break;case"copy":case"cut":case"paste":p=Gb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Bh}var g=(e&4)!==0,b=!g&&t==="scroll",y=g?h!==null?h+"Capture":null:h;g=[];for(var m=c,v;m!==null;){v=m;var S=v.stateNode;if(v.tag===5&&S!==null&&(v=S,y!==null&&(S=bo(m,y),S!=null&&g.push(No(m,S,v)))),b)break;m=m.return}0<g.length&&(h=new p(h,x,null,n,d),f.push({event:h,listeners:g}))}}if(!(e&7)){e:{if(h=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",h&&n!==Au&&(x=n.relatedTarget||n.fromElement)&&($s(x)||x[Dn]))break e;if((p||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,p?(x=n.relatedTarget||n.toElement,p=c,x=x?$s(x):null,x!==null&&(b=fr(x),x!==b||x.tag!==5&&x.tag!==6)&&(x=null)):(p=null,x=c),p!==x)){if(g=Fh,S="onMouseLeave",y="onMouseEnter",m="mouse",(t==="pointerout"||t==="pointerover")&&(g=Bh,S="onPointerLeave",y="onPointerEnter",m="pointer"),b=p==null?h:Mr(p),v=x==null?h:Mr(x),h=new g(S,m+"leave",p,n,d),h.target=b,h.relatedTarget=v,S=null,$s(d)===c&&(g=new g(y,m+"enter",x,n,d),g.target=v,g.relatedTarget=b,S=g),b=S,p&&x)t:{for(g=p,y=x,m=0,v=g;v;v=br(v))m++;for(v=0,S=y;S;S=br(S))v++;for(;0<m-v;)g=br(g),m--;for(;0<v-m;)y=br(y),v--;for(;m--;){if(g===y||y!==null&&g===y.alternate)break t;g=br(g),y=br(y)}g=null}else g=null;p!==null&&Gh(f,h,p,g,!1),x!==null&&b!==null&&Gh(f,b,x,g,!0)}}e:{if(h=c?Mr(c):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var _=yw;else if(Wh(h))if(Nx)_=Sw;else{_=bw;var k=vw}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(_=ww);if(_&&(_=_(t,c))){jx(f,_,n,d);break e}k&&k(t,h,c),t==="focusout"&&(k=h._wrapperState)&&k.controlled&&h.type==="number"&&Ru(h,"number",h.value)}switch(k=c?Mr(c):window,t){case"focusin":(Wh(k)||k.contentEditable==="true")&&(Nr=k,Wu=c,oo=null);break;case"focusout":oo=Wu=Nr=null;break;case"mousedown":Hu=!0;break;case"contextmenu":case"mouseup":case"dragend":Hu=!1,Yh(f,n,d);break;case"selectionchange":if(Cw)break;case"keydown":case"keyup":Yh(f,n,d)}var C;if(uf)e:{switch(t){case"compositionstart":var j="onCompositionStart";break e;case"compositionend":j="onCompositionEnd";break e;case"compositionupdate":j="onCompositionUpdate";break e}j=void 0}else jr?kx(t,n)&&(j="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(j="onCompositionStart");j&&(_x&&n.locale!=="ko"&&(jr||j!=="onCompositionStart"?j==="onCompositionEnd"&&jr&&(C=Sx()):(is=d,af="value"in is?is.value:is.textContent,jr=!0)),k=xl(c,j),0<k.length&&(j=new zh(j,t,null,n,d),f.push({event:j,listeners:k}),C?j.data=C:(C=Cx(n),C!==null&&(j.data=C)))),(C=hw?pw(t,n):gw(t,n))&&(c=xl(c,"onBeforeInput"),0<c.length&&(d=new zh("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:c}),d.data=C))}Ix(f,e)})}function No(t,e,n){return{instance:t,listener:e,currentTarget:n}}function xl(t,e){for(var n=e+"Capture",s=[];t!==null;){var r=t,i=r.stateNode;r.tag===5&&i!==null&&(r=i,i=bo(t,n),i!=null&&s.unshift(No(t,i,r)),i=bo(t,e),i!=null&&s.push(No(t,i,r))),t=t.return}return s}function br(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Gh(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=bo(n,i),l!=null&&o.unshift(No(n,l,a))):r||(l=bo(n,i),l!=null&&o.push(No(n,l,a)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var Mw=/\r\n?/g,Pw=/\u0000|\uFFFD/g;function Jh(t){return(typeof t=="string"?t:""+t).replace(Mw,`
38
+ `).replace(Pw,"")}function Sa(t,e,n){if(e=Jh(e),Jh(t)!==e&&n)throw Error(O(425))}function yl(){}var Vu=null,Qu=null;function Ku(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 Yu=typeof setTimeout=="function"?setTimeout:void 0,Rw=typeof clearTimeout=="function"?clearTimeout:void 0,Zh=typeof Promise=="function"?Promise:void 0,Ow=typeof queueMicrotask=="function"?queueMicrotask:typeof Zh<"u"?function(t){return Zh.resolve(null).then(t).catch(Tw)}:Yu;function Tw(t){setTimeout(function(){throw t})}function Xc(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),_o(e);return}s--}else n!=="$"&&n!=="$?"&&n!=="$!"||s++;n=r}while(n);_o(e)}function gs(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 ep(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 yi=Math.random().toString(36).slice(2),gn="__reactFiber$"+yi,Eo="__reactProps$"+yi,Dn="__reactContainer$"+yi,Xu="__reactEvents$"+yi,Dw="__reactListeners$"+yi,Lw="__reactHandles$"+yi;function $s(t){var e=t[gn];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Dn]||n[gn]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=ep(t);t!==null;){if(n=t[gn])return n;t=ep(t)}return e}t=n,n=t.parentNode}return null}function Jo(t){return t=t[gn]||t[Dn],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Mr(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(O(33))}function oc(t){return t[Eo]||null}var qu=[],Pr=-1;function Ps(t){return{current:t}}function me(t){0>Pr||(t.current=qu[Pr],qu[Pr]=null,Pr--)}function de(t,e){Pr++,qu[Pr]=t.current,t.current=e}var Cs={},qe=Ps(Cs),dt=Ps(!1),rr=Cs;function ai(t,e){var n=t.type.contextTypes;if(!n)return Cs;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 ft(t){return t=t.childContextTypes,t!=null}function vl(){me(dt),me(qe)}function tp(t,e,n){if(qe.current!==Cs)throw Error(O(168));de(qe,e),de(dt,n)}function zx(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(O(108,vb(t)||"Unknown",r));return _e({},n,s)}function bl(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Cs,rr=qe.current,de(qe,t),de(dt,dt.current),!0}function np(t,e,n){var s=t.stateNode;if(!s)throw Error(O(169));n?(t=zx(t,e,rr),s.__reactInternalMemoizedMergedChildContext=t,me(dt),me(qe),de(qe,t)):me(dt),de(dt,n)}var Cn=null,ac=!1,qc=!1;function Bx(t){Cn===null?Cn=[t]:Cn.push(t)}function Aw(t){ac=!0,Bx(t)}function Rs(){if(!qc&&Cn!==null){qc=!0;var t=0,e=le;try{var n=Cn;for(le=1;t<n.length;t++){var s=n[t];do s=s(!0);while(s!==null)}Cn=null,ac=!1}catch(r){throw Cn!==null&&(Cn=Cn.slice(t+1)),dx(nf,Rs),r}finally{le=e,qc=!1}}return null}var Rr=[],Or=0,wl=null,Sl=0,Rt=[],Ot=0,ir=null,En=1,Mn="";function Fs(t,e){Rr[Or++]=Sl,Rr[Or++]=wl,wl=t,Sl=e}function $x(t,e,n){Rt[Ot++]=En,Rt[Ot++]=Mn,Rt[Ot++]=ir,ir=t;var s=En;t=Mn;var r=32-Kt(s)-1;s&=~(1<<r),n+=1;var i=32-Kt(e)+r;if(30<i){var o=r-r%5;i=(s&(1<<o)-1).toString(32),s>>=o,r-=o,En=1<<32-Kt(e)+r|n<<r|s,Mn=i+t}else En=1<<i|n<<r|s,Mn=t}function ff(t){t.return!==null&&(Fs(t,1),$x(t,1,0))}function hf(t){for(;t===wl;)wl=Rr[--Or],Rr[Or]=null,Sl=Rr[--Or],Rr[Or]=null;for(;t===ir;)ir=Rt[--Ot],Rt[Ot]=null,Mn=Rt[--Ot],Rt[Ot]=null,En=Rt[--Ot],Rt[Ot]=null}var St=null,wt=null,ye=!1,Qt=null;function Ux(t,e){var n=Tt(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 sp(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,St=t,wt=gs(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,St=t,wt=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=ir!==null?{id:En,overflow:Mn}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=Tt(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,St=t,wt=null,!0):!1;default:return!1}}function Gu(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Ju(t){if(ye){var e=wt;if(e){var n=e;if(!sp(t,e)){if(Gu(t))throw Error(O(418));e=gs(n.nextSibling);var s=St;e&&sp(t,e)?Ux(s,n):(t.flags=t.flags&-4097|2,ye=!1,St=t)}}else{if(Gu(t))throw Error(O(418));t.flags=t.flags&-4097|2,ye=!1,St=t}}}function rp(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;St=t}function _a(t){if(t!==St)return!1;if(!ye)return rp(t),ye=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Ku(t.type,t.memoizedProps)),e&&(e=wt)){if(Gu(t))throw Wx(),Error(O(418));for(;e;)Ux(t,e),e=gs(e.nextSibling)}if(rp(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(O(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){wt=gs(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}wt=null}}else wt=St?gs(t.stateNode.nextSibling):null;return!0}function Wx(){for(var t=wt;t;)t=gs(t.nextSibling)}function li(){wt=St=null,ye=!1}function pf(t){Qt===null?Qt=[t]:Qt.push(t)}var Iw=In.ReactCurrentBatchConfig;function Ai(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(O(309));var s=n.stateNode}if(!s)throw Error(O(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(O(284));if(!n._owner)throw Error(O(290,t))}return t}function ka(t,e){throw t=Object.prototype.toString.call(e),Error(O(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function ip(t){var e=t._init;return e(t._payload)}function Hx(t){function e(y,m){if(t){var v=y.deletions;v===null?(y.deletions=[m],y.flags|=16):v.push(m)}}function n(y,m){if(!t)return null;for(;m!==null;)e(y,m),m=m.sibling;return null}function s(y,m){for(y=new Map;m!==null;)m.key!==null?y.set(m.key,m):y.set(m.index,m),m=m.sibling;return y}function r(y,m){return y=vs(y,m),y.index=0,y.sibling=null,y}function i(y,m,v){return y.index=v,t?(v=y.alternate,v!==null?(v=v.index,v<m?(y.flags|=2,m):v):(y.flags|=2,m)):(y.flags|=1048576,m)}function o(y){return t&&y.alternate===null&&(y.flags|=2),y}function a(y,m,v,S){return m===null||m.tag!==6?(m=su(v,y.mode,S),m.return=y,m):(m=r(m,v),m.return=y,m)}function l(y,m,v,S){var _=v.type;return _===Cr?d(y,m,v.props.children,S,v.key):m!==null&&(m.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Qn&&ip(_)===m.type)?(S=r(m,v.props),S.ref=Ai(y,m,v),S.return=y,S):(S=sl(v.type,v.key,v.props,null,y.mode,S),S.ref=Ai(y,m,v),S.return=y,S)}function c(y,m,v,S){return m===null||m.tag!==4||m.stateNode.containerInfo!==v.containerInfo||m.stateNode.implementation!==v.implementation?(m=ru(v,y.mode,S),m.return=y,m):(m=r(m,v.children||[]),m.return=y,m)}function d(y,m,v,S,_){return m===null||m.tag!==7?(m=nr(v,y.mode,S,_),m.return=y,m):(m=r(m,v),m.return=y,m)}function f(y,m,v){if(typeof m=="string"&&m!==""||typeof m=="number")return m=su(""+m,y.mode,v),m.return=y,m;if(typeof m=="object"&&m!==null){switch(m.$$typeof){case ha:return v=sl(m.type,m.key,m.props,null,y.mode,v),v.ref=Ai(y,null,m),v.return=y,v;case kr:return m=ru(m,y.mode,v),m.return=y,m;case Qn:var S=m._init;return f(y,S(m._payload),v)}if(Ki(m)||Ri(m))return m=nr(m,y.mode,v,null),m.return=y,m;ka(y,m)}return null}function h(y,m,v,S){var _=m!==null?m.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return _!==null?null:a(y,m,""+v,S);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case ha:return v.key===_?l(y,m,v,S):null;case kr:return v.key===_?c(y,m,v,S):null;case Qn:return _=v._init,h(y,m,_(v._payload),S)}if(Ki(v)||Ri(v))return _!==null?null:d(y,m,v,S,null);ka(y,v)}return null}function p(y,m,v,S,_){if(typeof S=="string"&&S!==""||typeof S=="number")return y=y.get(v)||null,a(m,y,""+S,_);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case ha:return y=y.get(S.key===null?v:S.key)||null,l(m,y,S,_);case kr:return y=y.get(S.key===null?v:S.key)||null,c(m,y,S,_);case Qn:var k=S._init;return p(y,m,v,k(S._payload),_)}if(Ki(S)||Ri(S))return y=y.get(v)||null,d(m,y,S,_,null);ka(m,S)}return null}function x(y,m,v,S){for(var _=null,k=null,C=m,j=m=0,P=null;C!==null&&j<v.length;j++){C.index>j?(P=C,C=null):P=C.sibling;var E=h(y,C,v[j],S);if(E===null){C===null&&(C=P);break}t&&C&&E.alternate===null&&e(y,C),m=i(E,m,j),k===null?_=E:k.sibling=E,k=E,C=P}if(j===v.length)return n(y,C),ye&&Fs(y,j),_;if(C===null){for(;j<v.length;j++)C=f(y,v[j],S),C!==null&&(m=i(C,m,j),k===null?_=C:k.sibling=C,k=C);return ye&&Fs(y,j),_}for(C=s(y,C);j<v.length;j++)P=p(C,y,j,v[j],S),P!==null&&(t&&P.alternate!==null&&C.delete(P.key===null?j:P.key),m=i(P,m,j),k===null?_=P:k.sibling=P,k=P);return t&&C.forEach(function(R){return e(y,R)}),ye&&Fs(y,j),_}function g(y,m,v,S){var _=Ri(v);if(typeof _!="function")throw Error(O(150));if(v=_.call(v),v==null)throw Error(O(151));for(var k=_=null,C=m,j=m=0,P=null,E=v.next();C!==null&&!E.done;j++,E=v.next()){C.index>j?(P=C,C=null):P=C.sibling;var R=h(y,C,E.value,S);if(R===null){C===null&&(C=P);break}t&&C&&R.alternate===null&&e(y,C),m=i(R,m,j),k===null?_=R:k.sibling=R,k=R,C=P}if(E.done)return n(y,C),ye&&Fs(y,j),_;if(C===null){for(;!E.done;j++,E=v.next())E=f(y,E.value,S),E!==null&&(m=i(E,m,j),k===null?_=E:k.sibling=E,k=E);return ye&&Fs(y,j),_}for(C=s(y,C);!E.done;j++,E=v.next())E=p(C,y,j,E.value,S),E!==null&&(t&&E.alternate!==null&&C.delete(E.key===null?j:E.key),m=i(E,m,j),k===null?_=E:k.sibling=E,k=E);return t&&C.forEach(function(M){return e(y,M)}),ye&&Fs(y,j),_}function b(y,m,v,S){if(typeof v=="object"&&v!==null&&v.type===Cr&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case ha:e:{for(var _=v.key,k=m;k!==null;){if(k.key===_){if(_=v.type,_===Cr){if(k.tag===7){n(y,k.sibling),m=r(k,v.props.children),m.return=y,y=m;break e}}else if(k.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Qn&&ip(_)===k.type){n(y,k.sibling),m=r(k,v.props),m.ref=Ai(y,k,v),m.return=y,y=m;break e}n(y,k);break}else e(y,k);k=k.sibling}v.type===Cr?(m=nr(v.props.children,y.mode,S,v.key),m.return=y,y=m):(S=sl(v.type,v.key,v.props,null,y.mode,S),S.ref=Ai(y,m,v),S.return=y,y=S)}return o(y);case kr:e:{for(k=v.key;m!==null;){if(m.key===k)if(m.tag===4&&m.stateNode.containerInfo===v.containerInfo&&m.stateNode.implementation===v.implementation){n(y,m.sibling),m=r(m,v.children||[]),m.return=y,y=m;break e}else{n(y,m);break}else e(y,m);m=m.sibling}m=ru(v,y.mode,S),m.return=y,y=m}return o(y);case Qn:return k=v._init,b(y,m,k(v._payload),S)}if(Ki(v))return x(y,m,v,S);if(Ri(v))return g(y,m,v,S);ka(y,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,m!==null&&m.tag===6?(n(y,m.sibling),m=r(m,v),m.return=y,y=m):(n(y,m),m=su(v,y.mode,S),m.return=y,y=m),o(y)):n(y,m)}return b}var ci=Hx(!0),Vx=Hx(!1),_l=Ps(null),kl=null,Tr=null,gf=null;function mf(){gf=Tr=kl=null}function xf(t){var e=_l.current;me(_l),t._currentValue=e}function Zu(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 $r(t,e){kl=t,gf=Tr=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(lt=!0),t.firstContext=null)}function At(t){var e=t._currentValue;if(gf!==t)if(t={context:t,memoizedValue:e,next:null},Tr===null){if(kl===null)throw Error(O(308));Tr=t,kl.dependencies={lanes:0,firstContext:t}}else Tr=Tr.next=t;return e}var Us=null;function yf(t){Us===null?Us=[t]:Us.push(t)}function Qx(t,e,n,s){var r=e.interleaved;return r===null?(n.next=n,yf(e)):(n.next=r.next,r.next=n),e.interleaved=n,Ln(t,s)}function Ln(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 Kn=!1;function vf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Kx(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 On(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function ms(t,e,n){var s=t.updateQueue;if(s===null)return null;if(s=s.shared,te&2){var r=s.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),s.pending=e,Ln(t,n)}return r=s.interleaved,r===null?(e.next=e,yf(s)):(e.next=r.next,r.next=e),s.interleaved=e,Ln(t,n)}function Ga(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,sf(t,n)}}function op(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 Cl(t,e,n,s){var r=t.updateQueue;Kn=!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 d=t.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=c:a.next=c,d.lastBaseUpdate=l))}if(i!==null){var f=r.baseState;o=0,d=c=l=null,a=i;do{var h=a.lane,p=a.eventTime;if((s&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var x=t,g=a;switch(h=e,p=n,g.tag){case 1:if(x=g.payload,typeof x=="function"){f=x.call(p,f,h);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=g.payload,h=typeof x=="function"?x.call(p,f,h):x,h==null)break e;f=_e({},f,h);break e;case 2:Kn=!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},d===null?(c=d=p,l=f):d=d.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(d===null&&(l=f),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=d,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);ar|=o,t.lanes=o,t.memoizedState=f}}function ap(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(O(191,r));r.call(s)}}}var Zo={},xn=Ps(Zo),Mo=Ps(Zo),Po=Ps(Zo);function Ws(t){if(t===Zo)throw Error(O(174));return t}function bf(t,e){switch(de(Po,e),de(Mo,t),de(xn,Zo),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Tu(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Tu(e,t)}me(xn),de(xn,e)}function ui(){me(xn),me(Mo),me(Po)}function Yx(t){Ws(Po.current);var e=Ws(xn.current),n=Tu(e,t.type);e!==n&&(de(Mo,t),de(xn,n))}function wf(t){Mo.current===t&&(me(xn),me(Mo))}var we=Ps(0);function jl(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 Gc=[];function Sf(){for(var t=0;t<Gc.length;t++)Gc[t]._workInProgressVersionPrimary=null;Gc.length=0}var Ja=In.ReactCurrentDispatcher,Jc=In.ReactCurrentBatchConfig,or=0,Se=null,Oe=null,Ae=null,Nl=!1,ao=!1,Ro=0,Fw=0;function Qe(){throw Error(O(321))}function _f(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!qt(t[n],e[n]))return!1;return!0}function kf(t,e,n,s,r,i){if(or=i,Se=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Ja.current=t===null||t.memoizedState===null?Uw:Ww,t=n(s,r),ao){i=0;do{if(ao=!1,Ro=0,25<=i)throw Error(O(301));i+=1,Ae=Oe=null,e.updateQueue=null,Ja.current=Hw,t=n(s,r)}while(ao)}if(Ja.current=El,e=Oe!==null&&Oe.next!==null,or=0,Ae=Oe=Se=null,Nl=!1,e)throw Error(O(300));return t}function Cf(){var t=Ro!==0;return Ro=0,t}function cn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ae===null?Se.memoizedState=Ae=t:Ae=Ae.next=t,Ae}function It(){if(Oe===null){var t=Se.alternate;t=t!==null?t.memoizedState:null}else t=Oe.next;var e=Ae===null?Se.memoizedState:Ae.next;if(e!==null)Ae=e,Oe=t;else{if(t===null)throw Error(O(310));Oe=t,t={memoizedState:Oe.memoizedState,baseState:Oe.baseState,baseQueue:Oe.baseQueue,queue:Oe.queue,next:null},Ae===null?Se.memoizedState=Ae=t:Ae=Ae.next=t}return Ae}function Oo(t,e){return typeof e=="function"?e(t):e}function Zc(t){var e=It(),n=e.queue;if(n===null)throw Error(O(311));n.lastRenderedReducer=t;var s=Oe,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 d=c.lane;if((or&d)===d)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:d,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=f,o=s):l=l.next=f,Se.lanes|=d,ar|=d}c=c.next}while(c!==null&&c!==i);l===null?o=s:l.next=a,qt(s,e.memoizedState)||(lt=!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,Se.lanes|=i,ar|=i,r=r.next;while(r!==t)}else r===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function eu(t){var e=It(),n=e.queue;if(n===null)throw Error(O(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);qt(i,e.memoizedState)||(lt=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,s]}function Xx(){}function qx(t,e){var n=Se,s=It(),r=e(),i=!qt(s.memoizedState,r);if(i&&(s.memoizedState=r,lt=!0),s=s.queue,jf(Zx.bind(null,n,s,t),[t]),s.getSnapshot!==e||i||Ae!==null&&Ae.memoizedState.tag&1){if(n.flags|=2048,To(9,Jx.bind(null,n,s,r,e),void 0,null),ze===null)throw Error(O(349));or&30||Gx(n,e,r)}return r}function Gx(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Se.updateQueue,e===null?(e={lastEffect:null,stores:null},Se.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function Jx(t,e,n,s){e.value=n,e.getSnapshot=s,e0(e)&&t0(t)}function Zx(t,e,n){return n(function(){e0(e)&&t0(t)})}function e0(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!qt(t,n)}catch{return!0}}function t0(t){var e=Ln(t,1);e!==null&&Yt(e,t,1,-1)}function lp(t){var e=cn();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:t},e.queue=t,t=t.dispatch=$w.bind(null,Se,t),[e.memoizedState,t]}function To(t,e,n,s){return t={tag:t,create:e,destroy:n,deps:s,next:null},e=Se.updateQueue,e===null?(e={lastEffect:null,stores:null},Se.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 n0(){return It().memoizedState}function Za(t,e,n,s){var r=cn();Se.flags|=t,r.memoizedState=To(1|e,n,void 0,s===void 0?null:s)}function lc(t,e,n,s){var r=It();s=s===void 0?null:s;var i=void 0;if(Oe!==null){var o=Oe.memoizedState;if(i=o.destroy,s!==null&&_f(s,o.deps)){r.memoizedState=To(e,n,i,s);return}}Se.flags|=t,r.memoizedState=To(1|e,n,i,s)}function cp(t,e){return Za(8390656,8,t,e)}function jf(t,e){return lc(2048,8,t,e)}function s0(t,e){return lc(4,2,t,e)}function r0(t,e){return lc(4,4,t,e)}function i0(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 o0(t,e,n){return n=n!=null?n.concat([t]):null,lc(4,4,i0.bind(null,e,t),n)}function Nf(){}function a0(t,e){var n=It();e=e===void 0?null:e;var s=n.memoizedState;return s!==null&&e!==null&&_f(e,s[1])?s[0]:(n.memoizedState=[t,e],t)}function l0(t,e){var n=It();e=e===void 0?null:e;var s=n.memoizedState;return s!==null&&e!==null&&_f(e,s[1])?s[0]:(t=t(),n.memoizedState=[t,e],t)}function c0(t,e,n){return or&21?(qt(n,e)||(n=px(),Se.lanes|=n,ar|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,lt=!0),t.memoizedState=n)}function zw(t,e){var n=le;le=n!==0&&4>n?n:4,t(!0);var s=Jc.transition;Jc.transition={};try{t(!1),e()}finally{le=n,Jc.transition=s}}function u0(){return It().memoizedState}function Bw(t,e,n){var s=ys(t);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},d0(t))f0(e,n);else if(n=Qx(t,e,n,s),n!==null){var r=et();Yt(n,t,s,r),h0(n,e,s)}}function $w(t,e,n){var s=ys(t),r={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(d0(t))f0(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,qt(a,o)){var l=e.interleaved;l===null?(r.next=r,yf(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}n=Qx(t,e,r,s),n!==null&&(r=et(),Yt(n,t,s,r),h0(n,e,s))}}function d0(t){var e=t.alternate;return t===Se||e!==null&&e===Se}function f0(t,e){ao=Nl=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function h0(t,e,n){if(n&4194240){var s=e.lanes;s&=t.pendingLanes,n|=s,e.lanes=n,sf(t,n)}}var El={readContext:At,useCallback:Qe,useContext:Qe,useEffect:Qe,useImperativeHandle:Qe,useInsertionEffect:Qe,useLayoutEffect:Qe,useMemo:Qe,useReducer:Qe,useRef:Qe,useState:Qe,useDebugValue:Qe,useDeferredValue:Qe,useTransition:Qe,useMutableSource:Qe,useSyncExternalStore:Qe,useId:Qe,unstable_isNewReconciler:!1},Uw={readContext:At,useCallback:function(t,e){return cn().memoizedState=[t,e===void 0?null:e],t},useContext:At,useEffect:cp,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Za(4194308,4,i0.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Za(4194308,4,t,e)},useInsertionEffect:function(t,e){return Za(4,2,t,e)},useMemo:function(t,e){var n=cn();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var s=cn();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=Bw.bind(null,Se,t),[s.memoizedState,t]},useRef:function(t){var e=cn();return t={current:t},e.memoizedState=t},useState:lp,useDebugValue:Nf,useDeferredValue:function(t){return cn().memoizedState=t},useTransition:function(){var t=lp(!1),e=t[0];return t=zw.bind(null,t[1]),cn().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var s=Se,r=cn();if(ye){if(n===void 0)throw Error(O(407));n=n()}else{if(n=e(),ze===null)throw Error(O(349));or&30||Gx(s,e,n)}r.memoizedState=n;var i={value:n,getSnapshot:e};return r.queue=i,cp(Zx.bind(null,s,i,t),[t]),s.flags|=2048,To(9,Jx.bind(null,s,i,n,e),void 0,null),n},useId:function(){var t=cn(),e=ze.identifierPrefix;if(ye){var n=Mn,s=En;n=(s&~(1<<32-Kt(s)-1)).toString(32)+n,e=":"+e+"R"+n,n=Ro++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=Fw++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},Ww={readContext:At,useCallback:a0,useContext:At,useEffect:jf,useImperativeHandle:o0,useInsertionEffect:s0,useLayoutEffect:r0,useMemo:l0,useReducer:Zc,useRef:n0,useState:function(){return Zc(Oo)},useDebugValue:Nf,useDeferredValue:function(t){var e=It();return c0(e,Oe.memoizedState,t)},useTransition:function(){var t=Zc(Oo)[0],e=It().memoizedState;return[t,e]},useMutableSource:Xx,useSyncExternalStore:qx,useId:u0,unstable_isNewReconciler:!1},Hw={readContext:At,useCallback:a0,useContext:At,useEffect:jf,useImperativeHandle:o0,useInsertionEffect:s0,useLayoutEffect:r0,useMemo:l0,useReducer:eu,useRef:n0,useState:function(){return eu(Oo)},useDebugValue:Nf,useDeferredValue:function(t){var e=It();return Oe===null?e.memoizedState=t:c0(e,Oe.memoizedState,t)},useTransition:function(){var t=eu(Oo)[0],e=It().memoizedState;return[t,e]},useMutableSource:Xx,useSyncExternalStore:qx,useId:u0,unstable_isNewReconciler:!1};function Ut(t,e){if(t&&t.defaultProps){e=_e({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function ed(t,e,n,s){e=t.memoizedState,n=n(s,e),n=n==null?e:_e({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var cc={isMounted:function(t){return(t=t._reactInternals)?fr(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var s=et(),r=ys(t),i=On(s,r);i.payload=e,n!=null&&(i.callback=n),e=ms(t,i,r),e!==null&&(Yt(e,t,r,s),Ga(e,t,r))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var s=et(),r=ys(t),i=On(s,r);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=ms(t,i,r),e!==null&&(Yt(e,t,r,s),Ga(e,t,r))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=et(),s=ys(t),r=On(n,s);r.tag=2,e!=null&&(r.callback=e),e=ms(t,r,s),e!==null&&(Yt(e,t,s,n),Ga(e,t,s))}};function up(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?!Co(n,s)||!Co(r,i):!0}function p0(t,e,n){var s=!1,r=Cs,i=e.contextType;return typeof i=="object"&&i!==null?i=At(i):(r=ft(e)?rr:qe.current,s=e.contextTypes,i=(s=s!=null)?ai(t,r):Cs),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=cc,t.stateNode=e,e._reactInternals=t,s&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=r,t.__reactInternalMemoizedMaskedChildContext=i),e}function dp(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&&cc.enqueueReplaceState(e,e.state,null)}function td(t,e,n,s){var r=t.stateNode;r.props=n,r.state=t.memoizedState,r.refs={},vf(t);var i=e.contextType;typeof i=="object"&&i!==null?r.context=At(i):(i=ft(e)?rr:qe.current,r.context=ai(t,i)),r.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(ed(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&&cc.enqueueReplaceState(r,r.state,null),Cl(t,n,r,s),r.state=t.memoizedState),typeof r.componentDidMount=="function"&&(t.flags|=4194308)}function di(t,e){try{var n="",s=e;do n+=yb(s),s=s.return;while(s);var r=n}catch(i){r=`
39
39
  Error generating stack: `+i.message+`
40
- `+i.stack}return{value:t,source:e,stack:r,digest:null}}function tu(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function nd(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var Qw=typeof WeakMap=="function"?WeakMap:Map;function g0(t,e,n){n=On(-1,n),n.tag=3,n.payload={element:null};var s=e.value;return n.callback=function(){Ml||(Ml=!0,fd=s),nd(t,e)},n}function m0(t,e,n){n=On(-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(){nd(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){nd(t,e),typeof s!="function"&&(xs===null?xs=new Set([this]):xs.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function fp(t,e,n){var s=t.pingCache;if(s===null){s=t.pingCache=new Qw;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=o1.bind(null,t,e,n),e.then(t,t))}function hp(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 pp(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=On(-1,1),e.tag=2,ms(n,e,1))),n.lanes|=1),t)}var Kw=In.ReactCurrentOwner,lt=!1;function Ze(t,e,n,s){e.child=t===null?Vx(e,null,n,s):ci(e,t.child,n,s)}function gp(t,e,n,s,r){n=n.render;var i=e.ref;return $r(e,r),s=kf(t,e,n,s,i,r),n=Cf(),t!==null&&!lt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~r,An(t,e,r)):(ye&&n&&ff(e),e.flags|=1,Ze(t,e,s,r),e.child)}function mp(t,e,n,s,r){if(t===null){var i=n.type;return typeof i=="function"&&!Lf(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,x0(t,e,i,s,r)):(t=nl(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:ko,n(o,s)&&t.ref===e.ref)return An(t,e,r)}return e.flags|=1,t=vs(i,s),t.ref=e.ref,t.return=e,e.child=t}function x0(t,e,n,s,r){if(t!==null){var i=t.memoizedProps;if(ko(i,s)&&t.ref===e.ref)if(lt=!1,e.pendingProps=s=i,(t.lanes&r)!==0)t.flags&131072&&(lt=!0);else return e.lanes=t.lanes,An(t,e,r)}return sd(t,e,n,s,r)}function y0(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},de(Lr,vt),vt|=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,de(Lr,vt),vt|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=i!==null?i.baseLanes:n,de(Lr,vt),vt|=s}else i!==null?(s=i.baseLanes|n,e.memoizedState=null):s=n,de(Lr,vt),vt|=s;return Ze(t,e,r,n),e.child}function v0(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function sd(t,e,n,s,r){var i=ft(n)?rr:qe.current;return i=ai(e,i),$r(e,r),n=kf(t,e,n,s,i,r),s=Cf(),t!==null&&!lt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~r,An(t,e,r)):(ye&&s&&ff(e),e.flags|=1,Ze(t,e,n,r),e.child)}function xp(t,e,n,s,r){if(ft(n)){var i=!0;vl(e)}else i=!1;if($r(e,r),e.stateNode===null)Za(t,e),p0(e,n,s),td(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=At(c):(c=ft(n)?rr:qe.current,c=ai(e,c));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==s||l!==c)&&dp(e,o,s,c),Kn=!1;var h=e.memoizedState;o.state=h,kl(e,s,o,r),l=e.memoizedState,a!==s||h!==l||dt.current||Kn?(typeof d=="function"&&(ed(e,n,d,s),l=e.memoizedState),(a=Kn||up(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,Kx(t,e),a=e.memoizedProps,c=e.type===e.elementType?a:Ut(e.type,a),o.props=c,f=e.pendingProps,h=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=At(l):(l=ft(n)?rr:qe.current,l=ai(e,l));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==f||h!==l)&&dp(e,o,s,l),Kn=!1,h=e.memoizedState,o.state=h,kl(e,s,o,r);var x=e.memoizedState;a!==f||h!==x||dt.current||Kn?(typeof p=="function"&&(ed(e,n,p,s),x=e.memoizedState),(c=Kn||up(e,n,c,s,h,x,l)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(s,x,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(s,x,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=x),o.props=s,o.state=x,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 rd(t,e,n,s,i,r)}function rd(t,e,n,s,r,i){v0(t,e);var o=(e.flags&128)!==0;if(!s&&!o)return r&&np(e,n,!1),An(t,e,i);s=e.stateNode,Kw.current=e;var a=o&&typeof n.getDerivedStateFromError!="function"?null:s.render();return e.flags|=1,t!==null&&o?(e.child=ci(e,t.child,null,i),e.child=ci(e,null,a,i)):Ze(t,e,a,i),e.memoizedState=s.state,r&&np(e,n,!0),e.child}function b0(t){var e=t.stateNode;e.pendingContext?tp(t,e.pendingContext,e.pendingContext!==e.context):e.context&&tp(t,e.context,!1),bf(t,e.containerInfo)}function yp(t,e,n,s,r){return li(),pf(r),e.flags|=256,Ze(t,e,n,s),e.child}var id={dehydrated:null,treeContext:null,retryLane:0};function od(t){return{baseLanes:t,cachePool:null,transitions:null}}function w0(t,e,n){var s=e.pendingProps,r=we.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),de(we,r&1),t===null)return Ju(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=dc(o,s,0,null),t=nr(t,s,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=od(n),e.memoizedState=id,t):Ef(e,o));if(r=t.memoizedState,r!==null&&(a=r.dehydrated,a!==null))return Yw(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=vs(r,l),s.subtreeFlags=r.subtreeFlags&14680064),a!==null?i=vs(a,i):(i=nr(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?od(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=t.childLanes&~n,e.memoizedState=id,s}return i=t.child,t=i.sibling,s=vs(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 Ef(t,e){return e=dc({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function ka(t,e,n,s){return s!==null&&pf(s),ci(e,t.child,null,n),t=Ef(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function Yw(t,e,n,s,r,i,o){if(n)return e.flags&256?(e.flags&=-257,s=tu(Error(R(422))),ka(t,e,o,s)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=s.fallback,r=e.mode,s=dc({mode:"visible",children:s.children},r,0,null),i=nr(i,r,o,null),i.flags|=2,s.return=e,i.return=e,s.sibling=i,e.child=s,e.mode&1&&ci(e,t.child,null,o),e.child.memoizedState=od(o),e.memoizedState=id,i);if(!(e.mode&1))return ka(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=tu(i,s,void 0),ka(t,e,o,s)}if(a=(o&t.childLanes)!==0,lt||a){if(s=ze,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,Ln(t,r),Yt(s,t,r,-1))}return Tf(),s=tu(Error(R(421))),ka(t,e,o,s)}return r.data==="$?"?(e.flags|=128,e.child=t.child,e=a1.bind(null,t),r._reactRetry=e,null):(t=i.treeContext,bt=gs(r.nextSibling),wt=e,ye=!0,Qt=null,t!==null&&(Rt[Ot++]=En,Rt[Ot++]=Mn,Rt[Ot++]=ir,En=t.id,Mn=t.overflow,ir=e),e=Ef(e,s.children),e.flags|=4096,e)}function vp(t,e,n){t.lanes|=e;var s=t.alternate;s!==null&&(s.lanes|=e),Zu(t.return,e,n)}function nu(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 S0(t,e,n){var s=e.pendingProps,r=s.revealOrder,i=s.tail;if(Ze(t,e,s.children,n),s=we.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&&vp(t,n,e);else if(t.tag===19)vp(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(de(we,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&&Cl(t)===null&&(r=n),n=n.sibling;n=r,n===null?(r=e.child,e.child=null):(r=n.sibling,n.sibling=null),nu(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&&Cl(t)===null){e.child=r;break}t=r.sibling,r.sibling=n,n=r,r=t}nu(e,!0,n,null,i);break;case"together":nu(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Za(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function An(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),ar|=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=vs(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=vs(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function Xw(t,e,n){switch(e.tag){case 3:b0(e),li();break;case 5:Yx(e);break;case 1:ft(e.type)&&vl(e);break;case 4:bf(e,e.stateNode.containerInfo);break;case 10:var s=e.type._context,r=e.memoizedProps.value;de(Sl,s._currentValue),s._currentValue=r;break;case 13:if(s=e.memoizedState,s!==null)return s.dehydrated!==null?(de(we,we.current&1),e.flags|=128,null):n&e.child.childLanes?w0(t,e,n):(de(we,we.current&1),t=An(t,e,n),t!==null?t.sibling:null);de(we,we.current&1);break;case 19:if(s=(n&e.childLanes)!==0,t.flags&128){if(s)return S0(t,e,n);e.flags|=128}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),de(we,we.current),s)break;return null;case 22:case 23:return e.lanes=0,y0(t,e,n)}return An(t,e,n)}var _0,ad,k0,C0;_0=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}};ad=function(){};k0=function(t,e,n,s){var r=t.memoizedProps;if(r!==s){t=e.stateNode,Ws(xn.current);var i=null;switch(n){case"input":r=Mu(t,r),s=Mu(t,s),i=[];break;case"select":r=_e({},r,{value:void 0}),s=_e({},s,{value:void 0}),i=[];break;case"textarea":r=Ou(t,r),s=Ou(t,s),i=[];break;default:typeof r.onClick!="function"&&typeof s.onClick=="function"&&(t.onclick=xl)}Tu(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"&&(xo.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"&&(xo.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&fe("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)}};C0=function(t,e,n,s){n!==s&&(e.flags|=4)};function Ai(t,e){if(!ye)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 Ke(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 qw(t,e,n){var s=e.pendingProps;switch(hf(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ke(e),null;case 1:return ft(e.type)&&yl(),Ke(e),null;case 3:return s=e.stateNode,ui(),me(dt),me(qe),Sf(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(t===null||t.child===null)&&(Sa(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Qt!==null&&(gd(Qt),Qt=null))),ad(t,e),Ke(e),null;case 5:wf(e);var r=Ws(Mo.current);if(n=e.type,t!==null&&e.stateNode!=null)k0(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 Ke(e),null}if(t=Ws(xn.current),Sa(e)){s=e.stateNode,n=e.type;var i=e.memoizedProps;switch(s[gn]=e,s[No]=i,t=(e.mode&1)!==0,n){case"dialog":fe("cancel",s),fe("close",s);break;case"iframe":case"object":case"embed":fe("load",s);break;case"video":case"audio":for(r=0;r<Yi.length;r++)fe(Yi[r],s);break;case"source":fe("error",s);break;case"img":case"image":case"link":fe("error",s),fe("load",s);break;case"details":fe("toggle",s);break;case"input":Eh(s,i),fe("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!i.multiple},fe("invalid",s);break;case"textarea":Ph(s,i),fe("invalid",s)}Tu(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&&wa(s.textContent,a,t),r=["children",a]):typeof a=="number"&&s.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&wa(s.textContent,a,t),r=["children",""+a]):xo.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&fe("scroll",s)}switch(n){case"input":ha(s),Mh(s,i,!0);break;case"textarea":ha(s),Rh(s);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(s.onclick=xl)}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=Zm(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[gn]=e,t[No]=s,_0(t,e,!1,!1),e.stateNode=t;e:{switch(o=Lu(n,s),n){case"dialog":fe("cancel",t),fe("close",t),r=s;break;case"iframe":case"object":case"embed":fe("load",t),r=s;break;case"video":case"audio":for(r=0;r<Yi.length;r++)fe(Yi[r],t);r=s;break;case"source":fe("error",t),r=s;break;case"img":case"image":case"link":fe("error",t),fe("load",t),r=s;break;case"details":fe("toggle",t),r=s;break;case"input":Eh(t,s),r=Mu(t,s),fe("invalid",t);break;case"option":r=s;break;case"select":t._wrapperState={wasMultiple:!!s.multiple},r=_e({},s,{value:void 0}),fe("invalid",t);break;case"textarea":Ph(t,s),r=Ou(t,s),fe("invalid",t);break;default:r=s}Tu(n,r),a=r;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?nx(t,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&ex(t,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&yo(t,l):typeof l=="number"&&yo(t,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(xo.hasOwnProperty(i)?l!=null&&i==="onScroll"&&fe("scroll",t):l!=null&&Gd(t,i,l,o))}switch(n){case"input":ha(t),Mh(t,s,!1);break;case"textarea":ha(t),Rh(t);break;case"option":s.value!=null&&t.setAttribute("value",""+ks(s.value));break;case"select":t.multiple=!!s.multiple,i=s.value,i!=null?Ir(t,!!s.multiple,i,!1):s.defaultValue!=null&&Ir(t,!!s.multiple,s.defaultValue,!0);break;default:typeof r.onClick=="function"&&(t.onclick=xl)}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 Ke(e),null;case 6:if(t&&e.stateNode!=null)C0(t,e,t.memoizedProps,s);else{if(typeof s!="string"&&e.stateNode===null)throw Error(R(166));if(n=Ws(Mo.current),Ws(xn.current),Sa(e)){if(s=e.stateNode,n=e.memoizedProps,s[gn]=e,(i=s.nodeValue!==n)&&(t=wt,t!==null))switch(t.tag){case 3:wa(s.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&wa(s.nodeValue,n,(t.mode&1)!==0)}i&&(e.flags|=4)}else s=(n.nodeType===9?n:n.ownerDocument).createTextNode(s),s[gn]=e,e.stateNode=s}return Ke(e),null;case 13:if(me(we),s=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(ye&&bt!==null&&e.mode&1&&!(e.flags&128))Wx(),li(),e.flags|=98560,i=!1;else if(i=Sa(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[gn]=e}else li(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Ke(e),i=!1}else Qt!==null&&(gd(Qt),Qt=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||we.current&1?Te===0&&(Te=3):Tf())),e.updateQueue!==null&&(e.flags|=4),Ke(e),null);case 4:return ui(),ad(t,e),t===null&&Co(e.stateNode.containerInfo),Ke(e),null;case 10:return xf(e.type._context),Ke(e),null;case 17:return ft(e.type)&&yl(),Ke(e),null;case 19:if(me(we),i=e.memoizedState,i===null)return Ke(e),null;if(s=(e.flags&128)!==0,o=i.rendering,o===null)if(s)Ai(i,!1);else{if(Te!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=Cl(t),o!==null){for(e.flags|=128,Ai(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 de(we,we.current&1|2),e.child}t=t.sibling}i.tail!==null&&Ne()>fi&&(e.flags|=128,s=!0,Ai(i,!1),e.lanes=4194304)}else{if(!s)if(t=Cl(o),t!==null){if(e.flags|=128,s=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Ai(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!ye)return Ke(e),null}else 2*Ne()-i.renderingStartTime>fi&&n!==1073741824&&(e.flags|=128,s=!0,Ai(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=Ne(),e.sibling=null,n=we.current,de(we,s?n&1|2:n&1),e):(Ke(e),null);case 22:case 23:return Df(),s=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==s&&(e.flags|=8192),s&&e.mode&1?vt&1073741824&&(Ke(e),e.subtreeFlags&6&&(e.flags|=8192)):Ke(e),null;case 24:return null;case 25:return null}throw Error(R(156,e.tag))}function Gw(t,e){switch(hf(e),e.tag){case 1:return ft(e.type)&&yl(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return ui(),me(dt),me(qe),Sf(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return wf(e),null;case 13:if(me(we),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(R(340));li()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return me(we),null;case 4:return ui(),null;case 10:return xf(e.type._context),null;case 22:case 23:return Df(),null;case 24:return null;default:return null}}var Ca=!1,Xe=!1,Jw=typeof WeakSet=="function"?WeakSet:Set,L=null;function Tr(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){Ce(t,e,s)}else n.current=null}function ld(t,e,n){try{n()}catch(s){Ce(t,e,s)}}var bp=!1;function Zw(t,e){if(Vu=pl,t=Px(),df(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,d=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&&++d===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(Qu={focusedElem:t,selectionRange:n},pl=!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 x=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var g=x.memoizedProps,b=x.memoizedState,y=e.stateNode,m=y.getSnapshotBeforeUpdate(e.elementType===e.type?g:Ut(e.type,g),b);y.__reactInternalSnapshotBeforeUpdate=m}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){Ce(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,L=t;break}L=e.return}return x=bp,bp=!1,x}function ao(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&&ld(e,n,i)}r=r.next}while(r!==s)}}function cc(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 cd(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 j0(t){var e=t.alternate;e!==null&&(t.alternate=null,j0(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[gn],delete e[No],delete e[Xu],delete e[Lw],delete e[Aw])),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 N0(t){return t.tag===5||t.tag===3||t.tag===4}function wp(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||N0(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 ud(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=xl));else if(s!==4&&(t=t.child,t!==null))for(ud(t,e,n),t=t.sibling;t!==null;)ud(t,e,n),t=t.sibling}function dd(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(dd(t,e,n),t=t.sibling;t!==null;)dd(t,e,n),t=t.sibling}var $e=null,Vt=!1;function Wn(t,e,n){for(n=n.child;n!==null;)E0(t,e,n),n=n.sibling}function E0(t,e,n){if(mn&&typeof mn.onCommitFiberUnmount=="function")try{mn.onCommitFiberUnmount(tc,n)}catch{}switch(n.tag){case 5:Xe||Tr(n,e);case 6:var s=$e,r=Vt;$e=null,Wn(t,e,n),$e=s,Vt=r,$e!==null&&(Vt?(t=$e,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):$e.removeChild(n.stateNode));break;case 18:$e!==null&&(Vt?(t=$e,n=n.stateNode,t.nodeType===8?Xc(t.parentNode,n):t.nodeType===1&&Xc(t,n),So(t)):Xc($e,n.stateNode));break;case 4:s=$e,r=Vt,$e=n.stateNode.containerInfo,Vt=!0,Wn(t,e,n),$e=s,Vt=r;break;case 0:case 11:case 14:case 15:if(!Xe&&(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)&&ld(n,e,o),r=r.next}while(r!==s)}Wn(t,e,n);break;case 1:if(!Xe&&(Tr(n,e),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(a){Ce(n,e,a)}Wn(t,e,n);break;case 21:Wn(t,e,n);break;case 22:n.mode&1?(Xe=(s=Xe)||n.memoizedState!==null,Wn(t,e,n),Xe=s):Wn(t,e,n);break;default:Wn(t,e,n)}}function Sp(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new Jw),e.forEach(function(s){var r=l1.bind(null,t,s);n.has(s)||(n.add(s),s.then(r,r))})}}function $t(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:$e=a.stateNode,Vt=!1;break e;case 3:$e=a.stateNode.containerInfo,Vt=!0;break e;case 4:$e=a.stateNode.containerInfo,Vt=!0;break e}a=a.return}if($e===null)throw Error(R(160));E0(i,o,r),$e=null,Vt=!1;var l=r.alternate;l!==null&&(l.return=null),r.return=null}catch(c){Ce(r,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)M0(e,t),e=e.sibling}function M0(t,e){var n=t.alternate,s=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if($t(e,t),rn(t),s&4){try{ao(3,t,t.return),cc(3,t)}catch(g){Ce(t,t.return,g)}try{ao(5,t,t.return)}catch(g){Ce(t,t.return,g)}}break;case 1:$t(e,t),rn(t),s&512&&n!==null&&Tr(n,n.return);break;case 5:if($t(e,t),rn(t),s&512&&n!==null&&Tr(n,n.return),t.flags&32){var r=t.stateNode;try{yo(r,"")}catch(g){Ce(t,t.return,g)}}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&&Gm(r,i),Lu(a,o);var c=Lu(a,i);for(o=0;o<l.length;o+=2){var d=l[o],f=l[o+1];d==="style"?nx(r,f):d==="dangerouslySetInnerHTML"?ex(r,f):d==="children"?yo(r,f):Gd(r,d,f,c)}switch(a){case"input":Pu(r,i);break;case"textarea":Jm(r,i);break;case"select":var h=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Ir(r,!!i.multiple,p,!1):h!==!!i.multiple&&(i.defaultValue!=null?Ir(r,!!i.multiple,i.defaultValue,!0):Ir(r,!!i.multiple,i.multiple?[]:"",!1))}r[No]=i}catch(g){Ce(t,t.return,g)}}break;case 6:if($t(e,t),rn(t),s&4){if(t.stateNode===null)throw Error(R(162));r=t.stateNode,i=t.memoizedProps;try{r.nodeValue=i}catch(g){Ce(t,t.return,g)}}break;case 3:if($t(e,t),rn(t),s&4&&n!==null&&n.memoizedState.isDehydrated)try{So(e.containerInfo)}catch(g){Ce(t,t.return,g)}break;case 4:$t(e,t),rn(t);break;case 13:$t(e,t),rn(t),r=t.child,r.flags&8192&&(i=r.memoizedState!==null,r.stateNode.isHidden=i,!i||r.alternate!==null&&r.alternate.memoizedState!==null||(Rf=Ne())),s&4&&Sp(t);break;case 22:if(d=n!==null&&n.memoizedState!==null,t.mode&1?(Xe=(c=Xe)||d,$t(e,t),Xe=c):$t(e,t),rn(t),s&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!d&&t.mode&1)for(L=t,d=t.child;d!==null;){for(f=L=d;L!==null;){switch(h=L,p=h.child,h.tag){case 0:case 11:case 14:case 15:ao(4,h,h.return);break;case 1:Tr(h,h.return);var x=h.stateNode;if(typeof x.componentWillUnmount=="function"){s=h,n=h.return;try{e=s,x.props=e.memoizedProps,x.state=e.memoizedState,x.componentWillUnmount()}catch(g){Ce(s,n,g)}}break;case 5:Tr(h,h.return);break;case 22:if(h.memoizedState!==null){kp(f);continue}}p!==null?(p.return=h,L=p):kp(f)}d=d.sibling}e:for(d=null,f=t;;){if(f.tag===5){if(d===null){d=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=tx("display",o))}catch(g){Ce(t,t.return,g)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=c?"":f.memoizedProps}catch(g){Ce(t,t.return,g)}}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;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:$t(e,t),rn(t),s&4&&Sp(t);break;case 21:break;default:$t(e,t),rn(t)}}function rn(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(N0(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&&(yo(r,""),s.flags&=-33);var i=wp(t);dd(t,i,r);break;case 3:case 4:var o=s.stateNode.containerInfo,a=wp(t);ud(t,a,o);break;default:throw Error(R(161))}}catch(l){Ce(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function e1(t,e,n){L=t,P0(t)}function P0(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||Ca;if(!o){var a=r.alternate,l=a!==null&&a.memoizedState!==null||Xe;a=Ca;var c=Xe;if(Ca=o,(Xe=l)&&!c)for(L=r;L!==null;)o=L,l=o.child,o.tag===22&&o.memoizedState!==null?Cp(r):l!==null?(l.return=o,L=l):Cp(r);for(;i!==null;)L=i,P0(i),i=i.sibling;L=r,Ca=a,Xe=c}_p(t)}else r.subtreeFlags&8772&&i!==null?(i.return=r,L=i):_p(t)}}function _p(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:Xe||cc(5,e);break;case 1:var s=e.stateNode;if(e.flags&4&&!Xe)if(n===null)s.componentDidMount();else{var r=e.elementType===e.type?n.memoizedProps:Ut(e.type,n.memoizedProps);s.componentDidUpdate(r,n.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&ap(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}ap(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 d=c.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&So(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(R(163))}Xe||e.flags&512&&cd(e)}catch(h){Ce(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 kp(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 Cp(t){for(;L!==null;){var e=L;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{cc(4,e)}catch(l){Ce(e,n,l)}break;case 1:var s=e.stateNode;if(typeof s.componentDidMount=="function"){var r=e.return;try{s.componentDidMount()}catch(l){Ce(e,r,l)}}var i=e.return;try{cd(e)}catch(l){Ce(e,i,l)}break;case 5:var o=e.return;try{cd(e)}catch(l){Ce(e,o,l)}}}catch(l){Ce(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 t1=Math.ceil,El=In.ReactCurrentDispatcher,Mf=In.ReactCurrentOwner,Lt=In.ReactCurrentBatchConfig,te=0,ze=null,Me=null,We=0,vt=0,Lr=Ps(0),Te=0,Do=null,ar=0,uc=0,Pf=0,lo=null,ot=null,Rf=0,fi=1/0,kn=null,Ml=!1,fd=null,xs=null,ja=!1,os=null,Pl=0,co=0,hd=null,el=-1,tl=0;function et(){return te&6?Ne():el!==-1?el:el=Ne()}function ys(t){return t.mode&1?te&2&&We!==0?We&-We:Fw.transition!==null?(tl===0&&(tl=px()),tl):(t=le,t!==0||(t=window.event,t=t===void 0?16:wx(t.type)),t):1}function Yt(t,e,n,s){if(50<co)throw co=0,hd=null,Error(R(185));Xo(t,n,s),(!(te&2)||t!==ze)&&(t===ze&&(!(te&2)&&(uc|=n),Te===4&&qn(t,We)),ht(t,s),n===1&&te===0&&!(e.mode&1)&&(fi=Ne()+500,oc&&Rs()))}function ht(t,e){var n=t.callbackNode;Fb(t,e);var s=hl(t,t===ze?We:0);if(s===0)n!==null&&Th(n),t.callbackNode=null,t.callbackPriority=0;else if(e=s&-s,t.callbackPriority!==e){if(n!=null&&Th(n),e===1)t.tag===0?Iw(jp.bind(null,t)):Bx(jp.bind(null,t)),Dw(function(){!(te&6)&&Rs()}),n=null;else{switch(gx(s)){case 1:n=nf;break;case 4:n=fx;break;case 16:n=fl;break;case 536870912:n=hx;break;default:n=fl}n=F0(n,R0.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function R0(t,e){if(el=-1,tl=0,te&6)throw Error(R(327));var n=t.callbackNode;if(Ur()&&t.callbackNode!==n)return null;var s=hl(t,t===ze?We:0);if(s===0)return null;if(s&30||s&t.expiredLanes||e)e=Rl(t,s);else{e=s;var r=te;te|=2;var i=D0();(ze!==t||We!==e)&&(kn=null,fi=Ne()+500,tr(t,e));do try{r1();break}catch(a){O0(t,a)}while(!0);mf(),El.current=i,te=r,Me!==null?e=0:(ze=null,We=0,e=Te)}if(e!==0){if(e===2&&(r=Bu(t),r!==0&&(s=r,e=pd(t,r))),e===1)throw n=Do,tr(t,0),qn(t,s),ht(t,Ne()),n;if(e===6)qn(t,s);else{if(r=t.current.alternate,!(s&30)&&!n1(r)&&(e=Rl(t,s),e===2&&(i=Bu(t),i!==0&&(s=i,e=pd(t,i))),e===1))throw n=Do,tr(t,0),qn(t,s),ht(t,Ne()),n;switch(t.finishedWork=r,t.finishedLanes=s,e){case 0:case 1:throw Error(R(345));case 2:zs(t,ot,kn);break;case 3:if(qn(t,s),(s&130023424)===s&&(e=Rf+500-Ne(),10<e)){if(hl(t,0)!==0)break;if(r=t.suspendedLanes,(r&s)!==s){et(),t.pingedLanes|=t.suspendedLanes&r;break}t.timeoutHandle=Yu(zs.bind(null,t,ot,kn),e);break}zs(t,ot,kn);break;case 4:if(qn(t,s),(s&4194240)===s)break;for(e=t.eventTimes,r=-1;0<s;){var o=31-Kt(s);i=1<<o,o=e[o],o>r&&(r=o),s&=~i}if(s=r,s=Ne()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*t1(s/1960))-s,10<s){t.timeoutHandle=Yu(zs.bind(null,t,ot,kn),s);break}zs(t,ot,kn);break;case 5:zs(t,ot,kn);break;default:throw Error(R(329))}}}return ht(t,Ne()),t.callbackNode===n?R0.bind(null,t):null}function pd(t,e){var n=lo;return t.current.memoizedState.isDehydrated&&(tr(t,e).flags|=256),t=Rl(t,e),t!==2&&(e=ot,ot=n,e!==null&&gd(e)),t}function gd(t){ot===null?ot=t:ot.push.apply(ot,t)}function n1(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(!qt(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 qn(t,e){for(e&=~Pf,e&=~uc,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-Kt(e),s=1<<n;t[n]=-1,e&=~s}}function jp(t){if(te&6)throw Error(R(327));Ur();var e=hl(t,0);if(!(e&1))return ht(t,Ne()),null;var n=Rl(t,e);if(t.tag!==0&&n===2){var s=Bu(t);s!==0&&(e=s,n=pd(t,s))}if(n===1)throw n=Do,tr(t,0),qn(t,e),ht(t,Ne()),n;if(n===6)throw Error(R(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,zs(t,ot,kn),ht(t,Ne()),null}function Of(t,e){var n=te;te|=1;try{return t(e)}finally{te=n,te===0&&(fi=Ne()+500,oc&&Rs())}}function lr(t){os!==null&&os.tag===0&&!(te&6)&&Ur();var e=te;te|=1;var n=Lt.transition,s=le;try{if(Lt.transition=null,le=1,t)return t()}finally{le=s,Lt.transition=n,te=e,!(te&6)&&Rs()}}function Df(){vt=Lr.current,me(Lr)}function tr(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,Ow(n)),Me!==null)for(n=Me.return;n!==null;){var s=n;switch(hf(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&yl();break;case 3:ui(),me(dt),me(qe),Sf();break;case 5:wf(s);break;case 4:ui();break;case 13:me(we);break;case 19:me(we);break;case 10:xf(s.type._context);break;case 22:case 23:Df()}n=n.return}if(ze=t,Me=t=vs(t.current,null),We=vt=e,Te=0,Do=null,Pf=uc=ar=0,ot=lo=null,Us!==null){for(e=0;e<Us.length;e++)if(n=Us[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}Us=null}return t}function O0(t,e){do{var n=Me;try{if(mf(),Ga.current=Nl,jl){for(var s=Se.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}jl=!1}if(or=0,Ae=Oe=Se=null,oo=!1,Po=0,Mf.current=null,n===null||n.return===null){Te=1,Do=e,Me=null;break}e:{var i=t,o=n.return,a=n,l=e;if(e=We,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,d=a,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var h=d.alternate;h?(d.updateQueue=h.updateQueue,d.memoizedState=h.memoizedState,d.lanes=h.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=hp(o);if(p!==null){p.flags&=-257,pp(p,o,a,i,e),p.mode&1&&fp(i,c,e),e=p,l=c;var x=e.updateQueue;if(x===null){var g=new Set;g.add(l),e.updateQueue=g}else x.add(l);break e}else{if(!(e&1)){fp(i,c,e),Tf();break e}l=Error(R(426))}}else if(ye&&a.mode&1){var b=hp(o);if(b!==null){!(b.flags&65536)&&(b.flags|=256),pp(b,o,a,i,e),pf(di(l,a));break e}}i=l=di(l,a),Te!==4&&(Te=2),lo===null?lo=[i]:lo.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var y=g0(i,l,e);op(i,y);break e;case 1:a=l;var m=i.type,v=i.stateNode;if(!(i.flags&128)&&(typeof m.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(xs===null||!xs.has(v)))){i.flags|=65536,e&=-e,i.lanes|=e;var S=m0(i,a,e);op(i,S);break e}}i=i.return}while(i!==null)}L0(n)}catch(_){e=_,Me===n&&n!==null&&(Me=n=n.return);continue}break}while(!0)}function D0(){var t=El.current;return El.current=Nl,t===null?Nl:t}function Tf(){(Te===0||Te===3||Te===2)&&(Te=4),ze===null||!(ar&268435455)&&!(uc&268435455)||qn(ze,We)}function Rl(t,e){var n=te;te|=2;var s=D0();(ze!==t||We!==e)&&(kn=null,tr(t,e));do try{s1();break}catch(r){O0(t,r)}while(!0);if(mf(),te=n,El.current=s,Me!==null)throw Error(R(261));return ze=null,We=0,Te}function s1(){for(;Me!==null;)T0(Me)}function r1(){for(;Me!==null&&!Mb();)T0(Me)}function T0(t){var e=I0(t.alternate,t,vt);t.memoizedProps=t.pendingProps,e===null?L0(t):Me=e,Mf.current=null}function L0(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=Gw(n,e),n!==null){n.flags&=32767,Me=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Te=6,Me=null;return}}else if(n=qw(n,e,vt),n!==null){Me=n;return}if(e=e.sibling,e!==null){Me=e;return}Me=e=t}while(e!==null);Te===0&&(Te=5)}function zs(t,e,n){var s=le,r=Lt.transition;try{Lt.transition=null,le=1,i1(t,e,n,s)}finally{Lt.transition=r,le=s}return null}function i1(t,e,n,s){do Ur();while(os!==null);if(te&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(zb(t,i),t===ze&&(Me=ze=null,We=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ja||(ja=!0,F0(fl,function(){return Ur(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Lt.transition,Lt.transition=null;var o=le;le=1;var a=te;te|=4,Mf.current=null,Zw(t,n),M0(n,t),Cw(Qu),pl=!!Vu,Qu=Vu=null,t.current=n,e1(n),Pb(),te=a,le=o,Lt.transition=i}else t.current=n;if(ja&&(ja=!1,os=t,Pl=r),i=t.pendingLanes,i===0&&(xs=null),Db(n.stateNode),ht(t,Ne()),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(Ml)throw Ml=!1,t=fd,fd=null,t;return Pl&1&&t.tag!==0&&Ur(),i=t.pendingLanes,i&1?t===hd?co++:(co=0,hd=t):co=0,Rs(),null}function Ur(){if(os!==null){var t=gx(Pl),e=Lt.transition,n=le;try{if(Lt.transition=null,le=16>t?16:t,os===null)var s=!1;else{if(t=os,os=null,Pl=0,te&6)throw Error(R(331));var r=te;for(te|=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 d=L;switch(d.tag){case 0:case 11:case 15:ao(8,d,i)}var f=d.child;if(f!==null)f.return=d,L=f;else for(;L!==null;){d=L;var h=d.sibling,p=d.return;if(j0(d),d===c){L=null;break}if(h!==null){h.return=p,L=h;break}L=p}}}var x=i.alternate;if(x!==null){var g=x.child;if(g!==null){x.child=null;do{var b=g.sibling;g.sibling=null,g=b}while(g!==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:ao(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,L=y;break e}L=i.return}}var m=t.current;for(L=m;L!==null;){o=L;var v=o.child;if(o.subtreeFlags&2064&&v!==null)v.return=o,L=v;else e:for(o=m;L!==null;){if(a=L,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:cc(9,a)}}catch(_){Ce(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(te=r,Rs(),mn&&typeof mn.onPostCommitFiberRoot=="function")try{mn.onPostCommitFiberRoot(tc,t)}catch{}s=!0}return s}finally{le=n,Lt.transition=e}}return!1}function Np(t,e,n){e=di(n,e),e=g0(t,e,1),t=ms(t,e,1),e=et(),t!==null&&(Xo(t,1,e),ht(t,e))}function Ce(t,e,n){if(t.tag===3)Np(t,t,n);else for(;e!==null;){if(e.tag===3){Np(e,t,n);break}else if(e.tag===1){var s=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(xs===null||!xs.has(s))){t=di(n,t),t=m0(e,t,1),e=ms(e,t,1),t=et(),e!==null&&(Xo(e,1,t),ht(e,t));break}}e=e.return}}function o1(t,e,n){var s=t.pingCache;s!==null&&s.delete(e),e=et(),t.pingedLanes|=t.suspendedLanes&n,ze===t&&(We&n)===n&&(Te===4||Te===3&&(We&130023424)===We&&500>Ne()-Rf?tr(t,0):Pf|=n),ht(t,e)}function A0(t,e){e===0&&(t.mode&1?(e=ma,ma<<=1,!(ma&130023424)&&(ma=4194304)):e=1);var n=et();t=Ln(t,e),t!==null&&(Xo(t,e,n),ht(t,n))}function a1(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),A0(t,n)}function l1(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),A0(t,n)}var I0;I0=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||dt.current)lt=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return lt=!1,Xw(t,e,n);lt=!!(t.flags&131072)}else lt=!1,ye&&e.flags&1048576&&$x(e,wl,e.index);switch(e.lanes=0,e.tag){case 2:var s=e.type;Za(t,e),t=e.pendingProps;var r=ai(e,qe.current);$r(e,n),r=kf(null,e,s,t,r,n);var i=Cf();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,ft(s)?(i=!0,vl(e)):i=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,vf(e),r.updater=lc,e.stateNode=r,r._reactInternals=e,td(e,s,t,n),e=rd(null,e,s,!0,i,n)):(e.tag=0,ye&&i&&ff(e),Ze(null,e,r,n),e=e.child),e;case 16:s=e.elementType;e:{switch(Za(t,e),t=e.pendingProps,r=s._init,s=r(s._payload),e.type=s,r=e.tag=u1(s),t=Ut(s,t),r){case 0:e=sd(null,e,s,t,n);break e;case 1:e=xp(null,e,s,t,n);break e;case 11:e=gp(null,e,s,t,n);break e;case 14:e=mp(null,e,s,Ut(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:Ut(s,r),sd(t,e,s,r,n);case 1:return s=e.type,r=e.pendingProps,r=e.elementType===s?r:Ut(s,r),xp(t,e,s,r,n);case 3:e:{if(b0(e),t===null)throw Error(R(387));s=e.pendingProps,i=e.memoizedState,r=i.element,Kx(t,e),kl(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=di(Error(R(423)),e),e=yp(t,e,s,n,r);break e}else if(s!==r){r=di(Error(R(424)),e),e=yp(t,e,s,n,r);break e}else for(bt=gs(e.stateNode.containerInfo.firstChild),wt=e,ye=!0,Qt=null,n=Vx(e,null,s,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(li(),s===r){e=An(t,e,n);break e}Ze(t,e,s,n)}e=e.child}return e;case 5:return Yx(e),t===null&&Ju(e),s=e.type,r=e.pendingProps,i=t!==null?t.memoizedProps:null,o=r.children,Ku(s,r)?o=null:i!==null&&Ku(s,i)&&(e.flags|=32),v0(t,e),Ze(t,e,o,n),e.child;case 6:return t===null&&Ju(e),null;case 13:return w0(t,e,n);case 4:return bf(e,e.stateNode.containerInfo),s=e.pendingProps,t===null?e.child=ci(e,null,s,n):Ze(t,e,s,n),e.child;case 11:return s=e.type,r=e.pendingProps,r=e.elementType===s?r:Ut(s,r),gp(t,e,s,r,n);case 7:return Ze(t,e,e.pendingProps,n),e.child;case 8:return Ze(t,e,e.pendingProps.children,n),e.child;case 12:return Ze(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,de(Sl,s._currentValue),s._currentValue=o,i!==null)if(qt(i.value,o)){if(i.children===r.children&&!dt.current){e=An(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=On(-1,n&-n),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?l.next=l:(l.next=d.next,d.next=l),c.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Zu(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),Zu(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}Ze(t,e,r.children,n),e=e.child}return e;case 9:return r=e.type,s=e.pendingProps.children,$r(e,n),r=At(r),s=s(r),e.flags|=1,Ze(t,e,s,n),e.child;case 14:return s=e.type,r=Ut(s,e.pendingProps),r=Ut(s.type,r),mp(t,e,s,r,n);case 15:return x0(t,e,e.type,e.pendingProps,n);case 17:return s=e.type,r=e.pendingProps,r=e.elementType===s?r:Ut(s,r),Za(t,e),e.tag=1,ft(s)?(t=!0,vl(e)):t=!1,$r(e,n),p0(e,s,r),td(e,s,r,n),rd(null,e,s,!0,t,n);case 19:return S0(t,e,n);case 22:return y0(t,e,n)}throw Error(R(156,e.tag))};function F0(t,e){return dx(t,e)}function c1(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 Dt(t,e,n,s){return new c1(t,e,n,s)}function Lf(t){return t=t.prototype,!(!t||!t.isReactComponent)}function u1(t){if(typeof t=="function")return Lf(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Zd)return 11;if(t===ef)return 14}return 2}function vs(t,e){var n=t.alternate;return n===null?(n=Dt(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 nl(t,e,n,s,r,i){var o=2;if(s=t,typeof t=="function")Lf(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Cr:return nr(n.children,r,i,e);case Jd:o=8,r|=8;break;case Cu:return t=Dt(12,n,e,r|2),t.elementType=Cu,t.lanes=i,t;case ju:return t=Dt(13,n,e,r),t.elementType=ju,t.lanes=i,t;case Nu:return t=Dt(19,n,e,r),t.elementType=Nu,t.lanes=i,t;case Ym:return dc(n,r,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Qm:o=10;break e;case Km:o=9;break e;case Zd:o=11;break e;case ef:o=14;break e;case Qn:o=16,s=null;break e}throw Error(R(130,t==null?t:typeof t,""))}return e=Dt(o,n,e,r),e.elementType=t,e.type=s,e.lanes=i,e}function nr(t,e,n,s){return t=Dt(7,t,s,e),t.lanes=n,t}function dc(t,e,n,s){return t=Dt(22,t,s,e),t.elementType=Ym,t.lanes=n,t.stateNode={isHidden:!1},t}function su(t,e,n){return t=Dt(6,t,null,e),t.lanes=n,t}function ru(t,e,n){return e=Dt(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function d1(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=Fc(0),this.expirationTimes=Fc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fc(0),this.identifierPrefix=s,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Af(t,e,n,s,r,i,o,a,l){return t=new d1(t,e,n,a,l),e===1?(e=1,i===!0&&(e|=8)):e=0,i=Dt(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},vf(i),t}function f1(t,e,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:kr,key:s==null?null:""+s,children:t,containerInfo:e,implementation:n}}function z0(t){if(!t)return Cs;t=t._reactInternals;e:{if(fr(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(ft(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(ft(n))return zx(t,n,e)}return e}function B0(t,e,n,s,r,i,o,a,l){return t=Af(n,s,!0,t,r,i,o,a,l),t.context=z0(null),n=t.current,s=et(),r=ys(n),i=On(s,r),i.callback=e??null,ms(n,i,r),t.current.lanes=r,Xo(t,r,s),ht(t,s),t}function fc(t,e,n,s){var r=e.current,i=et(),o=ys(r);return n=z0(n),e.context===null?e.context=n:e.pendingContext=n,e=On(i,o),e.payload={element:t},s=s===void 0?null:s,s!==null&&(e.callback=s),t=ms(r,e,o),t!==null&&(Yt(t,r,o,i),qa(t,r,o)),o}function Ol(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 Ep(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function If(t,e){Ep(t,e),(t=t.alternate)&&Ep(t,e)}function h1(){return null}var $0=typeof reportError=="function"?reportError:function(t){console.error(t)};function Ff(t){this._internalRoot=t}hc.prototype.render=Ff.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(R(409));fc(t,e,null,null)};hc.prototype.unmount=Ff.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;lr(function(){fc(null,t,null,null)}),e[Tn]=null}};function hc(t){this._internalRoot=t}hc.prototype.unstable_scheduleHydration=function(t){if(t){var e=yx();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Xn.length&&e!==0&&e<Xn[n].priority;n++);Xn.splice(n,0,t),n===0&&bx(t)}};function zf(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function pc(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Mp(){}function p1(t,e,n,s,r){if(r){if(typeof s=="function"){var i=s;s=function(){var c=Ol(o);i.call(c)}}var o=B0(e,s,t,0,null,!1,!1,"",Mp);return t._reactRootContainer=o,t[Tn]=o.current,Co(t.nodeType===8?t.parentNode:t),lr(),o}for(;r=t.lastChild;)t.removeChild(r);if(typeof s=="function"){var a=s;s=function(){var c=Ol(l);a.call(c)}}var l=Af(t,0,!1,null,null,!1,!1,"",Mp);return t._reactRootContainer=l,t[Tn]=l.current,Co(t.nodeType===8?t.parentNode:t),lr(function(){fc(e,l,n,s)}),l}function gc(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=Ol(o);a.call(l)}}fc(e,o,t,r)}else o=p1(n,e,t,r,s);return Ol(o)}mx=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=Ki(e.pendingLanes);n!==0&&(sf(e,n|1),ht(e,Ne()),!(te&6)&&(fi=Ne()+500,Rs()))}break;case 13:lr(function(){var s=Ln(t,1);if(s!==null){var r=et();Yt(s,t,1,r)}}),If(t,1)}};rf=function(t){if(t.tag===13){var e=Ln(t,134217728);if(e!==null){var n=et();Yt(e,t,134217728,n)}If(t,134217728)}};xx=function(t){if(t.tag===13){var e=ys(t),n=Ln(t,e);if(n!==null){var s=et();Yt(n,t,e,s)}If(t,e)}};yx=function(){return le};vx=function(t,e){var n=le;try{return le=t,e()}finally{le=n}};Iu=function(t,e,n){switch(e){case"input":if(Pu(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=ic(s);if(!r)throw Error(R(90));qm(s),Pu(s,r)}}}break;case"textarea":Jm(t,n);break;case"select":e=n.value,e!=null&&Ir(t,!!n.multiple,e,!1)}};ix=Of;ox=lr;var g1={usingClientEntryPoint:!1,Events:[Go,Mr,ic,sx,rx,Of]},Ii={findFiberByHostInstance:$s,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},m1={bundleType:Ii.bundleType,version:Ii.version,rendererPackageName:Ii.rendererPackageName,rendererConfig:Ii.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:In.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=cx(t),t===null?null:t.stateNode},findFiberByHostInstance:Ii.findFiberByHostInstance||h1,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 Na=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Na.isDisabled&&Na.supportsFiber)try{tc=Na.inject(m1),mn=Na}catch{}}kt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=g1;kt.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!zf(e))throw Error(R(200));return f1(t,e,null,n)};kt.createRoot=function(t,e){if(!zf(t))throw Error(R(299));var n=!1,s="",r=$0;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(s=e.identifierPrefix),e.onRecoverableError!==void 0&&(r=e.onRecoverableError)),e=Af(t,1,!1,null,null,n,!1,s,r),t[Tn]=e.current,Co(t.nodeType===8?t.parentNode:t),new Ff(e)};kt.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=cx(e),t=t===null?null:t.stateNode,t};kt.flushSync=function(t){return lr(t)};kt.hydrate=function(t,e,n){if(!pc(e))throw Error(R(200));return gc(null,t,e,!0,n)};kt.hydrateRoot=function(t,e,n){if(!zf(t))throw Error(R(405));var s=n!=null&&n.hydratedSources||null,r=!1,i="",o=$0;if(n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=B0(e,null,t,1,n??null,r,!1,i,o),t[Tn]=e.current,Co(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 hc(e)};kt.render=function(t,e,n){if(!pc(e))throw Error(R(200));return gc(null,t,e,!1,n)};kt.unmountComponentAtNode=function(t){if(!pc(t))throw Error(R(40));return t._reactRootContainer?(lr(function(){gc(null,null,t,!1,function(){t._reactRootContainer=null,t[Tn]=null})}),!0):!1};kt.unstable_batchedUpdates=Of;kt.unstable_renderSubtreeIntoContainer=function(t,e,n,s){if(!pc(n))throw Error(R(200));if(t==null||t._reactInternals===void 0)throw Error(R(38));return gc(t,e,n,!1,s)};kt.version="18.3.1-next-f1338f8080-20240426";function U0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(U0)}catch(t){console.error(t)}}U0(),Um.exports=kt;var Ar=Um.exports,Pp=Ar;_u.createRoot=Pp.createRoot,_u.hydrateRoot=Pp.hydrateRoot;const W0=w.createContext(void 0),x1=t=>{const e=w.useContext(W0);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},y1=({client:t,children:e})=>(w.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),u.jsx(W0.Provider,{value:t,children:e})),v1={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)};var Gn,Hd,wm,b1=(wm=class{constructor(){B(this,Gn,v1);B(this,Hd,!1)}setTimeoutProvider(t){T(this,Gn,t)}setTimeout(t,e){return j(this,Gn).setTimeout(t,e)}clearTimeout(t){j(this,Gn).clearTimeout(t)}setInterval(t,e){return j(this,Gn).setInterval(t,e)}clearInterval(t){j(this,Gn).clearInterval(t)}},Gn=new WeakMap,Hd=new WeakMap,wm);const Hs=new b1;function w1(t){setTimeout(t,0)}const S1=typeof window>"u"||"Deno"in globalThis;function it(){}function _1(t,e){return typeof t=="function"?t(e):t}function H0(t){return typeof t=="number"&&t>=0&&t!==1/0}function V0(t,e){return Math.max(t+(e||0)-Date.now(),0)}function xe(t,e){return typeof t=="function"?t(e):t}function Rp(t,e){const{type:n="all",exact:s,fetchStatus:r,predicate:i,queryKey:o,stale:a}=t;if(o){if(s){if(e.queryHash!==Bf(o,e.options))return!1}else if(!hi(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 Op(t,e){const{exact:n,status:s,predicate:r,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(n){if(To(e.options.mutationKey)!==To(i))return!1}else if(!hi(e.options.mutationKey,i))return!1}return!(s&&e.state.status!==s||r&&!r(e))}function Bf(t,e){return((e==null?void 0:e.queryKeyHashFn)||To)(t)}function To(t){return JSON.stringify(t,(e,n)=>md(n)?Object.keys(n).sort().reduce((s,r)=>(s[r]=n[r],s),{}):n)}function hi(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(!hi(t[s],e[s]))return!1;return!0}const n=Object.keys(e);for(const s of n)if(!hi(t[s],e[s]))return!1;return!0}return!1}const k1=Object.prototype.hasOwnProperty;function Q0(t,e,n=0){if(t===e)return t;if(n>500)return e;const s=Dp(t)&&Dp(e);if(!s&&!(md(t)&&md(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 d=s?c:i[c],f=t[d],h=e[d];if(f===h){a[d]=f,(s?c<r:k1.call(t,d))&&l++;continue}if(f===null||h===null||typeof f!="object"||typeof h!="object"){a[d]=h;continue}const p=Q0(f,h,n+1);a[d]=p,p===f&&l++}return r===o&&l===r?t:a}function iu(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 Dp(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function md(t){if(!Tp(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!(!Tp(s)||!s.hasOwnProperty("isPrototypeOf")||e!==Object.prototype)}function Tp(t){return Object.prototype.toString.call(t)==="[object Object]"}function C1(t){return new Promise(e=>{Hs.setTimeout(e,t)})}function xd(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?Q0(t,e):e}function j1(t,e,n=0){const s=[...t,e];return n&&s.length>n?s.slice(1):s}function N1(t,e,n=0){const s=[e,...t];return n&&s.length>n?s.slice(0,-1):s}const $f=Symbol();function K0(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===$f?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Y0(t,e){return typeof t=="function"?t(...e):!!t}function E1(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 M1=()=>S1;const Uf=()=>M1();var Zo=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(){}},Qs,Jn,Kr,Sm,P1=(Sm=class extends Zo{constructor(){super();B(this,Qs);B(this,Jn);B(this,Kr);T(this,Kr,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){j(this,Jn)||this.setEventListener(j(this,Kr))}onUnsubscribe(){var e;this.hasListeners()||((e=j(this,Jn))==null||e.call(this),T(this,Jn,void 0))}setEventListener(e){var n;T(this,Kr,e),(n=j(this,Jn))==null||n.call(this),T(this,Jn,e(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(e){j(this,Qs)!==e&&(T(this,Qs,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof j(this,Qs)=="boolean"?j(this,Qs):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Qs=new WeakMap,Jn=new WeakMap,Kr=new WeakMap,Sm);const Wf=new P1,R1=w1;function O1(){let t=[],e=0,n=a=>{a()},s=a=>{a()},r=R1;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 Ue=O1();var Yr,Zn,Xr,_m,D1=(_m=class extends Zo{constructor(){super();B(this,Yr,!0);B(this,Zn);B(this,Xr);T(this,Xr,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(){j(this,Zn)||this.setEventListener(j(this,Xr))}onUnsubscribe(){var e;this.hasListeners()||((e=j(this,Zn))==null||e.call(this),T(this,Zn,void 0))}setEventListener(e){var n;T(this,Xr,e),(n=j(this,Zn))==null||n.call(this),T(this,Zn,e(this.setOnline.bind(this)))}setOnline(e){j(this,Yr)!==e&&(T(this,Yr,e),this.listeners.forEach(n=>{n(e)}))}isOnline(){return j(this,Yr)}},Yr=new WeakMap,Zn=new WeakMap,Xr=new WeakMap,_m);const Dl=new D1;function T1(t){return Math.min(1e3*2**t,3e4)}function X0(t){return(t??"online")==="online"?Dl.isOnline():!0}var yd=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function q0(t){let e=!1,n=0,s,r="pending",i,o;const a=new Promise((m,v)=>{i=m,o=v});a.catch(it);const l=()=>r!=="pending",c=m=>{var v;if(!l()){const S=new yd(m);g(S),(v=t.onCancel)==null||v.call(t,S)}},d=()=>{e=!0},f=()=>{e=!1},h=()=>Wf.isFocused()&&(t.networkMode==="always"||Dl.isOnline())&&t.canRun(),p=()=>X0(t.networkMode)&&t.canRun(),x=m=>{l()||(s==null||s(),r="resolved",i(m))},g=m=>{l()||(s==null||s(),r="rejected",o(m))},b=m=>new Promise(v=>{var S;s=_=>{(l()||m())&&v(_)},(S=t.onPause)==null||S.call(t)}).then(()=>{var v;s=void 0,l()||(v=t.onContinue)==null||v.call(t)}),y=()=>{if(l())return;let m;const v=n===0?t.initialPromise:void 0;try{m=v??t.fn()}catch(S){m=Promise.reject(S)}Promise.resolve(m).then(x).catch(S=>{var P;if(l())return;const _=t.retry??(Uf()?0:3),k=t.retryDelay??T1,C=typeof k=="function"?k(n,S):k,N=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,S);if(e||!N){g(S);return}n++,(P=t.onFail)==null||P.call(t,n,S),C1(C).then(()=>h()?void 0:b(h)).then(()=>{e?g(S):y()})})};return{promise:a,status:()=>r,cancel:c,continue:()=>(s==null||s(),a),cancelRetry:d,continueRetry:f,canStart:p,start:()=>(p()?y():b(p).then(y),a)}}var Ks,km,G0=(km=class{constructor(){B(this,Ks)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),H0(this.gcTime)&&T(this,Ks,Hs.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Uf()?1/0:3e5))}clearGcTimeout(){j(this,Ks)!==void 0&&(Hs.clearTimeout(j(this,Ks)),T(this,Ks,void 0))}},Ks=new WeakMap,km);function L1(t){return{onFetch:(e,n)=>{var d,f,h,p,x;const s=e.options,r=(h=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,i=((p=e.state.data)==null?void 0:p.pages)||[],o=((x=e.state.data)==null?void 0:x.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let g=!1;const b=v=>{E1(v,()=>e.signal,()=>g=!0)},y=K0(e.options,e.fetchOptions),m=async(v,S,_)=>{if(g)return Promise.reject(e.signal.reason);if(S==null&&v.pages.length)return Promise.resolve(v);const C=(()=>{const O={client:e.client,queryKey:e.queryKey,pageParam:S,direction:_?"backward":"forward",meta:e.options.meta};return b(O),O})(),N=await y(C),{maxPages:P}=e.options,M=_?N1:j1;return{pages:M(v.pages,N,P),pageParams:M(v.pageParams,S,P)}};if(r&&i.length){const v=r==="backward",S=v?A1:Lp,_={pages:i,pageParams:o};a=await m(_,S(s,_),v)}else{const v=t??i.length;do{const S=l===0?o[0]===void 0?s.initialPageParam:o[0]:Lp(s,a);if(l>0&&S==null)break;a=await m(a,S),l++}while(l<v)}return a};e.options.persister?e.fetchFn=()=>{var g,b;return(b=(g=e.options).persister)==null?void 0:b.call(g,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=c}}}function Lp(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 A1(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 qr,Ys,Gr,Mt,Xs,Re,Wo,qs,Wt,wn,Cm,I1=(Cm=class extends G0{constructor(e){super();B(this,Wt);B(this,qr);B(this,Ys);B(this,Gr);B(this,Mt);B(this,Xs);B(this,Re);B(this,Wo);B(this,qs);T(this,qs,!1),T(this,Wo,e.defaultOptions),this.setOptions(e.options),this.observers=[],T(this,Xs,e.client),T(this,Mt,j(this,Xs).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,T(this,Ys,Ip(this.options)),this.state=e.state??j(this,Ys),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return j(this,qr)}get promise(){var e;return(e=j(this,Re))==null?void 0:e.promise}setOptions(e){if(this.options={...j(this,Wo),...e},e!=null&&e._type&&T(this,qr,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Ip(this.options);n.data!==void 0&&(this.setState(Ap(n.data,n.dataUpdatedAt)),T(this,Ys,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&j(this,Mt).remove(this)}setData(e,n){const s=xd(this.state.data,e,this.options);return q(this,Wt,wn).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(e){q(this,Wt,wn).call(this,{type:"setState",state:e})}cancel(e){var s,r;const n=(s=j(this,Re))==null?void 0:s.promise;return(r=j(this,Re))==null||r.cancel(e),n?n.then(it).catch(it):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return j(this,Ys)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>xe(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===$f||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>xe(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:!V0(this.state.dataUpdatedAt,e)}onFocus(){var e,n;(e=this.observers.find(s=>s.shouldFetchOnWindowFocus()))==null||e.refetch({cancelRefetch:!1}),(n=j(this,Re))==null||n.continue()}onOnline(){var e,n;(e=this.observers.find(s=>s.shouldFetchOnReconnect()))==null||e.refetch({cancelRefetch:!1}),(n=j(this,Re))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),j(this,Mt).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||(j(this,Re)&&(j(this,qs)||this.state.fetchStatus==="paused"&&this.state.status==="pending"?j(this,Re).cancel({revert:!0}):j(this,Re).cancelRetry()),this.scheduleGc()),j(this,Mt).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||q(this,Wt,wn).call(this,{type:"invalidate"})}async fetch(e,n){var c,d,f,h,p,x,g,b,y,m,v,S;if(this.state.fetchStatus!=="idle"&&((c=j(this,Re))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(j(this,Re))return j(this,Re).continueRetry(),j(this,Re).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:()=>(T(this,qs,!0),s.signal)})},i=()=>{const _=K0(this.options,n),C=(()=>{const N={client:j(this,Xs),queryKey:this.queryKey,meta:this.meta};return r(N),N})();return T(this,qs,!1),this.options.persister?this.options.persister(_,C,this):_(C)},a=(()=>{const _={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:j(this,Xs),state:this.state,fetchFn:i};return r(_),_})();(d=j(this,qr)==="infinite"?L1(this.options.pages):this.options.behavior)==null||d.onFetch(a,this),T(this,Gr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&q(this,Wt,wn).call(this,{type:"fetch",meta:(h=a.fetchOptions)==null?void 0:h.meta});const l=T(this,Re,q0({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:_=>{_ instanceof yd&&_.revert&&this.setState({...j(this,Gr),fetchStatus:"idle"}),s.abort()},onFail:(_,k)=>{q(this,Wt,wn).call(this,{type:"failed",failureCount:_,error:k})},onPause:()=>{q(this,Wt,wn).call(this,{type:"pause"})},onContinue:()=>{q(this,Wt,wn).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(_),(x=(p=j(this,Mt).config).onSuccess)==null||x.call(p,_,this),(b=(g=j(this,Mt).config).onSettled)==null||b.call(g,_,this.state.error,this),_}catch(_){if(_ instanceof yd){if(_.silent)return j(this,Re).promise;if(_.revert){if(this.state.data===void 0)throw _;return this.state.data}}throw q(this,Wt,wn).call(this,{type:"error",error:_}),(m=(y=j(this,Mt).config).onError)==null||m.call(y,_,this),(S=(v=j(this,Mt).config).onSettled)==null||S.call(v,this.state.data,_,this),_}finally{j(this,Re)===l&&T(this,Re,void 0),this.scheduleGc()}}},qr=new WeakMap,Ys=new WeakMap,Gr=new WeakMap,Mt=new WeakMap,Xs=new WeakMap,Re=new WeakMap,Wo=new WeakMap,qs=new WeakMap,Wt=new WeakSet,wn=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,...J0(s.data,this.options),fetchMeta:e.meta??null};case"success":const r={...s,...Ap(e.data,e.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return T(this,Gr,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),Ue.batch(()=>{this.observers.slice().forEach(s=>{s.onQueryUpdate()}),j(this,Mt).notify({query:this,type:"updated",action:e})})},Cm);function J0(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:X0(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Ap(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ip(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 Ge,G,Ho,Je,Gs,Jr,Nn,Vo,Zr,ei,Js,Zs,es,ti,re,Xi,vd,bd,wd,Sd,_d,kd,Cd,jd,jm,F1=(jm=class extends Zo{constructor(e,n){super();B(this,re);B(this,Ge);B(this,G);B(this,Ho);B(this,Je);B(this,Gs);B(this,Jr);B(this,Nn);B(this,Vo);B(this,Zr);B(this,ei);B(this,Js);B(this,Zs);B(this,es);B(this,ti,new Set);this.options=n,T(this,Ge,e),T(this,Nn,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(j(this,G).addObserver(this),Fp(j(this,G),this.options)?q(this,re,Xi).call(this):this.updateResult(),q(this,re,_d).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Nd(j(this,G),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Nd(j(this,G),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,q(this,re,kd).call(this),q(this,re,Cd).call(this),j(this,G).removeObserver(this)}setOptions(e){const n=this.options,s=j(this,G);if(this.options=j(this,Ge).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof xe(this.options.enabled,j(this,G))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");q(this,re,jd).call(this),j(this,G).setOptions(this.options),n._defaulted&&!iu(this.options,n)&&j(this,Ge).getQueryCache().notify({type:"observerOptionsUpdated",query:j(this,G),observer:this});const r=this.hasListeners();r&&zp(j(this,G),s,this.options,n)&&q(this,re,Xi).call(this),this.updateResult(),r&&(j(this,G)!==s||xe(this.options.enabled,j(this,G))!==xe(n.enabled,j(this,G))||xe(this.options.staleTime,j(this,G))!==xe(n.staleTime,j(this,G)))&&q(this,re,bd).call(this);const i=q(this,re,wd).call(this);r&&(j(this,G)!==s||xe(this.options.enabled,j(this,G))!==xe(n.enabled,j(this,G))||i!==j(this,es))&&q(this,re,Sd).call(this,i)}getOptimisticResult(e){const n=j(this,Ge).getQueryCache().build(j(this,Ge),e),s=this.createResult(n,e);return iu(this.getCurrentResult(),s)||(T(this,Je,s),T(this,Jr,this.options),T(this,Gs,j(this,G).state)),s}getCurrentResult(){return j(this,Je)}trackResult(e,n){return new Proxy(e,{get:(s,r)=>(this.trackProp(r),n==null||n(r),Reflect.get(s,r))})}trackProp(e){j(this,ti).add(e)}getCurrentQuery(){return j(this,G)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=j(this,Ge).defaultQueryOptions(e),s=j(this,Ge).getQueryCache().build(j(this,Ge),n);let r=()=>{},i;const o=new Promise(a=>{i=a,r=j(this,Ge).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 q(this,re,Xi).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),j(this,Je)))}createResult(e,n){var k;const s=j(this,G),r=this.options,i=j(this,Je),o=j(this,Gs),a=j(this,Jr),l=e!==s?e.state:j(this,Ho),{state:c}=e;let d={...c},f=!1,h;if(n._optimisticResults){const C=this.hasListeners(),N=!C&&Fp(e,n),P=C&&zp(e,s,n,r);(N||P)&&(d={...d,...J0(c.data,e.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:p,errorUpdatedAt:x,status:g}=d;h=d.data;let b=!1;if(n.placeholderData!==void 0&&h===void 0&&g==="pending"){let C;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(C=i.data,b=!0):C=typeof n.placeholderData=="function"?n.placeholderData((k=j(this,ei))==null?void 0:k.state.data,j(this,ei)):n.placeholderData,C!==void 0&&(g="success",h=xd(i==null?void 0:i.data,C,n),f=!0)}if(n.select&&h!==void 0&&!b)if(i&&h===(o==null?void 0:o.data)&&n.select===j(this,Vo))h=j(this,Zr);else try{T(this,Vo,n.select),h=n.select(h),h=xd(i==null?void 0:i.data,h,n),T(this,Zr,h),T(this,Nn,null)}catch(C){T(this,Nn,C)}else h===void 0&&T(this,Nn,null);j(this,Nn)&&(p=j(this,Nn),h=j(this,Zr),x=Date.now(),g="error",f=!1);const y=d.fetchStatus==="fetching",m=g==="pending",v=g==="error",S=m&&y,_=h!==void 0;return{status:g,fetchStatus:d.fetchStatus,isPending:m,isSuccess:g==="success",isError:v,isInitialLoading:S,isLoading:S,data:h,dataUpdatedAt:d.dataUpdatedAt,error:p,errorUpdatedAt:x,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:y,isRefetching:y&&!m,isLoadingError:v&&!_,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:v&&_,isStale:Hf(e,n),refetch:this.refetch,isEnabled:xe(n.enabled,e)!==!1}}updateResult(){const e=j(this,Je),n=this.createResult(j(this,G),this.options);if(T(this,Gs,j(this,G).state),T(this,Jr,this.options),j(this,Gs).data!==void 0&&T(this,ei,j(this,G)),iu(n,e))return;T(this,Je,n);const r=(()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!j(this,ti).size)return!0;const a=new Set(o??j(this,ti));return this.options.throwOnError&&a.add("error"),Object.keys(j(this,Je)).some(l=>{const c=l;return j(this,Je)[c]!==e[c]&&a.has(c)})})();Ue.batch(()=>{r&&this.listeners.forEach(i=>{i(j(this,Je))}),j(this,Ge).getQueryCache().notify({query:j(this,G),type:"observerResultsUpdated"})})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&q(this,re,_d).call(this)}},Ge=new WeakMap,G=new WeakMap,Ho=new WeakMap,Je=new WeakMap,Gs=new WeakMap,Jr=new WeakMap,Nn=new WeakMap,Vo=new WeakMap,Zr=new WeakMap,ei=new WeakMap,Js=new WeakMap,Zs=new WeakMap,es=new WeakMap,ti=new WeakMap,re=new WeakSet,Xi=function(e){q(this,re,jd).call(this);let n=j(this,G).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(it)),n},vd=function(e){return!Uf()&&xe(this.options.enabled,j(this,G))!==!1&&H0(e)},bd=function(){q(this,re,kd).call(this);const e=xe(this.options.staleTime,j(this,G));if(j(this,Je).isStale||!q(this,re,vd).call(this,e))return;const n=V0(j(this,Je).dataUpdatedAt,e)+1;T(this,Js,Hs.setTimeout(()=>{j(this,Je).isStale||this.updateResult()},n))},wd=function(){return xe(this.options.refetchInterval,j(this,G))??!1},Sd=function(e){q(this,re,Cd).call(this),T(this,es,e),!(j(this,es)===0||!q(this,re,vd).call(this,j(this,es)))&&T(this,Zs,Hs.setInterval(()=>{(this.options.refetchIntervalInBackground||Wf.isFocused())&&q(this,re,Xi).call(this)},j(this,es)))},_d=function(){q(this,re,bd).call(this),q(this,re,Sd).call(this,q(this,re,wd).call(this))},kd=function(){j(this,Js)!==void 0&&(Hs.clearTimeout(j(this,Js)),T(this,Js,void 0))},Cd=function(){j(this,Zs)!==void 0&&(Hs.clearInterval(j(this,Zs)),T(this,Zs,void 0))},jd=function(){const e=j(this,Ge).getQueryCache().build(j(this,Ge),this.options);if(e===j(this,G))return;const n=j(this,G);T(this,G,e),T(this,Ho,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},jm);function z1(t,e){return xe(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&xe(e.retryOnMount,t)===!1)}function Fp(t,e){return z1(t,e)||t.state.data!==void 0&&Nd(t,e,e.refetchOnMount)}function Nd(t,e,n){if(xe(e.enabled,t)!==!1&&xe(e.staleTime,t)!=="static"){const s=xe(n,t);return s==="always"||s!==!1&&Hf(t,e)}return!1}function zp(t,e,n,s){return(t!==e||xe(s.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&Hf(t,n)}function Hf(t,e){return xe(e.enabled,t)!==!1&&t.isStaleByTime(xe(e.staleTime,t))}var Qo,fn,Ye,er,hn,Vn,Nm,B1=(Nm=class extends G0{constructor(e){super();B(this,hn);B(this,Qo);B(this,fn);B(this,Ye);B(this,er);T(this,Qo,e.client),this.mutationId=e.mutationId,T(this,Ye,e.mutationCache),T(this,fn,[]),this.state=e.state||$1(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){j(this,fn).includes(e)||(j(this,fn).push(e),this.clearGcTimeout(),j(this,Ye).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){T(this,fn,j(this,fn).filter(n=>n!==e)),this.scheduleGc(),j(this,Ye).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){j(this,fn).length||(this.state.status==="pending"?this.scheduleGc():j(this,Ye).remove(this))}continue(){var e;return((e=j(this,er))==null?void 0:e.continue())??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(e){var a,l,c,d,f,h,p,x,g,b,y,m,v,S,_,k,C,N;const n=()=>{q(this,hn,Vn).call(this,{type:"continue"})},s={client:j(this,Qo),meta:this.options.meta,mutationKey:this.options.mutationKey},r=T(this,er,q0({fn:()=>this.options.mutationFn?this.options.mutationFn(e,s):Promise.reject(new Error("No mutationFn found")),onFail:(P,M)=>{q(this,hn,Vn).call(this,{type:"failed",failureCount:P,error:M})},onPause:()=>{q(this,hn,Vn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>j(this,Ye).canRun(this)})),i=this.state.status==="pending",o=!r.canStart();try{if(i)n();else{q(this,hn,Vn).call(this,{type:"pending",variables:e,isPaused:o}),j(this,Ye).config.onMutate&&await j(this,Ye).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&&q(this,hn,Vn).call(this,{type:"pending",context:M,variables:e,isPaused:o})}const P=await r.start();return await((d=(c=j(this,Ye).config).onSuccess)==null?void 0:d.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((x=(p=j(this,Ye).config).onSettled)==null?void 0:x.call(p,P,null,this.state.variables,this.state.context,this,s)),await((b=(g=this.options).onSettled)==null?void 0:b.call(g,P,null,e,this.state.context,s)),q(this,hn,Vn).call(this,{type:"success",data:P}),P}catch(P){try{await((m=(y=j(this,Ye).config).onError)==null?void 0:m.call(y,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=(_=j(this,Ye).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((N=(C=this.options).onSettled)==null?void 0:N.call(C,void 0,P,e,this.state.context,s))}catch(M){Promise.reject(M)}throw q(this,hn,Vn).call(this,{type:"error",error:P}),P}finally{j(this,er)===r&&T(this,er,void 0),j(this,Ye).runNext(this)}}},Qo=new WeakMap,fn=new WeakMap,Ye=new WeakMap,er=new WeakMap,hn=new WeakSet,Vn=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),Ue.batch(()=>{j(this,fn).forEach(s=>{s.onMutationUpdate(e)}),j(this,Ye).notify({mutation:this,type:"updated",action:e})})},Nm);function $1(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ts,Ht,Ko,Em,U1=(Em=class extends Zo{constructor(e={}){super();B(this,ts);B(this,Ht);B(this,Ko);this.config=e,T(this,ts,new Set),T(this,Ht,new Map),T(this,Ko,0)}build(e,n,s){const r=new B1({client:e,mutationCache:this,mutationId:++ua(this,Ko)._,options:e.defaultMutationOptions(n),state:s});return this.add(r),r}add(e){j(this,ts).add(e);const n=Ea(e);if(typeof n=="string"){const s=j(this,Ht).get(n);s?s.push(e):j(this,Ht).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(j(this,ts).delete(e)){const n=Ea(e);if(typeof n=="string"){const s=j(this,Ht).get(n);if(s)if(s.length>1){const r=s.indexOf(e);r!==-1&&s.splice(r,1)}else s[0]===e&&j(this,Ht).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){var s;const n=Ea(e);if(typeof n=="string"){const r=(s=j(this,Ht).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=Ea(e);return typeof n=="string"?((r=(s=j(this,Ht).get(n))==null?void 0:s.find(i=>i!==e&&i.state.isPaused))==null?void 0:r.continue())??Promise.resolve():Promise.resolve()}clear(){Ue.batch(()=>{const e=this.getAll();j(this,ts).clear(),j(this,Ht).clear(),e.forEach(n=>{this.notify({type:"removed",mutation:n})})})}getAll(){return Array.from(j(this,ts))}find(e){const n={exact:!0,...e};return this.getAll().find(s=>Op(n,s))}findAll(e={}){return this.getAll().filter(n=>Op(e,n))}notify(e){Ue.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Ue.batch(()=>Promise.all(e.map(n=>n.continue().catch(it))))}},ts=new WeakMap,Ht=new WeakMap,Ko=new WeakMap,Em);function Ea(t){var e;return(e=t.options.scope)==null?void 0:e.id}var pn,Mm,W1=(Mm=class extends Zo{constructor(e={}){super();B(this,pn);this.config=e,T(this,pn,new Map)}build(e,n,s){const r=n.queryKey,i=n.queryHash??Bf(r,n);let o=this.get(i);return o||(o=new I1({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(n),state:s,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){j(this,pn).has(e.queryHash)||(j(this,pn).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){j(this,pn).get(e.queryHash)===e&&(e.destroy(),j(this,pn).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Ue.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return j(this,pn).get(e)}getAll(){return[...j(this,pn).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(s=>Rp(n,s))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(s=>Rp(e,s)):n}notify(e){Ue.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Ue.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Ue.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},pn=new WeakMap,Mm),be,ns,ss,ni,si,rs,ri,ii,Pm,H1=(Pm=class{constructor(t={}){B(this,be);B(this,ns);B(this,ss);B(this,ni);B(this,si);B(this,rs);B(this,ri);B(this,ii);T(this,be,t.queryCache||new W1),T(this,ns,t.mutationCache||new U1),T(this,ss,t.defaultOptions||{}),T(this,ni,new Map),T(this,si,new Map),T(this,rs,0)}mount(){ua(this,rs)._++,j(this,rs)===1&&(T(this,ri,Wf.subscribe(async t=>{t&&(await this.resumePausedMutations(),j(this,be).onFocus())})),T(this,ii,Dl.subscribe(async t=>{t&&(await this.resumePausedMutations(),j(this,be).onOnline())})))}unmount(){var t,e;ua(this,rs)._--,j(this,rs)===0&&((t=j(this,ri))==null||t.call(this),T(this,ri,void 0),(e=j(this,ii))==null||e.call(this),T(this,ii,void 0))}isFetching(t){return j(this,be).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return j(this,ns).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=j(this,be).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=j(this,be).build(this,e),s=n.state.data;return s===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(xe(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(s))}getQueriesData(t){return j(this,be).findAll(t).map(({queryKey:e,state:n})=>[e,n.data])}setQueryData(t,e,n){var o;const s=this.defaultQueryOptions({queryKey:t}),r=(o=j(this,be).get(s.queryHash))==null?void 0:o.state.data,i=_1(e,r);if(i!==void 0)return j(this,be).build(this,s).setData(i,{...n,manual:!0})}setQueriesData(t,e,n){return Ue.batch(()=>j(this,be).findAll(t).map(({queryKey:s})=>[s,this.setQueryData(s,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=j(this,be).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=j(this,be);Ue.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=j(this,be);return Ue.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=Ue.batch(()=>j(this,be).findAll(t).map(r=>r.cancel(n)));return Promise.all(s).then(it).catch(it)}invalidateQueries(t,e={}){return Ue.batch(()=>(j(this,be).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=Ue.batch(()=>j(this,be).findAll(t).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let i=r.fetch(void 0,n);return n.throwOnError||(i=i.catch(it)),r.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(s).then(it)}async query(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=j(this,be).build(this,e),s=n.isStaleByTime(xe(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=j(this,be).build(this,e);return n.isStaleByTime(xe(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(it).catch(it)}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(it).catch(it)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return Dl.isOnline()?j(this,ns).resumePausedMutations():Promise.resolve()}getQueryCache(){return j(this,be)}getMutationCache(){return j(this,ns)}getDefaultOptions(){return j(this,ss)}setDefaultOptions(t){T(this,ss,t)}setQueryDefaults(t,e){j(this,ni).set(To(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...j(this,ni).values()],n={};return e.forEach(s=>{hi(t,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(t,e){j(this,si).set(To(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...j(this,si).values()],n={};return e.forEach(s=>{hi(t,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...j(this,ss).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Bf(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===$f&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...j(this,ss).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){j(this,be).clear(),j(this,ns).clear()}},be=new WeakMap,ns=new WeakMap,ss=new WeakMap,ni=new WeakMap,si=new WeakMap,rs=new WeakMap,ri=new WeakMap,ii=new WeakMap,Pm);const Z0=w.createContext(!1),V1=()=>w.useContext(Z0);Z0.Provider;function Q1(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}const K1=w.createContext(Q1()),Y1=()=>w.useContext(K1),X1=(t,e,n)=>{const s=(n==null?void 0:n.state.status)==="error"&&typeof t.throwOnError=="function"?Y0(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||s)&&(e.isReset()||(t.retryOnMount=!1))},q1=t=>{w.useEffect(()=>{t.clearReset()},[t])},G1=({result:t,errorResetBoundary:e,throwOnError:n,query:s,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&s&&(r&&t.data===void 0||Y0(n,[t.error,s])),J1=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))}},Z1=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,eS=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function tS(t,e,n){const s=V1(),r=Y1(),i=x1(),o=i.defaultQueryOptions(t),a=i.getQueryCache().get(o.queryHash),l=t.subscribed!==!1;o._optimisticResults=s?"isRestoring":l?"optimistic":void 0,J1(o),X1(o,r,a),q1(r);const[c]=w.useState(()=>new e(i,o)),d=c.getOptimisticResult(o),f=!s&&l;if(w.useSyncExternalStore(w.useCallback(h=>{const p=f?c.subscribe(Ue.batchCalls(h)):it;return c.updateResult(),p},[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),w.useEffect(()=>{c.setOptions(o)},[o,c]),Z1(o,d))throw eS(o,c,r);if(G1({result:d,errorResetBoundary:r,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw d.error;return o.notifyOnChangeProps?d:c.trackResult(d)}function ey(t,e){return tS(t,F1)}/**
40
+ `+i.stack}return{value:t,source:e,stack:r,digest:null}}function tu(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function nd(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var Vw=typeof WeakMap=="function"?WeakMap:Map;function g0(t,e,n){n=On(-1,n),n.tag=3,n.payload={element:null};var s=e.value;return n.callback=function(){Pl||(Pl=!0,fd=s),nd(t,e)},n}function m0(t,e,n){n=On(-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(){nd(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){nd(t,e),typeof s!="function"&&(xs===null?xs=new Set([this]):xs.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function fp(t,e,n){var s=t.pingCache;if(s===null){s=t.pingCache=new Vw;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=i1.bind(null,t,e,n),e.then(t,t))}function hp(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 pp(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=On(-1,1),e.tag=2,ms(n,e,1))),n.lanes|=1),t)}var Qw=In.ReactCurrentOwner,lt=!1;function Ze(t,e,n,s){e.child=t===null?Vx(e,null,n,s):ci(e,t.child,n,s)}function gp(t,e,n,s,r){n=n.render;var i=e.ref;return $r(e,r),s=kf(t,e,n,s,i,r),n=Cf(),t!==null&&!lt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~r,An(t,e,r)):(ye&&n&&ff(e),e.flags|=1,Ze(t,e,s,r),e.child)}function mp(t,e,n,s,r){if(t===null){var i=n.type;return typeof i=="function"&&!Lf(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,x0(t,e,i,s,r)):(t=sl(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:Co,n(o,s)&&t.ref===e.ref)return An(t,e,r)}return e.flags|=1,t=vs(i,s),t.ref=e.ref,t.return=e,e.child=t}function x0(t,e,n,s,r){if(t!==null){var i=t.memoizedProps;if(Co(i,s)&&t.ref===e.ref)if(lt=!1,e.pendingProps=s=i,(t.lanes&r)!==0)t.flags&131072&&(lt=!0);else return e.lanes=t.lanes,An(t,e,r)}return sd(t,e,n,s,r)}function y0(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},de(Lr,bt),bt|=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,de(Lr,bt),bt|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=i!==null?i.baseLanes:n,de(Lr,bt),bt|=s}else i!==null?(s=i.baseLanes|n,e.memoizedState=null):s=n,de(Lr,bt),bt|=s;return Ze(t,e,r,n),e.child}function v0(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function sd(t,e,n,s,r){var i=ft(n)?rr:qe.current;return i=ai(e,i),$r(e,r),n=kf(t,e,n,s,i,r),s=Cf(),t!==null&&!lt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~r,An(t,e,r)):(ye&&s&&ff(e),e.flags|=1,Ze(t,e,n,r),e.child)}function xp(t,e,n,s,r){if(ft(n)){var i=!0;bl(e)}else i=!1;if($r(e,r),e.stateNode===null)el(t,e),p0(e,n,s),td(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=At(c):(c=ft(n)?rr:qe.current,c=ai(e,c));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==s||l!==c)&&dp(e,o,s,c),Kn=!1;var h=e.memoizedState;o.state=h,Cl(e,s,o,r),l=e.memoizedState,a!==s||h!==l||dt.current||Kn?(typeof d=="function"&&(ed(e,n,d,s),l=e.memoizedState),(a=Kn||up(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,Kx(t,e),a=e.memoizedProps,c=e.type===e.elementType?a:Ut(e.type,a),o.props=c,f=e.pendingProps,h=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=At(l):(l=ft(n)?rr:qe.current,l=ai(e,l));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==f||h!==l)&&dp(e,o,s,l),Kn=!1,h=e.memoizedState,o.state=h,Cl(e,s,o,r);var x=e.memoizedState;a!==f||h!==x||dt.current||Kn?(typeof p=="function"&&(ed(e,n,p,s),x=e.memoizedState),(c=Kn||up(e,n,c,s,h,x,l)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(s,x,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(s,x,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=x),o.props=s,o.state=x,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 rd(t,e,n,s,i,r)}function rd(t,e,n,s,r,i){v0(t,e);var o=(e.flags&128)!==0;if(!s&&!o)return r&&np(e,n,!1),An(t,e,i);s=e.stateNode,Qw.current=e;var a=o&&typeof n.getDerivedStateFromError!="function"?null:s.render();return e.flags|=1,t!==null&&o?(e.child=ci(e,t.child,null,i),e.child=ci(e,null,a,i)):Ze(t,e,a,i),e.memoizedState=s.state,r&&np(e,n,!0),e.child}function b0(t){var e=t.stateNode;e.pendingContext?tp(t,e.pendingContext,e.pendingContext!==e.context):e.context&&tp(t,e.context,!1),bf(t,e.containerInfo)}function yp(t,e,n,s,r){return li(),pf(r),e.flags|=256,Ze(t,e,n,s),e.child}var id={dehydrated:null,treeContext:null,retryLane:0};function od(t){return{baseLanes:t,cachePool:null,transitions:null}}function w0(t,e,n){var s=e.pendingProps,r=we.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),de(we,r&1),t===null)return Ju(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=fc(o,s,0,null),t=nr(t,s,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=od(n),e.memoizedState=id,t):Ef(e,o));if(r=t.memoizedState,r!==null&&(a=r.dehydrated,a!==null))return Kw(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=vs(r,l),s.subtreeFlags=r.subtreeFlags&14680064),a!==null?i=vs(a,i):(i=nr(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?od(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=t.childLanes&~n,e.memoizedState=id,s}return i=t.child,t=i.sibling,s=vs(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 Ef(t,e){return e=fc({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Ca(t,e,n,s){return s!==null&&pf(s),ci(e,t.child,null,n),t=Ef(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function Kw(t,e,n,s,r,i,o){if(n)return e.flags&256?(e.flags&=-257,s=tu(Error(O(422))),Ca(t,e,o,s)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=s.fallback,r=e.mode,s=fc({mode:"visible",children:s.children},r,0,null),i=nr(i,r,o,null),i.flags|=2,s.return=e,i.return=e,s.sibling=i,e.child=s,e.mode&1&&ci(e,t.child,null,o),e.child.memoizedState=od(o),e.memoizedState=id,i);if(!(e.mode&1))return Ca(t,e,o,null);if(r.data==="$!"){if(s=r.nextSibling&&r.nextSibling.dataset,s)var a=s.dgst;return s=a,i=Error(O(419)),s=tu(i,s,void 0),Ca(t,e,o,s)}if(a=(o&t.childLanes)!==0,lt||a){if(s=ze,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,Ln(t,r),Yt(s,t,r,-1))}return Df(),s=tu(Error(O(421))),Ca(t,e,o,s)}return r.data==="$?"?(e.flags|=128,e.child=t.child,e=o1.bind(null,t),r._reactRetry=e,null):(t=i.treeContext,wt=gs(r.nextSibling),St=e,ye=!0,Qt=null,t!==null&&(Rt[Ot++]=En,Rt[Ot++]=Mn,Rt[Ot++]=ir,En=t.id,Mn=t.overflow,ir=e),e=Ef(e,s.children),e.flags|=4096,e)}function vp(t,e,n){t.lanes|=e;var s=t.alternate;s!==null&&(s.lanes|=e),Zu(t.return,e,n)}function nu(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 S0(t,e,n){var s=e.pendingProps,r=s.revealOrder,i=s.tail;if(Ze(t,e,s.children,n),s=we.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&&vp(t,n,e);else if(t.tag===19)vp(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(de(we,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&&jl(t)===null&&(r=n),n=n.sibling;n=r,n===null?(r=e.child,e.child=null):(r=n.sibling,n.sibling=null),nu(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&&jl(t)===null){e.child=r;break}t=r.sibling,r.sibling=n,n=r,r=t}nu(e,!0,n,null,i);break;case"together":nu(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function el(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function An(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),ar|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(O(153));if(e.child!==null){for(t=e.child,n=vs(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=vs(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function Yw(t,e,n){switch(e.tag){case 3:b0(e),li();break;case 5:Yx(e);break;case 1:ft(e.type)&&bl(e);break;case 4:bf(e,e.stateNode.containerInfo);break;case 10:var s=e.type._context,r=e.memoizedProps.value;de(_l,s._currentValue),s._currentValue=r;break;case 13:if(s=e.memoizedState,s!==null)return s.dehydrated!==null?(de(we,we.current&1),e.flags|=128,null):n&e.child.childLanes?w0(t,e,n):(de(we,we.current&1),t=An(t,e,n),t!==null?t.sibling:null);de(we,we.current&1);break;case 19:if(s=(n&e.childLanes)!==0,t.flags&128){if(s)return S0(t,e,n);e.flags|=128}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),de(we,we.current),s)break;return null;case 22:case 23:return e.lanes=0,y0(t,e,n)}return An(t,e,n)}var _0,ad,k0,C0;_0=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}};ad=function(){};k0=function(t,e,n,s){var r=t.memoizedProps;if(r!==s){t=e.stateNode,Ws(xn.current);var i=null;switch(n){case"input":r=Mu(t,r),s=Mu(t,s),i=[];break;case"select":r=_e({},r,{value:void 0}),s=_e({},s,{value:void 0}),i=[];break;case"textarea":r=Ou(t,r),s=Ou(t,s),i=[];break;default:typeof r.onClick!="function"&&typeof s.onClick=="function"&&(t.onclick=yl)}Du(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"&&(yo.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"&&(yo.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&fe("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)}};C0=function(t,e,n,s){n!==s&&(e.flags|=4)};function Ii(t,e){if(!ye)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 Ke(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 Xw(t,e,n){var s=e.pendingProps;switch(hf(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ke(e),null;case 1:return ft(e.type)&&vl(),Ke(e),null;case 3:return s=e.stateNode,ui(),me(dt),me(qe),Sf(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(t===null||t.child===null)&&(_a(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Qt!==null&&(gd(Qt),Qt=null))),ad(t,e),Ke(e),null;case 5:wf(e);var r=Ws(Po.current);if(n=e.type,t!==null&&e.stateNode!=null)k0(t,e,n,s,r),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!s){if(e.stateNode===null)throw Error(O(166));return Ke(e),null}if(t=Ws(xn.current),_a(e)){s=e.stateNode,n=e.type;var i=e.memoizedProps;switch(s[gn]=e,s[Eo]=i,t=(e.mode&1)!==0,n){case"dialog":fe("cancel",s),fe("close",s);break;case"iframe":case"object":case"embed":fe("load",s);break;case"video":case"audio":for(r=0;r<Xi.length;r++)fe(Xi[r],s);break;case"source":fe("error",s);break;case"img":case"image":case"link":fe("error",s),fe("load",s);break;case"details":fe("toggle",s);break;case"input":Eh(s,i),fe("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!i.multiple},fe("invalid",s);break;case"textarea":Ph(s,i),fe("invalid",s)}Du(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&&Sa(s.textContent,a,t),r=["children",a]):typeof a=="number"&&s.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&Sa(s.textContent,a,t),r=["children",""+a]):yo.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&fe("scroll",s)}switch(n){case"input":pa(s),Mh(s,i,!0);break;case"textarea":pa(s),Rh(s);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(s.onclick=yl)}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=Zm(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[gn]=e,t[Eo]=s,_0(t,e,!1,!1),e.stateNode=t;e:{switch(o=Lu(n,s),n){case"dialog":fe("cancel",t),fe("close",t),r=s;break;case"iframe":case"object":case"embed":fe("load",t),r=s;break;case"video":case"audio":for(r=0;r<Xi.length;r++)fe(Xi[r],t);r=s;break;case"source":fe("error",t),r=s;break;case"img":case"image":case"link":fe("error",t),fe("load",t),r=s;break;case"details":fe("toggle",t),r=s;break;case"input":Eh(t,s),r=Mu(t,s),fe("invalid",t);break;case"option":r=s;break;case"select":t._wrapperState={wasMultiple:!!s.multiple},r=_e({},s,{value:void 0}),fe("invalid",t);break;case"textarea":Ph(t,s),r=Ou(t,s),fe("invalid",t);break;default:r=s}Du(n,r),a=r;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?nx(t,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&ex(t,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&vo(t,l):typeof l=="number"&&vo(t,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(yo.hasOwnProperty(i)?l!=null&&i==="onScroll"&&fe("scroll",t):l!=null&&Gd(t,i,l,o))}switch(n){case"input":pa(t),Mh(t,s,!1);break;case"textarea":pa(t),Rh(t);break;case"option":s.value!=null&&t.setAttribute("value",""+ks(s.value));break;case"select":t.multiple=!!s.multiple,i=s.value,i!=null?Ir(t,!!s.multiple,i,!1):s.defaultValue!=null&&Ir(t,!!s.multiple,s.defaultValue,!0);break;default:typeof r.onClick=="function"&&(t.onclick=yl)}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 Ke(e),null;case 6:if(t&&e.stateNode!=null)C0(t,e,t.memoizedProps,s);else{if(typeof s!="string"&&e.stateNode===null)throw Error(O(166));if(n=Ws(Po.current),Ws(xn.current),_a(e)){if(s=e.stateNode,n=e.memoizedProps,s[gn]=e,(i=s.nodeValue!==n)&&(t=St,t!==null))switch(t.tag){case 3:Sa(s.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Sa(s.nodeValue,n,(t.mode&1)!==0)}i&&(e.flags|=4)}else s=(n.nodeType===9?n:n.ownerDocument).createTextNode(s),s[gn]=e,e.stateNode=s}return Ke(e),null;case 13:if(me(we),s=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(ye&&wt!==null&&e.mode&1&&!(e.flags&128))Wx(),li(),e.flags|=98560,i=!1;else if(i=_a(e),s!==null&&s.dehydrated!==null){if(t===null){if(!i)throw Error(O(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(O(317));i[gn]=e}else li(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Ke(e),i=!1}else Qt!==null&&(gd(Qt),Qt=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||we.current&1?De===0&&(De=3):Df())),e.updateQueue!==null&&(e.flags|=4),Ke(e),null);case 4:return ui(),ad(t,e),t===null&&jo(e.stateNode.containerInfo),Ke(e),null;case 10:return xf(e.type._context),Ke(e),null;case 17:return ft(e.type)&&vl(),Ke(e),null;case 19:if(me(we),i=e.memoizedState,i===null)return Ke(e),null;if(s=(e.flags&128)!==0,o=i.rendering,o===null)if(s)Ii(i,!1);else{if(De!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=jl(t),o!==null){for(e.flags|=128,Ii(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 de(we,we.current&1|2),e.child}t=t.sibling}i.tail!==null&&Ne()>fi&&(e.flags|=128,s=!0,Ii(i,!1),e.lanes=4194304)}else{if(!s)if(t=jl(o),t!==null){if(e.flags|=128,s=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Ii(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!ye)return Ke(e),null}else 2*Ne()-i.renderingStartTime>fi&&n!==1073741824&&(e.flags|=128,s=!0,Ii(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=Ne(),e.sibling=null,n=we.current,de(we,s?n&1|2:n&1),e):(Ke(e),null);case 22:case 23:return Tf(),s=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==s&&(e.flags|=8192),s&&e.mode&1?bt&1073741824&&(Ke(e),e.subtreeFlags&6&&(e.flags|=8192)):Ke(e),null;case 24:return null;case 25:return null}throw Error(O(156,e.tag))}function qw(t,e){switch(hf(e),e.tag){case 1:return ft(e.type)&&vl(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return ui(),me(dt),me(qe),Sf(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return wf(e),null;case 13:if(me(we),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(O(340));li()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return me(we),null;case 4:return ui(),null;case 10:return xf(e.type._context),null;case 22:case 23:return Tf(),null;case 24:return null;default:return null}}var ja=!1,Xe=!1,Gw=typeof WeakSet=="function"?WeakSet:Set,L=null;function Dr(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){Ce(t,e,s)}else n.current=null}function ld(t,e,n){try{n()}catch(s){Ce(t,e,s)}}var bp=!1;function Jw(t,e){if(Vu=gl,t=Px(),df(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,d=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&&++d===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(Qu={focusedElem:t,selectionRange:n},gl=!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 x=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var g=x.memoizedProps,b=x.memoizedState,y=e.stateNode,m=y.getSnapshotBeforeUpdate(e.elementType===e.type?g:Ut(e.type,g),b);y.__reactInternalSnapshotBeforeUpdate=m}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(O(163))}}catch(S){Ce(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,L=t;break}L=e.return}return x=bp,bp=!1,x}function lo(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&&ld(e,n,i)}r=r.next}while(r!==s)}}function uc(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 cd(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 j0(t){var e=t.alternate;e!==null&&(t.alternate=null,j0(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[gn],delete e[Eo],delete e[Xu],delete e[Dw],delete e[Lw])),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 N0(t){return t.tag===5||t.tag===3||t.tag===4}function wp(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||N0(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 ud(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=yl));else if(s!==4&&(t=t.child,t!==null))for(ud(t,e,n),t=t.sibling;t!==null;)ud(t,e,n),t=t.sibling}function dd(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(dd(t,e,n),t=t.sibling;t!==null;)dd(t,e,n),t=t.sibling}var $e=null,Vt=!1;function Wn(t,e,n){for(n=n.child;n!==null;)E0(t,e,n),n=n.sibling}function E0(t,e,n){if(mn&&typeof mn.onCommitFiberUnmount=="function")try{mn.onCommitFiberUnmount(nc,n)}catch{}switch(n.tag){case 5:Xe||Dr(n,e);case 6:var s=$e,r=Vt;$e=null,Wn(t,e,n),$e=s,Vt=r,$e!==null&&(Vt?(t=$e,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):$e.removeChild(n.stateNode));break;case 18:$e!==null&&(Vt?(t=$e,n=n.stateNode,t.nodeType===8?Xc(t.parentNode,n):t.nodeType===1&&Xc(t,n),_o(t)):Xc($e,n.stateNode));break;case 4:s=$e,r=Vt,$e=n.stateNode.containerInfo,Vt=!0,Wn(t,e,n),$e=s,Vt=r;break;case 0:case 11:case 14:case 15:if(!Xe&&(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)&&ld(n,e,o),r=r.next}while(r!==s)}Wn(t,e,n);break;case 1:if(!Xe&&(Dr(n,e),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(a){Ce(n,e,a)}Wn(t,e,n);break;case 21:Wn(t,e,n);break;case 22:n.mode&1?(Xe=(s=Xe)||n.memoizedState!==null,Wn(t,e,n),Xe=s):Wn(t,e,n);break;default:Wn(t,e,n)}}function Sp(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new Gw),e.forEach(function(s){var r=a1.bind(null,t,s);n.has(s)||(n.add(s),s.then(r,r))})}}function $t(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:$e=a.stateNode,Vt=!1;break e;case 3:$e=a.stateNode.containerInfo,Vt=!0;break e;case 4:$e=a.stateNode.containerInfo,Vt=!0;break e}a=a.return}if($e===null)throw Error(O(160));E0(i,o,r),$e=null,Vt=!1;var l=r.alternate;l!==null&&(l.return=null),r.return=null}catch(c){Ce(r,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)M0(e,t),e=e.sibling}function M0(t,e){var n=t.alternate,s=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if($t(e,t),rn(t),s&4){try{lo(3,t,t.return),uc(3,t)}catch(g){Ce(t,t.return,g)}try{lo(5,t,t.return)}catch(g){Ce(t,t.return,g)}}break;case 1:$t(e,t),rn(t),s&512&&n!==null&&Dr(n,n.return);break;case 5:if($t(e,t),rn(t),s&512&&n!==null&&Dr(n,n.return),t.flags&32){var r=t.stateNode;try{vo(r,"")}catch(g){Ce(t,t.return,g)}}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&&Gm(r,i),Lu(a,o);var c=Lu(a,i);for(o=0;o<l.length;o+=2){var d=l[o],f=l[o+1];d==="style"?nx(r,f):d==="dangerouslySetInnerHTML"?ex(r,f):d==="children"?vo(r,f):Gd(r,d,f,c)}switch(a){case"input":Pu(r,i);break;case"textarea":Jm(r,i);break;case"select":var h=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Ir(r,!!i.multiple,p,!1):h!==!!i.multiple&&(i.defaultValue!=null?Ir(r,!!i.multiple,i.defaultValue,!0):Ir(r,!!i.multiple,i.multiple?[]:"",!1))}r[Eo]=i}catch(g){Ce(t,t.return,g)}}break;case 6:if($t(e,t),rn(t),s&4){if(t.stateNode===null)throw Error(O(162));r=t.stateNode,i=t.memoizedProps;try{r.nodeValue=i}catch(g){Ce(t,t.return,g)}}break;case 3:if($t(e,t),rn(t),s&4&&n!==null&&n.memoizedState.isDehydrated)try{_o(e.containerInfo)}catch(g){Ce(t,t.return,g)}break;case 4:$t(e,t),rn(t);break;case 13:$t(e,t),rn(t),r=t.child,r.flags&8192&&(i=r.memoizedState!==null,r.stateNode.isHidden=i,!i||r.alternate!==null&&r.alternate.memoizedState!==null||(Rf=Ne())),s&4&&Sp(t);break;case 22:if(d=n!==null&&n.memoizedState!==null,t.mode&1?(Xe=(c=Xe)||d,$t(e,t),Xe=c):$t(e,t),rn(t),s&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!d&&t.mode&1)for(L=t,d=t.child;d!==null;){for(f=L=d;L!==null;){switch(h=L,p=h.child,h.tag){case 0:case 11:case 14:case 15:lo(4,h,h.return);break;case 1:Dr(h,h.return);var x=h.stateNode;if(typeof x.componentWillUnmount=="function"){s=h,n=h.return;try{e=s,x.props=e.memoizedProps,x.state=e.memoizedState,x.componentWillUnmount()}catch(g){Ce(s,n,g)}}break;case 5:Dr(h,h.return);break;case 22:if(h.memoizedState!==null){kp(f);continue}}p!==null?(p.return=h,L=p):kp(f)}d=d.sibling}e:for(d=null,f=t;;){if(f.tag===5){if(d===null){d=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=tx("display",o))}catch(g){Ce(t,t.return,g)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=c?"":f.memoizedProps}catch(g){Ce(t,t.return,g)}}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;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:$t(e,t),rn(t),s&4&&Sp(t);break;case 21:break;default:$t(e,t),rn(t)}}function rn(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(N0(n)){var s=n;break e}n=n.return}throw Error(O(160))}switch(s.tag){case 5:var r=s.stateNode;s.flags&32&&(vo(r,""),s.flags&=-33);var i=wp(t);dd(t,i,r);break;case 3:case 4:var o=s.stateNode.containerInfo,a=wp(t);ud(t,a,o);break;default:throw Error(O(161))}}catch(l){Ce(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function Zw(t,e,n){L=t,P0(t)}function P0(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||ja;if(!o){var a=r.alternate,l=a!==null&&a.memoizedState!==null||Xe;a=ja;var c=Xe;if(ja=o,(Xe=l)&&!c)for(L=r;L!==null;)o=L,l=o.child,o.tag===22&&o.memoizedState!==null?Cp(r):l!==null?(l.return=o,L=l):Cp(r);for(;i!==null;)L=i,P0(i),i=i.sibling;L=r,ja=a,Xe=c}_p(t)}else r.subtreeFlags&8772&&i!==null?(i.return=r,L=i):_p(t)}}function _p(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:Xe||uc(5,e);break;case 1:var s=e.stateNode;if(e.flags&4&&!Xe)if(n===null)s.componentDidMount();else{var r=e.elementType===e.type?n.memoizedProps:Ut(e.type,n.memoizedProps);s.componentDidUpdate(r,n.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&ap(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}ap(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 d=c.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&_o(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(O(163))}Xe||e.flags&512&&cd(e)}catch(h){Ce(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 kp(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 Cp(t){for(;L!==null;){var e=L;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{uc(4,e)}catch(l){Ce(e,n,l)}break;case 1:var s=e.stateNode;if(typeof s.componentDidMount=="function"){var r=e.return;try{s.componentDidMount()}catch(l){Ce(e,r,l)}}var i=e.return;try{cd(e)}catch(l){Ce(e,i,l)}break;case 5:var o=e.return;try{cd(e)}catch(l){Ce(e,o,l)}}}catch(l){Ce(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 e1=Math.ceil,Ml=In.ReactCurrentDispatcher,Mf=In.ReactCurrentOwner,Lt=In.ReactCurrentBatchConfig,te=0,ze=null,Pe=null,We=0,bt=0,Lr=Ps(0),De=0,Do=null,ar=0,dc=0,Pf=0,co=null,ot=null,Rf=0,fi=1/0,kn=null,Pl=!1,fd=null,xs=null,Na=!1,os=null,Rl=0,uo=0,hd=null,tl=-1,nl=0;function et(){return te&6?Ne():tl!==-1?tl:tl=Ne()}function ys(t){return t.mode&1?te&2&&We!==0?We&-We:Iw.transition!==null?(nl===0&&(nl=px()),nl):(t=le,t!==0||(t=window.event,t=t===void 0?16:wx(t.type)),t):1}function Yt(t,e,n,s){if(50<uo)throw uo=0,hd=null,Error(O(185));qo(t,n,s),(!(te&2)||t!==ze)&&(t===ze&&(!(te&2)&&(dc|=n),De===4&&qn(t,We)),ht(t,s),n===1&&te===0&&!(e.mode&1)&&(fi=Ne()+500,ac&&Rs()))}function ht(t,e){var n=t.callbackNode;Ib(t,e);var s=pl(t,t===ze?We:0);if(s===0)n!==null&&Dh(n),t.callbackNode=null,t.callbackPriority=0;else if(e=s&-s,t.callbackPriority!==e){if(n!=null&&Dh(n),e===1)t.tag===0?Aw(jp.bind(null,t)):Bx(jp.bind(null,t)),Ow(function(){!(te&6)&&Rs()}),n=null;else{switch(gx(s)){case 1:n=nf;break;case 4:n=fx;break;case 16:n=hl;break;case 536870912:n=hx;break;default:n=hl}n=F0(n,R0.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function R0(t,e){if(tl=-1,nl=0,te&6)throw Error(O(327));var n=t.callbackNode;if(Ur()&&t.callbackNode!==n)return null;var s=pl(t,t===ze?We:0);if(s===0)return null;if(s&30||s&t.expiredLanes||e)e=Ol(t,s);else{e=s;var r=te;te|=2;var i=T0();(ze!==t||We!==e)&&(kn=null,fi=Ne()+500,tr(t,e));do try{s1();break}catch(a){O0(t,a)}while(!0);mf(),Ml.current=i,te=r,Pe!==null?e=0:(ze=null,We=0,e=De)}if(e!==0){if(e===2&&(r=Bu(t),r!==0&&(s=r,e=pd(t,r))),e===1)throw n=Do,tr(t,0),qn(t,s),ht(t,Ne()),n;if(e===6)qn(t,s);else{if(r=t.current.alternate,!(s&30)&&!t1(r)&&(e=Ol(t,s),e===2&&(i=Bu(t),i!==0&&(s=i,e=pd(t,i))),e===1))throw n=Do,tr(t,0),qn(t,s),ht(t,Ne()),n;switch(t.finishedWork=r,t.finishedLanes=s,e){case 0:case 1:throw Error(O(345));case 2:zs(t,ot,kn);break;case 3:if(qn(t,s),(s&130023424)===s&&(e=Rf+500-Ne(),10<e)){if(pl(t,0)!==0)break;if(r=t.suspendedLanes,(r&s)!==s){et(),t.pingedLanes|=t.suspendedLanes&r;break}t.timeoutHandle=Yu(zs.bind(null,t,ot,kn),e);break}zs(t,ot,kn);break;case 4:if(qn(t,s),(s&4194240)===s)break;for(e=t.eventTimes,r=-1;0<s;){var o=31-Kt(s);i=1<<o,o=e[o],o>r&&(r=o),s&=~i}if(s=r,s=Ne()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*e1(s/1960))-s,10<s){t.timeoutHandle=Yu(zs.bind(null,t,ot,kn),s);break}zs(t,ot,kn);break;case 5:zs(t,ot,kn);break;default:throw Error(O(329))}}}return ht(t,Ne()),t.callbackNode===n?R0.bind(null,t):null}function pd(t,e){var n=co;return t.current.memoizedState.isDehydrated&&(tr(t,e).flags|=256),t=Ol(t,e),t!==2&&(e=ot,ot=n,e!==null&&gd(e)),t}function gd(t){ot===null?ot=t:ot.push.apply(ot,t)}function t1(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(!qt(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 qn(t,e){for(e&=~Pf,e&=~dc,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-Kt(e),s=1<<n;t[n]=-1,e&=~s}}function jp(t){if(te&6)throw Error(O(327));Ur();var e=pl(t,0);if(!(e&1))return ht(t,Ne()),null;var n=Ol(t,e);if(t.tag!==0&&n===2){var s=Bu(t);s!==0&&(e=s,n=pd(t,s))}if(n===1)throw n=Do,tr(t,0),qn(t,e),ht(t,Ne()),n;if(n===6)throw Error(O(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,zs(t,ot,kn),ht(t,Ne()),null}function Of(t,e){var n=te;te|=1;try{return t(e)}finally{te=n,te===0&&(fi=Ne()+500,ac&&Rs())}}function lr(t){os!==null&&os.tag===0&&!(te&6)&&Ur();var e=te;te|=1;var n=Lt.transition,s=le;try{if(Lt.transition=null,le=1,t)return t()}finally{le=s,Lt.transition=n,te=e,!(te&6)&&Rs()}}function Tf(){bt=Lr.current,me(Lr)}function tr(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,Rw(n)),Pe!==null)for(n=Pe.return;n!==null;){var s=n;switch(hf(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&vl();break;case 3:ui(),me(dt),me(qe),Sf();break;case 5:wf(s);break;case 4:ui();break;case 13:me(we);break;case 19:me(we);break;case 10:xf(s.type._context);break;case 22:case 23:Tf()}n=n.return}if(ze=t,Pe=t=vs(t.current,null),We=bt=e,De=0,Do=null,Pf=dc=ar=0,ot=co=null,Us!==null){for(e=0;e<Us.length;e++)if(n=Us[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}Us=null}return t}function O0(t,e){do{var n=Pe;try{if(mf(),Ja.current=El,Nl){for(var s=Se.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}Nl=!1}if(or=0,Ae=Oe=Se=null,ao=!1,Ro=0,Mf.current=null,n===null||n.return===null){De=1,Do=e,Pe=null;break}e:{var i=t,o=n.return,a=n,l=e;if(e=We,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,d=a,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var h=d.alternate;h?(d.updateQueue=h.updateQueue,d.memoizedState=h.memoizedState,d.lanes=h.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=hp(o);if(p!==null){p.flags&=-257,pp(p,o,a,i,e),p.mode&1&&fp(i,c,e),e=p,l=c;var x=e.updateQueue;if(x===null){var g=new Set;g.add(l),e.updateQueue=g}else x.add(l);break e}else{if(!(e&1)){fp(i,c,e),Df();break e}l=Error(O(426))}}else if(ye&&a.mode&1){var b=hp(o);if(b!==null){!(b.flags&65536)&&(b.flags|=256),pp(b,o,a,i,e),pf(di(l,a));break e}}i=l=di(l,a),De!==4&&(De=2),co===null?co=[i]:co.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var y=g0(i,l,e);op(i,y);break e;case 1:a=l;var m=i.type,v=i.stateNode;if(!(i.flags&128)&&(typeof m.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(xs===null||!xs.has(v)))){i.flags|=65536,e&=-e,i.lanes|=e;var S=m0(i,a,e);op(i,S);break e}}i=i.return}while(i!==null)}L0(n)}catch(_){e=_,Pe===n&&n!==null&&(Pe=n=n.return);continue}break}while(!0)}function T0(){var t=Ml.current;return Ml.current=El,t===null?El:t}function Df(){(De===0||De===3||De===2)&&(De=4),ze===null||!(ar&268435455)&&!(dc&268435455)||qn(ze,We)}function Ol(t,e){var n=te;te|=2;var s=T0();(ze!==t||We!==e)&&(kn=null,tr(t,e));do try{n1();break}catch(r){O0(t,r)}while(!0);if(mf(),te=n,Ml.current=s,Pe!==null)throw Error(O(261));return ze=null,We=0,De}function n1(){for(;Pe!==null;)D0(Pe)}function s1(){for(;Pe!==null&&!Eb();)D0(Pe)}function D0(t){var e=I0(t.alternate,t,bt);t.memoizedProps=t.pendingProps,e===null?L0(t):Pe=e,Mf.current=null}function L0(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=qw(n,e),n!==null){n.flags&=32767,Pe=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{De=6,Pe=null;return}}else if(n=Xw(n,e,bt),n!==null){Pe=n;return}if(e=e.sibling,e!==null){Pe=e;return}Pe=e=t}while(e!==null);De===0&&(De=5)}function zs(t,e,n){var s=le,r=Lt.transition;try{Lt.transition=null,le=1,r1(t,e,n,s)}finally{Lt.transition=r,le=s}return null}function r1(t,e,n,s){do Ur();while(os!==null);if(te&6)throw Error(O(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(O(177));t.callbackNode=null,t.callbackPriority=0;var i=n.lanes|n.childLanes;if(Fb(t,i),t===ze&&(Pe=ze=null,We=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Na||(Na=!0,F0(hl,function(){return Ur(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Lt.transition,Lt.transition=null;var o=le;le=1;var a=te;te|=4,Mf.current=null,Jw(t,n),M0(n,t),kw(Qu),gl=!!Vu,Qu=Vu=null,t.current=n,Zw(n),Mb(),te=a,le=o,Lt.transition=i}else t.current=n;if(Na&&(Na=!1,os=t,Rl=r),i=t.pendingLanes,i===0&&(xs=null),Ob(n.stateNode),ht(t,Ne()),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(Pl)throw Pl=!1,t=fd,fd=null,t;return Rl&1&&t.tag!==0&&Ur(),i=t.pendingLanes,i&1?t===hd?uo++:(uo=0,hd=t):uo=0,Rs(),null}function Ur(){if(os!==null){var t=gx(Rl),e=Lt.transition,n=le;try{if(Lt.transition=null,le=16>t?16:t,os===null)var s=!1;else{if(t=os,os=null,Rl=0,te&6)throw Error(O(331));var r=te;for(te|=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 d=L;switch(d.tag){case 0:case 11:case 15:lo(8,d,i)}var f=d.child;if(f!==null)f.return=d,L=f;else for(;L!==null;){d=L;var h=d.sibling,p=d.return;if(j0(d),d===c){L=null;break}if(h!==null){h.return=p,L=h;break}L=p}}}var x=i.alternate;if(x!==null){var g=x.child;if(g!==null){x.child=null;do{var b=g.sibling;g.sibling=null,g=b}while(g!==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:lo(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,L=y;break e}L=i.return}}var m=t.current;for(L=m;L!==null;){o=L;var v=o.child;if(o.subtreeFlags&2064&&v!==null)v.return=o,L=v;else e:for(o=m;L!==null;){if(a=L,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:uc(9,a)}}catch(_){Ce(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(te=r,Rs(),mn&&typeof mn.onPostCommitFiberRoot=="function")try{mn.onPostCommitFiberRoot(nc,t)}catch{}s=!0}return s}finally{le=n,Lt.transition=e}}return!1}function Np(t,e,n){e=di(n,e),e=g0(t,e,1),t=ms(t,e,1),e=et(),t!==null&&(qo(t,1,e),ht(t,e))}function Ce(t,e,n){if(t.tag===3)Np(t,t,n);else for(;e!==null;){if(e.tag===3){Np(e,t,n);break}else if(e.tag===1){var s=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(xs===null||!xs.has(s))){t=di(n,t),t=m0(e,t,1),e=ms(e,t,1),t=et(),e!==null&&(qo(e,1,t),ht(e,t));break}}e=e.return}}function i1(t,e,n){var s=t.pingCache;s!==null&&s.delete(e),e=et(),t.pingedLanes|=t.suspendedLanes&n,ze===t&&(We&n)===n&&(De===4||De===3&&(We&130023424)===We&&500>Ne()-Rf?tr(t,0):Pf|=n),ht(t,e)}function A0(t,e){e===0&&(t.mode&1?(e=xa,xa<<=1,!(xa&130023424)&&(xa=4194304)):e=1);var n=et();t=Ln(t,e),t!==null&&(qo(t,e,n),ht(t,n))}function o1(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),A0(t,n)}function a1(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(O(314))}s!==null&&s.delete(e),A0(t,n)}var I0;I0=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||dt.current)lt=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return lt=!1,Yw(t,e,n);lt=!!(t.flags&131072)}else lt=!1,ye&&e.flags&1048576&&$x(e,Sl,e.index);switch(e.lanes=0,e.tag){case 2:var s=e.type;el(t,e),t=e.pendingProps;var r=ai(e,qe.current);$r(e,n),r=kf(null,e,s,t,r,n);var i=Cf();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,ft(s)?(i=!0,bl(e)):i=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,vf(e),r.updater=cc,e.stateNode=r,r._reactInternals=e,td(e,s,t,n),e=rd(null,e,s,!0,i,n)):(e.tag=0,ye&&i&&ff(e),Ze(null,e,r,n),e=e.child),e;case 16:s=e.elementType;e:{switch(el(t,e),t=e.pendingProps,r=s._init,s=r(s._payload),e.type=s,r=e.tag=c1(s),t=Ut(s,t),r){case 0:e=sd(null,e,s,t,n);break e;case 1:e=xp(null,e,s,t,n);break e;case 11:e=gp(null,e,s,t,n);break e;case 14:e=mp(null,e,s,Ut(s.type,t),n);break e}throw Error(O(306,s,""))}return e;case 0:return s=e.type,r=e.pendingProps,r=e.elementType===s?r:Ut(s,r),sd(t,e,s,r,n);case 1:return s=e.type,r=e.pendingProps,r=e.elementType===s?r:Ut(s,r),xp(t,e,s,r,n);case 3:e:{if(b0(e),t===null)throw Error(O(387));s=e.pendingProps,i=e.memoizedState,r=i.element,Kx(t,e),Cl(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=di(Error(O(423)),e),e=yp(t,e,s,n,r);break e}else if(s!==r){r=di(Error(O(424)),e),e=yp(t,e,s,n,r);break e}else for(wt=gs(e.stateNode.containerInfo.firstChild),St=e,ye=!0,Qt=null,n=Vx(e,null,s,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(li(),s===r){e=An(t,e,n);break e}Ze(t,e,s,n)}e=e.child}return e;case 5:return Yx(e),t===null&&Ju(e),s=e.type,r=e.pendingProps,i=t!==null?t.memoizedProps:null,o=r.children,Ku(s,r)?o=null:i!==null&&Ku(s,i)&&(e.flags|=32),v0(t,e),Ze(t,e,o,n),e.child;case 6:return t===null&&Ju(e),null;case 13:return w0(t,e,n);case 4:return bf(e,e.stateNode.containerInfo),s=e.pendingProps,t===null?e.child=ci(e,null,s,n):Ze(t,e,s,n),e.child;case 11:return s=e.type,r=e.pendingProps,r=e.elementType===s?r:Ut(s,r),gp(t,e,s,r,n);case 7:return Ze(t,e,e.pendingProps,n),e.child;case 8:return Ze(t,e,e.pendingProps.children,n),e.child;case 12:return Ze(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,de(_l,s._currentValue),s._currentValue=o,i!==null)if(qt(i.value,o)){if(i.children===r.children&&!dt.current){e=An(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=On(-1,n&-n),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?l.next=l:(l.next=d.next,d.next=l),c.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Zu(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(O(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Zu(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}Ze(t,e,r.children,n),e=e.child}return e;case 9:return r=e.type,s=e.pendingProps.children,$r(e,n),r=At(r),s=s(r),e.flags|=1,Ze(t,e,s,n),e.child;case 14:return s=e.type,r=Ut(s,e.pendingProps),r=Ut(s.type,r),mp(t,e,s,r,n);case 15:return x0(t,e,e.type,e.pendingProps,n);case 17:return s=e.type,r=e.pendingProps,r=e.elementType===s?r:Ut(s,r),el(t,e),e.tag=1,ft(s)?(t=!0,bl(e)):t=!1,$r(e,n),p0(e,s,r),td(e,s,r,n),rd(null,e,s,!0,t,n);case 19:return S0(t,e,n);case 22:return y0(t,e,n)}throw Error(O(156,e.tag))};function F0(t,e){return dx(t,e)}function l1(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 Tt(t,e,n,s){return new l1(t,e,n,s)}function Lf(t){return t=t.prototype,!(!t||!t.isReactComponent)}function c1(t){if(typeof t=="function")return Lf(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Zd)return 11;if(t===ef)return 14}return 2}function vs(t,e){var n=t.alternate;return n===null?(n=Tt(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 sl(t,e,n,s,r,i){var o=2;if(s=t,typeof t=="function")Lf(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Cr:return nr(n.children,r,i,e);case Jd:o=8,r|=8;break;case Cu:return t=Tt(12,n,e,r|2),t.elementType=Cu,t.lanes=i,t;case ju:return t=Tt(13,n,e,r),t.elementType=ju,t.lanes=i,t;case Nu:return t=Tt(19,n,e,r),t.elementType=Nu,t.lanes=i,t;case Ym:return fc(n,r,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Qm:o=10;break e;case Km:o=9;break e;case Zd:o=11;break e;case ef:o=14;break e;case Qn:o=16,s=null;break e}throw Error(O(130,t==null?t:typeof t,""))}return e=Tt(o,n,e,r),e.elementType=t,e.type=s,e.lanes=i,e}function nr(t,e,n,s){return t=Tt(7,t,s,e),t.lanes=n,t}function fc(t,e,n,s){return t=Tt(22,t,s,e),t.elementType=Ym,t.lanes=n,t.stateNode={isHidden:!1},t}function su(t,e,n){return t=Tt(6,t,null,e),t.lanes=n,t}function ru(t,e,n){return e=Tt(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function u1(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=Fc(0),this.expirationTimes=Fc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fc(0),this.identifierPrefix=s,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Af(t,e,n,s,r,i,o,a,l){return t=new u1(t,e,n,a,l),e===1?(e=1,i===!0&&(e|=8)):e=0,i=Tt(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},vf(i),t}function d1(t,e,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:kr,key:s==null?null:""+s,children:t,containerInfo:e,implementation:n}}function z0(t){if(!t)return Cs;t=t._reactInternals;e:{if(fr(t)!==t||t.tag!==1)throw Error(O(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(ft(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(O(171))}if(t.tag===1){var n=t.type;if(ft(n))return zx(t,n,e)}return e}function B0(t,e,n,s,r,i,o,a,l){return t=Af(n,s,!0,t,r,i,o,a,l),t.context=z0(null),n=t.current,s=et(),r=ys(n),i=On(s,r),i.callback=e??null,ms(n,i,r),t.current.lanes=r,qo(t,r,s),ht(t,s),t}function hc(t,e,n,s){var r=e.current,i=et(),o=ys(r);return n=z0(n),e.context===null?e.context=n:e.pendingContext=n,e=On(i,o),e.payload={element:t},s=s===void 0?null:s,s!==null&&(e.callback=s),t=ms(r,e,o),t!==null&&(Yt(t,r,o,i),Ga(t,r,o)),o}function Tl(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 Ep(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function If(t,e){Ep(t,e),(t=t.alternate)&&Ep(t,e)}function f1(){return null}var $0=typeof reportError=="function"?reportError:function(t){console.error(t)};function Ff(t){this._internalRoot=t}pc.prototype.render=Ff.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(O(409));hc(t,e,null,null)};pc.prototype.unmount=Ff.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;lr(function(){hc(null,t,null,null)}),e[Dn]=null}};function pc(t){this._internalRoot=t}pc.prototype.unstable_scheduleHydration=function(t){if(t){var e=yx();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Xn.length&&e!==0&&e<Xn[n].priority;n++);Xn.splice(n,0,t),n===0&&bx(t)}};function zf(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function gc(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Mp(){}function h1(t,e,n,s,r){if(r){if(typeof s=="function"){var i=s;s=function(){var c=Tl(o);i.call(c)}}var o=B0(e,s,t,0,null,!1,!1,"",Mp);return t._reactRootContainer=o,t[Dn]=o.current,jo(t.nodeType===8?t.parentNode:t),lr(),o}for(;r=t.lastChild;)t.removeChild(r);if(typeof s=="function"){var a=s;s=function(){var c=Tl(l);a.call(c)}}var l=Af(t,0,!1,null,null,!1,!1,"",Mp);return t._reactRootContainer=l,t[Dn]=l.current,jo(t.nodeType===8?t.parentNode:t),lr(function(){hc(e,l,n,s)}),l}function mc(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=Tl(o);a.call(l)}}hc(e,o,t,r)}else o=h1(n,e,t,r,s);return Tl(o)}mx=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=Yi(e.pendingLanes);n!==0&&(sf(e,n|1),ht(e,Ne()),!(te&6)&&(fi=Ne()+500,Rs()))}break;case 13:lr(function(){var s=Ln(t,1);if(s!==null){var r=et();Yt(s,t,1,r)}}),If(t,1)}};rf=function(t){if(t.tag===13){var e=Ln(t,134217728);if(e!==null){var n=et();Yt(e,t,134217728,n)}If(t,134217728)}};xx=function(t){if(t.tag===13){var e=ys(t),n=Ln(t,e);if(n!==null){var s=et();Yt(n,t,e,s)}If(t,e)}};yx=function(){return le};vx=function(t,e){var n=le;try{return le=t,e()}finally{le=n}};Iu=function(t,e,n){switch(e){case"input":if(Pu(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=oc(s);if(!r)throw Error(O(90));qm(s),Pu(s,r)}}}break;case"textarea":Jm(t,n);break;case"select":e=n.value,e!=null&&Ir(t,!!n.multiple,e,!1)}};ix=Of;ox=lr;var p1={usingClientEntryPoint:!1,Events:[Jo,Mr,oc,sx,rx,Of]},Fi={findFiberByHostInstance:$s,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},g1={bundleType:Fi.bundleType,version:Fi.version,rendererPackageName:Fi.rendererPackageName,rendererConfig:Fi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:In.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=cx(t),t===null?null:t.stateNode},findFiberByHostInstance:Fi.findFiberByHostInstance||f1,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 Ea=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ea.isDisabled&&Ea.supportsFiber)try{nc=Ea.inject(g1),mn=Ea}catch{}}Ct.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=p1;Ct.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!zf(e))throw Error(O(200));return d1(t,e,null,n)};Ct.createRoot=function(t,e){if(!zf(t))throw Error(O(299));var n=!1,s="",r=$0;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(s=e.identifierPrefix),e.onRecoverableError!==void 0&&(r=e.onRecoverableError)),e=Af(t,1,!1,null,null,n,!1,s,r),t[Dn]=e.current,jo(t.nodeType===8?t.parentNode:t),new Ff(e)};Ct.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(O(188)):(t=Object.keys(t).join(","),Error(O(268,t)));return t=cx(e),t=t===null?null:t.stateNode,t};Ct.flushSync=function(t){return lr(t)};Ct.hydrate=function(t,e,n){if(!gc(e))throw Error(O(200));return mc(null,t,e,!0,n)};Ct.hydrateRoot=function(t,e,n){if(!zf(t))throw Error(O(405));var s=n!=null&&n.hydratedSources||null,r=!1,i="",o=$0;if(n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=B0(e,null,t,1,n??null,r,!1,i,o),t[Dn]=e.current,jo(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 pc(e)};Ct.render=function(t,e,n){if(!gc(e))throw Error(O(200));return mc(null,t,e,!1,n)};Ct.unmountComponentAtNode=function(t){if(!gc(t))throw Error(O(40));return t._reactRootContainer?(lr(function(){mc(null,null,t,!1,function(){t._reactRootContainer=null,t[Dn]=null})}),!0):!1};Ct.unstable_batchedUpdates=Of;Ct.unstable_renderSubtreeIntoContainer=function(t,e,n,s){if(!gc(n))throw Error(O(200));if(t==null||t._reactInternals===void 0)throw Error(O(38));return mc(t,e,n,!1,s)};Ct.version="18.3.1-next-f1338f8080-20240426";function U0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(U0)}catch(t){console.error(t)}}U0(),Um.exports=Ct;var Ar=Um.exports,Pp=Ar;_u.createRoot=Pp.createRoot,_u.hydrateRoot=Pp.hydrateRoot;const W0=w.createContext(void 0),m1=t=>{const e=w.useContext(W0);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},x1=({client:t,children:e})=>(w.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),u.jsx(W0.Provider,{value:t,children:e})),y1={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)};var Gn,Hd,wm,v1=(wm=class{constructor(){B(this,Gn,y1);B(this,Hd,!1)}setTimeoutProvider(t){D(this,Gn,t)}setTimeout(t,e){return N(this,Gn).setTimeout(t,e)}clearTimeout(t){N(this,Gn).clearTimeout(t)}setInterval(t,e){return N(this,Gn).setInterval(t,e)}clearInterval(t){N(this,Gn).clearInterval(t)}},Gn=new WeakMap,Hd=new WeakMap,wm);const Hs=new v1;function b1(t){setTimeout(t,0)}const w1=typeof window>"u"||"Deno"in globalThis;function it(){}function S1(t,e){return typeof t=="function"?t(e):t}function H0(t){return typeof t=="number"&&t>=0&&t!==1/0}function V0(t,e){return Math.max(t+(e||0)-Date.now(),0)}function xe(t,e){return typeof t=="function"?t(e):t}function Rp(t,e){const{type:n="all",exact:s,fetchStatus:r,predicate:i,queryKey:o,stale:a}=t;if(o){if(s){if(e.queryHash!==Bf(o,e.options))return!1}else if(!hi(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 Op(t,e){const{exact:n,status:s,predicate:r,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(n){if(Lo(e.options.mutationKey)!==Lo(i))return!1}else if(!hi(e.options.mutationKey,i))return!1}return!(s&&e.state.status!==s||r&&!r(e))}function Bf(t,e){return((e==null?void 0:e.queryKeyHashFn)||Lo)(t)}function Lo(t){return JSON.stringify(t,(e,n)=>md(n)?Object.keys(n).sort().reduce((s,r)=>(s[r]=n[r],s),{}):n)}function hi(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(!hi(t[s],e[s]))return!1;return!0}const n=Object.keys(e);for(const s of n)if(!hi(t[s],e[s]))return!1;return!0}return!1}const _1=Object.prototype.hasOwnProperty;function Q0(t,e,n=0){if(t===e)return t;if(n>500)return e;const s=Tp(t)&&Tp(e);if(!s&&!(md(t)&&md(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 d=s?c:i[c],f=t[d],h=e[d];if(f===h){a[d]=f,(s?c<r:_1.call(t,d))&&l++;continue}if(f===null||h===null||typeof f!="object"||typeof h!="object"){a[d]=h;continue}const p=Q0(f,h,n+1);a[d]=p,p===f&&l++}return r===o&&l===r?t:a}function iu(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 Tp(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function md(t){if(!Dp(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!(!Dp(s)||!s.hasOwnProperty("isPrototypeOf")||e!==Object.prototype)}function Dp(t){return Object.prototype.toString.call(t)==="[object Object]"}function k1(t){return new Promise(e=>{Hs.setTimeout(e,t)})}function xd(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?Q0(t,e):e}function C1(t,e,n=0){const s=[...t,e];return n&&s.length>n?s.slice(1):s}function j1(t,e,n=0){const s=[e,...t];return n&&s.length>n?s.slice(0,-1):s}const $f=Symbol();function K0(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===$f?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Y0(t,e){return typeof t=="function"?t(...e):!!t}function N1(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 E1=()=>w1;const Uf=()=>E1();var ea=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(){}},Qs,Jn,Kr,Sm,M1=(Sm=class extends ea{constructor(){super();B(this,Qs);B(this,Jn);B(this,Kr);D(this,Kr,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){N(this,Jn)||this.setEventListener(N(this,Kr))}onUnsubscribe(){var e;this.hasListeners()||((e=N(this,Jn))==null||e.call(this),D(this,Jn,void 0))}setEventListener(e){var n;D(this,Kr,e),(n=N(this,Jn))==null||n.call(this),D(this,Jn,e(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(e){N(this,Qs)!==e&&(D(this,Qs,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof N(this,Qs)=="boolean"?N(this,Qs):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Qs=new WeakMap,Jn=new WeakMap,Kr=new WeakMap,Sm);const Wf=new M1,P1=b1;function R1(){let t=[],e=0,n=a=>{a()},s=a=>{a()},r=P1;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 Ue=R1();var Yr,Zn,Xr,_m,O1=(_m=class extends ea{constructor(){super();B(this,Yr,!0);B(this,Zn);B(this,Xr);D(this,Xr,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(){N(this,Zn)||this.setEventListener(N(this,Xr))}onUnsubscribe(){var e;this.hasListeners()||((e=N(this,Zn))==null||e.call(this),D(this,Zn,void 0))}setEventListener(e){var n;D(this,Xr,e),(n=N(this,Zn))==null||n.call(this),D(this,Zn,e(this.setOnline.bind(this)))}setOnline(e){N(this,Yr)!==e&&(D(this,Yr,e),this.listeners.forEach(n=>{n(e)}))}isOnline(){return N(this,Yr)}},Yr=new WeakMap,Zn=new WeakMap,Xr=new WeakMap,_m);const Dl=new O1;function T1(t){return Math.min(1e3*2**t,3e4)}function X0(t){return(t??"online")==="online"?Dl.isOnline():!0}var yd=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function q0(t){let e=!1,n=0,s,r="pending",i,o;const a=new Promise((m,v)=>{i=m,o=v});a.catch(it);const l=()=>r!=="pending",c=m=>{var v;if(!l()){const S=new yd(m);g(S),(v=t.onCancel)==null||v.call(t,S)}},d=()=>{e=!0},f=()=>{e=!1},h=()=>Wf.isFocused()&&(t.networkMode==="always"||Dl.isOnline())&&t.canRun(),p=()=>X0(t.networkMode)&&t.canRun(),x=m=>{l()||(s==null||s(),r="resolved",i(m))},g=m=>{l()||(s==null||s(),r="rejected",o(m))},b=m=>new Promise(v=>{var S;s=_=>{(l()||m())&&v(_)},(S=t.onPause)==null||S.call(t)}).then(()=>{var v;s=void 0,l()||(v=t.onContinue)==null||v.call(t)}),y=()=>{if(l())return;let m;const v=n===0?t.initialPromise:void 0;try{m=v??t.fn()}catch(S){m=Promise.reject(S)}Promise.resolve(m).then(x).catch(S=>{var P;if(l())return;const _=t.retry??(Uf()?0:3),k=t.retryDelay??T1,C=typeof k=="function"?k(n,S):k,j=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,S);if(e||!j){g(S);return}n++,(P=t.onFail)==null||P.call(t,n,S),k1(C).then(()=>h()?void 0:b(h)).then(()=>{e?g(S):y()})})};return{promise:a,status:()=>r,cancel:c,continue:()=>(s==null||s(),a),cancelRetry:d,continueRetry:f,canStart:p,start:()=>(p()?y():b(p).then(y),a)}}var Ks,km,G0=(km=class{constructor(){B(this,Ks)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),H0(this.gcTime)&&D(this,Ks,Hs.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Uf()?1/0:3e5))}clearGcTimeout(){N(this,Ks)!==void 0&&(Hs.clearTimeout(N(this,Ks)),D(this,Ks,void 0))}},Ks=new WeakMap,km);function D1(t){return{onFetch:(e,n)=>{var d,f,h,p,x;const s=e.options,r=(h=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,i=((p=e.state.data)==null?void 0:p.pages)||[],o=((x=e.state.data)==null?void 0:x.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let g=!1;const b=v=>{N1(v,()=>e.signal,()=>g=!0)},y=K0(e.options,e.fetchOptions),m=async(v,S,_)=>{if(g)return Promise.reject(e.signal.reason);if(S==null&&v.pages.length)return Promise.resolve(v);const C=(()=>{const R={client:e.client,queryKey:e.queryKey,pageParam:S,direction:_?"backward":"forward",meta:e.options.meta};return b(R),R})(),j=await y(C),{maxPages:P}=e.options,E=_?j1:C1;return{pages:E(v.pages,j,P),pageParams:E(v.pageParams,S,P)}};if(r&&i.length){const v=r==="backward",S=v?L1:Lp,_={pages:i,pageParams:o};a=await m(_,S(s,_),v)}else{const v=t??i.length;do{const S=l===0?o[0]===void 0?s.initialPageParam:o[0]:Lp(s,a);if(l>0&&S==null)break;a=await m(a,S),l++}while(l<v)}return a};e.options.persister?e.fetchFn=()=>{var g,b;return(b=(g=e.options).persister)==null?void 0:b.call(g,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=c}}}function Lp(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 L1(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 qr,Ys,Gr,Mt,Xs,Re,Ho,qs,Wt,wn,Cm,A1=(Cm=class extends G0{constructor(e){super();B(this,Wt);B(this,qr);B(this,Ys);B(this,Gr);B(this,Mt);B(this,Xs);B(this,Re);B(this,Ho);B(this,qs);D(this,qs,!1),D(this,Ho,e.defaultOptions),this.setOptions(e.options),this.observers=[],D(this,Xs,e.client),D(this,Mt,N(this,Xs).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,D(this,Ys,Ip(this.options)),this.state=e.state??N(this,Ys),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return N(this,qr)}get promise(){var e;return(e=N(this,Re))==null?void 0:e.promise}setOptions(e){if(this.options={...N(this,Ho),...e},e!=null&&e._type&&D(this,qr,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Ip(this.options);n.data!==void 0&&(this.setState(Ap(n.data,n.dataUpdatedAt)),D(this,Ys,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&N(this,Mt).remove(this)}setData(e,n){const s=xd(this.state.data,e,this.options);return q(this,Wt,wn).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(e){q(this,Wt,wn).call(this,{type:"setState",state:e})}cancel(e){var s,r;const n=(s=N(this,Re))==null?void 0:s.promise;return(r=N(this,Re))==null||r.cancel(e),n?n.then(it).catch(it):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return N(this,Ys)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>xe(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===$f||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>xe(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:!V0(this.state.dataUpdatedAt,e)}onFocus(){var e,n;(e=this.observers.find(s=>s.shouldFetchOnWindowFocus()))==null||e.refetch({cancelRefetch:!1}),(n=N(this,Re))==null||n.continue()}onOnline(){var e,n;(e=this.observers.find(s=>s.shouldFetchOnReconnect()))==null||e.refetch({cancelRefetch:!1}),(n=N(this,Re))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),N(this,Mt).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||(N(this,Re)&&(N(this,qs)||this.state.fetchStatus==="paused"&&this.state.status==="pending"?N(this,Re).cancel({revert:!0}):N(this,Re).cancelRetry()),this.scheduleGc()),N(this,Mt).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||q(this,Wt,wn).call(this,{type:"invalidate"})}async fetch(e,n){var c,d,f,h,p,x,g,b,y,m,v,S;if(this.state.fetchStatus!=="idle"&&((c=N(this,Re))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(N(this,Re))return N(this,Re).continueRetry(),N(this,Re).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,qs,!0),s.signal)})},i=()=>{const _=K0(this.options,n),C=(()=>{const j={client:N(this,Xs),queryKey:this.queryKey,meta:this.meta};return r(j),j})();return D(this,qs,!1),this.options.persister?this.options.persister(_,C,this):_(C)},a=(()=>{const _={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:N(this,Xs),state:this.state,fetchFn:i};return r(_),_})();(d=N(this,qr)==="infinite"?D1(this.options.pages):this.options.behavior)==null||d.onFetch(a,this),D(this,Gr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&q(this,Wt,wn).call(this,{type:"fetch",meta:(h=a.fetchOptions)==null?void 0:h.meta});const l=D(this,Re,q0({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:_=>{_ instanceof yd&&_.revert&&this.setState({...N(this,Gr),fetchStatus:"idle"}),s.abort()},onFail:(_,k)=>{q(this,Wt,wn).call(this,{type:"failed",failureCount:_,error:k})},onPause:()=>{q(this,Wt,wn).call(this,{type:"pause"})},onContinue:()=>{q(this,Wt,wn).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(_),(x=(p=N(this,Mt).config).onSuccess)==null||x.call(p,_,this),(b=(g=N(this,Mt).config).onSettled)==null||b.call(g,_,this.state.error,this),_}catch(_){if(_ instanceof yd){if(_.silent)return N(this,Re).promise;if(_.revert){if(this.state.data===void 0)throw _;return this.state.data}}throw q(this,Wt,wn).call(this,{type:"error",error:_}),(m=(y=N(this,Mt).config).onError)==null||m.call(y,_,this),(S=(v=N(this,Mt).config).onSettled)==null||S.call(v,this.state.data,_,this),_}finally{N(this,Re)===l&&D(this,Re,void 0),this.scheduleGc()}}},qr=new WeakMap,Ys=new WeakMap,Gr=new WeakMap,Mt=new WeakMap,Xs=new WeakMap,Re=new WeakMap,Ho=new WeakMap,qs=new WeakMap,Wt=new WeakSet,wn=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,...J0(s.data,this.options),fetchMeta:e.meta??null};case"success":const r={...s,...Ap(e.data,e.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return D(this,Gr,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),Ue.batch(()=>{this.observers.slice().forEach(s=>{s.onQueryUpdate()}),N(this,Mt).notify({query:this,type:"updated",action:e})})},Cm);function J0(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:X0(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Ap(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ip(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 Ge,G,Vo,Je,Gs,Jr,Nn,Qo,Zr,ei,Js,Zs,es,ti,re,qi,vd,bd,wd,Sd,_d,kd,Cd,jd,jm,I1=(jm=class extends ea{constructor(e,n){super();B(this,re);B(this,Ge);B(this,G);B(this,Vo);B(this,Je);B(this,Gs);B(this,Jr);B(this,Nn);B(this,Qo);B(this,Zr);B(this,ei);B(this,Js);B(this,Zs);B(this,es);B(this,ti,new Set);this.options=n,D(this,Ge,e),D(this,Nn,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(N(this,G).addObserver(this),Fp(N(this,G),this.options)?q(this,re,qi).call(this):this.updateResult(),q(this,re,_d).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Nd(N(this,G),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Nd(N(this,G),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,q(this,re,kd).call(this),q(this,re,Cd).call(this),N(this,G).removeObserver(this)}setOptions(e){const n=this.options,s=N(this,G);if(this.options=N(this,Ge).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof xe(this.options.enabled,N(this,G))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");q(this,re,jd).call(this),N(this,G).setOptions(this.options),n._defaulted&&!iu(this.options,n)&&N(this,Ge).getQueryCache().notify({type:"observerOptionsUpdated",query:N(this,G),observer:this});const r=this.hasListeners();r&&zp(N(this,G),s,this.options,n)&&q(this,re,qi).call(this),this.updateResult(),r&&(N(this,G)!==s||xe(this.options.enabled,N(this,G))!==xe(n.enabled,N(this,G))||xe(this.options.staleTime,N(this,G))!==xe(n.staleTime,N(this,G)))&&q(this,re,bd).call(this);const i=q(this,re,wd).call(this);r&&(N(this,G)!==s||xe(this.options.enabled,N(this,G))!==xe(n.enabled,N(this,G))||i!==N(this,es))&&q(this,re,Sd).call(this,i)}getOptimisticResult(e){const n=N(this,Ge).getQueryCache().build(N(this,Ge),e),s=this.createResult(n,e);return iu(this.getCurrentResult(),s)||(D(this,Je,s),D(this,Jr,this.options),D(this,Gs,N(this,G).state)),s}getCurrentResult(){return N(this,Je)}trackResult(e,n){return new Proxy(e,{get:(s,r)=>(this.trackProp(r),n==null||n(r),Reflect.get(s,r))})}trackProp(e){N(this,ti).add(e)}getCurrentQuery(){return N(this,G)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=N(this,Ge).defaultQueryOptions(e),s=N(this,Ge).getQueryCache().build(N(this,Ge),n);let r=()=>{},i;const o=new Promise(a=>{i=a,r=N(this,Ge).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 q(this,re,qi).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),N(this,Je)))}createResult(e,n){var k;const s=N(this,G),r=this.options,i=N(this,Je),o=N(this,Gs),a=N(this,Jr),l=e!==s?e.state:N(this,Vo),{state:c}=e;let d={...c},f=!1,h;if(n._optimisticResults){const C=this.hasListeners(),j=!C&&Fp(e,n),P=C&&zp(e,s,n,r);(j||P)&&(d={...d,...J0(c.data,e.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:p,errorUpdatedAt:x,status:g}=d;h=d.data;let b=!1;if(n.placeholderData!==void 0&&h===void 0&&g==="pending"){let C;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(C=i.data,b=!0):C=typeof n.placeholderData=="function"?n.placeholderData((k=N(this,ei))==null?void 0:k.state.data,N(this,ei)):n.placeholderData,C!==void 0&&(g="success",h=xd(i==null?void 0:i.data,C,n),f=!0)}if(n.select&&h!==void 0&&!b)if(i&&h===(o==null?void 0:o.data)&&n.select===N(this,Qo))h=N(this,Zr);else try{D(this,Qo,n.select),h=n.select(h),h=xd(i==null?void 0:i.data,h,n),D(this,Zr,h),D(this,Nn,null)}catch(C){D(this,Nn,C)}else h===void 0&&D(this,Nn,null);N(this,Nn)&&(p=N(this,Nn),h=N(this,Zr),x=Date.now(),g="error",f=!1);const y=d.fetchStatus==="fetching",m=g==="pending",v=g==="error",S=m&&y,_=h!==void 0;return{status:g,fetchStatus:d.fetchStatus,isPending:m,isSuccess:g==="success",isError:v,isInitialLoading:S,isLoading:S,data:h,dataUpdatedAt:d.dataUpdatedAt,error:p,errorUpdatedAt:x,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:y,isRefetching:y&&!m,isLoadingError:v&&!_,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:v&&_,isStale:Hf(e,n),refetch:this.refetch,isEnabled:xe(n.enabled,e)!==!1}}updateResult(){const e=N(this,Je),n=this.createResult(N(this,G),this.options);if(D(this,Gs,N(this,G).state),D(this,Jr,this.options),N(this,Gs).data!==void 0&&D(this,ei,N(this,G)),iu(n,e))return;D(this,Je,n);const r=(()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!N(this,ti).size)return!0;const a=new Set(o??N(this,ti));return this.options.throwOnError&&a.add("error"),Object.keys(N(this,Je)).some(l=>{const c=l;return N(this,Je)[c]!==e[c]&&a.has(c)})})();Ue.batch(()=>{r&&this.listeners.forEach(i=>{i(N(this,Je))}),N(this,Ge).getQueryCache().notify({query:N(this,G),type:"observerResultsUpdated"})})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&q(this,re,_d).call(this)}},Ge=new WeakMap,G=new WeakMap,Vo=new WeakMap,Je=new WeakMap,Gs=new WeakMap,Jr=new WeakMap,Nn=new WeakMap,Qo=new WeakMap,Zr=new WeakMap,ei=new WeakMap,Js=new WeakMap,Zs=new WeakMap,es=new WeakMap,ti=new WeakMap,re=new WeakSet,qi=function(e){q(this,re,jd).call(this);let n=N(this,G).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(it)),n},vd=function(e){return!Uf()&&xe(this.options.enabled,N(this,G))!==!1&&H0(e)},bd=function(){q(this,re,kd).call(this);const e=xe(this.options.staleTime,N(this,G));if(N(this,Je).isStale||!q(this,re,vd).call(this,e))return;const n=V0(N(this,Je).dataUpdatedAt,e)+1;D(this,Js,Hs.setTimeout(()=>{N(this,Je).isStale||this.updateResult()},n))},wd=function(){return xe(this.options.refetchInterval,N(this,G))??!1},Sd=function(e){q(this,re,Cd).call(this),D(this,es,e),!(N(this,es)===0||!q(this,re,vd).call(this,N(this,es)))&&D(this,Zs,Hs.setInterval(()=>{(this.options.refetchIntervalInBackground||Wf.isFocused())&&q(this,re,qi).call(this)},N(this,es)))},_d=function(){q(this,re,bd).call(this),q(this,re,Sd).call(this,q(this,re,wd).call(this))},kd=function(){N(this,Js)!==void 0&&(Hs.clearTimeout(N(this,Js)),D(this,Js,void 0))},Cd=function(){N(this,Zs)!==void 0&&(Hs.clearInterval(N(this,Zs)),D(this,Zs,void 0))},jd=function(){const e=N(this,Ge).getQueryCache().build(N(this,Ge),this.options);if(e===N(this,G))return;const n=N(this,G);D(this,G,e),D(this,Vo,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},jm);function F1(t,e){return xe(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&xe(e.retryOnMount,t)===!1)}function Fp(t,e){return F1(t,e)||t.state.data!==void 0&&Nd(t,e,e.refetchOnMount)}function Nd(t,e,n){if(xe(e.enabled,t)!==!1&&xe(e.staleTime,t)!=="static"){const s=xe(n,t);return s==="always"||s!==!1&&Hf(t,e)}return!1}function zp(t,e,n,s){return(t!==e||xe(s.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&Hf(t,n)}function Hf(t,e){return xe(e.enabled,t)!==!1&&t.isStaleByTime(xe(e.staleTime,t))}var Ko,fn,Ye,er,hn,Vn,Nm,z1=(Nm=class extends G0{constructor(e){super();B(this,hn);B(this,Ko);B(this,fn);B(this,Ye);B(this,er);D(this,Ko,e.client),this.mutationId=e.mutationId,D(this,Ye,e.mutationCache),D(this,fn,[]),this.state=e.state||B1(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){N(this,fn).includes(e)||(N(this,fn).push(e),this.clearGcTimeout(),N(this,Ye).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){D(this,fn,N(this,fn).filter(n=>n!==e)),this.scheduleGc(),N(this,Ye).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){N(this,fn).length||(this.state.status==="pending"?this.scheduleGc():N(this,Ye).remove(this))}continue(){var e;return((e=N(this,er))==null?void 0:e.continue())??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(e){var a,l,c,d,f,h,p,x,g,b,y,m,v,S,_,k,C,j;const n=()=>{q(this,hn,Vn).call(this,{type:"continue"})},s={client:N(this,Ko),meta:this.options.meta,mutationKey:this.options.mutationKey},r=D(this,er,q0({fn:()=>this.options.mutationFn?this.options.mutationFn(e,s):Promise.reject(new Error("No mutationFn found")),onFail:(P,E)=>{q(this,hn,Vn).call(this,{type:"failed",failureCount:P,error:E})},onPause:()=>{q(this,hn,Vn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>N(this,Ye).canRun(this)})),i=this.state.status==="pending",o=!r.canStart();try{if(i)n();else{q(this,hn,Vn).call(this,{type:"pending",variables:e,isPaused:o}),N(this,Ye).config.onMutate&&await N(this,Ye).config.onMutate(e,this,s);const E=await((l=(a=this.options).onMutate)==null?void 0:l.call(a,e,s));E!==this.state.context&&q(this,hn,Vn).call(this,{type:"pending",context:E,variables:e,isPaused:o})}const P=await r.start();return await((d=(c=N(this,Ye).config).onSuccess)==null?void 0:d.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((x=(p=N(this,Ye).config).onSettled)==null?void 0:x.call(p,P,null,this.state.variables,this.state.context,this,s)),await((b=(g=this.options).onSettled)==null?void 0:b.call(g,P,null,e,this.state.context,s)),q(this,hn,Vn).call(this,{type:"success",data:P}),P}catch(P){try{await((m=(y=N(this,Ye).config).onError)==null?void 0:m.call(y,P,e,this.state.context,this,s))}catch(E){Promise.reject(E)}try{await((S=(v=this.options).onError)==null?void 0:S.call(v,P,e,this.state.context,s))}catch(E){Promise.reject(E)}try{await((k=(_=N(this,Ye).config).onSettled)==null?void 0:k.call(_,void 0,P,this.state.variables,this.state.context,this,s))}catch(E){Promise.reject(E)}try{await((j=(C=this.options).onSettled)==null?void 0:j.call(C,void 0,P,e,this.state.context,s))}catch(E){Promise.reject(E)}throw q(this,hn,Vn).call(this,{type:"error",error:P}),P}finally{N(this,er)===r&&D(this,er,void 0),N(this,Ye).runNext(this)}}},Ko=new WeakMap,fn=new WeakMap,Ye=new WeakMap,er=new WeakMap,hn=new WeakSet,Vn=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),Ue.batch(()=>{N(this,fn).forEach(s=>{s.onMutationUpdate(e)}),N(this,Ye).notify({mutation:this,type:"updated",action:e})})},Nm);function B1(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ts,Ht,Yo,Em,$1=(Em=class extends ea{constructor(e={}){super();B(this,ts);B(this,Ht);B(this,Yo);this.config=e,D(this,ts,new Set),D(this,Ht,new Map),D(this,Yo,0)}build(e,n,s){const r=new z1({client:e,mutationCache:this,mutationId:++da(this,Yo)._,options:e.defaultMutationOptions(n),state:s});return this.add(r),r}add(e){N(this,ts).add(e);const n=Ma(e);if(typeof n=="string"){const s=N(this,Ht).get(n);s?s.push(e):N(this,Ht).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(N(this,ts).delete(e)){const n=Ma(e);if(typeof n=="string"){const s=N(this,Ht).get(n);if(s)if(s.length>1){const r=s.indexOf(e);r!==-1&&s.splice(r,1)}else s[0]===e&&N(this,Ht).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){var s;const n=Ma(e);if(typeof n=="string"){const r=(s=N(this,Ht).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=Ma(e);return typeof n=="string"?((r=(s=N(this,Ht).get(n))==null?void 0:s.find(i=>i!==e&&i.state.isPaused))==null?void 0:r.continue())??Promise.resolve():Promise.resolve()}clear(){Ue.batch(()=>{const e=this.getAll();N(this,ts).clear(),N(this,Ht).clear(),e.forEach(n=>{this.notify({type:"removed",mutation:n})})})}getAll(){return Array.from(N(this,ts))}find(e){const n={exact:!0,...e};return this.getAll().find(s=>Op(n,s))}findAll(e={}){return this.getAll().filter(n=>Op(e,n))}notify(e){Ue.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Ue.batch(()=>Promise.all(e.map(n=>n.continue().catch(it))))}},ts=new WeakMap,Ht=new WeakMap,Yo=new WeakMap,Em);function Ma(t){var e;return(e=t.options.scope)==null?void 0:e.id}var pn,Mm,U1=(Mm=class extends ea{constructor(e={}){super();B(this,pn);this.config=e,D(this,pn,new Map)}build(e,n,s){const r=n.queryKey,i=n.queryHash??Bf(r,n);let o=this.get(i);return o||(o=new A1({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(n),state:s,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){N(this,pn).has(e.queryHash)||(N(this,pn).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){N(this,pn).get(e.queryHash)===e&&(e.destroy(),N(this,pn).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Ue.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return N(this,pn).get(e)}getAll(){return[...N(this,pn).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(s=>Rp(n,s))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(s=>Rp(e,s)):n}notify(e){Ue.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Ue.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Ue.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},pn=new WeakMap,Mm),be,ns,ss,ni,si,rs,ri,ii,Pm,W1=(Pm=class{constructor(t={}){B(this,be);B(this,ns);B(this,ss);B(this,ni);B(this,si);B(this,rs);B(this,ri);B(this,ii);D(this,be,t.queryCache||new U1),D(this,ns,t.mutationCache||new $1),D(this,ss,t.defaultOptions||{}),D(this,ni,new Map),D(this,si,new Map),D(this,rs,0)}mount(){da(this,rs)._++,N(this,rs)===1&&(D(this,ri,Wf.subscribe(async t=>{t&&(await this.resumePausedMutations(),N(this,be).onFocus())})),D(this,ii,Dl.subscribe(async t=>{t&&(await this.resumePausedMutations(),N(this,be).onOnline())})))}unmount(){var t,e;da(this,rs)._--,N(this,rs)===0&&((t=N(this,ri))==null||t.call(this),D(this,ri,void 0),(e=N(this,ii))==null||e.call(this),D(this,ii,void 0))}isFetching(t){return N(this,be).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return N(this,ns).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=N(this,be).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=N(this,be).build(this,e),s=n.state.data;return s===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(xe(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(s))}getQueriesData(t){return N(this,be).findAll(t).map(({queryKey:e,state:n})=>[e,n.data])}setQueryData(t,e,n){var o;const s=this.defaultQueryOptions({queryKey:t}),r=(o=N(this,be).get(s.queryHash))==null?void 0:o.state.data,i=S1(e,r);if(i!==void 0)return N(this,be).build(this,s).setData(i,{...n,manual:!0})}setQueriesData(t,e,n){return Ue.batch(()=>N(this,be).findAll(t).map(({queryKey:s})=>[s,this.setQueryData(s,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=N(this,be).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=N(this,be);Ue.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=N(this,be);return Ue.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=Ue.batch(()=>N(this,be).findAll(t).map(r=>r.cancel(n)));return Promise.all(s).then(it).catch(it)}invalidateQueries(t,e={}){return Ue.batch(()=>(N(this,be).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=Ue.batch(()=>N(this,be).findAll(t).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let i=r.fetch(void 0,n);return n.throwOnError||(i=i.catch(it)),r.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(s).then(it)}async query(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=N(this,be).build(this,e),s=n.isStaleByTime(xe(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=N(this,be).build(this,e);return n.isStaleByTime(xe(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(it).catch(it)}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(it).catch(it)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return Dl.isOnline()?N(this,ns).resumePausedMutations():Promise.resolve()}getQueryCache(){return N(this,be)}getMutationCache(){return N(this,ns)}getDefaultOptions(){return N(this,ss)}setDefaultOptions(t){D(this,ss,t)}setQueryDefaults(t,e){N(this,ni).set(Lo(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...N(this,ni).values()],n={};return e.forEach(s=>{hi(t,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(t,e){N(this,si).set(Lo(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...N(this,si).values()],n={};return e.forEach(s=>{hi(t,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...N(this,ss).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Bf(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===$f&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...N(this,ss).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){N(this,be).clear(),N(this,ns).clear()}},be=new WeakMap,ns=new WeakMap,ss=new WeakMap,ni=new WeakMap,si=new WeakMap,rs=new WeakMap,ri=new WeakMap,ii=new WeakMap,Pm);const Z0=w.createContext(!1),H1=()=>w.useContext(Z0);Z0.Provider;function V1(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}const Q1=w.createContext(V1()),K1=()=>w.useContext(Q1),Y1=(t,e,n)=>{const s=(n==null?void 0:n.state.status)==="error"&&typeof t.throwOnError=="function"?Y0(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||s)&&(e.isReset()||(t.retryOnMount=!1))},X1=t=>{w.useEffect(()=>{t.clearReset()},[t])},q1=({result:t,errorResetBoundary:e,throwOnError:n,query:s,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&s&&(r&&t.data===void 0||Y0(n,[t.error,s])),G1=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))}},J1=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,Z1=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function eS(t,e,n){const s=H1(),r=K1(),i=m1(),o=i.defaultQueryOptions(t),a=i.getQueryCache().get(o.queryHash),l=t.subscribed!==!1;o._optimisticResults=s?"isRestoring":l?"optimistic":void 0,G1(o),Y1(o,r,a),X1(r);const[c]=w.useState(()=>new e(i,o)),d=c.getOptimisticResult(o),f=!s&&l;if(w.useSyncExternalStore(w.useCallback(h=>{const p=f?c.subscribe(Ue.batchCalls(h)):it;return c.updateResult(),p},[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),w.useEffect(()=>{c.setOptions(o)},[o,c]),J1(o,d))throw Z1(o,c,r);if(q1({result:d,errorResetBoundary:r,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw d.error;return o.notifyOnChangeProps?d:c.trackResult(d)}function ey(t,e){return eS(t,I1)}/**
41
41
  * @remix-run/router v1.23.4
42
42
  *
43
43
  * Copyright (c) Remix Software Inc.
@@ -46,7 +46,7 @@ Error generating stack: `+i.message+`
46
46
  * LICENSE.md file in the root directory of this source tree.
47
47
  *
48
48
  * @license MIT
49
- */function Lo(){return Lo=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},Lo.apply(null,arguments)}var as;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(as||(as={}));const Bp="popstate";function nS(t){t===void 0&&(t={});function e(s,r){let{pathname:i,search:o,hash:a}=s.location;return Ed("",{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:Tl(r)}return rS(e,n,null,t)}function je(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function ty(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function sS(){return Math.random().toString(36).substr(2,8)}function $p(t,e){return{usr:t.state,key:t.key,idx:e}}function Ed(t,e,n,s){return n===void 0&&(n=null),Lo({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?vi(e):e,{state:n,key:e&&e.key||s||sS()})}function Tl(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 vi(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 rS(t,e,n,s){s===void 0&&(s={});let{window:r=document.defaultView,v5Compat:i=!1}=s,o=r.history,a=as.Pop,l=null,c=d();c==null&&(c=0,o.replaceState(Lo({},o.state,{idx:c}),""));function d(){return(o.state||{idx:null}).idx}function f(){a=as.Pop;let b=d(),y=b==null?null:b-c;c=b,l&&l({action:a,location:g.location,delta:y})}function h(b,y){a=as.Push;let m=Ed(g.location,b,y);c=d()+1;let v=$p(m,c),S=g.createHref(m);try{o.pushState(v,"",S)}catch(_){if(_ instanceof DOMException&&_.name==="DataCloneError")throw _;r.location.assign(S)}i&&l&&l({action:a,location:g.location,delta:1})}function p(b,y){a=as.Replace;let m=Ed(g.location,b,y);c=d();let v=$p(m,c),S=g.createHref(m);o.replaceState(v,"",S),i&&l&&l({action:a,location:g.location,delta:0})}function x(b){let y=r.location.origin!=="null"?r.location.origin:r.location.href,m=typeof b=="string"?b:Tl(b);return m=m.replace(/ $/,"%20"),je(y,"No window.location.(origin|href) available to create URL for href: "+m),new URL(m,y)}let g={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(Bp,f),l=b,()=>{r.removeEventListener(Bp,f),l=null}},createHref(b){return e(r,b)},createURL:x,encodeLocation(b){let y=x(b);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:h,replace:p,go(b){return o.go(b)}};return g}var Up;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Up||(Up={}));function iS(t,e,n){return n===void 0&&(n="/"),oS(t,e,n)}function oS(t,e,n,s){let r=typeof e=="string"?vi(e):e,i=pi(r.pathname||"/",n);if(i==null)return null;let o=ny(t);aS(o);let a=null,l=yS(i);for(let c=0;a==null&&c<o.length;++c)a=mS(o[c],l);return a}function ny(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("/")&&(je(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=bs([s,l.relativePath]),d=n.concat(l);i.children&&i.children.length>0&&(je(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),ny(i.children,e,d,c)),!(i.path==null&&!i.index)&&e.push({path:c,score:pS(c,i.index),routesMeta:d})};return t.forEach((i,o)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))r(i,o);else for(let l of sy(i.path))r(i,o,l)}),e}function sy(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=sy(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 aS(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:gS(e.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const lS=/^:[\w-]+$/,cS=3,uS=2,dS=1,fS=10,hS=-2,Wp=t=>t==="*";function pS(t,e){let n=t.split("/"),s=n.length;return n.some(Wp)&&(s+=hS),e&&(s+=uS),n.filter(r=>!Wp(r)).reduce((r,i)=>r+(lS.test(i)?cS:i===""?dS:fS),s)}function gS(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 mS(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,d=i==="/"?e:e.slice(i.length)||"/",f=Md({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},d),h=l.route;if(!f)return null;Object.assign(r,f.params),o.push({params:r,pathname:bs([i,f.pathname]),pathnameBase:wS(bs([i,f.pathnameBase])),route:h}),f.pathnameBase!=="/"&&(i=bs([i,f.pathnameBase]))}return o}function Md(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,s]=xS(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,d,f)=>{let{paramName:h,isOptional:p}=d;if(h==="*"){let g=a[f]||"";o=i.slice(0,i.length-g.length).replace(/(.)\/+$/,"$1")}const x=a[f];return p&&!x?c[h]=void 0:c[h]=(x||"").replace(/%2F/g,"/"),c},{}),pathname:i,pathnameBase:o,pattern:t}}function xS(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),ty(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 yS(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return ty(!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 pi(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 vS(t,e){e===void 0&&(e="/");let{pathname:n,search:s="",hash:r=""}=typeof t=="string"?vi(t):t,i;return n?(n=oy(n),n.startsWith("/")?i=Hp(n.substring(1),"/"):i=Hp(n,e)):i=e,{pathname:i,search:SS(s),hash:_S(r)}}function Hp(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 ou(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 bS(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function ry(t,e){let n=bS(t);return e?n.map((s,r)=>r===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function iy(t,e,n,s){s===void 0&&(s=!1);let r;typeof t=="string"?r=vi(t):(r=Lo({},t),je(!r.pathname||!r.pathname.includes("?"),ou("?","pathname","search",r)),je(!r.pathname||!r.pathname.includes("#"),ou("#","pathname","hash",r)),je(!r.search||!r.search.includes("#"),ou("#","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=vS(r,a),c=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}const oy=t=>t.replace(/\/\/+/g,"/"),bs=t=>oy(t.join("/")),wS=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),SS=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,_S=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function kS(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const ay=["post","put","patch","delete"];new Set(ay);const CS=["get",...ay];new Set(CS);/**
49
+ */function Ao(){return Ao=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},Ao.apply(null,arguments)}var as;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(as||(as={}));const Bp="popstate";function tS(t){t===void 0&&(t={});function e(s,r){let{pathname:i,search:o,hash:a}=s.location;return Ed("",{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:Ll(r)}return sS(e,n,null,t)}function je(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function ty(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function nS(){return Math.random().toString(36).substr(2,8)}function $p(t,e){return{usr:t.state,key:t.key,idx:e}}function Ed(t,e,n,s){return n===void 0&&(n=null),Ao({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?vi(e):e,{state:n,key:e&&e.key||s||nS()})}function Ll(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 vi(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 sS(t,e,n,s){s===void 0&&(s={});let{window:r=document.defaultView,v5Compat:i=!1}=s,o=r.history,a=as.Pop,l=null,c=d();c==null&&(c=0,o.replaceState(Ao({},o.state,{idx:c}),""));function d(){return(o.state||{idx:null}).idx}function f(){a=as.Pop;let b=d(),y=b==null?null:b-c;c=b,l&&l({action:a,location:g.location,delta:y})}function h(b,y){a=as.Push;let m=Ed(g.location,b,y);c=d()+1;let v=$p(m,c),S=g.createHref(m);try{o.pushState(v,"",S)}catch(_){if(_ instanceof DOMException&&_.name==="DataCloneError")throw _;r.location.assign(S)}i&&l&&l({action:a,location:g.location,delta:1})}function p(b,y){a=as.Replace;let m=Ed(g.location,b,y);c=d();let v=$p(m,c),S=g.createHref(m);o.replaceState(v,"",S),i&&l&&l({action:a,location:g.location,delta:0})}function x(b){let y=r.location.origin!=="null"?r.location.origin:r.location.href,m=typeof b=="string"?b:Ll(b);return m=m.replace(/ $/,"%20"),je(y,"No window.location.(origin|href) available to create URL for href: "+m),new URL(m,y)}let g={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(Bp,f),l=b,()=>{r.removeEventListener(Bp,f),l=null}},createHref(b){return e(r,b)},createURL:x,encodeLocation(b){let y=x(b);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:h,replace:p,go(b){return o.go(b)}};return g}var Up;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Up||(Up={}));function rS(t,e,n){return n===void 0&&(n="/"),iS(t,e,n)}function iS(t,e,n,s){let r=typeof e=="string"?vi(e):e,i=pi(r.pathname||"/",n);if(i==null)return null;let o=ny(t);oS(o);let a=null,l=xS(i);for(let c=0;a==null&&c<o.length;++c)a=gS(o[c],l);return a}function ny(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("/")&&(je(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=bs([s,l.relativePath]),d=n.concat(l);i.children&&i.children.length>0&&(je(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),ny(i.children,e,d,c)),!(i.path==null&&!i.index)&&e.push({path:c,score:hS(c,i.index),routesMeta:d})};return t.forEach((i,o)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))r(i,o);else for(let l of sy(i.path))r(i,o,l)}),e}function sy(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=sy(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 oS(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:pS(e.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const aS=/^:[\w-]+$/,lS=3,cS=2,uS=1,dS=10,fS=-2,Wp=t=>t==="*";function hS(t,e){let n=t.split("/"),s=n.length;return n.some(Wp)&&(s+=fS),e&&(s+=cS),n.filter(r=>!Wp(r)).reduce((r,i)=>r+(aS.test(i)?lS:i===""?uS:dS),s)}function pS(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 gS(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,d=i==="/"?e:e.slice(i.length)||"/",f=Md({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},d),h=l.route;if(!f)return null;Object.assign(r,f.params),o.push({params:r,pathname:bs([i,f.pathname]),pathnameBase:bS(bs([i,f.pathnameBase])),route:h}),f.pathnameBase!=="/"&&(i=bs([i,f.pathnameBase]))}return o}function Md(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,s]=mS(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,d,f)=>{let{paramName:h,isOptional:p}=d;if(h==="*"){let g=a[f]||"";o=i.slice(0,i.length-g.length).replace(/(.)\/+$/,"$1")}const x=a[f];return p&&!x?c[h]=void 0:c[h]=(x||"").replace(/%2F/g,"/"),c},{}),pathname:i,pathnameBase:o,pattern:t}}function mS(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),ty(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 xS(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return ty(!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 pi(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 yS(t,e){e===void 0&&(e="/");let{pathname:n,search:s="",hash:r=""}=typeof t=="string"?vi(t):t,i;return n?(n=oy(n),n.startsWith("/")?i=Hp(n.substring(1),"/"):i=Hp(n,e)):i=e,{pathname:i,search:wS(s),hash:SS(r)}}function Hp(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 ou(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 vS(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function ry(t,e){let n=vS(t);return e?n.map((s,r)=>r===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function iy(t,e,n,s){s===void 0&&(s=!1);let r;typeof t=="string"?r=vi(t):(r=Ao({},t),je(!r.pathname||!r.pathname.includes("?"),ou("?","pathname","search",r)),je(!r.pathname||!r.pathname.includes("#"),ou("#","pathname","hash",r)),je(!r.search||!r.search.includes("#"),ou("#","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=yS(r,a),c=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}const oy=t=>t.replace(/\/\/+/g,"/"),bs=t=>oy(t.join("/")),bS=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),wS=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,SS=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function _S(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const ay=["post","put","patch","delete"];new Set(ay);const kS=["get",...ay];new Set(kS);/**
50
50
  * React Router v6.30.6
51
51
  *
52
52
  * Copyright (c) Remix Software Inc.
@@ -55,7 +55,7 @@ Error generating stack: `+i.message+`
55
55
  * LICENSE.md file in the root directory of this source tree.
56
56
  *
57
57
  * @license MIT
58
- */function Ao(){return Ao=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},Ao.apply(null,arguments)}const mc=w.createContext(null),ly=w.createContext(null),Os=w.createContext(null),xc=w.createContext(null),hr=w.createContext({outlet:null,matches:[],isDataRoute:!1}),cy=w.createContext(null);function jS(t,e){let{relative:n}=e===void 0?{}:e;ea()||je(!1);let{basename:s,navigator:r}=w.useContext(Os),{hash:i,pathname:o,search:a}=yc(t,{relative:n}),l=o;return s!=="/"&&(l=o==="/"?s:bs([s,o])),r.createHref({pathname:l,search:a,hash:i})}function ea(){return w.useContext(xc)!=null}function Ds(){return ea()||je(!1),w.useContext(xc).location}function uy(t){w.useContext(Os).static||w.useLayoutEffect(t)}function ta(){let{isDataRoute:t}=w.useContext(hr);return t?zS():NS()}function NS(){ea()||je(!1);let t=w.useContext(mc),{basename:e,future:n,navigator:s}=w.useContext(Os),{matches:r}=w.useContext(hr),{pathname:i}=Ds(),o=JSON.stringify(ry(r,n.v7_relativeSplatPath)),a=w.useRef(!1);return uy(()=>{a.current=!0}),w.useCallback(function(c,d){if(d===void 0&&(d={}),!a.current)return;if(typeof c=="number"){s.go(c);return}let f=iy(c,JSON.parse(o),i,d.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:bs([e,f.pathname])),(d.replace?s.replace:s.push)(f,d.state,d)},[e,s,o,i,t])}function yc(t,e){let{relative:n}=e===void 0?{}:e,{future:s}=w.useContext(Os),{matches:r}=w.useContext(hr),{pathname:i}=Ds(),o=JSON.stringify(ry(r,s.v7_relativeSplatPath));return w.useMemo(()=>iy(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function ES(t,e){return MS(t,e)}function MS(t,e,n,s){ea()||je(!1);let{navigator:r}=w.useContext(Os),{matches:i}=w.useContext(hr),o=i[i.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let c=Ds(),d;if(e){var f;let b=typeof e=="string"?vi(e):e;l==="/"||(f=b.pathname)!=null&&f.startsWith(l)||je(!1),d=b}else d=c;let h=d.pathname||"/",p=h;if(l!=="/"){let b=l.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(b.length).join("/")}let x=iS(t,{pathname:p}),g=TS(x&&x.map(b=>Object.assign({},b,{params:Object.assign({},a,b.params),pathname:bs([l,r.encodeLocation?r.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?l:bs([l,r.encodeLocation?r.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),i,n,s);return e&&g?w.createElement(xc.Provider,{value:{location:Ao({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:as.Pop}},g):g}function PS(){let t=FS(),e=kS(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 RS=w.createElement(PS,null);class OS 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(hr.Provider,{value:this.props.routeContext},w.createElement(cy.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function DS(t){let{routeContext:e,match:n,children:s}=t,r=w.useContext(mc);return r&&r.static&&r.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=n.route.id),w.createElement(hr.Provider,{value:e},s)}function TS(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 d=o.findIndex(f=>f.route.id&&(a==null?void 0:a[f.route.id])!==void 0);d>=0||je(!1),o=o.slice(0,Math.min(o.length,d+1))}let l=!1,c=-1;if(n&&s&&s.v7_partialHydration)for(let d=0;d<o.length;d++){let f=o[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(c=d),f.route.id){let{loaderData:h,errors:p}=n,x=f.route.loader&&h[f.route.id]===void 0&&(!p||p[f.route.id]===void 0);if(f.route.lazy||x){l=!0,c>=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((d,f,h)=>{let p,x=!1,g=null,b=null;n&&(p=a&&f.route.id?a[f.route.id]:void 0,g=f.route.errorElement||RS,l&&(c<0&&h===0?(BS("route-fallback"),x=!0,b=null):c===h&&(x=!0,b=f.route.hydrateFallbackElement||null)));let y=e.concat(o.slice(0,h+1)),m=()=>{let v;return p?v=g:x?v=b:f.route.Component?v=w.createElement(f.route.Component,null):f.route.element?v=f.route.element:v=d,w.createElement(DS,{match:f,routeContext:{outlet:d,matches:y,isDataRoute:n!=null},children:v})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?w.createElement(OS,{location:n.location,revalidation:n.revalidation,component:g,error:p,children:m(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):m()},null)}var dy=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(dy||{}),fy=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}(fy||{});function LS(t){let e=w.useContext(mc);return e||je(!1),e}function AS(t){let e=w.useContext(ly);return e||je(!1),e}function IS(t){let e=w.useContext(hr);return e||je(!1),e}function hy(t){let e=IS(),n=e.matches[e.matches.length-1];return n.route.id||je(!1),n.route.id}function FS(){var t;let e=w.useContext(cy),n=AS(),s=hy();return e!==void 0?e:(t=n.errors)==null?void 0:t[s]}function zS(){let{router:t}=LS(dy.UseNavigateStable),e=hy(fy.UseNavigateStable),n=w.useRef(!1);return uy(()=>{n.current=!0}),w.useCallback(function(r,i){i===void 0&&(i={}),n.current&&(typeof r=="number"?t.navigate(r):t.navigate(r,Ao({fromRouteId:e},i)))},[t,e])}const Vp={};function BS(t,e,n){Vp[t]||(Vp[t]=!0)}function $S(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Et(t){je(!1)}function US(t){let{basename:e="/",children:n=null,location:s,navigationType:r=as.Pop,navigator:i,static:o=!1,future:a}=t;ea()&&je(!1);let l=e.replace(/^\/*/,"/"),c=w.useMemo(()=>({basename:l,navigator:i,static:o,future:Ao({v7_relativeSplatPath:!1},a)}),[l,a,i,o]);typeof s=="string"&&(s=vi(s));let{pathname:d="/",search:f="",hash:h="",state:p=null,key:x="default"}=s,g=w.useMemo(()=>{let b=pi(d,l);return b==null?null:{location:{pathname:b,search:f,hash:h,state:p,key:x},navigationType:r}},[l,d,f,h,p,x,r]);return g==null?null:w.createElement(Os.Provider,{value:c},w.createElement(xc.Provider,{children:n,value:g}))}function WS(t){let{children:e,location:n}=t;return ES(Pd(e),n)}new Promise(()=>{});function Pd(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,Pd(s.props.children,i));return}s.type!==Et&&je(!1),!s.props.index||!s.props.children||je(!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=Pd(s.props.children,i)),n.push(o)}),n}/**
58
+ */function Io(){return Io=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},Io.apply(null,arguments)}const xc=w.createContext(null),ly=w.createContext(null),Os=w.createContext(null),yc=w.createContext(null),hr=w.createContext({outlet:null,matches:[],isDataRoute:!1}),cy=w.createContext(null);function CS(t,e){let{relative:n}=e===void 0?{}:e;ta()||je(!1);let{basename:s,navigator:r}=w.useContext(Os),{hash:i,pathname:o,search:a}=vc(t,{relative:n}),l=o;return s!=="/"&&(l=o==="/"?s:bs([s,o])),r.createHref({pathname:l,search:a,hash:i})}function ta(){return w.useContext(yc)!=null}function Ts(){return ta()||je(!1),w.useContext(yc).location}function uy(t){w.useContext(Os).static||w.useLayoutEffect(t)}function bi(){let{isDataRoute:t}=w.useContext(hr);return t?FS():jS()}function jS(){ta()||je(!1);let t=w.useContext(xc),{basename:e,future:n,navigator:s}=w.useContext(Os),{matches:r}=w.useContext(hr),{pathname:i}=Ts(),o=JSON.stringify(ry(r,n.v7_relativeSplatPath)),a=w.useRef(!1);return uy(()=>{a.current=!0}),w.useCallback(function(c,d){if(d===void 0&&(d={}),!a.current)return;if(typeof c=="number"){s.go(c);return}let f=iy(c,JSON.parse(o),i,d.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:bs([e,f.pathname])),(d.replace?s.replace:s.push)(f,d.state,d)},[e,s,o,i,t])}function vc(t,e){let{relative:n}=e===void 0?{}:e,{future:s}=w.useContext(Os),{matches:r}=w.useContext(hr),{pathname:i}=Ts(),o=JSON.stringify(ry(r,s.v7_relativeSplatPath));return w.useMemo(()=>iy(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function NS(t,e){return ES(t,e)}function ES(t,e,n,s){ta()||je(!1);let{navigator:r}=w.useContext(Os),{matches:i}=w.useContext(hr),o=i[i.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let c=Ts(),d;if(e){var f;let b=typeof e=="string"?vi(e):e;l==="/"||(f=b.pathname)!=null&&f.startsWith(l)||je(!1),d=b}else d=c;let h=d.pathname||"/",p=h;if(l!=="/"){let b=l.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(b.length).join("/")}let x=rS(t,{pathname:p}),g=TS(x&&x.map(b=>Object.assign({},b,{params:Object.assign({},a,b.params),pathname:bs([l,r.encodeLocation?r.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?l:bs([l,r.encodeLocation?r.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),i,n,s);return e&&g?w.createElement(yc.Provider,{value:{location:Io({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:as.Pop}},g):g}function MS(){let t=IS(),e=_S(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 PS=w.createElement(MS,null);class RS 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(hr.Provider,{value:this.props.routeContext},w.createElement(cy.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function OS(t){let{routeContext:e,match:n,children:s}=t,r=w.useContext(xc);return r&&r.static&&r.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=n.route.id),w.createElement(hr.Provider,{value:e},s)}function TS(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 d=o.findIndex(f=>f.route.id&&(a==null?void 0:a[f.route.id])!==void 0);d>=0||je(!1),o=o.slice(0,Math.min(o.length,d+1))}let l=!1,c=-1;if(n&&s&&s.v7_partialHydration)for(let d=0;d<o.length;d++){let f=o[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(c=d),f.route.id){let{loaderData:h,errors:p}=n,x=f.route.loader&&h[f.route.id]===void 0&&(!p||p[f.route.id]===void 0);if(f.route.lazy||x){l=!0,c>=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((d,f,h)=>{let p,x=!1,g=null,b=null;n&&(p=a&&f.route.id?a[f.route.id]:void 0,g=f.route.errorElement||PS,l&&(c<0&&h===0?(zS("route-fallback"),x=!0,b=null):c===h&&(x=!0,b=f.route.hydrateFallbackElement||null)));let y=e.concat(o.slice(0,h+1)),m=()=>{let v;return p?v=g:x?v=b:f.route.Component?v=w.createElement(f.route.Component,null):f.route.element?v=f.route.element:v=d,w.createElement(OS,{match:f,routeContext:{outlet:d,matches:y,isDataRoute:n!=null},children:v})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?w.createElement(RS,{location:n.location,revalidation:n.revalidation,component:g,error:p,children:m(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):m()},null)}var dy=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(dy||{}),fy=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}(fy||{});function DS(t){let e=w.useContext(xc);return e||je(!1),e}function LS(t){let e=w.useContext(ly);return e||je(!1),e}function AS(t){let e=w.useContext(hr);return e||je(!1),e}function hy(t){let e=AS(),n=e.matches[e.matches.length-1];return n.route.id||je(!1),n.route.id}function IS(){var t;let e=w.useContext(cy),n=LS(),s=hy();return e!==void 0?e:(t=n.errors)==null?void 0:t[s]}function FS(){let{router:t}=DS(dy.UseNavigateStable),e=hy(fy.UseNavigateStable),n=w.useRef(!1);return uy(()=>{n.current=!0}),w.useCallback(function(r,i){i===void 0&&(i={}),n.current&&(typeof r=="number"?t.navigate(r):t.navigate(r,Io({fromRouteId:e},i)))},[t,e])}const Vp={};function zS(t,e,n){Vp[t]||(Vp[t]=!0)}function BS(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function yt(t){je(!1)}function $S(t){let{basename:e="/",children:n=null,location:s,navigationType:r=as.Pop,navigator:i,static:o=!1,future:a}=t;ta()&&je(!1);let l=e.replace(/^\/*/,"/"),c=w.useMemo(()=>({basename:l,navigator:i,static:o,future:Io({v7_relativeSplatPath:!1},a)}),[l,a,i,o]);typeof s=="string"&&(s=vi(s));let{pathname:d="/",search:f="",hash:h="",state:p=null,key:x="default"}=s,g=w.useMemo(()=>{let b=pi(d,l);return b==null?null:{location:{pathname:b,search:f,hash:h,state:p,key:x},navigationType:r}},[l,d,f,h,p,x,r]);return g==null?null:w.createElement(Os.Provider,{value:c},w.createElement(yc.Provider,{children:n,value:g}))}function US(t){let{children:e,location:n}=t;return NS(Pd(e),n)}new Promise(()=>{});function Pd(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,Pd(s.props.children,i));return}s.type!==yt&&je(!1),!s.props.index||!s.props.children||je(!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=Pd(s.props.children,i)),n.push(o)}),n}/**
59
59
  * React Router DOM v6.30.6
60
60
  *
61
61
  * Copyright (c) Remix Software Inc.
@@ -64,27 +64,27 @@ Error generating stack: `+i.message+`
64
64
  * LICENSE.md file in the root directory of this source tree.
65
65
  *
66
66
  * @license MIT
67
- */function Ll(){return Ll=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},Ll.apply(null,arguments)}function py(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 HS(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function VS(t,e){return t.button===0&&(!e||e==="_self")&&!HS(t)}function Rd(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 QS(t,e){let n=Rd(t);return e&&e.forEach((s,r)=>{n.has(r)||e.getAll(r).forEach(i=>{n.append(r,i)})}),n}const KS=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],YS=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],XS="6";try{window.__reactRouterVersion=XS}catch{}const qS=w.createContext({isTransitioning:!1}),GS="startTransition",Qp=ob[GS];function JS(t){let{basename:e,children:n,future:s,window:r}=t,i=w.useRef();i.current==null&&(i.current=nS({window:r,v5Compat:!0}));let o=i.current,[a,l]=w.useState({action:o.action,location:o.location}),{v7_startTransition:c}=s||{},d=w.useCallback(f=>{c&&Qp?Qp(()=>l(f)):l(f)},[l,c]);return w.useLayoutEffect(()=>o.listen(d),[o,d]),w.useEffect(()=>$S(s),[s]),w.createElement(US,{basename:e,children:n,location:a.location,navigationType:a.action,navigator:o,future:s})}const ZS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",e_=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,t_=w.forwardRef(function(e,n){let{onClick:s,relative:r,reloadDocument:i,replace:o,state:a,target:l,to:c,preventScrollReset:d,viewTransition:f}=e,h=py(e,KS),{basename:p}=w.useContext(Os),x,g=!1;if(typeof c=="string"&&e_.test(c)&&(x=c,ZS))try{let v=new URL(window.location.href),S=c.startsWith("//")?new URL(v.protocol+c):new URL(c),_=pi(S.pathname,p);S.origin===v.origin&&_!=null?c=_+S.search+S.hash:g=!0}catch{}let b=jS(c,{relative:r}),y=s_(c,{replace:o,state:a,target:l,preventScrollReset:d,relative:r,viewTransition:f});function m(v){s&&s(v),v.defaultPrevented||y(v)}return w.createElement("a",Ll({},h,{href:x||b,onClick:g||i?s:m,ref:n,target:l}))}),gy=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:d}=e,f=py(e,YS),h=yc(l,{relative:f.relative}),p=Ds(),x=w.useContext(ly),{navigator:g,basename:b}=w.useContext(Os),y=x!=null&&r_(h)&&c===!0,m=g.encodeLocation?g.encodeLocation(h).pathname:h.pathname,v=p.pathname,S=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;r||(v=v.toLowerCase(),S=S?S.toLowerCase():null,m=m.toLowerCase()),S&&b&&(S=pi(S,b)||S);const _=m!=="/"&&m.endsWith("/")?m.length-1:m.length;let k=v===m||!o&&v.startsWith(m)&&v.charAt(_)==="/",C=S!=null&&(S===m||!o&&S.startsWith(m)&&S.charAt(m.length)==="/"),N={isActive:k,isPending:C,isTransitioning:y},P=k?s:void 0,M;typeof i=="function"?M=i(N):M=[i,k?"active":null,C?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let O=typeof a=="function"?a(N):a;return w.createElement(t_,Ll({},f,{"aria-current":P,className:M,ref:n,style:O,to:l,viewTransition:c}),typeof d=="function"?d(N):d)});var Od;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Od||(Od={}));var Kp;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Kp||(Kp={}));function n_(t){let e=w.useContext(mc);return e||je(!1),e}function s_(t,e){let{target:n,replace:s,state:r,preventScrollReset:i,relative:o,viewTransition:a}=e===void 0?{}:e,l=ta(),c=Ds(),d=yc(t,{relative:o});return w.useCallback(f=>{if(VS(f,n)){f.preventDefault();let h=s!==void 0?s:Tl(c)===Tl(d);l(t,{replace:h,state:r,preventScrollReset:i,relative:o,viewTransition:a})}},[c,l,d,s,r,n,t,i,o,a])}function my(t){let e=w.useRef(Rd(t)),n=w.useRef(!1),s=Ds(),r=w.useMemo(()=>QS(s.search,n.current?null:e.current),[s.search]),i=ta(),o=w.useCallback((a,l)=>{const c=Rd(typeof a=="function"?a(r):a);n.current=!0,i("?"+c,l)},[i,r]);return[r,o]}function r_(t,e){e===void 0&&(e={});let n=w.useContext(qS);n==null&&je(!1);let{basename:s}=n_(Od.useViewTransitionState),r=yc(t,{relative:e.relative});if(!n.isTransitioning)return!1;let i=pi(n.currentLocation.pathname,s)||n.currentLocation.pathname,o=pi(n.nextLocation.pathname,s)||n.nextLocation.pathname;return Md(r.pathname,o)!=null||Md(r.pathname,i)!=null}const i_="/api";class o_ extends Error{constructor(n,s){super(s);$(this,"status");this.status=n,this.name="ApiError"}}async function Y(t,e={}){const n=await fetch(i_+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 o_(n.status,s)}if(n.status!==204)return n.json()}const Pe=t=>({method:"POST",body:JSON.stringify(t)}),W={health:()=>Y("/health"),doctor:()=>Y("/doctor"),shutdown:()=>Y("/shutdown",Pe({})),metricas:()=>Y("/metrics"),leads:{listar:()=>Y("/leads"),criar:t=>Y("/leads",Pe(t)),atualizar:(t,e)=>Y(`/leads/${t}`,{method:"PATCH",body:JSON.stringify(e)}),remover:t=>Y(`/leads/${t}`,{method:"DELETE"}),importar:t=>Y("/leads/import",Pe({leads:t})),enriquecer:t=>Y(`/leads/${t}/enrich`,Pe({}))},crm:{leadsListar:()=>Y("/crm/leads"),criarLead:t=>Y("/crm/leads",Pe(t)),moverLead:(t,e)=>Y(`/crm/leads/${t}/etapa`,{method:"PUT",body:JSON.stringify({etapa:e})}),sugestoes:()=>Y("/crm/sugestoes"),aplicar:(t,e)=>Y("/crm/sugestoes/aplicar",Pe({lead_id:t,para:e}))},campanhas:{listar:()=>Y("/campaigns"),criar:t=>Y("/campaigns",Pe(t)),iniciar:t=>Y(`/campaigns/${t}/start`,Pe({})),pausar:t=>Y(`/campaigns/${t}/pause`,Pe({})),parar:t=>Y(`/campaigns/${t}/stop`,Pe({})),remover:t=>Y(`/campaigns/${t}`,{method:"DELETE"})},extrair:{maps:t=>Y("/extractors/maps",Pe(t)),instagram:(t,e)=>Y("/extractors/instagram",Pe({profile_url:t,limit:e})),cnpj:t=>Y("/extract/cnpj",Pe({cnpj:t})),cnpjBusca:t=>Y("/extract/cnpj/search",Pe(t))},config:{obter:()=>Y("/config"),salvar:t=>Y("/config",{method:"PUT",body:JSON.stringify(t)}),testarLlm:()=>Y("/config/test/llm",Pe({})),testarIntegracao:t=>Y("/config/test/integracao",Pe({url:t}))},integracoes:()=>Y("/integrations/status"),agentes:{templates:()=>Y("/agents/templates"),salvarTemplates:t=>Y("/agents/templates",{method:"PUT",body:JSON.stringify(t)}),testarTemplate:(t,e)=>Y("/agents/templates/test",Pe({template:t,lead_id:e})),chat:t=>Y("/agents/attendance/chat",Pe({mensagens:t}))},webhook:{obter:()=>Y("/webhook"),salvar:t=>Y("/webhook",{method:"PUT",body:JSON.stringify(t)}),testar:t=>Y("/webhook/test",Pe({url:t}))}};function H(...t){return t.filter(Boolean).join(" ")}function a_(t){return(t||"?").trim().charAt(0).toUpperCase()||"?"}function Al(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 na(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 l_(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 c_(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 u_(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 d_(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 f_={md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl"};function Xt({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?u.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:u.jsxs("div",{className:H("bg-white rounded-2xl shadow-xl w-full",f_[i]),children:[u.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100",children:[u.jsxs("h3",{className:"text-base font-semibold text-gray-800 flex items-center gap-2",children:[u.jsx("i",{className:H(r,"text-indigo-500")})," ",n]}),u.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600","aria-label":"Fechar",children:u.jsx("i",{className:"fas fa-times"})})]}),u.jsx("div",{className:"px-6 py-5 max-h-[70vh] overflow-y-auto",children:s})]})}):null}const h_=[{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 p_({titulo:t,nomeUsuario:e}){const[n,s]=w.useState(!1);return u.jsxs("header",{className:"bg-white shadow-sm px-8 py-4 flex items-center justify-between shrink-0",children:[u.jsx("div",{children:u.jsx("h2",{className:"text-lg font-semibold text-gray-800",children:t})}),u.jsxs("div",{className:"flex items-center space-x-4",children:[u.jsxs("button",{onClick:()=>s(!0),className:"text-sm text-indigo-600 hover:text-indigo-800 font-medium",children:[u.jsx("i",{className:"fas fa-play-circle mr-1"})," Ver tutorial"]}),u.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:a_(e)}),u.jsx("span",{className:"text-sm font-medium text-gray-700",children:e})]}),u.jsxs(Xt,{aberto:n,onFechar:()=>s(!1),titulo:"Tutorial rápido",icone:"fas fa-graduation-cap",children:[u.jsx("ol",{className:"space-y-4",children:h_.map((r,i)=>u.jsxs("li",{className:"flex gap-3 items-start",children:[u.jsx("span",{className:"w-8 h-8 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center shrink-0",children:u.jsx("i",{className:r.icone})}),u.jsx("p",{className:"text-sm text-gray-600 pt-1.5",children:r.texto})]},i))}),u.jsx("p",{className:"text-xs text-gray-400 mt-5",children:"Dica: o LLM (para enriquecimento e agentes) é configurado em Ferramentas."})]})]})}const g_=[{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:"/extrator-maps",icone:"fas fa-map-marked-alt",rotulo:"Extrator Maps"},{para:"/extrator-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 m_({onSair:t}){const e=Ds(),[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 u.jsxs("aside",{className:"w-64 bg-[#1e1b4b] text-white flex flex-col shrink-0 h-screen sticky top-0",children:[u.jsx("div",{className:"p-6 border-b border-gray-700",children:u.jsxs("h1",{className:"text-2xl font-bold tracking-tight flex items-center gap-2",children:[u.jsx("span",{className:"text-2xl",children:"⚡"}),"LeadMaster"]})}),u.jsx("nav",{className:"flex-1 overflow-y-auto py-4",children:u.jsx("ul",{className:"space-y-1",children:g_.map((i,o)=>u.jsx("li",{children:u.jsxs("ul",{children:[i.secao&&u.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"?u.jsxs("li",{children:[u.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:[u.jsx("i",{className:H(a.icone,"w-5 text-gray-400")}),u.jsx("span",{className:"ml-3",children:a.rotulo}),u.jsx("i",{className:H("fas fa-chevron-down ml-auto text-xs text-gray-400 transition-transform",n&&"rotate-180")})]}),n&&u.jsxs("ul",{className:"pl-12 space-y-1 mt-1",children:[u.jsx("li",{children:u.jsx(Yp,{para:"/agentes?tab=disparo",rotulo:"Agente de Disparo",ativo:e.pathname==="/agentes"&&e.search.includes("disparo")})}),u.jsx("li",{children:u.jsx(Yp,{para:"/agentes?tab=atendimento",rotulo:"Agente de Atendimento",ativo:e.pathname==="/agentes"&&e.search.includes("atendimento")})})]})]},"agentes"):u.jsx("li",{children:u.jsxs(gy,{to:a.para,className:H("sidebar-link flex items-center px-6 py-2.5 text-sm",r(a)&&"active"),children:[u.jsx("i",{className:H(a.icone,"w-5 text-gray-400")}),u.jsx("span",{className:"ml-3",children:a.rotulo})]})},a.para))]})},o))})}),u.jsx("div",{className:"p-4 border-t border-gray-700",children:u.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:[u.jsx("i",{className:"fas fa-sign-out-alt mr-2"})," Sair"]})})]})}function Yp({para:t,rotulo:e,ativo:n}){return u.jsx(gy,{to:t,className:H("sidebar-link block px-4 py-2 text-xs text-gray-300 rounded",n&&"active"),children:e})}const xy=w.createContext({toast:()=>{}});function en(){return w.useContext(xy)}const x_={sucesso:"bg-green-600",erro:"bg-red-600",info:"bg-indigo-600"},y_={sucesso:"fas fa-check-circle",erro:"fas fa-exclamation-circle",info:"fas fa-info-circle"};function v_({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 u.jsxs(xy.Provider,{value:{toast:r},children:[t,u.jsx("div",{className:"fixed top-4 right-4 z-[100] space-y-2 w-80",children:e.map(i=>u.jsxs("div",{className:H(x_[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:[u.jsx("i",{className:H(y_[i.tipo],"mt-0.5")}),u.jsx("span",{className:"flex-1",children:i.mensagem}),u.jsx("button",{className:"opacity-70 hover:opacity-100",onClick:()=>n(o=>o.filter(a=>a.id!==i.id)),"aria-label":"Fechar",children:u.jsx("i",{className:"fas fa-times"})})]},i.id))})]})}function Ma({rotulo:t,valor:e,subtitulo:n,children:s,icone:r}){return u.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-5 border border-gray-100",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("p",{className:"text-sm text-gray-500 font-medium",children:t}),r&&u.jsx("i",{className:`${r} text-indigo-300`})]}),s??u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"text-2xl font-bold text-gray-800 mt-1",children:e}),n&&u.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:n})]})]})}/*!
67
+ */function Al(){return Al=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},Al.apply(null,arguments)}function py(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 WS(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function HS(t,e){return t.button===0&&(!e||e==="_self")&&!WS(t)}function Rd(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 VS(t,e){let n=Rd(t);return e&&e.forEach((s,r)=>{n.has(r)||e.getAll(r).forEach(i=>{n.append(r,i)})}),n}const QS=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],KS=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],YS="6";try{window.__reactRouterVersion=YS}catch{}const XS=w.createContext({isTransitioning:!1}),qS="startTransition",Qp=ib[qS];function GS(t){let{basename:e,children:n,future:s,window:r}=t,i=w.useRef();i.current==null&&(i.current=tS({window:r,v5Compat:!0}));let o=i.current,[a,l]=w.useState({action:o.action,location:o.location}),{v7_startTransition:c}=s||{},d=w.useCallback(f=>{c&&Qp?Qp(()=>l(f)):l(f)},[l,c]);return w.useLayoutEffect(()=>o.listen(d),[o,d]),w.useEffect(()=>BS(s),[s]),w.createElement($S,{basename:e,children:n,location:a.location,navigationType:a.action,navigator:o,future:s})}const JS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ZS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,e_=w.forwardRef(function(e,n){let{onClick:s,relative:r,reloadDocument:i,replace:o,state:a,target:l,to:c,preventScrollReset:d,viewTransition:f}=e,h=py(e,QS),{basename:p}=w.useContext(Os),x,g=!1;if(typeof c=="string"&&ZS.test(c)&&(x=c,JS))try{let v=new URL(window.location.href),S=c.startsWith("//")?new URL(v.protocol+c):new URL(c),_=pi(S.pathname,p);S.origin===v.origin&&_!=null?c=_+S.search+S.hash:g=!0}catch{}let b=CS(c,{relative:r}),y=n_(c,{replace:o,state:a,target:l,preventScrollReset:d,relative:r,viewTransition:f});function m(v){s&&s(v),v.defaultPrevented||y(v)}return w.createElement("a",Al({},h,{href:x||b,onClick:g||i?s:m,ref:n,target:l}))}),gy=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:d}=e,f=py(e,KS),h=vc(l,{relative:f.relative}),p=Ts(),x=w.useContext(ly),{navigator:g,basename:b}=w.useContext(Os),y=x!=null&&r_(h)&&c===!0,m=g.encodeLocation?g.encodeLocation(h).pathname:h.pathname,v=p.pathname,S=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;r||(v=v.toLowerCase(),S=S?S.toLowerCase():null,m=m.toLowerCase()),S&&b&&(S=pi(S,b)||S);const _=m!=="/"&&m.endsWith("/")?m.length-1:m.length;let k=v===m||!o&&v.startsWith(m)&&v.charAt(_)==="/",C=S!=null&&(S===m||!o&&S.startsWith(m)&&S.charAt(m.length)==="/"),j={isActive:k,isPending:C,isTransitioning:y},P=k?s:void 0,E;typeof i=="function"?E=i(j):E=[i,k?"active":null,C?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let R=typeof a=="function"?a(j):a;return w.createElement(e_,Al({},f,{"aria-current":P,className:E,ref:n,style:R,to:l,viewTransition:c}),typeof d=="function"?d(j):d)});var Od;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Od||(Od={}));var Kp;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Kp||(Kp={}));function t_(t){let e=w.useContext(xc);return e||je(!1),e}function n_(t,e){let{target:n,replace:s,state:r,preventScrollReset:i,relative:o,viewTransition:a}=e===void 0?{}:e,l=bi(),c=Ts(),d=vc(t,{relative:o});return w.useCallback(f=>{if(HS(f,n)){f.preventDefault();let h=s!==void 0?s:Ll(c)===Ll(d);l(t,{replace:h,state:r,preventScrollReset:i,relative:o,viewTransition:a})}},[c,l,d,s,r,n,t,i,o,a])}function s_(t){let e=w.useRef(Rd(t)),n=w.useRef(!1),s=Ts(),r=w.useMemo(()=>VS(s.search,n.current?null:e.current),[s.search]),i=bi(),o=w.useCallback((a,l)=>{const c=Rd(typeof a=="function"?a(r):a);n.current=!0,i("?"+c,l)},[i,r]);return[r,o]}function r_(t,e){e===void 0&&(e={});let n=w.useContext(XS);n==null&&je(!1);let{basename:s}=t_(Od.useViewTransitionState),r=vc(t,{relative:e.relative});if(!n.isTransitioning)return!1;let i=pi(n.currentLocation.pathname,s)||n.currentLocation.pathname,o=pi(n.nextLocation.pathname,s)||n.nextLocation.pathname;return Md(r.pathname,o)!=null||Md(r.pathname,i)!=null}const i_="/api";class o_ extends Error{constructor(n,s){super(s);$(this,"status");this.status=n,this.name="ApiError"}}async function Y(t,e={}){const n=await fetch(i_+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 o_(n.status,s)}if(n.status!==204)return n.json()}const Me=t=>({method:"POST",body:JSON.stringify(t)}),W={health:()=>Y("/health"),doctor:()=>Y("/doctor"),shutdown:()=>Y("/shutdown",Me({})),metricas:()=>Y("/metrics"),leads:{listar:()=>Y("/leads"),criar:t=>Y("/leads",Me(t)),atualizar:(t,e)=>Y(`/leads/${t}`,{method:"PATCH",body:JSON.stringify(e)}),remover:t=>Y(`/leads/${t}`,{method:"DELETE"}),importar:t=>Y("/leads/import",Me({leads:t})),enriquecer:t=>Y(`/leads/${t}/enrich`,Me({}))},crm:{leadsListar:()=>Y("/crm/leads"),criarLead:t=>Y("/crm/leads",Me(t)),moverLead:(t,e)=>Y(`/crm/leads/${t}/etapa`,{method:"PUT",body:JSON.stringify({etapa:e})}),sugestoes:()=>Y("/crm/sugestoes"),aplicar:(t,e)=>Y("/crm/sugestoes/aplicar",Me({lead_id:t,para:e}))},campanhas:{listar:()=>Y("/campaigns"),criar:t=>Y("/campaigns",Me(t)),iniciar:t=>Y(`/campaigns/${t}/start`,Me({})),pausar:t=>Y(`/campaigns/${t}/pause`,Me({})),parar:t=>Y(`/campaigns/${t}/stop`,Me({})),remover:t=>Y(`/campaigns/${t}`,{method:"DELETE"})},extrair:{maps:t=>Y("/extractors/maps",Me(t)),instagram:(t,e)=>Y("/extractors/instagram",Me({profile_url:t,limit:e})),cnpj:t=>Y("/extract/cnpj",Me({cnpj:t})),cnpjBusca:t=>Y("/extract/cnpj/search",Me(t)),cnpjExtract:t=>Y("/extractors/cnpj",Me(t))},config:{obter:()=>Y("/config"),salvar:t=>Y("/config",{method:"PUT",body:JSON.stringify(t)}),testarLlm:()=>Y("/config/test/llm",Me({})),testarIntegracao:t=>Y("/config/test/integracao",Me({url:t}))},integracoes:()=>Y("/integrations/status"),agentes:{templates:()=>Y("/agents/templates"),salvarTemplates:t=>Y("/agents/templates",{method:"PUT",body:JSON.stringify(t)}),testarTemplate:(t,e)=>Y("/agents/templates/test",Me({template:t,lead_id:e})),chat:t=>Y("/agents/attendance/chat",Me({mensagens:t}))},webhook:{obter:()=>Y("/webhook"),salvar:t=>Y("/webhook",{method:"PUT",body:JSON.stringify(t)}),testar:t=>Y("/webhook/test",Me({url:t}))}};function Q(...t){return t.filter(Boolean).join(" ")}function a_(t){return(t||"?").trim().charAt(0).toUpperCase()||"?"}function Il(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 na(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 l_(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 c_(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 u_(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 d_(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 f_={md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl"};function Xt({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?u.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:u.jsxs("div",{className:Q("bg-white rounded-2xl shadow-xl w-full",f_[i]),children:[u.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100",children:[u.jsxs("h3",{className:"text-base font-semibold text-gray-800 flex items-center gap-2",children:[u.jsx("i",{className:Q(r,"text-indigo-500")})," ",n]}),u.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600","aria-label":"Fechar",children:u.jsx("i",{className:"fas fa-times"})})]}),u.jsx("div",{className:"px-6 py-5 max-h-[70vh] overflow-y-auto",children:s})]})}):null}const h_=[{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 p_({titulo:t,nomeUsuario:e}){const[n,s]=w.useState(!1);return u.jsxs("header",{className:"bg-white shadow-sm px-8 py-4 flex items-center justify-between shrink-0",children:[u.jsx("div",{children:u.jsx("h2",{className:"text-lg font-semibold text-gray-800",children:t})}),u.jsxs("div",{className:"flex items-center space-x-4",children:[u.jsxs("button",{onClick:()=>s(!0),className:"text-sm text-indigo-600 hover:text-indigo-800 font-medium",children:[u.jsx("i",{className:"fas fa-play-circle mr-1"})," Ver tutorial"]}),u.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:a_(e)}),u.jsx("span",{className:"text-sm font-medium text-gray-700",children:e})]}),u.jsxs(Xt,{aberto:n,onFechar:()=>s(!1),titulo:"Tutorial rápido",icone:"fas fa-graduation-cap",children:[u.jsx("ol",{className:"space-y-4",children:h_.map((r,i)=>u.jsxs("li",{className:"flex gap-3 items-start",children:[u.jsx("span",{className:"w-8 h-8 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center shrink-0",children:u.jsx("i",{className:r.icone})}),u.jsx("p",{className:"text-sm text-gray-600 pt-1.5",children:r.texto})]},i))}),u.jsx("p",{className:"text-xs text-gray-400 mt-5",children:"Dica: o LLM (para enriquecimento e agentes) é configurado em Ferramentas."})]})]})}const g_=[{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:"/extrator-maps",icone:"fas fa-map-marked-alt",rotulo:"Extrator Maps"},{para:"/extrator-instagram",icone:"fab fa-instagram",rotulo:"Extrator Instagram"},{para:"/extrator-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 m_({onSair:t}){const e=Ts(),[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 u.jsxs("aside",{className:"w-64 bg-[#1e1b4b] text-white flex flex-col shrink-0 h-screen sticky top-0",children:[u.jsx("div",{className:"p-6 border-b border-gray-700",children:u.jsxs("h1",{className:"text-2xl font-bold tracking-tight flex items-center gap-2",children:[u.jsx("span",{className:"text-2xl",children:"⚡"}),"LeadMaster",u.jsxs("span",{className:"text-[10px] font-medium text-indigo-300 border border-indigo-400/40 rounded-md px-1.5 py-0.5",children:["v","0.1.14"]})]})}),u.jsx("nav",{className:"flex-1 overflow-y-auto py-4",children:u.jsx("ul",{className:"space-y-1",children:g_.map((i,o)=>u.jsx("li",{children:u.jsxs("ul",{children:[i.secao&&u.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"?u.jsxs("li",{children:[u.jsxs("button",{type:"button",onClick:()=>s(l=>!l),className:Q("sidebar-link w-full flex items-center px-6 py-2.5 text-sm",r(a)&&"active"),children:[u.jsx("i",{className:Q(a.icone,"w-5 text-gray-400")}),u.jsx("span",{className:"ml-3",children:a.rotulo}),u.jsx("i",{className:Q("fas fa-chevron-down ml-auto text-xs text-gray-400 transition-transform",n&&"rotate-180")})]}),n&&u.jsxs("ul",{className:"pl-12 space-y-1 mt-1",children:[u.jsx("li",{children:u.jsx(Yp,{para:"/agentes?tab=disparo",rotulo:"Agente de Disparo",ativo:e.pathname==="/agentes"&&e.search.includes("disparo")})}),u.jsx("li",{children:u.jsx(Yp,{para:"/agentes?tab=atendimento",rotulo:"Agente de Atendimento",ativo:e.pathname==="/agentes"&&e.search.includes("atendimento")})})]})]},"agentes"):u.jsx("li",{children:u.jsxs(gy,{to:a.para,className:Q("sidebar-link flex items-center px-6 py-2.5 text-sm",r(a)&&"active"),children:[u.jsx("i",{className:Q(a.icone,"w-5 text-gray-400")}),u.jsx("span",{className:"ml-3",children:a.rotulo})]})},a.para))]})},o))})}),u.jsx("div",{className:"p-4 border-t border-gray-700",children:u.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:[u.jsx("i",{className:"fas fa-sign-out-alt mr-2"})," Sair"]})})]})}function Yp({para:t,rotulo:e,ativo:n}){return u.jsx(gy,{to:t,className:Q("sidebar-link block px-4 py-2 text-xs text-gray-300 rounded",n&&"active"),children:e})}const my=w.createContext({toast:()=>{}});function en(){return w.useContext(my)}const x_={sucesso:"bg-green-600",erro:"bg-red-600",info:"bg-indigo-600"},y_={sucesso:"fas fa-check-circle",erro:"fas fa-exclamation-circle",info:"fas fa-info-circle"};function v_({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 u.jsxs(my.Provider,{value:{toast:r},children:[t,u.jsx("div",{className:"fixed top-4 right-4 z-[100] space-y-2 w-80",children:e.map(i=>u.jsxs("div",{className:Q(x_[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:[u.jsx("i",{className:Q(y_[i.tipo],"mt-0.5")}),u.jsx("span",{className:"flex-1",children:i.mensagem}),u.jsx("button",{className:"opacity-70 hover:opacity-100",onClick:()=>n(o=>o.filter(a=>a.id!==i.id)),"aria-label":"Fechar",children:u.jsx("i",{className:"fas fa-times"})})]},i.id))})]})}function Pa({rotulo:t,valor:e,subtitulo:n,children:s,icone:r}){return u.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-5 border border-gray-100",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("p",{className:"text-sm text-gray-500 font-medium",children:t}),r&&u.jsx("i",{className:`${r} text-indigo-300`})]}),s??u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"text-2xl font-bold text-gray-800 mt-1",children:e}),n&&u.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:n})]})]})}/*!
68
68
  * @kurkle/color v0.3.4
69
69
  * https://github.com/kurkle/color#readme
70
70
  * (c) 2024 Jukka Kurkela
71
71
  * Released under the MIT License
72
- */function sa(t){return t+.5|0}const ls=(t,e,n)=>Math.max(Math.min(t,n),e);function qi(t){return ls(sa(t*2.55),0,255)}function ws(t){return ls(sa(t*255),0,255)}function jn(t){return ls(sa(t/2.55)/100,0,1)}function Xp(t){return ls(sa(t*100),0,100)}const Nt={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},Dd=[..."0123456789ABCDEF"],b_=t=>Dd[t&15],w_=t=>Dd[(t&240)>>4]+Dd[t&15],Pa=t=>(t&240)>>4===(t&15),S_=t=>Pa(t.r)&&Pa(t.g)&&Pa(t.b)&&Pa(t.a);function __(t){var e=t.length,n;return t[0]==="#"&&(e===4||e===5?n={r:255&Nt[t[1]]*17,g:255&Nt[t[2]]*17,b:255&Nt[t[3]]*17,a:e===5?Nt[t[4]]*17:255}:(e===7||e===9)&&(n={r:Nt[t[1]]<<4|Nt[t[2]],g:Nt[t[3]]<<4|Nt[t[4]],b:Nt[t[5]]<<4|Nt[t[6]],a:e===9?Nt[t[7]]<<4|Nt[t[8]]:255})),n}const k_=(t,e)=>t<255?e(t):"";function C_(t){var e=S_(t)?b_:w_;return t?"#"+e(t.r)+e(t.g)+e(t.b)+k_(t.a,e):void 0}const j_=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function yy(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 N_(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 E_(t,e,n){const s=yy(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 M_(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 Vf(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,d;return i!==o&&(d=i-o,c=a>.5?d/(2-i-o):d/(i+o),l=M_(n,s,r,d,i),l=l*60+.5),[l|0,c||0,a]}function Qf(t,e,n,s){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,n,s)).map(ws)}function Kf(t,e,n){return Qf(yy,t,e,n)}function P_(t,e,n){return Qf(E_,t,e,n)}function R_(t,e,n){return Qf(N_,t,e,n)}function vy(t){return(t%360+360)%360}function O_(t){const e=j_.exec(t);let n=255,s;if(!e)return;e[5]!==s&&(n=e[6]?qi(+e[5]):ws(+e[5]));const r=vy(+e[2]),i=+e[3]/100,o=+e[4]/100;return e[1]==="hwb"?s=P_(r,i,o):e[1]==="hsv"?s=R_(r,i,o):s=Kf(r,i,o),{r:s[0],g:s[1],b:s[2],a:n}}function D_(t,e){var n=Vf(t);n[0]=vy(n[0]+e),n=Kf(n),t.r=n[0],t.g=n[1],t.b=n[2]}function T_(t){if(!t)return;const e=Vf(t),n=e[0],s=Xp(e[1]),r=Xp(e[2]);return t.a<255?`hsla(${n}, ${s}%, ${r}%, ${jn(t.a)})`:`hsl(${n}, ${s}%, ${r}%)`}const qp={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"},Gp={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 L_(){const t={},e=Object.keys(Gp),n=Object.keys(qp);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,qp[i]);i=parseInt(Gp[o],16),t[a]=[i>>16&255,i>>8&255,i&255]}return t}let Ra;function A_(t){Ra||(Ra=L_(),Ra.transparent=[0,0,0,0]);const e=Ra[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}const I_=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function F_(t){const e=I_.exec(t);let n=255,s,r,i;if(e){if(e[7]!==s){const o=+e[7];n=e[8]?qi(o):ls(o*255,0,255)}return s=+e[1],r=+e[3],i=+e[5],s=255&(e[2]?qi(s):ls(s,0,255)),r=255&(e[4]?qi(r):ls(r,0,255)),i=255&(e[6]?qi(i):ls(i,0,255)),{r:s,g:r,b:i,a:n}}}function z_(t){return t&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${jn(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`)}const au=t=>t<=.0031308?t*12.92:Math.pow(t,1/2.4)*1.055-.055,wr=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function B_(t,e,n){const s=wr(jn(t.r)),r=wr(jn(t.g)),i=wr(jn(t.b));return{r:ws(au(s+n*(wr(jn(e.r))-s))),g:ws(au(r+n*(wr(jn(e.g))-r))),b:ws(au(i+n*(wr(jn(e.b))-i))),a:t.a+n*(e.a-t.a)}}function Oa(t,e,n){if(t){let s=Vf(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*n,e===0?360:1)),s=Kf(s),t.r=s[0],t.g=s[1],t.b=s[2]}}function by(t,e){return t&&Object.assign(e||{},t)}function Jp(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=ws(t[3]))):(e=by(t,{r:0,g:0,b:0,a:1}),e.a=ws(e.a)),e}function $_(t){return t.charAt(0)==="r"?F_(t):O_(t)}class Io{constructor(e){if(e instanceof Io)return e;const n=typeof e;let s;n==="object"?s=Jp(e):n==="string"&&(s=__(e)||A_(e)||$_(e)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var e=by(this._rgb);return e&&(e.a=jn(e.a)),e}set rgb(e){this._rgb=Jp(e)}rgbString(){return this._valid?z_(this._rgb):void 0}hexString(){return this._valid?C_(this._rgb):void 0}hslString(){return this._valid?T_(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=B_(this._rgb,e._rgb,n)),this}clone(){return new Io(this.rgb)}alpha(e){return this._rgb.a=ws(e),this}clearer(e){const n=this._rgb;return n.a*=1-e,this}greyscale(){const e=this._rgb,n=sa(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 Oa(this._rgb,2,e),this}darken(e){return Oa(this._rgb,2,-e),this}saturate(e){return Oa(this._rgb,1,e),this}desaturate(e){return Oa(this._rgb,1,-e),this}rotate(e){return D_(this._rgb,e),this}}/*!
72
+ */function sa(t){return t+.5|0}const ls=(t,e,n)=>Math.max(Math.min(t,n),e);function Gi(t){return ls(sa(t*2.55),0,255)}function ws(t){return ls(sa(t*255),0,255)}function jn(t){return ls(sa(t/2.55)/100,0,1)}function Xp(t){return ls(sa(t*100),0,100)}const Et={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},Td=[..."0123456789ABCDEF"],b_=t=>Td[t&15],w_=t=>Td[(t&240)>>4]+Td[t&15],Ra=t=>(t&240)>>4===(t&15),S_=t=>Ra(t.r)&&Ra(t.g)&&Ra(t.b)&&Ra(t.a);function __(t){var e=t.length,n;return t[0]==="#"&&(e===4||e===5?n={r:255&Et[t[1]]*17,g:255&Et[t[2]]*17,b:255&Et[t[3]]*17,a:e===5?Et[t[4]]*17:255}:(e===7||e===9)&&(n={r:Et[t[1]]<<4|Et[t[2]],g:Et[t[3]]<<4|Et[t[4]],b:Et[t[5]]<<4|Et[t[6]],a:e===9?Et[t[7]]<<4|Et[t[8]]:255})),n}const k_=(t,e)=>t<255?e(t):"";function C_(t){var e=S_(t)?b_:w_;return t?"#"+e(t.r)+e(t.g)+e(t.b)+k_(t.a,e):void 0}const j_=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function xy(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 N_(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 E_(t,e,n){const s=xy(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 M_(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 Vf(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,d;return i!==o&&(d=i-o,c=a>.5?d/(2-i-o):d/(i+o),l=M_(n,s,r,d,i),l=l*60+.5),[l|0,c||0,a]}function Qf(t,e,n,s){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,n,s)).map(ws)}function Kf(t,e,n){return Qf(xy,t,e,n)}function P_(t,e,n){return Qf(E_,t,e,n)}function R_(t,e,n){return Qf(N_,t,e,n)}function yy(t){return(t%360+360)%360}function O_(t){const e=j_.exec(t);let n=255,s;if(!e)return;e[5]!==s&&(n=e[6]?Gi(+e[5]):ws(+e[5]));const r=yy(+e[2]),i=+e[3]/100,o=+e[4]/100;return e[1]==="hwb"?s=P_(r,i,o):e[1]==="hsv"?s=R_(r,i,o):s=Kf(r,i,o),{r:s[0],g:s[1],b:s[2],a:n}}function T_(t,e){var n=Vf(t);n[0]=yy(n[0]+e),n=Kf(n),t.r=n[0],t.g=n[1],t.b=n[2]}function D_(t){if(!t)return;const e=Vf(t),n=e[0],s=Xp(e[1]),r=Xp(e[2]);return t.a<255?`hsla(${n}, ${s}%, ${r}%, ${jn(t.a)})`:`hsl(${n}, ${s}%, ${r}%)`}const qp={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"},Gp={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 L_(){const t={},e=Object.keys(Gp),n=Object.keys(qp);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,qp[i]);i=parseInt(Gp[o],16),t[a]=[i>>16&255,i>>8&255,i&255]}return t}let Oa;function A_(t){Oa||(Oa=L_(),Oa.transparent=[0,0,0,0]);const e=Oa[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}const I_=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function F_(t){const e=I_.exec(t);let n=255,s,r,i;if(e){if(e[7]!==s){const o=+e[7];n=e[8]?Gi(o):ls(o*255,0,255)}return s=+e[1],r=+e[3],i=+e[5],s=255&(e[2]?Gi(s):ls(s,0,255)),r=255&(e[4]?Gi(r):ls(r,0,255)),i=255&(e[6]?Gi(i):ls(i,0,255)),{r:s,g:r,b:i,a:n}}}function z_(t){return t&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${jn(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`)}const au=t=>t<=.0031308?t*12.92:Math.pow(t,1/2.4)*1.055-.055,wr=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function B_(t,e,n){const s=wr(jn(t.r)),r=wr(jn(t.g)),i=wr(jn(t.b));return{r:ws(au(s+n*(wr(jn(e.r))-s))),g:ws(au(r+n*(wr(jn(e.g))-r))),b:ws(au(i+n*(wr(jn(e.b))-i))),a:t.a+n*(e.a-t.a)}}function Ta(t,e,n){if(t){let s=Vf(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*n,e===0?360:1)),s=Kf(s),t.r=s[0],t.g=s[1],t.b=s[2]}}function vy(t,e){return t&&Object.assign(e||{},t)}function Jp(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=ws(t[3]))):(e=vy(t,{r:0,g:0,b:0,a:1}),e.a=ws(e.a)),e}function $_(t){return t.charAt(0)==="r"?F_(t):O_(t)}class Fo{constructor(e){if(e instanceof Fo)return e;const n=typeof e;let s;n==="object"?s=Jp(e):n==="string"&&(s=__(e)||A_(e)||$_(e)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var e=vy(this._rgb);return e&&(e.a=jn(e.a)),e}set rgb(e){this._rgb=Jp(e)}rgbString(){return this._valid?z_(this._rgb):void 0}hexString(){return this._valid?C_(this._rgb):void 0}hslString(){return this._valid?D_(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=B_(this._rgb,e._rgb,n)),this}clone(){return new Fo(this.rgb)}alpha(e){return this._rgb.a=ws(e),this}clearer(e){const n=this._rgb;return n.a*=1-e,this}greyscale(){const e=this._rgb,n=sa(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 Ta(this._rgb,2,e),this}darken(e){return Ta(this._rgb,2,-e),this}saturate(e){return Ta(this._rgb,1,e),this}desaturate(e){return Ta(this._rgb,1,-e),this}rotate(e){return T_(this._rgb,e),this}}/*!
73
73
  * Chart.js v4.6.1
74
74
  * https://www.chartjs.org
75
75
  * (c) 2026 Chart.js Contributors
76
76
  * Released under the MIT License
77
- */function bn(){}const U_=(()=>{let t=0;return()=>t++})();function ue(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 ne(t){return t!==null&&Object.prototype.toString.call(t)==="[object Object]"}function Ft(t){return(typeof t=="number"||t instanceof Number)&&isFinite(+t)}function on(t,e){return Ft(t)?t:e}function ee(t,e){return typeof t>"u"?e:t}const W_=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100:+t/e,wy=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100*e:+t;function he(t,e,n){if(t&&typeof t.call=="function")return t.apply(n,e)}function ae(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(ne(t))for(o=Object.keys(t),i=o.length,r=0;r<i;r++)e.call(n,t[o[r]],o[r])}function Il(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 Fl(t){if(Fe(t))return t.map(Fl);if(ne(t)){const e=Object.create(null),n=Object.keys(t),s=n.length;let r=0;for(;r<s;++r)e[n[r]]=Fl(t[n[r]]);return e}return t}function Sy(t){return["__proto__","prototype","constructor"].indexOf(t)===-1}function H_(t,e,n,s){if(!Sy(t))return;const r=e[t],i=n[t];ne(r)&&ne(i)?Fo(r,i,s):e[t]=Fl(i)}function Fo(t,e,n){const s=Fe(e)?e:[e],r=s.length;if(!ne(t))return t;n=n||{};const i=n.merger||H_;let o;for(let a=0;a<r;++a){if(o=s[a],!ne(o))continue;const l=Object.keys(o);for(let c=0,d=l.length;c<d;++c)i(l[c],t,o,n)}return t}function uo(t,e){return Fo(t,e,{merger:V_})}function V_(t,e,n){if(!Sy(t))return;const s=e[t],r=n[t];ne(s)&&ne(r)?uo(s,r):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=Fl(r))}const Zp={"":t=>t,x:t=>t.x,y:t=>t.y};function Q_(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 K_(t){const e=Q_(t);return n=>{for(const s of e){if(s==="")break;n=n&&n[s]}return n}}function cr(t,e){return(Zp[e]||(Zp[e]=K_(e)))(t)}function Yf(t){return t.charAt(0).toUpperCase()+t.slice(1)}const zo=t=>typeof t<"u",js=t=>typeof t=="function",eg=(t,e)=>{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0};function Y_(t){return t.type==="mouseup"||t.type==="click"||t.type==="contextmenu"}const ge=Math.PI,ve=2*ge,zl=Number.POSITIVE_INFINITY,X_=ge/180,Le=ge/2,Ts=ge/4,tg=ge*2/3,_y=Math.log10,Ss=Math.sign;function sl(t,e,n){return Math.abs(t-e)<n}function ng(t){const e=Math.round(t);t=sl(t,e,t/1e3)?e:t;const n=Math.pow(10,Math.floor(_y(t))),s=t/n;return(s<=1?1:s<=2?2:s<=5?5:10)*n}function q_(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 G_(t){return typeof t=="symbol"||typeof t=="object"&&t!==null&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}function Bl(t){return!G_(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function J_(t,e){const n=Math.round(t);return n-e<=t&&n+e>=t}function Z_(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 Pn(t){return t*(ge/180)}function ek(t){return t*(180/ge)}function sg(t){if(!Ft(t))return;let e=1,n=0;for(;Math.round(t*e)/e!==t;)e*=10,n++;return n}function ky(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*ge&&(i+=ve),{angle:i,distance:r}}function tk(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function dn(t){return(t%ve+ve)%ve}function $l(t,e,n,s){const r=dn(t),i=dn(e),o=dn(n),a=dn(i-r),l=dn(o-r),c=dn(r-i),d=dn(r-o);return r===i||r===o||s&&i===o||a>l&&c<d}function ct(t,e,n){return Math.max(e,Math.min(n,t))}function nk(t){return ct(t,-32768,32767)}function Vs(t,e,n,s=1e-6){return t>=Math.min(e,n)-s&&t<=Math.max(e,n)+s}function Xf(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 Td=(t,e,n,s)=>Xf(t,n,s?r=>{const i=t[r][e];return i<n||i===n&&t[r+1][e]===n}:r=>t[r][e]<n),sk=(t,e,n)=>Xf(t,n,s=>t[s][e]>=n);function rk(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 Cy=["push","pop","shift","splice","unshift"];function ik(t,e){if(t._chartjs){t._chartjs.listeners.push(e);return}Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),Cy.forEach(n=>{const s="_onData"+Yf(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 rg(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)&&(Cy.forEach(i=>{delete t[i]}),delete t._chartjs)}function jy(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const Ny=function(){return typeof window>"u"?function(t){return t()}:window.requestAnimationFrame}();function Ey(t,e){let n=[],s=!1;return function(...r){n=r,s||(s=!0,Ny.call(window,()=>{s=!1,t.apply(e,n)}))}}function ok(t,e){let n;return function(...s){return e?(clearTimeout(n),n=setTimeout(t,e,s)):t.apply(this,s),e}}const My=t=>t==="start"?"left":t==="end"?"right":"center",yt=(t,e,n)=>t==="start"?e:t==="end"?n:(e+n)/2,ak=(t,e,n,s)=>t===(s?"left":"right")?n:t==="center"?(e+n)/2:e,Da=t=>t===0||t===1,ig=(t,e,n)=>-(Math.pow(2,10*(t-=1))*Math.sin((t-e)*ve/n)),og=(t,e,n)=>Math.pow(2,-10*t)*Math.sin((t-e)*ve/n)+1,fo={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*Le)+1,easeOutSine:t=>Math.sin(t*Le),easeInOutSine:t=>-.5*(Math.cos(ge*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=>Da(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=>Da(t)?t:ig(t,.075,.3),easeOutElastic:t=>Da(t)?t:og(t,.075,.3),easeInOutElastic(t){return Da(t)?t:t<.5?.5*ig(t*2,.1125,.45):.5+.5*og(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-fo.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?fo.easeInBounce(t*2)*.5:fo.easeOutBounce(t*2-1)*.5+.5};function Py(t){if(t&&typeof t=="object"){const e=t.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function ag(t){return Py(t)?t:new Io(t)}function lu(t){return Py(t)?t:new Io(t).saturate(.5).darken(.1).hexString()}const lk=["x","y","borderWidth","radius","tension"],ck=["color","borderColor","backgroundColor"];function uk(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:ck},numbers:{type:"number",properties:lk}}),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 dk(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const lg=new Map;function fk(t,e){e=e||{};const n=t+JSON.stringify(e);let s=lg.get(n);return s||(s=new Intl.NumberFormat(t,e),lg.set(n,s)),s}function qf(t,e,n){return fk(e,n).format(t)}const hk={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=pk(t,n)}const o=_y(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),qf(t,s,l)}};function pk(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 Ry={formatters:hk};function gk(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:Ry.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 ur=Object.create(null),Ld=Object.create(null);function ho(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 cu(t,e,n){return typeof e=="string"?Fo(ho(t,e),n):Fo(ho(t,""),e)}class mk{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)=>lu(r.backgroundColor),this.hoverBorderColor=(s,r)=>lu(r.borderColor),this.hoverColor=(s,r)=>lu(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 cu(this,e,n)}get(e){return ho(this,e)}describe(e,n){return cu(Ld,e,n)}override(e,n){return cu(ur,e,n)}route(e,n,s,r){const i=ho(this,e),o=ho(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 ne(l)?Object.assign({},c,l):ee(l,c)},set(l){this[a]=l}}})}apply(e){e.forEach(n=>n(this))}}var Ee=new mk({_scriptable:t=>!t.startsWith("on"),_indexable:t=>t!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[uk,dk,gk]);function xk(t){return!t||ue(t.size)||ue(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function cg(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 Ls(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 ug(t,e){!e&&!t||(e=e||t.getContext("2d"),e.save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function dg(t,e,n,s){Oy(t,e,n,s,null)}function Oy(t,e,n,s,r){let i,o,a,l,c,d,f,h;const p=e.pointStyle,x=e.rotation,g=e.radius;let b=(x||0)*X_;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(g)||g<=0)){switch(t.beginPath(),p){default:r?t.ellipse(n,s,r/2,g,0,0,ve):t.arc(n,s,g,0,ve),t.closePath();break;case"triangle":d=r?r/2:g,t.moveTo(n+Math.sin(b)*d,s-Math.cos(b)*g),b+=tg,t.lineTo(n+Math.sin(b)*d,s-Math.cos(b)*g),b+=tg,t.lineTo(n+Math.sin(b)*d,s-Math.cos(b)*g),t.closePath();break;case"rectRounded":c=g*.516,l=g-c,o=Math.cos(b+Ts)*l,f=Math.cos(b+Ts)*(r?r/2-c:l),a=Math.sin(b+Ts)*l,h=Math.sin(b+Ts)*(r?r/2-c:l),t.arc(n-f,s-a,c,b-ge,b-Le),t.arc(n+h,s-o,c,b-Le,b),t.arc(n+f,s+a,c,b,b+Le),t.arc(n-h,s+o,c,b+Le,b+ge),t.closePath();break;case"rect":if(!x){l=Math.SQRT1_2*g,d=r?r/2:l,t.rect(n-d,s-l,2*d,2*l);break}b+=Ts;case"rectRot":f=Math.cos(b)*(r?r/2:g),o=Math.cos(b)*g,a=Math.sin(b)*g,h=Math.sin(b)*(r?r/2:g),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+=Ts;case"cross":f=Math.cos(b)*(r?r/2:g),o=Math.cos(b)*g,a=Math.sin(b)*g,h=Math.sin(b)*(r?r/2:g),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:g),o=Math.cos(b)*g,a=Math.sin(b)*g,h=Math.sin(b)*(r?r/2:g),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+=Ts,f=Math.cos(b)*(r?r/2:g),o=Math.cos(b)*g,a=Math.sin(b)*g,h=Math.sin(b)*(r?r/2:g),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)*g,a=Math.sin(b)*g,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:g),s+Math.sin(b)*g);break;case!1:t.closePath();break}t.fill(),e.borderWidth>0&&t.stroke()}}function Dy(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 Gf(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function Jf(t){t.restore()}function yk(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),ue(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 vk(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,d=r.strikethrough?(l+c)/2:c;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=r.decorationWidth||2,t.moveTo(o,d),t.lineTo(a,d),t.stroke()}}function bk(t,e){const n=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=n}function Ul(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,yk(t,i),l=0;l<o.length;++l)c=o[l],i.backdrop&&bk(t,i.backdrop),a&&(i.strokeColor&&(t.strokeStyle=i.strokeColor),ue(i.strokeWidth)||(t.lineWidth=i.strokeWidth),t.strokeText(c,n,s,i.maxWidth)),t.fillText(c,n,s,i.maxWidth),vk(t,n,s,c,i),s+=Number(r.lineHeight);t.restore()}function Wl(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*ge,ge,!0),t.lineTo(n,s+i-o.bottomLeft),t.arc(n+o.bottomLeft,s+i-o.bottomLeft,o.bottomLeft,ge,Le,!0),t.lineTo(n+r-o.bottomRight,s+i),t.arc(n+r-o.bottomRight,s+i-o.bottomRight,o.bottomRight,Le,0,!0),t.lineTo(n+r,s+o.topRight),t.arc(n+r-o.topRight,s+o.topRight,o.topRight,0,-Le,!0),t.lineTo(n+o.topLeft,s)}const wk=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Sk=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function _k(t,e){const n=(""+t).match(wk);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 kk=t=>+t||0;function Zf(t,e){const n={},s=ne(e),r=s?Object.keys(e):e,i=ne(t)?s?o=>ee(t[o],t[e[o]]):o=>t[o]:()=>t;for(const o of r)n[o]=kk(i(o));return n}function Ty(t){return Zf(t,{top:"y",right:"x",bottom:"y",left:"x"})}function Wr(t){return Zf(t,["topLeft","topRight","bottomLeft","bottomRight"])}function Gt(t){const e=Ty(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function ut(t,e){t=t||{},e=e||Ee.font;let n=ee(t.size,e.size);typeof n=="string"&&(n=parseInt(n,10));let s=ee(t.style,e.style);s&&!(""+s).match(Sk)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const r={family:ee(t.family,e.family),lineHeight:_k(ee(t.lineHeight,e.lineHeight),n),size:n,style:s,weight:ee(t.weight,e.weight),string:""};return r.string=xk(r),r}function Ta(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 Ck(t,e,n){const{min:s,max:r}=t,i=wy(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 bi(t,e){return Object.assign(Object.create(t),e)}function eh(t,e=[""],n,s,r=()=>t[0]){const i=n||t;typeof s>"u"&&(s=Fy("_fallback",t));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:i,_fallback:s,_getTarget:r,override:a=>eh([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 Ay(a,l,()=>Dk(l,e,t,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(t[0])},has(a,l){return hg(a).includes(l)},ownKeys(a){return hg(a)},set(a,l,c){const d=a._storage||(a._storage=r());return a[l]=d[l]=c,delete a._keys,!0}})}function gi(t,e,n,s){const r={_cacheable:!1,_proxy:t,_context:e,_subProxy:n,_stack:new Set,_descriptors:Ly(t,s),setContext:i=>gi(t,i,n,s),override:i=>gi(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 Ay(i,o,()=>Nk(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 Ly(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:js(n)?n:()=>n,isIndexable:js(s)?s:()=>s}}const jk=(t,e)=>t?t+Yf(e):e,th=(t,e)=>ne(e)&&t!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function Ay(t,e,n){if(Object.prototype.hasOwnProperty.call(t,e)||e==="constructor")return t[e];const s=n();return t[e]=s,s}function Nk(t,e,n){const{_proxy:s,_context:r,_subProxy:i,_descriptors:o}=t;let a=s[e];return js(a)&&o.isScriptable(e)&&(a=Ek(e,a,t,n)),Fe(a)&&a.length&&(a=Mk(e,a,t,o.isIndexable)),th(e,a)&&(a=gi(a,r,i&&i[e],o)),a}function Ek(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),th(t,l)&&(l=nh(r._scopes,r,t,l)),l}function Mk(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(ne(e[0])){const l=e,c=r._scopes.filter(d=>d!==l);e=[];for(const d of l){const f=nh(c,r,t,d);e.push(gi(f,i,o&&o[t],a))}}return e}function Iy(t,e,n){return js(t)?t(e,n):t}const Pk=(t,e)=>t===!0?e:typeof t=="string"?cr(e,t):void 0;function Rk(t,e,n,s,r){for(const i of e){const o=Pk(n,i);if(o){t.add(o);const a=Iy(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 nh(t,e,n,s){const r=e._rootScopes,i=Iy(e._fallback,n,s),o=[...t,...r],a=new Set;a.add(s);let l=fg(a,o,n,i||n,s);return l===null||typeof i<"u"&&i!==n&&(l=fg(a,o,i,l,s),l===null)?!1:eh(Array.from(a),[""],r,i,()=>Ok(e,n,s))}function fg(t,e,n,s,r){for(;n;)n=Rk(t,e,n,s,r);return n}function Ok(t,e,n){const s=t._getTarget();e in s||(s[e]={});const r=s[e];return Fe(r)&&ne(n)?n:r||{}}function Dk(t,e,n,s){let r;for(const i of e)if(r=Fy(jk(i,t),n),typeof r<"u")return th(t,r)?nh(n,s,t,r):r}function Fy(t,e){for(const n of e){if(!n)continue;const s=n[t];if(typeof s<"u")return s}}function hg(t){let e=t._keys;return e||(e=t._keys=Tk(t._scopes)),e}function Tk(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 sh(){return typeof window<"u"&&typeof document<"u"}function rh(t){let e=t.parentNode;return e&&e.toString()==="[object ShadowRoot]"&&(e=e.host),e}function Hl(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 vc=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);function Lk(t,e){return vc(t).getPropertyValue(e)}const Ak=["top","right","bottom","left"];function sr(t,e,n){const s={};n=n?"-"+n:"";for(let r=0;r<4;r++){const i=Ak[r];s[i]=parseFloat(t[e+"-"+i+n])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const Ik=(t,e,n)=>(t>0||e>0)&&(!n||!n.shadowRoot);function Fk(t,e){const n=t.touches,s=n&&n.length?n[0]:t,{offsetX:r,offsetY:i}=s;let o=!1,a,l;if(Ik(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 Bs(t,e){if("native"in t)return t;const{canvas:n,currentDevicePixelRatio:s}=e,r=vc(n),i=r.boxSizing==="border-box",o=sr(r,"padding"),a=sr(r,"border","width"),{x:l,y:c,box:d}=Fk(t,n),f=o.left+(d&&a.left),h=o.top+(d&&a.top);let{width:p,height:x}=e;return i&&(p-=o.width+a.width,x-=o.height+a.height),{x:Math.round((l-f)/p*n.width/s),y:Math.round((c-h)/x*n.height/s)}}function zk(t,e,n){let s,r;if(e===void 0||n===void 0){const i=t&&rh(t);if(!i)e=t.clientWidth,n=t.clientHeight;else{const o=i.getBoundingClientRect(),a=vc(i),l=sr(a,"border","width"),c=sr(a,"padding");e=o.width-c.width-l.width,n=o.height-c.height-l.height,s=Hl(a.maxWidth,i,"clientWidth"),r=Hl(a.maxHeight,i,"clientHeight")}}return{width:e,height:n,maxWidth:s||zl,maxHeight:r||zl}}const cs=t=>Math.round(t*10)/10;function Bk(t,e,n,s){const r=vc(t),i=sr(r,"margin"),o=Hl(r.maxWidth,t,"clientWidth")||zl,a=Hl(r.maxHeight,t,"clientHeight")||zl,l=zk(t,e,n);let{width:c,height:d}=l;if(r.boxSizing==="content-box"){const h=sr(r,"border","width"),p=sr(r,"padding");c-=p.width+h.width,d-=p.height+h.height}return c=Math.max(0,c-i.width),d=Math.max(0,s?c/s:d-i.height),c=cs(Math.min(c,o,l.maxWidth)),d=cs(Math.min(d,a,l.maxHeight)),c&&!d&&(d=cs(c/2)),(e!==void 0||n!==void 0)&&s&&l.height&&d>l.height&&(d=l.height,c=cs(Math.floor(d*s))),{width:c,height:d}}function pg(t,e,n){const s=e||1,r=cs(t.height*s),i=cs(t.width*s);t.height=cs(t.height),t.width=cs(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 $k=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};sh()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch{}return t}();function gg(t,e){const n=Lk(t,e),s=n&&n.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}const Uk=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}}},Wk=function(){return{x(t){return t},setWidth(t){},textAlign(t){return t},xPlus(t,e){return t+e},leftForLtr(t,e){return t}}};function Hr(t,e,n){return t?Uk(e,n):Wk()}function zy(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 By(t,e){e!==void 0&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function La(t,e,n){return t.options.clip?t[n]:e[n]}function Hk(t,e){const{xScale:n,yScale:s}=t;return n&&s?{left:La(n,e,"left"),right:La(n,e,"right"),top:La(s,e,"top"),bottom:La(s,e,"bottom")}:e}function Vk(t,e){const n=e._clip;if(n.disabled)return!1;const s=Hk(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)}}/*!
77
+ */function bn(){}const U_=(()=>{let t=0;return()=>t++})();function ue(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 ne(t){return t!==null&&Object.prototype.toString.call(t)==="[object Object]"}function Ft(t){return(typeof t=="number"||t instanceof Number)&&isFinite(+t)}function on(t,e){return Ft(t)?t:e}function ee(t,e){return typeof t>"u"?e:t}const W_=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100:+t/e,by=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100*e:+t;function he(t,e,n){if(t&&typeof t.call=="function")return t.apply(n,e)}function ae(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(ne(t))for(o=Object.keys(t),i=o.length,r=0;r<i;r++)e.call(n,t[o[r]],o[r])}function Fl(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 zl(t){if(Fe(t))return t.map(zl);if(ne(t)){const e=Object.create(null),n=Object.keys(t),s=n.length;let r=0;for(;r<s;++r)e[n[r]]=zl(t[n[r]]);return e}return t}function wy(t){return["__proto__","prototype","constructor"].indexOf(t)===-1}function H_(t,e,n,s){if(!wy(t))return;const r=e[t],i=n[t];ne(r)&&ne(i)?zo(r,i,s):e[t]=zl(i)}function zo(t,e,n){const s=Fe(e)?e:[e],r=s.length;if(!ne(t))return t;n=n||{};const i=n.merger||H_;let o;for(let a=0;a<r;++a){if(o=s[a],!ne(o))continue;const l=Object.keys(o);for(let c=0,d=l.length;c<d;++c)i(l[c],t,o,n)}return t}function fo(t,e){return zo(t,e,{merger:V_})}function V_(t,e,n){if(!wy(t))return;const s=e[t],r=n[t];ne(s)&&ne(r)?fo(s,r):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=zl(r))}const Zp={"":t=>t,x:t=>t.x,y:t=>t.y};function Q_(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 K_(t){const e=Q_(t);return n=>{for(const s of e){if(s==="")break;n=n&&n[s]}return n}}function cr(t,e){return(Zp[e]||(Zp[e]=K_(e)))(t)}function Yf(t){return t.charAt(0).toUpperCase()+t.slice(1)}const Bo=t=>typeof t<"u",js=t=>typeof t=="function",eg=(t,e)=>{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0};function Y_(t){return t.type==="mouseup"||t.type==="click"||t.type==="contextmenu"}const ge=Math.PI,ve=2*ge,Bl=Number.POSITIVE_INFINITY,X_=ge/180,Le=ge/2,Ds=ge/4,tg=ge*2/3,Sy=Math.log10,Ss=Math.sign;function rl(t,e,n){return Math.abs(t-e)<n}function ng(t){const e=Math.round(t);t=rl(t,e,t/1e3)?e:t;const n=Math.pow(10,Math.floor(Sy(t))),s=t/n;return(s<=1?1:s<=2?2:s<=5?5:10)*n}function q_(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 G_(t){return typeof t=="symbol"||typeof t=="object"&&t!==null&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}function $l(t){return!G_(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function J_(t,e){const n=Math.round(t);return n-e<=t&&n+e>=t}function Z_(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 Pn(t){return t*(ge/180)}function ek(t){return t*(180/ge)}function sg(t){if(!Ft(t))return;let e=1,n=0;for(;Math.round(t*e)/e!==t;)e*=10,n++;return n}function _y(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*ge&&(i+=ve),{angle:i,distance:r}}function tk(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function dn(t){return(t%ve+ve)%ve}function Ul(t,e,n,s){const r=dn(t),i=dn(e),o=dn(n),a=dn(i-r),l=dn(o-r),c=dn(r-i),d=dn(r-o);return r===i||r===o||s&&i===o||a>l&&c<d}function ct(t,e,n){return Math.max(e,Math.min(n,t))}function nk(t){return ct(t,-32768,32767)}function Vs(t,e,n,s=1e-6){return t>=Math.min(e,n)-s&&t<=Math.max(e,n)+s}function Xf(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 Dd=(t,e,n,s)=>Xf(t,n,s?r=>{const i=t[r][e];return i<n||i===n&&t[r+1][e]===n}:r=>t[r][e]<n),sk=(t,e,n)=>Xf(t,n,s=>t[s][e]>=n);function rk(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 ky=["push","pop","shift","splice","unshift"];function ik(t,e){if(t._chartjs){t._chartjs.listeners.push(e);return}Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),ky.forEach(n=>{const s="_onData"+Yf(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 rg(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)&&(ky.forEach(i=>{delete t[i]}),delete t._chartjs)}function Cy(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const jy=function(){return typeof window>"u"?function(t){return t()}:window.requestAnimationFrame}();function Ny(t,e){let n=[],s=!1;return function(...r){n=r,s||(s=!0,jy.call(window,()=>{s=!1,t.apply(e,n)}))}}function ok(t,e){let n;return function(...s){return e?(clearTimeout(n),n=setTimeout(t,e,s)):t.apply(this,s),e}}const Ey=t=>t==="start"?"left":t==="end"?"right":"center",vt=(t,e,n)=>t==="start"?e:t==="end"?n:(e+n)/2,ak=(t,e,n,s)=>t===(s?"left":"right")?n:t==="center"?(e+n)/2:e,Da=t=>t===0||t===1,ig=(t,e,n)=>-(Math.pow(2,10*(t-=1))*Math.sin((t-e)*ve/n)),og=(t,e,n)=>Math.pow(2,-10*t)*Math.sin((t-e)*ve/n)+1,ho={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*Le)+1,easeOutSine:t=>Math.sin(t*Le),easeInOutSine:t=>-.5*(Math.cos(ge*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=>Da(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=>Da(t)?t:ig(t,.075,.3),easeOutElastic:t=>Da(t)?t:og(t,.075,.3),easeInOutElastic(t){return Da(t)?t:t<.5?.5*ig(t*2,.1125,.45):.5+.5*og(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-ho.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?ho.easeInBounce(t*2)*.5:ho.easeOutBounce(t*2-1)*.5+.5};function My(t){if(t&&typeof t=="object"){const e=t.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function ag(t){return My(t)?t:new Fo(t)}function lu(t){return My(t)?t:new Fo(t).saturate(.5).darken(.1).hexString()}const lk=["x","y","borderWidth","radius","tension"],ck=["color","borderColor","backgroundColor"];function uk(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:ck},numbers:{type:"number",properties:lk}}),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 dk(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const lg=new Map;function fk(t,e){e=e||{};const n=t+JSON.stringify(e);let s=lg.get(n);return s||(s=new Intl.NumberFormat(t,e),lg.set(n,s)),s}function qf(t,e,n){return fk(e,n).format(t)}const hk={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=pk(t,n)}const o=Sy(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),qf(t,s,l)}};function pk(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 Py={formatters:hk};function gk(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:Py.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 ur=Object.create(null),Ld=Object.create(null);function po(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 cu(t,e,n){return typeof e=="string"?zo(po(t,e),n):zo(po(t,""),e)}class mk{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)=>lu(r.backgroundColor),this.hoverBorderColor=(s,r)=>lu(r.borderColor),this.hoverColor=(s,r)=>lu(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 cu(this,e,n)}get(e){return po(this,e)}describe(e,n){return cu(Ld,e,n)}override(e,n){return cu(ur,e,n)}route(e,n,s,r){const i=po(this,e),o=po(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 ne(l)?Object.assign({},c,l):ee(l,c)},set(l){this[a]=l}}})}apply(e){e.forEach(n=>n(this))}}var Ee=new mk({_scriptable:t=>!t.startsWith("on"),_indexable:t=>t!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[uk,dk,gk]);function xk(t){return!t||ue(t.size)||ue(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function cg(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 Ls(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 ug(t,e){!e&&!t||(e=e||t.getContext("2d"),e.save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function dg(t,e,n,s){Ry(t,e,n,s,null)}function Ry(t,e,n,s,r){let i,o,a,l,c,d,f,h;const p=e.pointStyle,x=e.rotation,g=e.radius;let b=(x||0)*X_;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(g)||g<=0)){switch(t.beginPath(),p){default:r?t.ellipse(n,s,r/2,g,0,0,ve):t.arc(n,s,g,0,ve),t.closePath();break;case"triangle":d=r?r/2:g,t.moveTo(n+Math.sin(b)*d,s-Math.cos(b)*g),b+=tg,t.lineTo(n+Math.sin(b)*d,s-Math.cos(b)*g),b+=tg,t.lineTo(n+Math.sin(b)*d,s-Math.cos(b)*g),t.closePath();break;case"rectRounded":c=g*.516,l=g-c,o=Math.cos(b+Ds)*l,f=Math.cos(b+Ds)*(r?r/2-c:l),a=Math.sin(b+Ds)*l,h=Math.sin(b+Ds)*(r?r/2-c:l),t.arc(n-f,s-a,c,b-ge,b-Le),t.arc(n+h,s-o,c,b-Le,b),t.arc(n+f,s+a,c,b,b+Le),t.arc(n-h,s+o,c,b+Le,b+ge),t.closePath();break;case"rect":if(!x){l=Math.SQRT1_2*g,d=r?r/2:l,t.rect(n-d,s-l,2*d,2*l);break}b+=Ds;case"rectRot":f=Math.cos(b)*(r?r/2:g),o=Math.cos(b)*g,a=Math.sin(b)*g,h=Math.sin(b)*(r?r/2:g),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+=Ds;case"cross":f=Math.cos(b)*(r?r/2:g),o=Math.cos(b)*g,a=Math.sin(b)*g,h=Math.sin(b)*(r?r/2:g),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:g),o=Math.cos(b)*g,a=Math.sin(b)*g,h=Math.sin(b)*(r?r/2:g),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+=Ds,f=Math.cos(b)*(r?r/2:g),o=Math.cos(b)*g,a=Math.sin(b)*g,h=Math.sin(b)*(r?r/2:g),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)*g,a=Math.sin(b)*g,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:g),s+Math.sin(b)*g);break;case!1:t.closePath();break}t.fill(),e.borderWidth>0&&t.stroke()}}function Oy(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 Gf(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function Jf(t){t.restore()}function yk(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),ue(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 vk(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,d=r.strikethrough?(l+c)/2:c;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=r.decorationWidth||2,t.moveTo(o,d),t.lineTo(a,d),t.stroke()}}function bk(t,e){const n=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=n}function Wl(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,yk(t,i),l=0;l<o.length;++l)c=o[l],i.backdrop&&bk(t,i.backdrop),a&&(i.strokeColor&&(t.strokeStyle=i.strokeColor),ue(i.strokeWidth)||(t.lineWidth=i.strokeWidth),t.strokeText(c,n,s,i.maxWidth)),t.fillText(c,n,s,i.maxWidth),vk(t,n,s,c,i),s+=Number(r.lineHeight);t.restore()}function Hl(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*ge,ge,!0),t.lineTo(n,s+i-o.bottomLeft),t.arc(n+o.bottomLeft,s+i-o.bottomLeft,o.bottomLeft,ge,Le,!0),t.lineTo(n+r-o.bottomRight,s+i),t.arc(n+r-o.bottomRight,s+i-o.bottomRight,o.bottomRight,Le,0,!0),t.lineTo(n+r,s+o.topRight),t.arc(n+r-o.topRight,s+o.topRight,o.topRight,0,-Le,!0),t.lineTo(n+o.topLeft,s)}const wk=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Sk=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function _k(t,e){const n=(""+t).match(wk);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 kk=t=>+t||0;function Zf(t,e){const n={},s=ne(e),r=s?Object.keys(e):e,i=ne(t)?s?o=>ee(t[o],t[e[o]]):o=>t[o]:()=>t;for(const o of r)n[o]=kk(i(o));return n}function Ty(t){return Zf(t,{top:"y",right:"x",bottom:"y",left:"x"})}function Wr(t){return Zf(t,["topLeft","topRight","bottomLeft","bottomRight"])}function Gt(t){const e=Ty(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function ut(t,e){t=t||{},e=e||Ee.font;let n=ee(t.size,e.size);typeof n=="string"&&(n=parseInt(n,10));let s=ee(t.style,e.style);s&&!(""+s).match(Sk)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const r={family:ee(t.family,e.family),lineHeight:_k(ee(t.lineHeight,e.lineHeight),n),size:n,style:s,weight:ee(t.weight,e.weight),string:""};return r.string=xk(r),r}function La(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 Ck(t,e,n){const{min:s,max:r}=t,i=by(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 wi(t,e){return Object.assign(Object.create(t),e)}function eh(t,e=[""],n,s,r=()=>t[0]){const i=n||t;typeof s>"u"&&(s=Iy("_fallback",t));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:i,_fallback:s,_getTarget:r,override:a=>eh([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 Ly(a,l,()=>Tk(l,e,t,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(t[0])},has(a,l){return hg(a).includes(l)},ownKeys(a){return hg(a)},set(a,l,c){const d=a._storage||(a._storage=r());return a[l]=d[l]=c,delete a._keys,!0}})}function gi(t,e,n,s){const r={_cacheable:!1,_proxy:t,_context:e,_subProxy:n,_stack:new Set,_descriptors:Dy(t,s),setContext:i=>gi(t,i,n,s),override:i=>gi(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 Ly(i,o,()=>Nk(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 Dy(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:js(n)?n:()=>n,isIndexable:js(s)?s:()=>s}}const jk=(t,e)=>t?t+Yf(e):e,th=(t,e)=>ne(e)&&t!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function Ly(t,e,n){if(Object.prototype.hasOwnProperty.call(t,e)||e==="constructor")return t[e];const s=n();return t[e]=s,s}function Nk(t,e,n){const{_proxy:s,_context:r,_subProxy:i,_descriptors:o}=t;let a=s[e];return js(a)&&o.isScriptable(e)&&(a=Ek(e,a,t,n)),Fe(a)&&a.length&&(a=Mk(e,a,t,o.isIndexable)),th(e,a)&&(a=gi(a,r,i&&i[e],o)),a}function Ek(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),th(t,l)&&(l=nh(r._scopes,r,t,l)),l}function Mk(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(ne(e[0])){const l=e,c=r._scopes.filter(d=>d!==l);e=[];for(const d of l){const f=nh(c,r,t,d);e.push(gi(f,i,o&&o[t],a))}}return e}function Ay(t,e,n){return js(t)?t(e,n):t}const Pk=(t,e)=>t===!0?e:typeof t=="string"?cr(e,t):void 0;function Rk(t,e,n,s,r){for(const i of e){const o=Pk(n,i);if(o){t.add(o);const a=Ay(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 nh(t,e,n,s){const r=e._rootScopes,i=Ay(e._fallback,n,s),o=[...t,...r],a=new Set;a.add(s);let l=fg(a,o,n,i||n,s);return l===null||typeof i<"u"&&i!==n&&(l=fg(a,o,i,l,s),l===null)?!1:eh(Array.from(a),[""],r,i,()=>Ok(e,n,s))}function fg(t,e,n,s,r){for(;n;)n=Rk(t,e,n,s,r);return n}function Ok(t,e,n){const s=t._getTarget();e in s||(s[e]={});const r=s[e];return Fe(r)&&ne(n)?n:r||{}}function Tk(t,e,n,s){let r;for(const i of e)if(r=Iy(jk(i,t),n),typeof r<"u")return th(t,r)?nh(n,s,t,r):r}function Iy(t,e){for(const n of e){if(!n)continue;const s=n[t];if(typeof s<"u")return s}}function hg(t){let e=t._keys;return e||(e=t._keys=Dk(t._scopes)),e}function Dk(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 sh(){return typeof window<"u"&&typeof document<"u"}function rh(t){let e=t.parentNode;return e&&e.toString()==="[object ShadowRoot]"&&(e=e.host),e}function Vl(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 bc=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);function Lk(t,e){return bc(t).getPropertyValue(e)}const Ak=["top","right","bottom","left"];function sr(t,e,n){const s={};n=n?"-"+n:"";for(let r=0;r<4;r++){const i=Ak[r];s[i]=parseFloat(t[e+"-"+i+n])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const Ik=(t,e,n)=>(t>0||e>0)&&(!n||!n.shadowRoot);function Fk(t,e){const n=t.touches,s=n&&n.length?n[0]:t,{offsetX:r,offsetY:i}=s;let o=!1,a,l;if(Ik(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 Bs(t,e){if("native"in t)return t;const{canvas:n,currentDevicePixelRatio:s}=e,r=bc(n),i=r.boxSizing==="border-box",o=sr(r,"padding"),a=sr(r,"border","width"),{x:l,y:c,box:d}=Fk(t,n),f=o.left+(d&&a.left),h=o.top+(d&&a.top);let{width:p,height:x}=e;return i&&(p-=o.width+a.width,x-=o.height+a.height),{x:Math.round((l-f)/p*n.width/s),y:Math.round((c-h)/x*n.height/s)}}function zk(t,e,n){let s,r;if(e===void 0||n===void 0){const i=t&&rh(t);if(!i)e=t.clientWidth,n=t.clientHeight;else{const o=i.getBoundingClientRect(),a=bc(i),l=sr(a,"border","width"),c=sr(a,"padding");e=o.width-c.width-l.width,n=o.height-c.height-l.height,s=Vl(a.maxWidth,i,"clientWidth"),r=Vl(a.maxHeight,i,"clientHeight")}}return{width:e,height:n,maxWidth:s||Bl,maxHeight:r||Bl}}const cs=t=>Math.round(t*10)/10;function Bk(t,e,n,s){const r=bc(t),i=sr(r,"margin"),o=Vl(r.maxWidth,t,"clientWidth")||Bl,a=Vl(r.maxHeight,t,"clientHeight")||Bl,l=zk(t,e,n);let{width:c,height:d}=l;if(r.boxSizing==="content-box"){const h=sr(r,"border","width"),p=sr(r,"padding");c-=p.width+h.width,d-=p.height+h.height}return c=Math.max(0,c-i.width),d=Math.max(0,s?c/s:d-i.height),c=cs(Math.min(c,o,l.maxWidth)),d=cs(Math.min(d,a,l.maxHeight)),c&&!d&&(d=cs(c/2)),(e!==void 0||n!==void 0)&&s&&l.height&&d>l.height&&(d=l.height,c=cs(Math.floor(d*s))),{width:c,height:d}}function pg(t,e,n){const s=e||1,r=cs(t.height*s),i=cs(t.width*s);t.height=cs(t.height),t.width=cs(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 $k=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};sh()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch{}return t}();function gg(t,e){const n=Lk(t,e),s=n&&n.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}const Uk=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}}},Wk=function(){return{x(t){return t},setWidth(t){},textAlign(t){return t},xPlus(t,e){return t+e},leftForLtr(t,e){return t}}};function Hr(t,e,n){return t?Uk(e,n):Wk()}function Fy(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 zy(t,e){e!==void 0&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Aa(t,e,n){return t.options.clip?t[n]:e[n]}function Hk(t,e){const{xScale:n,yScale:s}=t;return n&&s?{left:Aa(n,e,"left"),right:Aa(n,e,"right"),top:Aa(s,e,"top"),bottom:Aa(s,e,"bottom")}:e}function Vk(t,e){const n=e._clip;if(n.disabled)return!1;const s=Hk(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
78
  * Chart.js v4.6.1
79
79
  * https://www.chartjs.org
80
80
  * (c) 2026 Chart.js Contributors
81
81
  * Released under the MIT License
82
- */class Qk{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=Ny.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 Sn=new Qk;const mg="transparent",Kk={boolean(t,e,n){return n>.5?e:t},color(t,e,n){const s=ag(t||mg),r=s.valid&&ag(e||mg);return r&&r.valid?r.mix(s,n).hexString():e},number(t,e,n){return t+(e-t)*n}};class Yk{constructor(e,n,s,r){const i=n[s];r=Ta([e.to,r,i,e.from]);const o=Ta([e.from,i,r]);this._active=!0,this._fn=e.fn||Kk[e.type||typeof o],this._easing=fo[e.easing]||fo.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=Ta([e.to,n,r,e.from]),this._from=Ta([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 $y{constructor(e,n){this._chart=e,this._properties=new Map,this.configure(n)}configure(e){if(!ne(e))return;const n=Object.keys(Ee.animation),s=this._properties;Object.getOwnPropertyNames(e).forEach(r=>{const i=e[r];if(!ne(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=qk(e,s);if(!r)return[];const i=this._createAnimations(r,s);return s.$shared&&Xk(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 d=n[c];let f=i[c];const h=s.get(c);if(f)if(h&&f.active()){f.update(h,d,a);continue}else f.cancel();if(!h||!h.duration){e[c]=d;continue}i[c]=f=new Yk(h,e,c,d),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 Sn.add(this._chart,s),!0}}function Xk(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 qk(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 xg(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 Gk(t,e,n){if(n===!1)return!1;const s=xg(t,n),r=xg(e,n);return{top:r.end,right:s.end,bottom:r.start,left:s.start}}function Jk(t){let e,n,s,r;return ne(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 Uy(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 yg(t,e,n,s={}){const r=t.keys,i=s.mode==="single";let o,a,l,c;if(e===null)return;let d=!1;for(o=0,a=r.length;o<a;++o){if(l=+r[o],l===n){if(d=!0,s.all)continue;break}c=t.values[l],Ft(c)&&(i||e===0||Ss(e)===Ss(c))&&(e+=c)}return!d&&!s.all?0:e}function Zk(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,d;for(l=0,c=o.length;l<c;++l)d=o[l],a[l]={[r]:d,[i]:t[d]};return a}function uu(t,e){const n=t&&t.options.stacked;return n||n===void 0&&e.stack!==void 0}function eC(t,e,n){return`${t.id}.${e.id}.${n.stack||n.type}`}function tC(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 nC(t,e,n){const s=t[e]||(t[e]={});return s[n]||(s[n]={})}function vg(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 bg(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,d=eC(i,o,s),f=e.length;let h;for(let p=0;p<f;++p){const x=e[p],{[l]:g,[c]:b}=x,y=x._stacks||(x._stacks={});h=y[c]=nC(r,d,g),h[a]=b,h._top=vg(h,o,!0,s.type),h._bottom=vg(h,o,!1,s.type);const m=h._visualValues||(h._visualValues={});m[a]=b}}function du(t,e){const n=t.scales;return Object.keys(n).filter(s=>n[s].axis===e).shift()}function sC(t,e){return bi(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function rC(t,e,n){return bi(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:n,index:e,mode:"default",type:"data"})}function Fi(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 fu=t=>t==="reset"||t==="none",wg=(t,e)=>e?t:Object.assign({},t),iC=(t,e,n)=>t&&!e.hidden&&e._stacked&&{keys:Uy(n,!0),values:null};class Vr{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=uu(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&&Fi(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,n=this._cachedMeta,s=this.getDataset(),r=(f,h,p,x)=>f==="x"?h:f==="r"?x:p,i=n.xAxisID=ee(s.xAxisID,du(e,"x")),o=n.yAxisID=ee(s.yAxisID,du(e,"y")),a=n.rAxisID=ee(s.rAxisID,du(e,"r")),l=n.indexAxis,c=n.iAxisID=r(l,i,o,a),d=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(d)}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&&rg(this._data,this),e._stacked&&Fi(e)}_dataCheck(){const e=this.getDataset(),n=e.data||(e.data=[]),s=this._data;if(ne(n)){const r=this._cachedMeta;this._data=Zk(n,r)}else if(s!==n){if(s){rg(s,this);const r=this._cachedMeta;Fi(r),r._parsed=[]}n&&Object.isExtensible(n)&&ik(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=uu(n.vScale,n),n.stack!==s.stack&&(r=!0,Fi(n),n.stack=s.stack),this._resyncElements(e),(r||i!==n._stacked)&&(bg(this,n._parsed),n._stacked=uu(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],d,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):ne(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(d=0;d<n;++d)s._parsed[d+e]=f=h[d],l&&(p()&&(l=!1),c=f);s._sorted=l}o&&bg(this,h)}parsePrimitiveData(e,n,s,r){const{iScale:i,vScale:o}=e,a=i.axis,l=o.axis,c=i.getLabels(),d=i===o,f=new Array(r);let h,p,x;for(h=0,p=r;h<p;++h)x=h+s,f[h]={[a]:d||i.parse(c[x],x),[l]:o.parse(n[x],x)};return f}parseArrayData(e,n,s,r){const{xScale:i,yScale:o}=e,a=new Array(r);let l,c,d,f;for(l=0,c=r;l<c;++l)d=l+s,f=n[d],a[l]={x:i.parse(f[0],d),y:o.parse(f[1],d)};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 d,f,h,p;for(d=0,f=r;d<f;++d)h=d+s,p=n[h],c[d]={x:i.parse(cr(p,a),h),y:o.parse(cr(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:Uy(r,!0),values:n._stacks[e.axis]._visualValues};return yg(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=yg(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=iC(n,s,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:f}=tC(a);let h,p;function x(){p=r[h];const g=p[a.axis];return!Ft(p[e.axis])||d>g||f<g}for(h=0;h<o&&!(!x()&&(this.updateRangeFromParsed(c,e,p,l),i));++h);if(i){for(h=o-1;h>=0;--h)if(!x()){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],Ft(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=Jk(ee(this.options.clip,Gk(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 d;for(s.dataset&&s.dataset.draw(e,i,a,l),d=a;d<a+l;++d){const f=r[d];f.hidden||(f.active&&c?o.push(f):f.draw(e,i))}for(d=0;d<o.length;++d)o[d].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=rC(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=sC(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&&zo(s);if(a)return wg(a,l);const c=this.chart.config,d=c.datasetElementScopeKeys(this._type,e),f=r?[`${e}Hover`,"hover",e,""]:[e,""],h=c.getOptionScopes(this.getDataset(),d),p=Object.keys(Ee.elements[e]),x=()=>this.getContext(s,r,n),g=c.resolveNamedOptions(h,p,x,f);return g.$shared&&(g.$shared=l,i[o]=Object.freeze(wg(g,l))),g}_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 d=this.chart.config,f=d.datasetAnimationScopeKeys(this._type,n),h=d.getOptionScopes(this.getDataset(),f);l=d.createResolver(h,this.getContext(e,s,n))}const c=new $y(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||fu(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){fu(r)?Object.assign(e,s):this._resolveAnimations(n,r).update(e,s)}updateSharedOptions(e,n,s){e&&!fu(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&&Fi(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])}}$(Vr,"defaults",{}),$(Vr,"datasetElementType",null),$(Vr,"dataElementType",null);function oC(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=jy(s.sort((r,i)=>r-i))}return t._cache.$bar}function aC(t){const e=t.iScale,n=oC(e,t.type);let s=e._length,r,i,o,a;const l=()=>{o===32767||o===-32768||(zo(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 lC(t,e,n,s){const r=n.barThickness;let i,o;return ue(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 cC(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 uC(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 Wy(t,e,n,s){return Fe(t)?uC(t,e,n,s):e[n.axis]=n.parse(t,s),e}function Sg(t,e,n,s){const r=t.iScale,i=t.vScale,o=r.getLabels(),a=r===i,l=[];let c,d,f,h;for(c=n,d=n+s;c<d;++c)h=e[c],f={},f[r.axis]=a||r.parse(o[c],c),l.push(Wy(h,f,i,c));return l}function hu(t){return t&&t.barStart!==void 0&&t.barEnd!==void 0}function dC(t,e,n){return t!==0?Ss(t):(e.isHorizontal()?1:-1)*(e.min>=n?1:-1)}function fC(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 hC(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:d}=fC(t);r==="middle"&&n&&(t.enableBorderRadius=!0,(n._top||0)===s?r=c:(n._bottom||0)===s?r=d:(i[_g(d,o,a,l)]=!0,r=c)),i[_g(r,o,a,l)]=!0,t.borderSkipped=i}function _g(t,e,n,s){return s?(t=pC(t,e,n),t=kg(t,n,e)):t=kg(t,e,n),t}function pC(t,e,n){return t===e?n:t===n?e:t}function kg(t,e,n){return t==="start"?e:t==="end"?n:t}function gC(t,{inflateAmount:e},n){t.inflateAmount=e==="auto"?n===1?.33:0:e}class rl extends Vr{parsePrimitiveData(e,n,s,r){return Sg(e,n,s,r)}parseArrayData(e,n,s,r){return Sg(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,d=o.axis==="x"?a:l,f=[];let h,p,x,g;for(h=s,p=s+r;h<p;++h)g=n[h],x={},x[i.axis]=i.parse(cr(g,c),h),f.push(Wy(cr(g,d),x,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=hu(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(),d=this._getRuler(),{sharedOptions:f,includeOptions:h}=this._getSharedOptions(n,r);for(let p=n;p<n+s;p++){const x=this.getParsed(p),g=i||ue(x[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(p),b=this._calculateBarIndexPixels(p,d),y=(x._stacks||{})[a.axis],m={horizontal:c,base:g.base,enableBorderRadius:!y||hu(x._custom)||o===y._top||o===y._bottom,x:c?g.head:b.center,y:c?b.center:g.head,height:c?b.size:Math.abs(g.size),width:c?Math.abs(g.size):b.size};h&&(m.options=f||this.resolveDataElementOptions(p,e[p].active?"active":r));const v=m.options||e[p].options;hC(m,v,y,o),gC(m,v,d.ratio),this.updateElement(e[p],p,m,r)}}_getStacks(e,n){const{iScale:s}=this._cachedMeta,r=s.getMatchingVisibleMetas(this._type).filter(d=>d.controller.options.grouped),i=s.options.stacked,o=[],a=this._cachedMeta.controller.getParsed(n),l=a&&a[s.axis],c=d=>{const f=d._parsed.find(p=>p[s.axis]===l),h=f&&f[d.vScale.axis];if(ue(h)||isNaN(h))return!0};for(const d of r)if(!(n!==void 0&&c(d))&&((i===!1||o.indexOf(d.stack)===-1||i===void 0&&d.stack===void 0)&&o.push(d.stack),d.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[ee(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||aC(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,d=hu(c);let f=l[n.axis],h=0,p=s?this.applyStack(n,l,s):f,x,g;p!==f&&(h=p-f,p=f),d&&(f=c.barStart,p=c.barEnd-c.barStart,f!==0&&Ss(f)!==Ss(c.barEnd)&&(h=0),h+=f);const b=!ue(i)&&!d?i:h;let y=n.getPixelForValue(b);if(this.chart.getDataVisibility(e)?x=n.getPixelForValue(h+p):x=y,g=x-y,Math.abs(g)<o){g=dC(g,n,a)*o,f===a&&(y-=g/2);const m=n.getPixelForDecimal(0),v=n.getPixelForDecimal(1),S=Math.min(m,v),_=Math.max(m,v);y=Math.max(Math.min(y,_),S),x=y+g,s&&!d&&(l._stacks[n.axis]._visualValues[r]=n.getValueForPixel(x)-n.getValueForPixel(y))}if(y===n.getPixelForValue(a)){const m=Ss(g)*n.getLineWidthForValue(a)/2;y+=m,g-=m}return{size:g,base:y,head:x,center:x+g/2}}_calculateBarIndexPixels(e,n){const s=n.scale,r=this.options,i=r.skipNull,o=ee(r.maxBarThickness,1/0);let a,l;const c=this._getAxisCount();if(n.grouped){const d=i?this._getStackCount(e):n.stackCount,f=r.barThickness==="flex"?cC(e,n,r,d*c):lC(e,n,r,d*c),h=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,p=this._getAxis().indexOf(ee(h,this.getFirstScaleIdForIndexAxis())),x=this._getStackIndex(this.index,this._cachedMeta.stack,i?e:void 0)+p;a=f.start+f.chunk*x+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)}}$(rl,"id","bar"),$(rl,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),$(rl,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});function mC(t,e,n){let s=1,r=1,i=0,o=0;if(e<ve){const a=t,l=a+e,c=Math.cos(a),d=Math.sin(a),f=Math.cos(l),h=Math.sin(l),p=(v,S,_)=>$l(v,a,l,!0)?1:Math.max(S,S*n,_,_*n),x=(v,S,_)=>$l(v,a,l,!0)?-1:Math.min(S,S*n,_,_*n),g=p(0,c,f),b=p(Le,d,h),y=x(ge,c,f),m=x(ge+Le,d,h);s=(g-y)/2,r=(b-m)/2,i=-(g+y)/2,o=-(b+m)/2}return{ratioX:s,ratioY:r,offsetX:i,offsetY:o}}class Gi extends Vr{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(ne(s[e])){const{key:l="value"}=this._parsing;i=c=>+cr(s[c],l)}let o,a;for(o=e,a=e+n;o<a;++o)r._parsed[o]=i(o)}}_getRotation(){return Pn(this.options.rotation-90)}_getCircumference(){return Pn(this.options.circumference)}_getRotationExtents(){let e=ve,n=-ve;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(W_(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:d,rotation:f}=this._getRotationExtents(),{ratioX:h,ratioY:p,offsetX:x,offsetY:g}=mC(f,d,l),b=(s.width-o)/h,y=(s.height-o)/p,m=Math.max(Math.min(b,y)/2,0),v=wy(this.options.radius,m),S=Math.max(v*l,0),_=(v-S)/this._getVisibleDatasetWeightTotal();this.offsetX=x*v,this.offsetY=g*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/ve)}updateElements(e,n,s,r){const i=r==="reset",o=this.chart,a=o.chartArea,c=o.options.animation,d=(a.left+a.right)/2,f=(a.top+a.bottom)/2,h=i&&c.animateScale,p=h?0:this.innerRadius,x=h?0:this.outerRadius,{sharedOptions:g,includeOptions:b}=this._getSharedOptions(n,r);let y=this._getRotation(),m;for(m=0;m<n;++m)y+=this._circumference(m,i);for(m=n;m<n+s;++m){const v=this._circumference(m,i),S=e[m],_={x:d+this.offsetX,y:f+this.offsetY,startAngle:y,endAngle:y+v,circumference:v,outerRadius:x,innerRadius:p};b&&(_.options=g||this.resolveDataElementOptions(m,S.active?"active":r)),y+=v,this.updateElement(S,m,_,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)?ve*(Math.abs(e)/n):0}getLabelAndValue(e){const n=this._cachedMeta,s=this.chart,r=s.data.labels||[],i=qf(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(ee(this.chart.data.datasets[e].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}$(Gi,"id","doughnut"),$(Gi,"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"}),$(Gi,"descriptors",{_scriptable:e=>e!=="spacing"&&e!=="spacingMode",_indexable:e=>e!=="spacing"&&e!=="spacingMode"&&!e.startsWith("borderDash")&&!e.startsWith("hoverBorderDash")}),$(Gi,"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 As(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class ih{constructor(e){$(this,"options");this.options=e||{}}static override(e){Object.assign(ih.prototype,e)}init(){}formats(){return As()}parse(){return As()}format(){return As()}add(){return As()}diff(){return As()}startOf(){return As()}endOf(){return As()}}var xC={_date:ih};function yC(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?sk:Td;if(s){if(r._sharedOptions){const d=i[0],f=typeof d.getRange=="function"&&d.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 d=c(i,e,n);if(l){const{vScale:f}=r._cachedMeta,{_parsed:h}=t,p=h.slice(0,d.lo+1).reverse().findIndex(g=>!ue(g[f.axis]));d.lo-=Math.max(0,p);const x=h.slice(d.hi).findIndex(g=>!ue(g[f.axis]));d.hi+=Math.max(0,x)}return d}}return{lo:0,hi:i.length-1}}function bc(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:d}=i[a],{lo:f,hi:h}=yC(i[a],e,o,r);for(let p=f;p<=h;++p){const x=d[p];x.skip||s(x,c,p)}}}function vC(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 pu(t,e,n,s,r){const i=[];return!r&&!t.isPointInArea(e)||bc(t,n,e,function(a,l,c){!r&&!Dy(a,t.chartArea,0)||a.inRange(e.x,e.y,s)&&i.push({element:a,datasetIndex:l,index:c})},!0),i}function bC(t,e,n,s){let r=[];function i(o,a,l){const{startAngle:c,endAngle:d}=o.getProps(["startAngle","endAngle"],s),{angle:f}=ky(o,{x:e.x,y:e.y});$l(f,c,d)&&r.push({element:o,datasetIndex:a,index:l})}return bc(t,n,e,i),r}function wC(t,e,n,s,r,i){let o=[];const a=vC(n);let l=Number.POSITIVE_INFINITY;function c(d,f,h){const p=d.inRange(e.x,e.y,r);if(s&&!p)return;const x=d.getCenterPoint(r);if(!(!!i||t.isPointInArea(x))&&!p)return;const b=a(e,x);b<l?(o=[{element:d,datasetIndex:f,index:h}],l=b):b===l&&o.push({element:d,datasetIndex:f,index:h})}return bc(t,n,e,c),o}function gu(t,e,n,s,r,i){return!i&&!t.isPointInArea(e)?[]:n==="r"&&!s?bC(t,e,n,r):wC(t,e,n,s,r,i)}function Cg(t,e,n,s,r){const i=[],o=n==="x"?"inXRange":"inYRange";let a=!1;return bc(t,n,e,(l,c,d)=>{l[o]&&l[o](e[n],r)&&(i.push({element:l,datasetIndex:c,index:d}),a=a||l.inRange(e.x,e.y,r))}),s&&!a?[]:i}var SC={modes:{index(t,e,n,s){const r=Bs(e,t),i=n.axis||"x",o=n.includeInvisible||!1,a=n.intersect?pu(t,r,i,s,o):gu(t,r,i,!1,s,o),l=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach(c=>{const d=a[0].index,f=c.data[d];f&&!f.skip&&l.push({element:f,datasetIndex:c.index,index:d})}),l):[]},dataset(t,e,n,s){const r=Bs(e,t),i=n.axis||"xy",o=n.includeInvisible||!1;let a=n.intersect?pu(t,r,i,s,o):gu(t,r,i,!1,s,o);if(a.length>0){const l=a[0].datasetIndex,c=t.getDatasetMeta(l).data;a=[];for(let d=0;d<c.length;++d)a.push({element:c[d],datasetIndex:l,index:d})}return a},point(t,e,n,s){const r=Bs(e,t),i=n.axis||"xy",o=n.includeInvisible||!1;return pu(t,r,i,s,o)},nearest(t,e,n,s){const r=Bs(e,t),i=n.axis||"xy",o=n.includeInvisible||!1;return gu(t,r,i,n.intersect,s,o)},x(t,e,n,s){const r=Bs(e,t);return Cg(t,r,"x",n.intersect,s)},y(t,e,n,s){const r=Bs(e,t);return Cg(t,r,"y",n.intersect,s)}}};const Hy=["left","top","right","bottom"];function zi(t,e){return t.filter(n=>n.pos===e)}function jg(t,e){return t.filter(n=>Hy.indexOf(n.pos)===-1&&n.box.axis===e)}function Bi(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 _C(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 kC(t){const e={};for(const n of t){const{stack:s,pos:r,stackWeight:i}=n;if(!s||!Hy.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 CC(t,e){const n=kC(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],d=c&&a.stackWeight/c.weight;a.horizontal?(a.width=d?d*s:l&&e.availableWidth,a.height=r):(a.width=s,a.height=d?d*r:l&&e.availableHeight)}return n}function jC(t){const e=_C(t),n=Bi(e.filter(c=>c.box.fullSize),!0),s=Bi(zi(e,"left"),!0),r=Bi(zi(e,"right")),i=Bi(zi(e,"top"),!0),o=Bi(zi(e,"bottom")),a=jg(e,"x"),l=jg(e,"y");return{fullSize:n,leftAndTop:s.concat(i),rightAndBottom:r.concat(l).concat(o).concat(a),chartArea:zi(e,"chartArea"),vertical:s.concat(r).concat(l),horizontal:i.concat(o).concat(a)}}function Ng(t,e,n,s){return Math.max(t[n],e[n])+Math.max(t[s],e[s])}function Vy(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 NC(t,e,n,s){const{pos:r,box:i}=n,o=t.maxPadding;if(!ne(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&&Vy(o,i.getPadding());const a=Math.max(0,e.outerWidth-Ng(o,t,"left","right")),l=Math.max(0,e.outerHeight-Ng(o,t,"top","bottom")),c=a!==t.w,d=l!==t.h;return t.w=a,t.h=l,n.horizontal?{same:c,other:d}:{same:d,other:c}}function EC(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 MC(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 Ji(t,e,n,s){const r=[];let i,o,a,l,c,d;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,MC(a.horizontal,e));const{same:f,other:h}=NC(e,n,a,s);c|=f&&r.length,d=d||h,l.fullSize||r.push(a)}return c&&Ji(r,e,n,s)||d}function Aa(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 Eg(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},d=a.stackWeight/c.weight||1;if(a.horizontal){const f=e.w*d,h=c.size||l.height;zo(c.start)&&(o=c.start),l.fullSize?Aa(l,r.left,o,n.outerWidth-r.right-r.left,h):Aa(l,e.left+c.placed,o,f,h),c.start=o,c.placed+=f,o=l.bottom}else{const f=e.h*d,h=c.size||l.width;zo(c.start)&&(i=c.start),l.fullSize?Aa(l,i,r.top,h,n.outerHeight-r.bottom-r.top):Aa(l,i,e.top+c.placed,h,f),c.start=i,c.placed+=f,i=l.right}}e.x=i,e.y=o}var us={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=Gt(t.options.layout.padding),i=Math.max(e-r.width,0),o=Math.max(n-r.height,0),a=jC(t.boxes),l=a.vertical,c=a.horizontal;ae(t.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});const d=l.reduce((g,b)=>b.box.options&&b.box.options.display===!1?g:g+1,0)||1,f=Object.freeze({outerWidth:e,outerHeight:n,padding:r,availableWidth:i,availableHeight:o,vBoxMaxWidth:i/2/d,hBoxMaxHeight:o/2}),h=Object.assign({},r);Vy(h,Gt(s));const p=Object.assign({maxPadding:h,w:i,h:o,x:r.left,y:r.top},r),x=CC(l.concat(c),f);Ji(a.fullSize,p,f,x),Ji(l,p,f,x),Ji(c,p,f,x)&&Ji(l,p,f,x),EC(p),Eg(a.leftAndTop,p,f,x),p.x+=p.w,p.y+=p.h,Eg(a.rightAndBottom,p,f,x),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},ae(a.chartArea,g=>{const b=g.box;Object.assign(b,t.chartArea),b.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}};class Qy{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 PC extends Qy{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const il="$chartjs",RC={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Mg=t=>t===null||t==="";function OC(t,e){const n=t.style,s=t.getAttribute("height"),r=t.getAttribute("width");if(t[il]={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",Mg(r)){const i=gg(t,"width");i!==void 0&&(t.width=i)}if(Mg(s))if(t.style.height==="")t.height=t.width/(e||2);else{const i=gg(t,"height");i!==void 0&&(t.height=i)}return t}const Ky=$k?{passive:!0}:!1;function DC(t,e,n){t&&t.addEventListener(e,n,Ky)}function TC(t,e,n){t&&t.canvas&&t.canvas.removeEventListener(e,n,Ky)}function LC(t,e){const n=RC[t.type]||t.type,{x:s,y:r}=Bs(t,e);return{type:n,chart:e,native:t,x:s!==void 0?s:null,y:r!==void 0?r:null}}function Vl(t,e){for(const n of t)if(n===e||n.contains(e))return!0}function AC(t,e,n){const s=t.canvas,r=new MutationObserver(i=>{let o=!1;for(const a of i)o=o||Vl(a.addedNodes,s),o=o&&!Vl(a.removedNodes,s);o&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}function IC(t,e,n){const s=t.canvas,r=new MutationObserver(i=>{let o=!1;for(const a of i)o=o||Vl(a.removedNodes,s),o=o&&!Vl(a.addedNodes,s);o&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}const Bo=new Map;let Pg=0;function Yy(){const t=window.devicePixelRatio;t!==Pg&&(Pg=t,Bo.forEach((e,n)=>{n.currentDevicePixelRatio!==t&&e()}))}function FC(t,e){Bo.size||window.addEventListener("resize",Yy),Bo.set(t,e)}function zC(t){Bo.delete(t),Bo.size||window.removeEventListener("resize",Yy)}function BC(t,e,n){const s=t.canvas,r=s&&rh(s);if(!r)return;const i=Ey((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,d=l.contentRect.height;c===0&&d===0||i(c,d)});return o.observe(r),FC(t,i),o}function mu(t,e,n){n&&n.disconnect(),e==="resize"&&zC(t)}function $C(t,e,n){const s=t.canvas,r=Ey(i=>{t.ctx!==null&&n(LC(i,t))},t);return DC(s,e,r),r}class UC extends Qy{acquireContext(e,n){const s=e&&e.getContext&&e.getContext("2d");return s&&s.canvas===e?(OC(e,n),s):null}releaseContext(e){const n=e.canvas;if(!n[il])return!1;const s=n[il].initial;["height","width"].forEach(i=>{const o=s[i];ue(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[il],!0}addEventListener(e,n,s){this.removeEventListener(e,n);const r=e.$proxies||(e.$proxies={}),o={attach:AC,detach:IC,resize:BC}[n]||$C;r[n]=o(e,n,s)}removeEventListener(e,n){const s=e.$proxies||(e.$proxies={}),r=s[n];if(!r)return;({attach:mu,detach:mu,resize:mu}[n]||TC)(e,n,r),s[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,n,s,r){return Bk(e,n,s,r)}isAttached(e){const n=e&&rh(e);return!!(n&&n.isConnected)}}function WC(t){return!sh()||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas?PC:UC}class Ns{constructor(){$(this,"x");$(this,"y");$(this,"active",!1);$(this,"options");$(this,"$animations")}tooltipPosition(e){const{x:n,y:s}=this.getProps(["x","y"],e);return{x:n,y:s}}hasValue(){return Bl(this.x)&&Bl(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}}$(Ns,"defaults",{}),$(Ns,"defaultRoutes");function HC(t,e){const n=t.options.ticks,s=VC(t),r=Math.min(n.maxTicksLimit||s,s),i=n.major.enabled?KC(e):[],o=i.length,a=i[0],l=i[o-1],c=[];if(o>r)return YC(e,c,i,o/r),c;const d=QC(i,e,r);if(o>0){let f,h;const p=o>1?Math.round((l-a)/(o-1)):null;for(Ia(e,c,d,ue(p)?0:a-p,a),f=0,h=o-1;f<h;f++)Ia(e,c,d,i[f],i[f+1]);return Ia(e,c,d,l,ue(p)?e.length:l+p),c}return Ia(e,c,d),c}function VC(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 QC(t,e,n){const s=XC(t),r=e.length/n;if(!s)return Math.max(r,1);const i=q_(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 KC(t){const e=[];let n,s;for(n=0,s=t.length;n<s;n++)t[n].major&&e.push(n);return e}function YC(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 Ia(t,e,n,s,r){const i=ee(s,0),o=Math.min(ee(r,t.length),t.length);let a=0,l,c,d;for(n=Math.ceil(n),r&&(l=r-s,n=l/Math.floor(l/n)),d=i;d<0;)a++,d=Math.round(i+a*n);for(c=Math.max(i,0);c<o;c++)c===d&&(e.push(t[c]),a++,d=Math.round(i+a*n))}function XC(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 qC=t=>t==="left"?"right":t==="right"?"left":t,Rg=(t,e,n)=>e==="top"||e==="left"?t[e]+n:t[e]-n,Og=(t,e)=>Math.min(e||t,t);function Dg(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 GC(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 JC(t,e){ae(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 $i(t){return t.drawTicks?t.tickLength:0}function Tg(t,e){if(!t.display)return 0;const n=ut(t.font,e),s=Gt(t.padding);return(Fe(t.text)?t.text.length:1)*n.lineHeight+s.height}function ZC(t,e){return bi(t,{scale:e,type:"scale"})}function ej(t,e,n){return bi(t,{tick:n,index:e,type:"tick"})}function tj(t,e,n){let s=My(t);return(n&&e!=="right"||!n&&e==="right")&&(s=qC(s)),s}function nj(t,e,n,s){const{top:r,left:i,bottom:o,right:a,chart:l}=t,{chartArea:c,scales:d}=l;let f=0,h,p,x;const g=o-r,b=a-i;if(t.isHorizontal()){if(p=yt(s,i,a),ne(n)){const y=Object.keys(n)[0],m=n[y];x=d[y].getPixelForValue(m)+g-e}else n==="center"?x=(c.bottom+c.top)/2+g-e:x=Rg(t,n,e);h=a-i}else{if(ne(n)){const y=Object.keys(n)[0],m=n[y];p=d[y].getPixelForValue(m)-b+e}else n==="center"?p=(c.left+c.right)/2-b+e:p=Rg(t,n,e);x=yt(s,o,r),f=n==="left"?-Le:Le}return{titleX:p,titleY:x,maxWidth:h,rotation:f}}class wi extends Ns{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=on(e,Number.POSITIVE_INFINITY),n=on(n,Number.NEGATIVE_INFINITY),s=on(s,Number.POSITIVE_INFINITY),r=on(r,Number.NEGATIVE_INFINITY),{min:on(e,s),max:on(n,r),minDefined:Ft(e),maxDefined:Ft(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:on(n,on(s,n)),max:on(s,on(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(){he(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=Ck(this,i,r),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?Dg(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||o.source==="auto")&&(this.ticks=HC(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(){he(this.options.afterUpdate,[this])}beforeSetDimensions(){he(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(){he(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),he(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){he(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=he(n.callback,[i.value,s,e],this)}afterTickToLabelConversion(){he(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){he(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,n=e.ticks,s=Og(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 d=this._getLabelSizes(),f=d.widest.width,h=d.highest.height,p=ct(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-$i(e.grid)-n.padding-Tg(e.title,this.chart.options.font),c=Math.sqrt(f*f+h*h),o=ek(Math.min(Math.asin(ct((d.highest.height+6)/a,-1,1)),Math.asin(ct(l/c,-1,1))-Math.asin(ct(h/c,-1,1)))),o=Math.max(r,Math.min(i,o))),this.labelRotation=o}afterCalculateLabelRotation(){he(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){he(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=Tg(r,n.options.font);if(a?(e.width=this.maxWidth,e.height=$i(i)+l):(e.height=this.maxHeight,e.width=$i(i)+l),s.display&&this.ticks.length){const{first:c,last:d,widest:f,highest:h}=this._getLabelSizes(),p=s.padding*2,x=Pn(this.labelRotation),g=Math.cos(x),b=Math.sin(x);if(a){const y=s.mirror?0:b*f.width+g*h.height;e.height=Math.min(this.maxHeight,e.height+y+p)}else{const y=s.mirror?0:g*f.width+b*h.height;e.width=Math.min(this.maxWidth,e.width+y+p)}this._calculatePadding(c,d,b,g)}}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 d=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-d+o)*this.width/(this.width-d),0),this.paddingRight=Math.max((p-f+o)*this.width/(this.width-f),0)}else{let d=n.height/2,f=e.height/2;i==="start"?(d=0,f=e.height):i==="end"&&(d=n.height,f=0),this.paddingTop=d+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(){he(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++)ue(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=Dg(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/Og(n,s));let c=0,d=0,f,h,p,x,g,b,y,m,v,S,_;for(f=0;f<n;f+=l){if(x=e[f].label,g=this._resolveTickFontOptions(f),r.font=b=g.string,y=i[b]=i[b]||{data:{},gc:[]},m=g.lineHeight,v=S=0,!ue(x)&&!Fe(x))v=cg(r,y.data,y.gc,v,x),S=m;else if(Fe(x))for(h=0,p=x.length;h<p;++h)_=x[h],!ue(_)&&!Fe(_)&&(v=cg(r,y.data,y.gc,v,_),S+=m);o.push(v),a.push(S),c=Math.max(v,c),d=Math.max(S,d)}JC(i,n);const k=o.indexOf(c),C=a.indexOf(d),N=P=>({width:o[P]||0,height:a[P]||0});return{first:N(0),last:N(n-1),widest:N(k),highest:N(C),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 nk(this._alignToPixels?Ls(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=ej(this.getContext(),e,s))}return this.$context||(this.$context=ZC(this.chart.getContext(),this))}_tickSize(){const e=this.options.ticks,n=Pn(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=$i(i),p=[],x=a.setContext(this.getContext()),g=x.display?x.width:0,b=g/2,y=function(oe){return Ls(s,oe,g)};let m,v,S,_,k,C,N,P,M,O,E,F;if(o==="top")m=y(this.bottom),C=this.bottom-h,P=m-b,O=y(e.top)+b,F=e.bottom;else if(o==="bottom")m=y(this.top),O=e.top,F=y(e.bottom)-b,C=m+b,P=this.top+h;else if(o==="left")m=y(this.right),k=this.right-h,N=m-b,M=y(e.left)+b,E=e.right;else if(o==="right")m=y(this.left),M=e.left,E=y(e.right)-b,k=m+b,N=this.left+h;else if(n==="x"){if(o==="center")m=y((e.top+e.bottom)/2+.5);else if(ne(o)){const oe=Object.keys(o)[0],J=o[oe];m=y(this.chart.scales[oe].getPixelForValue(J))}O=e.top,F=e.bottom,C=m+b,P=C+h}else if(n==="y"){if(o==="center")m=y((e.left+e.right)/2);else if(ne(o)){const oe=Object.keys(o)[0],J=o[oe];m=y(this.chart.scales[oe].getPixelForValue(J))}k=m-b,N=k-h,M=e.left,E=e.right}const U=ee(r.ticks.maxTicksLimit,f),V=Math.max(1,Math.ceil(f/U));for(v=0;v<f;v+=V){const oe=this.getContext(v),J=i.setContext(oe),D=a.setContext(oe),A=J.lineWidth,I=J.color,K=D.dash||[],z=D.dashOffset,ce=J.tickWidth,Q=J.tickColor,ke=J.tickBorderDash||[],Z=J.tickBorderDashOffset;S=GC(this,v,l),S!==void 0&&(_=Ls(s,S,A),c?k=N=M=E=_:C=P=O=F=_,p.push({tx1:k,ty1:C,tx2:N,ty2:P,x1:M,y1:O,x2:E,y2:F,width:A,color:I,borderDash:K,borderDashOffset:z,tickWidth:ce,tickColor:Q,tickBorderDash:ke,tickBorderDashOffset:Z}))}return this._ticksLength=f,this._borderValue=m,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:d,mirror:f}=i,h=$i(s.grid),p=h+d,x=f?-d:p,g=-Pn(this.labelRotation),b=[];let y,m,v,S,_,k,C,N,P,M,O,E,F="middle";if(r==="top")k=this.bottom-x,C=this._getXAxisLabelAlignment();else if(r==="bottom")k=this.top+x,C=this._getXAxisLabelAlignment();else if(r==="left"){const V=this._getYAxisLabelAlignment(h);C=V.textAlign,_=V.x}else if(r==="right"){const V=this._getYAxisLabelAlignment(h);C=V.textAlign,_=V.x}else if(n==="x"){if(r==="center")k=(e.top+e.bottom)/2+p;else if(ne(r)){const V=Object.keys(r)[0],oe=r[V];k=this.chart.scales[V].getPixelForValue(oe)+p}C=this._getXAxisLabelAlignment()}else if(n==="y"){if(r==="center")_=(e.left+e.right)/2-p;else if(ne(r)){const V=Object.keys(r)[0],oe=r[V];_=this.chart.scales[V].getPixelForValue(oe)}C=this._getYAxisLabelAlignment(h).textAlign}n==="y"&&(l==="start"?F="top":l==="end"&&(F="bottom"));const U=this._getLabelSizes();for(y=0,m=a.length;y<m;++y){v=a[y],S=v.label;const V=i.setContext(this.getContext(y));N=this.getPixelForTick(y)+i.labelOffset,P=this._resolveTickFontOptions(y),M=P.lineHeight,O=Fe(S)?S.length:1;const oe=O/2,J=V.color,D=V.textStrokeColor,A=V.textStrokeWidth;let I=C;o?(_=N,C==="inner"&&(y===m-1?I=this.options.reverse?"left":"right":y===0?I=this.options.reverse?"right":"left":I="center"),r==="top"?c==="near"||g!==0?E=-O*M+M/2:c==="center"?E=-U.highest.height/2-oe*M+M:E=-U.highest.height+M/2:c==="near"||g!==0?E=M/2:c==="center"?E=U.highest.height/2-oe*M:E=U.highest.height-O*M,f&&(E*=-1),g!==0&&!V.showLabelBackdrop&&(_+=M/2*Math.sin(g))):(k=N,E=(1-O)*M/2);let K;if(V.showLabelBackdrop){const z=Gt(V.backdropPadding),ce=U.heights[y],Q=U.widths[y];let ke=E-z.top,Z=0-z.left;switch(F){case"middle":ke-=ce/2;break;case"bottom":ke-=ce;break}switch(C){case"center":Z-=Q/2;break;case"right":Z-=Q;break;case"inner":y===m-1?Z-=Q:y>0&&(Z-=Q/2);break}K={left:Z,top:ke,width:Q+z.width,height:ce+z.height,color:V.backdropColor}}b.push({label:S,font:P,textOffset:E,options:{rotation:g,color:J,strokeColor:D,strokeWidth:A,textAlign:I,textBaseline:F,translation:[_,k],backdrop:K}})}return b}_getXAxisLabelAlignment(){const{position:e,ticks:n}=this.options;if(-Pn(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,d;return n==="left"?r?(d=this.right+i,s==="near"?c="left":s==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-a,s==="near"?c="right":s==="center"?(c="center",d-=l/2):(c="left",d=this.left)):n==="right"?r?(d=this.left+i,s==="near"?c="right":s==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+a,s==="near"?c="left":s==="center"?(c="center",d+=l/2):(c="right",d=this.right)):c="right",{textAlign:c,x:d}}_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,d)=>{!d.width||!d.color||(s.save(),s.lineWidth=d.width,s.strokeStyle=d.color,s.setLineDash(d.borderDash||[]),s.lineDashOffset=d.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,d,f,h;this.isHorizontal()?(c=Ls(e,this.left,o)-o/2,d=Ls(e,this.right,a)+a/2,f=h=l):(f=Ls(e,this.top,o)-o/2,h=Ls(e,this.bottom,a)+a/2,c=d=l),n.save(),n.lineWidth=i.width,n.strokeStyle=i.color,n.beginPath(),n.moveTo(c,f),n.lineTo(d,h),n.stroke(),n.restore()}drawLabels(e){if(!this.options.ticks.display)return;const s=this.ctx,r=this._computeLabelArea();r&&Gf(s,r);const i=this.getLabelItems(e);for(const o of i){const a=o.options,l=o.font,c=o.label,d=o.textOffset;Ul(s,c,0,d,l,a)}r&&Jf(s)}drawTitle(){const{ctx:e,options:{position:n,title:s,reverse:r}}=this;if(!s.display)return;const i=ut(s.font),o=Gt(s.padding),a=s.align;let l=i.lineHeight/2;n==="bottom"||n==="center"||ne(n)?(l+=o.bottom,Fe(s.text)&&(l+=i.lineHeight*(s.text.length-1))):l+=o.top;const{titleX:c,titleY:d,maxWidth:f,rotation:h}=nj(this,l,n,a);Ul(e,s.text,0,0,i,{color:s.color,maxWidth:f,rotation:h,textAlign:tj(a,n,r),textBaseline:"middle",translation:[c,d],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=ee(e.grid&&e.grid.z,-1),r=ee(e.border&&e.border.z,0);return!this._isVisible()||this.draw!==wi.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 ut(n.font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class Fa{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;ij(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,sj(e,o,s),this.override&&Ee.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 Ee[r]&&(delete Ee[r][s],this.override&&delete ur[s])}}function sj(t,e,n){const s=Fo(Object.create(null),[n?Ee.get(n):{},Ee.get(e),t.defaults]);Ee.set(e,s),t.defaultRoutes&&rj(e,t.defaultRoutes),t.descriptors&&Ee.describe(e,t.descriptors)}function rj(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(".");Ee.route(i,r,l,a)})}function ij(t){return"id"in t&&"defaults"in t}class oj{constructor(){this.controllers=new Fa(Vr,"datasets",!0),this.elements=new Fa(Ns,"elements"),this.plugins=new Fa(Object,"plugins"),this.scales=new Fa(wi,"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):ae(r,o=>{const a=s||this._getRegistryForType(o);this._exec(e,a,o)})})}_exec(e,n,s){const r=Yf(e);he(s["before"+r],[],s),n[e](s),he(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 un=new oj;class aj{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(he(a,l,o)===!1&&r.cancelable)return!1}return!0}invalidate(){ue(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=ee(s.options&&s.options.plugins,{}),i=lj(s);return r===!1&&!n?[]:uj(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 lj(t){const e={},n=[],s=Object.keys(un.plugins.items);for(let i=0;i<s.length;i++)n.push(un.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 cj(t,e){return!e&&t===!1?null:t===!0?{}:t}function uj(t,{plugins:e,localIds:n},s,r){const i=[],o=t.getContext();for(const a of e){const l=a.id,c=cj(s[l],r);c!==null&&i.push({plugin:a,options:dj(t.config,{plugin:a,local:n[l]},c,o)})}return i}function dj(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 Ad(t,e){const n=Ee.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||n.indexAxis||"x"}function fj(t,e){let n=t;return t==="_index_"?n=e:t==="_value_"&&(n=e==="x"?"y":"x"),n}function hj(t,e){return t===e?"_index_":"_value_"}function Lg(t){if(t==="x"||t==="y"||t==="r")return t}function pj(t){if(t==="top"||t==="bottom")return"x";if(t==="left"||t==="right")return"y"}function Id(t,...e){if(Lg(t))return t;for(const n of e){const s=n.axis||pj(n.position)||t.length>1&&Lg(t[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function Ag(t,e,n){if(n[e+"AxisID"]===t)return{axis:e}}function gj(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 Ag(t,"x",n[0])||Ag(t,"y",n[0])}return{}}function mj(t,e){const n=ur[t.type]||{scales:{}},s=e.scales||{},r=Ad(t.type,e),i=Object.create(null);return Object.keys(s).forEach(o=>{const a=s[o];if(!ne(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=Id(o,a,gj(o,t),Ee.scales[a.type]),c=hj(l,r),d=n.scales||{};i[o]=uo(Object.create(null),[{axis:l},a,d[l],d[c]])}),t.data.datasets.forEach(o=>{const a=o.type||t.type,l=o.indexAxis||Ad(a,e),d=(ur[a]||{}).scales||{};Object.keys(d).forEach(f=>{const h=fj(f,l),p=o[h+"AxisID"]||h;i[p]=i[p]||Object.create(null),uo(i[p],[{axis:h},s[p],d[f]])})}),Object.keys(i).forEach(o=>{const a=i[o];uo(a,[Ee.scales[a.type],Ee.scale])}),i}function Xy(t){const e=t.options||(t.options={});e.plugins=ee(e.plugins,{}),e.scales=mj(t,e)}function qy(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function xj(t){return t=t||{},t.data=qy(t.data),Xy(t),t}const Ig=new Map,Gy=new Set;function za(t,e){let n=Ig.get(t);return n||(n=e(),Ig.set(t,n),Gy.add(n)),n}const Ui=(t,e,n)=>{const s=cr(e,n);s!==void 0&&t.add(s)};class yj{constructor(e){this._config=xj(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=qy(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(),Xy(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return za(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,n){return za(`${e}.transition.${n}`,()=>[[`datasets.${e}.transitions.${n}`,`transitions.${n}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,n){return za(`${e}-${n}`,()=>[[`datasets.${e}.elements.${n}`,`datasets.${e}`,`elements.${n}`,""]])}pluginScopeKeys(e){const n=e.id,s=this.type;return za(`${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(d=>{e&&(l.add(e),d.forEach(f=>Ui(l,e,f))),d.forEach(f=>Ui(l,r,f)),d.forEach(f=>Ui(l,ur[i]||{},f)),d.forEach(f=>Ui(l,Ee,f)),d.forEach(f=>Ui(l,Ld,f))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Gy.has(n)&&o.set(n,c),c}chartOptionScopes(){const{options:e,type:n}=this;return[e,ur[n]||{},Ee.datasets[n]||{},{type:n},Ee,Ld]}resolveNamedOptions(e,n,s,r=[""]){const i={$shared:!0},{resolver:o,subPrefixes:a}=Fg(this._resolverCache,e,r);let l=o;if(bj(o,n)){i.$shared=!1,s=js(s)?s():s;const c=this.createResolver(e,s,a);l=gi(o,s,c)}for(const c of n)i[c]=l[c];return i}createResolver(e,n,s=[""],r){const{resolver:i}=Fg(this._resolverCache,e,s);return ne(n)?gi(i,n,void 0,r):i}}function Fg(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:eh(e,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},s.set(r,i)),i}const vj=t=>ne(t)&&Object.getOwnPropertyNames(t).some(e=>js(t[e]));function bj(t,e){const{isScriptable:n,isIndexable:s}=Ly(t);for(const r of e){const i=n(r),o=s(r),a=(o||i)&&t[r];if(i&&(js(a)||vj(a))||o&&Fe(a))return!0}return!1}var wj="4.6.1";const Sj=["top","bottom","left","right","chartArea"];function zg(t,e){return t==="top"||t==="bottom"||Sj.indexOf(t)===-1&&e==="x"}function Bg(t,e){return function(n,s){return n[t]===s[t]?n[e]-s[e]:n[t]-s[t]}}function $g(t){const e=t.chart,n=e.options.animation;e.notifyPlugins("afterRender"),he(n&&n.onComplete,[t],e)}function _j(t){const e=t.chart,n=e.options.animation;he(n&&n.onProgress,[t],e)}function Jy(t){return sh()&&typeof t=="string"?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const ol={},Ug=t=>{const e=Jy(t);return Object.values(ol).filter(n=>n.canvas===e).pop()};function kj(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 Cj(t,e,n,s){return!n||t.type==="mouseout"?null:s?e:t}var Hn;let wc=(Hn=class{static register(...e){un.add(...e),Wg()}static unregister(...e){un.remove(...e),Wg()}constructor(e,n){const s=this.config=new yj(n),r=Jy(e),i=Ug(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||WC(r)),this.platform.updateConfig(s);const a=this.platform.acquireContext(r,o.aspectRatio),l=a&&a.canvas,c=l&&l.height,d=l&&l.width;if(this.id=U_(),this.ctx=a,this.canvas=l,this.width=d,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 aj,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=ok(f=>this.update(f),o.resizeDelay||0),this._dataChanges=[],ol[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Sn.listen(this,"complete",$g),Sn.listen(this,"progress",_j),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:n},width:s,height:r,_aspectRatio:i}=this;return ue(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 un}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():pg(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return ug(this.canvas,this.ctx),this}stop(){return Sn.stop(this),this}resize(e,n){Sn.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,pg(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),he(s.onResize,[this,o],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};ae(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=Id(o,a),c=l==="r",d=l==="x";return{options:a,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),ae(i,o=>{const a=o.options,l=a.id,c=Id(l,a),d=ee(a.type,o.dtype);(a.position===void 0||zg(a.position,c)!==zg(o.dposition))&&(a.position=o.dposition),r[l]=!0;let f=null;if(l in s&&s[l].type===d)f=s[l];else{const h=un.getScale(d);f=new h({id:l,type:d,ctx:this.ctx,chart:this}),s[f.id]=f}f.init(a,e)}),ae(r,(o,a)=>{o||delete s[a]}),ae(s,o=>{us.configure(this,o,o.options),us.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(Bg("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||Ad(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=un.getController(a),{datasetElementType:c,dataElementType:d}=Ee.datasets[a];Object.assign(l,{dataElementType:un.getElement(d),datasetElementType:c&&un.getElement(c)}),o.controller=new l(this,s),e.push(o.controller)}}return this._updateMetasets(),e}_resetElements(){ae(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,d=this.data.datasets.length;c<d;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||ae(i,c=>{c.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(Bg("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){ae(this.scales,e=>{us.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,n=new Set(Object.keys(this._listeners)),s=new Set(e.events);(!eg(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;kj(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(!eg(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;us.update(this,this.width,this.height,e);const n=this.chartArea,s=n.width<=0||n.height<=0;this._layers=[],ae(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,js(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&&(Sn.has(this)?this.attached&&!Sn.running(this)&&Sn.start(this):(this.draw(),$g({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=Vk(this,e);this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(r&&Gf(n,r),e.controller.draw(),r&&Jf(n),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(e){return Dy(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,n,s,r){const i=SC.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=bi(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);zo(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(),Sn.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(),ug(e,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete ol[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)};ae(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(){ae(this._listeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._listeners={},ae(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}});!Il(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(d=>!c.some(f=>d.datasetIndex===f.datasetIndex&&d.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=Y_(e),c=Cj(e,this._lastEvent,s,l);s&&(this._lastEvent=null,he(i.onHover,[e,a,this],this),l&&he(i.onClick,[e,a,this],this));const d=!Il(a,r);return(d||n)&&(this._active=a,this._updateHoverStyles(a,r,n)),this._lastEvent=c,d}_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)}},$(Hn,"defaults",Ee),$(Hn,"instances",ol),$(Hn,"overrides",ur),$(Hn,"registry",un),$(Hn,"version",wj),$(Hn,"getChart",Ug),Hn);function Wg(){return ae(wc.instances,t=>t._plugins.invalidate())}function jj(t,e,n){const{startAngle:s,x:r,y:i,outerRadius:o,innerRadius:a,options:l}=e,{borderWidth:c,borderJoinStyle:d}=l,f=Math.min(c/o,dn(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,dn(s-n));t.arc(r,i,a+c/2,n-h/2,s+h/2,!0)}else{const h=Math.min(c/2,o*dn(s-n));if(d==="round")t.arc(r,i,h,n-ge/2,s+ge/2,!0);else if(d==="bevel"){const p=2*h*h,x=-p*Math.cos(n+ge/2)+r,g=-p*Math.sin(n+ge/2)+i,b=p*Math.cos(s+ge/2)+r,y=p*Math.sin(s+ge/2)+i;t.lineTo(x,g),t.lineTo(b,y)}}t.closePath(),t.moveTo(0,0),t.rect(0,0,t.canvas.width,t.canvas.height),t.clip("evenodd")}function Nj(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+Le,s-Le),t.closePath(),t.clip()}function Ej(t){return Zf(t,["outerStart","outerEnd","innerStart","innerEnd"])}function Mj(t,e,n,s){const r=Ej(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 ct(l,0,Math.min(i,c))};return{outerStart:a(r.outerStart),outerEnd:a(r.outerEnd),innerStart:ct(r.innerStart,0,o),innerEnd:ct(r.innerEnd,0,o)}}function Sr(t,e,n,s){return{x:n+t*Math.cos(e),y:s+t*Math.sin(e)}}function Pj(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),d=l>0?l+s+n+a:0;t.beginPath(),t.arc(r,i,c,o,o+ve),d>0&&(t.moveTo(r+Math.cos(o)*d,i+Math.sin(o)*d),t.arc(r,i,d,o+ve,o,!0)),t.closePath()}function Ql(t,e,n,s,r,i){const{x:o,y:a,startAngle:l,pixelMargin:c,innerRadius:d}=e,{spacingMode:f="angular"}=e.options,h=r-l;if(i&&e.options.selfJoin&&Math.abs(h)>=ve-1e-4){Pj(t,e,n,s);return}const p=Math.max(e.outerRadius+s+n-c,0);let x=d>0?d+s+n+c:0,g=0,b=0;const y=p>0?Math.max(.001,h*p-n/ge)/p:.001,m=(h-y)/2;if(s){const I=d>0?d-s:0,K=p>0?p-s:0,z=(I+K)/2,ce=(()=>{const pt=z!==0?h*z/(z+s):h;return(h-pt)/2})(),Q=z>0?Math.asin(Math.min(1,s/z)):0,ke=Math.max(0,y/2-.001),Z=Math.sin(ke);if(f==="parallel"){if(x===0&&Z>0){const Bt=s/Z,ie=Math.max(0,p-.001);x=Math.min(Bt,ie)}const pt=Math.min(p>0?p*Z:Number.POSITIVE_INFINITY,x>0?x*Z:Number.POSITIVE_INFINITY),zt=Math.min(s,pt);g=p>0?Math.asin(Math.min(1,zt/p)):Math.min(ke,Q),b=x>0?Math.asin(Math.min(1,zt/x)):g}else f==="proportional"?(g=Math.min(ke,ce),b=Math.min(ke,ce)):(g=Math.min(ke,Q),b=Math.min(ke,Q))}const v=l+m+g,S=r-m-g,_=l+m+b,k=r-m-b,C=Math.min(S-v,k-_),{outerStart:N,outerEnd:P,innerStart:M,innerEnd:O}=Mj(e,x,p,C),E=p-N,F=p-P,U=v+N/E,V=S-P/F,oe=x+M,J=x+O,D=_+M/oe,A=k-O/J;if(t.beginPath(),i){const I=(U+V)/2;if(t.arc(o,a,p,U,I),t.arc(o,a,p,I,V),P>0){const Q=Sr(F,V,o,a);t.arc(Q.x,Q.y,P,V,S+Le)}const K=Sr(J,k,o,a);if(t.lineTo(K.x,K.y),O>0){const Q=Sr(J,A,o,a);t.arc(Q.x,Q.y,O,k+Le,A+Math.PI)}const z=(k-O/x+(_+M/x))/2;if(t.arc(o,a,x,k-O/x,z,!0),t.arc(o,a,x,z,_+M/x,!0),M>0){const Q=Sr(oe,D,o,a);t.arc(Q.x,Q.y,M,D+Math.PI,_-Le)}const ce=Sr(E,v,o,a);if(t.lineTo(ce.x,ce.y),N>0){const Q=Sr(E,U,o,a);t.arc(Q.x,Q.y,N,v-Le,U)}}else{t.moveTo(o,a);const I=Math.cos(U)*p+o,K=Math.sin(U)*p+a;t.lineTo(I,K);const z=Math.cos(V)*p+o,ce=Math.sin(V)*p+a;t.lineTo(z,ce)}t.closePath()}function Rj(t,e,n,s,r){const{fullCircles:i,startAngle:o,circumference:a}=e;let l=e.endAngle;if(i){Ql(t,e,n,s,l,r);for(let c=0;c<i;++c)t.fill();isNaN(a)||(l=o+(a%ve||ve))}return Ql(t,e,n,s,l,r),t.fill(),l}function Oj(t,e,n,s,r){const{fullCircles:i,startAngle:o,circumference:a,options:l}=e,{borderWidth:c,borderJoinStyle:d,borderDash:f,borderDashOffset:h,borderRadius:p}=l,x=l.borderAlign==="inner";if(!c)return;t.setLineDash(f||[]),t.lineDashOffset=h,x?(t.lineWidth=c*2,t.lineJoin=d||"round"):(t.lineWidth=c,t.lineJoin=d||"bevel");let g=e.endAngle;const b=Math.abs(g-o)>=ve-1e-4;if(i){Ql(t,e,n,s,g,r);for(let m=0;m<i;++m)t.stroke();isNaN(a)||(g=o+(a%ve||ve))}x&&Nj(t,e,g),!(b&&e.innerRadius>0)&&l.selfJoin&&g-o>=ge&&p===0&&d!=="miter"&&jj(t,e,g),i||(Ql(t,e,n,s,g,r),t.stroke())}class Zi extends Ns{constructor(n){super();$(this,"circumference");$(this,"endAngle");$(this,"fullCircles");$(this,"innerRadius");$(this,"outerRadius");$(this,"pixelMargin");$(this,"startAngle");$(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}=ky(i,{x:n,y:s}),{startAngle:l,endAngle:c,innerRadius:d,outerRadius:f,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],r),p=(this.options.spacing+this.options.borderWidth)/2,x=ee(h,c-l),g=$l(o,l,c)&&l!==c,b=x>=ve||g,y=Vs(a,d+p,f+p);return b&&y}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:d}=this.options,f=(i+o)/2,h=(a+l+d+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>ve?Math.floor(r/ve):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(ge,r||0)),d=i*c;n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,Rj(n,this,d,o,a),Oj(n,this,d,o,a),n.restore()}}$(Zi,"id","arc"),$(Zi,"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}),$(Zi,"defaultRoutes",{backgroundColor:"backgroundColor"}),$(Zi,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function Zy(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,d,f;return t.horizontal?(f=o/2,a=Math.min(n,r),l=Math.max(n,r),c=s-f,d=s+f):(f=i/2,a=n-f,l=n+f,c=Math.min(s,r),d=Math.max(s,r)),{left:a,top:c,right:l,bottom:d}}function ds(t,e,n,s){return t?0:ct(e,n,s)}function Dj(t,e,n){const s=t.options.borderWidth,r=t.borderSkipped,i=Ty(s);return{t:ds(r.top,i.top,0,n),r:ds(r.right,i.right,0,e),b:ds(r.bottom,i.bottom,0,n),l:ds(r.left,i.left,0,e)}}function Tj(t,e,n){const{enableBorderRadius:s}=t.getProps(["enableBorderRadius"]),r=t.options.borderRadius,i=Wr(r),o=Math.min(e,n),a=t.borderSkipped,l=s||ne(r);return{topLeft:ds(!l||a.top||a.left,i.topLeft,0,o),topRight:ds(!l||a.top||a.right,i.topRight,0,o),bottomLeft:ds(!l||a.bottom||a.left,i.bottomLeft,0,o),bottomRight:ds(!l||a.bottom||a.right,i.bottomRight,0,o)}}function Lj(t){const e=Zy(t),n=e.right-e.left,s=e.bottom-e.top,r=Dj(t,n/2,s/2),i=Tj(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 xu(t,e,n,s){const r=e===null,i=n===null,a=t&&!(r&&i)&&Zy(t,s);return a&&(r||Vs(e,a.left,a.right))&&(i||Vs(n,a.top,a.bottom))}function Aj(t){return t.topLeft||t.topRight||t.bottomLeft||t.bottomRight}function Ij(t,e){t.rect(e.x,e.y,e.w,e.h)}function yu(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 al extends Ns{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}=Lj(this),a=Aj(o.radius)?Wl:Ij;e.save(),(o.w!==i.w||o.h!==i.h)&&(e.beginPath(),a(e,yu(o,n,i)),e.clip(),a(e,yu(i,-n,o)),e.fillStyle=s,e.fill("evenodd")),e.beginPath(),a(e,yu(i,n)),e.fillStyle=r,e.fill(),e.restore()}inRange(e,n,s){return xu(this,e,n,s)}inXRange(e,n){return xu(this,e,null,n)}inYRange(e,n){return xu(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}}$(al,"id","bar"),$(al,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),$(al,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});const Hg=(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)}},Fj=(t,e)=>t!==null&&e!==null&&t.datasetIndex===e.datasetIndex&&t.index===e.index;class Vg extends Ns{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=he(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=ut(s.font),i=r.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Hg(s,i);let c,d;n.font=r.string,this.isHorizontal()?(c=this.maxWidth,d=this._fitRows(o,i,a,l)+10):(d=this.maxHeight,c=this._fitCols(o,r,a,l)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(d,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],d=r+a;let f=e;i.textAlign="left",i.textBaseline="middle";let h=-1,p=-d;return this.legendItems.forEach((x,g)=>{const b=s+n/2+i.measureText(x.text).width;(g===0||c[c.length-1]+b+2*a>o)&&(f+=d,c[c.length-(g>0?0:1)]=0,p+=d,h++),l[g]={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=[],d=o-e;let f=a,h=0,p=0,x=0,g=0;return this.legendItems.forEach((b,y)=>{const{itemWidth:m,itemHeight:v}=zj(s,n,i,b,r);y>0&&p+v+2*a>d&&(f+=h+a,c.push({width:h,height:p}),x+=h+a,g++,h=p=0),l[y]={left:x,top:p,col:g,width:m,height:v},h=Math.max(h,m),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=Hr(i,this.left,this.width);if(this.isHorizontal()){let a=0,l=yt(s,this.left+r,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=yt(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=yt(s,this.top+e+r,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=yt(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;Gf(e,this),this._draw(),Jf(e)}}_draw(){const{options:e,columnSizes:n,lineWidths:s,ctx:r}=this,{align:i,labels:o}=e,a=Ee.color,l=Hr(e.rtl,this.left,this.width),c=ut(o.font),{padding:d}=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:x,boxHeight:g,itemHeight:b}=Hg(o,f),y=function(k,C,N){if(isNaN(x)||x<=0||isNaN(g)||g<0)return;r.save();const P=ee(N.lineWidth,1);if(r.fillStyle=ee(N.fillStyle,a),r.lineCap=ee(N.lineCap,"butt"),r.lineDashOffset=ee(N.lineDashOffset,0),r.lineJoin=ee(N.lineJoin,"miter"),r.lineWidth=P,r.strokeStyle=ee(N.strokeStyle,a),r.setLineDash(ee(N.lineDash,[])),o.usePointStyle){const M={radius:g*Math.SQRT2/2,pointStyle:N.pointStyle,rotation:N.rotation,borderWidth:P},O=l.xPlus(k,x/2),E=C+h;Oy(r,M,O,E,o.pointStyleWidth&&x)}else{const M=C+Math.max((f-g)/2,0),O=l.leftForLtr(k,x),E=Wr(N.borderRadius);r.beginPath(),Object.values(E).some(F=>F!==0)?Wl(r,{x:O,y:M,w:x,h:g,radius:E}):r.rect(O,M,x,g),r.fill(),P!==0&&r.stroke()}r.restore()},m=function(k,C,N){Ul(r,N.text,k,C+b/2,c,{strikethrough:N.hidden,textAlign:l.textAlign(N.textAlign)})},v=this.isHorizontal(),S=this._computeTitleHeight();v?p={x:yt(i,this.left+d,this.right-s[0]),y:this.top+d+S,line:0}:p={x:this.left+d,y:yt(i,this.top+S+d,this.bottom-n[0].height),line:0},zy(this.ctx,e.textDirection);const _=b+d;this.legendItems.forEach((k,C)=>{r.strokeStyle=k.fontColor,r.fillStyle=k.fontColor;const N=r.measureText(k.text).width,P=l.textAlign(k.textAlign||(k.textAlign=o.textAlign)),M=x+h+N;let O=p.x,E=p.y;l.setWidth(this.width),v?C>0&&O+M+d>this.right&&(E=p.y+=_,p.line++,O=p.x=yt(i,this.left+d,this.right-s[p.line])):C>0&&E+_>this.bottom&&(O=p.x=O+n[p.line].width+d,p.line++,E=p.y=yt(i,this.top+S+d,this.bottom-n[p.line].height));const F=l.x(O);if(y(F,E,k),O=ak(P,O+x+h,v?O+M:this.right,e.rtl),m(l.x(O),E,k),v)p.x+=M+d;else if(typeof k.text!="string"){const U=c.lineHeight;p.y+=ev(k,U)+d}else p.y+=_}),By(this.ctx,e.textDirection)}drawTitle(){const e=this.options,n=e.title,s=ut(n.font),r=Gt(n.padding);if(!n.display)return;const i=Hr(e.rtl,this.left,this.width),o=this.ctx,a=n.position,l=s.size/2,c=r.top+l;let d,f=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),d=this.top+c,f=yt(e.align,f,this.right-h);else{const x=this.columnSizes.reduce((g,b)=>Math.max(g,b.height),0);d=c+yt(e.align,this.top,this.bottom-x-e.labels.padding-this._computeTitleHeight())}const p=yt(a,f,f+h);o.textAlign=i.textAlign(My(a)),o.textBaseline="middle",o.strokeStyle=n.color,o.fillStyle=n.color,o.font=s.string,Ul(o,n.text,p,d,s)}_computeTitleHeight(){const e=this.options.title,n=ut(e.font),s=Gt(e.padding);return e.display?n.lineHeight+s.height:0}_getLegendItemAt(e,n){let s,r,i;if(Vs(e,this.left,this.right)&&Vs(n,this.top,this.bottom)){for(i=this.legendHitBoxes,s=0;s<i.length;++s)if(r=i[s],Vs(e,r.left,r.left+r.width)&&Vs(n,r.top,r.top+r.height))return this.legendItems[s]}return null}handleEvent(e){const n=this.options;if(!Uj(e.type,n))return;const s=this._getLegendItemAt(e.x,e.y);if(e.type==="mousemove"||e.type==="mouseout"){const r=this._hoveredItem,i=Fj(r,s);r&&!i&&he(n.onLeave,[e,r,this],this),this._hoveredItem=s,s&&!i&&he(n.onHover,[e,s,this],this)}else s&&he(n.onClick,[e,s,this],this)}}function zj(t,e,n,s,r){const i=Bj(s,t,e,n),o=$j(r,s,e.lineHeight);return{itemWidth:i,itemHeight:o}}function Bj(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 $j(t,e,n){let s=t;return typeof e.text!="string"&&(s=ev(e,n)),s}function ev(t,e){const n=t.text?t.text.length:0;return e*n}function Uj(t,e){return!!((t==="mousemove"||t==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(t==="click"||t==="mouseup"))}var Wj={id:"legend",_element:Vg,start(t,e,n){const s=t.legend=new Vg({ctx:t.ctx,options:n,chart:t});us.configure(t,s,n),us.addBox(t,s)},stop(t){us.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,n){const s=t.legend;us.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),d=Gt(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:(d.width+d.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 eo={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(),d=tk(e,c);d<r&&(r=d,a=l)}}if(a){const l=a.tooltipPosition();n=l.x,s=l.y}return{x:n,y:s}}};function ln(t,e){return e&&(Fe(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function _n(t){return(typeof t=="string"||t instanceof String)&&t.indexOf(`
82
+ */class Qk{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=jy.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 Sn=new Qk;const mg="transparent",Kk={boolean(t,e,n){return n>.5?e:t},color(t,e,n){const s=ag(t||mg),r=s.valid&&ag(e||mg);return r&&r.valid?r.mix(s,n).hexString():e},number(t,e,n){return t+(e-t)*n}};class Yk{constructor(e,n,s,r){const i=n[s];r=La([e.to,r,i,e.from]);const o=La([e.from,i,r]);this._active=!0,this._fn=e.fn||Kk[e.type||typeof o],this._easing=ho[e.easing]||ho.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=La([e.to,n,r,e.from]),this._from=La([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 By{constructor(e,n){this._chart=e,this._properties=new Map,this.configure(n)}configure(e){if(!ne(e))return;const n=Object.keys(Ee.animation),s=this._properties;Object.getOwnPropertyNames(e).forEach(r=>{const i=e[r];if(!ne(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=qk(e,s);if(!r)return[];const i=this._createAnimations(r,s);return s.$shared&&Xk(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 d=n[c];let f=i[c];const h=s.get(c);if(f)if(h&&f.active()){f.update(h,d,a);continue}else f.cancel();if(!h||!h.duration){e[c]=d;continue}i[c]=f=new Yk(h,e,c,d),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 Sn.add(this._chart,s),!0}}function Xk(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 qk(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 xg(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 Gk(t,e,n){if(n===!1)return!1;const s=xg(t,n),r=xg(e,n);return{top:r.end,right:s.end,bottom:r.start,left:s.start}}function Jk(t){let e,n,s,r;return ne(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 $y(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 yg(t,e,n,s={}){const r=t.keys,i=s.mode==="single";let o,a,l,c;if(e===null)return;let d=!1;for(o=0,a=r.length;o<a;++o){if(l=+r[o],l===n){if(d=!0,s.all)continue;break}c=t.values[l],Ft(c)&&(i||e===0||Ss(e)===Ss(c))&&(e+=c)}return!d&&!s.all?0:e}function Zk(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,d;for(l=0,c=o.length;l<c;++l)d=o[l],a[l]={[r]:d,[i]:t[d]};return a}function uu(t,e){const n=t&&t.options.stacked;return n||n===void 0&&e.stack!==void 0}function eC(t,e,n){return`${t.id}.${e.id}.${n.stack||n.type}`}function tC(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 nC(t,e,n){const s=t[e]||(t[e]={});return s[n]||(s[n]={})}function vg(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 bg(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,d=eC(i,o,s),f=e.length;let h;for(let p=0;p<f;++p){const x=e[p],{[l]:g,[c]:b}=x,y=x._stacks||(x._stacks={});h=y[c]=nC(r,d,g),h[a]=b,h._top=vg(h,o,!0,s.type),h._bottom=vg(h,o,!1,s.type);const m=h._visualValues||(h._visualValues={});m[a]=b}}function du(t,e){const n=t.scales;return Object.keys(n).filter(s=>n[s].axis===e).shift()}function sC(t,e){return wi(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function rC(t,e,n){return wi(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:n,index:e,mode:"default",type:"data"})}function zi(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 fu=t=>t==="reset"||t==="none",wg=(t,e)=>e?t:Object.assign({},t),iC=(t,e,n)=>t&&!e.hidden&&e._stacked&&{keys:$y(n,!0),values:null};class Vr{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=uu(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&&zi(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,n=this._cachedMeta,s=this.getDataset(),r=(f,h,p,x)=>f==="x"?h:f==="r"?x:p,i=n.xAxisID=ee(s.xAxisID,du(e,"x")),o=n.yAxisID=ee(s.yAxisID,du(e,"y")),a=n.rAxisID=ee(s.rAxisID,du(e,"r")),l=n.indexAxis,c=n.iAxisID=r(l,i,o,a),d=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(d)}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&&rg(this._data,this),e._stacked&&zi(e)}_dataCheck(){const e=this.getDataset(),n=e.data||(e.data=[]),s=this._data;if(ne(n)){const r=this._cachedMeta;this._data=Zk(n,r)}else if(s!==n){if(s){rg(s,this);const r=this._cachedMeta;zi(r),r._parsed=[]}n&&Object.isExtensible(n)&&ik(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=uu(n.vScale,n),n.stack!==s.stack&&(r=!0,zi(n),n.stack=s.stack),this._resyncElements(e),(r||i!==n._stacked)&&(bg(this,n._parsed),n._stacked=uu(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],d,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):ne(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(d=0;d<n;++d)s._parsed[d+e]=f=h[d],l&&(p()&&(l=!1),c=f);s._sorted=l}o&&bg(this,h)}parsePrimitiveData(e,n,s,r){const{iScale:i,vScale:o}=e,a=i.axis,l=o.axis,c=i.getLabels(),d=i===o,f=new Array(r);let h,p,x;for(h=0,p=r;h<p;++h)x=h+s,f[h]={[a]:d||i.parse(c[x],x),[l]:o.parse(n[x],x)};return f}parseArrayData(e,n,s,r){const{xScale:i,yScale:o}=e,a=new Array(r);let l,c,d,f;for(l=0,c=r;l<c;++l)d=l+s,f=n[d],a[l]={x:i.parse(f[0],d),y:o.parse(f[1],d)};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 d,f,h,p;for(d=0,f=r;d<f;++d)h=d+s,p=n[h],c[d]={x:i.parse(cr(p,a),h),y:o.parse(cr(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:$y(r,!0),values:n._stacks[e.axis]._visualValues};return yg(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=yg(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=iC(n,s,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:f}=tC(a);let h,p;function x(){p=r[h];const g=p[a.axis];return!Ft(p[e.axis])||d>g||f<g}for(h=0;h<o&&!(!x()&&(this.updateRangeFromParsed(c,e,p,l),i));++h);if(i){for(h=o-1;h>=0;--h)if(!x()){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],Ft(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=Jk(ee(this.options.clip,Gk(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 d;for(s.dataset&&s.dataset.draw(e,i,a,l),d=a;d<a+l;++d){const f=r[d];f.hidden||(f.active&&c?o.push(f):f.draw(e,i))}for(d=0;d<o.length;++d)o[d].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=rC(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=sC(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&&Bo(s);if(a)return wg(a,l);const c=this.chart.config,d=c.datasetElementScopeKeys(this._type,e),f=r?[`${e}Hover`,"hover",e,""]:[e,""],h=c.getOptionScopes(this.getDataset(),d),p=Object.keys(Ee.elements[e]),x=()=>this.getContext(s,r,n),g=c.resolveNamedOptions(h,p,x,f);return g.$shared&&(g.$shared=l,i[o]=Object.freeze(wg(g,l))),g}_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 d=this.chart.config,f=d.datasetAnimationScopeKeys(this._type,n),h=d.getOptionScopes(this.getDataset(),f);l=d.createResolver(h,this.getContext(e,s,n))}const c=new By(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||fu(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){fu(r)?Object.assign(e,s):this._resolveAnimations(n,r).update(e,s)}updateSharedOptions(e,n,s){e&&!fu(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&&zi(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])}}$(Vr,"defaults",{}),$(Vr,"datasetElementType",null),$(Vr,"dataElementType",null);function oC(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=Cy(s.sort((r,i)=>r-i))}return t._cache.$bar}function aC(t){const e=t.iScale,n=oC(e,t.type);let s=e._length,r,i,o,a;const l=()=>{o===32767||o===-32768||(Bo(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 lC(t,e,n,s){const r=n.barThickness;let i,o;return ue(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 cC(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 uC(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 Uy(t,e,n,s){return Fe(t)?uC(t,e,n,s):e[n.axis]=n.parse(t,s),e}function Sg(t,e,n,s){const r=t.iScale,i=t.vScale,o=r.getLabels(),a=r===i,l=[];let c,d,f,h;for(c=n,d=n+s;c<d;++c)h=e[c],f={},f[r.axis]=a||r.parse(o[c],c),l.push(Uy(h,f,i,c));return l}function hu(t){return t&&t.barStart!==void 0&&t.barEnd!==void 0}function dC(t,e,n){return t!==0?Ss(t):(e.isHorizontal()?1:-1)*(e.min>=n?1:-1)}function fC(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 hC(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:d}=fC(t);r==="middle"&&n&&(t.enableBorderRadius=!0,(n._top||0)===s?r=c:(n._bottom||0)===s?r=d:(i[_g(d,o,a,l)]=!0,r=c)),i[_g(r,o,a,l)]=!0,t.borderSkipped=i}function _g(t,e,n,s){return s?(t=pC(t,e,n),t=kg(t,n,e)):t=kg(t,e,n),t}function pC(t,e,n){return t===e?n:t===n?e:t}function kg(t,e,n){return t==="start"?e:t==="end"?n:t}function gC(t,{inflateAmount:e},n){t.inflateAmount=e==="auto"?n===1?.33:0:e}class il extends Vr{parsePrimitiveData(e,n,s,r){return Sg(e,n,s,r)}parseArrayData(e,n,s,r){return Sg(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,d=o.axis==="x"?a:l,f=[];let h,p,x,g;for(h=s,p=s+r;h<p;++h)g=n[h],x={},x[i.axis]=i.parse(cr(g,c),h),f.push(Uy(cr(g,d),x,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=hu(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(),d=this._getRuler(),{sharedOptions:f,includeOptions:h}=this._getSharedOptions(n,r);for(let p=n;p<n+s;p++){const x=this.getParsed(p),g=i||ue(x[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(p),b=this._calculateBarIndexPixels(p,d),y=(x._stacks||{})[a.axis],m={horizontal:c,base:g.base,enableBorderRadius:!y||hu(x._custom)||o===y._top||o===y._bottom,x:c?g.head:b.center,y:c?b.center:g.head,height:c?b.size:Math.abs(g.size),width:c?Math.abs(g.size):b.size};h&&(m.options=f||this.resolveDataElementOptions(p,e[p].active?"active":r));const v=m.options||e[p].options;hC(m,v,y,o),gC(m,v,d.ratio),this.updateElement(e[p],p,m,r)}}_getStacks(e,n){const{iScale:s}=this._cachedMeta,r=s.getMatchingVisibleMetas(this._type).filter(d=>d.controller.options.grouped),i=s.options.stacked,o=[],a=this._cachedMeta.controller.getParsed(n),l=a&&a[s.axis],c=d=>{const f=d._parsed.find(p=>p[s.axis]===l),h=f&&f[d.vScale.axis];if(ue(h)||isNaN(h))return!0};for(const d of r)if(!(n!==void 0&&c(d))&&((i===!1||o.indexOf(d.stack)===-1||i===void 0&&d.stack===void 0)&&o.push(d.stack),d.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[ee(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||aC(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,d=hu(c);let f=l[n.axis],h=0,p=s?this.applyStack(n,l,s):f,x,g;p!==f&&(h=p-f,p=f),d&&(f=c.barStart,p=c.barEnd-c.barStart,f!==0&&Ss(f)!==Ss(c.barEnd)&&(h=0),h+=f);const b=!ue(i)&&!d?i:h;let y=n.getPixelForValue(b);if(this.chart.getDataVisibility(e)?x=n.getPixelForValue(h+p):x=y,g=x-y,Math.abs(g)<o){g=dC(g,n,a)*o,f===a&&(y-=g/2);const m=n.getPixelForDecimal(0),v=n.getPixelForDecimal(1),S=Math.min(m,v),_=Math.max(m,v);y=Math.max(Math.min(y,_),S),x=y+g,s&&!d&&(l._stacks[n.axis]._visualValues[r]=n.getValueForPixel(x)-n.getValueForPixel(y))}if(y===n.getPixelForValue(a)){const m=Ss(g)*n.getLineWidthForValue(a)/2;y+=m,g-=m}return{size:g,base:y,head:x,center:x+g/2}}_calculateBarIndexPixels(e,n){const s=n.scale,r=this.options,i=r.skipNull,o=ee(r.maxBarThickness,1/0);let a,l;const c=this._getAxisCount();if(n.grouped){const d=i?this._getStackCount(e):n.stackCount,f=r.barThickness==="flex"?cC(e,n,r,d*c):lC(e,n,r,d*c),h=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,p=this._getAxis().indexOf(ee(h,this.getFirstScaleIdForIndexAxis())),x=this._getStackIndex(this.index,this._cachedMeta.stack,i?e:void 0)+p;a=f.start+f.chunk*x+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)}}$(il,"id","bar"),$(il,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),$(il,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});function mC(t,e,n){let s=1,r=1,i=0,o=0;if(e<ve){const a=t,l=a+e,c=Math.cos(a),d=Math.sin(a),f=Math.cos(l),h=Math.sin(l),p=(v,S,_)=>Ul(v,a,l,!0)?1:Math.max(S,S*n,_,_*n),x=(v,S,_)=>Ul(v,a,l,!0)?-1:Math.min(S,S*n,_,_*n),g=p(0,c,f),b=p(Le,d,h),y=x(ge,c,f),m=x(ge+Le,d,h);s=(g-y)/2,r=(b-m)/2,i=-(g+y)/2,o=-(b+m)/2}return{ratioX:s,ratioY:r,offsetX:i,offsetY:o}}class Ji extends Vr{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(ne(s[e])){const{key:l="value"}=this._parsing;i=c=>+cr(s[c],l)}let o,a;for(o=e,a=e+n;o<a;++o)r._parsed[o]=i(o)}}_getRotation(){return Pn(this.options.rotation-90)}_getCircumference(){return Pn(this.options.circumference)}_getRotationExtents(){let e=ve,n=-ve;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(W_(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:d,rotation:f}=this._getRotationExtents(),{ratioX:h,ratioY:p,offsetX:x,offsetY:g}=mC(f,d,l),b=(s.width-o)/h,y=(s.height-o)/p,m=Math.max(Math.min(b,y)/2,0),v=by(this.options.radius,m),S=Math.max(v*l,0),_=(v-S)/this._getVisibleDatasetWeightTotal();this.offsetX=x*v,this.offsetY=g*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/ve)}updateElements(e,n,s,r){const i=r==="reset",o=this.chart,a=o.chartArea,c=o.options.animation,d=(a.left+a.right)/2,f=(a.top+a.bottom)/2,h=i&&c.animateScale,p=h?0:this.innerRadius,x=h?0:this.outerRadius,{sharedOptions:g,includeOptions:b}=this._getSharedOptions(n,r);let y=this._getRotation(),m;for(m=0;m<n;++m)y+=this._circumference(m,i);for(m=n;m<n+s;++m){const v=this._circumference(m,i),S=e[m],_={x:d+this.offsetX,y:f+this.offsetY,startAngle:y,endAngle:y+v,circumference:v,outerRadius:x,innerRadius:p};b&&(_.options=g||this.resolveDataElementOptions(m,S.active?"active":r)),y+=v,this.updateElement(S,m,_,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)?ve*(Math.abs(e)/n):0}getLabelAndValue(e){const n=this._cachedMeta,s=this.chart,r=s.data.labels||[],i=qf(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(ee(this.chart.data.datasets[e].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}$(Ji,"id","doughnut"),$(Ji,"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"}),$(Ji,"descriptors",{_scriptable:e=>e!=="spacing"&&e!=="spacingMode",_indexable:e=>e!=="spacing"&&e!=="spacingMode"&&!e.startsWith("borderDash")&&!e.startsWith("hoverBorderDash")}),$(Ji,"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 As(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class ih{constructor(e){$(this,"options");this.options=e||{}}static override(e){Object.assign(ih.prototype,e)}init(){}formats(){return As()}parse(){return As()}format(){return As()}add(){return As()}diff(){return As()}startOf(){return As()}endOf(){return As()}}var xC={_date:ih};function yC(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?sk:Dd;if(s){if(r._sharedOptions){const d=i[0],f=typeof d.getRange=="function"&&d.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 d=c(i,e,n);if(l){const{vScale:f}=r._cachedMeta,{_parsed:h}=t,p=h.slice(0,d.lo+1).reverse().findIndex(g=>!ue(g[f.axis]));d.lo-=Math.max(0,p);const x=h.slice(d.hi).findIndex(g=>!ue(g[f.axis]));d.hi+=Math.max(0,x)}return d}}return{lo:0,hi:i.length-1}}function wc(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:d}=i[a],{lo:f,hi:h}=yC(i[a],e,o,r);for(let p=f;p<=h;++p){const x=d[p];x.skip||s(x,c,p)}}}function vC(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 pu(t,e,n,s,r){const i=[];return!r&&!t.isPointInArea(e)||wc(t,n,e,function(a,l,c){!r&&!Oy(a,t.chartArea,0)||a.inRange(e.x,e.y,s)&&i.push({element:a,datasetIndex:l,index:c})},!0),i}function bC(t,e,n,s){let r=[];function i(o,a,l){const{startAngle:c,endAngle:d}=o.getProps(["startAngle","endAngle"],s),{angle:f}=_y(o,{x:e.x,y:e.y});Ul(f,c,d)&&r.push({element:o,datasetIndex:a,index:l})}return wc(t,n,e,i),r}function wC(t,e,n,s,r,i){let o=[];const a=vC(n);let l=Number.POSITIVE_INFINITY;function c(d,f,h){const p=d.inRange(e.x,e.y,r);if(s&&!p)return;const x=d.getCenterPoint(r);if(!(!!i||t.isPointInArea(x))&&!p)return;const b=a(e,x);b<l?(o=[{element:d,datasetIndex:f,index:h}],l=b):b===l&&o.push({element:d,datasetIndex:f,index:h})}return wc(t,n,e,c),o}function gu(t,e,n,s,r,i){return!i&&!t.isPointInArea(e)?[]:n==="r"&&!s?bC(t,e,n,r):wC(t,e,n,s,r,i)}function Cg(t,e,n,s,r){const i=[],o=n==="x"?"inXRange":"inYRange";let a=!1;return wc(t,n,e,(l,c,d)=>{l[o]&&l[o](e[n],r)&&(i.push({element:l,datasetIndex:c,index:d}),a=a||l.inRange(e.x,e.y,r))}),s&&!a?[]:i}var SC={modes:{index(t,e,n,s){const r=Bs(e,t),i=n.axis||"x",o=n.includeInvisible||!1,a=n.intersect?pu(t,r,i,s,o):gu(t,r,i,!1,s,o),l=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach(c=>{const d=a[0].index,f=c.data[d];f&&!f.skip&&l.push({element:f,datasetIndex:c.index,index:d})}),l):[]},dataset(t,e,n,s){const r=Bs(e,t),i=n.axis||"xy",o=n.includeInvisible||!1;let a=n.intersect?pu(t,r,i,s,o):gu(t,r,i,!1,s,o);if(a.length>0){const l=a[0].datasetIndex,c=t.getDatasetMeta(l).data;a=[];for(let d=0;d<c.length;++d)a.push({element:c[d],datasetIndex:l,index:d})}return a},point(t,e,n,s){const r=Bs(e,t),i=n.axis||"xy",o=n.includeInvisible||!1;return pu(t,r,i,s,o)},nearest(t,e,n,s){const r=Bs(e,t),i=n.axis||"xy",o=n.includeInvisible||!1;return gu(t,r,i,n.intersect,s,o)},x(t,e,n,s){const r=Bs(e,t);return Cg(t,r,"x",n.intersect,s)},y(t,e,n,s){const r=Bs(e,t);return Cg(t,r,"y",n.intersect,s)}}};const Wy=["left","top","right","bottom"];function Bi(t,e){return t.filter(n=>n.pos===e)}function jg(t,e){return t.filter(n=>Wy.indexOf(n.pos)===-1&&n.box.axis===e)}function $i(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 _C(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 kC(t){const e={};for(const n of t){const{stack:s,pos:r,stackWeight:i}=n;if(!s||!Wy.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 CC(t,e){const n=kC(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],d=c&&a.stackWeight/c.weight;a.horizontal?(a.width=d?d*s:l&&e.availableWidth,a.height=r):(a.width=s,a.height=d?d*r:l&&e.availableHeight)}return n}function jC(t){const e=_C(t),n=$i(e.filter(c=>c.box.fullSize),!0),s=$i(Bi(e,"left"),!0),r=$i(Bi(e,"right")),i=$i(Bi(e,"top"),!0),o=$i(Bi(e,"bottom")),a=jg(e,"x"),l=jg(e,"y");return{fullSize:n,leftAndTop:s.concat(i),rightAndBottom:r.concat(l).concat(o).concat(a),chartArea:Bi(e,"chartArea"),vertical:s.concat(r).concat(l),horizontal:i.concat(o).concat(a)}}function Ng(t,e,n,s){return Math.max(t[n],e[n])+Math.max(t[s],e[s])}function Hy(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 NC(t,e,n,s){const{pos:r,box:i}=n,o=t.maxPadding;if(!ne(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&&Hy(o,i.getPadding());const a=Math.max(0,e.outerWidth-Ng(o,t,"left","right")),l=Math.max(0,e.outerHeight-Ng(o,t,"top","bottom")),c=a!==t.w,d=l!==t.h;return t.w=a,t.h=l,n.horizontal?{same:c,other:d}:{same:d,other:c}}function EC(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 MC(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 Zi(t,e,n,s){const r=[];let i,o,a,l,c,d;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,MC(a.horizontal,e));const{same:f,other:h}=NC(e,n,a,s);c|=f&&r.length,d=d||h,l.fullSize||r.push(a)}return c&&Zi(r,e,n,s)||d}function Ia(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 Eg(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},d=a.stackWeight/c.weight||1;if(a.horizontal){const f=e.w*d,h=c.size||l.height;Bo(c.start)&&(o=c.start),l.fullSize?Ia(l,r.left,o,n.outerWidth-r.right-r.left,h):Ia(l,e.left+c.placed,o,f,h),c.start=o,c.placed+=f,o=l.bottom}else{const f=e.h*d,h=c.size||l.width;Bo(c.start)&&(i=c.start),l.fullSize?Ia(l,i,r.top,h,n.outerHeight-r.bottom-r.top):Ia(l,i,e.top+c.placed,h,f),c.start=i,c.placed+=f,i=l.right}}e.x=i,e.y=o}var us={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=Gt(t.options.layout.padding),i=Math.max(e-r.width,0),o=Math.max(n-r.height,0),a=jC(t.boxes),l=a.vertical,c=a.horizontal;ae(t.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});const d=l.reduce((g,b)=>b.box.options&&b.box.options.display===!1?g:g+1,0)||1,f=Object.freeze({outerWidth:e,outerHeight:n,padding:r,availableWidth:i,availableHeight:o,vBoxMaxWidth:i/2/d,hBoxMaxHeight:o/2}),h=Object.assign({},r);Hy(h,Gt(s));const p=Object.assign({maxPadding:h,w:i,h:o,x:r.left,y:r.top},r),x=CC(l.concat(c),f);Zi(a.fullSize,p,f,x),Zi(l,p,f,x),Zi(c,p,f,x)&&Zi(l,p,f,x),EC(p),Eg(a.leftAndTop,p,f,x),p.x+=p.w,p.y+=p.h,Eg(a.rightAndBottom,p,f,x),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},ae(a.chartArea,g=>{const b=g.box;Object.assign(b,t.chartArea),b.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}};class Vy{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 PC extends Vy{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const ol="$chartjs",RC={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Mg=t=>t===null||t==="";function OC(t,e){const n=t.style,s=t.getAttribute("height"),r=t.getAttribute("width");if(t[ol]={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",Mg(r)){const i=gg(t,"width");i!==void 0&&(t.width=i)}if(Mg(s))if(t.style.height==="")t.height=t.width/(e||2);else{const i=gg(t,"height");i!==void 0&&(t.height=i)}return t}const Qy=$k?{passive:!0}:!1;function TC(t,e,n){t&&t.addEventListener(e,n,Qy)}function DC(t,e,n){t&&t.canvas&&t.canvas.removeEventListener(e,n,Qy)}function LC(t,e){const n=RC[t.type]||t.type,{x:s,y:r}=Bs(t,e);return{type:n,chart:e,native:t,x:s!==void 0?s:null,y:r!==void 0?r:null}}function Ql(t,e){for(const n of t)if(n===e||n.contains(e))return!0}function AC(t,e,n){const s=t.canvas,r=new MutationObserver(i=>{let o=!1;for(const a of i)o=o||Ql(a.addedNodes,s),o=o&&!Ql(a.removedNodes,s);o&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}function IC(t,e,n){const s=t.canvas,r=new MutationObserver(i=>{let o=!1;for(const a of i)o=o||Ql(a.removedNodes,s),o=o&&!Ql(a.addedNodes,s);o&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}const $o=new Map;let Pg=0;function Ky(){const t=window.devicePixelRatio;t!==Pg&&(Pg=t,$o.forEach((e,n)=>{n.currentDevicePixelRatio!==t&&e()}))}function FC(t,e){$o.size||window.addEventListener("resize",Ky),$o.set(t,e)}function zC(t){$o.delete(t),$o.size||window.removeEventListener("resize",Ky)}function BC(t,e,n){const s=t.canvas,r=s&&rh(s);if(!r)return;const i=Ny((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,d=l.contentRect.height;c===0&&d===0||i(c,d)});return o.observe(r),FC(t,i),o}function mu(t,e,n){n&&n.disconnect(),e==="resize"&&zC(t)}function $C(t,e,n){const s=t.canvas,r=Ny(i=>{t.ctx!==null&&n(LC(i,t))},t);return TC(s,e,r),r}class UC extends Vy{acquireContext(e,n){const s=e&&e.getContext&&e.getContext("2d");return s&&s.canvas===e?(OC(e,n),s):null}releaseContext(e){const n=e.canvas;if(!n[ol])return!1;const s=n[ol].initial;["height","width"].forEach(i=>{const o=s[i];ue(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[ol],!0}addEventListener(e,n,s){this.removeEventListener(e,n);const r=e.$proxies||(e.$proxies={}),o={attach:AC,detach:IC,resize:BC}[n]||$C;r[n]=o(e,n,s)}removeEventListener(e,n){const s=e.$proxies||(e.$proxies={}),r=s[n];if(!r)return;({attach:mu,detach:mu,resize:mu}[n]||DC)(e,n,r),s[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,n,s,r){return Bk(e,n,s,r)}isAttached(e){const n=e&&rh(e);return!!(n&&n.isConnected)}}function WC(t){return!sh()||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas?PC:UC}class Ns{constructor(){$(this,"x");$(this,"y");$(this,"active",!1);$(this,"options");$(this,"$animations")}tooltipPosition(e){const{x:n,y:s}=this.getProps(["x","y"],e);return{x:n,y:s}}hasValue(){return $l(this.x)&&$l(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}}$(Ns,"defaults",{}),$(Ns,"defaultRoutes");function HC(t,e){const n=t.options.ticks,s=VC(t),r=Math.min(n.maxTicksLimit||s,s),i=n.major.enabled?KC(e):[],o=i.length,a=i[0],l=i[o-1],c=[];if(o>r)return YC(e,c,i,o/r),c;const d=QC(i,e,r);if(o>0){let f,h;const p=o>1?Math.round((l-a)/(o-1)):null;for(Fa(e,c,d,ue(p)?0:a-p,a),f=0,h=o-1;f<h;f++)Fa(e,c,d,i[f],i[f+1]);return Fa(e,c,d,l,ue(p)?e.length:l+p),c}return Fa(e,c,d),c}function VC(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 QC(t,e,n){const s=XC(t),r=e.length/n;if(!s)return Math.max(r,1);const i=q_(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 KC(t){const e=[];let n,s;for(n=0,s=t.length;n<s;n++)t[n].major&&e.push(n);return e}function YC(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 Fa(t,e,n,s,r){const i=ee(s,0),o=Math.min(ee(r,t.length),t.length);let a=0,l,c,d;for(n=Math.ceil(n),r&&(l=r-s,n=l/Math.floor(l/n)),d=i;d<0;)a++,d=Math.round(i+a*n);for(c=Math.max(i,0);c<o;c++)c===d&&(e.push(t[c]),a++,d=Math.round(i+a*n))}function XC(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 qC=t=>t==="left"?"right":t==="right"?"left":t,Rg=(t,e,n)=>e==="top"||e==="left"?t[e]+n:t[e]-n,Og=(t,e)=>Math.min(e||t,t);function Tg(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 GC(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 JC(t,e){ae(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 Ui(t){return t.drawTicks?t.tickLength:0}function Dg(t,e){if(!t.display)return 0;const n=ut(t.font,e),s=Gt(t.padding);return(Fe(t.text)?t.text.length:1)*n.lineHeight+s.height}function ZC(t,e){return wi(t,{scale:e,type:"scale"})}function ej(t,e,n){return wi(t,{tick:n,index:e,type:"tick"})}function tj(t,e,n){let s=Ey(t);return(n&&e!=="right"||!n&&e==="right")&&(s=qC(s)),s}function nj(t,e,n,s){const{top:r,left:i,bottom:o,right:a,chart:l}=t,{chartArea:c,scales:d}=l;let f=0,h,p,x;const g=o-r,b=a-i;if(t.isHorizontal()){if(p=vt(s,i,a),ne(n)){const y=Object.keys(n)[0],m=n[y];x=d[y].getPixelForValue(m)+g-e}else n==="center"?x=(c.bottom+c.top)/2+g-e:x=Rg(t,n,e);h=a-i}else{if(ne(n)){const y=Object.keys(n)[0],m=n[y];p=d[y].getPixelForValue(m)-b+e}else n==="center"?p=(c.left+c.right)/2-b+e:p=Rg(t,n,e);x=vt(s,o,r),f=n==="left"?-Le:Le}return{titleX:p,titleY:x,maxWidth:h,rotation:f}}class Si extends Ns{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=on(e,Number.POSITIVE_INFINITY),n=on(n,Number.NEGATIVE_INFINITY),s=on(s,Number.POSITIVE_INFINITY),r=on(r,Number.NEGATIVE_INFINITY),{min:on(e,s),max:on(n,r),minDefined:Ft(e),maxDefined:Ft(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:on(n,on(s,n)),max:on(s,on(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(){he(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=Ck(this,i,r),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?Tg(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||o.source==="auto")&&(this.ticks=HC(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(){he(this.options.afterUpdate,[this])}beforeSetDimensions(){he(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(){he(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),he(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){he(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=he(n.callback,[i.value,s,e],this)}afterTickToLabelConversion(){he(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){he(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,n=e.ticks,s=Og(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 d=this._getLabelSizes(),f=d.widest.width,h=d.highest.height,p=ct(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-Ui(e.grid)-n.padding-Dg(e.title,this.chart.options.font),c=Math.sqrt(f*f+h*h),o=ek(Math.min(Math.asin(ct((d.highest.height+6)/a,-1,1)),Math.asin(ct(l/c,-1,1))-Math.asin(ct(h/c,-1,1)))),o=Math.max(r,Math.min(i,o))),this.labelRotation=o}afterCalculateLabelRotation(){he(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){he(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=Dg(r,n.options.font);if(a?(e.width=this.maxWidth,e.height=Ui(i)+l):(e.height=this.maxHeight,e.width=Ui(i)+l),s.display&&this.ticks.length){const{first:c,last:d,widest:f,highest:h}=this._getLabelSizes(),p=s.padding*2,x=Pn(this.labelRotation),g=Math.cos(x),b=Math.sin(x);if(a){const y=s.mirror?0:b*f.width+g*h.height;e.height=Math.min(this.maxHeight,e.height+y+p)}else{const y=s.mirror?0:g*f.width+b*h.height;e.width=Math.min(this.maxWidth,e.width+y+p)}this._calculatePadding(c,d,b,g)}}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 d=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-d+o)*this.width/(this.width-d),0),this.paddingRight=Math.max((p-f+o)*this.width/(this.width-f),0)}else{let d=n.height/2,f=e.height/2;i==="start"?(d=0,f=e.height):i==="end"&&(d=n.height,f=0),this.paddingTop=d+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(){he(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++)ue(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=Tg(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/Og(n,s));let c=0,d=0,f,h,p,x,g,b,y,m,v,S,_;for(f=0;f<n;f+=l){if(x=e[f].label,g=this._resolveTickFontOptions(f),r.font=b=g.string,y=i[b]=i[b]||{data:{},gc:[]},m=g.lineHeight,v=S=0,!ue(x)&&!Fe(x))v=cg(r,y.data,y.gc,v,x),S=m;else if(Fe(x))for(h=0,p=x.length;h<p;++h)_=x[h],!ue(_)&&!Fe(_)&&(v=cg(r,y.data,y.gc,v,_),S+=m);o.push(v),a.push(S),c=Math.max(v,c),d=Math.max(S,d)}JC(i,n);const k=o.indexOf(c),C=a.indexOf(d),j=P=>({width:o[P]||0,height:a[P]||0});return{first:j(0),last:j(n-1),widest:j(k),highest:j(C),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 nk(this._alignToPixels?Ls(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=ej(this.getContext(),e,s))}return this.$context||(this.$context=ZC(this.chart.getContext(),this))}_tickSize(){const e=this.options.ticks,n=Pn(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=Ui(i),p=[],x=a.setContext(this.getContext()),g=x.display?x.width:0,b=g/2,y=function(oe){return Ls(s,oe,g)};let m,v,S,_,k,C,j,P,E,R,M,A;if(o==="top")m=y(this.bottom),C=this.bottom-h,P=m-b,R=y(e.top)+b,A=e.bottom;else if(o==="bottom")m=y(this.top),R=e.top,A=y(e.bottom)-b,C=m+b,P=this.top+h;else if(o==="left")m=y(this.right),k=this.right-h,j=m-b,E=y(e.left)+b,M=e.right;else if(o==="right")m=y(this.left),E=e.left,M=y(e.right)-b,k=m+b,j=this.left+h;else if(n==="x"){if(o==="center")m=y((e.top+e.bottom)/2+.5);else if(ne(o)){const oe=Object.keys(o)[0],J=o[oe];m=y(this.chart.scales[oe].getPixelForValue(J))}R=e.top,A=e.bottom,C=m+b,P=C+h}else if(n==="y"){if(o==="center")m=y((e.left+e.right)/2);else if(ne(o)){const oe=Object.keys(o)[0],J=o[oe];m=y(this.chart.scales[oe].getPixelForValue(J))}k=m-b,j=k-h,E=e.left,M=e.right}const U=ee(r.ticks.maxTicksLimit,f),H=Math.max(1,Math.ceil(f/U));for(v=0;v<f;v+=H){const oe=this.getContext(v),J=i.setContext(oe),T=a.setContext(oe),I=J.lineWidth,F=J.color,K=T.dash||[],z=T.dashOffset,ce=J.tickWidth,V=J.tickColor,ke=J.tickBorderDash||[],Z=J.tickBorderDashOffset;S=GC(this,v,l),S!==void 0&&(_=Ls(s,S,I),c?k=j=E=M=_:C=P=R=A=_,p.push({tx1:k,ty1:C,tx2:j,ty2:P,x1:E,y1:R,x2:M,y2:A,width:I,color:F,borderDash:K,borderDashOffset:z,tickWidth:ce,tickColor:V,tickBorderDash:ke,tickBorderDashOffset:Z}))}return this._ticksLength=f,this._borderValue=m,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:d,mirror:f}=i,h=Ui(s.grid),p=h+d,x=f?-d:p,g=-Pn(this.labelRotation),b=[];let y,m,v,S,_,k,C,j,P,E,R,M,A="middle";if(r==="top")k=this.bottom-x,C=this._getXAxisLabelAlignment();else if(r==="bottom")k=this.top+x,C=this._getXAxisLabelAlignment();else if(r==="left"){const H=this._getYAxisLabelAlignment(h);C=H.textAlign,_=H.x}else if(r==="right"){const H=this._getYAxisLabelAlignment(h);C=H.textAlign,_=H.x}else if(n==="x"){if(r==="center")k=(e.top+e.bottom)/2+p;else if(ne(r)){const H=Object.keys(r)[0],oe=r[H];k=this.chart.scales[H].getPixelForValue(oe)+p}C=this._getXAxisLabelAlignment()}else if(n==="y"){if(r==="center")_=(e.left+e.right)/2-p;else if(ne(r)){const H=Object.keys(r)[0],oe=r[H];_=this.chart.scales[H].getPixelForValue(oe)}C=this._getYAxisLabelAlignment(h).textAlign}n==="y"&&(l==="start"?A="top":l==="end"&&(A="bottom"));const U=this._getLabelSizes();for(y=0,m=a.length;y<m;++y){v=a[y],S=v.label;const H=i.setContext(this.getContext(y));j=this.getPixelForTick(y)+i.labelOffset,P=this._resolveTickFontOptions(y),E=P.lineHeight,R=Fe(S)?S.length:1;const oe=R/2,J=H.color,T=H.textStrokeColor,I=H.textStrokeWidth;let F=C;o?(_=j,C==="inner"&&(y===m-1?F=this.options.reverse?"left":"right":y===0?F=this.options.reverse?"right":"left":F="center"),r==="top"?c==="near"||g!==0?M=-R*E+E/2:c==="center"?M=-U.highest.height/2-oe*E+E:M=-U.highest.height+E/2:c==="near"||g!==0?M=E/2:c==="center"?M=U.highest.height/2-oe*E:M=U.highest.height-R*E,f&&(M*=-1),g!==0&&!H.showLabelBackdrop&&(_+=E/2*Math.sin(g))):(k=j,M=(1-R)*E/2);let K;if(H.showLabelBackdrop){const z=Gt(H.backdropPadding),ce=U.heights[y],V=U.widths[y];let ke=M-z.top,Z=0-z.left;switch(A){case"middle":ke-=ce/2;break;case"bottom":ke-=ce;break}switch(C){case"center":Z-=V/2;break;case"right":Z-=V;break;case"inner":y===m-1?Z-=V:y>0&&(Z-=V/2);break}K={left:Z,top:ke,width:V+z.width,height:ce+z.height,color:H.backdropColor}}b.push({label:S,font:P,textOffset:M,options:{rotation:g,color:J,strokeColor:T,strokeWidth:I,textAlign:F,textBaseline:A,translation:[_,k],backdrop:K}})}return b}_getXAxisLabelAlignment(){const{position:e,ticks:n}=this.options;if(-Pn(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,d;return n==="left"?r?(d=this.right+i,s==="near"?c="left":s==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-a,s==="near"?c="right":s==="center"?(c="center",d-=l/2):(c="left",d=this.left)):n==="right"?r?(d=this.left+i,s==="near"?c="right":s==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+a,s==="near"?c="left":s==="center"?(c="center",d+=l/2):(c="right",d=this.right)):c="right",{textAlign:c,x:d}}_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,d)=>{!d.width||!d.color||(s.save(),s.lineWidth=d.width,s.strokeStyle=d.color,s.setLineDash(d.borderDash||[]),s.lineDashOffset=d.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,d,f,h;this.isHorizontal()?(c=Ls(e,this.left,o)-o/2,d=Ls(e,this.right,a)+a/2,f=h=l):(f=Ls(e,this.top,o)-o/2,h=Ls(e,this.bottom,a)+a/2,c=d=l),n.save(),n.lineWidth=i.width,n.strokeStyle=i.color,n.beginPath(),n.moveTo(c,f),n.lineTo(d,h),n.stroke(),n.restore()}drawLabels(e){if(!this.options.ticks.display)return;const s=this.ctx,r=this._computeLabelArea();r&&Gf(s,r);const i=this.getLabelItems(e);for(const o of i){const a=o.options,l=o.font,c=o.label,d=o.textOffset;Wl(s,c,0,d,l,a)}r&&Jf(s)}drawTitle(){const{ctx:e,options:{position:n,title:s,reverse:r}}=this;if(!s.display)return;const i=ut(s.font),o=Gt(s.padding),a=s.align;let l=i.lineHeight/2;n==="bottom"||n==="center"||ne(n)?(l+=o.bottom,Fe(s.text)&&(l+=i.lineHeight*(s.text.length-1))):l+=o.top;const{titleX:c,titleY:d,maxWidth:f,rotation:h}=nj(this,l,n,a);Wl(e,s.text,0,0,i,{color:s.color,maxWidth:f,rotation:h,textAlign:tj(a,n,r),textBaseline:"middle",translation:[c,d],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=ee(e.grid&&e.grid.z,-1),r=ee(e.border&&e.border.z,0);return!this._isVisible()||this.draw!==Si.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 ut(n.font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class za{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;ij(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,sj(e,o,s),this.override&&Ee.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 Ee[r]&&(delete Ee[r][s],this.override&&delete ur[s])}}function sj(t,e,n){const s=zo(Object.create(null),[n?Ee.get(n):{},Ee.get(e),t.defaults]);Ee.set(e,s),t.defaultRoutes&&rj(e,t.defaultRoutes),t.descriptors&&Ee.describe(e,t.descriptors)}function rj(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(".");Ee.route(i,r,l,a)})}function ij(t){return"id"in t&&"defaults"in t}class oj{constructor(){this.controllers=new za(Vr,"datasets",!0),this.elements=new za(Ns,"elements"),this.plugins=new za(Object,"plugins"),this.scales=new za(Si,"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):ae(r,o=>{const a=s||this._getRegistryForType(o);this._exec(e,a,o)})})}_exec(e,n,s){const r=Yf(e);he(s["before"+r],[],s),n[e](s),he(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 un=new oj;class aj{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(he(a,l,o)===!1&&r.cancelable)return!1}return!0}invalidate(){ue(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=ee(s.options&&s.options.plugins,{}),i=lj(s);return r===!1&&!n?[]:uj(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 lj(t){const e={},n=[],s=Object.keys(un.plugins.items);for(let i=0;i<s.length;i++)n.push(un.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 cj(t,e){return!e&&t===!1?null:t===!0?{}:t}function uj(t,{plugins:e,localIds:n},s,r){const i=[],o=t.getContext();for(const a of e){const l=a.id,c=cj(s[l],r);c!==null&&i.push({plugin:a,options:dj(t.config,{plugin:a,local:n[l]},c,o)})}return i}function dj(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 Ad(t,e){const n=Ee.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||n.indexAxis||"x"}function fj(t,e){let n=t;return t==="_index_"?n=e:t==="_value_"&&(n=e==="x"?"y":"x"),n}function hj(t,e){return t===e?"_index_":"_value_"}function Lg(t){if(t==="x"||t==="y"||t==="r")return t}function pj(t){if(t==="top"||t==="bottom")return"x";if(t==="left"||t==="right")return"y"}function Id(t,...e){if(Lg(t))return t;for(const n of e){const s=n.axis||pj(n.position)||t.length>1&&Lg(t[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function Ag(t,e,n){if(n[e+"AxisID"]===t)return{axis:e}}function gj(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 Ag(t,"x",n[0])||Ag(t,"y",n[0])}return{}}function mj(t,e){const n=ur[t.type]||{scales:{}},s=e.scales||{},r=Ad(t.type,e),i=Object.create(null);return Object.keys(s).forEach(o=>{const a=s[o];if(!ne(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=Id(o,a,gj(o,t),Ee.scales[a.type]),c=hj(l,r),d=n.scales||{};i[o]=fo(Object.create(null),[{axis:l},a,d[l],d[c]])}),t.data.datasets.forEach(o=>{const a=o.type||t.type,l=o.indexAxis||Ad(a,e),d=(ur[a]||{}).scales||{};Object.keys(d).forEach(f=>{const h=fj(f,l),p=o[h+"AxisID"]||h;i[p]=i[p]||Object.create(null),fo(i[p],[{axis:h},s[p],d[f]])})}),Object.keys(i).forEach(o=>{const a=i[o];fo(a,[Ee.scales[a.type],Ee.scale])}),i}function Yy(t){const e=t.options||(t.options={});e.plugins=ee(e.plugins,{}),e.scales=mj(t,e)}function Xy(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function xj(t){return t=t||{},t.data=Xy(t.data),Yy(t),t}const Ig=new Map,qy=new Set;function Ba(t,e){let n=Ig.get(t);return n||(n=e(),Ig.set(t,n),qy.add(n)),n}const Wi=(t,e,n)=>{const s=cr(e,n);s!==void 0&&t.add(s)};class yj{constructor(e){this._config=xj(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=Xy(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(),Yy(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return Ba(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,n){return Ba(`${e}.transition.${n}`,()=>[[`datasets.${e}.transitions.${n}`,`transitions.${n}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,n){return Ba(`${e}-${n}`,()=>[[`datasets.${e}.elements.${n}`,`datasets.${e}`,`elements.${n}`,""]])}pluginScopeKeys(e){const n=e.id,s=this.type;return Ba(`${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(d=>{e&&(l.add(e),d.forEach(f=>Wi(l,e,f))),d.forEach(f=>Wi(l,r,f)),d.forEach(f=>Wi(l,ur[i]||{},f)),d.forEach(f=>Wi(l,Ee,f)),d.forEach(f=>Wi(l,Ld,f))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),qy.has(n)&&o.set(n,c),c}chartOptionScopes(){const{options:e,type:n}=this;return[e,ur[n]||{},Ee.datasets[n]||{},{type:n},Ee,Ld]}resolveNamedOptions(e,n,s,r=[""]){const i={$shared:!0},{resolver:o,subPrefixes:a}=Fg(this._resolverCache,e,r);let l=o;if(bj(o,n)){i.$shared=!1,s=js(s)?s():s;const c=this.createResolver(e,s,a);l=gi(o,s,c)}for(const c of n)i[c]=l[c];return i}createResolver(e,n,s=[""],r){const{resolver:i}=Fg(this._resolverCache,e,s);return ne(n)?gi(i,n,void 0,r):i}}function Fg(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:eh(e,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},s.set(r,i)),i}const vj=t=>ne(t)&&Object.getOwnPropertyNames(t).some(e=>js(t[e]));function bj(t,e){const{isScriptable:n,isIndexable:s}=Dy(t);for(const r of e){const i=n(r),o=s(r),a=(o||i)&&t[r];if(i&&(js(a)||vj(a))||o&&Fe(a))return!0}return!1}var wj="4.6.1";const Sj=["top","bottom","left","right","chartArea"];function zg(t,e){return t==="top"||t==="bottom"||Sj.indexOf(t)===-1&&e==="x"}function Bg(t,e){return function(n,s){return n[t]===s[t]?n[e]-s[e]:n[t]-s[t]}}function $g(t){const e=t.chart,n=e.options.animation;e.notifyPlugins("afterRender"),he(n&&n.onComplete,[t],e)}function _j(t){const e=t.chart,n=e.options.animation;he(n&&n.onProgress,[t],e)}function Gy(t){return sh()&&typeof t=="string"?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const al={},Ug=t=>{const e=Gy(t);return Object.values(al).filter(n=>n.canvas===e).pop()};function kj(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 Cj(t,e,n,s){return!n||t.type==="mouseout"?null:s?e:t}var Hn;let Sc=(Hn=class{static register(...e){un.add(...e),Wg()}static unregister(...e){un.remove(...e),Wg()}constructor(e,n){const s=this.config=new yj(n),r=Gy(e),i=Ug(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||WC(r)),this.platform.updateConfig(s);const a=this.platform.acquireContext(r,o.aspectRatio),l=a&&a.canvas,c=l&&l.height,d=l&&l.width;if(this.id=U_(),this.ctx=a,this.canvas=l,this.width=d,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 aj,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=ok(f=>this.update(f),o.resizeDelay||0),this._dataChanges=[],al[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Sn.listen(this,"complete",$g),Sn.listen(this,"progress",_j),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:n},width:s,height:r,_aspectRatio:i}=this;return ue(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 un}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():pg(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return ug(this.canvas,this.ctx),this}stop(){return Sn.stop(this),this}resize(e,n){Sn.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,pg(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),he(s.onResize,[this,o],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};ae(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=Id(o,a),c=l==="r",d=l==="x";return{options:a,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),ae(i,o=>{const a=o.options,l=a.id,c=Id(l,a),d=ee(a.type,o.dtype);(a.position===void 0||zg(a.position,c)!==zg(o.dposition))&&(a.position=o.dposition),r[l]=!0;let f=null;if(l in s&&s[l].type===d)f=s[l];else{const h=un.getScale(d);f=new h({id:l,type:d,ctx:this.ctx,chart:this}),s[f.id]=f}f.init(a,e)}),ae(r,(o,a)=>{o||delete s[a]}),ae(s,o=>{us.configure(this,o,o.options),us.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(Bg("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||Ad(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=un.getController(a),{datasetElementType:c,dataElementType:d}=Ee.datasets[a];Object.assign(l,{dataElementType:un.getElement(d),datasetElementType:c&&un.getElement(c)}),o.controller=new l(this,s),e.push(o.controller)}}return this._updateMetasets(),e}_resetElements(){ae(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,d=this.data.datasets.length;c<d;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||ae(i,c=>{c.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(Bg("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){ae(this.scales,e=>{us.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,n=new Set(Object.keys(this._listeners)),s=new Set(e.events);(!eg(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;kj(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(!eg(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;us.update(this,this.width,this.height,e);const n=this.chartArea,s=n.width<=0||n.height<=0;this._layers=[],ae(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,js(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&&(Sn.has(this)?this.attached&&!Sn.running(this)&&Sn.start(this):(this.draw(),$g({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=Vk(this,e);this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(r&&Gf(n,r),e.controller.draw(),r&&Jf(n),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(e){return Oy(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,n,s,r){const i=SC.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=wi(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);Bo(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(),Sn.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(),ug(e,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete al[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)};ae(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(){ae(this._listeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._listeners={},ae(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}});!Fl(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(d=>!c.some(f=>d.datasetIndex===f.datasetIndex&&d.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=Y_(e),c=Cj(e,this._lastEvent,s,l);s&&(this._lastEvent=null,he(i.onHover,[e,a,this],this),l&&he(i.onClick,[e,a,this],this));const d=!Fl(a,r);return(d||n)&&(this._active=a,this._updateHoverStyles(a,r,n)),this._lastEvent=c,d}_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)}},$(Hn,"defaults",Ee),$(Hn,"instances",al),$(Hn,"overrides",ur),$(Hn,"registry",un),$(Hn,"version",wj),$(Hn,"getChart",Ug),Hn);function Wg(){return ae(Sc.instances,t=>t._plugins.invalidate())}function jj(t,e,n){const{startAngle:s,x:r,y:i,outerRadius:o,innerRadius:a,options:l}=e,{borderWidth:c,borderJoinStyle:d}=l,f=Math.min(c/o,dn(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,dn(s-n));t.arc(r,i,a+c/2,n-h/2,s+h/2,!0)}else{const h=Math.min(c/2,o*dn(s-n));if(d==="round")t.arc(r,i,h,n-ge/2,s+ge/2,!0);else if(d==="bevel"){const p=2*h*h,x=-p*Math.cos(n+ge/2)+r,g=-p*Math.sin(n+ge/2)+i,b=p*Math.cos(s+ge/2)+r,y=p*Math.sin(s+ge/2)+i;t.lineTo(x,g),t.lineTo(b,y)}}t.closePath(),t.moveTo(0,0),t.rect(0,0,t.canvas.width,t.canvas.height),t.clip("evenodd")}function Nj(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+Le,s-Le),t.closePath(),t.clip()}function Ej(t){return Zf(t,["outerStart","outerEnd","innerStart","innerEnd"])}function Mj(t,e,n,s){const r=Ej(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 ct(l,0,Math.min(i,c))};return{outerStart:a(r.outerStart),outerEnd:a(r.outerEnd),innerStart:ct(r.innerStart,0,o),innerEnd:ct(r.innerEnd,0,o)}}function Sr(t,e,n,s){return{x:n+t*Math.cos(e),y:s+t*Math.sin(e)}}function Pj(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),d=l>0?l+s+n+a:0;t.beginPath(),t.arc(r,i,c,o,o+ve),d>0&&(t.moveTo(r+Math.cos(o)*d,i+Math.sin(o)*d),t.arc(r,i,d,o+ve,o,!0)),t.closePath()}function Kl(t,e,n,s,r,i){const{x:o,y:a,startAngle:l,pixelMargin:c,innerRadius:d}=e,{spacingMode:f="angular"}=e.options,h=r-l;if(i&&e.options.selfJoin&&Math.abs(h)>=ve-1e-4){Pj(t,e,n,s);return}const p=Math.max(e.outerRadius+s+n-c,0);let x=d>0?d+s+n+c:0,g=0,b=0;const y=p>0?Math.max(.001,h*p-n/ge)/p:.001,m=(h-y)/2;if(s){const F=d>0?d-s:0,K=p>0?p-s:0,z=(F+K)/2,ce=(()=>{const pt=z!==0?h*z/(z+s):h;return(h-pt)/2})(),V=z>0?Math.asin(Math.min(1,s/z)):0,ke=Math.max(0,y/2-.001),Z=Math.sin(ke);if(f==="parallel"){if(x===0&&Z>0){const Bt=s/Z,ie=Math.max(0,p-.001);x=Math.min(Bt,ie)}const pt=Math.min(p>0?p*Z:Number.POSITIVE_INFINITY,x>0?x*Z:Number.POSITIVE_INFINITY),zt=Math.min(s,pt);g=p>0?Math.asin(Math.min(1,zt/p)):Math.min(ke,V),b=x>0?Math.asin(Math.min(1,zt/x)):g}else f==="proportional"?(g=Math.min(ke,ce),b=Math.min(ke,ce)):(g=Math.min(ke,V),b=Math.min(ke,V))}const v=l+m+g,S=r-m-g,_=l+m+b,k=r-m-b,C=Math.min(S-v,k-_),{outerStart:j,outerEnd:P,innerStart:E,innerEnd:R}=Mj(e,x,p,C),M=p-j,A=p-P,U=v+j/M,H=S-P/A,oe=x+E,J=x+R,T=_+E/oe,I=k-R/J;if(t.beginPath(),i){const F=(U+H)/2;if(t.arc(o,a,p,U,F),t.arc(o,a,p,F,H),P>0){const V=Sr(A,H,o,a);t.arc(V.x,V.y,P,H,S+Le)}const K=Sr(J,k,o,a);if(t.lineTo(K.x,K.y),R>0){const V=Sr(J,I,o,a);t.arc(V.x,V.y,R,k+Le,I+Math.PI)}const z=(k-R/x+(_+E/x))/2;if(t.arc(o,a,x,k-R/x,z,!0),t.arc(o,a,x,z,_+E/x,!0),E>0){const V=Sr(oe,T,o,a);t.arc(V.x,V.y,E,T+Math.PI,_-Le)}const ce=Sr(M,v,o,a);if(t.lineTo(ce.x,ce.y),j>0){const V=Sr(M,U,o,a);t.arc(V.x,V.y,j,v-Le,U)}}else{t.moveTo(o,a);const F=Math.cos(U)*p+o,K=Math.sin(U)*p+a;t.lineTo(F,K);const z=Math.cos(H)*p+o,ce=Math.sin(H)*p+a;t.lineTo(z,ce)}t.closePath()}function Rj(t,e,n,s,r){const{fullCircles:i,startAngle:o,circumference:a}=e;let l=e.endAngle;if(i){Kl(t,e,n,s,l,r);for(let c=0;c<i;++c)t.fill();isNaN(a)||(l=o+(a%ve||ve))}return Kl(t,e,n,s,l,r),t.fill(),l}function Oj(t,e,n,s,r){const{fullCircles:i,startAngle:o,circumference:a,options:l}=e,{borderWidth:c,borderJoinStyle:d,borderDash:f,borderDashOffset:h,borderRadius:p}=l,x=l.borderAlign==="inner";if(!c)return;t.setLineDash(f||[]),t.lineDashOffset=h,x?(t.lineWidth=c*2,t.lineJoin=d||"round"):(t.lineWidth=c,t.lineJoin=d||"bevel");let g=e.endAngle;const b=Math.abs(g-o)>=ve-1e-4;if(i){Kl(t,e,n,s,g,r);for(let m=0;m<i;++m)t.stroke();isNaN(a)||(g=o+(a%ve||ve))}x&&Nj(t,e,g),!(b&&e.innerRadius>0)&&l.selfJoin&&g-o>=ge&&p===0&&d!=="miter"&&jj(t,e,g),i||(Kl(t,e,n,s,g,r),t.stroke())}class eo extends Ns{constructor(n){super();$(this,"circumference");$(this,"endAngle");$(this,"fullCircles");$(this,"innerRadius");$(this,"outerRadius");$(this,"pixelMargin");$(this,"startAngle");$(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}=_y(i,{x:n,y:s}),{startAngle:l,endAngle:c,innerRadius:d,outerRadius:f,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],r),p=(this.options.spacing+this.options.borderWidth)/2,x=ee(h,c-l),g=Ul(o,l,c)&&l!==c,b=x>=ve||g,y=Vs(a,d+p,f+p);return b&&y}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:d}=this.options,f=(i+o)/2,h=(a+l+d+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>ve?Math.floor(r/ve):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(ge,r||0)),d=i*c;n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,Rj(n,this,d,o,a),Oj(n,this,d,o,a),n.restore()}}$(eo,"id","arc"),$(eo,"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}),$(eo,"defaultRoutes",{backgroundColor:"backgroundColor"}),$(eo,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function Jy(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,d,f;return t.horizontal?(f=o/2,a=Math.min(n,r),l=Math.max(n,r),c=s-f,d=s+f):(f=i/2,a=n-f,l=n+f,c=Math.min(s,r),d=Math.max(s,r)),{left:a,top:c,right:l,bottom:d}}function ds(t,e,n,s){return t?0:ct(e,n,s)}function Tj(t,e,n){const s=t.options.borderWidth,r=t.borderSkipped,i=Ty(s);return{t:ds(r.top,i.top,0,n),r:ds(r.right,i.right,0,e),b:ds(r.bottom,i.bottom,0,n),l:ds(r.left,i.left,0,e)}}function Dj(t,e,n){const{enableBorderRadius:s}=t.getProps(["enableBorderRadius"]),r=t.options.borderRadius,i=Wr(r),o=Math.min(e,n),a=t.borderSkipped,l=s||ne(r);return{topLeft:ds(!l||a.top||a.left,i.topLeft,0,o),topRight:ds(!l||a.top||a.right,i.topRight,0,o),bottomLeft:ds(!l||a.bottom||a.left,i.bottomLeft,0,o),bottomRight:ds(!l||a.bottom||a.right,i.bottomRight,0,o)}}function Lj(t){const e=Jy(t),n=e.right-e.left,s=e.bottom-e.top,r=Tj(t,n/2,s/2),i=Dj(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 xu(t,e,n,s){const r=e===null,i=n===null,a=t&&!(r&&i)&&Jy(t,s);return a&&(r||Vs(e,a.left,a.right))&&(i||Vs(n,a.top,a.bottom))}function Aj(t){return t.topLeft||t.topRight||t.bottomLeft||t.bottomRight}function Ij(t,e){t.rect(e.x,e.y,e.w,e.h)}function yu(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 ll extends Ns{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}=Lj(this),a=Aj(o.radius)?Hl:Ij;e.save(),(o.w!==i.w||o.h!==i.h)&&(e.beginPath(),a(e,yu(o,n,i)),e.clip(),a(e,yu(i,-n,o)),e.fillStyle=s,e.fill("evenodd")),e.beginPath(),a(e,yu(i,n)),e.fillStyle=r,e.fill(),e.restore()}inRange(e,n,s){return xu(this,e,n,s)}inXRange(e,n){return xu(this,e,null,n)}inYRange(e,n){return xu(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}}$(ll,"id","bar"),$(ll,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),$(ll,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});const Hg=(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)}},Fj=(t,e)=>t!==null&&e!==null&&t.datasetIndex===e.datasetIndex&&t.index===e.index;class Vg extends Ns{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=he(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=ut(s.font),i=r.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Hg(s,i);let c,d;n.font=r.string,this.isHorizontal()?(c=this.maxWidth,d=this._fitRows(o,i,a,l)+10):(d=this.maxHeight,c=this._fitCols(o,r,a,l)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(d,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],d=r+a;let f=e;i.textAlign="left",i.textBaseline="middle";let h=-1,p=-d;return this.legendItems.forEach((x,g)=>{const b=s+n/2+i.measureText(x.text).width;(g===0||c[c.length-1]+b+2*a>o)&&(f+=d,c[c.length-(g>0?0:1)]=0,p+=d,h++),l[g]={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=[],d=o-e;let f=a,h=0,p=0,x=0,g=0;return this.legendItems.forEach((b,y)=>{const{itemWidth:m,itemHeight:v}=zj(s,n,i,b,r);y>0&&p+v+2*a>d&&(f+=h+a,c.push({width:h,height:p}),x+=h+a,g++,h=p=0),l[y]={left:x,top:p,col:g,width:m,height:v},h=Math.max(h,m),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=Hr(i,this.left,this.width);if(this.isHorizontal()){let a=0,l=vt(s,this.left+r,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=vt(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=vt(s,this.top+e+r,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=vt(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;Gf(e,this),this._draw(),Jf(e)}}_draw(){const{options:e,columnSizes:n,lineWidths:s,ctx:r}=this,{align:i,labels:o}=e,a=Ee.color,l=Hr(e.rtl,this.left,this.width),c=ut(o.font),{padding:d}=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:x,boxHeight:g,itemHeight:b}=Hg(o,f),y=function(k,C,j){if(isNaN(x)||x<=0||isNaN(g)||g<0)return;r.save();const P=ee(j.lineWidth,1);if(r.fillStyle=ee(j.fillStyle,a),r.lineCap=ee(j.lineCap,"butt"),r.lineDashOffset=ee(j.lineDashOffset,0),r.lineJoin=ee(j.lineJoin,"miter"),r.lineWidth=P,r.strokeStyle=ee(j.strokeStyle,a),r.setLineDash(ee(j.lineDash,[])),o.usePointStyle){const E={radius:g*Math.SQRT2/2,pointStyle:j.pointStyle,rotation:j.rotation,borderWidth:P},R=l.xPlus(k,x/2),M=C+h;Ry(r,E,R,M,o.pointStyleWidth&&x)}else{const E=C+Math.max((f-g)/2,0),R=l.leftForLtr(k,x),M=Wr(j.borderRadius);r.beginPath(),Object.values(M).some(A=>A!==0)?Hl(r,{x:R,y:E,w:x,h:g,radius:M}):r.rect(R,E,x,g),r.fill(),P!==0&&r.stroke()}r.restore()},m=function(k,C,j){Wl(r,j.text,k,C+b/2,c,{strikethrough:j.hidden,textAlign:l.textAlign(j.textAlign)})},v=this.isHorizontal(),S=this._computeTitleHeight();v?p={x:vt(i,this.left+d,this.right-s[0]),y:this.top+d+S,line:0}:p={x:this.left+d,y:vt(i,this.top+S+d,this.bottom-n[0].height),line:0},Fy(this.ctx,e.textDirection);const _=b+d;this.legendItems.forEach((k,C)=>{r.strokeStyle=k.fontColor,r.fillStyle=k.fontColor;const j=r.measureText(k.text).width,P=l.textAlign(k.textAlign||(k.textAlign=o.textAlign)),E=x+h+j;let R=p.x,M=p.y;l.setWidth(this.width),v?C>0&&R+E+d>this.right&&(M=p.y+=_,p.line++,R=p.x=vt(i,this.left+d,this.right-s[p.line])):C>0&&M+_>this.bottom&&(R=p.x=R+n[p.line].width+d,p.line++,M=p.y=vt(i,this.top+S+d,this.bottom-n[p.line].height));const A=l.x(R);if(y(A,M,k),R=ak(P,R+x+h,v?R+E:this.right,e.rtl),m(l.x(R),M,k),v)p.x+=E+d;else if(typeof k.text!="string"){const U=c.lineHeight;p.y+=Zy(k,U)+d}else p.y+=_}),zy(this.ctx,e.textDirection)}drawTitle(){const e=this.options,n=e.title,s=ut(n.font),r=Gt(n.padding);if(!n.display)return;const i=Hr(e.rtl,this.left,this.width),o=this.ctx,a=n.position,l=s.size/2,c=r.top+l;let d,f=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),d=this.top+c,f=vt(e.align,f,this.right-h);else{const x=this.columnSizes.reduce((g,b)=>Math.max(g,b.height),0);d=c+vt(e.align,this.top,this.bottom-x-e.labels.padding-this._computeTitleHeight())}const p=vt(a,f,f+h);o.textAlign=i.textAlign(Ey(a)),o.textBaseline="middle",o.strokeStyle=n.color,o.fillStyle=n.color,o.font=s.string,Wl(o,n.text,p,d,s)}_computeTitleHeight(){const e=this.options.title,n=ut(e.font),s=Gt(e.padding);return e.display?n.lineHeight+s.height:0}_getLegendItemAt(e,n){let s,r,i;if(Vs(e,this.left,this.right)&&Vs(n,this.top,this.bottom)){for(i=this.legendHitBoxes,s=0;s<i.length;++s)if(r=i[s],Vs(e,r.left,r.left+r.width)&&Vs(n,r.top,r.top+r.height))return this.legendItems[s]}return null}handleEvent(e){const n=this.options;if(!Uj(e.type,n))return;const s=this._getLegendItemAt(e.x,e.y);if(e.type==="mousemove"||e.type==="mouseout"){const r=this._hoveredItem,i=Fj(r,s);r&&!i&&he(n.onLeave,[e,r,this],this),this._hoveredItem=s,s&&!i&&he(n.onHover,[e,s,this],this)}else s&&he(n.onClick,[e,s,this],this)}}function zj(t,e,n,s,r){const i=Bj(s,t,e,n),o=$j(r,s,e.lineHeight);return{itemWidth:i,itemHeight:o}}function Bj(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 $j(t,e,n){let s=t;return typeof e.text!="string"&&(s=Zy(e,n)),s}function Zy(t,e){const n=t.text?t.text.length:0;return e*n}function Uj(t,e){return!!((t==="mousemove"||t==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(t==="click"||t==="mouseup"))}var Wj={id:"legend",_element:Vg,start(t,e,n){const s=t.legend=new Vg({ctx:t.ctx,options:n,chart:t});us.configure(t,s,n),us.addBox(t,s)},stop(t){us.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,n){const s=t.legend;us.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),d=Gt(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:(d.width+d.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 to={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(),d=tk(e,c);d<r&&(r=d,a=l)}}if(a){const l=a.tooltipPosition();n=l.x,s=l.y}return{x:n,y:s}}};function ln(t,e){return e&&(Fe(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function _n(t){return(typeof t=="string"||t instanceof String)&&t.indexOf(`
83
83
  `)>-1?t.split(`
84
- `):t}function Hj(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 Qg(t,e){const n=t.chart.ctx,{body:s,footer:r,title:i}=t,{boxWidth:o,boxHeight:a}=e,l=ut(e.bodyFont),c=ut(e.titleFont),d=ut(e.footerFont),f=i.length,h=r.length,p=s.length,x=Gt(e.padding);let g=x.height,b=0,y=s.reduce((S,_)=>S+_.before.length+_.lines.length+_.after.length,0);if(y+=t.beforeBody.length+t.afterBody.length,f&&(g+=f*c.lineHeight+(f-1)*e.titleSpacing+e.titleMarginBottom),y){const S=e.displayColors?Math.max(a,l.lineHeight):l.lineHeight;g+=p*S+(y-p)*l.lineHeight+(y-1)*e.bodySpacing}h&&(g+=e.footerMarginTop+h*d.lineHeight+(h-1)*e.footerSpacing);let m=0;const v=function(S){b=Math.max(b,n.measureText(S).width+m)};return n.save(),n.font=c.string,ae(t.title,v),n.font=l.string,ae(t.beforeBody.concat(t.afterBody),v),m=e.displayColors?o+2+e.boxPadding:0,ae(s,S=>{ae(S.before,v),ae(S.lines,v),ae(S.after,v)}),m=0,n.font=d.string,ae(t.footer,v),n.restore(),b+=x.width,{width:b,height:g}}function Vj(t,e){const{y:n,height:s}=e;return n<s/2?"top":n>t.height-s/2?"bottom":"center"}function Qj(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 Kj(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"),Qj(c,t,e,n)&&(c="center"),c}function Kg(t,e,n){const s=n.yAlign||e.yAlign||Vj(t,n);return{xAlign:n.xAlign||e.xAlign||Kj(t,e,n,s),yAlign:s}}function Yj(t,e){let{x:n,width:s}=t;return e==="right"?n-=s:e==="center"&&(n-=s/2),n}function Xj(t,e,n){let{y:s,height:r}=t;return e==="top"?s+=n:e==="bottom"?s-=r+n:s-=r/2,s}function Yg(t,e,n,s){const{caretSize:r,caretPadding:i,cornerRadius:o}=t,{xAlign:a,yAlign:l}=n,c=r+i,{topLeft:d,topRight:f,bottomLeft:h,bottomRight:p}=Wr(o);let x=Yj(e,a);const g=Xj(e,l,c);return l==="center"?a==="left"?x+=c:a==="right"&&(x-=c):a==="left"?x-=Math.max(d,h)+r:a==="right"&&(x+=Math.max(f,p)+r),{x:ct(x,0,s.width-e.width),y:ct(g,0,s.height-e.height)}}function Ba(t,e,n){const s=Gt(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-s.right:t.x+s.left}function Xg(t){return ln([],_n(t))}function qj(t,e,n){return bi(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function qg(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const tv={beforeTitle:bn,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:bn,beforeBody:bn,beforeLabel:bn,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 ue(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:bn,afterBody:bn,beforeFooter:bn,footer:bn,afterFooter:bn};function rt(t,e,n,s){const r=t[e].call(n,s);return typeof r>"u"?tv[e].call(n,s):r}class Fd extends Ns{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 $y(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=qj(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:s}=n,r=rt(s,"beforeTitle",this,e),i=rt(s,"title",this,e),o=rt(s,"afterTitle",this,e);let a=[];return a=ln(a,_n(r)),a=ln(a,_n(i)),a=ln(a,_n(o)),a}getBeforeBody(e,n){return Xg(rt(n.callbacks,"beforeBody",this,e))}getBody(e,n){const{callbacks:s}=n,r=[];return ae(e,i=>{const o={before:[],lines:[],after:[]},a=qg(s,i);ln(o.before,_n(rt(a,"beforeLabel",this,i))),ln(o.lines,rt(a,"label",this,i)),ln(o.after,_n(rt(a,"afterLabel",this,i))),r.push(o)}),r}getAfterBody(e,n){return Xg(rt(n.callbacks,"afterBody",this,e))}getFooter(e,n){const{callbacks:s}=n,r=rt(s,"beforeFooter",this,e),i=rt(s,"footer",this,e),o=rt(s,"afterFooter",this,e);let a=[];return a=ln(a,_n(r)),a=ln(a,_n(i)),a=ln(a,_n(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(Hj(this.chart,n[l]));return e.filter&&(a=a.filter((d,f,h)=>e.filter(d,f,h,s))),e.itemSort&&(a=a.sort((d,f)=>e.itemSort(d,f,s))),ae(a,d=>{const f=qg(e.callbacks,d);r.push(rt(f,"labelColor",this,d)),i.push(rt(f,"labelPointStyle",this,d)),o.push(rt(f,"labelTextColor",this,d))}),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=eo[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=Qg(this,s),c=Object.assign({},a,l),d=Kg(this.chart,s,c),f=Yg(s,c,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.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:d,bottomRight:f}=Wr(a),{x:h,y:p}=e,{width:x,height:g}=n;let b,y,m,v,S,_;return i==="center"?(S=p+g/2,r==="left"?(b=h,y=b-o,v=S+o,_=S-o):(b=h+x,y=b+o,v=S-o,_=S+o),m=b):(r==="left"?y=h+Math.max(l,d)+o:r==="right"?y=h+x-Math.max(c,f)-o:y=this.caretX,i==="top"?(v=p,S=v-o,b=y-o,m=y+o):(v=p+g,S=v+o,b=y+o,m=y-o),_=v),{x1:b,x2:y,x3:m,y1:v,y2:S,y3:_}}drawTitle(e,n,s){const r=this.title,i=r.length;let o,a,l;if(i){const c=Hr(s.rtl,this.x,this.width);for(e.x=Ba(this,s.titleAlign,s),n.textAlign=c.textAlign(s.titleAlign),n.textBaseline="middle",o=ut(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,d=ut(i.bodyFont),f=Ba(this,"left",i),h=r.x(f),p=l<d.lineHeight?(d.lineHeight-l)/2:0,x=n.y+p;if(i.usePointStyle){const g={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},b=r.leftForLtr(h,c)+c/2,y=x+l/2;e.strokeStyle=i.multiKeyBackground,e.fillStyle=i.multiKeyBackground,dg(e,g,b,y),e.strokeStyle=o.borderColor,e.fillStyle=o.backgroundColor,dg(e,g,b,y)}else{e.lineWidth=ne(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 g=r.leftForLtr(h,c),b=r.leftForLtr(r.xPlus(h,1),c-2),y=Wr(o.borderRadius);Object.values(y).some(m=>m!==0)?(e.beginPath(),e.fillStyle=i.multiKeyBackground,Wl(e,{x:g,y:x,w:c,h:l,radius:y}),e.fill(),e.stroke(),e.fillStyle=o.backgroundColor,e.beginPath(),Wl(e,{x:b,y:x+1,w:c-2,h:l-2,radius:y}),e.fill()):(e.fillStyle=i.multiKeyBackground,e.fillRect(g,x,c,l),e.strokeRect(g,x,c,l),e.fillStyle=o.backgroundColor,e.fillRect(b,x+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:d}=s,f=ut(s.bodyFont);let h=f.lineHeight,p=0;const x=Hr(s.rtl,this.x,this.width),g=function(N){n.fillText(N,x.x(e.x+p),e.y+h/2),e.y+=h+i},b=x.textAlign(o);let y,m,v,S,_,k,C;for(n.textAlign=o,n.textBaseline="middle",n.font=f.string,e.x=Ba(this,b,s),n.fillStyle=s.bodyColor,ae(this.beforeBody,g),p=a&&b!=="right"?o==="center"?c/2+d:c+2+d:0,S=0,k=r.length;S<k;++S){for(y=r[S],m=this.labelTextColors[S],n.fillStyle=m,ae(y.before,g),v=y.lines,a&&v.length&&(this._drawColorBox(n,e,S,x,s),h=Math.max(f.lineHeight,l)),_=0,C=v.length;_<C;++_)g(v[_]),h=f.lineHeight;ae(y.after,g)}p=0,h=f.lineHeight,ae(this.afterBody,g),e.y-=i}drawFooter(e,n,s){const r=this.footer,i=r.length;let o,a;if(i){const l=Hr(s.rtl,this.x,this.width);for(e.x=Ba(this,s.footerAlign,s),e.y+=s.footerMarginTop,n.textAlign=l.textAlign(s.footerAlign),n.textBaseline="middle",o=ut(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:d}=s,{topLeft:f,topRight:h,bottomLeft:p,bottomRight:x}=Wr(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+d-x),n.quadraticCurveTo(a+c,l+d,a+c-x,l+d),o==="bottom"&&this.drawCaret(e,n,s,r),n.lineTo(a+p,l+d),n.quadraticCurveTo(a,l+d,a,l+d-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=eo[e.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=Qg(this,e),l=Object.assign({},o,this._size),c=Kg(n,e,l),d=Yg(e,l,c,n);(r._to!==d.x||i._to!==d.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,d))}}_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=Gt(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),zy(e,n.textDirection),i.y+=o.top,this.drawTitle(i,e,n),this.drawBody(i,e,n),this.drawFooter(i,e,n),By(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=!Il(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||!Il(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=eo[i.position].call(this,e,n);return o!==!1&&(s!==o.x||r!==o.y)}}$(Fd,"positioners",eo);var Gj={id:"tooltip",_element:Fd,positioners:eo,afterInit(t,e,n){n&&(t.tooltip=new Fd({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:tv},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 Jj=(t,e,n,s)=>(typeof e=="string"?(n=t.push(e)-1,s.unshift({index:n,label:e})):isNaN(e)&&(n=null),n);function Zj(t,e,n,s){const r=t.indexOf(e);if(r===-1)return Jj(t,e,n,s);const i=t.lastIndexOf(e);return r!==i?n:r}const eN=(t,e)=>t===null?null:ct(Math.round(t),0,e);function Gg(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}class zd extends wi{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(ue(e))return null;const s=this.getLabels();return n=isFinite(n)&&s[n]===e?n:Zj(s,e,ee(n,e),this._addedLabels),eN(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 Gg.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}}$(zd,"id","category"),$(zd,"defaults",{ticks:{callback:Gg}});function tN(t,e){const n=[],{bounds:r,step:i,min:o,max:a,precision:l,count:c,maxTicks:d,maxDigits:f,includeBounds:h}=t,p=i||1,x=d-1,{min:g,max:b}=e,y=!ue(o),m=!ue(a),v=!ue(c),S=(b-g)/(f+1);let _=ng((b-g)/x/p)*p,k,C,N,P;if(_<1e-14&&!y&&!m)return[{value:g},{value:b}];P=Math.ceil(b/_)-Math.floor(g/_),P>x&&(_=ng(P*_/x/p)*p),ue(l)||(k=Math.pow(10,l),_=Math.ceil(_*k)/k),r==="ticks"?(C=Math.floor(g/_)*_,N=Math.ceil(b/_)*_):(C=g,N=b),y&&m&&i&&J_((a-o)/i,_/1e3)?(P=Math.round(Math.min((a-o)/_,d)),_=(a-o)/P,C=o,N=a):v?(C=y?o:C,N=m?a:N,P=c-1,_=(N-C)/P):(P=(N-C)/_,sl(P,Math.round(P),_/1e3)?P=Math.round(P):P=Math.ceil(P));const M=Math.max(sg(_),sg(C));k=Math.pow(10,ue(l)?M:l),C=Math.round(C*k)/k,N=Math.round(N*k)/k;let O=0;for(y&&(h&&C!==o?(n.push({value:o}),C<o&&O++,sl(Math.round((C+O*_)*k)/k,o,Jg(o,S,t))&&O++):C<o&&O++);O<P;++O){const E=Math.round((C+O*_)*k)/k;if(m&&E>a)break;n.push({value:E})}return m&&h&&N!==a?n.length&&sl(n[n.length-1].value,a,Jg(a,S,t))?n[n.length-1].value=a:n.push({value:a}):(!m||N===a)&&n.push({value:N}),n}function Jg(t,e,{horizontal:n,minRotation:s}){const r=Pn(s),i=(n?Math.sin(r):Math.cos(r))||.001,o=.75*e*(""+t).length;return Math.min(e/i,o)}class nN extends wi{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 ue(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=Ss(r),c=Ss(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=tN(r,i);return e.bounds==="ticks"&&Z_(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 qf(e,this.chart.options.locale,this.options.ticks.format)}}class Bd extends nN{determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=Ft(e)?e:0,this.max=Ft(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),n=e?this.width:this.height,s=Pn(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}}$(Bd,"id","linear"),$(Bd,"defaults",{ticks:{callback:Ry.formatters.numeric}});const Sc={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}},at=Object.keys(Sc);function Zg(t,e){return t-e}function em(t,e){if(ue(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)),Ft(o)||(o=typeof s=="string"?n.parse(o,s):n.parse(o)),o===null?null:(r&&(o=r==="week"&&(Bl(i)||i===!0)?n.startOf(o,"isoWeek",i):n.startOf(o,r)),+o)}function tm(t,e,n,s){const r=at.length;for(let i=at.indexOf(t);i<r-1;++i){const o=Sc[at[i]],a=o.steps?o.steps:Number.MAX_SAFE_INTEGER;if(o.common&&Math.ceil((n-e)/(a*o.size))<=s)return at[i]}return at[r-1]}function sN(t,e,n,s,r){for(let i=at.length-1;i>=at.indexOf(n);i--){const o=at[i];if(Sc[o].common&&t._adapter.diff(r,s,o)>=e-1)return o}return at[n?at.indexOf(n):0]}function rN(t){for(let e=at.indexOf(t)+1,n=at.length;e<n;++e)if(Sc[at[e]].common)return at[e]}function nm(t,e,n){if(!n)t[e]=!0;else if(n.length){const{lo:s,hi:r}=Xf(n,e),i=n[s]>=e?n[s]:n[r];t[i]=!0}}function iN(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 sm(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:iN(t,s,r,n)}class Kl extends wi{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 xC._date(e.adapters.date);r.init(n),uo(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:em(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=Ft(r)&&!isNaN(r)?r:+n.startOf(Date.now(),s),i=Ft(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=rk(r,i,o);return this._unit=n.unit||(s.autoSkip?tm(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):sN(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!s.major.enabled||this._unit==="year"?void 0:rN(this._unit),this.initOffsets(r),e.reverse&&a.reverse(),sm(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=ct(n,0,o),s=ct(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||tm(i.minUnit,n,s,this._getLabelCapacity(n)),a=ee(r.ticks.stepSize,1),l=o==="week"?i.isoWeekday:!1,c=Bl(l)||l===!0,d={};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 x=r.ticks.source==="data"&&this.getDataTimestamps();for(h=f,p=0;h<s;h=+e.add(h,a,o),p++)nm(d,h,x);return(h===s||r.bounds==="ticks"||p===1)&&nm(d,h,x),Object.keys(d).sort(Zg).map(g=>+g)}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 he(o,[e,n,s],this);const a=i.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&a[l],f=c&&a[c],h=s[n],p=c&&f&&h&&h.major;return this._adapter.format(e,r||(p?f:d))}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=Pn(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,sm(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(em(this,r[n]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return jy(e.sort(Zg))}}$(Kl,"id","time"),$(Kl,"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 $a(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}=Td(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}=Td(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 rm extends Kl{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=$a(n,this.min),this._tableRange=$a(n,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:n,max:s}=this,r=[],i=[];let o,a,l,c,d;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)d=r[o+1],l=r[o-1],c=r[o],Math.round((d+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($a(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const n=this._offsets,s=this.getDecimalForPixel(e)/n.factor-n.end;return $a(this._table,s*this._tableRange+this._minPos,!0)}}$(rm,"id","timeseries"),$(rm,"defaults",Kl.defaults);const nv="label";function im(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function oN(t,e){const n=t.options;n&&e&&Object.assign(n,e)}function sv(t,e){t.labels=e}function rv(t,e,n=nv){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 aN(t,e=nv){const n={labels:[],datasets:[]};return sv(n,t.labels),rv(n,t.datasets,e),n}function lN(t,e){const{height:n=150,width:s=300,redraw:r=!1,datasetIdKey:i,type:o,data:a,options:l,plugins:c=[],fallbackContent:d,updateMode:f,...h}=t,p=w.useRef(null),x=w.useRef(null),g=()=>{p.current&&(x.current=new wc(p.current,{type:o,data:aN(a,i),options:l&&{...l},plugins:c}),im(e,x.current))},b=()=>{im(e,null),x.current&&(x.current.destroy(),x.current=null)};return w.useEffect(()=>{!r&&x.current&&l&&oN(x.current,l)},[r,l]),w.useEffect(()=>{!r&&x.current&&sv(x.current.config.data,a.labels)},[r,a.labels]),w.useEffect(()=>{!r&&x.current&&a.datasets&&rv(x.current.config.data,a.datasets,i)},[r,a.datasets]),w.useEffect(()=>{x.current&&(r?(b(),setTimeout(g)):x.current.update(f))},[r,l,a.labels,a.datasets,f]),w.useEffect(()=>{x.current&&(b(),setTimeout(g))},[o]),w.useEffect(()=>(g(),()=>b()),[]),u.jsx("canvas",{ref:p,role:"img",height:n,width:s,...h,children:d})}const cN=w.forwardRef(lN);function iv(t,e){return wc.register(e),w.forwardRef((n,s)=>u.jsx(cN,{...n,ref:s,type:t}))}const uN=iv("bar",rl),dN=iv("doughnut",Gi),St=["leads","em_contato","proposta","fechado"],Rn={leads:"Novos Leads",em_contato:"Em Contato",proposta:"Proposta",fechado:"Fechado"};wc.register(Zi,al,zd,Bd,Wj,Gj);function fN({porEtapa:t}){const e=St.map(s=>t[s]??0),n=Math.max(20,Math.ceil((Math.max(...e)+1)/20)*20);return u.jsx("div",{className:"mt-4 h-64",children:u.jsx(uN,{data:{labels:St.map(s=>Rn[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 hN({enviadas:t,erros:e}){return u.jsx("div",{className:"mt-4 h-64 flex items-center justify-center",children:u.jsx(dN,{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 pN=1e4;function gN({nomeUsuario:t}){const{data:e,isPending:n,isError:s,error:r,refetch:i}=ey({queryKey:["metrics"],queryFn:()=>W.metricas(),refetchInterval:pN,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 u.jsxs("div",{className:"space-y-6",children:[u.jsxs("div",{children:[u.jsxs("h1",{className:"text-2xl font-bold text-gray-800",children:["Olá, ",t," 👋 bem-vindo ao seu painel"]}),u.jsxs("div",{className:"mt-2 flex items-center justify-between text-sm text-gray-500",children:[u.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&&u.jsxs("span",{children:["Restam ",u.jsx("strong",{className:"text-gray-700",children:c===null?"∞":`${c} dias`})]})]})]}),a&&u.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 rounded-xl px-4 py-3 text-sm",children:[u.jsx("i",{className:"fas fa-exclamation-triangle mr-2"}),a]}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[u.jsxs(Ma,{rotulo:"Status da Conexão",icone:"fas fa-plug",children:[u.jsx("div",{className:"mt-2 flex items-center",children:u.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:[u.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"]})}),u.jsxs("p",{className:"text-[11px] text-gray-400 mt-2",children:[u.jsx("i",{className:"fas fa-brain mr-1"}),e!=null&&e.conexao.llm?"LLM ✓":"LLM não configurado"," ·"," ",u.jsx("i",{className:"fas fa-paper-plane mr-1"}),e!=null&&e.conexao.openoutreach?"OpenOutreach ✓":"OpenOutreach não configurado"]})]}),u.jsx(Ma,{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"}),u.jsx(Ma,{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"}),u.jsx(Ma,{rotulo:"Leads cadastrados",valor:o?"—":(e==null?void 0:e.leads_total)??0,subtitulo:"Total na base",icone:"fas fa-users"})]}),u.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[u.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6 border border-gray-100",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("h3",{className:"text-base font-semibold text-gray-800",children:"Leads por etapa (CRM)"}),u.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Quantidade de leads em cada coluna do Kanban"})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsxs("span",{className:"text-[11px] text-gray-300 hidden sm:inline",title:"O painel atualiza sozinho",children:[u.jsx("i",{className:"fas fa-rotate mr-1"}),"a cada 10s"]}),u.jsx("button",{onClick:()=>i(),className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:"Atualizar"})]})]}),e?u.jsx(fN,{porEtapa:e.leads_por_etapa}):u.jsx(mN,{})]}),u.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6 border border-gray-100",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("h3",{className:"text-base font-semibold text-gray-800",children:"Desempenho das campanhas"}),u.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Agregação de todas as campanhas (Enviadas × Erros)"})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsxs("span",{className:"text-[11px] text-gray-300 hidden sm:inline",title:"O painel atualiza sozinho",children:[u.jsx("i",{className:"fas fa-rotate mr-1"}),"a cada 10s"]}),u.jsx("button",{onClick:()=>i(),className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:"Atualizar"})]})]}),u.jsx(hN,{enviadas:(e==null?void 0:e.campanhas.enviadas)??0,erros:(e==null?void 0:e.campanhas.erros)??0}),u.jsxs("div",{className:"mt-4 flex items-center justify-center space-x-6 text-xs",children:[u.jsxs("span",{className:"flex items-center",children:[u.jsx("span",{className:"w-3 h-3 bg-blue-500 rounded-full mr-1.5"})," Enviadas (",(e==null?void 0:e.campanhas.enviadas)??0,")"]}),u.jsxs("span",{className:"flex items-center",children:[u.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 mN(){return u.jsx("div",{className:"mt-4 h-64 flex items-center justify-center text-gray-300",children:u.jsx("i",{className:"fas fa-spinner fa-spin text-2xl"})})}function Tt({titulo:t,icone:e="fas fa-sliders",children:n,abertoInicial:s=!1}){const[r,i]=w.useState(s);return u.jsxs("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:[u.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:[u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx("i",{className:H(e,"text-gray-400")})," ",t]}),u.jsx("i",{className:H("fas fa-chevron-down text-xs text-gray-400 transition-transform",r&&"rotate-180")})]}),r&&u.jsx("div",{className:"px-4 py-4 bg-white space-y-3",children:n})]})}function _c({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 u.jsxs("div",{className:H("w-full",s),children:[n&&u.jsxs("div",{className:"flex justify-between text-xs text-gray-500 mb-1",children:[u.jsx("span",{children:"Progresso"}),u.jsxs("span",{className:"font-semibold text-gray-700",children:[r,"%"]})]}),u.jsx("div",{className:H("w-full bg-gray-200 rounded-full overflow-hidden",i[e]),children:u.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 xN={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"},yN={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 _s({status:t,rotulo:e,className:n}){const s=xN[t]||"bg-gray-100 text-gray-600";return u.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||yN[t]||t})}const vN={nome:"",telefone:"",email:"",fonte:"Manual",etapa:"leads"};function bN(){const{toast:t}=en(),[e,n]=w.useState([]),[s,r]=w.useState(""),[i,o]=w.useState("todas"),[a,l]=w.useState(!1),[c,d]=w.useState(null),[f,h]=w.useState(null),[p,x]=w.useState(null),g=w.useCallback(async()=>{n(await W.leads.listar())},[]);w.useEffect(()=>{g().catch(k=>t("erro",k.message))},[g,t]);const b=w.useMemo(()=>{const k=s.trim().toLowerCase();return e.filter(C=>{const N=!k||C.nome.toLowerCase().includes(k)||C.telefone.includes(k)||C.email.toLowerCase().includes(k),P=i==="todas"||C.etapa===i;return N&&P})},[e,s,i]),y=()=>{d({...vN}),l(!0)},m=k=>{d({...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:C,criado_em:N,atualizado_em:P,...M}=c;await W.leads.atualizar(C,M),t("sucesso","Lead atualizado.")}else await W.leads.criar(c),t("sucesso","Lead criado com sucesso.");l(!1),d(null),await g()}catch(C){t("erro",C instanceof Error?C.message:"Falha ao salvar lead.")}},S=async()=>{if(f)try{await W.leads.remover(f.id),t("sucesso",`Lead "${f.nome}" removido.`),h(null),await g()}catch(k){t("erro",k instanceof Error?k.message:"Falha ao remover.")}},_=async k=>{x(k.id);try{(await W.leads.enriquecer(k.id)).notas.forEach(N=>t("info",N)),t("sucesso","Lead enriquecido."),await g()}catch(C){t("erro",C instanceof Error?C.message:"Falha ao enriquecer.")}finally{x(null)}};return u.jsxs("div",{className:"space-y-6",children:[u.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[u.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-[280px]",children:[u.jsxs("div",{className:"relative flex-1 max-w-md",children:[u.jsx("i",{className:"fas fa-search absolute left-3 top-2.5 text-gray-400 text-sm"}),u.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"})]}),u.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:[u.jsx("option",{value:"todas",children:"Todas as etapas"}),St.map(k=>u.jsx("option",{value:k,children:Rn[k]},k))]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs("button",{onClick:()=>d_(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:[u.jsx("i",{className:"fas fa-download mr-2"})," Exportar"]}),u.jsxs("button",{onClick:y,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:[u.jsx("i",{className:"fas fa-plus mr-2"})," Novo Lead"]})]})]}),u.jsx("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden",children:u.jsx("div",{className:"overflow-x-auto",children:u.jsxs("table",{className:"w-full text-sm",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"text-left text-xs text-gray-500 uppercase border-b border-gray-100 bg-gray-50/50",children:[u.jsx("th",{className:"px-5 py-3 font-semibold",children:"Lead"}),u.jsx("th",{className:"px-5 py-3 font-semibold",children:"Contato"}),u.jsx("th",{className:"px-5 py-3 font-semibold",children:"Etapa"}),u.jsx("th",{className:"px-5 py-3 font-semibold",children:"Completude"}),u.jsx("th",{className:"px-5 py-3 font-semibold",children:"Atualizado"}),u.jsx("th",{className:"px-5 py-3 font-semibold text-right",children:"Ações"})]})}),u.jsxs("tbody",{children:[b.map(k=>{const C=l_(k),N=c_(k);return u.jsxs("tr",{className:"border-b border-gray-50 hover:bg-indigo-50/40 transition",children:[u.jsxs("td",{className:"px-5 py-3",children:[u.jsx("p",{className:"font-medium text-gray-800",children:k.nome}),u.jsxs("p",{className:"text-xs text-gray-400",children:[k.fonte,k.empresa?` · ${k.empresa}`:""]})]}),u.jsxs("td",{className:"px-5 py-3 text-gray-600",children:[u.jsx("p",{children:k.telefone||"—"}),u.jsx("p",{className:"text-xs text-gray-400",children:k.email||"sem e-mail"})]}),u.jsx("td",{className:"px-5 py-3",children:u.jsx(_s,{status:k.etapa})}),u.jsxs("td",{className:"px-5 py-3 w-52",children:[u.jsx(_c,{valor:C,altura:"sm"}),u.jsx("p",{className:"text-[11px] text-gray-400 mt-1",children:u_(C,N)})]}),u.jsx("td",{className:"px-5 py-3 text-xs text-gray-400",children:Al(k.atualizado_em)}),u.jsxs("td",{className:"px-5 py-3 text-right whitespace-nowrap",children:[u.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:u.jsx("i",{className:H("fas fa-wand-magic-sparkles",p===k.id&&"fa-spin")})}),u.jsx("button",{onClick:()=>m(k),title:"Editar",className:"text-gray-400 hover:text-indigo-600 px-1.5",children:u.jsx("i",{className:"fas fa-pen"})}),u.jsx("button",{onClick:()=>h(k),title:"Excluir",className:"text-gray-400 hover:text-red-600 px-1.5",children:u.jsx("i",{className:"fas fa-trash"})})]})]},k.id)}),b.length===0&&u.jsx("tr",{children:u.jsxs("td",{colSpan:6,className:"px-5 py-16 text-center text-gray-400",children:[u.jsx("i",{className:"fas fa-users text-3xl text-gray-200 block mb-3"}),"Nenhum lead encontrado. Crie um novo ou importe pelos Extratores."]})})]})]})})}),u.jsx(Xt,{aberto:a,onFechar:()=>l(!1),titulo:c!=null&&c.id?"Editar lead":"Novo lead",icone:"fas fa-user-plus",children:c&&u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[u.jsx(Is,{rotulo:"Nome *",valor:c.nome||"",onChange:k=>d({...c,nome:k})}),u.jsx(Is,{rotulo:"Telefone",valor:c.telefone||"",onChange:k=>d({...c,telefone:k}),placeholder:"(11) 99999-9999"}),u.jsx(Is,{rotulo:"E-mail",tipo:"email",valor:c.email||"",onChange:k=>d({...c,email:k}),placeholder:"contato@empresa.com.br"}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Etapa"}),u.jsx("select",{value:c.etapa||"leads",onChange:k=>d({...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:St.map(k=>u.jsx("option",{value:k,children:Rn[k]},k))})]})]}),u.jsxs(Tt,{titulo:"Campos avançados",icone:"fas fa-sliders",children:[u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[u.jsx(Is,{rotulo:"Empresa",valor:c.empresa||"",onChange:k=>d({...c,empresa:k})}),u.jsx(Is,{rotulo:"CNPJ",valor:c.cnpj||"",onChange:k=>d({...c,cnpj:k}),placeholder:"00.000.000/0000-00"}),u.jsx(Is,{rotulo:"Cidade",valor:c.cidade||"",onChange:k=>d({...c,cidade:k}),placeholder:"São Paulo/SP"}),u.jsx(Is,{rotulo:"Fonte",valor:c.fonte||"",onChange:k=>d({...c,fonte:k}),placeholder:"Google Maps, Instagram, CNPJ..."})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Observações"}),u.jsx("textarea",{value:c.observacoes||"",onChange:k=>d({...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..."})]})]}),u.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[u.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"}),u.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:[u.jsx("i",{className:"fas fa-save mr-2"})," Salvar"]})]})]})}),u.jsxs(Xt,{aberto:!!f,onFechar:()=>h(null),titulo:"Excluir lead",icone:"fas fa-trash",children:[u.jsxs("p",{className:"text-sm text-gray-600",children:["Tem certeza que deseja excluir ",u.jsx("strong",{children:f==null?void 0:f.nome}),"? Essa ação não pode ser desfeita."]}),u.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[u.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"}),u.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 Is({rotulo:t,valor:e,onChange:n,tipo:s="text",placeholder:r}){return u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:t}),u.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"})]})}function wN(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return w.useMemo(()=>s=>{e.forEach(r=>r(s))},e)}const kc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Si(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function oh(t){return"nodeType"in t}function st(t){var e,n;return t?Si(t)?t:oh(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function ah(t){const{Document:e}=st(t);return t instanceof e}function ra(t){return Si(t)?!1:t instanceof st(t).HTMLElement}function ov(t){return t instanceof st(t).SVGElement}function _i(t){return t?Si(t)?t.document:oh(t)?ah(t)?t:ra(t)||ov(t)?t.ownerDocument:document:document:document}const Jt=kc?w.useLayoutEffect:w.useEffect;function Cc(t){const e=w.useRef(t);return Jt(()=>{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 SN(){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 $o(t,e){e===void 0&&(e=[t]);const n=w.useRef(t);return Jt(()=>{n.current!==t&&(n.current=t)},e),n}function ia(t,e){const n=w.useRef();return w.useMemo(()=>{const s=t(n.current);return n.current=s,s},[...e])}function Yl(t){const e=Cc(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 Xl(t){const e=w.useRef();return w.useEffect(()=>{e.current=t},[t]),e.current}let vu={};function oa(t,e){return w.useMemo(()=>{if(e)return e;const n=vu[t]==null?0:vu[t]+1;return vu[t]=n,t+"-"+n},[t,e])}function av(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 d=i[l];d!=null&&(i[l]=d+t*c)}return i},{...e})}}const Qr=av(1),ql=av(-1);function _N(t){return"clientX"in t&&"clientY"in t}function jc(t){if(!t)return!1;const{KeyboardEvent:e}=st(t.target);return e&&t instanceof e}function kN(t){if(!t)return!1;const{TouchEvent:e}=st(t.target);return e&&t instanceof e}function Gl(t){if(kN(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 _N(t)?{x:t.clientX,y:t.clientY}:null}const Es=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[Es.Translate.toString(t),Es.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:s}=t;return e+" "+n+"ms "+s}}}),om="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function CN(t){return t.matches(om)?t:t.querySelector(om)}const jN={display:"none"};function NN(t){let{id:e,value:n}=t;return pe.createElement("div",{id:e,style:jN},n)}function EN(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 pe.createElement("div",{id:e,style:r,role:"status","aria-live":s,"aria-atomic":!0},n)}function MN(){const[t,e]=w.useState("");return{announce:w.useCallback(s=>{s!=null&&e(s)},[]),announcement:t}}const lv=w.createContext(null);function PN(t){const e=w.useContext(lv);w.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function RN(){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 ON={draggable:`
84
+ `):t}function Hj(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 Qg(t,e){const n=t.chart.ctx,{body:s,footer:r,title:i}=t,{boxWidth:o,boxHeight:a}=e,l=ut(e.bodyFont),c=ut(e.titleFont),d=ut(e.footerFont),f=i.length,h=r.length,p=s.length,x=Gt(e.padding);let g=x.height,b=0,y=s.reduce((S,_)=>S+_.before.length+_.lines.length+_.after.length,0);if(y+=t.beforeBody.length+t.afterBody.length,f&&(g+=f*c.lineHeight+(f-1)*e.titleSpacing+e.titleMarginBottom),y){const S=e.displayColors?Math.max(a,l.lineHeight):l.lineHeight;g+=p*S+(y-p)*l.lineHeight+(y-1)*e.bodySpacing}h&&(g+=e.footerMarginTop+h*d.lineHeight+(h-1)*e.footerSpacing);let m=0;const v=function(S){b=Math.max(b,n.measureText(S).width+m)};return n.save(),n.font=c.string,ae(t.title,v),n.font=l.string,ae(t.beforeBody.concat(t.afterBody),v),m=e.displayColors?o+2+e.boxPadding:0,ae(s,S=>{ae(S.before,v),ae(S.lines,v),ae(S.after,v)}),m=0,n.font=d.string,ae(t.footer,v),n.restore(),b+=x.width,{width:b,height:g}}function Vj(t,e){const{y:n,height:s}=e;return n<s/2?"top":n>t.height-s/2?"bottom":"center"}function Qj(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 Kj(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"),Qj(c,t,e,n)&&(c="center"),c}function Kg(t,e,n){const s=n.yAlign||e.yAlign||Vj(t,n);return{xAlign:n.xAlign||e.xAlign||Kj(t,e,n,s),yAlign:s}}function Yj(t,e){let{x:n,width:s}=t;return e==="right"?n-=s:e==="center"&&(n-=s/2),n}function Xj(t,e,n){let{y:s,height:r}=t;return e==="top"?s+=n:e==="bottom"?s-=r+n:s-=r/2,s}function Yg(t,e,n,s){const{caretSize:r,caretPadding:i,cornerRadius:o}=t,{xAlign:a,yAlign:l}=n,c=r+i,{topLeft:d,topRight:f,bottomLeft:h,bottomRight:p}=Wr(o);let x=Yj(e,a);const g=Xj(e,l,c);return l==="center"?a==="left"?x+=c:a==="right"&&(x-=c):a==="left"?x-=Math.max(d,h)+r:a==="right"&&(x+=Math.max(f,p)+r),{x:ct(x,0,s.width-e.width),y:ct(g,0,s.height-e.height)}}function $a(t,e,n){const s=Gt(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-s.right:t.x+s.left}function Xg(t){return ln([],_n(t))}function qj(t,e,n){return wi(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function qg(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const ev={beforeTitle:bn,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:bn,beforeBody:bn,beforeLabel:bn,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 ue(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:bn,afterBody:bn,beforeFooter:bn,footer:bn,afterFooter:bn};function rt(t,e,n,s){const r=t[e].call(n,s);return typeof r>"u"?ev[e].call(n,s):r}class Fd extends Ns{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 By(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=qj(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:s}=n,r=rt(s,"beforeTitle",this,e),i=rt(s,"title",this,e),o=rt(s,"afterTitle",this,e);let a=[];return a=ln(a,_n(r)),a=ln(a,_n(i)),a=ln(a,_n(o)),a}getBeforeBody(e,n){return Xg(rt(n.callbacks,"beforeBody",this,e))}getBody(e,n){const{callbacks:s}=n,r=[];return ae(e,i=>{const o={before:[],lines:[],after:[]},a=qg(s,i);ln(o.before,_n(rt(a,"beforeLabel",this,i))),ln(o.lines,rt(a,"label",this,i)),ln(o.after,_n(rt(a,"afterLabel",this,i))),r.push(o)}),r}getAfterBody(e,n){return Xg(rt(n.callbacks,"afterBody",this,e))}getFooter(e,n){const{callbacks:s}=n,r=rt(s,"beforeFooter",this,e),i=rt(s,"footer",this,e),o=rt(s,"afterFooter",this,e);let a=[];return a=ln(a,_n(r)),a=ln(a,_n(i)),a=ln(a,_n(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(Hj(this.chart,n[l]));return e.filter&&(a=a.filter((d,f,h)=>e.filter(d,f,h,s))),e.itemSort&&(a=a.sort((d,f)=>e.itemSort(d,f,s))),ae(a,d=>{const f=qg(e.callbacks,d);r.push(rt(f,"labelColor",this,d)),i.push(rt(f,"labelPointStyle",this,d)),o.push(rt(f,"labelTextColor",this,d))}),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=to[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=Qg(this,s),c=Object.assign({},a,l),d=Kg(this.chart,s,c),f=Yg(s,c,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.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:d,bottomRight:f}=Wr(a),{x:h,y:p}=e,{width:x,height:g}=n;let b,y,m,v,S,_;return i==="center"?(S=p+g/2,r==="left"?(b=h,y=b-o,v=S+o,_=S-o):(b=h+x,y=b+o,v=S-o,_=S+o),m=b):(r==="left"?y=h+Math.max(l,d)+o:r==="right"?y=h+x-Math.max(c,f)-o:y=this.caretX,i==="top"?(v=p,S=v-o,b=y-o,m=y+o):(v=p+g,S=v+o,b=y+o,m=y-o),_=v),{x1:b,x2:y,x3:m,y1:v,y2:S,y3:_}}drawTitle(e,n,s){const r=this.title,i=r.length;let o,a,l;if(i){const c=Hr(s.rtl,this.x,this.width);for(e.x=$a(this,s.titleAlign,s),n.textAlign=c.textAlign(s.titleAlign),n.textBaseline="middle",o=ut(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,d=ut(i.bodyFont),f=$a(this,"left",i),h=r.x(f),p=l<d.lineHeight?(d.lineHeight-l)/2:0,x=n.y+p;if(i.usePointStyle){const g={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},b=r.leftForLtr(h,c)+c/2,y=x+l/2;e.strokeStyle=i.multiKeyBackground,e.fillStyle=i.multiKeyBackground,dg(e,g,b,y),e.strokeStyle=o.borderColor,e.fillStyle=o.backgroundColor,dg(e,g,b,y)}else{e.lineWidth=ne(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 g=r.leftForLtr(h,c),b=r.leftForLtr(r.xPlus(h,1),c-2),y=Wr(o.borderRadius);Object.values(y).some(m=>m!==0)?(e.beginPath(),e.fillStyle=i.multiKeyBackground,Hl(e,{x:g,y:x,w:c,h:l,radius:y}),e.fill(),e.stroke(),e.fillStyle=o.backgroundColor,e.beginPath(),Hl(e,{x:b,y:x+1,w:c-2,h:l-2,radius:y}),e.fill()):(e.fillStyle=i.multiKeyBackground,e.fillRect(g,x,c,l),e.strokeRect(g,x,c,l),e.fillStyle=o.backgroundColor,e.fillRect(b,x+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:d}=s,f=ut(s.bodyFont);let h=f.lineHeight,p=0;const x=Hr(s.rtl,this.x,this.width),g=function(j){n.fillText(j,x.x(e.x+p),e.y+h/2),e.y+=h+i},b=x.textAlign(o);let y,m,v,S,_,k,C;for(n.textAlign=o,n.textBaseline="middle",n.font=f.string,e.x=$a(this,b,s),n.fillStyle=s.bodyColor,ae(this.beforeBody,g),p=a&&b!=="right"?o==="center"?c/2+d:c+2+d:0,S=0,k=r.length;S<k;++S){for(y=r[S],m=this.labelTextColors[S],n.fillStyle=m,ae(y.before,g),v=y.lines,a&&v.length&&(this._drawColorBox(n,e,S,x,s),h=Math.max(f.lineHeight,l)),_=0,C=v.length;_<C;++_)g(v[_]),h=f.lineHeight;ae(y.after,g)}p=0,h=f.lineHeight,ae(this.afterBody,g),e.y-=i}drawFooter(e,n,s){const r=this.footer,i=r.length;let o,a;if(i){const l=Hr(s.rtl,this.x,this.width);for(e.x=$a(this,s.footerAlign,s),e.y+=s.footerMarginTop,n.textAlign=l.textAlign(s.footerAlign),n.textBaseline="middle",o=ut(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:d}=s,{topLeft:f,topRight:h,bottomLeft:p,bottomRight:x}=Wr(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+d-x),n.quadraticCurveTo(a+c,l+d,a+c-x,l+d),o==="bottom"&&this.drawCaret(e,n,s,r),n.lineTo(a+p,l+d),n.quadraticCurveTo(a,l+d,a,l+d-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=to[e.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=Qg(this,e),l=Object.assign({},o,this._size),c=Kg(n,e,l),d=Yg(e,l,c,n);(r._to!==d.x||i._to!==d.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,d))}}_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=Gt(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),Fy(e,n.textDirection),i.y+=o.top,this.drawTitle(i,e,n),this.drawBody(i,e,n),this.drawFooter(i,e,n),zy(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=!Fl(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||!Fl(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=to[i.position].call(this,e,n);return o!==!1&&(s!==o.x||r!==o.y)}}$(Fd,"positioners",to);var Gj={id:"tooltip",_element:Fd,positioners:to,afterInit(t,e,n){n&&(t.tooltip=new Fd({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:ev},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 Jj=(t,e,n,s)=>(typeof e=="string"?(n=t.push(e)-1,s.unshift({index:n,label:e})):isNaN(e)&&(n=null),n);function Zj(t,e,n,s){const r=t.indexOf(e);if(r===-1)return Jj(t,e,n,s);const i=t.lastIndexOf(e);return r!==i?n:r}const eN=(t,e)=>t===null?null:ct(Math.round(t),0,e);function Gg(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}class zd extends Si{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(ue(e))return null;const s=this.getLabels();return n=isFinite(n)&&s[n]===e?n:Zj(s,e,ee(n,e),this._addedLabels),eN(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 Gg.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}}$(zd,"id","category"),$(zd,"defaults",{ticks:{callback:Gg}});function tN(t,e){const n=[],{bounds:r,step:i,min:o,max:a,precision:l,count:c,maxTicks:d,maxDigits:f,includeBounds:h}=t,p=i||1,x=d-1,{min:g,max:b}=e,y=!ue(o),m=!ue(a),v=!ue(c),S=(b-g)/(f+1);let _=ng((b-g)/x/p)*p,k,C,j,P;if(_<1e-14&&!y&&!m)return[{value:g},{value:b}];P=Math.ceil(b/_)-Math.floor(g/_),P>x&&(_=ng(P*_/x/p)*p),ue(l)||(k=Math.pow(10,l),_=Math.ceil(_*k)/k),r==="ticks"?(C=Math.floor(g/_)*_,j=Math.ceil(b/_)*_):(C=g,j=b),y&&m&&i&&J_((a-o)/i,_/1e3)?(P=Math.round(Math.min((a-o)/_,d)),_=(a-o)/P,C=o,j=a):v?(C=y?o:C,j=m?a:j,P=c-1,_=(j-C)/P):(P=(j-C)/_,rl(P,Math.round(P),_/1e3)?P=Math.round(P):P=Math.ceil(P));const E=Math.max(sg(_),sg(C));k=Math.pow(10,ue(l)?E:l),C=Math.round(C*k)/k,j=Math.round(j*k)/k;let R=0;for(y&&(h&&C!==o?(n.push({value:o}),C<o&&R++,rl(Math.round((C+R*_)*k)/k,o,Jg(o,S,t))&&R++):C<o&&R++);R<P;++R){const M=Math.round((C+R*_)*k)/k;if(m&&M>a)break;n.push({value:M})}return m&&h&&j!==a?n.length&&rl(n[n.length-1].value,a,Jg(a,S,t))?n[n.length-1].value=a:n.push({value:a}):(!m||j===a)&&n.push({value:j}),n}function Jg(t,e,{horizontal:n,minRotation:s}){const r=Pn(s),i=(n?Math.sin(r):Math.cos(r))||.001,o=.75*e*(""+t).length;return Math.min(e/i,o)}class nN extends Si{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 ue(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=Ss(r),c=Ss(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=tN(r,i);return e.bounds==="ticks"&&Z_(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 qf(e,this.chart.options.locale,this.options.ticks.format)}}class Bd extends nN{determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=Ft(e)?e:0,this.max=Ft(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),n=e?this.width:this.height,s=Pn(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}}$(Bd,"id","linear"),$(Bd,"defaults",{ticks:{callback:Py.formatters.numeric}});const _c={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}},at=Object.keys(_c);function Zg(t,e){return t-e}function em(t,e){if(ue(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)),Ft(o)||(o=typeof s=="string"?n.parse(o,s):n.parse(o)),o===null?null:(r&&(o=r==="week"&&($l(i)||i===!0)?n.startOf(o,"isoWeek",i):n.startOf(o,r)),+o)}function tm(t,e,n,s){const r=at.length;for(let i=at.indexOf(t);i<r-1;++i){const o=_c[at[i]],a=o.steps?o.steps:Number.MAX_SAFE_INTEGER;if(o.common&&Math.ceil((n-e)/(a*o.size))<=s)return at[i]}return at[r-1]}function sN(t,e,n,s,r){for(let i=at.length-1;i>=at.indexOf(n);i--){const o=at[i];if(_c[o].common&&t._adapter.diff(r,s,o)>=e-1)return o}return at[n?at.indexOf(n):0]}function rN(t){for(let e=at.indexOf(t)+1,n=at.length;e<n;++e)if(_c[at[e]].common)return at[e]}function nm(t,e,n){if(!n)t[e]=!0;else if(n.length){const{lo:s,hi:r}=Xf(n,e),i=n[s]>=e?n[s]:n[r];t[i]=!0}}function iN(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 sm(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:iN(t,s,r,n)}class Yl extends Si{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 xC._date(e.adapters.date);r.init(n),fo(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:em(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=Ft(r)&&!isNaN(r)?r:+n.startOf(Date.now(),s),i=Ft(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=rk(r,i,o);return this._unit=n.unit||(s.autoSkip?tm(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):sN(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!s.major.enabled||this._unit==="year"?void 0:rN(this._unit),this.initOffsets(r),e.reverse&&a.reverse(),sm(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=ct(n,0,o),s=ct(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||tm(i.minUnit,n,s,this._getLabelCapacity(n)),a=ee(r.ticks.stepSize,1),l=o==="week"?i.isoWeekday:!1,c=$l(l)||l===!0,d={};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 x=r.ticks.source==="data"&&this.getDataTimestamps();for(h=f,p=0;h<s;h=+e.add(h,a,o),p++)nm(d,h,x);return(h===s||r.bounds==="ticks"||p===1)&&nm(d,h,x),Object.keys(d).sort(Zg).map(g=>+g)}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 he(o,[e,n,s],this);const a=i.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&a[l],f=c&&a[c],h=s[n],p=c&&f&&h&&h.major;return this._adapter.format(e,r||(p?f:d))}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=Pn(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,sm(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(em(this,r[n]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return Cy(e.sort(Zg))}}$(Yl,"id","time"),$(Yl,"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 Ua(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}=Dd(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}=Dd(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 rm extends Yl{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=Ua(n,this.min),this._tableRange=Ua(n,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:n,max:s}=this,r=[],i=[];let o,a,l,c,d;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)d=r[o+1],l=r[o-1],c=r[o],Math.round((d+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(Ua(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const n=this._offsets,s=this.getDecimalForPixel(e)/n.factor-n.end;return Ua(this._table,s*this._tableRange+this._minPos,!0)}}$(rm,"id","timeseries"),$(rm,"defaults",Yl.defaults);const tv="label";function im(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function oN(t,e){const n=t.options;n&&e&&Object.assign(n,e)}function nv(t,e){t.labels=e}function sv(t,e,n=tv){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 aN(t,e=tv){const n={labels:[],datasets:[]};return nv(n,t.labels),sv(n,t.datasets,e),n}function lN(t,e){const{height:n=150,width:s=300,redraw:r=!1,datasetIdKey:i,type:o,data:a,options:l,plugins:c=[],fallbackContent:d,updateMode:f,...h}=t,p=w.useRef(null),x=w.useRef(null),g=()=>{p.current&&(x.current=new Sc(p.current,{type:o,data:aN(a,i),options:l&&{...l},plugins:c}),im(e,x.current))},b=()=>{im(e,null),x.current&&(x.current.destroy(),x.current=null)};return w.useEffect(()=>{!r&&x.current&&l&&oN(x.current,l)},[r,l]),w.useEffect(()=>{!r&&x.current&&nv(x.current.config.data,a.labels)},[r,a.labels]),w.useEffect(()=>{!r&&x.current&&a.datasets&&sv(x.current.config.data,a.datasets,i)},[r,a.datasets]),w.useEffect(()=>{x.current&&(r?(b(),setTimeout(g)):x.current.update(f))},[r,l,a.labels,a.datasets,f]),w.useEffect(()=>{x.current&&(b(),setTimeout(g))},[o]),w.useEffect(()=>(g(),()=>b()),[]),u.jsx("canvas",{ref:p,role:"img",height:n,width:s,...h,children:d})}const cN=w.forwardRef(lN);function rv(t,e){return Sc.register(e),w.forwardRef((n,s)=>u.jsx(cN,{...n,ref:s,type:t}))}const uN=rv("bar",il),dN=rv("doughnut",Ji),_t=["leads","em_contato","proposta","fechado"],Rn={leads:"Novos Leads",em_contato:"Em Contato",proposta:"Proposta",fechado:"Fechado"};Sc.register(eo,ll,zd,Bd,Wj,Gj);function fN({porEtapa:t}){const e=_t.map(s=>t[s]??0),n=Math.max(20,Math.ceil((Math.max(...e)+1)/20)*20);return u.jsx("div",{className:"mt-4 h-64",children:u.jsx(uN,{data:{labels:_t.map(s=>Rn[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 hN({enviadas:t,erros:e}){return u.jsx("div",{className:"mt-4 h-64 flex items-center justify-center",children:u.jsx(dN,{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 pN=1e4;function gN({nomeUsuario:t}){const{data:e,isPending:n,isError:s,error:r,refetch:i}=ey({queryKey:["metrics"],queryFn:()=>W.metricas(),refetchInterval:pN,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 u.jsxs("div",{className:"space-y-6",children:[u.jsxs("div",{children:[u.jsxs("h1",{className:"text-2xl font-bold text-gray-800",children:["Olá, ",t," 👋 bem-vindo ao seu painel"]}),u.jsxs("div",{className:"mt-2 flex items-center justify-between text-sm text-gray-500",children:[u.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&&u.jsxs("span",{children:["Restam ",u.jsx("strong",{className:"text-gray-700",children:c===null?"∞":`${c} dias`})]})]})]}),a&&u.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 rounded-xl px-4 py-3 text-sm",children:[u.jsx("i",{className:"fas fa-exclamation-triangle mr-2"}),a]}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[u.jsxs(Pa,{rotulo:"Status da Conexão",icone:"fas fa-plug",children:[u.jsx("div",{className:"mt-2 flex items-center",children:u.jsxs("span",{className:Q("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:[u.jsx("span",{className:Q("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"]})}),u.jsxs("p",{className:"text-[11px] text-gray-400 mt-2",children:[u.jsx("i",{className:"fas fa-brain mr-1"}),e!=null&&e.conexao.llm?"LLM ✓":"LLM não configurado"," ·"," ",u.jsx("i",{className:"fas fa-paper-plane mr-1"}),e!=null&&e.conexao.openoutreach?"OpenOutreach ✓":"OpenOutreach não configurado"]})]}),u.jsx(Pa,{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"}),u.jsx(Pa,{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"}),u.jsx(Pa,{rotulo:"Leads cadastrados",valor:o?"—":(e==null?void 0:e.leads_total)??0,subtitulo:"Total na base",icone:"fas fa-users"})]}),u.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[u.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6 border border-gray-100",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("h3",{className:"text-base font-semibold text-gray-800",children:"Leads por etapa (CRM)"}),u.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Quantidade de leads em cada coluna do Kanban"})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsxs("span",{className:"text-[11px] text-gray-300 hidden sm:inline",title:"O painel atualiza sozinho",children:[u.jsx("i",{className:"fas fa-rotate mr-1"}),"a cada 10s"]}),u.jsx("button",{onClick:()=>i(),className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:"Atualizar"})]})]}),e?u.jsx(fN,{porEtapa:e.leads_por_etapa}):u.jsx(mN,{})]}),u.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6 border border-gray-100",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("h3",{className:"text-base font-semibold text-gray-800",children:"Desempenho das campanhas"}),u.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Agregação de todas as campanhas (Enviadas × Erros)"})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsxs("span",{className:"text-[11px] text-gray-300 hidden sm:inline",title:"O painel atualiza sozinho",children:[u.jsx("i",{className:"fas fa-rotate mr-1"}),"a cada 10s"]}),u.jsx("button",{onClick:()=>i(),className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:"Atualizar"})]})]}),u.jsx(hN,{enviadas:(e==null?void 0:e.campanhas.enviadas)??0,erros:(e==null?void 0:e.campanhas.erros)??0}),u.jsxs("div",{className:"mt-4 flex items-center justify-center space-x-6 text-xs",children:[u.jsxs("span",{className:"flex items-center",children:[u.jsx("span",{className:"w-3 h-3 bg-blue-500 rounded-full mr-1.5"})," Enviadas (",(e==null?void 0:e.campanhas.enviadas)??0,")"]}),u.jsxs("span",{className:"flex items-center",children:[u.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 mN(){return u.jsx("div",{className:"mt-4 h-64 flex items-center justify-center text-gray-300",children:u.jsx("i",{className:"fas fa-spinner fa-spin text-2xl"})})}function Dt({titulo:t,icone:e="fas fa-sliders",children:n,abertoInicial:s=!1}){const[r,i]=w.useState(s);return u.jsxs("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:[u.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:[u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx("i",{className:Q(e,"text-gray-400")})," ",t]}),u.jsx("i",{className:Q("fas fa-chevron-down text-xs text-gray-400 transition-transform",r&&"rotate-180")})]}),r&&u.jsx("div",{className:"px-4 py-4 bg-white space-y-3",children:n})]})}function ra({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 u.jsxs("div",{className:Q("w-full",s),children:[n&&u.jsxs("div",{className:"flex justify-between text-xs text-gray-500 mb-1",children:[u.jsx("span",{children:"Progresso"}),u.jsxs("span",{className:"font-semibold text-gray-700",children:[r,"%"]})]}),u.jsx("div",{className:Q("w-full bg-gray-200 rounded-full overflow-hidden",i[e]),children:u.jsx("div",{className:Q("h-full rounded-full bg-gradient-to-r from-indigo-500 to-purple-500 transition-all duration-500"),style:{width:`${r}%`}})})]})}const xN={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"},yN={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 _s({status:t,rotulo:e,className:n}){const s=xN[t]||"bg-gray-100 text-gray-600";return u.jsx("span",{className:Q("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium whitespace-nowrap",s,n),children:e||yN[t]||t})}const vN={nome:"",telefone:"",email:"",fonte:"Manual",etapa:"leads"};function bN(){const{toast:t}=en(),[e,n]=w.useState([]),[s,r]=w.useState(""),[i,o]=w.useState("todas"),[a,l]=w.useState(!1),[c,d]=w.useState(null),[f,h]=w.useState(null),[p,x]=w.useState(null),g=w.useCallback(async()=>{n(await W.leads.listar())},[]);w.useEffect(()=>{g().catch(k=>t("erro",k.message))},[g,t]);const b=w.useMemo(()=>{const k=s.trim().toLowerCase();return e.filter(C=>{const j=!k||C.nome.toLowerCase().includes(k)||C.telefone.includes(k)||C.email.toLowerCase().includes(k),P=i==="todas"||C.etapa===i;return j&&P})},[e,s,i]),y=()=>{d({...vN}),l(!0)},m=k=>{d({...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:C,criado_em:j,atualizado_em:P,...E}=c;await W.leads.atualizar(C,E),t("sucesso","Lead atualizado.")}else await W.leads.criar(c),t("sucesso","Lead criado com sucesso.");l(!1),d(null),await g()}catch(C){t("erro",C instanceof Error?C.message:"Falha ao salvar lead.")}},S=async()=>{if(f)try{await W.leads.remover(f.id),t("sucesso",`Lead "${f.nome}" removido.`),h(null),await g()}catch(k){t("erro",k instanceof Error?k.message:"Falha ao remover.")}},_=async k=>{x(k.id);try{(await W.leads.enriquecer(k.id)).notas.forEach(j=>t("info",j)),t("sucesso","Lead enriquecido."),await g()}catch(C){t("erro",C instanceof Error?C.message:"Falha ao enriquecer.")}finally{x(null)}};return u.jsxs("div",{className:"space-y-6",children:[u.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[u.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-[280px]",children:[u.jsxs("div",{className:"relative flex-1 max-w-md",children:[u.jsx("i",{className:"fas fa-search absolute left-3 top-2.5 text-gray-400 text-sm"}),u.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"})]}),u.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:[u.jsx("option",{value:"todas",children:"Todas as etapas"}),_t.map(k=>u.jsx("option",{value:k,children:Rn[k]},k))]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs("button",{onClick:()=>d_(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:[u.jsx("i",{className:"fas fa-download mr-2"})," Exportar"]}),u.jsxs("button",{onClick:y,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:[u.jsx("i",{className:"fas fa-plus mr-2"})," Novo Lead"]})]})]}),u.jsx("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden",children:u.jsx("div",{className:"overflow-x-auto",children:u.jsxs("table",{className:"w-full text-sm",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"text-left text-xs text-gray-500 uppercase border-b border-gray-100 bg-gray-50/50",children:[u.jsx("th",{className:"px-5 py-3 font-semibold",children:"Lead"}),u.jsx("th",{className:"px-5 py-3 font-semibold",children:"Contato"}),u.jsx("th",{className:"px-5 py-3 font-semibold",children:"Etapa"}),u.jsx("th",{className:"px-5 py-3 font-semibold",children:"Completude"}),u.jsx("th",{className:"px-5 py-3 font-semibold",children:"Atualizado"}),u.jsx("th",{className:"px-5 py-3 font-semibold text-right",children:"Ações"})]})}),u.jsxs("tbody",{children:[b.map(k=>{const C=l_(k),j=c_(k);return u.jsxs("tr",{className:"border-b border-gray-50 hover:bg-indigo-50/40 transition",children:[u.jsxs("td",{className:"px-5 py-3",children:[u.jsx("p",{className:"font-medium text-gray-800",children:k.nome}),u.jsxs("p",{className:"text-xs text-gray-400",children:[k.fonte,k.empresa?` · ${k.empresa}`:""]})]}),u.jsxs("td",{className:"px-5 py-3 text-gray-600",children:[u.jsx("p",{children:k.telefone||"—"}),u.jsx("p",{className:"text-xs text-gray-400",children:k.email||"sem e-mail"})]}),u.jsx("td",{className:"px-5 py-3",children:u.jsx(_s,{status:k.etapa})}),u.jsxs("td",{className:"px-5 py-3 w-52",children:[u.jsx(ra,{valor:C,altura:"sm"}),u.jsx("p",{className:"text-[11px] text-gray-400 mt-1",children:u_(C,j)})]}),u.jsx("td",{className:"px-5 py-3 text-xs text-gray-400",children:Il(k.atualizado_em)}),u.jsxs("td",{className:"px-5 py-3 text-right whitespace-nowrap",children:[u.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:u.jsx("i",{className:Q("fas fa-wand-magic-sparkles",p===k.id&&"fa-spin")})}),u.jsx("button",{onClick:()=>m(k),title:"Editar",className:"text-gray-400 hover:text-indigo-600 px-1.5",children:u.jsx("i",{className:"fas fa-pen"})}),u.jsx("button",{onClick:()=>h(k),title:"Excluir",className:"text-gray-400 hover:text-red-600 px-1.5",children:u.jsx("i",{className:"fas fa-trash"})})]})]},k.id)}),b.length===0&&u.jsx("tr",{children:u.jsxs("td",{colSpan:6,className:"px-5 py-16 text-center text-gray-400",children:[u.jsx("i",{className:"fas fa-users text-3xl text-gray-200 block mb-3"}),"Nenhum lead encontrado. Crie um novo ou importe pelos Extratores."]})})]})]})})}),u.jsx(Xt,{aberto:a,onFechar:()=>l(!1),titulo:c!=null&&c.id?"Editar lead":"Novo lead",icone:"fas fa-user-plus",children:c&&u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[u.jsx(Is,{rotulo:"Nome *",valor:c.nome||"",onChange:k=>d({...c,nome:k})}),u.jsx(Is,{rotulo:"Telefone",valor:c.telefone||"",onChange:k=>d({...c,telefone:k}),placeholder:"(11) 99999-9999"}),u.jsx(Is,{rotulo:"E-mail",tipo:"email",valor:c.email||"",onChange:k=>d({...c,email:k}),placeholder:"contato@empresa.com.br"}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Etapa"}),u.jsx("select",{value:c.etapa||"leads",onChange:k=>d({...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:_t.map(k=>u.jsx("option",{value:k,children:Rn[k]},k))})]})]}),u.jsxs(Dt,{titulo:"Campos avançados",icone:"fas fa-sliders",children:[u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[u.jsx(Is,{rotulo:"Empresa",valor:c.empresa||"",onChange:k=>d({...c,empresa:k})}),u.jsx(Is,{rotulo:"CNPJ",valor:c.cnpj||"",onChange:k=>d({...c,cnpj:k}),placeholder:"00.000.000/0000-00"}),u.jsx(Is,{rotulo:"Cidade",valor:c.cidade||"",onChange:k=>d({...c,cidade:k}),placeholder:"São Paulo/SP"}),u.jsx(Is,{rotulo:"Fonte",valor:c.fonte||"",onChange:k=>d({...c,fonte:k}),placeholder:"Google Maps, Instagram, CNPJ..."})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Observações"}),u.jsx("textarea",{value:c.observacoes||"",onChange:k=>d({...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..."})]})]}),u.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[u.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"}),u.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:[u.jsx("i",{className:"fas fa-save mr-2"})," Salvar"]})]})]})}),u.jsxs(Xt,{aberto:!!f,onFechar:()=>h(null),titulo:"Excluir lead",icone:"fas fa-trash",children:[u.jsxs("p",{className:"text-sm text-gray-600",children:["Tem certeza que deseja excluir ",u.jsx("strong",{children:f==null?void 0:f.nome}),"? Essa ação não pode ser desfeita."]}),u.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[u.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"}),u.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 Is({rotulo:t,valor:e,onChange:n,tipo:s="text",placeholder:r}){return u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:t}),u.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"})]})}function wN(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return w.useMemo(()=>s=>{e.forEach(r=>r(s))},e)}const kc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function _i(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function oh(t){return"nodeType"in t}function st(t){var e,n;return t?_i(t)?t:oh(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function ah(t){const{Document:e}=st(t);return t instanceof e}function ia(t){return _i(t)?!1:t instanceof st(t).HTMLElement}function iv(t){return t instanceof st(t).SVGElement}function ki(t){return t?_i(t)?t.document:oh(t)?ah(t)?t:ia(t)||iv(t)?t.ownerDocument:document:document:document}const Jt=kc?w.useLayoutEffect:w.useEffect;function Cc(t){const e=w.useRef(t);return Jt(()=>{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 SN(){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 Uo(t,e){e===void 0&&(e=[t]);const n=w.useRef(t);return Jt(()=>{n.current!==t&&(n.current=t)},e),n}function oa(t,e){const n=w.useRef();return w.useMemo(()=>{const s=t(n.current);return n.current=s,s},[...e])}function Xl(t){const e=Cc(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 ql(t){const e=w.useRef();return w.useEffect(()=>{e.current=t},[t]),e.current}let vu={};function aa(t,e){return w.useMemo(()=>{if(e)return e;const n=vu[t]==null?0:vu[t]+1;return vu[t]=n,t+"-"+n},[t,e])}function ov(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 d=i[l];d!=null&&(i[l]=d+t*c)}return i},{...e})}}const Qr=ov(1),Gl=ov(-1);function _N(t){return"clientX"in t&&"clientY"in t}function jc(t){if(!t)return!1;const{KeyboardEvent:e}=st(t.target);return e&&t instanceof e}function kN(t){if(!t)return!1;const{TouchEvent:e}=st(t.target);return e&&t instanceof e}function Jl(t){if(kN(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 _N(t)?{x:t.clientX,y:t.clientY}:null}const Es=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[Es.Translate.toString(t),Es.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:s}=t;return e+" "+n+"ms "+s}}}),om="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function CN(t){return t.matches(om)?t:t.querySelector(om)}const jN={display:"none"};function NN(t){let{id:e,value:n}=t;return pe.createElement("div",{id:e,style:jN},n)}function EN(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 pe.createElement("div",{id:e,style:r,role:"status","aria-live":s,"aria-atomic":!0},n)}function MN(){const[t,e]=w.useState("");return{announce:w.useCallback(s=>{s!=null&&e(s)},[]),announcement:t}}const av=w.createContext(null);function PN(t){const e=w.useContext(av);w.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function RN(){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 ON={draggable:`
85
85
  To pick up a draggable item, press the space bar.
86
86
  While dragging, use the arrow keys to move the item.
87
87
  Press space again to drop the item in its new position, or press escape to cancel.
88
- `},DN={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 TN(t){let{announcements:e=DN,container:n,hiddenTextDescribedById:s,screenReaderInstructions:r=ON}=t;const{announce:i,announcement:o}=MN(),a=oa("DndLiveRegion"),[l,c]=w.useState(!1);if(w.useEffect(()=>{c(!0)},[]),PN(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 d=pe.createElement(pe.Fragment,null,pe.createElement(NN,{id:s,value:r.draggable}),pe.createElement(EN,{id:a,announcement:o}));return n?Ar.createPortal(d,n):d}var De;(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"})(De||(De={}));function Jl(){}function LN(t,e){return w.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function AN(){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 Zt=Object.freeze({x:0,y:0});function IN(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function FN(t,e){const n=Gl(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 zN(t,e){let{data:{value:n}}=t,{data:{value:s}}=e;return n-s}function BN(t,e){let{data:{value:n}}=t,{data:{value:s}}=e;return s-n}function am(t){let{left:e,top:n,height:s,width:r}=t;return[{x:e,y:n},{x:e+r,y:n},{x:e,y:n+s},{x:e+r,y:n+s}]}function $N(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}const UN=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:s}=t;const r=am(e),i=[];for(const o of s){const{id:a}=o,l=n.get(a);if(l){const c=am(l),d=r.reduce((h,p,x)=>h+IN(c[x],p),0),f=Number((d/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(zN)};function WN(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,d=o*a,f=d/(l+c-d);return Number(f.toFixed(4))}return 0}const HN=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=WN(a,e);l>0&&r.push({id:o,data:{droppableContainer:i,value:l}})}}return r.sort(BN)};function VN(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function cv(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Zt}function QN(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 KN=QN(1);function uv(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 YN(t,e,n){const s=uv(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)),d=r?t.width/r:t.width,f=i?t.height/i:t.height;return{width:d,height:f,top:c,right:l+d,bottom:c+f,left:l}}const XN={ignoreTransform:!1};function ki(t,e){e===void 0&&(e=XN);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:d}=st(t).getComputedStyle(t);c&&(n=YN(n,c,d))}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 lm(t){return ki(t,{ignoreTransform:!0})}function qN(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function GN(t,e){return e===void 0&&(e=st(t).getComputedStyle(t)),e.position==="fixed"}function JN(t,e){e===void 0&&(e=st(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 lh(t,e){const n=[];function s(r){if(e!=null&&n.length>=e||!r)return n;if(ah(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!ra(r)||ov(r)||n.includes(r))return n;const i=st(t).getComputedStyle(r);return r!==t&&JN(r,i)&&n.push(r),GN(r,i)?n:s(r.parentNode)}return t?s(t):n}function dv(t){const[e]=lh(t,1);return e??null}function bu(t){return!kc||!t?null:Si(t)?t:oh(t)?ah(t)||t===_i(t).scrollingElement?window:ra(t)?t:null:null}function fv(t){return Si(t)?t.scrollX:t.scrollLeft}function hv(t){return Si(t)?t.scrollY:t.scrollTop}function $d(t){return{x:fv(t),y:hv(t)}}var Ie;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Ie||(Ie={}));function pv(t){return!kc||!t?!1:t===document.scrollingElement}function gv(t){const e={x:0,y:0},n=pv(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 ZN={x:.2,y:.2};function e2(t,e,n,s,r){let{top:i,left:o,right:a,bottom:l}=n;s===void 0&&(s=10),r===void 0&&(r=ZN);const{isTop:c,isBottom:d,isLeft:f,isRight:h}=gv(t),p={x:0,y:0},x={x:0,y:0},g={height:e.height*r.y,width:e.width*r.x};return!c&&i<=e.top+g.height?(p.y=Ie.Backward,x.y=s*Math.abs((e.top+g.height-i)/g.height)):!d&&l>=e.bottom-g.height&&(p.y=Ie.Forward,x.y=s*Math.abs((e.bottom-g.height-l)/g.height)),!h&&a>=e.right-g.width?(p.x=Ie.Forward,x.x=s*Math.abs((e.right-g.width-a)/g.width)):!f&&o<=e.left+g.width&&(p.x=Ie.Backward,x.x=s*Math.abs((e.left+g.width-o)/g.width)),{direction:p,speed:x}}function t2(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 mv(t){return t.reduce((e,n)=>Qr(e,$d(n)),Zt)}function n2(t){return t.reduce((e,n)=>e+fv(n),0)}function s2(t){return t.reduce((e,n)=>e+hv(n),0)}function xv(t,e){if(e===void 0&&(e=ki),!t)return;const{top:n,left:s,bottom:r,right:i}=e(t);dv(t)&&(r<=0||i<=0||n>=window.innerHeight||s>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const r2=[["x",["left","right"],n2],["y",["top","bottom"],s2]];class ch{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=lh(n),r=mv(s);this.rect={...e},this.width=e.width,this.height=e.height;for(const[i,o,a]of r2)for(const l of o)Object.defineProperty(this,l,{get:()=>{const c=a(s),d=r[i]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class po{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 i2(t){const{EventTarget:e}=st(t);return t instanceof e?t:_i(t)}function wu(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 Pt;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Pt||(Pt={}));function cm(t){t.preventDefault()}function o2(t){t.stopPropagation()}var se;(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"})(se||(se={}));const yv={start:[se.Space,se.Enter],cancel:[se.Esc],end:[se.Space,se.Enter,se.Tab]},a2=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case se.Right:return{...n,x:n.x+25};case se.Left:return{...n,x:n.x-25};case se.Down:return{...n,y:n.y+25};case se.Up:return{...n,y:n.y-25}}};class vv{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 po(_i(n)),this.windowListeners=new po(st(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Pt.Resize,this.handleCancel),this.windowListeners.add(Pt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Pt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,s=e.node.current;s&&xv(s),n(Zt)}handleKeyDown(e){if(jc(e)){const{active:n,context:s,options:r}=this.props,{keyboardCodes:i=yv,coordinateGetter:o=a2,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,d=c?{x:c.left,y:c.top}:Zt;this.referenceCoordinates||(this.referenceCoordinates=d);const f=o(e,{active:n,context:s.current,currentCoordinates:d});if(f){const h=ql(f,d),p={x:0,y:0},{scrollableAncestors:x}=s.current;for(const g of x){const b=e.code,{isTop:y,isRight:m,isLeft:v,isBottom:S,maxScroll:_,minScroll:k}=gv(g),C=t2(g),N={x:Math.min(b===se.Right?C.right-C.width/2:C.right,Math.max(b===se.Right?C.left:C.left+C.width/2,f.x)),y:Math.min(b===se.Down?C.bottom-C.height/2:C.bottom,Math.max(b===se.Down?C.top:C.top+C.height/2,f.y))},P=b===se.Right&&!m||b===se.Left&&!v,M=b===se.Down&&!S||b===se.Up&&!y;if(P&&N.x!==f.x){const O=g.scrollLeft+h.x,E=b===se.Right&&O<=_.x||b===se.Left&&O>=k.x;if(E&&!h.y){g.scrollTo({left:O,behavior:a});return}E?p.x=g.scrollLeft-O:p.x=b===se.Right?g.scrollLeft-_.x:g.scrollLeft-k.x,p.x&&g.scrollBy({left:-p.x,behavior:a});break}else if(M&&N.y!==f.y){const O=g.scrollTop+h.y,E=b===se.Down&&O<=_.y||b===se.Up&&O>=k.y;if(E&&!h.x){g.scrollTo({top:O,behavior:a});return}E?p.y=g.scrollTop-O:p.y=b===se.Down?g.scrollTop-_.y:g.scrollTop-k.y,p.y&&g.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(e,Qr(ql(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()}}vv.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:s=yv,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 um(t){return!!(t&&"distance"in t)}function dm(t){return!!(t&&"delay"in t)}class uh{constructor(e,n,s){var r;s===void 0&&(s=i2(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=_i(o),this.documentListeners=new po(this.document),this.listeners=new po(s),this.windowListeners=new po(st(o)),this.initialCoordinates=(r=Gl(i))!=null?r:Zt,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(Pt.Resize,this.handleCancel),this.windowListeners.add(Pt.DragStart,cm),this.windowListeners.add(Pt.VisibilityChange,this.handleCancel),this.windowListeners.add(Pt.ContextMenu,cm),this.documentListeners.add(Pt.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(dm(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(um(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(Pt.Click,o2,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Pt.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=Gl(e))!=null?n:Zt,c=ql(r,l);if(!s&&a){if(um(a)){if(a.tolerance!=null&&wu(c,a.tolerance))return this.handleCancel();if(wu(c,a.distance))return this.handleStart()}if(dm(a)&&wu(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===se.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const l2={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class dh extends uh{constructor(e){const{event:n}=e,s=_i(n.target);super(e,l2,s)}}dh.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 c2={move:{name:"mousemove"},end:{name:"mouseup"}};var Ud;(function(t){t[t.RightClick=2]="RightClick"})(Ud||(Ud={}));class u2 extends uh{constructor(e){super(e,c2,_i(e.event.target))}}u2.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:s}=e;return n.button===Ud.RightClick?!1:(s==null||s({event:n}),!0)}}];const Su={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class d2 extends uh{constructor(e){super(e,Su)}static setup(){return window.addEventListener(Su.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Su.move.name,e)};function e(){}}}d2.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 go;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(go||(go={}));var Zl;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Zl||(Zl={}));function f2(t){let{acceleration:e,activator:n=go.Pointer,canScroll:s,draggingRect:r,enabled:i,interval:o=5,order:a=Zl.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:f,threshold:h}=t;const p=p2({delta:f,disabled:!i}),[x,g]=SN(),b=w.useRef({x:0,y:0}),y=w.useRef({x:0,y:0}),m=w.useMemo(()=>{switch(n){case go.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case go.DraggableRect:return r}},[n,r,l]),v=w.useRef(null),S=w.useCallback(()=>{const k=v.current;if(!k)return;const C=b.current.x*y.current.x,N=b.current.y*y.current.y;k.scrollBy(C,N)},[]),_=w.useMemo(()=>a===Zl.TreeOrder?[...c].reverse():c,[a,c]);w.useEffect(()=>{if(!i||!c.length||!m){g();return}for(const k of _){if((s==null?void 0:s(k))===!1)continue;const C=c.indexOf(k),N=d[C];if(!N)continue;const{direction:P,speed:M}=e2(k,N,m,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){g(),v.current=k,x(S,o),b.current=M,y.current=P;return}}b.current={x:0,y:0},y.current={x:0,y:0},g()},[e,S,s,g,i,o,JSON.stringify(m),JSON.stringify(p),x,c,_,d,JSON.stringify(h)])}const h2={x:{[Ie.Backward]:!1,[Ie.Forward]:!1},y:{[Ie.Backward]:!1,[Ie.Forward]:!1}};function p2(t){let{delta:e,disabled:n}=t;const s=Xl(e);return ia(r=>{if(n||!s||!r)return h2;const i={x:Math.sign(e.x-s.x),y:Math.sign(e.y-s.y)};return{x:{[Ie.Backward]:r.x[Ie.Backward]||i.x===-1,[Ie.Forward]:r.x[Ie.Forward]||i.x===1},y:{[Ie.Backward]:r.y[Ie.Backward]||i.y===-1,[Ie.Forward]:r.y[Ie.Forward]||i.y===1}}},[n,e,s])}function g2(t,e){const n=e!=null?t.get(e):void 0,s=n?n.node.current:null;return ia(r=>{var i;return e==null?null:(i=s??r)!=null?i:null},[s,e])}function m2(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 Uo;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Uo||(Uo={}));var Wd;(function(t){t.Optimized="optimized"})(Wd||(Wd={}));const fm=new Map;function x2(t,e){let{dragging:n,dependencies:s,config:r}=e;const[i,o]=w.useState(null),{frequency:a,measure:l,strategy:c}=r,d=w.useRef(t),f=b(),h=$o(f),p=w.useCallback(function(y){y===void 0&&(y=[]),!h.current&&o(m=>m===null?y:m.concat(y.filter(v=>!m.includes(v))))},[h]),x=w.useRef(null),g=ia(y=>{if(f&&!n)return fm;if(!y||y===fm||d.current!==t||i!=null){const m=new Map;for(let v of t){if(!v)continue;if(i&&i.length>0&&!i.includes(v.id)&&v.rect.current){m.set(v.id,v.rect.current);continue}const S=v.node.current,_=S?new ch(l(S),S):null;v.rect.current=_,_&&m.set(v.id,_)}return m}return y},[t,i,n,f,l]);return w.useEffect(()=>{d.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"||x.current!==null||(x.current=setTimeout(()=>{p(),x.current=null},a))},[a,f,p,...s]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:i!=null};function b(){switch(c){case Uo.Always:return!1;case Uo.BeforeDragging:return n;default:return!n}}}function fh(t,e){return ia(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function y2(t,e){return fh(t,e)}function v2(t){let{callback:e,disabled:n}=t;const s=Cc(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 Nc(t){let{callback:e,disabled:n}=t;const s=Cc(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 b2(t){return new ch(ki(t),t)}function hm(t,e,n){e===void 0&&(e=b2);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 d=e(t);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const o=v2({callback(l){if(t)for(const c of l){const{type:d,target:f}=c;if(d==="childList"&&f instanceof HTMLElement&&f.contains(t)){i();break}}}}),a=Nc({callback:i});return Jt(()=>{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 w2(t){const e=fh(t);return cv(t,e)}const pm=[];function S2(t){const e=w.useRef(t),n=ia(s=>t?s&&s!==pm&&t&&e.current&&t.parentNode===e.current.parentNode?s:lh(t):pm,[t]);return w.useEffect(()=>{e.current=t},[t]),n}function _2(t){const[e,n]=w.useState(null),s=w.useRef(t),r=w.useCallback(i=>{const o=bu(i.target);o&&n(a=>a?(a.set(o,$d(o)),new Map(a)):null)},[]);return w.useEffect(()=>{const i=s.current;if(t!==i){o(i);const a=t.map(l=>{const c=bu(l);return c?(c.addEventListener("scroll",r,{passive:!0}),[c,$d(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=bu(l);c==null||c.removeEventListener("scroll",r)})}},[r,t]),w.useMemo(()=>t.length?e?Array.from(e.values()).reduce((i,o)=>Qr(i,o),Zt):mv(t):Zt,[t,e])}function gm(t,e){e===void 0&&(e=[]);const n=w.useRef(null);return w.useEffect(()=>{n.current=null},e),w.useEffect(()=>{const s=t!==Zt;s&&!n.current&&(n.current=t),!s&&n.current&&(n.current=null)},[t]),n.current?ql(t,n.current):Zt}function k2(t){w.useEffect(()=>{if(!kc)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 bv(t){return w.useMemo(()=>t?qN(t):null,[t])}const mm=[];function j2(t,e){e===void 0&&(e=ki);const[n]=t,s=bv(n?st(n):null),[r,i]=w.useState(mm);function o(){i(()=>t.length?t.map(l=>pv(l)?s:new ch(e(l),l)):mm)}const a=Nc({callback:o});return Jt(()=>{a==null||a.disconnect(),o(),t.forEach(l=>a==null?void 0:a.observe(l))},[t]),r}function wv(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return ra(e)?e:t}function N2(t){let{measure:e}=t;const[n,s]=w.useState(null),r=w.useCallback(c=>{for(const{target:d}of c)if(ra(d)){s(f=>{const h=e(d);return f?{...f,width:h.width,height:h.height}:h});break}},[e]),i=Nc({callback:r}),o=w.useCallback(c=>{const d=wv(c);i==null||i.disconnect(),d&&(i==null||i.observe(d)),s(d?e(d):null)},[e,i]),[a,l]=Yl(o);return w.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const E2=[{sensor:dh,options:{}},{sensor:vv,options:{}}],M2={current:{}},ll={draggable:{measure:lm},droppable:{measure:lm,strategy:Uo.WhileDragging,frequency:Wd.Optimized},dragOverlay:{measure:ki}};class mo 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 mo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Jl},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ll,measureDroppableContainers:Jl,windowRect:null,measuringScheduled:!1},Sv={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Jl,draggableNodes:new Map,over:null,measureDroppableContainers:Jl},aa=w.createContext(Sv),_v=w.createContext(P2);function R2(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new mo}}}function O2(t,e){switch(e.type){case De.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case De.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 De.DragEnd:case De.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case De.RegisterDroppable:{const{element:n}=e,{id:s}=n,r=new mo(t.droppable.containers);return r.set(s,n),{...t,droppable:{...t.droppable,containers:r}}}case De.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 mo(t.droppable.containers);return o.set(n,{...i,disabled:r}),{...t,droppable:{...t.droppable,containers:o}}}case De.UnregisterDroppable:{const{id:n,key:s}=e,r=t.droppable.containers.get(n);if(!r||s!==r.key)return t;const i=new mo(t.droppable.containers);return i.delete(n),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function D2(t){let{disabled:e}=t;const{active:n,activatorEvent:s,draggableNodes:r}=w.useContext(aa),i=Xl(s),o=Xl(n==null?void 0:n.id);return w.useEffect(()=>{if(!e&&!s&&i&&o!=null){if(!jc(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 d of[l.current,c.current]){if(!d)continue;const f=CN(d);if(f){f.focus();break}}})}},[s,e,r,o,i]),null}function kv(t,e){let{transform:n,...s}=e;return t!=null&&t.length?t.reduce((r,i)=>i({transform:r,...s}),n):n}function T2(t){return w.useMemo(()=>({draggable:{...ll.draggable,...t==null?void 0:t.draggable},droppable:{...ll.droppable,...t==null?void 0:t.droppable},dragOverlay:{...ll.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 L2(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;Jt(()=>{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 d=n(c),f=cv(d,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=dv(c);h&&h.scrollBy({top:f.y,left:f.x})}},[e,o,a,s,n])}const Ec=w.createContext({...Zt,scaleX:1,scaleY:1});var Yn;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Yn||(Yn={}));const A2=w.memo(function(e){var n,s,r,i;let{id:o,accessibility:a,autoScroll:l=!0,children:c,sensors:d=E2,collisionDetection:f=HN,measuring:h,modifiers:p,...x}=e;const g=w.useReducer(O2,void 0,R2),[b,y]=g,[m,v]=RN(),[S,_]=w.useState(Yn.Uninitialized),k=S===Yn.Initialized,{draggable:{active:C,nodes:N,translate:P},droppable:{containers:M}}=b,O=C!=null?N.get(C):null,E=w.useRef({initial:null,translated:null}),F=w.useMemo(()=>{var Ve;return C!=null?{id:C,data:(Ve=O==null?void 0:O.data)!=null?Ve:M2,rect:E}:null},[C,O]),U=w.useRef(null),[V,oe]=w.useState(null),[J,D]=w.useState(null),A=$o(x,Object.values(x)),I=oa("DndDescribedBy",o),K=w.useMemo(()=>M.getEnabled(),[M]),z=T2(h),{droppableRects:ce,measureDroppableContainers:Q,measuringScheduled:ke}=x2(K,{dragging:k,dependencies:[P.x,P.y],config:z.droppable}),Z=g2(N,C),pt=w.useMemo(()=>J?Gl(J):null,[J]),zt=Bv(),Bt=y2(Z,z.draggable.measure);L2({activeNode:C!=null?N.get(C):null,config:zt.layoutShiftCompensation,initialRect:Bt,measure:z.draggable.measure});const ie=hm(Z,z.draggable.measure,Bt),Ci=hm(Z?Z.parentElement:null),tn=w.useRef({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:ce,draggableNodes:N,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),pr=M.getNodeFor((n=tn.current.over)==null?void 0:n.id),yn=N2({measure:z.dragOverlay.measure}),gr=(s=yn.nodeRef.current)!=null?s:Z,mr=k?(r=yn.rect)!=null?r:ie:null,hh=!!(yn.nodeRef.current&&yn.rect),ph=w2(hh?null:ie),Mc=bv(gr?st(gr):null),Fn=S2(k?pr??Z:null),la=j2(Fn),ca=kv(p,{transform:{x:P.x-ph.x,y:P.y-ph.y,scaleX:1,scaleY:1},activatorEvent:J,active:F,activeNodeRect:ie,containerNodeRect:Ci,draggingNodeRect:mr,over:tn.current.over,overlayNodeRect:yn.rect,scrollableAncestors:Fn,scrollableAncestorRects:la,windowRect:Mc}),gh=pt?Qr(pt,P):null,mh=_2(Fn),Dv=gm(mh),Tv=gm(mh,[ie]),xr=Qr(ca,Dv),yr=mr?KN(mr,ca):null,ji=F&&yr?f({active:F,collisionRect:yr,droppableRects:ce,droppableContainers:K,pointerCoordinates:gh}):null,xh=$N(ji,"id"),[zn,yh]=w.useState(null),Lv=hh?ca:Qr(ca,Tv),Av=VN(Lv,(i=zn==null?void 0:zn.rect)!=null?i:null,ie),Pc=w.useRef(null),vh=w.useCallback((Ve,gt)=>{let{sensor:mt,options:Bn}=gt;if(U.current==null)return;const jt=N.get(U.current);if(!jt)return;const xt=Ve.nativeEvent,nn=new mt({active:U.current,activeNode:jt,event:xt,options:Bn,context:tn,onAbort(Be){if(!N.get(Be))return;const{onDragAbort:sn}=A.current,vn={id:Be};sn==null||sn(vn),m({type:"onDragAbort",event:vn})},onPending(Be,$n,sn,vn){if(!N.get(Be))return;const{onDragPending:Ei}=A.current,Un={id:Be,constraint:$n,initialCoordinates:sn,offset:vn};Ei==null||Ei(Un),m({type:"onDragPending",event:Un})},onStart(Be){const $n=U.current;if($n==null)return;const sn=N.get($n);if(!sn)return;const{onDragStart:vn}=A.current,Ni={activatorEvent:xt,active:{id:$n,data:sn.data,rect:E}};Ar.unstable_batchedUpdates(()=>{vn==null||vn(Ni),_(Yn.Initializing),y({type:De.DragStart,initialCoordinates:Be,active:$n}),m({type:"onDragStart",event:Ni}),oe(Pc.current),D(xt)})},onMove(Be){y({type:De.DragMove,coordinates:Be})},onEnd:vr(De.DragEnd),onCancel:vr(De.DragCancel)});Pc.current=nn;function vr(Be){return async function(){const{active:sn,collisions:vn,over:Ni,scrollAdjustedTranslate:Ei}=tn.current;let Un=null;if(sn&&Ei){const{cancelDrop:Mi}=A.current;Un={activatorEvent:xt,active:sn,collisions:vn,delta:Ei,over:Ni},Be===De.DragEnd&&typeof Mi=="function"&&await Promise.resolve(Mi(Un))&&(Be=De.DragCancel)}U.current=null,Ar.unstable_batchedUpdates(()=>{y({type:Be}),_(Yn.Uninitialized),yh(null),oe(null),D(null),Pc.current=null;const Mi=Be===De.DragEnd?"onDragEnd":"onDragCancel";if(Un){const Rc=A.current[Mi];Rc==null||Rc(Un),m({type:Mi,event:Un})}})}}},[N]),Iv=w.useCallback((Ve,gt)=>(mt,Bn)=>{const jt=mt.nativeEvent,xt=N.get(Bn);if(U.current!==null||!xt||jt.dndKit||jt.defaultPrevented)return;const nn={active:xt};Ve(mt,gt.options,nn)===!0&&(jt.dndKit={capturedBy:gt.sensor},U.current=Bn,vh(mt,gt))},[N,vh]),bh=m2(d,Iv);k2(d),Jt(()=>{ie&&S===Yn.Initializing&&_(Yn.Initialized)},[ie,S]),w.useEffect(()=>{const{onDragMove:Ve}=A.current,{active:gt,activatorEvent:mt,collisions:Bn,over:jt}=tn.current;if(!gt||!mt)return;const xt={active:gt,activatorEvent:mt,collisions:Bn,delta:{x:xr.x,y:xr.y},over:jt};Ar.unstable_batchedUpdates(()=>{Ve==null||Ve(xt),m({type:"onDragMove",event:xt})})},[xr.x,xr.y]),w.useEffect(()=>{const{active:Ve,activatorEvent:gt,collisions:mt,droppableContainers:Bn,scrollAdjustedTranslate:jt}=tn.current;if(!Ve||U.current==null||!gt||!jt)return;const{onDragOver:xt}=A.current,nn=Bn.get(xh),vr=nn&&nn.rect.current?{id:nn.id,rect:nn.rect.current,data:nn.data,disabled:nn.disabled}:null,Be={active:Ve,activatorEvent:gt,collisions:mt,delta:{x:jt.x,y:jt.y},over:vr};Ar.unstable_batchedUpdates(()=>{yh(vr),xt==null||xt(Be),m({type:"onDragOver",event:Be})})},[xh]),Jt(()=>{tn.current={activatorEvent:J,active:F,activeNode:Z,collisionRect:yr,collisions:ji,droppableRects:ce,draggableNodes:N,draggingNode:gr,draggingNodeRect:mr,droppableContainers:M,over:zn,scrollableAncestors:Fn,scrollAdjustedTranslate:xr},E.current={initial:mr,translated:yr}},[F,Z,ji,yr,N,gr,mr,ce,M,zn,Fn,xr]),f2({...zt,delta:P,draggingRect:yr,pointerCoordinates:gh,scrollableAncestors:Fn,scrollableAncestorRects:la});const Fv=w.useMemo(()=>({active:F,activeNode:Z,activeNodeRect:ie,activatorEvent:J,collisions:ji,containerNodeRect:Ci,dragOverlay:yn,draggableNodes:N,droppableContainers:M,droppableRects:ce,over:zn,measureDroppableContainers:Q,scrollableAncestors:Fn,scrollableAncestorRects:la,measuringConfiguration:z,measuringScheduled:ke,windowRect:Mc}),[F,Z,ie,J,ji,Ci,yn,N,M,ce,zn,Q,Fn,la,z,ke,Mc]),zv=w.useMemo(()=>({activatorEvent:J,activators:bh,active:F,activeNodeRect:ie,ariaDescribedById:{draggable:I},dispatch:y,draggableNodes:N,over:zn,measureDroppableContainers:Q}),[J,bh,F,ie,y,I,N,zn,Q]);return pe.createElement(lv.Provider,{value:v},pe.createElement(aa.Provider,{value:zv},pe.createElement(_v.Provider,{value:Fv},pe.createElement(Ec.Provider,{value:Av},c)),pe.createElement(D2,{disabled:(a==null?void 0:a.restoreFocus)===!1})),pe.createElement(TN,{...a,hiddenTextDescribedById:I}));function Bv(){const Ve=(V==null?void 0:V.autoScrollEnabled)===!1,gt=typeof l=="object"?l.enabled===!1:l===!1,mt=k&&!Ve&&!gt;return typeof l=="object"?{...l,enabled:mt}:{enabled:mt}}}),I2=w.createContext(null),xm="button",F2="Draggable";function z2(t){let{id:e,data:n,disabled:s=!1,attributes:r}=t;const i=oa(F2),{activators:o,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:f,over:h}=w.useContext(aa),{role:p=xm,roleDescription:x="draggable",tabIndex:g=0}=r??{},b=(l==null?void 0:l.id)===e,y=w.useContext(b?Ec:I2),[m,v]=Yl(),[S,_]=Yl(),k=C2(o,e),C=$o(n);Jt(()=>(f.set(e,{id:e,key:i,node:m,activatorNode:S,data:C}),()=>{const P=f.get(e);P&&P.key===i&&f.delete(e)}),[f,e]);const N=w.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":s,"aria-pressed":b&&p===xm?!0:void 0,"aria-roledescription":x,"aria-describedby":d.draggable}),[s,p,g,b,x,d.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:N,isDragging:b,listeners:s?void 0:k,node:m,over:h,setNodeRef:v,setActivatorNodeRef:_,transform:y}}function Cv(){return w.useContext(_v)}const B2="Droppable",$2={timeout:25};function jv(t){let{data:e,disabled:n=!1,id:s,resizeObserverConfig:r}=t;const i=oa(B2),{active:o,dispatch:a,over:l,measureDroppableContainers:c}=w.useContext(aa),d=w.useRef({disabled:n}),f=w.useRef(!1),h=w.useRef(null),p=w.useRef(null),{disabled:x,updateMeasurementsFor:g,timeout:b}={...$2,...r},y=$o(g??s),m=w.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(y.current)?y.current:[y.current]),p.current=null},b)},[b]),v=Nc({callback:m,disabled:x||!o}),S=w.useCallback((N,P)=>{v&&(P&&(v.unobserve(P),f.current=!1),N&&v.observe(N))},[v]),[_,k]=Yl(S),C=$o(e);return w.useEffect(()=>{!v||!_.current||(v.disconnect(),f.current=!1,v.observe(_.current))},[_,v]),w.useEffect(()=>(a({type:De.RegisterDroppable,element:{id:s,key:i,disabled:n,node:_,rect:h,data:C}}),()=>a({type:De.UnregisterDroppable,key:i,id:s})),[s]),w.useEffect(()=>{n!==d.current.disabled&&(a({type:De.SetDroppableDisabled,id:s,key:i,disabled:n}),d.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 U2(t){let{animation:e,children:n}=t;const[s,r]=w.useState(null),[i,o]=w.useState(null),a=Xl(n);return!n&&!s&&a&&r(a),Jt(()=>{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]),pe.createElement(pe.Fragment,null,n,s?w.cloneElement(s,{ref:o}):null)}const W2={x:0,y:0,scaleX:1,scaleY:1};function H2(t){let{children:e}=t;return pe.createElement(aa.Provider,{value:Sv},pe.createElement(Ec.Provider,{value:W2},e))}const V2={position:"fixed",touchAction:"none"},Q2=t=>jc(t)?"transform 250ms ease":void 0,K2=w.forwardRef((t,e)=>{let{as:n,activatorEvent:s,adjustScale:r,children:i,className:o,rect:a,style:l,transform:c,transition:d=Q2}=t;if(!a)return null;const f=r?c:{...c,scaleX:1,scaleY:1},h={...V2,width:a.width,height:a.height,top:a.top,left:a.left,transform:Es.Transform.toString(f),transformOrigin:r&&s?FN(s,a):void 0,transition:typeof d=="function"?d(s):d,...l};return pe.createElement(n,{className:o,style:h,ref:e},i)}),Y2=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)}},X2=t=>{let{transform:{initial:e,final:n}}=t;return[{transform:Es.Transform.toString(e)},{transform:Es.Transform.toString(n)}]},q2={duration:250,easing:"ease",keyframes:X2,sideEffects:Y2({styles:{active:{opacity:"0"}}})};function G2(t){let{config:e,draggableNodes:n,droppableContainers:s,measuringConfiguration:r}=t;return Cc((i,o)=>{if(e===null)return;const a=n.get(i);if(!a)return;const l=a.node.current;if(!l)return;const c=wv(o);if(!c)return;const{transform:d}=st(o).getComputedStyle(o),f=uv(d);if(!f)return;const h=typeof e=="function"?e:J2(e);return xv(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 J2(t){const{duration:e,easing:n,sideEffects:s,keyframes:r}={...q2,...t};return i=>{let{active:o,dragOverlay:a,transform:l,...c}=i;if(!e)return;const d={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-d.x,y:l.y-d.y,...f},p=r({...c,active:o,dragOverlay:a,transform:{initial:l,final:h}}),[x]=p,g=p[p.length-1];if(JSON.stringify(x)===JSON.stringify(g))return;const b=s==null?void 0:s({active:o,dragOverlay:a,...c}),y=a.node.animate(p,{duration:e,easing:n,fill:"forwards"});return new Promise(m=>{y.onfinish=()=>{b==null||b(),m()}})}}let ym=0;function Z2(t){return w.useMemo(()=>{if(t!=null)return ym++,ym},[t])}const eE=pe.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:d,active:f,activeNodeRect:h,containerNodeRect:p,draggableNodes:x,droppableContainers:g,dragOverlay:b,over:y,measuringConfiguration:m,scrollableAncestors:v,scrollableAncestorRects:S,windowRect:_}=Cv(),k=w.useContext(Ec),C=Z2(f==null?void 0:f.id),N=kv(o,{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:b.rect,over:y,overlayNodeRect:b.rect,scrollableAncestors:v,scrollableAncestorRects:S,transform:k,windowRect:_}),P=fh(h),M=G2({config:s,draggableNodes:x,droppableContainers:g,measuringConfiguration:m}),O=P?b.setRef:void 0;return pe.createElement(H2,null,pe.createElement(U2,{animation:M},f&&C?pe.createElement(K2,{key:C,id:f.id,ref:O,as:a,activatorEvent:d,adjustScale:e,className:l,transition:i,rect:P,style:{zIndex:c,...r},transform:N},n):null))});function Nv(t,e,n){const s=t.slice();return s.splice(n<0?s.length+n:n,0,s.splice(e,1)[0]),s}function tE(t,e){return t.reduce((n,s,r)=>{const i=e.get(s);return i&&(n[r]=i),n},Array(t.length))}function Ua(t){return t!==null&&t>=0}function nE(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function sE(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const Ev=t=>{let{rects:e,activeIndex:n,overIndex:s,index:r}=t;const i=Nv(e,s,n),o=e[r],a=i[r];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},Wa={scaleX:1,scaleY:1},rE=t=>{var e;let{activeIndex:n,activeNodeRect:s,index:r,rects:i,overIndex:o}=t;const a=(e=i[n])!=null?e:s;if(!a)return null;if(r===n){const c=i[o];return c?{x:0,y:n<o?c.top+c.height-(a.top+a.height):c.top-a.top,...Wa}:null}const l=iE(i,r,n);return r>n&&r<=o?{x:0,y:-a.height-l,...Wa}:r<n&&r>=o?{x:0,y:a.height+l,...Wa}:{x:0,y:0,...Wa}};function iE(t,e,n){const s=t[e],r=t[e-1],i=t[e+1];return s?n<e?r?s.top-(r.top+r.height):i?i.top-(s.top+s.height):0:i?i.top-(s.top+s.height):r?s.top-(r.top+r.height):0:0}const Mv="Sortable",Pv=pe.createContext({activeIndex:-1,containerId:Mv,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Ev,disabled:{draggable:!1,droppable:!1}});function oE(t){let{children:e,id:n,items:s,strategy:r=Ev,disabled:i=!1}=t;const{active:o,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:d}=Cv(),f=oa(Mv,n),h=a.rect!==null,p=w.useMemo(()=>s.map(k=>typeof k=="object"&&"id"in k?k.id:k),[s]),x=o!=null,g=o?p.indexOf(o.id):-1,b=c?p.indexOf(c.id):-1,y=w.useRef(p),m=!nE(p,y.current),v=b!==-1&&g===-1||m,S=sE(i);Jt(()=>{m&&x&&d(p)},[m,p,x,d]),w.useEffect(()=>{y.current=p},[p]);const _=w.useMemo(()=>({activeIndex:g,containerId:f,disabled:S,disableTransforms:v,items:p,overIndex:b,useDragOverlay:h,sortedRects:tE(p,l),strategy:r}),[g,f,S.draggable,S.droppable,v,p,b,l,h,r]);return pe.createElement(Pv.Provider,{value:_},e)}const aE=t=>{let{id:e,items:n,activeIndex:s,overIndex:r}=t;return Nv(n,s,r).indexOf(e)},lE=t=>{let{containerId:e,isSorting:n,wasDragging:s,index:r,items:i,newIndex:o,previousItems:a,previousContainerId:l,transition:c}=t;return!c||!s||a!==i&&r===o?!1:n?!0:o!==r&&e===l},cE={duration:200,easing:"ease"},Rv="transform",uE=Es.Transition.toString({property:Rv,duration:0,easing:"linear"}),dE={roleDescription:"sortable"};function fE(t){let{disabled:e,index:n,node:s,rect:r}=t;const[i,o]=w.useState(null),a=w.useRef(n);return Jt(()=>{if(!e&&n!==a.current&&s.current){const l=r.current;if(l){const c=ki(s.current,{ignoreTransform:!0}),d={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(d.x||d.y)&&o(d)}}n!==a.current&&(a.current=n)},[e,n,s,r]),w.useEffect(()=>{i&&o(null)},[i]),i}function hE(t){let{animateLayoutChanges:e=lE,attributes:n,disabled:s,data:r,getNewIndex:i=aE,id:o,strategy:a,resizeObserverConfig:l,transition:c=cE}=t;const{items:d,containerId:f,activeIndex:h,disabled:p,disableTransforms:x,sortedRects:g,overIndex:b,useDragOverlay:y,strategy:m}=w.useContext(Pv),v=pE(s,p),S=d.indexOf(o),_=w.useMemo(()=>({sortable:{containerId:f,index:S,items:d},...r}),[f,r,S,d]),k=w.useMemo(()=>d.slice(d.indexOf(o)),[d,o]),{rect:C,node:N,isOver:P,setNodeRef:M}=jv({id:o,data:_,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...l}}),{active:O,activatorEvent:E,activeNodeRect:F,attributes:U,setNodeRef:V,listeners:oe,isDragging:J,over:D,setActivatorNodeRef:A,transform:I}=z2({id:o,data:_,attributes:{...dE,...n},disabled:v.draggable}),K=wN(M,V),z=!!O,ce=z&&!x&&Ua(h)&&Ua(b),Q=!y&&J,ke=Q&&ce?I:null,pt=ce?ke??(a??m)({rects:g,activeNodeRect:F,activeIndex:h,overIndex:b,index:S}):null,zt=Ua(h)&&Ua(b)?i({id:o,items:d,activeIndex:h,overIndex:b}):S,Bt=O==null?void 0:O.id,ie=w.useRef({activeId:Bt,items:d,newIndex:zt,containerId:f}),Ci=d!==ie.current.items,tn=e({active:O,containerId:f,isDragging:J,isSorting:z,id:o,index:S,items:d,newIndex:ie.current.newIndex,previousItems:ie.current.items,previousContainerId:ie.current.containerId,transition:c,wasDragging:ie.current.activeId!=null}),pr=fE({disabled:!tn,index:S,node:N,rect:C});return w.useEffect(()=>{z&&ie.current.newIndex!==zt&&(ie.current.newIndex=zt),f!==ie.current.containerId&&(ie.current.containerId=f),d!==ie.current.items&&(ie.current.items=d)},[z,zt,f,d]),w.useEffect(()=>{if(Bt===ie.current.activeId)return;if(Bt!=null&&ie.current.activeId==null){ie.current.activeId=Bt;return}const gr=setTimeout(()=>{ie.current.activeId=Bt},50);return()=>clearTimeout(gr)},[Bt]),{active:O,activeIndex:h,attributes:U,data:_,rect:C,index:S,newIndex:zt,items:d,isOver:P,isSorting:z,isDragging:J,listeners:oe,node:N,overIndex:b,over:D,setNodeRef:K,setActivatorNodeRef:A,setDroppableNodeRef:M,setDraggableNodeRef:V,transform:pr??pt,transition:yn()};function yn(){if(pr||Ci&&ie.current.newIndex===S)return uE;if(!(Q&&!jc(E)||!c)&&(z||tn))return Es.Transition.toString({...c,property:Rv})}}function pE(t,e){var n,s;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t==null?void 0:t.draggable)!=null?n:e.draggable,droppable:(s=t==null?void 0:t.droppable)!=null?s:e.droppable}}se.Down,se.Right,se.Up,se.Left;function Ov({lead:t,onAbrir:e,emOverlay:n=!1}){const{attributes:s,listeners:r,setNodeRef:i,transform:o,transition:a,isDragging:l}=hE({id:t.id});return u.jsxs("div",{ref:i,...r,...s,style:{transform:Es.Transform.toString(o),transition:a,opacity:l?.5:1},className:H("bg-white rounded-lg shadow-sm border border-gray-100 p-3 cursor-grab active:cursor-grabbing select-none touch-none",n&&"shadow-xl rotate-2 cursor-grabbing"),onDoubleClick:()=>e==null?void 0:e(t),title:"Arraste para mudar de coluna · duplo clique para editar",children:[u.jsx("p",{className:"text-sm font-semibold text-gray-800 truncate",children:t.nome}),u.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:na(t.telefone)}),u.jsxs("div",{className:"flex items-center justify-between mt-2",children:[u.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}),u.jsx("span",{className:"text-[10px] text-gray-400",title:"Data de criação",children:new Date(t.criado_em).toLocaleDateString("pt-BR")})]})]})}function gE({etapa:t,leads:e,cor:n,onAbrirLead:s}){const{setNodeRef:r,isOver:i}=jv({id:t});return u.jsxs("div",{className:"w-72 shrink-0",children:[u.jsxs("div",{className:"flex items-center justify-between px-1 pb-2",children:[u.jsxs("span",{className:"flex items-center gap-2 text-sm font-semibold text-gray-700",children:[u.jsx("span",{className:H("w-2.5 h-2.5 rounded-full",n)}),Rn[t]]}),u.jsx("span",{className:"text-xs font-medium text-gray-500 bg-white border border-gray-200 rounded-full px-2 py-0.5 shadow-sm",children:e.length})]}),u.jsx("div",{ref:r,className:H("bg-white rounded-xl p-3 min-h-[420px] transition-colors","shadow-sm border",i?"border-2 border-dashed border-indigo-400 bg-indigo-50":"border-gray-100"),children:u.jsx(oE,{items:e.map(o=>o.id),strategy:rE,children:u.jsxs("div",{className:"space-y-2 max-h-[calc(100vh-320px)] overflow-y-auto pr-0.5",children:[e.length===0&&u.jsxs("div",{className:"text-center text-xs text-gray-400 border-2 border-dashed border-gray-200 rounded-lg py-10 mt-8",children:[u.jsx("i",{className:"fas fa-inbox text-2xl text-gray-300 mb-2 block"}),"Arraste leads para cá"]}),e.map(o=>u.jsx(Ov,{lead:o,onAbrir:s},o.id))]})})})]})}const mE={leads:"bg-blue-500",em_contato:"bg-amber-500",proposta:"bg-violet-500",fechado:"bg-green-500"};function Wi(t,e){if(St.includes(e))return e;for(const n of St)if((t[n]||[]).includes(e))return n;return null}function xE({leads:t,onMover:e,onAbrirLead:n}){const[s,r]=w.useState(()=>yE(t)),[i,o]=w.useState(null),a=w.useRef(s),l=AN(LN(dh,{activationConstraint:{distance:6}}));w.useEffect(()=>{r(x=>{const g=new Set(t.map(v=>v.id)),b={};for(const v of St)b[v]=(x[v]||[]).filter(S=>g.has(S));let y=!1;for(const v of t){const S=Wi(b,v.id);S===null?(b[v.etapa]=[...b[v.etapa]||[],v.id],y=!0):S!==v.etapa&&(b[S]=b[S].filter(_=>_!==v.id),b[v.etapa]=[...b[v.etapa]||[],v.id],y=!0)}const m=St.every(v=>(b[v]||[]).length===(x[v]||[]).length);return y||!m?b:x})},[t]);const c=w.useCallback(x=>x&&t.find(g=>g.id===x)||null,[t]),d=w.useMemo(()=>c(i),[c,i]),f=x=>{a.current=s,o(String(x.active.id))},h=w.useCallback(x=>{const{active:g,over:b}=x;if(!b)return;const y=String(g.id),m=String(b.id);r(v=>{const S=Wi(v,y),_=Wi(v,m);return!S||!_||S===_?v:{...v,[S]:v[S].filter(k=>k!==y),[_]:[...v[_],y]}})},[]),p=async x=>{o(null);const g=String(x.active.id);if(!x.over){r(a.current);return}const b=Wi(s,String(x.over.id)),y=Wi(a.current,g);!b||!y||b===y||await e(g,b)};return u.jsxs(A2,{sensors:l,collisionDetection:UN,onDragStart:f,onDragOver:h,onDragEnd:p,children:[u.jsx("div",{className:"flex gap-4 overflow-x-auto pb-2",children:St.map(x=>u.jsx(gE,{etapa:x,cor:mE[x],leads:t.filter(g=>{var b;return(b=s[x])==null?void 0:b.includes(g.id)}),onAbrirLead:n},x))}),u.jsx(eE,{children:d?u.jsx(Ov,{lead:d,emOverlay:!0}):null})]})}function yE(t){const e={leads:[],em_contato:[],proposta:[],fechado:[]};for(const n of t)e[n.etapa]&&e[n.etapa].push(n.id);return e}const vm={nome:"",telefone:"",email:"",fonte:"Manual",etapa:"leads"};function vE(){const{toast:t}=en(),[e,n]=w.useState([]),[s,r]=w.useState(null),[i,o]=w.useState(!1),[a,l]=w.useState(!1),[c,d]=w.useState(null),[f,h]=w.useState({...vm}),[p,x]=w.useState(""),g=w.useCallback(async()=>{n(await W.crm.leadsListar())},[]);w.useEffect(()=>{g().catch(C=>t("erro",C.message))},[g,t]);const b=async(C,N)=>{const P=e;n(M=>M.map(O=>O.id===C?{...O,etapa:N}:O));try{await W.crm.moverLead(C,N),t("sucesso",`Lead movido para "${Rn[N]}".`)}catch(M){n(P),t("erro",M instanceof Error?M.message:"Falha ao mover lead.")}},y=async()=>{var C;if(!((C=f.nome)!=null&&C.trim())){t("erro","O nome do lead é obrigatório.");return}try{await W.crm.criarLead({...f,etapa:f.etapa||"leads"}),t("sucesso","Lead criado com sucesso."),l(!1),h({...vm}),await g()}catch(N){t("erro",N instanceof Error?N.message:"Falha ao criar lead.")}},m=async()=>{o(!0);try{const C=await W.crm.sugestoes();r(C.sugestoes)}catch(C){t("erro",C instanceof Error?C.message:"Falha ao pedir sugestões.")}finally{o(!1)}},v=async C=>{try{await W.crm.aplicar(C.lead_id,C.para),r(N=>(N==null?void 0:N.filter(P=>P!==C))??null),await g(),t("sucesso",`Sugestão aplicada: ${C.lead_nome} → ${Rn[C.para]}.`)}catch(N){t("erro",N instanceof Error?N.message:"Falha ao aplicar sugestão.")}},S=async C=>{try{(await W.leads.enriquecer(C.id)).notas.forEach(P=>t("info",P)),await g()}catch(N){t("erro",N instanceof Error?N.message:"Falha ao enriquecer.")}},_=async()=>{if(c)try{await W.leads.atualizar(c.id,{observacoes:p}),d(null),await g(),t("sucesso","Observações salvas.")}catch(C){t("erro",C instanceof Error?C.message:"Falha ao salvar.")}},k=w.useMemo(()=>Object.fromEntries(St.map(C=>[C,e.filter(N=>N.etapa===C).length])),[e]);return u.jsxs("div",{className:"space-y-6",children:[u.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[u.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-500 flex-wrap",children:[u.jsxs("span",{children:[u.jsx("strong",{className:"text-gray-800",children:e.length})," leads no funil"]}),St.map(C=>u.jsxs("span",{className:"hidden md:inline",children:[Rn[C],": ",u.jsx("strong",{className:"text-gray-700",children:k[C]})]},C))]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs("button",{onClick:m,disabled:i,className:"px-5 py-2.5 text-sm font-medium text-indigo-600 bg-white border border-indigo-200 rounded-lg hover:bg-indigo-50 transition disabled:opacity-60 shadow-sm",children:[u.jsx("i",{className:H("fas fa-wand-magic-sparkles mr-2",i&&"fa-spin")}),"Sugestões da IA"]}),u.jsxs("button",{onClick:()=>l(!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:[u.jsx("i",{className:"fas fa-plus mr-2"})," Adicionar Lead"]})]})]}),u.jsx(xE,{leads:e,onMover:b,onAbrirLead:C=>{d(C),x(C.observacoes||"")}}),u.jsxs(Xt,{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&&u.jsxs("p",{className:"text-sm text-gray-500 text-center py-8",children:[u.jsx("i",{className:"fas fa-circle-check text-green-500 text-2xl block mb-3"}),"Nenhuma sugestão no momento — o funil está equilibrado. 🎯"]}),u.jsx("div",{className:"space-y-3",children:s==null?void 0:s.map((C,N)=>u.jsxs("div",{className:"border border-gray-100 rounded-xl p-4 flex items-start justify-between gap-4 hover:border-indigo-200 transition",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("p",{className:"text-sm font-semibold text-gray-800 truncate",children:C.lead_nome}),u.jsxs("p",{className:"text-xs text-gray-500 mt-1 flex items-center gap-2",children:[u.jsx(_s,{status:C.de})," ",u.jsx("i",{className:"fas fa-arrow-right text-gray-300"})," ",u.jsx(_s,{status:C.para}),u.jsxs("span",{className:"text-gray-400",children:["confiança ",Math.round(C.confianca*100),"%"]})]}),u.jsx("p",{className:"text-xs text-gray-600 mt-2",children:C.motivo})]}),u.jsx("button",{onClick:()=>v(C),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"})]},N))})]}),u.jsx(Xt,{aberto:a,onFechar:()=>l(!1),titulo:"Adicionar Lead",icone:"fas fa-user-plus",children:u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[u.jsx(_r,{rotulo:"Nome *",valor:f.nome||"",onChange:C=>h({...f,nome:C})}),u.jsx(_r,{rotulo:"Telefone",valor:f.telefone||"",onChange:C=>h({...f,telefone:C}),placeholder:"(11) 99999-9999"}),u.jsx(_r,{rotulo:"E-mail",tipo:"email",valor:f.email||"",onChange:C=>h({...f,email:C}),placeholder:"contato@empresa.com.br"}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Coluna inicial"}),u.jsx("select",{value:f.etapa||"leads",onChange:C=>h({...f,etapa:C.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:St.map(C=>u.jsx("option",{value:C,children:Rn[C]},C))})]})]}),u.jsx(_r,{rotulo:"Fonte",valor:f.fonte||"",onChange:C=>h({...f,fonte:C}),placeholder:"Manual, Google Maps, Instagram, CNPJ..."}),u.jsxs(Tt,{titulo:"Campos avançados",icone:"fas fa-sliders",children:[u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[u.jsx(_r,{rotulo:"Empresa",valor:f.empresa||"",onChange:C=>h({...f,empresa:C})}),u.jsx(_r,{rotulo:"Cidade",valor:f.cidade||"",onChange:C=>h({...f,cidade:C}),placeholder:"São Paulo/SP"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Observações"}),u.jsx("textarea",{value:f.observacoes||"",onChange:C=>h({...f,observacoes:C.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"})]})]}),u.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[u.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"}),u.jsxs("button",{onClick:y,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:[u.jsx("i",{className:"fas fa-save mr-2"})," Salvar"]})]})]})}),u.jsx(Xt,{aberto:!!c,onFechar:()=>d(null),titulo:"Lead",icone:"fas fa-address-card",children:c&&u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("p",{className:"text-base font-semibold text-gray-800",children:c.nome}),u.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:[na(c.telefone)," · ",c.fonte," · criado em ",Al(c.criado_em)]})]}),u.jsx(_s,{status:c.etapa})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Observações"}),u.jsx("textarea",{value:p,onChange:C=>x(C.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..."})]}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("button",{onClick:()=>S(c),className:"text-sm text-indigo-600 hover:text-indigo-800 font-medium",children:[u.jsx("i",{className:"fas fa-wand-magic-sparkles mr-1"})," Enriquecer com IA"]}),u.jsxs("div",{className:"flex gap-3",children:[u.jsx("button",{onClick:()=>d(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"}),u.jsxs("button",{onClick:_,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:[u.jsx("i",{className:"fas fa-save mr-2"})," Salvar"]})]})]})]})})]})}function _r({rotulo:t,valor:e,onChange:n,tipo:s="text",placeholder:r}){return u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:t}),u.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"})]})}function bE(){const{toast:t}=en(),[e,n]=w.useState([]),[s,r]=w.useState({}),[i,o]=w.useState(!1),[a,l]=w.useState(null),{data:c=[],refetch:d}=ey({queryKey:["campanhas"],queryFn:()=>W.campanhas.listar(),refetchInterval:E=>{var F;return(F=E.state.data)!=null&&F.some(U=>U.status==="em_andamento")?4e3:!1},refetchIntervalInBackground:!1}),f=w.useCallback(async()=>{const[E,F]=await Promise.all([W.leads.listar(),W.agentes.templates()]);n(E),r(F)},[]);w.useEffect(()=>{f().catch(E=>t("erro",E.message))},[f,t]);const[h,p]=w.useState(""),[x,g]=w.useState("texto"),[b,y]=w.useState("texto"),[m,v]=w.useState(new Set),[S,_]=w.useState("todas"),k=w.useMemo(()=>S==="todas"?e:e.filter(E=>E.etapa===S),[e,S]),C=E=>{v(F=>{const U=new Set(F);return U.has(E)?U.delete(E):U.add(E),U})},N=()=>{v(new Set(k.map(E=>E.id)))},P=async()=>{if(!h.trim()){t("erro","Dê um nome para a campanha.");return}if(m.size===0){t("erro","Selecione ao menos um lead para disparar.");return}try{await W.campanhas.criar({nome:h.trim(),canal:x,template:b,lead_ids:[...m]}),t("sucesso","Campanha criada — clique em Iniciar quando estiver pronto."),o(!1),p(""),v(new Set),await d()}catch(E){t("erro",E instanceof Error?E.message:"Falha ao criar campanha.")}},M=async(E,F)=>{try{const U=F==="iniciar"?await W.campanhas.iniciar(E.id):F==="pausar"?await W.campanhas.pausar(E.id):await W.campanhas.parar(E.id);t(U.ok?"sucesso":"info",U.mensagem),await d()}catch(U){t("erro",U instanceof Error?U.message:"Falha na ação.")}},O=async E=>{try{await W.campanhas.remover(E.id),t("sucesso",`Campanha "${E.nome}" removida.`),await d()}catch(F){t("erro",F instanceof Error?F.message:"Falha ao remover.")}};return u.jsxs("div",{className:"space-y-6",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("p",{className:"text-sm text-gray-500",children:[u.jsx("strong",{className:"text-gray-800",children:c.length})," campanhas • templates configuráveis em Agentes"]}),u.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:[u.jsx("i",{className:"fas fa-plus mr-2"})," Nova Campanha"]})]}),u.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[c.map(E=>{const F=Math.max(E.total,E.enviadas+E.erros),U=F?Math.round((E.enviadas+E.erros)/F*100):0,V=E.status==="em_andamento";return u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-5 space-y-3",children:[u.jsxs("div",{className:"flex items-start justify-between gap-3",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("p",{className:"text-sm font-semibold text-gray-800 truncate",children:E.nome}),u.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:["criada em ",Al(E.criado_em),' · template "',E.template,'"']})]}),u.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[u.jsx(_s,{status:wE(E.canal),rotulo:E.canal==="audio"?"Áudio":"Texto"}),u.jsx(_s,{status:E.status})]})]}),u.jsx(_c,{valor:U,mostrarLabel:!0}),u.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500",children:[u.jsxs("span",{children:[u.jsx("i",{className:"fas fa-paper-plane text-blue-500 mr-1"}),E.enviadas," enviadas"]}),u.jsxs("span",{children:[u.jsx("i",{className:"fas fa-circle-exclamation text-red-500 mr-1"}),E.erros," erros"]}),u.jsxs("span",{children:[F," leads"]})]}),u.jsxs("div",{className:"flex items-center justify-between pt-1",children:[u.jsxs("button",{onClick:()=>l(E),className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:[u.jsx("i",{className:"fas fa-list mr-1"})," Ver eventos"]}),u.jsxs("div",{className:"flex items-center gap-2",children:[(E.status==="rascunho"||E.status==="pausada"||E.status==="concluida")&&u.jsxs("button",{onClick:()=>M(E,"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:[u.jsx("i",{className:"fas fa-play mr-1"})," ",E.status==="pausada"?"Retomar":"Iniciar"]}),V&&u.jsxs(u.Fragment,{children:[u.jsxs("button",{onClick:()=>M(E,"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:[u.jsx("i",{className:"fas fa-pause mr-1"})," Pausar"]}),u.jsxs("button",{onClick:()=>M(E,"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:[u.jsx("i",{className:"fas fa-stop mr-1"})," Parar"]})]}),u.jsx("button",{onClick:()=>O(E),className:"text-gray-400 hover:text-red-600 px-2 py-2",title:"Excluir campanha",children:u.jsx("i",{className:"fas fa-trash"})})]})]})]},E.id)}),c.length===0&&u.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:[u.jsx("i",{className:"fas fa-bullhorn text-3xl text-gray-200 block mb-3"}),'Nenhuma campanha ainda. Crie a primeira com "Nova Campanha".']})]}),u.jsx(Xt,{aberto:i,onFechar:()=>o(!1),titulo:"Nova campanha de disparo",icone:"fas fa-bullhorn",largura:"lg",children:u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[u.jsxs("div",{className:"md:col-span-3",children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Nome da campanha *"}),u.jsx("input",{value:h,onChange:E=>p(E.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"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Canal"}),u.jsxs("select",{value:x,onChange:E=>{const F=E.target.value;g(F),y(F)},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:[u.jsx("option",{value:"texto",children:"Texto"}),u.jsx("option",{value:"audio",children:"Áudio"})]})]}),u.jsxs("div",{className:"md:col-span-2",children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Template"}),u.jsx("select",{value:b,onChange:E=>y(E.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(E=>u.jsxs("option",{value:E,children:[E==="texto"?"Texto":"Áudio"," — ",s[E].slice(0,40),"..."]},E))})]})]}),u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsxs("label",{className:"text-xs font-medium text-gray-500",children:["Leads destinatários — ",m.size," selecionado(s)"]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs("select",{value:S,onChange:E=>_(E.target.value),className:"text-xs border border-gray-200 rounded-lg px-2 py-1.5 bg-white",children:[u.jsx("option",{value:"todas",children:"Todas as etapas"}),St.map(E=>u.jsx("option",{value:E,children:Rn[E]},E))]}),u.jsx("button",{onClick:N,className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:"Selecionar todos"})]})]}),u.jsxs("div",{className:"max-h-52 overflow-y-auto border border-gray-100 rounded-lg divide-y divide-gray-50",children:[k.map(E=>u.jsxs("label",{className:"flex items-center gap-3 px-3 py-2.5 text-sm cursor-pointer hover:bg-indigo-50/50",children:[u.jsx("input",{type:"checkbox",checked:m.has(E.id),onChange:()=>C(E.id),className:"w-4 h-4 accent-indigo-500"}),u.jsx("span",{className:"text-gray-700 flex-1 truncate",children:E.nome}),u.jsx("span",{className:"text-xs text-gray-400",children:E.telefone||E.email||"sem contato"})]},E.id)),k.length===0&&u.jsx("p",{className:"px-3 py-6 text-center text-xs text-gray-400",children:"Nenhum lead nesta etapa."})]})]}),u.jsx(Tt,{titulo:"Como funciona o disparo?",icone:"fas fa-circle-question",children:u.jsxs("p",{className:"text-xs text-gray-500",children:["O disparo é executado pelo ",u.jsx("strong",{children:"OpenOutreach"})," (eracle/OpenOutreach). Se ainda não configurou, a validação acontece na hora de iniciar — configure em ",u.jsx("strong",{children:"Ferramentas → OpenOutreach"}),"."]})}),u.jsxs("div",{className:"flex justify-end gap-3 pt-1",children:[u.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"}),u.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:[u.jsx("i",{className:"fas fa-plus mr-2"})," Criar campanha"]})]})]})}),u.jsx(Xt,{aberto:!!a,onFechar:()=>l(null),titulo:`Eventos — ${(a==null?void 0:a.nome)??""}`,icone:"fas fa-list",largura:"lg",children:a&&u.jsxs("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:[a.eventos.length===0&&u.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((E,F)=>{var U;return u.jsxs("div",{className:"flex items-start gap-3 text-sm border-b border-gray-50 pb-2",children:[u.jsx("i",{className:H("mt-1 text-xs",E.status==="enviado"?"fas fa-circle-check text-green-500":"fas fa-circle-xmark text-red-500")}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("p",{className:"text-gray-700 truncate",children:((U=e.find(V=>V.id===E.lead_id))==null?void 0:U.nome)??E.lead_id}),E.mensagem&&u.jsx("p",{className:"text-xs text-gray-400 truncate",children:E.mensagem})]}),u.jsx("span",{className:"text-xs text-gray-300 shrink-0",children:Al(E.momento)})]},F)})]})})]})}function wE(t){return t==="audio"?"audio":"texto"}const SE=[{id:"cnpj",rotulo:"CNPJ",icone:"fas fa-building"}];function _E(){const[t,e]=my(),n=ta(),s=t.get("tab")||"cnpj";return u.jsxs("div",{className:"space-y-6",children:[u.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[u.jsx("div",{className:"flex gap-2",children:SE.map(r=>u.jsxs("button",{onClick:()=>e({tab:r.id}),className:H("px-5 py-2.5 text-sm font-medium rounded-lg transition",s===r.id?"bg-[#1e1b4b] text-white shadow-sm":"bg-white text-gray-600 border border-gray-200 hover:bg-gray-50"),children:[u.jsx("i",{className:H(r.icone,"mr-2")}),r.rotulo]},r.id))}),u.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[u.jsxs("button",{onClick:()=>n("/extrator-maps"),className:"text-indigo-600 hover:text-indigo-800 font-medium",children:[u.jsx("i",{className:"fas fa-map-marked-alt mr-1"})," Extrator Maps"]}),u.jsxs("button",{onClick:()=>n("/extrator-instagram"),className:"text-indigo-600 hover:text-indigo-800 font-medium",children:[u.jsx("i",{className:"fab fa-instagram mr-1"})," Extrator Instagram"]})]})]}),s==="cnpj"&&u.jsx(jE,{})]})}function kE({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 u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden",children:[u.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-100 bg-gray-50/50",children:[u.jsxs("p",{className:"text-sm font-medium text-gray-700",children:[t.leads.length," resultado(s) — ",s.size," selecionado(s)"]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.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"}),u.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:[u.jsx("i",{className:"fas fa-file-import mr-1"})," ",n?"Importando...":`Importar ${s.size}`]})]})]}),u.jsx("div",{className:"overflow-x-auto max-h-[420px] overflow-y-auto",children:u.jsxs("table",{className:"w-full text-sm",children:[u.jsx("thead",{className:"sticky top-0",children:u.jsxs("tr",{className:"text-left text-xs text-gray-500 uppercase border-b border-gray-100 bg-white",children:[u.jsx("th",{className:"px-4 py-2 w-8"}),u.jsx("th",{className:"px-4 py-2 font-semibold",children:"Nome / Empresa"}),u.jsx("th",{className:"px-4 py-2 font-semibold",children:"Contato"}),u.jsx("th",{className:"px-4 py-2 font-semibold",children:"Cidade"}),u.jsx("th",{className:"px-4 py-2 font-semibold",children:"Detalhes"})]})}),u.jsx("tbody",{children:t.leads.map((a,l)=>u.jsxs("tr",{className:"border-b border-gray-50 hover:bg-indigo-50/40",children:[u.jsx("td",{className:"px-4 py-2",children:u.jsx("input",{type:"checkbox",checked:s.has(l),onChange:()=>i(l),className:"w-4 h-4 accent-indigo-500"})}),u.jsx("td",{className:"px-4 py-2 text-gray-800",children:a.nome||a.empresa||"—"}),u.jsxs("td",{className:"px-4 py-2 text-gray-600",children:[u.jsx("p",{children:na(a.telefone)}),u.jsx("p",{className:"text-xs text-gray-400",children:a.email||"sem e-mail"})]}),u.jsx("td",{className:"px-4 py-2 text-gray-500 text-xs",children:a.cidade||"—"}),u.jsx("td",{className:"px-4 py-2 text-xs text-gray-400",children:CE(a)})]},l))})]})})]})}function CE(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 jE(){const{toast:t}=en(),[e,n]=w.useState("cnpj"),[s,r]=w.useState(""),[i,o]=w.useState(""),[a,l]=w.useState("SP"),[c,d]=w.useState(20),[f,h]=w.useState(null),[p,x]=w.useState(!1),[g,b]=w.useState(!1),y=w.useCallback(async()=>{x(!0),h(null);try{if(e==="cnpj"){const S=await W.extrair.cnpj(s.trim());h({leads:[S]}),t("sucesso","CNPJ localizado — revise e importe.")}else{const S=await W.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{x(!1)}},[e,s,i,a,c,t]),m=async S=>{b(!0);try{const _=await W.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 u.jsxs("div",{className:"space-y-5",children:[u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-4",children:[u.jsxs("div",{className:"flex gap-2",children:[u.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"}),u.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"?u.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:u.jsxs("div",{className:"md:col-span-2",children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"CNPJ *"}),u.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"})]})}):u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"CNAE (código) *"}),u.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"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"UF *"}),u.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=>u.jsx("option",{children:S},S))})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Quantidade"}),u.jsx("input",{type:"number",min:1,max:100,value:c,onChange:S=>d(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"})]})]}),u.jsxs("button",{onClick:y,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:[u.jsx("i",{className:H("fas fa-building mr-2",p&&"fa-spin")}),p?"Consultando...":e==="cnpj"?"Consultar CNPJ":"Buscar empresas"]}),u.jsx(Tt,{titulo:"Fontes e scraping profundo",icone:"fas fa-circle-question",children:u.jsxs("ul",{className:"text-xs text-gray-500 space-y-1 list-disc pl-4",children:[u.jsxs("li",{children:["Consulta direta usa a ",u.jsx("strong",{children:"BrasilAPI"})," (brasilapi.com.br) — sem chave."]}),u.jsxs("li",{children:["A busca por CNAE/UF usa um ",u.jsx("strong",{children:"provedor configurável"})," (padrão: OpenCNPJ) — ajuste a URL em"," ",u.jsx("strong",{children:"Ferramentas → Extratores"})," conforme o provedor que você usa."]}),u.jsxs("li",{children:["Scraping profundo de contatos no site da empresa via ",u.jsx("strong",{children:"Scrapling"})," (D4Vinci/Scrapling), se configurado."]})]})})]}),f&&u.jsx(kE,{resultados:f,onImportar:m,importando:g})]})}function NE(){const{toast:t}=en(),e=ta(),[n,s]=w.useState(""),[r,i]=w.useState(""),[o,a]=w.useState(10),[l,c]=w.useState(5),[d,f]=w.useState(!1),[h,p]=w.useState(!1),[x,g]=w.useState(0),[b,y]=w.useState(null),[m,v]=w.useState(""),S=async()=>{if(n.trim().length<2||r.trim().length<2){t("erro",'Preencha a palavra-chave e a localização (ex.: "Dentista", "Rio de Janeiro").');return}p(!0),y(null),g(8);const _=setInterval(()=>{g(k=>k<85?k+Math.ceil((90-k)/6):85)},90);try{const k=await W.extrair.maps({keyword:n.trim(),location:r.trim(),limit:o});clearInterval(_),g(100),y(k.importados),v(k.origem==="cli"?"scraper real":"mock de teste");const C=k.duplicados>0?` · ${k.duplicados} duplicados ignorados`:"",N=k.aviso?` · ${k.aviso}`:"";t("sucesso",`${k.importados.length} leads extraídos (${k.origem==="cli"?"scraper real":"mock"})${C}${N}`)}catch(k){clearInterval(_),g(0),t("erro",k instanceof Error?k.message:"Falha na extração.")}finally{p(!1)}};return u.jsxs("div",{className:"space-y-6 max-w-4xl",children:[u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-5",children:[u.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[u.jsxs("p",{className:"text-sm text-gray-500",children:["Busque empresas por palavra-chave e localização. Sem scraper configurado, o LeadMaster gera",u.jsx("strong",{children:" dados mockados (5–10 leads)"})," para teste — sem risco de bloqueio de IP."]}),u.jsxs("span",{className:"text-xs shrink-0 text-gray-400",children:[u.jsx("i",{className:"fas fa-shield-halved mr-1"})," dados públicos"]})]}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Palavra-chave *"}),u.jsx("input",{value:n,onChange:_=>s(_.target.value),placeholder:"Ex.: Dentista, pizzaria, 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"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Localização *"}),u.jsx("input",{value:r,onChange:_=>i(_.target.value),placeholder:"Ex.: Rio de Janeiro, RJ",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"})]}),u.jsxs("div",{children:[u.jsxs("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:["Quantidade: ",o]}),u.jsx("input",{type:"range",min:5,max:10,value:o,onChange:_=>a(Number(_.target.value)),className:"w-full accent-indigo-500 mt-2"})]})]}),u.jsxs("button",{onClick:S,disabled:h,className:"w-full md:w-auto px-8 py-3.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 shadow-sm",children:[u.jsx("i",{className:H("fas fa-magnifying-glass mr-2",h&&"fa-spin")}),h?"Buscando leads...":"Iniciar Extração"]}),(h||x>0)&&u.jsxs("div",{className:"space-y-1",children:[u.jsx(_c,{valor:x}),u.jsx("p",{className:"text-xs text-indigo-600 font-medium",children:x<100?"Buscando leads no Google Maps...":"Extração concluída ✓"})]}),u.jsxs(Tt,{titulo:"Configurações avançadas",icone:"fas fa-sliders",children:[u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[u.jsxs("div",{children:[u.jsxs("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:["Raio de busca: ",l," km"]}),u.jsx("input",{type:"range",min:1,max:50,value:l,onChange:_=>c(Number(_.target.value)),className:"w-full accent-indigo-500"})]}),u.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-600 bg-gray-50 border border-gray-100 rounded-lg px-3 py-2.5 cursor-pointer h-fit",children:[u.jsx("input",{type:"checkbox",checked:d,onChange:_=>f(_.target.checked),className:"w-4 h-4 accent-indigo-500"}),"Apenas com nota ≥ 4,5"]})]}),u.jsx("p",{className:"text-[11px] text-gray-400",children:"As opções avançadas aplicam-se ao scraper real (gosom/google-maps-scraper), quando configurado em Ferramentas → Extratores. No modo mock elas são ignoradas."})]})]}),b&&u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden",children:[u.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-100 bg-gray-50/50",children:[u.jsxs("p",{className:"text-sm font-medium text-gray-700",children:[b.length," lead(s) extraído(s) · origem: ",u.jsx("span",{className:"text-indigo-600",children:m})]}),u.jsxs("button",{onClick:()=>e("/crm"),className:"px-5 py-2 text-xs font-medium text-indigo-600 bg-white border border-indigo-200 rounded-lg hover:bg-indigo-50",children:[u.jsx("i",{className:"fas fa-columns mr-1"})," Ir para o CRM"]})]}),u.jsx("div",{className:"overflow-x-auto",children:u.jsxs("table",{className:"w-full text-sm",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"text-left text-xs text-gray-500 uppercase border-b border-gray-100",children:[u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Nome"}),u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Telefone"}),u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Localização"}),u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Avaliação"})]})}),u.jsx("tbody",{children:b.map((_,k)=>{var N;const C=(N=_.extras)==null?void 0:N.avaliacao;return u.jsxs("tr",{className:"border-b border-gray-50 hover:bg-indigo-50/40",children:[u.jsx("td",{className:"px-5 py-2.5 text-gray-800",children:_.nome}),u.jsx("td",{className:"px-5 py-2.5 text-gray-600",children:na(_.telefone)}),u.jsxs("td",{className:"px-5 py-2.5 text-gray-500 text-xs",children:[_.cidade||"—",_.endereco?` · ${_.endereco}`:""]}),u.jsx("td",{className:"px-5 py-2.5 text-xs text-gray-400",children:C!==void 0?u.jsxs(u.Fragment,{children:[u.jsx("i",{className:"fas fa-star text-amber-400 mr-1"}),C]}):"—"})]},_.id||k)})})]})}),u.jsx("div",{className:"px-5 py-3 border-t border-gray-100 bg-gray-50/50",children:u.jsxs("button",{onClick:()=>e("/crm"),className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:[u.jsx("i",{className:"fas fa-arrow-right mr-1"})," Ver todos os leads no CRM Kanban"]})})]})]})}function EE(){const{toast:t}=en(),e=ta(),[n,s]=w.useState(""),[r,i]=w.useState(10),[o,a]=w.useState(!1),[l,c]=w.useState(500),[d,f]=w.useState(!1),[h,p]=w.useState(0),[x,g]=w.useState(null),[b,y]=w.useState(""),m=async()=>{if(!n.includes("instagram.com")){t("erro","Informe a URL do perfil (ex.: https://instagram.com/perfil).");return}f(!0),g(null),p(8);const v=setInterval(()=>{p(S=>S<85?S+Math.ceil((90-S)/6):85)},90);try{const S=await W.extrair.instagram(n.trim(),r);clearInterval(v),p(100),g(S.importados),y(S.origem==="cli"?"igmapper real":"mock de teste");const _=S.duplicados>0?` · ${S.duplicados} duplicados ignorados`:"",k=S.aviso?` · ${S.aviso}`:"";t("sucesso",`${S.importados.length} leads extraídos (${S.origem==="cli"?"igmapper real":"mock"})${_}${k}`)}catch(S){clearInterval(v),p(0),t("erro",S instanceof Error?S.message:"Falha na extração.")}finally{f(!1)}};return u.jsxs("div",{className:"space-y-6 max-w-4xl",children:[u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-5",children:[u.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[u.jsxs("p",{className:"text-sm text-gray-500",children:["Extraia seguidores de um perfil público do Instagram. Sem igmapper configurado, o LeadMaster gera",u.jsx("strong",{children:" dados mockados (5–10 leads)"})," para teste — sem risco de bloqueio de conta."]}),u.jsxs("span",{className:"text-xs shrink-0 text-gray-400",children:[u.jsx("i",{className:"fas fa-shield-halved mr-1"})," perfis públicos"]})]}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[u.jsxs("div",{className:"md:col-span-2",children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"URL do perfil *"}),u.jsx("input",{value:n,onChange:v=>s(v.target.value),placeholder:"https://instagram.com/perfil_do_concorrente/",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"})]}),u.jsxs("div",{children:[u.jsxs("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:["Quantidade de seguidores: ",r]}),u.jsx("input",{type:"range",min:5,max:10,value:r,onChange:v=>i(Number(v.target.value)),className:"w-full accent-indigo-500 mt-2"})]})]}),u.jsxs("button",{onClick:m,disabled:d,className:"w-full md:w-auto px-8 py-3.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 shadow-sm",children:[u.jsx("i",{className:H("fab fa-instagram mr-2",d&&"fa-spin")}),d?"Buscando seguidores...":"Iniciar Extração"]}),(d||h>0)&&u.jsxs("div",{className:"space-y-1",children:[u.jsx(_c,{valor:h}),u.jsx("p",{className:"text-xs text-indigo-600 font-medium",children:h<100?"Buscando seguidores no Instagram...":"Extração concluída ✓"})]}),u.jsxs(Tt,{titulo:"Configurações avançadas",icone:"fas fa-sliders",children:[u.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-600 bg-gray-50 border border-gray-100 rounded-lg px-3 py-2.5 cursor-pointer",children:[u.jsx("input",{type:"checkbox",checked:o,onChange:v=>a(v.target.checked),className:"w-4 h-4 accent-indigo-500"}),"Extrair apenas contas comerciais"]}),u.jsxs("div",{children:[u.jsxs("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:["Mínimo de seguidores: ",l]}),u.jsx("input",{type:"range",min:100,max:5e3,step:100,value:l,onChange:v=>c(Number(v.target.value)),className:"w-full accent-indigo-500"})]}),u.jsx("p",{className:"text-[11px] text-gray-400",children:"As opções avançadas aplicam-se ao igmapper real (lucasoal/igmapper), quando configurado em Ferramentas → Extratores. No modo mock elas são ignoradas."})]})]}),x&&u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden",children:[u.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-100 bg-gray-50/50",children:[u.jsxs("p",{className:"text-sm font-medium text-gray-700",children:[x.length," lead(s) extraído(s) · origem: ",u.jsx("span",{className:"text-indigo-600",children:b})]}),u.jsxs("button",{onClick:()=>e("/crm"),className:"px-5 py-2 text-xs font-medium text-indigo-600 bg-white border border-indigo-200 rounded-lg hover:bg-indigo-50",children:[u.jsx("i",{className:"fas fa-columns mr-1"})," Ir para o CRM"]})]}),u.jsx("div",{className:"overflow-x-auto",children:u.jsxs("table",{className:"w-full text-sm",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"text-left text-xs text-gray-500 uppercase border-b border-gray-100",children:[u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Nome / Username"}),u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Telefone"}),u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Fonte"}),u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Seguidores"})]})}),u.jsx("tbody",{children:x.map((v,S)=>{var C,N;const _=((C=v.extras)==null?void 0:C.username)||"",k=(N=v.extras)==null?void 0:N.seguidores;return u.jsxs("tr",{className:"border-b border-gray-50 hover:bg-indigo-50/40",children:[u.jsxs("td",{className:"px-5 py-2.5 text-gray-800",children:[v.nome,_&&u.jsxs("span",{className:"text-xs text-gray-400 ml-2",children:["@",_]})]}),u.jsx("td",{className:"px-5 py-2.5 text-gray-600",children:na(v.telefone)}),u.jsx("td",{className:"px-5 py-2.5",children:u.jsx("span",{className:"text-[10px] uppercase tracking-wide bg-pink-50 text-pink-700 px-1.5 py-0.5 rounded font-medium",children:v.fonte})}),u.jsx("td",{className:"px-5 py-2.5 text-xs text-gray-400",children:k!==void 0?k.toLocaleString("pt-BR"):"—"})]},v.id||S)})})]})}),u.jsx("div",{className:"px-5 py-3 border-t border-gray-100 bg-gray-50/50",children:u.jsxs("button",{onClick:()=>e("/crm"),className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:[u.jsx("i",{className:"fas fa-arrow-right mr-1"})," Ver todos os leads no CRM Kanban"]})})]})]})}function ME(){const[t,e]=my(),n=t.get("tab")||"disparo";return u.jsxs("div",{className:"space-y-6",children:[u.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=>u.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:[u.jsx("i",{className:H(s.icone,"mr-2")}),s.rotulo]},s.id))}),n==="disparo"?u.jsx(PE,{}):u.jsx(RE,{})]})}function PE(){const{toast:t}=en(),[e,n]=w.useState({texto:"",audio:""}),[s,r]=w.useState("LeadMaster"),[i,o]=w.useState(""),[a,l]=w.useState(!1),[c,d]=w.useState(!1),[f,h]=w.useState(null),p=w.useCallback(async()=>{const[b,y]=await Promise.all([W.agentes.templates(),W.config.obter()]);n({texto:b.texto??"",audio:b.audio??""}),r(y.agentes.disparo.minha_empresa??"LeadMaster"),h(y.integracoes.openoutreach)},[]);w.useEffect(()=>{p().catch(b=>t("erro",b.message))},[p,t]);const x=async()=>{d(!0);try{await W.agentes.salvarTemplates(e),await W.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{d(!1)}},g=async()=>{try{const b=await W.agentes.testarTemplate(e.texto);o(b.renderizado),l(!0)}catch(b){t("erro",b instanceof Error?b.message:"Falha ao renderizar template.")}};return u.jsxs("div",{className:"space-y-5 max-w-3xl",children:[u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-4",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("h3",{className:"text-sm font-semibold text-gray-800",children:"Templates de mensagem"}),u.jsx(_s,{status:f!=null&&f.url&&f.enabled!==!1?"ativo":"inativo",rotulo:f!=null&&f.url&&f.enabled!==!1?"OpenOutreach configurado":"OpenOutreach não configurado"})]}),u.jsxs("p",{className:"text-xs text-gray-500",children:["Variáveis disponíveis: ",u.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"{{nome}}"}),","," ",u.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"{{primeiro_nome}}"}),","," ",u.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"{{empresa}}"}),","," ",u.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"{{cidade}}"}),","," ",u.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"{{minha_empresa}}"}),"."]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Template — texto"}),u.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"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Template — áudio (texto para gravação)"}),u.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"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Nome da sua empresa"}),u.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"})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsxs("button",{onClick:x,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:[u.jsx("i",{className:"fas fa-save mr-2"})," Salvar templates"]}),u.jsxs("button",{onClick:g,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:[u.jsx("i",{className:"fas fa-vial mr-2"})," Testar com lead de exemplo"]})]})]}),u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 text-sm text-gray-500 space-y-2",children:[u.jsx("p",{className:"font-medium text-gray-700 text-xs uppercase tracking-wide",children:"Como funciona"}),u.jsxs("p",{children:["O envio em massa é executado pelo ",u.jsx("strong",{children:"OpenOutreach"})," (eracle/OpenOutreach). As campanhas ficam na página ",u.jsx("strong",{children:"Disparos"}),"; a validação da integração acontece na hora de iniciar a campanha — sem travas de pré-registro."]})]}),u.jsx(Xt,{aberto:a,onFechar:()=>l(!1),titulo:"Pré-visualização do template",icone:"fas fa-comment-dots",children:u.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 RE(){const{toast:t}=en(),[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,d]=w.useState(!1),f=w.useCallback(async()=>{const x=await W.config.obter();n(x.agentes.atendimento.modo==="voz"?"voz":"texto"),r(x.integracoes.pipecat.url||"")},[]);w.useEffect(()=>{f().catch(x=>t("erro",x.message))},[f,t]);const h=async x=>{n(x);try{await W.config.salvar({agentes:{atendimento:{modo:x}},integracoes:{pipecat:{url:s}}}),t("sucesso",`Modo de atendimento: ${x==="voz"?"voz (pipecat)":"texto (LLM)"}.`)}catch(g){t("erro",g instanceof Error?g.message:"Falha ao salvar modo.")}},p=async()=>{const x=a.trim();if(!x)return;const g=[...i,{role:"user",content:x}];o(g),l(""),d(!0);try{const b=await W.agentes.chat(g.map(y=>({role:y.role==="assistant"?"assistant":"user",content:y.content})));b.ok&&b.resposta?o([...g,{role:"assistant",content:b.resposta}]):(o([...g,{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{d(!1)}};return u.jsxs("div",{className:"space-y-5 max-w-3xl",children:[u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-4",children:[u.jsx("h3",{className:"text-sm font-semibold text-gray-800",children:"Modo do agente de atendimento"}),u.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(x=>u.jsxs("button",{onClick:()=>h(x.id),className:H("flex-1 px-4 py-3 rounded-lg border text-left transition",e===x.id?"bg-indigo-50 border-indigo-400":"bg-white border-gray-200 hover:bg-gray-50"),children:[u.jsxs("p",{className:H("text-sm font-medium flex items-center gap-2",e===x.id?"text-indigo-700":"text-gray-600"),children:[u.jsx("i",{className:x.icone})," ",x.rotulo]}),u.jsx("p",{className:"text-xs text-gray-400 mt-1",children:x.descricao})]},x.id))}),e==="voz"&&u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"URL do serviço pipecat"}),u.jsx("input",{value:s,onChange:x=>r(x.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"})]})]}),u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6",children:[u.jsx("h3",{className:"text-sm font-semibold text-gray-800 mb-3",children:"Testar conversa"}),u.jsxs("div",{className:"space-y-3 max-h-80 overflow-y-auto mb-4",children:[i.map((x,g)=>u.jsx("div",{className:H("flex",x.role==="user"?"justify-end":"justify-start"),children:u.jsx("div",{className:H("max-w-[80%] px-4 py-2.5 rounded-2xl text-sm",x.role==="user"?"bg-indigo-500 text-white rounded-br-sm":"bg-gray-100 text-gray-700 rounded-bl-sm"),children:x.content})},g)),c&&u.jsxs("div",{className:"text-xs text-gray-400 flex items-center gap-2",children:[u.jsx("i",{className:"fas fa-spinner fa-spin"})," pensando..."]})]}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("input",{value:a,onChange:x=>l(x.target.value),onKeyDown:x=>x.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"}),u.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:u.jsx("i",{className:"fas fa-paper-plane"})})]})]})]})}function OE({onConfigSalva:t}){const{toast:e}=en(),[n,s]=w.useState(null),[r,i]=w.useState(!1),[o,a]=w.useState(""),l=w.useCallback(async()=>{const h=await W.config.obter();s(h)},[]);if(w.useEffect(()=>{l().catch(h=>e("erro",h.message))},[l,e]),!n)return u.jsx("div",{className:"text-center text-gray-400 py-16",children:u.jsx("i",{className:"fas fa-spinner fa-spin text-2xl"})});const c=h=>{s(p=>{if(!p)return p;const x=JSON.parse(JSON.stringify(p));return h(x),x})},d=async()=>{i(!0);try{const h=await W.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 W.config.testarLlm();e(h.ok?"sucesso":"erro",h.ok?`LLM respondeu: ${h.resposta}`:h.mensagem??"Falha no teste.")}finally{a("")}};return u.jsxs("div",{className:"space-y-6 max-w-4xl",children:[u.jsxs(Ha,{titulo:"LLM (agentes de IA)",icone:"fas fa-brain",children:[u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[u.jsx(an,{rotulo:"Base URL",valor:n.llm.base_url,onChange:h=>c(p=>{p.llm.base_url=h}),placeholder:"https://api.openai.com/v1"}),u.jsx(an,{rotulo:"Modelo",valor:n.llm.modelo,onChange:h=>c(p=>{p.llm.modelo=h}),placeholder:"gpt-4o-mini"}),u.jsx(TE,{rotulo:"API Key",configurado:!!n.llm.api_key_configurado,onChange:h=>c(p=>{p.llm.api_key=h})})]}),u.jsx(LE,{rotulo:"Testar conexão LLM",carregando:o==="llm",onClick:f})]}),u.jsxs(Ha,{titulo:"Extratores de leads",icone:"fas fa-magnifying-glass-location",children:[u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[u.jsx(an,{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"}),u.jsx(an,{rotulo:"igmapper — binário",valor:n.extratores.igmapper_cli,onChange:h=>c(p=>{p.extratores.igmapper_cli=h}),placeholder:"Caminho do CLI igmapper"})]}),u.jsxs(Tt,{titulo:"Argumentos dos scrapers (templates)",icone:"fas fa-terminal",children:[u.jsx(bm,{rotulo:"Google Maps — template de argumentos",valor:n.extratores.google_maps_args,onChange:h=>c(p=>{p.extratores.google_maps_args=h}),linhas:2}),u.jsx(bm,{rotulo:"igmapper — template de argumentos",valor:n.extratores.igmapper_args,onChange:h=>c(p=>{p.extratores.igmapper_args=h}),linhas:2})]}),u.jsxs(Tt,{titulo:"CNPJ e Scrapling",icone:"fas fa-building",children:[u.jsx(an,{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"}),u.jsx(an,{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"})]})]}),u.jsxs(Ha,{titulo:"Agentes — integrações",icone:"fas fa-robot",children:[u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[u.jsx(an,{rotulo:"OpenOutreach — URL",valor:n.integracoes.openoutreach.url,onChange:h=>c(p=>{p.integracoes.openoutreach.url=h}),placeholder:"http://localhost:9090"}),u.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:[u.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"]})]}),u.jsx(an,{rotulo:"pipecat — URL (atendimento por voz)",valor:n.integracoes.pipecat.url,onChange:h=>c(p=>{p.integracoes.pipecat.url=h}),placeholder:"http://localhost:5000"})]}),u.jsx(Ha,{titulo:"Perfil e licença",icone:"fas fa-user",children:u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[u.jsx(an,{rotulo:"Seu nome",valor:n.perfil.nome,onChange:h=>c(p=>{p.perfil.nome=h})}),u.jsx(an,{rotulo:"Expira em",valor:n.perfil.licenca.expira_em,onChange:h=>c(p=>{p.perfil.licenca.expira_em=h})}),u.jsx(DE,{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})})]})}),u.jsx("div",{className:"flex justify-end",children:u.jsxs("button",{onClick:d,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:[u.jsx("i",{className:H("fas fa-save mr-2",r&&"fa-spin")}),r?"Salvando...":"Salvar configurações"]})})]})}function Ha({titulo:t,icone:e,children:n}){return u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-4",children:[u.jsxs("h3",{className:"text-sm font-semibold text-gray-800 flex items-center gap-2",children:[u.jsx("i",{className:H(e,"text-indigo-400")})," ",t]}),n]})}function an({rotulo:t,valor:e,onChange:n,placeholder:s,tipo:r="text"}){return u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:t}),u.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 DE({rotulo:t,valor:e,onChange:n}){return u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:t}),u.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 TE({rotulo:t,configurado:e,onChange:n}){return u.jsxs("div",{children:[u.jsxs("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:[t," ",e&&u.jsx("span",{className:"text-green-600",children:"• configurado"})]}),u.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 bm({rotulo:t,valor:e,onChange:n,linhas:s=3}){return u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:t}),u.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 LE({rotulo:t,onClick:e,carregando:n}){return u.jsxs("button",{onClick:e,disabled:n,className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium disabled:opacity-50",children:[u.jsx("i",{className:H("fas fa-vial-circle-check mr-1",n&&"fa-spin")})," ",t]})}const AE=[{id:"lead.criado",rotulo:"Lead criado"},{id:"lead.etapa",rotulo:"Lead mudou de etapa"},{id:"campanha.concluida",rotulo:"Campanha concluída"}];function IE(){const{toast:t}=en(),[e,n]=w.useState(""),[s,r]=w.useState(new Set),[i,o]=w.useState(""),[a,l]=w.useState(!1),[c,d]=w.useState(!1),f=w.useCallback(async()=>{const g=await W.webhook.obter();n(g.url),r(new Set(g.eventos))},[]);w.useEffect(()=>{f().catch(g=>t("erro",g.message))},[f,t]);const h=g=>r(b=>{const y=new Set(b);return y.has(g)?y.delete(g):y.add(g),y}),p=async()=>{d(!0);try{await W.webhook.salvar({url:e.trim(),eventos:[...s]}),t("sucesso","Webhook salvo.")}catch(g){t("erro",g instanceof Error?g.message:"Falha ao salvar webhook.")}finally{d(!1)}},x=async()=>{if(!e.trim()){t("erro","Informe a URL do webhook antes de testar.");return}try{const g=await W.webhook.testar(e.trim());g.ok?o(`✅ HTTP ${g.status_http} — o endpoint recebeu o evento de teste.
88
+ `},TN={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 DN(t){let{announcements:e=TN,container:n,hiddenTextDescribedById:s,screenReaderInstructions:r=ON}=t;const{announce:i,announcement:o}=MN(),a=aa("DndLiveRegion"),[l,c]=w.useState(!1);if(w.useEffect(()=>{c(!0)},[]),PN(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 d=pe.createElement(pe.Fragment,null,pe.createElement(NN,{id:s,value:r.draggable}),pe.createElement(EN,{id:a,announcement:o}));return n?Ar.createPortal(d,n):d}var Te;(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"})(Te||(Te={}));function Zl(){}function LN(t,e){return w.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function AN(){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 Zt=Object.freeze({x:0,y:0});function IN(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function FN(t,e){const n=Jl(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 zN(t,e){let{data:{value:n}}=t,{data:{value:s}}=e;return n-s}function BN(t,e){let{data:{value:n}}=t,{data:{value:s}}=e;return s-n}function am(t){let{left:e,top:n,height:s,width:r}=t;return[{x:e,y:n},{x:e+r,y:n},{x:e,y:n+s},{x:e+r,y:n+s}]}function $N(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}const UN=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:s}=t;const r=am(e),i=[];for(const o of s){const{id:a}=o,l=n.get(a);if(l){const c=am(l),d=r.reduce((h,p,x)=>h+IN(c[x],p),0),f=Number((d/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(zN)};function WN(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,d=o*a,f=d/(l+c-d);return Number(f.toFixed(4))}return 0}const HN=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=WN(a,e);l>0&&r.push({id:o,data:{droppableContainer:i,value:l}})}}return r.sort(BN)};function VN(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function lv(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Zt}function QN(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 KN=QN(1);function cv(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 YN(t,e,n){const s=cv(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)),d=r?t.width/r:t.width,f=i?t.height/i:t.height;return{width:d,height:f,top:c,right:l+d,bottom:c+f,left:l}}const XN={ignoreTransform:!1};function Ci(t,e){e===void 0&&(e=XN);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:d}=st(t).getComputedStyle(t);c&&(n=YN(n,c,d))}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 lm(t){return Ci(t,{ignoreTransform:!0})}function qN(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function GN(t,e){return e===void 0&&(e=st(t).getComputedStyle(t)),e.position==="fixed"}function JN(t,e){e===void 0&&(e=st(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 lh(t,e){const n=[];function s(r){if(e!=null&&n.length>=e||!r)return n;if(ah(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!ia(r)||iv(r)||n.includes(r))return n;const i=st(t).getComputedStyle(r);return r!==t&&JN(r,i)&&n.push(r),GN(r,i)?n:s(r.parentNode)}return t?s(t):n}function uv(t){const[e]=lh(t,1);return e??null}function bu(t){return!kc||!t?null:_i(t)?t:oh(t)?ah(t)||t===ki(t).scrollingElement?window:ia(t)?t:null:null}function dv(t){return _i(t)?t.scrollX:t.scrollLeft}function fv(t){return _i(t)?t.scrollY:t.scrollTop}function $d(t){return{x:dv(t),y:fv(t)}}var Ie;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Ie||(Ie={}));function hv(t){return!kc||!t?!1:t===document.scrollingElement}function pv(t){const e={x:0,y:0},n=hv(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 ZN={x:.2,y:.2};function e2(t,e,n,s,r){let{top:i,left:o,right:a,bottom:l}=n;s===void 0&&(s=10),r===void 0&&(r=ZN);const{isTop:c,isBottom:d,isLeft:f,isRight:h}=pv(t),p={x:0,y:0},x={x:0,y:0},g={height:e.height*r.y,width:e.width*r.x};return!c&&i<=e.top+g.height?(p.y=Ie.Backward,x.y=s*Math.abs((e.top+g.height-i)/g.height)):!d&&l>=e.bottom-g.height&&(p.y=Ie.Forward,x.y=s*Math.abs((e.bottom-g.height-l)/g.height)),!h&&a>=e.right-g.width?(p.x=Ie.Forward,x.x=s*Math.abs((e.right-g.width-a)/g.width)):!f&&o<=e.left+g.width&&(p.x=Ie.Backward,x.x=s*Math.abs((e.left+g.width-o)/g.width)),{direction:p,speed:x}}function t2(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 gv(t){return t.reduce((e,n)=>Qr(e,$d(n)),Zt)}function n2(t){return t.reduce((e,n)=>e+dv(n),0)}function s2(t){return t.reduce((e,n)=>e+fv(n),0)}function mv(t,e){if(e===void 0&&(e=Ci),!t)return;const{top:n,left:s,bottom:r,right:i}=e(t);uv(t)&&(r<=0||i<=0||n>=window.innerHeight||s>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const r2=[["x",["left","right"],n2],["y",["top","bottom"],s2]];class ch{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=lh(n),r=gv(s);this.rect={...e},this.width=e.width,this.height=e.height;for(const[i,o,a]of r2)for(const l of o)Object.defineProperty(this,l,{get:()=>{const c=a(s),d=r[i]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class go{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 i2(t){const{EventTarget:e}=st(t);return t instanceof e?t:ki(t)}function wu(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 Pt;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Pt||(Pt={}));function cm(t){t.preventDefault()}function o2(t){t.stopPropagation()}var se;(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"})(se||(se={}));const xv={start:[se.Space,se.Enter],cancel:[se.Esc],end:[se.Space,se.Enter,se.Tab]},a2=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case se.Right:return{...n,x:n.x+25};case se.Left:return{...n,x:n.x-25};case se.Down:return{...n,y:n.y+25};case se.Up:return{...n,y:n.y-25}}};class yv{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 go(ki(n)),this.windowListeners=new go(st(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Pt.Resize,this.handleCancel),this.windowListeners.add(Pt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Pt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,s=e.node.current;s&&mv(s),n(Zt)}handleKeyDown(e){if(jc(e)){const{active:n,context:s,options:r}=this.props,{keyboardCodes:i=xv,coordinateGetter:o=a2,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,d=c?{x:c.left,y:c.top}:Zt;this.referenceCoordinates||(this.referenceCoordinates=d);const f=o(e,{active:n,context:s.current,currentCoordinates:d});if(f){const h=Gl(f,d),p={x:0,y:0},{scrollableAncestors:x}=s.current;for(const g of x){const b=e.code,{isTop:y,isRight:m,isLeft:v,isBottom:S,maxScroll:_,minScroll:k}=pv(g),C=t2(g),j={x:Math.min(b===se.Right?C.right-C.width/2:C.right,Math.max(b===se.Right?C.left:C.left+C.width/2,f.x)),y:Math.min(b===se.Down?C.bottom-C.height/2:C.bottom,Math.max(b===se.Down?C.top:C.top+C.height/2,f.y))},P=b===se.Right&&!m||b===se.Left&&!v,E=b===se.Down&&!S||b===se.Up&&!y;if(P&&j.x!==f.x){const R=g.scrollLeft+h.x,M=b===se.Right&&R<=_.x||b===se.Left&&R>=k.x;if(M&&!h.y){g.scrollTo({left:R,behavior:a});return}M?p.x=g.scrollLeft-R:p.x=b===se.Right?g.scrollLeft-_.x:g.scrollLeft-k.x,p.x&&g.scrollBy({left:-p.x,behavior:a});break}else if(E&&j.y!==f.y){const R=g.scrollTop+h.y,M=b===se.Down&&R<=_.y||b===se.Up&&R>=k.y;if(M&&!h.x){g.scrollTo({top:R,behavior:a});return}M?p.y=g.scrollTop-R:p.y=b===se.Down?g.scrollTop-_.y:g.scrollTop-k.y,p.y&&g.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(e,Qr(Gl(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()}}yv.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:s=xv,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 um(t){return!!(t&&"distance"in t)}function dm(t){return!!(t&&"delay"in t)}class uh{constructor(e,n,s){var r;s===void 0&&(s=i2(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=ki(o),this.documentListeners=new go(this.document),this.listeners=new go(s),this.windowListeners=new go(st(o)),this.initialCoordinates=(r=Jl(i))!=null?r:Zt,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(Pt.Resize,this.handleCancel),this.windowListeners.add(Pt.DragStart,cm),this.windowListeners.add(Pt.VisibilityChange,this.handleCancel),this.windowListeners.add(Pt.ContextMenu,cm),this.documentListeners.add(Pt.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(dm(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(um(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(Pt.Click,o2,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Pt.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=Jl(e))!=null?n:Zt,c=Gl(r,l);if(!s&&a){if(um(a)){if(a.tolerance!=null&&wu(c,a.tolerance))return this.handleCancel();if(wu(c,a.distance))return this.handleStart()}if(dm(a)&&wu(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===se.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const l2={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class dh extends uh{constructor(e){const{event:n}=e,s=ki(n.target);super(e,l2,s)}}dh.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 c2={move:{name:"mousemove"},end:{name:"mouseup"}};var Ud;(function(t){t[t.RightClick=2]="RightClick"})(Ud||(Ud={}));class u2 extends uh{constructor(e){super(e,c2,ki(e.event.target))}}u2.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:s}=e;return n.button===Ud.RightClick?!1:(s==null||s({event:n}),!0)}}];const Su={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class d2 extends uh{constructor(e){super(e,Su)}static setup(){return window.addEventListener(Su.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Su.move.name,e)};function e(){}}}d2.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 mo;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(mo||(mo={}));var ec;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(ec||(ec={}));function f2(t){let{acceleration:e,activator:n=mo.Pointer,canScroll:s,draggingRect:r,enabled:i,interval:o=5,order:a=ec.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:f,threshold:h}=t;const p=p2({delta:f,disabled:!i}),[x,g]=SN(),b=w.useRef({x:0,y:0}),y=w.useRef({x:0,y:0}),m=w.useMemo(()=>{switch(n){case mo.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case mo.DraggableRect:return r}},[n,r,l]),v=w.useRef(null),S=w.useCallback(()=>{const k=v.current;if(!k)return;const C=b.current.x*y.current.x,j=b.current.y*y.current.y;k.scrollBy(C,j)},[]),_=w.useMemo(()=>a===ec.TreeOrder?[...c].reverse():c,[a,c]);w.useEffect(()=>{if(!i||!c.length||!m){g();return}for(const k of _){if((s==null?void 0:s(k))===!1)continue;const C=c.indexOf(k),j=d[C];if(!j)continue;const{direction:P,speed:E}=e2(k,j,m,e,h);for(const R of["x","y"])p[R][P[R]]||(E[R]=0,P[R]=0);if(E.x>0||E.y>0){g(),v.current=k,x(S,o),b.current=E,y.current=P;return}}b.current={x:0,y:0},y.current={x:0,y:0},g()},[e,S,s,g,i,o,JSON.stringify(m),JSON.stringify(p),x,c,_,d,JSON.stringify(h)])}const h2={x:{[Ie.Backward]:!1,[Ie.Forward]:!1},y:{[Ie.Backward]:!1,[Ie.Forward]:!1}};function p2(t){let{delta:e,disabled:n}=t;const s=ql(e);return oa(r=>{if(n||!s||!r)return h2;const i={x:Math.sign(e.x-s.x),y:Math.sign(e.y-s.y)};return{x:{[Ie.Backward]:r.x[Ie.Backward]||i.x===-1,[Ie.Forward]:r.x[Ie.Forward]||i.x===1},y:{[Ie.Backward]:r.y[Ie.Backward]||i.y===-1,[Ie.Forward]:r.y[Ie.Forward]||i.y===1}}},[n,e,s])}function g2(t,e){const n=e!=null?t.get(e):void 0,s=n?n.node.current:null;return oa(r=>{var i;return e==null?null:(i=s??r)!=null?i:null},[s,e])}function m2(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 Wo;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Wo||(Wo={}));var Wd;(function(t){t.Optimized="optimized"})(Wd||(Wd={}));const fm=new Map;function x2(t,e){let{dragging:n,dependencies:s,config:r}=e;const[i,o]=w.useState(null),{frequency:a,measure:l,strategy:c}=r,d=w.useRef(t),f=b(),h=Uo(f),p=w.useCallback(function(y){y===void 0&&(y=[]),!h.current&&o(m=>m===null?y:m.concat(y.filter(v=>!m.includes(v))))},[h]),x=w.useRef(null),g=oa(y=>{if(f&&!n)return fm;if(!y||y===fm||d.current!==t||i!=null){const m=new Map;for(let v of t){if(!v)continue;if(i&&i.length>0&&!i.includes(v.id)&&v.rect.current){m.set(v.id,v.rect.current);continue}const S=v.node.current,_=S?new ch(l(S),S):null;v.rect.current=_,_&&m.set(v.id,_)}return m}return y},[t,i,n,f,l]);return w.useEffect(()=>{d.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"||x.current!==null||(x.current=setTimeout(()=>{p(),x.current=null},a))},[a,f,p,...s]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:i!=null};function b(){switch(c){case Wo.Always:return!1;case Wo.BeforeDragging:return n;default:return!n}}}function fh(t,e){return oa(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function y2(t,e){return fh(t,e)}function v2(t){let{callback:e,disabled:n}=t;const s=Cc(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 Nc(t){let{callback:e,disabled:n}=t;const s=Cc(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 b2(t){return new ch(Ci(t),t)}function hm(t,e,n){e===void 0&&(e=b2);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 d=e(t);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const o=v2({callback(l){if(t)for(const c of l){const{type:d,target:f}=c;if(d==="childList"&&f instanceof HTMLElement&&f.contains(t)){i();break}}}}),a=Nc({callback:i});return Jt(()=>{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 w2(t){const e=fh(t);return lv(t,e)}const pm=[];function S2(t){const e=w.useRef(t),n=oa(s=>t?s&&s!==pm&&t&&e.current&&t.parentNode===e.current.parentNode?s:lh(t):pm,[t]);return w.useEffect(()=>{e.current=t},[t]),n}function _2(t){const[e,n]=w.useState(null),s=w.useRef(t),r=w.useCallback(i=>{const o=bu(i.target);o&&n(a=>a?(a.set(o,$d(o)),new Map(a)):null)},[]);return w.useEffect(()=>{const i=s.current;if(t!==i){o(i);const a=t.map(l=>{const c=bu(l);return c?(c.addEventListener("scroll",r,{passive:!0}),[c,$d(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=bu(l);c==null||c.removeEventListener("scroll",r)})}},[r,t]),w.useMemo(()=>t.length?e?Array.from(e.values()).reduce((i,o)=>Qr(i,o),Zt):gv(t):Zt,[t,e])}function gm(t,e){e===void 0&&(e=[]);const n=w.useRef(null);return w.useEffect(()=>{n.current=null},e),w.useEffect(()=>{const s=t!==Zt;s&&!n.current&&(n.current=t),!s&&n.current&&(n.current=null)},[t]),n.current?Gl(t,n.current):Zt}function k2(t){w.useEffect(()=>{if(!kc)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 vv(t){return w.useMemo(()=>t?qN(t):null,[t])}const mm=[];function j2(t,e){e===void 0&&(e=Ci);const[n]=t,s=vv(n?st(n):null),[r,i]=w.useState(mm);function o(){i(()=>t.length?t.map(l=>hv(l)?s:new ch(e(l),l)):mm)}const a=Nc({callback:o});return Jt(()=>{a==null||a.disconnect(),o(),t.forEach(l=>a==null?void 0:a.observe(l))},[t]),r}function bv(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return ia(e)?e:t}function N2(t){let{measure:e}=t;const[n,s]=w.useState(null),r=w.useCallback(c=>{for(const{target:d}of c)if(ia(d)){s(f=>{const h=e(d);return f?{...f,width:h.width,height:h.height}:h});break}},[e]),i=Nc({callback:r}),o=w.useCallback(c=>{const d=bv(c);i==null||i.disconnect(),d&&(i==null||i.observe(d)),s(d?e(d):null)},[e,i]),[a,l]=Xl(o);return w.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const E2=[{sensor:dh,options:{}},{sensor:yv,options:{}}],M2={current:{}},cl={draggable:{measure:lm},droppable:{measure:lm,strategy:Wo.WhileDragging,frequency:Wd.Optimized},dragOverlay:{measure:Ci}};class xo 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 xo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Zl},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:cl,measureDroppableContainers:Zl,windowRect:null,measuringScheduled:!1},wv={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Zl,draggableNodes:new Map,over:null,measureDroppableContainers:Zl},la=w.createContext(wv),Sv=w.createContext(P2);function R2(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new xo}}}function O2(t,e){switch(e.type){case Te.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Te.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 Te.DragEnd:case Te.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Te.RegisterDroppable:{const{element:n}=e,{id:s}=n,r=new xo(t.droppable.containers);return r.set(s,n),{...t,droppable:{...t.droppable,containers:r}}}case Te.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 xo(t.droppable.containers);return o.set(n,{...i,disabled:r}),{...t,droppable:{...t.droppable,containers:o}}}case Te.UnregisterDroppable:{const{id:n,key:s}=e,r=t.droppable.containers.get(n);if(!r||s!==r.key)return t;const i=new xo(t.droppable.containers);return i.delete(n),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function T2(t){let{disabled:e}=t;const{active:n,activatorEvent:s,draggableNodes:r}=w.useContext(la),i=ql(s),o=ql(n==null?void 0:n.id);return w.useEffect(()=>{if(!e&&!s&&i&&o!=null){if(!jc(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 d of[l.current,c.current]){if(!d)continue;const f=CN(d);if(f){f.focus();break}}})}},[s,e,r,o,i]),null}function _v(t,e){let{transform:n,...s}=e;return t!=null&&t.length?t.reduce((r,i)=>i({transform:r,...s}),n):n}function D2(t){return w.useMemo(()=>({draggable:{...cl.draggable,...t==null?void 0:t.draggable},droppable:{...cl.droppable,...t==null?void 0:t.droppable},dragOverlay:{...cl.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 L2(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;Jt(()=>{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 d=n(c),f=lv(d,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=uv(c);h&&h.scrollBy({top:f.y,left:f.x})}},[e,o,a,s,n])}const Ec=w.createContext({...Zt,scaleX:1,scaleY:1});var Yn;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Yn||(Yn={}));const A2=w.memo(function(e){var n,s,r,i;let{id:o,accessibility:a,autoScroll:l=!0,children:c,sensors:d=E2,collisionDetection:f=HN,measuring:h,modifiers:p,...x}=e;const g=w.useReducer(O2,void 0,R2),[b,y]=g,[m,v]=RN(),[S,_]=w.useState(Yn.Uninitialized),k=S===Yn.Initialized,{draggable:{active:C,nodes:j,translate:P},droppable:{containers:E}}=b,R=C!=null?j.get(C):null,M=w.useRef({initial:null,translated:null}),A=w.useMemo(()=>{var Ve;return C!=null?{id:C,data:(Ve=R==null?void 0:R.data)!=null?Ve:M2,rect:M}:null},[C,R]),U=w.useRef(null),[H,oe]=w.useState(null),[J,T]=w.useState(null),I=Uo(x,Object.values(x)),F=aa("DndDescribedBy",o),K=w.useMemo(()=>E.getEnabled(),[E]),z=D2(h),{droppableRects:ce,measureDroppableContainers:V,measuringScheduled:ke}=x2(K,{dragging:k,dependencies:[P.x,P.y],config:z.droppable}),Z=g2(j,C),pt=w.useMemo(()=>J?Jl(J):null,[J]),zt=zv(),Bt=y2(Z,z.draggable.measure);L2({activeNode:C!=null?j.get(C):null,config:zt.layoutShiftCompensation,initialRect:Bt,measure:z.draggable.measure});const ie=hm(Z,z.draggable.measure,Bt),ji=hm(Z?Z.parentElement:null),tn=w.useRef({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:ce,draggableNodes:j,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),pr=E.getNodeFor((n=tn.current.over)==null?void 0:n.id),yn=N2({measure:z.dragOverlay.measure}),gr=(s=yn.nodeRef.current)!=null?s:Z,mr=k?(r=yn.rect)!=null?r:ie:null,hh=!!(yn.nodeRef.current&&yn.rect),ph=w2(hh?null:ie),Mc=vv(gr?st(gr):null),Fn=S2(k?pr??Z:null),ca=j2(Fn),ua=_v(p,{transform:{x:P.x-ph.x,y:P.y-ph.y,scaleX:1,scaleY:1},activatorEvent:J,active:A,activeNodeRect:ie,containerNodeRect:ji,draggingNodeRect:mr,over:tn.current.over,overlayNodeRect:yn.rect,scrollableAncestors:Fn,scrollableAncestorRects:ca,windowRect:Mc}),gh=pt?Qr(pt,P):null,mh=_2(Fn),Ov=gm(mh),Tv=gm(mh,[ie]),xr=Qr(ua,Ov),yr=mr?KN(mr,ua):null,Ni=A&&yr?f({active:A,collisionRect:yr,droppableRects:ce,droppableContainers:K,pointerCoordinates:gh}):null,xh=$N(Ni,"id"),[zn,yh]=w.useState(null),Dv=hh?ua:Qr(ua,Tv),Lv=VN(Dv,(i=zn==null?void 0:zn.rect)!=null?i:null,ie),Pc=w.useRef(null),vh=w.useCallback((Ve,gt)=>{let{sensor:mt,options:Bn}=gt;if(U.current==null)return;const Nt=j.get(U.current);if(!Nt)return;const xt=Ve.nativeEvent,nn=new mt({active:U.current,activeNode:Nt,event:xt,options:Bn,context:tn,onAbort(Be){if(!j.get(Be))return;const{onDragAbort:sn}=I.current,vn={id:Be};sn==null||sn(vn),m({type:"onDragAbort",event:vn})},onPending(Be,$n,sn,vn){if(!j.get(Be))return;const{onDragPending:Mi}=I.current,Un={id:Be,constraint:$n,initialCoordinates:sn,offset:vn};Mi==null||Mi(Un),m({type:"onDragPending",event:Un})},onStart(Be){const $n=U.current;if($n==null)return;const sn=j.get($n);if(!sn)return;const{onDragStart:vn}=I.current,Ei={activatorEvent:xt,active:{id:$n,data:sn.data,rect:M}};Ar.unstable_batchedUpdates(()=>{vn==null||vn(Ei),_(Yn.Initializing),y({type:Te.DragStart,initialCoordinates:Be,active:$n}),m({type:"onDragStart",event:Ei}),oe(Pc.current),T(xt)})},onMove(Be){y({type:Te.DragMove,coordinates:Be})},onEnd:vr(Te.DragEnd),onCancel:vr(Te.DragCancel)});Pc.current=nn;function vr(Be){return async function(){const{active:sn,collisions:vn,over:Ei,scrollAdjustedTranslate:Mi}=tn.current;let Un=null;if(sn&&Mi){const{cancelDrop:Pi}=I.current;Un={activatorEvent:xt,active:sn,collisions:vn,delta:Mi,over:Ei},Be===Te.DragEnd&&typeof Pi=="function"&&await Promise.resolve(Pi(Un))&&(Be=Te.DragCancel)}U.current=null,Ar.unstable_batchedUpdates(()=>{y({type:Be}),_(Yn.Uninitialized),yh(null),oe(null),T(null),Pc.current=null;const Pi=Be===Te.DragEnd?"onDragEnd":"onDragCancel";if(Un){const Rc=I.current[Pi];Rc==null||Rc(Un),m({type:Pi,event:Un})}})}}},[j]),Av=w.useCallback((Ve,gt)=>(mt,Bn)=>{const Nt=mt.nativeEvent,xt=j.get(Bn);if(U.current!==null||!xt||Nt.dndKit||Nt.defaultPrevented)return;const nn={active:xt};Ve(mt,gt.options,nn)===!0&&(Nt.dndKit={capturedBy:gt.sensor},U.current=Bn,vh(mt,gt))},[j,vh]),bh=m2(d,Av);k2(d),Jt(()=>{ie&&S===Yn.Initializing&&_(Yn.Initialized)},[ie,S]),w.useEffect(()=>{const{onDragMove:Ve}=I.current,{active:gt,activatorEvent:mt,collisions:Bn,over:Nt}=tn.current;if(!gt||!mt)return;const xt={active:gt,activatorEvent:mt,collisions:Bn,delta:{x:xr.x,y:xr.y},over:Nt};Ar.unstable_batchedUpdates(()=>{Ve==null||Ve(xt),m({type:"onDragMove",event:xt})})},[xr.x,xr.y]),w.useEffect(()=>{const{active:Ve,activatorEvent:gt,collisions:mt,droppableContainers:Bn,scrollAdjustedTranslate:Nt}=tn.current;if(!Ve||U.current==null||!gt||!Nt)return;const{onDragOver:xt}=I.current,nn=Bn.get(xh),vr=nn&&nn.rect.current?{id:nn.id,rect:nn.rect.current,data:nn.data,disabled:nn.disabled}:null,Be={active:Ve,activatorEvent:gt,collisions:mt,delta:{x:Nt.x,y:Nt.y},over:vr};Ar.unstable_batchedUpdates(()=>{yh(vr),xt==null||xt(Be),m({type:"onDragOver",event:Be})})},[xh]),Jt(()=>{tn.current={activatorEvent:J,active:A,activeNode:Z,collisionRect:yr,collisions:Ni,droppableRects:ce,draggableNodes:j,draggingNode:gr,draggingNodeRect:mr,droppableContainers:E,over:zn,scrollableAncestors:Fn,scrollAdjustedTranslate:xr},M.current={initial:mr,translated:yr}},[A,Z,Ni,yr,j,gr,mr,ce,E,zn,Fn,xr]),f2({...zt,delta:P,draggingRect:yr,pointerCoordinates:gh,scrollableAncestors:Fn,scrollableAncestorRects:ca});const Iv=w.useMemo(()=>({active:A,activeNode:Z,activeNodeRect:ie,activatorEvent:J,collisions:Ni,containerNodeRect:ji,dragOverlay:yn,draggableNodes:j,droppableContainers:E,droppableRects:ce,over:zn,measureDroppableContainers:V,scrollableAncestors:Fn,scrollableAncestorRects:ca,measuringConfiguration:z,measuringScheduled:ke,windowRect:Mc}),[A,Z,ie,J,Ni,ji,yn,j,E,ce,zn,V,Fn,ca,z,ke,Mc]),Fv=w.useMemo(()=>({activatorEvent:J,activators:bh,active:A,activeNodeRect:ie,ariaDescribedById:{draggable:F},dispatch:y,draggableNodes:j,over:zn,measureDroppableContainers:V}),[J,bh,A,ie,y,F,j,zn,V]);return pe.createElement(av.Provider,{value:v},pe.createElement(la.Provider,{value:Fv},pe.createElement(Sv.Provider,{value:Iv},pe.createElement(Ec.Provider,{value:Lv},c)),pe.createElement(T2,{disabled:(a==null?void 0:a.restoreFocus)===!1})),pe.createElement(DN,{...a,hiddenTextDescribedById:F}));function zv(){const Ve=(H==null?void 0:H.autoScrollEnabled)===!1,gt=typeof l=="object"?l.enabled===!1:l===!1,mt=k&&!Ve&&!gt;return typeof l=="object"?{...l,enabled:mt}:{enabled:mt}}}),I2=w.createContext(null),xm="button",F2="Draggable";function z2(t){let{id:e,data:n,disabled:s=!1,attributes:r}=t;const i=aa(F2),{activators:o,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:f,over:h}=w.useContext(la),{role:p=xm,roleDescription:x="draggable",tabIndex:g=0}=r??{},b=(l==null?void 0:l.id)===e,y=w.useContext(b?Ec:I2),[m,v]=Xl(),[S,_]=Xl(),k=C2(o,e),C=Uo(n);Jt(()=>(f.set(e,{id:e,key:i,node:m,activatorNode:S,data:C}),()=>{const P=f.get(e);P&&P.key===i&&f.delete(e)}),[f,e]);const j=w.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":s,"aria-pressed":b&&p===xm?!0:void 0,"aria-roledescription":x,"aria-describedby":d.draggable}),[s,p,g,b,x,d.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:j,isDragging:b,listeners:s?void 0:k,node:m,over:h,setNodeRef:v,setActivatorNodeRef:_,transform:y}}function kv(){return w.useContext(Sv)}const B2="Droppable",$2={timeout:25};function Cv(t){let{data:e,disabled:n=!1,id:s,resizeObserverConfig:r}=t;const i=aa(B2),{active:o,dispatch:a,over:l,measureDroppableContainers:c}=w.useContext(la),d=w.useRef({disabled:n}),f=w.useRef(!1),h=w.useRef(null),p=w.useRef(null),{disabled:x,updateMeasurementsFor:g,timeout:b}={...$2,...r},y=Uo(g??s),m=w.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(y.current)?y.current:[y.current]),p.current=null},b)},[b]),v=Nc({callback:m,disabled:x||!o}),S=w.useCallback((j,P)=>{v&&(P&&(v.unobserve(P),f.current=!1),j&&v.observe(j))},[v]),[_,k]=Xl(S),C=Uo(e);return w.useEffect(()=>{!v||!_.current||(v.disconnect(),f.current=!1,v.observe(_.current))},[_,v]),w.useEffect(()=>(a({type:Te.RegisterDroppable,element:{id:s,key:i,disabled:n,node:_,rect:h,data:C}}),()=>a({type:Te.UnregisterDroppable,key:i,id:s})),[s]),w.useEffect(()=>{n!==d.current.disabled&&(a({type:Te.SetDroppableDisabled,id:s,key:i,disabled:n}),d.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 U2(t){let{animation:e,children:n}=t;const[s,r]=w.useState(null),[i,o]=w.useState(null),a=ql(n);return!n&&!s&&a&&r(a),Jt(()=>{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]),pe.createElement(pe.Fragment,null,n,s?w.cloneElement(s,{ref:o}):null)}const W2={x:0,y:0,scaleX:1,scaleY:1};function H2(t){let{children:e}=t;return pe.createElement(la.Provider,{value:wv},pe.createElement(Ec.Provider,{value:W2},e))}const V2={position:"fixed",touchAction:"none"},Q2=t=>jc(t)?"transform 250ms ease":void 0,K2=w.forwardRef((t,e)=>{let{as:n,activatorEvent:s,adjustScale:r,children:i,className:o,rect:a,style:l,transform:c,transition:d=Q2}=t;if(!a)return null;const f=r?c:{...c,scaleX:1,scaleY:1},h={...V2,width:a.width,height:a.height,top:a.top,left:a.left,transform:Es.Transform.toString(f),transformOrigin:r&&s?FN(s,a):void 0,transition:typeof d=="function"?d(s):d,...l};return pe.createElement(n,{className:o,style:h,ref:e},i)}),Y2=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)}},X2=t=>{let{transform:{initial:e,final:n}}=t;return[{transform:Es.Transform.toString(e)},{transform:Es.Transform.toString(n)}]},q2={duration:250,easing:"ease",keyframes:X2,sideEffects:Y2({styles:{active:{opacity:"0"}}})};function G2(t){let{config:e,draggableNodes:n,droppableContainers:s,measuringConfiguration:r}=t;return Cc((i,o)=>{if(e===null)return;const a=n.get(i);if(!a)return;const l=a.node.current;if(!l)return;const c=bv(o);if(!c)return;const{transform:d}=st(o).getComputedStyle(o),f=cv(d);if(!f)return;const h=typeof e=="function"?e:J2(e);return mv(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 J2(t){const{duration:e,easing:n,sideEffects:s,keyframes:r}={...q2,...t};return i=>{let{active:o,dragOverlay:a,transform:l,...c}=i;if(!e)return;const d={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-d.x,y:l.y-d.y,...f},p=r({...c,active:o,dragOverlay:a,transform:{initial:l,final:h}}),[x]=p,g=p[p.length-1];if(JSON.stringify(x)===JSON.stringify(g))return;const b=s==null?void 0:s({active:o,dragOverlay:a,...c}),y=a.node.animate(p,{duration:e,easing:n,fill:"forwards"});return new Promise(m=>{y.onfinish=()=>{b==null||b(),m()}})}}let ym=0;function Z2(t){return w.useMemo(()=>{if(t!=null)return ym++,ym},[t])}const eE=pe.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:d,active:f,activeNodeRect:h,containerNodeRect:p,draggableNodes:x,droppableContainers:g,dragOverlay:b,over:y,measuringConfiguration:m,scrollableAncestors:v,scrollableAncestorRects:S,windowRect:_}=kv(),k=w.useContext(Ec),C=Z2(f==null?void 0:f.id),j=_v(o,{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:b.rect,over:y,overlayNodeRect:b.rect,scrollableAncestors:v,scrollableAncestorRects:S,transform:k,windowRect:_}),P=fh(h),E=G2({config:s,draggableNodes:x,droppableContainers:g,measuringConfiguration:m}),R=P?b.setRef:void 0;return pe.createElement(H2,null,pe.createElement(U2,{animation:E},f&&C?pe.createElement(K2,{key:C,id:f.id,ref:R,as:a,activatorEvent:d,adjustScale:e,className:l,transition:i,rect:P,style:{zIndex:c,...r},transform:j},n):null))});function jv(t,e,n){const s=t.slice();return s.splice(n<0?s.length+n:n,0,s.splice(e,1)[0]),s}function tE(t,e){return t.reduce((n,s,r)=>{const i=e.get(s);return i&&(n[r]=i),n},Array(t.length))}function Wa(t){return t!==null&&t>=0}function nE(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function sE(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const Nv=t=>{let{rects:e,activeIndex:n,overIndex:s,index:r}=t;const i=jv(e,s,n),o=e[r],a=i[r];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},Ha={scaleX:1,scaleY:1},rE=t=>{var e;let{activeIndex:n,activeNodeRect:s,index:r,rects:i,overIndex:o}=t;const a=(e=i[n])!=null?e:s;if(!a)return null;if(r===n){const c=i[o];return c?{x:0,y:n<o?c.top+c.height-(a.top+a.height):c.top-a.top,...Ha}:null}const l=iE(i,r,n);return r>n&&r<=o?{x:0,y:-a.height-l,...Ha}:r<n&&r>=o?{x:0,y:a.height+l,...Ha}:{x:0,y:0,...Ha}};function iE(t,e,n){const s=t[e],r=t[e-1],i=t[e+1];return s?n<e?r?s.top-(r.top+r.height):i?i.top-(s.top+s.height):0:i?i.top-(s.top+s.height):r?s.top-(r.top+r.height):0:0}const Ev="Sortable",Mv=pe.createContext({activeIndex:-1,containerId:Ev,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Nv,disabled:{draggable:!1,droppable:!1}});function oE(t){let{children:e,id:n,items:s,strategy:r=Nv,disabled:i=!1}=t;const{active:o,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:d}=kv(),f=aa(Ev,n),h=a.rect!==null,p=w.useMemo(()=>s.map(k=>typeof k=="object"&&"id"in k?k.id:k),[s]),x=o!=null,g=o?p.indexOf(o.id):-1,b=c?p.indexOf(c.id):-1,y=w.useRef(p),m=!nE(p,y.current),v=b!==-1&&g===-1||m,S=sE(i);Jt(()=>{m&&x&&d(p)},[m,p,x,d]),w.useEffect(()=>{y.current=p},[p]);const _=w.useMemo(()=>({activeIndex:g,containerId:f,disabled:S,disableTransforms:v,items:p,overIndex:b,useDragOverlay:h,sortedRects:tE(p,l),strategy:r}),[g,f,S.draggable,S.droppable,v,p,b,l,h,r]);return pe.createElement(Mv.Provider,{value:_},e)}const aE=t=>{let{id:e,items:n,activeIndex:s,overIndex:r}=t;return jv(n,s,r).indexOf(e)},lE=t=>{let{containerId:e,isSorting:n,wasDragging:s,index:r,items:i,newIndex:o,previousItems:a,previousContainerId:l,transition:c}=t;return!c||!s||a!==i&&r===o?!1:n?!0:o!==r&&e===l},cE={duration:200,easing:"ease"},Pv="transform",uE=Es.Transition.toString({property:Pv,duration:0,easing:"linear"}),dE={roleDescription:"sortable"};function fE(t){let{disabled:e,index:n,node:s,rect:r}=t;const[i,o]=w.useState(null),a=w.useRef(n);return Jt(()=>{if(!e&&n!==a.current&&s.current){const l=r.current;if(l){const c=Ci(s.current,{ignoreTransform:!0}),d={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(d.x||d.y)&&o(d)}}n!==a.current&&(a.current=n)},[e,n,s,r]),w.useEffect(()=>{i&&o(null)},[i]),i}function hE(t){let{animateLayoutChanges:e=lE,attributes:n,disabled:s,data:r,getNewIndex:i=aE,id:o,strategy:a,resizeObserverConfig:l,transition:c=cE}=t;const{items:d,containerId:f,activeIndex:h,disabled:p,disableTransforms:x,sortedRects:g,overIndex:b,useDragOverlay:y,strategy:m}=w.useContext(Mv),v=pE(s,p),S=d.indexOf(o),_=w.useMemo(()=>({sortable:{containerId:f,index:S,items:d},...r}),[f,r,S,d]),k=w.useMemo(()=>d.slice(d.indexOf(o)),[d,o]),{rect:C,node:j,isOver:P,setNodeRef:E}=Cv({id:o,data:_,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...l}}),{active:R,activatorEvent:M,activeNodeRect:A,attributes:U,setNodeRef:H,listeners:oe,isDragging:J,over:T,setActivatorNodeRef:I,transform:F}=z2({id:o,data:_,attributes:{...dE,...n},disabled:v.draggable}),K=wN(E,H),z=!!R,ce=z&&!x&&Wa(h)&&Wa(b),V=!y&&J,ke=V&&ce?F:null,pt=ce?ke??(a??m)({rects:g,activeNodeRect:A,activeIndex:h,overIndex:b,index:S}):null,zt=Wa(h)&&Wa(b)?i({id:o,items:d,activeIndex:h,overIndex:b}):S,Bt=R==null?void 0:R.id,ie=w.useRef({activeId:Bt,items:d,newIndex:zt,containerId:f}),ji=d!==ie.current.items,tn=e({active:R,containerId:f,isDragging:J,isSorting:z,id:o,index:S,items:d,newIndex:ie.current.newIndex,previousItems:ie.current.items,previousContainerId:ie.current.containerId,transition:c,wasDragging:ie.current.activeId!=null}),pr=fE({disabled:!tn,index:S,node:j,rect:C});return w.useEffect(()=>{z&&ie.current.newIndex!==zt&&(ie.current.newIndex=zt),f!==ie.current.containerId&&(ie.current.containerId=f),d!==ie.current.items&&(ie.current.items=d)},[z,zt,f,d]),w.useEffect(()=>{if(Bt===ie.current.activeId)return;if(Bt!=null&&ie.current.activeId==null){ie.current.activeId=Bt;return}const gr=setTimeout(()=>{ie.current.activeId=Bt},50);return()=>clearTimeout(gr)},[Bt]),{active:R,activeIndex:h,attributes:U,data:_,rect:C,index:S,newIndex:zt,items:d,isOver:P,isSorting:z,isDragging:J,listeners:oe,node:j,overIndex:b,over:T,setNodeRef:K,setActivatorNodeRef:I,setDroppableNodeRef:E,setDraggableNodeRef:H,transform:pr??pt,transition:yn()};function yn(){if(pr||ji&&ie.current.newIndex===S)return uE;if(!(V&&!jc(M)||!c)&&(z||tn))return Es.Transition.toString({...c,property:Pv})}}function pE(t,e){var n,s;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t==null?void 0:t.draggable)!=null?n:e.draggable,droppable:(s=t==null?void 0:t.droppable)!=null?s:e.droppable}}se.Down,se.Right,se.Up,se.Left;function Rv({lead:t,onAbrir:e,emOverlay:n=!1}){const{attributes:s,listeners:r,setNodeRef:i,transform:o,transition:a,isDragging:l}=hE({id:t.id});return u.jsxs("div",{ref:i,...r,...s,style:{transform:Es.Transform.toString(o),transition:a,opacity:l?.5:1},className:Q("bg-white rounded-lg shadow-sm border border-gray-100 p-3 cursor-grab active:cursor-grabbing select-none touch-none",n&&"shadow-xl rotate-2 cursor-grabbing"),onDoubleClick:()=>e==null?void 0:e(t),title:"Arraste para mudar de coluna · duplo clique para editar",children:[u.jsx("p",{className:"text-sm font-semibold text-gray-800 truncate",children:t.nome}),u.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:na(t.telefone)}),u.jsxs("div",{className:"flex items-center justify-between mt-2",children:[u.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}),u.jsx("span",{className:"text-[10px] text-gray-400",title:"Data de criação",children:new Date(t.criado_em).toLocaleDateString("pt-BR")})]})]})}function gE({etapa:t,leads:e,cor:n,onAbrirLead:s}){const{setNodeRef:r,isOver:i}=Cv({id:t});return u.jsxs("div",{className:"w-72 shrink-0",children:[u.jsxs("div",{className:"flex items-center justify-between px-1 pb-2",children:[u.jsxs("span",{className:"flex items-center gap-2 text-sm font-semibold text-gray-700",children:[u.jsx("span",{className:Q("w-2.5 h-2.5 rounded-full",n)}),Rn[t]]}),u.jsx("span",{className:"text-xs font-medium text-gray-500 bg-white border border-gray-200 rounded-full px-2 py-0.5 shadow-sm",children:e.length})]}),u.jsx("div",{ref:r,className:Q("bg-white rounded-xl p-3 min-h-[420px] transition-colors","shadow-sm border",i?"border-2 border-dashed border-indigo-400 bg-indigo-50":"border-gray-100"),children:u.jsx(oE,{items:e.map(o=>o.id),strategy:rE,children:u.jsxs("div",{className:"space-y-2 max-h-[calc(100vh-320px)] overflow-y-auto pr-0.5",children:[e.length===0&&u.jsxs("div",{className:"text-center text-xs text-gray-400 border-2 border-dashed border-gray-200 rounded-lg py-10 mt-8",children:[u.jsx("i",{className:"fas fa-inbox text-2xl text-gray-300 mb-2 block"}),"Arraste leads para cá"]}),e.map(o=>u.jsx(Rv,{lead:o,onAbrir:s},o.id))]})})})]})}const mE={leads:"bg-blue-500",em_contato:"bg-amber-500",proposta:"bg-violet-500",fechado:"bg-green-500"};function Hi(t,e){if(_t.includes(e))return e;for(const n of _t)if((t[n]||[]).includes(e))return n;return null}function xE({leads:t,onMover:e,onAbrirLead:n}){const[s,r]=w.useState(()=>yE(t)),[i,o]=w.useState(null),a=w.useRef(s),l=AN(LN(dh,{activationConstraint:{distance:6}}));w.useEffect(()=>{r(x=>{const g=new Set(t.map(v=>v.id)),b={};for(const v of _t)b[v]=(x[v]||[]).filter(S=>g.has(S));let y=!1;for(const v of t){const S=Hi(b,v.id);S===null?(b[v.etapa]=[...b[v.etapa]||[],v.id],y=!0):S!==v.etapa&&(b[S]=b[S].filter(_=>_!==v.id),b[v.etapa]=[...b[v.etapa]||[],v.id],y=!0)}const m=_t.every(v=>(b[v]||[]).length===(x[v]||[]).length);return y||!m?b:x})},[t]);const c=w.useCallback(x=>x&&t.find(g=>g.id===x)||null,[t]),d=w.useMemo(()=>c(i),[c,i]),f=x=>{a.current=s,o(String(x.active.id))},h=w.useCallback(x=>{const{active:g,over:b}=x;if(!b)return;const y=String(g.id),m=String(b.id);r(v=>{const S=Hi(v,y),_=Hi(v,m);return!S||!_||S===_?v:{...v,[S]:v[S].filter(k=>k!==y),[_]:[...v[_],y]}})},[]),p=async x=>{o(null);const g=String(x.active.id);if(!x.over){r(a.current);return}const b=Hi(s,String(x.over.id)),y=Hi(a.current,g);!b||!y||b===y||await e(g,b)};return u.jsxs(A2,{sensors:l,collisionDetection:UN,onDragStart:f,onDragOver:h,onDragEnd:p,children:[u.jsx("div",{className:"flex gap-4 overflow-x-auto pb-2",children:_t.map(x=>u.jsx(gE,{etapa:x,cor:mE[x],leads:t.filter(g=>{var b;return(b=s[x])==null?void 0:b.includes(g.id)}),onAbrirLead:n},x))}),u.jsx(eE,{children:d?u.jsx(Rv,{lead:d,emOverlay:!0}):null})]})}function yE(t){const e={leads:[],em_contato:[],proposta:[],fechado:[]};for(const n of t)e[n.etapa]&&e[n.etapa].push(n.id);return e}const vm={nome:"",telefone:"",email:"",fonte:"Manual",etapa:"leads"};function vE(){const{toast:t}=en(),[e,n]=w.useState([]),[s,r]=w.useState(null),[i,o]=w.useState(!1),[a,l]=w.useState(!1),[c,d]=w.useState(null),[f,h]=w.useState({...vm}),[p,x]=w.useState(""),g=w.useCallback(async()=>{n(await W.crm.leadsListar())},[]);w.useEffect(()=>{g().catch(C=>t("erro",C.message))},[g,t]);const b=async(C,j)=>{const P=e;n(E=>E.map(R=>R.id===C?{...R,etapa:j}:R));try{await W.crm.moverLead(C,j),t("sucesso",`Lead movido para "${Rn[j]}".`)}catch(E){n(P),t("erro",E instanceof Error?E.message:"Falha ao mover lead.")}},y=async()=>{var C;if(!((C=f.nome)!=null&&C.trim())){t("erro","O nome do lead é obrigatório.");return}try{await W.crm.criarLead({...f,etapa:f.etapa||"leads"}),t("sucesso","Lead criado com sucesso."),l(!1),h({...vm}),await g()}catch(j){t("erro",j instanceof Error?j.message:"Falha ao criar lead.")}},m=async()=>{o(!0);try{const C=await W.crm.sugestoes();r(C.sugestoes)}catch(C){t("erro",C instanceof Error?C.message:"Falha ao pedir sugestões.")}finally{o(!1)}},v=async C=>{try{await W.crm.aplicar(C.lead_id,C.para),r(j=>(j==null?void 0:j.filter(P=>P!==C))??null),await g(),t("sucesso",`Sugestão aplicada: ${C.lead_nome} → ${Rn[C.para]}.`)}catch(j){t("erro",j instanceof Error?j.message:"Falha ao aplicar sugestão.")}},S=async C=>{try{(await W.leads.enriquecer(C.id)).notas.forEach(P=>t("info",P)),await g()}catch(j){t("erro",j instanceof Error?j.message:"Falha ao enriquecer.")}},_=async()=>{if(c)try{await W.leads.atualizar(c.id,{observacoes:p}),d(null),await g(),t("sucesso","Observações salvas.")}catch(C){t("erro",C instanceof Error?C.message:"Falha ao salvar.")}},k=w.useMemo(()=>Object.fromEntries(_t.map(C=>[C,e.filter(j=>j.etapa===C).length])),[e]);return u.jsxs("div",{className:"space-y-6",children:[u.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[u.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-500 flex-wrap",children:[u.jsxs("span",{children:[u.jsx("strong",{className:"text-gray-800",children:e.length})," leads no funil"]}),_t.map(C=>u.jsxs("span",{className:"hidden md:inline",children:[Rn[C],": ",u.jsx("strong",{className:"text-gray-700",children:k[C]})]},C))]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs("button",{onClick:m,disabled:i,className:"px-5 py-2.5 text-sm font-medium text-indigo-600 bg-white border border-indigo-200 rounded-lg hover:bg-indigo-50 transition disabled:opacity-60 shadow-sm",children:[u.jsx("i",{className:Q("fas fa-wand-magic-sparkles mr-2",i&&"fa-spin")}),"Sugestões da IA"]}),u.jsxs("button",{onClick:()=>l(!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:[u.jsx("i",{className:"fas fa-plus mr-2"})," Adicionar Lead"]})]})]}),u.jsx(xE,{leads:e,onMover:b,onAbrirLead:C=>{d(C),x(C.observacoes||"")}}),u.jsxs(Xt,{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&&u.jsxs("p",{className:"text-sm text-gray-500 text-center py-8",children:[u.jsx("i",{className:"fas fa-circle-check text-green-500 text-2xl block mb-3"}),"Nenhuma sugestão no momento — o funil está equilibrado. 🎯"]}),u.jsx("div",{className:"space-y-3",children:s==null?void 0:s.map((C,j)=>u.jsxs("div",{className:"border border-gray-100 rounded-xl p-4 flex items-start justify-between gap-4 hover:border-indigo-200 transition",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("p",{className:"text-sm font-semibold text-gray-800 truncate",children:C.lead_nome}),u.jsxs("p",{className:"text-xs text-gray-500 mt-1 flex items-center gap-2",children:[u.jsx(_s,{status:C.de})," ",u.jsx("i",{className:"fas fa-arrow-right text-gray-300"})," ",u.jsx(_s,{status:C.para}),u.jsxs("span",{className:"text-gray-400",children:["confiança ",Math.round(C.confianca*100),"%"]})]}),u.jsx("p",{className:"text-xs text-gray-600 mt-2",children:C.motivo})]}),u.jsx("button",{onClick:()=>v(C),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"})]},j))})]}),u.jsx(Xt,{aberto:a,onFechar:()=>l(!1),titulo:"Adicionar Lead",icone:"fas fa-user-plus",children:u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[u.jsx(_r,{rotulo:"Nome *",valor:f.nome||"",onChange:C=>h({...f,nome:C})}),u.jsx(_r,{rotulo:"Telefone",valor:f.telefone||"",onChange:C=>h({...f,telefone:C}),placeholder:"(11) 99999-9999"}),u.jsx(_r,{rotulo:"E-mail",tipo:"email",valor:f.email||"",onChange:C=>h({...f,email:C}),placeholder:"contato@empresa.com.br"}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Coluna inicial"}),u.jsx("select",{value:f.etapa||"leads",onChange:C=>h({...f,etapa:C.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:_t.map(C=>u.jsx("option",{value:C,children:Rn[C]},C))})]})]}),u.jsx(_r,{rotulo:"Fonte",valor:f.fonte||"",onChange:C=>h({...f,fonte:C}),placeholder:"Manual, Google Maps, Instagram, CNPJ..."}),u.jsxs(Dt,{titulo:"Campos avançados",icone:"fas fa-sliders",children:[u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[u.jsx(_r,{rotulo:"Empresa",valor:f.empresa||"",onChange:C=>h({...f,empresa:C})}),u.jsx(_r,{rotulo:"Cidade",valor:f.cidade||"",onChange:C=>h({...f,cidade:C}),placeholder:"São Paulo/SP"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Observações"}),u.jsx("textarea",{value:f.observacoes||"",onChange:C=>h({...f,observacoes:C.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"})]})]}),u.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[u.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"}),u.jsxs("button",{onClick:y,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:[u.jsx("i",{className:"fas fa-save mr-2"})," Salvar"]})]})]})}),u.jsx(Xt,{aberto:!!c,onFechar:()=>d(null),titulo:"Lead",icone:"fas fa-address-card",children:c&&u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("p",{className:"text-base font-semibold text-gray-800",children:c.nome}),u.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:[na(c.telefone)," · ",c.fonte," · criado em ",Il(c.criado_em)]})]}),u.jsx(_s,{status:c.etapa})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Observações"}),u.jsx("textarea",{value:p,onChange:C=>x(C.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..."})]}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("button",{onClick:()=>S(c),className:"text-sm text-indigo-600 hover:text-indigo-800 font-medium",children:[u.jsx("i",{className:"fas fa-wand-magic-sparkles mr-1"})," Enriquecer com IA"]}),u.jsxs("div",{className:"flex gap-3",children:[u.jsx("button",{onClick:()=>d(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"}),u.jsxs("button",{onClick:_,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:[u.jsx("i",{className:"fas fa-save mr-2"})," Salvar"]})]})]})]})})]})}function _r({rotulo:t,valor:e,onChange:n,tipo:s="text",placeholder:r}){return u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:t}),u.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"})]})}function bE(){const{toast:t}=en(),[e,n]=w.useState([]),[s,r]=w.useState({}),[i,o]=w.useState(!1),[a,l]=w.useState(null),{data:c=[],refetch:d}=ey({queryKey:["campanhas"],queryFn:()=>W.campanhas.listar(),refetchInterval:M=>{var A;return(A=M.state.data)!=null&&A.some(U=>U.status==="em_andamento")?4e3:!1},refetchIntervalInBackground:!1}),f=w.useCallback(async()=>{const[M,A]=await Promise.all([W.leads.listar(),W.agentes.templates()]);n(M),r(A)},[]);w.useEffect(()=>{f().catch(M=>t("erro",M.message))},[f,t]);const[h,p]=w.useState(""),[x,g]=w.useState("texto"),[b,y]=w.useState("texto"),[m,v]=w.useState(new Set),[S,_]=w.useState("todas"),k=w.useMemo(()=>S==="todas"?e:e.filter(M=>M.etapa===S),[e,S]),C=M=>{v(A=>{const U=new Set(A);return U.has(M)?U.delete(M):U.add(M),U})},j=()=>{v(new Set(k.map(M=>M.id)))},P=async()=>{if(!h.trim()){t("erro","Dê um nome para a campanha.");return}if(m.size===0){t("erro","Selecione ao menos um lead para disparar.");return}try{await W.campanhas.criar({nome:h.trim(),canal:x,template:b,lead_ids:[...m]}),t("sucesso","Campanha criada — clique em Iniciar quando estiver pronto."),o(!1),p(""),v(new Set),await d()}catch(M){t("erro",M instanceof Error?M.message:"Falha ao criar campanha.")}},E=async(M,A)=>{try{const U=A==="iniciar"?await W.campanhas.iniciar(M.id):A==="pausar"?await W.campanhas.pausar(M.id):await W.campanhas.parar(M.id);t(U.ok?"sucesso":"info",U.mensagem),await d()}catch(U){t("erro",U instanceof Error?U.message:"Falha na ação.")}},R=async M=>{try{await W.campanhas.remover(M.id),t("sucesso",`Campanha "${M.nome}" removida.`),await d()}catch(A){t("erro",A instanceof Error?A.message:"Falha ao remover.")}};return u.jsxs("div",{className:"space-y-6",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("p",{className:"text-sm text-gray-500",children:[u.jsx("strong",{className:"text-gray-800",children:c.length})," campanhas • templates configuráveis em Agentes"]}),u.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:[u.jsx("i",{className:"fas fa-plus mr-2"})," Nova Campanha"]})]}),u.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[c.map(M=>{const A=Math.max(M.total,M.enviadas+M.erros),U=A?Math.round((M.enviadas+M.erros)/A*100):0,H=M.status==="em_andamento";return u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-5 space-y-3",children:[u.jsxs("div",{className:"flex items-start justify-between gap-3",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("p",{className:"text-sm font-semibold text-gray-800 truncate",children:M.nome}),u.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:["criada em ",Il(M.criado_em),' · template "',M.template,'"']})]}),u.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[u.jsx(_s,{status:wE(M.canal),rotulo:M.canal==="audio"?"Áudio":"Texto"}),u.jsx(_s,{status:M.status})]})]}),u.jsx(ra,{valor:U,mostrarLabel:!0}),u.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500",children:[u.jsxs("span",{children:[u.jsx("i",{className:"fas fa-paper-plane text-blue-500 mr-1"}),M.enviadas," enviadas"]}),u.jsxs("span",{children:[u.jsx("i",{className:"fas fa-circle-exclamation text-red-500 mr-1"}),M.erros," erros"]}),u.jsxs("span",{children:[A," leads"]})]}),u.jsxs("div",{className:"flex items-center justify-between pt-1",children:[u.jsxs("button",{onClick:()=>l(M),className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:[u.jsx("i",{className:"fas fa-list mr-1"})," Ver eventos"]}),u.jsxs("div",{className:"flex items-center gap-2",children:[(M.status==="rascunho"||M.status==="pausada"||M.status==="concluida")&&u.jsxs("button",{onClick:()=>E(M,"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:[u.jsx("i",{className:"fas fa-play mr-1"})," ",M.status==="pausada"?"Retomar":"Iniciar"]}),H&&u.jsxs(u.Fragment,{children:[u.jsxs("button",{onClick:()=>E(M,"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:[u.jsx("i",{className:"fas fa-pause mr-1"})," Pausar"]}),u.jsxs("button",{onClick:()=>E(M,"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:[u.jsx("i",{className:"fas fa-stop mr-1"})," Parar"]})]}),u.jsx("button",{onClick:()=>R(M),className:"text-gray-400 hover:text-red-600 px-2 py-2",title:"Excluir campanha",children:u.jsx("i",{className:"fas fa-trash"})})]})]})]},M.id)}),c.length===0&&u.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:[u.jsx("i",{className:"fas fa-bullhorn text-3xl text-gray-200 block mb-3"}),'Nenhuma campanha ainda. Crie a primeira com "Nova Campanha".']})]}),u.jsx(Xt,{aberto:i,onFechar:()=>o(!1),titulo:"Nova campanha de disparo",icone:"fas fa-bullhorn",largura:"lg",children:u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[u.jsxs("div",{className:"md:col-span-3",children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Nome da campanha *"}),u.jsx("input",{value:h,onChange:M=>p(M.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"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Canal"}),u.jsxs("select",{value:x,onChange:M=>{const A=M.target.value;g(A),y(A)},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:[u.jsx("option",{value:"texto",children:"Texto"}),u.jsx("option",{value:"audio",children:"Áudio"})]})]}),u.jsxs("div",{className:"md:col-span-2",children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Template"}),u.jsx("select",{value:b,onChange:M=>y(M.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(M=>u.jsxs("option",{value:M,children:[M==="texto"?"Texto":"Áudio"," — ",s[M].slice(0,40),"..."]},M))})]})]}),u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsxs("label",{className:"text-xs font-medium text-gray-500",children:["Leads destinatários — ",m.size," selecionado(s)"]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs("select",{value:S,onChange:M=>_(M.target.value),className:"text-xs border border-gray-200 rounded-lg px-2 py-1.5 bg-white",children:[u.jsx("option",{value:"todas",children:"Todas as etapas"}),_t.map(M=>u.jsx("option",{value:M,children:Rn[M]},M))]}),u.jsx("button",{onClick:j,className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:"Selecionar todos"})]})]}),u.jsxs("div",{className:"max-h-52 overflow-y-auto border border-gray-100 rounded-lg divide-y divide-gray-50",children:[k.map(M=>u.jsxs("label",{className:"flex items-center gap-3 px-3 py-2.5 text-sm cursor-pointer hover:bg-indigo-50/50",children:[u.jsx("input",{type:"checkbox",checked:m.has(M.id),onChange:()=>C(M.id),className:"w-4 h-4 accent-indigo-500"}),u.jsx("span",{className:"text-gray-700 flex-1 truncate",children:M.nome}),u.jsx("span",{className:"text-xs text-gray-400",children:M.telefone||M.email||"sem contato"})]},M.id)),k.length===0&&u.jsx("p",{className:"px-3 py-6 text-center text-xs text-gray-400",children:"Nenhum lead nesta etapa."})]})]}),u.jsx(Dt,{titulo:"Como funciona o disparo?",icone:"fas fa-circle-question",children:u.jsxs("p",{className:"text-xs text-gray-500",children:["O disparo é executado pelo ",u.jsx("strong",{children:"OpenOutreach"})," (eracle/OpenOutreach). Se ainda não configurou, a validação acontece na hora de iniciar — configure em ",u.jsx("strong",{children:"Ferramentas → OpenOutreach"}),"."]})}),u.jsxs("div",{className:"flex justify-end gap-3 pt-1",children:[u.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"}),u.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:[u.jsx("i",{className:"fas fa-plus mr-2"})," Criar campanha"]})]})]})}),u.jsx(Xt,{aberto:!!a,onFechar:()=>l(null),titulo:`Eventos — ${(a==null?void 0:a.nome)??""}`,icone:"fas fa-list",largura:"lg",children:a&&u.jsxs("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:[a.eventos.length===0&&u.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((M,A)=>{var U;return u.jsxs("div",{className:"flex items-start gap-3 text-sm border-b border-gray-50 pb-2",children:[u.jsx("i",{className:Q("mt-1 text-xs",M.status==="enviado"?"fas fa-circle-check text-green-500":"fas fa-circle-xmark text-red-500")}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("p",{className:"text-gray-700 truncate",children:((U=e.find(H=>H.id===M.lead_id))==null?void 0:U.nome)??M.lead_id}),M.mensagem&&u.jsx("p",{className:"text-xs text-gray-400 truncate",children:M.mensagem})]}),u.jsx("span",{className:"text-xs text-gray-300 shrink-0",children:Il(M.momento)})]},A)})]})})]})}function wE(t){return t==="audio"?"audio":"texto"}const SE=[{para:"/extrator-maps",icone:"fas fa-map-marked-alt",titulo:"Google Maps",descricao:"Empresas por palavra-chave e localização. Sem scraper configurado, gera mock de 5–10 leads."},{para:"/extrator-instagram",icone:"fab fa-instagram",titulo:"Instagram",descricao:"Seguidores de um perfil público. Sem igmapper configurado, gera mock de 5–10 leads."},{para:"/extrator-cnpj",icone:"fas fa-building",titulo:"CNPJ (B2B)",descricao:"Empresas por CNAE + UF. Sem provedor configurado, gera mock de 5–10 empresas."}];function _E(){const t=bi();return u.jsxs("div",{className:"space-y-6",children:[u.jsxs("p",{className:"text-sm text-gray-500",children:["Selecione uma fonte de leads. Todas salvam diretamente em ",u.jsx("strong",{children:"leads.json"}),", na coluna"," ",u.jsx("strong",{children:'"Novos Leads"'})," do CRM — dados 100% locais."]}),u.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:SE.map(e=>u.jsxs("button",{onClick:()=>t(e.para),className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 text-left space-y-3 hover:border-indigo-200 hover:shadow-md transition group",children:[u.jsx("span",{className:"w-11 h-11 rounded-lg bg-indigo-50 text-indigo-600 flex items-center justify-center text-lg group-hover:bg-indigo-100",children:u.jsx("i",{className:e.icone})}),u.jsx("p",{className:"text-sm font-semibold text-gray-800",children:e.titulo}),u.jsx("p",{className:"text-xs text-gray-500 leading-relaxed",children:e.descricao}),u.jsxs("span",{className:"text-xs font-medium text-indigo-600 group-hover:text-indigo-800",children:["Abrir extrator ",u.jsx("i",{className:"fas fa-arrow-right ml-1"})]})]},e.para))})]})}function kE(){const{toast:t}=en(),e=bi(),[n,s]=w.useState(""),[r,i]=w.useState(""),[o,a]=w.useState(10),[l,c]=w.useState(5),[d,f]=w.useState(!1),[h,p]=w.useState(!1),[x,g]=w.useState(0),[b,y]=w.useState(null),[m,v]=w.useState(""),S=async()=>{if(n.trim().length<2||r.trim().length<2){t("erro",'Preencha a palavra-chave e a localização (ex.: "Dentista", "Rio de Janeiro").');return}p(!0),y(null),g(8);const _=setInterval(()=>{g(k=>k<85?k+Math.ceil((90-k)/6):85)},90);try{const k=await W.extrair.maps({keyword:n.trim(),location:r.trim(),limit:o});clearInterval(_),g(100),y(k.importados),v(k.origem==="cli"?"scraper real":"mock de teste");const C=k.duplicados>0?` · ${k.duplicados} duplicados ignorados`:"",j=k.aviso?` · ${k.aviso}`:"";t("sucesso",`${k.importados.length} leads extraídos (${k.origem==="cli"?"scraper real":"mock"})${C}${j}`)}catch(k){clearInterval(_),g(0),t("erro",k instanceof Error?k.message:"Falha na extração.")}finally{p(!1)}};return u.jsxs("div",{className:"space-y-6 max-w-4xl",children:[u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-5",children:[u.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[u.jsxs("p",{className:"text-sm text-gray-500",children:["Busque empresas por palavra-chave e localização. Sem scraper configurado, o LeadMaster gera",u.jsx("strong",{children:" dados mockados (5–10 leads)"})," para teste — sem risco de bloqueio de IP."]}),u.jsxs("span",{className:"text-xs shrink-0 text-gray-400",children:[u.jsx("i",{className:"fas fa-shield-halved mr-1"})," dados públicos"]})]}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Palavra-chave *"}),u.jsx("input",{value:n,onChange:_=>s(_.target.value),placeholder:"Ex.: Dentista, pizzaria, 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"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Localização *"}),u.jsx("input",{value:r,onChange:_=>i(_.target.value),placeholder:"Ex.: Rio de Janeiro, RJ",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"})]}),u.jsxs("div",{children:[u.jsxs("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:["Quantidade: ",o]}),u.jsx("input",{type:"range",min:5,max:10,value:o,onChange:_=>a(Number(_.target.value)),className:"w-full accent-indigo-500 mt-2"})]})]}),u.jsxs("button",{onClick:S,disabled:h,className:"w-full md:w-auto px-8 py-3.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 shadow-sm",children:[u.jsx("i",{className:Q("fas fa-magnifying-glass mr-2",h&&"fa-spin")}),h?"Buscando leads...":"Iniciar Extração"]}),(h||x>0)&&u.jsxs("div",{className:"space-y-1",children:[u.jsx(ra,{valor:x}),u.jsx("p",{className:"text-xs text-indigo-600 font-medium",children:x<100?"Buscando leads no Google Maps...":"Extração concluída ✓"})]}),u.jsxs(Dt,{titulo:"Configurações avançadas",icone:"fas fa-sliders",children:[u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[u.jsxs("div",{children:[u.jsxs("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:["Raio de busca: ",l," km"]}),u.jsx("input",{type:"range",min:1,max:50,value:l,onChange:_=>c(Number(_.target.value)),className:"w-full accent-indigo-500"})]}),u.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-600 bg-gray-50 border border-gray-100 rounded-lg px-3 py-2.5 cursor-pointer h-fit",children:[u.jsx("input",{type:"checkbox",checked:d,onChange:_=>f(_.target.checked),className:"w-4 h-4 accent-indigo-500"}),"Apenas com nota ≥ 4,5"]})]}),u.jsx("p",{className:"text-[11px] text-gray-400",children:"As opções avançadas aplicam-se ao scraper real (gosom/google-maps-scraper), quando configurado em Ferramentas → Extratores. No modo mock elas são ignoradas."})]})]}),b&&u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden",children:[u.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-100 bg-gray-50/50",children:[u.jsxs("p",{className:"text-sm font-medium text-gray-700",children:[b.length," lead(s) extraído(s) · origem: ",u.jsx("span",{className:"text-indigo-600",children:m})]}),u.jsxs("button",{onClick:()=>e("/crm"),className:"px-5 py-2 text-xs font-medium text-indigo-600 bg-white border border-indigo-200 rounded-lg hover:bg-indigo-50",children:[u.jsx("i",{className:"fas fa-columns mr-1"})," Ir para o CRM"]})]}),u.jsx("div",{className:"overflow-x-auto",children:u.jsxs("table",{className:"w-full text-sm",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"text-left text-xs text-gray-500 uppercase border-b border-gray-100",children:[u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Nome"}),u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Telefone"}),u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Localização"}),u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Avaliação"})]})}),u.jsx("tbody",{children:b.map((_,k)=>{var j;const C=(j=_.extras)==null?void 0:j.avaliacao;return u.jsxs("tr",{className:"border-b border-gray-50 hover:bg-indigo-50/40",children:[u.jsx("td",{className:"px-5 py-2.5 text-gray-800",children:_.nome}),u.jsx("td",{className:"px-5 py-2.5 text-gray-600",children:na(_.telefone)}),u.jsxs("td",{className:"px-5 py-2.5 text-gray-500 text-xs",children:[_.cidade||"—",_.endereco?` · ${_.endereco}`:""]}),u.jsx("td",{className:"px-5 py-2.5 text-xs text-gray-400",children:C!==void 0?u.jsxs(u.Fragment,{children:[u.jsx("i",{className:"fas fa-star text-amber-400 mr-1"}),C]}):"—"})]},_.id||k)})})]})}),u.jsx("div",{className:"px-5 py-3 border-t border-gray-100 bg-gray-50/50",children:u.jsxs("button",{onClick:()=>e("/crm"),className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:[u.jsx("i",{className:"fas fa-arrow-right mr-1"})," Ver todos os leads no CRM Kanban"]})})]})]})}function CE(){const{toast:t}=en(),e=bi(),[n,s]=w.useState(""),[r,i]=w.useState(10),[o,a]=w.useState(!1),[l,c]=w.useState(500),[d,f]=w.useState(!1),[h,p]=w.useState(0),[x,g]=w.useState(null),[b,y]=w.useState(""),m=async()=>{if(!n.includes("instagram.com")){t("erro","Informe a URL do perfil (ex.: https://instagram.com/perfil).");return}f(!0),g(null),p(8);const v=setInterval(()=>{p(S=>S<85?S+Math.ceil((90-S)/6):85)},90);try{const S=await W.extrair.instagram(n.trim(),r);clearInterval(v),p(100),g(S.importados),y(S.origem==="cli"?"igmapper real":"mock de teste");const _=S.duplicados>0?` · ${S.duplicados} duplicados ignorados`:"",k=S.aviso?` · ${S.aviso}`:"";t("sucesso",`${S.importados.length} leads extraídos (${S.origem==="cli"?"igmapper real":"mock"})${_}${k}`)}catch(S){clearInterval(v),p(0),t("erro",S instanceof Error?S.message:"Falha na extração.")}finally{f(!1)}};return u.jsxs("div",{className:"space-y-6 max-w-4xl",children:[u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-5",children:[u.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[u.jsxs("p",{className:"text-sm text-gray-500",children:["Extraia seguidores de um perfil público do Instagram. Sem igmapper configurado, o LeadMaster gera",u.jsx("strong",{children:" dados mockados (5–10 leads)"})," para teste — sem risco de bloqueio de conta."]}),u.jsxs("span",{className:"text-xs shrink-0 text-gray-400",children:[u.jsx("i",{className:"fas fa-shield-halved mr-1"})," perfis públicos"]})]}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[u.jsxs("div",{className:"md:col-span-2",children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"URL do perfil *"}),u.jsx("input",{value:n,onChange:v=>s(v.target.value),placeholder:"https://instagram.com/perfil_do_concorrente/",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"})]}),u.jsxs("div",{children:[u.jsxs("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:["Quantidade de seguidores: ",r]}),u.jsx("input",{type:"range",min:5,max:10,value:r,onChange:v=>i(Number(v.target.value)),className:"w-full accent-indigo-500 mt-2"})]})]}),u.jsxs("button",{onClick:m,disabled:d,className:"w-full md:w-auto px-8 py-3.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 shadow-sm",children:[u.jsx("i",{className:Q("fab fa-instagram mr-2",d&&"fa-spin")}),d?"Buscando seguidores...":"Iniciar Extração"]}),(d||h>0)&&u.jsxs("div",{className:"space-y-1",children:[u.jsx(ra,{valor:h}),u.jsx("p",{className:"text-xs text-indigo-600 font-medium",children:h<100?"Buscando seguidores no Instagram...":"Extração concluída ✓"})]}),u.jsxs(Dt,{titulo:"Configurações avançadas",icone:"fas fa-sliders",children:[u.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-600 bg-gray-50 border border-gray-100 rounded-lg px-3 py-2.5 cursor-pointer",children:[u.jsx("input",{type:"checkbox",checked:o,onChange:v=>a(v.target.checked),className:"w-4 h-4 accent-indigo-500"}),"Extrair apenas contas comerciais"]}),u.jsxs("div",{children:[u.jsxs("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:["Mínimo de seguidores: ",l]}),u.jsx("input",{type:"range",min:100,max:5e3,step:100,value:l,onChange:v=>c(Number(v.target.value)),className:"w-full accent-indigo-500"})]}),u.jsx("p",{className:"text-[11px] text-gray-400",children:"As opções avançadas aplicam-se ao igmapper real (lucasoal/igmapper), quando configurado em Ferramentas → Extratores. No modo mock elas são ignoradas."})]})]}),x&&u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden",children:[u.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-100 bg-gray-50/50",children:[u.jsxs("p",{className:"text-sm font-medium text-gray-700",children:[x.length," lead(s) extraído(s) · origem: ",u.jsx("span",{className:"text-indigo-600",children:b})]}),u.jsxs("button",{onClick:()=>e("/crm"),className:"px-5 py-2 text-xs font-medium text-indigo-600 bg-white border border-indigo-200 rounded-lg hover:bg-indigo-50",children:[u.jsx("i",{className:"fas fa-columns mr-1"})," Ir para o CRM"]})]}),u.jsx("div",{className:"overflow-x-auto",children:u.jsxs("table",{className:"w-full text-sm",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"text-left text-xs text-gray-500 uppercase border-b border-gray-100",children:[u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Nome / Username"}),u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Telefone"}),u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Fonte"}),u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Seguidores"})]})}),u.jsx("tbody",{children:x.map((v,S)=>{var C,j;const _=((C=v.extras)==null?void 0:C.username)||"",k=(j=v.extras)==null?void 0:j.seguidores;return u.jsxs("tr",{className:"border-b border-gray-50 hover:bg-indigo-50/40",children:[u.jsxs("td",{className:"px-5 py-2.5 text-gray-800",children:[v.nome,_&&u.jsxs("span",{className:"text-xs text-gray-400 ml-2",children:["@",_]})]}),u.jsx("td",{className:"px-5 py-2.5 text-gray-600",children:na(v.telefone)}),u.jsx("td",{className:"px-5 py-2.5",children:u.jsx("span",{className:"text-[10px] uppercase tracking-wide bg-pink-50 text-pink-700 px-1.5 py-0.5 rounded font-medium",children:v.fonte})}),u.jsx("td",{className:"px-5 py-2.5 text-xs text-gray-400",children:k!==void 0?k.toLocaleString("pt-BR"):"—"})]},v.id||S)})})]})}),u.jsx("div",{className:"px-5 py-3 border-t border-gray-100 bg-gray-50/50",children:u.jsxs("button",{onClick:()=>e("/crm"),className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:[u.jsx("i",{className:"fas fa-arrow-right mr-1"})," Ver todos os leads no CRM Kanban"]})})]})]})}const jE=["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"];function NE(){const{toast:t}=en(),e=bi(),[n,s]=w.useState(""),[r,i]=w.useState("SP"),[o,a]=w.useState(10),[l,c]=w.useState(""),[d,f]=w.useState(0),[h,p]=w.useState(!1),[x,g]=w.useState(0),[b,y]=w.useState(null),[m,v]=w.useState(""),[S,_]=w.useState(""),[k,C]=w.useState(!1),j=async()=>{if(n.trim().length<2){t("erro","Informe o CNAE (ex.: 6201-5/01 — desenvolvimento de software).");return}p(!0),y(null),g(8);const E=setInterval(()=>{g(R=>R<85?R+Math.ceil((90-R)/6):85)},90);try{const R=await W.extrair.cnpjExtract({cnae:n.trim(),uf:r,limit:o});clearInterval(E),g(100),y(R.importados),v(R.origem==="provedor"?"provedor real":"mock de teste");const M=R.duplicados>0?` · ${R.duplicados} duplicados ignorados`:"",A=R.aviso?` · ${R.aviso}`:"";t("sucesso",`${R.importados.length} empresas extraídas (${R.origem==="provedor"?"provedor real":"mock"})${M}${A}`)}catch(R){clearInterval(E),g(0),t("erro",R instanceof Error?R.message:"Falha na extração.")}finally{p(!1)}},P=async()=>{const E=S.trim();if(E.length<8){t("erro","Informe um CNPJ completo (14 dígitos, com ou sem pontuação).");return}C(!0);try{const R=await W.extrair.cnpj(E),M=await W.leads.importar([R]);t("sucesso",`${M.importados.length} lead(s) importado(s) para "Novos Leads"${M.duplicados.length?` · ${M.duplicados.length} duplicado(s)`:""}.`),_("")}catch(R){t("erro",R instanceof Error?R.message:"Falha ao consultar o CNPJ.")}finally{C(!1)}};return u.jsxs("div",{className:"space-y-6 max-w-4xl",children:[u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-5",children:[u.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[u.jsxs("p",{className:"text-sm text-gray-500",children:["Busque empresas por CNAE e estado. Sem provedor configurado, o LeadMaster gera",u.jsx("strong",{children:" dados mockados (5–10 empresas)"})," para teste — sem risco de bloqueio."]}),u.jsxs("span",{className:"text-xs shrink-0 text-gray-400",children:[u.jsx("i",{className:"fas fa-shield-halved mr-1"})," dados B2B"]})]}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"CNAE *"}),u.jsx("input",{value:n,onChange:E=>s(E.target.value),placeholder:"Ex.: 6201-5/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"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"UF *"}),u.jsx("select",{value:r,onChange:E=>i(E.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 bg-white",children:jE.map(E=>u.jsx("option",{value:E,children:E},E))})]}),u.jsxs("div",{children:[u.jsxs("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:["Quantidade: ",o]}),u.jsx("input",{type:"range",min:5,max:10,value:o,onChange:E=>a(Number(E.target.value)),className:"w-full accent-indigo-500 mt-2"})]})]}),u.jsxs("button",{onClick:j,disabled:h,className:"w-full md:w-auto px-8 py-3.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 shadow-sm",children:[u.jsx("i",{className:Q("fas fa-building mr-2",h&&"fa-spin")}),h?"Buscando empresas...":"Iniciar Extração"]}),(h||x>0)&&u.jsxs("div",{className:"space-y-1",children:[u.jsx(ra,{valor:x}),u.jsx("p",{className:"text-xs text-indigo-600 font-medium",children:x<100?"Buscando empresas por CNAE...":"Extração concluída ✓"})]}),u.jsxs(Dt,{titulo:"Configurações avançadas",icone:"fas fa-sliders",children:[u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Porte da empresa"}),u.jsxs("select",{value:l,onChange:E=>c(E.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 bg-white",children:[u.jsx("option",{value:"",children:"Todos"}),u.jsx("option",{value:"ME",children:"ME (Microempresa)"}),u.jsx("option",{value:"EPP",children:"EPP (Pequeno porte)"}),u.jsx("option",{value:"medio",children:"Médio porte"}),u.jsx("option",{value:"grande",children:"Grande porte"})]})]}),u.jsxs("div",{children:[u.jsxs("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:["Capital social mínimo: ",d.toLocaleString("pt-BR",{style:"currency",currency:"BRL",maximumFractionDigits:0})]}),u.jsx("input",{type:"range",min:0,max:5e6,step:1e5,value:d,onChange:E=>f(Number(E.target.value)),className:"w-full accent-indigo-500"})]})]}),u.jsx("p",{className:"text-[11px] text-gray-400",children:"Os filtros de porte e capital social aplicam-se ao provedor real de busca, quando configurado em Ferramentas → Extratores. No modo mock eles são ignorados."})]}),u.jsxs("div",{className:"pt-1 border-t border-gray-100",children:[u.jsxs("p",{className:"text-xs font-medium text-gray-500 mb-2",children:[u.jsx("i",{className:"fas fa-magnifying-glass mr-1"})," Consulta avulsa por CNPJ (BrasilAPI) — importa uma empresa específica"]}),u.jsxs("div",{className:"flex flex-wrap gap-3",children:[u.jsx("input",{value:S,onChange:E=>_(E.target.value),placeholder:"00.000.000/0000-00",className:"flex-1 min-w-[220px] px-3 py-2.5 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-400 outline-none"}),u.jsxs("button",{onClick:P,disabled:k,className:"px-5 py-2.5 text-xs font-medium text-indigo-600 bg-white border border-indigo-200 rounded-lg hover:bg-indigo-50 disabled:opacity-60",children:[u.jsx("i",{className:Q("fas fa-file-import mr-1",k&&"fa-spin")}),k?"Importando...":"Consultar e importar"]})]})]})]}),b&&u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden",children:[u.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-100 bg-gray-50/50",children:[u.jsxs("p",{className:"text-sm font-medium text-gray-700",children:[b.length," lead(s) extraído(s) · origem: ",u.jsx("span",{className:"text-indigo-600",children:m})]}),u.jsxs("button",{onClick:()=>e("/crm"),className:"px-5 py-2 text-xs font-medium text-indigo-600 bg-white border border-indigo-200 rounded-lg hover:bg-indigo-50",children:[u.jsx("i",{className:"fas fa-columns mr-1"})," Ir para o CRM"]})]}),u.jsx("div",{className:"overflow-x-auto",children:u.jsxs("table",{className:"w-full text-sm",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"text-left text-xs text-gray-500 uppercase border-b border-gray-100",children:[u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Nome Fantasia"}),u.jsx("th",{className:"px-5 py-2 font-semibold",children:"CNPJ"}),u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Cidade / UF"}),u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Telefone"}),u.jsx("th",{className:"px-5 py-2 font-semibold",children:"Fonte"})]})}),u.jsx("tbody",{children:b.map((E,R)=>u.jsxs("tr",{className:"border-b border-gray-50 hover:bg-indigo-50/40",children:[u.jsx("td",{className:"px-5 py-2.5 text-gray-800",children:E.nome}),u.jsx("td",{className:"px-5 py-2.5 text-gray-600 font-mono text-xs",children:E.cnpj||"—"}),u.jsx("td",{className:"px-5 py-2.5 text-gray-500 text-xs",children:E.cidade||"—"}),u.jsx("td",{className:"px-5 py-2.5 text-gray-600",children:na(E.telefone)}),u.jsx("td",{className:"px-5 py-2.5",children:u.jsx("span",{className:"text-[10px] uppercase tracking-wide bg-indigo-50 text-indigo-700 px-1.5 py-0.5 rounded font-medium",children:E.fonte})})]},E.id||R))})]})}),u.jsx("div",{className:"px-5 py-3 border-t border-gray-100 bg-gray-50/50",children:u.jsxs("button",{onClick:()=>e("/crm"),className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:[u.jsx("i",{className:"fas fa-arrow-right mr-1"})," Ver todos os leads no CRM Kanban"]})})]})]})}function EE(){const[t,e]=s_(),n=t.get("tab")||"disparo";return u.jsxs("div",{className:"space-y-6",children:[u.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=>u.jsxs("button",{onClick:()=>e({tab:s.id}),className:Q("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:[u.jsx("i",{className:Q(s.icone,"mr-2")}),s.rotulo]},s.id))}),n==="disparo"?u.jsx(ME,{}):u.jsx(PE,{})]})}function ME(){const{toast:t}=en(),[e,n]=w.useState({texto:"",audio:""}),[s,r]=w.useState("LeadMaster"),[i,o]=w.useState(""),[a,l]=w.useState(!1),[c,d]=w.useState(!1),[f,h]=w.useState(null),p=w.useCallback(async()=>{const[b,y]=await Promise.all([W.agentes.templates(),W.config.obter()]);n({texto:b.texto??"",audio:b.audio??""}),r(y.agentes.disparo.minha_empresa??"LeadMaster"),h(y.integracoes.openoutreach)},[]);w.useEffect(()=>{p().catch(b=>t("erro",b.message))},[p,t]);const x=async()=>{d(!0);try{await W.agentes.salvarTemplates(e),await W.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{d(!1)}},g=async()=>{try{const b=await W.agentes.testarTemplate(e.texto);o(b.renderizado),l(!0)}catch(b){t("erro",b instanceof Error?b.message:"Falha ao renderizar template.")}};return u.jsxs("div",{className:"space-y-5 max-w-3xl",children:[u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-4",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("h3",{className:"text-sm font-semibold text-gray-800",children:"Templates de mensagem"}),u.jsx(_s,{status:f!=null&&f.url&&f.enabled!==!1?"ativo":"inativo",rotulo:f!=null&&f.url&&f.enabled!==!1?"OpenOutreach configurado":"OpenOutreach não configurado"})]}),u.jsxs("p",{className:"text-xs text-gray-500",children:["Variáveis disponíveis: ",u.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"{{nome}}"}),","," ",u.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"{{primeiro_nome}}"}),","," ",u.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"{{empresa}}"}),","," ",u.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"{{cidade}}"}),","," ",u.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"{{minha_empresa}}"}),"."]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Template — texto"}),u.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"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Template — áudio (texto para gravação)"}),u.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"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Nome da sua empresa"}),u.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"})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsxs("button",{onClick:x,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:[u.jsx("i",{className:"fas fa-save mr-2"})," Salvar templates"]}),u.jsxs("button",{onClick:g,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:[u.jsx("i",{className:"fas fa-vial mr-2"})," Testar com lead de exemplo"]})]})]}),u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 text-sm text-gray-500 space-y-2",children:[u.jsx("p",{className:"font-medium text-gray-700 text-xs uppercase tracking-wide",children:"Como funciona"}),u.jsxs("p",{children:["O envio em massa é executado pelo ",u.jsx("strong",{children:"OpenOutreach"})," (eracle/OpenOutreach). As campanhas ficam na página ",u.jsx("strong",{children:"Disparos"}),"; a validação da integração acontece na hora de iniciar a campanha — sem travas de pré-registro."]})]}),u.jsx(Xt,{aberto:a,onFechar:()=>l(!1),titulo:"Pré-visualização do template",icone:"fas fa-comment-dots",children:u.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 PE(){const{toast:t}=en(),[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,d]=w.useState(!1),f=w.useCallback(async()=>{const x=await W.config.obter();n(x.agentes.atendimento.modo==="voz"?"voz":"texto"),r(x.integracoes.pipecat.url||"")},[]);w.useEffect(()=>{f().catch(x=>t("erro",x.message))},[f,t]);const h=async x=>{n(x);try{await W.config.salvar({agentes:{atendimento:{modo:x}},integracoes:{pipecat:{url:s}}}),t("sucesso",`Modo de atendimento: ${x==="voz"?"voz (pipecat)":"texto (LLM)"}.`)}catch(g){t("erro",g instanceof Error?g.message:"Falha ao salvar modo.")}},p=async()=>{const x=a.trim();if(!x)return;const g=[...i,{role:"user",content:x}];o(g),l(""),d(!0);try{const b=await W.agentes.chat(g.map(y=>({role:y.role==="assistant"?"assistant":"user",content:y.content})));b.ok&&b.resposta?o([...g,{role:"assistant",content:b.resposta}]):(o([...g,{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{d(!1)}};return u.jsxs("div",{className:"space-y-5 max-w-3xl",children:[u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-4",children:[u.jsx("h3",{className:"text-sm font-semibold text-gray-800",children:"Modo do agente de atendimento"}),u.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(x=>u.jsxs("button",{onClick:()=>h(x.id),className:Q("flex-1 px-4 py-3 rounded-lg border text-left transition",e===x.id?"bg-indigo-50 border-indigo-400":"bg-white border-gray-200 hover:bg-gray-50"),children:[u.jsxs("p",{className:Q("text-sm font-medium flex items-center gap-2",e===x.id?"text-indigo-700":"text-gray-600"),children:[u.jsx("i",{className:x.icone})," ",x.rotulo]}),u.jsx("p",{className:"text-xs text-gray-400 mt-1",children:x.descricao})]},x.id))}),e==="voz"&&u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"URL do serviço pipecat"}),u.jsx("input",{value:s,onChange:x=>r(x.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"})]})]}),u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6",children:[u.jsx("h3",{className:"text-sm font-semibold text-gray-800 mb-3",children:"Testar conversa"}),u.jsxs("div",{className:"space-y-3 max-h-80 overflow-y-auto mb-4",children:[i.map((x,g)=>u.jsx("div",{className:Q("flex",x.role==="user"?"justify-end":"justify-start"),children:u.jsx("div",{className:Q("max-w-[80%] px-4 py-2.5 rounded-2xl text-sm",x.role==="user"?"bg-indigo-500 text-white rounded-br-sm":"bg-gray-100 text-gray-700 rounded-bl-sm"),children:x.content})},g)),c&&u.jsxs("div",{className:"text-xs text-gray-400 flex items-center gap-2",children:[u.jsx("i",{className:"fas fa-spinner fa-spin"})," pensando..."]})]}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("input",{value:a,onChange:x=>l(x.target.value),onKeyDown:x=>x.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"}),u.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:u.jsx("i",{className:"fas fa-paper-plane"})})]})]})]})}function RE({onConfigSalva:t}){const{toast:e}=en(),[n,s]=w.useState(null),[r,i]=w.useState(!1),[o,a]=w.useState(""),l=w.useCallback(async()=>{const h=await W.config.obter();s(h)},[]);if(w.useEffect(()=>{l().catch(h=>e("erro",h.message))},[l,e]),!n)return u.jsx("div",{className:"text-center text-gray-400 py-16",children:u.jsx("i",{className:"fas fa-spinner fa-spin text-2xl"})});const c=h=>{s(p=>{if(!p)return p;const x=JSON.parse(JSON.stringify(p));return h(x),x})},d=async()=>{i(!0);try{const h=await W.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 W.config.testarLlm();e(h.ok?"sucesso":"erro",h.ok?`LLM respondeu: ${h.resposta}`:h.mensagem??"Falha no teste.")}finally{a("")}};return u.jsxs("div",{className:"space-y-6 max-w-4xl",children:[u.jsxs(Va,{titulo:"LLM (agentes de IA)",icone:"fas fa-brain",children:[u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[u.jsx(an,{rotulo:"Base URL",valor:n.llm.base_url,onChange:h=>c(p=>{p.llm.base_url=h}),placeholder:"https://api.openai.com/v1"}),u.jsx(an,{rotulo:"Modelo",valor:n.llm.modelo,onChange:h=>c(p=>{p.llm.modelo=h}),placeholder:"gpt-4o-mini"}),u.jsx(TE,{rotulo:"API Key",configurado:!!n.llm.api_key_configurado,onChange:h=>c(p=>{p.llm.api_key=h})})]}),u.jsx(DE,{rotulo:"Testar conexão LLM",carregando:o==="llm",onClick:f})]}),u.jsxs(Va,{titulo:"Extratores de leads",icone:"fas fa-magnifying-glass-location",children:[u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[u.jsx(an,{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"}),u.jsx(an,{rotulo:"igmapper — binário",valor:n.extratores.igmapper_cli,onChange:h=>c(p=>{p.extratores.igmapper_cli=h}),placeholder:"Caminho do CLI igmapper"})]}),u.jsxs(Dt,{titulo:"Argumentos dos scrapers (templates)",icone:"fas fa-terminal",children:[u.jsx(bm,{rotulo:"Google Maps — template de argumentos",valor:n.extratores.google_maps_args,onChange:h=>c(p=>{p.extratores.google_maps_args=h}),linhas:2}),u.jsx(bm,{rotulo:"igmapper — template de argumentos",valor:n.extratores.igmapper_args,onChange:h=>c(p=>{p.extratores.igmapper_args=h}),linhas:2})]}),u.jsxs(Dt,{titulo:"CNPJ e Scrapling",icone:"fas fa-building",children:[u.jsx(an,{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"}),u.jsx(an,{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"})]})]}),u.jsxs(Va,{titulo:"Agentes — integrações",icone:"fas fa-robot",children:[u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[u.jsx(an,{rotulo:"OpenOutreach — URL",valor:n.integracoes.openoutreach.url,onChange:h=>c(p=>{p.integracoes.openoutreach.url=h}),placeholder:"http://localhost:9090"}),u.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:[u.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"]})]}),u.jsx(an,{rotulo:"pipecat — URL (atendimento por voz)",valor:n.integracoes.pipecat.url,onChange:h=>c(p=>{p.integracoes.pipecat.url=h}),placeholder:"http://localhost:5000"})]}),u.jsx(Va,{titulo:"Perfil e licença",icone:"fas fa-user",children:u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[u.jsx(an,{rotulo:"Seu nome",valor:n.perfil.nome,onChange:h=>c(p=>{p.perfil.nome=h})}),u.jsx(an,{rotulo:"Expira em",valor:n.perfil.licenca.expira_em,onChange:h=>c(p=>{p.perfil.licenca.expira_em=h})}),u.jsx(OE,{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})})]})}),u.jsx("div",{className:"flex justify-end",children:u.jsxs("button",{onClick:d,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:[u.jsx("i",{className:Q("fas fa-save mr-2",r&&"fa-spin")}),r?"Salvando...":"Salvar configurações"]})})]})}function Va({titulo:t,icone:e,children:n}){return u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-4",children:[u.jsxs("h3",{className:"text-sm font-semibold text-gray-800 flex items-center gap-2",children:[u.jsx("i",{className:Q(e,"text-indigo-400")})," ",t]}),n]})}function an({rotulo:t,valor:e,onChange:n,placeholder:s,tipo:r="text"}){return u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:t}),u.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 OE({rotulo:t,valor:e,onChange:n}){return u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:t}),u.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 TE({rotulo:t,configurado:e,onChange:n}){return u.jsxs("div",{children:[u.jsxs("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:[t," ",e&&u.jsx("span",{className:"text-green-600",children:"• configurado"})]}),u.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 bm({rotulo:t,valor:e,onChange:n,linhas:s=3}){return u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:t}),u.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 DE({rotulo:t,onClick:e,carregando:n}){return u.jsxs("button",{onClick:e,disabled:n,className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium disabled:opacity-50",children:[u.jsx("i",{className:Q("fas fa-vial-circle-check mr-1",n&&"fa-spin")})," ",t]})}const LE=[{id:"lead.criado",rotulo:"Lead criado"},{id:"lead.etapa",rotulo:"Lead mudou de etapa"},{id:"campanha.concluida",rotulo:"Campanha concluída"}];function AE(){const{toast:t}=en(),[e,n]=w.useState(""),[s,r]=w.useState(new Set),[i,o]=w.useState(""),[a,l]=w.useState(!1),[c,d]=w.useState(!1),f=w.useCallback(async()=>{const g=await W.webhook.obter();n(g.url),r(new Set(g.eventos))},[]);w.useEffect(()=>{f().catch(g=>t("erro",g.message))},[f,t]);const h=g=>r(b=>{const y=new Set(b);return y.has(g)?y.delete(g):y.add(g),y}),p=async()=>{d(!0);try{await W.webhook.salvar({url:e.trim(),eventos:[...s]}),t("sucesso","Webhook salvo.")}catch(g){t("erro",g instanceof Error?g.message:"Falha ao salvar webhook.")}finally{d(!1)}},x=async()=>{if(!e.trim()){t("erro","Informe a URL do webhook antes de testar.");return}try{const g=await W.webhook.testar(e.trim());g.ok?o(`✅ HTTP ${g.status_http} — o endpoint recebeu o evento de teste.
89
89
 
90
- ${g.resposta??""}`):o(`❌ ${g.mensagem??"Falha no teste."}`),l(!0)}catch(g){t("erro",g instanceof Error?g.message:"Falha no teste.")}};return u.jsxs("div",{className:"space-y-6 max-w-3xl",children:[u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-5",children:[u.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.)."}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"URL do webhook"}),u.jsx("input",{value:e,onChange:g=>n(g.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"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-2",children:"Eventos enviados"}),u.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:AE.map(g=>u.jsxs("label",{className:H("flex items-center gap-3 px-4 py-3 rounded-lg border text-sm cursor-pointer transition",s.has(g.id)?"bg-indigo-50 border-indigo-300 text-indigo-700":"bg-white border-gray-200 text-gray-500 hover:bg-gray-50"),children:[u.jsx("input",{type:"checkbox",checked:s.has(g.id),onChange:()=>h(g.id),className:"w-4 h-4 accent-indigo-500"}),g.rotulo,u.jsx("code",{className:"text-[10px] text-gray-400 ml-auto",children:g.id})]},g.id))})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.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:[u.jsx("i",{className:"fas fa-save mr-2"})," Salvar"]}),u.jsxs("button",{onClick:x,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:[u.jsx("i",{className:"fas fa-paper-plane mr-2"})," Enviar evento de teste"]})]})]}),u.jsx(Xt,{aberto:a,onFechar:()=>l(!1),titulo:"Resultado do teste",icone:"fas fa-satellite-dish",children:u.jsx("pre",{className:"text-xs text-gray-600 bg-gray-50 rounded-lg p-4 whitespace-pre-wrap",children:i})})]})}function FE(){const{toast:t}=en(),[e,n]=w.useState(null),[s,r]=w.useState(!1),i=async()=>{r(!0);try{n(await W.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()},[]),u.jsxs("div",{className:"space-y-6 max-w-3xl",children:[u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("h3",{className:"text-sm font-semibold text-gray-800 flex items-center gap-2",children:[u.jsx("i",{className:"fas fa-heart-pulse text-indigo-400"})," Diagnóstico do ambiente"]}),u.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:[u.jsx("i",{className:H("fas fa-rotate mr-1",s&&"fa-spin")})," Executar novamente"]})]}),e&&u.jsxs("div",{className:"mt-4 space-y-2 text-sm",children:[u.jsx(Hi,{rotulo:"Versão do LeadMaster",valor:e.versao}),u.jsx(Hi,{rotulo:"Python",valor:e.python}),u.jsx(Hi,{rotulo:"Sistema",valor:e.sistema}),u.jsx(Hi,{rotulo:"Interface construída (dist)",valor:e.dist_frontend?"presente":"ausente (modo dev)"}),u.jsx(Hi,{rotulo:"Pasta de dados",valor:e.storage}),u.jsx("div",{className:"pt-2 flex flex-wrap gap-2",children:Object.entries(e.integracoes).map(([o,a])=>u.jsx(_s,{status:a?"ativo":"inativo",rotulo:`${zE(o)}: ${a?"ativo":"inativo"}`},o))})]})]}),u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6",children:[u.jsxs("h3",{className:"text-sm font-semibold text-gray-800 mb-3",children:[u.jsx("i",{className:"fas fa-circle-question text-indigo-400 mr-2"})," Perguntas frequentes"]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(Tt,{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."}),u.jsx(Tt,{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."}),u.jsx(Tt,{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."}),u.jsx(Tt,{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."})]})]}),u.jsxs("div",{className:"bg-[#1e1b4b] text-white rounded-xl p-6 flex items-center justify-between flex-wrap gap-4",children:[u.jsxs("div",{children:[u.jsx("p",{className:"text-sm font-semibold",children:"LeadMaster — SaaS local de prospecção e automação de conteúdo"}),u.jsx("p",{className:"text-xs text-gray-300 mt-1",children:"Instalável via npx · dados 100% locais · sem mensalidade de nuvem"})]}),u.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:[u.jsx("i",{className:"fab fa-github mr-2"})," Repositório"]})]})]})}function Hi({rotulo:t,valor:e}){return u.jsxs("div",{className:"flex items-center justify-between border-b border-gray-50 pb-2",children:[u.jsx("span",{className:"text-xs text-gray-500",children:t}),u.jsx("span",{className:"text-xs font-medium text-gray-700 text-right break-all max-w-[60%]",children:e})]})}function zE(t){return{llm_configurado:"LLM",openoutreach:"OpenOutreach",pipecat:"pipecat"}[t]??t}const BE={"/":"Painel","/leads":"Leads","/agentes":"Agentes","/ferramentas":"Ferramentas","/extratores":"Extratores de Leads","/extrator-maps":"Extrator de Leads — Google Maps","/extrator-instagram":"Extrator de Leads — Instagram","/disparos":"Disparos","/crm":"CRM — Kanban","/webhook":"Webhook","/suporte":"Suporte"};function $E(){const[t,e]=w.useState(null),[n,s]=w.useState(!1),[r,i]=w.useState(!1),o=w.useCallback(async()=>{try{e(await W.config.obter())}catch{}},[]);return w.useEffect(()=>{o()},[o]),r?u.jsx("div",{className:"min-h-screen bg-[#1e1b4b] text-white flex items-center justify-center p-8",children:u.jsxs("div",{className:"text-center max-w-md",children:[u.jsx("i",{className:"fas fa-power-off text-4xl text-indigo-300 mb-4 block"}),u.jsx("h1",{className:"text-xl font-bold",children:"LeadMaster encerrado"}),u.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."}),u.jsxs("p",{className:"text-xs text-gray-400 mt-6",children:["Para voltar, execute: ",u.jsx("code",{className:"bg-white/10 px-2 py-1 rounded",children:"npx --yes @danhachuel/leadmaster"})]})]})}):u.jsx(v_,{children:u.jsxs(JS,{children:[u.jsx(UE,{nomeUsuario:(t==null?void 0:t.perfil.nome)??"...",onSair:()=>s(!0),onConfigSalva:a=>e(a)}),u.jsxs(Xt,{aberto:n,onFechar:()=>s(!1),titulo:"Encerrar o LeadMaster",icone:"fas fa-power-off",children:[u.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?"}),u.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[u.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"}),u.jsxs("button",{onClick:async()=>{s(!1);try{await W.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:[u.jsx("i",{className:"fas fa-power-off mr-2"})," Encerrar"]})]})]})]})})}function UE({nomeUsuario:t,onSair:e,onConfigSalva:n}){const s=Ds(),r=BE[s.pathname]??"LeadMaster";return u.jsxs("div",{className:"bg-gray-100 min-h-screen flex",children:[u.jsx(m_,{onSair:e}),u.jsxs("main",{className:"flex-1 flex flex-col min-w-0",children:[u.jsx(p_,{titulo:r,nomeUsuario:t}),u.jsxs("div",{className:"p-8 space-y-6 overflow-y-auto flex-1",children:[u.jsxs(WS,{children:[u.jsx(Et,{path:"/",element:u.jsx(gN,{nomeUsuario:t})}),u.jsx(Et,{path:"/leads",element:u.jsx(bN,{})}),u.jsx(Et,{path:"/crm",element:u.jsx(vE,{})}),u.jsx(Et,{path:"/disparos",element:u.jsx(bE,{})}),u.jsx(Et,{path:"/extratores",element:u.jsx(_E,{})}),u.jsx(Et,{path:"/extrator-maps",element:u.jsx(NE,{})}),u.jsx(Et,{path:"/extrator-instagram",element:u.jsx(EE,{})}),u.jsx(Et,{path:"/agentes",element:u.jsx(ME,{})}),u.jsx(Et,{path:"/ferramentas",element:u.jsx(OE,{onConfigSalva:n})}),u.jsx(Et,{path:"/webhook",element:u.jsx(IE,{})}),u.jsx(Et,{path:"/suporte",element:u.jsx(FE,{})})]}),u.jsxs("footer",{className:"flex items-center justify-between text-xs text-gray-400 pt-4 border-t border-gray-200",children:[u.jsx("span",{children:"© 2026 LeadMaster. Todos os direitos reservados."}),u.jsx("span",{children:"Dados 100% locais — sem nuvem"})]})]})]})]})}const WE=new H1({defaultOptions:{queries:{retry:1,staleTime:5e3,refetchOnWindowFocus:!0}}});_u.createRoot(document.getElementById("root")).render(u.jsx(pe.StrictMode,{children:u.jsx(y1,{client:WE,children:u.jsx($E,{})})}));
90
+ ${g.resposta??""}`):o(`❌ ${g.mensagem??"Falha no teste."}`),l(!0)}catch(g){t("erro",g instanceof Error?g.message:"Falha no teste.")}};return u.jsxs("div",{className:"space-y-6 max-w-3xl",children:[u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6 space-y-5",children:[u.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.)."}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"URL do webhook"}),u.jsx("input",{value:e,onChange:g=>n(g.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"})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-2",children:"Eventos enviados"}),u.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:LE.map(g=>u.jsxs("label",{className:Q("flex items-center gap-3 px-4 py-3 rounded-lg border text-sm cursor-pointer transition",s.has(g.id)?"bg-indigo-50 border-indigo-300 text-indigo-700":"bg-white border-gray-200 text-gray-500 hover:bg-gray-50"),children:[u.jsx("input",{type:"checkbox",checked:s.has(g.id),onChange:()=>h(g.id),className:"w-4 h-4 accent-indigo-500"}),g.rotulo,u.jsx("code",{className:"text-[10px] text-gray-400 ml-auto",children:g.id})]},g.id))})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.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:[u.jsx("i",{className:"fas fa-save mr-2"})," Salvar"]}),u.jsxs("button",{onClick:x,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:[u.jsx("i",{className:"fas fa-paper-plane mr-2"})," Enviar evento de teste"]})]})]}),u.jsx(Xt,{aberto:a,onFechar:()=>l(!1),titulo:"Resultado do teste",icone:"fas fa-satellite-dish",children:u.jsx("pre",{className:"text-xs text-gray-600 bg-gray-50 rounded-lg p-4 whitespace-pre-wrap",children:i})})]})}function IE(){const{toast:t}=en(),[e,n]=w.useState(null),[s,r]=w.useState(!1),i=async()=>{r(!0);try{n(await W.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()},[]),u.jsxs("div",{className:"space-y-6 max-w-3xl",children:[u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("h3",{className:"text-sm font-semibold text-gray-800 flex items-center gap-2",children:[u.jsx("i",{className:"fas fa-heart-pulse text-indigo-400"})," Diagnóstico do ambiente"]}),u.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:[u.jsx("i",{className:Q("fas fa-rotate mr-1",s&&"fa-spin")})," Executar novamente"]})]}),e&&u.jsxs("div",{className:"mt-4 space-y-2 text-sm",children:[u.jsx(Vi,{rotulo:"Versão do LeadMaster",valor:e.versao}),u.jsx(Vi,{rotulo:"Python",valor:e.python}),u.jsx(Vi,{rotulo:"Sistema",valor:e.sistema}),u.jsx(Vi,{rotulo:"Interface construída (dist)",valor:e.dist_frontend?"presente":"ausente (modo dev)"}),u.jsx(Vi,{rotulo:"Pasta de dados",valor:e.storage}),u.jsx("div",{className:"pt-2 flex flex-wrap gap-2",children:Object.entries(e.integracoes).map(([o,a])=>u.jsx(_s,{status:a?"ativo":"inativo",rotulo:`${FE(o)}: ${a?"ativo":"inativo"}`},o))})]})]}),u.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6",children:[u.jsxs("h3",{className:"text-sm font-semibold text-gray-800 mb-3",children:[u.jsx("i",{className:"fas fa-circle-question text-indigo-400 mr-2"})," Perguntas frequentes"]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(Dt,{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."}),u.jsx(Dt,{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."}),u.jsx(Dt,{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."}),u.jsx(Dt,{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."})]})]}),u.jsxs("div",{className:"bg-[#1e1b4b] text-white rounded-xl p-6 flex items-center justify-between flex-wrap gap-4",children:[u.jsxs("div",{children:[u.jsx("p",{className:"text-sm font-semibold",children:"LeadMaster — SaaS local de prospecção e automação de conteúdo"}),u.jsx("p",{className:"text-xs text-gray-300 mt-1",children:"Instalável via npx · dados 100% locais · sem mensalidade de nuvem"})]}),u.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:[u.jsx("i",{className:"fab fa-github mr-2"})," Repositório"]})]})]})}function Vi({rotulo:t,valor:e}){return u.jsxs("div",{className:"flex items-center justify-between border-b border-gray-50 pb-2",children:[u.jsx("span",{className:"text-xs text-gray-500",children:t}),u.jsx("span",{className:"text-xs font-medium text-gray-700 text-right break-all max-w-[60%]",children:e})]})}function FE(t){return{llm_configurado:"LLM",openoutreach:"OpenOutreach",pipecat:"pipecat"}[t]??t}const zE={"/":"Painel","/leads":"Leads","/agentes":"Agentes","/ferramentas":"Ferramentas","/extratores":"Extratores de Leads","/extrator-maps":"Extrator de Leads — Google Maps","/extrator-instagram":"Extrator de Leads — Instagram","/extrator-cnpj":"Extrator de Leads — CNPJ","/disparos":"Disparos","/crm":"CRM — Kanban","/webhook":"Webhook","/suporte":"Suporte"};function BE(){const[t,e]=w.useState(null),[n,s]=w.useState(!1),[r,i]=w.useState(!1),o=w.useCallback(async()=>{try{e(await W.config.obter())}catch{}},[]);return w.useEffect(()=>{o()},[o]),r?u.jsx("div",{className:"min-h-screen bg-[#1e1b4b] text-white flex items-center justify-center p-8",children:u.jsxs("div",{className:"text-center max-w-md",children:[u.jsx("i",{className:"fas fa-power-off text-4xl text-indigo-300 mb-4 block"}),u.jsx("h1",{className:"text-xl font-bold",children:"LeadMaster encerrado"}),u.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."}),u.jsxs("p",{className:"text-xs text-gray-400 mt-6",children:["Para voltar, execute: ",u.jsx("code",{className:"bg-white/10 px-2 py-1 rounded",children:"npx --yes @danhachuel/leadmaster"})]})]})}):u.jsx(v_,{children:u.jsxs(GS,{children:[u.jsx($E,{nomeUsuario:(t==null?void 0:t.perfil.nome)??"...",onSair:()=>s(!0),onConfigSalva:a=>e(a)}),u.jsxs(Xt,{aberto:n,onFechar:()=>s(!1),titulo:"Encerrar o LeadMaster",icone:"fas fa-power-off",children:[u.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?"}),u.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[u.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"}),u.jsxs("button",{onClick:async()=>{s(!1);try{await W.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:[u.jsx("i",{className:"fas fa-power-off mr-2"})," Encerrar"]})]})]})]})})}function $E({nomeUsuario:t,onSair:e,onConfigSalva:n}){const s=Ts(),r=zE[s.pathname]??"LeadMaster";return u.jsxs("div",{className:"bg-gray-100 min-h-screen flex",children:[u.jsx(m_,{onSair:e}),u.jsxs("main",{className:"flex-1 flex flex-col min-w-0",children:[u.jsx(p_,{titulo:r,nomeUsuario:t}),u.jsxs("div",{className:"p-8 space-y-6 overflow-y-auto flex-1",children:[u.jsxs(US,{children:[u.jsx(yt,{path:"/",element:u.jsx(gN,{nomeUsuario:t})}),u.jsx(yt,{path:"/leads",element:u.jsx(bN,{})}),u.jsx(yt,{path:"/crm",element:u.jsx(vE,{})}),u.jsx(yt,{path:"/disparos",element:u.jsx(bE,{})}),u.jsx(yt,{path:"/extratores",element:u.jsx(_E,{})}),u.jsx(yt,{path:"/extrator-maps",element:u.jsx(kE,{})}),u.jsx(yt,{path:"/extrator-instagram",element:u.jsx(CE,{})}),u.jsx(yt,{path:"/extrator-cnpj",element:u.jsx(NE,{})}),u.jsx(yt,{path:"/agentes",element:u.jsx(EE,{})}),u.jsx(yt,{path:"/ferramentas",element:u.jsx(RE,{onConfigSalva:n})}),u.jsx(yt,{path:"/webhook",element:u.jsx(AE,{})}),u.jsx(yt,{path:"/suporte",element:u.jsx(IE,{})})]}),u.jsxs("footer",{className:"flex items-center justify-between text-xs text-gray-400 pt-4 border-t border-gray-200",children:[u.jsx("span",{children:"© 2026 LeadMaster. Todos os direitos reservados."}),u.jsx("span",{children:"Dados 100% locais — sem nuvem"})]})]})]})]})}const UE=new W1({defaultOptions:{queries:{retry:1,staleTime:5e3,refetchOnWindowFocus:!0}}});_u.createRoot(document.getElementById("root")).render(u.jsx(pe.StrictMode,{children:u.jsx(x1,{client:UE,children:u.jsx(BE,{})})}));