pulsewatch-frontend 0.1.1 → 0.1.3

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 (66) hide show
  1. package/dist/PulsePage.d.ts +7 -0
  2. package/dist/api.d.ts +1 -0
  3. package/dist/components/ui/SessionTimeoutDialog.d.ts +6 -0
  4. package/dist/components/ui/alert-dialog.d.ts +14 -0
  5. package/dist/components/ui/alert.d.ts +9 -0
  6. package/dist/components/ui/avatar-group.d.ts +11 -0
  7. package/dist/components/ui/avatar.d.ts +6 -0
  8. package/dist/components/ui/badge.d.ts +9 -0
  9. package/dist/components/ui/button.d.ts +10 -0
  10. package/dist/components/ui/calendar.d.ts +8 -0
  11. package/dist/components/ui/card.d.ts +9 -0
  12. package/dist/components/ui/checkbox.d.ts +4 -0
  13. package/dist/components/ui/collapsible.d.ts +5 -0
  14. package/dist/components/ui/command.d.ts +18 -0
  15. package/dist/components/ui/copy-button.d.ts +5 -0
  16. package/dist/components/ui/dialog.d.ts +15 -0
  17. package/dist/components/ui/dropdown-menu.d.ts +25 -0
  18. package/dist/components/ui/form.d.ts +26 -0
  19. package/dist/components/ui/input-otp.d.ts +11 -0
  20. package/dist/components/ui/input.d.ts +3 -0
  21. package/dist/components/ui/label.d.ts +4 -0
  22. package/dist/components/ui/multi-select.d.ts +13 -0
  23. package/dist/components/ui/popover.d.ts +7 -0
  24. package/dist/components/ui/radio-group.d.ts +5 -0
  25. package/dist/components/ui/scroll-area.d.ts +8 -0
  26. package/dist/components/ui/select.d.ts +15 -0
  27. package/dist/components/ui/separator.d.ts +4 -0
  28. package/dist/components/ui/sheet.d.ts +13 -0
  29. package/dist/components/ui/sidebar.d.ts +69 -0
  30. package/dist/components/ui/skeleton.d.ts +2 -0
  31. package/dist/components/ui/sonner.d.ts +2 -0
  32. package/dist/components/ui/switch.d.ts +4 -0
  33. package/dist/components/ui/table.d.ts +10 -0
  34. package/dist/components/ui/tabs.d.ts +7 -0
  35. package/dist/components/ui/textarea.d.ts +3 -0
  36. package/dist/components/ui/tooltip.d.ts +7 -0
  37. package/dist/hooks/use-dialog-state.d.ts +7 -0
  38. package/dist/hooks/use-mobile.d.ts +1 -0
  39. package/dist/hooks/use-table-url-state.d.ts +54 -0
  40. package/dist/index.d.ts +6 -0
  41. package/dist/index.js +100 -8
  42. package/dist/index.mjs +23412 -11860
  43. package/dist/lib/cookies.d.ts +16 -0
  44. package/dist/lib/handle-server-error.d.ts +1 -0
  45. package/dist/lib/show-submitted-data.d.ts +1 -0
  46. package/dist/lib/utils/error.d.ts +1 -0
  47. package/dist/lib/utils.d.ts +17 -0
  48. package/dist/lib/validation/account-schema.d.ts +8 -0
  49. package/dist/lib/validation/auth-schema.d.ts +6 -0
  50. package/dist/lib/validation/permission-schema.d.ts +10 -0
  51. package/dist/lib/validation/profile-schema.d.ts +8 -0
  52. package/dist/lib/validation/request-schema.d.ts +7 -0
  53. package/dist/lib/validation/sso-schema.d.ts +18 -0
  54. package/dist/lib/validation/teams-schema.d.ts +7 -0
  55. package/dist/lib/validation/user-schema.d.ts +6 -0
  56. package/dist/pulsewatch-frontend.css +1 -1
  57. package/dist/services/monitor.d.ts +10 -0
  58. package/dist/store/hooks.d.ts +14 -0
  59. package/dist/store/index.d.ts +25 -0
  60. package/dist/store/slices/monitorSlice.d.ts +30 -0
  61. package/dist/types.d.ts +27 -0
  62. package/dist/ui/components/MonitorCard.d.ts +12 -0
  63. package/dist/ui/components/MonitorDeleteDialog.d.ts +9 -0
  64. package/dist/ui/components/MonitorFormDialog.d.ts +36 -0
  65. package/dist/ui/pages/MonitorListPage.d.ts +1 -0
  66. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,13 +1,105 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("react"),xd=require("react-dom");function _p(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const Q=_p(L);var Si={exports:{}},vn={};var bl;function wp(){if(bl)return vn;bl=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(n,i,r){var o=null;if(r!==void 0&&(o=""+r),i.key!==void 0&&(o=""+i.key),"key"in i){r={};for(var a in i)a!=="key"&&(r[a]=i[a])}else r=i;return i=r.ref,{$$typeof:e,type:n,key:o,ref:i!==void 0?i:null,props:r}}return vn.Fragment=t,vn.jsx=s,vn.jsxs=s,vn}var _n={};var yl;function Sp(){return yl||(yl=1,process.env.NODE_ENV!=="production"&&(function(){function e(M){if(M==null)return null;if(typeof M=="function")return M.$$typeof===j?null:M.displayName||M.name||null;if(typeof M=="string")return M;switch(M){case g:return"Fragment";case x:return"Profiler";case b:return"StrictMode";case P:return"Suspense";case R:return"SuspenseList";case N:return"Activity"}if(typeof M=="object")switch(typeof M.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),M.$$typeof){case m:return"Portal";case v:return M.displayName||"Context";case w:return(M._context.displayName||"Context")+".Consumer";case S:var Y=M.render;return M=M.displayName,M||(M=Y.displayName||Y.name||"",M=M!==""?"ForwardRef("+M+")":"ForwardRef"),M;case _:return Y=M.displayName||null,Y!==null?Y:e(M.type)||"Memo";case C:Y=M._payload,M=M._init;try{return e(M(Y))}catch{}}return null}function t(M){return""+M}function s(M){try{t(M);var Y=!1}catch{Y=!0}if(Y){Y=console;var B=Y.error,U=typeof Symbol=="function"&&Symbol.toStringTag&&M[Symbol.toStringTag]||M.constructor.name||"Object";return B.call(Y,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",U),t(M)}}function n(M){if(M===g)return"<>";if(typeof M=="object"&&M!==null&&M.$$typeof===C)return"<...>";try{var Y=e(M);return Y?"<"+Y+">":"<...>"}catch{return"<...>"}}function i(){var M=A.A;return M===null?null:M.getOwner()}function r(){return Error("react-stack-top-frame")}function o(M){if(F.call(M,"key")){var Y=Object.getOwnPropertyDescriptor(M,"key").get;if(Y&&Y.isReactWarning)return!1}return M.key!==void 0}function a(M,Y){function B(){I||(I=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",Y))}B.isReactWarning=!0,Object.defineProperty(M,"key",{get:B,configurable:!0})}function l(){var M=e(this.type);return q[M]||(q[M]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),M=this.props.ref,M!==void 0?M:null}function c(M,Y,B,U,et,ft){var Z=B.ref;return M={$$typeof:p,type:M,key:Y,props:B,_owner:U},(Z!==void 0?Z:null)!==null?Object.defineProperty(M,"ref",{enumerable:!1,get:l}):Object.defineProperty(M,"ref",{enumerable:!1,value:null}),M._store={},Object.defineProperty(M._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(M,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(M,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:et}),Object.defineProperty(M,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ft}),Object.freeze&&(Object.freeze(M.props),Object.freeze(M)),M}function u(M,Y,B,U,et,ft){var Z=Y.children;if(Z!==void 0)if(U)if(V(Z)){for(U=0;U<Z.length;U++)d(Z[U]);Object.freeze&&Object.freeze(Z)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else d(Z);if(F.call(Y,"key")){Z=e(M);var it=Object.keys(Y).filter(function(Ot){return Ot!=="key"});U=0<it.length?"{key: someKey, "+it.join(": ..., ")+": ...}":"{key: someKey}",dt[Z+U]||(it=0<it.length?"{"+it.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react"),Dc=require("react-dom");function lb(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const v=lb(T),Ic=lb(Dc);var ji={exports:{}},lo={};var Vh;function oE(){if(Vh)return lo;Vh=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,o){var i=null;if(o!==void 0&&(i=""+o),s.key!==void 0&&(i=""+s.key),"key"in s){o={};for(var a in s)a!=="key"&&(o[a]=s[a])}else o=s;return s=o.ref,{$$typeof:e,type:r,key:i,ref:s!==void 0?s:null,props:o}}return lo.Fragment=t,lo.jsx=n,lo.jsxs=n,lo}var uo={};var Bh;function iE(){return Bh||(Bh=1,process.env.NODE_ENV!=="production"&&(function(){function e(I){if(I==null)return null;if(typeof I=="function")return I.$$typeof===N?null:I.displayName||I.name||null;if(typeof I=="string")return I;switch(I){case y:return"Fragment";case x:return"Profiler";case b:return"StrictMode";case C:return"Suspense";case k:return"SuspenseList";case O:return"Activity"}if(typeof I=="object")switch(typeof I.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),I.$$typeof){case m:return"Portal";case w:return I.displayName||"Context";case _:return(I._context.displayName||"Context")+".Consumer";case S:var Y=I.render;return I=I.displayName,I||(I=Y.displayName||Y.name||"",I=I!==""?"ForwardRef("+I+")":"ForwardRef"),I;case E:return Y=I.displayName||null,Y!==null?Y:e(I.type)||"Memo";case P:Y=I._payload,I=I._init;try{return e(I(Y))}catch{}}return null}function t(I){return""+I}function n(I){try{t(I);var Y=!1}catch{Y=!0}if(Y){Y=console;var K=Y.error,Z=typeof Symbol=="function"&&Symbol.toStringTag&&I[Symbol.toStringTag]||I.constructor.name||"Object";return K.call(Y,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Z),t(I)}}function r(I){if(I===y)return"<>";if(typeof I=="object"&&I!==null&&I.$$typeof===P)return"<...>";try{var Y=e(I);return Y?"<"+Y+">":"<...>"}catch{return"<...>"}}function s(){var I=A.A;return I===null?null:I.getOwner()}function o(){return Error("react-stack-top-frame")}function i(I){if(j.call(I,"key")){var Y=Object.getOwnPropertyDescriptor(I,"key").get;if(Y&&Y.isReactWarning)return!1}return I.key!==void 0}function a(I,Y){function K(){D||(D=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",Y))}K.isReactWarning=!0,Object.defineProperty(I,"key",{get:K,configurable:!0})}function c(){var I=e(this.type);return H[I]||(H[I]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),I=this.props.ref,I!==void 0?I:null}function l(I,Y,K,Z,oe,ce){var V=K.ref;return I={$$typeof:p,type:I,key:Y,props:K,_owner:Z},(V!==void 0?V:null)!==null?Object.defineProperty(I,"ref",{enumerable:!1,get:c}):Object.defineProperty(I,"ref",{enumerable:!1,value:null}),I._store={},Object.defineProperty(I._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(I,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(I,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:oe}),Object.defineProperty(I,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ce}),Object.freeze&&(Object.freeze(I.props),Object.freeze(I)),I}function u(I,Y,K,Z,oe,ce){var V=Y.children;if(V!==void 0)if(Z)if($(V)){for(Z=0;Z<V.length;Z++)d(V[Z]);Object.freeze&&Object.freeze(V)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else d(V);if(j.call(Y,"key")){V=e(I);var ee=Object.keys(Y).filter(function(le){return le!=="key"});Z=0<ee.length?"{key: someKey, "+ee.join(": ..., ")+": ...}":"{key: someKey}",se[V+Z]||(ee=0<ee.length?"{"+ee.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,U,Z,it,Z),dt[Z+U]=!0)}if(Z=null,B!==void 0&&(s(B),Z=""+B),o(Y)&&(s(Y.key),Z=""+Y.key),"key"in Y){B={};for(var kt in Y)kt!=="key"&&(B[kt]=Y[kt])}else B=Y;return Z&&a(B,typeof M=="function"?M.displayName||M.name||"Unknown":M),c(M,Z,B,i(),et,ft)}function d(M){h(M)?M._store&&(M._store.validated=1):typeof M=="object"&&M!==null&&M.$$typeof===C&&(M._payload.status==="fulfilled"?h(M._payload.value)&&M._payload.value._store&&(M._payload.value._store.validated=1):M._store&&(M._store.validated=1))}function h(M){return typeof M=="object"&&M!==null&&M.$$typeof===p}var f=L,p=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),v=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),j=Symbol.for("react.client.reference"),A=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,V=Array.isArray,W=console.createTask?console.createTask:function(){return null};f={react_stack_bottom_frame:function(M){return M()}};var I,q={},z=f.react_stack_bottom_frame.bind(f,r)(),rt=W(n(r)),dt={};_n.Fragment=g,_n.jsx=function(M,Y,B){var U=1e4>A.recentlyCreatedOwnerStacks++;return u(M,Y,B,!1,U?Error("react-stack-top-frame"):z,U?W(n(M)):rt)},_n.jsxs=function(M,Y,B){var U=1e4>A.recentlyCreatedOwnerStacks++;return u(M,Y,B,!0,U?Error("react-stack-top-frame"):z,U?W(n(M)):rt)}})()),_n}var xl;function kp(){return xl||(xl=1,process.env.NODE_ENV==="production"?Si.exports=wp():Si.exports=Sp()),Si.exports}var y=kp();const Fo=new WeakMap,Rp=new WeakMap,lr={current:[]};let Qr=!1,Hn=0;const Fn=new Set,ki=new Map;function vd(e){for(const t of e){if(lr.current.includes(t))continue;lr.current.push(t),t.recompute();const s=Rp.get(t);if(s)for(const n of s){const i=Fo.get(n);i?.length&&vd(i)}}}function Pp(e){const t={prevVal:e.prevState,currentVal:e.state};for(const s of e.listeners)s(t)}function Ep(e){const t={prevVal:e.prevState,currentVal:e.state};for(const s of e.listeners)s(t)}function _d(e){if(Hn>0&&!ki.has(e)&&ki.set(e,e.prevState),Fn.add(e),!(Hn>0)&&!Qr)try{for(Qr=!0;Fn.size>0;){const t=Array.from(Fn);Fn.clear();for(const s of t){const n=ki.get(s)??s.prevState;s.prevState=n,Pp(s)}for(const s of t){const n=Fo.get(s);n&&(lr.current.push(s),vd(n))}for(const s of t){const n=Fo.get(s);if(n)for(const i of n)Ep(i)}}}finally{Qr=!1,lr.current=[],ki.clear()}}function Cp(e){Hn++;try{e()}finally{if(Hn--,Hn===0){const t=Fn.values().next().value;t&&_d(t)}}}function Op(e){return typeof e=="function"}class Tp{constructor(t,s){this.listeners=new Set,this.subscribe=n=>{var i,r;this.listeners.add(n);const o=(r=(i=this.options)==null?void 0:i.onSubscribe)==null?void 0:r.call(i,n,this);return()=>{this.listeners.delete(n),o?.()}},this.prevState=t,this.state=t,this.options=s}setState(t){var s,n,i;this.prevState=this.state,(s=this.options)!=null&&s.updateFn?this.state=this.options.updateFn(this.prevState)(t):Op(t)?this.state=t(this.prevState):this.state=t,(i=(n=this.options)==null?void 0:n.onUpdate)==null||i.call(n),_d(this)}}const us="__TSR_index",vl="popstate",_l="beforeunload";function Mp(e){let t=e.getLocation();const s=new Set,n=o=>{t=e.getLocation(),s.forEach(a=>a({location:t,action:o}))},i=o=>{e.notifyOnIndexChange??!0?n(o):t=e.getLocation()},r=async({task:o,navigateOpts:a,...l})=>{if(a?.ignoreBlocker??!1){o();return}const u=e.getBlockers?.()??[],d=l.type==="PUSH"||l.type==="REPLACE";if(typeof document<"u"&&u.length&&d)for(const h of u){const f=cr(l.path,l.state);if(await h.blockerFn({currentLocation:t,nextLocation:f,action:l.type})){e.onBlocked?.();return}}o()};return{get location(){return t},get length(){return e.getLength()},subscribers:s,subscribe:o=>(s.add(o),()=>{s.delete(o)}),push:(o,a,l)=>{const c=t.state[us];a=wl(c+1,a),r({task:()=>{e.pushState(o,a),n({type:"PUSH"})},navigateOpts:l,type:"PUSH",path:o,state:a})},replace:(o,a,l)=>{const c=t.state[us];a=wl(c,a),r({task:()=>{e.replaceState(o,a),n({type:"REPLACE"})},navigateOpts:l,type:"REPLACE",path:o,state:a})},go:(o,a)=>{r({task:()=>{e.go(o),i({type:"GO",index:o})},navigateOpts:a,type:"GO"})},back:o=>{r({task:()=>{e.back(o?.ignoreBlocker??!1),i({type:"BACK"})},navigateOpts:o,type:"BACK"})},forward:o=>{r({task:()=>{e.forward(o?.ignoreBlocker??!1),i({type:"FORWARD"})},navigateOpts:o,type:"FORWARD"})},canGoBack:()=>t.state[us]!==0,createHref:o=>e.createHref(o),block:o=>{if(!e.setBlockers)return()=>{};const a=e.getBlockers?.()??[];return e.setBlockers([...a,o]),()=>{const l=e.getBlockers?.()??[];e.setBlockers?.(l.filter(c=>c!==o))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:n}}function wl(e,t){t||(t={});const s=_a();return{...t,key:s,__TSR_key:s,[us]:e}}function Ap(e){const t=typeof document<"u"?window:void 0,s=t.history.pushState,n=t.history.replaceState;let i=[];const r=()=>i,o=_=>i=_,a=(_=>_),l=(()=>cr(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const _=_a();t.history.replaceState({[us]:0,key:_,__TSR_key:_},"")}let c=l(),u,d=!1,h=!1,f=!1,p=!1;const m=()=>c;let g,b;const x=()=>{g&&(R._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,"",g.href),R._ignoreSubscribers=!1,g=void 0,b=void 0,u=void 0)},w=(_,C,N)=>{const j=a(C);b||(u=c),c=cr(C,N),g={href:j,state:N,isPush:g?.isPush||_==="push"},b||(b=Promise.resolve().then(()=>x()))},v=_=>{c=l(),R.notify({type:_})},S=async()=>{if(h){h=!1;return}const _=l(),C=_.state[us]-c.state[us],N=C===1,j=C===-1,A=!N&&!j||d;d=!1;const F=A?"GO":j?"BACK":"FORWARD",V=A?{type:"GO",index:C}:{type:j?"BACK":"FORWARD"};if(f)f=!1;else{const W=r();if(typeof document<"u"&&W.length){for(const I of W)if(await I.blockerFn({currentLocation:c,nextLocation:_,action:F})){h=!0,t.history.go(1),R.notify(V);return}}}c=l(),R.notify(V)},P=_=>{if(p){p=!1;return}let C=!1;const N=r();if(typeof document<"u"&&N.length)for(const j of N){const A=j.enableBeforeUnload??!0;if(A===!0){C=!0;break}if(typeof A=="function"&&A()===!0){C=!0;break}}if(C)return _.preventDefault(),_.returnValue=""},R=Mp({getLocation:m,getLength:()=>t.history.length,pushState:(_,C)=>w("push",_,C),replaceState:(_,C)=>w("replace",_,C),back:_=>(_&&(f=!0),p=!0,t.history.back()),forward:_=>{_&&(f=!0),p=!0,t.history.forward()},go:_=>{d=!0,t.history.go(_)},createHref:_=>a(_),flush:x,destroy:()=>{t.history.pushState=s,t.history.replaceState=n,t.removeEventListener(_l,P,{capture:!0}),t.removeEventListener(vl,S)},onBlocked:()=>{u&&c!==u&&(c=u)},getBlockers:r,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(_l,P,{capture:!0}),t.addEventListener(vl,S),t.history.pushState=function(..._){const C=s.apply(t.history,_);return R._ignoreSubscribers||v("PUSH"),C},t.history.replaceState=function(..._){const C=n.apply(t.history,_);return R._ignoreSubscribers||v("REPLACE"),C},R}function Lp(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function cr(e,t){const s=Lp(e),n=s.indexOf("#"),i=s.indexOf("?"),r=_a();return{href:s,pathname:s.substring(0,n>0?i>0?Math.min(n,i):n:i>0?i:s.length),hash:n>-1?s.substring(n):"",search:i>-1?s.slice(i,n===-1?void 0:n):"",state:t||{[us]:0,key:r,__TSR_key:r}}}function _a(){return(Math.random()+1).toString(36).substring(7)}const Dp=!1;function Un(e){let t;return Cp(()=>{t=e()}),t}function Xn(e){return e[e.length-1]}function Np(e){return typeof e=="function"}function is(e,t){return Np(e)?e(t):e}const Fp=Object.prototype.hasOwnProperty,Sl=Object.prototype.propertyIsEnumerable;function Zt(e,t,s=0){if(e===t)return e;if(s>500)return t;const n=t,i=Pl(e)&&Pl(n);if(!i&&!(ur(e)&&ur(n)))return n;const r=i?e:kl(e);if(!r)return n;const o=i?n:kl(n);if(!o)return n;const a=r.length,l=o.length,c=i?new Array(l):{};let u=0;for(let d=0;d<l;d++){const h=i?d:o[d],f=e[h],p=n[h];if(f===p){c[h]=f,(i?d<a:Fp.call(e,h))&&u++;continue}if(f===null||p===null||typeof f!="object"||typeof p!="object"){c[h]=p;continue}const m=Zt(f,p,s+1);c[h]=m,m===f&&u++}return a===l&&u===a?e:c}function kl(e){const t=Object.getOwnPropertyNames(e);for(const i of t)if(!Sl.call(e,i))return!1;const s=Object.getOwnPropertySymbols(e);if(s.length===0)return t;const n=t;for(const i of s){if(!Sl.call(e,i))return!1;n.push(i)}return n}function ur(e){if(!Rl(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const s=t.prototype;return!(!Rl(s)||!s.hasOwnProperty("isPrototypeOf"))}function Rl(e){return Object.prototype.toString.call(e)==="[object Object]"}function Pl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ns(e,t,s){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(!Ns(e[n],t[n],s))return!1;return!0}if(ur(e)&&ur(t)){const n=s?.ignoreUndefined??!0;if(s?.partial){for(const o in t)if((!n||t[o]!==void 0)&&!Ns(e[o],t[o],s))return!1;return!0}let i=0;if(!n)i=Object.keys(e).length;else for(const o in e)e[o]!==void 0&&i++;let r=0;for(const o in t)if((!n||t[o]!==void 0)&&(r++,r>i||!Ns(e[o],t[o],s)))return!1;return i===r}return!1}function an(e){let t,s;const n=new Promise((i,r)=>{t=i,s=r});return n.status="pending",n.resolve=i=>{n.status="resolved",n.value=i,t(i),e?.(i)},n.reject=i=>{n.status="rejected",s(i)},n}function nn(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function El(e,t){for(let s=e.length-1;s>=0;s--){const n=e[s];if(t(n))return n}}function Ip(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function Cl(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,s=>{try{return decodeURI(s)}catch{return s}})}return Ip(t)}const wd=["http:","https:","mailto:","tel:"];function dr(e){if(!e)return!1;try{const t=new URL(e);return!wd.includes(t.protocol)}catch{return!1}}function wn(e,t){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return e;const s=/%25|%5C/gi;let n=0,i="",r;for(;(r=s.exec(e))!==null;)i+=Cl(e.slice(n,r.index))+r[0],n=s.lastIndex;return i=i+Cl(n?e.slice(n):e),i.startsWith("//")&&(i="/"+i.replace(/^\/+/,"")),i}function jp(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}var Bp=process.env.NODE_ENV==="production",Jr="Invariant failed";function Qe(e,t){if(!e){if(Bp)throw new Error(Jr);var s=typeof t=="function"?t():t,n=s?"".concat(Jr,": ").concat(s):Jr;throw new Error(n)}}function hr(e){const t=new Map;let s,n;const i=r=>{r.next&&(r.prev?(r.prev.next=r.next,r.next.prev=r.prev,r.next=void 0,n&&(n.next=r,r.prev=n)):(r.next.prev=void 0,s=r.next,r.next=void 0,n&&(r.prev=n,n.next=r)),n=r)};return{get(r){const o=t.get(r);if(o)return i(o),o.value},set(r,o){if(t.size>=e&&s){const l=s;t.delete(l.key),l.next&&(s=l.next,l.next.prev=void 0),l===n&&(n=void 0)}const a=t.get(r);if(a)a.value=o,i(a);else{const l={key:r,value:o,prev:n};n&&(n.next=l),n=l,s||(s=l),t.set(r,l)}},clear(){t.clear(),s=void 0,n=void 0}}}const ln=0,Vs=1,zs=2,Qn=3,Ts=4,Sd=5;function Vp(e){const t=e.indexOf("{");if(t===-1)return null;const s=e.indexOf("}",t);return s===-1||t+1>=e.length?null:[t,s]}function wa(e,t,s=new Uint16Array(6)){const n=e.indexOf("/",t),i=n===-1?e.length:n,r=e.substring(t,i);if(!r||!r.includes("$"))return s[0]=ln,s[1]=t,s[2]=t,s[3]=i,s[4]=i,s[5]=i,s;if(r==="$"){const a=e.length;return s[0]=zs,s[1]=t,s[2]=t,s[3]=a,s[4]=a,s[5]=a,s}if(r.charCodeAt(0)===36)return s[0]=Vs,s[1]=t,s[2]=t+1,s[3]=i,s[4]=i,s[5]=i,s;const o=Vp(r);if(o){const[a,l]=o,c=r.charCodeAt(a+1);if(c===45){if(a+2<r.length&&r.charCodeAt(a+2)===36){const u=a+3,d=l;if(u<d)return s[0]=Qn,s[1]=t+a,s[2]=t+u,s[3]=t+d,s[4]=t+l+1,s[5]=i,s}}else if(c===36){const u=a+1,d=a+2;return d===l?(s[0]=zs,s[1]=t+a,s[2]=t+u,s[3]=t+d,s[4]=t+l+1,s[5]=e.length,s):(s[0]=Vs,s[1]=t+a,s[2]=t+d,s[3]=t+l,s[4]=t+l+1,s[5]=i,s)}}return s[0]=ln,s[1]=t,s[2]=t,s[3]=i,s[4]=i,s[5]=i,s}function Mr(e,t,s,n,i,r,o){o?.(s);let a=n;{const l=s.fullPath??s.from,c=l.length,u=s.options?.caseSensitive??e,d=!!(s.options?.params?.parse&&s.options?.skipRouteOnParseError?.params);for(;a<c;){const f=wa(l,a,t);let p;const m=a,g=f[5];switch(a=g+1,r++,f[0]){case ln:{const x=l.substring(f[2],f[3]);if(u){const w=i.static?.get(x);if(w)p=w;else{i.static??=new Map;const v=Ms(s.fullPath??s.from);v.parent=i,v.depth=r,p=v,i.static.set(x,v)}}else{const w=x.toLowerCase(),v=i.staticInsensitive?.get(w);if(v)p=v;else{i.staticInsensitive??=new Map;const S=Ms(s.fullPath??s.from);S.parent=i,S.depth=r,p=S,i.staticInsensitive.set(w,S)}}break}case Vs:{const x=l.substring(m,f[1]),w=l.substring(f[4],g),v=u&&!!(x||w),S=x?v?x:x.toLowerCase():void 0,P=w?v?w:w.toLowerCase():void 0,R=!d&&i.dynamic?.find(_=>!_.skipOnParamError&&_.caseSensitive===v&&_.prefix===S&&_.suffix===P);if(R)p=R;else{const _=to(Vs,s.fullPath??s.from,v,S,P);p=_,_.depth=r,_.parent=i,i.dynamic??=[],i.dynamic.push(_)}break}case Qn:{const x=l.substring(m,f[1]),w=l.substring(f[4],g),v=u&&!!(x||w),S=x?v?x:x.toLowerCase():void 0,P=w?v?w:w.toLowerCase():void 0,R=!d&&i.optional?.find(_=>!_.skipOnParamError&&_.caseSensitive===v&&_.prefix===S&&_.suffix===P);if(R)p=R;else{const _=to(Qn,s.fullPath??s.from,v,S,P);p=_,_.parent=i,_.depth=r,i.optional??=[],i.optional.push(_)}break}case zs:{const x=l.substring(m,f[1]),w=l.substring(f[4],g),v=u&&!!(x||w),S=x?v?x:x.toLowerCase():void 0,P=w?v?w:w.toLowerCase():void 0,R=to(zs,s.fullPath??s.from,v,S,P);p=R,R.parent=i,R.depth=r,i.wildcard??=[],i.wildcard.push(R)}}i=p}if(d&&s.children&&!s.isRoot&&s.id&&s.id.charCodeAt(s.id.lastIndexOf("/")+1)===95){const f=Ms(s.fullPath??s.from);f.kind=Sd,f.parent=i,r++,f.depth=r,i.pathless??=[],i.pathless.push(f),i=f}const h=(s.path||!s.children)&&!s.isRoot;if(h&&l.endsWith("/")){const f=Ms(s.fullPath??s.from);f.kind=Ts,f.parent=i,r++,f.depth=r,i.index=f,i=f}i.parse=s.options?.params?.parse??null,i.skipOnParamError=d,i.parsingPriority=s.options?.skipRouteOnParseError?.priority??0,h&&!i.route&&(i.route=s,i.fullPath=s.fullPath??s.from)}if(s.children)for(const l of s.children)Mr(e,t,l,a,i,r,o)}function Zr(e,t){if(e.skipOnParamError&&!t.skipOnParamError)return-1;if(!e.skipOnParamError&&t.skipOnParamError)return 1;if(e.skipOnParamError&&t.skipOnParamError&&(e.parsingPriority||t.parsingPriority))return t.parsingPriority-e.parsingPriority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function ss(e){if(e.pathless)for(const t of e.pathless)ss(t);if(e.static)for(const t of e.static.values())ss(t);if(e.staticInsensitive)for(const t of e.staticInsensitive.values())ss(t);if(e.dynamic?.length){e.dynamic.sort(Zr);for(const t of e.dynamic)ss(t)}if(e.optional?.length){e.optional.sort(Zr);for(const t of e.optional)ss(t)}if(e.wildcard?.length){e.wildcard.sort(Zr);for(const t of e.wildcard)ss(t)}}function Ms(e){return{kind:ln,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function to(e,t,s,n,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:s,prefix:n,suffix:i}}function zp(e,t){const s=Ms("/"),n=new Uint16Array(6);for(const i of e)Mr(!1,n,i,1,s,0);ss(s),t.masksTree=s,t.flatCache=hr(1e3)}function Hp(e,t){e||="/";const s=t.flatCache.get(e);if(s)return s;const n=Sa(e,t.masksTree);return t.flatCache.set(e,n),n}function Up(e,t,s,n,i){e||="/",n||="/";const r=t?`case\0${e}`:e;let o=i.singleCache.get(r);if(!o){o=Ms("/");const a=new Uint16Array(6);Mr(t,a,{from:e},1,o,0),i.singleCache.set(r,o)}return Sa(n,o,s)}function Wp(e,t,s=!1){const n=s?e:`nofuzz\0${e}`,i=t.matchCache.get(n);if(i!==void 0)return i;e||="/";let r;try{r=Sa(e,t.segmentTree,s)}catch(o){if(o instanceof URIError)r=null;else throw o}return r&&(r.branch=Kp(r.route)),t.matchCache.set(n,r),r}function $p(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function qp(e,t=!1,s){const n=Ms(e.fullPath),i=new Uint16Array(6),r={},o={};let a=0;return Mr(t,i,e,1,n,0,c=>{if(s?.(c,a),Qe(!(c.id in r),`Duplicate routes found with id: ${String(c.id)}`),r[c.id]=c,a!==0&&c.path){const u=$p(c.fullPath);(!o[u]||c.fullPath.endsWith("/"))&&(o[u]=c)}a++}),ss(n),{processedTree:{segmentTree:n,singleCache:hr(1e3),matchCache:hr(1e3),flatCache:null,masksTree:null},routesById:r,routesByPath:o}}function Sa(e,t,s=!1){const n=e.split("/"),i=Gp(e,n,t,s);if(!i)return null;const[r]=kd(e,n,i);return{route:i.node.route,rawParams:r,parsedParams:i.parsedParams}}function kd(e,t,s){const n=Yp(s.node);let i=null;const r={};let o=s.extract?.part??0,a=s.extract?.node??0,l=s.extract?.path??0,c=s.extract?.segment??0;for(;a<n.length;o++,a++,l++,c++){const u=n[a];if(u.kind===Ts)break;if(u.kind===Sd){c--,o--,l--;continue}const d=t[o],h=l;if(d&&(l+=d.length),u.kind===Vs){i??=s.node.fullPath.split("/");const f=i[c],p=u.prefix?.length??0;if(f.charCodeAt(p)===123){const g=u.suffix?.length??0,b=f.substring(p+2,f.length-g-1),x=d.substring(p,d.length-g);r[b]=decodeURIComponent(x)}else{const g=f.substring(1);r[g]=decodeURIComponent(d)}}else if(u.kind===Qn){if(s.skipped&1<<a){o--,l=h-1;continue}i??=s.node.fullPath.split("/");const f=i[c],p=u.prefix?.length??0,m=u.suffix?.length??0,g=f.substring(p+3,f.length-m-1),b=u.suffix||u.prefix?d.substring(p,d.length-m):d;b&&(r[g]=decodeURIComponent(b))}else if(u.kind===zs){const f=u,p=e.substring(h+(f.prefix?.length??0),e.length-(f.suffix?.length??0)),m=decodeURIComponent(p);r["*"]=m,r._splat=m;break}}return s.rawParams&&Object.assign(r,s.rawParams),[r,{part:o,node:a,path:l,segment:c}]}function Kp(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Yp(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Gp(e,t,s,n){if(e==="/"&&s.index)return{node:s.index,skipped:0};const i=!Xn(t),r=i&&e!=="/",o=t.length-(i?1:0),a=[{node:s,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}];let l=null,c=null,u=null;for(;a.length;){const d=a.pop(),{node:h,index:f,skipped:p,depth:m,statics:g,dynamics:b,optionals:x}=d;let{extract:w,rawParams:v,parsedParams:S}=d;if(h.skipOnParamError){if(!eo(e,t,d))continue;v=d.rawParams,w=d.extract,S=d.parsedParams}n&&h.route&&h.kind!==Ts&&Sn(c,d)&&(c=d);const P=f===o;if(P&&(h.route&&!r&&Sn(u,d)&&(u=d),!h.optional&&!h.wildcard&&!h.index&&!h.pathless))continue;const R=P?void 0:t[f];let _;if(P&&h.index){const C={node:h.index,index:f,skipped:p,depth:m+1,statics:g,dynamics:b,optionals:x,extract:w,rawParams:v,parsedParams:S};let N=!0;if(h.index.skipOnParamError&&(eo(e,t,C)||(N=!1)),N){if(g===o&&!b&&!x&&!p)return C;Sn(u,C)&&(u=C)}}if(h.wildcard&&Sn(l,d))for(const C of h.wildcard){const{prefix:N,suffix:j}=C;if(N&&(P||!(C.caseSensitive?R:_??=R.toLowerCase()).startsWith(N)))continue;if(j){if(P)continue;const F=t.slice(f).join("/").slice(-j.length);if((C.caseSensitive?F:F.toLowerCase())!==j)continue}const A={node:C,index:o,skipped:p,depth:m,statics:g,dynamics:b,optionals:x,extract:w,rawParams:v,parsedParams:S};if(!(C.skipOnParamError&&!eo(e,t,A))){l=A;break}}if(h.optional){const C=p|1<<m,N=m+1;for(let j=h.optional.length-1;j>=0;j--){const A=h.optional[j];a.push({node:A,index:f,skipped:C,depth:N,statics:g,dynamics:b,optionals:x,extract:w,rawParams:v,parsedParams:S})}if(!P)for(let j=h.optional.length-1;j>=0;j--){const A=h.optional[j],{prefix:F,suffix:V}=A;if(F||V){const W=A.caseSensitive?R:_??=R.toLowerCase();if(F&&!W.startsWith(F)||V&&!W.endsWith(V))continue}a.push({node:A,index:f+1,skipped:p,depth:N,statics:g,dynamics:b,optionals:x+1,extract:w,rawParams:v,parsedParams:S})}}if(!P&&h.dynamic&&R)for(let C=h.dynamic.length-1;C>=0;C--){const N=h.dynamic[C],{prefix:j,suffix:A}=N;if(j||A){const F=N.caseSensitive?R:_??=R.toLowerCase();if(j&&!F.startsWith(j)||A&&!F.endsWith(A))continue}a.push({node:N,index:f+1,skipped:p,depth:m+1,statics:g,dynamics:b+1,optionals:x,extract:w,rawParams:v,parsedParams:S})}if(!P&&h.staticInsensitive){const C=h.staticInsensitive.get(_??=R.toLowerCase());C&&a.push({node:C,index:f+1,skipped:p,depth:m+1,statics:g+1,dynamics:b,optionals:x,extract:w,rawParams:v,parsedParams:S})}if(!P&&h.static){const C=h.static.get(R);C&&a.push({node:C,index:f+1,skipped:p,depth:m+1,statics:g+1,dynamics:b,optionals:x,extract:w,rawParams:v,parsedParams:S})}if(h.pathless){const C=m+1;for(let N=h.pathless.length-1;N>=0;N--){const j=h.pathless[N];a.push({node:j,index:f,skipped:p,depth:C,statics:g,dynamics:b,optionals:x,extract:w,rawParams:v,parsedParams:S})}}}if(u&&l)return Sn(l,u)?u:l;if(u)return u;if(l)return l;if(n&&c){let d=c.index;for(let f=0;f<c.index;f++)d+=t[f].length;const h=d===e.length?"/":e.slice(d);return c.rawParams??={},c.rawParams["**"]=decodeURIComponent(h),c}return null}function eo(e,t,s){try{const[n,i]=kd(e,t,s);s.rawParams=n,s.extract=i;const r=s.node.parse(n);return s.parsedParams=Object.assign({},s.parsedParams,r),!0}catch{return null}}function Sn(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Ts)>(e.node.kind===Ts)||t.node.kind===Ts==(e.node.kind===Ts)&&t.depth>e.depth))):!0}function Xi(e){return ka(e.filter(t=>t!==void 0).join("/"))}function ka(e){return e.replace(/\/{2,}/g,"/")}function Rd(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function qe(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function Pd(e){return qe(Rd(e))}function fr(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function Xp(e,t,s){return fr(e,s)===fr(t,s)}function Qp({base:e,to:t,trailingSlash:s="never",cache:n}){const i=t.startsWith("/"),r=!i&&t===".";let o;if(n){o=i?t:r?e:e+"\0"+t;const d=n.get(o);if(d)return d}let a;if(r)a=e.split("/");else if(i)a=t.split("/");else{for(a=e.split("/");a.length>1&&Xn(a)==="";)a.pop();const d=t.split("/");for(let h=0,f=d.length;h<f;h++){const p=d[h];p===""?h?h===f-1&&a.push(p):a=[p]:p===".."?a.pop():p==="."||a.push(p)}}a.length>1&&(Xn(a)===""?s==="never"&&a.pop():s==="always"&&a.push(""));let l,c="";for(let d=0;d<a.length;d++){d>0&&(c+="/");const h=a[d];if(!h)continue;l=wa(h,0,l);const f=l[0];if(f===ln){c+=h;continue}const p=l[5],m=h.substring(0,l[1]),g=h.substring(l[4],p),b=h.substring(l[2],l[3]);f===Vs?c+=m||g?`${m}{$${b}}${g}`:`$${b}`:f===zs?c+=m||g?`${m}{$}${g}`:"$":c+=`${m}{-$${b}}${g}`}c=ka(c);const u=c||"/";return o&&n&&n.set(o,u),u}function Jp(e){const t=new Map(e.map(i=>[encodeURIComponent(i),i])),s=Array.from(t.keys()).map(i=>i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),n=new RegExp(s,"g");return i=>i.replace(n,r=>t.get(r)??r)}function so(e,t,s){const n=t[e];return typeof n!="string"?n:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(n)?n:n.split("/").map(i=>Ol(i,s)).join("/"):Ol(n,s)}function no({path:e,params:t,decoder:s,server:n}){let i=!1;const r={};if(!e||e==="/")return{interpolatedPath:"/",usedParams:r,isMissingParams:i};if(!e.includes("$"))return{interpolatedPath:e,usedParams:r,isMissingParams:i};const o=e.length;let a=0,l,c="";for(;a<o;){const d=a;l=wa(e,d,l);const h=l[5];if(a=h+1,d===h)continue;const f=l[0];if(f===ln){c+="/"+e.substring(d,h);continue}if(f===zs){const p=t._splat;r._splat=p,r["*"]=p;const m=e.substring(d,l[1]),g=e.substring(l[4],h);if(!p){i=!0,(m||g)&&(c+="/"+m+g);continue}const b=so("_splat",t,s);c+="/"+m+b+g;continue}if(f===Vs){const p=e.substring(l[2],l[3]);!i&&!(p in t)&&(i=!0),r[p]=t[p];const m=e.substring(d,l[1]),g=e.substring(l[4],h),b=so(p,t,s)??"undefined";c+="/"+m+b+g;continue}if(f===Qn){const p=e.substring(l[2],l[3]),m=t[p];if(m==null)continue;r[p]=m;const g=e.substring(d,l[1]),b=e.substring(l[4],h),x=so(p,t,s)??"";c+="/"+g+x+b;continue}}return e.endsWith("/")&&(c+="/"),{usedParams:r,interpolatedPath:c||"/",isMissingParams:i}}function Ol(e,t){const s=encodeURIComponent(e);return t?.(s)??s}function ce(e){return!!e?.isNotFound}function Zp(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}const Io="tsr-scroll-restoration-v1_3",tm=(e,t)=>{let s;return(...n)=>{s||(s=setTimeout(()=>{e(...n),s=null},t))}};function em(){const e=Zp();if(!e)return null;const t=e.getItem(Io);let s=t?JSON.parse(t):{};return{state:s,set:n=>{s=is(n,s)||s;try{e.setItem(Io,JSON.stringify(s))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}const Ri=em(),sm=e=>e.state.__TSR_key||e.href;function nm(e){const t=[];let s;for(;s=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(s.children,e)+1})`),e=s;return`${t.reverse().join(" > ")}`.toLowerCase()}let pr=!1;function im({storageKey:e,key:t,behavior:s,shouldScrollRestoration:n,scrollToTopSelectors:i,location:r}){let o;try{o=JSON.parse(sessionStorage.getItem(e)||"{}")}catch(c){console.error(c);return}const a=t||window.history.state?.__TSR_key,l=o[a];pr=!0;t:{if(n&&l&&Object.keys(l).length>0){for(const d in l){const h=l[d];if(d==="window")window.scrollTo({top:h.scrollY,left:h.scrollX,behavior:s});else if(d){const f=document.querySelector(d);f&&(f.scrollLeft=h.scrollX,f.scrollTop=h.scrollY)}}break t}const c=(r??window.location).hash.split("#",2)[1];if(c){const d=window.history.state?.__hashScrollIntoViewOptions??!0;if(d){const h=document.getElementById(c);h&&h.scrollIntoView(d)}break t}const u={top:0,left:0,behavior:s};if(window.scrollTo(u),i)for(const d of i){if(d==="window")continue;const h=typeof d=="function"?d():document.querySelector(d);h&&h.scrollTo(u)}}pr=!1}function rm(e,t){if(!Ri||((e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!Ri))return;e.isScrollRestorationSetup=!0,pr=!1;const n=e.options.getScrollRestorationKey||sm;window.history.scrollRestoration="manual";const i=r=>{if(pr||!e.isScrollRestoring)return;let o="";if(r.target===document||r.target===window)o="window";else{const l=r.target.getAttribute("data-scroll-restoration-id");l?o=`[data-scroll-restoration-id="${l}"]`:o=nm(r.target)}const a=n(e.state.location);Ri.set(l=>{const c=l[a]||={},u=c[o]||={};if(o==="window")u.scrollX=window.scrollX||0,u.scrollY=window.scrollY||0;else if(o){const d=document.querySelector(o);d&&(u.scrollX=d.scrollLeft||0,u.scrollY=d.scrollTop||0)}return l})};typeof document<"u"&&document.addEventListener("scroll",tm(i,100),!0),e.subscribe("onRendered",r=>{const o=n(r.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation})||(im({storageKey:Io,key:o,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&Ri.set(a=>(a[o]||={},a)))})}function om(e){if(typeof document<"u"&&document.querySelector){const t=e.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&e.state.location.hash!==""){const s=document.getElementById(e.state.location.hash);s&&s.scrollIntoView(t)}}}function am(e,t=String){const s=new URLSearchParams;for(const n in e){const i=e[n];i!==void 0&&s.set(n,t(i))}return s.toString()}function io(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function lm(e){const t=new URLSearchParams(e),s={};for(const[n,i]of t.entries()){const r=s[n];r==null?s[n]=io(i):Array.isArray(r)?r.push(io(i)):s[n]=[r,io(i)]}return s}const cm=dm(JSON.parse),um=hm(JSON.stringify,JSON.parse);function dm(e){return t=>{t[0]==="?"&&(t=t.substring(1));const s=lm(t);for(const n in s){const i=s[n];if(typeof i=="string")try{s[n]=e(i)}catch{}}return s}}function hm(e,t){const s=typeof t=="function";function n(i){if(typeof i=="object"&&i!==null)try{return e(i)}catch{}else if(s&&typeof i=="string")try{return t(i),e(i)}catch{}return i}return i=>{const r=am(i,n);return r?`?${r}`:""}}const fe="__root__";function Ed(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&typeof e.href=="string"&&dr(e.href))throw new Error(`Redirect blocked: unsafe protocol in href "${e.href}". Only ${wd.join(", ")} protocols are allowed.`);if(!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const s=new Response(null,{status:e.statusCode,headers:t});if(s.options=e,e.throw)throw s;return s}function ge(e){return e instanceof Response&&!!e.options}const Qi=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Ar=(e,t)=>!!(e.preload&&!e.router.state.matches.some(s=>s.id===t)),rn=(e,t,s=!0)=>{const n={...e.router.options.context??{}},i=s?t:t-1;for(let r=0;r<=i;r++){const o=e.matches[r];if(!o)continue;const a=e.router.getMatch(o.id);a&&Object.assign(n,a.__routeContext,a.__beforeLoadContext)}return n},Cd=(e,t)=>{const s=e.router.routesById[t.routeId??""]??e.router.routeTree;!s.options.notFoundComponent&&e.router.options?.defaultNotFoundComponent&&(s.options.notFoundComponent=e.router.options.defaultNotFoundComponent),Qe(s.options.notFoundComponent,"No notFoundComponent found. Please set a notFoundComponent on your route or provide a defaultNotFoundComponent to the router.");const n=e.matches.find(i=>i.routeId===s.id);Qe(n,"Could not find match for route: "+s.id),e.updateMatch(n.id,i=>({...i,status:"notFound",error:t,isFetching:!1})),t.routerCode==="BEFORE_LOAD"&&s.parentRoute&&(t.routeId=s.parentRoute.id,Cd(e,t))},rs=(e,t,s)=>{if(!(!ge(s)&&!ce(s))){if(ge(s)&&s.redirectHandled&&!s.options.reloadDocument)throw s;if(t){t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0;const n=ge(s)?"redirected":"notFound";t._nonReactive.error=s,e.updateMatch(t.id,i=>({...i,status:n,context:rn(e,t.index),isFetching:!1,error:s})),ce(s)&&!s.routeId&&(s.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()}throw ge(s)?(e.rendered=!0,s.options._fromLocation=e.location,s.redirectHandled=!0,s=e.router.resolveRedirect(s),s):(Cd(e,s),s)}},Od=(e,t)=>!!e.router.getMatch(t)._nonReactive.dehydrated,kn=(e,t,s,n)=>{const{id:i,routeId:r}=e.matches[t],o=e.router.looseRoutesById[r];if(s instanceof Promise)throw s;s.routerCode=n,e.firstBadMatchIndex??=t,rs(e,e.router.getMatch(i),s);try{o.options.onError?.(s)}catch(a){s=a,rs(e,e.router.getMatch(i),s)}e.updateMatch(i,a=>(a._nonReactive.beforeLoadPromise?.resolve(),a._nonReactive.beforeLoadPromise=void 0,a._nonReactive.loadPromise?.resolve(),{...a,error:s,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}))},Td=(e,t,s,n)=>{if(n._nonReactive.pendingTimeout!==void 0)return;const i=s.options.pendingMs??e.router.options.defaultPendingMs;if(!!(e.onReady&&!Ar(e,t)&&(s.options.loader||s.options.beforeLoad||Ld(s))&&typeof i=="number"&&i!==1/0&&(s.options.pendingComponent??e.router.options?.defaultPendingComponent))){const o=setTimeout(()=>{Qi(e)},i);n._nonReactive.pendingTimeout=o}},fm=(e,t,s)=>{const n=e.router.getMatch(t);if(!n._nonReactive.beforeLoadPromise&&!n._nonReactive.loaderPromise)return;Td(e,t,s,n);const i=()=>{const r=e.router.getMatch(t);r.preload&&(r.status==="redirected"||r.status==="notFound")&&rs(e,r,r.error)};return n._nonReactive.beforeLoadPromise?n._nonReactive.beforeLoadPromise.then(i):i()},pm=(e,t,s,n)=>{const i=e.router.getMatch(t),r=i._nonReactive.loadPromise;i._nonReactive.loadPromise=an(()=>{r?.resolve()});const{paramsError:o,searchError:a}=i;o&&kn(e,s,o,"PARSE_PARAMS"),a&&kn(e,s,a,"VALIDATE_SEARCH"),Td(e,t,n,i);const l=new AbortController;let c=!1;const u=()=>{c||(c=!0,e.updateMatch(t,v=>({...v,isFetching:"beforeLoad",fetchCount:v.fetchCount+1,abortController:l})))},d=()=>{i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,v=>({...v,isFetching:!1}))};if(!n.options.beforeLoad){Un(()=>{u(),d()});return}i._nonReactive.beforeLoadPromise=an();const h={...rn(e,s,!1),...i.__routeContext},{search:f,params:p,cause:m}=i,g=Ar(e,t),b={search:f,abortController:l,params:p,preload:g,context:h,location:e.location,navigate:v=>e.router.navigate({...v,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:g?"preload":m,matches:e.matches,...e.router.options.additionalContext},x=v=>{if(v===void 0){Un(()=>{u(),d()});return}(ge(v)||ce(v))&&(u(),kn(e,s,v,"BEFORE_LOAD")),Un(()=>{u(),e.updateMatch(t,S=>({...S,__beforeLoadContext:v})),d()})};let w;try{if(w=n.options.beforeLoad(b),nn(w))return u(),w.catch(v=>{kn(e,s,v,"BEFORE_LOAD")}).then(x)}catch(v){u(),kn(e,s,v,"BEFORE_LOAD")}x(w)},mm=(e,t)=>{const{id:s,routeId:n}=e.matches[t],i=e.router.looseRoutesById[n],r=()=>a(),o=()=>pm(e,s,t,i),a=()=>{if(Od(e,s))return;const l=fm(e,s,i);return nn(l)?l.then(o):o()};return r()},gm=(e,t,s)=>{const n=e.router.getMatch(t);if(!n||!s.options.head&&!s.options.scripts&&!s.options.headers)return;const i={ssr:e.router.options.ssr,matches:e.matches,match:n,params:n.params,loaderData:n.loaderData};return Promise.all([s.options.head?.(i),s.options.scripts?.(i),s.options.headers?.(i)]).then(([r,o,a])=>{const l=r?.meta,c=r?.links,u=r?.scripts,d=r?.styles;return{meta:l,links:c,headScripts:u,headers:a,scripts:o,styles:d}})},Md=(e,t,s,n)=>{const i=e.matchPromises[s-1],{params:r,loaderDeps:o,abortController:a,cause:l}=e.router.getMatch(t),c=rn(e,s),u=Ar(e,t);return{params:r,deps:o,preload:!!u,parentMatchPromise:i,abortController:a,context:c,location:e.location,navigate:d=>e.router.navigate({...d,_fromLocation:e.location}),cause:u?"preload":l,route:n,...e.router.options.additionalContext}},Tl=async(e,t,s,n)=>{try{const i=e.router.getMatch(t);try{(!(Dp??e.router.isServer)||i.ssr===!0)&&Ad(n);const r=n.options.loader?.(Md(e,t,s,n)),o=n.options.loader&&nn(r);if((o||n._lazyPromise||n._componentsPromise||n.options.head||n.options.scripts||n.options.headers||i._nonReactive.minPendingPromise)&&e.updateMatch(t,c=>({...c,isFetching:"loader"})),n.options.loader){const c=o?await r:r;rs(e,e.router.getMatch(t),c),c!==void 0&&e.updateMatch(t,u=>({...u,loaderData:c}))}n._lazyPromise&&await n._lazyPromise;const l=i._nonReactive.minPendingPromise;l&&await l,n._componentsPromise&&await n._componentsPromise,e.updateMatch(t,c=>({...c,error:void 0,context:rn(e,s),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(r){let o=r;if(o?.name==="AbortError"){e.updateMatch(t,l=>({...l,status:l.status==="pending"?"success":l.status,isFetching:!1,context:rn(e,s)}));return}const a=i._nonReactive.minPendingPromise;a&&await a,ce(r)&&await n.options.notFoundComponent?.preload?.(),rs(e,e.router.getMatch(t),r);try{n.options.onError?.(r)}catch(l){o=l,rs(e,e.router.getMatch(t),l)}e.updateMatch(t,l=>({...l,error:o,context:rn(e,s),status:"error",isFetching:!1}))}}catch(i){const r=e.router.getMatch(t);r&&(r._nonReactive.loaderPromise=void 0),rs(e,r,i)}},bm=async(e,t)=>{const{id:s,routeId:n}=e.matches[t];let i=!1,r=!1;const o=e.router.looseRoutesById[n];if(!Od(e,s)){const c=e.router.getMatch(s);if(c._nonReactive.loaderPromise){if(c.status==="success"&&!e.sync&&!c.preload)return c;await c._nonReactive.loaderPromise;const u=e.router.getMatch(s),d=u._nonReactive.error||u.error;d&&rs(e,u,d)}else{const u=Date.now()-c.updatedAt,d=Ar(e,s),h=d?o.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:o.options.staleTime??e.router.options.defaultStaleTime??0,f=o.options.shouldReload,p=typeof f=="function"?f(Md(e,s,t,o)):f,m=!!d&&!e.router.state.matches.some(w=>w.id===s),g=e.router.getMatch(s);g._nonReactive.loaderPromise=an(),m!==g.preload&&e.updateMatch(s,w=>({...w,preload:m}));const{status:b,invalid:x}=g;i=b==="success"&&(x||(p??u>h)),d&&o.options.preload===!1||(i&&!e.sync?(r=!0,(async()=>{try{await Tl(e,s,t,o);const w=e.router.getMatch(s);w._nonReactive.loaderPromise?.resolve(),w._nonReactive.loadPromise?.resolve(),w._nonReactive.loaderPromise=void 0}catch(w){ge(w)&&await e.router.navigate(w.options)}})()):(b!=="success"||i&&e.sync)&&await Tl(e,s,t,o))}}const a=e.router.getMatch(s);r||(a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loadPromise?.resolve()),clearTimeout(a._nonReactive.pendingTimeout),a._nonReactive.pendingTimeout=void 0,r||(a._nonReactive.loaderPromise=void 0),a._nonReactive.dehydrated=void 0;const l=r?a.isFetching:!1;return l!==a.isFetching||a.invalid!==!1?(e.updateMatch(s,c=>({...c,isFetching:l,invalid:!1})),e.router.getMatch(s)):a};async function Ml(e){const t=Object.assign(e,{matchPromises:[]});t.router.state.matches.some(s=>s._forcePending)&&Qi(t);try{for(let a=0;a<t.matches.length;a++){const l=mm(t,a);nn(l)&&await l}const s=t.firstBadMatchIndex??t.matches.length;for(let a=0;a<s;a++)t.matchPromises.push(bm(t,a));const i=(await Promise.allSettled(t.matchPromises)).filter(a=>a.status==="rejected").map(a=>a.reason);let r;for(const a of i){if(ge(a))throw a;!r&&ce(a)&&(r=a)}for(const a of t.matches){const{id:l,routeId:c}=a,u=t.router.looseRoutesById[c];try{const d=gm(t,l,u);if(d){const h=await d;t.updateMatch(l,f=>({...f,...h}))}}catch(d){console.error(`Error executing head for route ${c}:`,d)}}if(r)throw r;const o=Qi(t);nn(o)&&await o}catch(s){if(ce(s)&&!t.preload){const n=Qi(t);throw nn(n)&&await n,s}if(ge(s))throw s}return t.matches}async function Ad(e){if(!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{const{id:s,...n}=t.options;Object.assign(e.options,n),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0),!e._componentsLoaded&&e._componentsPromise===void 0){const t=()=>{const s=[];for(const n of Dd){const i=e.options[n]?.preload;i&&s.push(i())}if(s.length)return Promise.all(s).then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0});e._componentsLoaded=!0,e._componentsPromise=void 0};e._componentsPromise=e._lazyPromise?e._lazyPromise.then(t):t()}return e._componentsPromise}function Ld(e){for(const t of Dd)if(e.options[t]?.preload)return!0;return!1}const Dd=["component","errorComponent","pendingComponent","notFoundComponent"];function ym(e){return{input:({url:t})=>{for(const s of e)t=jo(s,t);return t},output:({url:t})=>{for(let s=e.length-1;s>=0;s--)t=Nd(e[s],t);return t}}}function xm(e){const t=Pd(e.basepath),s=`/${t}`,n=`${s}/`,i=e.caseSensitive?s:s.toLowerCase(),r=e.caseSensitive?n:n.toLowerCase();return{input:({url:o})=>{const a=e.caseSensitive?o.pathname:o.pathname.toLowerCase();return a===i?o.pathname="/":a.startsWith(r)&&(o.pathname=o.pathname.slice(s.length)),o},output:({url:o})=>(o.pathname=Xi(["/",t,o.pathname]),o)}}function jo(e,t){const s=e?.input?.({url:t});if(s){if(typeof s=="string")return new URL(s);if(s instanceof URL)return s}return t}function Nd(e,t){const s=e?.output?.({url:t});if(s){if(typeof s=="string")return new URL(s);if(s instanceof URL)return s}return t}function Fs(e){const t=e.resolvedLocation,s=e.location,n=t?.pathname!==s.pathname,i=t?.href!==s.href,r=t?.hash!==s.hash;return{fromLocation:t,toLocation:s,pathChanged:n,hrefChanged:i,hashChanged:r}}class vm{constructor(t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=s=>s(),this.update=s=>{s.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const n=this.options,i=this.basepath??n?.basepath??"/",r=this.basepath===void 0,o=n?.rewrite;if(this.options={...n,...s},this.isServer=this.options.isServer??typeof document>"u",this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Jp(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=Ap()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let h;this.resolvePathCache=hr(1e3),h=this.buildRouteTree(),this.setRoutes(h)}!this.__store&&this.latestLocation&&(this.__store=new Tp(wm(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(h=>!["redirected"].includes(h.status))}}}),rm(this));let a=!1;const l=this.options.basepath??"/",c=this.options.rewrite;if(r||i!==l||o!==c){this.basepath=l;const h=[],f=Pd(l);f&&f!=="/"&&h.push(xm({basepath:l})),c&&h.push(c),this.rewrite=h.length===0?void 0:h.length===1?h[0]:ym(h),this.history&&this.updateLatestLocation(),a=!0}a&&this.__store&&(this.__store.state={...this.state,location:this.latestLocation}),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const s=qp(this.routeTree,this.options.caseSensitive,(n,i)=>{n.init({originalIndex:i})});return this.options.routeMasks&&zp(this.options.routeMasks,s.processedTree),s},this.subscribe=(s,n)=>{const i={eventType:s,fn:n};return this.subscribers.add(i),()=>{this.subscribers.delete(i)}},this.emit=s=>{this.subscribers.forEach(n=>{n.eventType===s.type&&n.fn(s)})},this.parseLocation=(s,n)=>{const i=({pathname:l,search:c,hash:u,href:d,state:h})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(l)){const x=this.options.parseSearch(c),w=this.options.stringifySearch(x);return{href:l+w+u,publicHref:d,pathname:wn(l),external:!1,searchStr:w,search:Zt(n?.search,x),hash:wn(u.slice(1)),state:Zt(n?.state,h)}}const f=new URL(d,this.origin),p=jo(this.rewrite,f),m=this.options.parseSearch(p.search),g=this.options.stringifySearch(m);return p.search=g,{href:p.href.replace(p.origin,""),publicHref:d,pathname:wn(p.pathname),external:!!this.rewrite&&p.origin!==this.origin,searchStr:g,search:Zt(n?.search,m),hash:wn(p.hash.slice(1)),state:Zt(n?.state,h)}},r=i(s),{__tempLocation:o,__tempKey:a}=r.state;if(o&&(!a||a===this.tempLocationKey)){const l=i(o);return l.state.key=r.state.key,l.state.__TSR_key=r.state.__TSR_key,delete l.state.__tempLocation,{...l,maskedLocation:r}}return r},this.resolvePathWithBase=(s,n)=>Qp({base:s,to:ka(n),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(s,n,i)=>typeof s=="string"?this.matchRoutesInternal({pathname:s,search:n},i):this.matchRoutesInternal(s,n),this.getMatchedRoutes=s=>Sm({pathname:s,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=s=>{const n=this.getMatch(s);n&&(n.abortController.abort(),clearTimeout(n._nonReactive.pendingTimeout),n._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const s=this.state.matches.filter(r=>r.status==="pending"),n=this.state.matches.filter(r=>r.isFetching==="loader");new Set([...this.state.pendingMatches??[],...s,...n]).forEach(r=>{this.cancelMatch(r.id)})},this.buildLocation=s=>{const n=(r={})=>{const o=r._fromLocation||this.pendingBuiltLocation||this.latestLocation,a=this.matchRoutesLightweight(o);if(r.from&&process.env.NODE_ENV!=="production"&&r._isNavigate){const F=this.getMatchedRoutes(r.from).matchedRoutes,V=El(a.matchedRoutes,I=>Ll(I.fullPath,r.from)),W=El(F,I=>Ll(I.fullPath,a.fullPath));!V&&!W&&console.warn(`Could not find match for from: ${r.from}`)}const l=r.unsafeRelative==="path"?o.pathname:r.from??a.fullPath,c=this.resolvePathWithBase(l,"."),u=a.search,d={...a.params},h=r.to?this.resolvePathWithBase(c,`${r.to}`):this.resolvePathWithBase(c,"."),f=r.params===!1||r.params===null?{}:(r.params??!0)===!0?d:Object.assign(d,is(r.params,d)),p=no({path:h,params:f,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath,m=this.getMatchedRoutes(p);let g=m.matchedRoutes;(m.foundRoute?m.foundRoute.path!=="/"&&m.routeParams["**"]:qe(p))&&this.options.notFoundRoute&&(g=[...g,this.options.notFoundRoute]);let x=!1;if(Object.keys(f).length>0)for(const F of g){const V=F.options.params?.stringify??F.options.stringifyParams;V&&(x=!0,Object.assign(f,V(f)))}const w=s.leaveParams?h:wn(x?no({path:h,params:f,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath:p);let v=u;if(s._includeValidateSearch&&this.options.search?.strict){const F={};g.forEach(V=>{if(V.options.validateSearch)try{Object.assign(F,Ji(V.options.validateSearch,{...F,...v}))}catch{}}),v=F}v=km({search:v,dest:r,destRoutes:g,_includeValidateSearch:s._includeValidateSearch}),v=Zt(u,v);const S=this.options.stringifySearch(v),P=r.hash===!0?o.hash:r.hash?is(r.hash,o.hash):void 0,R=P?`#${P}`:"";let _=r.state===!0?o.state:r.state?is(r.state,o.state):{};_=Zt(o.state,_);const C=`${w}${S}${R}`;let N,j,A=!1;if(this.rewrite){const F=new URL(C,this.origin),V=Nd(this.rewrite,F);N=F.href.replace(F.origin,""),V.origin!==this.origin?(j=V.href,A=!0):j=V.pathname+V.search+V.hash}else N=jp(C),j=N;return{publicHref:j,href:N,pathname:w,search:v,searchStr:S,state:_,hash:P??"",external:A,unmaskOnReload:r.unmaskOnReload}},i=(r={},o)=>{const a=n(r);let l=o?n(o):void 0;if(!l){const c={};if(this.options.routeMasks){const u=Hp(a.pathname,this.processedTree);if(u){Object.assign(c,u.rawParams);const{from:d,params:h,...f}=u.route,p=h===!1||h===null?{}:(h??!0)===!0?c:Object.assign(c,is(h,c));o={from:s.from,...f,params:p},l=n(o)}}}return l&&(a.maskedLocation=l),a};return s.mask?i(s,{from:s.from,...s.mask}):i(s)},this.commitLocation=async({viewTransition:s,ignoreBlocker:n,...i})=>{const r=()=>{const l=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];l.forEach(u=>{i.state[u]=this.latestLocation.state[u]});const c=Ns(i.state,this.latestLocation.state);return l.forEach(u=>{delete i.state[u]}),c},o=qe(this.latestLocation.href)===qe(i.href),a=this.commitLocationPromise;if(this.commitLocationPromise=an(()=>{a?.resolve()}),o&&r())this.load();else{let{maskedLocation:l,hashScrollIntoView:c,...u}=i;l&&(u={...l,state:{...l.state,__tempKey:void 0,__tempLocation:{...u,search:u.searchStr,state:{...u.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(u.unmaskOnReload??this.options.unmaskOnReload??!1)&&(u.state.__tempKey=this.tempLocationKey)),u.state.__hashScrollIntoViewOptions=c??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=s,this.history[i.replace?"replace":"push"](u.publicHref,u.state,{ignoreBlocker:n})}return this.resetNextScroll=i.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:s,resetScroll:n,hashScrollIntoView:i,viewTransition:r,ignoreBlocker:o,href:a,...l}={})=>{if(a){const d=this.history.location.state.__TSR_index,h=cr(a,{__TSR_index:s?d:d+1}),f=new URL(h.pathname,this.origin),p=jo(this.rewrite,f);l.to=p.pathname,l.search=this.options.parseSearch(h.search),l.hash=h.hash.slice(1)}const c=this.buildLocation({...l,_includeValidateSearch:!0});this.pendingBuiltLocation=c;const u=this.commitLocation({...c,viewTransition:r,replace:s,resetScroll:n,hashScrollIntoView:i,ignoreBlocker:o});return Promise.resolve().then(()=>{this.pendingBuiltLocation===c&&(this.pendingBuiltLocation=void 0)}),u},this.navigate=async({to:s,reloadDocument:n,href:i,publicHref:r,...o})=>{let a=!1;if(i)try{new URL(`${i}`),a=!0}catch{}if(a&&!n&&(n=!0),n){if(s!==void 0||!i){const c=this.buildLocation({to:s,...o});i=i??c.publicHref,r=r??c.publicHref}const l=!a&&r?r:i;if(dr(l))return process.env.NODE_ENV!=="production"&&console.warn(`Blocked navigation to dangerous protocol: ${l}`),Promise.resolve();if(!o.ignoreBlocker){const u=this.history.getBlockers?.()??[];for(const d of u)if(d?.blockerFn&&await d.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return o.replace?window.location.replace(l):window.location.href=l,Promise.resolve()}return this.buildAndCommitLocation({...o,href:i,to:s,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const s=this.matchRoutes(this.latestLocation);this.__store.setState(n=>({...n,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:s,cachedMatches:n.cachedMatches.filter(i=>!s.some(r=>r.id===i.id))}))},this.load=async s=>{let n,i,r;for(r=new Promise(a=>{this.startTransition(async()=>{try{this.beforeLoad();const l=this.latestLocation,c=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...Fs({resolvedLocation:c,location:l})}),this.emit({type:"onBeforeLoad",...Fs({resolvedLocation:c,location:l})}),await Ml({router:this,sync:s?.sync,matches:this.state.pendingMatches,location:l,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let u=[],d=[],h=[];Un(()=>{this.__store.setState(f=>{const p=f.matches,m=f.pendingMatches||f.matches;return u=p.filter(g=>!m.some(b=>b.id===g.id)),d=m.filter(g=>!p.some(b=>b.id===g.id)),h=m.filter(g=>p.some(b=>b.id===g.id)),{...f,isLoading:!1,loadedAt:Date.now(),matches:m,pendingMatches:void 0,cachedMatches:[...f.cachedMatches,...u.filter(g=>g.status!=="error"&&g.status!=="notFound")]}}),this.clearExpiredCache()}),[[u,"onLeave"],[d,"onEnter"],[h,"onStay"]].forEach(([f,p])=>{f.forEach(m=>{this.looseRoutesById[m.routeId].options[p]?.(m)})})})})}})}catch(l){ge(l)?(n=l,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):ce(l)&&(i=l),this.__store.setState(c=>({...c,statusCode:n?n.status:i?404:c.matches.some(u=>u.status==="error")?500:200,redirect:n}))}this.latestLoadPromise===r&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),a()})}),this.latestLoadPromise=r,await r;this.latestLoadPromise&&r!==this.latestLoadPromise;)await this.latestLoadPromise;let o;this.hasNotFoundMatch()?o=404:this.__store.state.matches.some(a=>a.status==="error")&&(o=500),o!==void 0&&this.__store.setState(a=>({...a,statusCode:o}))},this.startViewTransition=s=>{const n=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,n&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let i;if(typeof n=="object"&&this.isViewTransitionTypesSupported){const r=this.latestLocation,o=this.state.resolvedLocation,a=typeof n.types=="function"?n.types(Fs({resolvedLocation:o,location:r})):n.types;if(a===!1){s();return}i={update:s,types:a}}else i=s;document.startViewTransition(i)}else s()},this.updateMatch=(s,n)=>{this.startTransition(()=>{const i=this.state.pendingMatches?.some(r=>r.id===s)?"pendingMatches":this.state.matches.some(r=>r.id===s)?"matches":this.state.cachedMatches.some(r=>r.id===s)?"cachedMatches":"";i&&this.__store.setState(r=>({...r,[i]:r[i]?.map(o=>o.id===s?n(o):o)}))})},this.getMatch=s=>{const n=i=>i.id===s;return this.state.cachedMatches.find(n)??this.state.pendingMatches?.find(n)??this.state.matches.find(n)},this.invalidate=s=>{const n=i=>s?.filter?.(i)??!0?{...i,invalid:!0,...s?.forcePending||i.status==="error"||i.status==="notFound"?{status:"pending",error:void 0}:void 0}:i;return this.__store.setState(i=>({...i,matches:i.matches.map(n),cachedMatches:i.cachedMatches.map(n),pendingMatches:i.pendingMatches?.map(n)})),this.shouldViewTransition=!1,this.load({sync:s?.sync})},this.getParsedLocationHref=s=>s.publicHref||"/",this.resolveRedirect=s=>{const n=s.headers.get("Location");if(!s.options.href||s.options._builtLocation){const i=s.options._builtLocation??this.buildLocation(s.options),r=this.getParsedLocationHref(i);s.options.href=r,s.headers.set("Location",r)}else if(n)try{const i=new URL(n);if(this.origin&&i.origin===this.origin){const r=i.pathname+i.search+i.hash;s.options.href=r,s.headers.set("Location",r)}}catch{}return s.headers.get("Location")||s.headers.set("Location",s.options.href),s},this.clearCache=s=>{const n=s?.filter;n!==void 0?this.__store.setState(i=>({...i,cachedMatches:i.cachedMatches.filter(r=>!n(r))})):this.__store.setState(i=>({...i,cachedMatches:[]}))},this.clearExpiredCache=()=>{const s=n=>{const i=this.looseRoutesById[n.routeId];if(!i.options.loader)return!0;const r=(n.preload?i.options.preloadGcTime??this.options.defaultPreloadGcTime:i.options.gcTime??this.options.defaultGcTime)??300*1e3;return n.status==="error"?!0:Date.now()-n.updatedAt>=r};this.clearCache({filter:s})},this.loadRouteChunk=Ad,this.preloadRoute=async s=>{const n=this.buildLocation(s);let i=this.matchRoutes(n,{throwOnError:!0,preload:!0,dest:s});const r=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(a=>a.id)),o=new Set([...r,...this.state.cachedMatches.map(a=>a.id)]);Un(()=>{i.forEach(a=>{o.has(a.id)||this.__store.setState(l=>({...l,cachedMatches:[...l.cachedMatches,a]}))})});try{return i=await Ml({router:this,matches:i,location:n,preload:!0,updateMatch:(a,l)=>{r.has(a)?i=i.map(c=>c.id===a?l(c):c):this.updateMatch(a,l)}}),i}catch(a){if(ge(a))return a.options.reloadDocument?void 0:await this.preloadRoute({...a.options,_fromLocation:n});ce(a)||console.error(a);return}},this.matchRoute=(s,n)=>{const i={...s,to:s.to?this.resolvePathWithBase(s.from||"",s.to):void 0,params:s.params||{},leaveParams:!0},r=this.buildLocation(i);if(n?.pending&&this.state.status!=="pending")return!1;const a=(n?.pending===void 0?!this.state.isLoading:n.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,l=Up(r.pathname,n?.caseSensitive??!1,n?.fuzzy??!1,a.pathname,this.processedTree);return!l||s.params&&!Ns(l.rawParams,s.params,{partial:!0})?!1:n?.includeSearch??!0?Ns(a.search,r.search,{partial:!0})?l.rawParams:!1:l.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(s=>s.status==="notFound"||s.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...t,caseSensitive:t.caseSensitive??!1,notFoundMode:t.notFoundMode??"fuzzy",stringifySearch:t.stringifySearch??um,parseSearch:t.parseSearch??cm}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}setRoutes({routesById:t,routesByPath:s,processedTree:n}){this.routesById=t,this.routesByPath=s,this.processedTree=n;const i=this.options.notFoundRoute;i&&(i.init({originalIndex:99999999999}),this.routesById[i.id]=i)}get looseRoutesById(){return this.routesById}matchRoutesInternal(t,s){const n=this.getMatchedRoutes(t.pathname),{foundRoute:i,routeParams:r,parsedParams:o}=n;let{matchedRoutes:a}=n,l=!1;(i?i.path!=="/"&&r["**"]:qe(t.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:l=!0);const c=l?Pm(this.options.notFoundMode,a):void 0,u=[],d=h=>h?.id?h.context??this.options.context??void 0:this.options.context??void 0;return a.forEach((h,f)=>{const p=u[f-1],[m,g,b]=(()=>{const V=p?.search??t.search,W=p?._strictSearch??void 0;try{const I=Ji(h.options.validateSearch,{...V})??void 0;return[{...V,...I},{...W,...I},void 0]}catch(I){let q=I;if(I instanceof mr||(q=new mr(I.message,{cause:I})),s?.throwOnError)throw q;return[V,{},q]}})(),x=h.options.loaderDeps?.({search:m})??"",w=x?JSON.stringify(x):"",{interpolatedPath:v,usedParams:S}=no({path:h.fullPath,params:r,decoder:this.pathParamsDecoder,server:this.isServer}),P=h.id+v+w,R=this.getMatch(P),_=this.state.matches.find(V=>V.routeId===h.id),C=R?._strictParams??S;let N;if(!R)try{Dl(h,S,o,C)}catch(V){if(ce(V)||ge(V)?N=V:N=new _m(V.message,{cause:V}),s?.throwOnError)throw N}Object.assign(r,C);const j=_?"stay":"enter";let A;if(R)A={...R,cause:j,params:_?Zt(_.params,r):r,_strictParams:C,search:Zt(_?_.search:R.search,m),_strictSearch:g};else{const V=h.options.loader||h.options.beforeLoad||h.lazyFn||Ld(h)?"pending":"success";A={id:P,ssr:h.options.ssr,index:f,routeId:h.id,params:_?Zt(_.params,r):r,_strictParams:C,pathname:v,updatedAt:Date.now(),search:_?Zt(_.search,m):m,_strictSearch:g,searchError:void 0,status:V,isFetching:!1,error:void 0,paramsError:N,__routeContext:void 0,_nonReactive:{loadPromise:an()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:j,loaderDeps:_?Zt(_.loaderDeps,x):x,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:h.options.staticData||{},fullPath:h.fullPath}}s?.preload||(A.globalNotFound=c===h.id),A.searchError=b;const F=d(p);A.context={...F,...A.__routeContext,...A.__beforeLoadContext},u.push(A)}),u.forEach((h,f)=>{const p=this.looseRoutesById[h.routeId];if(!this.getMatch(h.id)){const g=u[f-1],b=d(g);if(p.options.context){const x={deps:h.loaderDeps,params:h.params,context:b??{},location:t,navigate:w=>this.navigate({...w,_fromLocation:t}),buildLocation:this.buildLocation,cause:h.cause,abortController:h.abortController,preload:!!h.preload,matches:u};h.__routeContext=p.options.context(x)??void 0}h.context={...b,...h.__routeContext,...h.__beforeLoadContext}}}),u}matchRoutesLightweight(t){const{matchedRoutes:s,routeParams:n,parsedParams:i}=this.getMatchedRoutes(t.pathname),r=Xn(s),o={...t.search};for(const u of s)try{Object.assign(o,Ji(u.options.validateSearch,o))}catch{}const a=Xn(this.state.matches),l=a&&a.routeId===r.id&&t.pathname===this.state.location.pathname;let c;if(l)c=a.params;else{const u={...n};for(const d of s)try{Dl(d,n,i??{},u)}catch{}c=u}return{matchedRoutes:s,fullPath:r.fullPath,search:o,params:c}}}class mr extends Error{}class _m extends Error{}const Al=e=>e.endsWith("/")&&e.length>1?e.slice(0,-1):e;function Ll(e,t){return Al(e)===Al(t)}function wm(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function Ji(e,t){if(e==null)return{};if("~standard"in e){const s=e["~standard"].validate(t);if(s instanceof Promise)throw new mr("Async validation not supported");if(s.issues)throw new mr(JSON.stringify(s.issues,void 0,2),{cause:s});return s.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function Sm({pathname:e,routesById:t,processedTree:s}){const n={},i=qe(e);let r,o;const a=Wp(i,s,!0);return a&&(r=a.route,Object.assign(n,a.rawParams),o=Object.assign({},a.parsedParams)),{matchedRoutes:a?.branch||[t[fe]],routeParams:n,foundRoute:r,parsedParams:o}}function km({search:e,dest:t,destRoutes:s,_includeValidateSearch:n}){return Rm(s)(e,t,n??!1)}function Rm(e){const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const i of e){if("search"in i.options)i.options.search?.middlewares&&t.middlewares.push(...i.options.search.middlewares);else if(i.options.preSearchFilters||i.options.postSearchFilters){const r=({search:o,next:a})=>{let l=o;"preSearchFilters"in i.options&&i.options.preSearchFilters&&(l=i.options.preSearchFilters.reduce((u,d)=>d(u),o));const c=a(l);return"postSearchFilters"in i.options&&i.options.postSearchFilters?i.options.postSearchFilters.reduce((u,d)=>d(u),c):c};t.middlewares.push(r)}if(i.options.validateSearch){const r=({search:o,next:a})=>{const l=a(o);if(!t._includeValidateSearch)return l;try{return{...l,...Ji(i.options.validateSearch,l)??void 0}}catch{return l}};t.middlewares.push(r)}}const s=({search:i})=>{const r=t.dest;return r.search?r.search===!0?i:is(r.search,i):{}};t.middlewares.push(s);const n=(i,r,o)=>{if(i>=o.length)return r;const a=o[i];return a({search:r,next:c=>n(i+1,c,o)})};return function(r,o,a){return t.dest=o,t._includeValidateSearch=a,n(0,r,t.middlewares)}}function Pm(e,t){if(e!=="root")for(let s=t.length-1;s>=0;s--){const n=t[s];if(n.children)return n.id}return fe}function Dl(e,t,s,n){const i=e.options.params?.parse??e.options.parseParams;if(i)if(e.options.skipRouteOnParseError)for(const r in t)r in s&&(n[r]=s[r]);else{const r=i(n);Object.assign(n,r)}}const Em="Error preloading route! ☝️";class Fd{constructor(t){if(this.init=s=>{this.originalIndex=s.originalIndex;const n=this.options,i=!n?.path&&!n?.id;this.parentRoute=this.options.getParentRoute?.(),i?this._path=fe:this.parentRoute||Qe(!1,"Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.");let r=i?fe:n?.path;r&&r!=="/"&&(r=Rd(r));const o=n?.id||r;let a=i?fe:Xi([this.parentRoute.id===fe?"":this.parentRoute.id,o]);r===fe&&(r="/"),a!==fe&&(a=Xi(["/",a]));const l=a===fe?"/":Xi([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=l,this._to=qe(l)},this.addChildren=s=>this._addFileChildren(s),this._addFileChildren=s=>(Array.isArray(s)&&(this.children=s),typeof s=="object"&&s!==null&&(this.children=Object.values(s)),this),this._addFileTypes=()=>this,this.updateLoader=s=>(Object.assign(this.options,s),this),this.update=s=>(Object.assign(this.options,s),this),this.lazy=s=>(this.lazyFn=s,this),this.redirect=s=>Ed({from:this.fullPath,...s}),this.options=t||{},this.isRoot=!t?.getParentRoute,t?.id&&t?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class Cm extends Fd{constructor(t){super(t)}}const Pi=typeof window<"u"?Q.useLayoutEffect:Q.useEffect;function ro(e){const t=Q.useRef({value:e,prev:null}),s=t.current.value;return e!==s&&(t.current={value:e,prev:s}),t.current.prev}function Om(e,t,s={},n={}){Q.useEffect(()=>{if(!e.current||n.disabled||typeof IntersectionObserver!="function")return;const i=new IntersectionObserver(([r])=>{t(r)},s);return i.observe(e.current),()=>{i.disconnect()}},[t,s,n.disabled,e])}function Tm(e){const t=Q.useRef(null);return Q.useImperativeHandle(e,()=>t.current,[]),t}function Ra(e){const t=e.errorComponent??Pa;return y.jsx(Mm,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:s,reset:n})=>s?Q.createElement(t,{error:s,reset:n}):e.children})}class Mm extends Q.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(t){return{resetKey:t.getResetKey()}}static getDerivedStateFromError(t){return{error:t}}reset(){this.setState({error:null})}componentDidUpdate(t,s){s.error&&s.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(t,s){this.props.onCatch&&this.props.onCatch(t,s)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function Pa({error:e}){const[t,s]=Q.useState(process.env.NODE_ENV!=="production");return y.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[y.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),y.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>s(n=>!n),children:t?"Hide Error":"Show Error"})]}),y.jsx("div",{style:{height:".25rem"}}),t?y.jsx("div",{children:y.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?y.jsx("code",{children:e.message}):null})}):null]})}function Am({children:e,fallback:t=null}){return Id()?y.jsx(L.Fragment,{children:e}):y.jsx(L.Fragment,{children:t})}function Id(){return L.useSyncExternalStore(Lm,()=>!0,()=>!1)}function Lm(){return()=>{}}var Dm=process.env.NODE_ENV==="production";function cn(e,t){if(!Dm){if(e)return;var s="Warning: "+t;typeof console<"u"&&console.warn(s);try{throw Error(s)}catch{}}}var Ei={exports:{}},oo={},Ci={exports:{}},ao={};var Nl;function Nm(){if(Nl)return ao;Nl=1;var e=L;function t(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var s=typeof Object.is=="function"?Object.is:t,n=e.useState,i=e.useEffect,r=e.useLayoutEffect,o=e.useDebugValue;function a(d,h){var f=h(),p=n({inst:{value:f,getSnapshot:h}}),m=p[0].inst,g=p[1];return r(function(){m.value=f,m.getSnapshot=h,l(m)&&g({inst:m})},[d,f,h]),i(function(){return l(m)&&g({inst:m}),d(function(){l(m)&&g({inst:m})})},[d]),o(f),f}function l(d){var h=d.getSnapshot;d=d.value;try{var f=h();return!s(d,f)}catch{return!0}}function c(d,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return ao.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,ao}var lo={};var Fl;function Fm(){return Fl||(Fl=1,process.env.NODE_ENV!=="production"&&(function(){function e(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}function t(f,p){u||i.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=p();if(!d){var g=p();r(m,g)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}g=o({inst:{value:m,getSnapshot:p}});var b=g[0].inst,x=g[1];return l(function(){b.value=m,b.getSnapshot=p,s(b)&&x({inst:b})},[f,m,p]),a(function(){return s(b)&&x({inst:b}),f(function(){s(b)&&x({inst:b})})},[f]),c(m),m}function s(f){var p=f.getSnapshot;f=f.value;try{var m=p();return!r(f,m)}catch{return!0}}function n(f,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=L,r=typeof Object.is=="function"?Object.is:e,o=i.useState,a=i.useEffect,l=i.useLayoutEffect,c=i.useDebugValue,u=!1,d=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;lo.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),lo}var Il;function jd(){return Il||(Il=1,process.env.NODE_ENV==="production"?Ci.exports=Nm():Ci.exports=Fm()),Ci.exports}var jl;function Im(){if(jl)return oo;jl=1;var e=L,t=jd();function s(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var n=typeof Object.is=="function"?Object.is:s,i=t.useSyncExternalStore,r=e.useRef,o=e.useEffect,a=e.useMemo,l=e.useDebugValue;return oo.useSyncExternalStoreWithSelector=function(c,u,d,h,f){var p=r(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function b(P){if(!x){if(x=!0,w=P,P=h(P),f!==void 0&&m.hasValue){var R=m.value;if(f(R,P))return v=R}return v=P}if(R=v,n(w,P))return R;var _=h(P);return f!==void 0&&f(R,_)?(w=P,R):(w=P,v=_)}var x=!1,w,v,S=d===void 0?null:d;return[function(){return b(u())},S===null?void 0:function(){return b(S())}]},[u,d,h,f]);var g=i(c,p[0],p[1]);return o(function(){m.hasValue=!0,m.value=g},[g]),l(g),g},oo}var co={};var Bl;function jm(){return Bl||(Bl=1,process.env.NODE_ENV!=="production"&&(function(){function e(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=L,s=jd(),n=typeof Object.is=="function"?Object.is:e,i=s.useSyncExternalStore,r=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;co.useSyncExternalStoreWithSelector=function(c,u,d,h,f){var p=r(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function b(P){if(!x){if(x=!0,w=P,P=h(P),f!==void 0&&m.hasValue){var R=m.value;if(f(R,P))return v=R}return v=P}if(R=v,n(w,P))return R;var _=h(P);return f!==void 0&&f(R,_)?(w=P,R):(w=P,v=_)}var x=!1,w,v,S=d===void 0?null:d;return[function(){return b(u())},S===null?void 0:function(){return b(S())}]},[u,d,h,f]);var g=i(c,p[0],p[1]);return o(function(){m.hasValue=!0,m.value=g},[g]),l(g),g},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),co}var Vl;function Bm(){return Vl||(Vl=1,process.env.NODE_ENV==="production"?Ei.exports=Im():Ei.exports=jm()),Ei.exports}var Vm=Bm();function zm(e,t=n=>n,s={}){const n=s.equal??Hm;return Vm.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,n)}function Hm(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,i]of e)if(!t.has(n)||!Object.is(i,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const s=zl(e);if(s.length!==zl(t).length)return!1;for(let n=0;n<s.length;n++)if(!Object.prototype.hasOwnProperty.call(t,s[n])||!Object.is(e[s[n]],t[s[n]]))return!1;return!0}function zl(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const uo=Q.createContext(null);function Bd(){return typeof document>"u"?uo:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=uo,uo)}function be(e){const t=Q.useContext(Bd());return cn(!((e?.warn??!0)&&!t),"useRouter must be used inside a <RouterProvider> component!"),t}function ue(e){const t=be({warn:e?.router===void 0}),s=e?.router||t,n=L.useRef(void 0);return zm(s.__store,i=>{if(e?.select){if(e.structuralSharing??s.options.defaultStructuralSharing){const r=Zt(n.current,e.select(i));return n.current=r,r}return e.select(i)}return i})}const Lr=Q.createContext(void 0),Um=Q.createContext(void 0);function Ie(e){const t=Q.useContext(e.from?Um:Lr);return ue({select:n=>{const i=n.matches.find(r=>e.from?e.from===r.routeId:r.id===t);if(Qe(!((e.shouldThrow??!0)&&!i),`Could not find ${e.from?`an active match from "${e.from}"`:"a nearest match!"}`),i!==void 0)return e.select?e.select(i):i},structuralSharing:e.structuralSharing})}function Ea(e){return Ie({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Ca(e){const{select:t,...s}=e;return Ie({...s,select:n=>t?t(n.loaderDeps):n.loaderDeps})}function ai(e){return Ie({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const s=e.strict===!1?t.params:t._strictParams;return e.select?e.select(s):s}})}function Oa(e){return Ie({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function qs(e){const t=be();return Q.useCallback(s=>t.navigate({...s,from:s.from??e?.from}),[e?.from,t])}function Wm(e,t){const s=be(),n=Tm(t),{activeProps:i,inactiveProps:r,activeOptions:o,to:a,preload:l,preloadDelay:c,hashScrollIntoView:u,replace:d,startTransition:h,resetScroll:f,viewTransition:p,children:m,target:g,disabled:b,style:x,className:w,onClick:v,onFocus:S,onMouseEnter:P,onMouseLeave:R,onTouchStart:_,ignoreBlocker:C,params:N,search:j,hash:A,state:F,mask:V,reloadDocument:W,unsafeRelative:I,from:q,_fromLocation:z,...rt}=e,dt=Id(),M=ue({select:D=>D.location.search,structuralSharing:!0}),Y=e.from,B=Q.useMemo(()=>({...e,from:Y}),[s,M,Y,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),U=Q.useMemo(()=>s.buildLocation({...B}),[s,B]),et=U.maskedLocation?U.maskedLocation.publicHref:U.publicHref,ft=U.maskedLocation?U.maskedLocation.external:U.external,Z=Q.useMemo(()=>Xm(et,ft,s.history,b),[b,ft,et,s.history]),it=Q.useMemo(()=>{if(Z?.external){if(dr(Z.href)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${Z.href}`);return}return Z.href}if(!Qm(a)&&!(typeof a!="string"||a.indexOf(":")===-1))try{if(new URL(a),dr(a)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${a}`);return}return a}catch{}},[a,Z]),kt=ue({select:D=>{if(it)return!1;if(o?.exact){if(!Xp(D.location.pathname,U.pathname,s.basepath))return!1}else{const K=fr(D.location.pathname,s.basepath),st=fr(U.pathname,s.basepath);if(!(K.startsWith(st)&&(K.length===st.length||K[st.length]==="/")))return!1}return(o?.includeSearch??!0)&&!Ns(D.location.search,U.search,{partial:!o?.exact,ignoreUndefined:!o?.explicitUndefined})?!1:o?.includeHash?dt&&D.location.hash===U.hash:!0}}),Ot=kt?is(i,{})??$m:ho,Bt=kt?ho:is(r,{})??ho,Ht=[w,Ot.className,Bt.className].filter(Boolean).join(" "),xs=(x||Ot.style||Bt.style)&&{...x,...Ot.style,...Bt.style},[vs,_s]=Q.useState(!1),Ze=Q.useRef(!1),Qt=e.reloadDocument||it?!1:l??s.options.defaultPreload,ts=c??s.options.defaultPreloadDelay??0,Ft=Q.useCallback(()=>{s.preloadRoute({...B}).catch(D=>{console.warn(D),console.warn(Em)})},[s,B]),Gs=Q.useCallback(D=>{D?.isIntersecting&&Ft()},[Ft]);Om(n,Gs,Gm,{disabled:!!b||Qt!=="viewport"}),Q.useEffect(()=>{Ze.current||!b&&Qt==="render"&&(Ft(),Ze.current=!0)},[b,Ft,Qt]);const k=D=>{const K=D.currentTarget.getAttribute("target"),st=g!==void 0?g:K;if(!b&&!Jm(D)&&!D.defaultPrevented&&(!st||st==="_self")&&D.button===0){D.preventDefault(),xd.flushSync(()=>{_s(!0)});const ct=s.subscribe("onResolved",()=>{ct(),_s(!1)});s.navigate({...B,replace:d,resetScroll:f,hashScrollIntoView:u,startTransition:h,viewTransition:p,ignoreBlocker:C})}};if(it)return{...rt,ref:n,href:it,...m&&{children:m},...g&&{target:g},...b&&{disabled:b},...x&&{style:x},...w&&{className:w},...v&&{onClick:v},...S&&{onFocus:S},...P&&{onMouseEnter:P},...R&&{onMouseLeave:R},..._&&{onTouchStart:_}};const E=D=>{b||Qt&&Ft()},T=E,$=D=>{if(!(b||!Qt))if(!ts)Ft();else{const K=D.target;if(Rn.has(K))return;const st=setTimeout(()=>{Rn.delete(K),Ft()},ts);Rn.set(K,st)}},H=D=>{if(b||!Qt||!ts)return;const K=D.target,st=Rn.get(K);st&&(clearTimeout(st),Rn.delete(K))};return{...rt,...Ot,...Bt,href:Z?.href,ref:n,onClick:Pn([v,k]),onFocus:Pn([S,E]),onMouseEnter:Pn([P,$]),onMouseLeave:Pn([R,H]),onTouchStart:Pn([_,T]),disabled:!!b,target:g,...xs&&{style:xs},...Ht&&{className:Ht},...b&&qm,...kt&&Km,...dt&&vs&&Ym}}const ho={},$m={className:"active"},qm={role:"link","aria-disabled":!0},Km={"data-status":"active","aria-current":"page"},Ym={"data-transitioning":"transitioning"},Rn=new WeakMap,Gm={rootMargin:"100px"},Pn=e=>t=>{for(const s of e)if(s){if(t.defaultPrevented)return;s(t)}};function Xm(e,t,s,n){if(!n)return t?{href:e,external:!0}:{href:s.createHref(e)||"/",external:!1}}function Qm(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}const Ta=Q.forwardRef((e,t)=>{const{_asChild:s,...n}=e,{type:i,...r}=Wm(n,t),o=typeof n.children=="function"?n.children({isActive:r["data-status"]==="active"}):n.children;if(!s){const{disabled:a,...l}=r;return Q.createElement("a",l,o)}return Q.createElement(s,r,o)});function Jm(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}class Zm extends Fd{constructor(t){super(t),this.useMatch=s=>Ie({select:s?.select,from:this.id,structuralSharing:s?.structuralSharing}),this.useRouteContext=s=>Ie({...s,from:this.id,select:n=>s?.select?s.select(n.context):n.context}),this.useSearch=s=>Oa({select:s?.select,structuralSharing:s?.structuralSharing,from:this.id}),this.useParams=s=>ai({select:s?.select,structuralSharing:s?.structuralSharing,from:this.id}),this.useLoaderDeps=s=>Ca({...s,from:this.id}),this.useLoaderData=s=>Ea({...s,from:this.id}),this.useNavigate=()=>qs({from:this.fullPath}),this.Link=L.forwardRef((s,n)=>y.jsx(Ta,{ref:n,from:this.fullPath,...s})),this.$$typeof=Symbol.for("react.memo")}}function He(e){return new Zm(e)}class tg extends Cm{constructor(t){super(t),this.useMatch=s=>Ie({select:s?.select,from:this.id,structuralSharing:s?.structuralSharing}),this.useRouteContext=s=>Ie({...s,from:this.id,select:n=>s?.select?s.select(n.context):n.context}),this.useSearch=s=>Oa({select:s?.select,structuralSharing:s?.structuralSharing,from:this.id}),this.useParams=s=>ai({select:s?.select,structuralSharing:s?.structuralSharing,from:this.id}),this.useLoaderDeps=s=>Ca({...s,from:this.id}),this.useLoaderData=s=>Ea({...s,from:this.id}),this.useNavigate=()=>qs({from:this.fullPath}),this.Link=L.forwardRef((s,n)=>y.jsx(Ta,{ref:n,from:this.fullPath,...s})),this.$$typeof=Symbol.for("react.memo")}}function eg(e){return new tg(e)}function Hl(e){return typeof e=="object"?new Ul(e,{silent:!0}).createRoute(e):new Ul(e,{silent:!0}).createRoute}class Ul{constructor(t,s){this.path=t,this.createRoute=n=>{cn(this.silent,"FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.");const i=He(n);return i.isRoot=!1,i},this.silent=s?.silent}}class Wl{constructor(t){this.useMatch=s=>Ie({select:s?.select,from:this.options.id,structuralSharing:s?.structuralSharing}),this.useRouteContext=s=>Ie({from:this.options.id,select:n=>s?.select?s.select(n.context):n.context}),this.useSearch=s=>Oa({select:s?.select,structuralSharing:s?.structuralSharing,from:this.options.id}),this.useParams=s=>ai({select:s?.select,structuralSharing:s?.structuralSharing,from:this.options.id}),this.useLoaderDeps=s=>Ca({...s,from:this.options.id}),this.useLoaderData=s=>Ea({...s,from:this.options.id}),this.useNavigate=()=>{const s=be();return qs({from:s.routesById[this.options.id].fullPath})},this.options=t,this.$$typeof=Symbol.for("react.memo")}}function $l(e){return typeof e=="object"?new Wl(e):t=>new Wl({id:e,...t})}function sg(){const e=be(),t=Q.useRef({router:e,mounted:!1}),[s,n]=Q.useState(!1),{hasPendingMatches:i,isLoading:r}=ue({select:d=>({isLoading:d.isLoading,hasPendingMatches:d.matches.some(h=>h.status==="pending")}),structuralSharing:!0}),o=ro(r),a=r||s||i,l=ro(a),c=r||i,u=ro(c);return e.startTransition=d=>{n(!0),Q.startTransition(()=>{d(),n(!1)})},Q.useEffect(()=>{const d=e.history.subscribe(e.load),h=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return qe(e.latestLocation.publicHref)!==qe(h.publicHref)&&e.commitLocation({...h,replace:!0}),()=>{d()}},[e,e.history]),Pi(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(h){console.error(h)}})()},[e]),Pi(()=>{o&&!r&&e.emit({type:"onLoad",...Fs(e.state)})},[o,e,r]),Pi(()=>{u&&!c&&e.emit({type:"onBeforeRouteMount",...Fs(e.state)})},[c,u,e]),Pi(()=>{if(l&&!a){const d=Fs(e.state);e.emit({type:"onResolved",...d}),e.__store.setState(h=>({...h,status:"idle",resolvedLocation:h.location})),d.hrefChanged&&om(e)}},[a,l,e]),null}function ng(e){const t=ue({select:s=>`not-found-${s.location.pathname}-${s.status}`});return y.jsx(Ra,{getResetKey:()=>t,onCatch:(s,n)=>{if(ce(s))e.onCatch?.(s,n);else throw s},errorComponent:({error:s})=>{if(ce(s))return e.fallback?.(s);throw s},children:e.children})}function ig(){return y.jsx("p",{children:"Not Found"})}function en(e){return y.jsx(y.Fragment,{children:e.children})}function Vd(e,t,s){return t.options.notFoundComponent?y.jsx(t.options.notFoundComponent,{...s}):e.options.defaultNotFoundComponent?y.jsx(e.options.defaultNotFoundComponent,{...s}):(process.env.NODE_ENV==="development"&&cn(t.options.notFoundComponent,`A notFoundError was encountered on the route with ID "${t.id}", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Not Found</p>)`),y.jsx(ig,{}))}function rg(){return be().isScrollRestoring,null}const zd=Q.memo(function({matchId:t}){const s=be(),n=ue({select:m=>{const g=m.matches.findIndex(x=>x.id===t),b=m.matches[g];return Qe(b,`Could not find match for matchId "${t}". Please file an issue!`),{routeId:b.routeId,ssr:b.ssr,_displayPending:b._displayPending,resetKey:m.loadedAt,parentRouteId:m.matches[g-1]?.routeId}},structuralSharing:!0}),i=s.routesById[n.routeId],r=i.options.pendingComponent??s.options.defaultPendingComponent,o=r?y.jsx(r,{}):null,a=i.options.errorComponent??s.options.defaultErrorComponent,l=i.options.onCatch??s.options.defaultOnCatch,c=i.isRoot?i.options.notFoundComponent??s.options.notFoundRoute?.options.component:i.options.notFoundComponent,u=n.ssr===!1||n.ssr==="data-only",d=(!i.isRoot||i.options.wrapInSuspense||u)&&(i.options.wrapInSuspense??r??(i.options.errorComponent?.preload||u))?Q.Suspense:en,h=a?Ra:en,f=c?ng:en,p=i.isRoot?i.options.shellComponent??en:en;return y.jsxs(p,{children:[y.jsx(Lr.Provider,{value:t,children:y.jsx(d,{fallback:o,children:y.jsx(h,{getResetKey:()=>n.resetKey,errorComponent:a||Pa,onCatch:(m,g)=>{if(ce(m))throw m;cn(!1,`Error in route match: ${t}`),l?.(m,g)},children:y.jsx(f,{fallback:m=>{if(!c||m.routeId&&m.routeId!==n.routeId||!m.routeId&&!i.isRoot)throw m;return Q.createElement(c,m)},children:u||n._displayPending?y.jsx(Am,{fallback:o,children:y.jsx(ql,{matchId:t})}):y.jsx(ql,{matchId:t})})})})}),n.parentRouteId===fe&&s.options.scrollRestoration?y.jsxs(y.Fragment,{children:[y.jsx(og,{}),y.jsx(rg,{})]}):null]})});function og(){const e=be(),t=Q.useRef(void 0);return y.jsx("script",{suppressHydrationWarning:!0,ref:s=>{s&&(t.current===void 0||t.current.href!==e.latestLocation.href)&&(e.emit({type:"onRendered",...Fs(e.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}const ql=Q.memo(function({matchId:t}){const s=be(),{match:n,key:i,routeId:r}=ue({select:l=>{const c=l.matches.find(p=>p.id===t),u=c.routeId,h=(s.routesById[u].options.remountDeps??s.options.defaultRemountDeps)?.({routeId:u,loaderDeps:c.loaderDeps,params:c._strictParams,search:c._strictSearch});return{key:h?JSON.stringify(h):void 0,routeId:u,match:{id:c.id,status:c.status,error:c.error,invalid:c.invalid,_forcePending:c._forcePending,_displayPending:c._displayPending}}},structuralSharing:!0}),o=s.routesById[r],a=Q.useMemo(()=>{const l=o.options.component??s.options.defaultComponent;return l?y.jsx(l,{},i):y.jsx(Ma,{})},[i,o.options.component,s.options.defaultComponent]);if(n._displayPending)throw s.getMatch(n.id)?._nonReactive.displayPendingPromise;if(n._forcePending)throw s.getMatch(n.id)?._nonReactive.minPendingPromise;if(n.status==="pending"){const l=o.options.pendingMinMs??s.options.defaultPendingMinMs;if(l){const c=s.getMatch(n.id);if(c&&!c._nonReactive.minPendingPromise){const u=an();c._nonReactive.minPendingPromise=u,setTimeout(()=>{u.resolve(),c._nonReactive.minPendingPromise=void 0},l)}}throw s.getMatch(n.id)?._nonReactive.loadPromise}if(n.status==="notFound")return Qe(ce(n.error),"Expected a notFound error"),Vd(s,o,n.error);if(n.status==="redirected")throw Qe(ge(n.error),"Expected a redirect error"),s.getMatch(n.id)?._nonReactive.loadPromise;if(n.status==="error")throw n.error;return a}),Ma=Q.memo(function(){const t=be(),s=Q.useContext(Lr),n=ue({select:c=>c.matches.find(u=>u.id===s)?.routeId}),i=t.routesById[n],r=ue({select:c=>{const d=c.matches.find(h=>h.id===s);return Qe(d,`Could not find parent match for matchId "${s}"`),d.globalNotFound}}),o=ue({select:c=>{const u=c.matches,d=u.findIndex(h=>h.id===s);return u[d+1]?.id}}),a=t.options.defaultPendingComponent?y.jsx(t.options.defaultPendingComponent,{}):null;if(r)return Vd(t,i,void 0);if(!o)return null;const l=y.jsx(zd,{matchId:o});return n===fe?y.jsx(Q.Suspense,{fallback:a,children:l}):l});function ag(){const e=be(),s=e.routesById[fe].options.pendingComponent??e.options.defaultPendingComponent,n=s?y.jsx(s,{}):null,i=typeof document<"u"&&e.ssr?en:Q.Suspense,r=y.jsxs(i,{fallback:n,children:[y.jsx(sg,{}),y.jsx(lg,{})]});return e.options.InnerWrap?y.jsx(e.options.InnerWrap,{children:r}):r}function lg(){const e=be(),t=ue({select:i=>i.matches[0]?.id}),s=ue({select:i=>i.loadedAt}),n=t?y.jsx(zd,{matchId:t}):null;return y.jsx(Lr.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?n:y.jsx(Ra,{getResetKey:()=>s,errorComponent:Pa,onCatch:i=>{cn(!1,"The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!"),cn(!1,i.message||i.toString())},children:n})})}const Hd=e=>new cg(e);class cg extends vm{constructor(t){super(t)}}typeof globalThis<"u"?(globalThis.createFileRoute=Hl,globalThis.createLazyFileRoute=$l):typeof window<"u"&&(window.createFileRoute=Hl,window.createLazyFileRoute=$l);function ug({router:e,children:t,...s}){Object.keys(s).length>0&&e.update({...e.options,...s,context:{...e.options.context,...s.context}});const n=Bd(),i=y.jsx(n.Provider,{value:e,children:t});return e.options.Wrap?y.jsx(e.options.Wrap,{children:i}):i}function dg({router:e,...t}){return y.jsx(ug,{router:e,...t,children:y.jsx(ag,{})})}function hg(e){return ue({select:t=>t.location})}var li=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},fg={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},pg=class{#t=fg;#e=!1;setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&this.#e&&e!==this.#t&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#t,provider:e}),this.#t=e,process.env.NODE_ENV!=="production"&&(this.#e=!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&(this.#e=!0),this.#t.setTimeout(e,t)}clearTimeout(e){this.#t.clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&(this.#e=!0),this.#t.setInterval(e,t)}clearInterval(e){this.#t.clearInterval(e)}},As=new pg;function mg(e){setTimeout(e,0)}var Hs=typeof window>"u"||"Deno"in globalThis;function ee(){}function gg(e,t){return typeof e=="function"?e(t):e}function Bo(e){return typeof e=="number"&&e>=0&&e!==1/0}function Ud(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ds(e,t){return typeof e=="function"?e(t):e}function pe(e,t){return typeof e=="function"?e(t):e}function Kl(e,t){const{type:s="all",exact:n,fetchStatus:i,predicate:r,queryKey:o,stale:a}=e;if(o){if(n){if(t.queryHash!==Aa(o,t.options))return!1}else if(!Zn(t.queryKey,o))return!1}if(s!=="all"){const l=t.isActive();if(s==="active"&&!l||s==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||i&&i!==t.state.fetchStatus||r&&!r(t))}function Yl(e,t){const{exact:s,status:n,predicate:i,mutationKey:r}=e;if(r){if(!t.options.mutationKey)return!1;if(s){if(Jn(t.options.mutationKey)!==Jn(r))return!1}else if(!Zn(t.options.mutationKey,r))return!1}return!(n&&t.state.status!==n||i&&!i(t))}function Aa(e,t){return(t?.queryKeyHashFn||Jn)(e)}function Jn(e){return JSON.stringify(e,(t,s)=>Ho(s)?Object.keys(s).sort().reduce((n,i)=>(n[i]=s[i],n),{}):s)}function Zn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(s=>Zn(e[s],t[s])):!1}var bg=Object.prototype.hasOwnProperty;function Vo(e,t,s=0){if(e===t)return e;if(s>500)return t;const n=Gl(e)&&Gl(t);if(!n&&!(Ho(e)&&Ho(t)))return t;const r=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),a=o.length,l=n?new Array(a):{};let c=0;for(let u=0;u<a;u++){const d=n?u:o[u],h=e[d],f=t[d];if(h===f){l[d]=h,(n?u<r:bg.call(e,d))&&c++;continue}if(h===null||f===null||typeof h!="object"||typeof f!="object"){l[d]=f;continue}const p=Vo(h,f,s+1);l[d]=p,p===h&&c++}return r===a&&c===r?e:l}function zo(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}function Gl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ho(e){if(!Xl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const s=t.prototype;return!(!Xl(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Xl(e){return Object.prototype.toString.call(e)==="[object Object]"}function yg(e){return new Promise(t=>{As.setTimeout(t,e)})}function Uo(e,t,s){if(typeof s.structuralSharing=="function")return s.structuralSharing(e,t);if(s.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Vo(e,t)}catch(n){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${s.queryHash}]: ${n}`),n}return Vo(e,t)}return t}function xg(e,t,s=0){const n=[...e,t];return s&&n.length>s?n.slice(1):n}function vg(e,t,s=0){const n=[t,...e];return s&&n.length>s?n.slice(0,-1):n}var gr=Symbol();function Wd(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===gr&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===gr?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function $d(e,t){return typeof e=="function"?e(...t):!!e}function _g(e,t,s){let n=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),n||(n=!0,i.aborted?s():i.addEventListener("abort",s,{once:!0})),i)}),e}var wg=class extends li{#t;#e;#s;constructor(){super(),this.#s=e=>{if(!Hs&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#s=e,this.#e?.(),this.#e=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#t!==e&&(this.#t=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},La=new wg;function Wo(){let e,t;const s=new Promise((i,r)=>{e=i,t=r});s.status="pending",s.catch(()=>{});function n(i){Object.assign(s,i),delete s.resolve,delete s.reject}return s.resolve=i=>{n({status:"fulfilled",value:i}),e(i)},s.reject=i=>{n({status:"rejected",reason:i}),t(i)},s}var Sg=mg;function kg(){let e=[],t=0,s=a=>{a()},n=a=>{a()},i=Sg;const r=a=>{t?e.push(a):i(()=>{s(a)})},o=()=>{const a=e;e=[],a.length&&i(()=>{n(()=>{a.forEach(l=>{s(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||o()}return l},batchCalls:a=>(...l)=>{r(()=>{a(...l)})},schedule:r,setNotifyFunction:a=>{s=a},setBatchNotifyFunction:a=>{n=a},setScheduler:a=>{i=a}}}var zt=kg(),Rg=class extends li{#t=!0;#e;#s;constructor(){super(),this.#s=e=>{if(!Hs&&window.addEventListener){const t=()=>e(!0),s=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#s=e,this.#e?.(),this.#e=e(this.setOnline.bind(this))}setOnline(e){this.#t!==e&&(this.#t=e,this.listeners.forEach(s=>{s(e)}))}isOnline(){return this.#t}},br=new Rg;function Pg(e){return Math.min(1e3*2**e,3e4)}function qd(e){return(e??"online")==="online"?br.isOnline():!0}var $o=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Kd(e){let t=!1,s=0,n;const i=Wo(),r=()=>i.status!=="pending",o=m=>{if(!r()){const g=new $o(m);h(g),e.onCancel?.(g)}},a=()=>{t=!0},l=()=>{t=!1},c=()=>La.isFocused()&&(e.networkMode==="always"||br.isOnline())&&e.canRun(),u=()=>qd(e.networkMode)&&e.canRun(),d=m=>{r()||(n?.(),i.resolve(m))},h=m=>{r()||(n?.(),i.reject(m))},f=()=>new Promise(m=>{n=g=>{(r()||c())&&m(g)},e.onPause?.()}).then(()=>{n=void 0,r()||e.onContinue?.()}),p=()=>{if(r())return;let m;const g=s===0?e.initialPromise:void 0;try{m=g??e.fn()}catch(b){m=Promise.reject(b)}Promise.resolve(m).then(d).catch(b=>{if(r())return;const x=e.retry??(Hs?0:3),w=e.retryDelay??Pg,v=typeof w=="function"?w(s,b):w,S=x===!0||typeof x=="number"&&s<x||typeof x=="function"&&x(s,b);if(t||!S){h(b);return}s++,e.onFail?.(s,b),yg(v).then(()=>c()?void 0:f()).then(()=>{t?h(b):p()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(n?.(),i),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?p():f().then(p),i)}}var Yd=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Bo(this.gcTime)&&(this.#t=As.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Hs?1/0:300*1e3))}clearGcTimeout(){this.#t&&(As.clearTimeout(this.#t),this.#t=void 0)}},Eg=class extends Yd{#t;#e;#s;#i;#n;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#s=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Jl(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#n?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=Jl(this.options);t.data!==void 0&&(this.setState(Ql(t.data,t.dataUpdatedAt)),this.#t=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#s.remove(this)}setData(e,t){const s=Uo(this.state.data,e,this.options);return this.#r({data:s,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),s}setState(e,t){this.#r({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#n?.promise;return this.#n?.cancel(e),t?t.then(ee).catch(ee):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(e=>pe(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===gr||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>ds(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:!Ud(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#n&&(this.#o?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#s.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#r({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#n?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(e&&this.setOptions(e),!this.options.queryFn){const a=this.observers.find(l=>l.options.queryFn);a&&this.setOptions(a.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const s=new AbortController,n=a=>{Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(this.#o=!0,s.signal)})},i=()=>{const a=Wd(this.options,t),c=(()=>{const u={client:this.#i,queryKey:this.queryKey,meta:this.meta};return n(u),u})();return this.#o=!1,this.options.persister?this.options.persister(a,c,this):a(c)},o=(()=>{const a={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return n(a),a})();this.options.behavior?.onFetch(o,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#r({type:"fetch",meta:o.fetchOptions?.meta}),this.#n=Kd({initialPromise:t?.initialPromise,fn:o.fetchFn,onCancel:a=>{a instanceof $o&&a.revert&&this.setState({...this.#e,fetchStatus:"idle"}),s.abort()},onFail:(a,l)=>{this.#r({type:"failed",failureCount:a,error:l})},onPause:()=>{this.#r({type:"pause"})},onContinue:()=>{this.#r({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const a=await this.#n.start();if(a===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(a),this.#s.config.onSuccess?.(a,this),this.#s.config.onSettled?.(a,this.state.error,this),a}catch(a){if(a instanceof $o){if(a.silent)return this.#n.promise;if(a.revert){if(this.state.data===void 0)throw a;return this.state.data}}throw this.#r({type:"error",error:a}),this.#s.config.onError?.(a,this),this.#s.config.onSettled?.(this.state.data,a,this),a}finally{this.scheduleGc()}}#r(e){const t=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,...Gd(s.data,this.options),fetchMeta:e.meta??null};case"success":const n={...s,...Ql(e.data,e.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#e=e.manual?n:void 0,n;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=t(this.state),zt.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),this.#s.notify({query:this,type:"updated",action:e})})}};function Gd(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:qd(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Ql(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Jl(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,s=t!==void 0,n=s?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:s?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var Cg=class extends li{constructor(e,t){super(),this.options=t,this.#t=e,this.#r=null,this.#o=Wo(),this.bindMethods(),this.setOptions(t)}#t;#e=void 0;#s=void 0;#i=void 0;#n;#a;#o;#r;#m;#h;#f;#c;#u;#l;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),Zl(this.#e,this.options)?this.#d():this.updateResult(),this.#x())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return qo(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return qo(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#v(),this.#_(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,s=this.#e;if(this.options=this.#t.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof pe(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#w(),this.#e.setOptions(this.options),t._defaulted&&!zo(this.options,t)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const n=this.hasListeners();n&&tc(this.#e,s,this.options,t)&&this.#d(),this.updateResult(),n&&(this.#e!==s||pe(this.options.enabled,this.#e)!==pe(t.enabled,this.#e)||ds(this.options.staleTime,this.#e)!==ds(t.staleTime,this.#e))&&this.#g();const i=this.#b();n&&(this.#e!==s||pe(this.options.enabled,this.#e)!==pe(t.enabled,this.#e)||i!==this.#l)&&this.#y(i)}getOptimisticResult(e){const t=this.#t.getQueryCache().build(this.#t,e),s=this.createResult(t,e);return Tg(this,s)&&(this.#i=s,this.#a=this.options,this.#n=this.#e.state),s}getCurrentResult(){return this.#i}trackResult(e,t){return new Proxy(e,{get:(s,n)=>(this.trackProp(n),t?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#t.defaultQueryOptions(e),s=this.#t.getQueryCache().build(this.#t,t);return s.fetch().then(()=>this.createResult(s,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#d(e){this.#w();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ee)),t}#g(){this.#v();const e=ds(this.options.staleTime,this.#e);if(Hs||this.#i.isStale||!Bo(e))return;const s=Ud(this.#i.dataUpdatedAt,e)+1;this.#c=As.setTimeout(()=>{this.#i.isStale||this.updateResult()},s)}#b(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#y(e){this.#_(),this.#l=e,!(Hs||pe(this.options.enabled,this.#e)===!1||!Bo(this.#l)||this.#l===0)&&(this.#u=As.setInterval(()=>{(this.options.refetchIntervalInBackground||La.isFocused())&&this.#d()},this.#l))}#x(){this.#g(),this.#y(this.#b())}#v(){this.#c&&(As.clearTimeout(this.#c),this.#c=void 0)}#_(){this.#u&&(As.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const s=this.#e,n=this.options,i=this.#i,r=this.#n,o=this.#a,l=e!==s?e.state:this.#s,{state:c}=e;let u={...c},d=!1,h;if(t._optimisticResults){const _=this.hasListeners(),C=!_&&Zl(e,t),N=_&&tc(e,s,t,n);(C||N)&&(u={...u,...Gd(c.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:f,errorUpdatedAt:p,status:m}=u;h=u.data;let g=!1;if(t.placeholderData!==void 0&&h===void 0&&m==="pending"){let _;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(_=i.data,g=!0):_=typeof t.placeholderData=="function"?t.placeholderData(this.#f?.state.data,this.#f):t.placeholderData,_!==void 0&&(m="success",h=Uo(i?.data,_,t),d=!0)}if(t.select&&h!==void 0&&!g)if(i&&h===r?.data&&t.select===this.#m)h=this.#h;else try{this.#m=t.select,h=t.select(h),h=Uo(i?.data,h,t),this.#h=h,this.#r=null}catch(_){this.#r=_}this.#r&&(f=this.#r,h=this.#h,p=Date.now(),m="error");const b=u.fetchStatus==="fetching",x=m==="pending",w=m==="error",v=x&&b,S=h!==void 0,R={status:m,fetchStatus:u.fetchStatus,isPending:x,isSuccess:m==="success",isError:w,isInitialLoading:v,isLoading:v,data:h,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>l.dataUpdateCount||u.errorUpdateCount>l.errorUpdateCount,isFetching:b,isRefetching:b&&!x,isLoadingError:w&&!S,isPaused:u.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:w&&S,isStale:Da(e,t),refetch:this.refetch,promise:this.#o,isEnabled:pe(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const _=R.data!==void 0,C=R.status==="error"&&!_,N=F=>{C?F.reject(R.error):_&&F.resolve(R.data)},j=()=>{const F=this.#o=R.promise=Wo();N(F)},A=this.#o;switch(A.status){case"pending":e.queryHash===s.queryHash&&N(A);break;case"fulfilled":(C||R.data!==A.value)&&j();break;case"rejected":(!C||R.error!==A.reason)&&j();break}}return R}updateResult(){const e=this.#i,t=this.createResult(this.#e,this.options);if(this.#n=this.#e.state,this.#a=this.options,this.#n.data!==void 0&&(this.#f=this.#e),zo(t,e))return;this.#i=t;const s=()=>{if(!e)return!0;const{notifyOnChangeProps:n}=this.options,i=typeof n=="function"?n():n;if(i==="all"||!i&&!this.#p.size)return!0;const r=new Set(i??this.#p);return this.options.throwOnError&&r.add("error"),Object.keys(this.#i).some(o=>{const a=o;return this.#i[a]!==e[a]&&r.has(a)})};this.#S({listeners:s()})}#w(){const e=this.#t.getQueryCache().build(this.#t,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#s=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#x()}#S(e){zt.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#i)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function Og(e,t){return pe(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Zl(e,t){return Og(e,t)||e.state.data!==void 0&&qo(e,t,t.refetchOnMount)}function qo(e,t,s){if(pe(t.enabled,e)!==!1&&ds(t.staleTime,e)!=="static"){const n=typeof s=="function"?s(e):s;return n==="always"||n!==!1&&Da(e,t)}return!1}function tc(e,t,s,n){return(e!==t||pe(n.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&Da(e,s)}function Da(e,t){return pe(t.enabled,e)!==!1&&e.isStaleByTime(ds(t.staleTime,e))}function Tg(e,t){return!zo(e.getCurrentResult(),t)}function ec(e){return{onFetch:(t,s)=>{const n=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,r=t.state.data?.pages||[],o=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let u=!1;const d=p=>{_g(p,()=>t.signal,()=>u=!0)},h=Wd(t.options,t.fetchOptions),f=async(p,m,g)=>{if(u)return Promise.reject();if(m==null&&p.pages.length)return Promise.resolve(p);const x=(()=>{const P={client:t.client,queryKey:t.queryKey,pageParam:m,direction:g?"backward":"forward",meta:t.options.meta};return d(P),P})(),w=await h(x),{maxPages:v}=t.options,S=g?vg:xg;return{pages:S(p.pages,w,v),pageParams:S(p.pageParams,m,v)}};if(i&&r.length){const p=i==="backward",m=p?Mg:sc,g={pages:r,pageParams:o},b=m(n,g);a=await f(g,b,p)}else{const p=e??r.length;do{const m=l===0?o[0]??n.initialPageParam:sc(n,a);if(l>0&&m==null)break;a=await f(a,m),l++}while(l<p)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},s):t.fetchFn=c}}}function sc(e,{pages:t,pageParams:s}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,s[n],s):void 0}function Mg(e,{pages:t,pageParams:s}){return t.length>0?e.getPreviousPageParam?.(t[0],t,s[0],s):void 0}var Ag=class extends Yd{#t;#e;#s;#i;constructor(e){super(),this.#t=e.client,this.mutationId=e.mutationId,this.#s=e.mutationCache,this.#e=[],this.state=e.state||Lg(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#e.includes(e)||(this.#e.push(e),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#e=this.#e.filter(t=>t!==e),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#s.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#n({type:"continue"})},s={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=Kd({fn:()=>this.options.mutationFn?this.options.mutationFn(e,s):Promise.reject(new Error("No mutationFn found")),onFail:(r,o)=>{this.#n({type:"failed",failureCount:r,error:o})},onPause:()=>{this.#n({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#s.canRun(this)});const n=this.state.status==="pending",i=!this.#i.canStart();try{if(n)t();else{this.#n({type:"pending",variables:e,isPaused:i}),this.#s.config.onMutate&&await this.#s.config.onMutate(e,this,s);const o=await this.options.onMutate?.(e,s);o!==this.state.context&&this.#n({type:"pending",context:o,variables:e,isPaused:i})}const r=await this.#i.start();return await this.#s.config.onSuccess?.(r,e,this.state.context,this,s),await this.options.onSuccess?.(r,e,this.state.context,s),await this.#s.config.onSettled?.(r,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(r,null,e,this.state.context,s),this.#n({type:"success",data:r}),r}catch(r){try{await this.#s.config.onError?.(r,e,this.state.context,this,s)}catch(o){Promise.reject(o)}try{await this.options.onError?.(r,e,this.state.context,s)}catch(o){Promise.reject(o)}try{await this.#s.config.onSettled?.(void 0,r,this.state.variables,this.state.context,this,s)}catch(o){Promise.reject(o)}try{await this.options.onSettled?.(void 0,r,e,this.state.context,s)}catch(o){Promise.reject(o)}throw this.#n({type:"error",error:r}),r}finally{this.#s.runNext(this)}}#n(e){const t=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=t(this.state),zt.batch(()=>{this.#e.forEach(s=>{s.onMutationUpdate(e)}),this.#s.notify({mutation:this,type:"updated",action:e})})}};function Lg(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Dg=class extends li{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#e=new Map,this.#s=0}#t;#e;#s;build(e,t,s){const n=new Ag({client:e,mutationCache:this,mutationId:++this.#s,options:e.defaultMutationOptions(t),state:s});return this.add(n),n}add(e){this.#t.add(e);const t=Oi(e);if(typeof t=="string"){const s=this.#e.get(t);s?s.push(e):this.#e.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){const t=Oi(e);if(typeof t=="string"){const s=this.#e.get(t);if(s)if(s.length>1){const n=s.indexOf(e);n!==-1&&s.splice(n,1)}else s[0]===e&&this.#e.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Oi(e);if(typeof t=="string"){const n=this.#e.get(t)?.find(i=>i.state.status==="pending");return!n||n===e}else return!0}runNext(e){const t=Oi(e);return typeof t=="string"?this.#e.get(t)?.find(n=>n!==e&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){zt.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(e){const t={exact:!0,...e};return this.getAll().find(s=>Yl(t,s))}findAll(e={}){return this.getAll().filter(t=>Yl(e,t))}notify(e){zt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return zt.batch(()=>Promise.all(e.map(t=>t.continue().catch(ee))))}};function Oi(e){return e.options.scope?.id}var Ng=class extends li{constructor(e={}){super(),this.config=e,this.#t=new Map}#t;build(e,t,s){const n=t.queryKey,i=t.queryHash??Aa(n,t);let r=this.get(i);return r||(r=new Eg({client:e,queryKey:n,queryHash:i,options:e.defaultQueryOptions(t),state:s,defaultOptions:e.getQueryDefaults(n)}),this.add(r)),r}add(e){this.#t.has(e.queryHash)||(this.#t.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#t.get(e.queryHash);t&&(e.destroy(),t===e&&this.#t.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){zt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#t.get(e)}getAll(){return[...this.#t.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(s=>Kl(t,s))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(s=>Kl(e,s)):t}notify(e){zt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){zt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){zt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Fg=class{#t;#e;#s;#i;#n;#a;#o;#r;constructor(e={}){this.#t=e.queryCache||new Ng,this.#e=e.mutationCache||new Dg,this.#s=e.defaultOptions||{},this.#i=new Map,this.#n=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=La.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#r=br.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#r?.(),this.#r=void 0)}isFetching(e){return this.#t.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#e.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),s=this.#t.build(this,t),n=s.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(ds(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#t.findAll(e).map(({queryKey:t,state:s})=>{const n=s.data;return[t,n]})}setQueryData(e,t,s){const n=this.defaultQueryOptions({queryKey:e}),r=this.#t.get(n.queryHash)?.state.data,o=gg(t,r);if(o!==void 0)return this.#t.build(this,n).setData(o,{...s,manual:!0})}setQueriesData(e,t,s){return zt.batch(()=>this.#t.findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,s)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state}removeQueries(e){const t=this.#t;zt.batch(()=>{t.findAll(e).forEach(s=>{t.remove(s)})})}resetQueries(e,t){const s=this.#t;return zt.batch(()=>(s.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const s={revert:!0,...t},n=zt.batch(()=>this.#t.findAll(e).map(i=>i.cancel(s)));return Promise.all(n).then(ee).catch(ee)}invalidateQueries(e,t={}){return zt.batch(()=>(this.#t.findAll(e).forEach(s=>{s.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const s={...t,cancelRefetch:t.cancelRefetch??!0},n=zt.batch(()=>this.#t.findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let r=i.fetch(void 0,s);return s.throwOnError||(r=r.catch(ee)),i.state.fetchStatus==="paused"?Promise.resolve():r}));return Promise.all(n).then(ee)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const s=this.#t.build(this,t);return s.isStaleByTime(ds(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ee).catch(ee)}fetchInfiniteQuery(e){return e.behavior=ec(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ee).catch(ee)}ensureInfiniteQueryData(e){return e.behavior=ec(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return br.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#s}setDefaultOptions(e){this.#s=e}setQueryDefaults(e,t){this.#i.set(Jn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#i.values()],s={};return t.forEach(n=>{Zn(e,n.queryKey)&&Object.assign(s,n.defaultOptions)}),s}setMutationDefaults(e,t){this.#n.set(Jn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#n.values()],s={};return t.forEach(n=>{Zn(e,n.mutationKey)&&Object.assign(s,n.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#s.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Aa(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===gr&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#s.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},Xd=Q.createContext(void 0),Ig=e=>{const t=Q.useContext(Xd);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},jg=({client:e,children:t})=>(Q.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),y.jsx(Xd.Provider,{value:e,children:t})),Qd=Q.createContext(!1),Bg=()=>Q.useContext(Qd);Qd.Provider;function Vg(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var zg=Q.createContext(Vg()),Hg=()=>Q.useContext(zg),Ug=(e,t,s)=>{const n=s?.state.error&&typeof e.throwOnError=="function"?$d(e.throwOnError,[s.state.error,s]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},Wg=e=>{Q.useEffect(()=>{e.clearReset()},[e])},$g=({result:e,errorResetBoundary:t,throwOnError:s,query:n,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(i&&e.data===void 0||$d(s,[e.error,n])),qg=e=>{if(e.suspense){const s=i=>i==="static"?i:Math.max(i??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...i)=>s(n(...i)):s(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Kg=(e,t)=>e.isLoading&&e.isFetching&&!t,Yg=(e,t)=>e?.suspense&&t.isPending,nc=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function Gg(e,t,s){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=Bg(),i=Hg(),r=Ig(),o=r.defaultQueryOptions(e);r.getDefaultOptions().queries?._experimental_beforeQuery?.(o);const a=r.getQueryCache().get(o.queryHash);process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),o._optimisticResults=n?"isRestoring":"optimistic",qg(o),Ug(o,i,a),Wg(i);const l=!r.getQueryCache().get(o.queryHash),[c]=Q.useState(()=>new t(r,o)),u=c.getOptimisticResult(o),d=!n&&e.subscribed!==!1;if(Q.useSyncExternalStore(Q.useCallback(h=>{const f=d?c.subscribe(zt.batchCalls(h)):ee;return c.updateResult(),f},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),Q.useEffect(()=>{c.setOptions(o)},[o,c]),Yg(o,u))throw nc(o,c,i);if($g({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw u.error;return r.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!Hs&&Kg(u,n)&&(l?nc(o,c,i):a?.promise)?.catch(ee).finally(()=>{c.updateResult()}),o.notifyOnChangeProps?u:c.trackResult(u)}function ps(e,t){return Gg(e,Cg)}function Xg(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",t.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}const Qg=e=>{switch(e){case"success":return tb;case"info":return sb;case"warning":return eb;case"error":return nb;default:return null}},Jg=Array(12).fill(0),Zg=({visible:e,className:t})=>L.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},L.createElement("div",{className:"sonner-spinner"},Jg.map((s,n)=>L.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),tb=L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},L.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),eb=L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},L.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),sb=L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},L.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),nb=L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},L.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),ib=L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},L.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),L.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),rb=()=>{const[e,t]=L.useState(document.hidden);return L.useEffect(()=>{const s=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",s),()=>window.removeEventListener("visibilitychange",s)},[]),e};let Ko=1;class ob{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const s=this.subscribers.indexOf(t);this.subscribers.splice(s,1)}),this.publish=t=>{this.subscribers.forEach(s=>s(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var s;const{message:n,...i}=t,r=typeof t?.id=="number"||((s=t.id)==null?void 0:s.length)>0?t.id:Ko++,o=this.toasts.find(l=>l.id===r),a=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),o?this.toasts=this.toasts.map(l=>l.id===r?(this.publish({...l,...t,id:r,title:n}),{...l,...t,id:r,dismissible:a,title:n}):l):this.addToast({title:n,...i,dismissible:a,id:r}),r},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(s=>s({id:t,dismiss:!0})))):this.toasts.forEach(s=>{this.subscribers.forEach(n=>n({id:s.id,dismiss:!0}))}),t),this.message=(t,s)=>this.create({...s,message:t}),this.error=(t,s)=>this.create({...s,message:t,type:"error"}),this.success=(t,s)=>this.create({...s,type:"success",message:t}),this.info=(t,s)=>this.create({...s,type:"info",message:t}),this.warning=(t,s)=>this.create({...s,type:"warning",message:t}),this.loading=(t,s)=>this.create({...s,type:"loading",message:t}),this.promise=(t,s)=>{if(!s)return;let n;s.loading!==void 0&&(n=this.create({...s,promise:t,type:"loading",message:s.loading,description:typeof s.description!="function"?s.description:void 0}));const i=Promise.resolve(t instanceof Function?t():t);let r=n!==void 0,o;const a=i.then(async c=>{if(o=["resolve",c],L.isValidElement(c))r=!1,this.create({id:n,type:"default",message:c});else if(lb(c)&&!c.ok){r=!1;const d=typeof s.error=="function"?await s.error(`HTTP error! status: ${c.status}`):s.error,h=typeof s.description=="function"?await s.description(`HTTP error! status: ${c.status}`):s.description,p=typeof d=="object"&&!L.isValidElement(d)?d:{message:d};this.create({id:n,type:"error",description:h,...p})}else if(c instanceof Error){r=!1;const d=typeof s.error=="function"?await s.error(c):s.error,h=typeof s.description=="function"?await s.description(c):s.description,p=typeof d=="object"&&!L.isValidElement(d)?d:{message:d};this.create({id:n,type:"error",description:h,...p})}else if(s.success!==void 0){r=!1;const d=typeof s.success=="function"?await s.success(c):s.success,h=typeof s.description=="function"?await s.description(c):s.description,p=typeof d=="object"&&!L.isValidElement(d)?d:{message:d};this.create({id:n,type:"success",description:h,...p})}}).catch(async c=>{if(o=["reject",c],s.error!==void 0){r=!1;const u=typeof s.error=="function"?await s.error(c):s.error,d=typeof s.description=="function"?await s.description(c):s.description,f=typeof u=="object"&&!L.isValidElement(u)?u:{message:u};this.create({id:n,type:"error",description:d,...f})}}).finally(()=>{r&&(this.dismiss(n),n=void 0),s.finally==null||s.finally.call(s)}),l=()=>new Promise((c,u)=>a.then(()=>o[0]==="reject"?u(o[1]):c(o[1])).catch(u));return typeof n!="string"&&typeof n!="number"?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(t,s)=>{const n=s?.id||Ko++;return this.create({jsx:t(n),id:n,...s}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const te=new ob,ab=(e,t)=>{const s=t?.id||Ko++;return te.addToast({title:e,...t,id:s}),s},lb=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",cb=ab,ub=()=>te.toasts,db=()=>te.getActiveToasts(),yt=Object.assign(cb,{success:te.success,info:te.info,warning:te.warning,error:te.error,custom:te.custom,message:te.message,promise:te.promise,dismiss:te.dismiss,loading:te.loading},{getHistory:ub,getToasts:db});Xg("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Ti(e){return e.label!==void 0}const hb=3,fb="24px",pb="16px",ic=4e3,mb=356,gb=14,bb=45,yb=200;function Ee(...e){return e.filter(Boolean).join(" ")}function xb(e){const[t,s]=e.split("-"),n=[];return t&&n.push(t),s&&n.push(s),n}const vb=e=>{var t,s,n,i,r,o,a,l,c;const{invert:u,toast:d,unstyled:h,interacting:f,setHeights:p,visibleToasts:m,heights:g,index:b,toasts:x,expanded:w,removeToast:v,defaultRichColors:S,closeButton:P,style:R,cancelButtonStyle:_,actionButtonStyle:C,className:N="",descriptionClassName:j="",duration:A,position:F,gap:V,expandByDefault:W,classNames:I,icons:q,closeButtonAriaLabel:z="Close toast"}=e,[rt,dt]=L.useState(null),[M,Y]=L.useState(null),[B,U]=L.useState(!1),[et,ft]=L.useState(!1),[Z,it]=L.useState(!1),[kt,Ot]=L.useState(!1),[Bt,Ht]=L.useState(!1),[xs,vs]=L.useState(0),[_s,Ze]=L.useState(0),Qt=L.useRef(d.duration||A||ic),ts=L.useRef(null),Ft=L.useRef(null),Gs=b===0,k=b+1<=m,E=d.type,T=d.dismissible!==!1,$=d.className||"",H=d.descriptionClassName||"",D=L.useMemo(()=>g.findIndex(ot=>ot.toastId===d.id)||0,[g,d.id]),K=L.useMemo(()=>{var ot;return(ot=d.closeButton)!=null?ot:P},[d.closeButton,P]),st=L.useMemo(()=>d.duration||A||ic,[d.duration,A]),ct=L.useRef(0),Rt=L.useRef(0),Pe=L.useRef(0),Gt=L.useRef(null),[Xr,yn]=F.split("-"),Xs=L.useMemo(()=>g.reduce((ot,It,Ut)=>Ut>=D?ot:ot+It.height,0),[g,D]),xi=rb(),vi=d.invert||u,xn=E==="loading";Rt.current=L.useMemo(()=>D*V+Xs,[D,Xs]),L.useEffect(()=>{Qt.current=st},[st]),L.useEffect(()=>{U(!0)},[]),L.useEffect(()=>{const ot=Ft.current;if(ot){const It=ot.getBoundingClientRect().height;return Ze(It),p(Ut=>[{toastId:d.id,height:It,position:d.position},...Ut]),()=>p(Ut=>Ut.filter(oe=>oe.toastId!==d.id))}},[p,d.id]),L.useLayoutEffect(()=>{if(!B)return;const ot=Ft.current,It=ot.style.height;ot.style.height="auto";const Ut=ot.getBoundingClientRect().height;ot.style.height=It,Ze(Ut),p(oe=>oe.find(Vt=>Vt.toastId===d.id)?oe.map(Vt=>Vt.toastId===d.id?{...Vt,height:Ut}:Vt):[{toastId:d.id,height:Ut,position:d.position},...oe])},[B,d.title,d.description,p,d.id,d.jsx,d.action,d.cancel]);const ye=L.useCallback(()=>{ft(!0),vs(Rt.current),p(ot=>ot.filter(It=>It.toastId!==d.id)),setTimeout(()=>{v(d)},yb)},[d,v,p,Rt]);L.useEffect(()=>{if(d.promise&&E==="loading"||d.duration===1/0||d.type==="loading")return;let ot;return w||f||xi?(()=>{if(Pe.current<ct.current){const oe=new Date().getTime()-ct.current;Qt.current=Qt.current-oe}Pe.current=new Date().getTime()})():Qt.current!==1/0&&(ct.current=new Date().getTime(),ot=setTimeout(()=>{d.onAutoClose==null||d.onAutoClose.call(d,d),ye()},Qt.current)),()=>clearTimeout(ot)},[w,f,d,E,xi,ye]),L.useEffect(()=>{d.delete&&(ye(),d.onDismiss==null||d.onDismiss.call(d,d))},[ye,d.delete]);function xp(){var ot;if(q?.loading){var It;return L.createElement("div",{className:Ee(I?.loader,d==null||(It=d.classNames)==null?void 0:It.loader,"sonner-loader"),"data-visible":E==="loading"},q.loading)}return L.createElement(Zg,{className:Ee(I?.loader,d==null||(ot=d.classNames)==null?void 0:ot.loader),visible:E==="loading"})}const vp=d.icon||q?.[E]||Qg(E);var pl,ml;return L.createElement("li",{tabIndex:0,ref:Ft,className:Ee(N,$,I?.toast,d==null||(t=d.classNames)==null?void 0:t.toast,I?.default,I?.[E],d==null||(s=d.classNames)==null?void 0:s[E]),"data-sonner-toast":"","data-rich-colors":(pl=d.richColors)!=null?pl:S,"data-styled":!(d.jsx||d.unstyled||h),"data-mounted":B,"data-promise":!!d.promise,"data-swiped":Bt,"data-removed":et,"data-visible":k,"data-y-position":Xr,"data-x-position":yn,"data-index":b,"data-front":Gs,"data-swiping":Z,"data-dismissible":T,"data-type":E,"data-invert":vi,"data-swipe-out":kt,"data-swipe-direction":M,"data-expanded":!!(w||W&&B),"data-testid":d.testId,style:{"--index":b,"--toasts-before":b,"--z-index":x.length-b,"--offset":`${et?xs:Rt.current}px`,"--initial-height":W?"auto":`${_s}px`,...R,...d.style},onDragEnd:()=>{it(!1),dt(null),Gt.current=null},onPointerDown:ot=>{ot.button!==2&&(xn||!T||(ts.current=new Date,vs(Rt.current),ot.target.setPointerCapture(ot.pointerId),ot.target.tagName!=="BUTTON"&&(it(!0),Gt.current={x:ot.clientX,y:ot.clientY})))},onPointerUp:()=>{var ot,It,Ut;if(kt||!T)return;Gt.current=null;const oe=Number(((ot=Ft.current)==null?void 0:ot.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),_i=Number(((It=Ft.current)==null?void 0:It.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Vt=new Date().getTime()-((Ut=ts.current)==null?void 0:Ut.getTime()),de=rt==="x"?oe:_i,wi=Math.abs(de)/Vt;if(Math.abs(de)>=bb||wi>.11){vs(Rt.current),d.onDismiss==null||d.onDismiss.call(d,d),Y(rt==="x"?oe>0?"right":"left":_i>0?"down":"up"),ye(),Ot(!0);return}else{var xe,ve;(xe=Ft.current)==null||xe.style.setProperty("--swipe-amount-x","0px"),(ve=Ft.current)==null||ve.style.setProperty("--swipe-amount-y","0px")}Ht(!1),it(!1),dt(null)},onPointerMove:ot=>{var It,Ut,oe;if(!Gt.current||!T||((It=window.getSelection())==null?void 0:It.toString().length)>0)return;const Vt=ot.clientY-Gt.current.y,de=ot.clientX-Gt.current.x;var wi;const xe=(wi=e.swipeDirections)!=null?wi:xb(F);!rt&&(Math.abs(de)>1||Math.abs(Vt)>1)&&dt(Math.abs(de)>Math.abs(Vt)?"x":"y");let ve={x:0,y:0};const gl=ws=>1/(1.5+Math.abs(ws)/20);if(rt==="y"){if(xe.includes("top")||xe.includes("bottom"))if(xe.includes("top")&&Vt<0||xe.includes("bottom")&&Vt>0)ve.y=Vt;else{const ws=Vt*gl(Vt);ve.y=Math.abs(ws)<Math.abs(Vt)?ws:Vt}}else if(rt==="x"&&(xe.includes("left")||xe.includes("right")))if(xe.includes("left")&&de<0||xe.includes("right")&&de>0)ve.x=de;else{const ws=de*gl(de);ve.x=Math.abs(ws)<Math.abs(de)?ws:de}(Math.abs(ve.x)>0||Math.abs(ve.y)>0)&&Ht(!0),(Ut=Ft.current)==null||Ut.style.setProperty("--swipe-amount-x",`${ve.x}px`),(oe=Ft.current)==null||oe.style.setProperty("--swipe-amount-y",`${ve.y}px`)}},K&&!d.jsx&&E!=="loading"?L.createElement("button",{"aria-label":z,"data-disabled":xn,"data-close-button":!0,onClick:xn||!T?()=>{}:()=>{ye(),d.onDismiss==null||d.onDismiss.call(d,d)},className:Ee(I?.closeButton,d==null||(n=d.classNames)==null?void 0:n.closeButton)},(ml=q?.close)!=null?ml:ib):null,(E||d.icon||d.promise)&&d.icon!==null&&(q?.[E]!==null||d.icon)?L.createElement("div",{"data-icon":"",className:Ee(I?.icon,d==null||(i=d.classNames)==null?void 0:i.icon)},d.promise||d.type==="loading"&&!d.icon?d.icon||xp():null,d.type!=="loading"?vp:null):null,L.createElement("div",{"data-content":"",className:Ee(I?.content,d==null||(r=d.classNames)==null?void 0:r.content)},L.createElement("div",{"data-title":"",className:Ee(I?.title,d==null||(o=d.classNames)==null?void 0:o.title)},d.jsx?d.jsx:typeof d.title=="function"?d.title():d.title),d.description?L.createElement("div",{"data-description":"",className:Ee(j,H,I?.description,d==null||(a=d.classNames)==null?void 0:a.description)},typeof d.description=="function"?d.description():d.description):null),L.isValidElement(d.cancel)?d.cancel:d.cancel&&Ti(d.cancel)?L.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||_,onClick:ot=>{Ti(d.cancel)&&T&&(d.cancel.onClick==null||d.cancel.onClick.call(d.cancel,ot),ye())},className:Ee(I?.cancelButton,d==null||(l=d.classNames)==null?void 0:l.cancelButton)},d.cancel.label):null,L.isValidElement(d.action)?d.action:d.action&&Ti(d.action)?L.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||C,onClick:ot=>{Ti(d.action)&&(d.action.onClick==null||d.action.onClick.call(d.action,ot),!ot.defaultPrevented&&ye())},className:Ee(I?.actionButton,d==null||(c=d.classNames)==null?void 0:c.actionButton)},d.action.label):null)};function rc(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function _b(e,t){const s={};return[e,t].forEach((n,i)=>{const r=i===1,o=r?"--mobile-offset":"--offset",a=r?pb:fb;function l(c){["top","right","bottom","left"].forEach(u=>{s[`${o}-${u}`]=typeof c=="number"?`${c}px`:c})}typeof n=="number"||typeof n=="string"?l(n):typeof n=="object"?["top","right","bottom","left"].forEach(c=>{n[c]===void 0?s[`${o}-${c}`]=a:s[`${o}-${c}`]=typeof n[c]=="number"?`${n[c]}px`:n[c]}):l(a)}),s}const wb=L.forwardRef(function(t,s){const{id:n,invert:i,position:r="bottom-right",hotkey:o=["altKey","KeyT"],expand:a,closeButton:l,className:c,offset:u,mobileOffset:d,theme:h="light",richColors:f,duration:p,style:m,visibleToasts:g=hb,toastOptions:b,dir:x=rc(),gap:w=gb,icons:v,containerAriaLabel:S="Notifications"}=t,[P,R]=L.useState([]),_=L.useMemo(()=>n?P.filter(B=>B.toasterId===n):P.filter(B=>!B.toasterId),[P,n]),C=L.useMemo(()=>Array.from(new Set([r].concat(_.filter(B=>B.position).map(B=>B.position)))),[_,r]),[N,j]=L.useState([]),[A,F]=L.useState(!1),[V,W]=L.useState(!1),[I,q]=L.useState(h!=="system"?h:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),z=L.useRef(null),rt=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),dt=L.useRef(null),M=L.useRef(!1),Y=L.useCallback(B=>{R(U=>{var et;return(et=U.find(ft=>ft.id===B.id))!=null&&et.delete||te.dismiss(B.id),U.filter(({id:ft})=>ft!==B.id)})},[]);return L.useEffect(()=>te.subscribe(B=>{if(B.dismiss){requestAnimationFrame(()=>{R(U=>U.map(et=>et.id===B.id?{...et,delete:!0}:et))});return}setTimeout(()=>{xd.flushSync(()=>{R(U=>{const et=U.findIndex(ft=>ft.id===B.id);return et!==-1?[...U.slice(0,et),{...U[et],...B},...U.slice(et+1)]:[B,...U]})})})}),[P]),L.useEffect(()=>{if(h!=="system"){q(h);return}if(h==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?q("dark"):q("light")),typeof window>"u")return;const B=window.matchMedia("(prefers-color-scheme: dark)");try{B.addEventListener("change",({matches:U})=>{q(U?"dark":"light")})}catch{B.addListener(({matches:et})=>{try{q(et?"dark":"light")}catch(ft){console.error(ft)}})}},[h]),L.useEffect(()=>{P.length<=1&&F(!1)},[P]),L.useEffect(()=>{const B=U=>{var et;if(o.every(it=>U[it]||U.code===it)){var Z;F(!0),(Z=z.current)==null||Z.focus()}U.code==="Escape"&&(document.activeElement===z.current||(et=z.current)!=null&&et.contains(document.activeElement))&&F(!1)};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[o]),L.useEffect(()=>{if(z.current)return()=>{dt.current&&(dt.current.focus({preventScroll:!0}),dt.current=null,M.current=!1)}},[z.current]),L.createElement("section",{ref:s,"aria-label":`${S} ${rt}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},C.map((B,U)=>{var et;const[ft,Z]=B.split("-");return _.length?L.createElement("ol",{key:B,dir:x==="auto"?rc():x,tabIndex:-1,ref:z,className:c,"data-sonner-toaster":!0,"data-sonner-theme":I,"data-y-position":ft,"data-x-position":Z,style:{"--front-toast-height":`${((et=N[0])==null?void 0:et.height)||0}px`,"--width":`${mb}px`,"--gap":`${w}px`,...m,..._b(u,d)},onBlur:it=>{M.current&&!it.currentTarget.contains(it.relatedTarget)&&(M.current=!1,dt.current&&(dt.current.focus({preventScroll:!0}),dt.current=null))},onFocus:it=>{it.target instanceof HTMLElement&&it.target.dataset.dismissible==="false"||M.current||(M.current=!0,dt.current=it.relatedTarget)},onMouseEnter:()=>F(!0),onMouseMove:()=>F(!0),onMouseLeave:()=>{V||F(!1)},onDragEnd:()=>F(!1),onPointerDown:it=>{it.target instanceof HTMLElement&&it.target.dataset.dismissible==="false"||W(!0)},onPointerUp:()=>W(!1)},_.filter(it=>!it.position&&U===0||it.position===B).map((it,kt)=>{var Ot,Bt;return L.createElement(vb,{key:it.id,icons:v,index:kt,toast:it,defaultRichColors:f,duration:(Ot=b?.duration)!=null?Ot:p,className:b?.className,descriptionClassName:b?.descriptionClassName,invert:i,visibleToasts:g,closeButton:(Bt=b?.closeButton)!=null?Bt:l,interacting:V,position:B,style:b?.style,unstyled:b?.unstyled,classNames:b?.classNames,cancelButtonStyle:b?.cancelButtonStyle,actionButtonStyle:b?.actionButtonStyle,closeButtonAriaLabel:b?.closeButtonAriaLabel,removeToast:Y,toasts:_.filter(Ht=>Ht.position==it.position),heights:N.filter(Ht=>Ht.position==it.position),setHeights:j,expandByDefault:a,gap:w,expanded:A,swipeDirections:t.swipeDirections})})):null}))}),oc=e=>{let t;const s=new Set,n=(c,u)=>{const d=typeof c=="function"?c(t):c;if(!Object.is(d,t)){const h=t;t=u??(typeof d!="object"||d===null)?d:Object.assign({},t,d),s.forEach(f=>f(t,h))}},i=()=>t,a={setState:n,getState:i,getInitialState:()=>l,subscribe:c=>(s.add(c),()=>s.delete(c))},l=t=e(n,i,a);return a},Sb=(e=>e?oc(e):oc),kb=e=>e;function Rb(e,t=kb){const s=L.useSyncExternalStore(e.subscribe,L.useCallback(()=>t(e.getState()),[e,t]),L.useCallback(()=>t(e.getInitialState()),[e,t]));return L.useDebugValue(s),s}const ac=e=>{const t=Sb(e),s=n=>Rb(t,n);return Object.assign(s,t),s},Jd=(e=>e?ac(e):ac);function Pb(e,t){let s;try{s=e()}catch{return}return{getItem:i=>{var r;const o=l=>l===null?null:JSON.parse(l,void 0),a=(r=s.getItem(i))!=null?r:null;return a instanceof Promise?a.then(o):o(a)},setItem:(i,r)=>s.setItem(i,JSON.stringify(r,void 0)),removeItem:i=>s.removeItem(i)}}const Yo=e=>t=>{try{const s=e(t);return s instanceof Promise?s:{then(n){return Yo(n)(s)},catch(n){return this}}}catch(s){return{then(n){return this},catch(n){return Yo(n)(s)}}}},Eb=(e,t)=>(s,n,i)=>{let r={storage:Pb(()=>localStorage),partialize:g=>g,version:0,merge:(g,b)=>({...b,...g}),...t},o=!1,a=0;const l=new Set,c=new Set;let u=r.storage;if(!u)return e((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),s(...g)},n,i);const d=()=>{const g=r.partialize({...n()});return u.setItem(r.name,{state:g,version:r.version})},h=i.setState;i.setState=(g,b)=>(h(g,b),d());const f=e((...g)=>(s(...g),d()),n,i);i.getInitialState=()=>f;let p;const m=()=>{var g,b;if(!u)return;const x=++a;o=!1,l.forEach(v=>{var S;return v((S=n())!=null?S:f)});const w=((b=r.onRehydrateStorage)==null?void 0:b.call(r,(g=n())!=null?g:f))||void 0;return Yo(u.getItem.bind(u))(r.name).then(v=>{if(v)if(typeof v.version=="number"&&v.version!==r.version){if(r.migrate){const S=r.migrate(v.state,v.version);return S instanceof Promise?S.then(P=>[!0,P]):[!0,S]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,v.state];return[!1,void 0]}).then(v=>{var S;if(x!==a)return;const[P,R]=v;if(p=r.merge(R,(S=n())!=null?S:f),s(p,!0),P)return d()}).then(()=>{x===a&&(w?.(p,void 0),p=n(),o=!0,c.forEach(v=>v(p)))}).catch(v=>{x===a&&w?.(void 0,v)})};return i.persist={setOptions:g=>{r={...r,...g},g.storage&&(u=g.storage)},clearStorage:()=>{u?.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>m(),hasHydrated:()=>o,onHydrate:g=>(l.add(g),()=>{l.delete(g)}),onFinishHydration:g=>(c.add(g),()=>{c.delete(g)})},r.skipHydration||m(),p||f},Cb=Eb;function Zd(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ob}=Object.prototype,{getPrototypeOf:Na}=Object,{iterator:Dr,toStringTag:th}=Symbol,Nr=(e=>t=>{const s=Ob.call(t);return e[s]||(e[s]=s.slice(8,-1).toLowerCase())})(Object.create(null)),Re=e=>(e=e.toLowerCase(),t=>Nr(t)===e),Fr=e=>t=>typeof t===e,{isArray:pn}=Array,un=Fr("undefined");function ci(e){return e!==null&&!un(e)&&e.constructor!==null&&!un(e.constructor)&&ie(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const eh=Re("ArrayBuffer");function Tb(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&eh(e.buffer),t}const Mb=Fr("string"),ie=Fr("function"),sh=Fr("number"),ui=e=>e!==null&&typeof e=="object",Ab=e=>e===!0||e===!1,Zi=e=>{if(Nr(e)!=="object")return!1;const t=Na(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(th in e)&&!(Dr in e)},Lb=e=>{if(!ui(e)||ci(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Db=Re("Date"),Nb=Re("File"),Fb=Re("Blob"),Ib=Re("FileList"),jb=e=>ui(e)&&ie(e.pipe),Bb=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||ie(e.append)&&((t=Nr(e))==="formdata"||t==="object"&&ie(e.toString)&&e.toString()==="[object FormData]"))},Vb=Re("URLSearchParams"),[zb,Hb,Ub,Wb]=["ReadableStream","Request","Response","Headers"].map(Re),$b=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function di(e,t,{allOwnKeys:s=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),pn(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(ci(e))return;const r=s?Object.getOwnPropertyNames(e):Object.keys(e),o=r.length;let a;for(n=0;n<o;n++)a=r[n],t.call(null,e[a],a,e)}}function nh(e,t){if(ci(e))return null;t=t.toLowerCase();const s=Object.keys(e);let n=s.length,i;for(;n-- >0;)if(i=s[n],t===i.toLowerCase())return i;return null}const Ls=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ih=e=>!un(e)&&e!==Ls;function Go(){const{caseless:e,skipUndefined:t}=ih(this)&&this||{},s={},n=(i,r)=>{const o=e&&nh(s,r)||r;Zi(s[o])&&Zi(i)?s[o]=Go(s[o],i):Zi(i)?s[o]=Go({},i):pn(i)?s[o]=i.slice():(!t||!un(i))&&(s[o]=i)};for(let i=0,r=arguments.length;i<r;i++)arguments[i]&&di(arguments[i],n);return s}const qb=(e,t,s,{allOwnKeys:n}={})=>(di(t,(i,r)=>{s&&ie(i)?Object.defineProperty(e,r,{value:Zd(i,s),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),Kb=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Yb=(e,t,s,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),s&&Object.assign(e.prototype,s)},Gb=(e,t,s,n)=>{let i,r,o;const a={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),r=i.length;r-- >0;)o=i[r],(!n||n(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=s!==!1&&Na(e)}while(e&&(!s||s(e,t))&&e!==Object.prototype);return t},Xb=(e,t,s)=>{e=String(e),(s===void 0||s>e.length)&&(s=e.length),s-=t.length;const n=e.indexOf(t,s);return n!==-1&&n===s},Qb=e=>{if(!e)return null;if(pn(e))return e;let t=e.length;if(!sh(t))return null;const s=new Array(t);for(;t-- >0;)s[t]=e[t];return s},Jb=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Na(Uint8Array)),Zb=(e,t)=>{const n=(e&&e[Dr]).call(e);let i;for(;(i=n.next())&&!i.done;){const r=i.value;t.call(e,r[0],r[1])}},ty=(e,t)=>{let s;const n=[];for(;(s=e.exec(t))!==null;)n.push(s);return n},ey=Re("HTMLFormElement"),sy=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(s,n,i){return n.toUpperCase()+i}),lc=(({hasOwnProperty:e})=>(t,s)=>e.call(t,s))(Object.prototype),ny=Re("RegExp"),rh=(e,t)=>{const s=Object.getOwnPropertyDescriptors(e),n={};di(s,(i,r)=>{let o;(o=t(i,r,e))!==!1&&(n[r]=o||i)}),Object.defineProperties(e,n)},iy=e=>{rh(e,(t,s)=>{if(ie(e)&&["arguments","caller","callee"].indexOf(s)!==-1)return!1;const n=e[s];if(ie(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")})}})},ry=(e,t)=>{const s={},n=i=>{i.forEach(r=>{s[r]=!0})};return pn(e)?n(e):n(String(e).split(t)),s},oy=()=>{},ay=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function ly(e){return!!(e&&ie(e.append)&&e[th]==="FormData"&&e[Dr])}const cy=e=>{const t=new Array(10),s=(n,i)=>{if(ui(n)){if(t.indexOf(n)>=0)return;if(ci(n))return n;if(!("toJSON"in n)){t[i]=n;const r=pn(n)?[]:{};return di(n,(o,a)=>{const l=s(o,i+1);!un(l)&&(r[a]=l)}),t[i]=void 0,r}}return n};return s(e,0)},uy=Re("AsyncFunction"),dy=e=>e&&(ui(e)||ie(e))&&ie(e.then)&&ie(e.catch),oh=((e,t)=>e?setImmediate:t?((s,n)=>(Ls.addEventListener("message",({source:i,data:r})=>{i===Ls&&r===s&&n.length&&n.shift()()},!1),i=>{n.push(i),Ls.postMessage(s,"*")}))(`axios@${Math.random()}`,[]):s=>setTimeout(s))(typeof setImmediate=="function",ie(Ls.postMessage)),hy=typeof queueMicrotask<"u"?queueMicrotask.bind(Ls):typeof process<"u"&&process.nextTick||oh,fy=e=>e!=null&&ie(e[Dr]),O={isArray:pn,isArrayBuffer:eh,isBuffer:ci,isFormData:Bb,isArrayBufferView:Tb,isString:Mb,isNumber:sh,isBoolean:Ab,isObject:ui,isPlainObject:Zi,isEmptyObject:Lb,isReadableStream:zb,isRequest:Hb,isResponse:Ub,isHeaders:Wb,isUndefined:un,isDate:Db,isFile:Nb,isBlob:Fb,isRegExp:ny,isFunction:ie,isStream:jb,isURLSearchParams:Vb,isTypedArray:Jb,isFileList:Ib,forEach:di,merge:Go,extend:qb,trim:$b,stripBOM:Kb,inherits:Yb,toFlatObject:Gb,kindOf:Nr,kindOfTest:Re,endsWith:Xb,toArray:Qb,forEachEntry:Zb,matchAll:ty,isHTMLForm:ey,hasOwnProperty:lc,hasOwnProp:lc,reduceDescriptors:rh,freezeMethods:iy,toObjectSet:ry,toCamelCase:sy,noop:oy,toFiniteNumber:ay,findKey:nh,global:Ls,isContextDefined:ih,isSpecCompliantForm:ly,toJSONObject:cy,isAsyncFn:uy,isThenable:dy,setImmediate:oh,asap:hy,isIterable:fy};let tt=class ah extends Error{static from(t,s,n,i,r,o){const a=new ah(t.message,s||t.code,n,i,r);return a.cause=t,a.name=t.name,o&&Object.assign(a,o),a}constructor(t,s,n,i,r){super(t),this.name="AxiosError",this.isAxiosError=!0,s&&(this.code=s),n&&(this.config=n),i&&(this.request=i),r&&(this.response=r,this.status=r.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:O.toJSONObject(this.config),code:this.code,status:this.status}}};tt.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";tt.ERR_BAD_OPTION="ERR_BAD_OPTION";tt.ECONNABORTED="ECONNABORTED";tt.ETIMEDOUT="ETIMEDOUT";tt.ERR_NETWORK="ERR_NETWORK";tt.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";tt.ERR_DEPRECATED="ERR_DEPRECATED";tt.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";tt.ERR_BAD_REQUEST="ERR_BAD_REQUEST";tt.ERR_CANCELED="ERR_CANCELED";tt.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";tt.ERR_INVALID_URL="ERR_INVALID_URL";const py=null;function Xo(e){return O.isPlainObject(e)||O.isArray(e)}function lh(e){return O.endsWith(e,"[]")?e.slice(0,-2):e}function cc(e,t,s){return e?e.concat(t).map(function(i,r){return i=lh(i),!s&&r?"["+i+"]":i}).join(s?".":""):t}function my(e){return O.isArray(e)&&!e.some(Xo)}const gy=O.toFlatObject(O,{},null,function(t){return/^is[A-Z]/.test(t)});function Ir(e,t,s){if(!O.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,s=O.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,g){return!O.isUndefined(g[m])});const n=s.metaTokens,i=s.visitor||u,r=s.dots,o=s.indexes,l=(s.Blob||typeof Blob<"u"&&Blob)&&O.isSpecCompliantForm(t);if(!O.isFunction(i))throw new TypeError("visitor must be a function");function c(p){if(p===null)return"";if(O.isDate(p))return p.toISOString();if(O.isBoolean(p))return p.toString();if(!l&&O.isBlob(p))throw new tt("Blob is not supported. Use a Buffer instead.");return O.isArrayBuffer(p)||O.isTypedArray(p)?l&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function u(p,m,g){let b=p;if(p&&!g&&typeof p=="object"){if(O.endsWith(m,"{}"))m=n?m:m.slice(0,-2),p=JSON.stringify(p);else if(O.isArray(p)&&my(p)||(O.isFileList(p)||O.endsWith(m,"[]"))&&(b=O.toArray(p)))return m=lh(m),b.forEach(function(w,v){!(O.isUndefined(w)||w===null)&&t.append(o===!0?cc([m],v,r):o===null?m:m+"[]",c(w))}),!1}return Xo(p)?!0:(t.append(cc(g,m,r),c(p)),!1)}const d=[],h=Object.assign(gy,{defaultVisitor:u,convertValue:c,isVisitable:Xo});function f(p,m){if(!O.isUndefined(p)){if(d.indexOf(p)!==-1)throw Error("Circular reference detected in "+m.join("."));d.push(p),O.forEach(p,function(b,x){(!(O.isUndefined(b)||b===null)&&i.call(t,b,O.isString(x)?x.trim():x,m,h))===!0&&f(b,m?m.concat(x):[x])}),d.pop()}}if(!O.isObject(e))throw new TypeError("data must be an object");return f(e),t}function uc(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Fa(e,t){this._pairs=[],e&&Ir(e,this,t)}const ch=Fa.prototype;ch.append=function(t,s){this._pairs.push([t,s])};ch.toString=function(t){const s=t?function(n){return t.call(this,n,uc)}:uc;return this._pairs.map(function(i){return s(i[0])+"="+s(i[1])},"").join("&")};function by(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function uh(e,t,s){if(!t)return e;const n=s&&s.encode||by,i=O.isFunction(s)?{serialize:s}:s,r=i&&i.serialize;let o;if(r?o=r(t,i):o=O.isURLSearchParams(t)?t.toString():new Fa(t,i).toString(n),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class dc{constructor(){this.handlers=[]}use(t,s,n){return this.handlers.push({fulfilled:t,rejected:s,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){O.forEach(this.handlers,function(n){n!==null&&t(n)})}}const dh={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},yy=typeof URLSearchParams<"u"?URLSearchParams:Fa,xy=typeof FormData<"u"?FormData:null,vy=typeof Blob<"u"?Blob:null,_y={isBrowser:!0,classes:{URLSearchParams:yy,FormData:xy,Blob:vy},protocols:["http","https","file","blob","url","data"]},Ia=typeof window<"u"&&typeof document<"u",Qo=typeof navigator=="object"&&navigator||void 0,wy=Ia&&(!Qo||["ReactNative","NativeScript","NS"].indexOf(Qo.product)<0),Sy=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",ky=Ia&&window.location.href||"http://localhost",Ry=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ia,hasStandardBrowserEnv:wy,hasStandardBrowserWebWorkerEnv:Sy,navigator:Qo,origin:ky},Symbol.toStringTag,{value:"Module"})),qt={...Ry,..._y};function Py(e,t){return Ir(e,new qt.classes.URLSearchParams,{visitor:function(s,n,i,r){return qt.isNode&&O.isBuffer(s)?(this.append(n,s.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}function Ey(e){return O.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Cy(e){const t={},s=Object.keys(e);let n;const i=s.length;let r;for(n=0;n<i;n++)r=s[n],t[r]=e[r];return t}function hh(e){function t(s,n,i,r){let o=s[r++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),l=r>=s.length;return o=!o&&O.isArray(i)?i.length:o,l?(O.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!O.isObject(i[o]))&&(i[o]=[]),t(s,n,i[o],r)&&O.isArray(i[o])&&(i[o]=Cy(i[o])),!a)}if(O.isFormData(e)&&O.isFunction(e.entries)){const s={};return O.forEachEntry(e,(n,i)=>{t(Ey(n),i,s,0)}),s}return null}function Oy(e,t,s){if(O.isString(e))try{return(t||JSON.parse)(e),O.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(s||JSON.stringify)(e)}const hi={transitional:dh,adapter:["xhr","http","fetch"],transformRequest:[function(t,s){const n=s.getContentType()||"",i=n.indexOf("application/json")>-1,r=O.isObject(t);if(r&&O.isHTMLForm(t)&&(t=new FormData(t)),O.isFormData(t))return i?JSON.stringify(hh(t)):t;if(O.isArrayBuffer(t)||O.isBuffer(t)||O.isStream(t)||O.isFile(t)||O.isBlob(t)||O.isReadableStream(t))return t;if(O.isArrayBufferView(t))return t.buffer;if(O.isURLSearchParams(t))return s.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(r){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Py(t,this.formSerializer).toString();if((a=O.isFileList(t))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Ir(a?{"files[]":t}:t,l&&new l,this.formSerializer)}}return r||i?(s.setContentType("application/json",!1),Oy(t)):t}],transformResponse:[function(t){const s=this.transitional||hi.transitional,n=s&&s.forcedJSONParsing,i=this.responseType==="json";if(O.isResponse(t)||O.isReadableStream(t))return t;if(t&&O.isString(t)&&(n&&!this.responseType||i)){const o=!(s&&s.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(a){if(o)throw a.name==="SyntaxError"?tt.from(a,tt.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:qt.classes.FormData,Blob:qt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};O.forEach(["delete","get","head","post","put","patch"],e=>{hi.headers[e]={}});const Ty=O.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),My=e=>{const t={};let s,n,i;return e&&e.split(`
7
- `).forEach(function(o){i=o.indexOf(":"),s=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!s||t[s]&&Ty[s])&&(s==="set-cookie"?t[s]?t[s].push(n):t[s]=[n]:t[s]=t[s]?t[s]+", "+n:n)}),t},hc=Symbol("internals");function En(e){return e&&String(e).trim().toLowerCase()}function tr(e){return e===!1||e==null?e:O.isArray(e)?e.map(tr):String(e)}function Ay(e){const t=Object.create(null),s=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=s.exec(e);)t[n[1]]=n[2];return t}const Ly=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function fo(e,t,s,n,i){if(O.isFunction(n))return n.call(this,t,s);if(i&&(t=s),!!O.isString(t)){if(O.isString(n))return t.indexOf(n)!==-1;if(O.isRegExp(n))return n.test(t)}}function Dy(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,s,n)=>s.toUpperCase()+n)}function Ny(e,t){const s=O.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+s,{value:function(i,r,o){return this[n].call(this,t,i,r,o)},configurable:!0})})}let re=class{constructor(t){t&&this.set(t)}set(t,s,n){const i=this;function r(a,l,c){const u=En(l);if(!u)throw new Error("header name must be a non-empty string");const d=O.findKey(i,u);(!d||i[d]===void 0||c===!0||c===void 0&&i[d]!==!1)&&(i[d||l]=tr(a))}const o=(a,l)=>O.forEach(a,(c,u)=>r(c,u,l));if(O.isPlainObject(t)||t instanceof this.constructor)o(t,s);else if(O.isString(t)&&(t=t.trim())&&!Ly(t))o(My(t),s);else if(O.isObject(t)&&O.isIterable(t)){let a={},l,c;for(const u of t){if(!O.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[c=u[0]]=(l=a[c])?O.isArray(l)?[...l,u[1]]:[l,u[1]]:u[1]}o(a,s)}else t!=null&&r(s,t,n);return this}get(t,s){if(t=En(t),t){const n=O.findKey(this,t);if(n){const i=this[n];if(!s)return i;if(s===!0)return Ay(i);if(O.isFunction(s))return s.call(this,i,n);if(O.isRegExp(s))return s.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,s){if(t=En(t),t){const n=O.findKey(this,t);return!!(n&&this[n]!==void 0&&(!s||fo(this,this[n],n,s)))}return!1}delete(t,s){const n=this;let i=!1;function r(o){if(o=En(o),o){const a=O.findKey(n,o);a&&(!s||fo(n,n[a],a,s))&&(delete n[a],i=!0)}}return O.isArray(t)?t.forEach(r):r(t),i}clear(t){const s=Object.keys(this);let n=s.length,i=!1;for(;n--;){const r=s[n];(!t||fo(this,this[r],r,t,!0))&&(delete this[r],i=!0)}return i}normalize(t){const s=this,n={};return O.forEach(this,(i,r)=>{const o=O.findKey(n,r);if(o){s[o]=tr(i),delete s[r];return}const a=t?Dy(r):String(r).trim();a!==r&&delete s[r],s[a]=tr(i),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const s=Object.create(null);return O.forEach(this,(n,i)=>{n!=null&&n!==!1&&(s[i]=t&&O.isArray(n)?n.join(", "):n)}),s}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,s])=>t+": "+s).join(`
8
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...s){const n=new this(t);return s.forEach(i=>n.set(i)),n}static accessor(t){const n=(this[hc]=this[hc]={accessors:{}}).accessors,i=this.prototype;function r(o){const a=En(o);n[a]||(Ny(i,o),n[a]=!0)}return O.isArray(t)?t.forEach(r):r(t),this}};re.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);O.reduceDescriptors(re.prototype,({value:e},t)=>{let s=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[s]=n}}});O.freezeMethods(re);function po(e,t){const s=this||hi,n=t||s,i=re.from(n.headers);let r=n.data;return O.forEach(e,function(a){r=a.call(s,r,i.normalize(),t?t.status:void 0)}),i.normalize(),r}function fh(e){return!!(e&&e.__CANCEL__)}let fi=class extends tt{constructor(t,s,n){super(t??"canceled",tt.ERR_CANCELED,s,n),this.name="CanceledError",this.__CANCEL__=!0}};function ph(e,t,s){const n=s.config.validateStatus;!s.status||!n||n(s.status)?e(s):t(new tt("Request failed with status code "+s.status,[tt.ERR_BAD_REQUEST,tt.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s))}function Fy(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Iy(e,t){e=e||10;const s=new Array(e),n=new Array(e);let i=0,r=0,o;return t=t!==void 0?t:1e3,function(l){const c=Date.now(),u=n[r];o||(o=c),s[i]=l,n[i]=c;let d=r,h=0;for(;d!==i;)h+=s[d++],d=d%e;if(i=(i+1)%e,i===r&&(r=(r+1)%e),c-o<t)return;const f=u&&c-u;return f?Math.round(h*1e3/f):void 0}}function jy(e,t){let s=0,n=1e3/t,i,r;const o=(c,u=Date.now())=>{s=u,i=null,r&&(clearTimeout(r),r=null),e(...c)};return[(...c)=>{const u=Date.now(),d=u-s;d>=n?o(c,u):(i=c,r||(r=setTimeout(()=>{r=null,o(i)},n-d)))},()=>i&&o(i)]}const yr=(e,t,s=3)=>{let n=0;const i=Iy(50,250);return jy(r=>{const o=r.loaded,a=r.lengthComputable?r.total:void 0,l=o-n,c=i(l),u=o<=a;n=o;const d={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&u?(a-o)/c:void 0,event:r,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(d)},s)},fc=(e,t)=>{const s=e!=null;return[n=>t[0]({lengthComputable:s,total:e,loaded:n}),t[1]]},pc=e=>(...t)=>O.asap(()=>e(...t)),By=qt.hasStandardBrowserEnv?((e,t)=>s=>(s=new URL(s,qt.origin),e.protocol===s.protocol&&e.host===s.host&&(t||e.port===s.port)))(new URL(qt.origin),qt.navigator&&/(msie|trident)/i.test(qt.navigator.userAgent)):()=>!0,Vy=qt.hasStandardBrowserEnv?{write(e,t,s,n,i,r,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];O.isNumber(s)&&a.push(`expires=${new Date(s).toUTCString()}`),O.isString(n)&&a.push(`path=${n}`),O.isString(i)&&a.push(`domain=${i}`),r===!0&&a.push("secure"),O.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function zy(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Hy(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function mh(e,t,s){let n=!zy(t);return e&&(n||s==!1)?Hy(e,t):t}const mc=e=>e instanceof re?{...e}:e;function Us(e,t){t=t||{};const s={};function n(c,u,d,h){return O.isPlainObject(c)&&O.isPlainObject(u)?O.merge.call({caseless:h},c,u):O.isPlainObject(u)?O.merge({},u):O.isArray(u)?u.slice():u}function i(c,u,d,h){if(O.isUndefined(u)){if(!O.isUndefined(c))return n(void 0,c,d,h)}else return n(c,u,d,h)}function r(c,u){if(!O.isUndefined(u))return n(void 0,u)}function o(c,u){if(O.isUndefined(u)){if(!O.isUndefined(c))return n(void 0,c)}else return n(void 0,u)}function a(c,u,d){if(d in t)return n(c,u);if(d in e)return n(void 0,c)}const l={url:r,method:r,data:r,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,u,d)=>i(mc(c),mc(u),d,!0)};return O.forEach(Object.keys({...e,...t}),function(u){const d=l[u]||i,h=d(e[u],t[u],u);O.isUndefined(h)&&d!==a||(s[u]=h)}),s}const gh=e=>{const t=Us({},e);let{data:s,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:r,headers:o,auth:a}=t;if(t.headers=o=re.from(o),t.url=uh(mh(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),O.isFormData(s)){if(qt.hasStandardBrowserEnv||qt.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(O.isFunction(s.getHeaders)){const l=s.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,d])=>{c.includes(u.toLowerCase())&&o.set(u,d)})}}if(qt.hasStandardBrowserEnv&&(n&&O.isFunction(n)&&(n=n(t)),n||n!==!1&&By(t.url))){const l=i&&r&&Vy.read(r);l&&o.set(i,l)}return t},Uy=typeof XMLHttpRequest<"u",Wy=Uy&&function(e){return new Promise(function(s,n){const i=gh(e);let r=i.data;const o=re.from(i.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=i,u,d,h,f,p;function m(){f&&f(),p&&p(),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let g=new XMLHttpRequest;g.open(i.method.toUpperCase(),i.url,!0),g.timeout=i.timeout;function b(){if(!g)return;const w=re.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),S={data:!a||a==="text"||a==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:w,config:e,request:g};ph(function(R){s(R),m()},function(R){n(R),m()},S),g=null}"onloadend"in g?g.onloadend=b:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(b)},g.onabort=function(){g&&(n(new tt("Request aborted",tt.ECONNABORTED,e,g)),g=null)},g.onerror=function(v){const S=v&&v.message?v.message:"Network Error",P=new tt(S,tt.ERR_NETWORK,e,g);P.event=v||null,n(P),g=null},g.ontimeout=function(){let v=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const S=i.transitional||dh;i.timeoutErrorMessage&&(v=i.timeoutErrorMessage),n(new tt(v,S.clarifyTimeoutError?tt.ETIMEDOUT:tt.ECONNABORTED,e,g)),g=null},r===void 0&&o.setContentType(null),"setRequestHeader"in g&&O.forEach(o.toJSON(),function(v,S){g.setRequestHeader(S,v)}),O.isUndefined(i.withCredentials)||(g.withCredentials=!!i.withCredentials),a&&a!=="json"&&(g.responseType=i.responseType),c&&([h,p]=yr(c,!0),g.addEventListener("progress",h)),l&&g.upload&&([d,f]=yr(l),g.upload.addEventListener("progress",d),g.upload.addEventListener("loadend",f)),(i.cancelToken||i.signal)&&(u=w=>{g&&(n(!w||w.type?new fi(null,e,g):w),g.abort(),g=null)},i.cancelToken&&i.cancelToken.subscribe(u),i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u)));const x=Fy(i.url);if(x&&qt.protocols.indexOf(x)===-1){n(new tt("Unsupported protocol "+x+":",tt.ERR_BAD_REQUEST,e));return}g.send(r||null)})},$y=(e,t)=>{const{length:s}=e=e?e.filter(Boolean):[];if(t||s){let n=new AbortController,i;const r=function(c){if(!i){i=!0,a();const u=c instanceof Error?c:this.reason;n.abort(u instanceof tt?u:new fi(u instanceof Error?u.message:u))}};let o=t&&setTimeout(()=>{o=null,r(new tt(`timeout of ${t}ms exceeded`,tt.ETIMEDOUT))},t);const a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(r):c.removeEventListener("abort",r)}),e=null)};e.forEach(c=>c.addEventListener("abort",r));const{signal:l}=n;return l.unsubscribe=()=>O.asap(a),l}},qy=function*(e,t){let s=e.byteLength;if(s<t){yield e;return}let n=0,i;for(;n<s;)i=n+t,yield e.slice(n,i),n=i},Ky=async function*(e,t){for await(const s of Yy(e))yield*qy(s,t)},Yy=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:s,value:n}=await t.read();if(s)break;yield n}}finally{await t.cancel()}},gc=(e,t,s,n)=>{const i=Ky(e,t);let r=0,o,a=l=>{o||(o=!0,n&&n(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await i.next();if(c){a(),l.close();return}let d=u.byteLength;if(s){let h=r+=d;s(h)}l.enqueue(new Uint8Array(u))}catch(c){throw a(c),c}},cancel(l){return a(l),i.return()}},{highWaterMark:2})},bc=64*1024,{isFunction:Mi}=O,Gy=(({Request:e,Response:t})=>({Request:e,Response:t}))(O.global),{ReadableStream:yc,TextEncoder:xc}=O.global,vc=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Xy=e=>{e=O.merge.call({skipUndefined:!0},Gy,e);const{fetch:t,Request:s,Response:n}=e,i=t?Mi(t):typeof fetch=="function",r=Mi(s),o=Mi(n);if(!i)return!1;const a=i&&Mi(yc),l=i&&(typeof xc=="function"?(p=>m=>p.encode(m))(new xc):async p=>new Uint8Array(await new s(p).arrayBuffer())),c=r&&a&&vc(()=>{let p=!1;const m=new s(qt.origin,{body:new yc,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!m}),u=o&&a&&vc(()=>O.isReadableStream(new n("").body)),d={stream:u&&(p=>p.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!d[p]&&(d[p]=(m,g)=>{let b=m&&m[p];if(b)return b.call(m);throw new tt(`Response type '${p}' is not supported`,tt.ERR_NOT_SUPPORT,g)})});const h=async p=>{if(p==null)return 0;if(O.isBlob(p))return p.size;if(O.isSpecCompliantForm(p))return(await new s(qt.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(O.isArrayBufferView(p)||O.isArrayBuffer(p))return p.byteLength;if(O.isURLSearchParams(p)&&(p=p+""),O.isString(p))return(await l(p)).byteLength},f=async(p,m)=>{const g=O.toFiniteNumber(p.getContentLength());return g??h(m)};return async p=>{let{url:m,method:g,data:b,signal:x,cancelToken:w,timeout:v,onDownloadProgress:S,onUploadProgress:P,responseType:R,headers:_,withCredentials:C="same-origin",fetchOptions:N}=gh(p),j=t||fetch;R=R?(R+"").toLowerCase():"text";let A=$y([x,w&&w.toAbortSignal()],v),F=null;const V=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let W;try{if(P&&c&&g!=="get"&&g!=="head"&&(W=await f(_,b))!==0){let M=new s(m,{method:"POST",body:b,duplex:"half"}),Y;if(O.isFormData(b)&&(Y=M.headers.get("content-type"))&&_.setContentType(Y),M.body){const[B,U]=fc(W,yr(pc(P)));b=gc(M.body,bc,B,U)}}O.isString(C)||(C=C?"include":"omit");const I=r&&"credentials"in s.prototype,q={...N,signal:A,method:g.toUpperCase(),headers:_.normalize().toJSON(),body:b,duplex:"half",credentials:I?C:void 0};F=r&&new s(m,q);let z=await(r?j(F,N):j(m,q));const rt=u&&(R==="stream"||R==="response");if(u&&(S||rt&&V)){const M={};["status","statusText","headers"].forEach(et=>{M[et]=z[et]});const Y=O.toFiniteNumber(z.headers.get("content-length")),[B,U]=S&&fc(Y,yr(pc(S),!0))||[];z=new n(gc(z.body,bc,B,()=>{U&&U(),V&&V()}),M)}R=R||"text";let dt=await d[O.findKey(d,R)||"text"](z,p);return!rt&&V&&V(),await new Promise((M,Y)=>{ph(M,Y,{data:dt,headers:re.from(z.headers),status:z.status,statusText:z.statusText,config:p,request:F})})}catch(I){throw V&&V(),I&&I.name==="TypeError"&&/Load failed|fetch/i.test(I.message)?Object.assign(new tt("Network Error",tt.ERR_NETWORK,p,F),{cause:I.cause||I}):tt.from(I,I&&I.code,p,F)}}},Qy=new Map,bh=e=>{let t=e&&e.env||{};const{fetch:s,Request:n,Response:i}=t,r=[n,i,s];let o=r.length,a=o,l,c,u=Qy;for(;a--;)l=r[a],c=u.get(l),c===void 0&&u.set(l,c=a?new Map:Xy(t)),u=c;return c};bh();const ja={http:py,xhr:Wy,fetch:{get:bh}};O.forEach(ja,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const _c=e=>`- ${e}`,Jy=e=>O.isFunction(e)||e===null||e===!1;function Zy(e,t){e=O.isArray(e)?e:[e];const{length:s}=e;let n,i;const r={};for(let o=0;o<s;o++){n=e[o];let a;if(i=n,!Jy(n)&&(i=ja[(a=String(n)).toLowerCase()],i===void 0))throw new tt(`Unknown adapter '${a}'`);if(i&&(O.isFunction(i)||(i=i.get(t))))break;r[a||"#"+o]=i}if(!i){const o=Object.entries(r).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=s?o.length>1?`since :
9
- `+o.map(_c).join(`
10
- `):" "+_c(o[0]):"as no adapter specified";throw new tt("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return i}const yh={getAdapter:Zy,adapters:ja};function mo(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new fi(null,e)}function wc(e){return mo(e),e.headers=re.from(e.headers),e.data=po.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),yh.getAdapter(e.adapter||hi.adapter,e)(e).then(function(n){return mo(e),n.data=po.call(e,e.transformResponse,n),n.headers=re.from(n.headers),n},function(n){return fh(n)||(mo(e),n&&n.response&&(n.response.data=po.call(e,e.transformResponse,n.response),n.response.headers=re.from(n.response.headers))),Promise.reject(n)})}const xh="1.13.4",jr={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{jr[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Sc={};jr.transitional=function(t,s,n){function i(r,o){return"[Axios v"+xh+"] Transitional option '"+r+"'"+o+(n?". "+n:"")}return(r,o,a)=>{if(t===!1)throw new tt(i(o," has been removed"+(s?" in "+s:"")),tt.ERR_DEPRECATED);return s&&!Sc[o]&&(Sc[o]=!0,console.warn(i(o," has been deprecated since v"+s+" and will be removed in the near future"))),t?t(r,o,a):!0}};jr.spelling=function(t){return(s,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function tx(e,t,s){if(typeof e!="object")throw new tt("options must be an object",tt.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const r=n[i],o=t[r];if(o){const a=e[r],l=a===void 0||o(a,r,e);if(l!==!0)throw new tt("option "+r+" must be "+l,tt.ERR_BAD_OPTION_VALUE);continue}if(s!==!0)throw new tt("Unknown option "+r,tt.ERR_BAD_OPTION)}}const er={assertOptions:tx,validators:jr},Ce=er.validators;let Is=class{constructor(t){this.defaults=t||{},this.interceptors={request:new dc,response:new dc}}async request(t,s){try{return await this._request(t,s)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const r=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?r&&!String(n.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(n.stack+=`
11
- `+r):n.stack=r}catch{}}throw n}}_request(t,s){typeof t=="string"?(s=s||{},s.url=t):s=t||{},s=Us(this.defaults,s);const{transitional:n,paramsSerializer:i,headers:r}=s;n!==void 0&&er.assertOptions(n,{silentJSONParsing:Ce.transitional(Ce.boolean),forcedJSONParsing:Ce.transitional(Ce.boolean),clarifyTimeoutError:Ce.transitional(Ce.boolean)},!1),i!=null&&(O.isFunction(i)?s.paramsSerializer={serialize:i}:er.assertOptions(i,{encode:Ce.function,serialize:Ce.function},!0)),s.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?s.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:s.allowAbsoluteUrls=!0),er.assertOptions(s,{baseUrl:Ce.spelling("baseURL"),withXsrfToken:Ce.spelling("withXSRFToken")},!0),s.method=(s.method||this.defaults.method||"get").toLowerCase();let o=r&&O.merge(r.common,r[s.method]);r&&O.forEach(["delete","get","head","post","put","patch","common"],p=>{delete r[p]}),s.headers=re.concat(o,r);const a=[];let l=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(s)===!1||(l=l&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const c=[];this.interceptors.response.forEach(function(m){c.push(m.fulfilled,m.rejected)});let u,d=0,h;if(!l){const p=[wc.bind(this),void 0];for(p.unshift(...a),p.push(...c),h=p.length,u=Promise.resolve(s);d<h;)u=u.then(p[d++],p[d++]);return u}h=a.length;let f=s;for(;d<h;){const p=a[d++],m=a[d++];try{f=p(f)}catch(g){m.call(this,g);break}}try{u=wc.call(this,f)}catch(p){return Promise.reject(p)}for(d=0,h=c.length;d<h;)u=u.then(c[d++],c[d++]);return u}getUri(t){t=Us(this.defaults,t);const s=mh(t.baseURL,t.url,t.allowAbsoluteUrls);return uh(s,t.params,t.paramsSerializer)}};O.forEach(["delete","get","head","options"],function(t){Is.prototype[t]=function(s,n){return this.request(Us(n||{},{method:t,url:s,data:(n||{}).data}))}});O.forEach(["post","put","patch"],function(t){function s(n){return function(r,o,a){return this.request(Us(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:r,data:o}))}}Is.prototype[t]=s(),Is.prototype[t+"Form"]=s(!0)});let ex=class vh{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(r){s=r});const n=this;this.promise.then(i=>{if(!n._listeners)return;let r=n._listeners.length;for(;r-- >0;)n._listeners[r](i);n._listeners=null}),this.promise.then=i=>{let r;const o=new Promise(a=>{n.subscribe(a),r=a}).then(i);return o.cancel=function(){n.unsubscribe(r)},o},t(function(r,o,a){n.reason||(n.reason=new fi(r,o,a),s(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const s=this._listeners.indexOf(t);s!==-1&&this._listeners.splice(s,1)}toAbortSignal(){const t=new AbortController,s=n=>{t.abort(n)};return this.subscribe(s),t.signal.unsubscribe=()=>this.unsubscribe(s),t.signal}static source(){let t;return{token:new vh(function(i){t=i}),cancel:t}}};function sx(e){return function(s){return e.apply(null,s)}}function nx(e){return O.isObject(e)&&e.isAxiosError===!0}const Jo={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Jo).forEach(([e,t])=>{Jo[t]=e});function _h(e){const t=new Is(e),s=Zd(Is.prototype.request,t);return O.extend(s,Is.prototype,t,{allOwnKeys:!0}),O.extend(s,t,null,{allOwnKeys:!0}),s.create=function(i){return _h(Us(e,i))},s}const Ct=_h(hi);Ct.Axios=Is;Ct.CanceledError=fi;Ct.CancelToken=ex;Ct.isCancel=fh;Ct.VERSION=xh;Ct.toFormData=Ir;Ct.AxiosError=tt;Ct.Cancel=Ct.CanceledError;Ct.all=function(t){return Promise.all(t)};Ct.spread=sx;Ct.isAxiosError=nx;Ct.mergeConfig=Us;Ct.AxiosHeaders=re;Ct.formToJSON=e=>hh(O.isHTMLForm(e)?new FormData(e):e);Ct.getAdapter=yh.getAdapter;Ct.HttpStatusCode=Jo;Ct.default=Ct;const{Axios:cP,AxiosError:uP,CanceledError:dP,isCancel:hP,CancelToken:fP,VERSION:pP,all:mP,Cancel:gP,isAxiosError:bP,spread:yP,toFormData:xP,AxiosHeaders:vP,HttpStatusCode:_P,formToJSON:wP,getAdapter:SP,mergeConfig:kP}=Ct,Zo={apiBase:"http://localhost:3000/api",wsPath:"/ws"},bt=Ct.create({baseURL:Zo.apiBase});function ta(e){e?bt.defaults.headers.common.Authorization=`Bearer ${e}`:delete bt.defaults.headers.common.Authorization}const Br=Jd()(Cb(e=>({token:null,email:null,setAuth:(t,s)=>{ta(t),e({token:t,email:s})},logout:()=>{ta(null),e({token:null,email:null})}}),{name:"kuma_clone_auth"})),kc=Br.getState();kc.token&&ta(kc.token);const wh="pulsewatch.theme";function ea(e){const t=document.documentElement;e==="dark"?t.classList.add("dark"):t.classList.remove("dark"),t.style.colorScheme=e,localStorage.setItem(wh,e)}const Sh=Jd((e,t)=>({mode:"light",setMode:s=>{ea(s),e({mode:s})},toggle:()=>{const s=t().mode==="dark"?"light":"dark";ea(s),e({mode:s})}}));function ix(){const t=localStorage.getItem(wh)==="dark"?"dark":"light";ea(t),Sh.setState({mode:t})}var pi=e=>e.type==="checkbox",Ds=e=>e instanceof Date,se=e=>e==null;const kh=e=>typeof e=="object";var At=e=>!se(e)&&!Array.isArray(e)&&kh(e)&&!Ds(e),rx=e=>At(e)&&e.target?pi(e.target)?e.target.checked:e.target.value:e,ox=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,ax=(e,t)=>e.has(ox(t)),lx=e=>{const t=e.constructor&&e.constructor.prototype;return At(t)&&t.hasOwnProperty("isPrototypeOf")},Ba=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Dt(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(Ba&&(e instanceof Blob||t))return e;const s=Array.isArray(e);if(!s&&!(At(e)&&lx(e)))return e;const n=s?[]:Object.create(Object.getPrototypeOf(e));for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=Dt(e[i]));return n}var Vr=e=>/^\w*$/.test(e),St=e=>e===void 0,Va=e=>Array.isArray(e)?e.filter(Boolean):[],za=e=>Va(e.replace(/["|']|\]/g,"").split(/\.|\[/)),J=(e,t,s)=>{if(!t||!At(e))return s;const n=(Vr(t)?[t]:za(t)).reduce((i,r)=>se(i)?i:i[r],e);return St(n)||n===e?St(e[t])?s:e[t]:n},Me=e=>typeof e=="boolean",we=e=>typeof e=="function",vt=(e,t,s)=>{let n=-1;const i=Vr(t)?[t]:za(t),r=i.length,o=r-1;for(;++n<r;){const a=i[n];let l=s;if(n!==o){const c=e[a];l=At(c)||Array.isArray(c)?c:isNaN(+i[n+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=l,e=e[a]}};const Rc={BLUR:"blur",FOCUS_OUT:"focusout"},Se={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Be={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},cx=L.createContext(null);cx.displayName="HookFormControlContext";var ux=(e,t,s,n=!0)=>{const i={defaultValues:t._defaultValues};for(const r in e)Object.defineProperty(i,r,{get:()=>{const o=r;return t._proxyFormState[o]!==Se.all&&(t._proxyFormState[o]=!n||Se.all),e[o]}});return i};const dx=typeof window<"u"?L.useLayoutEffect:L.useEffect;var le=e=>typeof e=="string",hx=(e,t,s,n,i)=>le(e)?(n&&t.watch.add(e),J(s,e,i)):Array.isArray(e)?e.map(r=>(n&&t.watch.add(r),J(s,r))):(n&&(t.watchAll=!0),s),sa=e=>se(e)||!kh(e);function ns(e,t,s=new WeakSet){if(sa(e)||sa(t))return Object.is(e,t);if(Ds(e)&&Ds(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;if(s.has(e)||s.has(t))return!0;s.add(e),s.add(t);for(const r of n){const o=e[r];if(!i.includes(r))return!1;if(r!=="ref"){const a=t[r];if(Ds(o)&&Ds(a)||At(o)&&At(a)||Array.isArray(o)&&Array.isArray(a)?!ns(o,a,s):!Object.is(o,a))return!1}}return!0}const fx=L.createContext(null);fx.displayName="HookFormContext";var px=(e,t,s,n,i)=>t?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[n]:i||!0}}:{},Wn=e=>Array.isArray(e)?e:[e],Pc=()=>{let e=[];return{get observers(){return e},next:i=>{for(const r of e)r.next&&r.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(r=>r!==i)}}),unsubscribe:()=>{e=[]}}};function Rh(e,t){const s={};for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],r=t[n];if(i&&At(i)&&r){const o=Rh(i,r);At(o)&&(s[n]=o)}else e[n]&&(s[n]=r)}return s}var Xt=e=>At(e)&&!Object.keys(e).length,Ha=e=>e.type==="file",xr=e=>{if(!Ba)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ph=e=>e.type==="select-multiple",Ua=e=>e.type==="radio",mx=e=>Ua(e)||pi(e),go=e=>xr(e)&&e.isConnected;function gx(e,t){const s=t.slice(0,-1).length;let n=0;for(;n<s;)e=St(e)?n++:e[t[n++]];return e}function bx(e){for(const t in e)if(e.hasOwnProperty(t)&&!St(e[t]))return!1;return!0}function Tt(e,t){const s=Array.isArray(t)?t:Vr(t)?[t]:za(t),n=s.length===1?e:gx(e,s),i=s.length-1,r=s[i];return n&&delete n[r],i!==0&&(At(n)&&Xt(n)||Array.isArray(n)&&bx(n))&&Tt(e,s.slice(0,-1)),e}var yx=e=>{for(const t in e)if(we(e[t]))return!0;return!1};function Eh(e){return Array.isArray(e)||At(e)&&!yx(e)}function na(e,t={}){for(const s in e){const n=e[s];Eh(n)?(t[s]=Array.isArray(n)?[]:{},na(n,t[s])):St(n)||(t[s]=!0)}return t}function sn(e,t,s){s||(s=na(t));for(const n in e){const i=e[n];if(Eh(i))St(t)||sa(s[n])?s[n]=na(i,Array.isArray(i)?[]:{}):sn(i,se(t)?{}:t[n],s[n]);else{const r=t[n];s[n]=!ns(i,r)}}return s}const Ec={value:!1,isValid:!1},Cc={value:!0,isValid:!0};var Ch=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!St(e[0].attributes.value)?St(e[0].value)||e[0].value===""?Cc:{value:e[0].value,isValid:!0}:Cc:Ec}return Ec},Oh=(e,{valueAsNumber:t,valueAsDate:s,setValueAs:n})=>St(e)?e:t?e===""?NaN:e&&+e:s&&le(e)?new Date(e):n?n(e):e;const Oc={isValid:!1,value:null};var Th=e=>Array.isArray(e)?e.reduce((t,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:t,Oc):Oc;function Tc(e){const t=e.ref;return Ha(t)?t.files:Ua(t)?Th(e.refs).value:Ph(t)?[...t.selectedOptions].map(({value:s})=>s):pi(t)?Ch(e.refs).value:Oh(St(t.value)?e.ref.value:t.value,e)}var xx=(e,t,s,n)=>{const i={};for(const r of e){const o=J(t,r);o&&vt(i,r,o._f)}return{criteriaMode:s,names:[...e],fields:i,shouldUseNativeValidation:n}},vr=e=>e instanceof RegExp,Cn=e=>St(e)?e:vr(e)?e.source:At(e)?vr(e.value)?e.value.source:e.value:e,Mc=e=>({isOnSubmit:!e||e===Se.onSubmit,isOnBlur:e===Se.onBlur,isOnChange:e===Se.onChange,isOnAll:e===Se.all,isOnTouch:e===Se.onTouched});const Ac="AsyncFunction";var vx=e=>!!e&&!!e.validate&&!!(we(e.validate)&&e.validate.constructor.name===Ac||At(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Ac)),_x=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Lc=(e,t,s)=>!s&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const $n=(e,t,s,n)=>{for(const i of s||Object.keys(e)){const r=J(e,i);if(r){const{_f:o,...a}=r;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],i)&&!n)return!0;if(o.ref&&t(o.ref,o.name)&&!n)return!0;if($n(a,t))break}else if(At(a)&&$n(a,t))break}}};function Dc(e,t,s){const n=J(e,s);if(n||Vr(s))return{error:n,name:s};const i=s.split(".");for(;i.length;){const r=i.join("."),o=J(t,r),a=J(e,r);if(o&&!Array.isArray(o)&&s!==r)return{name:s};if(a&&a.type)return{name:r,error:a};if(a&&a.root&&a.root.type)return{name:`${r}.root`,error:a.root};i.pop()}return{name:s}}var wx=(e,t,s,n)=>{s(e);const{name:i,...r}=e;return Xt(r)||Object.keys(r).length>=Object.keys(t).length||Object.keys(r).find(o=>t[o]===(!n||Se.all))},Sx=(e,t,s)=>!e||!t||e===t||Wn(e).some(n=>n&&(s?n===t:n.startsWith(t)||t.startsWith(n))),kx=(e,t,s,n,i)=>i.isOnAll?!1:!s&&i.isOnTouch?!(t||e):(s?n.isOnBlur:i.isOnBlur)?!e:(s?n.isOnChange:i.isOnChange)?e:!0,Rx=(e,t)=>!Va(J(e,t)).length&&Tt(e,t),Px=(e,t,s)=>{const n=Wn(J(e,s));return vt(n,"root",t[s]),vt(e,s,n),e};function Nc(e,t,s="validate"){if(le(e)||Array.isArray(e)&&e.every(le)||Me(e)&&!e)return{type:s,message:le(e)?e:"",ref:t}}var Qs=e=>At(e)&&!vr(e)?e:{value:e,message:""},Fc=async(e,t,s,n,i,r)=>{const{ref:o,refs:a,required:l,maxLength:c,minLength:u,min:d,max:h,pattern:f,validate:p,name:m,valueAsNumber:g,mount:b}=e._f,x=J(s,m);if(!b||t.has(m))return{};const w=a?a[0]:o,v=A=>{i&&w.reportValidity&&(w.setCustomValidity(Me(A)?"":A||""),w.reportValidity())},S={},P=Ua(o),R=pi(o),_=P||R,C=(g||Ha(o))&&St(o.value)&&St(x)||xr(o)&&o.value===""||x===""||Array.isArray(x)&&!x.length,N=px.bind(null,m,n,S),j=(A,F,V,W=Be.maxLength,I=Be.minLength)=>{const q=A?F:V;S[m]={type:A?W:I,message:q,ref:o,...N(A?W:I,q)}};if(r?!Array.isArray(x)||!x.length:l&&(!_&&(C||se(x))||Me(x)&&!x||R&&!Ch(a).isValid||P&&!Th(a).isValid)){const{value:A,message:F}=le(l)?{value:!!l,message:l}:Qs(l);if(A&&(S[m]={type:Be.required,message:F,ref:w,...N(Be.required,F)},!n))return v(F),S}if(!C&&(!se(d)||!se(h))){let A,F;const V=Qs(h),W=Qs(d);if(!se(x)&&!isNaN(x)){const I=o.valueAsNumber||x&&+x;se(V.value)||(A=I>V.value),se(W.value)||(F=I<W.value)}else{const I=o.valueAsDate||new Date(x),q=dt=>new Date(new Date().toDateString()+" "+dt),z=o.type=="time",rt=o.type=="week";le(V.value)&&x&&(A=z?q(x)>q(V.value):rt?x>V.value:I>new Date(V.value)),le(W.value)&&x&&(F=z?q(x)<q(W.value):rt?x<W.value:I<new Date(W.value))}if((A||F)&&(j(!!A,V.message,W.message,Be.max,Be.min),!n))return v(S[m].message),S}if((c||u)&&!C&&(le(x)||r&&Array.isArray(x))){const A=Qs(c),F=Qs(u),V=!se(A.value)&&x.length>+A.value,W=!se(F.value)&&x.length<+F.value;if((V||W)&&(j(V,A.message,F.message),!n))return v(S[m].message),S}if(f&&!C&&le(x)){const{value:A,message:F}=Qs(f);if(vr(A)&&!x.match(A)&&(S[m]={type:Be.pattern,message:F,ref:o,...N(Be.pattern,F)},!n))return v(F),S}if(p){if(we(p)){const A=await p(x,s),F=Nc(A,w);if(F&&(S[m]={...F,...N(Be.validate,F.message)},!n))return v(F.message),S}else if(At(p)){let A={};for(const F in p){if(!Xt(A)&&!n)break;const V=Nc(await p[F](x,s),w,F);V&&(A={...V,...N(F,V.message)},v(V.message),n&&(S[m]=A))}if(!Xt(A)&&(S[m]={ref:w,...A},!n))return S}}return v(!0),S};const Ex={mode:Se.onSubmit,reValidateMode:Se.onChange,shouldFocusError:!0};function Cx(e={}){let t={...Ex,...e},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:we(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},i=At(t.defaultValues)||At(t.values)?Dt(t.defaultValues||t.values)||{}:{},r=t.shouldUnregister?{}:Dt(i),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...u};let h={...d};const f={array:Pc(),state:Pc()},p=t.criteriaMode===Se.all,m=k=>E=>{clearTimeout(c),c=setTimeout(k,E)},g=async k=>{if(!o.keepIsValid&&!t.disabled&&(d.isValid||h.isValid||k)){let E;t.resolver?(E=Xt((await _()).errors),b()):E=await N(n,!0),E!==s.isValid&&f.state.next({isValid:E})}},b=(k,E)=>{!t.disabled&&(d.isValidating||d.validatingFields||h.isValidating||h.validatingFields)&&((k||Array.from(a.mount)).forEach(T=>{T&&(E?vt(s.validatingFields,T,E):Tt(s.validatingFields,T))}),f.state.next({validatingFields:s.validatingFields,isValidating:!Xt(s.validatingFields)}))},x=(k,E=[],T,$,H=!0,D=!0)=>{if($&&T&&!t.disabled){if(o.action=!0,D&&Array.isArray(J(n,k))){const K=T(J(n,k),$.argA,$.argB);H&&vt(n,k,K)}if(D&&Array.isArray(J(s.errors,k))){const K=T(J(s.errors,k),$.argA,$.argB);H&&vt(s.errors,k,K),Rx(s.errors,k)}if((d.touchedFields||h.touchedFields)&&D&&Array.isArray(J(s.touchedFields,k))){const K=T(J(s.touchedFields,k),$.argA,$.argB);H&&vt(s.touchedFields,k,K)}(d.dirtyFields||h.dirtyFields)&&(s.dirtyFields=sn(i,r)),f.state.next({name:k,isDirty:A(k,E),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else vt(r,k,E)},w=(k,E)=>{vt(s.errors,k,E),f.state.next({errors:s.errors})},v=k=>{s.errors=k,f.state.next({errors:s.errors,isValid:!1})},S=(k,E,T,$)=>{const H=J(n,k);if(H){const D=J(r,k,St(T)?J(i,k):T);St(D)||$&&$.defaultChecked||E?vt(r,k,E?D:Tc(H._f)):W(k,D),o.mount&&!o.action&&g()}},P=(k,E,T,$,H)=>{let D=!1,K=!1;const st={name:k};if(!t.disabled){if(!T||$){(d.isDirty||h.isDirty)&&(K=s.isDirty,s.isDirty=st.isDirty=A(),D=K!==st.isDirty);const ct=ns(J(i,k),E);K=!!J(s.dirtyFields,k),ct?Tt(s.dirtyFields,k):vt(s.dirtyFields,k,!0),st.dirtyFields=s.dirtyFields,D=D||(d.dirtyFields||h.dirtyFields)&&K!==!ct}if(T){const ct=J(s.touchedFields,k);ct||(vt(s.touchedFields,k,T),st.touchedFields=s.touchedFields,D=D||(d.touchedFields||h.touchedFields)&&ct!==T)}D&&H&&f.state.next(st)}return D?st:{}},R=(k,E,T,$)=>{const H=J(s.errors,k),D=(d.isValid||h.isValid)&&Me(E)&&s.isValid!==E;if(t.delayError&&T?(l=m(()=>w(k,T)),l(t.delayError)):(clearTimeout(c),l=null,T?vt(s.errors,k,T):Tt(s.errors,k)),(T?!ns(H,T):H)||!Xt($)||D){const K={...$,...D&&Me(E)?{isValid:E}:{},errors:s.errors,name:k};s={...s,...K},f.state.next(K)}},_=async k=>(b(k,!0),await t.resolver(r,t.context,xx(k||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),C=async k=>{const{errors:E}=await _(k);if(b(k),k)for(const T of k){const $=J(E,T);$?vt(s.errors,T,$):Tt(s.errors,T)}else s.errors=E;return E},N=async(k,E,T={valid:!0})=>{for(const $ in k){const H=k[$];if(H){const{_f:D,...K}=H;if(D){const st=a.array.has(D.name),ct=H._f&&vx(H._f);ct&&d.validatingFields&&b([D.name],!0);const Rt=await Fc(H,a.disabled,r,p,t.shouldUseNativeValidation&&!E,st);if(ct&&d.validatingFields&&b([D.name]),Rt[D.name]&&(T.valid=!1,E||e.shouldUseNativeValidation))break;!E&&(J(Rt,D.name)?st?Px(s.errors,Rt,D.name):vt(s.errors,D.name,Rt[D.name]):Tt(s.errors,D.name))}!Xt(K)&&await N(K,E,T)}}return T.valid},j=()=>{for(const k of a.unMount){const E=J(n,k);E&&(E._f.refs?E._f.refs.every(T=>!go(T)):!go(E._f.ref))&&it(k)}a.unMount=new Set},A=(k,E)=>!t.disabled&&(k&&E&&vt(r,k,E),!ns(M(),i)),F=(k,E,T)=>hx(k,a,{...o.mount?r:St(E)?i:le(k)?{[k]:E}:E},T,E),V=k=>Va(J(o.mount?r:i,k,t.shouldUnregister?J(i,k,[]):[])),W=(k,E,T={})=>{const $=J(n,k);let H=E;if($){const D=$._f;D&&(!D.disabled&&vt(r,k,Oh(E,D)),H=xr(D.ref)&&se(E)?"":E,Ph(D.ref)?[...D.ref.options].forEach(K=>K.selected=H.includes(K.value)):D.refs?pi(D.ref)?D.refs.forEach(K=>{(!K.defaultChecked||!K.disabled)&&(Array.isArray(H)?K.checked=!!H.find(st=>st===K.value):K.checked=H===K.value||!!H)}):D.refs.forEach(K=>K.checked=K.value===H):Ha(D.ref)?D.ref.value="":(D.ref.value=H,D.ref.type||f.state.next({name:k,values:Dt(r)})))}(T.shouldDirty||T.shouldTouch)&&P(k,H,T.shouldTouch,T.shouldDirty,!0),T.shouldValidate&&dt(k)},I=(k,E,T)=>{for(const $ in E){if(!E.hasOwnProperty($))return;const H=E[$],D=k+"."+$,K=J(n,D);(a.array.has(k)||At(H)||K&&!K._f)&&!Ds(H)?I(D,H,T):W(D,H,T)}},q=(k,E,T={})=>{const $=J(n,k),H=a.array.has(k),D=Dt(E);vt(r,k,D),H?(f.array.next({name:k,values:Dt(r)}),(d.isDirty||d.dirtyFields||h.isDirty||h.dirtyFields)&&T.shouldDirty&&f.state.next({name:k,dirtyFields:sn(i,r),isDirty:A(k,D)})):$&&!$._f&&!se(D)?I(k,D,T):W(k,D,T),Lc(k,a)?f.state.next({...s,name:k,values:Dt(r)}):f.state.next({name:o.mount?k:void 0,values:Dt(r)})},z=async k=>{o.mount=!0;const E=k.target;let T=E.name,$=!0;const H=J(n,T),D=ct=>{$=Number.isNaN(ct)||Ds(ct)&&isNaN(ct.getTime())||ns(ct,J(r,T,ct))},K=Mc(t.mode),st=Mc(t.reValidateMode);if(H){let ct,Rt;const Pe=E.type?Tc(H._f):rx(k),Gt=k.type===Rc.BLUR||k.type===Rc.FOCUS_OUT,Xr=!_x(H._f)&&!t.resolver&&!J(s.errors,T)&&!H._f.deps||kx(Gt,J(s.touchedFields,T),s.isSubmitted,st,K),yn=Lc(T,a,Gt);vt(r,T,Pe),Gt?(!E||!E.readOnly)&&(H._f.onBlur&&H._f.onBlur(k),l&&l(0)):H._f.onChange&&H._f.onChange(k);const Xs=P(T,Pe,Gt),xi=!Xt(Xs)||yn;if(!Gt&&f.state.next({name:T,type:k.type,values:Dt(r)}),Xr)return(d.isValid||h.isValid)&&(t.mode==="onBlur"?Gt&&g():Gt||g()),xi&&f.state.next({name:T,...yn?{}:Xs});if(!Gt&&yn&&f.state.next({...s}),t.resolver){const{errors:vi}=await _([T]);if(b([T]),D(Pe),$){const xn=Dc(s.errors,n,T),ye=Dc(vi,n,xn.name||T);ct=ye.error,T=ye.name,Rt=Xt(vi)}}else b([T],!0),ct=(await Fc(H,a.disabled,r,p,t.shouldUseNativeValidation))[T],b([T]),D(Pe),$&&(ct?Rt=!1:(d.isValid||h.isValid)&&(Rt=await N(n,!0)));$&&(H._f.deps&&(!Array.isArray(H._f.deps)||H._f.deps.length>0)&&dt(H._f.deps),R(T,Rt,ct,Xs))}},rt=(k,E)=>{if(J(s.errors,E)&&k.focus)return k.focus(),1},dt=async(k,E={})=>{let T,$;const H=Wn(k);if(t.resolver){const D=await C(St(k)?k:H);T=Xt(D),$=k?!H.some(K=>J(D,K)):T}else k?($=(await Promise.all(H.map(async D=>{const K=J(n,D);return await N(K&&K._f?{[D]:K}:K)}))).every(Boolean),!(!$&&!s.isValid)&&g()):$=T=await N(n);return f.state.next({...!le(k)||(d.isValid||h.isValid)&&T!==s.isValid?{}:{name:k},...t.resolver||!k?{isValid:T}:{},errors:s.errors}),E.shouldFocus&&!$&&$n(n,rt,k?H:a.mount),$},M=(k,E)=>{let T={...o.mount?r:i};return E&&(T=Rh(E.dirtyFields?s.dirtyFields:s.touchedFields,T)),St(k)?T:le(k)?J(T,k):k.map($=>J(T,$))},Y=(k,E)=>({invalid:!!J((E||s).errors,k),isDirty:!!J((E||s).dirtyFields,k),error:J((E||s).errors,k),isValidating:!!J(s.validatingFields,k),isTouched:!!J((E||s).touchedFields,k)}),B=k=>{k&&Wn(k).forEach(E=>Tt(s.errors,E)),f.state.next({errors:k?s.errors:{}})},U=(k,E,T)=>{const $=(J(n,k,{_f:{}})._f||{}).ref,H=J(s.errors,k)||{},{ref:D,message:K,type:st,...ct}=H;vt(s.errors,k,{...ct,...E,ref:$}),f.state.next({name:k,errors:s.errors,isValid:!1}),T&&T.shouldFocus&&$&&$.focus&&$.focus()},et=(k,E)=>we(k)?f.state.subscribe({next:T=>"values"in T&&k(F(void 0,E),T)}):F(k,E,!0),ft=k=>f.state.subscribe({next:E=>{Sx(k.name,E.name,k.exact)&&wx(E,k.formState||d,ts,k.reRenderRoot)&&k.callback({values:{...r},...s,...E,defaultValues:i})}}).unsubscribe,Z=k=>(o.mount=!0,h={...h,...k.formState},ft({...k,formState:{...u,...k.formState}})),it=(k,E={})=>{for(const T of k?Wn(k):a.mount)a.mount.delete(T),a.array.delete(T),E.keepValue||(Tt(n,T),Tt(r,T)),!E.keepError&&Tt(s.errors,T),!E.keepDirty&&Tt(s.dirtyFields,T),!E.keepTouched&&Tt(s.touchedFields,T),!E.keepIsValidating&&Tt(s.validatingFields,T),!t.shouldUnregister&&!E.keepDefaultValue&&Tt(i,T);f.state.next({values:Dt(r)}),f.state.next({...s,...E.keepDirty?{isDirty:A()}:{}}),!E.keepIsValid&&g()},kt=({disabled:k,name:E})=>{if(Me(k)&&o.mount||k||a.disabled.has(E)){const H=a.disabled.has(E)!==!!k;k?a.disabled.add(E):a.disabled.delete(E),H&&o.mount&&!o.action&&g()}},Ot=(k,E={})=>{let T=J(n,k);const $=Me(E.disabled)||Me(t.disabled);return vt(n,k,{...T||{},_f:{...T&&T._f?T._f:{ref:{name:k}},name:k,mount:!0,...E}}),a.mount.add(k),T?kt({disabled:Me(E.disabled)?E.disabled:t.disabled,name:k}):S(k,!0,E.value),{...$?{disabled:E.disabled||t.disabled}:{},...t.progressive?{required:!!E.required,min:Cn(E.min),max:Cn(E.max),minLength:Cn(E.minLength),maxLength:Cn(E.maxLength),pattern:Cn(E.pattern)}:{},name:k,onChange:z,onBlur:z,ref:H=>{if(H){Ot(k,E),T=J(n,k);const D=St(H.value)&&H.querySelectorAll&&H.querySelectorAll("input,select,textarea")[0]||H,K=mx(D),st=T._f.refs||[];if(K?st.find(ct=>ct===D):D===T._f.ref)return;vt(n,k,{_f:{...T._f,...K?{refs:[...st.filter(go),D,...Array.isArray(J(i,k))?[{}]:[]],ref:{type:D.type,name:k}}:{ref:D}}}),S(k,!1,void 0,D)}else T=J(n,k,{}),T._f&&(T._f.mount=!1),(t.shouldUnregister||E.shouldUnregister)&&!(ax(a.array,k)&&o.action)&&a.unMount.add(k)}}},Bt=()=>t.shouldFocusError&&$n(n,rt,a.mount),Ht=k=>{Me(k)&&(f.state.next({disabled:k}),$n(n,(E,T)=>{const $=J(n,T);$&&(E.disabled=$._f.disabled||k,Array.isArray($._f.refs)&&$._f.refs.forEach(H=>{H.disabled=$._f.disabled||k}))},0,!1))},xs=(k,E)=>async T=>{let $;T&&(T.preventDefault&&T.preventDefault(),T.persist&&T.persist());let H=Dt(r);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:D,values:K}=await _();b(),s.errors=D,H=Dt(K)}else await N(n);if(a.disabled.size)for(const D of a.disabled)Tt(H,D);if(Tt(s.errors,"root"),Xt(s.errors)){f.state.next({errors:{}});try{await k(H,T)}catch(D){$=D}}else E&&await E({...s.errors},T),Bt(),setTimeout(Bt);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Xt(s.errors)&&!$,submitCount:s.submitCount+1,errors:s.errors}),$)throw $},vs=(k,E={})=>{J(n,k)&&(St(E.defaultValue)?q(k,Dt(J(i,k))):(q(k,E.defaultValue),vt(i,k,Dt(E.defaultValue))),E.keepTouched||Tt(s.touchedFields,k),E.keepDirty||(Tt(s.dirtyFields,k),s.isDirty=E.defaultValue?A(k,Dt(J(i,k))):A()),E.keepError||(Tt(s.errors,k),d.isValid&&g()),f.state.next({...s}))},_s=(k,E={})=>{const T=k?Dt(k):i,$=Dt(T),H=Xt(k),D=H?i:$;if(E.keepDefaultValues||(i=T),!E.keepValues){if(E.keepDirtyValues){const K=new Set([...a.mount,...Object.keys(sn(i,r))]);for(const st of Array.from(K)){const ct=J(s.dirtyFields,st),Rt=J(r,st),Pe=J(D,st);ct&&!St(Rt)?vt(D,st,Rt):!ct&&!St(Pe)&&q(st,Pe)}}else{if(Ba&&St(k))for(const K of a.mount){const st=J(n,K);if(st&&st._f){const ct=Array.isArray(st._f.refs)?st._f.refs[0]:st._f.ref;if(xr(ct)){const Rt=ct.closest("form");if(Rt){Rt.reset();break}}}}if(E.keepFieldsRef)for(const K of a.mount)q(K,J(D,K));else n={}}r=t.shouldUnregister?E.keepDefaultValues?Dt(i):{}:Dt(D),f.array.next({values:{...D}}),f.state.next({values:{...D}})}a={mount:E.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!d.isValid||!!E.keepIsValid||!!E.keepDirtyValues||!t.shouldUnregister&&!Xt(D),o.watch=!!t.shouldUnregister,o.keepIsValid=!!E.keepIsValid,o.action=!1,E.keepErrors||(s.errors={}),f.state.next({submitCount:E.keepSubmitCount?s.submitCount:0,isDirty:H?!1:E.keepDirty?s.isDirty:!!(E.keepDefaultValues&&!ns(k,i)),isSubmitted:E.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:H?{}:E.keepDirtyValues?E.keepDefaultValues&&r?sn(i,r):s.dirtyFields:E.keepDefaultValues&&k?sn(i,k):E.keepDirty?s.dirtyFields:{},touchedFields:E.keepTouched?s.touchedFields:{},errors:E.keepErrors?s.errors:{},isSubmitSuccessful:E.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},Ze=(k,E)=>_s(we(k)?k(r):k,{...t.resetOptions,...E}),Qt=(k,E={})=>{const T=J(n,k),$=T&&T._f;if($){const H=$.refs?$.refs[0]:$.ref;H.focus&&setTimeout(()=>{H.focus(),E.shouldSelect&&we(H.select)&&H.select()})}},ts=k=>{s={...s,...k}},Gs={control:{register:Ot,unregister:it,getFieldState:Y,handleSubmit:xs,setError:U,_subscribe:ft,_runSchema:_,_updateIsValidating:b,_focusError:Bt,_getWatch:F,_getDirty:A,_setValid:g,_setFieldArray:x,_setDisabledField:kt,_setErrors:v,_getFieldArray:V,_reset:_s,_resetDefaultValues:()=>we(t.defaultValues)&&t.defaultValues().then(k=>{Ze(k,t.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:j,_disableForm:Ht,_subjects:f,_proxyFormState:d,get _fields(){return n},get _formValues(){return r},get _state(){return o},set _state(k){o=k},get _defaultValues(){return i},get _names(){return a},set _names(k){a=k},get _formState(){return s},get _options(){return t},set _options(k){t={...t,...k}}},subscribe:Z,trigger:dt,register:Ot,handleSubmit:xs,watch:et,setValue:q,getValues:M,reset:Ze,resetField:vs,clearErrors:B,unregister:it,setError:U,setFocus:Qt,getFieldState:Y};return{...Gs,formControl:Gs}}function Mh(e={}){const t=L.useRef(void 0),s=L.useRef(void 0),[n,i]=L.useState({isDirty:!1,isValidating:!1,isLoading:we(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:we(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!we(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...a}=Cx(e);t.current={...a,formState:n}}const r=t.current.control;return r._options=e,dx(()=>{const o=r._subscribe({formState:r._proxyFormState,callback:()=>i({...r._formState}),reRenderRoot:!0});return i(a=>({...a,isReady:!0})),r._formState.isReady=!0,o},[r]),L.useEffect(()=>r._disableForm(e.disabled),[r,e.disabled]),L.useEffect(()=>{e.mode&&(r._options.mode=e.mode),e.reValidateMode&&(r._options.reValidateMode=e.reValidateMode)},[r,e.mode,e.reValidateMode]),L.useEffect(()=>{e.errors&&(r._setErrors(e.errors),r._focusError())},[r,e.errors]),L.useEffect(()=>{e.shouldUnregister&&r._subjects.state.next({values:r._getWatch()})},[r,e.shouldUnregister]),L.useEffect(()=>{if(r._proxyFormState.isDirty){const o=r._getDirty();o!==n.isDirty&&r._subjects.state.next({isDirty:o})}},[r,n.isDirty]),L.useEffect(()=>{var o;e.values&&!ns(e.values,s.current)?(r._reset(e.values,{keepFieldsRef:!0,...r._options.resetOptions}),!((o=r._options.resetOptions)===null||o===void 0)&&o.keepIsValid||r._setValid(),s.current=e.values,i(a=>({...a}))):r._resetDefaultValues()},[r,e.values]),L.useEffect(()=>{r._state.mount||(r._setValid(),r._state.mount=!0),r._state.watch&&(r._state.watch=!1,r._subjects.state.next({...r._formState})),r._removeUnmounted()}),t.current.formState=L.useMemo(()=>ux(n,r),[r,n]),t.current}function Ah(e){var t,s,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(s=Ah(e[t]))&&(n&&(n+=" "),n+=s)}else for(s in e)e[s]&&(n&&(n+=" "),n+=s);return n}function Ox(){for(var e,t,s=0,n="",i=arguments.length;s<i;s++)(e=arguments[s])&&(t=Ah(e))&&(n&&(n+=" "),n+=t);return n}const Tx=(e,t)=>{const s=new Array(e.length+t.length);for(let n=0;n<e.length;n++)s[n]=e[n];for(let n=0;n<t.length;n++)s[e.length+n]=t[n];return s},Mx=(e,t)=>({classGroupId:e,validator:t}),Lh=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),_r="-",Ic=[],Ax="arbitrary..",Lx=e=>{const t=Nx(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return Dx(o);const a=o.split(_r),l=a[0]===""&&a.length>1?1:0;return Dh(a,l,t)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=n[o],c=s[o];return l?c?Tx(c,l):l:c||Ic}return s[o]||Ic}}},Dh=(e,t,s)=>{if(e.length-t===0)return s.classGroupId;const i=e[t],r=s.nextPart.get(i);if(r){const c=Dh(e,t+1,r);if(c)return c}const o=s.validators;if(o===null)return;const a=t===0?e.join(_r):e.slice(t).join(_r),l=o.length;for(let c=0;c<l;c++){const u=o[c];if(u.validator(a))return u.classGroupId}},Dx=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),s=t.indexOf(":"),n=t.slice(0,s);return n?Ax+n:void 0})(),Nx=e=>{const{theme:t,classGroups:s}=e;return Fx(s,t)},Fx=(e,t)=>{const s=Lh();for(const n in e){const i=e[n];Wa(i,s,n,t)}return s},Wa=(e,t,s,n)=>{const i=e.length;for(let r=0;r<i;r++){const o=e[r];Ix(o,t,s,n)}},Ix=(e,t,s,n)=>{if(typeof e=="string"){jx(e,t,s);return}if(typeof e=="function"){Bx(e,t,s,n);return}Vx(e,t,s,n)},jx=(e,t,s)=>{const n=e===""?t:Nh(t,e);n.classGroupId=s},Bx=(e,t,s,n)=>{if(zx(e)){Wa(e(n),t,s,n);return}t.validators===null&&(t.validators=[]),t.validators.push(Mx(s,e))},Vx=(e,t,s,n)=>{const i=Object.entries(e),r=i.length;for(let o=0;o<r;o++){const[a,l]=i[o];Wa(l,Nh(t,a),s,n)}},Nh=(e,t)=>{let s=e;const n=t.split(_r),i=n.length;for(let r=0;r<i;r++){const o=n[r];let a=s.nextPart.get(o);a||(a=Lh(),s.nextPart.set(o,a)),s=a}return s},zx=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Hx=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=Object.create(null),n=Object.create(null);const i=(r,o)=>{s[r]=o,t++,t>e&&(t=0,n=s,s=Object.create(null))};return{get(r){let o=s[r];if(o!==void 0)return o;if((o=n[r])!==void 0)return i(r,o),o},set(r,o){r in s?s[r]=o:i(r,o)}}},ia="!",jc=":",Ux=[],Bc=(e,t,s,n,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:n,isExternal:i}),Wx=e=>{const{prefix:t,experimentalParseClassName:s}=e;let n=i=>{const r=[];let o=0,a=0,l=0,c;const u=i.length;for(let m=0;m<u;m++){const g=i[m];if(o===0&&a===0){if(g===jc){r.push(i.slice(l,m)),l=m+1;continue}if(g==="/"){c=m;continue}}g==="["?o++:g==="]"?o--:g==="("?a++:g===")"&&a--}const d=r.length===0?i:i.slice(l);let h=d,f=!1;d.endsWith(ia)?(h=d.slice(0,-1),f=!0):d.startsWith(ia)&&(h=d.slice(1),f=!0);const p=c&&c>l?c-l:void 0;return Bc(r,f,h,p)};if(t){const i=t+jc,r=n;n=o=>o.startsWith(i)?r(o.slice(i.length)):Bc(Ux,!1,o,void 0,!0)}if(s){const i=n;n=r=>s({className:r,parseClassName:i})}return n},$x=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((s,n)=>{t.set(s,1e6+n)}),s=>{const n=[];let i=[];for(let r=0;r<s.length;r++){const o=s[r],a=o[0]==="[",l=t.has(o);a||l?(i.length>0&&(i.sort(),n.push(...i),i=[]),n.push(o)):i.push(o)}return i.length>0&&(i.sort(),n.push(...i)),n}},qx=e=>({cache:Hx(e.cacheSize),parseClassName:Wx(e),sortModifiers:$x(e),...Lx(e)}),Kx=/\s+/,Yx=(e,t)=>{const{parseClassName:s,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:r}=t,o=[],a=e.trim().split(Kx);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{isExternal:d,modifiers:h,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=s(u);if(d){l=u+(l.length>0?" "+l:l);continue}let g=!!m,b=n(g?p.substring(0,m):p);if(!b){if(!g){l=u+(l.length>0?" "+l:l);continue}if(b=n(p),!b){l=u+(l.length>0?" "+l:l);continue}g=!1}const x=h.length===0?"":h.length===1?h[0]:r(h).join(":"),w=f?x+ia:x,v=w+b;if(o.indexOf(v)>-1)continue;o.push(v);const S=i(b,g);for(let P=0;P<S.length;++P){const R=S[P];o.push(w+R)}l=u+(l.length>0?" "+l:l)}return l},Gx=(...e)=>{let t=0,s,n,i="";for(;t<e.length;)(s=e[t++])&&(n=Fh(s))&&(i&&(i+=" "),i+=n);return i},Fh=e=>{if(typeof e=="string")return e;let t,s="";for(let n=0;n<e.length;n++)e[n]&&(t=Fh(e[n]))&&(s&&(s+=" "),s+=t);return s},Xx=(e,...t)=>{let s,n,i,r;const o=l=>{const c=t.reduce((u,d)=>d(u),e());return s=qx(c),n=s.cache.get,i=s.cache.set,r=a,a(l)},a=l=>{const c=n(l);if(c)return c;const u=Yx(l,s);return i(l,u),u};return r=o,(...l)=>r(Gx(...l))},Qx=[],Lt=e=>{const t=s=>s[e]||Qx;return t.isThemeGetter=!0,t},Ih=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,jh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Jx=/^\d+\/\d+$/,Zx=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,t0=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,e0=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,s0=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,n0=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Js=e=>Jx.test(e),at=e=>!!e&&!Number.isNaN(Number(e)),es=e=>!!e&&Number.isInteger(Number(e)),bo=e=>e.endsWith("%")&&at(e.slice(0,-1)),Ve=e=>Zx.test(e),i0=()=>!0,r0=e=>t0.test(e)&&!e0.test(e),Bh=()=>!1,o0=e=>s0.test(e),a0=e=>n0.test(e),l0=e=>!G(e)&&!X(e),c0=e=>mn(e,Hh,Bh),G=e=>Ih.test(e),Ss=e=>mn(e,Uh,r0),yo=e=>mn(e,p0,at),Vc=e=>mn(e,Vh,Bh),u0=e=>mn(e,zh,a0),Ai=e=>mn(e,Wh,o0),X=e=>jh.test(e),On=e=>gn(e,Uh),d0=e=>gn(e,m0),zc=e=>gn(e,Vh),h0=e=>gn(e,Hh),f0=e=>gn(e,zh),Li=e=>gn(e,Wh,!0),mn=(e,t,s)=>{const n=Ih.exec(e);return n?n[1]?t(n[1]):s(n[2]):!1},gn=(e,t,s=!1)=>{const n=jh.exec(e);return n?n[1]?t(n[1]):s:!1},Vh=e=>e==="position"||e==="percentage",zh=e=>e==="image"||e==="url",Hh=e=>e==="length"||e==="size"||e==="bg-size",Uh=e=>e==="length",p0=e=>e==="number",m0=e=>e==="family-name",Wh=e=>e==="shadow",g0=()=>{const e=Lt("color"),t=Lt("font"),s=Lt("text"),n=Lt("font-weight"),i=Lt("tracking"),r=Lt("leading"),o=Lt("breakpoint"),a=Lt("container"),l=Lt("spacing"),c=Lt("radius"),u=Lt("shadow"),d=Lt("inset-shadow"),h=Lt("text-shadow"),f=Lt("drop-shadow"),p=Lt("blur"),m=Lt("perspective"),g=Lt("aspect"),b=Lt("ease"),x=Lt("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...v(),X,G],P=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],_=()=>[X,G,l],C=()=>[Js,"full","auto",..._()],N=()=>[es,"none","subgrid",X,G],j=()=>["auto",{span:["full",es,X,G]},es,X,G],A=()=>[es,"auto",X,G],F=()=>["auto","min","max","fr",X,G],V=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",..._()],q=()=>[Js,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],z=()=>[e,X,G],rt=()=>[...v(),zc,Vc,{position:[X,G]}],dt=()=>["no-repeat",{repeat:["","x","y","space","round"]}],M=()=>["auto","cover","contain",h0,c0,{size:[X,G]}],Y=()=>[bo,On,Ss],B=()=>["","none","full",c,X,G],U=()=>["",at,On,Ss],et=()=>["solid","dashed","dotted","double"],ft=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>[at,bo,zc,Vc],it=()=>["","none",p,X,G],kt=()=>["none",at,X,G],Ot=()=>["none",at,X,G],Bt=()=>[at,X,G],Ht=()=>[Js,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ve],breakpoint:[Ve],color:[i0],container:[Ve],"drop-shadow":[Ve],ease:["in","out","in-out"],font:[l0],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ve],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ve],shadow:[Ve],spacing:["px",at],text:[Ve],"text-shadow":[Ve],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Js,G,X,g]}],container:["container"],columns:[{columns:[at,G,X,a]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:C()}],"inset-x":[{"inset-x":C()}],"inset-y":[{"inset-y":C()}],start:[{start:C()}],end:[{end:C()}],top:[{top:C()}],right:[{right:C()}],bottom:[{bottom:C()}],left:[{left:C()}],visibility:["visible","invisible","collapse"],z:[{z:[es,"auto",X,G]}],basis:[{basis:[Js,"full","auto",a,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[at,Js,"auto","initial","none",G]}],grow:[{grow:["",at,X,G]}],shrink:[{shrink:["",at,X,G]}],order:[{order:[es,"first","last","none",X,G]}],"grid-cols":[{"grid-cols":N()}],"col-start-end":[{col:j()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":N()}],"row-start-end":[{row:j()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:[...V(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...V()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":V()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],w:[{w:[a,"screen",...q()]}],"min-w":[{"min-w":[a,"screen","none",...q()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh",...q()]}],"font-size":[{text:["base",s,On,Ss]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,X,yo]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",bo,G]}],"font-family":[{font:[d0,G,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,X,G]}],"line-clamp":[{"line-clamp":[at,"none",X,yo]}],leading:[{leading:[r,..._()]}],"list-image":[{"list-image":["none",X,G]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",X,G]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:z()}],"text-color":[{text:z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...et(),"wavy"]}],"text-decoration-thickness":[{decoration:[at,"from-font","auto",X,Ss]}],"text-decoration-color":[{decoration:z()}],"underline-offset":[{"underline-offset":[at,"auto",X,G]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",X,G]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",X,G]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:rt()}],"bg-repeat":[{bg:dt()}],"bg-size":[{bg:M()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},es,X,G],radial:["",X,G],conic:[es,X,G]},f0,u0]}],"bg-color":[{bg:z()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:z()}],"gradient-via":[{via:z()}],"gradient-to":[{to:z()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:U()}],"border-w-x":[{"border-x":U()}],"border-w-y":[{"border-y":U()}],"border-w-s":[{"border-s":U()}],"border-w-e":[{"border-e":U()}],"border-w-t":[{"border-t":U()}],"border-w-r":[{"border-r":U()}],"border-w-b":[{"border-b":U()}],"border-w-l":[{"border-l":U()}],"divide-x":[{"divide-x":U()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":U()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...et(),"hidden","none"]}],"divide-style":[{divide:[...et(),"hidden","none"]}],"border-color":[{border:z()}],"border-color-x":[{"border-x":z()}],"border-color-y":[{"border-y":z()}],"border-color-s":[{"border-s":z()}],"border-color-e":[{"border-e":z()}],"border-color-t":[{"border-t":z()}],"border-color-r":[{"border-r":z()}],"border-color-b":[{"border-b":z()}],"border-color-l":[{"border-l":z()}],"divide-color":[{divide:z()}],"outline-style":[{outline:[...et(),"none","hidden"]}],"outline-offset":[{"outline-offset":[at,X,G]}],"outline-w":[{outline:["",at,On,Ss]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","none",u,Li,Ai]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",d,Li,Ai]}],"inset-shadow-color":[{"inset-shadow":z()}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:z()}],"ring-offset-w":[{"ring-offset":[at,Ss]}],"ring-offset-color":[{"ring-offset":z()}],"inset-ring-w":[{"inset-ring":U()}],"inset-ring-color":[{"inset-ring":z()}],"text-shadow":[{"text-shadow":["none",h,Li,Ai]}],"text-shadow-color":[{"text-shadow":z()}],opacity:[{opacity:[at,X,G]}],"mix-blend":[{"mix-blend":[...ft(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ft()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[at]}],"mask-image-linear-from-pos":[{"mask-linear-from":Z()}],"mask-image-linear-to-pos":[{"mask-linear-to":Z()}],"mask-image-linear-from-color":[{"mask-linear-from":z()}],"mask-image-linear-to-color":[{"mask-linear-to":z()}],"mask-image-t-from-pos":[{"mask-t-from":Z()}],"mask-image-t-to-pos":[{"mask-t-to":Z()}],"mask-image-t-from-color":[{"mask-t-from":z()}],"mask-image-t-to-color":[{"mask-t-to":z()}],"mask-image-r-from-pos":[{"mask-r-from":Z()}],"mask-image-r-to-pos":[{"mask-r-to":Z()}],"mask-image-r-from-color":[{"mask-r-from":z()}],"mask-image-r-to-color":[{"mask-r-to":z()}],"mask-image-b-from-pos":[{"mask-b-from":Z()}],"mask-image-b-to-pos":[{"mask-b-to":Z()}],"mask-image-b-from-color":[{"mask-b-from":z()}],"mask-image-b-to-color":[{"mask-b-to":z()}],"mask-image-l-from-pos":[{"mask-l-from":Z()}],"mask-image-l-to-pos":[{"mask-l-to":Z()}],"mask-image-l-from-color":[{"mask-l-from":z()}],"mask-image-l-to-color":[{"mask-l-to":z()}],"mask-image-x-from-pos":[{"mask-x-from":Z()}],"mask-image-x-to-pos":[{"mask-x-to":Z()}],"mask-image-x-from-color":[{"mask-x-from":z()}],"mask-image-x-to-color":[{"mask-x-to":z()}],"mask-image-y-from-pos":[{"mask-y-from":Z()}],"mask-image-y-to-pos":[{"mask-y-to":Z()}],"mask-image-y-from-color":[{"mask-y-from":z()}],"mask-image-y-to-color":[{"mask-y-to":z()}],"mask-image-radial":[{"mask-radial":[X,G]}],"mask-image-radial-from-pos":[{"mask-radial-from":Z()}],"mask-image-radial-to-pos":[{"mask-radial-to":Z()}],"mask-image-radial-from-color":[{"mask-radial-from":z()}],"mask-image-radial-to-color":[{"mask-radial-to":z()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":v()}],"mask-image-conic-pos":[{"mask-conic":[at]}],"mask-image-conic-from-pos":[{"mask-conic-from":Z()}],"mask-image-conic-to-pos":[{"mask-conic-to":Z()}],"mask-image-conic-from-color":[{"mask-conic-from":z()}],"mask-image-conic-to-color":[{"mask-conic-to":z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:rt()}],"mask-repeat":[{mask:dt()}],"mask-size":[{mask:M()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",X,G]}],filter:[{filter:["","none",X,G]}],blur:[{blur:it()}],brightness:[{brightness:[at,X,G]}],contrast:[{contrast:[at,X,G]}],"drop-shadow":[{"drop-shadow":["","none",f,Li,Ai]}],"drop-shadow-color":[{"drop-shadow":z()}],grayscale:[{grayscale:["",at,X,G]}],"hue-rotate":[{"hue-rotate":[at,X,G]}],invert:[{invert:["",at,X,G]}],saturate:[{saturate:[at,X,G]}],sepia:[{sepia:["",at,X,G]}],"backdrop-filter":[{"backdrop-filter":["","none",X,G]}],"backdrop-blur":[{"backdrop-blur":it()}],"backdrop-brightness":[{"backdrop-brightness":[at,X,G]}],"backdrop-contrast":[{"backdrop-contrast":[at,X,G]}],"backdrop-grayscale":[{"backdrop-grayscale":["",at,X,G]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[at,X,G]}],"backdrop-invert":[{"backdrop-invert":["",at,X,G]}],"backdrop-opacity":[{"backdrop-opacity":[at,X,G]}],"backdrop-saturate":[{"backdrop-saturate":[at,X,G]}],"backdrop-sepia":[{"backdrop-sepia":["",at,X,G]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",X,G]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[at,"initial",X,G]}],ease:[{ease:["linear","initial",b,X,G]}],delay:[{delay:[at,X,G]}],animate:[{animate:["none",x,X,G]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,X,G]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:kt()}],"rotate-x":[{"rotate-x":kt()}],"rotate-y":[{"rotate-y":kt()}],"rotate-z":[{"rotate-z":kt()}],scale:[{scale:Ot()}],"scale-x":[{"scale-x":Ot()}],"scale-y":[{"scale-y":Ot()}],"scale-z":[{"scale-z":Ot()}],"scale-3d":["scale-3d"],skew:[{skew:Bt()}],"skew-x":[{"skew-x":Bt()}],"skew-y":[{"skew-y":Bt()}],transform:[{transform:[X,G,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ht()}],"translate-x":[{"translate-x":Ht()}],"translate-y":[{"translate-y":Ht()}],"translate-z":[{"translate-z":Ht()}],"translate-none":["translate-none"],accent:[{accent:z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:z()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",X,G]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",X,G]}],fill:[{fill:["none",...z()]}],"stroke-w":[{stroke:[at,On,Ss,yo]}],stroke:[{stroke:["none",...z()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},b0=Xx(g0);function Ke(...e){return b0(Ox(e))}function Ae(e){return y.jsx("div",{...e,className:Ke("rounded-2xl border bg-white shadow-sm",e.className)})}function Le(e){return y.jsx("div",{...e,className:Ke("border-b px-4 py-3",e.className)})}function De(e){return y.jsx("div",{...e,className:Ke("px-4 py-3",e.className)})}function y0(){const e=qs(),t=Br(),{register:s,handleSubmit:n,formState:i}=Mh({defaultValues:{email:"admin@example.com",password:"ChangeMe123!"}}),r=n(async o=>{try{const a=await bt.post("/auth/login",o);t.setAuth(a.data.token,a.data.user.email),yt.success("Logged in"),e({to:"/"})}catch(a){yt.error(a?.response?.data?.detail??"Login failed")}});return y.jsx("div",{className:"mx-auto max-w-md",children:y.jsxs(Ae,{children:[y.jsxs(Le,{children:[y.jsx("div",{className:"text-lg font-semibold",children:"Login"}),y.jsx("div",{className:"text-sm text-neutral-600",children:"Use the admin credentials from your backend env."})]}),y.jsx(De,{children:y.jsxs("form",{onSubmit:r,className:"space-y-3",children:[y.jsxs("div",{children:[y.jsx("label",{className:"text-sm text-neutral-700",children:"Email"}),y.jsx("input",{className:"mt-1 w-full rounded-xl border px-3 py-2",...s("email",{required:!0})})]}),y.jsxs("div",{children:[y.jsx("label",{className:"text-sm text-neutral-700",children:"Password"}),y.jsx("input",{type:"password",className:"mt-1 w-full rounded-xl border px-3 py-2",...s("password",{required:!0})})]}),y.jsx("button",{disabled:i.isSubmitting,className:"w-full rounded-xl bg-neutral-900 px-3 py-2 text-white hover:bg-neutral-800 disabled:opacity-60",children:i.isSubmitting?"Signing in...":"Sign in"})]})})]})})}const x0=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),v0=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,n)=>n?n.toUpperCase():s.toLowerCase()),Hc=e=>{const t=v0(e);return t.charAt(0).toUpperCase()+t.slice(1)},$h=(...e)=>e.filter((t,s,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===s).join(" ").trim(),_0=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var w0={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const S0=L.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:n,className:i="",children:r,iconNode:o,...a},l)=>L.createElement("svg",{ref:l,...w0,width:t,height:t,stroke:e,strokeWidth:n?Number(s)*24/Number(t):s,className:$h("lucide",i),...!r&&!_0(a)&&{"aria-hidden":"true"},...a},[...o.map(([c,u])=>L.createElement(c,u)),...Array.isArray(r)?r:[r]]));const Ks=(e,t)=>{const s=L.forwardRef(({className:n,...i},r)=>L.createElement(S0,{ref:r,iconNode:t,className:$h(`lucide-${x0(Hc(e))}`,`lucide-${e}`,n),...i}));return s.displayName=Hc(e),s};const k0=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],qh=Ks("copy",k0);const R0=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Kh=Ks("pause",R0);const P0=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Yh=Ks("pencil",P0);const E0=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Gh=Ks("play",E0);const C0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],O0=Ks("plus",C0);const T0=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],M0=Ks("search",T0);const A0=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Xh=Ks("trash-2",A0);function L0(){const e=qs(),s=hg().pathname.match(/\/monitors\/([0-9a-f\-]+)/i)?.[1]??"",[n,i]=Q.useState(""),{data:r,refetch:o,isLoading:a}=ps({queryKey:["monitors-summary"],queryFn:async()=>(await bt.get("/monitors/summary?bars=60")).data.rows,refetchInterval:2e4}),l=(r??[]).filter(h=>h.monitor.name.toLowerCase().includes(n.toLowerCase()));async function c(h){try{await bt.post(`/monitors/${h.id}/pause`,{paused:!h.isPaused}),yt.success(h.isPaused?"Resumed":"Paused"),await o()}catch(f){yt.error(f?.response?.data?.detail??"Failed")}}async function u(h){try{const p=(await bt.post(`/monitors/${h.id}/clone`)).data.monitor.id;yt.success("Cloned (paused)"),await o(),e({to:"/monitors/$id",params:{id:p}})}catch(f){yt.error(f?.response?.data?.detail??"Clone failed")}}async function d(h){if(confirm(`Delete monitor "${h.name}"?`))try{await bt.delete(`/monitors/${h.id}`),yt.success("Deleted"),await o(),e({to:"/"})}catch(f){yt.error(f?.response?.data?.detail??"Delete failed")}}return y.jsxs("aside",{className:"flex h-full w-[360px] flex-col border-r border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-950",children:[y.jsxs("div",{className:"p-3",children:[y.jsxs("button",{className:"inline-flex w-full items-center justify-center gap-2 rounded-full bg-emerald-500 px-3 py-2 text-sm font-semibold text-white hover:bg-emerald-600",onClick:()=>e({to:"/monitors/new"}),children:[y.jsx(O0,{size:16})," Add New Monitor"]}),y.jsxs("div",{className:"mt-3 flex items-center gap-2 rounded-full border border-neutral-200 bg-neutral-50 px-3 py-2 dark:border-neutral-800 dark:bg-neutral-900",children:[y.jsx(M0,{size:16,className:"text-neutral-500"}),y.jsx("input",{value:n,onChange:h=>i(h.target.value),placeholder:"Search...",className:"w-full bg-transparent text-sm outline-none placeholder:text-neutral-400 dark:text-neutral-100"})]})]}),y.jsxs("div",{className:"flex-1 overflow-auto p-2",children:[a?y.jsx("div",{className:"p-3 text-sm text-neutral-500",children:"Loading..."}):null,l.map(h=>{const f=h.monitor,p=h.latest?.status??"unknown",m=p==="up"?"bg-emerald-500":p==="down"?"bg-red-500":"bg-neutral-400";return y.jsxs("div",{className:Ke("mb-2 rounded-2xl border p-3 shadow-sm transition",s===f.id?"border-emerald-400 bg-emerald-50 dark:border-emerald-700/60 dark:bg-emerald-900/10":"border-neutral-200 bg-white hover:bg-neutral-50 dark:border-neutral-800 dark:bg-neutral-950 dark:hover:bg-neutral-900/60"),children:[y.jsxs("div",{className:"flex items-center justify-between gap-2",children:[y.jsxs(Ta,{to:"/monitors/$id",params:{id:f.id},className:"min-w-0 flex-1",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:Ke("h-2.5 w-2.5 rounded-full",m)}),y.jsx("div",{className:"truncate text-sm font-semibold",children:f.name}),f.isPaused?y.jsx("span",{className:"rounded-full bg-neutral-200 px-2 py-0.5 text-xs dark:bg-neutral-800",children:"Paused"}):null]}),y.jsxs("div",{className:"mt-1 text-xs text-neutral-500 dark:text-neutral-400",children:[f.type," • ",f.intervalSeconds,"s"]})]}),y.jsxs("div",{className:"flex items-center gap-1",children:[y.jsx("button",{className:"rounded-lg p-1 hover:bg-neutral-100 dark:hover:bg-neutral-800",onClick:()=>c(f),children:f.isPaused?y.jsx(Gh,{size:16}):y.jsx(Kh,{size:16})}),y.jsx("button",{className:"rounded-lg p-1 hover:bg-neutral-100 dark:hover:bg-neutral-800",onClick:()=>e({to:"/monitors/$id/edit",params:{id:f.id}}),children:y.jsx(Yh,{size:16})}),y.jsx("button",{className:"rounded-lg p-1 hover:bg-neutral-100 dark:hover:bg-neutral-800",onClick:()=>u(f),children:y.jsx(qh,{size:16})}),y.jsx("button",{className:"rounded-lg p-1 hover:bg-neutral-100 dark:hover:bg-neutral-800 text-red-600",onClick:()=>d(f),children:y.jsx(Xh,{size:16})})]})]}),y.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[y.jsxs("div",{className:Ke("rounded-full px-2 py-0.5 text-xs font-semibold text-white",m),children:[Math.round(h.uptimePct),"%"]}),y.jsx("div",{className:"flex items-center gap-1",children:h.bars.slice(-18).map((g,b)=>y.jsx("span",{className:Ke("h-3 w-1.5 rounded-full",g==="up"?"bg-emerald-500":g==="down"?"bg-red-500":"bg-neutral-300 dark:bg-neutral-700")},b))})]})]},f.id)})]})]})}function D0(){return y.jsxs("div",{className:"flex h-[calc(100vh-56px)]",children:[y.jsx(L0,{}),y.jsx("div",{className:"flex-1 overflow-auto bg-neutral-50 p-4 dark:bg-neutral-900/40",children:y.jsx(Ma,{})})]})}function N0(){return y.jsx("div",{className:"flex h-full items-center justify-center",children:y.jsxs("div",{className:"rounded-2xl border border-neutral-200 bg-white p-10 text-center shadow-sm dark:border-neutral-800 dark:bg-neutral-950",children:[y.jsx("div",{className:"text-xl font-semibold",children:"Select a monitor"}),y.jsx("div",{className:"mt-2 text-sm text-neutral-500 dark:text-neutral-400",children:"Choose a monitor from the left to view details."})]})})}function Uc(){const e=qs(),s=ai({strict:!1})?.id,{register:n,handleSubmit:i,watch:r,reset:o,formState:a}=Mh({defaultValues:{name:"",type:"http",intervalSeconds:20,timeoutMs:8e3,method:"GET"}});Q.useEffect(()=>{s&&(async()=>{const d=(await bt.get("/monitors")).data.monitors.find(h=>h.id===s);d&&o(d)})()},[s,o]);const l=r("type"),c=i(async u=>{try{s?(await bt.put(`/monitors/${s}`,u),yt.success("Monitor updated")):(await bt.post("/monitors",u),yt.success("Monitor created")),e({to:"/"})}catch(d){yt.error(d?.response?.data?.detail??"Save failed")}});return y.jsx("div",{className:"mx-auto max-w-2xl",children:y.jsxs(Ae,{children:[y.jsxs(Le,{children:[y.jsx("div",{className:"text-lg font-semibold",children:s?"Edit Monitor":"New Monitor"}),y.jsx("div",{className:"text-sm text-neutral-600",children:"Default interval is 20 seconds (configurable)."})]}),y.jsx(De,{children:y.jsxs("form",{onSubmit:c,className:"space-y-4",children:[y.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[y.jsxs("div",{children:[y.jsx("label",{className:"text-sm",children:"Name"}),y.jsx("input",{className:"mt-1 w-full rounded-xl border px-3 py-2",...n("name",{required:!0})})]}),y.jsxs("div",{children:[y.jsx("label",{className:"text-sm",children:"Type"}),y.jsx("select",{className:"mt-1 w-full rounded-xl border px-3 py-2",...n("type"),children:["http","tcp","keyword","json_query","websocket","ping","dns","push","steam","docker"].map(u=>y.jsx("option",{value:u,children:u},u))})]}),y.jsxs("div",{children:[y.jsx("label",{className:"text-sm",children:"Interval (seconds)"}),y.jsx("input",{type:"number",className:"mt-1 w-full rounded-xl border px-3 py-2",...n("intervalSeconds",{valueAsNumber:!0})})]}),y.jsxs("div",{children:[y.jsx("label",{className:"text-sm",children:"Timeout (ms)"}),y.jsx("input",{type:"number",className:"mt-1 w-full rounded-xl border px-3 py-2",...n("timeoutMs",{valueAsNumber:!0})})]})]}),(l==="http"||l==="keyword"||l==="json_query"||l==="websocket")&&y.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[y.jsxs("div",{className:"sm:col-span-2",children:[y.jsx("label",{className:"text-sm",children:"URL"}),y.jsx("input",{className:"mt-1 w-full rounded-xl border px-3 py-2",placeholder:"https://example.com",...n("url")})]}),l!=="websocket"&&y.jsxs("div",{children:[y.jsx("label",{className:"text-sm",children:"Method"}),y.jsx("select",{className:"mt-1 w-full rounded-xl border px-3 py-2",...n("method"),children:["GET","POST","PUT","DELETE"].map(u=>y.jsx("option",{value:u,children:u},u))})]})]}),(l==="tcp"||l==="ping"||l==="dns"||l==="steam")&&y.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[y.jsxs("div",{children:[y.jsx("label",{className:"text-sm",children:"Host"}),y.jsx("input",{className:"mt-1 w-full rounded-xl border px-3 py-2",...n("host")})]}),(l==="tcp"||l==="steam")&&y.jsxs("div",{children:[y.jsx("label",{className:"text-sm",children:"Port"}),y.jsx("input",{type:"number",className:"mt-1 w-full rounded-xl border px-3 py-2",...n("port",{valueAsNumber:!0})})]}),l==="dns"&&y.jsxs("div",{children:[y.jsx("label",{className:"text-sm",children:"DNS Record Type"}),y.jsx("select",{className:"mt-1 w-full rounded-xl border px-3 py-2",...n("dnsRecordType"),children:["A","AAAA","CNAME","TXT","MX","NS"].map(u=>y.jsx("option",{value:u,children:u},u))})]})]}),l==="keyword"&&y.jsxs("div",{children:[y.jsx("label",{className:"text-sm",children:"Keyword"}),y.jsx("input",{className:"mt-1 w-full rounded-xl border px-3 py-2",...n("keyword")})]}),l==="json_query"&&y.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[y.jsxs("div",{children:[y.jsx("label",{className:"text-sm",children:"JSON Query"}),y.jsx("input",{className:"mt-1 w-full rounded-xl border px-3 py-2",placeholder:"$.data.status",...n("jsonQuery")})]}),y.jsxs("div",{children:[y.jsx("label",{className:"text-sm",children:"Expected Value"}),y.jsx("input",{className:"mt-1 w-full rounded-xl border px-3 py-2",...n("expectedValue")})]})]}),l==="push"&&y.jsx("div",{className:"rounded-2xl border bg-neutral-50 p-3 text-sm text-neutral-700",children:"Push monitors generate a token on create. Use the Dashboard to copy the push URL after saving."}),y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("button",{type:"button",onClick:()=>e({to:"/"}),className:"rounded-xl border px-3 py-2 hover:bg-neutral-50",children:"Cancel"}),y.jsx("button",{disabled:a.isSubmitting,className:"rounded-xl bg-neutral-900 px-4 py-2 text-white hover:bg-neutral-800 disabled:opacity-60",children:a.isSubmitting?"Saving...":"Save"})]})]})})]})})}const je=Object.create(null);je.open="0";je.close="1";je.ping="2";je.pong="3";je.message="4";je.upgrade="5";je.noop="6";const sr=Object.create(null);Object.keys(je).forEach(e=>{sr[je[e]]=e});const ra={type:"error",data:"parser error"},Qh=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Jh=typeof ArrayBuffer=="function",Zh=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,$a=({type:e,data:t},s,n)=>Qh&&t instanceof Blob?s?n(t):Wc(t,n):Jh&&(t instanceof ArrayBuffer||Zh(t))?s?n(t):Wc(new Blob([t]),n):n(je[e]+(t||"")),Wc=(e,t)=>{const s=new FileReader;return s.onload=function(){const n=s.result.split(",")[1];t("b"+(n||""))},s.readAsDataURL(e)};function $c(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let xo;function F0(e,t){if(Qh&&e.data instanceof Blob)return e.data.arrayBuffer().then($c).then(t);if(Jh&&(e.data instanceof ArrayBuffer||Zh(e.data)))return t($c(e.data));$a(e,!1,s=>{xo||(xo=new TextEncoder),t(xo.encode(s))})}const qc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",In=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<qc.length;e++)In[qc.charCodeAt(e)]=e;const I0=e=>{let t=e.length*.75,s=e.length,n,i=0,r,o,a,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const c=new ArrayBuffer(t),u=new Uint8Array(c);for(n=0;n<s;n+=4)r=In[e.charCodeAt(n)],o=In[e.charCodeAt(n+1)],a=In[e.charCodeAt(n+2)],l=In[e.charCodeAt(n+3)],u[i++]=r<<2|o>>4,u[i++]=(o&15)<<4|a>>2,u[i++]=(a&3)<<6|l&63;return c},j0=typeof ArrayBuffer=="function",qa=(e,t)=>{if(typeof e!="string")return{type:"message",data:tf(e,t)};const s=e.charAt(0);return s==="b"?{type:"message",data:B0(e.substring(1),t)}:sr[s]?e.length>1?{type:sr[s],data:e.substring(1)}:{type:sr[s]}:ra},B0=(e,t)=>{if(j0){const s=I0(e);return tf(s,t)}else return{base64:!0,data:e}},tf=(e,t)=>t==="blob"?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,ef="",V0=(e,t)=>{const s=e.length,n=new Array(s);let i=0;e.forEach((r,o)=>{$a(r,!1,a=>{n[o]=a,++i===s&&t(n.join(ef))})})},z0=(e,t)=>{const s=e.split(ef),n=[];for(let i=0;i<s.length;i++){const r=qa(s[i],t);if(n.push(r),r.type==="error")break}return n};function H0(){return new TransformStream({transform(e,t){F0(e,s=>{const n=s.length;let i;if(n<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,n);else if(n<65536){i=new Uint8Array(3);const r=new DataView(i.buffer);r.setUint8(0,126),r.setUint16(1,n)}else{i=new Uint8Array(9);const r=new DataView(i.buffer);r.setUint8(0,127),r.setBigUint64(1,BigInt(n))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(s)})}})}let vo;function Di(e){return e.reduce((t,s)=>t+s.length,0)}function Ni(e,t){if(e[0].length===t)return e.shift();const s=new Uint8Array(t);let n=0;for(let i=0;i<t;i++)s[i]=e[0][n++],n===e[0].length&&(e.shift(),n=0);return e.length&&n<e[0].length&&(e[0]=e[0].slice(n)),s}function U0(e,t){vo||(vo=new TextDecoder);const s=[];let n=0,i=-1,r=!1;return new TransformStream({transform(o,a){for(s.push(o);;){if(n===0){if(Di(s)<1)break;const l=Ni(s,1);r=(l[0]&128)===128,i=l[0]&127,i<126?n=3:i===126?n=1:n=2}else if(n===1){if(Di(s)<2)break;const l=Ni(s,2);i=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),n=3}else if(n===2){if(Di(s)<8)break;const l=Ni(s,8),c=new DataView(l.buffer,l.byteOffset,l.length),u=c.getUint32(0);if(u>Math.pow(2,21)-1){a.enqueue(ra);break}i=u*Math.pow(2,32)+c.getUint32(4),n=3}else{if(Di(s)<i)break;const l=Ni(s,i);a.enqueue(qa(r?l:vo.decode(l),t)),n=0}if(i===0||i>e){a.enqueue(ra);break}}}})}const sf=4;function Mt(e){if(e)return W0(e)}function W0(e){for(var t in Mt.prototype)e[t]=Mt.prototype[t];return e}Mt.prototype.on=Mt.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Mt.prototype.once=function(e,t){function s(){this.off(e,s),t.apply(this,arguments)}return s.fn=t,this.on(e,s),this};Mt.prototype.off=Mt.prototype.removeListener=Mt.prototype.removeAllListeners=Mt.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+e];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var n,i=0;i<s.length;i++)if(n=s[i],n===t||n.fn===t){s.splice(i,1);break}return s.length===0&&delete this._callbacks["$"+e],this};Mt.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),s=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(s){s=s.slice(0);for(var n=0,i=s.length;n<i;++n)s[n].apply(this,t)}return this};Mt.prototype.emitReserved=Mt.prototype.emit;Mt.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};Mt.prototype.hasListeners=function(e){return!!this.listeners(e).length};const zr=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,s)=>s(t,0),me=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),$0="arraybuffer";function nf(e,...t){return t.reduce((s,n)=>(e.hasOwnProperty(n)&&(s[n]=e[n]),s),{})}const q0=me.setTimeout,K0=me.clearTimeout;function Hr(e,t){t.useNativeTimers?(e.setTimeoutFn=q0.bind(me),e.clearTimeoutFn=K0.bind(me)):(e.setTimeoutFn=me.setTimeout.bind(me),e.clearTimeoutFn=me.clearTimeout.bind(me))}const Y0=1.33;function G0(e){return typeof e=="string"?X0(e):Math.ceil((e.byteLength||e.size)*Y0)}function X0(e){let t=0,s=0;for(let n=0,i=e.length;n<i;n++)t=e.charCodeAt(n),t<128?s+=1:t<2048?s+=2:t<55296||t>=57344?s+=3:(n++,s+=4);return s}function rf(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Q0(e){let t="";for(let s in e)e.hasOwnProperty(s)&&(t.length&&(t+="&"),t+=encodeURIComponent(s)+"="+encodeURIComponent(e[s]));return t}function J0(e){let t={},s=e.split("&");for(let n=0,i=s.length;n<i;n++){let r=s[n].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}class Z0 extends Error{constructor(t,s,n){super(t),this.description=s,this.context=n,this.type="TransportError"}}class Ka extends Mt{constructor(t){super(),this.writable=!1,Hr(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,s,n){return super.emitReserved("error",new Z0(t,s,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const s=qa(t,this.socket.binaryType);this.onPacket(s)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,s={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const s=Q0(t);return s.length?"?"+s:""}}class tv extends Ka{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const s=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let n=0;this._polling&&(n++,this.once("pollComplete",function(){--n||s()})),this.writable||(n++,this.once("drain",function(){--n||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const s=n=>{if(this.readyState==="opening"&&n.type==="open"&&this.onOpen(),n.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(n)};z0(t,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,V0(t,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=rf()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(t,s)}}let of=!1;try{of=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const ev=of;function sv(){}class nv extends tv{constructor(t){if(super(t),typeof location<"u"){const s=location.protocol==="https:";let n=location.port;n||(n=s?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||n!==t.port}}doWrite(t,s){const n=this.request({method:"POST",data:t});n.on("success",s),n.on("error",(i,r)=>{this.onError("xhr post error",i,r)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(s,n)=>{this.onError("xhr poll error",s,n)}),this.pollXhr=t}}class Ne extends Mt{constructor(t,s,n){super(),this.createRequest=t,Hr(this,n),this._opts=n,this._method=n.method||"GET",this._uri=s,this._data=n.data!==void 0?n.data:null,this._create()}_create(){var t;const s=nf(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(s);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&n.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var i;n.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(n.getResponseHeader("set-cookie"))),n.readyState===4&&(n.status===200||n.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof n.status=="number"?n.status:0)},0))},n.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=Ne.requestsCount++,Ne.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=sv,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Ne.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Ne.requestsCount=0;Ne.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Kc);else if(typeof addEventListener=="function"){const e="onpagehide"in me?"pagehide":"unload";addEventListener(e,Kc,!1)}}function Kc(){for(let e in Ne.requests)Ne.requests.hasOwnProperty(e)&&Ne.requests[e].abort()}const iv=(function(){const e=af({xdomain:!1});return e&&e.responseType!==null})();class rv extends nv{constructor(t){super(t);const s=t&&t.forceBase64;this.supportsBinary=iv&&!s}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Ne(af,this.uri(),t)}}function af(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||ev))return new XMLHttpRequest}catch{}if(!t)try{return new me[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const lf=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class ov extends Ka{get name(){return"websocket"}doOpen(){const t=this.uri(),s=this.opts.protocols,n=lf?{}:nf(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,s,n)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const n=t[s],i=s===t.length-1;$a(n,this.supportsBinary,r=>{try{this.doWrite(n,r)}catch{}i&&zr(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=rf()),this.supportsBinary||(s.b64=1),this.createUri(t,s)}}const _o=me.WebSocket||me.MozWebSocket;class av extends ov{createSocket(t,s,n){return lf?new _o(t,s,n):s?new _o(t,s):new _o(t)}doWrite(t,s){this.ws.send(s)}}class lv extends Ka{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const s=U0(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=t.readable.pipeThrough(s).getReader(),i=H0();i.readable.pipeTo(t.writable),this._writer=i.writable.getWriter();const r=()=>{n.read().then(({done:a,value:l})=>{a||(this.onPacket(l),r())}).catch(a=>{})};r();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const n=t[s],i=s===t.length-1;this._writer.write(n).then(()=>{i&&zr(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const cv={websocket:av,webtransport:lv,polling:rv},uv=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,dv=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function oa(e){if(e.length>8e3)throw"URI too long";const t=e,s=e.indexOf("["),n=e.indexOf("]");s!=-1&&n!=-1&&(e=e.substring(0,s)+e.substring(s,n).replace(/:/g,";")+e.substring(n,e.length));let i=uv.exec(e||""),r={},o=14;for(;o--;)r[dv[o]]=i[o]||"";return s!=-1&&n!=-1&&(r.source=t,r.host=r.host.substring(1,r.host.length-1).replace(/;/g,":"),r.authority=r.authority.replace("[","").replace("]","").replace(/;/g,":"),r.ipv6uri=!0),r.pathNames=hv(r,r.path),r.queryKey=fv(r,r.query),r}function hv(e,t){const s=/\/{2,9}/g,n=t.replace(s,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&n.splice(0,1),t.slice(-1)=="/"&&n.splice(n.length-1,1),n}function fv(e,t){const s={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,i,r){i&&(s[i]=r)}),s}const aa=typeof addEventListener=="function"&&typeof removeEventListener=="function",nr=[];aa&&addEventListener("offline",()=>{nr.forEach(e=>e())},!1);class hs extends Mt{constructor(t,s){if(super(),this.binaryType=$0,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){const n=oa(t);s.hostname=n.host,s.secure=n.protocol==="https"||n.protocol==="wss",s.port=n.port,n.query&&(s.query=n.query)}else s.host&&(s.hostname=oa(s.host).host);Hr(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(n=>{const i=n.prototype.name;this.transports.push(i),this._transportsByName[i]=n}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=J0(this.opts.query)),aa&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},nr.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const s=Object.assign({},this.opts.query);s.EIO=sf,s.transport=t,this.id&&(s.sid=this.id);const n=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&hs.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",hs.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let n=0;n<this.writeBuffer.length;n++){const i=this.writeBuffer[n].data;if(i&&(s+=G0(i)),n>0&&s>this._maxPayload)return this.writeBuffer.slice(0,n);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,zr(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,n){return this._sendPacket("message",t,s,n),this}send(t,s,n){return this._sendPacket("message",t,s,n),this}_sendPacket(t,s,n,i){if(typeof s=="function"&&(i=s,s=void 0),typeof n=="function"&&(i=n,n=null),this.readyState==="closing"||this.readyState==="closed")return;n=n||{},n.compress=n.compress!==!1;const r={type:t,data:s,options:n};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},n=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():t()}):this.upgrading?n():t()),this}_onError(t){if(hs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),aa&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const n=nr.indexOf(this._offlineEventListener);n!==-1&&nr.splice(n,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}hs.protocol=sf;class pv extends hs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let s=this.createTransport(t),n=!1;hs.priorWebsocketSuccess=!1;const i=()=>{n||(s.send([{type:"ping",data:"probe"}]),s.once("packet",d=>{if(!n)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;hs.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{n||this.readyState!=="closed"&&(u(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const h=new Error("probe error");h.transport=s.name,this.emitReserved("upgradeError",h)}}))};function r(){n||(n=!0,u(),s.close(),s=null)}const o=d=>{const h=new Error("probe error: "+d);h.transport=s.name,r(),this.emitReserved("upgradeError",h)};function a(){o("transport closed")}function l(){o("socket closed")}function c(d){s&&d.name!==s.name&&r()}const u=()=>{s.removeListener("open",i),s.removeListener("error",o),s.removeListener("close",a),this.off("close",l),this.off("upgrading",c)};s.once("open",i),s.once("error",o),s.once("close",a),this.once("close",l),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{n||s.open()},200):s.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const s=[];for(let n=0;n<t.length;n++)~this.transports.indexOf(t[n])&&s.push(t[n]);return s}}let mv=class extends pv{constructor(t,s={}){const n=typeof t=="object"?t:s;(!n.transports||n.transports&&typeof n.transports[0]=="string")&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(i=>cv[i]).filter(i=>!!i)),super(t,n)}};function gv(e,t="",s){let n=e;s=s||typeof location<"u"&&location,e==null&&(e=s.protocol+"//"+s.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=s.protocol+e:e=s.host+e),/^(https?|wss?):\/\//.test(e)||(typeof s<"u"?e=s.protocol+"//"+e:e="https://"+e),n=oa(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const r=n.host.indexOf(":")!==-1?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+r+":"+n.port+t,n.href=n.protocol+"://"+r+(s&&s.port===n.port?"":":"+n.port),n}const bv=typeof ArrayBuffer=="function",yv=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,cf=Object.prototype.toString,xv=typeof Blob=="function"||typeof Blob<"u"&&cf.call(Blob)==="[object BlobConstructor]",vv=typeof File=="function"||typeof File<"u"&&cf.call(File)==="[object FileConstructor]";function Ya(e){return bv&&(e instanceof ArrayBuffer||yv(e))||xv&&e instanceof Blob||vv&&e instanceof File}function ir(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let s=0,n=e.length;s<n;s++)if(ir(e[s]))return!0;return!1}if(Ya(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return ir(e.toJSON(),!0);for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&ir(e[s]))return!0;return!1}function _v(e){const t=[],s=e.data,n=e;return n.data=la(s,t),n.attachments=t.length,{packet:n,buffers:t}}function la(e,t){if(!e)return e;if(Ya(e)){const s={_placeholder:!0,num:t.length};return t.push(e),s}else if(Array.isArray(e)){const s=new Array(e.length);for(let n=0;n<e.length;n++)s[n]=la(e[n],t);return s}else if(typeof e=="object"&&!(e instanceof Date)){const s={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=la(e[n],t));return s}return e}function wv(e,t){return e.data=ca(e.data,t),delete e.attachments,e}function ca(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let s=0;s<e.length;s++)e[s]=ca(e[s],t);else if(typeof e=="object")for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(e[s]=ca(e[s],t));return e}const Sv=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ht;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(ht||(ht={}));class kv{constructor(t){this.replacer=t}encode(t){return(t.type===ht.EVENT||t.type===ht.ACK)&&ir(t)?this.encodeAsBinary({type:t.type===ht.EVENT?ht.BINARY_EVENT:ht.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let s=""+t.type;return(t.type===ht.BINARY_EVENT||t.type===ht.BINARY_ACK)&&(s+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(s+=t.nsp+","),t.id!=null&&(s+=t.id),t.data!=null&&(s+=JSON.stringify(t.data,this.replacer)),s}encodeAsBinary(t){const s=_v(t),n=this.encodeAsString(s.packet),i=s.buffers;return i.unshift(n),i}}class Ga extends Mt{constructor(t){super(),this.reviver=t}add(t){let s;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(t);const n=s.type===ht.BINARY_EVENT;n||s.type===ht.BINARY_ACK?(s.type=n?ht.EVENT:ht.ACK,this.reconstructor=new Rv(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(Ya(t)||t.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(t),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let s=0;const n={type:Number(t.charAt(0))};if(ht[n.type]===void 0)throw new Error("unknown packet type "+n.type);if(n.type===ht.BINARY_EVENT||n.type===ht.BINARY_ACK){const r=s+1;for(;t.charAt(++s)!=="-"&&s!=t.length;);const o=t.substring(r,s);if(o!=Number(o)||t.charAt(s)!=="-")throw new Error("Illegal attachments");n.attachments=Number(o)}if(t.charAt(s+1)==="/"){const r=s+1;for(;++s&&!(t.charAt(s)===","||s===t.length););n.nsp=t.substring(r,s)}else n.nsp="/";const i=t.charAt(s+1);if(i!==""&&Number(i)==i){const r=s+1;for(;++s;){const o=t.charAt(s);if(o==null||Number(o)!=o){--s;break}if(s===t.length)break}n.id=Number(t.substring(r,s+1))}if(t.charAt(++s)){const r=this.tryParse(t.substr(s));if(Ga.isPayloadValid(n.type,r))n.data=r;else throw new Error("invalid payload")}return n}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,s){switch(t){case ht.CONNECT:return Yc(s);case ht.DISCONNECT:return s===void 0;case ht.CONNECT_ERROR:return typeof s=="string"||Yc(s);case ht.EVENT:case ht.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&Sv.indexOf(s[0])===-1);case ht.ACK:case ht.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Rv{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const s=wv(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Yc(e){return Object.prototype.toString.call(e)==="[object Object]"}const Pv=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Ga,Encoder:kv,get PacketType(){return ht}},Symbol.toStringTag,{value:"Module"}));function _e(e,t,s){return e.on(t,s),function(){e.off(t,s)}}const Ev=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class uf extends Mt{constructor(t,s,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=s,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[_e(t,"open",this.onopen.bind(this)),_e(t,"packet",this.onpacket.bind(this)),_e(t,"error",this.onerror.bind(this)),_e(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...s){var n,i,r;if(Ev.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(s.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const o={type:ht.EVENT,data:s};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const u=this.ids++,d=s.pop();this._registerAckCallback(u,d),o.id=u}const a=(i=(n=this.io.engine)===null||n===void 0?void 0:n.transport)===null||i===void 0?void 0:i.writable,l=this.connected&&!(!((r=this.io.engine)===null||r===void 0)&&r._hasPingExpired());return this.flags.volatile&&!a||(l?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,s){var n;const i=(n=this.flags.timeout)!==null&&n!==void 0?n:this._opts.ackTimeout;if(i===void 0){this.acks[t]=s;return}const r=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===t&&this.sendBuffer.splice(a,1);s.call(this,new Error("operation has timed out"))},i),o=(...a)=>{this.io.clearTimeoutFn(r),s.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...s){return new Promise((n,i)=>{const r=(o,a)=>o?i(o):n(a);r.withError=!0,s.push(r),this.emit(t,...s)})}_addToQueue(t){let s;typeof t[t.length-1]=="function"&&(s=t.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...r)=>(this._queue[0],i!==null?n.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(i)):(this._queue.shift(),s&&s(null,...r)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!t||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:ht.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(n=>String(n.id)===t)){const n=this.acks[t];delete this.acks[t],n.withError&&n.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case ht.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ht.EVENT:case ht.BINARY_EVENT:this.onevent(t);break;case ht.ACK:case ht.BINARY_ACK:this.onack(t);break;case ht.DISCONNECT:this.ondisconnect();break;case ht.CONNECT_ERROR:this.destroy();const n=new Error(t.data.message);n.data=t.data.data,this.emitReserved("connect_error",n);break}}onevent(t){const s=t.data||[];t.id!=null&&s.push(this.ack(t.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const n of s)n.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const s=this;let n=!1;return function(...i){n||(n=!0,s.packet({type:ht.ACK,id:t,data:i}))}}onack(t){const s=this.acks[t.id];typeof s=="function"&&(delete this.acks[t.id],s.withError&&t.data.unshift(null),s.apply(this,t.data))}onconnect(t,s){this.id=t,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ht.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const s=this._anyListeners;for(let n=0;n<s.length;n++)if(t===s[n])return s.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const s=this._anyOutgoingListeners;for(let n=0;n<s.length;n++)if(t===s[n])return s.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const n of s)n.apply(this,t.data)}}}function bn(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}bn.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),s=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-s:e+s}return Math.min(e,this.max)|0};bn.prototype.reset=function(){this.attempts=0};bn.prototype.setMin=function(e){this.ms=e};bn.prototype.setMax=function(e){this.max=e};bn.prototype.setJitter=function(e){this.jitter=e};class ua extends Mt{constructor(t,s){var n;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(s=t,t=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Hr(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((n=s.randomizationFactor)!==null&&n!==void 0?n:.5),this.backoff=new bn({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=t;const i=s.parser||Pv;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var s;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(s=this.backoff)===null||s===void 0||s.setMin(t),this)}randomizationFactor(t){var s;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(s=this.backoff)===null||s===void 0||s.setJitter(t),this)}reconnectionDelayMax(t){var s;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(s=this.backoff)===null||s===void 0||s.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new mv(this.uri,this.opts);const s=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const i=_e(s,"open",function(){n.onopen(),t&&t()}),r=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=_e(s,"error",r);if(this._timeout!==!1){const a=this._timeout,l=this.setTimeoutFn(()=>{i(),r(new Error("timeout")),s.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(_e(t,"ping",this.onping.bind(this)),_e(t,"data",this.ondata.bind(this)),_e(t,"error",this.onerror.bind(this)),_e(t,"close",this.onclose.bind(this)),_e(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(s){this.onclose("parse error",s)}}ondecoded(t){zr(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,s){let n=this.nsps[t];return n?this._autoConnect&&!n.active&&n.connect():(n=new uf(this,t,s),this.nsps[t]=n),n}_destroy(t){const s=Object.keys(this.nsps);for(const n of s)if(this.nsps[n].active)return;this._close()}_packet(t){const s=this.encoder.encode(t);for(let n=0;n<s.length;n++)this.engine.write(s[n],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,s){var n;this.cleanup(),(n=this.engine)===null||n===void 0||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},s);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Tn={};function rr(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const s=gv(e,t.path||"/socket.io"),n=s.source,i=s.id,r=s.path,o=Tn[i]&&r in Tn[i].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let l;return a?l=new ua(n,t):(Tn[i]||(Tn[i]=new ua(n,t)),l=Tn[i]),s.query&&!t.query&&(t.query=s.queryKey),l.socket(s.path,t)}Object.assign(rr,{Manager:ua,Socket:uf,io:rr,connect:rr});function mi(e){return e+.5|0}const os=(e,t,s)=>Math.max(Math.min(e,s),t);function jn(e){return os(mi(e*2.55),0,255)}function fs(e){return os(mi(e*255),0,255)}function $e(e){return os(mi(e/2.55)/100,0,1)}function Gc(e){return os(mi(e*100),0,100)}const he={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},da=[..."0123456789ABCDEF"],Cv=e=>da[e&15],Ov=e=>da[(e&240)>>4]+da[e&15],Fi=e=>(e&240)>>4===(e&15),Tv=e=>Fi(e.r)&&Fi(e.g)&&Fi(e.b)&&Fi(e.a);function Mv(e){var t=e.length,s;return e[0]==="#"&&(t===4||t===5?s={r:255&he[e[1]]*17,g:255&he[e[2]]*17,b:255&he[e[3]]*17,a:t===5?he[e[4]]*17:255}:(t===7||t===9)&&(s={r:he[e[1]]<<4|he[e[2]],g:he[e[3]]<<4|he[e[4]],b:he[e[5]]<<4|he[e[6]],a:t===9?he[e[7]]<<4|he[e[8]]:255})),s}const Av=(e,t)=>e<255?t(e):"";function Lv(e){var t=Tv(e)?Cv:Ov;return e?"#"+t(e.r)+t(e.g)+t(e.b)+Av(e.a,t):void 0}const Dv=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function df(e,t,s){const n=t*Math.min(s,1-s),i=(r,o=(r+e/30)%12)=>s-n*Math.max(Math.min(o-3,9-o,1),-1);return[i(0),i(8),i(4)]}function Nv(e,t,s){const n=(i,r=(i+e/60)%6)=>s-s*t*Math.max(Math.min(r,4-r,1),0);return[n(5),n(3),n(1)]}function Fv(e,t,s){const n=df(e,1,.5);let i;for(t+s>1&&(i=1/(t+s),t*=i,s*=i),i=0;i<3;i++)n[i]*=1-t-s,n[i]+=t;return n}function Iv(e,t,s,n,i){return e===i?(t-s)/n+(t<s?6:0):t===i?(s-e)/n+2:(e-t)/n+4}function Xa(e){const s=e.r/255,n=e.g/255,i=e.b/255,r=Math.max(s,n,i),o=Math.min(s,n,i),a=(r+o)/2;let l,c,u;return r!==o&&(u=r-o,c=a>.5?u/(2-r-o):u/(r+o),l=Iv(s,n,i,u,r),l=l*60+.5),[l|0,c||0,a]}function Qa(e,t,s,n){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,s,n)).map(fs)}function Ja(e,t,s){return Qa(df,e,t,s)}function jv(e,t,s){return Qa(Fv,e,t,s)}function Bv(e,t,s){return Qa(Nv,e,t,s)}function hf(e){return(e%360+360)%360}function Vv(e){const t=Dv.exec(e);let s=255,n;if(!t)return;t[5]!==n&&(s=t[6]?jn(+t[5]):fs(+t[5]));const i=hf(+t[2]),r=+t[3]/100,o=+t[4]/100;return t[1]==="hwb"?n=jv(i,r,o):t[1]==="hsv"?n=Bv(i,r,o):n=Ja(i,r,o),{r:n[0],g:n[1],b:n[2],a:s}}function zv(e,t){var s=Xa(e);s[0]=hf(s[0]+t),s=Ja(s),e.r=s[0],e.g=s[1],e.b=s[2]}function Hv(e){if(!e)return;const t=Xa(e),s=t[0],n=Gc(t[1]),i=Gc(t[2]);return e.a<255?`hsla(${s}, ${n}%, ${i}%, ${$e(e.a)})`:`hsl(${s}, ${n}%, ${i}%)`}const Xc={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"},Qc={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 Uv(){const e={},t=Object.keys(Qc),s=Object.keys(Xc);let n,i,r,o,a;for(n=0;n<t.length;n++){for(o=a=t[n],i=0;i<s.length;i++)r=s[i],a=a.replace(r,Xc[r]);r=parseInt(Qc[o],16),e[a]=[r>>16&255,r>>8&255,r&255]}return e}let Ii;function Wv(e){Ii||(Ii=Uv(),Ii.transparent=[0,0,0,0]);const t=Ii[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const $v=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function qv(e){const t=$v.exec(e);let s=255,n,i,r;if(t){if(t[7]!==n){const o=+t[7];s=t[8]?jn(o):os(o*255,0,255)}return n=+t[1],i=+t[3],r=+t[5],n=255&(t[2]?jn(n):os(n,0,255)),i=255&(t[4]?jn(i):os(i,0,255)),r=255&(t[6]?jn(r):os(r,0,255)),{r:n,g:i,b:r,a:s}}}function Kv(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${$e(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const wo=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,Zs=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function Yv(e,t,s){const n=Zs($e(e.r)),i=Zs($e(e.g)),r=Zs($e(e.b));return{r:fs(wo(n+s*(Zs($e(t.r))-n))),g:fs(wo(i+s*(Zs($e(t.g))-i))),b:fs(wo(r+s*(Zs($e(t.b))-r))),a:e.a+s*(t.a-e.a)}}function ji(e,t,s){if(e){let n=Xa(e);n[t]=Math.max(0,Math.min(n[t]+n[t]*s,t===0?360:1)),n=Ja(n),e.r=n[0],e.g=n[1],e.b=n[2]}}function ff(e,t){return e&&Object.assign(t||{},e)}function Jc(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=fs(e[3]))):(t=ff(e,{r:0,g:0,b:0,a:1}),t.a=fs(t.a)),t}function Gv(e){return e.charAt(0)==="r"?qv(e):Vv(e)}class ti{constructor(t){if(t instanceof ti)return t;const s=typeof t;let n;s==="object"?n=Jc(t):s==="string"&&(n=Mv(t)||Wv(t)||Gv(t)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var t=ff(this._rgb);return t&&(t.a=$e(t.a)),t}set rgb(t){this._rgb=Jc(t)}rgbString(){return this._valid?Kv(this._rgb):void 0}hexString(){return this._valid?Lv(this._rgb):void 0}hslString(){return this._valid?Hv(this._rgb):void 0}mix(t,s){if(t){const n=this.rgb,i=t.rgb;let r;const o=s===r?.5:s,a=2*o-1,l=n.a-i.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;r=1-c,n.r=255&c*n.r+r*i.r+.5,n.g=255&c*n.g+r*i.g+.5,n.b=255&c*n.b+r*i.b+.5,n.a=o*n.a+(1-o)*i.a,this.rgb=n}return this}interpolate(t,s){return t&&(this._rgb=Yv(this._rgb,t._rgb,s)),this}clone(){return new ti(this.rgb)}alpha(t){return this._rgb.a=fs(t),this}clearer(t){const s=this._rgb;return s.a*=1-t,this}greyscale(){const t=this._rgb,s=mi(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=s,this}opaquer(t){const s=this._rgb;return s.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return ji(this._rgb,2,t),this}darken(t){return ji(this._rgb,2,-t),this}saturate(t){return ji(this._rgb,1,t),this}desaturate(t){return ji(this._rgb,1,-t),this}rotate(t){return zv(this._rgb,t),this}}function ze(){}const Xv=(()=>{let e=0;return()=>e++})();function lt(e){return e==null}function _t(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function ut(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function Pt(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function ae(e,t){return Pt(e)?e:t}function nt(e,t){return typeof e>"u"?t:e}const Qv=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100:+e/t,pf=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function gt(e,t,s){if(e&&typeof e.call=="function")return e.apply(s,t)}function mt(e,t,s,n){let i,r,o;if(_t(e))for(r=e.length,i=0;i<r;i++)t.call(s,e[i],i);else if(ut(e))for(o=Object.keys(e),r=o.length,i=0;i<r;i++)t.call(s,e[o[i]],o[i])}function wr(e,t){let s,n,i,r;if(!e||!t||e.length!==t.length)return!1;for(s=0,n=e.length;s<n;++s)if(i=e[s],r=t[s],i.datasetIndex!==r.datasetIndex||i.index!==r.index)return!1;return!0}function Sr(e){if(_t(e))return e.map(Sr);if(ut(e)){const t=Object.create(null),s=Object.keys(e),n=s.length;let i=0;for(;i<n;++i)t[s[i]]=Sr(e[s[i]]);return t}return e}function mf(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function Jv(e,t,s,n){if(!mf(e))return;const i=t[e],r=s[e];ut(i)&&ut(r)?ei(i,r,n):t[e]=Sr(r)}function ei(e,t,s){const n=_t(t)?t:[t],i=n.length;if(!ut(e))return e;s=s||{};const r=s.merger||Jv;let o;for(let a=0;a<i;++a){if(o=n[a],!ut(o))continue;const l=Object.keys(o);for(let c=0,u=l.length;c<u;++c)r(l[c],e,o,s)}return e}function qn(e,t){return ei(e,t,{merger:Zv})}function Zv(e,t,s){if(!mf(e))return;const n=t[e],i=s[e];ut(n)&&ut(i)?qn(n,i):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=Sr(i))}const Zc={"":e=>e,x:e=>e.x,y:e=>e.y};function t_(e){const t=e.split("."),s=[];let n="";for(const i of t)n+=i,n.endsWith("\\")?n=n.slice(0,-1)+".":(s.push(n),n="");return s}function e_(e){const t=t_(e);return s=>{for(const n of t){if(n==="")break;s=s&&s[n]}return s}}function ms(e,t){return(Zc[t]||(Zc[t]=e_(t)))(e)}function Za(e){return e.charAt(0).toUpperCase()+e.slice(1)}const si=e=>typeof e<"u",gs=e=>typeof e=="function",tu=(e,t)=>{if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0};function s_(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const pt=Math.PI,xt=2*pt,n_=xt+pt,kr=Number.POSITIVE_INFINITY,i_=pt/180,Et=pt/2,ks=pt/4,eu=pt*2/3,as=Math.log10,Fe=Math.sign;function Kn(e,t,s){return Math.abs(e-t)<s}function su(e){const t=Math.round(e);e=Kn(e,t,e/1e3)?t:e;const s=Math.pow(10,Math.floor(as(e))),n=e/s;return(n<=1?1:n<=2?2:n<=5?5:10)*s}function r_(e){const t=[],s=Math.sqrt(e);let n;for(n=1;n<s;n++)e%n===0&&(t.push(n),t.push(e/n));return s===(s|0)&&t.push(s),t.sort((i,r)=>i-r).pop(),t}function o_(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function dn(e){return!o_(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function a_(e,t){const s=Math.round(e);return s-t<=e&&s+t>=e}function gf(e,t,s){let n,i,r;for(n=0,i=e.length;n<i;n++)r=e[n][s],isNaN(r)||(t.min=Math.min(t.min,r),t.max=Math.max(t.max,r))}function ke(e){return e*(pt/180)}function tl(e){return e*(180/pt)}function nu(e){if(!Pt(e))return;let t=1,s=0;for(;Math.round(e*t)/t!==e;)t*=10,s++;return s}function bf(e,t){const s=t.x-e.x,n=t.y-e.y,i=Math.sqrt(s*s+n*n);let r=Math.atan2(n,s);return r<-.5*pt&&(r+=xt),{angle:r,distance:i}}function ha(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function l_(e,t){return(e-t+n_)%xt-pt}function $t(e){return(e%xt+xt)%xt}function ni(e,t,s,n){const i=$t(e),r=$t(t),o=$t(s),a=$t(r-i),l=$t(o-i),c=$t(i-r),u=$t(i-o);return i===r||i===o||n&&r===o||a>l&&c<u}function jt(e,t,s){return Math.max(t,Math.min(s,e))}function c_(e){return jt(e,-32768,32767)}function Ye(e,t,s,n=1e-6){return e>=Math.min(t,s)-n&&e<=Math.max(t,s)+n}function el(e,t,s){s=s||(o=>e[o]<t);let n=e.length-1,i=0,r;for(;n-i>1;)r=i+n>>1,s(r)?i=r:n=r;return{lo:i,hi:n}}const Ge=(e,t,s,n)=>el(e,s,n?i=>{const r=e[i][t];return r<s||r===s&&e[i+1][t]===s}:i=>e[i][t]<s),u_=(e,t,s)=>el(e,s,n=>e[n][t]>=s);function d_(e,t,s){let n=0,i=e.length;for(;n<i&&e[n]<t;)n++;for(;i>n&&e[i-1]>s;)i--;return n>0||i<e.length?e.slice(n,i):e}const yf=["push","pop","shift","splice","unshift"];function h_(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),yf.forEach(s=>{const n="_onData"+Za(s),i=e[s];Object.defineProperty(e,s,{configurable:!0,enumerable:!1,value(...r){const o=i.apply(this,r);return e._chartjs.listeners.forEach(a=>{typeof a[n]=="function"&&a[n](...r)}),o}})})}function iu(e,t){const s=e._chartjs;if(!s)return;const n=s.listeners,i=n.indexOf(t);i!==-1&&n.splice(i,1),!(n.length>0)&&(yf.forEach(r=>{delete e[r]}),delete e._chartjs)}function xf(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const vf=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function _f(e,t){let s=[],n=!1;return function(...i){s=i,n||(n=!0,vf.call(window,()=>{n=!1,e.apply(t,s)}))}}function f_(e,t){let s;return function(...n){return t?(clearTimeout(s),s=setTimeout(e,t,n)):e.apply(this,n),t}}const sl=e=>e==="start"?"left":e==="end"?"right":"center",Wt=(e,t,s)=>e==="start"?t:e==="end"?s:(t+s)/2,p_=(e,t,s,n)=>e===(n?"left":"right")?s:e==="center"?(t+s)/2:t;function wf(e,t,s){const n=t.length;let i=0,r=n;if(e._sorted){const{iScale:o,vScale:a,_parsed:l}=e,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,u=o.axis,{min:d,max:h,minDefined:f,maxDefined:p}=o.getUserBounds();if(f){if(i=Math.min(Ge(l,u,d).lo,s?n:Ge(t,u,o.getPixelForValue(d)).lo),c){const m=l.slice(0,i+1).reverse().findIndex(g=>!lt(g[a.axis]));i-=Math.max(0,m)}i=jt(i,0,n-1)}if(p){let m=Math.max(Ge(l,o.axis,h,!0).hi+1,s?0:Ge(t,u,o.getPixelForValue(h),!0).hi+1);if(c){const g=l.slice(m-1).findIndex(b=>!lt(b[a.axis]));m+=Math.max(0,g)}r=jt(m,i,n)-i}else r=n-i}return{start:i,count:r}}function Sf(e){const{xScale:t,yScale:s,_scaleRanges:n}=e,i={xmin:t.min,xmax:t.max,ymin:s.min,ymax:s.max};if(!n)return e._scaleRanges=i,!0;const r=n.xmin!==t.min||n.xmax!==t.max||n.ymin!==s.min||n.ymax!==s.max;return Object.assign(n,i),r}const Bi=e=>e===0||e===1,ru=(e,t,s)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*xt/s)),ou=(e,t,s)=>Math.pow(2,-10*e)*Math.sin((e-t)*xt/s)+1,Yn={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*Et)+1,easeOutSine:e=>Math.sin(e*Et),easeInOutSine:e=>-.5*(Math.cos(pt*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>Bi(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>Bi(e)?e:ru(e,.075,.3),easeOutElastic:e=>Bi(e)?e:ou(e,.075,.3),easeInOutElastic(e){return Bi(e)?e:e<.5?.5*ru(e*2,.1125,.45):.5+.5*ou(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-Yn.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?Yn.easeInBounce(e*2)*.5:Yn.easeOutBounce(e*2-1)*.5+.5};function nl(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function au(e){return nl(e)?e:new ti(e)}function So(e){return nl(e)?e:new ti(e).saturate(.5).darken(.1).hexString()}const m_=["x","y","borderWidth","radius","tension"],g_=["color","borderColor","backgroundColor"];function b_(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:g_},numbers:{type:"number",properties:m_}}),e.describe("animations",{_fallback:"animation"}),e.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:t=>t|0}}}})}function y_(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const lu=new Map;function x_(e,t){t=t||{};const s=e+JSON.stringify(t);let n=lu.get(s);return n||(n=new Intl.NumberFormat(e,t),lu.set(s,n)),n}function gi(e,t,s){return x_(t,s).format(e)}const kf={values(e){return _t(e)?e:""+e},numeric(e,t,s){if(e===0)return"0";const n=this.chart.options.locale;let i,r=e;if(s.length>1){const c=Math.max(Math.abs(s[0].value),Math.abs(s[s.length-1].value));(c<1e-4||c>1e15)&&(i="scientific"),r=v_(e,s)}const o=as(Math.abs(r)),a=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),l={notation:i,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),gi(e,n,l)},logarithmic(e,t,s){if(e===0)return"0";const n=s[t].significand||e/Math.pow(10,Math.floor(as(e)));return[1,2,3,5,10,15].includes(n)||t>.8*s.length?kf.numeric.call(this,e,t,s):""}};function v_(e,t){let s=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(s)>=1&&e!==Math.floor(e)&&(s=e-Math.floor(e)),s}var Ur={formatters:kf};function __(e){e.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:(t,s)=>s.lineWidth,tickColor:(t,s)=>s.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:Ur.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Ws=Object.create(null),fa=Object.create(null);function Gn(e,t){if(!t)return e;const s=t.split(".");for(let n=0,i=s.length;n<i;++n){const r=s[n];e=e[r]||(e[r]=Object.create(null))}return e}function ko(e,t,s){return typeof t=="string"?ei(Gn(e,t),s):ei(Gn(e,""),t)}class w_{constructor(t,s){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=n=>n.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=(n,i)=>So(i.backgroundColor),this.hoverBorderColor=(n,i)=>So(i.borderColor),this.hoverColor=(n,i)=>So(i.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(t),this.apply(s)}set(t,s){return ko(this,t,s)}get(t){return Gn(this,t)}describe(t,s){return ko(fa,t,s)}override(t,s){return ko(Ws,t,s)}route(t,s,n,i){const r=Gn(this,t),o=Gn(this,n),a="_"+s;Object.defineProperties(r,{[a]:{value:r[s],writable:!0},[s]:{enumerable:!0,get(){const l=this[a],c=o[i];return ut(l)?Object.assign({},c,l):nt(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(s=>s(this))}}var wt=new w_({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[b_,y_,__]);function S_(e){return!e||lt(e.size)||lt(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function Rr(e,t,s,n,i){let r=t[i];return r||(r=t[i]=e.measureText(i).width,s.push(i)),r>n&&(n=r),n}function k_(e,t,s,n){n=n||{};let i=n.data=n.data||{},r=n.garbageCollect=n.garbageCollect||[];n.font!==t&&(i=n.data={},r=n.garbageCollect=[],n.font=t),e.save(),e.font=t;let o=0;const a=s.length;let l,c,u,d,h;for(l=0;l<a;l++)if(d=s[l],d!=null&&!_t(d))o=Rr(e,i,r,o,d);else if(_t(d))for(c=0,u=d.length;c<u;c++)h=d[c],h!=null&&!_t(h)&&(o=Rr(e,i,r,o,h));e.restore();const f=r.length/2;if(f>s.length){for(l=0;l<f;l++)delete i[r[l]];r.splice(0,f)}return o}function Rs(e,t,s){const n=e.currentDevicePixelRatio,i=s!==0?Math.max(s/2,.5):0;return Math.round((t-i)*n)/n+i}function cu(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function pa(e,t,s,n){Rf(e,t,s,n,null)}function Rf(e,t,s,n,i){let r,o,a,l,c,u,d,h;const f=t.pointStyle,p=t.rotation,m=t.radius;let g=(p||0)*i_;if(f&&typeof f=="object"&&(r=f.toString(),r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]")){e.save(),e.translate(s,n),e.rotate(g),e.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),e.restore();return}if(!(isNaN(m)||m<=0)){switch(e.beginPath(),f){default:i?e.ellipse(s,n,i/2,m,0,0,xt):e.arc(s,n,m,0,xt),e.closePath();break;case"triangle":u=i?i/2:m,e.moveTo(s+Math.sin(g)*u,n-Math.cos(g)*m),g+=eu,e.lineTo(s+Math.sin(g)*u,n-Math.cos(g)*m),g+=eu,e.lineTo(s+Math.sin(g)*u,n-Math.cos(g)*m),e.closePath();break;case"rectRounded":c=m*.516,l=m-c,o=Math.cos(g+ks)*l,d=Math.cos(g+ks)*(i?i/2-c:l),a=Math.sin(g+ks)*l,h=Math.sin(g+ks)*(i?i/2-c:l),e.arc(s-d,n-a,c,g-pt,g-Et),e.arc(s+h,n-o,c,g-Et,g),e.arc(s+d,n+a,c,g,g+Et),e.arc(s-h,n+o,c,g+Et,g+pt),e.closePath();break;case"rect":if(!p){l=Math.SQRT1_2*m,u=i?i/2:l,e.rect(s-u,n-l,2*u,2*l);break}g+=ks;case"rectRot":d=Math.cos(g)*(i?i/2:m),o=Math.cos(g)*m,a=Math.sin(g)*m,h=Math.sin(g)*(i?i/2:m),e.moveTo(s-d,n-a),e.lineTo(s+h,n-o),e.lineTo(s+d,n+a),e.lineTo(s-h,n+o),e.closePath();break;case"crossRot":g+=ks;case"cross":d=Math.cos(g)*(i?i/2:m),o=Math.cos(g)*m,a=Math.sin(g)*m,h=Math.sin(g)*(i?i/2:m),e.moveTo(s-d,n-a),e.lineTo(s+d,n+a),e.moveTo(s+h,n-o),e.lineTo(s-h,n+o);break;case"star":d=Math.cos(g)*(i?i/2:m),o=Math.cos(g)*m,a=Math.sin(g)*m,h=Math.sin(g)*(i?i/2:m),e.moveTo(s-d,n-a),e.lineTo(s+d,n+a),e.moveTo(s+h,n-o),e.lineTo(s-h,n+o),g+=ks,d=Math.cos(g)*(i?i/2:m),o=Math.cos(g)*m,a=Math.sin(g)*m,h=Math.sin(g)*(i?i/2:m),e.moveTo(s-d,n-a),e.lineTo(s+d,n+a),e.moveTo(s+h,n-o),e.lineTo(s-h,n+o);break;case"line":o=i?i/2:Math.cos(g)*m,a=Math.sin(g)*m,e.moveTo(s-o,n-a),e.lineTo(s+o,n+a);break;case"dash":e.moveTo(s,n),e.lineTo(s+Math.cos(g)*(i?i/2:m),n+Math.sin(g)*m);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function Xe(e,t,s){return s=s||.5,!t||e&&e.x>t.left-s&&e.x<t.right+s&&e.y>t.top-s&&e.y<t.bottom+s}function Wr(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function $r(e){e.restore()}function R_(e,t,s,n,i){if(!t)return e.lineTo(s.x,s.y);if(i==="middle"){const r=(t.x+s.x)/2;e.lineTo(r,t.y),e.lineTo(r,s.y)}else i==="after"!=!!n?e.lineTo(t.x,s.y):e.lineTo(s.x,t.y);e.lineTo(s.x,s.y)}function P_(e,t,s,n){if(!t)return e.lineTo(s.x,s.y);e.bezierCurveTo(n?t.cp1x:t.cp2x,n?t.cp1y:t.cp2y,n?s.cp2x:s.cp1x,n?s.cp2y:s.cp1y,s.x,s.y)}function E_(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),lt(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function C_(e,t,s,n,i){if(i.strikethrough||i.underline){const r=e.measureText(n),o=t-r.actualBoundingBoxLeft,a=t+r.actualBoundingBoxRight,l=s-r.actualBoundingBoxAscent,c=s+r.actualBoundingBoxDescent,u=i.strikethrough?(l+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=i.decorationWidth||2,e.moveTo(o,u),e.lineTo(a,u),e.stroke()}}function O_(e,t){const s=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=s}function $s(e,t,s,n,i,r={}){const o=_t(t)?t:[t],a=r.strokeWidth>0&&r.strokeColor!=="";let l,c;for(e.save(),e.font=i.string,E_(e,r),l=0;l<o.length;++l)c=o[l],r.backdrop&&O_(e,r.backdrop),a&&(r.strokeColor&&(e.strokeStyle=r.strokeColor),lt(r.strokeWidth)||(e.lineWidth=r.strokeWidth),e.strokeText(c,s,n,r.maxWidth)),e.fillText(c,s,n,r.maxWidth),C_(e,s,n,c,r),n+=Number(i.lineHeight);e.restore()}function ii(e,t){const{x:s,y:n,w:i,h:r,radius:o}=t;e.arc(s+o.topLeft,n+o.topLeft,o.topLeft,1.5*pt,pt,!0),e.lineTo(s,n+r-o.bottomLeft),e.arc(s+o.bottomLeft,n+r-o.bottomLeft,o.bottomLeft,pt,Et,!0),e.lineTo(s+i-o.bottomRight,n+r),e.arc(s+i-o.bottomRight,n+r-o.bottomRight,o.bottomRight,Et,0,!0),e.lineTo(s+i,n+o.topRight),e.arc(s+i-o.topRight,n+o.topRight,o.topRight,0,-Et,!0),e.lineTo(s+o.topLeft,n)}const T_=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,M_=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function A_(e,t){const s=(""+e).match(T_);if(!s||s[1]==="normal")return t*1.2;switch(e=+s[2],s[3]){case"px":return e;case"%":e/=100;break}return t*e}const L_=e=>+e||0;function il(e,t){const s={},n=ut(t),i=n?Object.keys(t):t,r=ut(e)?n?o=>nt(e[o],e[t[o]]):o=>e[o]:()=>e;for(const o of i)s[o]=L_(r(o));return s}function Pf(e){return il(e,{top:"y",right:"x",bottom:"y",left:"x"})}function js(e){return il(e,["topLeft","topRight","bottomLeft","bottomRight"])}function Yt(e){const t=Pf(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Nt(e,t){e=e||{},t=t||wt.font;let s=nt(e.size,t.size);typeof s=="string"&&(s=parseInt(s,10));let n=nt(e.style,t.style);n&&!(""+n).match(M_)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);const i={family:nt(e.family,t.family),lineHeight:A_(nt(e.lineHeight,t.lineHeight),s),size:s,style:n,weight:nt(e.weight,t.weight),string:""};return i.string=S_(i),i}function Bn(e,t,s,n){let i,r,o;for(i=0,r=e.length;i<r;++i)if(o=e[i],o!==void 0&&o!==void 0)return o}function D_(e,t,s){const{min:n,max:i}=e,r=pf(t,(i-n)/2),o=(a,l)=>s&&a===0?0:a+l;return{min:o(n,-Math.abs(r)),max:o(i,r)}}function bs(e,t){return Object.assign(Object.create(e),t)}function rl(e,t=[""],s,n,i=()=>e[0]){const r=s||e;typeof n>"u"&&(n=Tf("_fallback",e));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:r,_fallback:n,_getTarget:i,override:a=>rl([a,...e],t,r,n)};return new Proxy(o,{deleteProperty(a,l){return delete a[l],delete a._keys,delete e[0][l],!0},get(a,l){return Cf(a,l,()=>H_(l,t,e,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,l){return du(a).includes(l)},ownKeys(a){return du(a)},set(a,l,c){const u=a._storage||(a._storage=i());return a[l]=u[l]=c,delete a._keys,!0}})}function hn(e,t,s,n){const i={_cacheable:!1,_proxy:e,_context:t,_subProxy:s,_stack:new Set,_descriptors:Ef(e,n),setContext:r=>hn(e,r,s,n),override:r=>hn(e.override(r),t,s,n)};return new Proxy(i,{deleteProperty(r,o){return delete r[o],delete e[o],!0},get(r,o,a){return Cf(r,o,()=>F_(r,o,a))},getOwnPropertyDescriptor(r,o){return r._descriptors.allKeys?Reflect.has(e,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,o)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(r,o){return Reflect.has(e,o)},ownKeys(){return Reflect.ownKeys(e)},set(r,o,a){return e[o]=a,delete r[o],!0}})}function Ef(e,t={scriptable:!0,indexable:!0}){const{_scriptable:s=t.scriptable,_indexable:n=t.indexable,_allKeys:i=t.allKeys}=e;return{allKeys:i,scriptable:s,indexable:n,isScriptable:gs(s)?s:()=>s,isIndexable:gs(n)?n:()=>n}}const N_=(e,t)=>e?e+Za(t):t,ol=(e,t)=>ut(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Cf(e,t,s){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const n=s();return e[t]=n,n}function F_(e,t,s){const{_proxy:n,_context:i,_subProxy:r,_descriptors:o}=e;let a=n[t];return gs(a)&&o.isScriptable(t)&&(a=I_(t,a,e,s)),_t(a)&&a.length&&(a=j_(t,a,e,o.isIndexable)),ol(t,a)&&(a=hn(a,i,r&&r[t],o)),a}function I_(e,t,s,n){const{_proxy:i,_context:r,_subProxy:o,_stack:a}=s;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let l=t(r,o||n);return a.delete(e),ol(e,l)&&(l=al(i._scopes,i,e,l)),l}function j_(e,t,s,n){const{_proxy:i,_context:r,_subProxy:o,_descriptors:a}=s;if(typeof r.index<"u"&&n(e))return t[r.index%t.length];if(ut(t[0])){const l=t,c=i._scopes.filter(u=>u!==l);t=[];for(const u of l){const d=al(c,i,e,u);t.push(hn(d,r,o&&o[e],a))}}return t}function Of(e,t,s){return gs(e)?e(t,s):e}const B_=(e,t)=>e===!0?t:typeof e=="string"?ms(t,e):void 0;function V_(e,t,s,n,i){for(const r of t){const o=B_(s,r);if(o){e.add(o);const a=Of(o._fallback,s,i);if(typeof a<"u"&&a!==s&&a!==n)return a}else if(o===!1&&typeof n<"u"&&s!==n)return null}return!1}function al(e,t,s,n){const i=t._rootScopes,r=Of(t._fallback,s,n),o=[...e,...i],a=new Set;a.add(n);let l=uu(a,o,s,r||s,n);return l===null||typeof r<"u"&&r!==s&&(l=uu(a,o,r,l,n),l===null)?!1:rl(Array.from(a),[""],i,r,()=>z_(t,s,n))}function uu(e,t,s,n,i){for(;s;)s=V_(e,t,s,n,i);return s}function z_(e,t,s){const n=e._getTarget();t in n||(n[t]={});const i=n[t];return _t(i)&&ut(s)?s:i||{}}function H_(e,t,s,n){let i;for(const r of t)if(i=Tf(N_(r,e),s),typeof i<"u")return ol(e,i)?al(s,n,e,i):i}function Tf(e,t){for(const s of t){if(!s)continue;const n=s[e];if(typeof n<"u")return n}}function du(e){let t=e._keys;return t||(t=e._keys=U_(e._scopes)),t}function U_(e){const t=new Set;for(const s of e)for(const n of Object.keys(s).filter(i=>!i.startsWith("_")))t.add(n);return Array.from(t)}function Mf(e,t,s,n){const{iScale:i}=e,{key:r="r"}=this._parsing,o=new Array(n);let a,l,c,u;for(a=0,l=n;a<l;++a)c=a+s,u=t[c],o[a]={r:i.parse(ms(u,r),c)};return o}const W_=Number.EPSILON||1e-14,fn=(e,t)=>t<e.length&&!e[t].skip&&e[t],Af=e=>e==="x"?"y":"x";function $_(e,t,s,n){const i=e.skip?t:e,r=t,o=s.skip?t:s,a=ha(r,i),l=ha(o,r);let c=a/(a+l),u=l/(a+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;const d=n*c,h=n*u;return{previous:{x:r.x-d*(o.x-i.x),y:r.y-d*(o.y-i.y)},next:{x:r.x+h*(o.x-i.x),y:r.y+h*(o.y-i.y)}}}function q_(e,t,s){const n=e.length;let i,r,o,a,l,c=fn(e,0);for(let u=0;u<n-1;++u)if(l=c,c=fn(e,u+1),!(!l||!c)){if(Kn(t[u],0,W_)){s[u]=s[u+1]=0;continue}i=s[u]/t[u],r=s[u+1]/t[u],a=Math.pow(i,2)+Math.pow(r,2),!(a<=9)&&(o=3/Math.sqrt(a),s[u]=i*o*t[u],s[u+1]=r*o*t[u])}}function K_(e,t,s="x"){const n=Af(s),i=e.length;let r,o,a,l=fn(e,0);for(let c=0;c<i;++c){if(o=a,a=l,l=fn(e,c+1),!a)continue;const u=a[s],d=a[n];o&&(r=(u-o[s])/3,a[`cp1${s}`]=u-r,a[`cp1${n}`]=d-r*t[c]),l&&(r=(l[s]-u)/3,a[`cp2${s}`]=u+r,a[`cp2${n}`]=d+r*t[c])}}function Y_(e,t="x"){const s=Af(t),n=e.length,i=Array(n).fill(0),r=Array(n);let o,a,l,c=fn(e,0);for(o=0;o<n;++o)if(a=l,l=c,c=fn(e,o+1),!!l){if(c){const u=c[t]-l[t];i[o]=u!==0?(c[s]-l[s])/u:0}r[o]=a?c?Fe(i[o-1])!==Fe(i[o])?0:(i[o-1]+i[o])/2:i[o-1]:i[o]}q_(e,i,r),K_(e,r,t)}function Vi(e,t,s){return Math.max(Math.min(e,s),t)}function G_(e,t){let s,n,i,r,o,a=Xe(e[0],t);for(s=0,n=e.length;s<n;++s)o=r,r=a,a=s<n-1&&Xe(e[s+1],t),r&&(i=e[s],o&&(i.cp1x=Vi(i.cp1x,t.left,t.right),i.cp1y=Vi(i.cp1y,t.top,t.bottom)),a&&(i.cp2x=Vi(i.cp2x,t.left,t.right),i.cp2y=Vi(i.cp2y,t.top,t.bottom)))}function X_(e,t,s,n,i){let r,o,a,l;if(t.spanGaps&&(e=e.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")Y_(e,i);else{let c=n?e[e.length-1]:e[0];for(r=0,o=e.length;r<o;++r)a=e[r],l=$_(c,a,e[Math.min(r+1,o-(n?0:1))%o],t.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}t.capBezierPoints&&G_(e,s)}function ll(){return typeof window<"u"&&typeof document<"u"}function cl(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Pr(e,t,s){let n;return typeof e=="string"?(n=parseInt(e,10),e.indexOf("%")!==-1&&(n=n/100*t.parentNode[s])):n=e,n}const qr=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function Q_(e,t){return qr(e).getPropertyValue(t)}const J_=["top","right","bottom","left"];function Bs(e,t,s){const n={};s=s?"-"+s:"";for(let i=0;i<4;i++){const r=J_[i];n[r]=parseFloat(e[t+"-"+r+s])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}const Z_=(e,t,s)=>(e>0||t>0)&&(!s||!s.shadowRoot);function tw(e,t){const s=e.touches,n=s&&s.length?s[0]:e,{offsetX:i,offsetY:r}=n;let o=!1,a,l;if(Z_(i,r,e.target))a=i,l=r;else{const c=t.getBoundingClientRect();a=n.clientX-c.left,l=n.clientY-c.top,o=!0}return{x:a,y:l,box:o}}function Cs(e,t){if("native"in e)return e;const{canvas:s,currentDevicePixelRatio:n}=t,i=qr(s),r=i.boxSizing==="border-box",o=Bs(i,"padding"),a=Bs(i,"border","width"),{x:l,y:c,box:u}=tw(e,s),d=o.left+(u&&a.left),h=o.top+(u&&a.top);let{width:f,height:p}=t;return r&&(f-=o.width+a.width,p-=o.height+a.height),{x:Math.round((l-d)/f*s.width/n),y:Math.round((c-h)/p*s.height/n)}}function ew(e,t,s){let n,i;if(t===void 0||s===void 0){const r=e&&cl(e);if(!r)t=e.clientWidth,s=e.clientHeight;else{const o=r.getBoundingClientRect(),a=qr(r),l=Bs(a,"border","width"),c=Bs(a,"padding");t=o.width-c.width-l.width,s=o.height-c.height-l.height,n=Pr(a.maxWidth,r,"clientWidth"),i=Pr(a.maxHeight,r,"clientHeight")}}return{width:t,height:s,maxWidth:n||kr,maxHeight:i||kr}}const ls=e=>Math.round(e*10)/10;function sw(e,t,s,n){const i=qr(e),r=Bs(i,"margin"),o=Pr(i.maxWidth,e,"clientWidth")||kr,a=Pr(i.maxHeight,e,"clientHeight")||kr,l=ew(e,t,s);let{width:c,height:u}=l;if(i.boxSizing==="content-box"){const h=Bs(i,"border","width"),f=Bs(i,"padding");c-=f.width+h.width,u-=f.height+h.height}return c=Math.max(0,c-r.width),u=Math.max(0,n?c/n:u-r.height),c=ls(Math.min(c,o,l.maxWidth)),u=ls(Math.min(u,a,l.maxHeight)),c&&!u&&(u=ls(c/2)),(t!==void 0||s!==void 0)&&n&&l.height&&u>l.height&&(u=l.height,c=ls(Math.floor(u*n))),{width:c,height:u}}function hu(e,t,s){const n=t||1,i=ls(e.height*n),r=ls(e.width*n);e.height=ls(e.height),e.width=ls(e.width);const o=e.canvas;return o.style&&(s||!o.style.height&&!o.style.width)&&(o.style.height=`${e.height}px`,o.style.width=`${e.width}px`),e.currentDevicePixelRatio!==n||o.height!==i||o.width!==r?(e.currentDevicePixelRatio=n,o.height=i,o.width=r,e.ctx.setTransform(n,0,0,n,0,0),!0):!1}const nw=(function(){let e=!1;try{const t={get passive(){return e=!0,!1}};ll()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function fu(e,t){const s=Q_(e,t),n=s&&s.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function Os(e,t,s,n){return{x:e.x+s*(t.x-e.x),y:e.y+s*(t.y-e.y)}}function iw(e,t,s,n){return{x:e.x+s*(t.x-e.x),y:n==="middle"?s<.5?e.y:t.y:n==="after"?s<1?e.y:t.y:s>0?t.y:e.y}}function rw(e,t,s,n){const i={x:e.cp2x,y:e.cp2y},r={x:t.cp1x,y:t.cp1y},o=Os(e,i,s),a=Os(i,r,s),l=Os(r,t,s),c=Os(o,a,s),u=Os(a,l,s);return Os(c,u,s)}const ow=function(e,t){return{x(s){return e+e+t-s},setWidth(s){t=s},textAlign(s){return s==="center"?s:s==="right"?"left":"right"},xPlus(s,n){return s-n},leftForLtr(s,n){return s-n}}},aw=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function on(e,t,s){return e?ow(t,s):aw()}function Lf(e,t){let s,n;(t==="ltr"||t==="rtl")&&(s=e.canvas.style,n=[s.getPropertyValue("direction"),s.getPropertyPriority("direction")],s.setProperty("direction",t,"important"),e.prevTextDirection=n)}function Df(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function Nf(e){return e==="angle"?{between:ni,compare:l_,normalize:$t}:{between:Ye,compare:(t,s)=>t-s,normalize:t=>t}}function pu({start:e,end:t,count:s,loop:n,style:i}){return{start:e%s,end:t%s,loop:n&&(t-e+1)%s===0,style:i}}function lw(e,t,s){const{property:n,start:i,end:r}=s,{between:o,normalize:a}=Nf(n),l=t.length;let{start:c,end:u,loop:d}=e,h,f;if(d){for(c+=l,u+=l,h=0,f=l;h<f&&o(a(t[c%l][n]),i,r);++h)c--,u--;c%=l,u%=l}return u<c&&(u+=l),{start:c,end:u,loop:d,style:e.style}}function Ff(e,t,s){if(!s)return[e];const{property:n,start:i,end:r}=s,o=t.length,{compare:a,between:l,normalize:c}=Nf(n),{start:u,end:d,loop:h,style:f}=lw(e,t,s),p=[];let m=!1,g=null,b,x,w;const v=()=>l(i,w,b)&&a(i,w)!==0,S=()=>a(r,b)===0||l(r,w,b),P=()=>m||v(),R=()=>!m||S();for(let _=u,C=u;_<=d;++_)x=t[_%o],!x.skip&&(b=c(x[n]),b!==w&&(m=l(b,i,r),g===null&&P()&&(g=a(b,i)===0?_:C),g!==null&&R()&&(p.push(pu({start:g,end:_,loop:h,count:o,style:f})),g=null),C=_,w=b));return g!==null&&p.push(pu({start:g,end:d,loop:h,count:o,style:f})),p}function If(e,t){const s=[],n=e.segments;for(let i=0;i<n.length;i++){const r=Ff(n[i],e.points,t);r.length&&s.push(...r)}return s}function cw(e,t,s,n){let i=0,r=t-1;if(s&&!n)for(;i<t&&!e[i].skip;)i++;for(;i<t&&e[i].skip;)i++;for(i%=t,s&&(r+=i);r>i&&e[r%t].skip;)r--;return r%=t,{start:i,end:r}}function uw(e,t,s,n){const i=e.length,r=[];let o=t,a=e[t],l;for(l=t+1;l<=s;++l){const c=e[l%i];c.skip||c.stop?a.skip||(n=!1,r.push({start:t%i,end:(l-1)%i,loop:n}),t=o=c.stop?l:null):(o=l,a.skip&&(t=l)),a=c}return o!==null&&r.push({start:t%i,end:o%i,loop:n}),r}function dw(e,t){const s=e.points,n=e.options.spanGaps,i=s.length;if(!i)return[];const r=!!e._loop,{start:o,end:a}=cw(s,i,r,n);if(n===!0)return mu(e,[{start:o,end:a,loop:r}],s,t);const l=a<o?a+i:a,c=!!e._fullLoop&&o===0&&a===i-1;return mu(e,uw(s,o,l,c),s,t)}function mu(e,t,s,n){return!n||!n.setContext||!s?t:hw(e,t,s,n)}function hw(e,t,s,n){const i=e._chart.getContext(),r=gu(e.options),{_datasetIndex:o,options:{spanGaps:a}}=e,l=s.length,c=[];let u=r,d=t[0].start,h=d;function f(p,m,g,b){const x=a?-1:1;if(p!==m){for(p+=l;s[p%l].skip;)p-=x;for(;s[m%l].skip;)m+=x;p%l!==m%l&&(c.push({start:p%l,end:m%l,loop:g,style:b}),u=b,d=m%l)}}for(const p of t){d=a?d:p.start;let m=s[d%l],g;for(h=d+1;h<=p.end;h++){const b=s[h%l];g=gu(n.setContext(bs(i,{type:"segment",p0:m,p1:b,p0DataIndex:(h-1)%l,p1DataIndex:h%l,datasetIndex:o}))),fw(g,u)&&f(d,h-1,p.loop,u),m=b,u=g}d<h-1&&f(d,h-1,p.loop,u)}return c}function gu(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function fw(e,t){if(!t)return!1;const s=[],n=function(i,r){return nl(r)?(s.includes(r)||s.push(r),s.indexOf(r)):r};return JSON.stringify(e,n)!==JSON.stringify(t,n)}function zi(e,t,s){return e.options.clip?e[s]:t[s]}function pw(e,t){const{xScale:s,yScale:n}=e;return s&&n?{left:zi(s,t,"left"),right:zi(s,t,"right"),top:zi(n,t,"top"),bottom:zi(n,t,"bottom")}:t}function jf(e,t){const s=t._clip;if(s.disabled)return!1;const n=pw(t,e.chartArea);return{left:s.left===!1?0:n.left-(s.left===!0?0:s.left),right:s.right===!1?e.width:n.right+(s.right===!0?0:s.right),top:s.top===!1?0:n.top-(s.top===!0?0:s.top),bottom:s.bottom===!1?e.height:n.bottom+(s.bottom===!0?0:s.bottom)}}class mw{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,s,n,i){const r=s.listeners[i],o=s.duration;r.forEach(a=>a({chart:t,initial:s.initial,numSteps:o,currentStep:Math.min(n-s.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=vf.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let s=0;this._charts.forEach((n,i)=>{if(!n.running||!n.items.length)return;const r=n.items;let o=r.length-1,a=!1,l;for(;o>=0;--o)l=r[o],l._active?(l._total>n.duration&&(n.duration=l._total),l.tick(t),a=!0):(r[o]=r[r.length-1],r.pop());a&&(i.draw(),this._notify(i,n,t,"progress")),r.length||(n.running=!1,this._notify(i,n,t,"complete"),n.initial=!1),s+=r.length}),this._lastDate=t,s===0&&(this._running=!1)}_getAnims(t){const s=this._charts;let n=s.get(t);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},s.set(t,n)),n}listen(t,s,n){this._getAnims(t).listeners[s].push(n)}add(t,s){!s||!s.length||this._getAnims(t).items.push(...s)}has(t){return this._getAnims(t).items.length>0}start(t){const s=this._charts.get(t);s&&(s.running=!0,s.start=Date.now(),s.duration=s.items.reduce((n,i)=>Math.max(n,i._duration),0),this._refresh())}running(t){if(!this._running)return!1;const s=this._charts.get(t);return!(!s||!s.running||!s.items.length)}stop(t){const s=this._charts.get(t);if(!s||!s.items.length)return;const n=s.items;let i=n.length-1;for(;i>=0;--i)n[i].cancel();s.items=[],this._notify(t,s,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Ue=new mw;const bu="transparent",gw={boolean(e,t,s){return s>.5?t:e},color(e,t,s){const n=au(e||bu),i=n.valid&&au(t||bu);return i&&i.valid?i.mix(n,s).hexString():t},number(e,t,s){return e+(t-e)*s}};class bw{constructor(t,s,n,i){const r=s[n];i=Bn([t.to,i,r,t.from]);const o=Bn([t.from,r,i]);this._active=!0,this._fn=t.fn||gw[t.type||typeof o],this._easing=Yn[t.easing]||Yn.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=s,this._prop=n,this._from=o,this._to=i,this._promises=void 0}active(){return this._active}update(t,s,n){if(this._active){this._notify(!1);const i=this._target[this._prop],r=n-this._start,o=this._duration-r;this._start=n,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=r,this._loop=!!t.loop,this._to=Bn([t.to,s,i,t.from]),this._from=Bn([t.from,i,s])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const s=t-this._start,n=this._duration,i=this._prop,r=this._from,o=this._loop,a=this._to;let l;if(this._active=r!==a&&(o||s<n),!this._active){this._target[i]=a,this._notify(!0);return}if(s<0){this._target[i]=r;return}l=s/n%2,l=o&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[i]=this._fn(r,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((s,n)=>{t.push({res:s,rej:n})})}_notify(t){const s=t?"res":"rej",n=this._promises||[];for(let i=0;i<n.length;i++)n[i][s]()}}class Bf{constructor(t,s){this._chart=t,this._properties=new Map,this.configure(s)}configure(t){if(!ut(t))return;const s=Object.keys(wt.animation),n=this._properties;Object.getOwnPropertyNames(t).forEach(i=>{const r=t[i];if(!ut(r))return;const o={};for(const a of s)o[a]=r[a];(_t(r.properties)&&r.properties||[i]).forEach(a=>{(a===i||!n.has(a))&&n.set(a,o)})})}_animateOptions(t,s){const n=s.options,i=xw(t,n);if(!i)return[];const r=this._createAnimations(i,n);return n.$shared&&yw(t.options.$animations,n).then(()=>{t.options=n},()=>{}),r}_createAnimations(t,s){const n=this._properties,i=[],r=t.$animations||(t.$animations={}),o=Object.keys(s),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"){i.push(...this._animateOptions(t,s));continue}const u=s[c];let d=r[c];const h=n.get(c);if(d)if(h&&d.active()){d.update(h,u,a);continue}else d.cancel();if(!h||!h.duration){t[c]=u;continue}r[c]=d=new bw(h,t,c,u),i.push(d)}return i}update(t,s){if(this._properties.size===0){Object.assign(t,s);return}const n=this._createAnimations(t,s);if(n.length)return Ue.add(this._chart,n),!0}}function yw(e,t){const s=[],n=Object.keys(t);for(let i=0;i<n.length;i++){const r=e[n[i]];r&&r.active()&&s.push(r.wait())}return Promise.all(s)}function xw(e,t){if(!t)return;let s=e.options;if(!s){e.options=t;return}return s.$shared&&(e.options=s=Object.assign({},s,{$shared:!1,$animations:{}})),s}function yu(e,t){const s=e&&e.options||{},n=s.reverse,i=s.min===void 0?t:0,r=s.max===void 0?t:0;return{start:n?r:i,end:n?i:r}}function vw(e,t,s){if(s===!1)return!1;const n=yu(e,s),i=yu(t,s);return{top:i.end,right:n.end,bottom:i.start,left:n.start}}function _w(e){let t,s,n,i;return ut(e)?(t=e.top,s=e.right,n=e.bottom,i=e.left):t=s=n=i=e,{top:t,right:s,bottom:n,left:i,disabled:e===!1}}function Vf(e,t){const s=[],n=e._getSortedDatasetMetas(t);let i,r;for(i=0,r=n.length;i<r;++i)s.push(n[i].index);return s}function xu(e,t,s,n={}){const i=e.keys,r=n.mode==="single";let o,a,l,c;if(t===null)return;let u=!1;for(o=0,a=i.length;o<a;++o){if(l=+i[o],l===s){if(u=!0,n.all)continue;break}c=e.values[l],Pt(c)&&(r||t===0||Fe(t)===Fe(c))&&(t+=c)}return!u&&!n.all?0:t}function ww(e,t){const{iScale:s,vScale:n}=t,i=s.axis==="x"?"x":"y",r=n.axis==="x"?"x":"y",o=Object.keys(e),a=new Array(o.length);let l,c,u;for(l=0,c=o.length;l<c;++l)u=o[l],a[l]={[i]:u,[r]:e[u]};return a}function Ro(e,t){const s=e&&e.options.stacked;return s||s===void 0&&t.stack!==void 0}function Sw(e,t,s){return`${e.id}.${t.id}.${s.stack||s.type}`}function kw(e){const{min:t,max:s,minDefined:n,maxDefined:i}=e.getUserBounds();return{min:n?t:Number.NEGATIVE_INFINITY,max:i?s:Number.POSITIVE_INFINITY}}function Rw(e,t,s){const n=e[t]||(e[t]={});return n[s]||(n[s]={})}function vu(e,t,s,n){for(const i of t.getMatchingVisibleMetas(n).reverse()){const r=e[i.index];if(s&&r>0||!s&&r<0)return i.index}return null}function _u(e,t){const{chart:s,_cachedMeta:n}=e,i=s._stacks||(s._stacks={}),{iScale:r,vScale:o,index:a}=n,l=r.axis,c=o.axis,u=Sw(r,o,n),d=t.length;let h;for(let f=0;f<d;++f){const p=t[f],{[l]:m,[c]:g}=p,b=p._stacks||(p._stacks={});h=b[c]=Rw(i,u,m),h[a]=g,h._top=vu(h,o,!0,n.type),h._bottom=vu(h,o,!1,n.type);const x=h._visualValues||(h._visualValues={});x[a]=g}}function Po(e,t){const s=e.scales;return Object.keys(s).filter(n=>s[n].axis===t).shift()}function Pw(e,t){return bs(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Ew(e,t,s){return bs(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:s,index:t,mode:"default",type:"data"})}function Mn(e,t){const s=e.controller.index,n=e.vScale&&e.vScale.axis;if(n){t=t||e._parsed;for(const i of t){const r=i._stacks;if(!r||r[n]===void 0||r[n][s]===void 0)return;delete r[n][s],r[n]._visualValues!==void 0&&r[n]._visualValues[s]!==void 0&&delete r[n]._visualValues[s]}}}const Eo=e=>e==="reset"||e==="none",wu=(e,t)=>t?e:Object.assign({},e),Cw=(e,t,s)=>e&&!t.hidden&&t._stacked&&{keys:Vf(s,!0),values:null};class ys{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,s){this.chart=t,this._ctx=t.ctx,this.index=s,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 t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Ro(t.vScale,t),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(t){this.index!==t&&Mn(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,s=this._cachedMeta,n=this.getDataset(),i=(d,h,f,p)=>d==="x"?h:d==="r"?p:f,r=s.xAxisID=nt(n.xAxisID,Po(t,"x")),o=s.yAxisID=nt(n.yAxisID,Po(t,"y")),a=s.rAxisID=nt(n.rAxisID,Po(t,"r")),l=s.indexAxis,c=s.iAxisID=i(l,r,o,a),u=s.vAxisID=i(l,o,r,a);s.xScale=this.getScaleForId(r),s.yScale=this.getScaleForId(o),s.rScale=this.getScaleForId(a),s.iScale=this.getScaleForId(c),s.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const s=this._cachedMeta;return t===s.iScale?s.vScale:s.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&iu(this._data,this),t._stacked&&Mn(t)}_dataCheck(){const t=this.getDataset(),s=t.data||(t.data=[]),n=this._data;if(ut(s)){const i=this._cachedMeta;this._data=ww(s,i)}else if(n!==s){if(n){iu(n,this);const i=this._cachedMeta;Mn(i),i._parsed=[]}s&&Object.isExtensible(s)&&h_(s,this),this._syncList=[],this._data=s}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const s=this._cachedMeta,n=this.getDataset();let i=!1;this._dataCheck();const r=s._stacked;s._stacked=Ro(s.vScale,s),s.stack!==n.stack&&(i=!0,Mn(s),s.stack=n.stack),this._resyncElements(t),(i||r!==s._stacked)&&(_u(this,s._parsed),s._stacked=Ro(s.vScale,s))}configure(){const t=this.chart.config,s=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),s,!0);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,s){const{_cachedMeta:n,_data:i}=this,{iScale:r,_stacked:o}=n,a=r.axis;let l=t===0&&s===i.length?!0:n._sorted,c=t>0&&n._parsed[t-1],u,d,h;if(this._parsing===!1)n._parsed=i,n._sorted=!0,h=i;else{_t(i[t])?h=this.parseArrayData(n,i,t,s):ut(i[t])?h=this.parseObjectData(n,i,t,s):h=this.parsePrimitiveData(n,i,t,s);const f=()=>d[a]===null||c&&d[a]<c[a];for(u=0;u<s;++u)n._parsed[u+t]=d=h[u],l&&(f()&&(l=!1),c=d);n._sorted=l}o&&_u(this,h)}parsePrimitiveData(t,s,n,i){const{iScale:r,vScale:o}=t,a=r.axis,l=o.axis,c=r.getLabels(),u=r===o,d=new Array(i);let h,f,p;for(h=0,f=i;h<f;++h)p=h+n,d[h]={[a]:u||r.parse(c[p],p),[l]:o.parse(s[p],p)};return d}parseArrayData(t,s,n,i){const{xScale:r,yScale:o}=t,a=new Array(i);let l,c,u,d;for(l=0,c=i;l<c;++l)u=l+n,d=s[u],a[l]={x:r.parse(d[0],u),y:o.parse(d[1],u)};return a}parseObjectData(t,s,n,i){const{xScale:r,yScale:o}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(i);let u,d,h,f;for(u=0,d=i;u<d;++u)h=u+n,f=s[h],c[u]={x:r.parse(ms(f,a),h),y:o.parse(ms(f,l),h)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,s,n){const i=this.chart,r=this._cachedMeta,o=s[t.axis],a={keys:Vf(i,!0),values:s._stacks[t.axis]._visualValues};return xu(a,o,r.index,{mode:n})}updateRangeFromParsed(t,s,n,i){const r=n[s.axis];let o=r===null?NaN:r;const a=i&&n._stacks[s.axis];i&&a&&(i.values=a,o=xu(i,r,this._cachedMeta.index)),t.min=Math.min(t.min,o),t.max=Math.max(t.max,o)}getMinMax(t,s){const n=this._cachedMeta,i=n._parsed,r=n._sorted&&t===n.iScale,o=i.length,a=this._getOtherScale(t),l=Cw(s,n,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:d}=kw(a);let h,f;function p(){f=i[h];const m=f[a.axis];return!Pt(f[t.axis])||u>m||d<m}for(h=0;h<o&&!(!p()&&(this.updateRangeFromParsed(c,t,f,l),r));++h);if(r){for(h=o-1;h>=0;--h)if(!p()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const s=this._cachedMeta._parsed,n=[];let i,r,o;for(i=0,r=s.length;i<r;++i)o=s[i][t.axis],Pt(o)&&n.push(o);return n}getMaxOverflow(){return!1}getLabelAndValue(t){const s=this._cachedMeta,n=s.iScale,i=s.vScale,r=this.getParsed(t);return{label:n?""+n.getLabelForValue(r[n.axis]):"",value:i?""+i.getLabelForValue(r[i.axis]):""}}_update(t){const s=this._cachedMeta;this.update(t||"default"),s._clip=_w(nt(this.options.clip,vw(s.xScale,s.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,s=this.chart,n=this._cachedMeta,i=n.data||[],r=s.chartArea,o=[],a=this._drawStart||0,l=this._drawCount||i.length-a,c=this.options.drawActiveElementsOnTop;let u;for(n.dataset&&n.dataset.draw(t,r,a,l),u=a;u<a+l;++u){const d=i[u];d.hidden||(d.active&&c?o.push(d):d.draw(t,r))}for(u=0;u<o.length;++u)o[u].draw(t,r)}getStyle(t,s){const n=s?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(t||0,n)}getContext(t,s,n){const i=this.getDataset();let r;if(t>=0&&t<this._cachedMeta.data.length){const o=this._cachedMeta.data[t];r=o.$context||(o.$context=Ew(this.getContext(),t,o)),r.parsed=this.getParsed(t),r.raw=i.data[t],r.index=r.dataIndex=t}else r=this.$context||(this.$context=Pw(this.chart.getContext(),this.index)),r.dataset=i,r.index=r.datasetIndex=this.index;return r.active=!!s,r.mode=n,r}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,s){return this._resolveElementOptions(this.dataElementType.id,s,t)}_resolveElementOptions(t,s="default",n){const i=s==="active",r=this._cachedDataOpts,o=t+"-"+s,a=r[o],l=this.enableOptionSharing&&si(n);if(a)return wu(a,l);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),d=i?[`${t}Hover`,"hover",t,""]:[t,""],h=c.getOptionScopes(this.getDataset(),u),f=Object.keys(wt.elements[t]),p=()=>this.getContext(n,i,s),m=c.resolveNamedOptions(h,f,p,d);return m.$shared&&(m.$shared=l,r[o]=Object.freeze(wu(m,l))),m}_resolveAnimations(t,s,n){const i=this.chart,r=this._cachedDataOpts,o=`animation-${s}`,a=r[o];if(a)return a;let l;if(i.options.animation!==!1){const u=this.chart.config,d=u.datasetAnimationScopeKeys(this._type,s),h=u.getOptionScopes(this.getDataset(),d);l=u.createResolver(h,this.getContext(t,n,s))}const c=new Bf(i,l&&l.animations);return l&&l._cacheable&&(r[o]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,s){return!s||Eo(t)||this.chart._animationsDisabled}_getSharedOptions(t,s){const n=this.resolveDataElementOptions(t,s),i=this._sharedOptions,r=this.getSharedOptions(n),o=this.includeOptions(s,r)||r!==i;return this.updateSharedOptions(r,s,n),{sharedOptions:r,includeOptions:o}}updateElement(t,s,n,i){Eo(i)?Object.assign(t,n):this._resolveAnimations(s,i).update(t,n)}updateSharedOptions(t,s,n){t&&!Eo(s)&&this._resolveAnimations(void 0,s).update(t,n)}_setStyle(t,s,n,i){t.active=i;const r=this.getStyle(s,i);this._resolveAnimations(s,n,i).update(t,{options:!i&&this.getSharedOptions(r)||r})}removeHoverStyle(t,s,n){this._setStyle(t,n,"active",!1)}setHoverStyle(t,s,n){this._setStyle(t,n,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const s=this._data,n=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const i=n.length,r=s.length,o=Math.min(r,i);o&&this.parse(0,o),r>i?this._insertElements(i,r-i,t):r<i&&this._removeElements(r,i-r)}_insertElements(t,s,n=!0){const i=this._cachedMeta,r=i.data,o=t+s;let a;const l=c=>{for(c.length+=s,a=c.length-1;a>=o;a--)c[a]=c[a-s]};for(l(r),a=t;a<o;++a)r[a]=new this.dataElementType;this._parsing&&l(i._parsed),this.parse(t,s),n&&this.updateElements(r,t,s,"reset")}updateElements(t,s,n,i){}_removeElements(t,s){const n=this._cachedMeta;if(this._parsing){const i=n._parsed.splice(t,s);n._stacked&&Mn(n,i)}n.data.splice(t,s)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[s,n,i]=t;this[s](n,i)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,s){s&&this._sync(["_removeElements",t,s]);const n=arguments.length-2;n&&this._sync(["_insertElements",t,n])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function Ow(e,t){if(!e._cache.$bar){const s=e.getMatchingVisibleMetas(t);let n=[];for(let i=0,r=s.length;i<r;i++)n=n.concat(s[i].controller.getAllParsedValues(e));e._cache.$bar=xf(n.sort((i,r)=>i-r))}return e._cache.$bar}function Tw(e){const t=e.iScale,s=Ow(t,e.type);let n=t._length,i,r,o,a;const l=()=>{o===32767||o===-32768||(si(a)&&(n=Math.min(n,Math.abs(o-a)||n)),a=o)};for(i=0,r=s.length;i<r;++i)o=t.getPixelForValue(s[i]),l();for(a=void 0,i=0,r=t.ticks.length;i<r;++i)o=t.getPixelForTick(i),l();return n}function Mw(e,t,s,n){const i=s.barThickness;let r,o;return lt(i)?(r=t.min*s.categoryPercentage,o=s.barPercentage):(r=i*n,o=1),{chunk:r/n,ratio:o,start:t.pixels[e]-r/2}}function Aw(e,t,s,n){const i=t.pixels,r=i[e];let o=e>0?i[e-1]:null,a=e<i.length-1?i[e+1]:null;const l=s.categoryPercentage;o===null&&(o=r-(a===null?t.end-t.start:a-r)),a===null&&(a=r+r-o);const c=r-(r-Math.min(o,a))/2*l;return{chunk:Math.abs(a-o)/2*l/n,ratio:s.barPercentage,start:c}}function Lw(e,t,s,n){const i=s.parse(e[0],n),r=s.parse(e[1],n),o=Math.min(i,r),a=Math.max(i,r);let l=o,c=a;Math.abs(o)>Math.abs(a)&&(l=a,c=o),t[s.axis]=c,t._custom={barStart:l,barEnd:c,start:i,end:r,min:o,max:a}}function zf(e,t,s,n){return _t(e)?Lw(e,t,s,n):t[s.axis]=s.parse(e,n),t}function Su(e,t,s,n){const i=e.iScale,r=e.vScale,o=i.getLabels(),a=i===r,l=[];let c,u,d,h;for(c=s,u=s+n;c<u;++c)h=t[c],d={},d[i.axis]=a||i.parse(o[c],c),l.push(zf(h,d,r,c));return l}function Co(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function Dw(e,t,s){return e!==0?Fe(e):(t.isHorizontal()?1:-1)*(t.min>=s?1:-1)}function Nw(e){let t,s,n,i,r;return e.horizontal?(t=e.base>e.x,s="left",n="right"):(t=e.base<e.y,s="bottom",n="top"),t?(i="end",r="start"):(i="start",r="end"),{start:s,end:n,reverse:t,top:i,bottom:r}}function Fw(e,t,s,n){let i=t.borderSkipped;const r={};if(!i){e.borderSkipped=r;return}if(i===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:o,end:a,reverse:l,top:c,bottom:u}=Nw(e);i==="middle"&&s&&(e.enableBorderRadius=!0,(s._top||0)===n?i=c:(s._bottom||0)===n?i=u:(r[ku(u,o,a,l)]=!0,i=c)),r[ku(i,o,a,l)]=!0,e.borderSkipped=r}function ku(e,t,s,n){return n?(e=Iw(e,t,s),e=Ru(e,s,t)):e=Ru(e,t,s),e}function Iw(e,t,s){return e===t?s:e===s?t:e}function Ru(e,t,s){return e==="start"?t:e==="end"?s:e}function jw(e,{inflateAmount:t},s){e.inflateAmount=t==="auto"?s===1?.33:0:t}class Bw extends ys{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,s,n,i){return Su(t,s,n,i)}parseArrayData(t,s,n,i){return Su(t,s,n,i)}parseObjectData(t,s,n,i){const{iScale:r,vScale:o}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=r.axis==="x"?a:l,u=o.axis==="x"?a:l,d=[];let h,f,p,m;for(h=n,f=n+i;h<f;++h)m=s[h],p={},p[r.axis]=r.parse(ms(m,c),h),d.push(zf(ms(m,u),p,o,h));return d}updateRangeFromParsed(t,s,n,i){super.updateRangeFromParsed(t,s,n,i);const r=n._custom;r&&s===this._cachedMeta.vScale&&(t.min=Math.min(t.min,r.min),t.max=Math.max(t.max,r.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const s=this._cachedMeta,{iScale:n,vScale:i}=s,r=this.getParsed(t),o=r._custom,a=Co(o)?"["+o.start+", "+o.end+"]":""+i.getLabelForValue(r[i.axis]);return{label:""+n.getLabelForValue(r[n.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const s=this._cachedMeta;this.updateElements(s.data,0,s.data.length,t)}updateElements(t,s,n,i){const r=i==="reset",{index:o,_cachedMeta:{vScale:a}}=this,l=a.getBasePixel(),c=a.isHorizontal(),u=this._getRuler(),{sharedOptions:d,includeOptions:h}=this._getSharedOptions(s,i);for(let f=s;f<s+n;f++){const p=this.getParsed(f),m=r||lt(p[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),g=this._calculateBarIndexPixels(f,u),b=(p._stacks||{})[a.axis],x={horizontal:c,base:m.base,enableBorderRadius:!b||Co(p._custom)||o===b._top||o===b._bottom,x:c?m.head:g.center,y:c?g.center:m.head,height:c?g.size:Math.abs(m.size),width:c?Math.abs(m.size):g.size};h&&(x.options=d||this.resolveDataElementOptions(f,t[f].active?"active":i));const w=x.options||t[f].options;Fw(x,w,b,o),jw(x,w,u.ratio),this.updateElement(t[f],f,x,i)}}_getStacks(t,s){const{iScale:n}=this._cachedMeta,i=n.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),r=n.options.stacked,o=[],a=this._cachedMeta.controller.getParsed(s),l=a&&a[n.axis],c=u=>{const d=u._parsed.find(f=>f[n.axis]===l),h=d&&d[u.vScale.axis];if(lt(h)||isNaN(h))return!0};for(const u of i)if(!(s!==void 0&&c(u))&&((r===!1||o.indexOf(u.stack)===-1||r===void 0&&u.stack===void 0)&&o.push(u.stack),u.index===t))break;return o.length||o.push(void 0),o}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,s=this.chart.options.indexAxis;return Object.keys(t).filter(n=>t[n].axis===s).shift()}_getAxis(){const t={},s=this.getFirstScaleIdForIndexAxis();for(const n of this.chart.data.datasets)t[nt(this.chart.options.indexAxis==="x"?n.xAxisID:n.yAxisID,s)]=!0;return Object.keys(t)}_getStackIndex(t,s,n){const i=this._getStacks(t,n),r=s!==void 0?i.indexOf(s):-1;return r===-1?i.length-1:r}_getRuler(){const t=this.options,s=this._cachedMeta,n=s.iScale,i=[];let r,o;for(r=0,o=s.data.length;r<o;++r)i.push(n.getPixelForValue(this.getParsed(r)[n.axis],r));const a=t.barThickness;return{min:a||Tw(s),pixels:i,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:s,_stacked:n,index:i},options:{base:r,minBarLength:o}}=this,a=r||0,l=this.getParsed(t),c=l._custom,u=Co(c);let d=l[s.axis],h=0,f=n?this.applyStack(s,l,n):d,p,m;f!==d&&(h=f-d,f=d),u&&(d=c.barStart,f=c.barEnd-c.barStart,d!==0&&Fe(d)!==Fe(c.barEnd)&&(h=0),h+=d);const g=!lt(r)&&!u?r:h;let b=s.getPixelForValue(g);if(this.chart.getDataVisibility(t)?p=s.getPixelForValue(h+f):p=b,m=p-b,Math.abs(m)<o){m=Dw(m,s,a)*o,d===a&&(b-=m/2);const x=s.getPixelForDecimal(0),w=s.getPixelForDecimal(1),v=Math.min(x,w),S=Math.max(x,w);b=Math.max(Math.min(b,S),v),p=b+m,n&&!u&&(l._stacks[s.axis]._visualValues[i]=s.getValueForPixel(p)-s.getValueForPixel(b))}if(b===s.getPixelForValue(a)){const x=Fe(m)*s.getLineWidthForValue(a)/2;b+=x,m-=x}return{size:m,base:b,head:p,center:p+m/2}}_calculateBarIndexPixels(t,s){const n=s.scale,i=this.options,r=i.skipNull,o=nt(i.maxBarThickness,1/0);let a,l;const c=this._getAxisCount();if(s.grouped){const u=r?this._getStackCount(t):s.stackCount,d=i.barThickness==="flex"?Aw(t,s,i,u*c):Mw(t,s,i,u*c),h=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,f=this._getAxis().indexOf(nt(h,this.getFirstScaleIdForIndexAxis())),p=this._getStackIndex(this.index,this._cachedMeta.stack,r?t:void 0)+f;a=d.start+d.chunk*p+d.chunk/2,l=Math.min(o,d.chunk*d.ratio)}else a=n.getPixelForValue(this.getParsed(t)[n.axis],t),l=Math.min(o,s.min*s.ratio);return{base:a-l/2,head:a+l/2,center:a,size:l}}draw(){const t=this._cachedMeta,s=t.vScale,n=t.data,i=n.length;let r=0;for(;r<i;++r)this.getParsed(r)[s.axis]!==null&&!n[r].hidden&&n[r].draw(this._ctx)}}class Vw extends ys{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,s,n,i){const r=super.parsePrimitiveData(t,s,n,i);for(let o=0;o<r.length;o++)r[o]._custom=this.resolveDataElementOptions(o+n).radius;return r}parseArrayData(t,s,n,i){const r=super.parseArrayData(t,s,n,i);for(let o=0;o<r.length;o++){const a=s[n+o];r[o]._custom=nt(a[2],this.resolveDataElementOptions(o+n).radius)}return r}parseObjectData(t,s,n,i){const r=super.parseObjectData(t,s,n,i);for(let o=0;o<r.length;o++){const a=s[n+o];r[o]._custom=nt(a&&a.r&&+a.r,this.resolveDataElementOptions(o+n).radius)}return r}getMaxOverflow(){const t=this._cachedMeta.data;let s=0;for(let n=t.length-1;n>=0;--n)s=Math.max(s,t[n].size(this.resolveDataElementOptions(n))/2);return s>0&&s}getLabelAndValue(t){const s=this._cachedMeta,n=this.chart.data.labels||[],{xScale:i,yScale:r}=s,o=this.getParsed(t),a=i.getLabelForValue(o.x),l=r.getLabelForValue(o.y),c=o._custom;return{label:n[t]||"",value:"("+a+", "+l+(c?", "+c:"")+")"}}update(t){const s=this._cachedMeta.data;this.updateElements(s,0,s.length,t)}updateElements(t,s,n,i){const r=i==="reset",{iScale:o,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(s,i),u=o.axis,d=a.axis;for(let h=s;h<s+n;h++){const f=t[h],p=!r&&this.getParsed(h),m={},g=m[u]=r?o.getPixelForDecimal(.5):o.getPixelForValue(p[u]),b=m[d]=r?a.getBasePixel():a.getPixelForValue(p[d]);m.skip=isNaN(g)||isNaN(b),c&&(m.options=l||this.resolveDataElementOptions(h,f.active?"active":i),r&&(m.options.radius=0)),this.updateElement(f,h,m,i)}}resolveDataElementOptions(t,s){const n=this.getParsed(t);let i=super.resolveDataElementOptions(t,s);i.$shared&&(i=Object.assign({},i,{$shared:!1}));const r=i.radius;return s!=="active"&&(i.radius=0),i.radius+=nt(n&&n._custom,r),i}}function zw(e,t,s){let n=1,i=1,r=0,o=0;if(t<xt){const a=e,l=a+t,c=Math.cos(a),u=Math.sin(a),d=Math.cos(l),h=Math.sin(l),f=(w,v,S)=>ni(w,a,l,!0)?1:Math.max(v,v*s,S,S*s),p=(w,v,S)=>ni(w,a,l,!0)?-1:Math.min(v,v*s,S,S*s),m=f(0,c,d),g=f(Et,u,h),b=p(pt,c,d),x=p(pt+Et,u,h);n=(m-b)/2,i=(g-x)/2,r=-(m+b)/2,o=-(g+x)/2}return{ratioX:n,ratioY:i,offsetX:r,offsetY:o}}class ul extends ys{static id="doughnut";static 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,indexAxis:"r"};static descriptors={_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const s=t.data,{labels:{pointStyle:n,textAlign:i,color:r,useBorderRadius:o,borderRadius:a}}=t.legend.options;return s.labels.length&&s.datasets.length?s.labels.map((l,c)=>{const d=t.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:d.backgroundColor,fontColor:r,hidden:!t.getDataVisibility(c),lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:d.borderWidth,strokeStyle:d.borderColor,textAlign:i,pointStyle:n,borderRadius:o&&(a||d.borderRadius),index:c}}):[]}},onClick(t,s,n){n.chart.toggleDataVisibility(s.index),n.chart.update()}}}};constructor(t,s){super(t,s),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,s){const n=this.getDataset().data,i=this._cachedMeta;if(this._parsing===!1)i._parsed=n;else{let r=l=>+n[l];if(ut(n[t])){const{key:l="value"}=this._parsing;r=c=>+ms(n[c],l)}let o,a;for(o=t,a=t+s;o<a;++o)i._parsed[o]=r(o)}}_getRotation(){return ke(this.options.rotation-90)}_getCircumference(){return ke(this.options.circumference)}_getRotationExtents(){let t=xt,s=-xt;for(let n=0;n<this.chart.data.datasets.length;++n)if(this.chart.isDatasetVisible(n)&&this.chart.getDatasetMeta(n).type===this._type){const i=this.chart.getDatasetMeta(n).controller,r=i._getRotation(),o=i._getCircumference();t=Math.min(t,r),s=Math.max(s,r+o)}return{rotation:t,circumference:s-t}}update(t){const s=this.chart,{chartArea:n}=s,i=this._cachedMeta,r=i.data,o=this.getMaxBorderWidth()+this.getMaxOffset(r)+this.options.spacing,a=Math.max((Math.min(n.width,n.height)-o)/2,0),l=Math.min(Qv(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:u,rotation:d}=this._getRotationExtents(),{ratioX:h,ratioY:f,offsetX:p,offsetY:m}=zw(d,u,l),g=(n.width-o)/h,b=(n.height-o)/f,x=Math.max(Math.min(g,b)/2,0),w=pf(this.options.radius,x),v=Math.max(w*l,0),S=(w-v)/this._getVisibleDatasetWeightTotal();this.offsetX=p*w,this.offsetY=m*w,i.total=this.calculateTotal(),this.outerRadius=w-S*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-S*c,0),this.updateElements(r,0,r.length,t)}_circumference(t,s){const n=this.options,i=this._cachedMeta,r=this._getCircumference();return s&&n.animation.animateRotate||!this.chart.getDataVisibility(t)||i._parsed[t]===null||i.data[t].hidden?0:this.calculateCircumference(i._parsed[t]*r/xt)}updateElements(t,s,n,i){const r=i==="reset",o=this.chart,a=o.chartArea,c=o.options.animation,u=(a.left+a.right)/2,d=(a.top+a.bottom)/2,h=r&&c.animateScale,f=h?0:this.innerRadius,p=h?0:this.outerRadius,{sharedOptions:m,includeOptions:g}=this._getSharedOptions(s,i);let b=this._getRotation(),x;for(x=0;x<s;++x)b+=this._circumference(x,r);for(x=s;x<s+n;++x){const w=this._circumference(x,r),v=t[x],S={x:u+this.offsetX,y:d+this.offsetY,startAngle:b,endAngle:b+w,circumference:w,outerRadius:p,innerRadius:f};g&&(S.options=m||this.resolveDataElementOptions(x,v.active?"active":i)),b+=w,this.updateElement(v,x,S,i)}}calculateTotal(){const t=this._cachedMeta,s=t.data;let n=0,i;for(i=0;i<s.length;i++){const r=t._parsed[i];r!==null&&!isNaN(r)&&this.chart.getDataVisibility(i)&&!s[i].hidden&&(n+=Math.abs(r))}return n}calculateCircumference(t){const s=this._cachedMeta.total;return s>0&&!isNaN(t)?xt*(Math.abs(t)/s):0}getLabelAndValue(t){const s=this._cachedMeta,n=this.chart,i=n.data.labels||[],r=gi(s._parsed[t],n.options.locale);return{label:i[t]||"",value:r}}getMaxBorderWidth(t){let s=0;const n=this.chart;let i,r,o,a,l;if(!t){for(i=0,r=n.data.datasets.length;i<r;++i)if(n.isDatasetVisible(i)){o=n.getDatasetMeta(i),t=o.data,a=o.controller;break}}if(!t)return 0;for(i=0,r=t.length;i<r;++i)l=a.resolveDataElementOptions(i),l.borderAlign!=="inner"&&(s=Math.max(s,l.borderWidth||0,l.hoverBorderWidth||0));return s}getMaxOffset(t){let s=0;for(let n=0,i=t.length;n<i;++n){const r=this.resolveDataElementOptions(n);s=Math.max(s,r.offset||0,r.hoverOffset||0)}return s}_getRingWeightOffset(t){let s=0;for(let n=0;n<t;++n)this.chart.isDatasetVisible(n)&&(s+=this._getRingWeight(n));return s}_getRingWeight(t){return Math.max(nt(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class Hf extends ys{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const s=this._cachedMeta,{dataset:n,data:i=[],_dataset:r}=s,o=this.chart._animationsDisabled;let{start:a,count:l}=wf(s,i,o);this._drawStart=a,this._drawCount=l,Sf(s)&&(a=0,l=i.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!r._decimated,n.points=i;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!o,options:c},t),this.updateElements(i,a,l,t)}updateElements(t,s,n,i){const r=i==="reset",{iScale:o,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:d}=this._getSharedOptions(s,i),h=o.axis,f=a.axis,{spanGaps:p,segment:m}=this.options,g=dn(p)?p:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||r||i==="none",x=s+n,w=t.length;let v=s>0&&this.getParsed(s-1);for(let S=0;S<w;++S){const P=t[S],R=b?P:{};if(S<s||S>=x){R.skip=!0;continue}const _=this.getParsed(S),C=lt(_[f]),N=R[h]=o.getPixelForValue(_[h],S),j=R[f]=r||C?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,_,l):_[f],S);R.skip=isNaN(N)||isNaN(j)||C,R.stop=S>0&&Math.abs(_[h]-v[h])>g,m&&(R.parsed=_,R.raw=c.data[S]),d&&(R.options=u||this.resolveDataElementOptions(S,P.active?"active":i)),b||this.updateElement(P,S,R,i),v=_}}getMaxOverflow(){const t=this._cachedMeta,s=t.dataset,n=s.options&&s.options.borderWidth||0,i=t.data||[];if(!i.length)return n;const r=i[0].size(this.resolveDataElementOptions(0)),o=i[i.length-1].size(this.resolveDataElementOptions(i.length-1));return Math.max(n,r,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}class Uf extends ys{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const s=t.data;if(s.labels.length&&s.datasets.length){const{labels:{pointStyle:n,color:i}}=t.legend.options;return s.labels.map((r,o)=>{const l=t.getDatasetMeta(0).controller.getStyle(o);return{text:r,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:i,lineWidth:l.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(o),index:o}})}return[]}},onClick(t,s,n){n.chart.toggleDataVisibility(s.index),n.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,s){super(t,s),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const s=this._cachedMeta,n=this.chart,i=n.data.labels||[],r=gi(s._parsed[t].r,n.options.locale);return{label:i[t]||"",value:r}}parseObjectData(t,s,n,i){return Mf.bind(this)(t,s,n,i)}update(t){const s=this._cachedMeta.data;this._updateRadius(),this.updateElements(s,0,s.length,t)}getMinMax(){const t=this._cachedMeta,s={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((n,i)=>{const r=this.getParsed(i).r;!isNaN(r)&&this.chart.getDataVisibility(i)&&(r<s.min&&(s.min=r),r>s.max&&(s.max=r))}),s}_updateRadius(){const t=this.chart,s=t.chartArea,n=t.options,i=Math.min(s.right-s.left,s.bottom-s.top),r=Math.max(i/2,0),o=Math.max(n.cutoutPercentage?r/100*n.cutoutPercentage:1,0),a=(r-o)/t.getVisibleDatasetCount();this.outerRadius=r-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,s,n,i){const r=i==="reset",o=this.chart,l=o.options.animation,c=this._cachedMeta.rScale,u=c.xCenter,d=c.yCenter,h=c.getIndexAngle(0)-.5*pt;let f=h,p;const m=360/this.countVisibleElements();for(p=0;p<s;++p)f+=this._computeAngle(p,i,m);for(p=s;p<s+n;p++){const g=t[p];let b=f,x=f+this._computeAngle(p,i,m),w=o.getDataVisibility(p)?c.getDistanceFromCenterForValue(this.getParsed(p).r):0;f=x,r&&(l.animateScale&&(w=0),l.animateRotate&&(b=x=h));const v={x:u,y:d,innerRadius:0,outerRadius:w,startAngle:b,endAngle:x,options:this.resolveDataElementOptions(p,g.active?"active":i)};this.updateElement(g,p,v,i)}}countVisibleElements(){const t=this._cachedMeta;let s=0;return t.data.forEach((n,i)=>{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&s++}),s}_computeAngle(t,s,n){return this.chart.getDataVisibility(t)?ke(this.resolveDataElementOptions(t,s).angle||n):0}}class Hw extends ul{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}}class Uw extends ys{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const s=this._cachedMeta.vScale,n=this.getParsed(t);return{label:s.getLabels()[t],value:""+s.getLabelForValue(n[s.axis])}}parseObjectData(t,s,n,i){return Mf.bind(this)(t,s,n,i)}update(t){const s=this._cachedMeta,n=s.dataset,i=s.data||[],r=s.iScale.getLabels();if(n.points=i,t!=="resize"){const o=this.resolveDatasetElementOptions(t);this.options.showLine||(o.borderWidth=0);const a={_loop:!0,_fullLoop:r.length===i.length,options:o};this.updateElement(n,void 0,a,t)}this.updateElements(i,0,i.length,t)}updateElements(t,s,n,i){const r=this._cachedMeta.rScale,o=i==="reset";for(let a=s;a<s+n;a++){const l=t[a],c=this.resolveDataElementOptions(a,l.active?"active":i),u=r.getPointPositionForValue(a,this.getParsed(a).r),d=o?r.xCenter:u.x,h=o?r.yCenter:u.y,f={x:d,y:h,angle:u.angle,skip:isNaN(d)||isNaN(h),options:c};this.updateElement(l,a,f,i)}}}class Ww extends ys{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const s=this._cachedMeta,n=this.chart.data.labels||[],{xScale:i,yScale:r}=s,o=this.getParsed(t),a=i.getLabelForValue(o.x),l=r.getLabelForValue(o.y);return{label:n[t]||"",value:"("+a+", "+l+")"}}update(t){const s=this._cachedMeta,{data:n=[]}=s,i=this.chart._animationsDisabled;let{start:r,count:o}=wf(s,n,i);if(this._drawStart=r,this._drawCount=o,Sf(s)&&(r=0,o=n.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:a,_dataset:l}=s;a._chart=this.chart,a._datasetIndex=this.index,a._decimated=!!l._decimated,a.points=n;const c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(a,void 0,{animated:!i,options:c},t)}else this.datasetElementType&&(delete s.dataset,this.datasetElementType=!1);this.updateElements(n,r,o,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,s,n,i){const r=i==="reset",{iScale:o,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,u=this.resolveDataElementOptions(s,i),d=this.getSharedOptions(u),h=this.includeOptions(i,d),f=o.axis,p=a.axis,{spanGaps:m,segment:g}=this.options,b=dn(m)?m:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||r||i==="none";let w=s>0&&this.getParsed(s-1);for(let v=s;v<s+n;++v){const S=t[v],P=this.getParsed(v),R=x?S:{},_=lt(P[p]),C=R[f]=o.getPixelForValue(P[f],v),N=R[p]=r||_?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,P,l):P[p],v);R.skip=isNaN(C)||isNaN(N)||_,R.stop=v>0&&Math.abs(P[f]-w[f])>b,g&&(R.parsed=P,R.raw=c.data[v]),h&&(R.options=d||this.resolveDataElementOptions(v,S.active?"active":i)),x||this.updateElement(S,v,R,i),w=P}this.updateSharedOptions(d,i,u)}getMaxOverflow(){const t=this._cachedMeta,s=t.data||[];if(!this.options.showLine){let a=0;for(let l=s.length-1;l>=0;--l)a=Math.max(a,s[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const n=t.dataset,i=n.options&&n.options.borderWidth||0;if(!s.length)return i;const r=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,r,o)/2}}var $w=Object.freeze({__proto__:null,BarController:Bw,BubbleController:Vw,DoughnutController:ul,LineController:Hf,PieController:Hw,PolarAreaController:Uf,RadarController:Uw,ScatterController:Ww});function Ps(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class dl{static override(t){Object.assign(dl.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return Ps()}parse(){return Ps()}format(){return Ps()}add(){return Ps()}diff(){return Ps()}startOf(){return Ps()}endOf(){return Ps()}}var qw={_date:dl};function Kw(e,t,s,n){const{controller:i,data:r,_sorted:o}=e,a=i._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&o&&r.length){const c=a._reversePixels?u_:Ge;if(n){if(i._sharedOptions){const u=r[0],d=typeof u.getRange=="function"&&u.getRange(t);if(d){const h=c(r,t,s-d),f=c(r,t,s+d);return{lo:h.lo,hi:f.hi}}}}else{const u=c(r,t,s);if(l){const{vScale:d}=i._cachedMeta,{_parsed:h}=e,f=h.slice(0,u.lo+1).reverse().findIndex(m=>!lt(m[d.axis]));u.lo-=Math.max(0,f);const p=h.slice(u.hi).findIndex(m=>!lt(m[d.axis]));u.hi+=Math.max(0,p)}return u}}return{lo:0,hi:r.length-1}}function Kr(e,t,s,n,i){const r=e.getSortedVisibleDatasetMetas(),o=s[t];for(let a=0,l=r.length;a<l;++a){const{index:c,data:u}=r[a],{lo:d,hi:h}=Kw(r[a],t,o,i);for(let f=d;f<=h;++f){const p=u[f];p.skip||n(p,c,f)}}}function Yw(e){const t=e.indexOf("x")!==-1,s=e.indexOf("y")!==-1;return function(n,i){const r=t?Math.abs(n.x-i.x):0,o=s?Math.abs(n.y-i.y):0;return Math.sqrt(Math.pow(r,2)+Math.pow(o,2))}}function Oo(e,t,s,n,i){const r=[];return!i&&!e.isPointInArea(t)||Kr(e,s,t,function(a,l,c){!i&&!Xe(a,e.chartArea,0)||a.inRange(t.x,t.y,n)&&r.push({element:a,datasetIndex:l,index:c})},!0),r}function Gw(e,t,s,n){let i=[];function r(o,a,l){const{startAngle:c,endAngle:u}=o.getProps(["startAngle","endAngle"],n),{angle:d}=bf(o,{x:t.x,y:t.y});ni(d,c,u)&&i.push({element:o,datasetIndex:a,index:l})}return Kr(e,s,t,r),i}function Xw(e,t,s,n,i,r){let o=[];const a=Yw(s);let l=Number.POSITIVE_INFINITY;function c(u,d,h){const f=u.inRange(t.x,t.y,i);if(n&&!f)return;const p=u.getCenterPoint(i);if(!(!!r||e.isPointInArea(p))&&!f)return;const g=a(t,p);g<l?(o=[{element:u,datasetIndex:d,index:h}],l=g):g===l&&o.push({element:u,datasetIndex:d,index:h})}return Kr(e,s,t,c),o}function To(e,t,s,n,i,r){return!r&&!e.isPointInArea(t)?[]:s==="r"&&!n?Gw(e,t,s,i):Xw(e,t,s,n,i,r)}function Pu(e,t,s,n,i){const r=[],o=s==="x"?"inXRange":"inYRange";let a=!1;return Kr(e,s,t,(l,c,u)=>{l[o]&&l[o](t[s],i)&&(r.push({element:l,datasetIndex:c,index:u}),a=a||l.inRange(t.x,t.y,i))}),n&&!a?[]:r}var Qw={modes:{index(e,t,s,n){const i=Cs(t,e),r=s.axis||"x",o=s.includeInvisible||!1,a=s.intersect?Oo(e,i,r,n,o):To(e,i,r,!1,n,o),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const u=a[0].index,d=c.data[u];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:u})}),l):[]},dataset(e,t,s,n){const i=Cs(t,e),r=s.axis||"xy",o=s.includeInvisible||!1;let a=s.intersect?Oo(e,i,r,n,o):To(e,i,r,!1,n,o);if(a.length>0){const l=a[0].datasetIndex,c=e.getDatasetMeta(l).data;a=[];for(let u=0;u<c.length;++u)a.push({element:c[u],datasetIndex:l,index:u})}return a},point(e,t,s,n){const i=Cs(t,e),r=s.axis||"xy",o=s.includeInvisible||!1;return Oo(e,i,r,n,o)},nearest(e,t,s,n){const i=Cs(t,e),r=s.axis||"xy",o=s.includeInvisible||!1;return To(e,i,r,s.intersect,n,o)},x(e,t,s,n){const i=Cs(t,e);return Pu(e,i,"x",s.intersect,n)},y(e,t,s,n){const i=Cs(t,e);return Pu(e,i,"y",s.intersect,n)}}};const Wf=["left","top","right","bottom"];function An(e,t){return e.filter(s=>s.pos===t)}function Eu(e,t){return e.filter(s=>Wf.indexOf(s.pos)===-1&&s.box.axis===t)}function Ln(e,t){return e.sort((s,n)=>{const i=t?n:s,r=t?s:n;return i.weight===r.weight?i.index-r.index:i.weight-r.weight})}function Jw(e){const t=[];let s,n,i,r,o,a;for(s=0,n=(e||[]).length;s<n;++s)i=e[s],{position:r,options:{stack:o,stackWeight:a=1}}=i,t.push({index:s,box:i,pos:r,horizontal:i.isHorizontal(),weight:i.weight,stack:o&&r+o,stackWeight:a});return t}function Zw(e){const t={};for(const s of e){const{stack:n,pos:i,stackWeight:r}=s;if(!n||!Wf.includes(i))continue;const o=t[n]||(t[n]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=r}return t}function tS(e,t){const s=Zw(e),{vBoxMaxWidth:n,hBoxMaxHeight:i}=t;let r,o,a;for(r=0,o=e.length;r<o;++r){a=e[r];const{fullSize:l}=a.box,c=s[a.stack],u=c&&a.stackWeight/c.weight;a.horizontal?(a.width=u?u*n:l&&t.availableWidth,a.height=i):(a.width=n,a.height=u?u*i:l&&t.availableHeight)}return s}function eS(e){const t=Jw(e),s=Ln(t.filter(c=>c.box.fullSize),!0),n=Ln(An(t,"left"),!0),i=Ln(An(t,"right")),r=Ln(An(t,"top"),!0),o=Ln(An(t,"bottom")),a=Eu(t,"x"),l=Eu(t,"y");return{fullSize:s,leftAndTop:n.concat(r),rightAndBottom:i.concat(l).concat(o).concat(a),chartArea:An(t,"chartArea"),vertical:n.concat(i).concat(l),horizontal:r.concat(o).concat(a)}}function Cu(e,t,s,n){return Math.max(e[s],t[s])+Math.max(e[n],t[n])}function $f(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function sS(e,t,s,n){const{pos:i,box:r}=s,o=e.maxPadding;if(!ut(i)){s.size&&(e[i]-=s.size);const d=n[s.stack]||{size:0,count:1};d.size=Math.max(d.size,s.horizontal?r.height:r.width),s.size=d.size/d.count,e[i]+=s.size}r.getPadding&&$f(o,r.getPadding());const a=Math.max(0,t.outerWidth-Cu(o,e,"left","right")),l=Math.max(0,t.outerHeight-Cu(o,e,"top","bottom")),c=a!==e.w,u=l!==e.h;return e.w=a,e.h=l,s.horizontal?{same:c,other:u}:{same:u,other:c}}function nS(e){const t=e.maxPadding;function s(n){const i=Math.max(t[n]-e[n],0);return e[n]+=i,i}e.y+=s("top"),e.x+=s("left"),s("right"),s("bottom")}function iS(e,t){const s=t.maxPadding;function n(i){const r={left:0,top:0,right:0,bottom:0};return i.forEach(o=>{r[o]=Math.max(t[o],s[o])}),r}return n(e?["left","right"]:["top","bottom"])}function Vn(e,t,s,n){const i=[];let r,o,a,l,c,u;for(r=0,o=e.length,c=0;r<o;++r){a=e[r],l=a.box,l.update(a.width||t.w,a.height||t.h,iS(a.horizontal,t));const{same:d,other:h}=sS(t,s,a,n);c|=d&&i.length,u=u||h,l.fullSize||i.push(a)}return c&&Vn(i,t,s,n)||u}function Hi(e,t,s,n,i){e.top=s,e.left=t,e.right=t+n,e.bottom=s+i,e.width=n,e.height=i}function Ou(e,t,s,n){const i=s.padding;let{x:r,y:o}=t;for(const a of e){const l=a.box,c=n[a.stack]||{placed:0,weight:1},u=a.stackWeight/c.weight||1;if(a.horizontal){const d=t.w*u,h=c.size||l.height;si(c.start)&&(o=c.start),l.fullSize?Hi(l,i.left,o,s.outerWidth-i.right-i.left,h):Hi(l,t.left+c.placed,o,d,h),c.start=o,c.placed+=d,o=l.bottom}else{const d=t.h*u,h=c.size||l.width;si(c.start)&&(r=c.start),l.fullSize?Hi(l,r,i.top,h,s.outerHeight-i.bottom-i.top):Hi(l,r,t.top+c.placed,h,d),c.start=r,c.placed+=d,r=l.right}}t.x=r,t.y=o}var Kt={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(s){t.draw(s)}}]},e.boxes.push(t)},removeBox(e,t){const s=e.boxes?e.boxes.indexOf(t):-1;s!==-1&&e.boxes.splice(s,1)},configure(e,t,s){t.fullSize=s.fullSize,t.position=s.position,t.weight=s.weight},update(e,t,s,n){if(!e)return;const i=Yt(e.options.layout.padding),r=Math.max(t-i.width,0),o=Math.max(s-i.height,0),a=eS(e.boxes),l=a.vertical,c=a.horizontal;mt(e.boxes,m=>{typeof m.beforeLayout=="function"&&m.beforeLayout()});const u=l.reduce((m,g)=>g.box.options&&g.box.options.display===!1?m:m+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:s,padding:i,availableWidth:r,availableHeight:o,vBoxMaxWidth:r/2/u,hBoxMaxHeight:o/2}),h=Object.assign({},i);$f(h,Yt(n));const f=Object.assign({maxPadding:h,w:r,h:o,x:i.left,y:i.top},i),p=tS(l.concat(c),d);Vn(a.fullSize,f,d,p),Vn(l,f,d,p),Vn(c,f,d,p)&&Vn(l,f,d,p),nS(f),Ou(a.leftAndTop,f,d,p),f.x+=f.w,f.y+=f.h,Ou(a.rightAndBottom,f,d,p),e.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},mt(a.chartArea,m=>{const g=m.box;Object.assign(g,e.chartArea),g.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class qf{acquireContext(t,s){}releaseContext(t){return!1}addEventListener(t,s,n){}removeEventListener(t,s,n){}getDevicePixelRatio(){return 1}getMaximumSize(t,s,n,i){return s=Math.max(0,s||t.width),n=n||t.height,{width:s,height:Math.max(0,i?Math.floor(s/i):n)}}isAttached(t){return!0}updateConfig(t){}}class rS extends qf{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const or="$chartjs",oS={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Tu=e=>e===null||e==="";function aS(e,t){const s=e.style,n=e.getAttribute("height"),i=e.getAttribute("width");if(e[or]={initial:{height:n,width:i,style:{display:s.display,height:s.height,width:s.width}}},s.display=s.display||"block",s.boxSizing=s.boxSizing||"border-box",Tu(i)){const r=fu(e,"width");r!==void 0&&(e.width=r)}if(Tu(n))if(e.style.height==="")e.height=e.width/(t||2);else{const r=fu(e,"height");r!==void 0&&(e.height=r)}return e}const Kf=nw?{passive:!0}:!1;function lS(e,t,s){e&&e.addEventListener(t,s,Kf)}function cS(e,t,s){e&&e.canvas&&e.canvas.removeEventListener(t,s,Kf)}function uS(e,t){const s=oS[e.type]||e.type,{x:n,y:i}=Cs(e,t);return{type:s,chart:t,native:e,x:n!==void 0?n:null,y:i!==void 0?i:null}}function Er(e,t){for(const s of e)if(s===t||s.contains(t))return!0}function dS(e,t,s){const n=e.canvas,i=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||Er(a.addedNodes,n),o=o&&!Er(a.removedNodes,n);o&&s()});return i.observe(document,{childList:!0,subtree:!0}),i}function hS(e,t,s){const n=e.canvas,i=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||Er(a.removedNodes,n),o=o&&!Er(a.addedNodes,n);o&&s()});return i.observe(document,{childList:!0,subtree:!0}),i}const ri=new Map;let Mu=0;function Yf(){const e=window.devicePixelRatio;e!==Mu&&(Mu=e,ri.forEach((t,s)=>{s.currentDevicePixelRatio!==e&&t()}))}function fS(e,t){ri.size||window.addEventListener("resize",Yf),ri.set(e,t)}function pS(e){ri.delete(e),ri.size||window.removeEventListener("resize",Yf)}function mS(e,t,s){const n=e.canvas,i=n&&cl(n);if(!i)return;const r=_f((a,l)=>{const c=i.clientWidth;s(a,l),c<i.clientWidth&&s()},window),o=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||r(c,u)});return o.observe(i),fS(e,r),o}function Mo(e,t,s){s&&s.disconnect(),t==="resize"&&pS(e)}function gS(e,t,s){const n=e.canvas,i=_f(r=>{e.ctx!==null&&s(uS(r,e))},e);return lS(n,t,i),i}class bS extends qf{acquireContext(t,s){const n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(aS(t,s),n):null}releaseContext(t){const s=t.canvas;if(!s[or])return!1;const n=s[or].initial;["height","width"].forEach(r=>{const o=n[r];lt(o)?s.removeAttribute(r):s.setAttribute(r,o)});const i=n.style||{};return Object.keys(i).forEach(r=>{s.style[r]=i[r]}),s.width=s.width,delete s[or],!0}addEventListener(t,s,n){this.removeEventListener(t,s);const i=t.$proxies||(t.$proxies={}),o={attach:dS,detach:hS,resize:mS}[s]||gS;i[s]=o(t,s,n)}removeEventListener(t,s){const n=t.$proxies||(t.$proxies={}),i=n[s];if(!i)return;({attach:Mo,detach:Mo,resize:Mo}[s]||cS)(t,s,i),n[s]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,s,n,i){return sw(t,s,n,i)}isAttached(t){const s=t&&cl(t);return!!(s&&s.isConnected)}}function yS(e){return!ll()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?rS:bS}class Je{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:s,y:n}=this.getProps(["x","y"],t);return{x:s,y:n}}hasValue(){return dn(this.x)&&dn(this.y)}getProps(t,s){const n=this.$animations;if(!s||!n)return this;const i={};return t.forEach(r=>{i[r]=n[r]&&n[r].active()?n[r]._to:this[r]}),i}}function xS(e,t){const s=e.options.ticks,n=vS(e),i=Math.min(s.maxTicksLimit||n,n),r=s.major.enabled?wS(t):[],o=r.length,a=r[0],l=r[o-1],c=[];if(o>i)return SS(t,c,r,o/i),c;const u=_S(r,t,i);if(o>0){let d,h;const f=o>1?Math.round((l-a)/(o-1)):null;for(Ui(t,c,u,lt(f)?0:a-f,a),d=0,h=o-1;d<h;d++)Ui(t,c,u,r[d],r[d+1]);return Ui(t,c,u,l,lt(f)?t.length:l+f),c}return Ui(t,c,u),c}function vS(e){const t=e.options.offset,s=e._tickSize(),n=e._length/s+(t?0:1),i=e._maxLength/s;return Math.floor(Math.min(n,i))}function _S(e,t,s){const n=kS(e),i=t.length/s;if(!n)return Math.max(i,1);const r=r_(n);for(let o=0,a=r.length-1;o<a;o++){const l=r[o];if(l>i)return l}return Math.max(i,1)}function wS(e){const t=[];let s,n;for(s=0,n=e.length;s<n;s++)e[s].major&&t.push(s);return t}function SS(e,t,s,n){let i=0,r=s[0],o;for(n=Math.ceil(n),o=0;o<e.length;o++)o===r&&(t.push(e[o]),i++,r=s[i*n])}function Ui(e,t,s,n,i){const r=nt(n,0),o=Math.min(nt(i,e.length),e.length);let a=0,l,c,u;for(s=Math.ceil(s),i&&(l=i-n,s=l/Math.floor(l/s)),u=r;u<0;)a++,u=Math.round(r+a*s);for(c=Math.max(r,0);c<o;c++)c===u&&(t.push(e[c]),a++,u=Math.round(r+a*s))}function kS(e){const t=e.length;let s,n;if(t<2)return!1;for(n=e[0],s=1;s<t;++s)if(e[s]-e[s-1]!==n)return!1;return n}const RS=e=>e==="left"?"right":e==="right"?"left":e,Au=(e,t,s)=>t==="top"||t==="left"?e[t]+s:e[t]-s,Lu=(e,t)=>Math.min(t||e,e);function Du(e,t){const s=[],n=e.length/t,i=e.length;let r=0;for(;r<i;r+=n)s.push(e[Math.floor(r)]);return s}function PS(e,t,s){const n=e.ticks.length,i=Math.min(t,n-1),r=e._startPixel,o=e._endPixel,a=1e-6;let l=e.getPixelForTick(i),c;if(!(s&&(n===1?c=Math.max(l-r,o-l):t===0?c=(e.getPixelForTick(1)-l)/2:c=(l-e.getPixelForTick(i-1))/2,l+=i<t?c:-c,l<r-a||l>o+a)))return l}function ES(e,t){mt(e,s=>{const n=s.gc,i=n.length/2;let r;if(i>t){for(r=0;r<i;++r)delete s.data[n[r]];n.splice(0,i)}})}function Dn(e){return e.drawTicks?e.tickLength:0}function Nu(e,t){if(!e.display)return 0;const s=Nt(e.font,t),n=Yt(e.padding);return(_t(e.text)?e.text.length:1)*s.lineHeight+n.height}function CS(e,t){return bs(e,{scale:t,type:"scale"})}function OS(e,t,s){return bs(e,{tick:s,index:t,type:"tick"})}function TS(e,t,s){let n=sl(e);return(s&&t!=="right"||!s&&t==="right")&&(n=RS(n)),n}function MS(e,t,s,n){const{top:i,left:r,bottom:o,right:a,chart:l}=e,{chartArea:c,scales:u}=l;let d=0,h,f,p;const m=o-i,g=a-r;if(e.isHorizontal()){if(f=Wt(n,r,a),ut(s)){const b=Object.keys(s)[0],x=s[b];p=u[b].getPixelForValue(x)+m-t}else s==="center"?p=(c.bottom+c.top)/2+m-t:p=Au(e,s,t);h=a-r}else{if(ut(s)){const b=Object.keys(s)[0],x=s[b];f=u[b].getPixelForValue(x)-g+t}else s==="center"?f=(c.left+c.right)/2-g+t:f=Au(e,s,t);p=Wt(n,o,i),d=s==="left"?-Et:Et}return{titleX:f,titleY:p,maxWidth:h,rotation:d}}class Ys extends Je{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.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(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,s){return t}getUserBounds(){let{_userMin:t,_userMax:s,_suggestedMin:n,_suggestedMax:i}=this;return t=ae(t,Number.POSITIVE_INFINITY),s=ae(s,Number.NEGATIVE_INFINITY),n=ae(n,Number.POSITIVE_INFINITY),i=ae(i,Number.NEGATIVE_INFINITY),{min:ae(t,n),max:ae(s,i),minDefined:Pt(t),maxDefined:Pt(s)}}getMinMax(t){let{min:s,max:n,minDefined:i,maxDefined:r}=this.getUserBounds(),o;if(i&&r)return{min:s,max:n};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)o=a[l].controller.getMinMax(this,t),i||(s=Math.min(s,o.min)),r||(n=Math.max(n,o.max));return s=r&&s>n?n:s,n=i&&s>n?s:n,{min:ae(s,ae(n,s)),max:ae(n,ae(s,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){gt(this.options.beforeUpdate,[this])}update(t,s,n){const{beginAtZero:i,grace:r,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=s,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=D_(this,r,i),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?Du(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||o.source==="auto")&&(this.ticks=xS(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,s,n;this.isHorizontal()?(s=this.left,n=this.right):(s=this.top,n=this.bottom,t=!t),this._startPixel=s,this._endPixel=n,this._reversePixels=t,this._length=n-s,this._alignToPixels=this.options.alignToPixels}afterUpdate(){gt(this.options.afterUpdate,[this])}beforeSetDimensions(){gt(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(){gt(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),gt(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){gt(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const s=this.options.ticks;let n,i,r;for(n=0,i=t.length;n<i;n++)r=t[n],r.label=gt(s.callback,[r.value,n,t],this)}afterTickToLabelConversion(){gt(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){gt(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,s=t.ticks,n=Lu(this.ticks.length,t.ticks.maxTicksLimit),i=s.minRotation||0,r=s.maxRotation;let o=i,a,l,c;if(!this._isVisible()||!s.display||i>=r||n<=1||!this.isHorizontal()){this.labelRotation=i;return}const u=this._getLabelSizes(),d=u.widest.width,h=u.highest.height,f=jt(this.chart.width-d,0,this.maxWidth);a=t.offset?this.maxWidth/n:f/(n-1),d+6>a&&(a=f/(n-(t.offset?.5:1)),l=this.maxHeight-Dn(t.grid)-s.padding-Nu(t.title,this.chart.options.font),c=Math.sqrt(d*d+h*h),o=tl(Math.min(Math.asin(jt((u.highest.height+6)/a,-1,1)),Math.asin(jt(l/c,-1,1))-Math.asin(jt(h/c,-1,1)))),o=Math.max(i,Math.min(r,o))),this.labelRotation=o}afterCalculateLabelRotation(){gt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){gt(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:s,options:{ticks:n,title:i,grid:r}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const l=Nu(i,s.options.font);if(a?(t.width=this.maxWidth,t.height=Dn(r)+l):(t.height=this.maxHeight,t.width=Dn(r)+l),n.display&&this.ticks.length){const{first:c,last:u,widest:d,highest:h}=this._getLabelSizes(),f=n.padding*2,p=ke(this.labelRotation),m=Math.cos(p),g=Math.sin(p);if(a){const b=n.mirror?0:g*d.width+m*h.height;t.height=Math.min(this.maxHeight,t.height+b+f)}else{const b=n.mirror?0:m*d.width+g*h.height;t.width=Math.min(this.maxWidth,t.width+b+f)}this._calculatePadding(c,u,g,m)}}this._handleMargins(),a?(this.width=this._length=s.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=s.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,s,n,i){const{ticks:{align:r,padding:o},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,f=0;l?c?(h=i*t.width,f=n*s.height):(h=n*t.height,f=i*s.width):r==="start"?f=s.width:r==="end"?h=t.width:r!=="inner"&&(h=t.width/2,f=s.width/2),this.paddingLeft=Math.max((h-u+o)*this.width/(this.width-u),0),this.paddingRight=Math.max((f-d+o)*this.width/(this.width-d),0)}else{let u=s.height/2,d=t.height/2;r==="start"?(u=0,d=t.height):r==="end"&&(u=s.height,d=0),this.paddingTop=u+o,this.paddingBottom=d+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(){gt(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:s}=this.options;return s==="top"||s==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let s,n;for(s=0,n=t.length;s<n;s++)lt(t[s].label)&&(t.splice(s,1),n--,s--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const s=this.options.ticks.sampleSize;let n=this.ticks;s<n.length&&(n=Du(n,s)),this._labelSizes=t=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,s,n){const{ctx:i,_longestTextCache:r}=this,o=[],a=[],l=Math.floor(s/Lu(s,n));let c=0,u=0,d,h,f,p,m,g,b,x,w,v,S;for(d=0;d<s;d+=l){if(p=t[d].label,m=this._resolveTickFontOptions(d),i.font=g=m.string,b=r[g]=r[g]||{data:{},gc:[]},x=m.lineHeight,w=v=0,!lt(p)&&!_t(p))w=Rr(i,b.data,b.gc,w,p),v=x;else if(_t(p))for(h=0,f=p.length;h<f;++h)S=p[h],!lt(S)&&!_t(S)&&(w=Rr(i,b.data,b.gc,w,S),v+=x);o.push(w),a.push(v),c=Math.max(w,c),u=Math.max(v,u)}ES(r,s);const P=o.indexOf(c),R=a.indexOf(u),_=C=>({width:o[C]||0,height:a[C]||0});return{first:_(0),last:_(s-1),widest:_(P),highest:_(R),widths:o,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,s){return NaN}getValueForPixel(t){}getPixelForTick(t){const s=this.ticks;return t<0||t>s.length-1?null:this.getPixelForValue(s[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const s=this._startPixel+t*this._length;return c_(this._alignToPixels?Rs(this.chart,s,0):s)}getDecimalForPixel(t){const s=(t-this._startPixel)/this._length;return this._reversePixels?1-s:s}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:s}=this;return t<0&&s<0?s:t>0&&s>0?t:0}getContext(t){const s=this.ticks||[];if(t>=0&&t<s.length){const n=s[t];return n.$context||(n.$context=OS(this.getContext(),t,n))}return this.$context||(this.$context=CS(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,s=ke(this.labelRotation),n=Math.abs(Math.cos(s)),i=Math.abs(Math.sin(s)),r=this._getLabelSizes(),o=t.autoSkipPadding||0,a=r?r.widest.width+o:0,l=r?r.highest.height+o:0;return this.isHorizontal()?l*n>a*i?a/n:l/i:l*i<a*n?l/n:a/i}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const s=this.axis,n=this.chart,i=this.options,{grid:r,position:o,border:a}=i,l=r.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),h=Dn(r),f=[],p=a.setContext(this.getContext()),m=p.display?p.width:0,g=m/2,b=function(I){return Rs(n,I,m)};let x,w,v,S,P,R,_,C,N,j,A,F;if(o==="top")x=b(this.bottom),R=this.bottom-h,C=x-g,j=b(t.top)+g,F=t.bottom;else if(o==="bottom")x=b(this.top),j=t.top,F=b(t.bottom)-g,R=x+g,C=this.top+h;else if(o==="left")x=b(this.right),P=this.right-h,_=x-g,N=b(t.left)+g,A=t.right;else if(o==="right")x=b(this.left),N=t.left,A=b(t.right)-g,P=x+g,_=this.left+h;else if(s==="x"){if(o==="center")x=b((t.top+t.bottom)/2+.5);else if(ut(o)){const I=Object.keys(o)[0],q=o[I];x=b(this.chart.scales[I].getPixelForValue(q))}j=t.top,F=t.bottom,R=x+g,C=R+h}else if(s==="y"){if(o==="center")x=b((t.left+t.right)/2);else if(ut(o)){const I=Object.keys(o)[0],q=o[I];x=b(this.chart.scales[I].getPixelForValue(q))}P=x-g,_=P-h,N=t.left,A=t.right}const V=nt(i.ticks.maxTicksLimit,d),W=Math.max(1,Math.ceil(d/V));for(w=0;w<d;w+=W){const I=this.getContext(w),q=r.setContext(I),z=a.setContext(I),rt=q.lineWidth,dt=q.color,M=z.dash||[],Y=z.dashOffset,B=q.tickWidth,U=q.tickColor,et=q.tickBorderDash||[],ft=q.tickBorderDashOffset;v=PS(this,w,l),v!==void 0&&(S=Rs(n,v,rt),c?P=_=N=A=S:R=C=j=F=S,f.push({tx1:P,ty1:R,tx2:_,ty2:C,x1:N,y1:j,x2:A,y2:F,width:rt,color:dt,borderDash:M,borderDashOffset:Y,tickWidth:B,tickColor:U,tickBorderDash:et,tickBorderDashOffset:ft}))}return this._ticksLength=d,this._borderValue=x,f}_computeLabelItems(t){const s=this.axis,n=this.options,{position:i,ticks:r}=n,o=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:u,mirror:d}=r,h=Dn(n.grid),f=h+u,p=d?-u:f,m=-ke(this.labelRotation),g=[];let b,x,w,v,S,P,R,_,C,N,j,A,F="middle";if(i==="top")P=this.bottom-p,R=this._getXAxisLabelAlignment();else if(i==="bottom")P=this.top+p,R=this._getXAxisLabelAlignment();else if(i==="left"){const W=this._getYAxisLabelAlignment(h);R=W.textAlign,S=W.x}else if(i==="right"){const W=this._getYAxisLabelAlignment(h);R=W.textAlign,S=W.x}else if(s==="x"){if(i==="center")P=(t.top+t.bottom)/2+f;else if(ut(i)){const W=Object.keys(i)[0],I=i[W];P=this.chart.scales[W].getPixelForValue(I)+f}R=this._getXAxisLabelAlignment()}else if(s==="y"){if(i==="center")S=(t.left+t.right)/2-f;else if(ut(i)){const W=Object.keys(i)[0],I=i[W];S=this.chart.scales[W].getPixelForValue(I)}R=this._getYAxisLabelAlignment(h).textAlign}s==="y"&&(l==="start"?F="top":l==="end"&&(F="bottom"));const V=this._getLabelSizes();for(b=0,x=a.length;b<x;++b){w=a[b],v=w.label;const W=r.setContext(this.getContext(b));_=this.getPixelForTick(b)+r.labelOffset,C=this._resolveTickFontOptions(b),N=C.lineHeight,j=_t(v)?v.length:1;const I=j/2,q=W.color,z=W.textStrokeColor,rt=W.textStrokeWidth;let dt=R;o?(S=_,R==="inner"&&(b===x-1?dt=this.options.reverse?"left":"right":b===0?dt=this.options.reverse?"right":"left":dt="center"),i==="top"?c==="near"||m!==0?A=-j*N+N/2:c==="center"?A=-V.highest.height/2-I*N+N:A=-V.highest.height+N/2:c==="near"||m!==0?A=N/2:c==="center"?A=V.highest.height/2-I*N:A=V.highest.height-j*N,d&&(A*=-1),m!==0&&!W.showLabelBackdrop&&(S+=N/2*Math.sin(m))):(P=_,A=(1-j)*N/2);let M;if(W.showLabelBackdrop){const Y=Yt(W.backdropPadding),B=V.heights[b],U=V.widths[b];let et=A-Y.top,ft=0-Y.left;switch(F){case"middle":et-=B/2;break;case"bottom":et-=B;break}switch(R){case"center":ft-=U/2;break;case"right":ft-=U;break;case"inner":b===x-1?ft-=U:b>0&&(ft-=U/2);break}M={left:ft,top:et,width:U+Y.width,height:B+Y.height,color:W.backdropColor}}g.push({label:v,font:C,textOffset:A,options:{rotation:m,color:q,strokeColor:z,strokeWidth:rt,textAlign:dt,textBaseline:F,translation:[S,P],backdrop:M}})}return g}_getXAxisLabelAlignment(){const{position:t,ticks:s}=this.options;if(-ke(this.labelRotation))return t==="top"?"left":"right";let i="center";return s.align==="start"?i="left":s.align==="end"?i="right":s.align==="inner"&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:s,ticks:{crossAlign:n,mirror:i,padding:r}}=this.options,o=this._getLabelSizes(),a=t+r,l=o.widest.width;let c,u;return s==="left"?i?(u=this.right+r,n==="near"?c="left":n==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-a,n==="near"?c="right":n==="center"?(c="center",u-=l/2):(c="left",u=this.left)):s==="right"?i?(u=this.left+r,n==="near"?c="right":n==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+a,n==="near"?c="left":n==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,s=this.options.position;if(s==="left"||s==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(s==="top"||s==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:s},left:n,top:i,width:r,height:o}=this;s&&(t.save(),t.fillStyle=s,t.fillRect(n,i,r,o),t.restore())}getLineWidthForValue(t){const s=this.options.grid;if(!this._isVisible()||!s.display)return 0;const i=this.ticks.findIndex(r=>r.value===t);return i>=0?s.setContext(this.getContext(i)).lineWidth:0}drawGrid(t){const s=this.options.grid,n=this.ctx,i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let r,o;const a=(l,c,u)=>{!u.width||!u.color||(n.save(),n.lineWidth=u.width,n.strokeStyle=u.color,n.setLineDash(u.borderDash||[]),n.lineDashOffset=u.borderDashOffset,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(c.x,c.y),n.stroke(),n.restore())};if(s.display)for(r=0,o=i.length;r<o;++r){const l=i[r];s.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),s.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:t,ctx:s,options:{border:n,grid:i}}=this,r=n.setContext(this.getContext()),o=n.display?r.width:0;if(!o)return;const a=i.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,u,d,h;this.isHorizontal()?(c=Rs(t,this.left,o)-o/2,u=Rs(t,this.right,a)+a/2,d=h=l):(d=Rs(t,this.top,o)-o/2,h=Rs(t,this.bottom,a)+a/2,c=u=l),s.save(),s.lineWidth=r.width,s.strokeStyle=r.color,s.beginPath(),s.moveTo(c,d),s.lineTo(u,h),s.stroke(),s.restore()}drawLabels(t){if(!this.options.ticks.display)return;const n=this.ctx,i=this._computeLabelArea();i&&Wr(n,i);const r=this.getLabelItems(t);for(const o of r){const a=o.options,l=o.font,c=o.label,u=o.textOffset;$s(n,c,0,u,l,a)}i&&$r(n)}drawTitle(){const{ctx:t,options:{position:s,title:n,reverse:i}}=this;if(!n.display)return;const r=Nt(n.font),o=Yt(n.padding),a=n.align;let l=r.lineHeight/2;s==="bottom"||s==="center"||ut(s)?(l+=o.bottom,_t(n.text)&&(l+=r.lineHeight*(n.text.length-1))):l+=o.top;const{titleX:c,titleY:u,maxWidth:d,rotation:h}=MS(this,l,s,a);$s(t,n.text,0,0,r,{color:n.color,maxWidth:d,rotation:h,textAlign:TS(a,s,i),textBaseline:"middle",translation:[c,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,s=t.ticks&&t.ticks.z||0,n=nt(t.grid&&t.grid.z,-1),i=nt(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==Ys.prototype.draw?[{z:s,draw:r=>{this.draw(r)}}]:[{z:n,draw:r=>{this.drawBackground(),this.drawGrid(r),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:s,draw:r=>{this.drawLabels(r)}}]}getMatchingVisibleMetas(t){const s=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",i=[];let r,o;for(r=0,o=s.length;r<o;++r){const a=s[r];a[n]===this.id&&(!t||a.type===t)&&i.push(a)}return i}_resolveTickFontOptions(t){const s=this.options.ticks.setContext(this.getContext(t));return Nt(s.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Wi{constructor(t,s,n){this.type=t,this.scope=s,this.override=n,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const s=Object.getPrototypeOf(t);let n;DS(s)&&(n=this.register(s));const i=this.items,r=t.id,o=this.scope+"."+r;if(!r)throw new Error("class does not have id: "+t);return r in i||(i[r]=t,AS(t,o,n),this.override&&wt.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){const s=this.items,n=t.id,i=this.scope;n in s&&delete s[n],i&&n in wt[i]&&(delete wt[i][n],this.override&&delete Ws[n])}}function AS(e,t,s){const n=ei(Object.create(null),[s?wt.get(s):{},wt.get(t),e.defaults]);wt.set(t,n),e.defaultRoutes&&LS(t,e.defaultRoutes),e.descriptors&&wt.describe(t,e.descriptors)}function LS(e,t){Object.keys(t).forEach(s=>{const n=s.split("."),i=n.pop(),r=[e].concat(n).join("."),o=t[s].split("."),a=o.pop(),l=o.join(".");wt.route(r,i,l,a)})}function DS(e){return"id"in e&&"defaults"in e}class NS{constructor(){this.controllers=new Wi(ys,"datasets",!0),this.elements=new Wi(Je,"elements"),this.plugins=new Wi(Object,"plugins"),this.scales=new Wi(Ys,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,s,n){[...s].forEach(i=>{const r=n||this._getRegistryForType(i);n||r.isForType(i)||r===this.plugins&&i.id?this._exec(t,r,i):mt(i,o=>{const a=n||this._getRegistryForType(o);this._exec(t,a,o)})})}_exec(t,s,n){const i=Za(t);gt(n["before"+i],[],n),s[t](n),gt(n["after"+i],[],n)}_getRegistryForType(t){for(let s=0;s<this._typedRegistries.length;s++){const n=this._typedRegistries[s];if(n.isForType(t))return n}return this.plugins}_get(t,s,n){const i=s.get(t);if(i===void 0)throw new Error('"'+t+'" is not a registered '+n+".");return i}}var Te=new NS;class FS{constructor(){this._init=void 0}notify(t,s,n,i){if(s==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;const r=i?this._descriptors(t).filter(i):this._descriptors(t),o=this._notify(r,t,s,n);return s==="afterDestroy"&&(this._notify(r,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),o}_notify(t,s,n,i){i=i||{};for(const r of t){const o=r.plugin,a=o[n],l=[s,i,r.options];if(gt(a,l,o)===!1&&i.cancelable)return!1}return!0}invalidate(){lt(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const s=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),s}_createDescriptors(t,s){const n=t&&t.config,i=nt(n.options&&n.options.plugins,{}),r=IS(n);return i===!1&&!s?[]:BS(t,r,i,s)}_notifyStateChanges(t){const s=this._oldCache||[],n=this._cache,i=(r,o)=>r.filter(a=>!o.some(l=>a.plugin.id===l.plugin.id));this._notify(i(s,n),t,"stop"),this._notify(i(n,s),t,"start")}}function IS(e){const t={},s=[],n=Object.keys(Te.plugins.items);for(let r=0;r<n.length;r++)s.push(Te.getPlugin(n[r]));const i=e.plugins||[];for(let r=0;r<i.length;r++){const o=i[r];s.indexOf(o)===-1&&(s.push(o),t[o.id]=!0)}return{plugins:s,localIds:t}}function jS(e,t){return!t&&e===!1?null:e===!0?{}:e}function BS(e,{plugins:t,localIds:s},n,i){const r=[],o=e.getContext();for(const a of t){const l=a.id,c=jS(n[l],i);c!==null&&r.push({plugin:a,options:VS(e.config,{plugin:a,local:s[l]},c,o)})}return r}function VS(e,{plugin:t,local:s},n,i){const r=e.pluginScopeKeys(t),o=e.getOptionScopes(n,r);return s&&t.defaults&&o.push(t.defaults),e.createResolver(o,i,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function ma(e,t){const s=wt.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||s.indexAxis||"x"}function zS(e,t){let s=e;return e==="_index_"?s=t:e==="_value_"&&(s=t==="x"?"y":"x"),s}function HS(e,t){return e===t?"_index_":"_value_"}function Fu(e){if(e==="x"||e==="y"||e==="r")return e}function US(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function ga(e,...t){if(Fu(e))return e;for(const s of t){const n=s.axis||US(s.position)||e.length>1&&Fu(e[0].toLowerCase());if(n)return n}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function Iu(e,t,s){if(s[t+"AxisID"]===e)return{axis:t}}function WS(e,t){if(t.data&&t.data.datasets){const s=t.data.datasets.filter(n=>n.xAxisID===e||n.yAxisID===e);if(s.length)return Iu(e,"x",s[0])||Iu(e,"y",s[0])}return{}}function $S(e,t){const s=Ws[e.type]||{scales:{}},n=t.scales||{},i=ma(e.type,t),r=Object.create(null);return Object.keys(n).forEach(o=>{const a=n[o];if(!ut(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=ga(o,a,WS(o,e),wt.scales[a.type]),c=HS(l,i),u=s.scales||{};r[o]=qn(Object.create(null),[{axis:l},a,u[l],u[c]])}),e.data.datasets.forEach(o=>{const a=o.type||e.type,l=o.indexAxis||ma(a,t),u=(Ws[a]||{}).scales||{};Object.keys(u).forEach(d=>{const h=zS(d,l),f=o[h+"AxisID"]||h;r[f]=r[f]||Object.create(null),qn(r[f],[{axis:h},n[f],u[d]])})}),Object.keys(r).forEach(o=>{const a=r[o];qn(a,[wt.scales[a.type],wt.scale])}),r}function Gf(e){const t=e.options||(e.options={});t.plugins=nt(t.plugins,{}),t.scales=$S(e,t)}function Xf(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function qS(e){return e=e||{},e.data=Xf(e.data),Gf(e),e}const ju=new Map,Qf=new Set;function $i(e,t){let s=ju.get(e);return s||(s=t(),ju.set(e,s),Qf.add(s)),s}const Nn=(e,t,s)=>{const n=ms(t,s);n!==void 0&&e.add(n)};class KS{constructor(t){this._config=qS(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Xf(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Gf(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return $i(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,s){return $i(`${t}.transition.${s}`,()=>[[`datasets.${t}.transitions.${s}`,`transitions.${s}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,s){return $i(`${t}-${s}`,()=>[[`datasets.${t}.elements.${s}`,`datasets.${t}`,`elements.${s}`,""]])}pluginScopeKeys(t){const s=t.id,n=this.type;return $i(`${n}-plugin-${s}`,()=>[[`plugins.${s}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,s){const n=this._scopeCache;let i=n.get(t);return(!i||s)&&(i=new Map,n.set(t,i)),i}getOptionScopes(t,s,n){const{options:i,type:r}=this,o=this._cachedScopes(t,n),a=o.get(s);if(a)return a;const l=new Set;s.forEach(u=>{t&&(l.add(t),u.forEach(d=>Nn(l,t,d))),u.forEach(d=>Nn(l,i,d)),u.forEach(d=>Nn(l,Ws[r]||{},d)),u.forEach(d=>Nn(l,wt,d)),u.forEach(d=>Nn(l,fa,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Qf.has(s)&&o.set(s,c),c}chartOptionScopes(){const{options:t,type:s}=this;return[t,Ws[s]||{},wt.datasets[s]||{},{type:s},wt,fa]}resolveNamedOptions(t,s,n,i=[""]){const r={$shared:!0},{resolver:o,subPrefixes:a}=Bu(this._resolverCache,t,i);let l=o;if(GS(o,s)){r.$shared=!1,n=gs(n)?n():n;const c=this.createResolver(t,n,a);l=hn(o,n,c)}for(const c of s)r[c]=l[c];return r}createResolver(t,s,n=[""],i){const{resolver:r}=Bu(this._resolverCache,t,n);return ut(s)?hn(r,s,void 0,i):r}}function Bu(e,t,s){let n=e.get(t);n||(n=new Map,e.set(t,n));const i=s.join();let r=n.get(i);return r||(r={resolver:rl(t,s),subPrefixes:s.filter(a=>!a.toLowerCase().includes("hover"))},n.set(i,r)),r}const YS=e=>ut(e)&&Object.getOwnPropertyNames(e).some(t=>gs(e[t]));function GS(e,t){const{isScriptable:s,isIndexable:n}=Ef(e);for(const i of t){const r=s(i),o=n(i),a=(o||r)&&e[i];if(r&&(gs(a)||YS(a))||o&&_t(a))return!0}return!1}var XS="4.5.1";const QS=["top","bottom","left","right","chartArea"];function Vu(e,t){return e==="top"||e==="bottom"||QS.indexOf(e)===-1&&t==="x"}function zu(e,t){return function(s,n){return s[e]===n[e]?s[t]-n[t]:s[e]-n[e]}}function Hu(e){const t=e.chart,s=t.options.animation;t.notifyPlugins("afterRender"),gt(s&&s.onComplete,[e],t)}function JS(e){const t=e.chart,s=t.options.animation;gt(s&&s.onProgress,[e],t)}function Jf(e){return ll()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const ar={},Uu=e=>{const t=Jf(e);return Object.values(ar).filter(s=>s.canvas===t).pop()};function ZS(e,t,s){const n=Object.keys(e);for(const i of n){const r=+i;if(r>=t){const o=e[i];delete e[i],(s>0||r>t)&&(e[r+s]=o)}}}function tk(e,t,s,n){return!s||e.type==="mouseout"?null:n?t:e}let bi=class{static defaults=wt;static instances=ar;static overrides=Ws;static registry=Te;static version=XS;static getChart=Uu;static register(...t){Te.add(...t),Wu()}static unregister(...t){Te.remove(...t),Wu()}constructor(t,s){const n=this.config=new KS(s),i=Jf(t),r=Uu(i);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");const o=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||yS(i)),this.platform.updateConfig(n);const a=this.platform.acquireContext(i,o.aspectRatio),l=a&&a.canvas,c=l&&l.height,u=l&&l.width;if(this.id=Xv(),this.ctx=a,this.canvas=l,this.width=u,this.height=c,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new FS,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=f_(d=>this.update(d),o.resizeDelay||0),this._dataChanges=[],ar[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Ue.listen(this,"complete",Hu),Ue.listen(this,"progress",JS),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:s},width:n,height:i,_aspectRatio:r}=this;return lt(t)?s&&r?r:i?n/i:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Te}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():hu(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return cu(this.canvas,this.ctx),this}stop(){return Ue.stop(this),this}resize(t,s){Ue.running(this)?this._resizeBeforeDraw={width:t,height:s}:this._resize(t,s)}_resize(t,s){const n=this.options,i=this.canvas,r=n.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(i,t,s,r),a=n.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,hu(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),gt(n.onResize,[this,o],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const s=this.options.scales||{};mt(s,(n,i)=>{n.id=i})}buildOrUpdateScales(){const t=this.options,s=t.scales,n=this.scales,i=Object.keys(n).reduce((o,a)=>(o[a]=!1,o),{});let r=[];s&&(r=r.concat(Object.keys(s).map(o=>{const a=s[o],l=ga(o,a),c=l==="r",u=l==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),mt(r,o=>{const a=o.options,l=a.id,c=ga(l,a),u=nt(a.type,o.dtype);(a.position===void 0||Vu(a.position,c)!==Vu(o.dposition))&&(a.position=o.dposition),i[l]=!0;let d=null;if(l in n&&n[l].type===u)d=n[l];else{const h=Te.getScale(u);d=new h({id:l,type:u,ctx:this.ctx,chart:this}),n[d.id]=d}d.init(a,t)}),mt(i,(o,a)=>{o||delete n[a]}),mt(n,o=>{Kt.configure(this,o,o.options),Kt.addBox(this,o)})}_updateMetasets(){const t=this._metasets,s=this.data.datasets.length,n=t.length;if(t.sort((i,r)=>i.index-r.index),n>s){for(let i=s;i<n;++i)this._destroyDatasetMeta(i);t.splice(s,n-s)}this._sortedMetasets=t.slice(0).sort(zu("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:s}}=this;t.length>s.length&&delete this._stacks,t.forEach((n,i)=>{s.filter(r=>r===n._dataset).length===0&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){const t=[],s=this.data.datasets;let n,i;for(this._removeUnreferencedMetasets(),n=0,i=s.length;n<i;n++){const r=s[n];let o=this.getDatasetMeta(n);const a=r.type||this.config.type;if(o.type&&o.type!==a&&(this._destroyDatasetMeta(n),o=this.getDatasetMeta(n)),o.type=a,o.indexAxis=r.indexAxis||ma(a,this.options),o.order=r.order||0,o.index=n,o.label=""+r.label,o.visible=this.isDatasetVisible(n),o.controller)o.controller.updateIndex(n),o.controller.linkScales();else{const l=Te.getController(a),{datasetElementType:c,dataElementType:u}=wt.datasets[a];Object.assign(l,{dataElementType:Te.getElement(u),datasetElementType:c&&Te.getElement(c)}),o.controller=new l(this,n),t.push(o.controller)}}return this._updateMetasets(),t}_resetElements(){mt(this.data.datasets,(t,s)=>{this.getDatasetMeta(s).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const s=this.config;s.update();const n=this._options=s.createResolver(s.chartOptionScopes(),this.getContext()),i=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let c=0,u=this.data.datasets.length;c<u;c++){const{controller:d}=this.getDatasetMeta(c),h=!i&&r.indexOf(d)===-1;d.buildOrUpdateElements(h),o=Math.max(+d.getMaxOverflow(),o)}o=this._minPadding=n.layout.autoPadding?o:0,this._updateLayout(o),i||mt(r,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(zu("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){mt(this.scales,t=>{Kt.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,s=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!tu(s,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,s=this._getUniformDataChanges()||[];for(const{method:n,start:i,count:r}of s){const o=n==="_removeElements"?-r:r;ZS(t,i,o)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const s=this.data.datasets.length,n=r=>new Set(t.filter(o=>o[0]===r).map((o,a)=>a+","+o.splice(1).join(","))),i=n(0);for(let r=1;r<s;r++)if(!tu(i,n(r)))return;return Array.from(i).map(r=>r.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Kt.update(this,this.width,this.height,t);const s=this.chartArea,n=s.width<=0||s.height<=0;this._layers=[],mt(this.boxes,i=>{n&&i.position==="chartArea"||(i.configure&&i.configure(),this._layers.push(...i._layers()))},this),this._layers.forEach((i,r)=>{i._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let s=0,n=this.data.datasets.length;s<n;++s)this.getDatasetMeta(s).controller.configure();for(let s=0,n=this.data.datasets.length;s<n;++s)this._updateDataset(s,gs(t)?t({datasetIndex:s}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,s){const n=this.getDatasetMeta(t),i={meta:n,index:t,mode:s,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",i)!==!1&&(n.controller._update(s),i.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",i))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Ue.has(this)?this.attached&&!Ue.running(this)&&Ue.start(this):(this.draw(),Hu({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:n,height:i}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(n,i)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const s=this._layers;for(t=0;t<s.length&&s[t].z<=0;++t)s[t].draw(this.chartArea);for(this._drawDatasets();t<s.length;++t)s[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const s=this._sortedMetasets,n=[];let i,r;for(i=0,r=s.length;i<r;++i){const o=s[i];(!t||o.visible)&&n.push(o)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let s=t.length-1;s>=0;--s)this._drawDataset(t[s]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const s=this.ctx,n={meta:t,index:t.index,cancelable:!0},i=jf(this,t);this.notifyPlugins("beforeDatasetDraw",n)!==!1&&(i&&Wr(s,i),t.controller.draw(),i&&$r(s),n.cancelable=!1,this.notifyPlugins("afterDatasetDraw",n))}isPointInArea(t){return Xe(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,s,n,i){const r=Qw.modes[s];return typeof r=="function"?r(this,t,n,i):[]}getDatasetMeta(t){const s=this.data.datasets[t],n=this._metasets;let i=n.filter(r=>r&&r._dataset===s).pop();return i||(i={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:s&&s.order||0,index:t,_dataset:s,_parsed:[],_sorted:!1},n.push(i)),i}getContext(){return this.$context||(this.$context=bs(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const s=this.data.datasets[t];if(!s)return!1;const n=this.getDatasetMeta(t);return typeof n.hidden=="boolean"?!n.hidden:!s.hidden}setDatasetVisibility(t,s){const n=this.getDatasetMeta(t);n.hidden=!s}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,s,n){const i=n?"show":"hide",r=this.getDatasetMeta(t),o=r.controller._resolveAnimations(void 0,i);si(s)?(r.data[s].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),o.update(r,{visible:n}),this.update(a=>a.datasetIndex===t?i:void 0))}hide(t,s){this._updateVisibility(t,s,!1)}show(t,s){this._updateVisibility(t,s,!0)}_destroyDatasetMeta(t){const s=this._metasets[t];s&&s.controller&&s.controller._destroy(),delete this._metasets[t]}_stop(){let t,s;for(this.stop(),Ue.remove(this),t=0,s=this.data.datasets.length;t<s;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:s}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),cu(t,s),this.platform.releaseContext(s),this.canvas=null,this.ctx=null),delete ar[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,s=this.platform,n=(r,o)=>{s.addEventListener(this,r,o),t[r]=o},i=(r,o,a)=>{r.offsetX=o,r.offsetY=a,this._eventHandler(r)};mt(this.options.events,r=>n(r,i))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,s=this.platform,n=(l,c)=>{s.addEventListener(this,l,c),t[l]=c},i=(l,c)=>{t[l]&&(s.removeEventListener(this,l,c),delete t[l])},r=(l,c)=>{this.canvas&&this.resize(l,c)};let o;const a=()=>{i("attach",a),this.attached=!0,this.resize(),n("resize",r),n("detach",o)};o=()=>{this.attached=!1,i("resize",r),this._stop(),this._resize(0,0),n("attach",a)},s.isAttached(this.canvas)?a():o()}unbindEvents(){mt(this._listeners,(t,s)=>{this.platform.removeEventListener(this,s,t)}),this._listeners={},mt(this._responsiveListeners,(t,s)=>{this.platform.removeEventListener(this,s,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,s,n){const i=n?"set":"remove";let r,o,a,l;for(s==="dataset"&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+i+"DatasetHoverStyle"]()),a=0,l=t.length;a<l;++a){o=t[a];const c=o&&this.getDatasetMeta(o.datasetIndex).controller;c&&c[i+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const s=this._active||[],n=t.map(({datasetIndex:r,index:o})=>{const a=this.getDatasetMeta(r);if(!a)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:a.data[o],index:o}});!wr(n,s)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,s))}notifyPlugins(t,s,n){return this._plugins.notify(this,t,s,n)}isPluginEnabled(t){return this._plugins._cache.filter(s=>s.plugin.id===t).length===1}_updateHoverStyles(t,s,n){const i=this.options.hover,r=(l,c)=>l.filter(u=>!c.some(d=>u.datasetIndex===d.datasetIndex&&u.index===d.index)),o=r(s,t),a=n?t:r(t,s);o.length&&this.updateHoverStyle(o,i.mode,!1),a.length&&i.mode&&this.updateHoverStyle(a,i.mode,!0)}_eventHandler(t,s){const n={event:t,replay:s,cancelable:!0,inChartArea:this.isPointInArea(t)},i=o=>(o.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",n,i)===!1)return;const r=this._handleEvent(t,s,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,i),(r||n.changed)&&this.render(),this}_handleEvent(t,s,n){const{_active:i=[],options:r}=this,o=s,a=this._getActiveElements(t,i,n,o),l=s_(t),c=tk(t,this._lastEvent,n,l);n&&(this._lastEvent=null,gt(r.onHover,[t,a,this],this),l&&gt(r.onClick,[t,a,this],this));const u=!wr(a,i);return(u||s)&&(this._active=a,this._updateHoverStyles(a,i,s)),this._lastEvent=c,u}_getActiveElements(t,s,n,i){if(t.type==="mouseout")return[];if(!n)return s;const r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,i)}};function Wu(){return mt(bi.instances,e=>e._plugins.invalidate())}function ek(e,t,s){const{startAngle:n,x:i,y:r,outerRadius:o,innerRadius:a,options:l}=t,{borderWidth:c,borderJoinStyle:u}=l,d=Math.min(c/o,$t(n-s));if(e.beginPath(),e.arc(i,r,o-c/2,n+d/2,s-d/2),a>0){const h=Math.min(c/a,$t(n-s));e.arc(i,r,a+c/2,s-h/2,n+h/2,!0)}else{const h=Math.min(c/2,o*$t(n-s));if(u==="round")e.arc(i,r,h,s-pt/2,n+pt/2,!0);else if(u==="bevel"){const f=2*h*h,p=-f*Math.cos(s+pt/2)+i,m=-f*Math.sin(s+pt/2)+r,g=f*Math.cos(n+pt/2)+i,b=f*Math.sin(n+pt/2)+r;e.lineTo(p,m),e.lineTo(g,b)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}function sk(e,t,s){const{startAngle:n,pixelMargin:i,x:r,y:o,outerRadius:a,innerRadius:l}=t;let c=i/a;e.beginPath(),e.arc(r,o,a,n-c,s+c),l>i?(c=i/l,e.arc(r,o,l,s+c,n-c,!0)):e.arc(r,o,i,s+Et,n-Et),e.closePath(),e.clip()}function nk(e){return il(e,["outerStart","outerEnd","innerStart","innerEnd"])}function ik(e,t,s,n){const i=nk(e.options.borderRadius),r=(s-t)/2,o=Math.min(r,n*t/2),a=l=>{const c=(s-Math.min(r,l))*n/2;return jt(l,0,Math.min(r,c))};return{outerStart:a(i.outerStart),outerEnd:a(i.outerEnd),innerStart:jt(i.innerStart,0,o),innerEnd:jt(i.innerEnd,0,o)}}function tn(e,t,s,n){return{x:s+e*Math.cos(t),y:n+e*Math.sin(t)}}function Cr(e,t,s,n,i,r){const{x:o,y:a,startAngle:l,pixelMargin:c,innerRadius:u}=t,d=Math.max(t.outerRadius+n+s-c,0),h=u>0?u+n+s+c:0;let f=0;const p=i-l;if(n){const W=u>0?u-n:0,I=d>0?d-n:0,q=(W+I)/2,z=q!==0?p*q/(q+n):p;f=(p-z)/2}const m=Math.max(.001,p*d-s/pt)/d,g=(p-m)/2,b=l+g+f,x=i-g-f,{outerStart:w,outerEnd:v,innerStart:S,innerEnd:P}=ik(t,h,d,x-b),R=d-w,_=d-v,C=b+w/R,N=x-v/_,j=h+S,A=h+P,F=b+S/j,V=x-P/A;if(e.beginPath(),r){const W=(C+N)/2;if(e.arc(o,a,d,C,W),e.arc(o,a,d,W,N),v>0){const rt=tn(_,N,o,a);e.arc(rt.x,rt.y,v,N,x+Et)}const I=tn(A,x,o,a);if(e.lineTo(I.x,I.y),P>0){const rt=tn(A,V,o,a);e.arc(rt.x,rt.y,P,x+Et,V+Math.PI)}const q=(x-P/h+(b+S/h))/2;if(e.arc(o,a,h,x-P/h,q,!0),e.arc(o,a,h,q,b+S/h,!0),S>0){const rt=tn(j,F,o,a);e.arc(rt.x,rt.y,S,F+Math.PI,b-Et)}const z=tn(R,b,o,a);if(e.lineTo(z.x,z.y),w>0){const rt=tn(R,C,o,a);e.arc(rt.x,rt.y,w,b-Et,C)}}else{e.moveTo(o,a);const W=Math.cos(C)*d+o,I=Math.sin(C)*d+a;e.lineTo(W,I);const q=Math.cos(N)*d+o,z=Math.sin(N)*d+a;e.lineTo(q,z)}e.closePath()}function rk(e,t,s,n,i){const{fullCircles:r,startAngle:o,circumference:a}=t;let l=t.endAngle;if(r){Cr(e,t,s,n,l,i);for(let c=0;c<r;++c)e.fill();isNaN(a)||(l=o+(a%xt||xt))}return Cr(e,t,s,n,l,i),e.fill(),l}function ok(e,t,s,n,i){const{fullCircles:r,startAngle:o,circumference:a,options:l}=t,{borderWidth:c,borderJoinStyle:u,borderDash:d,borderDashOffset:h,borderRadius:f}=l,p=l.borderAlign==="inner";if(!c)return;e.setLineDash(d||[]),e.lineDashOffset=h,p?(e.lineWidth=c*2,e.lineJoin=u||"round"):(e.lineWidth=c,e.lineJoin=u||"bevel");let m=t.endAngle;if(r){Cr(e,t,s,n,m,i);for(let g=0;g<r;++g)e.stroke();isNaN(a)||(m=o+(a%xt||xt))}p&&sk(e,t,m),l.selfJoin&&m-o>=pt&&f===0&&u!=="miter"&&ek(e,t,m),r||(Cr(e,t,s,n,m,i),e.stroke())}class ak extends Je{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),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,t&&Object.assign(this,t)}inRange(t,s,n){const i=this.getProps(["x","y"],n),{angle:r,distance:o}=bf(i,{x:t,y:s}),{startAngle:a,endAngle:l,innerRadius:c,outerRadius:u,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],n),h=(this.options.spacing+this.options.borderWidth)/2,f=nt(d,l-a),p=ni(r,a,l)&&a!==l,m=f>=xt||p,g=Ye(o,c+h,u+h);return m&&g}getCenterPoint(t){const{x:s,y:n,startAngle:i,endAngle:r,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:l,spacing:c}=this.options,u=(i+r)/2,d=(o+a+c+l)/2;return{x:s+Math.cos(u)*d,y:n+Math.sin(u)*d}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:s,circumference:n}=this,i=(s.offset||0)/4,r=(s.spacing||0)/2,o=s.circular;if(this.pixelMargin=s.borderAlign==="inner"?.33:0,this.fullCircles=n>xt?Math.floor(n/xt):0,n===0||this.innerRadius<0||this.outerRadius<0)return;t.save();const a=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(a)*i,Math.sin(a)*i);const l=1-Math.sin(Math.min(pt,n||0)),c=i*l;t.fillStyle=s.backgroundColor,t.strokeStyle=s.borderColor,rk(t,this,c,r,o),ok(t,this,c,r,o),t.restore()}}function Zf(e,t,s=t){e.lineCap=nt(s.borderCapStyle,t.borderCapStyle),e.setLineDash(nt(s.borderDash,t.borderDash)),e.lineDashOffset=nt(s.borderDashOffset,t.borderDashOffset),e.lineJoin=nt(s.borderJoinStyle,t.borderJoinStyle),e.lineWidth=nt(s.borderWidth,t.borderWidth),e.strokeStyle=nt(s.borderColor,t.borderColor)}function lk(e,t,s){e.lineTo(s.x,s.y)}function ck(e){return e.stepped?R_:e.tension||e.cubicInterpolationMode==="monotone"?P_:lk}function tp(e,t,s={}){const n=e.length,{start:i=0,end:r=n-1}=s,{start:o,end:a}=t,l=Math.max(i,o),c=Math.min(r,a),u=i<o&&r<o||i>a&&r>a;return{count:n,start:l,loop:t.loop,ilen:c<l&&!u?n+c-l:c-l}}function uk(e,t,s,n){const{points:i,options:r}=t,{count:o,start:a,loop:l,ilen:c}=tp(i,s,n),u=ck(r);let{move:d=!0,reverse:h}=n||{},f,p,m;for(f=0;f<=c;++f)p=i[(a+(h?c-f:f))%o],!p.skip&&(d?(e.moveTo(p.x,p.y),d=!1):u(e,m,p,h,r.stepped),m=p);return l&&(p=i[(a+(h?c:0))%o],u(e,m,p,h,r.stepped)),!!l}function dk(e,t,s,n){const i=t.points,{count:r,start:o,ilen:a}=tp(i,s,n),{move:l=!0,reverse:c}=n||{};let u=0,d=0,h,f,p,m,g,b;const x=v=>(o+(c?a-v:v))%r,w=()=>{m!==g&&(e.lineTo(u,g),e.lineTo(u,m),e.lineTo(u,b))};for(l&&(f=i[x(0)],e.moveTo(f.x,f.y)),h=0;h<=a;++h){if(f=i[x(h)],f.skip)continue;const v=f.x,S=f.y,P=v|0;P===p?(S<m?m=S:S>g&&(g=S),u=(d*u+v)/++d):(w(),e.lineTo(v,S),p=P,d=0,m=g=S),b=S}w()}function ba(e){const t=e.options,s=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!s?dk:uk}function hk(e){return e.stepped?iw:e.tension||e.cubicInterpolationMode==="monotone"?rw:Os}function fk(e,t,s,n){let i=t._path;i||(i=t._path=new Path2D,t.path(i,s,n)&&i.closePath()),Zf(e,t.options),e.stroke(i)}function pk(e,t,s,n){const{segments:i,options:r}=t,o=ba(t);for(const a of i)Zf(e,r,a.style),e.beginPath(),o(e,t,a,{start:s,end:s+n-1})&&e.closePath(),e.stroke()}const mk=typeof Path2D=="function";function gk(e,t,s,n){mk&&!t.options.segment?fk(e,t,s,n):pk(e,t,s,n)}class yi extends Je{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,s){const n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){const i=n.spanGaps?this._loop:this._fullLoop;X_(this._points,n,t,i,s),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=dw(this,this.options.segment))}first(){const t=this.segments,s=this.points;return t.length&&s[t[0].start]}last(){const t=this.segments,s=this.points,n=t.length;return n&&s[t[n-1].end]}interpolate(t,s){const n=this.options,i=t[s],r=this.points,o=If(this,{property:s,start:i,end:i});if(!o.length)return;const a=[],l=hk(n);let c,u;for(c=0,u=o.length;c<u;++c){const{start:d,end:h}=o[c],f=r[d],p=r[h];if(f===p){a.push(f);continue}const m=Math.abs((i-f[s])/(p[s]-f[s])),g=l(f,p,m,n.stepped);g[s]=t[s],a.push(g)}return a.length===1?a[0]:a}pathSegment(t,s,n){return ba(this)(t,this,s,n)}path(t,s,n){const i=this.segments,r=ba(this);let o=this._loop;s=s||0,n=n||this.points.length-s;for(const a of i)o&=r(t,this,a,{start:s,end:s+n-1});return!!o}draw(t,s,n,i){const r=this.options||{};(this.points||[]).length&&r.borderWidth&&(t.save(),gk(t,this,n,i),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function $u(e,t,s,n){const i=e.options,{[s]:r}=e.getProps([s],n);return Math.abs(t-r)<i.radius+i.hitRadius}class ep extends Je{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,s,n){const i=this.options,{x:r,y:o}=this.getProps(["x","y"],n);return Math.pow(t-r,2)+Math.pow(s-o,2)<Math.pow(i.hitRadius+i.radius,2)}inXRange(t,s){return $u(this,t,"x",s)}inYRange(t,s){return $u(this,t,"y",s)}getCenterPoint(t){const{x:s,y:n}=this.getProps(["x","y"],t);return{x:s,y:n}}size(t){t=t||this.options||{};let s=t.radius||0;s=Math.max(s,s&&t.hoverRadius||0);const n=s&&t.borderWidth||0;return(s+n)*2}draw(t,s){const n=this.options;this.skip||n.radius<.1||!Xe(this,s,this.size(n)/2)||(t.strokeStyle=n.borderColor,t.lineWidth=n.borderWidth,t.fillStyle=n.backgroundColor,pa(t,n,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function sp(e,t){const{x:s,y:n,base:i,width:r,height:o}=e.getProps(["x","y","base","width","height"],t);let a,l,c,u,d;return e.horizontal?(d=o/2,a=Math.min(s,i),l=Math.max(s,i),c=n-d,u=n+d):(d=r/2,a=s-d,l=s+d,c=Math.min(n,i),u=Math.max(n,i)),{left:a,top:c,right:l,bottom:u}}function cs(e,t,s,n){return e?0:jt(t,s,n)}function bk(e,t,s){const n=e.options.borderWidth,i=e.borderSkipped,r=Pf(n);return{t:cs(i.top,r.top,0,s),r:cs(i.right,r.right,0,t),b:cs(i.bottom,r.bottom,0,s),l:cs(i.left,r.left,0,t)}}function yk(e,t,s){const{enableBorderRadius:n}=e.getProps(["enableBorderRadius"]),i=e.options.borderRadius,r=js(i),o=Math.min(t,s),a=e.borderSkipped,l=n||ut(i);return{topLeft:cs(!l||a.top||a.left,r.topLeft,0,o),topRight:cs(!l||a.top||a.right,r.topRight,0,o),bottomLeft:cs(!l||a.bottom||a.left,r.bottomLeft,0,o),bottomRight:cs(!l||a.bottom||a.right,r.bottomRight,0,o)}}function xk(e){const t=sp(e),s=t.right-t.left,n=t.bottom-t.top,i=bk(e,s/2,n/2),r=yk(e,s/2,n/2);return{outer:{x:t.left,y:t.top,w:s,h:n,radius:r},inner:{x:t.left+i.l,y:t.top+i.t,w:s-i.l-i.r,h:n-i.t-i.b,radius:{topLeft:Math.max(0,r.topLeft-Math.max(i.t,i.l)),topRight:Math.max(0,r.topRight-Math.max(i.t,i.r)),bottomLeft:Math.max(0,r.bottomLeft-Math.max(i.b,i.l)),bottomRight:Math.max(0,r.bottomRight-Math.max(i.b,i.r))}}}}function Ao(e,t,s,n){const i=t===null,r=s===null,a=e&&!(i&&r)&&sp(e,n);return a&&(i||Ye(t,a.left,a.right))&&(r||Ye(s,a.top,a.bottom))}function vk(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function _k(e,t){e.rect(t.x,t.y,t.w,t.h)}function Lo(e,t,s={}){const n=e.x!==s.x?-t:0,i=e.y!==s.y?-t:0,r=(e.x+e.w!==s.x+s.w?t:0)-n,o=(e.y+e.h!==s.y+s.h?t:0)-i;return{x:e.x+n,y:e.y+i,w:e.w+r,h:e.h+o,radius:e.radius}}class wk extends Je{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){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,t&&Object.assign(this,t)}draw(t){const{inflateAmount:s,options:{borderColor:n,backgroundColor:i}}=this,{inner:r,outer:o}=xk(this),a=vk(o.radius)?ii:_k;t.save(),(o.w!==r.w||o.h!==r.h)&&(t.beginPath(),a(t,Lo(o,s,r)),t.clip(),a(t,Lo(r,-s,o)),t.fillStyle=n,t.fill("evenodd")),t.beginPath(),a(t,Lo(r,s)),t.fillStyle=i,t.fill(),t.restore()}inRange(t,s,n){return Ao(this,t,s,n)}inXRange(t,s){return Ao(this,t,null,s)}inYRange(t,s){return Ao(this,null,t,s)}getCenterPoint(t){const{x:s,y:n,base:i,horizontal:r}=this.getProps(["x","y","base","horizontal"],t);return{x:r?(s+i)/2:s,y:r?n:(n+i)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}var Sk=Object.freeze({__proto__:null,ArcElement:ak,BarElement:wk,LineElement:yi,PointElement:ep});const ya=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],qu=ya.map(e=>e.replace("rgb(","rgba(").replace(")",", 0.5)"));function np(e){return ya[e%ya.length]}function ip(e){return qu[e%qu.length]}function kk(e,t){return e.borderColor=np(t),e.backgroundColor=ip(t),++t}function Rk(e,t){return e.backgroundColor=e.data.map(()=>np(t++)),t}function Pk(e,t){return e.backgroundColor=e.data.map(()=>ip(t++)),t}function Ek(e){let t=0;return(s,n)=>{const i=e.getDatasetMeta(n).controller;i instanceof ul?t=Rk(s,t):i instanceof Uf?t=Pk(s,t):i&&(t=kk(s,t))}}function Ku(e){let t;for(t in e)if(e[t].borderColor||e[t].backgroundColor)return!0;return!1}function Ck(e){return e&&(e.borderColor||e.backgroundColor)}function Ok(){return wt.borderColor!=="rgba(0,0,0,0.1)"||wt.backgroundColor!=="rgba(0,0,0,0.1)"}var Tk={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(e,t,s){if(!s.enabled)return;const{data:{datasets:n},options:i}=e.config,{elements:r}=i,o=Ku(n)||Ck(i)||r&&Ku(r)||Ok();if(!s.forceOverride&&o)return;const a=Ek(e);n.forEach(a)}};function Mk(e,t,s,n,i){const r=i.samples||n;if(r>=s)return e.slice(t,t+s);const o=[],a=(s-2)/(r-2);let l=0;const c=t+s-1;let u=t,d,h,f,p,m;for(o[l++]=e[u],d=0;d<r-2;d++){let g=0,b=0,x;const w=Math.floor((d+1)*a)+1+t,v=Math.min(Math.floor((d+2)*a)+1,s)+t,S=v-w;for(x=w;x<v;x++)g+=e[x].x,b+=e[x].y;g/=S,b/=S;const P=Math.floor(d*a)+1+t,R=Math.min(Math.floor((d+1)*a)+1,s)+t,{x:_,y:C}=e[u];for(f=p=-1,x=P;x<R;x++)p=.5*Math.abs((_-g)*(e[x].y-C)-(_-e[x].x)*(b-C)),p>f&&(f=p,h=e[x],m=x);o[l++]=h,u=m}return o[l++]=e[c],o}function Ak(e,t,s,n){let i=0,r=0,o,a,l,c,u,d,h,f,p,m;const g=[],b=t+s-1,x=e[t].x,v=e[b].x-x;for(o=t;o<t+s;++o){a=e[o],l=(a.x-x)/v*n,c=a.y;const S=l|0;if(S===u)c<p?(p=c,d=o):c>m&&(m=c,h=o),i=(r*i+a.x)/++r;else{const P=o-1;if(!lt(d)&&!lt(h)){const R=Math.min(d,h),_=Math.max(d,h);R!==f&&R!==P&&g.push({...e[R],x:i}),_!==f&&_!==P&&g.push({...e[_],x:i})}o>0&&P!==f&&g.push(e[P]),g.push(a),u=S,r=0,p=m=c,d=h=f=o}}return g}function rp(e){if(e._decimated){const t=e._data;delete e._decimated,delete e._data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function Yu(e){e.data.datasets.forEach(t=>{rp(t)})}function Lk(e,t){const s=t.length;let n=0,i;const{iScale:r}=e,{min:o,max:a,minDefined:l,maxDefined:c}=r.getUserBounds();return l&&(n=jt(Ge(t,r.axis,o).lo,0,s-1)),c?i=jt(Ge(t,r.axis,a).hi+1,n,s)-n:i=s-n,{start:n,count:i}}var Dk={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(e,t,s)=>{if(!s.enabled){Yu(e);return}const n=e.width;e.data.datasets.forEach((i,r)=>{const{_data:o,indexAxis:a}=i,l=e.getDatasetMeta(r),c=o||i.data;if(Bn([a,e.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const u=e.scales[l.xAxisID];if(u.type!=="linear"&&u.type!=="time"||e.options.parsing)return;let{start:d,count:h}=Lk(l,c);const f=s.threshold||4*n;if(h<=f){rp(i);return}lt(o)&&(i._data=c,delete i.data,Object.defineProperty(i,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(m){this._data=m}}));let p;switch(s.algorithm){case"lttb":p=Mk(c,d,h,n,s);break;case"min-max":p=Ak(c,d,h,n);break;default:throw new Error(`Unsupported decimation algorithm '${s.algorithm}'`)}i._decimated=p})},destroy(e){Yu(e)}};function Nk(e,t,s){const n=e.segments,i=e.points,r=t.points,o=[];for(const a of n){let{start:l,end:c}=a;c=Yr(l,c,i);const u=xa(s,i[l],i[c],a.loop);if(!t.segments){o.push({source:a,target:u,start:i[l],end:i[c]});continue}const d=If(t,u);for(const h of d){const f=xa(s,r[h.start],r[h.end],h.loop),p=Ff(a,i,f);for(const m of p)o.push({source:m,target:h,start:{[s]:Gu(u,f,"start",Math.max)},end:{[s]:Gu(u,f,"end",Math.min)}})}}return o}function xa(e,t,s,n){if(n)return;let i=t[e],r=s[e];return e==="angle"&&(i=$t(i),r=$t(r)),{property:e,start:i,end:r}}function Fk(e,t){const{x:s=null,y:n=null}=e||{},i=t.points,r=[];return t.segments.forEach(({start:o,end:a})=>{a=Yr(o,a,i);const l=i[o],c=i[a];n!==null?(r.push({x:l.x,y:n}),r.push({x:c.x,y:n})):s!==null&&(r.push({x:s,y:l.y}),r.push({x:s,y:c.y}))}),r}function Yr(e,t,s){for(;t>e;t--){const n=s[t];if(!isNaN(n.x)&&!isNaN(n.y))break}return t}function Gu(e,t,s,n){return e&&t?n(e[s],t[s]):e?e[s]:t?t[s]:0}function op(e,t){let s=[],n=!1;return _t(e)?(n=!0,s=e):s=Fk(e,t),s.length?new yi({points:s,options:{tension:0},_loop:n,_fullLoop:n}):null}function Xu(e){return e&&e.fill!==!1}function Ik(e,t,s){let i=e[t].fill;const r=[t];let o;if(!s)return i;for(;i!==!1&&r.indexOf(i)===-1;){if(!Pt(i))return i;if(o=e[i],!o)return!1;if(o.visible)return i;r.push(i),i=o.fill}return!1}function jk(e,t,s){const n=Hk(e);if(ut(n))return isNaN(n.value)?!1:n;let i=parseFloat(n);return Pt(i)&&Math.floor(i)===i?Bk(n[0],t,i,s):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function Bk(e,t,s,n){return(e==="-"||e==="+")&&(s=t+s),s===t||s<0||s>=n?!1:s}function Vk(e,t){let s=null;return e==="start"?s=t.bottom:e==="end"?s=t.top:ut(e)?s=t.getPixelForValue(e.value):t.getBasePixel&&(s=t.getBasePixel()),s}function zk(e,t,s){let n;return e==="start"?n=s:e==="end"?n=t.options.reverse?t.min:t.max:ut(e)?n=e.value:n=t.getBaseValue(),n}function Hk(e){const t=e.options,s=t.fill;let n=nt(s&&s.target,s);return n===void 0&&(n=!!t.backgroundColor),n===!1||n===null?!1:n===!0?"origin":n}function Uk(e){const{scale:t,index:s,line:n}=e,i=[],r=n.segments,o=n.points,a=Wk(t,s);a.push(op({x:null,y:t.bottom},n));for(let l=0;l<r.length;l++){const c=r[l];for(let u=c.start;u<=c.end;u++)$k(i,o[u],a)}return new yi({points:i,options:{}})}function Wk(e,t){const s=[],n=e.getMatchingVisibleMetas("line");for(let i=0;i<n.length;i++){const r=n[i];if(r.index===t)break;r.hidden||s.unshift(r.dataset)}return s}function $k(e,t,s){const n=[];for(let i=0;i<s.length;i++){const r=s[i],{first:o,last:a,point:l}=qk(r,t,"x");if(!(!l||o&&a)){if(o)n.unshift(l);else if(e.push(l),!a)break}}e.push(...n)}function qk(e,t,s){const n=e.interpolate(t,s);if(!n)return{};const i=n[s],r=e.segments,o=e.points;let a=!1,l=!1;for(let c=0;c<r.length;c++){const u=r[c],d=o[u.start][s],h=o[u.end][s];if(Ye(i,d,h)){a=i===d,l=i===h;break}}return{first:a,last:l,point:n}}class ap{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,s,n){const{x:i,y:r,radius:o}=this;return s=s||{start:0,end:xt},t.arc(i,r,o,s.end,s.start,!0),!n.bounds}interpolate(t){const{x:s,y:n,radius:i}=this,r=t.angle;return{x:s+Math.cos(r)*i,y:n+Math.sin(r)*i,angle:r}}}function Kk(e){const{chart:t,fill:s,line:n}=e;if(Pt(s))return Yk(t,s);if(s==="stack")return Uk(e);if(s==="shape")return!0;const i=Gk(e);return i instanceof ap?i:op(i,n)}function Yk(e,t){const s=e.getDatasetMeta(t);return s&&e.isDatasetVisible(t)?s.dataset:null}function Gk(e){return(e.scale||{}).getPointPositionForValue?Qk(e):Xk(e)}function Xk(e){const{scale:t={},fill:s}=e,n=Vk(s,t);if(Pt(n)){const i=t.isHorizontal();return{x:i?n:null,y:i?null:n}}return null}function Qk(e){const{scale:t,fill:s}=e,n=t.options,i=t.getLabels().length,r=n.reverse?t.max:t.min,o=zk(s,t,r),a=[];if(n.grid.circular){const l=t.getPointPositionForValue(0,r);return new ap({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(o)})}for(let l=0;l<i;++l)a.push(t.getPointPositionForValue(l,o));return a}function Do(e,t,s){const n=Kk(t),{chart:i,index:r,line:o,scale:a,axis:l}=t,c=o.options,u=c.fill,d=c.backgroundColor,{above:h=d,below:f=d}=u||{},p=i.getDatasetMeta(r),m=jf(i,p);n&&o.points.length&&(Wr(e,s),Jk(e,{line:o,target:n,above:h,below:f,area:s,scale:a,axis:l,clip:m}),$r(e))}function Jk(e,t){const{line:s,target:n,above:i,below:r,area:o,scale:a,clip:l}=t,c=s._loop?"angle":t.axis;e.save();let u=r;r!==i&&(c==="x"?(Qu(e,n,o.top),No(e,{line:s,target:n,color:i,scale:a,property:c,clip:l}),e.restore(),e.save(),Qu(e,n,o.bottom)):c==="y"&&(Ju(e,n,o.left),No(e,{line:s,target:n,color:r,scale:a,property:c,clip:l}),e.restore(),e.save(),Ju(e,n,o.right),u=i)),No(e,{line:s,target:n,color:u,scale:a,property:c,clip:l}),e.restore()}function Qu(e,t,s){const{segments:n,points:i}=t;let r=!0,o=!1;e.beginPath();for(const a of n){const{start:l,end:c}=a,u=i[l],d=i[Yr(l,c,i)];r?(e.moveTo(u.x,u.y),r=!1):(e.lineTo(u.x,s),e.lineTo(u.x,u.y)),o=!!t.pathSegment(e,a,{move:o}),o?e.closePath():e.lineTo(d.x,s)}e.lineTo(t.first().x,s),e.closePath(),e.clip()}function Ju(e,t,s){const{segments:n,points:i}=t;let r=!0,o=!1;e.beginPath();for(const a of n){const{start:l,end:c}=a,u=i[l],d=i[Yr(l,c,i)];r?(e.moveTo(u.x,u.y),r=!1):(e.lineTo(s,u.y),e.lineTo(u.x,u.y)),o=!!t.pathSegment(e,a,{move:o}),o?e.closePath():e.lineTo(s,d.y)}e.lineTo(s,t.first().y),e.closePath(),e.clip()}function No(e,t){const{line:s,target:n,property:i,color:r,scale:o,clip:a}=t,l=Nk(s,n,i);for(const{source:c,target:u,start:d,end:h}of l){const{style:{backgroundColor:f=r}={}}=c,p=n!==!0;e.save(),e.fillStyle=f,Zk(e,o,a,p&&xa(i,d,h)),e.beginPath();const m=!!s.pathSegment(e,c);let g;if(p){m?e.closePath():Zu(e,n,h,i);const b=!!n.pathSegment(e,u,{move:m,reverse:!0});g=m&&b,g||Zu(e,n,d,i)}e.closePath(),e.fill(g?"evenodd":"nonzero"),e.restore()}}function Zk(e,t,s,n){const i=t.chart.chartArea,{property:r,start:o,end:a}=n||{};if(r==="x"||r==="y"){let l,c,u,d;r==="x"?(l=o,c=i.top,u=a,d=i.bottom):(l=i.left,c=o,u=i.right,d=a),e.beginPath(),s&&(l=Math.max(l,s.left),u=Math.min(u,s.right),c=Math.max(c,s.top),d=Math.min(d,s.bottom)),e.rect(l,c,u-l,d-c),e.clip()}}function Zu(e,t,s,n){const i=t.interpolate(s,n);i&&e.lineTo(i.x,i.y)}var lp={id:"filler",afterDatasetsUpdate(e,t,s){const n=(e.data.datasets||[]).length,i=[];let r,o,a,l;for(o=0;o<n;++o)r=e.getDatasetMeta(o),a=r.dataset,l=null,a&&a.options&&a instanceof yi&&(l={visible:e.isDatasetVisible(o),index:o,fill:jk(a,o,n),chart:e,axis:r.controller.options.indexAxis,scale:r.vScale,line:a}),r.$filler=l,i.push(l);for(o=0;o<n;++o)l=i[o],!(!l||l.fill===!1)&&(l.fill=Ik(i,o,s.propagate))},beforeDraw(e,t,s){const n=s.drawTime==="beforeDraw",i=e.getSortedVisibleDatasetMetas(),r=e.chartArea;for(let o=i.length-1;o>=0;--o){const a=i[o].$filler;a&&(a.line.updateControlPoints(r,a.axis),n&&a.fill&&Do(e.ctx,a,r))}},beforeDatasetsDraw(e,t,s){if(s.drawTime!=="beforeDatasetsDraw")return;const n=e.getSortedVisibleDatasetMetas();for(let i=n.length-1;i>=0;--i){const r=n[i].$filler;Xu(r)&&Do(e.ctx,r,e.chartArea)}},beforeDatasetDraw(e,t,s){const n=t.meta.$filler;!Xu(n)||s.drawTime!=="beforeDatasetDraw"||Do(e.ctx,n,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const td=(e,t)=>{let{boxHeight:s=t,boxWidth:n=t}=e;return e.usePointStyle&&(s=Math.min(s,t),n=e.pointStyleWidth||Math.min(n,t)),{boxWidth:n,boxHeight:s,itemHeight:Math.max(t,s)}},tR=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class ed extends Je{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.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(t,s,n){this.maxWidth=t,this.maxHeight=s,this._margins=n,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 t=this.options.labels||{};let s=gt(t.generateLabels,[this.chart],this)||[];t.filter&&(s=s.filter(n=>t.filter(n,this.chart.data))),t.sort&&(s=s.sort((n,i)=>t.sort(n,i,this.chart.data))),this.options.reverse&&s.reverse(),this.legendItems=s}fit(){const{options:t,ctx:s}=this;if(!t.display){this.width=this.height=0;return}const n=t.labels,i=Nt(n.font),r=i.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=td(n,r);let c,u;s.font=i.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(o,r,a,l)+10):(u=this.maxHeight,c=this._fitCols(o,i,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,s,n,i){const{ctx:r,maxWidth:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=i+a;let d=t;r.textAlign="left",r.textBaseline="middle";let h=-1,f=-u;return this.legendItems.forEach((p,m)=>{const g=n+s/2+r.measureText(p.text).width;(m===0||c[c.length-1]+g+2*a>o)&&(d+=u,c[c.length-(m>0?0:1)]=0,f+=u,h++),l[m]={left:0,top:f,row:h,width:g,height:i},c[c.length-1]+=g+a}),d}_fitCols(t,s,n,i){const{ctx:r,maxHeight:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=o-t;let d=a,h=0,f=0,p=0,m=0;return this.legendItems.forEach((g,b)=>{const{itemWidth:x,itemHeight:w}=eR(n,s,r,g,i);b>0&&f+w+2*a>u&&(d+=h+a,c.push({width:h,height:f}),p+=h+a,m++,h=f=0),l[b]={left:p,top:f,col:m,width:x,height:w},h=Math.max(h,x),f+=w+a}),d+=h,c.push({width:h,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:s,options:{align:n,labels:{padding:i},rtl:r}}=this,o=on(r,this.left,this.width);if(this.isHorizontal()){let a=0,l=Wt(n,this.left+i,this.right-this.lineWidths[a]);for(const c of s)a!==c.row&&(a=c.row,l=Wt(n,this.left+i,this.right-this.lineWidths[a])),c.top+=this.top+t+i,c.left=o.leftForLtr(o.x(l),c.width),l+=c.width+i}else{let a=0,l=Wt(n,this.top+t+i,this.bottom-this.columnSizes[a].height);for(const c of s)c.col!==a&&(a=c.col,l=Wt(n,this.top+t+i,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+i,c.left=o.leftForLtr(o.x(c.left),c.width),l+=c.height+i}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Wr(t,this),this._draw(),$r(t)}}_draw(){const{options:t,columnSizes:s,lineWidths:n,ctx:i}=this,{align:r,labels:o}=t,a=wt.color,l=on(t.rtl,this.left,this.width),c=Nt(o.font),{padding:u}=o,d=c.size,h=d/2;let f;this.drawTitle(),i.textAlign=l.textAlign("left"),i.textBaseline="middle",i.lineWidth=.5,i.font=c.string;const{boxWidth:p,boxHeight:m,itemHeight:g}=td(o,d),b=function(P,R,_){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;i.save();const C=nt(_.lineWidth,1);if(i.fillStyle=nt(_.fillStyle,a),i.lineCap=nt(_.lineCap,"butt"),i.lineDashOffset=nt(_.lineDashOffset,0),i.lineJoin=nt(_.lineJoin,"miter"),i.lineWidth=C,i.strokeStyle=nt(_.strokeStyle,a),i.setLineDash(nt(_.lineDash,[])),o.usePointStyle){const N={radius:m*Math.SQRT2/2,pointStyle:_.pointStyle,rotation:_.rotation,borderWidth:C},j=l.xPlus(P,p/2),A=R+h;Rf(i,N,j,A,o.pointStyleWidth&&p)}else{const N=R+Math.max((d-m)/2,0),j=l.leftForLtr(P,p),A=js(_.borderRadius);i.beginPath(),Object.values(A).some(F=>F!==0)?ii(i,{x:j,y:N,w:p,h:m,radius:A}):i.rect(j,N,p,m),i.fill(),C!==0&&i.stroke()}i.restore()},x=function(P,R,_){$s(i,_.text,P,R+g/2,c,{strikethrough:_.hidden,textAlign:l.textAlign(_.textAlign)})},w=this.isHorizontal(),v=this._computeTitleHeight();w?f={x:Wt(r,this.left+u,this.right-n[0]),y:this.top+u+v,line:0}:f={x:this.left+u,y:Wt(r,this.top+v+u,this.bottom-s[0].height),line:0},Lf(this.ctx,t.textDirection);const S=g+u;this.legendItems.forEach((P,R)=>{i.strokeStyle=P.fontColor,i.fillStyle=P.fontColor;const _=i.measureText(P.text).width,C=l.textAlign(P.textAlign||(P.textAlign=o.textAlign)),N=p+h+_;let j=f.x,A=f.y;l.setWidth(this.width),w?R>0&&j+N+u>this.right&&(A=f.y+=S,f.line++,j=f.x=Wt(r,this.left+u,this.right-n[f.line])):R>0&&A+S>this.bottom&&(j=f.x=j+s[f.line].width+u,f.line++,A=f.y=Wt(r,this.top+v+u,this.bottom-s[f.line].height));const F=l.x(j);if(b(F,A,P),j=p_(C,j+p+h,w?j+N:this.right,t.rtl),x(l.x(j),A,P),w)f.x+=N+u;else if(typeof P.text!="string"){const V=c.lineHeight;f.y+=cp(P,V)+u}else f.y+=S}),Df(this.ctx,t.textDirection)}drawTitle(){const t=this.options,s=t.title,n=Nt(s.font),i=Yt(s.padding);if(!s.display)return;const r=on(t.rtl,this.left,this.width),o=this.ctx,a=s.position,l=n.size/2,c=i.top+l;let u,d=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),u=this.top+c,d=Wt(t.align,d,this.right-h);else{const p=this.columnSizes.reduce((m,g)=>Math.max(m,g.height),0);u=c+Wt(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const f=Wt(a,d,d+h);o.textAlign=r.textAlign(sl(a)),o.textBaseline="middle",o.strokeStyle=s.color,o.fillStyle=s.color,o.font=n.string,$s(o,s.text,f,u,n)}_computeTitleHeight(){const t=this.options.title,s=Nt(t.font),n=Yt(t.padding);return t.display?s.lineHeight+n.height:0}_getLegendItemAt(t,s){let n,i,r;if(Ye(t,this.left,this.right)&&Ye(s,this.top,this.bottom)){for(r=this.legendHitBoxes,n=0;n<r.length;++n)if(i=r[n],Ye(t,i.left,i.left+i.width)&&Ye(s,i.top,i.top+i.height))return this.legendItems[n]}return null}handleEvent(t){const s=this.options;if(!iR(t.type,s))return;const n=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const i=this._hoveredItem,r=tR(i,n);i&&!r&&gt(s.onLeave,[t,i,this],this),this._hoveredItem=n,n&&!r&&gt(s.onHover,[t,n,this],this)}else n&&gt(s.onClick,[t,n,this],this)}}function eR(e,t,s,n,i){const r=sR(n,e,t,s),o=nR(i,n,t.lineHeight);return{itemWidth:r,itemHeight:o}}function sR(e,t,s,n){let i=e.text;return i&&typeof i!="string"&&(i=i.reduce((r,o)=>r.length>o.length?r:o)),t+s.size/2+n.measureText(i).width}function nR(e,t,s){let n=e;return typeof t.text!="string"&&(n=cp(t,s)),n}function cp(e,t){const s=e.text?e.text.length:0;return t*s}function iR(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var up={id:"legend",_element:ed,start(e,t,s){const n=e.legend=new ed({ctx:e.ctx,options:s,chart:e});Kt.configure(e,n,s),Kt.addBox(e,n)},stop(e){Kt.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,s){const n=e.legend;Kt.configure(e,n,s),n.options=s},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,s){const n=t.datasetIndex,i=s.chart;i.isDatasetVisible(n)?(i.hide(n),t.hidden=!0):(i.show(n),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:s,pointStyle:n,textAlign:i,color:r,useBorderRadius:o,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(s?0:void 0),u=Yt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:r,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:n||c.pointStyle,rotation:c.rotation,textAlign:i||c.textAlign,borderRadius:o&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};class hl extends Je{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,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.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,s){const n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=s;const i=_t(n.text)?n.text.length:1;this._padding=Yt(n.padding);const r=i*Nt(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=r:this.width=r}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:s,left:n,bottom:i,right:r,options:o}=this,a=o.align;let l=0,c,u,d;return this.isHorizontal()?(u=Wt(a,n,r),d=s+t,c=r-n):(o.position==="left"?(u=n+t,d=Wt(a,i,s),l=pt*-.5):(u=r-t,d=Wt(a,s,i),l=pt*.5),c=i-s),{titleX:u,titleY:d,maxWidth:c,rotation:l}}draw(){const t=this.ctx,s=this.options;if(!s.display)return;const n=Nt(s.font),r=n.lineHeight/2+this._padding.top,{titleX:o,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(r);$s(t,s.text,0,0,n,{color:s.color,maxWidth:l,rotation:c,textAlign:sl(s.align),textBaseline:"middle",translation:[o,a]})}}function rR(e,t){const s=new hl({ctx:e.ctx,options:t,chart:e});Kt.configure(e,s,t),Kt.addBox(e,s),e.titleBlock=s}var oR={id:"title",_element:hl,start(e,t,s){rR(e,s)},stop(e){const t=e.titleBlock;Kt.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,s){const n=e.titleBlock;Kt.configure(e,n,s),n.options=s},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const qi=new WeakMap;var aR={id:"subtitle",start(e,t,s){const n=new hl({ctx:e.ctx,options:s,chart:e});Kt.configure(e,n,s),Kt.addBox(e,n),qi.set(e,n)},stop(e){Kt.removeBox(e,qi.get(e)),qi.delete(e)},beforeUpdate(e,t,s){const n=qi.get(e);Kt.configure(e,n,s),n.options=s},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const zn={average(e){if(!e.length)return!1;let t,s,n=new Set,i=0,r=0;for(t=0,s=e.length;t<s;++t){const a=e[t].element;if(a&&a.hasValue()){const l=a.tooltipPosition();n.add(l.x),i+=l.y,++r}}return r===0||n.size===0?!1:{x:[...n].reduce((a,l)=>a+l)/n.size,y:i/r}},nearest(e,t){if(!e.length)return!1;let s=t.x,n=t.y,i=Number.POSITIVE_INFINITY,r,o,a;for(r=0,o=e.length;r<o;++r){const l=e[r].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),u=ha(t,c);u<i&&(i=u,a=l)}}if(a){const l=a.tooltipPosition();s=l.x,n=l.y}return{x:s,y:n}}};function Oe(e,t){return t&&(_t(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function We(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
6
+ <%s key={someKey} {...props} />`,Z,V,ee,V),se[V+Z]=!0)}if(V=null,K!==void 0&&(n(K),V=""+K),i(Y)&&(n(Y.key),V=""+Y.key),"key"in Y){K={};for(var me in Y)me!=="key"&&(K[me]=Y[me])}else K=Y;return V&&a(K,typeof I=="function"?I.displayName||I.name||"Unknown":I),l(I,V,K,s(),oe,ce)}function d(I){f(I)?I._store&&(I._store.validated=1):typeof I=="object"&&I!==null&&I.$$typeof===P&&(I._payload.status==="fulfilled"?f(I._payload.value)&&I._payload.value._store&&(I._payload.value._store.validated=1):I._store&&(I._store.validated=1))}function f(I){return typeof I=="object"&&I!==null&&I.$$typeof===p}var h=T,p=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),w=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),N=Symbol.for("react.client.reference"),A=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=Object.prototype.hasOwnProperty,$=Array.isArray,q=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(I){return I()}};var D,H={},F=h.react_stack_bottom_frame.bind(h,o)(),W=q(r(o)),se={};uo.Fragment=y,uo.jsx=function(I,Y,K){var Z=1e4>A.recentlyCreatedOwnerStacks++;return u(I,Y,K,!1,Z?Error("react-stack-top-frame"):F,Z?q(r(I)):W)},uo.jsxs=function(I,Y,K){var Z=1e4>A.recentlyCreatedOwnerStacks++;return u(I,Y,K,!0,Z?Error("react-stack-top-frame"):F,Z?q(r(I)):W)}})()),uo}var Uh;function aE(){return Uh||(Uh=1,process.env.NODE_ENV==="production"?ji.exports=oE():ji.exports=iE()),ji.exports}var g=aE();const Fu=new WeakMap,cE=new WeakMap,Ua={current:[]};let Il=!1,jo=0;const Co=new Set,Li=new Map;function ub(e){for(const t of e){if(Ua.current.includes(t))continue;Ua.current.push(t),t.recompute();const n=cE.get(t);if(n)for(const r of n){const s=Fu.get(r);s?.length&&ub(s)}}}function lE(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function uE(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function db(e){if(jo>0&&!Li.has(e)&&Li.set(e,e.prevState),Co.add(e),!(jo>0)&&!Il)try{for(Il=!0;Co.size>0;){const t=Array.from(Co);Co.clear();for(const n of t){const r=Li.get(n)??n.prevState;n.prevState=r,lE(n)}for(const n of t){const r=Fu.get(n);r&&(Ua.current.push(n),ub(r))}for(const n of t){const r=Fu.get(n);if(r)for(const s of r)uE(s)}}}finally{Il=!1,Ua.current=[],Li.clear()}}function dE(e){jo++;try{e()}finally{if(jo--,jo===0){const t=Co.values().next().value;t&&db(t)}}}function fE(e){return typeof e=="function"}class hE{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var s,o;this.listeners.add(r);const i=(o=(s=this.options)==null?void 0:s.onSubscribe)==null?void 0:o.call(s,r,this);return()=>{this.listeners.delete(r),i?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,s;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):fE(t)?this.state=t(this.prevState):this.state=t,(s=(r=this.options)==null?void 0:r.onUpdate)==null||s.call(r),db(this)}}const ur="__TSR_index",Wh="popstate",Hh="beforeunload";function pE(e){let t=e.getLocation();const n=new Set,r=i=>{t=e.getLocation(),n.forEach(a=>a({location:t,action:i}))},s=i=>{e.notifyOnIndexChange??!0?r(i):t=e.getLocation()},o=async({task:i,navigateOpts:a,...c})=>{if(a?.ignoreBlocker??!1){i();return}const u=e.getBlockers?.()??[],d=c.type==="PUSH"||c.type==="REPLACE";if(typeof document<"u"&&u.length&&d)for(const f of u){const h=Wa(c.path,c.state);if(await f.blockerFn({currentLocation:t,nextLocation:h,action:c.type})){e.onBlocked?.();return}}i()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:i=>(n.add(i),()=>{n.delete(i)}),push:(i,a,c)=>{const l=t.state[ur];a=qh(l+1,a),o({task:()=>{e.pushState(i,a),r({type:"PUSH"})},navigateOpts:c,type:"PUSH",path:i,state:a})},replace:(i,a,c)=>{const l=t.state[ur];a=qh(l,a),o({task:()=>{e.replaceState(i,a),r({type:"REPLACE"})},navigateOpts:c,type:"REPLACE",path:i,state:a})},go:(i,a)=>{o({task:()=>{e.go(i),s({type:"GO",index:i})},navigateOpts:a,type:"GO"})},back:i=>{o({task:()=>{e.back(i?.ignoreBlocker??!1),s({type:"BACK"})},navigateOpts:i,type:"BACK"})},forward:i=>{o({task:()=>{e.forward(i?.ignoreBlocker??!1),s({type:"FORWARD"})},navigateOpts:i,type:"FORWARD"})},canGoBack:()=>t.state[ur]!==0,createHref:i=>e.createHref(i),block:i=>{if(!e.setBlockers)return()=>{};const a=e.getBlockers?.()??[];return e.setBlockers([...a,i]),()=>{const c=e.getBlockers?.()??[];e.setBlockers?.(c.filter(l=>l!==i))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function qh(e,t){t||(t={});const n=Yd();return{...t,key:n,__TSR_key:n,[ur]:e}}function mE(e){const t=typeof document<"u"?window:void 0,n=t.history.pushState,r=t.history.replaceState;let s=[];const o=()=>s,i=E=>s=E,a=(E=>E),c=(()=>Wa(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const E=Yd();t.history.replaceState({[ur]:0,key:E,__TSR_key:E},"")}let l=c(),u,d=!1,f=!1,h=!1,p=!1;const m=()=>l;let y,b;const x=()=>{y&&(k._ignoreSubscribers=!0,(y.isPush?t.history.pushState:t.history.replaceState)(y.state,"",y.href),k._ignoreSubscribers=!1,y=void 0,b=void 0,u=void 0)},_=(E,P,O)=>{const N=a(P);b||(u=l),l=Wa(P,O),y={href:N,state:O,isPush:y?.isPush||E==="push"},b||(b=Promise.resolve().then(()=>x()))},w=E=>{l=c(),k.notify({type:E})},S=async()=>{if(f){f=!1;return}const E=c(),P=E.state[ur]-l.state[ur],O=P===1,N=P===-1,A=!O&&!N||d;d=!1;const j=A?"GO":N?"BACK":"FORWARD",$=A?{type:"GO",index:P}:{type:N?"BACK":"FORWARD"};if(h)h=!1;else{const q=o();if(typeof document<"u"&&q.length){for(const D of q)if(await D.blockerFn({currentLocation:l,nextLocation:E,action:j})){f=!0,t.history.go(1),k.notify($);return}}}l=c(),k.notify($)},C=E=>{if(p){p=!1;return}let P=!1;const O=o();if(typeof document<"u"&&O.length)for(const N of O){const A=N.enableBeforeUnload??!0;if(A===!0){P=!0;break}if(typeof A=="function"&&A()===!0){P=!0;break}}if(P)return E.preventDefault(),E.returnValue=""},k=pE({getLocation:m,getLength:()=>t.history.length,pushState:(E,P)=>_("push",E,P),replaceState:(E,P)=>_("replace",E,P),back:E=>(E&&(h=!0),p=!0,t.history.back()),forward:E=>{E&&(h=!0),p=!0,t.history.forward()},go:E=>{d=!0,t.history.go(E)},createHref:E=>a(E),flush:x,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Hh,C,{capture:!0}),t.removeEventListener(Wh,S)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:o,setBlockers:i,notifyOnIndexChange:!1});return t.addEventListener(Hh,C,{capture:!0}),t.addEventListener(Wh,S),t.history.pushState=function(...E){const P=n.apply(t.history,E);return k._ignoreSubscribers||w("PUSH"),P},t.history.replaceState=function(...E){const P=r.apply(t.history,E);return k._ignoreSubscribers||w("REPLACE"),P},k}function gE(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function Wa(e,t){const n=gE(e),r=n.indexOf("#"),s=n.indexOf("?"),o=Yd();return{href:n,pathname:n.substring(0,r>0?s>0?Math.min(r,s):r:s>0?s:n.length),hash:r>-1?n.substring(r):"",search:s>-1?n.slice(s,r===-1?void 0:r):"",state:t||{[ur]:0,key:o,__TSR_key:o}}}function Yd(){return(Math.random()+1).toString(36).substring(7)}const yE=!1;function Lo(e){let t;return dE(()=>{t=e()}),t}function Ho(e){return e[e.length-1]}function bE(e){return typeof e=="function"}function sr(e,t){return bE(e)?e(t):e}const vE=Object.prototype.hasOwnProperty,Kh=Object.prototype.propertyIsEnumerable;function Ot(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=t,s=Yh(e)&&Yh(r);if(!s&&!(Ha(e)&&Ha(r)))return r;const o=s?e:Zh(e);if(!o)return r;const i=s?r:Zh(r);if(!i)return r;const a=o.length,c=i.length,l=s?new Array(c):{};let u=0;for(let d=0;d<c;d++){const f=s?d:i[d],h=e[f],p=r[f];if(h===p){l[f]=h,(s?d<a:vE.call(e,f))&&u++;continue}if(h===null||p===null||typeof h!="object"||typeof p!="object"){l[f]=p;continue}const m=Ot(h,p,n+1);l[f]=m,m===h&&u++}return a===c&&u===a?e:l}function Zh(e){const t=Object.getOwnPropertyNames(e);for(const s of t)if(!Kh.call(e,s))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const r=t;for(const s of n){if(!Kh.call(e,s))return!1;r.push(s)}return r}function Ha(e){if(!Gh(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!Gh(n)||!n.hasOwnProperty("isPrototypeOf"))}function Gh(e){return Object.prototype.toString.call(e)==="[object Object]"}function Yh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Wr(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,s=e.length;r<s;r++)if(!Wr(e[r],t[r],n))return!1;return!0}if(Ha(e)&&Ha(t)){const r=n?.ignoreUndefined??!0;if(n?.partial){for(const i in t)if((!r||t[i]!==void 0)&&!Wr(e[i],t[i],n))return!1;return!0}let s=0;if(!r)s=Object.keys(e).length;else for(const i in e)e[i]!==void 0&&s++;let o=0;for(const i in t)if((!r||t[i]!==void 0)&&(o++,o>s||!Wr(e[i],t[i],n)))return!1;return s===o}return!1}function Us(e){let t,n;const r=new Promise((s,o)=>{t=s,n=o});return r.status="pending",r.resolve=s=>{r.status="resolved",r.value=s,t(s),e?.(s)},r.reject=s=>{r.status="rejected",n(s)},r}function Ms(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function Xh(e,t){for(let n=e.length-1;n>=0;n--){const r=e[n];if(t(r))return r}}function xE(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function Jh(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return xE(t)}const fb=["http:","https:","mailto:","tel:"];function qa(e){if(!e)return!1;try{const t=new URL(e);return!fb.includes(t.protocol)}catch{return!1}}function fo(e,t){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return e;const n=/%25|%5C/gi;let r=0,s="",o;for(;(o=n.exec(e))!==null;)s+=Jh(e.slice(r,o.index))+o[0],r=n.lastIndex;return s=s+Jh(r?e.slice(r):e),s.startsWith("//")&&(s="/"+s.replace(/^\/+/,"")),s}function _E(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}var wE=process.env.NODE_ENV==="production",jl="Invariant failed";function qn(e,t){if(!e){if(wE)throw new Error(jl);var n=typeof t=="function"?t():t,r=n?"".concat(jl,": ").concat(n):jl;throw new Error(r)}}function Ka(e){const t=new Map;let n,r;const s=o=>{o.next&&(o.prev?(o.prev.next=o.next,o.next.prev=o.prev,o.next=void 0,r&&(r.next=o,o.prev=r)):(o.next.prev=void 0,n=o.next,o.next=void 0,r&&(o.prev=r,r.next=o)),r=o)};return{get(o){const i=t.get(o);if(i)return s(i),i.value},set(o,i){if(t.size>=e&&n){const c=n;t.delete(c.key),c.next&&(n=c.next,c.next.prev=void 0),c===r&&(r=void 0)}const a=t.get(o);if(a)a.value=i,s(a);else{const c={key:o,value:i,prev:r};r&&(r.next=c),r=c,n||(n=c),t.set(o,c)}},clear(){t.clear(),n=void 0,r=void 0}}}const Ws=0,Yr=1,Xr=2,qo=3,Fr=4,hb=5;function SE(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function Xd(e,t,n=new Uint16Array(6)){const r=e.indexOf("/",t),s=r===-1?e.length:r,o=e.substring(t,s);if(!o||!o.includes("$"))return n[0]=Ws,n[1]=t,n[2]=t,n[3]=s,n[4]=s,n[5]=s,n;if(o==="$"){const a=e.length;return n[0]=Xr,n[1]=t,n[2]=t,n[3]=a,n[4]=a,n[5]=a,n}if(o.charCodeAt(0)===36)return n[0]=Yr,n[1]=t,n[2]=t+1,n[3]=s,n[4]=s,n[5]=s,n;const i=SE(o);if(i){const[a,c]=i,l=o.charCodeAt(a+1);if(l===45){if(a+2<o.length&&o.charCodeAt(a+2)===36){const u=a+3,d=c;if(u<d)return n[0]=qo,n[1]=t+a,n[2]=t+u,n[3]=t+d,n[4]=t+c+1,n[5]=s,n}}else if(l===36){const u=a+1,d=a+2;return d===c?(n[0]=Xr,n[1]=t+a,n[2]=t+u,n[3]=t+d,n[4]=t+c+1,n[5]=e.length,n):(n[0]=Yr,n[1]=t+a,n[2]=t+d,n[3]=t+c,n[4]=t+c+1,n[5]=s,n)}}return n[0]=Ws,n[1]=t,n[2]=t,n[3]=s,n[4]=s,n[5]=s,n}function jc(e,t,n,r,s,o,i){i?.(n);let a=r;{const c=n.fullPath??n.from,l=c.length,u=n.options?.caseSensitive??e,d=!!(n.options?.params?.parse&&n.options?.skipRouteOnParseError?.params);for(;a<l;){const h=Xd(c,a,t);let p;const m=a,y=h[5];switch(a=y+1,o++,h[0]){case Ws:{const x=c.substring(h[2],h[3]);if(u){const _=s.static?.get(x);if(_)p=_;else{s.static??=new Map;const w=zr(n.fullPath??n.from);w.parent=s,w.depth=o,p=w,s.static.set(x,w)}}else{const _=x.toLowerCase(),w=s.staticInsensitive?.get(_);if(w)p=w;else{s.staticInsensitive??=new Map;const S=zr(n.fullPath??n.from);S.parent=s,S.depth=o,p=S,s.staticInsensitive.set(_,S)}}break}case Yr:{const x=c.substring(m,h[1]),_=c.substring(h[4],y),w=u&&!!(x||_),S=x?w?x:x.toLowerCase():void 0,C=_?w?_:_.toLowerCase():void 0,k=!d&&s.dynamic?.find(E=>!E.skipOnParamError&&E.caseSensitive===w&&E.prefix===S&&E.suffix===C);if(k)p=k;else{const E=Fl(Yr,n.fullPath??n.from,w,S,C);p=E,E.depth=o,E.parent=s,s.dynamic??=[],s.dynamic.push(E)}break}case qo:{const x=c.substring(m,h[1]),_=c.substring(h[4],y),w=u&&!!(x||_),S=x?w?x:x.toLowerCase():void 0,C=_?w?_:_.toLowerCase():void 0,k=!d&&s.optional?.find(E=>!E.skipOnParamError&&E.caseSensitive===w&&E.prefix===S&&E.suffix===C);if(k)p=k;else{const E=Fl(qo,n.fullPath??n.from,w,S,C);p=E,E.parent=s,E.depth=o,s.optional??=[],s.optional.push(E)}break}case Xr:{const x=c.substring(m,h[1]),_=c.substring(h[4],y),w=u&&!!(x||_),S=x?w?x:x.toLowerCase():void 0,C=_?w?_:_.toLowerCase():void 0,k=Fl(Xr,n.fullPath??n.from,w,S,C);p=k,k.parent=s,k.depth=o,s.wildcard??=[],s.wildcard.push(k)}}s=p}if(d&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const h=zr(n.fullPath??n.from);h.kind=hb,h.parent=s,o++,h.depth=o,s.pathless??=[],s.pathless.push(h),s=h}const f=(n.path||!n.children)&&!n.isRoot;if(f&&c.endsWith("/")){const h=zr(n.fullPath??n.from);h.kind=Fr,h.parent=s,o++,h.depth=o,s.index=h,s=h}s.parse=n.options?.params?.parse??null,s.skipOnParamError=d,s.parsingPriority=n.options?.skipRouteOnParseError?.priority??0,f&&!s.route&&(s.route=n,s.fullPath=n.fullPath??n.from)}if(n.children)for(const c of n.children)jc(e,t,c,a,s,o,i)}function Ll(e,t){if(e.skipOnParamError&&!t.skipOnParamError)return-1;if(!e.skipOnParamError&&t.skipOnParamError)return 1;if(e.skipOnParamError&&t.skipOnParamError&&(e.parsingPriority||t.parsingPriority))return t.parsingPriority-e.parsingPriority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function rr(e){if(e.pathless)for(const t of e.pathless)rr(t);if(e.static)for(const t of e.static.values())rr(t);if(e.staticInsensitive)for(const t of e.staticInsensitive.values())rr(t);if(e.dynamic?.length){e.dynamic.sort(Ll);for(const t of e.dynamic)rr(t)}if(e.optional?.length){e.optional.sort(Ll);for(const t of e.optional)rr(t)}if(e.wildcard?.length){e.wildcard.sort(Ll);for(const t of e.wildcard)rr(t)}}function zr(e){return{kind:Ws,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function Fl(e,t,n,r,s){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:n,prefix:r,suffix:s}}function EE(e,t){const n=zr("/"),r=new Uint16Array(6);for(const s of e)jc(!1,r,s,1,n,0);rr(n),t.masksTree=n,t.flatCache=Ka(1e3)}function kE(e,t){e||="/";const n=t.flatCache.get(e);if(n)return n;const r=Jd(e,t.masksTree);return t.flatCache.set(e,r),r}function CE(e,t,n,r,s){e||="/",r||="/";const o=t?`case\0${e}`:e;let i=s.singleCache.get(o);if(!i){i=zr("/");const a=new Uint16Array(6);jc(t,a,{from:e},1,i,0),s.singleCache.set(o,i)}return Jd(r,i,n)}function RE(e,t,n=!1){const r=n?e:`nofuzz\0${e}`,s=t.matchCache.get(r);if(s!==void 0)return s;e||="/";let o;try{o=Jd(e,t.segmentTree,n)}catch(i){if(i instanceof URIError)o=null;else throw i}return o&&(o.branch=TE(o.route)),t.matchCache.set(r,o),o}function PE(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function OE(e,t=!1,n){const r=zr(e.fullPath),s=new Uint16Array(6),o={},i={};let a=0;return jc(t,s,e,1,r,0,l=>{if(n?.(l,a),qn(!(l.id in o),`Duplicate routes found with id: ${String(l.id)}`),o[l.id]=l,a!==0&&l.path){const u=PE(l.fullPath);(!i[u]||l.fullPath.endsWith("/"))&&(i[u]=l)}a++}),rr(r),{processedTree:{segmentTree:r,singleCache:Ka(1e3),matchCache:Ka(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:i}}function Jd(e,t,n=!1){const r=e.split("/"),s=AE(e,r,t,n);if(!s)return null;const[o]=pb(e,r,s);return{route:s.node.route,rawParams:o,parsedParams:s.parsedParams}}function pb(e,t,n){const r=ME(n.node);let s=null;const o={};let i=n.extract?.part??0,a=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;a<r.length;i++,a++,c++,l++){const u=r[a];if(u.kind===Fr)break;if(u.kind===hb){l--,i--,c--;continue}const d=t[i],f=c;if(d&&(c+=d.length),u.kind===Yr){s??=n.node.fullPath.split("/");const h=s[l],p=u.prefix?.length??0;if(h.charCodeAt(p)===123){const y=u.suffix?.length??0,b=h.substring(p+2,h.length-y-1),x=d.substring(p,d.length-y);o[b]=decodeURIComponent(x)}else{const y=h.substring(1);o[y]=decodeURIComponent(d)}}else if(u.kind===qo){if(n.skipped&1<<a){i--,c=f-1;continue}s??=n.node.fullPath.split("/");const h=s[l],p=u.prefix?.length??0,m=u.suffix?.length??0,y=h.substring(p+3,h.length-m-1),b=u.suffix||u.prefix?d.substring(p,d.length-m):d;b&&(o[y]=decodeURIComponent(b))}else if(u.kind===Xr){const h=u,p=e.substring(f+(h.prefix?.length??0),e.length-(h.suffix?.length??0)),m=decodeURIComponent(p);o["*"]=m,o._splat=m;break}}return n.rawParams&&Object.assign(o,n.rawParams),[o,{part:i,node:a,path:c,segment:l}]}function TE(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function ME(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function AE(e,t,n,r){if(e==="/"&&n.index)return{node:n.index,skipped:0};const s=!Ho(t),o=s&&e!=="/",i=t.length-(s?1:0),a=[{node:n,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}];let c=null,l=null,u=null;for(;a.length;){const d=a.pop(),{node:f,index:h,skipped:p,depth:m,statics:y,dynamics:b,optionals:x}=d;let{extract:_,rawParams:w,parsedParams:S}=d;if(f.skipOnParamError){if(!zl(e,t,d))continue;w=d.rawParams,_=d.extract,S=d.parsedParams}r&&f.route&&f.kind!==Fr&&ho(l,d)&&(l=d);const C=h===i;if(C&&(f.route&&!o&&ho(u,d)&&(u=d),!f.optional&&!f.wildcard&&!f.index&&!f.pathless))continue;const k=C?void 0:t[h];let E;if(C&&f.index){const P={node:f.index,index:h,skipped:p,depth:m+1,statics:y,dynamics:b,optionals:x,extract:_,rawParams:w,parsedParams:S};let O=!0;if(f.index.skipOnParamError&&(zl(e,t,P)||(O=!1)),O){if(y===i&&!b&&!x&&!p)return P;ho(u,P)&&(u=P)}}if(f.wildcard&&ho(c,d))for(const P of f.wildcard){const{prefix:O,suffix:N}=P;if(O&&(C||!(P.caseSensitive?k:E??=k.toLowerCase()).startsWith(O)))continue;if(N){if(C)continue;const j=t.slice(h).join("/").slice(-N.length);if((P.caseSensitive?j:j.toLowerCase())!==N)continue}const A={node:P,index:i,skipped:p,depth:m,statics:y,dynamics:b,optionals:x,extract:_,rawParams:w,parsedParams:S};if(!(P.skipOnParamError&&!zl(e,t,A))){c=A;break}}if(f.optional){const P=p|1<<m,O=m+1;for(let N=f.optional.length-1;N>=0;N--){const A=f.optional[N];a.push({node:A,index:h,skipped:P,depth:O,statics:y,dynamics:b,optionals:x,extract:_,rawParams:w,parsedParams:S})}if(!C)for(let N=f.optional.length-1;N>=0;N--){const A=f.optional[N],{prefix:j,suffix:$}=A;if(j||$){const q=A.caseSensitive?k:E??=k.toLowerCase();if(j&&!q.startsWith(j)||$&&!q.endsWith($))continue}a.push({node:A,index:h+1,skipped:p,depth:O,statics:y,dynamics:b,optionals:x+1,extract:_,rawParams:w,parsedParams:S})}}if(!C&&f.dynamic&&k)for(let P=f.dynamic.length-1;P>=0;P--){const O=f.dynamic[P],{prefix:N,suffix:A}=O;if(N||A){const j=O.caseSensitive?k:E??=k.toLowerCase();if(N&&!j.startsWith(N)||A&&!j.endsWith(A))continue}a.push({node:O,index:h+1,skipped:p,depth:m+1,statics:y,dynamics:b+1,optionals:x,extract:_,rawParams:w,parsedParams:S})}if(!C&&f.staticInsensitive){const P=f.staticInsensitive.get(E??=k.toLowerCase());P&&a.push({node:P,index:h+1,skipped:p,depth:m+1,statics:y+1,dynamics:b,optionals:x,extract:_,rawParams:w,parsedParams:S})}if(!C&&f.static){const P=f.static.get(k);P&&a.push({node:P,index:h+1,skipped:p,depth:m+1,statics:y+1,dynamics:b,optionals:x,extract:_,rawParams:w,parsedParams:S})}if(f.pathless){const P=m+1;for(let O=f.pathless.length-1;O>=0;O--){const N=f.pathless[O];a.push({node:N,index:h,skipped:p,depth:P,statics:y,dynamics:b,optionals:x,extract:_,rawParams:w,parsedParams:S})}}}if(u&&c)return ho(c,u)?u:c;if(u)return u;if(c)return c;if(r&&l){let d=l.index;for(let h=0;h<l.index;h++)d+=t[h].length;const f=d===e.length?"/":e.slice(d);return l.rawParams??={},l.rawParams["**"]=decodeURIComponent(f),l}return null}function zl(e,t,n){try{const[r,s]=pb(e,t,n);n.rawParams=r,n.extract=s;const o=n.node.parse(r);return n.parsedParams=Object.assign({},n.parsedParams,o),!0}catch{return null}}function ho(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Fr)>(e.node.kind===Fr)||t.node.kind===Fr==(e.node.kind===Fr)&&t.depth>e.depth))):!0}function Ea(e){return Qd(e.filter(t=>t!==void 0).join("/"))}function Qd(e){return e.replace(/\/{2,}/g,"/")}function mb(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Vn(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function gb(e){return Vn(mb(e))}function Za(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function NE(e,t,n){return Za(e,n)===Za(t,n)}function DE({base:e,to:t,trailingSlash:n="never",cache:r}){const s=t.startsWith("/"),o=!s&&t===".";let i;if(r){i=s?t:o?e:e+"\0"+t;const d=r.get(i);if(d)return d}let a;if(o)a=e.split("/");else if(s)a=t.split("/");else{for(a=e.split("/");a.length>1&&Ho(a)==="";)a.pop();const d=t.split("/");for(let f=0,h=d.length;f<h;f++){const p=d[f];p===""?f?f===h-1&&a.push(p):a=[p]:p===".."?a.pop():p==="."||a.push(p)}}a.length>1&&(Ho(a)===""?n==="never"&&a.pop():n==="always"&&a.push(""));let c,l="";for(let d=0;d<a.length;d++){d>0&&(l+="/");const f=a[d];if(!f)continue;c=Xd(f,0,c);const h=c[0];if(h===Ws){l+=f;continue}const p=c[5],m=f.substring(0,c[1]),y=f.substring(c[4],p),b=f.substring(c[2],c[3]);h===Yr?l+=m||y?`${m}{$${b}}${y}`:`$${b}`:h===Xr?l+=m||y?`${m}{$}${y}`:"$":l+=`${m}{-$${b}}${y}`}l=Qd(l);const u=l||"/";return i&&r&&r.set(i,u),u}function IE(e){const t=new Map(e.map(s=>[encodeURIComponent(s),s])),n=Array.from(t.keys()).map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(n,"g");return s=>s.replace(r,o=>t.get(o)??o)}function $l(e,t,n){const r=t[e];return typeof r!="string"?r:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(s=>Qh(s,n)).join("/"):Qh(r,n)}function Vl({path:e,params:t,decoder:n,server:r}){let s=!1;const o={};if(!e||e==="/")return{interpolatedPath:"/",usedParams:o,isMissingParams:s};if(!e.includes("$"))return{interpolatedPath:e,usedParams:o,isMissingParams:s};const i=e.length;let a=0,c,l="";for(;a<i;){const d=a;c=Xd(e,d,c);const f=c[5];if(a=f+1,d===f)continue;const h=c[0];if(h===Ws){l+="/"+e.substring(d,f);continue}if(h===Xr){const p=t._splat;o._splat=p,o["*"]=p;const m=e.substring(d,c[1]),y=e.substring(c[4],f);if(!p){s=!0,(m||y)&&(l+="/"+m+y);continue}const b=$l("_splat",t,n);l+="/"+m+b+y;continue}if(h===Yr){const p=e.substring(c[2],c[3]);!s&&!(p in t)&&(s=!0),o[p]=t[p];const m=e.substring(d,c[1]),y=e.substring(c[4],f),b=$l(p,t,n)??"undefined";l+="/"+m+b+y;continue}if(h===qo){const p=e.substring(c[2],c[3]),m=t[p];if(m==null)continue;o[p]=m;const y=e.substring(d,c[1]),b=e.substring(c[4],f),x=$l(p,t,n)??"";l+="/"+y+x+b;continue}}return e.endsWith("/")&&(l+="/"),{usedParams:o,interpolatedPath:l||"/",isMissingParams:s}}function Qh(e,t){const n=encodeURIComponent(e);return t?.(n)??n}function Wt(e){return!!e?.isNotFound}function jE(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}const zu="tsr-scroll-restoration-v1_3",LE=(e,t)=>{let n;return(...r)=>{n||(n=setTimeout(()=>{e(...r),n=null},t))}};function FE(){const e=jE();if(!e)return null;const t=e.getItem(zu);let n=t?JSON.parse(t):{};return{state:n,set:r=>{n=sr(r,n)||n;try{e.setItem(zu,JSON.stringify(n))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}const Fi=FE(),zE=e=>e.state.__TSR_key||e.href;function $E(e){const t=[];let n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(" > ")}`.toLowerCase()}let Ga=!1;function VE({storageKey:e,key:t,behavior:n,shouldScrollRestoration:r,scrollToTopSelectors:s,location:o}){let i;try{i=JSON.parse(sessionStorage.getItem(e)||"{}")}catch(l){console.error(l);return}const a=t||window.history.state?.__TSR_key,c=i[a];Ga=!0;e:{if(r&&c&&Object.keys(c).length>0){for(const d in c){const f=c[d];if(d==="window")window.scrollTo({top:f.scrollY,left:f.scrollX,behavior:n});else if(d){const h=document.querySelector(d);h&&(h.scrollLeft=f.scrollX,h.scrollTop=f.scrollY)}}break e}const l=(o??window.location).hash.split("#",2)[1];if(l){const d=window.history.state?.__hashScrollIntoViewOptions??!0;if(d){const f=document.getElementById(l);f&&f.scrollIntoView(d)}break e}const u={top:0,left:0,behavior:n};if(window.scrollTo(u),s)for(const d of s){if(d==="window")continue;const f=typeof d=="function"?d():document.querySelector(d);f&&f.scrollTo(u)}}Ga=!1}function BE(e,t){if(!Fi||((e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!Fi))return;e.isScrollRestorationSetup=!0,Ga=!1;const r=e.options.getScrollRestorationKey||zE;window.history.scrollRestoration="manual";const s=o=>{if(Ga||!e.isScrollRestoring)return;let i="";if(o.target===document||o.target===window)i="window";else{const c=o.target.getAttribute("data-scroll-restoration-id");c?i=`[data-scroll-restoration-id="${c}"]`:i=$E(o.target)}const a=r(e.state.location);Fi.set(c=>{const l=c[a]||={},u=l[i]||={};if(i==="window")u.scrollX=window.scrollX||0,u.scrollY=window.scrollY||0;else if(i){const d=document.querySelector(i);d&&(u.scrollX=d.scrollLeft||0,u.scrollY=d.scrollTop||0)}return c})};typeof document<"u"&&document.addEventListener("scroll",LE(s,100),!0),e.subscribe("onRendered",o=>{const i=r(o.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation})||(VE({storageKey:zu,key:i,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&Fi.set(a=>(a[i]||={},a)))})}function UE(e){if(typeof document<"u"&&document.querySelector){const t=e.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&e.state.location.hash!==""){const n=document.getElementById(e.state.location.hash);n&&n.scrollIntoView(t)}}}function WE(e,t=String){const n=new URLSearchParams;for(const r in e){const s=e[r];s!==void 0&&n.set(r,t(s))}return n.toString()}function Bl(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function HE(e){const t=new URLSearchParams(e),n={};for(const[r,s]of t.entries()){const o=n[r];o==null?n[r]=Bl(s):Array.isArray(o)?o.push(Bl(s)):n[r]=[o,Bl(s)]}return n}const qE=ZE(JSON.parse),KE=GE(JSON.stringify,JSON.parse);function ZE(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=HE(t);for(const r in n){const s=n[r];if(typeof s=="string")try{n[r]=e(s)}catch{}}return n}}function GE(e,t){const n=typeof t=="function";function r(s){if(typeof s=="object"&&s!==null)try{return e(s)}catch{}else if(n&&typeof s=="string")try{return t(s),e(s)}catch{}return s}return s=>{const o=WE(s,r);return o?`?${o}`:""}}const Gt="__root__";function yb(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&typeof e.href=="string"&&qa(e.href))throw new Error(`Redirect blocked: unsafe protocol in href "${e.href}". Only ${fb.join(", ")} protocols are allowed.`);if(!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Jt(e){return e instanceof Response&&!!e.options}const ka=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Lc=(e,t)=>!!(e.preload&&!e.router.state.matches.some(n=>n.id===t)),As=(e,t,n=!0)=>{const r={...e.router.options.context??{}},s=n?t:t-1;for(let o=0;o<=s;o++){const i=e.matches[o];if(!i)continue;const a=e.router.getMatch(i.id);a&&Object.assign(r,a.__routeContext,a.__beforeLoadContext)}return r},bb=(e,t)=>{const n=e.router.routesById[t.routeId??""]??e.router.routeTree;!n.options.notFoundComponent&&e.router.options?.defaultNotFoundComponent&&(n.options.notFoundComponent=e.router.options.defaultNotFoundComponent),qn(n.options.notFoundComponent,"No notFoundComponent found. Please set a notFoundComponent on your route or provide a defaultNotFoundComponent to the router.");const r=e.matches.find(s=>s.routeId===n.id);qn(r,"Could not find match for route: "+n.id),e.updateMatch(r.id,s=>({...s,status:"notFound",error:t,isFetching:!1})),t.routerCode==="BEFORE_LOAD"&&n.parentRoute&&(t.routeId=n.parentRoute.id,bb(e,t))},or=(e,t,n)=>{if(!(!Jt(n)&&!Wt(n))){if(Jt(n)&&n.redirectHandled&&!n.options.reloadDocument)throw n;if(t){t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0;const r=Jt(n)?"redirected":"notFound";t._nonReactive.error=n,e.updateMatch(t.id,s=>({...s,status:r,context:As(e,t.index),isFetching:!1,error:n})),Wt(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()}throw Jt(n)?(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n),n):(bb(e,n),n)}},vb=(e,t)=>!!e.router.getMatch(t)._nonReactive.dehydrated,po=(e,t,n,r)=>{const{id:s,routeId:o}=e.matches[t],i=e.router.looseRoutesById[o];if(n instanceof Promise)throw n;n.routerCode=r,e.firstBadMatchIndex??=t,or(e,e.router.getMatch(s),n);try{i.options.onError?.(n)}catch(a){n=a,or(e,e.router.getMatch(s),n)}e.updateMatch(s,a=>(a._nonReactive.beforeLoadPromise?.resolve(),a._nonReactive.beforeLoadPromise=void 0,a._nonReactive.loadPromise?.resolve(),{...a,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}))},xb=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;const s=n.options.pendingMs??e.router.options.defaultPendingMs;if(!!(e.onReady&&!Lc(e,t)&&(n.options.loader||n.options.beforeLoad||Sb(n))&&typeof s=="number"&&s!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent))){const i=setTimeout(()=>{ka(e)},s);r._nonReactive.pendingTimeout=i}},YE=(e,t,n)=>{const r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;xb(e,t,n,r);const s=()=>{const o=e.router.getMatch(t);o.preload&&(o.status==="redirected"||o.status==="notFound")&&or(e,o,o.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(s):s()},XE=(e,t,n,r)=>{const s=e.router.getMatch(t),o=s._nonReactive.loadPromise;s._nonReactive.loadPromise=Us(()=>{o?.resolve()});const{paramsError:i,searchError:a}=s;i&&po(e,n,i,"PARSE_PARAMS"),a&&po(e,n,a,"VALIDATE_SEARCH"),xb(e,t,r,s);const c=new AbortController;let l=!1;const u=()=>{l||(l=!0,e.updateMatch(t,w=>({...w,isFetching:"beforeLoad",fetchCount:w.fetchCount+1,abortController:c})))},d=()=>{s._nonReactive.beforeLoadPromise?.resolve(),s._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,w=>({...w,isFetching:!1}))};if(!r.options.beforeLoad){Lo(()=>{u(),d()});return}s._nonReactive.beforeLoadPromise=Us();const f={...As(e,n,!1),...s.__routeContext},{search:h,params:p,cause:m}=s,y=Lc(e,t),b={search:h,abortController:c,params:p,preload:y,context:f,location:e.location,navigate:w=>e.router.navigate({...w,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:y?"preload":m,matches:e.matches,...e.router.options.additionalContext},x=w=>{if(w===void 0){Lo(()=>{u(),d()});return}(Jt(w)||Wt(w))&&(u(),po(e,n,w,"BEFORE_LOAD")),Lo(()=>{u(),e.updateMatch(t,S=>({...S,__beforeLoadContext:w})),d()})};let _;try{if(_=r.options.beforeLoad(b),Ms(_))return u(),_.catch(w=>{po(e,n,w,"BEFORE_LOAD")}).then(x)}catch(w){u(),po(e,n,w,"BEFORE_LOAD")}x(_)},JE=(e,t)=>{const{id:n,routeId:r}=e.matches[t],s=e.router.looseRoutesById[r],o=()=>a(),i=()=>XE(e,n,t,s),a=()=>{if(vb(e,n))return;const c=YE(e,n,s);return Ms(c)?c.then(i):i()};return o()},QE=(e,t,n)=>{const r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const s={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(s),n.options.scripts?.(s),n.options.headers?.(s)]).then(([o,i,a])=>{const c=o?.meta,l=o?.links,u=o?.scripts,d=o?.styles;return{meta:c,links:l,headScripts:u,headers:a,scripts:i,styles:d}})},_b=(e,t,n,r)=>{const s=e.matchPromises[n-1],{params:o,loaderDeps:i,abortController:a,cause:c}=e.router.getMatch(t),l=As(e,n),u=Lc(e,t);return{params:o,deps:i,preload:!!u,parentMatchPromise:s,abortController:a,context:l,location:e.location,navigate:d=>e.router.navigate({...d,_fromLocation:e.location}),cause:u?"preload":c,route:r,...e.router.options.additionalContext}},ep=async(e,t,n,r)=>{try{const s=e.router.getMatch(t);try{(!(yE??e.router.isServer)||s.ssr===!0)&&wb(r);const o=r.options.loader?.(_b(e,t,n,r)),i=r.options.loader&&Ms(o);if((i||r._lazyPromise||r._componentsPromise||r.options.head||r.options.scripts||r.options.headers||s._nonReactive.minPendingPromise)&&e.updateMatch(t,l=>({...l,isFetching:"loader"})),r.options.loader){const l=i?await o:o;or(e,e.router.getMatch(t),l),l!==void 0&&e.updateMatch(t,u=>({...u,loaderData:l}))}r._lazyPromise&&await r._lazyPromise;const c=s._nonReactive.minPendingPromise;c&&await c,r._componentsPromise&&await r._componentsPromise,e.updateMatch(t,l=>({...l,error:void 0,context:As(e,n),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(o){let i=o;if(i?.name==="AbortError"){e.updateMatch(t,c=>({...c,status:c.status==="pending"?"success":c.status,isFetching:!1,context:As(e,n)}));return}const a=s._nonReactive.minPendingPromise;a&&await a,Wt(o)&&await r.options.notFoundComponent?.preload?.(),or(e,e.router.getMatch(t),o);try{r.options.onError?.(o)}catch(c){i=c,or(e,e.router.getMatch(t),c)}e.updateMatch(t,c=>({...c,error:i,context:As(e,n),status:"error",isFetching:!1}))}}catch(s){const o=e.router.getMatch(t);o&&(o._nonReactive.loaderPromise=void 0),or(e,o,s)}},ek=async(e,t)=>{const{id:n,routeId:r}=e.matches[t];let s=!1,o=!1;const i=e.router.looseRoutesById[r];if(!vb(e,n)){const l=e.router.getMatch(n);if(l._nonReactive.loaderPromise){if(l.status==="success"&&!e.sync&&!l.preload)return l;await l._nonReactive.loaderPromise;const u=e.router.getMatch(n),d=u._nonReactive.error||u.error;d&&or(e,u,d)}else{const u=Date.now()-l.updatedAt,d=Lc(e,n),f=d?i.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:i.options.staleTime??e.router.options.defaultStaleTime??0,h=i.options.shouldReload,p=typeof h=="function"?h(_b(e,n,t,i)):h,m=!!d&&!e.router.state.matches.some(_=>_.id===n),y=e.router.getMatch(n);y._nonReactive.loaderPromise=Us(),m!==y.preload&&e.updateMatch(n,_=>({..._,preload:m}));const{status:b,invalid:x}=y;s=b==="success"&&(x||(p??u>f)),d&&i.options.preload===!1||(s&&!e.sync?(o=!0,(async()=>{try{await ep(e,n,t,i);const _=e.router.getMatch(n);_._nonReactive.loaderPromise?.resolve(),_._nonReactive.loadPromise?.resolve(),_._nonReactive.loaderPromise=void 0}catch(_){Jt(_)&&await e.router.navigate(_.options)}})()):(b!=="success"||s&&e.sync)&&await ep(e,n,t,i))}}const a=e.router.getMatch(n);o||(a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loadPromise?.resolve()),clearTimeout(a._nonReactive.pendingTimeout),a._nonReactive.pendingTimeout=void 0,o||(a._nonReactive.loaderPromise=void 0),a._nonReactive.dehydrated=void 0;const c=o?a.isFetching:!1;return c!==a.isFetching||a.invalid!==!1?(e.updateMatch(n,l=>({...l,isFetching:c,invalid:!1})),e.router.getMatch(n)):a};async function tp(e){const t=Object.assign(e,{matchPromises:[]});t.router.state.matches.some(n=>n._forcePending)&&ka(t);try{for(let a=0;a<t.matches.length;a++){const c=JE(t,a);Ms(c)&&await c}const n=t.firstBadMatchIndex??t.matches.length;for(let a=0;a<n;a++)t.matchPromises.push(ek(t,a));const s=(await Promise.allSettled(t.matchPromises)).filter(a=>a.status==="rejected").map(a=>a.reason);let o;for(const a of s){if(Jt(a))throw a;!o&&Wt(a)&&(o=a)}for(const a of t.matches){const{id:c,routeId:l}=a,u=t.router.looseRoutesById[l];try{const d=QE(t,c,u);if(d){const f=await d;t.updateMatch(c,h=>({...h,...f}))}}catch(d){console.error(`Error executing head for route ${l}:`,d)}}if(o)throw o;const i=ka(t);Ms(i)&&await i}catch(n){if(Wt(n)&&!t.preload){const r=ka(t);throw Ms(r)&&await r,n}if(Jt(n))throw n}return t.matches}async function wb(e){if(!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{const{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0),!e._componentsLoaded&&e._componentsPromise===void 0){const t=()=>{const n=[];for(const r of Eb){const s=e.options[r]?.preload;s&&n.push(s())}if(n.length)return Promise.all(n).then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0});e._componentsLoaded=!0,e._componentsPromise=void 0};e._componentsPromise=e._lazyPromise?e._lazyPromise.then(t):t()}return e._componentsPromise}function Sb(e){for(const t of Eb)if(e.options[t]?.preload)return!0;return!1}const Eb=["component","errorComponent","pendingComponent","notFoundComponent"];function tk(e){return{input:({url:t})=>{for(const n of e)t=$u(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=kb(e[n],t);return t}}}function nk(e){const t=gb(e.basepath),n=`/${t}`,r=`${n}/`,s=e.caseSensitive?n:n.toLowerCase(),o=e.caseSensitive?r:r.toLowerCase();return{input:({url:i})=>{const a=e.caseSensitive?i.pathname:i.pathname.toLowerCase();return a===s?i.pathname="/":a.startsWith(o)&&(i.pathname=i.pathname.slice(n.length)),i},output:({url:i})=>(i.pathname=Ea(["/",t,i.pathname]),i)}}function $u(e,t){const n=e?.input?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function kb(e,t){const n=e?.output?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function Hr(e){const t=e.resolvedLocation,n=e.location,r=t?.pathname!==n.pathname,s=t?.href!==n.href,o=t?.hash!==n.hash;return{fromLocation:t,toLocation:n,pathChanged:r,hrefChanged:s,hashChanged:o}}class rk{constructor(t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=n=>n(),this.update=n=>{n.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const r=this.options,s=this.basepath??r?.basepath??"/",o=this.basepath===void 0,i=r?.rewrite;if(this.options={...r,...n},this.isServer=this.options.isServer??typeof document>"u",this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=IE(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=mE()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let f;this.resolvePathCache=Ka(1e3),f=this.buildRouteTree(),this.setRoutes(f)}!this.__store&&this.latestLocation&&(this.__store=new hE(ok(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(f=>!["redirected"].includes(f.status))}}}),BE(this));let a=!1;const c=this.options.basepath??"/",l=this.options.rewrite;if(o||s!==c||i!==l){this.basepath=c;const f=[],h=gb(c);h&&h!=="/"&&f.push(nk({basepath:c})),l&&f.push(l),this.rewrite=f.length===0?void 0:f.length===1?f[0]:tk(f),this.history&&this.updateLatestLocation(),a=!0}a&&this.__store&&(this.__store.state={...this.state,location:this.latestLocation}),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const n=OE(this.routeTree,this.options.caseSensitive,(r,s)=>{r.init({originalIndex:s})});return this.options.routeMasks&&EE(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,r)=>{const s={eventType:n,fn:r};return this.subscribers.add(s),()=>{this.subscribers.delete(s)}},this.emit=n=>{this.subscribers.forEach(r=>{r.eventType===n.type&&r.fn(n)})},this.parseLocation=(n,r)=>{const s=({pathname:c,search:l,hash:u,href:d,state:f})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(c)){const x=this.options.parseSearch(l),_=this.options.stringifySearch(x);return{href:c+_+u,publicHref:d,pathname:fo(c),external:!1,searchStr:_,search:Ot(r?.search,x),hash:fo(u.slice(1)),state:Ot(r?.state,f)}}const h=new URL(d,this.origin),p=$u(this.rewrite,h),m=this.options.parseSearch(p.search),y=this.options.stringifySearch(m);return p.search=y,{href:p.href.replace(p.origin,""),publicHref:d,pathname:fo(p.pathname),external:!!this.rewrite&&p.origin!==this.origin,searchStr:y,search:Ot(r?.search,m),hash:fo(p.hash.slice(1)),state:Ot(r?.state,f)}},o=s(n),{__tempLocation:i,__tempKey:a}=o.state;if(i&&(!a||a===this.tempLocationKey)){const c=s(i);return c.state.key=o.state.key,c.state.__TSR_key=o.state.__TSR_key,delete c.state.__tempLocation,{...c,maskedLocation:o}}return o},this.resolvePathWithBase=(n,r)=>DE({base:n,to:Qd(r),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,r,s)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:r},s):this.matchRoutesInternal(n,r),this.getMatchedRoutes=n=>ik({pathname:n,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=n=>{const r=this.getMatch(n);r&&(r.abortController.abort(),clearTimeout(r._nonReactive.pendingTimeout),r._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const n=this.state.matches.filter(o=>o.status==="pending"),r=this.state.matches.filter(o=>o.isFetching==="loader");new Set([...this.state.pendingMatches??[],...n,...r]).forEach(o=>{this.cancelMatch(o.id)})},this.buildLocation=n=>{const r=(o={})=>{const i=o._fromLocation||this.pendingBuiltLocation||this.latestLocation,a=this.matchRoutesLightweight(i);if(o.from&&process.env.NODE_ENV!=="production"&&o._isNavigate){const j=this.getMatchedRoutes(o.from).matchedRoutes,$=Xh(a.matchedRoutes,D=>rp(D.fullPath,o.from)),q=Xh(j,D=>rp(D.fullPath,a.fullPath));!$&&!q&&console.warn(`Could not find match for from: ${o.from}`)}const c=o.unsafeRelative==="path"?i.pathname:o.from??a.fullPath,l=this.resolvePathWithBase(c,"."),u=a.search,d={...a.params},f=o.to?this.resolvePathWithBase(l,`${o.to}`):this.resolvePathWithBase(l,"."),h=o.params===!1||o.params===null?{}:(o.params??!0)===!0?d:Object.assign(d,sr(o.params,d)),p=Vl({path:f,params:h,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath,m=this.getMatchedRoutes(p);let y=m.matchedRoutes;(m.foundRoute?m.foundRoute.path!=="/"&&m.routeParams["**"]:Vn(p))&&this.options.notFoundRoute&&(y=[...y,this.options.notFoundRoute]);let x=!1;if(Object.keys(h).length>0)for(const j of y){const $=j.options.params?.stringify??j.options.stringifyParams;$&&(x=!0,Object.assign(h,$(h)))}const _=n.leaveParams?f:fo(x?Vl({path:f,params:h,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath:p);let w=u;if(n._includeValidateSearch&&this.options.search?.strict){const j={};y.forEach($=>{if($.options.validateSearch)try{Object.assign(j,Ca($.options.validateSearch,{...j,...w}))}catch{}}),w=j}w=ak({search:w,dest:o,destRoutes:y,_includeValidateSearch:n._includeValidateSearch}),w=Ot(u,w);const S=this.options.stringifySearch(w),C=o.hash===!0?i.hash:o.hash?sr(o.hash,i.hash):void 0,k=C?`#${C}`:"";let E=o.state===!0?i.state:o.state?sr(o.state,i.state):{};E=Ot(i.state,E);const P=`${_}${S}${k}`;let O,N,A=!1;if(this.rewrite){const j=new URL(P,this.origin),$=kb(this.rewrite,j);O=j.href.replace(j.origin,""),$.origin!==this.origin?(N=$.href,A=!0):N=$.pathname+$.search+$.hash}else O=_E(P),N=O;return{publicHref:N,href:O,pathname:_,search:w,searchStr:S,state:E,hash:C??"",external:A,unmaskOnReload:o.unmaskOnReload}},s=(o={},i)=>{const a=r(o);let c=i?r(i):void 0;if(!c){const l={};if(this.options.routeMasks){const u=kE(a.pathname,this.processedTree);if(u){Object.assign(l,u.rawParams);const{from:d,params:f,...h}=u.route,p=f===!1||f===null?{}:(f??!0)===!0?l:Object.assign(l,sr(f,l));i={from:n.from,...h,params:p},c=r(i)}}}return c&&(a.maskedLocation=c),a};return n.mask?s(n,{from:n.from,...n.mask}):s(n)},this.commitLocation=async({viewTransition:n,ignoreBlocker:r,...s})=>{const o=()=>{const c=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];c.forEach(u=>{s.state[u]=this.latestLocation.state[u]});const l=Wr(s.state,this.latestLocation.state);return c.forEach(u=>{delete s.state[u]}),l},i=Vn(this.latestLocation.href)===Vn(s.href),a=this.commitLocationPromise;if(this.commitLocationPromise=Us(()=>{a?.resolve()}),i&&o())this.load();else{let{maskedLocation:c,hashScrollIntoView:l,...u}=s;c&&(u={...c,state:{...c.state,__tempKey:void 0,__tempLocation:{...u,search:u.searchStr,state:{...u.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(u.unmaskOnReload??this.options.unmaskOnReload??!1)&&(u.state.__tempKey=this.tempLocationKey)),u.state.__hashScrollIntoViewOptions=l??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,this.history[s.replace?"replace":"push"](u.publicHref,u.state,{ignoreBlocker:r})}return this.resetNextScroll=s.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:r,hashScrollIntoView:s,viewTransition:o,ignoreBlocker:i,href:a,...c}={})=>{if(a){const d=this.history.location.state.__TSR_index,f=Wa(a,{__TSR_index:n?d:d+1}),h=new URL(f.pathname,this.origin),p=$u(this.rewrite,h);c.to=p.pathname,c.search=this.options.parseSearch(f.search),c.hash=f.hash.slice(1)}const l=this.buildLocation({...c,_includeValidateSearch:!0});this.pendingBuiltLocation=l;const u=this.commitLocation({...l,viewTransition:o,replace:n,resetScroll:r,hashScrollIntoView:s,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===l&&(this.pendingBuiltLocation=void 0)}),u},this.navigate=async({to:n,reloadDocument:r,href:s,publicHref:o,...i})=>{let a=!1;if(s)try{new URL(`${s}`),a=!0}catch{}if(a&&!r&&(r=!0),r){if(n!==void 0||!s){const l=this.buildLocation({to:n,...i});s=s??l.publicHref,o=o??l.publicHref}const c=!a&&o?o:s;if(qa(c))return process.env.NODE_ENV!=="production"&&console.warn(`Blocked navigation to dangerous protocol: ${c}`),Promise.resolve();if(!i.ignoreBlocker){const u=this.history.getBlockers?.()??[];for(const d of u)if(d?.blockerFn&&await d.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return i.replace?window.location.replace(c):window.location.href=c,Promise.resolve()}return this.buildAndCommitLocation({...i,href:s,to:n,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const n=this.matchRoutes(this.latestLocation);this.__store.setState(r=>({...r,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:n,cachedMatches:r.cachedMatches.filter(s=>!n.some(o=>o.id===s.id))}))},this.load=async n=>{let r,s,o;for(o=new Promise(a=>{this.startTransition(async()=>{try{this.beforeLoad();const c=this.latestLocation,l=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...Hr({resolvedLocation:l,location:c})}),this.emit({type:"onBeforeLoad",...Hr({resolvedLocation:l,location:c})}),await tp({router:this,sync:n?.sync,matches:this.state.pendingMatches,location:c,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let u=[],d=[],f=[];Lo(()=>{this.__store.setState(h=>{const p=h.matches,m=h.pendingMatches||h.matches;return u=p.filter(y=>!m.some(b=>b.id===y.id)),d=m.filter(y=>!p.some(b=>b.id===y.id)),f=m.filter(y=>p.some(b=>b.id===y.id)),{...h,isLoading:!1,loadedAt:Date.now(),matches:m,pendingMatches:void 0,cachedMatches:[...h.cachedMatches,...u.filter(y=>y.status!=="error"&&y.status!=="notFound")]}}),this.clearExpiredCache()}),[[u,"onLeave"],[d,"onEnter"],[f,"onStay"]].forEach(([h,p])=>{h.forEach(m=>{this.looseRoutesById[m.routeId].options[p]?.(m)})})})})}})}catch(c){Jt(c)?(r=c,this.navigate({...r.options,replace:!0,ignoreBlocker:!0})):Wt(c)&&(s=c),this.__store.setState(l=>({...l,statusCode:r?r.status:s?404:l.matches.some(u=>u.status==="error")?500:200,redirect:r}))}this.latestLoadPromise===o&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),a()})}),this.latestLoadPromise=o,await o;this.latestLoadPromise&&o!==this.latestLoadPromise;)await this.latestLoadPromise;let i;this.hasNotFoundMatch()?i=404:this.__store.state.matches.some(a=>a.status==="error")&&(i=500),i!==void 0&&this.__store.setState(a=>({...a,statusCode:i}))},this.startViewTransition=n=>{const r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let s;if(typeof r=="object"&&this.isViewTransitionTypesSupported){const o=this.latestLocation,i=this.state.resolvedLocation,a=typeof r.types=="function"?r.types(Hr({resolvedLocation:i,location:o})):r.types;if(a===!1){n();return}s={update:n,types:a}}else s=n;document.startViewTransition(s)}else n()},this.updateMatch=(n,r)=>{this.startTransition(()=>{const s=this.state.pendingMatches?.some(o=>o.id===n)?"pendingMatches":this.state.matches.some(o=>o.id===n)?"matches":this.state.cachedMatches.some(o=>o.id===n)?"cachedMatches":"";s&&this.__store.setState(o=>({...o,[s]:o[s]?.map(i=>i.id===n?r(i):i)}))})},this.getMatch=n=>{const r=s=>s.id===n;return this.state.cachedMatches.find(r)??this.state.pendingMatches?.find(r)??this.state.matches.find(r)},this.invalidate=n=>{const r=s=>n?.filter?.(s)??!0?{...s,invalid:!0,...n?.forcePending||s.status==="error"||s.status==="notFound"?{status:"pending",error:void 0}:void 0}:s;return this.__store.setState(s=>({...s,matches:s.matches.map(r),cachedMatches:s.cachedMatches.map(r),pendingMatches:s.pendingMatches?.map(r)})),this.shouldViewTransition=!1,this.load({sync:n?.sync})},this.getParsedLocationHref=n=>n.publicHref||"/",this.resolveRedirect=n=>{const r=n.headers.get("Location");if(!n.options.href||n.options._builtLocation){const s=n.options._builtLocation??this.buildLocation(n.options),o=this.getParsedLocationHref(s);n.options.href=o,n.headers.set("Location",o)}else if(r)try{const s=new URL(r);if(this.origin&&s.origin===this.origin){const o=s.pathname+s.search+s.hash;n.options.href=o,n.headers.set("Location",o)}}catch{}return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const r=n?.filter;r!==void 0?this.__store.setState(s=>({...s,cachedMatches:s.cachedMatches.filter(o=>!r(o))})):this.__store.setState(s=>({...s,cachedMatches:[]}))},this.clearExpiredCache=()=>{const n=r=>{const s=this.looseRoutesById[r.routeId];if(!s.options.loader)return!0;const o=(r.preload?s.options.preloadGcTime??this.options.defaultPreloadGcTime:s.options.gcTime??this.options.defaultGcTime)??300*1e3;return r.status==="error"?!0:Date.now()-r.updatedAt>=o};this.clearCache({filter:n})},this.loadRouteChunk=wb,this.preloadRoute=async n=>{const r=this.buildLocation(n);let s=this.matchRoutes(r,{throwOnError:!0,preload:!0,dest:n});const o=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(a=>a.id)),i=new Set([...o,...this.state.cachedMatches.map(a=>a.id)]);Lo(()=>{s.forEach(a=>{i.has(a.id)||this.__store.setState(c=>({...c,cachedMatches:[...c.cachedMatches,a]}))})});try{return s=await tp({router:this,matches:s,location:r,preload:!0,updateMatch:(a,c)=>{o.has(a)?s=s.map(l=>l.id===a?c(l):l):this.updateMatch(a,c)}}),s}catch(a){if(Jt(a))return a.options.reloadDocument?void 0:await this.preloadRoute({...a.options,_fromLocation:r});Wt(a)||console.error(a);return}},this.matchRoute=(n,r)=>{const s={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},o=this.buildLocation(s);if(r?.pending&&this.state.status!=="pending")return!1;const a=(r?.pending===void 0?!this.state.isLoading:r.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,c=CE(o.pathname,r?.caseSensitive??!1,r?.fuzzy??!1,a.pathname,this.processedTree);return!c||n.params&&!Wr(c.rawParams,n.params,{partial:!0})?!1:r?.includeSearch??!0?Wr(a.search,o.search,{partial:!0})?c.rawParams:!1:c.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(n=>n.status==="notFound"||n.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...t,caseSensitive:t.caseSensitive??!1,notFoundMode:t.notFoundMode??"fuzzy",stringifySearch:t.stringifySearch??KE,parseSearch:t.parseSearch??qE}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}setRoutes({routesById:t,routesByPath:n,processedTree:r}){this.routesById=t,this.routesByPath=n,this.processedTree=r;const s=this.options.notFoundRoute;s&&(s.init({originalIndex:99999999999}),this.routesById[s.id]=s)}get looseRoutesById(){return this.routesById}matchRoutesInternal(t,n){const r=this.getMatchedRoutes(t.pathname),{foundRoute:s,routeParams:o,parsedParams:i}=r;let{matchedRoutes:a}=r,c=!1;(s?s.path!=="/"&&o["**"]:Vn(t.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:c=!0);const l=c?lk(this.options.notFoundMode,a):void 0,u=[],d=f=>f?.id?f.context??this.options.context??void 0:this.options.context??void 0;return a.forEach((f,h)=>{const p=u[h-1],[m,y,b]=(()=>{const $=p?.search??t.search,q=p?._strictSearch??void 0;try{const D=Ca(f.options.validateSearch,{...$})??void 0;return[{...$,...D},{...q,...D},void 0]}catch(D){let H=D;if(D instanceof Ya||(H=new Ya(D.message,{cause:D})),n?.throwOnError)throw H;return[$,{},H]}})(),x=f.options.loaderDeps?.({search:m})??"",_=x?JSON.stringify(x):"",{interpolatedPath:w,usedParams:S}=Vl({path:f.fullPath,params:o,decoder:this.pathParamsDecoder,server:this.isServer}),C=f.id+w+_,k=this.getMatch(C),E=this.state.matches.find($=>$.routeId===f.id),P=k?._strictParams??S;let O;if(!k)try{sp(f,S,i,P)}catch($){if(Wt($)||Jt($)?O=$:O=new sk($.message,{cause:$}),n?.throwOnError)throw O}Object.assign(o,P);const N=E?"stay":"enter";let A;if(k)A={...k,cause:N,params:E?Ot(E.params,o):o,_strictParams:P,search:Ot(E?E.search:k.search,m),_strictSearch:y};else{const $=f.options.loader||f.options.beforeLoad||f.lazyFn||Sb(f)?"pending":"success";A={id:C,ssr:f.options.ssr,index:h,routeId:f.id,params:E?Ot(E.params,o):o,_strictParams:P,pathname:w,updatedAt:Date.now(),search:E?Ot(E.search,m):m,_strictSearch:y,searchError:void 0,status:$,isFetching:!1,error:void 0,paramsError:O,__routeContext:void 0,_nonReactive:{loadPromise:Us()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:N,loaderDeps:E?Ot(E.loaderDeps,x):x,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:f.options.staticData||{},fullPath:f.fullPath}}n?.preload||(A.globalNotFound=l===f.id),A.searchError=b;const j=d(p);A.context={...j,...A.__routeContext,...A.__beforeLoadContext},u.push(A)}),u.forEach((f,h)=>{const p=this.looseRoutesById[f.routeId];if(!this.getMatch(f.id)){const y=u[h-1],b=d(y);if(p.options.context){const x={deps:f.loaderDeps,params:f.params,context:b??{},location:t,navigate:_=>this.navigate({..._,_fromLocation:t}),buildLocation:this.buildLocation,cause:f.cause,abortController:f.abortController,preload:!!f.preload,matches:u};f.__routeContext=p.options.context(x)??void 0}f.context={...b,...f.__routeContext,...f.__beforeLoadContext}}}),u}matchRoutesLightweight(t){const{matchedRoutes:n,routeParams:r,parsedParams:s}=this.getMatchedRoutes(t.pathname),o=Ho(n),i={...t.search};for(const u of n)try{Object.assign(i,Ca(u.options.validateSearch,i))}catch{}const a=Ho(this.state.matches),c=a&&a.routeId===o.id&&t.pathname===this.state.location.pathname;let l;if(c)l=a.params;else{const u={...r};for(const d of n)try{sp(d,r,s??{},u)}catch{}l=u}return{matchedRoutes:n,fullPath:o.fullPath,search:i,params:l}}}class Ya extends Error{}class sk extends Error{}const np=e=>e.endsWith("/")&&e.length>1?e.slice(0,-1):e;function rp(e,t){return np(e)===np(t)}function ok(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function Ca(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new Ya("Async validation not supported");if(n.issues)throw new Ya(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function ik({pathname:e,routesById:t,processedTree:n}){const r={},s=Vn(e);let o,i;const a=RE(s,n,!0);return a&&(o=a.route,Object.assign(r,a.rawParams),i=Object.assign({},a.parsedParams)),{matchedRoutes:a?.branch||[t[Gt]],routeParams:r,foundRoute:o,parsedParams:i}}function ak({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return ck(n)(e,t,r??!1)}function ck(e){const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const s of e){if("search"in s.options)s.options.search?.middlewares&&t.middlewares.push(...s.options.search.middlewares);else if(s.options.preSearchFilters||s.options.postSearchFilters){const o=({search:i,next:a})=>{let c=i;"preSearchFilters"in s.options&&s.options.preSearchFilters&&(c=s.options.preSearchFilters.reduce((u,d)=>d(u),i));const l=a(c);return"postSearchFilters"in s.options&&s.options.postSearchFilters?s.options.postSearchFilters.reduce((u,d)=>d(u),l):l};t.middlewares.push(o)}if(s.options.validateSearch){const o=({search:i,next:a})=>{const c=a(i);if(!t._includeValidateSearch)return c;try{return{...c,...Ca(s.options.validateSearch,c)??void 0}}catch{return c}};t.middlewares.push(o)}}const n=({search:s})=>{const o=t.dest;return o.search?o.search===!0?s:sr(o.search,s):{}};t.middlewares.push(n);const r=(s,o,i)=>{if(s>=i.length)return o;const a=i[s];return a({search:o,next:l=>r(s+1,l,i)})};return function(o,i,a){return t.dest=i,t._includeValidateSearch=a,r(0,o,t.middlewares)}}function lk(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const r=t[n];if(r.children)return r.id}return Gt}function sp(e,t,n,r){const s=e.options.params?.parse??e.options.parseParams;if(s)if(e.options.skipRouteOnParseError)for(const o in t)o in n&&(r[o]=n[o]);else{const o=s(r);Object.assign(r,o)}}const uk="Error preloading route! ☝️";class Cb{constructor(t){if(this.init=n=>{this.originalIndex=n.originalIndex;const r=this.options,s=!r?.path&&!r?.id;this.parentRoute=this.options.getParentRoute?.(),s?this._path=Gt:this.parentRoute||qn(!1,"Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.");let o=s?Gt:r?.path;o&&o!=="/"&&(o=mb(o));const i=r?.id||o;let a=s?Gt:Ea([this.parentRoute.id===Gt?"":this.parentRoute.id,i]);o===Gt&&(o="/"),a!==Gt&&(a=Ea(["/",a]));const c=a===Gt?"/":Ea([this.parentRoute.fullPath,o]);this._path=o,this._id=a,this._fullPath=c,this._to=Vn(c)},this.addChildren=n=>this._addFileChildren(n),this._addFileChildren=n=>(Array.isArray(n)&&(this.children=n),typeof n=="object"&&n!==null&&(this.children=Object.values(n)),this),this._addFileTypes=()=>this,this.updateLoader=n=>(Object.assign(this.options,n),this),this.update=n=>(Object.assign(this.options,n),this),this.lazy=n=>(this.lazyFn=n,this),this.redirect=n=>yb({from:this.fullPath,...n}),this.options=t||{},this.isRoot=!t?.getParentRoute,t?.id&&t?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class dk extends Cb{constructor(t){super(t)}}const zi=typeof window<"u"?v.useLayoutEffect:v.useEffect;function Ul(e){const t=v.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function fk(e,t,n={},r={}){v.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!="function")return;const s=new IntersectionObserver(([o])=>{t(o)},n);return s.observe(e.current),()=>{s.disconnect()}},[t,n,r.disabled,e])}function hk(e){const t=v.useRef(null);return v.useImperativeHandle(e,()=>t.current,[]),t}function ef(e){const t=e.errorComponent??tf;return g.jsx(pk,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?v.createElement(t,{error:n,reset:r}):e.children})}class pk extends v.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(t){return{resetKey:t.getResetKey()}}static getDerivedStateFromError(t){return{error:t}}reset(){this.setState({error:null})}componentDidUpdate(t,n){n.error&&n.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(t,n){this.props.onCatch&&this.props.onCatch(t,n)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function tf({error:e}){const[t,n]=v.useState(process.env.NODE_ENV!=="production");return g.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[g.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),g.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(r=>!r),children:t?"Hide Error":"Show Error"})]}),g.jsx("div",{style:{height:".25rem"}}),t?g.jsx("div",{children:g.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?g.jsx("code",{children:e.message}):null})}):null]})}function mk({children:e,fallback:t=null}){return Rb()?g.jsx(T.Fragment,{children:e}):g.jsx(T.Fragment,{children:t})}function Rb(){return T.useSyncExternalStore(gk,()=>!0,()=>!1)}function gk(){return()=>{}}var yk=process.env.NODE_ENV==="production";function Hs(e,t){if(!yk){if(e)return;var n="Warning: "+t;typeof console<"u"&&console.warn(n);try{throw Error(n)}catch{}}}var $i={exports:{}},Wl={},Vi={exports:{}},Hl={};var op;function bk(){if(op)return Hl;op=1;var e=T;function t(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function a(d,f){var h=f(),p=r({inst:{value:h,getSnapshot:f}}),m=p[0].inst,y=p[1];return o(function(){m.value=h,m.getSnapshot=f,c(m)&&y({inst:m})},[d,h,f]),s(function(){return c(m)&&y({inst:m}),d(function(){c(m)&&y({inst:m})})},[d]),i(h),h}function c(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!n(d,h)}catch{return!0}}function l(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return Hl.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Hl}var ql={};var ip;function vk(){return ip||(ip=1,process.env.NODE_ENV!=="production"&&(function(){function e(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}function t(h,p){u||s.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=p();if(!d){var y=p();o(m,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}y=i({inst:{value:m,getSnapshot:p}});var b=y[0].inst,x=y[1];return c(function(){b.value=m,b.getSnapshot=p,n(b)&&x({inst:b})},[h,m,p]),a(function(){return n(b)&&x({inst:b}),h(function(){n(b)&&x({inst:b})})},[h]),l(m),m}function n(h){var p=h.getSnapshot;h=h.value;try{var m=p();return!o(h,m)}catch{return!0}}function r(h,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=T,o=typeof Object.is=="function"?Object.is:e,i=s.useState,a=s.useEffect,c=s.useLayoutEffect,l=s.useDebugValue,u=!1,d=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;ql.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),ql}var ap;function Pb(){return ap||(ap=1,process.env.NODE_ENV==="production"?Vi.exports=bk():Vi.exports=vk()),Vi.exports}var cp;function xk(){if(cp)return Wl;cp=1;var e=T,t=Pb();function n(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,a=e.useMemo,c=e.useDebugValue;return Wl.useSyncExternalStoreWithSelector=function(l,u,d,f,h){var p=o(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function b(C){if(!x){if(x=!0,_=C,C=f(C),h!==void 0&&m.hasValue){var k=m.value;if(h(k,C))return w=k}return w=C}if(k=w,r(_,C))return k;var E=f(C);return h!==void 0&&h(k,E)?(_=C,k):(_=C,w=E)}var x=!1,_,w,S=d===void 0?null:d;return[function(){return b(u())},S===null?void 0:function(){return b(S())}]},[u,d,f,h]);var y=s(l,p[0],p[1]);return i(function(){m.hasValue=!0,m.value=y},[y]),c(y),y},Wl}var Kl={};var lp;function _k(){return lp||(lp=1,process.env.NODE_ENV!=="production"&&(function(){function e(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=T,n=Pb(),r=typeof Object.is=="function"?Object.is:e,s=n.useSyncExternalStore,o=t.useRef,i=t.useEffect,a=t.useMemo,c=t.useDebugValue;Kl.useSyncExternalStoreWithSelector=function(l,u,d,f,h){var p=o(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function b(C){if(!x){if(x=!0,_=C,C=f(C),h!==void 0&&m.hasValue){var k=m.value;if(h(k,C))return w=k}return w=C}if(k=w,r(_,C))return k;var E=f(C);return h!==void 0&&h(k,E)?(_=C,k):(_=C,w=E)}var x=!1,_,w,S=d===void 0?null:d;return[function(){return b(u())},S===null?void 0:function(){return b(S())}]},[u,d,f,h]);var y=s(l,p[0],p[1]);return i(function(){m.hasValue=!0,m.value=y},[y]),c(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Kl}var up;function wk(){return up||(up=1,process.env.NODE_ENV==="production"?$i.exports=xk():$i.exports=_k()),$i.exports}var Sk=wk();function Ek(e,t=r=>r,n={}){const r=n.equal??kk;return Sk.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function kk(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!t.has(r)||!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=dp(e);if(n.length!==dp(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function dp(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const Zl=v.createContext(null);function Ob(){return typeof document>"u"?Zl:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=Zl,Zl)}function tn(e){const t=v.useContext(Ob());return Hs(!((e?.warn??!0)&&!t),"useRouter must be used inside a <RouterProvider> component!"),t}function Qt(e){const t=tn({warn:e?.router===void 0}),n=e?.router||t,r=T.useRef(void 0);return Ek(n.__store,s=>{if(e?.select){if(e.structuralSharing??n.options.defaultStructuralSharing){const o=Ot(r.current,e.select(s));return r.current=o,o}return e.select(s)}return s})}const Fc=v.createContext(void 0),Ck=v.createContext(void 0);function Pn(e){const t=v.useContext(e.from?Ck:Fc);return Qt({select:r=>{const s=r.matches.find(o=>e.from?e.from===o.routeId:o.id===t);if(qn(!((e.shouldThrow??!0)&&!s),`Could not find ${e.from?`an active match from "${e.from}"`:"a nearest match!"}`),s!==void 0)return e.select?e.select(s):s},structuralSharing:e.structuralSharing})}function nf(e){return Pn({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function rf(e){const{select:t,...n}=e;return Pn({...n,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function pi(e){return Pn({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function sf(e){return Pn({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function ls(e){const t=tn();return v.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Rk(e,t){const n=tn(),r=hk(t),{activeProps:s,inactiveProps:o,activeOptions:i,to:a,preload:c,preloadDelay:l,hashScrollIntoView:u,replace:d,startTransition:f,resetScroll:h,viewTransition:p,children:m,target:y,disabled:b,style:x,className:_,onClick:w,onFocus:S,onMouseEnter:C,onMouseLeave:k,onTouchStart:E,ignoreBlocker:P,params:O,search:N,hash:A,state:j,mask:$,reloadDocument:q,unsafeRelative:D,from:H,_fromLocation:F,...W}=e,se=Rb(),I=Qt({select:B=>B.location.search,structuralSharing:!0}),Y=e.from,K=v.useMemo(()=>({...e,from:Y}),[n,I,Y,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),Z=v.useMemo(()=>n.buildLocation({...K}),[n,K]),oe=Z.maskedLocation?Z.maskedLocation.publicHref:Z.publicHref,ce=Z.maskedLocation?Z.maskedLocation.external:Z.external,V=v.useMemo(()=>Nk(oe,ce,n.history,b),[b,ce,oe,n.history]),ee=v.useMemo(()=>{if(V?.external){if(qa(V.href)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${V.href}`);return}return V.href}if(!Dk(a)&&!(typeof a!="string"||a.indexOf(":")===-1))try{if(new URL(a),qa(a)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${a}`);return}return a}catch{}},[a,V]),me=Qt({select:B=>{if(ee)return!1;if(i?.exact){if(!NE(B.location.pathname,Z.pathname,n.basepath))return!1}else{const Q=Za(B.location.pathname,n.basepath),ue=Za(Z.pathname,n.basepath);if(!(Q.startsWith(ue)&&(Q.length===ue.length||Q[ue.length]==="/")))return!1}return(i?.includeSearch??!0)&&!Wr(B.location.search,Z.search,{partial:!i?.exact,ignoreUndefined:!i?.explicitUndefined})?!1:i?.includeHash?se&&B.location.hash===Z.hash:!0}}),le=me?sr(s,{})??Pk:Gl,fe=me?Gl:sr(o,{})??Gl,ge=[_,le.className,fe.className].filter(Boolean).join(" "),Ze=(x||le.style||fe.style)&&{...x,...le.style,...fe.style},[_t,rn]=v.useState(!1),qt=v.useRef(!1),st=e.reloadDocument||ee?!1:c??n.options.defaultPreload,Qn=l??n.options.defaultPreloadDelay??0,ot=v.useCallback(()=>{n.preloadRoute({...K}).catch(B=>{console.warn(B),console.warn(uk)})},[n,K]),ps=v.useCallback(B=>{B?.isIntersecting&&ot()},[ot]);fk(r,ps,Ak,{disabled:!!b||st!=="viewport"}),v.useEffect(()=>{qt.current||!b&&st==="render"&&(ot(),qt.current=!0)},[b,ot,st]);const R=B=>{const Q=B.currentTarget.getAttribute("target"),ue=y!==void 0?y:Q;if(!b&&!Ik(B)&&!B.defaultPrevented&&(!ue||ue==="_self")&&B.button===0){B.preventDefault(),Dc.flushSync(()=>{rn(!0)});const ve=n.subscribe("onResolved",()=>{ve(),rn(!1)});n.navigate({...K,replace:d,resetScroll:h,hashScrollIntoView:u,startTransition:f,viewTransition:p,ignoreBlocker:P})}};if(ee)return{...W,ref:r,href:ee,...m&&{children:m},...y&&{target:y},...b&&{disabled:b},...x&&{style:x},..._&&{className:_},...w&&{onClick:w},...S&&{onFocus:S},...C&&{onMouseEnter:C},...k&&{onMouseLeave:k},...E&&{onTouchStart:E}};const M=B=>{b||st&&ot()},z=M,J=B=>{if(!(b||!st))if(!Qn)ot();else{const Q=B.target;if(mo.has(Q))return;const ue=setTimeout(()=>{mo.delete(Q),ot()},Qn);mo.set(Q,ue)}},G=B=>{if(b||!st||!Qn)return;const Q=B.target,ue=mo.get(Q);ue&&(clearTimeout(ue),mo.delete(Q))};return{...W,...le,...fe,href:V?.href,ref:r,onClick:go([w,R]),onFocus:go([S,M]),onMouseEnter:go([C,J]),onMouseLeave:go([k,G]),onTouchStart:go([E,z]),disabled:!!b,target:y,...Ze&&{style:Ze},...ge&&{className:ge},...b&&Ok,...me&&Tk,...se&&_t&&Mk}}const Gl={},Pk={className:"active"},Ok={role:"link","aria-disabled":!0},Tk={"data-status":"active","aria-current":"page"},Mk={"data-transitioning":"transitioning"},mo=new WeakMap,Ak={rootMargin:"100px"},go=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function Nk(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function Dk(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}const Tb=v.forwardRef((e,t)=>{const{_asChild:n,...r}=e,{type:s,...o}=Rk(r,t),i=typeof r.children=="function"?r.children({isActive:o["data-status"]==="active"}):r.children;if(!n){const{disabled:a,...c}=o;return v.createElement("a",c,i)}return v.createElement(n,o,i)});function Ik(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}class jk extends Cb{constructor(t){super(t),this.useMatch=n=>Pn({select:n?.select,from:this.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>Pn({...n,from:this.id,select:r=>n?.select?n.select(r.context):r.context}),this.useSearch=n=>sf({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useParams=n=>pi({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useLoaderDeps=n=>rf({...n,from:this.id}),this.useLoaderData=n=>nf({...n,from:this.id}),this.useNavigate=()=>ls({from:this.fullPath}),this.Link=T.forwardRef((n,r)=>g.jsx(Tb,{ref:r,from:this.fullPath,...n})),this.$$typeof=Symbol.for("react.memo")}}function jn(e){return new jk(e)}class Lk extends dk{constructor(t){super(t),this.useMatch=n=>Pn({select:n?.select,from:this.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>Pn({...n,from:this.id,select:r=>n?.select?n.select(r.context):r.context}),this.useSearch=n=>sf({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useParams=n=>pi({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useLoaderDeps=n=>rf({...n,from:this.id}),this.useLoaderData=n=>nf({...n,from:this.id}),this.useNavigate=()=>ls({from:this.fullPath}),this.Link=T.forwardRef((n,r)=>g.jsx(Tb,{ref:r,from:this.fullPath,...n})),this.$$typeof=Symbol.for("react.memo")}}function Fk(e){return new Lk(e)}function fp(e){return typeof e=="object"?new hp(e,{silent:!0}).createRoute(e):new hp(e,{silent:!0}).createRoute}class hp{constructor(t,n){this.path=t,this.createRoute=r=>{Hs(this.silent,"FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.");const s=jn(r);return s.isRoot=!1,s},this.silent=n?.silent}}class pp{constructor(t){this.useMatch=n=>Pn({select:n?.select,from:this.options.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>Pn({from:this.options.id,select:r=>n?.select?n.select(r.context):r.context}),this.useSearch=n=>sf({select:n?.select,structuralSharing:n?.structuralSharing,from:this.options.id}),this.useParams=n=>pi({select:n?.select,structuralSharing:n?.structuralSharing,from:this.options.id}),this.useLoaderDeps=n=>rf({...n,from:this.options.id}),this.useLoaderData=n=>nf({...n,from:this.options.id}),this.useNavigate=()=>{const n=tn();return ls({from:n.routesById[this.options.id].fullPath})},this.options=t,this.$$typeof=Symbol.for("react.memo")}}function mp(e){return typeof e=="object"?new pp(e):t=>new pp({id:e,...t})}function zk(){const e=tn(),t=v.useRef({router:e,mounted:!1}),[n,r]=v.useState(!1),{hasPendingMatches:s,isLoading:o}=Qt({select:d=>({isLoading:d.isLoading,hasPendingMatches:d.matches.some(f=>f.status==="pending")}),structuralSharing:!0}),i=Ul(o),a=o||n||s,c=Ul(a),l=o||s,u=Ul(l);return e.startTransition=d=>{r(!0),v.startTransition(()=>{d(),r(!1)})},v.useEffect(()=>{const d=e.history.subscribe(e.load),f=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Vn(e.latestLocation.publicHref)!==Vn(f.publicHref)&&e.commitLocation({...f,replace:!0}),()=>{d()}},[e,e.history]),zi(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(f){console.error(f)}})()},[e]),zi(()=>{i&&!o&&e.emit({type:"onLoad",...Hr(e.state)})},[i,e,o]),zi(()=>{u&&!l&&e.emit({type:"onBeforeRouteMount",...Hr(e.state)})},[l,u,e]),zi(()=>{if(c&&!a){const d=Hr(e.state);e.emit({type:"onResolved",...d}),e.__store.setState(f=>({...f,status:"idle",resolvedLocation:f.location})),d.hrefChanged&&UE(e)}},[a,c,e]),null}function $k(e){const t=Qt({select:n=>`not-found-${n.location.pathname}-${n.status}`});return g.jsx(ef,{getResetKey:()=>t,onCatch:(n,r)=>{if(Wt(n))e.onCatch?.(n,r);else throw n},errorComponent:({error:n})=>{if(Wt(n))return e.fallback?.(n);throw n},children:e.children})}function Vk(){return g.jsx("p",{children:"Not Found"})}function Ss(e){return g.jsx(g.Fragment,{children:e.children})}function Mb(e,t,n){return t.options.notFoundComponent?g.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?g.jsx(e.options.defaultNotFoundComponent,{...n}):(process.env.NODE_ENV==="development"&&Hs(t.options.notFoundComponent,`A notFoundError was encountered on the route with ID "${t.id}", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Not Found</p>)`),g.jsx(Vk,{}))}function Bk(){return tn().isScrollRestoring,null}const Ab=v.memo(function({matchId:t}){const n=tn(),r=Qt({select:m=>{const y=m.matches.findIndex(x=>x.id===t),b=m.matches[y];return qn(b,`Could not find match for matchId "${t}". Please file an issue!`),{routeId:b.routeId,ssr:b.ssr,_displayPending:b._displayPending,resetKey:m.loadedAt,parentRouteId:m.matches[y-1]?.routeId}},structuralSharing:!0}),s=n.routesById[r.routeId],o=s.options.pendingComponent??n.options.defaultPendingComponent,i=o?g.jsx(o,{}):null,a=s.options.errorComponent??n.options.defaultErrorComponent,c=s.options.onCatch??n.options.defaultOnCatch,l=s.isRoot?s.options.notFoundComponent??n.options.notFoundRoute?.options.component:s.options.notFoundComponent,u=r.ssr===!1||r.ssr==="data-only",d=(!s.isRoot||s.options.wrapInSuspense||u)&&(s.options.wrapInSuspense??o??(s.options.errorComponent?.preload||u))?v.Suspense:Ss,f=a?ef:Ss,h=l?$k:Ss,p=s.isRoot?s.options.shellComponent??Ss:Ss;return g.jsxs(p,{children:[g.jsx(Fc.Provider,{value:t,children:g.jsx(d,{fallback:i,children:g.jsx(f,{getResetKey:()=>r.resetKey,errorComponent:a||tf,onCatch:(m,y)=>{if(Wt(m))throw m;Hs(!1,`Error in route match: ${t}`),c?.(m,y)},children:g.jsx(h,{fallback:m=>{if(!l||m.routeId&&m.routeId!==r.routeId||!m.routeId&&!s.isRoot)throw m;return v.createElement(l,m)},children:u||r._displayPending?g.jsx(mk,{fallback:i,children:g.jsx(gp,{matchId:t})}):g.jsx(gp,{matchId:t})})})})}),r.parentRouteId===Gt&&n.options.scrollRestoration?g.jsxs(g.Fragment,{children:[g.jsx(Uk,{}),g.jsx(Bk,{})]}):null]})});function Uk(){const e=tn(),t=v.useRef(void 0);return g.jsx("script",{suppressHydrationWarning:!0,ref:n=>{n&&(t.current===void 0||t.current.href!==e.latestLocation.href)&&(e.emit({type:"onRendered",...Hr(e.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}const gp=v.memo(function({matchId:t}){const n=tn(),{match:r,key:s,routeId:o}=Qt({select:c=>{const l=c.matches.find(p=>p.id===t),u=l.routeId,f=(n.routesById[u].options.remountDeps??n.options.defaultRemountDeps)?.({routeId:u,loaderDeps:l.loaderDeps,params:l._strictParams,search:l._strictSearch});return{key:f?JSON.stringify(f):void 0,routeId:u,match:{id:l.id,status:l.status,error:l.error,invalid:l.invalid,_forcePending:l._forcePending,_displayPending:l._displayPending}}},structuralSharing:!0}),i=n.routesById[o],a=v.useMemo(()=>{const c=i.options.component??n.options.defaultComponent;return c?g.jsx(c,{},s):g.jsx(of,{})},[s,i.options.component,n.options.defaultComponent]);if(r._displayPending)throw n.getMatch(r.id)?._nonReactive.displayPendingPromise;if(r._forcePending)throw n.getMatch(r.id)?._nonReactive.minPendingPromise;if(r.status==="pending"){const c=i.options.pendingMinMs??n.options.defaultPendingMinMs;if(c){const l=n.getMatch(r.id);if(l&&!l._nonReactive.minPendingPromise){const u=Us();l._nonReactive.minPendingPromise=u,setTimeout(()=>{u.resolve(),l._nonReactive.minPendingPromise=void 0},c)}}throw n.getMatch(r.id)?._nonReactive.loadPromise}if(r.status==="notFound")return qn(Wt(r.error),"Expected a notFound error"),Mb(n,i,r.error);if(r.status==="redirected")throw qn(Jt(r.error),"Expected a redirect error"),n.getMatch(r.id)?._nonReactive.loadPromise;if(r.status==="error")throw r.error;return a}),of=v.memo(function(){const t=tn(),n=v.useContext(Fc),r=Qt({select:l=>l.matches.find(u=>u.id===n)?.routeId}),s=t.routesById[r],o=Qt({select:l=>{const d=l.matches.find(f=>f.id===n);return qn(d,`Could not find parent match for matchId "${n}"`),d.globalNotFound}}),i=Qt({select:l=>{const u=l.matches,d=u.findIndex(f=>f.id===n);return u[d+1]?.id}}),a=t.options.defaultPendingComponent?g.jsx(t.options.defaultPendingComponent,{}):null;if(o)return Mb(t,s,void 0);if(!i)return null;const c=g.jsx(Ab,{matchId:i});return r===Gt?g.jsx(v.Suspense,{fallback:a,children:c}):c});function Wk(){const e=tn(),n=e.routesById[Gt].options.pendingComponent??e.options.defaultPendingComponent,r=n?g.jsx(n,{}):null,s=typeof document<"u"&&e.ssr?Ss:v.Suspense,o=g.jsxs(s,{fallback:r,children:[g.jsx(zk,{}),g.jsx(Hk,{})]});return e.options.InnerWrap?g.jsx(e.options.InnerWrap,{children:o}):o}function Hk(){const e=tn(),t=Qt({select:s=>s.matches[0]?.id}),n=Qt({select:s=>s.loadedAt}),r=t?g.jsx(Ab,{matchId:t}):null;return g.jsx(Fc.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:g.jsx(ef,{getResetKey:()=>n,errorComponent:tf,onCatch:s=>{Hs(!1,"The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!"),Hs(!1,s.message||s.toString())},children:r})})}const af=e=>new qk(e);class qk extends rk{constructor(t){super(t)}}typeof globalThis<"u"?(globalThis.createFileRoute=fp,globalThis.createLazyFileRoute=mp):typeof window<"u"&&(window.createFileRoute=fp,window.createLazyFileRoute=mp);function Kk({router:e,children:t,...n}){Object.keys(n).length>0&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const r=Ob(),s=g.jsx(r.Provider,{value:e,children:t});return e.options.Wrap?g.jsx(e.options.Wrap,{children:s}):s}function Nb({router:e,...t}){return g.jsx(Kk,{router:e,...t,children:g.jsx(Wk,{})})}var mi=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Zk={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Gk=class{#e=Zk;#t=!1;setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&this.#t&&e!==this.#e&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#e,provider:e}),this.#e=e,process.env.NODE_ENV!=="production"&&(this.#t=!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&(this.#t=!0),this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&(this.#t=!0),this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},$r=new Gk;function Yk(e){setTimeout(e,0)}var Jr=typeof window>"u"||"Deno"in globalThis;function Mt(){}function Xk(e,t){return typeof e=="function"?e(t):e}function Vu(e){return typeof e=="number"&&e>=0&&e!==1/0}function Db(e,t){return Math.max(e+(t||0)-Date.now(),0)}function dr(e,t){return typeof e=="function"?e(t):e}function Yt(e,t){return typeof e=="function"?e(t):e}function yp(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:o,queryKey:i,stale:a}=e;if(i){if(r){if(t.queryHash!==cf(i,t.options))return!1}else if(!Zo(t.queryKey,i))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||o&&!o(t))}function bp(e,t){const{exact:n,status:r,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Ko(t.options.mutationKey)!==Ko(o))return!1}else if(!Zo(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function cf(e,t){return(t?.queryKeyHashFn||Ko)(e)}function Ko(e){return JSON.stringify(e,(t,n)=>Wu(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Zo(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Zo(e[n],t[n])):!1}var Jk=Object.prototype.hasOwnProperty;function Bu(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=vp(e)&&vp(t);if(!r&&!(Wu(e)&&Wu(t)))return t;const o=(r?e:Object.keys(e)).length,i=r?t:Object.keys(t),a=i.length,c=r?new Array(a):{};let l=0;for(let u=0;u<a;u++){const d=r?u:i[u],f=e[d],h=t[d];if(f===h){c[d]=f,(r?u<o:Jk.call(e,d))&&l++;continue}if(f===null||h===null||typeof f!="object"||typeof h!="object"){c[d]=h;continue}const p=Bu(f,h,n+1);c[d]=p,p===f&&l++}return o===a&&l===o?e:c}function Uu(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function vp(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Wu(e){if(!xp(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!xp(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function xp(e){return Object.prototype.toString.call(e)==="[object Object]"}function Qk(e){return new Promise(t=>{$r.setTimeout(t,e)})}function Hu(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Bu(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return Bu(e,t)}return t}function eC(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function tC(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Xa=Symbol();function Ib(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Xa&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Xa?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function jb(e,t){return typeof e=="function"?e(...t):!!e}function nC(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=t(),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var rC=class extends mi{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!Jr&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},lf=new rC;function qu(){let e,t;const n=new Promise((s,o)=>{e=s,t=o});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var sC=Yk;function oC(){let e=[],t=0,n=a=>{a()},r=a=>{a()},s=sC;const o=a=>{t?e.push(a):s(()=>{n(a)})},i=()=>{const a=e;e=[],a.length&&s(()=>{r(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||i()}return c},batchCalls:a=>(...c)=>{o(()=>{a(...c)})},schedule:o,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{s=a}}}var ut=oC(),iC=class extends mi{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!Jr&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},Ja=new iC;function aC(e){return Math.min(1e3*2**e,3e4)}function Lb(e){return(e??"online")==="online"?Ja.isOnline():!0}var Ku=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Fb(e){let t=!1,n=0,r;const s=qu(),o=()=>s.status!=="pending",i=m=>{if(!o()){const y=new Ku(m);f(y),e.onCancel?.(y)}},a=()=>{t=!0},c=()=>{t=!1},l=()=>lf.isFocused()&&(e.networkMode==="always"||Ja.isOnline())&&e.canRun(),u=()=>Lb(e.networkMode)&&e.canRun(),d=m=>{o()||(r?.(),s.resolve(m))},f=m=>{o()||(r?.(),s.reject(m))},h=()=>new Promise(m=>{r=y=>{(o()||l())&&m(y)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),p=()=>{if(o())return;let m;const y=n===0?e.initialPromise:void 0;try{m=y??e.fn()}catch(b){m=Promise.reject(b)}Promise.resolve(m).then(d).catch(b=>{if(o())return;const x=e.retry??(Jr?0:3),_=e.retryDelay??aC,w=typeof _=="function"?_(n,b):_,S=x===!0||typeof x=="number"&&n<x||typeof x=="function"&&x(n,b);if(t||!S){f(b);return}n++,e.onFail?.(n,b),Qk(w).then(()=>l()?void 0:h()).then(()=>{t?f(b):p()})})};return{promise:s,status:()=>s.status,cancel:i,continue:()=>(r?.(),s),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?p():h().then(p),s)}}var zb=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Vu(this.gcTime)&&(this.#e=$r.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Jr?1/0:300*1e3))}clearGcTimeout(){this.#e&&($r.clearTimeout(this.#e),this.#e=void 0)}},cC=class extends zb{#e;#t;#n;#s;#r;#a;#i;constructor(e){super(),this.#i=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#s=e.client,this.#n=this.#s.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=wp(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=wp(this.options);t.data!==void 0&&(this.setState(_p(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=Hu(this.state.data,e,this.options);return this.#o({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#o({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(Mt).catch(Mt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Yt(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Xa||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>dr(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:!Db(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#i?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const a=this.observers.find(c=>c.options.queryFn);a&&this.setOptions(a.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,r=a=>{Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(this.#i=!0,n.signal)})},s=()=>{const a=Ib(this.options,t),l=(()=>{const u={client:this.#s,queryKey:this.queryKey,meta:this.meta};return r(u),u})();return this.#i=!1,this.options.persister?this.options.persister(a,l,this):a(l)},i=(()=>{const a={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:s};return r(a),a})();this.options.behavior?.onFetch(i,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==i.fetchOptions?.meta)&&this.#o({type:"fetch",meta:i.fetchOptions?.meta}),this.#r=Fb({initialPromise:t?.initialPromise,fn:i.fetchFn,onCancel:a=>{a instanceof Ku&&a.revert&&this.setState({...this.#t,fetchStatus:"idle"}),n.abort()},onFail:(a,c)=>{this.#o({type:"failed",failureCount:a,error:c})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0});try{const a=await this.#r.start();if(a===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(a),this.#n.config.onSuccess?.(a,this),this.#n.config.onSettled?.(a,this.state.error,this),a}catch(a){if(a instanceof Ku){if(a.silent)return this.#r.promise;if(a.revert){if(this.state.data===void 0)throw a;return this.state.data}}throw this.#o({type:"error",error:a}),this.#n.config.onError?.(a,this),this.#n.config.onSettled?.(this.state.data,a,this),a}finally{this.scheduleGc()}}#o(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...$b(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,..._p(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?r:void 0,r;case"error":const s=e.error;return{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),ut.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function $b(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Lb(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function _p(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function wp(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var lC=class extends mi{constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.#i=qu(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#s=void 0;#r;#a;#i;#o;#m;#f;#h;#l;#u;#c;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Sp(this.#t,this.options)?this.#d():this.updateResult(),this.#v())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Zu(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Zu(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#_(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Yt(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#w(),this.#t.setOptions(this.options),t._defaulted&&!Uu(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&Ep(this.#t,n,this.options,t)&&this.#d(),this.updateResult(),r&&(this.#t!==n||Yt(this.options.enabled,this.#t)!==Yt(t.enabled,this.#t)||dr(this.options.staleTime,this.#t)!==dr(t.staleTime,this.#t))&&this.#g();const s=this.#y();r&&(this.#t!==n||Yt(this.options.enabled,this.#t)!==Yt(t.enabled,this.#t)||s!==this.#c)&&this.#b(s)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return dC(this,n)&&(this.#s=n,this.#a=this.options,this.#r=this.#t.state),n}getCurrentResult(){return this.#s}trackResult(e,t){return new Proxy(e,{get:(n,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#i.status==="pending"&&this.#i.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#s))}#d(e){this.#w();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Mt)),t}#g(){this.#x();const e=dr(this.options.staleTime,this.#t);if(Jr||this.#s.isStale||!Vu(e))return;const n=Db(this.#s.dataUpdatedAt,e)+1;this.#l=$r.setTimeout(()=>{this.#s.isStale||this.updateResult()},n)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#b(e){this.#_(),this.#c=e,!(Jr||Yt(this.options.enabled,this.#t)===!1||!Vu(this.#c)||this.#c===0)&&(this.#u=$r.setInterval(()=>{(this.options.refetchIntervalInBackground||lf.isFocused())&&this.#d()},this.#c))}#v(){this.#g(),this.#b(this.#y())}#x(){this.#l&&($r.clearTimeout(this.#l),this.#l=void 0)}#_(){this.#u&&($r.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const n=this.#t,r=this.options,s=this.#s,o=this.#r,i=this.#a,c=e!==n?e.state:this.#n,{state:l}=e;let u={...l},d=!1,f;if(t._optimisticResults){const E=this.hasListeners(),P=!E&&Sp(e,t),O=E&&Ep(e,n,t,r);(P||O)&&(u={...u,...$b(l.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:h,errorUpdatedAt:p,status:m}=u;f=u.data;let y=!1;if(t.placeholderData!==void 0&&f===void 0&&m==="pending"){let E;s?.isPlaceholderData&&t.placeholderData===i?.placeholderData?(E=s.data,y=!0):E=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,E!==void 0&&(m="success",f=Hu(s?.data,E,t),d=!0)}if(t.select&&f!==void 0&&!y)if(s&&f===o?.data&&t.select===this.#m)f=this.#f;else try{this.#m=t.select,f=t.select(f),f=Hu(s?.data,f,t),this.#f=f,this.#o=null}catch(E){this.#o=E}this.#o&&(h=this.#o,f=this.#f,p=Date.now(),m="error");const b=u.fetchStatus==="fetching",x=m==="pending",_=m==="error",w=x&&b,S=f!==void 0,k={status:m,fetchStatus:u.fetchStatus,isPending:x,isSuccess:m==="success",isError:_,isInitialLoading:w,isLoading:w,data:f,dataUpdatedAt:u.dataUpdatedAt,error:h,errorUpdatedAt:p,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:b,isRefetching:b&&!x,isLoadingError:_&&!S,isPaused:u.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:_&&S,isStale:uf(e,t),refetch:this.refetch,promise:this.#i,isEnabled:Yt(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const E=k.data!==void 0,P=k.status==="error"&&!E,O=j=>{P?j.reject(k.error):E&&j.resolve(k.data)},N=()=>{const j=this.#i=k.promise=qu();O(j)},A=this.#i;switch(A.status){case"pending":e.queryHash===n.queryHash&&O(A);break;case"fulfilled":(P||k.data!==A.value)&&N();break;case"rejected":(!P||k.error!==A.reason)&&N();break}}return k}updateResult(){const e=this.#s,t=this.createResult(this.#t,this.options);if(this.#r=this.#t.state,this.#a=this.options,this.#r.data!==void 0&&(this.#h=this.#t),Uu(t,e))return;this.#s=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,s=typeof r=="function"?r():r;if(s==="all"||!s&&!this.#p.size)return!0;const o=new Set(s??this.#p);return this.options.throwOnError&&o.add("error"),Object.keys(this.#s).some(i=>{const a=i;return this.#s[a]!==e[a]&&o.has(a)})};this.#S({listeners:n()})}#w(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#v()}#S(e){ut.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#s)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function uC(e,t){return Yt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Sp(e,t){return uC(e,t)||e.state.data!==void 0&&Zu(e,t,t.refetchOnMount)}function Zu(e,t,n){if(Yt(t.enabled,e)!==!1&&dr(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&uf(e,t)}return!1}function Ep(e,t,n,r){return(e!==t||Yt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&uf(e,n)}function uf(e,t){return Yt(t.enabled,e)!==!1&&e.isStaleByTime(dr(t.staleTime,e))}function dC(e,t){return!Uu(e.getCurrentResult(),t)}function kp(e){return{onFetch:(t,n)=>{const r=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],i=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},c=0;const l=async()=>{let u=!1;const d=p=>{nC(p,()=>t.signal,()=>u=!0)},f=Ib(t.options,t.fetchOptions),h=async(p,m,y)=>{if(u)return Promise.reject();if(m==null&&p.pages.length)return Promise.resolve(p);const x=(()=>{const C={client:t.client,queryKey:t.queryKey,pageParam:m,direction:y?"backward":"forward",meta:t.options.meta};return d(C),C})(),_=await f(x),{maxPages:w}=t.options,S=y?tC:eC;return{pages:S(p.pages,_,w),pageParams:S(p.pageParams,m,w)}};if(s&&o.length){const p=s==="backward",m=p?fC:Cp,y={pages:o,pageParams:i},b=m(r,y);a=await h(y,b,p)}else{const p=e??o.length;do{const m=c===0?i[0]??r.initialPageParam:Cp(r,a);if(c>0&&m==null)break;a=await h(a,m),c++}while(c<p)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Cp(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function fC(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var hC=class extends zb{#e;#t;#n;#s;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||pC(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#s?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#r({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#s=Fb({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(o,i)=>{this.#r({type:"failed",failureCount:o,error:i})},onPause:()=>{this.#r({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",s=!this.#s.canStart();try{if(r)t();else{this.#r({type:"pending",variables:e,isPaused:s}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);const i=await this.options.onMutate?.(e,n);i!==this.state.context&&this.#r({type:"pending",context:i,variables:e,isPaused:s})}const o=await this.#s.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#r({type:"success",data:o}),o}catch(o){try{await this.#n.config.onError?.(o,e,this.state.context,this,n)}catch(i){Promise.reject(i)}try{await this.options.onError?.(o,e,this.state.context,n)}catch(i){Promise.reject(i)}try{await this.#n.config.onSettled?.(void 0,o,this.state.variables,this.state.context,this,n)}catch(i){Promise.reject(i)}try{await this.options.onSettled?.(void 0,o,e,this.state.context,n)}catch(i){Promise.reject(i)}throw this.#r({type:"error",error:o}),o}finally{this.#n.runNext(this)}}#r(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,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{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),ut.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function pC(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var mC=class extends mi{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new hC({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=Bi(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Bi(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Bi(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(s=>s.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=Bi(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){ut.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>bp(t,n))}findAll(e={}){return this.getAll().filter(t=>bp(e,t))}notify(e){ut.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return ut.batch(()=>Promise.all(e.map(t=>t.continue().catch(Mt))))}};function Bi(e){return e.options.scope?.id}var gC=class extends mi{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,s=t.queryHash??cf(r,t);let o=this.get(s);return o||(o=new cC({client:e,queryKey:r,queryHash:s,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){ut.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>yp(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>yp(e,n)):t}notify(e){ut.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ut.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ut.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Vb=class{#e;#t;#n;#s;#r;#a;#i;#o;constructor(e={}){this.#e=e.queryCache||new gC,this.#t=e.mutationCache||new mC,this.#n=e.defaultOptions||{},this.#s=new Map,this.#r=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#i=lf.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#o=Ja.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#i?.(),this.#i=void 0,this.#o?.(),this.#o=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(dr(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=this.#e.get(r.queryHash)?.state.data,i=Xk(t,o);if(i!==void 0)return this.#e.build(this,r).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return ut.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;ut.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return ut.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=ut.batch(()=>this.#e.findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Mt).catch(Mt)}invalidateQueries(e,t={}){return ut.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=ut.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,n);return n.throwOnError||(o=o.catch(Mt)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(Mt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(dr(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Mt).catch(Mt)}fetchInfiniteQuery(e){return e.behavior=kp(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Mt).catch(Mt)}ensureInfiniteQueryData(e){return e.behavior=kp(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ja.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#s.set(Ko(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#s.values()],n={};return t.forEach(r=>{Zo(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#r.set(Ko(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{Zo(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=cf(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Xa&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Bb=v.createContext(void 0),yC=e=>{const t=v.useContext(Bb);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Ub=({client:e,children:t})=>(v.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),g.jsx(Bb.Provider,{value:e,children:t})),Wb=v.createContext(!1),bC=()=>v.useContext(Wb);Wb.Provider;function vC(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var xC=v.createContext(vC()),_C=()=>v.useContext(xC),wC=(e,t,n)=>{const r=n?.state.error&&typeof e.throwOnError=="function"?jb(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},SC=e=>{v.useEffect(()=>{e.clearReset()},[e])},EC=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||jb(n,[e.error,r])),kC=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},CC=(e,t)=>e.isLoading&&e.isFetching&&!t,RC=(e,t)=>e?.suspense&&t.isPending,Rp=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function PC(e,t,n){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=bC(),s=_C(),o=yC(),i=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(i);const a=o.getQueryCache().get(i.queryHash);process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),i._optimisticResults=r?"isRestoring":"optimistic",kC(i),wC(i,s,a),SC(s);const c=!o.getQueryCache().get(i.queryHash),[l]=v.useState(()=>new t(o,i)),u=l.getOptimisticResult(i),d=!r&&e.subscribed!==!1;if(v.useSyncExternalStore(v.useCallback(f=>{const h=d?l.subscribe(ut.batchCalls(f)):Mt;return l.updateResult(),h},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),v.useEffect(()=>{l.setOptions(i)},[i,l]),RC(i,u))throw Rp(i,l,s);if(EC({result:u,errorResetBoundary:s,throwOnError:i.throwOnError,query:a,suspense:i.suspense}))throw u.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(i,u),i.experimental_prefetchInRender&&!Jr&&CC(u,r)&&(c?Rp(i,l,s):a?.promise)?.catch(Mt).finally(()=>{l.updateResult()}),i.notifyOnChangeProps?u:l.trackResult(u)}function Go(e,t){return PC(e,lC)}var Ui={exports:{}},Yl={};var Pp;function OC(){if(Pp)return Yl;Pp=1;var e=T;function t(c,l){return c===l&&(c!==0||1/c===1/l)||c!==c&&l!==l}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,s=e.useRef,o=e.useEffect,i=e.useMemo,a=e.useDebugValue;return Yl.useSyncExternalStoreWithSelector=function(c,l,u,d,f){var h=s(null);if(h.current===null){var p={hasValue:!1,value:null};h.current=p}else p=h.current;h=i(function(){function y(S){if(!b){if(b=!0,x=S,S=d(S),f!==void 0&&p.hasValue){var C=p.value;if(f(C,S))return _=C}return _=S}if(C=_,n(x,S))return C;var k=d(S);return f!==void 0&&f(C,k)?(x=S,C):(x=S,_=k)}var b=!1,x,_,w=u===void 0?null:u;return[function(){return y(l())},w===null?void 0:function(){return y(w())}]},[l,u,d,f]);var m=r(c,h[0],h[1]);return o(function(){p.hasValue=!0,p.value=m},[m]),a(m),m},Yl}var Xl={};var Op;function TC(){return Op||(Op=1,process.env.NODE_ENV!=="production"&&(function(){function e(c,l){return c===l&&(c!==0||1/c===1/l)||c!==c&&l!==l}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=T,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,s=t.useRef,o=t.useEffect,i=t.useMemo,a=t.useDebugValue;Xl.useSyncExternalStoreWithSelector=function(c,l,u,d,f){var h=s(null);if(h.current===null){var p={hasValue:!1,value:null};h.current=p}else p=h.current;h=i(function(){function y(S){if(!b){if(b=!0,x=S,S=d(S),f!==void 0&&p.hasValue){var C=p.value;if(f(C,S))return _=C}return _=S}if(C=_,n(x,S))return C;var k=d(S);return f!==void 0&&f(C,k)?(x=S,C):(x=S,_=k)}var b=!1,x,_,w=u===void 0?null:u;return[function(){return y(l())},w===null?void 0:function(){return y(w())}]},[l,u,d,f]);var m=r(c,h[0],h[1]);return o(function(){p.hasValue=!0,p.value=m},[m]),a(m),m},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Xl}var Tp;function MC(){return Tp||(Tp=1,process.env.NODE_ENV==="production"?Ui.exports=OC():Ui.exports=TC()),Ui.exports}var AC=MC();function NC(e){e()}function DC(){let e=null,t=null;return{clear(){e=null,t=null},notify(){NC(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const s=t={callback:n,next:null,prev:t};return s.prev?s.prev.next=s:e=s,function(){!r||e===null||(r=!1,s.next?s.next.prev=s.prev:t=s.prev,s.prev?s.prev.next=s.next:e=s.next)}}}}var Mp={notify(){},get:()=>[]};function IC(e,t){let n,r=Mp,s=0,o=!1;function i(m){u();const y=r.subscribe(m);let b=!1;return()=>{b||(b=!0,y(),d())}}function a(){r.notify()}function c(){p.onStateChange&&p.onStateChange()}function l(){return o}function u(){s++,n||(n=e.subscribe(c),r=DC())}function d(){s--,n&&s===0&&(n(),n=void 0,r.clear(),r=Mp)}function f(){o||(o=!0,u())}function h(){o&&(o=!1,d())}const p={addNestedSub:i,notifyNestedSubs:a,handleChangeWrapper:c,isSubscribed:l,trySubscribe:f,tryUnsubscribe:h,getListeners:()=>r};return p}var jC=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",LC=jC(),FC=()=>typeof navigator<"u"&&navigator.product==="ReactNative",zC=FC(),$C=()=>LC||zC?v.useLayoutEffect:v.useEffect,VC=$C(),BC=Symbol.for("react-redux-context"),UC=typeof globalThis<"u"?globalThis:{};function WC(){if(!v.createContext)return{};const e=UC[BC]??=new Map;let t=e.get(v.createContext);return t||(t=v.createContext(null),process.env.NODE_ENV!=="production"&&(t.displayName="ReactRedux"),e.set(v.createContext,t)),t}var mr=WC();function HC(e){const{children:t,context:n,serverState:r,store:s}=e,o=v.useMemo(()=>{const c=IC(s),l={store:s,subscription:c,getServerState:r?()=>r:void 0};if(process.env.NODE_ENV==="production")return l;{const{identityFunctionCheck:u="once",stabilityCheck:d="once"}=e;return Object.assign(l,{stabilityCheck:d,identityFunctionCheck:u})}},[s,r]),i=v.useMemo(()=>s.getState(),[s]);VC(()=>{const{subscription:c}=o;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),i!==s.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[o,i]);const a=n||mr;return v.createElement(a.Provider,{value:o},t)}var Hb=HC;function df(e=mr){return function(){const n=v.useContext(e);if(process.env.NODE_ENV!=="production"&&!n)throw new Error("could not find react-redux context value; please ensure the component is wrapped in a <Provider>");return n}}var qb=df();function Kb(e=mr){const t=e===mr?qb:df(e),n=()=>{const{store:r}=t();return r};return Object.assign(n,{withTypes:()=>n}),n}var qC=Kb();function KC(e=mr){const t=e===mr?qC:Kb(e),n=()=>t().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var ZC=KC(),GC=(e,t)=>e===t;function YC(e=mr){const t=e===mr?qb:df(e),n=(r,s={})=>{const{equalityFn:o=GC}=typeof s=="function"?{equalityFn:s}:s;if(process.env.NODE_ENV!=="production"){if(!r)throw new Error("You must pass a selector to useSelector");if(typeof r!="function")throw new Error("You must pass a function as a selector to useSelector");if(typeof o!="function")throw new Error("You must pass a function as an equality function to useSelector")}const i=t(),{store:a,subscription:c,getServerState:l}=i,u=v.useRef(!0),d=v.useCallback({[r.name](h){const p=r(h);if(process.env.NODE_ENV!=="production"){const{devModeChecks:m={}}=typeof s=="function"?{}:s,{identityFunctionCheck:y,stabilityCheck:b}=i,{identityFunctionCheck:x,stabilityCheck:_}={stabilityCheck:b,identityFunctionCheck:y,...m};if(_==="always"||_==="once"&&u.current){const w=r(h);if(!o(p,w)){let S;try{throw new Error}catch(C){({stack:S}=C)}console.warn("Selector "+(r.name||"unknown")+` returned a different result when called with the same parameters. This can lead to unnecessary rerenders.
7
+ Selectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization`,{state:h,selected:p,selected2:w,stack:S})}}if((x==="always"||x==="once"&&u.current)&&p===h){let w;try{throw new Error}catch(S){({stack:w}=S)}console.warn("Selector "+(r.name||"unknown")+` returned the root state when called. This can lead to unnecessary rerenders.
8
+ Selectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.`,{stack:w})}u.current&&(u.current=!1)}return p}}[r.name],[r]),f=AC.useSyncExternalStoreWithSelector(c.addNestedSub,a.getState,l||a.getState,d,o);return v.useDebugValue(f),f};return Object.assign(n,{withTypes:()=>n}),n}var XC=YC();function JC(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const QC=e=>{switch(e){case"success":return nR;case"info":return sR;case"warning":return rR;case"error":return oR;default:return null}},eR=Array(12).fill(0),tR=({visible:e,className:t})=>T.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},T.createElement("div",{className:"sonner-spinner"},eR.map((n,r)=>T.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),nR=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},T.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),rR=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},T.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),sR=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},T.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),oR=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},T.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),iR=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},T.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),T.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),aR=()=>{const[e,t]=T.useState(document.hidden);return T.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let Gu=1;class cR{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...s}=t,o=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:Gu++,i=this.toasts.find(c=>c.id===o),a=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),i?this.toasts=this.toasts.map(c=>c.id===o?(this.publish({...c,...t,id:o,title:r}),{...c,...t,id:o,dismissible:a,title:r}):c):this.addToast({title:r,...s,dismissible:a,id:o}),o},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let o=r!==void 0,i;const a=s.then(async l=>{if(i=["resolve",l],T.isValidElement(l))o=!1,this.create({id:r,type:"default",message:l});else if(uR(l)&&!l.ok){o=!1;const d=typeof n.error=="function"?await n.error(`HTTP error! status: ${l.status}`):n.error,f=typeof n.description=="function"?await n.description(`HTTP error! status: ${l.status}`):n.description,p=typeof d=="object"&&!T.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:f,...p})}else if(l instanceof Error){o=!1;const d=typeof n.error=="function"?await n.error(l):n.error,f=typeof n.description=="function"?await n.description(l):n.description,p=typeof d=="object"&&!T.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:f,...p})}else if(n.success!==void 0){o=!1;const d=typeof n.success=="function"?await n.success(l):n.success,f=typeof n.description=="function"?await n.description(l):n.description,p=typeof d=="object"&&!T.isValidElement(d)?d:{message:d};this.create({id:r,type:"success",description:f,...p})}}).catch(async l=>{if(i=["reject",l],n.error!==void 0){o=!1;const u=typeof n.error=="function"?await n.error(l):n.error,d=typeof n.description=="function"?await n.description(l):n.description,h=typeof u=="object"&&!T.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:d,...h})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),c=()=>new Promise((l,u)=>a.then(()=>i[0]==="reject"?u(i[1]):l(i[1])).catch(u));return typeof r!="string"&&typeof r!="number"?{unwrap:c}:Object.assign(r,{unwrap:c})},this.custom=(t,n)=>{const r=n?.id||Gu++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Tt=new cR,lR=(e,t)=>{const n=t?.id||Gu++;return Tt.addToast({title:e,...t,id:n}),n},uR=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",dR=lR,fR=()=>Tt.toasts,hR=()=>Tt.getActiveToasts(),Ee=Object.assign(dR,{success:Tt.success,info:Tt.info,warning:Tt.warning,error:Tt.error,custom:Tt.custom,message:Tt.message,promise:Tt.promise,dismiss:Tt.dismiss,loading:Tt.loading},{getHistory:fR,getToasts:hR});JC("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Wi(e){return e.label!==void 0}const pR=3,mR="24px",gR="16px",Ap=4e3,yR=356,bR=14,vR=45,xR=200;function vn(...e){return e.filter(Boolean).join(" ")}function _R(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const wR=e=>{var t,n,r,s,o,i,a,c,l;const{invert:u,toast:d,unstyled:f,interacting:h,setHeights:p,visibleToasts:m,heights:y,index:b,toasts:x,expanded:_,removeToast:w,defaultRichColors:S,closeButton:C,style:k,cancelButtonStyle:E,actionButtonStyle:P,className:O="",descriptionClassName:N="",duration:A,position:j,gap:$,expandByDefault:q,classNames:D,icons:H,closeButtonAriaLabel:F="Close toast"}=e,[W,se]=T.useState(null),[I,Y]=T.useState(null),[K,Z]=T.useState(!1),[oe,ce]=T.useState(!1),[V,ee]=T.useState(!1),[me,le]=T.useState(!1),[fe,ge]=T.useState(!1),[Ze,_t]=T.useState(0),[rn,qt]=T.useState(0),st=T.useRef(d.duration||A||Ap),Qn=T.useRef(null),ot=T.useRef(null),ps=b===0,R=b+1<=m,M=d.type,z=d.dismissible!==!1,J=d.className||"",G=d.descriptionClassName||"",B=T.useMemo(()=>y.findIndex(he=>he.toastId===d.id)||0,[y,d.id]),Q=T.useMemo(()=>{var he;return(he=d.closeButton)!=null?he:C},[d.closeButton,C]),ue=T.useMemo(()=>d.duration||A||Ap,[d.duration,A]),ve=T.useRef(0),Ue=T.useRef(0),bn=T.useRef(0),wt=T.useRef(null),[Dl,ao]=j.split("-"),ms=T.useMemo(()=>y.reduce((he,it,ft)=>ft>=B?he:he+it.height,0),[y,B]),Ai=aR(),Ni=d.invert||u,co=M==="loading";Ue.current=T.useMemo(()=>B*$+ms,[B,ms]),T.useEffect(()=>{st.current=ue},[ue]),T.useEffect(()=>{Z(!0)},[]),T.useEffect(()=>{const he=ot.current;if(he){const it=he.getBoundingClientRect().height;return qt(it),p(ft=>[{toastId:d.id,height:it,position:d.position},...ft]),()=>p(ft=>ft.filter(Lt=>Lt.toastId!==d.id))}},[p,d.id]),T.useLayoutEffect(()=>{if(!K)return;const he=ot.current,it=he.style.height;he.style.height="auto";const ft=he.getBoundingClientRect().height;he.style.height=it,qt(ft),p(Lt=>Lt.find(ct=>ct.toastId===d.id)?Lt.map(ct=>ct.toastId===d.id?{...ct,height:ft}:ct):[{toastId:d.id,height:ft,position:d.position},...Lt])},[K,d.title,d.description,p,d.id,d.jsx,d.action,d.cancel]);const sn=T.useCallback(()=>{ce(!0),_t(Ue.current),p(he=>he.filter(it=>it.toastId!==d.id)),setTimeout(()=>{w(d)},xR)},[d,w,p,Ue]);T.useEffect(()=>{if(d.promise&&M==="loading"||d.duration===1/0||d.type==="loading")return;let he;return _||h||Ai?(()=>{if(bn.current<ve.current){const Lt=new Date().getTime()-ve.current;st.current=st.current-Lt}bn.current=new Date().getTime()})():st.current!==1/0&&(ve.current=new Date().getTime(),he=setTimeout(()=>{d.onAutoClose==null||d.onAutoClose.call(d,d),sn()},st.current)),()=>clearTimeout(he)},[_,h,d,M,Ai,sn]),T.useEffect(()=>{d.delete&&(sn(),d.onDismiss==null||d.onDismiss.call(d,d))},[sn,d.delete]);function rE(){var he;if(H?.loading){var it;return T.createElement("div",{className:vn(D?.loader,d==null||(it=d.classNames)==null?void 0:it.loader,"sonner-loader"),"data-visible":M==="loading"},H.loading)}return T.createElement(tR,{className:vn(D?.loader,d==null||(he=d.classNames)==null?void 0:he.loader),visible:M==="loading"})}const sE=d.icon||H?.[M]||QC(M);var Fh,zh;return T.createElement("li",{tabIndex:0,ref:ot,className:vn(O,J,D?.toast,d==null||(t=d.classNames)==null?void 0:t.toast,D?.default,D?.[M],d==null||(n=d.classNames)==null?void 0:n[M]),"data-sonner-toast":"","data-rich-colors":(Fh=d.richColors)!=null?Fh:S,"data-styled":!(d.jsx||d.unstyled||f),"data-mounted":K,"data-promise":!!d.promise,"data-swiped":fe,"data-removed":oe,"data-visible":R,"data-y-position":Dl,"data-x-position":ao,"data-index":b,"data-front":ps,"data-swiping":V,"data-dismissible":z,"data-type":M,"data-invert":Ni,"data-swipe-out":me,"data-swipe-direction":I,"data-expanded":!!(_||q&&K),"data-testid":d.testId,style:{"--index":b,"--toasts-before":b,"--z-index":x.length-b,"--offset":`${oe?Ze:Ue.current}px`,"--initial-height":q?"auto":`${rn}px`,...k,...d.style},onDragEnd:()=>{ee(!1),se(null),wt.current=null},onPointerDown:he=>{he.button!==2&&(co||!z||(Qn.current=new Date,_t(Ue.current),he.target.setPointerCapture(he.pointerId),he.target.tagName!=="BUTTON"&&(ee(!0),wt.current={x:he.clientX,y:he.clientY})))},onPointerUp:()=>{var he,it,ft;if(me||!z)return;wt.current=null;const Lt=Number(((he=ot.current)==null?void 0:he.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Di=Number(((it=ot.current)==null?void 0:it.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ct=new Date().getTime()-((ft=Qn.current)==null?void 0:ft.getTime()),Kt=W==="x"?Lt:Di,Ii=Math.abs(Kt)/ct;if(Math.abs(Kt)>=vR||Ii>.11){_t(Ue.current),d.onDismiss==null||d.onDismiss.call(d,d),Y(W==="x"?Lt>0?"right":"left":Di>0?"down":"up"),sn(),le(!0);return}else{var on,an;(on=ot.current)==null||on.style.setProperty("--swipe-amount-x","0px"),(an=ot.current)==null||an.style.setProperty("--swipe-amount-y","0px")}ge(!1),ee(!1),se(null)},onPointerMove:he=>{var it,ft,Lt;if(!wt.current||!z||((it=window.getSelection())==null?void 0:it.toString().length)>0)return;const ct=he.clientY-wt.current.y,Kt=he.clientX-wt.current.x;var Ii;const on=(Ii=e.swipeDirections)!=null?Ii:_R(j);!W&&(Math.abs(Kt)>1||Math.abs(ct)>1)&&se(Math.abs(Kt)>Math.abs(ct)?"x":"y");let an={x:0,y:0};const $h=Or=>1/(1.5+Math.abs(Or)/20);if(W==="y"){if(on.includes("top")||on.includes("bottom"))if(on.includes("top")&&ct<0||on.includes("bottom")&&ct>0)an.y=ct;else{const Or=ct*$h(ct);an.y=Math.abs(Or)<Math.abs(ct)?Or:ct}}else if(W==="x"&&(on.includes("left")||on.includes("right")))if(on.includes("left")&&Kt<0||on.includes("right")&&Kt>0)an.x=Kt;else{const Or=Kt*$h(Kt);an.x=Math.abs(Or)<Math.abs(Kt)?Or:Kt}(Math.abs(an.x)>0||Math.abs(an.y)>0)&&ge(!0),(ft=ot.current)==null||ft.style.setProperty("--swipe-amount-x",`${an.x}px`),(Lt=ot.current)==null||Lt.style.setProperty("--swipe-amount-y",`${an.y}px`)}},Q&&!d.jsx&&M!=="loading"?T.createElement("button",{"aria-label":F,"data-disabled":co,"data-close-button":!0,onClick:co||!z?()=>{}:()=>{sn(),d.onDismiss==null||d.onDismiss.call(d,d)},className:vn(D?.closeButton,d==null||(r=d.classNames)==null?void 0:r.closeButton)},(zh=H?.close)!=null?zh:iR):null,(M||d.icon||d.promise)&&d.icon!==null&&(H?.[M]!==null||d.icon)?T.createElement("div",{"data-icon":"",className:vn(D?.icon,d==null||(s=d.classNames)==null?void 0:s.icon)},d.promise||d.type==="loading"&&!d.icon?d.icon||rE():null,d.type!=="loading"?sE:null):null,T.createElement("div",{"data-content":"",className:vn(D?.content,d==null||(o=d.classNames)==null?void 0:o.content)},T.createElement("div",{"data-title":"",className:vn(D?.title,d==null||(i=d.classNames)==null?void 0:i.title)},d.jsx?d.jsx:typeof d.title=="function"?d.title():d.title),d.description?T.createElement("div",{"data-description":"",className:vn(N,G,D?.description,d==null||(a=d.classNames)==null?void 0:a.description)},typeof d.description=="function"?d.description():d.description):null),T.isValidElement(d.cancel)?d.cancel:d.cancel&&Wi(d.cancel)?T.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||E,onClick:he=>{Wi(d.cancel)&&z&&(d.cancel.onClick==null||d.cancel.onClick.call(d.cancel,he),sn())},className:vn(D?.cancelButton,d==null||(c=d.classNames)==null?void 0:c.cancelButton)},d.cancel.label):null,T.isValidElement(d.action)?d.action:d.action&&Wi(d.action)?T.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||P,onClick:he=>{Wi(d.action)&&(d.action.onClick==null||d.action.onClick.call(d.action,he),!he.defaultPrevented&&sn())},className:vn(D?.actionButton,d==null||(l=d.classNames)==null?void 0:l.actionButton)},d.action.label):null)};function Np(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function SR(e,t){const n={};return[e,t].forEach((r,s)=>{const o=s===1,i=o?"--mobile-offset":"--offset",a=o?gR:mR;function c(l){["top","right","bottom","left"].forEach(u=>{n[`${i}-${u}`]=typeof l=="number"?`${l}px`:l})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(l=>{r[l]===void 0?n[`${i}-${l}`]=a:n[`${i}-${l}`]=typeof r[l]=="number"?`${r[l]}px`:r[l]}):c(a)}),n}const ER=T.forwardRef(function(t,n){const{id:r,invert:s,position:o="bottom-right",hotkey:i=["altKey","KeyT"],expand:a,closeButton:c,className:l,offset:u,mobileOffset:d,theme:f="light",richColors:h,duration:p,style:m,visibleToasts:y=pR,toastOptions:b,dir:x=Np(),gap:_=bR,icons:w,containerAriaLabel:S="Notifications"}=t,[C,k]=T.useState([]),E=T.useMemo(()=>r?C.filter(K=>K.toasterId===r):C.filter(K=>!K.toasterId),[C,r]),P=T.useMemo(()=>Array.from(new Set([o].concat(E.filter(K=>K.position).map(K=>K.position)))),[E,o]),[O,N]=T.useState([]),[A,j]=T.useState(!1),[$,q]=T.useState(!1),[D,H]=T.useState(f!=="system"?f:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),F=T.useRef(null),W=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),se=T.useRef(null),I=T.useRef(!1),Y=T.useCallback(K=>{k(Z=>{var oe;return(oe=Z.find(ce=>ce.id===K.id))!=null&&oe.delete||Tt.dismiss(K.id),Z.filter(({id:ce})=>ce!==K.id)})},[]);return T.useEffect(()=>Tt.subscribe(K=>{if(K.dismiss){requestAnimationFrame(()=>{k(Z=>Z.map(oe=>oe.id===K.id?{...oe,delete:!0}:oe))});return}setTimeout(()=>{Dc.flushSync(()=>{k(Z=>{const oe=Z.findIndex(ce=>ce.id===K.id);return oe!==-1?[...Z.slice(0,oe),{...Z[oe],...K},...Z.slice(oe+1)]:[K,...Z]})})})}),[C]),T.useEffect(()=>{if(f!=="system"){H(f);return}if(f==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?H("dark"):H("light")),typeof window>"u")return;const K=window.matchMedia("(prefers-color-scheme: dark)");try{K.addEventListener("change",({matches:Z})=>{H(Z?"dark":"light")})}catch{K.addListener(({matches:oe})=>{try{H(oe?"dark":"light")}catch(ce){console.error(ce)}})}},[f]),T.useEffect(()=>{C.length<=1&&j(!1)},[C]),T.useEffect(()=>{const K=Z=>{var oe;if(i.every(ee=>Z[ee]||Z.code===ee)){var V;j(!0),(V=F.current)==null||V.focus()}Z.code==="Escape"&&(document.activeElement===F.current||(oe=F.current)!=null&&oe.contains(document.activeElement))&&j(!1)};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[i]),T.useEffect(()=>{if(F.current)return()=>{se.current&&(se.current.focus({preventScroll:!0}),se.current=null,I.current=!1)}},[F.current]),T.createElement("section",{ref:n,"aria-label":`${S} ${W}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},P.map((K,Z)=>{var oe;const[ce,V]=K.split("-");return E.length?T.createElement("ol",{key:K,dir:x==="auto"?Np():x,tabIndex:-1,ref:F,className:l,"data-sonner-toaster":!0,"data-sonner-theme":D,"data-y-position":ce,"data-x-position":V,style:{"--front-toast-height":`${((oe=O[0])==null?void 0:oe.height)||0}px`,"--width":`${yR}px`,"--gap":`${_}px`,...m,...SR(u,d)},onBlur:ee=>{I.current&&!ee.currentTarget.contains(ee.relatedTarget)&&(I.current=!1,se.current&&(se.current.focus({preventScroll:!0}),se.current=null))},onFocus:ee=>{ee.target instanceof HTMLElement&&ee.target.dataset.dismissible==="false"||I.current||(I.current=!0,se.current=ee.relatedTarget)},onMouseEnter:()=>j(!0),onMouseMove:()=>j(!0),onMouseLeave:()=>{$||j(!1)},onDragEnd:()=>j(!1),onPointerDown:ee=>{ee.target instanceof HTMLElement&&ee.target.dataset.dismissible==="false"||q(!0)},onPointerUp:()=>q(!1)},E.filter(ee=>!ee.position&&Z===0||ee.position===K).map((ee,me)=>{var le,fe;return T.createElement(wR,{key:ee.id,icons:w,index:me,toast:ee,defaultRichColors:h,duration:(le=b?.duration)!=null?le:p,className:b?.className,descriptionClassName:b?.descriptionClassName,invert:s,visibleToasts:y,closeButton:(fe=b?.closeButton)!=null?fe:c,interacting:$,position:K,style:b?.style,unstyled:b?.unstyled,classNames:b?.classNames,cancelButtonStyle:b?.cancelButtonStyle,actionButtonStyle:b?.actionButtonStyle,closeButtonAriaLabel:b?.closeButtonAriaLabel,removeToast:Y,toasts:E.filter(ge=>ge.position==ee.position),heights:O.filter(ge=>ge.position==ee.position),setHeights:N,expandByDefault:a,gap:_,expanded:A,swipeDirections:t.swipeDirections})})):null}))}),Dp=e=>{let t;const n=new Set,r=(l,u)=>{const d=typeof l=="function"?l(t):l;if(!Object.is(d,t)){const f=t;t=u??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(h=>h(t,f))}},s=()=>t,a={setState:r,getState:s,getInitialState:()=>c,subscribe:l=>(n.add(l),()=>n.delete(l))},c=t=e(r,s,a);return a},kR=(e=>e?Dp(e):Dp),CR=e=>e;function RR(e,t=CR){const n=T.useSyncExternalStore(e.subscribe,T.useCallback(()=>t(e.getState()),[e,t]),T.useCallback(()=>t(e.getInitialState()),[e,t]));return T.useDebugValue(n),n}const Ip=e=>{const t=kR(e),n=r=>RR(t,r);return Object.assign(n,t),n},Zb=(e=>e?Ip(e):Ip);function PR(e,t){let n;try{n=e()}catch{return}return{getItem:s=>{var o;const i=c=>c===null?null:JSON.parse(c,void 0),a=(o=n.getItem(s))!=null?o:null;return a instanceof Promise?a.then(i):i(a)},setItem:(s,o)=>n.setItem(s,JSON.stringify(o,void 0)),removeItem:s=>n.removeItem(s)}}const Yu=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Yu(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Yu(r)(n)}}}},OR=(e,t)=>(n,r,s)=>{let o={storage:PR(()=>localStorage),partialize:y=>y,version:0,merge:(y,b)=>({...b,...y}),...t},i=!1,a=0;const c=new Set,l=new Set;let u=o.storage;if(!u)return e((...y)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...y)},r,s);const d=()=>{const y=o.partialize({...r()});return u.setItem(o.name,{state:y,version:o.version})},f=s.setState;s.setState=(y,b)=>(f(y,b),d());const h=e((...y)=>(n(...y),d()),r,s);s.getInitialState=()=>h;let p;const m=()=>{var y,b;if(!u)return;const x=++a;i=!1,c.forEach(w=>{var S;return w((S=r())!=null?S:h)});const _=((b=o.onRehydrateStorage)==null?void 0:b.call(o,(y=r())!=null?y:h))||void 0;return Yu(u.getItem.bind(u))(o.name).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==o.version){if(o.migrate){const S=o.migrate(w.state,w.version);return S instanceof Promise?S.then(C=>[!0,C]):[!0,S]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,w.state];return[!1,void 0]}).then(w=>{var S;if(x!==a)return;const[C,k]=w;if(p=o.merge(k,(S=r())!=null?S:h),n(p,!0),C)return d()}).then(()=>{x===a&&(_?.(p,void 0),p=r(),i=!0,l.forEach(w=>w(p)))}).catch(w=>{x===a&&_?.(void 0,w)})};return s.persist={setOptions:y=>{o={...o,...y},y.storage&&(u=y.storage)},clearStorage:()=>{u?.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>m(),hasHydrated:()=>i,onHydrate:y=>(c.add(y),()=>{c.delete(y)}),onFinishHydration:y=>(l.add(y),()=>{l.delete(y)})},o.skipHydration||m(),p||h},TR=OR;function Gb(e,t){return function(){return e.apply(t,arguments)}}const{toString:MR}=Object.prototype,{getPrototypeOf:ff}=Object,{iterator:zc,toStringTag:Yb}=Symbol,$c=(e=>t=>{const n=MR.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),gn=e=>(e=e.toLowerCase(),t=>$c(t)===e),Vc=e=>t=>typeof t===e,{isArray:Qs}=Array,qs=Vc("undefined");function gi(e){return e!==null&&!qs(e)&&e.constructor!==null&&!qs(e.constructor)&&Dt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Xb=gn("ArrayBuffer");function AR(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Xb(e.buffer),t}const NR=Vc("string"),Dt=Vc("function"),Jb=Vc("number"),yi=e=>e!==null&&typeof e=="object",DR=e=>e===!0||e===!1,Ra=e=>{if($c(e)!=="object")return!1;const t=ff(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Yb in e)&&!(zc in e)},IR=e=>{if(!yi(e)||gi(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},jR=gn("Date"),LR=gn("File"),FR=gn("Blob"),zR=gn("FileList"),$R=e=>yi(e)&&Dt(e.pipe),VR=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Dt(e.append)&&((t=$c(e))==="formdata"||t==="object"&&Dt(e.toString)&&e.toString()==="[object FormData]"))},BR=gn("URLSearchParams"),[UR,WR,HR,qR]=["ReadableStream","Request","Response","Headers"].map(gn),KR=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function bi(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),Qs(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(gi(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let a;for(r=0;r<i;r++)a=o[r],t.call(null,e[a],a,e)}}function Qb(e,t){if(gi(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const Vr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ev=e=>!qs(e)&&e!==Vr;function Xu(){const{caseless:e,skipUndefined:t}=ev(this)&&this||{},n={},r=(s,o)=>{const i=e&&Qb(n,o)||o;Ra(n[i])&&Ra(s)?n[i]=Xu(n[i],s):Ra(s)?n[i]=Xu({},s):Qs(s)?n[i]=s.slice():(!t||!qs(s))&&(n[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&bi(arguments[s],r);return n}const ZR=(e,t,n,{allOwnKeys:r}={})=>(bi(t,(s,o)=>{n&&Dt(s)?Object.defineProperty(e,o,{value:Gb(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),GR=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),YR=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},XR=(e,t,n,r)=>{let s,o,i;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!a[i]&&(t[i]=e[i],a[i]=!0);e=n!==!1&&ff(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},JR=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},QR=e=>{if(!e)return null;if(Qs(e))return e;let t=e.length;if(!Jb(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},eP=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&ff(Uint8Array)),tP=(e,t)=>{const r=(e&&e[zc]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},nP=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},rP=gn("HTMLFormElement"),sP=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),jp=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),oP=gn("RegExp"),tv=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};bi(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},iP=e=>{tv(e,(t,n)=>{if(Dt(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Dt(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},aP=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return Qs(e)?r(e):r(String(e).split(t)),n},cP=()=>{},lP=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function uP(e){return!!(e&&Dt(e.append)&&e[Yb]==="FormData"&&e[zc])}const dP=e=>{const t=new Array(10),n=(r,s)=>{if(yi(r)){if(t.indexOf(r)>=0)return;if(gi(r))return r;if(!("toJSON"in r)){t[s]=r;const o=Qs(r)?[]:{};return bi(r,(i,a)=>{const c=n(i,s+1);!qs(c)&&(o[a]=c)}),t[s]=void 0,o}}return r};return n(e,0)},fP=gn("AsyncFunction"),hP=e=>e&&(yi(e)||Dt(e))&&Dt(e.then)&&Dt(e.catch),nv=((e,t)=>e?setImmediate:t?((n,r)=>(Vr.addEventListener("message",({source:s,data:o})=>{s===Vr&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),Vr.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Dt(Vr.postMessage)),pP=typeof queueMicrotask<"u"?queueMicrotask.bind(Vr):typeof process<"u"&&process.nextTick||nv,mP=e=>e!=null&&Dt(e[zc]),L={isArray:Qs,isArrayBuffer:Xb,isBuffer:gi,isFormData:VR,isArrayBufferView:AR,isString:NR,isNumber:Jb,isBoolean:DR,isObject:yi,isPlainObject:Ra,isEmptyObject:IR,isReadableStream:UR,isRequest:WR,isResponse:HR,isHeaders:qR,isUndefined:qs,isDate:jR,isFile:LR,isBlob:FR,isRegExp:oP,isFunction:Dt,isStream:$R,isURLSearchParams:BR,isTypedArray:eP,isFileList:zR,forEach:bi,merge:Xu,extend:ZR,trim:KR,stripBOM:GR,inherits:YR,toFlatObject:XR,kindOf:$c,kindOfTest:gn,endsWith:JR,toArray:QR,forEachEntry:tP,matchAll:nP,isHTMLForm:rP,hasOwnProperty:jp,hasOwnProp:jp,reduceDescriptors:tv,freezeMethods:iP,toObjectSet:aP,toCamelCase:sP,noop:cP,toFiniteNumber:lP,findKey:Qb,global:Vr,isContextDefined:ev,isSpecCompliantForm:uP,toJSONObject:dP,isAsyncFn:fP,isThenable:hP,setImmediate:nv,asap:pP,isIterable:mP};let ae=class rv extends Error{static from(t,n,r,s,o,i){const a=new rv(t.message,n||t.code,r,s,o);return a.cause=t,a.name=t.name,i&&Object.assign(a,i),a}constructor(t,n,r,s,o){super(t),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:L.toJSONObject(this.config),code:this.code,status:this.status}}};ae.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";ae.ERR_BAD_OPTION="ERR_BAD_OPTION";ae.ECONNABORTED="ECONNABORTED";ae.ETIMEDOUT="ETIMEDOUT";ae.ERR_NETWORK="ERR_NETWORK";ae.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";ae.ERR_DEPRECATED="ERR_DEPRECATED";ae.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";ae.ERR_BAD_REQUEST="ERR_BAD_REQUEST";ae.ERR_CANCELED="ERR_CANCELED";ae.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";ae.ERR_INVALID_URL="ERR_INVALID_URL";const gP=null;function Ju(e){return L.isPlainObject(e)||L.isArray(e)}function sv(e){return L.endsWith(e,"[]")?e.slice(0,-2):e}function Lp(e,t,n){return e?e.concat(t).map(function(s,o){return s=sv(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function yP(e){return L.isArray(e)&&!e.some(Ju)}const bP=L.toFlatObject(L,{},null,function(t){return/^is[A-Z]/.test(t)});function Bc(e,t,n){if(!L.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=L.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,y){return!L.isUndefined(y[m])});const r=n.metaTokens,s=n.visitor||u,o=n.dots,i=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&L.isSpecCompliantForm(t);if(!L.isFunction(s))throw new TypeError("visitor must be a function");function l(p){if(p===null)return"";if(L.isDate(p))return p.toISOString();if(L.isBoolean(p))return p.toString();if(!c&&L.isBlob(p))throw new ae("Blob is not supported. Use a Buffer instead.");return L.isArrayBuffer(p)||L.isTypedArray(p)?c&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function u(p,m,y){let b=p;if(p&&!y&&typeof p=="object"){if(L.endsWith(m,"{}"))m=r?m:m.slice(0,-2),p=JSON.stringify(p);else if(L.isArray(p)&&yP(p)||(L.isFileList(p)||L.endsWith(m,"[]"))&&(b=L.toArray(p)))return m=sv(m),b.forEach(function(_,w){!(L.isUndefined(_)||_===null)&&t.append(i===!0?Lp([m],w,o):i===null?m:m+"[]",l(_))}),!1}return Ju(p)?!0:(t.append(Lp(y,m,o),l(p)),!1)}const d=[],f=Object.assign(bP,{defaultVisitor:u,convertValue:l,isVisitable:Ju});function h(p,m){if(!L.isUndefined(p)){if(d.indexOf(p)!==-1)throw Error("Circular reference detected in "+m.join("."));d.push(p),L.forEach(p,function(b,x){(!(L.isUndefined(b)||b===null)&&s.call(t,b,L.isString(x)?x.trim():x,m,f))===!0&&h(b,m?m.concat(x):[x])}),d.pop()}}if(!L.isObject(e))throw new TypeError("data must be an object");return h(e),t}function Fp(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function hf(e,t){this._pairs=[],e&&Bc(e,this,t)}const ov=hf.prototype;ov.append=function(t,n){this._pairs.push([t,n])};ov.toString=function(t){const n=t?function(r){return t.call(this,r,Fp)}:Fp;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function vP(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function iv(e,t,n){if(!t)return e;const r=n&&n.encode||vP,s=L.isFunction(n)?{serialize:n}:n,o=s&&s.serialize;let i;if(o?i=o(t,s):i=L.isURLSearchParams(t)?t.toString():new hf(t,s).toString(r),i){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class zp{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){L.forEach(this.handlers,function(r){r!==null&&t(r)})}}const av={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},xP=typeof URLSearchParams<"u"?URLSearchParams:hf,_P=typeof FormData<"u"?FormData:null,wP=typeof Blob<"u"?Blob:null,SP={isBrowser:!0,classes:{URLSearchParams:xP,FormData:_P,Blob:wP},protocols:["http","https","file","blob","url","data"]},pf=typeof window<"u"&&typeof document<"u",Qu=typeof navigator=="object"&&navigator||void 0,EP=pf&&(!Qu||["ReactNative","NativeScript","NS"].indexOf(Qu.product)<0),kP=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",CP=pf&&window.location.href||"http://localhost",RP=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:pf,hasStandardBrowserEnv:EP,hasStandardBrowserWebWorkerEnv:kP,navigator:Qu,origin:CP},Symbol.toStringTag,{value:"Module"})),yt={...RP,...SP};function PP(e,t){return Bc(e,new yt.classes.URLSearchParams,{visitor:function(n,r,s,o){return yt.isNode&&L.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function OP(e){return L.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function TP(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}function cv(e){function t(n,r,s,o){let i=n[o++];if(i==="__proto__")return!0;const a=Number.isFinite(+i),c=o>=n.length;return i=!i&&L.isArray(s)?s.length:i,c?(L.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!a):((!s[i]||!L.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&L.isArray(s[i])&&(s[i]=TP(s[i])),!a)}if(L.isFormData(e)&&L.isFunction(e.entries)){const n={};return L.forEachEntry(e,(r,s)=>{t(OP(r),s,n,0)}),n}return null}function MP(e,t,n){if(L.isString(e))try{return(t||JSON.parse)(e),L.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const vi={transitional:av,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=L.isObject(t);if(o&&L.isHTMLForm(t)&&(t=new FormData(t)),L.isFormData(t))return s?JSON.stringify(cv(t)):t;if(L.isArrayBuffer(t)||L.isBuffer(t)||L.isStream(t)||L.isFile(t)||L.isBlob(t)||L.isReadableStream(t))return t;if(L.isArrayBufferView(t))return t.buffer;if(L.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return PP(t,this.formSerializer).toString();if((a=L.isFileList(t))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Bc(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),MP(t)):t}],transformResponse:[function(t){const n=this.transitional||vi.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(L.isResponse(t)||L.isReadableStream(t))return t;if(t&&L.isString(t)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(a){if(i)throw a.name==="SyntaxError"?ae.from(a,ae.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:yt.classes.FormData,Blob:yt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};L.forEach(["delete","get","head","post","put","patch"],e=>{vi.headers[e]={}});const AP=L.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),NP=e=>{const t={};let n,r,s;return e&&e.split(`
9
+ `).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&AP[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},$p=Symbol("internals");function yo(e){return e&&String(e).trim().toLowerCase()}function Pa(e){return e===!1||e==null?e:L.isArray(e)?e.map(Pa):String(e)}function DP(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const IP=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Jl(e,t,n,r,s){if(L.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!L.isString(t)){if(L.isString(r))return t.indexOf(r)!==-1;if(L.isRegExp(r))return r.test(t)}}function jP(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function LP(e,t){const n=L.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,o,i){return this[r].call(this,t,s,o,i)},configurable:!0})})}let It=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(a,c,l){const u=yo(c);if(!u)throw new Error("header name must be a non-empty string");const d=L.findKey(s,u);(!d||s[d]===void 0||l===!0||l===void 0&&s[d]!==!1)&&(s[d||c]=Pa(a))}const i=(a,c)=>L.forEach(a,(l,u)=>o(l,u,c));if(L.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(L.isString(t)&&(t=t.trim())&&!IP(t))i(NP(t),n);else if(L.isObject(t)&&L.isIterable(t)){let a={},c,l;for(const u of t){if(!L.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[l=u[0]]=(c=a[l])?L.isArray(c)?[...c,u[1]]:[c,u[1]]:u[1]}i(a,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=yo(t),t){const r=L.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return DP(s);if(L.isFunction(n))return n.call(this,s,r);if(L.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=yo(t),t){const r=L.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Jl(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(i){if(i=yo(i),i){const a=L.findKey(r,i);a&&(!n||Jl(r,r[a],a,n))&&(delete r[a],s=!0)}}return L.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||Jl(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return L.forEach(this,(s,o)=>{const i=L.findKey(r,o);if(i){n[i]=Pa(s),delete n[o];return}const a=t?jP(o):String(o).trim();a!==o&&delete n[o],n[a]=Pa(s),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return L.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&L.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
10
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[$p]=this[$p]={accessors:{}}).accessors,s=this.prototype;function o(i){const a=yo(i);r[a]||(LP(s,i),r[a]=!0)}return L.isArray(t)?t.forEach(o):o(t),this}};It.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);L.reduceDescriptors(It.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});L.freezeMethods(It);function Ql(e,t){const n=this||vi,r=t||n,s=It.from(r.headers);let o=r.data;return L.forEach(e,function(a){o=a.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function lv(e){return!!(e&&e.__CANCEL__)}let xi=class extends ae{constructor(t,n,r){super(t??"canceled",ae.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function uv(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new ae("Request failed with status code "+n.status,[ae.ERR_BAD_REQUEST,ae.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function FP(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function zP(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(c){const l=Date.now(),u=r[o];i||(i=l),n[s]=c,r[s]=l;let d=o,f=0;for(;d!==s;)f+=n[d++],d=d%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),l-i<t)return;const h=u&&l-u;return h?Math.round(f*1e3/h):void 0}}function $P(e,t){let n=0,r=1e3/t,s,o;const i=(l,u=Date.now())=>{n=u,s=null,o&&(clearTimeout(o),o=null),e(...l)};return[(...l)=>{const u=Date.now(),d=u-n;d>=r?i(l,u):(s=l,o||(o=setTimeout(()=>{o=null,i(s)},r-d)))},()=>s&&i(s)]}const Qa=(e,t,n=3)=>{let r=0;const s=zP(50,250);return $P(o=>{const i=o.loaded,a=o.lengthComputable?o.total:void 0,c=i-r,l=s(c),u=i<=a;r=i;const d={loaded:i,total:a,progress:a?i/a:void 0,bytes:c,rate:l||void 0,estimated:l&&a&&u?(a-i)/l:void 0,event:o,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(d)},n)},Vp=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Bp=e=>(...t)=>L.asap(()=>e(...t)),VP=yt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,yt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(yt.origin),yt.navigator&&/(msie|trident)/i.test(yt.navigator.userAgent)):()=>!0,BP=yt.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];L.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),L.isString(r)&&a.push(`path=${r}`),L.isString(s)&&a.push(`domain=${s}`),o===!0&&a.push("secure"),L.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function UP(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function WP(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function dv(e,t,n){let r=!UP(t);return e&&(r||n==!1)?WP(e,t):t}const Up=e=>e instanceof It?{...e}:e;function Qr(e,t){t=t||{};const n={};function r(l,u,d,f){return L.isPlainObject(l)&&L.isPlainObject(u)?L.merge.call({caseless:f},l,u):L.isPlainObject(u)?L.merge({},u):L.isArray(u)?u.slice():u}function s(l,u,d,f){if(L.isUndefined(u)){if(!L.isUndefined(l))return r(void 0,l,d,f)}else return r(l,u,d,f)}function o(l,u){if(!L.isUndefined(u))return r(void 0,u)}function i(l,u){if(L.isUndefined(u)){if(!L.isUndefined(l))return r(void 0,l)}else return r(void 0,u)}function a(l,u,d){if(d in t)return r(l,u);if(d in e)return r(void 0,l)}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(l,u,d)=>s(Up(l),Up(u),d,!0)};return L.forEach(Object.keys({...e,...t}),function(u){const d=c[u]||s,f=d(e[u],t[u],u);L.isUndefined(f)&&d!==a||(n[u]=f)}),n}const fv=e=>{const t=Qr({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=It.from(i),t.url=iv(dv(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),L.isFormData(n)){if(yt.hasStandardBrowserEnv||yt.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(L.isFunction(n.getHeaders)){const c=n.getHeaders(),l=["content-type","content-length"];Object.entries(c).forEach(([u,d])=>{l.includes(u.toLowerCase())&&i.set(u,d)})}}if(yt.hasStandardBrowserEnv&&(r&&L.isFunction(r)&&(r=r(t)),r||r!==!1&&VP(t.url))){const c=s&&o&&BP.read(o);c&&i.set(s,c)}return t},HP=typeof XMLHttpRequest<"u",qP=HP&&function(e){return new Promise(function(n,r){const s=fv(e);let o=s.data;const i=It.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:l}=s,u,d,f,h,p;function m(){h&&h(),p&&p(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function b(){if(!y)return;const _=It.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),S={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:_,config:e,request:y};uv(function(k){n(k),m()},function(k){r(k),m()},S),y=null}"onloadend"in y?y.onloadend=b:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(b)},y.onabort=function(){y&&(r(new ae("Request aborted",ae.ECONNABORTED,e,y)),y=null)},y.onerror=function(w){const S=w&&w.message?w.message:"Network Error",C=new ae(S,ae.ERR_NETWORK,e,y);C.event=w||null,r(C),y=null},y.ontimeout=function(){let w=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const S=s.transitional||av;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),r(new ae(w,S.clarifyTimeoutError?ae.ETIMEDOUT:ae.ECONNABORTED,e,y)),y=null},o===void 0&&i.setContentType(null),"setRequestHeader"in y&&L.forEach(i.toJSON(),function(w,S){y.setRequestHeader(S,w)}),L.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),a&&a!=="json"&&(y.responseType=s.responseType),l&&([f,p]=Qa(l,!0),y.addEventListener("progress",f)),c&&y.upload&&([d,h]=Qa(c),y.upload.addEventListener("progress",d),y.upload.addEventListener("loadend",h)),(s.cancelToken||s.signal)&&(u=_=>{y&&(r(!_||_.type?new xi(null,e,y):_),y.abort(),y=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const x=FP(s.url);if(x&&yt.protocols.indexOf(x)===-1){r(new ae("Unsupported protocol "+x+":",ae.ERR_BAD_REQUEST,e));return}y.send(o||null)})},KP=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const o=function(l){if(!s){s=!0,a();const u=l instanceof Error?l:this.reason;r.abort(u instanceof ae?u:new xi(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{i=null,o(new ae(`timeout of ${t}ms exceeded`,ae.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(o):l.removeEventListener("abort",o)}),e=null)};e.forEach(l=>l.addEventListener("abort",o));const{signal:c}=r;return c.unsubscribe=()=>L.asap(a),c}},ZP=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},GP=async function*(e,t){for await(const n of YP(e))yield*ZP(n,t)},YP=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},Wp=(e,t,n,r)=>{const s=GP(e,t);let o=0,i,a=c=>{i||(i=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:l,value:u}=await s.next();if(l){a(),c.close();return}let d=u.byteLength;if(n){let f=o+=d;n(f)}c.enqueue(new Uint8Array(u))}catch(l){throw a(l),l}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},Hp=64*1024,{isFunction:Hi}=L,XP=(({Request:e,Response:t})=>({Request:e,Response:t}))(L.global),{ReadableStream:qp,TextEncoder:Kp}=L.global,Zp=(e,...t)=>{try{return!!e(...t)}catch{return!1}},JP=e=>{e=L.merge.call({skipUndefined:!0},XP,e);const{fetch:t,Request:n,Response:r}=e,s=t?Hi(t):typeof fetch=="function",o=Hi(n),i=Hi(r);if(!s)return!1;const a=s&&Hi(qp),c=s&&(typeof Kp=="function"?(p=>m=>p.encode(m))(new Kp):async p=>new Uint8Array(await new n(p).arrayBuffer())),l=o&&a&&Zp(()=>{let p=!1;const m=new n(yt.origin,{body:new qp,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!m}),u=i&&a&&Zp(()=>L.isReadableStream(new r("").body)),d={stream:u&&(p=>p.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!d[p]&&(d[p]=(m,y)=>{let b=m&&m[p];if(b)return b.call(m);throw new ae(`Response type '${p}' is not supported`,ae.ERR_NOT_SUPPORT,y)})});const f=async p=>{if(p==null)return 0;if(L.isBlob(p))return p.size;if(L.isSpecCompliantForm(p))return(await new n(yt.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(L.isArrayBufferView(p)||L.isArrayBuffer(p))return p.byteLength;if(L.isURLSearchParams(p)&&(p=p+""),L.isString(p))return(await c(p)).byteLength},h=async(p,m)=>{const y=L.toFiniteNumber(p.getContentLength());return y??f(m)};return async p=>{let{url:m,method:y,data:b,signal:x,cancelToken:_,timeout:w,onDownloadProgress:S,onUploadProgress:C,responseType:k,headers:E,withCredentials:P="same-origin",fetchOptions:O}=fv(p),N=t||fetch;k=k?(k+"").toLowerCase():"text";let A=KP([x,_&&_.toAbortSignal()],w),j=null;const $=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let q;try{if(C&&l&&y!=="get"&&y!=="head"&&(q=await h(E,b))!==0){let I=new n(m,{method:"POST",body:b,duplex:"half"}),Y;if(L.isFormData(b)&&(Y=I.headers.get("content-type"))&&E.setContentType(Y),I.body){const[K,Z]=Vp(q,Qa(Bp(C)));b=Wp(I.body,Hp,K,Z)}}L.isString(P)||(P=P?"include":"omit");const D=o&&"credentials"in n.prototype,H={...O,signal:A,method:y.toUpperCase(),headers:E.normalize().toJSON(),body:b,duplex:"half",credentials:D?P:void 0};j=o&&new n(m,H);let F=await(o?N(j,O):N(m,H));const W=u&&(k==="stream"||k==="response");if(u&&(S||W&&$)){const I={};["status","statusText","headers"].forEach(oe=>{I[oe]=F[oe]});const Y=L.toFiniteNumber(F.headers.get("content-length")),[K,Z]=S&&Vp(Y,Qa(Bp(S),!0))||[];F=new r(Wp(F.body,Hp,K,()=>{Z&&Z(),$&&$()}),I)}k=k||"text";let se=await d[L.findKey(d,k)||"text"](F,p);return!W&&$&&$(),await new Promise((I,Y)=>{uv(I,Y,{data:se,headers:It.from(F.headers),status:F.status,statusText:F.statusText,config:p,request:j})})}catch(D){throw $&&$(),D&&D.name==="TypeError"&&/Load failed|fetch/i.test(D.message)?Object.assign(new ae("Network Error",ae.ERR_NETWORK,p,j),{cause:D.cause||D}):ae.from(D,D&&D.code,p,j)}}},QP=new Map,hv=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i=o.length,a=i,c,l,u=QP;for(;a--;)c=o[a],l=u.get(c),l===void 0&&u.set(c,l=a?new Map:JP(t)),u=l;return l};hv();const mf={http:gP,xhr:qP,fetch:{get:hv}};L.forEach(mf,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Gp=e=>`- ${e}`,eO=e=>L.isFunction(e)||e===null||e===!1;function tO(e,t){e=L.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){r=e[i];let a;if(s=r,!eO(r)&&(s=mf[(a=String(r)).toLowerCase()],s===void 0))throw new ae(`Unknown adapter '${a}'`);if(s&&(L.isFunction(s)||(s=s.get(t))))break;o[a||"#"+i]=s}if(!s){const i=Object.entries(o).map(([c,l])=>`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=n?i.length>1?`since :
11
+ `+i.map(Gp).join(`
12
+ `):" "+Gp(i[0]):"as no adapter specified";throw new ae("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const pv={getAdapter:tO,adapters:mf};function eu(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new xi(null,e)}function Yp(e){return eu(e),e.headers=It.from(e.headers),e.data=Ql.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),pv.getAdapter(e.adapter||vi.adapter,e)(e).then(function(r){return eu(e),r.data=Ql.call(e,e.transformResponse,r),r.headers=It.from(r.headers),r},function(r){return lv(r)||(eu(e),r&&r.response&&(r.response.data=Ql.call(e,e.transformResponse,r.response),r.response.headers=It.from(r.response.headers))),Promise.reject(r)})}const mv="1.13.4",Uc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Uc[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Xp={};Uc.transitional=function(t,n,r){function s(o,i){return"[Axios v"+mv+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,a)=>{if(t===!1)throw new ae(s(i," has been removed"+(n?" in "+n:"")),ae.ERR_DEPRECATED);return n&&!Xp[i]&&(Xp[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,a):!0}};Uc.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function nO(e,t,n){if(typeof e!="object")throw new ae("options must be an object",ae.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const a=e[o],c=a===void 0||i(a,o,e);if(c!==!0)throw new ae("option "+o+" must be "+c,ae.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ae("Unknown option "+o,ae.ERR_BAD_OPTION)}}const Oa={assertOptions:nO,validators:Uc},xn=Oa.validators;let qr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new zp,response:new zp}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=`
13
+ `+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Qr(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&Oa.assertOptions(r,{silentJSONParsing:xn.transitional(xn.boolean),forcedJSONParsing:xn.transitional(xn.boolean),clarifyTimeoutError:xn.transitional(xn.boolean)},!1),s!=null&&(L.isFunction(s)?n.paramsSerializer={serialize:s}:Oa.assertOptions(s,{encode:xn.function,serialize:xn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Oa.assertOptions(n,{baseUrl:xn.spelling("baseURL"),withXsrfToken:xn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&L.merge(o.common,o[n.method]);o&&L.forEach(["delete","get","head","post","put","patch","common"],p=>{delete o[p]}),n.headers=It.concat(i,o);const a=[];let c=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(c=c&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const l=[];this.interceptors.response.forEach(function(m){l.push(m.fulfilled,m.rejected)});let u,d=0,f;if(!c){const p=[Yp.bind(this),void 0];for(p.unshift(...a),p.push(...l),f=p.length,u=Promise.resolve(n);d<f;)u=u.then(p[d++],p[d++]);return u}f=a.length;let h=n;for(;d<f;){const p=a[d++],m=a[d++];try{h=p(h)}catch(y){m.call(this,y);break}}try{u=Yp.call(this,h)}catch(p){return Promise.reject(p)}for(d=0,f=l.length;d<f;)u=u.then(l[d++],l[d++]);return u}getUri(t){t=Qr(this.defaults,t);const n=dv(t.baseURL,t.url,t.allowAbsoluteUrls);return iv(n,t.params,t.paramsSerializer)}};L.forEach(["delete","get","head","options"],function(t){qr.prototype[t]=function(n,r){return this.request(Qr(r||{},{method:t,url:n,data:(r||{}).data}))}});L.forEach(["post","put","patch"],function(t){function n(r){return function(o,i,a){return this.request(Qr(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}qr.prototype[t]=n(),qr.prototype[t+"Form"]=n(!0)});let rO=class gv{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(a=>{r.subscribe(a),o=a}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,a){r.reason||(r.reason=new xi(o,i,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new gv(function(s){t=s}),cancel:t}}};function sO(e){return function(n){return e.apply(null,n)}}function oO(e){return L.isObject(e)&&e.isAxiosError===!0}const ed={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ed).forEach(([e,t])=>{ed[t]=e});function yv(e){const t=new qr(e),n=Gb(qr.prototype.request,t);return L.extend(n,qr.prototype,t,{allOwnKeys:!0}),L.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return yv(Qr(e,s))},n}const qe=yv(vi);qe.Axios=qr;qe.CanceledError=xi;qe.CancelToken=rO;qe.isCancel=lv;qe.VERSION=mv;qe.toFormData=Bc;qe.AxiosError=ae;qe.Cancel=qe.CanceledError;qe.all=function(t){return Promise.all(t)};qe.spread=sO;qe.isAxiosError=oO;qe.mergeConfig=Qr;qe.AxiosHeaders=It;qe.formToJSON=e=>cv(L.isHTMLForm(e)?new FormData(e):e);qe.getAdapter=pv.getAdapter;qe.HttpStatusCode=ed;qe.default=qe;const{Axios:TH,AxiosError:MH,CanceledError:AH,isCancel:NH,CancelToken:DH,VERSION:IH,all:jH,Cancel:LH,isAxiosError:FH,spread:zH,toFormData:$H,AxiosHeaders:VH,HttpStatusCode:BH,formToJSON:UH,getAdapter:WH,mergeConfig:HH}=qe,td={apiBase:"http://localhost:3000/api",wsPath:"/ws"},Te=qe.create({baseURL:td.apiBase});function iO(e,t){Te.defaults.baseURL=e,t&&(Te.defaults.headers.common.Authorization=`Bearer ${t}`)}function nd(e){e?Te.defaults.headers.common.Authorization=`Bearer ${e}`:delete Te.defaults.headers.common.Authorization}const Wc=Zb()(TR(e=>({token:null,email:null,setAuth:(t,n)=>{nd(t),e({token:t,email:n})},logout:()=>{nd(null),e({token:null,email:null})}}),{name:"kuma_clone_auth"})),Jp=Wc.getState();Jp.token&&nd(Jp.token);const bv="pulsewatch.theme";function rd(e){const t=document.documentElement;e==="dark"?t.classList.add("dark"):t.classList.remove("dark"),t.style.colorScheme=e,localStorage.setItem(bv,e)}const vv=Zb((e,t)=>({mode:"light",setMode:n=>{rd(n),e({mode:n})},toggle:()=>{const n=t().mode==="dark"?"light":"dark";rd(n),e({mode:n})}}));function aO(){const t=localStorage.getItem(bv)==="dark"?"dark":"light";rd(t),vv.setState({mode:t})}var _i=e=>e.type==="checkbox",Br=e=>e instanceof Date,At=e=>e==null;const xv=e=>typeof e=="object";var Je=e=>!At(e)&&!Array.isArray(e)&&xv(e)&&!Br(e),_v=e=>Je(e)&&e.target?_i(e.target)?e.target.checked:e.target.value:e,cO=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,wv=(e,t)=>e.has(cO(t)),lO=e=>{const t=e.constructor&&e.constructor.prototype;return Je(t)&&t.hasOwnProperty("isPrototypeOf")},gf=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ge(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(gf&&(e instanceof Blob||t))return e;const n=Array.isArray(e);if(!n&&!(Je(e)&&lO(e)))return e;const r=n?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=Ge(e[s]));return r}var Hc=e=>/^\w*$/.test(e),Fe=e=>e===void 0,yf=e=>Array.isArray(e)?e.filter(Boolean):[],bf=e=>yf(e.replace(/["|']|\]/g,"").split(/\.|\[/)),X=(e,t,n)=>{if(!t||!Je(e))return n;const r=(Hc(t)?[t]:bf(t)).reduce((s,o)=>At(s)?s:s[o],e);return Fe(r)||r===e?Fe(e[t])?n:e[t]:r},zt=e=>typeof e=="boolean",kt=e=>typeof e=="function",ke=(e,t,n)=>{let r=-1;const s=Hc(t)?[t]:bf(t),o=s.length,i=o-1;for(;++r<o;){const a=s[r];let c=n;if(r!==i){const l=e[a];c=Je(l)||Array.isArray(l)?l:isNaN(+s[r+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=c,e=e[a]}};const ec={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},un={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Nn={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},vf=T.createContext(null);vf.displayName="HookFormControlContext";const xf=()=>T.useContext(vf);var Sv=(e,t,n,r=!0)=>{const s={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const i=o;return t._proxyFormState[i]!==un.all&&(t._proxyFormState[i]=!r||un.all),n&&(n[i]=!0),e[i]}});return s};const _f=typeof window<"u"?T.useLayoutEffect:T.useEffect;function Ev(e){const t=xf(),{control:n=t,disabled:r,name:s,exact:o}=e||{},[i,a]=T.useState(n._formState),c=T.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return _f(()=>n._subscribe({name:s,formState:c.current,exact:o,callback:l=>{!r&&a({...n._formState,...l})}}),[s,r,o]),T.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),T.useMemo(()=>Sv(i,n,c.current,!1),[i,n])}var Vt=e=>typeof e=="string",sd=(e,t,n,r,s)=>Vt(e)?(r&&t.watch.add(e),X(n,e,s)):Array.isArray(e)?e.map(o=>(r&&t.watch.add(o),X(n,o))):(r&&(t.watchAll=!0),n),od=e=>At(e)||!xv(e);function dn(e,t,n=new WeakSet){if(od(e)||od(t))return Object.is(e,t);if(Br(e)&&Br(t))return Object.is(e.getTime(),t.getTime());const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const o of r){const i=e[o];if(!s.includes(o))return!1;if(o!=="ref"){const a=t[o];if(Br(i)&&Br(a)||Je(i)&&Je(a)||Array.isArray(i)&&Array.isArray(a)?!dn(i,a,n):!Object.is(i,a))return!1}}return!0}function uO(e){const t=xf(),{control:n=t,name:r,defaultValue:s,disabled:o,exact:i,compute:a}=e||{},c=T.useRef(s),l=T.useRef(a),u=T.useRef(void 0),d=T.useRef(n),f=T.useRef(r);l.current=a;const[h,p]=T.useState(()=>{const w=n._getWatch(r,c.current);return l.current?l.current(w):w}),m=T.useCallback(w=>{const S=sd(r,n._names,w||n._formValues,!1,c.current);return l.current?l.current(S):S},[n._formValues,n._names,r]),y=T.useCallback(w=>{if(!o){const S=sd(r,n._names,w||n._formValues,!1,c.current);if(l.current){const C=l.current(S);dn(C,u.current)||(p(C),u.current=C)}else p(S)}},[n._formValues,n._names,o,r]);_f(()=>((d.current!==n||!dn(f.current,r))&&(d.current=n,f.current=r,y()),n._subscribe({name:r,formState:{values:!0},exact:i,callback:w=>{y(w.values)}})),[n,i,r,y]),T.useEffect(()=>n._removeUnmounted());const b=d.current!==n,x=f.current,_=T.useMemo(()=>{if(o)return null;const w=!b&&!dn(x,r);return b||w?m():null},[o,b,r,x,m]);return _!==null?_:h}function dO(e){const t=xf(),{name:n,disabled:r,control:s=t,shouldUnregister:o,defaultValue:i,exact:a=!0}=e,c=wv(s._names.array,n),l=T.useMemo(()=>X(s._formValues,n,X(s._defaultValues,n,i)),[s,n,i]),u=uO({control:s,name:n,defaultValue:l,exact:a}),d=Ev({control:s,name:n,exact:a}),f=T.useRef(e),h=T.useRef(void 0),p=T.useRef(s.register(n,{...e.rules,value:u,...zt(e.disabled)?{disabled:e.disabled}:{}}));f.current=e;const m=T.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!X(d.errors,n)},isDirty:{enumerable:!0,get:()=>!!X(d.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!X(d.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!X(d.validatingFields,n)},error:{enumerable:!0,get:()=>X(d.errors,n)}}),[d,n]),y=T.useCallback(w=>p.current.onChange({target:{value:_v(w),name:n},type:ec.CHANGE}),[n]),b=T.useCallback(()=>p.current.onBlur({target:{value:X(s._formValues,n),name:n},type:ec.BLUR}),[n,s._formValues]),x=T.useCallback(w=>{const S=X(s._fields,n);S&&S._f&&w&&(S._f.ref={focus:()=>kt(w.focus)&&w.focus(),select:()=>kt(w.select)&&w.select(),setCustomValidity:C=>kt(w.setCustomValidity)&&w.setCustomValidity(C),reportValidity:()=>kt(w.reportValidity)&&w.reportValidity()})},[s._fields,n]),_=T.useMemo(()=>({name:n,value:u,...zt(r)||d.disabled?{disabled:d.disabled||r}:{},onChange:y,onBlur:b,ref:x}),[n,r,d.disabled,y,b,x,u]);return T.useEffect(()=>{const w=s._options.shouldUnregister||o,S=h.current;S&&S!==n&&!c&&s.unregister(S),s.register(n,{...f.current.rules,...zt(f.current.disabled)?{disabled:f.current.disabled}:{}});const C=(k,E)=>{const P=X(s._fields,k);P&&P._f&&(P._f.mount=E)};if(C(n,!0),w){const k=Ge(X(s._options.defaultValues,n,f.current.defaultValue));ke(s._defaultValues,n,k),Fe(X(s._formValues,n))&&ke(s._formValues,n,k)}return!c&&s.register(n),h.current=n,()=>{(c?w&&!s._state.action:w)?s.unregister(n):C(n,!1)}},[n,s,c,o]),T.useEffect(()=>{s._setDisabledField({disabled:r,name:n})},[r,n,s]),T.useMemo(()=>({field:_,formState:d,fieldState:m}),[_,d,m])}const fO=e=>e.render(dO(e)),wf=T.createContext(null);wf.displayName="HookFormContext";const hO=()=>T.useContext(wf),pO=e=>{const{children:t,watch:n,getValues:r,getFieldState:s,setError:o,clearErrors:i,setValue:a,trigger:c,formState:l,resetField:u,reset:d,handleSubmit:f,unregister:h,control:p,register:m,setFocus:y,subscribe:b}=e;return T.createElement(wf.Provider,{value:T.useMemo(()=>({watch:n,getValues:r,getFieldState:s,setError:o,clearErrors:i,setValue:a,trigger:c,formState:l,resetField:u,reset:d,handleSubmit:f,unregister:h,control:p,register:m,setFocus:y,subscribe:b}),[i,p,l,s,r,f,m,d,u,o,y,a,b,c,h,n])},T.createElement(vf.Provider,{value:p},t))};var Sf=(e,t,n,r,s)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:s||!0}}:{},Fo=e=>Array.isArray(e)?e:[e],Qp=()=>{let e=[];return{get observers(){return e},next:s=>{for(const o of e)o.next&&o.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(o=>o!==s)}}),unsubscribe:()=>{e=[]}}};function kv(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const s=e[r],o=t[r];if(s&&Je(s)&&o){const i=kv(s,o);Je(i)&&(n[r]=i)}else e[r]&&(n[r]=o)}return n}var Et=e=>Je(e)&&!Object.keys(e).length,Ef=e=>e.type==="file",tc=e=>{if(!gf)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Cv=e=>e.type==="select-multiple",kf=e=>e.type==="radio",mO=e=>kf(e)||_i(e),tu=e=>tc(e)&&e.isConnected;function gO(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=Fe(e)?r++:e[t[r++]];return e}function yO(e){for(const t in e)if(e.hasOwnProperty(t)&&!Fe(e[t]))return!1;return!0}function Ye(e,t){const n=Array.isArray(t)?t:Hc(t)?[t]:bf(t),r=n.length===1?e:gO(e,n),s=n.length-1,o=n[s];return r&&delete r[o],s!==0&&(Je(r)&&Et(r)||Array.isArray(r)&&yO(r))&&Ye(e,n.slice(0,-1)),e}var bO=e=>{for(const t in e)if(kt(e[t]))return!0;return!1};function Rv(e){return Array.isArray(e)||Je(e)&&!bO(e)}function id(e,t={}){for(const n in e){const r=e[n];Rv(r)?(t[n]=Array.isArray(r)?[]:{},id(r,t[n])):Fe(r)||(t[n]=!0)}return t}function Es(e,t,n){n||(n=id(t));for(const r in e){const s=e[r];if(Rv(s))Fe(t)||od(n[r])?n[r]=id(s,Array.isArray(s)?[]:{}):Es(s,At(t)?{}:t[r],n[r]);else{const o=t[r];n[r]=!dn(s,o)}}return n}const em={value:!1,isValid:!1},tm={value:!0,isValid:!0};var Pv=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Fe(e[0].attributes.value)?Fe(e[0].value)||e[0].value===""?tm:{value:e[0].value,isValid:!0}:tm:em}return em},Ov=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Fe(e)?e:t?e===""?NaN:e&&+e:n&&Vt(e)?new Date(e):r?r(e):e;const nm={isValid:!1,value:null};var Tv=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,nm):nm;function rm(e){const t=e.ref;return Ef(t)?t.files:kf(t)?Tv(e.refs).value:Cv(t)?[...t.selectedOptions].map(({value:n})=>n):_i(t)?Pv(e.refs).value:Ov(Fe(t.value)?e.ref.value:t.value,e)}var vO=(e,t,n,r)=>{const s={};for(const o of e){const i=X(t,o);i&&ke(s,o,i._f)}return{criteriaMode:n,names:[...e],fields:s,shouldUseNativeValidation:r}},nc=e=>e instanceof RegExp,bo=e=>Fe(e)?e:nc(e)?e.source:Je(e)?nc(e.value)?e.value.source:e.value:e,sm=e=>({isOnSubmit:!e||e===un.onSubmit,isOnBlur:e===un.onBlur,isOnChange:e===un.onChange,isOnAll:e===un.all,isOnTouch:e===un.onTouched});const om="AsyncFunction";var xO=e=>!!e&&!!e.validate&&!!(kt(e.validate)&&e.validate.constructor.name===om||Je(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===om)),_O=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),im=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const zo=(e,t,n,r)=>{for(const s of n||Object.keys(e)){const o=X(e,s);if(o){const{_f:i,...a}=o;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],s)&&!r)return!0;if(i.ref&&t(i.ref,i.name)&&!r)return!0;if(zo(a,t))break}else if(Je(a)&&zo(a,t))break}}};function am(e,t,n){const r=X(e,n);if(r||Hc(n))return{error:r,name:n};const s=n.split(".");for(;s.length;){const o=s.join("."),i=X(t,o),a=X(e,o);if(i&&!Array.isArray(i)&&n!==o)return{name:n};if(a&&a.type)return{name:o,error:a};if(a&&a.root&&a.root.type)return{name:`${o}.root`,error:a.root};s.pop()}return{name:n}}var wO=(e,t,n,r)=>{n(e);const{name:s,...o}=e;return Et(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(i=>t[i]===(!r||un.all))},SO=(e,t,n)=>!e||!t||e===t||Fo(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r))),EO=(e,t,n,r,s)=>s.isOnAll?!1:!n&&s.isOnTouch?!(t||e):(n?r.isOnBlur:s.isOnBlur)?!e:(n?r.isOnChange:s.isOnChange)?e:!0,kO=(e,t)=>!yf(X(e,t)).length&&Ye(e,t),CO=(e,t,n)=>{const r=Fo(X(e,n));return ke(r,"root",t[n]),ke(e,n,r),e};function cm(e,t,n="validate"){if(Vt(e)||Array.isArray(e)&&e.every(Vt)||zt(e)&&!e)return{type:n,message:Vt(e)?e:"",ref:t}}var gs=e=>Je(e)&&!nc(e)?e:{value:e,message:""},lm=async(e,t,n,r,s,o)=>{const{ref:i,refs:a,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:h,validate:p,name:m,valueAsNumber:y,mount:b}=e._f,x=X(n,m);if(!b||t.has(m))return{};const _=a?a[0]:i,w=A=>{s&&_.reportValidity&&(_.setCustomValidity(zt(A)?"":A||""),_.reportValidity())},S={},C=kf(i),k=_i(i),E=C||k,P=(y||Ef(i))&&Fe(i.value)&&Fe(x)||tc(i)&&i.value===""||x===""||Array.isArray(x)&&!x.length,O=Sf.bind(null,m,r,S),N=(A,j,$,q=Nn.maxLength,D=Nn.minLength)=>{const H=A?j:$;S[m]={type:A?q:D,message:H,ref:i,...O(A?q:D,H)}};if(o?!Array.isArray(x)||!x.length:c&&(!E&&(P||At(x))||zt(x)&&!x||k&&!Pv(a).isValid||C&&!Tv(a).isValid)){const{value:A,message:j}=Vt(c)?{value:!!c,message:c}:gs(c);if(A&&(S[m]={type:Nn.required,message:j,ref:_,...O(Nn.required,j)},!r))return w(j),S}if(!P&&(!At(d)||!At(f))){let A,j;const $=gs(f),q=gs(d);if(!At(x)&&!isNaN(x)){const D=i.valueAsNumber||x&&+x;At($.value)||(A=D>$.value),At(q.value)||(j=D<q.value)}else{const D=i.valueAsDate||new Date(x),H=se=>new Date(new Date().toDateString()+" "+se),F=i.type=="time",W=i.type=="week";Vt($.value)&&x&&(A=F?H(x)>H($.value):W?x>$.value:D>new Date($.value)),Vt(q.value)&&x&&(j=F?H(x)<H(q.value):W?x<q.value:D<new Date(q.value))}if((A||j)&&(N(!!A,$.message,q.message,Nn.max,Nn.min),!r))return w(S[m].message),S}if((l||u)&&!P&&(Vt(x)||o&&Array.isArray(x))){const A=gs(l),j=gs(u),$=!At(A.value)&&x.length>+A.value,q=!At(j.value)&&x.length<+j.value;if(($||q)&&(N($,A.message,j.message),!r))return w(S[m].message),S}if(h&&!P&&Vt(x)){const{value:A,message:j}=gs(h);if(nc(A)&&!x.match(A)&&(S[m]={type:Nn.pattern,message:j,ref:i,...O(Nn.pattern,j)},!r))return w(j),S}if(p){if(kt(p)){const A=await p(x,n),j=cm(A,_);if(j&&(S[m]={...j,...O(Nn.validate,j.message)},!r))return w(j.message),S}else if(Je(p)){let A={};for(const j in p){if(!Et(A)&&!r)break;const $=cm(await p[j](x,n),_,j);$&&(A={...$,...O(j,$.message)},w($.message),r&&(S[m]=A))}if(!Et(A)&&(S[m]={ref:_,...A},!r))return S}}return w(!0),S};const RO={mode:un.onSubmit,reValidateMode:un.onChange,shouldFocusError:!0};function PO(e={}){let t={...RO,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:kt(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},s=Je(t.defaultValues)||Je(t.values)?Ge(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:Ge(s),i={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,l=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...u};let f={...d};const h={array:Qp(),state:Qp()},p=t.criteriaMode===un.all,m=R=>M=>{clearTimeout(l),l=setTimeout(R,M)},y=async R=>{if(!i.keepIsValid&&!t.disabled&&(d.isValid||f.isValid||R)){let M;t.resolver?(M=Et((await E()).errors),b()):M=await O(r,!0),M!==n.isValid&&h.state.next({isValid:M})}},b=(R,M)=>{!t.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((R||Array.from(a.mount)).forEach(z=>{z&&(M?ke(n.validatingFields,z,M):Ye(n.validatingFields,z))}),h.state.next({validatingFields:n.validatingFields,isValidating:!Et(n.validatingFields)}))},x=(R,M=[],z,J,G=!0,B=!0)=>{if(J&&z&&!t.disabled){if(i.action=!0,B&&Array.isArray(X(r,R))){const Q=z(X(r,R),J.argA,J.argB);G&&ke(r,R,Q)}if(B&&Array.isArray(X(n.errors,R))){const Q=z(X(n.errors,R),J.argA,J.argB);G&&ke(n.errors,R,Q),kO(n.errors,R)}if((d.touchedFields||f.touchedFields)&&B&&Array.isArray(X(n.touchedFields,R))){const Q=z(X(n.touchedFields,R),J.argA,J.argB);G&&ke(n.touchedFields,R,Q)}(d.dirtyFields||f.dirtyFields)&&(n.dirtyFields=Es(s,o)),h.state.next({name:R,isDirty:A(R,M),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else ke(o,R,M)},_=(R,M)=>{ke(n.errors,R,M),h.state.next({errors:n.errors})},w=R=>{n.errors=R,h.state.next({errors:n.errors,isValid:!1})},S=(R,M,z,J)=>{const G=X(r,R);if(G){const B=X(o,R,Fe(z)?X(s,R):z);Fe(B)||J&&J.defaultChecked||M?ke(o,R,M?B:rm(G._f)):q(R,B),i.mount&&!i.action&&y()}},C=(R,M,z,J,G)=>{let B=!1,Q=!1;const ue={name:R};if(!t.disabled){if(!z||J){(d.isDirty||f.isDirty)&&(Q=n.isDirty,n.isDirty=ue.isDirty=A(),B=Q!==ue.isDirty);const ve=dn(X(s,R),M);Q=!!X(n.dirtyFields,R),ve?Ye(n.dirtyFields,R):ke(n.dirtyFields,R,!0),ue.dirtyFields=n.dirtyFields,B=B||(d.dirtyFields||f.dirtyFields)&&Q!==!ve}if(z){const ve=X(n.touchedFields,R);ve||(ke(n.touchedFields,R,z),ue.touchedFields=n.touchedFields,B=B||(d.touchedFields||f.touchedFields)&&ve!==z)}B&&G&&h.state.next(ue)}return B?ue:{}},k=(R,M,z,J)=>{const G=X(n.errors,R),B=(d.isValid||f.isValid)&&zt(M)&&n.isValid!==M;if(t.delayError&&z?(c=m(()=>_(R,z)),c(t.delayError)):(clearTimeout(l),c=null,z?ke(n.errors,R,z):Ye(n.errors,R)),(z?!dn(G,z):G)||!Et(J)||B){const Q={...J,...B&&zt(M)?{isValid:M}:{},errors:n.errors,name:R};n={...n,...Q},h.state.next(Q)}},E=async R=>(b(R,!0),await t.resolver(o,t.context,vO(R||a.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),P=async R=>{const{errors:M}=await E(R);if(b(R),R)for(const z of R){const J=X(M,z);J?ke(n.errors,z,J):Ye(n.errors,z)}else n.errors=M;return M},O=async(R,M,z={valid:!0})=>{for(const J in R){const G=R[J];if(G){const{_f:B,...Q}=G;if(B){const ue=a.array.has(B.name),ve=G._f&&xO(G._f);ve&&d.validatingFields&&b([B.name],!0);const Ue=await lm(G,a.disabled,o,p,t.shouldUseNativeValidation&&!M,ue);if(ve&&d.validatingFields&&b([B.name]),Ue[B.name]&&(z.valid=!1,M||e.shouldUseNativeValidation))break;!M&&(X(Ue,B.name)?ue?CO(n.errors,Ue,B.name):ke(n.errors,B.name,Ue[B.name]):Ye(n.errors,B.name))}!Et(Q)&&await O(Q,M,z)}}return z.valid},N=()=>{for(const R of a.unMount){const M=X(r,R);M&&(M._f.refs?M._f.refs.every(z=>!tu(z)):!tu(M._f.ref))&&ee(R)}a.unMount=new Set},A=(R,M)=>!t.disabled&&(R&&M&&ke(o,R,M),!dn(I(),s)),j=(R,M,z)=>sd(R,a,{...i.mount?o:Fe(M)?s:Vt(R)?{[R]:M}:M},z,M),$=R=>yf(X(i.mount?o:s,R,t.shouldUnregister?X(s,R,[]):[])),q=(R,M,z={})=>{const J=X(r,R);let G=M;if(J){const B=J._f;B&&(!B.disabled&&ke(o,R,Ov(M,B)),G=tc(B.ref)&&At(M)?"":M,Cv(B.ref)?[...B.ref.options].forEach(Q=>Q.selected=G.includes(Q.value)):B.refs?_i(B.ref)?B.refs.forEach(Q=>{(!Q.defaultChecked||!Q.disabled)&&(Array.isArray(G)?Q.checked=!!G.find(ue=>ue===Q.value):Q.checked=G===Q.value||!!G)}):B.refs.forEach(Q=>Q.checked=Q.value===G):Ef(B.ref)?B.ref.value="":(B.ref.value=G,B.ref.type||h.state.next({name:R,values:Ge(o)})))}(z.shouldDirty||z.shouldTouch)&&C(R,G,z.shouldTouch,z.shouldDirty,!0),z.shouldValidate&&se(R)},D=(R,M,z)=>{for(const J in M){if(!M.hasOwnProperty(J))return;const G=M[J],B=R+"."+J,Q=X(r,B);(a.array.has(R)||Je(G)||Q&&!Q._f)&&!Br(G)?D(B,G,z):q(B,G,z)}},H=(R,M,z={})=>{const J=X(r,R),G=a.array.has(R),B=Ge(M);ke(o,R,B),G?(h.array.next({name:R,values:Ge(o)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&z.shouldDirty&&h.state.next({name:R,dirtyFields:Es(s,o),isDirty:A(R,B)})):J&&!J._f&&!At(B)?D(R,B,z):q(R,B,z),im(R,a)?h.state.next({...n,name:R,values:Ge(o)}):h.state.next({name:i.mount?R:void 0,values:Ge(o)})},F=async R=>{i.mount=!0;const M=R.target;let z=M.name,J=!0;const G=X(r,z),B=ve=>{J=Number.isNaN(ve)||Br(ve)&&isNaN(ve.getTime())||dn(ve,X(o,z,ve))},Q=sm(t.mode),ue=sm(t.reValidateMode);if(G){let ve,Ue;const bn=M.type?rm(G._f):_v(R),wt=R.type===ec.BLUR||R.type===ec.FOCUS_OUT,Dl=!_O(G._f)&&!t.resolver&&!X(n.errors,z)&&!G._f.deps||EO(wt,X(n.touchedFields,z),n.isSubmitted,ue,Q),ao=im(z,a,wt);ke(o,z,bn),wt?(!M||!M.readOnly)&&(G._f.onBlur&&G._f.onBlur(R),c&&c(0)):G._f.onChange&&G._f.onChange(R);const ms=C(z,bn,wt),Ai=!Et(ms)||ao;if(!wt&&h.state.next({name:z,type:R.type,values:Ge(o)}),Dl)return(d.isValid||f.isValid)&&(t.mode==="onBlur"?wt&&y():wt||y()),Ai&&h.state.next({name:z,...ao?{}:ms});if(!wt&&ao&&h.state.next({...n}),t.resolver){const{errors:Ni}=await E([z]);if(b([z]),B(bn),J){const co=am(n.errors,r,z),sn=am(Ni,r,co.name||z);ve=sn.error,z=sn.name,Ue=Et(Ni)}}else b([z],!0),ve=(await lm(G,a.disabled,o,p,t.shouldUseNativeValidation))[z],b([z]),B(bn),J&&(ve?Ue=!1:(d.isValid||f.isValid)&&(Ue=await O(r,!0)));J&&(G._f.deps&&(!Array.isArray(G._f.deps)||G._f.deps.length>0)&&se(G._f.deps),k(z,Ue,ve,ms))}},W=(R,M)=>{if(X(n.errors,M)&&R.focus)return R.focus(),1},se=async(R,M={})=>{let z,J;const G=Fo(R);if(t.resolver){const B=await P(Fe(R)?R:G);z=Et(B),J=R?!G.some(Q=>X(B,Q)):z}else R?(J=(await Promise.all(G.map(async B=>{const Q=X(r,B);return await O(Q&&Q._f?{[B]:Q}:Q)}))).every(Boolean),!(!J&&!n.isValid)&&y()):J=z=await O(r);return h.state.next({...!Vt(R)||(d.isValid||f.isValid)&&z!==n.isValid?{}:{name:R},...t.resolver||!R?{isValid:z}:{},errors:n.errors}),M.shouldFocus&&!J&&zo(r,W,R?G:a.mount),J},I=(R,M)=>{let z={...i.mount?o:s};return M&&(z=kv(M.dirtyFields?n.dirtyFields:n.touchedFields,z)),Fe(R)?z:Vt(R)?X(z,R):R.map(J=>X(z,J))},Y=(R,M)=>({invalid:!!X((M||n).errors,R),isDirty:!!X((M||n).dirtyFields,R),error:X((M||n).errors,R),isValidating:!!X(n.validatingFields,R),isTouched:!!X((M||n).touchedFields,R)}),K=R=>{R&&Fo(R).forEach(M=>Ye(n.errors,M)),h.state.next({errors:R?n.errors:{}})},Z=(R,M,z)=>{const J=(X(r,R,{_f:{}})._f||{}).ref,G=X(n.errors,R)||{},{ref:B,message:Q,type:ue,...ve}=G;ke(n.errors,R,{...ve,...M,ref:J}),h.state.next({name:R,errors:n.errors,isValid:!1}),z&&z.shouldFocus&&J&&J.focus&&J.focus()},oe=(R,M)=>kt(R)?h.state.subscribe({next:z=>"values"in z&&R(j(void 0,M),z)}):j(R,M,!0),ce=R=>h.state.subscribe({next:M=>{SO(R.name,M.name,R.exact)&&wO(M,R.formState||d,Qn,R.reRenderRoot)&&R.callback({values:{...o},...n,...M,defaultValues:s})}}).unsubscribe,V=R=>(i.mount=!0,f={...f,...R.formState},ce({...R,formState:{...u,...R.formState}})),ee=(R,M={})=>{for(const z of R?Fo(R):a.mount)a.mount.delete(z),a.array.delete(z),M.keepValue||(Ye(r,z),Ye(o,z)),!M.keepError&&Ye(n.errors,z),!M.keepDirty&&Ye(n.dirtyFields,z),!M.keepTouched&&Ye(n.touchedFields,z),!M.keepIsValidating&&Ye(n.validatingFields,z),!t.shouldUnregister&&!M.keepDefaultValue&&Ye(s,z);h.state.next({values:Ge(o)}),h.state.next({...n,...M.keepDirty?{isDirty:A()}:{}}),!M.keepIsValid&&y()},me=({disabled:R,name:M})=>{if(zt(R)&&i.mount||R||a.disabled.has(M)){const G=a.disabled.has(M)!==!!R;R?a.disabled.add(M):a.disabled.delete(M),G&&i.mount&&!i.action&&y()}},le=(R,M={})=>{let z=X(r,R);const J=zt(M.disabled)||zt(t.disabled);return ke(r,R,{...z||{},_f:{...z&&z._f?z._f:{ref:{name:R}},name:R,mount:!0,...M}}),a.mount.add(R),z?me({disabled:zt(M.disabled)?M.disabled:t.disabled,name:R}):S(R,!0,M.value),{...J?{disabled:M.disabled||t.disabled}:{},...t.progressive?{required:!!M.required,min:bo(M.min),max:bo(M.max),minLength:bo(M.minLength),maxLength:bo(M.maxLength),pattern:bo(M.pattern)}:{},name:R,onChange:F,onBlur:F,ref:G=>{if(G){le(R,M),z=X(r,R);const B=Fe(G.value)&&G.querySelectorAll&&G.querySelectorAll("input,select,textarea")[0]||G,Q=mO(B),ue=z._f.refs||[];if(Q?ue.find(ve=>ve===B):B===z._f.ref)return;ke(r,R,{_f:{...z._f,...Q?{refs:[...ue.filter(tu),B,...Array.isArray(X(s,R))?[{}]:[]],ref:{type:B.type,name:R}}:{ref:B}}}),S(R,!1,void 0,B)}else z=X(r,R,{}),z._f&&(z._f.mount=!1),(t.shouldUnregister||M.shouldUnregister)&&!(wv(a.array,R)&&i.action)&&a.unMount.add(R)}}},fe=()=>t.shouldFocusError&&zo(r,W,a.mount),ge=R=>{zt(R)&&(h.state.next({disabled:R}),zo(r,(M,z)=>{const J=X(r,z);J&&(M.disabled=J._f.disabled||R,Array.isArray(J._f.refs)&&J._f.refs.forEach(G=>{G.disabled=J._f.disabled||R}))},0,!1))},Ze=(R,M)=>async z=>{let J;z&&(z.preventDefault&&z.preventDefault(),z.persist&&z.persist());let G=Ge(o);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:B,values:Q}=await E();b(),n.errors=B,G=Ge(Q)}else await O(r);if(a.disabled.size)for(const B of a.disabled)Ye(G,B);if(Ye(n.errors,"root"),Et(n.errors)){h.state.next({errors:{}});try{await R(G,z)}catch(B){J=B}}else M&&await M({...n.errors},z),fe(),setTimeout(fe);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Et(n.errors)&&!J,submitCount:n.submitCount+1,errors:n.errors}),J)throw J},_t=(R,M={})=>{X(r,R)&&(Fe(M.defaultValue)?H(R,Ge(X(s,R))):(H(R,M.defaultValue),ke(s,R,Ge(M.defaultValue))),M.keepTouched||Ye(n.touchedFields,R),M.keepDirty||(Ye(n.dirtyFields,R),n.isDirty=M.defaultValue?A(R,Ge(X(s,R))):A()),M.keepError||(Ye(n.errors,R),d.isValid&&y()),h.state.next({...n}))},rn=(R,M={})=>{const z=R?Ge(R):s,J=Ge(z),G=Et(R),B=G?s:J;if(M.keepDefaultValues||(s=z),!M.keepValues){if(M.keepDirtyValues){const Q=new Set([...a.mount,...Object.keys(Es(s,o))]);for(const ue of Array.from(Q)){const ve=X(n.dirtyFields,ue),Ue=X(o,ue),bn=X(B,ue);ve&&!Fe(Ue)?ke(B,ue,Ue):!ve&&!Fe(bn)&&H(ue,bn)}}else{if(gf&&Fe(R))for(const Q of a.mount){const ue=X(r,Q);if(ue&&ue._f){const ve=Array.isArray(ue._f.refs)?ue._f.refs[0]:ue._f.ref;if(tc(ve)){const Ue=ve.closest("form");if(Ue){Ue.reset();break}}}}if(M.keepFieldsRef)for(const Q of a.mount)H(Q,X(B,Q));else r={}}o=t.shouldUnregister?M.keepDefaultValues?Ge(s):{}:Ge(B),h.array.next({values:{...B}}),h.state.next({values:{...B}})}a={mount:M.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!d.isValid||!!M.keepIsValid||!!M.keepDirtyValues||!t.shouldUnregister&&!Et(B),i.watch=!!t.shouldUnregister,i.keepIsValid=!!M.keepIsValid,i.action=!1,M.keepErrors||(n.errors={}),h.state.next({submitCount:M.keepSubmitCount?n.submitCount:0,isDirty:G?!1:M.keepDirty?n.isDirty:!!(M.keepDefaultValues&&!dn(R,s)),isSubmitted:M.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:G?{}:M.keepDirtyValues?M.keepDefaultValues&&o?Es(s,o):n.dirtyFields:M.keepDefaultValues&&R?Es(s,R):M.keepDirty?n.dirtyFields:{},touchedFields:M.keepTouched?n.touchedFields:{},errors:M.keepErrors?n.errors:{},isSubmitSuccessful:M.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},qt=(R,M)=>rn(kt(R)?R(o):R,{...t.resetOptions,...M}),st=(R,M={})=>{const z=X(r,R),J=z&&z._f;if(J){const G=J.refs?J.refs[0]:J.ref;G.focus&&setTimeout(()=>{G.focus(),M.shouldSelect&&kt(G.select)&&G.select()})}},Qn=R=>{n={...n,...R}},ps={control:{register:le,unregister:ee,getFieldState:Y,handleSubmit:Ze,setError:Z,_subscribe:ce,_runSchema:E,_updateIsValidating:b,_focusError:fe,_getWatch:j,_getDirty:A,_setValid:y,_setFieldArray:x,_setDisabledField:me,_setErrors:w,_getFieldArray:$,_reset:rn,_resetDefaultValues:()=>kt(t.defaultValues)&&t.defaultValues().then(R=>{qt(R,t.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:N,_disableForm:ge,_subjects:h,_proxyFormState:d,get _fields(){return r},get _formValues(){return o},get _state(){return i},set _state(R){i=R},get _defaultValues(){return s},get _names(){return a},set _names(R){a=R},get _formState(){return n},get _options(){return t},set _options(R){t={...t,...R}}},subscribe:V,trigger:se,register:le,handleSubmit:Ze,watch:oe,setValue:H,getValues:I,reset:qt,resetField:_t,clearErrors:K,unregister:ee,setError:Z,setFocus:st,getFieldState:Y};return{...ps,formControl:ps}}function Cf(e={}){const t=T.useRef(void 0),n=T.useRef(void 0),[r,s]=T.useState({isDirty:!1,isValidating:!1,isLoading:kt(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:kt(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!kt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...a}=PO(e);t.current={...a,formState:r}}const o=t.current.control;return o._options=e,_f(()=>{const i=o._subscribe({formState:o._proxyFormState,callback:()=>s({...o._formState}),reRenderRoot:!0});return s(a=>({...a,isReady:!0})),o._formState.isReady=!0,i},[o]),T.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),T.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),T.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),T.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),T.useEffect(()=>{if(o._proxyFormState.isDirty){const i=o._getDirty();i!==r.isDirty&&o._subjects.state.next({isDirty:i})}},[o,r.isDirty]),T.useEffect(()=>{var i;e.values&&!dn(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((i=o._options.resetOptions)===null||i===void 0)&&i.keepIsValid||o._setValid(),n.current=e.values,s(a=>({...a}))):o._resetDefaultValues()},[o,e.values]),T.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=T.useMemo(()=>Sv(r,o),[o,r]),t.current}function Mv(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=Mv(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Rf(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Mv(e))&&(r&&(r+=" "),r+=t);return r}const OO=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},TO=(e,t)=>({classGroupId:e,validator:t}),Av=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),rc="-",um=[],MO="arbitrary..",AO=e=>{const t=DO(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return NO(i);const a=i.split(rc),c=a[0]===""&&a.length>1?1:0;return Nv(a,c,t)},getConflictingClassGroupIds:(i,a)=>{if(a){const c=r[i],l=n[i];return c?l?OO(l,c):c:l||um}return n[i]||um}}},Nv=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const l=Nv(e,t+1,o);if(l)return l}const i=n.validators;if(i===null)return;const a=t===0?e.join(rc):e.slice(t).join(rc),c=i.length;for(let l=0;l<c;l++){const u=i[l];if(u.validator(a))return u.classGroupId}},NO=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?MO+r:void 0})(),DO=e=>{const{theme:t,classGroups:n}=e;return IO(n,t)},IO=(e,t)=>{const n=Av();for(const r in e){const s=e[r];Pf(s,n,r,t)}return n},Pf=(e,t,n,r)=>{const s=e.length;for(let o=0;o<s;o++){const i=e[o];jO(i,t,n,r)}},jO=(e,t,n,r)=>{if(typeof e=="string"){LO(e,t,n);return}if(typeof e=="function"){FO(e,t,n,r);return}zO(e,t,n,r)},LO=(e,t,n)=>{const r=e===""?t:Dv(t,e);r.classGroupId=n},FO=(e,t,n,r)=>{if($O(e)){Pf(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(TO(n,e))},zO=(e,t,n,r)=>{const s=Object.entries(e),o=s.length;for(let i=0;i<o;i++){const[a,c]=s[i];Pf(c,Dv(t,a),n,r)}},Dv=(e,t)=>{let n=e;const r=t.split(rc),s=r.length;for(let o=0;o<s;o++){const i=r[o];let a=n.nextPart.get(i);a||(a=Av(),n.nextPart.set(i,a)),n=a}return n},$O=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,VO=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(o,i)=>{n[o]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let i=n[o];if(i!==void 0)return i;if((i=r[o])!==void 0)return s(o,i),i},set(o,i){o in n?n[o]=i:s(o,i)}}},ad="!",dm=":",BO=[],fm=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),UO=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const o=[];let i=0,a=0,c=0,l;const u=s.length;for(let m=0;m<u;m++){const y=s[m];if(i===0&&a===0){if(y===dm){o.push(s.slice(c,m)),c=m+1;continue}if(y==="/"){l=m;continue}}y==="["?i++:y==="]"?i--:y==="("?a++:y===")"&&a--}const d=o.length===0?s:s.slice(c);let f=d,h=!1;d.endsWith(ad)?(f=d.slice(0,-1),h=!0):d.startsWith(ad)&&(f=d.slice(1),h=!0);const p=l&&l>c?l-c:void 0;return fm(o,h,f,p)};if(t){const s=t+dm,o=r;r=i=>i.startsWith(s)?o(i.slice(s.length)):fm(BO,!1,i,void 0,!0)}if(n){const s=r;r=o=>n({className:o,parseClassName:s})}return r},WO=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let o=0;o<n.length;o++){const i=n[o],a=i[0]==="[",c=t.has(i);a||c?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(i)):s.push(i)}return s.length>0&&(s.sort(),r.push(...s)),r}},HO=e=>({cache:VO(e.cacheSize),parseClassName:UO(e),sortModifiers:WO(e),...AO(e)}),qO=/\s+/,KO=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:o}=t,i=[],a=e.trim().split(qO);let c="";for(let l=a.length-1;l>=0;l-=1){const u=a[l],{isExternal:d,modifiers:f,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}=n(u);if(d){c=u+(c.length>0?" "+c:c);continue}let y=!!m,b=r(y?p.substring(0,m):p);if(!b){if(!y){c=u+(c.length>0?" "+c:c);continue}if(b=r(p),!b){c=u+(c.length>0?" "+c:c);continue}y=!1}const x=f.length===0?"":f.length===1?f[0]:o(f).join(":"),_=h?x+ad:x,w=_+b;if(i.indexOf(w)>-1)continue;i.push(w);const S=s(b,y);for(let C=0;C<S.length;++C){const k=S[C];i.push(_+k)}c=u+(c.length>0?" "+c:c)}return c},ZO=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=Iv(n))&&(s&&(s+=" "),s+=r);return s},Iv=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Iv(e[r]))&&(n&&(n+=" "),n+=t);return n},GO=(e,...t)=>{let n,r,s,o;const i=c=>{const l=t.reduce((u,d)=>d(u),e());return n=HO(l),r=n.cache.get,s=n.cache.set,o=a,a(c)},a=c=>{const l=r(c);if(l)return l;const u=KO(c,n);return s(c,u),u};return o=i,(...c)=>o(ZO(...c))},YO=[],tt=e=>{const t=n=>n[e]||YO;return t.isThemeGetter=!0,t},jv=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Lv=/^\((?:(\w[\w-]*):)?(.+)\)$/i,XO=/^\d+\/\d+$/,JO=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,QO=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,eT=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,tT=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,nT=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ys=e=>XO.test(e),pe=e=>!!e&&!Number.isNaN(Number(e)),er=e=>!!e&&Number.isInteger(Number(e)),nu=e=>e.endsWith("%")&&pe(e.slice(0,-1)),Dn=e=>JO.test(e),rT=()=>!0,sT=e=>QO.test(e)&&!eT.test(e),Fv=()=>!1,oT=e=>tT.test(e),iT=e=>nT.test(e),aT=e=>!te(e)&&!ne(e),cT=e=>eo(e,Vv,Fv),te=e=>jv.test(e),Tr=e=>eo(e,Bv,sT),ru=e=>eo(e,hT,pe),hm=e=>eo(e,zv,Fv),lT=e=>eo(e,$v,iT),qi=e=>eo(e,Uv,oT),ne=e=>Lv.test(e),vo=e=>to(e,Bv),uT=e=>to(e,pT),pm=e=>to(e,zv),dT=e=>to(e,Vv),fT=e=>to(e,$v),Ki=e=>to(e,Uv,!0),eo=(e,t,n)=>{const r=jv.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},to=(e,t,n=!1)=>{const r=Lv.exec(e);return r?r[1]?t(r[1]):n:!1},zv=e=>e==="position"||e==="percentage",$v=e=>e==="image"||e==="url",Vv=e=>e==="length"||e==="size"||e==="bg-size",Bv=e=>e==="length",hT=e=>e==="number",pT=e=>e==="family-name",Uv=e=>e==="shadow",mT=()=>{const e=tt("color"),t=tt("font"),n=tt("text"),r=tt("font-weight"),s=tt("tracking"),o=tt("leading"),i=tt("breakpoint"),a=tt("container"),c=tt("spacing"),l=tt("radius"),u=tt("shadow"),d=tt("inset-shadow"),f=tt("text-shadow"),h=tt("drop-shadow"),p=tt("blur"),m=tt("perspective"),y=tt("aspect"),b=tt("ease"),x=tt("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...w(),ne,te],C=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],E=()=>[ne,te,c],P=()=>[ys,"full","auto",...E()],O=()=>[er,"none","subgrid",ne,te],N=()=>["auto",{span:["full",er,ne,te]},er,ne,te],A=()=>[er,"auto",ne,te],j=()=>["auto","min","max","fr",ne,te],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],q=()=>["start","end","center","stretch","center-safe","end-safe"],D=()=>["auto",...E()],H=()=>[ys,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...E()],F=()=>[e,ne,te],W=()=>[...w(),pm,hm,{position:[ne,te]}],se=()=>["no-repeat",{repeat:["","x","y","space","round"]}],I=()=>["auto","cover","contain",dT,cT,{size:[ne,te]}],Y=()=>[nu,vo,Tr],K=()=>["","none","full",l,ne,te],Z=()=>["",pe,vo,Tr],oe=()=>["solid","dashed","dotted","double"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],V=()=>[pe,nu,pm,hm],ee=()=>["","none",p,ne,te],me=()=>["none",pe,ne,te],le=()=>["none",pe,ne,te],fe=()=>[pe,ne,te],ge=()=>[ys,"full",...E()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Dn],breakpoint:[Dn],color:[rT],container:[Dn],"drop-shadow":[Dn],ease:["in","out","in-out"],font:[aT],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Dn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Dn],shadow:[Dn],spacing:["px",pe],text:[Dn],"text-shadow":[Dn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ys,te,ne,y]}],container:["container"],columns:[{columns:[pe,te,ne,a]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{start:P()}],end:[{end:P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[er,"auto",ne,te]}],basis:[{basis:[ys,"full","auto",a,...E()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[pe,ys,"auto","initial","none",te]}],grow:[{grow:["",pe,ne,te]}],shrink:[{shrink:["",pe,ne,te]}],order:[{order:[er,"first","last","none",ne,te]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:N()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:N()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":j()}],"auto-rows":[{"auto-rows":j()}],gap:[{gap:E()}],"gap-x":[{"gap-x":E()}],"gap-y":[{"gap-y":E()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...q(),"normal"]}],"justify-self":[{"justify-self":["auto",...q()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...q(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...q(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...q(),"baseline"]}],"place-self":[{"place-self":["auto",...q()]}],p:[{p:E()}],px:[{px:E()}],py:[{py:E()}],ps:[{ps:E()}],pe:[{pe:E()}],pt:[{pt:E()}],pr:[{pr:E()}],pb:[{pb:E()}],pl:[{pl:E()}],m:[{m:D()}],mx:[{mx:D()}],my:[{my:D()}],ms:[{ms:D()}],me:[{me:D()}],mt:[{mt:D()}],mr:[{mr:D()}],mb:[{mb:D()}],ml:[{ml:D()}],"space-x":[{"space-x":E()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":E()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],w:[{w:[a,"screen",...H()]}],"min-w":[{"min-w":[a,"screen","none",...H()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",n,vo,Tr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ne,ru]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",nu,te]}],"font-family":[{font:[uT,te,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,ne,te]}],"line-clamp":[{"line-clamp":[pe,"none",ne,ru]}],leading:[{leading:[o,...E()]}],"list-image":[{"list-image":["none",ne,te]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ne,te]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[pe,"from-font","auto",ne,Tr]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[pe,"auto",ne,te]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ne,te]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ne,te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:W()}],"bg-repeat":[{bg:se()}],"bg-size":[{bg:I()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},er,ne,te],radial:["",ne,te],conic:[er,ne,te]},fT,lT]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:K()}],"rounded-s":[{"rounded-s":K()}],"rounded-e":[{"rounded-e":K()}],"rounded-t":[{"rounded-t":K()}],"rounded-r":[{"rounded-r":K()}],"rounded-b":[{"rounded-b":K()}],"rounded-l":[{"rounded-l":K()}],"rounded-ss":[{"rounded-ss":K()}],"rounded-se":[{"rounded-se":K()}],"rounded-ee":[{"rounded-ee":K()}],"rounded-es":[{"rounded-es":K()}],"rounded-tl":[{"rounded-tl":K()}],"rounded-tr":[{"rounded-tr":K()}],"rounded-br":[{"rounded-br":K()}],"rounded-bl":[{"rounded-bl":K()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[pe,ne,te]}],"outline-w":[{outline:["",pe,vo,Tr]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","none",u,Ki,qi]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",d,Ki,qi]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[pe,Tr]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",f,Ki,qi]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[pe,ne,te]}],"mix-blend":[{"mix-blend":[...ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[pe]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[ne,te]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[pe]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:W()}],"mask-repeat":[{mask:se()}],"mask-size":[{mask:I()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ne,te]}],filter:[{filter:["","none",ne,te]}],blur:[{blur:ee()}],brightness:[{brightness:[pe,ne,te]}],contrast:[{contrast:[pe,ne,te]}],"drop-shadow":[{"drop-shadow":["","none",h,Ki,qi]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",pe,ne,te]}],"hue-rotate":[{"hue-rotate":[pe,ne,te]}],invert:[{invert:["",pe,ne,te]}],saturate:[{saturate:[pe,ne,te]}],sepia:[{sepia:["",pe,ne,te]}],"backdrop-filter":[{"backdrop-filter":["","none",ne,te]}],"backdrop-blur":[{"backdrop-blur":ee()}],"backdrop-brightness":[{"backdrop-brightness":[pe,ne,te]}],"backdrop-contrast":[{"backdrop-contrast":[pe,ne,te]}],"backdrop-grayscale":[{"backdrop-grayscale":["",pe,ne,te]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[pe,ne,te]}],"backdrop-invert":[{"backdrop-invert":["",pe,ne,te]}],"backdrop-opacity":[{"backdrop-opacity":[pe,ne,te]}],"backdrop-saturate":[{"backdrop-saturate":[pe,ne,te]}],"backdrop-sepia":[{"backdrop-sepia":["",pe,ne,te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":E()}],"border-spacing-x":[{"border-spacing-x":E()}],"border-spacing-y":[{"border-spacing-y":E()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ne,te]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[pe,"initial",ne,te]}],ease:[{ease:["linear","initial",b,ne,te]}],delay:[{delay:[pe,ne,te]}],animate:[{animate:["none",x,ne,te]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,ne,te]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:me()}],"rotate-x":[{"rotate-x":me()}],"rotate-y":[{"rotate-y":me()}],"rotate-z":[{"rotate-z":me()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[ne,te,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ge()}],"translate-x":[{"translate-x":ge()}],"translate-y":[{"translate-y":ge()}],"translate-z":[{"translate-z":ge()}],"translate-none":["translate-none"],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ne,te]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ne,te]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[pe,vo,Tr,ru]}],stroke:[{stroke:["none",...F()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Wv=GO(mT);function Of(...e){return Wv(Rf(e))}function Yo(e){return g.jsx("div",{...e,className:Of("rounded-2xl border bg-white shadow-sm",e.className)})}function Xo(e){return g.jsx("div",{...e,className:Of("border-b px-4 py-3",e.className)})}function Jo(e){return g.jsx("div",{...e,className:Of("px-4 py-3",e.className)})}function gT(){const e=ls(),t=Wc(),{register:n,handleSubmit:r,formState:s}=Cf({defaultValues:{email:"admin@example.com",password:"ChangeMe123!"}}),o=r(async i=>{try{const a=await Te.post("/auth/login",i);t.setAuth(a.data.token,a.data.user.email),Ee.success("Logged in"),e({to:"/"})}catch(a){Ee.error(a?.response?.data?.detail??"Login failed")}});return g.jsx("div",{className:"mx-auto max-w-md",children:g.jsxs(Yo,{children:[g.jsxs(Xo,{children:[g.jsx("div",{className:"text-lg font-semibold",children:"Login"}),g.jsx("div",{className:"text-sm text-neutral-600",children:"Use the admin credentials from your backend env."})]}),g.jsx(Jo,{children:g.jsxs("form",{onSubmit:o,className:"space-y-3",children:[g.jsxs("div",{children:[g.jsx("label",{className:"text-sm text-neutral-700",children:"Email"}),g.jsx("input",{className:"mt-1 w-full rounded-xl border px-3 py-2",...n("email",{required:!0})})]}),g.jsxs("div",{children:[g.jsx("label",{className:"text-sm text-neutral-700",children:"Password"}),g.jsx("input",{type:"password",className:"mt-1 w-full rounded-xl border px-3 py-2",...n("password",{required:!0})})]}),g.jsx("button",{disabled:s.isSubmitting,className:"w-full rounded-xl bg-neutral-900 px-3 py-2 text-white hover:bg-neutral-800 disabled:opacity-60",children:s.isSubmitting?"Signing in...":"Sign in"})]})})]})})}function yT(){return g.jsx("div",{className:"flex-1 bg-neutral-50 p-6 dark:bg-neutral-900/40",children:g.jsx(of,{})})}const Hv=()=>ZC(),qv=XC;function lt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var bT=typeof Symbol=="function"&&Symbol.observable||"@@observable",mm=bT,su=()=>Math.random().toString(36).substring(7).split("").join("."),vT={INIT:`@@redux/INIT${su()}`,REPLACE:`@@redux/REPLACE${su()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${su()}`},Kr=vT;function wi(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function xT(e){if(e===void 0)return"undefined";if(e===null)return"null";const t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(ST(e))return"date";if(wT(e))return"error";const n=_T(e);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return Object.prototype.toString.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")}function _T(e){return typeof e.constructor=="function"?e.constructor.name:null}function wT(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function ST(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function tr(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=xT(e)),t}function Kv(e,t,n){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?lt(2):`Expected the root reducer to be a function. Instead, received: '${tr(e)}'`);if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?lt(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(process.env.NODE_ENV==="production"?lt(1):`Expected the enhancer to be a function. Instead, received: '${tr(n)}'`);return n(Kv)(e,t)}let r=e,s=t,o=new Map,i=o,a=0,c=!1;function l(){i===o&&(i=new Map,o.forEach((y,b)=>{i.set(b,y)}))}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?lt(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return s}function d(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?lt(4):`Expected the listener to be a function. Instead, received: '${tr(y)}'`);if(c)throw new Error(process.env.NODE_ENV==="production"?lt(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");let b=!0;l();const x=a++;return i.set(x,y),function(){if(b){if(c)throw new Error(process.env.NODE_ENV==="production"?lt(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");b=!1,l(),i.delete(x),o=null}}}function f(y){if(!wi(y))throw new Error(process.env.NODE_ENV==="production"?lt(7):`Actions must be plain objects. Instead, the actual type was: '${tr(y)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);if(typeof y.type>"u")throw new Error(process.env.NODE_ENV==="production"?lt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(typeof y.type!="string")throw new Error(process.env.NODE_ENV==="production"?lt(17):`Action "type" property must be a string. Instead, the actual type was: '${tr(y.type)}'. Value was: '${y.type}' (stringified)`);if(c)throw new Error(process.env.NODE_ENV==="production"?lt(9):"Reducers may not dispatch actions.");try{c=!0,s=r(s,y)}finally{c=!1}return(o=i).forEach(x=>{x()}),y}function h(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?lt(10):`Expected the nextReducer to be a function. Instead, received: '${tr(y)}`);r=y,f({type:Kr.REPLACE})}function p(){const y=d;return{subscribe(b){if(typeof b!="object"||b===null)throw new Error(process.env.NODE_ENV==="production"?lt(11):`Expected the observer to be an object. Instead, received: '${tr(b)}'`);function x(){const w=b;w.next&&w.next(u())}return x(),{unsubscribe:y(x)}},[mm](){return this}}}return f({type:Kr.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:h,[mm]:p}}function gm(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function ET(e,t,n,r){const s=Object.keys(t),o=n&&n.type===Kr.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(s.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!wi(e))return`The ${o} has unexpected type of "${tr(e)}". Expected argument to be an object with the following keys: "${s.join('", "')}"`;const i=Object.keys(e).filter(a=>!t.hasOwnProperty(a)&&!r[a]);if(i.forEach(a=>{r[a]=!0}),!(n&&n.type===Kr.REPLACE)&&i.length>0)return`Unexpected ${i.length>1?"keys":"key"} "${i.join('", "')}" found in ${o}. Expected to find one of the known reducer keys instead: "${s.join('", "')}". Unexpected keys will be ignored.`}function kT(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:Kr.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?lt(12):`The slice reducer for key "${t}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof n(void 0,{type:Kr.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?lt(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Kr.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)})}function CT(e){const t=Object.keys(e),n={};for(let i=0;i<t.length;i++){const a=t[i];process.env.NODE_ENV!=="production"&&typeof e[a]>"u"&&gm(`No reducer provided for key "${a}"`),typeof e[a]=="function"&&(n[a]=e[a])}const r=Object.keys(n);let s;process.env.NODE_ENV!=="production"&&(s={});let o;try{kT(n)}catch(i){o=i}return function(a={},c){if(o)throw o;if(process.env.NODE_ENV!=="production"){const d=ET(a,n,c,s);d&&gm(d)}let l=!1;const u={};for(let d=0;d<r.length;d++){const f=r[d],h=n[f],p=a[f],m=h(p,c);if(typeof m>"u"){const y=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?lt(14):`When called with an action of type ${y?`"${String(y)}"`:"(unknown type)"}, the slice reducer for key "${f}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}u[f]=m,l=l||m!==p}return l=l||r.length!==Object.keys(a).length,l?u:a}}function sc(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function RT(...e){return t=>(n,r)=>{const s=t(n,r);let o=()=>{throw new Error(process.env.NODE_ENV==="production"?lt(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")};const i={getState:s.getState,dispatch:(c,...l)=>o(c,...l)},a=e.map(c=>c(i));return o=sc(...a)(s.dispatch),{...s,dispatch:o}}}function Zv(e){return wi(e)&&"type"in e&&typeof e.type=="string"}var Gv=Symbol.for("immer-nothing"),ym=Symbol.for("immer-draftable"),Ct=Symbol.for("immer-state"),PT=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Bt(e,...t){if(process.env.NODE_ENV!=="production"){const n=PT[e],r=Lr(n)?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ut=Object,Ks=Ut.getPrototypeOf,oc="constructor",qc="prototype",cd="configurable",ic="enumerable",Ta="writable",Qo="value",Kn=e=>!!e&&!!e[Ct];function hn(e){return e?Yv(e)||Zc(e)||!!e[ym]||!!e[oc]?.[ym]||Gc(e)||Yc(e):!1}var OT=Ut[qc][oc].toString(),bm=new WeakMap;function Yv(e){if(!e||!Tf(e))return!1;const t=Ks(e);if(t===null||t===Ut[qc])return!0;const n=Ut.hasOwnProperty.call(t,oc)&&t[oc];if(n===Object)return!0;if(!Lr(n))return!1;let r=bm.get(n);return r===void 0&&(r=Function.toString.call(n),bm.set(n,r)),r===OT}function Kc(e,t,n=!0){Si(e)===0?(n?Reflect.ownKeys(e):Ut.keys(e)).forEach(s=>{t(s,e[s],e)}):e.forEach((r,s)=>t(s,r,e))}function Si(e){const t=e[Ct];return t?t.type_:Zc(e)?1:Gc(e)?2:Yc(e)?3:0}var vm=(e,t,n=Si(e))=>n===2?e.has(t):Ut[qc].hasOwnProperty.call(e,t),ld=(e,t,n=Si(e))=>n===2?e.get(t):e[t],ac=(e,t,n,r=Si(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function TT(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Zc=Array.isArray,Gc=e=>e instanceof Map,Yc=e=>e instanceof Set,Tf=e=>typeof e=="object",Lr=e=>typeof e=="function",ou=e=>typeof e=="boolean";function MT(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var zn=e=>e.copy_||e.base_,Mf=e=>e.modified_?e.copy_:e.base_;function ud(e,t){if(Gc(e))return new Map(e);if(Yc(e))return new Set(e);if(Zc(e))return Array[qc].slice.call(e);const n=Yv(e);if(t===!0||t==="class_only"&&!n){const r=Ut.getOwnPropertyDescriptors(e);delete r[Ct];let s=Reflect.ownKeys(r);for(let o=0;o<s.length;o++){const i=s[o],a=r[i];a[Ta]===!1&&(a[Ta]=!0,a[cd]=!0),(a.get||a.set)&&(r[i]={[cd]:!0,[Ta]:!0,[ic]:a[ic],[Qo]:e[i]})}return Ut.create(Ks(e),r)}else{const r=Ks(e);if(r!==null&&n)return{...e};const s=Ut.create(r);return Ut.assign(s,e)}}function Af(e,t=!1){return Xc(e)||Kn(e)||!hn(e)||(Si(e)>1&&Ut.defineProperties(e,{set:Zi,add:Zi,clear:Zi,delete:Zi}),Ut.freeze(e),t&&Kc(e,(n,r)=>{Af(r,!0)},!1)),e}function AT(){Bt(2)}var Zi={[Qo]:AT};function Xc(e){return e===null||!Tf(e)?!0:Ut.isFrozen(e)}var cc="MapSet",dd="Patches",xm="ArrayMethods",Xv={};function es(e){const t=Xv[e];return t||Bt(0,e),t}var _m=e=>!!Xv[e],ei,Jv=()=>ei,NT=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:_m(cc)?es(cc):void 0,arrayMethodsPlugin_:_m(xm)?es(xm):void 0});function wm(e,t){t&&(e.patchPlugin_=es(dd),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function fd(e){hd(e),e.drafts_.forEach(DT),e.drafts_=null}function hd(e){e===ei&&(ei=e.parent_)}var Sm=e=>ei=NT(ei,e);function DT(e){const t=e[Ct];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Em(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(e!==void 0&&e!==n){n[Ct].modified_&&(fd(t),Bt(4)),hn(e)&&(e=km(t,e));const{patchPlugin_:s}=t;s&&s.generateReplacementPatches_(n[Ct].base_,e,t)}else e=km(t,n);return IT(t,e,!0),fd(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Gv?e:void 0}function km(e,t){if(Xc(t))return t;const n=t[Ct];if(!n)return lc(t,e.handledSet_,e);if(!Jc(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);tx(n,e)}return n.copy_}function IT(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Af(t,n)}function Qv(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Jc=(e,t)=>e.scope_===t,jT=[];function ex(e,t,n,r){const s=zn(e),o=e.type_;if(r!==void 0&&ld(s,r,o)===t){ac(s,r,n,o);return}if(!e.draftLocations_){const a=e.draftLocations_=new Map;Kc(s,(c,l)=>{if(Kn(l)){const u=a.get(l)||[];u.push(c),a.set(l,u)}})}const i=e.draftLocations_.get(t)??jT;for(const a of i)ac(s,a,n,o)}function LT(e,t,n){e.callbacks_.push(function(s){const o=t;if(!o||!Jc(o,s))return;s.mapSetPlugin_?.fixSetContents(o);const i=Mf(o);ex(e,o.draft_??o,i,n),tx(o,s)})}function tx(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:r}=t;if(r){const s=r.getPath(e);s&&r.generatePatches_(e,s,t)}Qv(e)}}function FT(e,t,n){const{scope_:r}=e;if(Kn(n)){const s=n[Ct];Jc(s,r)&&s.callbacks_.push(function(){Ma(e);const i=Mf(s);ex(e,n,i,t)})}else hn(n)&&e.callbacks_.push(function(){const o=zn(e);e.type_===3?o.has(n)&&lc(n,r.handledSet_,r):ld(o,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&lc(ld(e.copy_,t,e.type_),r.handledSet_,r)})}function lc(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Kn(e)||t.has(e)||!hn(e)||Xc(e)||(t.add(e),Kc(e,(r,s)=>{if(Kn(s)){const o=s[Ct];if(Jc(o,n)){const i=Mf(o);ac(e,r,i,e.type_),Qv(o)}}else hn(s)&&lc(s,t,n)})),e}function zT(e,t){const n=Zc(e),r={type_:n?1:0,scope_:t?t.scope_:Jv(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let s=r,o=uc;n&&(s=[r],o=ti);const{revoke:i,proxy:a}=Proxy.revocable(s,o);return r.draft_=a,r.revoke_=i,[a,r]}var uc={get(e,t){if(t===Ct)return e;let n=e.scope_.arrayMethodsPlugin_;const r=e.type_===1&&typeof t=="string";if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const s=zn(e);if(!vm(s,t,e.type_))return $T(e,s,t);const o=s[t];if(e.finalized_||!hn(o)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&MT(t))return o;if(o===iu(e.base_,t)){Ma(e);const i=e.type_===1?+t:t,a=md(e.scope_,o,e,i);return e.copy_[i]=a}return o},has(e,t){return t in zn(e)},ownKeys(e){return Reflect.ownKeys(zn(e))},set(e,t,n){const r=nx(zn(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const s=iu(zn(e),t),o=s?.[Ct];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(TT(n,s)&&(n!==void 0||vm(e.base_,t,e.type_)))return!0;Ma(e),pd(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),FT(e,t,n)),!0},deleteProperty(e,t){return Ma(e),iu(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),pd(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=zn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[Ta]:!0,[cd]:e.type_!==1||t!=="length",[ic]:r[ic],[Qo]:n[t]}},defineProperty(){Bt(11)},getPrototypeOf(e){return Ks(e.base_)},setPrototypeOf(){Bt(12)}},ti={};for(let e in uc){let t=uc[e];ti[e]=function(){const n=arguments;return n[0]=n[0][0],t.apply(this,n)}}ti.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Bt(13),ti.set.call(this,e,t,void 0)};ti.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Bt(14),uc.set.call(this,e[0],t,n,e[0])};function iu(e,t){const n=e[Ct];return(n?zn(n):e)[t]}function $T(e,t,n){const r=nx(t,n);return r?Qo in r?r[Qo]:r.get?.call(e.draft_):void 0}function nx(e,t){if(!(t in e))return;let n=Ks(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Ks(n)}}function pd(e){e.modified_||(e.modified_=!0,e.parent_&&pd(e.parent_))}function Ma(e){e.copy_||(e.assigned_=new Map,e.copy_=ud(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var VT=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,n,r)=>{if(Lr(t)&&!Lr(n)){const o=n;n=t;const i=this;return function(c=o,...l){return i.produce(c,u=>n.call(this,u,...l))}}Lr(n)||Bt(6),r!==void 0&&!Lr(r)&&Bt(7);let s;if(hn(t)){const o=Sm(this),i=md(o,t,void 0);let a=!0;try{s=n(i),a=!1}finally{a?fd(o):hd(o)}return wm(o,r),Em(s,o)}else if(!t||!Tf(t)){if(s=n(t),s===void 0&&(s=t),s===Gv&&(s=void 0),this.autoFreeze_&&Af(s,!0),r){const o=[],i=[];es(dd).generateReplacementPatches_(t,s,{patches_:o,inversePatches_:i}),r(o,i)}return s}else Bt(1,t)},this.produceWithPatches=(t,n)=>{if(Lr(t))return(i,...a)=>this.produceWithPatches(i,c=>t(c,...a));let r,s;return[this.produce(t,n,(i,a)=>{r=i,s=a}),r,s]},ou(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),ou(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),ou(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){hn(e)||Bt(8),Kn(e)&&(e=BT(e));const t=Sm(this),n=md(t,e,void 0);return n[Ct].isManual_=!0,hd(t),n}finishDraft(e,t){const n=e&&e[Ct];(!n||!n.isManual_)&&Bt(9);const{scope_:r}=n;return wm(r,t),Em(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const s=t[n];if(s.path.length===0&&s.op==="replace"){e=s.value;break}}n>-1&&(t=t.slice(n+1));const r=es(dd).applyPatches_;return Kn(e)?r(e,t):this.produce(e,s=>r(s,t))}};function md(e,t,n,r){const[s,o]=Gc(t)?es(cc).proxyMap_(t,n):Yc(t)?es(cc).proxySet_(t,n):zT(t,n);return(n?.scope_??Jv()).drafts_.push(s),o.callbacks_=n?.callbacks_??[],o.key_=r,n&&r!==void 0?LT(n,o,r):o.callbacks_.push(function(c){c.mapSetPlugin_?.fixSetContents(o);const{patchPlugin_:l}=c;o.modified_&&l&&l.generatePatches_(o,[],c)}),s}function BT(e){return Kn(e)||Bt(10,e),rx(e)}function rx(e){if(!hn(e)||Xc(e))return e;const t=e[Ct];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ud(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=ud(e,!0);return Kc(n,(s,o)=>{ac(n,s,rx(o))},r),t&&(t.finalized_=!1),n}var UT=new VT,sx=UT.produce;function ox(e){return({dispatch:n,getState:r})=>s=>o=>typeof o=="function"?o(n,r,e):s(o)}var WT=ox(),HT=ox,qT=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?sc:sc.apply(null,arguments)},ix=e=>e&&typeof e.match=="function";function $o(e,t){function n(...r){if(t){let s=t(...r);if(!s)throw new Error(process.env.NODE_ENV==="production"?Oe(0):"prepareAction did not return an object");return{type:e,payload:s.payload,..."meta"in s&&{meta:s.meta},..."error"in s&&{error:s.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>Zv(r)&&r.type===e,n}function KT(e){return typeof e=="function"&&"type"in e&&ix(e)}function ZT(e){const t=e?`${e}`.split("/"):[],n=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched.
14
+ Make sure you're calling the action creator before dispatching, i.e. \`dispatch(${n}())\` instead of \`dispatch(${n})\`. This is necessary even if the action has no payload.`}function GT(e={}){if(process.env.NODE_ENV==="production")return()=>n=>r=>n(r);const{isActionCreator:t=KT}=e;return()=>n=>r=>(t(r)&&console.warn(ZT(r.type)),n(r))}function ax(e,t){let n=0;return{measureTime(r){const s=Date.now();try{return r()}finally{const o=Date.now();n+=o-s}},warnIfExceeded(){n>e&&console.warn(`${t} took ${n}ms, which is more than the warning threshold of ${e}ms.
15
+ If your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.
16
+ It is disabled in production builds, so you don't need to worry about that.`)}}}var cx=class Ro extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Ro.prototype)}static get[Symbol.species](){return Ro}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Ro(...t[0].concat(this)):new Ro(...t.concat(this))}};function Cm(e){return hn(e)?sx(e,()=>{}):e}function Gi(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function YT(e){return typeof e!="object"||e==null||Object.isFrozen(e)}function XT(e,t,n){const r=lx(e,t,n);return{detectMutations(){return ux(e,t,r,n)}}}function lx(e,t=[],n,r="",s=new Set){const o={value:n};if(!e(n)&&!s.has(n)){s.add(n),o.children={};const i=t.length>0;for(const a in n){const c=r?r+"."+a:a;i&&t.some(u=>u instanceof RegExp?u.test(c):c===u)||(o.children[a]=lx(e,t,n[a],c))}}return o}function ux(e,t=[],n,r,s=!1,o=""){const i=n?n.value:void 0,a=i===r;if(s&&!a&&!Number.isNaN(r))return{wasMutated:!0,path:o};if(e(i)||e(r))return{wasMutated:!1};const c={};for(let u in n.children)c[u]=!0;for(let u in r)c[u]=!0;const l=t.length>0;for(let u in c){const d=o?o+"."+u:u;if(l&&t.some(p=>p instanceof RegExp?p.test(d):d===p))continue;const f=ux(e,t,n.children[u],r[u],a,d);if(f.wasMutated)return f}return{wasMutated:!1}}function JT(e={}){if(process.env.NODE_ENV==="production")return()=>t=>n=>t(n);{let t=function(a,c,l,u){return JSON.stringify(a,n(c,u),l)},n=function(a,c){let l=[],u=[];return c||(c=function(d,f){return l[0]===f?"[Circular ~]":"[Circular ~."+u.slice(0,l.indexOf(f)).join(".")+"]"}),function(d,f){if(l.length>0){var h=l.indexOf(this);~h?l.splice(h+1):l.push(this),~h?u.splice(h,1/0,d):u.push(d),~l.indexOf(f)&&(f=c.call(this,d,f))}else l.push(f);return a==null?f:a.call(this,d,f)}},{isImmutable:r=YT,ignoredPaths:s,warnAfter:o=32}=e;const i=XT.bind(null,r,s);return({getState:a})=>{let c=a(),l=i(c),u;return d=>f=>{const h=ax(o,"ImmutableStateInvariantMiddleware");h.measureTime(()=>{if(c=a(),u=l.detectMutations(),l=i(c),u.wasMutated)throw new Error(process.env.NODE_ENV==="production"?Oe(19):`A state mutation was detected between dispatches, in the path '${u.path||""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)});const p=d(f);return h.measureTime(()=>{if(c=a(),u=l.detectMutations(),l=i(c),u.wasMutated)throw new Error(process.env.NODE_ENV==="production"?Oe(20):`A state mutation was detected inside a dispatch, in the path: ${u.path||""}. Take a look at the reducer(s) handling the action ${t(f)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)}),h.warnIfExceeded(),p}}}}function dx(e){const t=typeof e;return e==null||t==="string"||t==="boolean"||t==="number"||Array.isArray(e)||wi(e)}function gd(e,t="",n=dx,r,s=[],o){let i;if(!n(e))return{keyPath:t||"<root>",value:e};if(typeof e!="object"||e===null||o?.has(e))return!1;const a=r!=null?r(e):Object.entries(e),c=s.length>0;for(const[l,u]of a){const d=t?t+"."+l:l;if(!(c&&s.some(h=>h instanceof RegExp?h.test(d):d===h))){if(!n(u))return{keyPath:d,value:u};if(typeof u=="object"&&(i=gd(u,d,n,r,s,o),i))return i}}return o&&fx(e)&&o.add(e),!1}function fx(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if(!(typeof t!="object"||t===null)&&!fx(t))return!1;return!0}function QT(e={}){if(process.env.NODE_ENV==="production")return()=>t=>n=>t(n);{const{isSerializable:t=dx,getEntries:n,ignoredActions:r=[],ignoredActionPaths:s=["meta.arg","meta.baseQueryMeta"],ignoredPaths:o=[],warnAfter:i=32,ignoreState:a=!1,ignoreActions:c=!1,disableCache:l=!1}=e,u=!l&&WeakSet?new WeakSet:void 0;return d=>f=>h=>{if(!Zv(h))return f(h);const p=f(h),m=ax(i,"SerializableStateInvariantMiddleware");return!c&&!(r.length&&r.indexOf(h.type)!==-1)&&m.measureTime(()=>{const y=gd(h,"",t,n,s,u);if(y){const{keyPath:b,value:x}=y;console.error(`A non-serializable value was detected in an action, in the path: \`${b}\`. Value:`,x,`
17
+ Take a look at the logic that dispatched this action: `,h,`
18
+ (See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)`,`
19
+ (To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)`)}}),a||(m.measureTime(()=>{const y=d.getState(),b=gd(y,"",t,n,o,u);if(b){const{keyPath:x,value:_}=b;console.error(`A non-serializable value was detected in the state, in the path: \`${x}\`. Value:`,_,`
20
+ Take a look at the reducer(s) handling this action type: ${h.type}.
21
+ (See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}}),m.warnIfExceeded()),p}}}function Yi(e){return typeof e=="boolean"}var eM=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:s=!0,actionCreatorCheck:o=!0}=t??{};let i=new cx;if(n&&(Yi(n)?i.push(WT):i.push(HT(n.extraArgument))),process.env.NODE_ENV!=="production"){if(r){let a={};Yi(r)||(a=r),i.unshift(JT(a))}if(s){let a={};Yi(s)||(a=s),i.push(QT(a))}if(o){let a={};Yi(o)||(a=o),i.unshift(GT(a))}}return i},tM="RTK_autoBatch",Rm=e=>t=>{setTimeout(t,e)},nM=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let s=!0,o=!1,i=!1;const a=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Rm(10):e.type==="callback"?e.queueNotification:Rm(e.timeout),l=()=>{i=!1,o&&(o=!1,a.forEach(u=>u()))};return Object.assign({},r,{subscribe(u){const d=()=>s&&u(),f=r.subscribe(d);return a.add(u),()=>{f(),a.delete(u)}},dispatch(u){try{return s=!u?.meta?.[tM],o=!s,o&&(i||(i=!0,c(l))),r.dispatch(u)}finally{s=!0}}})},rM=e=>function(n){const{autoBatch:r=!0}=n??{};let s=new cx(e);return r&&s.push(nM(typeof r=="object"?r:void 0)),s};function sM(e){const t=eM(),{reducer:n=void 0,middleware:r,devTools:s=!0,duplicateMiddlewareCheck:o=!0,preloadedState:i=void 0,enhancers:a=void 0}=e||{};let c;if(typeof n=="function")c=n;else if(wi(n))c=CT(n);else throw new Error(process.env.NODE_ENV==="production"?Oe(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");if(process.env.NODE_ENV!=="production"&&r&&typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?Oe(2):"`middleware` field must be a callback");let l;if(typeof r=="function"){if(l=r(t),process.env.NODE_ENV!=="production"&&!Array.isArray(l))throw new Error(process.env.NODE_ENV==="production"?Oe(3):"when using a middleware builder function, an array of middleware must be returned")}else l=t();if(process.env.NODE_ENV!=="production"&&l.some(m=>typeof m!="function"))throw new Error(process.env.NODE_ENV==="production"?Oe(4):"each middleware provided to configureStore must be a function");if(process.env.NODE_ENV!=="production"&&o){let m=new Set;l.forEach(y=>{if(m.has(y))throw new Error(process.env.NODE_ENV==="production"?Oe(42):"Duplicate middleware references found when creating the store. Ensure that each middleware is only included once.");m.add(y)})}let u=sc;s&&(u=qT({trace:process.env.NODE_ENV!=="production",...typeof s=="object"&&s}));const d=RT(...l),f=rM(d);if(process.env.NODE_ENV!=="production"&&a&&typeof a!="function")throw new Error(process.env.NODE_ENV==="production"?Oe(5):"`enhancers` field must be a callback");let h=typeof a=="function"?a(f):f();if(process.env.NODE_ENV!=="production"&&!Array.isArray(h))throw new Error(process.env.NODE_ENV==="production"?Oe(6):"`enhancers` callback must return an array");if(process.env.NODE_ENV!=="production"&&h.some(m=>typeof m!="function"))throw new Error(process.env.NODE_ENV==="production"?Oe(7):"each enhancer provided to configureStore must be a function");process.env.NODE_ENV!=="production"&&l.length&&!h.includes(d)&&console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");const p=u(...h);return Kv(c,i,p)}function hx(e){const t={},n=[];let r;const s={addCase(o,i){if(process.env.NODE_ENV!=="production"){if(n.length>0)throw new Error(process.env.NODE_ENV==="production"?Oe(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(r)throw new Error(process.env.NODE_ENV==="production"?Oe(27):"`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const a=typeof o=="string"?o:o.type;if(!a)throw new Error(process.env.NODE_ENV==="production"?Oe(28):"`builder.addCase` cannot be called with an empty action type");if(a in t)throw new Error(process.env.NODE_ENV==="production"?Oe(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${a}'`);return t[a]=i,s},addAsyncThunk(o,i){if(process.env.NODE_ENV!=="production"&&r)throw new Error(process.env.NODE_ENV==="production"?Oe(43):"`builder.addAsyncThunk` should only be called before calling `builder.addDefaultCase`");return i.pending&&(t[o.pending.type]=i.pending),i.rejected&&(t[o.rejected.type]=i.rejected),i.fulfilled&&(t[o.fulfilled.type]=i.fulfilled),i.settled&&n.push({matcher:o.settled,reducer:i.settled}),s},addMatcher(o,i){if(process.env.NODE_ENV!=="production"&&r)throw new Error(process.env.NODE_ENV==="production"?Oe(30):"`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:o,reducer:i}),s},addDefaultCase(o){if(process.env.NODE_ENV!=="production"&&r)throw new Error(process.env.NODE_ENV==="production"?Oe(31):"`builder.addDefaultCase` can only be called once");return r=o,s}};return e(s),[t,n,r]}function oM(e){return typeof e=="function"}function iM(e,t){if(process.env.NODE_ENV!=="production"&&typeof t=="object")throw new Error(process.env.NODE_ENV==="production"?Oe(8):"The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");let[n,r,s]=hx(t),o;if(oM(e))o=()=>Cm(e());else{const a=Cm(e);o=()=>a}function i(a=o(),c){let l=[n[c.type],...r.filter(({matcher:u})=>u(c)).map(({reducer:u})=>u)];return l.filter(u=>!!u).length===0&&(l=[s]),l.reduce((u,d)=>{if(d)if(Kn(u)){const h=d(u,c);return h===void 0?u:h}else{if(hn(u))return sx(u,f=>d(f,c));{const f=d(u,c);if(f===void 0){if(u===null)return u;throw Error("A case reducer on a non-draftable value must not return undefined")}return f}}return u},a)}return i.getInitialState=o,i}var aM=(e,t)=>ix(e)?e.match(t):e(t);function cM(...e){return t=>e.some(n=>aM(n,t))}var lM="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",uM=(e=21)=>{let t="",n=e;for(;n--;)t+=lM[Math.random()*64|0];return t},dM=["name","message","stack","code"],au=class{constructor(e,t){this.payload=e,this.meta=t}_type},Pm=class{constructor(e,t){this.payload=e,this.meta=t}_type},fM=e=>{if(typeof e=="object"&&e!==null){const t={};for(const n of dM)typeof e[n]=="string"&&(t[n]=e[n]);return t}return{message:String(e)}},Om="External signal was aborted",xr=(()=>{function e(t,n,r){const s=$o(t+"/fulfilled",(c,l,u,d)=>({payload:c,meta:{...d||{},arg:u,requestId:l,requestStatus:"fulfilled"}})),o=$o(t+"/pending",(c,l,u)=>({payload:void 0,meta:{...u||{},arg:l,requestId:c,requestStatus:"pending"}})),i=$o(t+"/rejected",(c,l,u,d,f)=>({payload:d,error:(r&&r.serializeError||fM)(c||"Rejected"),meta:{...f||{},arg:u,requestId:l,rejectedWithValue:!!d,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function a(c,{signal:l}={}){return(u,d,f)=>{const h=r?.idGenerator?r.idGenerator(c):uM(),p=new AbortController;let m,y;function b(_){y=_,p.abort()}l&&(l.aborted?b(Om):l.addEventListener("abort",()=>b(Om),{once:!0}));const x=(async function(){let _;try{let S=r?.condition?.(c,{getState:d,extra:f});if(pM(S)&&(S=await S),S===!1||p.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const C=new Promise((k,E)=>{m=()=>{E({name:"AbortError",message:y||"Aborted"})},p.signal.addEventListener("abort",m,{once:!0})});u(o(h,c,r?.getPendingMeta?.({requestId:h,arg:c},{getState:d,extra:f}))),_=await Promise.race([C,Promise.resolve(n(c,{dispatch:u,getState:d,extra:f,requestId:h,signal:p.signal,abort:b,rejectWithValue:(k,E)=>new au(k,E),fulfillWithValue:(k,E)=>new Pm(k,E)})).then(k=>{if(k instanceof au)throw k;return k instanceof Pm?s(k.payload,h,c,k.meta):s(k,h,c)})])}catch(S){_=S instanceof au?i(null,h,c,S.payload,S.meta):i(S,h,c)}finally{m&&p.signal.removeEventListener("abort",m)}return r&&!r.dispatchConditionRejection&&i.match(_)&&_.meta.condition||u(_),_})();return Object.assign(x,{abort:b,requestId:h,arg:c,unwrap(){return x.then(hM)}})}}return Object.assign(a,{pending:o,rejected:i,fulfilled:s,settled:cM(i,s),typePrefix:t})}return e.withTypes=()=>e,e})();function hM(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function pM(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var mM=Symbol.for("rtk-slice-createasyncthunk");function gM(e,t){return`${e}/${t}`}function yM({creators:e}={}){const t=e?.asyncThunk?.[mM];return function(r){const{name:s,reducerPath:o=s}=r;if(!s)throw new Error(process.env.NODE_ENV==="production"?Oe(11):"`name` is a required option for createSlice");typeof process<"u"&&process.env.NODE_ENV==="development"&&r.initialState===void 0&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const i=(typeof r.reducers=="function"?r.reducers(xM()):r.reducers)||{},a=Object.keys(i),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},l={addCase(_,w){const S=typeof _=="string"?_:_.type;if(!S)throw new Error(process.env.NODE_ENV==="production"?Oe(12):"`context.addCase` cannot be called with an empty action type");if(S in c.sliceCaseReducersByType)throw new Error(process.env.NODE_ENV==="production"?Oe(13):"`context.addCase` cannot be called with two reducers for the same action type: "+S);return c.sliceCaseReducersByType[S]=w,l},addMatcher(_,w){return c.sliceMatchers.push({matcher:_,reducer:w}),l},exposeAction(_,w){return c.actionCreators[_]=w,l},exposeCaseReducer(_,w){return c.sliceCaseReducersByName[_]=w,l}};a.forEach(_=>{const w=i[_],S={reducerName:_,type:gM(s,_),createNotation:typeof r.reducers=="function"};wM(w)?EM(S,w,l,t):_M(S,w,l)});function u(){if(process.env.NODE_ENV!=="production"&&typeof r.extraReducers=="object")throw new Error(process.env.NODE_ENV==="production"?Oe(14):"The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");const[_={},w=[],S=void 0]=typeof r.extraReducers=="function"?hx(r.extraReducers):[r.extraReducers],C={..._,...c.sliceCaseReducersByType};return iM(r.initialState,k=>{for(let E in C)k.addCase(E,C[E]);for(let E of c.sliceMatchers)k.addMatcher(E.matcher,E.reducer);for(let E of w)k.addMatcher(E.matcher,E.reducer);S&&k.addDefaultCase(S)})}const d=_=>_,f=new Map,h=new WeakMap;let p;function m(_,w){return p||(p=u()),p(_,w)}function y(){return p||(p=u()),p.getInitialState()}function b(_,w=!1){function S(k){let E=k[_];if(typeof E>"u"){if(w)E=Gi(h,S,y);else if(process.env.NODE_ENV!=="production")throw new Error(process.env.NODE_ENV==="production"?Oe(15):"selectSlice returned undefined for an uninjected slice reducer")}return E}function C(k=d){const E=Gi(f,w,()=>new WeakMap);return Gi(E,k,()=>{const P={};for(const[O,N]of Object.entries(r.selectors??{}))P[O]=bM(N,k,()=>Gi(h,k,y),w);return P})}return{reducerPath:_,getSelectors:C,get selectors(){return C(S)},selectSlice:S}}const x={name:s,reducer:m,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:y,...b(o),injectInto(_,{reducerPath:w,...S}={}){const C=w??o;return _.inject({reducerPath:C,reducer:m},S),{...x,...b(C,!0)}}};return x}}function bM(e,t,n,r){function s(o,...i){let a=t(o);if(typeof a>"u"){if(r)a=n();else if(process.env.NODE_ENV!=="production")throw new Error(process.env.NODE_ENV==="production"?Oe(16):"selectState returned undefined for an uninjected slice reducer")}return e(a,...i)}return s.unwrapped=e,s}var vM=yM();function xM(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function _M({type:e,reducerName:t,createNotation:n},r,s){let o,i;if("reducer"in r){if(n&&!SM(r))throw new Error(process.env.NODE_ENV==="production"?Oe(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");o=r.reducer,i=r.prepare}else o=r;s.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,i?$o(e,i):$o(e))}function wM(e){return e._reducerDefinitionType==="asyncThunk"}function SM(e){return e._reducerDefinitionType==="reducerWithPrepare"}function EM({type:e,reducerName:t},n,r,s){if(!s)throw new Error(process.env.NODE_ENV==="production"?Oe(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:o,fulfilled:i,pending:a,rejected:c,settled:l,options:u}=n,d=s(e,o,u);r.exposeAction(t,d),i&&r.addCase(d.fulfilled,i),a&&r.addCase(d.pending,a),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:i||Xi,pending:a||Xi,rejected:c||Xi,settled:l||Xi})}function Xi(){}function Oe(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const _r={getSummary:(e=60)=>Te.get(`/monitors/summary?bars=${e}`).then(t=>t.data.rows),getList:()=>Te.get("/monitors").then(e=>e.data.monitors),getResults:(e,t=180)=>Te.get(`/monitors/${e}/results?limit=${t}`).then(n=>n.data.results),create:e=>Te.post("/monitors",e).then(t=>t.data),update:(e,t)=>Te.put(`/monitors/${e}`,t).then(n=>n.data),delete:e=>Te.delete(`/monitors/${e}`).then(t=>t.data),togglePause:(e,t)=>Te.post(`/monitors/${e}/pause`,{paused:t}).then(n=>n.data)},kM={data:[],list:[],current:null,currentResults:[],loading:!1,error:null,actionLoading:!1},Aa=xr("monitors/fetchResults",async(e,{rejectWithValue:t})=>{try{return await _r.getResults(e)}catch(n){return t(n.response?.data?.message||"Failed to fetch results")}}),Ur=xr("monitors/fetchSummary",async(e=60,{rejectWithValue:t})=>{try{return await _r.getSummary(e)}catch(n){return t(n.response?.data?.message||"Failed to fetch summary")}}),Na=xr("monitors/fetchAll",async(e,{rejectWithValue:t})=>{try{return await _r.getList()}catch(n){return t(n.response?.data?.message||"Failed to fetch monitors")}}),ks=xr("monitors/fetchOne",async(e,{rejectWithValue:t})=>{try{const r=(await _r.getList()).find(s=>s.id===e);if(!r)throw new Error("Monitor not found");return r}catch(n){return t(n.message||n.response?.data?.message||"Failed to fetch monitor")}}),dc=xr("monitors/pause",async({id:e,paused:t},{rejectWithValue:n})=>{try{return await _r.togglePause(e,t),{id:e,paused:t}}catch(r){return n(r.response?.data?.message||"Failed to toggle pause")}}),Nf=xr("monitors/delete",async(e,{rejectWithValue:t})=>{try{return await _r.delete(e),e}catch(n){return t(n.response?.data?.message||"Failed to delete monitor")}}),px=xr("monitors/create",async(e,{rejectWithValue:t})=>{try{return await _r.create(e)}catch(n){return t(n.response?.data?.message||"Failed to create monitor")}}),Df=xr("monitors/update",async({id:e,data:t},{rejectWithValue:n})=>{try{return await _r.update(e,t)}catch(r){return n(r.response?.data?.message||"Failed to update monitor")}}),mx=vM({name:"monitors",initialState:kM,reducers:{clearError:e=>{e.error=null},setCurrentMonitor:(e,t)=>{e.current=t.payload}},extraReducers:e=>{e.addCase(Ur.pending,t=>{t.loading=!0,t.error=null}),e.addCase(Ur.fulfilled,(t,n)=>{t.loading=!1,t.data=n.payload}),e.addCase(Ur.rejected,(t,n)=>{t.loading=!1,t.error=n.payload}),e.addCase(Na.pending,t=>{t.loading=!0}),e.addCase(Na.fulfilled,(t,n)=>{t.loading=!1,t.list=n.payload}),e.addCase(Na.rejected,(t,n)=>{t.loading=!1,t.error=n.payload}),e.addCase(ks.pending,t=>{t.loading=!0}),e.addCase(ks.fulfilled,(t,n)=>{t.loading=!1,t.current=n.payload}),e.addCase(Aa.fulfilled,(t,n)=>{t.currentResults=n.payload}),e.addCase(dc.pending,t=>{t.actionLoading=!0}),e.addCase(dc.fulfilled,(t,n)=>{t.actionLoading=!1;const r=t.data.find(o=>o.monitor.id===n.payload.id);r&&(r.monitor.isPaused=n.payload.paused);const s=t.list.find(o=>o.id===n.payload.id);s&&(s.isPaused=n.payload.paused),t.current?.id===n.payload.id&&(t.current.isPaused=n.payload.paused)}),e.addCase(Nf.fulfilled,(t,n)=>{t.data=t.data.filter(r=>r.monitor.id!==n.payload),t.list=t.list.filter(r=>r.id!==n.payload),t.current?.id===n.payload&&(t.current=null)}),e.addCase(px.fulfilled,(t,n)=>{t.list.push(n.payload.monitor)}),e.addCase(Df.fulfilled,(t,n)=>{const r=t.list.findIndex(o=>o.id===n.payload.monitor.id);r!==-1&&(t.list[r]=n.payload.monitor);const s=t.data.findIndex(o=>o.monitor.id===n.payload.monitor.id);s!==-1&&(t.data[s].monitor=n.payload.monitor),t.current?.id===n.payload.monitor.id&&(t.current=n.payload.monitor)})}}),{clearError:qH,setCurrentMonitor:KH}=mx.actions,CM=mx.reducer;const RM=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),PM=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Tm=e=>{const t=PM(e);return t.charAt(0).toUpperCase()+t.slice(1)},gx=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),OM=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var TM={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const MM=T.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:i,...a},c)=>T.createElement("svg",{ref:c,...TM,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:gx("lucide",s),...!o&&!OM(a)&&{"aria-hidden":"true"},...a},[...i.map(([l,u])=>T.createElement(l,u)),...Array.isArray(o)?o:[o]]));const Ke=(e,t)=>{const n=T.forwardRef(({className:r,...s},o)=>T.createElement(MM,{ref:o,iconNode:t,className:gx(`lucide-${RM(Tm(e))}`,`lucide-${e}`,r),...s}));return n.displayName=Tm(e),n};const AM=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],cu=Ke("activity",AM);const NM=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],yx=Ke("arrow-left",NM);const DM=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],bx=Ke("check",DM);const IM=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],vx=Ke("chevron-down",IM);const jM=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],LM=Ke("chevron-up",jM);const FM=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],xx=Ke("copy",FM);const zM=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],$M=Ke("database",zM);const VM=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],BM=Ke("ellipsis",VM);const UM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],WM=Ke("globe",UM);const HM=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],If=Ke("loader-circle",HM);const qM=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],KM=Ke("package",qM);const ZM=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],_x=Ke("pause",ZM);const GM=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],wx=Ke("pencil",GM);const YM=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Sx=Ke("play",YM);const XM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Mm=Ke("plus",XM);const JM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ex=Ke("search",JM);const QM=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],e1=Ke("send",QM);const t1=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],n1=Ke("server",t1);const r1=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],s1=Ke("terminal",r1);const o1=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],jf=Ke("trash-2",o1);const i1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],a1=Ke("x",i1);function Am(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Yn(...e){return t=>{let n=!1;const r=e.map(s=>{const o=Am(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():Am(e[s],null)}}}}function Pe(...e){return v.useCallback(Yn(...e),e)}var c1=Symbol.for("react.lazy"),fc=v[" use ".trim().toString()];function l1(e){return typeof e=="object"&&e!==null&&"then"in e}function kx(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===c1&&"_payload"in e&&l1(e._payload)}function Cx(e){const t=u1(e),n=v.forwardRef((r,s)=>{let{children:o,...i}=r;kx(o)&&typeof fc=="function"&&(o=fc(o._payload));const a=v.Children.toArray(o),c=a.find(f1);if(c){const l=c.props.children,u=a.map(d=>d===c?v.Children.count(l)>1?v.Children.only(null):v.isValidElement(l)?l.props.children:null:d);return g.jsx(t,{...i,ref:s,children:v.isValidElement(l)?v.cloneElement(l,void 0,u):null})}return g.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}var Lf=Cx("Slot");function u1(e){const t=v.forwardRef((n,r)=>{let{children:s,...o}=n;if(kx(s)&&typeof fc=="function"&&(s=fc(s._payload)),v.isValidElement(s)){const i=p1(s),a=h1(o,s.props);return s.type!==v.Fragment&&(a.ref=r?Yn(r,i):i),v.cloneElement(s,a)}return v.Children.count(s)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var d1=Symbol("radix.slottable");function f1(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===d1}function h1(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...a)=>{const c=o(...a);return s(...a),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function p1(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const Nm=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Dm=Rf,Rx=(e,t)=>n=>{var r;if(t?.variants==null)return Dm(e,n?.class,n?.className);const{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(l=>{const u=n?.[l],d=o?.[l];if(u===null)return null;const f=Nm(u)||Nm(d);return s[l][f]}),a=n&&Object.entries(n).reduce((l,u)=>{let[d,f]=u;return f===void 0||(l[d]=f),l},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((l,u)=>{let{class:d,className:f,...h}=u;return Object.entries(h).every(p=>{let[m,y]=p;return Array.isArray(y)?y.includes({...o,...a}[m]):{...o,...a}[m]===y})?[...l,d,f]:l},[]);return Dm(e,i,c,n?.class,n?.className)};function Se(...e){return Wv(Rf(e))}const m1=Rx("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function gt({className:e,variant:t,size:n,asChild:r=!1,...s}){const o=r?Lf:"button";return g.jsx(o,{"data-slot":"button",className:Se(m1({variant:t,size:n,className:e})),...s})}function re(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e?.(s),n===!1||!s.defaultPrevented)return t?.(s)}}function g1(e,t){const n=v.createContext(t),r=o=>{const{children:i,...a}=o,c=v.useMemo(()=>a,Object.values(a));return g.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function s(o){const i=v.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,s]}function wr(e,t=[]){let n=[];function r(o,i){const a=v.createContext(i),c=n.length;n=[...n,i];const l=d=>{const{scope:f,children:h,...p}=d,m=f?.[e]?.[c]||a,y=v.useMemo(()=>p,Object.values(p));return g.jsx(m.Provider,{value:y,children:h})};l.displayName=o+"Provider";function u(d,f){const h=f?.[e]?.[c]||a,p=v.useContext(h);if(p)return p;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${o}\``)}return[l,u]}const s=()=>{const o=n.map(i=>v.createContext(i));return function(a){const c=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return s.scopeName=e,[r,y1(s,...t)]}function y1(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=r.reduce((a,{useScope:c,scopeName:l})=>{const d=c(o)[`__scope${l}`];return{...a,...d}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var vt=globalThis?.document?v.useLayoutEffect:()=>{},b1=v[" useInsertionEffect ".trim().toString()]||vt;function Zs({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,i]=v1({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:s;{const u=v.useRef(e!==void 0);v.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const l=v.useCallback(u=>{if(a){const d=x1(u)?u(e):u;d!==e&&i.current?.(d)}else o(u)},[a,e,o,i]);return[c,l]}function v1({defaultProp:e,onChange:t}){const[n,r]=v.useState(e),s=v.useRef(n),o=v.useRef(t);return b1(()=>{o.current=t},[t]),v.useEffect(()=>{s.current!==n&&(o.current?.(n),s.current=n)},[n,s]),[n,r,o]}function x1(e){return typeof e=="function"}function _1(e){const t=w1(e),n=v.forwardRef((r,s)=>{const{children:o,...i}=r,a=v.Children.toArray(o),c=a.find(E1);if(c){const l=c.props.children,u=a.map(d=>d===c?v.Children.count(l)>1?v.Children.only(null):v.isValidElement(l)?l.props.children:null:d);return g.jsx(t,{...i,ref:s,children:v.isValidElement(l)?v.cloneElement(l,void 0,u):null})}return g.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function w1(e){const t=v.forwardRef((n,r)=>{const{children:s,...o}=n;if(v.isValidElement(s)){const i=C1(s),a=k1(o,s.props);return s.type!==v.Fragment&&(a.ref=r?Yn(r,i):i),v.cloneElement(s,a)}return v.Children.count(s)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var S1=Symbol("radix.slottable");function E1(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===S1}function k1(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...a)=>{const c=o(...a);return s(...a),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function C1(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var R1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],be=R1.reduce((e,t)=>{const n=_1(`Primitive.${t}`),r=v.forwardRef((s,o)=>{const{asChild:i,...a}=s,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(c,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Px(e,t){e&&Ic.flushSync(()=>e.dispatchEvent(t))}function Im(e){const t=P1(e),n=v.forwardRef((r,s)=>{const{children:o,...i}=r,a=v.Children.toArray(o),c=a.find(T1);if(c){const l=c.props.children,u=a.map(d=>d===c?v.Children.count(l)>1?v.Children.only(null):v.isValidElement(l)?l.props.children:null:d);return g.jsx(t,{...i,ref:s,children:v.isValidElement(l)?v.cloneElement(l,void 0,u):null})}return g.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function P1(e){const t=v.forwardRef((n,r)=>{const{children:s,...o}=n;if(v.isValidElement(s)){const i=A1(s),a=M1(o,s.props);return s.type!==v.Fragment&&(a.ref=r?Yn(r,i):i),v.cloneElement(s,a)}return v.Children.count(s)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var O1=Symbol("radix.slottable");function T1(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===O1}function M1(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...a)=>{const c=o(...a);return s(...a),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function A1(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Ff(e){const t=e+"CollectionProvider",[n,r]=wr(t),[s,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:y,children:b}=m,x=T.useRef(null),_=T.useRef(new Map).current;return g.jsx(s,{scope:y,itemMap:_,collectionRef:x,children:b})};i.displayName=t;const a=e+"CollectionSlot",c=Im(a),l=T.forwardRef((m,y)=>{const{scope:b,children:x}=m,_=o(a,b),w=Pe(y,_.collectionRef);return g.jsx(c,{ref:w,children:x})});l.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",f=Im(u),h=T.forwardRef((m,y)=>{const{scope:b,children:x,..._}=m,w=T.useRef(null),S=Pe(y,w),C=o(u,b);return T.useEffect(()=>(C.itemMap.set(w,{ref:w,..._}),()=>{C.itemMap.delete(w)})),g.jsx(f,{[d]:"",ref:S,children:x})});h.displayName=u;function p(m){const y=o(e+"CollectionConsumer",m);return T.useCallback(()=>{const x=y.collectionRef.current;if(!x)return[];const _=Array.from(x.querySelectorAll(`[${d}]`));return Array.from(y.itemMap.values()).sort((C,k)=>_.indexOf(C.ref.current)-_.indexOf(k.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:l,ItemSlot:h},p,r]}var N1=v.createContext(void 0);function zf(e){const t=v.useContext(N1);return e||t||"ltr"}function On(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>t.current?.(...n),[])}function D1(e,t=globalThis?.document){const n=On(e);v.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var I1="DismissableLayer",yd="dismissableLayer.update",j1="dismissableLayer.pointerDownOutside",L1="dismissableLayer.focusOutside",jm,Ox=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Qc=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,onDismiss:a,...c}=e,l=v.useContext(Ox),[u,d]=v.useState(null),f=u?.ownerDocument??globalThis?.document,[,h]=v.useState({}),p=Pe(t,k=>d(k)),m=Array.from(l.layers),[y]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(y),x=u?m.indexOf(u):-1,_=l.layersWithOutsidePointerEventsDisabled.size>0,w=x>=b,S=$1(k=>{const E=k.target,P=[...l.branches].some(O=>O.contains(E));!w||P||(s?.(k),i?.(k),k.defaultPrevented||a?.())},f),C=V1(k=>{const E=k.target;[...l.branches].some(O=>O.contains(E))||(o?.(k),i?.(k),k.defaultPrevented||a?.())},f);return D1(k=>{x===l.layers.size-1&&(r?.(k),!k.defaultPrevented&&a&&(k.preventDefault(),a()))},f),v.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(jm=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Lm(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=jm)}},[u,f,n,l]),v.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Lm())},[u,l]),v.useEffect(()=>{const k=()=>h({});return document.addEventListener(yd,k),()=>document.removeEventListener(yd,k)},[]),g.jsx(be.div,{...c,ref:p,style:{pointerEvents:_?w?"auto":"none":void 0,...e.style},onFocusCapture:re(e.onFocusCapture,C.onFocusCapture),onBlurCapture:re(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:re(e.onPointerDownCapture,S.onPointerDownCapture)})});Qc.displayName=I1;var F1="DismissableLayerBranch",z1=v.forwardRef((e,t)=>{const n=v.useContext(Ox),r=v.useRef(null),s=Pe(t,r);return v.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),g.jsx(be.div,{...e,ref:s})});z1.displayName=F1;function $1(e,t=globalThis?.document){const n=On(e),r=v.useRef(!1),s=v.useRef(()=>{});return v.useEffect(()=>{const o=a=>{if(a.target&&!r.current){let c=function(){Tx(j1,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function V1(e,t=globalThis?.document){const n=On(e),r=v.useRef(!1);return v.useEffect(()=>{const s=o=>{o.target&&!r.current&&Tx(L1,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Lm(){const e=new CustomEvent(yd);document.dispatchEvent(e)}function Tx(e,t,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?Px(s,o):s.dispatchEvent(o)}var lu=0;function $f(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Fm()),document.body.insertAdjacentElement("beforeend",e[1]??Fm()),lu++,()=>{lu===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),lu--}},[])}function Fm(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var uu="focusScope.autoFocusOnMount",du="focusScope.autoFocusOnUnmount",zm={bubbles:!1,cancelable:!0},B1="FocusScope",el=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...i}=e,[a,c]=v.useState(null),l=On(s),u=On(o),d=v.useRef(null),f=Pe(t,m=>c(m)),h=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let m=function(_){if(h.paused||!a)return;const w=_.target;a.contains(w)?d.current=w:nr(d.current,{select:!0})},y=function(_){if(h.paused||!a)return;const w=_.relatedTarget;w!==null&&(a.contains(w)||nr(d.current,{select:!0}))},b=function(_){if(document.activeElement===document.body)for(const S of _)S.removedNodes.length>0&&nr(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",y);const x=new MutationObserver(b);return a&&x.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",y),x.disconnect()}}},[r,a,h.paused]),v.useEffect(()=>{if(a){Vm.add(h);const m=document.activeElement;if(!a.contains(m)){const b=new CustomEvent(uu,zm);a.addEventListener(uu,l),a.dispatchEvent(b),b.defaultPrevented||(U1(Z1(Mx(a)),{select:!0}),document.activeElement===m&&nr(a))}return()=>{a.removeEventListener(uu,l),setTimeout(()=>{const b=new CustomEvent(du,zm);a.addEventListener(du,u),a.dispatchEvent(b),b.defaultPrevented||nr(m??document.body,{select:!0}),a.removeEventListener(du,u),Vm.remove(h)},0)}}},[a,l,u,h]);const p=v.useCallback(m=>{if(!n&&!r||h.paused)return;const y=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(y&&b){const x=m.currentTarget,[_,w]=W1(x);_&&w?!m.shiftKey&&b===w?(m.preventDefault(),n&&nr(_,{select:!0})):m.shiftKey&&b===_&&(m.preventDefault(),n&&nr(w,{select:!0})):b===x&&m.preventDefault()}},[n,r,h.paused]);return g.jsx(be.div,{tabIndex:-1,...i,ref:f,onKeyDown:p})});el.displayName=B1;function U1(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(nr(r,{select:t}),document.activeElement!==n)return}function W1(e){const t=Mx(e),n=$m(t,e),r=$m(t.reverse(),e);return[n,r]}function Mx(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function $m(e,t){for(const n of e)if(!H1(n,{upTo:t}))return n}function H1(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function q1(e){return e instanceof HTMLInputElement&&"select"in e}function nr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&q1(e)&&t&&e.select()}}var Vm=K1();function K1(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Bm(e,t),e.unshift(t)},remove(t){e=Bm(e,t),e[0]?.resume()}}}function Bm(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Z1(e){return e.filter(t=>t.tagName!=="A")}var G1=v[" useId ".trim().toString()]||(()=>{}),Y1=0;function Hn(e){const[t,n]=v.useState(G1());return vt(()=>{n(r=>r??String(Y1++))},[e]),e||(t?`radix-${t}`:"")}const X1=["top","right","bottom","left"],gr=Math.min,$t=Math.max,hc=Math.round,Ji=Math.floor,kn=e=>({x:e,y:e}),J1={left:"right",right:"left",bottom:"top",top:"bottom"},Q1={start:"end",end:"start"};function bd(e,t,n){return $t(e,gr(t,n))}function Zn(e,t){return typeof e=="function"?e(t):e}function Gn(e){return e.split("-")[0]}function no(e){return e.split("-")[1]}function Vf(e){return e==="x"?"y":"x"}function Bf(e){return e==="y"?"height":"width"}const eA=new Set(["top","bottom"]);function En(e){return eA.has(Gn(e))?"y":"x"}function Uf(e){return Vf(En(e))}function tA(e,t,n){n===void 0&&(n=!1);const r=no(e),s=Uf(e),o=Bf(s);let i=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=pc(i)),[i,pc(i)]}function nA(e){const t=pc(e);return[vd(e),t,vd(t)]}function vd(e){return e.replace(/start|end/g,t=>Q1[t])}const Um=["left","right"],Wm=["right","left"],rA=["top","bottom"],sA=["bottom","top"];function oA(e,t,n){switch(e){case"top":case"bottom":return n?t?Wm:Um:t?Um:Wm;case"left":case"right":return t?rA:sA;default:return[]}}function iA(e,t,n,r){const s=no(e);let o=oA(Gn(e),n==="start",r);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(vd)))),o}function pc(e){return e.replace(/left|right|bottom|top/g,t=>J1[t])}function aA(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ax(e){return typeof e!="number"?aA(e):{top:e,right:e,bottom:e,left:e}}function mc(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function Hm(e,t,n){let{reference:r,floating:s}=e;const o=En(t),i=Uf(t),a=Bf(i),c=Gn(t),l=o==="y",u=r.x+r.width/2-s.width/2,d=r.y+r.height/2-s.height/2,f=r[a]/2-s[a]/2;let h;switch(c){case"top":h={x:u,y:r.y-s.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-s.width,y:d};break;default:h={x:r.x,y:r.y}}switch(no(t)){case"start":h[i]-=f*(n&&l?-1:1);break;case"end":h[i]+=f*(n&&l?-1:1);break}return h}async function cA(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:i,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=Zn(t,e),p=Ax(h),y=a[f?d==="floating"?"reference":"floating":d],b=mc(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(y)))==null||n?y:y.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:l,rootBoundary:u,strategy:c})),x=d==="floating"?{x:r,y:s,width:i.floating.width,height:i.floating.height}:i.reference,_=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),w=await(o.isElement==null?void 0:o.isElement(_))?await(o.getScale==null?void 0:o.getScale(_))||{x:1,y:1}:{x:1,y:1},S=mc(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:_,strategy:c}):x);return{top:(b.top-S.top+p.top)/w.y,bottom:(S.bottom-b.bottom+p.bottom)/w.y,left:(b.left-S.left+p.left)/w.x,right:(S.right-b.right+p.right)/w.x}}const lA=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:i}=n,a=o.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:u,y:d}=Hm(l,r,c),f=r,h={},p=0;for(let y=0;y<a.length;y++){var m;const{name:b,fn:x}=a[y],{x:_,y:w,data:S,reset:C}=await x({x:u,y:d,initialPlacement:r,placement:f,strategy:s,middlewareData:h,rects:l,platform:{...i,detectOverflow:(m=i.detectOverflow)!=null?m:cA},elements:{reference:e,floating:t}});u=_??u,d=w??d,h={...h,[b]:{...h[b],...S}},C&&p<=50&&(p++,typeof C=="object"&&(C.placement&&(f=C.placement),C.rects&&(l=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):C.rects),{x:u,y:d}=Hm(l,f,c)),y=-1)}return{x:u,y:d,placement:f,strategy:s,middlewareData:h}},uA=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:i,elements:a,middlewareData:c}=t,{element:l,padding:u=0}=Zn(e,t)||{};if(l==null)return{};const d=Ax(u),f={x:n,y:r},h=Uf(s),p=Bf(h),m=await i.getDimensions(l),y=h==="y",b=y?"top":"left",x=y?"bottom":"right",_=y?"clientHeight":"clientWidth",w=o.reference[p]+o.reference[h]-f[h]-o.floating[p],S=f[h]-o.reference[h],C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l));let k=C?C[_]:0;(!k||!await(i.isElement==null?void 0:i.isElement(C)))&&(k=a.floating[_]||o.floating[p]);const E=w/2-S/2,P=k/2-m[p]/2-1,O=gr(d[b],P),N=gr(d[x],P),A=O,j=k-m[p]-N,$=k/2-m[p]/2+E,q=bd(A,$,j),D=!c.arrow&&no(s)!=null&&$!==q&&o.reference[p]/2-($<A?O:N)-m[p]/2<0,H=D?$<A?$-A:$-j:0;return{[h]:f[h]+H,data:{[h]:q,centerOffset:$-q-H,...D&&{alignmentOffset:H}},reset:D}}}),dA=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:i,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...y}=Zn(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const b=Gn(s),x=En(a),_=Gn(a)===a,w=await(c.isRTL==null?void 0:c.isRTL(l.floating)),S=f||(_||!m?[pc(a)]:nA(a)),C=p!=="none";!f&&C&&S.push(...iA(a,m,p,w));const k=[a,...S],E=await c.detectOverflow(t,y),P=[];let O=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&P.push(E[b]),d){const $=tA(s,i,w);P.push(E[$[0]],E[$[1]])}if(O=[...O,{placement:s,overflows:P}],!P.every($=>$<=0)){var N,A;const $=(((N=o.flip)==null?void 0:N.index)||0)+1,q=k[$];if(q&&(!(d==="alignment"?x!==En(q):!1)||O.every(F=>En(F.placement)===x?F.overflows[0]>0:!0)))return{data:{index:$,overflows:O},reset:{placement:q}};let D=(A=O.filter(H=>H.overflows[0]<=0).sort((H,F)=>H.overflows[1]-F.overflows[1])[0])==null?void 0:A.placement;if(!D)switch(h){case"bestFit":{var j;const H=(j=O.filter(F=>{if(C){const W=En(F.placement);return W===x||W==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(W=>W>0).reduce((W,se)=>W+se,0)]).sort((F,W)=>F[1]-W[1])[0])==null?void 0:j[0];H&&(D=H);break}case"initialPlacement":D=a;break}if(s!==D)return{reset:{placement:D}}}return{}}}};function qm(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Km(e){return X1.some(t=>e[t]>=0)}const fA=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...o}=Zn(e,t);switch(s){case"referenceHidden":{const i=await r.detectOverflow(t,{...o,elementContext:"reference"}),a=qm(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Km(a)}}}case"escaped":{const i=await r.detectOverflow(t,{...o,altBoundary:!0}),a=qm(i,n.floating);return{data:{escapedOffsets:a,escaped:Km(a)}}}default:return{}}}}},Nx=new Set(["left","top"]);async function hA(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),i=Gn(n),a=no(n),c=En(n)==="y",l=Nx.has(i)?-1:1,u=o&&c?-1:1,d=Zn(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),c?{x:h*u,y:f*l}:{x:f*l,y:h*u}}const pA=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:i,middlewareData:a}=t,c=await hA(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:i}}}}},mA=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:c={fn:b=>{let{x,y:_}=b;return{x,y:_}}},...l}=Zn(e,t),u={x:n,y:r},d=await o.detectOverflow(t,l),f=En(Gn(s)),h=Vf(f);let p=u[h],m=u[f];if(i){const b=h==="y"?"top":"left",x=h==="y"?"bottom":"right",_=p+d[b],w=p-d[x];p=bd(_,p,w)}if(a){const b=f==="y"?"top":"left",x=f==="y"?"bottom":"right",_=m+d[b],w=m-d[x];m=bd(_,m,w)}const y=c.fn({...t,[h]:p,[f]:m});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[h]:i,[f]:a}}}}}},gA=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:l=!0}=Zn(e,t),u={x:n,y:r},d=En(s),f=Vf(d);let h=u[f],p=u[d];const m=Zn(a,t),y=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const _=f==="y"?"height":"width",w=o.reference[f]-o.floating[_]+y.mainAxis,S=o.reference[f]+o.reference[_]-y.mainAxis;h<w?h=w:h>S&&(h=S)}if(l){var b,x;const _=f==="y"?"width":"height",w=Nx.has(Gn(s)),S=o.reference[d]-o.floating[_]+(w&&((b=i.offset)==null?void 0:b[d])||0)+(w?0:y.crossAxis),C=o.reference[d]+o.reference[_]+(w?0:((x=i.offset)==null?void 0:x[d])||0)-(w?y.crossAxis:0);p<S?p=S:p>C&&(p=C)}return{[f]:h,[d]:p}}}},yA=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:i,elements:a}=t,{apply:c=()=>{},...l}=Zn(e,t),u=await i.detectOverflow(t,l),d=Gn(s),f=no(s),h=En(s)==="y",{width:p,height:m}=o.floating;let y,b;d==="top"||d==="bottom"?(y=d,b=f===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(b=d,y=f==="end"?"top":"bottom");const x=m-u.top-u.bottom,_=p-u.left-u.right,w=gr(m-u[y],x),S=gr(p-u[b],_),C=!t.middlewareData.shift;let k=w,E=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(E=_),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(k=x),C&&!f){const O=$t(u.left,0),N=$t(u.right,0),A=$t(u.top,0),j=$t(u.bottom,0);h?E=p-2*(O!==0||N!==0?O+N:$t(u.left,u.right)):k=m-2*(A!==0||j!==0?A+j:$t(u.top,u.bottom))}await c({...t,availableWidth:E,availableHeight:k});const P=await i.getDimensions(a.floating);return p!==P.width||m!==P.height?{reset:{rects:!0}}:{}}}};function tl(){return typeof window<"u"}function ro(e){return Dx(e)?(e.nodeName||"").toLowerCase():"#document"}function Ht(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function An(e){var t;return(t=(Dx(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Dx(e){return tl()?e instanceof Node||e instanceof Ht(e).Node:!1}function pn(e){return tl()?e instanceof Element||e instanceof Ht(e).Element:!1}function Tn(e){return tl()?e instanceof HTMLElement||e instanceof Ht(e).HTMLElement:!1}function Zm(e){return!tl()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ht(e).ShadowRoot}const bA=new Set(["inline","contents"]);function Ei(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=mn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!bA.has(s)}const vA=new Set(["table","td","th"]);function xA(e){return vA.has(ro(e))}const _A=[":popover-open",":modal"];function nl(e){return _A.some(t=>{try{return e.matches(t)}catch{return!1}})}const wA=["transform","translate","scale","rotate","perspective"],SA=["transform","translate","scale","rotate","perspective","filter"],EA=["paint","layout","strict","content"];function Wf(e){const t=Hf(),n=pn(e)?mn(e):e;return wA.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||SA.some(r=>(n.willChange||"").includes(r))||EA.some(r=>(n.contain||"").includes(r))}function kA(e){let t=yr(e);for(;Tn(t)&&!Gs(t);){if(Wf(t))return t;if(nl(t))return null;t=yr(t)}return null}function Hf(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const CA=new Set(["html","body","#document"]);function Gs(e){return CA.has(ro(e))}function mn(e){return Ht(e).getComputedStyle(e)}function rl(e){return pn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function yr(e){if(ro(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Zm(e)&&e.host||An(e);return Zm(t)?t.host:t}function Ix(e){const t=yr(e);return Gs(t)?e.ownerDocument?e.ownerDocument.body:e.body:Tn(t)&&Ei(t)?t:Ix(t)}function ni(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Ix(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),i=Ht(s);if(o){const a=xd(i);return t.concat(i,i.visualViewport||[],Ei(s)?s:[],a&&n?ni(a):[])}return t.concat(s,ni(s,[],n))}function xd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function jx(e){const t=mn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Tn(e),o=s?e.offsetWidth:n,i=s?e.offsetHeight:r,a=hc(n)!==o||hc(r)!==i;return a&&(n=o,r=i),{width:n,height:r,$:a}}function qf(e){return pn(e)?e:e.contextElement}function Ns(e){const t=qf(e);if(!Tn(t))return kn(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=jx(t);let i=(o?hc(n.width):n.width)/r,a=(o?hc(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const RA=kn(0);function Lx(e){const t=Ht(e);return!Hf()||!t.visualViewport?RA:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function PA(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ht(e)?!1:t}function ts(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=qf(e);let i=kn(1);t&&(r?pn(r)&&(i=Ns(r)):i=Ns(e));const a=PA(o,n,r)?Lx(o):kn(0);let c=(s.left+a.x)/i.x,l=(s.top+a.y)/i.y,u=s.width/i.x,d=s.height/i.y;if(o){const f=Ht(o),h=r&&pn(r)?Ht(r):r;let p=f,m=xd(p);for(;m&&r&&h!==p;){const y=Ns(m),b=m.getBoundingClientRect(),x=mn(m),_=b.left+(m.clientLeft+parseFloat(x.paddingLeft))*y.x,w=b.top+(m.clientTop+parseFloat(x.paddingTop))*y.y;c*=y.x,l*=y.y,u*=y.x,d*=y.y,c+=_,l+=w,p=Ht(m),m=xd(p)}}return mc({width:u,height:d,x:c,y:l})}function sl(e,t){const n=rl(e).scrollLeft;return t?t.left+n:ts(An(e)).left+n}function Fx(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-sl(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function OA(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",i=An(r),a=t?nl(t.floating):!1;if(r===i||a&&o)return n;let c={scrollLeft:0,scrollTop:0},l=kn(1);const u=kn(0),d=Tn(r);if((d||!d&&!o)&&((ro(r)!=="body"||Ei(i))&&(c=rl(r)),Tn(r))){const h=ts(r);l=Ns(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const f=i&&!d&&!o?Fx(i,c):kn(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function TA(e){return Array.from(e.getClientRects())}function MA(e){const t=An(e),n=rl(e),r=e.ownerDocument.body,s=$t(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=$t(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+sl(e);const a=-n.scrollTop;return mn(r).direction==="rtl"&&(i+=$t(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:i,y:a}}const Gm=25;function AA(e,t){const n=Ht(e),r=An(e),s=n.visualViewport;let o=r.clientWidth,i=r.clientHeight,a=0,c=0;if(s){o=s.width,i=s.height;const u=Hf();(!u||u&&t==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}const l=sl(r);if(l<=0){const u=r.ownerDocument,d=u.body,f=getComputedStyle(d),h=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-h);p<=Gm&&(o-=p)}else l<=Gm&&(o+=l);return{width:o,height:i,x:a,y:c}}const NA=new Set(["absolute","fixed"]);function DA(e,t){const n=ts(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=Tn(e)?Ns(e):kn(1),i=e.clientWidth*o.x,a=e.clientHeight*o.y,c=s*o.x,l=r*o.y;return{width:i,height:a,x:c,y:l}}function Ym(e,t,n){let r;if(t==="viewport")r=AA(e,n);else if(t==="document")r=MA(An(e));else if(pn(t))r=DA(t,n);else{const s=Lx(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return mc(r)}function zx(e,t){const n=yr(e);return n===t||!pn(n)||Gs(n)?!1:mn(n).position==="fixed"||zx(n,t)}function IA(e,t){const n=t.get(e);if(n)return n;let r=ni(e,[],!1).filter(a=>pn(a)&&ro(a)!=="body"),s=null;const o=mn(e).position==="fixed";let i=o?yr(e):e;for(;pn(i)&&!Gs(i);){const a=mn(i),c=Wf(i);!c&&a.position==="fixed"&&(s=null),(o?!c&&!s:!c&&a.position==="static"&&!!s&&NA.has(s.position)||Ei(i)&&!c&&zx(e,i))?r=r.filter(u=>u!==i):s=a,i=yr(i)}return t.set(e,r),r}function jA(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?nl(t)?[]:IA(t,this._c):[].concat(n),r],a=i[0],c=i.reduce((l,u)=>{const d=Ym(t,u,s);return l.top=$t(d.top,l.top),l.right=gr(d.right,l.right),l.bottom=gr(d.bottom,l.bottom),l.left=$t(d.left,l.left),l},Ym(t,a,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function LA(e){const{width:t,height:n}=jx(e);return{width:t,height:n}}function FA(e,t,n){const r=Tn(t),s=An(t),o=n==="fixed",i=ts(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=kn(0);function l(){c.x=sl(s)}if(r||!r&&!o)if((ro(t)!=="body"||Ei(s))&&(a=rl(t)),r){const h=ts(t,!0,o,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else s&&l();o&&!r&&s&&l();const u=s&&!r&&!o?Fx(s,a):kn(0),d=i.left+a.scrollLeft-c.x-u.x,f=i.top+a.scrollTop-c.y-u.y;return{x:d,y:f,width:i.width,height:i.height}}function fu(e){return mn(e).position==="static"}function Xm(e,t){if(!Tn(e)||mn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return An(e)===n&&(n=n.ownerDocument.body),n}function $x(e,t){const n=Ht(e);if(nl(e))return n;if(!Tn(e)){let s=yr(e);for(;s&&!Gs(s);){if(pn(s)&&!fu(s))return s;s=yr(s)}return n}let r=Xm(e,t);for(;r&&xA(r)&&fu(r);)r=Xm(r,t);return r&&Gs(r)&&fu(r)&&!Wf(r)?n:r||kA(e)||n}const zA=async function(e){const t=this.getOffsetParent||$x,n=this.getDimensions,r=await n(e.floating);return{reference:FA(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $A(e){return mn(e).direction==="rtl"}const VA={convertOffsetParentRelativeRectToViewportRelativeRect:OA,getDocumentElement:An,getClippingRect:jA,getOffsetParent:$x,getElementRects:zA,getClientRects:TA,getDimensions:LA,getScale:Ns,isElement:pn,isRTL:$A};function Vx(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function BA(e,t){let n=null,r;const s=An(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();const l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:h}=l;if(a||t(),!f||!h)return;const p=Ji(d),m=Ji(s.clientWidth-(u+f)),y=Ji(s.clientHeight-(d+h)),b=Ji(u),_={rootMargin:-p+"px "+-m+"px "+-y+"px "+-b+"px",threshold:$t(0,gr(1,c))||1};let w=!0;function S(C){const k=C[0].intersectionRatio;if(k!==c){if(!w)return i();k?i(!1,k):r=setTimeout(()=>{i(!1,1e-7)},1e3)}k===1&&!Vx(l,e.getBoundingClientRect())&&i(),w=!1}try{n=new IntersectionObserver(S,{..._,root:s.ownerDocument})}catch{n=new IntersectionObserver(S,_)}n.observe(e)}return i(!0),o}function UA(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,l=qf(e),u=s||o?[...l?ni(l):[],...ni(t)]:[];u.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),o&&b.addEventListener("resize",n)});const d=l&&a?BA(l,n):null;let f=-1,h=null;i&&(h=new ResizeObserver(b=>{let[x]=b;x&&x.target===l&&h&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var _;(_=h)==null||_.observe(t)})),n()}),l&&!c&&h.observe(l),h.observe(t));let p,m=c?ts(e):null;c&&y();function y(){const b=ts(e);m&&!Vx(m,b)&&n(),m=b,p=requestAnimationFrame(y)}return n(),()=>{var b;u.forEach(x=>{s&&x.removeEventListener("scroll",n),o&&x.removeEventListener("resize",n)}),d?.(),(b=h)==null||b.disconnect(),h=null,c&&cancelAnimationFrame(p)}}const WA=pA,HA=mA,qA=dA,KA=yA,ZA=fA,Jm=uA,GA=gA,YA=(e,t,n)=>{const r=new Map,s={platform:VA,...n},o={...s.platform,_c:r};return lA(e,t,{...s,platform:o})};var XA=typeof document<"u",JA=function(){},Da=XA?T.useLayoutEffect:JA;function gc(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!gc(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!gc(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Bx(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Qm(e,t){const n=Bx(e);return Math.round(t*n)/n}function hu(e){const t=v.useRef(e);return Da(()=>{t.current=e}),t}function QA(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:i}={},transform:a=!0,whileElementsMounted:c,open:l}=e,[u,d]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=v.useState(r);gc(f,r)||h(r);const[p,m]=v.useState(null),[y,b]=v.useState(null),x=v.useCallback(F=>{F!==C.current&&(C.current=F,m(F))},[]),_=v.useCallback(F=>{F!==k.current&&(k.current=F,b(F))},[]),w=o||p,S=i||y,C=v.useRef(null),k=v.useRef(null),E=v.useRef(u),P=c!=null,O=hu(c),N=hu(s),A=hu(l),j=v.useCallback(()=>{if(!C.current||!k.current)return;const F={placement:t,strategy:n,middleware:f};N.current&&(F.platform=N.current),YA(C.current,k.current,F).then(W=>{const se={...W,isPositioned:A.current!==!1};$.current&&!gc(E.current,se)&&(E.current=se,Ic.flushSync(()=>{d(se)}))})},[f,t,n,N,A]);Da(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(F=>({...F,isPositioned:!1})))},[l]);const $=v.useRef(!1);Da(()=>($.current=!0,()=>{$.current=!1}),[]),Da(()=>{if(w&&(C.current=w),S&&(k.current=S),w&&S){if(O.current)return O.current(w,S,j);j()}},[w,S,j,O,P]);const q=v.useMemo(()=>({reference:C,floating:k,setReference:x,setFloating:_}),[x,_]),D=v.useMemo(()=>({reference:w,floating:S}),[w,S]),H=v.useMemo(()=>{const F={position:n,left:0,top:0};if(!D.floating)return F;const W=Qm(D.floating,u.x),se=Qm(D.floating,u.y);return a?{...F,transform:"translate("+W+"px, "+se+"px)",...Bx(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:se}},[n,a,D.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:j,refs:q,elements:D,floatingStyles:H}),[u,j,q,D,H])}const eN=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Jm({element:r.current,padding:s}).fn(n):{}:r?Jm({element:r,padding:s}).fn(n):{}}}},tN=(e,t)=>({...WA(e),options:[e,t]}),nN=(e,t)=>({...HA(e),options:[e,t]}),rN=(e,t)=>({...GA(e),options:[e,t]}),sN=(e,t)=>({...qA(e),options:[e,t]}),oN=(e,t)=>({...KA(e),options:[e,t]}),iN=(e,t)=>({...ZA(e),options:[e,t]}),aN=(e,t)=>({...eN(e),options:[e,t]});var cN="Arrow",Ux=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...o}=e;return g.jsx(be.svg,{...o,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ux.displayName=cN;var lN=Ux;function Wx(e){const[t,n]=v.useState(void 0);return vt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let i,a;if("borderBoxSize"in o){const c=o.borderBoxSize,l=Array.isArray(c)?c[0]:c;i=l.inlineSize,a=l.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Kf="Popper",[Hx,ol]=wr(Kf),[uN,qx]=Hx(Kf),Kx=e=>{const{__scopePopper:t,children:n}=e,[r,s]=v.useState(null);return g.jsx(uN,{scope:t,anchor:r,onAnchorChange:s,children:n})};Kx.displayName=Kf;var Zx="PopperAnchor",Gx=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=qx(Zx,n),i=v.useRef(null),a=Pe(t,i),c=v.useRef(null);return v.useEffect(()=>{const l=c.current;c.current=r?.current||i.current,l!==c.current&&o.onAnchorChange(c.current)}),r?null:g.jsx(be.div,{...s,ref:a})});Gx.displayName=Zx;var Zf="PopperContent",[dN,fN]=Hx(Zf),Yx=v.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:h="optimized",onPlaced:p,...m}=e,y=qx(Zf,n),[b,x]=v.useState(null),_=Pe(t,V=>x(V)),[w,S]=v.useState(null),C=Wx(w),k=C?.width??0,E=C?.height??0,P=r+(o!=="center"?"-"+o:""),O=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},N=Array.isArray(l)?l:[l],A=N.length>0,j={padding:O,boundary:N.filter(pN),altBoundary:A},{refs:$,floatingStyles:q,placement:D,isPositioned:H,middlewareData:F}=QA({strategy:"fixed",placement:P,whileElementsMounted:(...V)=>UA(...V,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[tN({mainAxis:s+E,alignmentAxis:i}),c&&nN({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?rN():void 0,...j}),c&&sN({...j}),oN({...j,apply:({elements:V,rects:ee,availableWidth:me,availableHeight:le})=>{const{width:fe,height:ge}=ee.reference,Ze=V.floating.style;Ze.setProperty("--radix-popper-available-width",`${me}px`),Ze.setProperty("--radix-popper-available-height",`${le}px`),Ze.setProperty("--radix-popper-anchor-width",`${fe}px`),Ze.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),w&&aN({element:w,padding:a}),mN({arrowWidth:k,arrowHeight:E}),f&&iN({strategy:"referenceHidden",...j})]}),[W,se]=Qx(D),I=On(p);vt(()=>{H&&I?.()},[H,I]);const Y=F.arrow?.x,K=F.arrow?.y,Z=F.arrow?.centerOffset!==0,[oe,ce]=v.useState();return vt(()=>{b&&ce(window.getComputedStyle(b).zIndex)},[b]),g.jsx("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:H?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(" "),...F.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:g.jsx(dN,{scope:n,placedSide:W,onArrowChange:S,arrowX:Y,arrowY:K,shouldHideArrow:Z,children:g.jsx(be.div,{"data-side":W,"data-align":se,...m,ref:_,style:{...m.style,animation:H?void 0:"none"}})})})});Yx.displayName=Zf;var Xx="PopperArrow",hN={top:"bottom",right:"left",bottom:"top",left:"right"},Jx=v.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=fN(Xx,r),i=hN[o.placedSide];return g.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:g.jsx(lN,{...s,ref:n,style:{...s.style,display:"block"}})})});Jx.displayName=Xx;function pN(e){return e!==null}var mN=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:s}=t,i=s.arrow?.centerOffset!==0,a=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[l,u]=Qx(n),d={start:"0%",center:"50%",end:"100%"}[u],f=(s.arrow?.x??0)+a/2,h=(s.arrow?.y??0)+c/2;let p="",m="";return l==="bottom"?(p=i?d:`${f}px`,m=`${-c}px`):l==="top"?(p=i?d:`${f}px`,m=`${r.floating.height+c}px`):l==="right"?(p=`${-c}px`,m=i?d:`${h}px`):l==="left"&&(p=`${r.floating.width+c}px`,m=i?d:`${h}px`),{data:{x:p,y:m}}}});function Qx(e){const[t,n="center"]=e.split("-");return[t,n]}var e_=Kx,t_=Gx,n_=Yx,r_=Jx,gN="Portal",il=v.forwardRef((e,t)=>{const{container:n,...r}=e,[s,o]=v.useState(!1);vt(()=>o(!0),[]);const i=n||s&&globalThis?.document?.body;return i?Dc.createPortal(g.jsx(be.div,{...r,ref:t}),i):null});il.displayName=gN;function yN(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var Xn=e=>{const{present:t,children:n}=e,r=bN(t),s=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),o=Pe(r.ref,vN(s));return typeof n=="function"||r.isPresent?v.cloneElement(s,{ref:o}):null};Xn.displayName="Presence";function bN(e){const[t,n]=v.useState(),r=v.useRef(null),s=v.useRef(e),o=v.useRef("none"),i=e?"mounted":"unmounted",[a,c]=yN(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const l=Qi(r.current);o.current=a==="mounted"?l:"none"},[a]),vt(()=>{const l=r.current,u=s.current;if(u!==e){const f=o.current,h=Qi(l);e?c("MOUNT"):h==="none"||l?.display==="none"?c("UNMOUNT"):c(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),vt(()=>{if(t){let l;const u=t.ownerDocument.defaultView??window,d=h=>{const m=Qi(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&m&&(c("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",l=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},f=h=>{h.target===t&&(o.current=Qi(r.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(l),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:v.useCallback(l=>{r.current=l?getComputedStyle(l):null,n(l)},[])}}function Qi(e){return e?.animationName||"none"}function vN(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var pu="rovingFocusGroup.onEntryFocus",xN={bubbles:!1,cancelable:!0},ki="RovingFocusGroup",[_d,s_,_N]=Ff(ki),[wN,o_]=wr(ki,[_N]),[SN,EN]=wN(ki),i_=v.forwardRef((e,t)=>g.jsx(_d.Provider,{scope:e.__scopeRovingFocusGroup,children:g.jsx(_d.Slot,{scope:e.__scopeRovingFocusGroup,children:g.jsx(kN,{...e,ref:t})})}));i_.displayName=ki;var kN=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=v.useRef(null),h=Pe(t,f),p=zf(o),[m,y]=Zs({prop:i,defaultProp:a??null,onChange:c,caller:ki}),[b,x]=v.useState(!1),_=On(l),w=s_(n),S=v.useRef(!1),[C,k]=v.useState(0);return v.useEffect(()=>{const E=f.current;if(E)return E.addEventListener(pu,_),()=>E.removeEventListener(pu,_)},[_]),g.jsx(SN,{scope:n,orientation:r,dir:p,loop:s,currentTabStopId:m,onItemFocus:v.useCallback(E=>y(E),[y]),onItemShiftTab:v.useCallback(()=>x(!0),[]),onFocusableItemAdd:v.useCallback(()=>k(E=>E+1),[]),onFocusableItemRemove:v.useCallback(()=>k(E=>E-1),[]),children:g.jsx(be.div,{tabIndex:b||C===0?-1:0,"data-orientation":r,...d,ref:h,style:{outline:"none",...e.style},onMouseDown:re(e.onMouseDown,()=>{S.current=!0}),onFocus:re(e.onFocus,E=>{const P=!S.current;if(E.target===E.currentTarget&&P&&!b){const O=new CustomEvent(pu,xN);if(E.currentTarget.dispatchEvent(O),!O.defaultPrevented){const N=w().filter(D=>D.focusable),A=N.find(D=>D.active),j=N.find(D=>D.id===m),q=[A,j,...N].filter(Boolean).map(D=>D.ref.current);l_(q,u)}}S.current=!1}),onBlur:re(e.onBlur,()=>x(!1))})})}),a_="RovingFocusGroupItem",c_=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:o,children:i,...a}=e,c=Hn(),l=o||c,u=EN(a_,n),d=u.currentTabStopId===l,f=s_(n),{onFocusableItemAdd:h,onFocusableItemRemove:p,currentTabStopId:m}=u;return v.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),g.jsx(_d.ItemSlot,{scope:n,id:l,focusable:r,active:s,children:g.jsx(be.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:re(e.onMouseDown,y=>{r?u.onItemFocus(l):y.preventDefault()}),onFocus:re(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:re(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const b=PN(y,u.orientation,u.dir);if(b!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let _=f().filter(w=>w.focusable).map(w=>w.ref.current);if(b==="last")_.reverse();else if(b==="prev"||b==="next"){b==="prev"&&_.reverse();const w=_.indexOf(y.currentTarget);_=u.loop?ON(_,w+1):_.slice(w+1)}setTimeout(()=>l_(_))}}),children:typeof i=="function"?i({isCurrentTabStop:d,hasTabStop:m!=null}):i})})});c_.displayName=a_;var CN={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function RN(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function PN(e,t,n){const r=RN(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return CN[r]}function l_(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function ON(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var TN=i_,MN=c_;function AN(e){const t=NN(e),n=v.forwardRef((r,s)=>{const{children:o,...i}=r,a=v.Children.toArray(o),c=a.find(IN);if(c){const l=c.props.children,u=a.map(d=>d===c?v.Children.count(l)>1?v.Children.only(null):v.isValidElement(l)?l.props.children:null:d);return g.jsx(t,{...i,ref:s,children:v.isValidElement(l)?v.cloneElement(l,void 0,u):null})}return g.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function NN(e){const t=v.forwardRef((n,r)=>{const{children:s,...o}=n;if(v.isValidElement(s)){const i=LN(s),a=jN(o,s.props);return s.type!==v.Fragment&&(a.ref=r?Yn(r,i):i),v.cloneElement(s,a)}return v.Children.count(s)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var DN=Symbol("radix.slottable");function IN(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===DN}function jN(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...a)=>{const c=o(...a);return s(...a),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function LN(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var FN=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},bs=new WeakMap,ea=new WeakMap,ta={},mu=0,u_=function(e){return e&&(e.host||u_(e.parentNode))},zN=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=u_(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},$N=function(e,t,n,r){var s=zN(t,Array.isArray(e)?e:[e]);ta[n]||(ta[n]=new WeakMap);var o=ta[n],i=[],a=new Set,c=new Set(s),l=function(d){!d||a.has(d)||(a.add(d),l(d.parentNode))};s.forEach(l);var u=function(d){!d||c.has(d)||Array.prototype.forEach.call(d.children,function(f){if(a.has(f))u(f);else try{var h=f.getAttribute(r),p=h!==null&&h!=="false",m=(bs.get(f)||0)+1,y=(o.get(f)||0)+1;bs.set(f,m),o.set(f,y),i.push(f),m===1&&p&&ea.set(f,!0),y===1&&f.setAttribute(n,"true"),p||f.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",f,b)}})};return u(t),a.clear(),mu++,function(){i.forEach(function(d){var f=bs.get(d)-1,h=o.get(d)-1;bs.set(d,f),o.set(d,h),f||(ea.has(d)||d.removeAttribute(r),ea.delete(d)),h||d.removeAttribute(n)}),mu--,mu||(bs=new WeakMap,bs=new WeakMap,ea=new WeakMap,ta={})}},Gf=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=FN(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),$N(r,s,n,"aria-hidden")):function(){return null}},Sn=function(){return Sn=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Sn.apply(this,arguments)};function d_(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function VN(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var Ia="right-scroll-bar-position",ja="width-before-scroll-bar",BN="with-scroll-bars-hidden",UN="--removed-body-scroll-bar-size";function gu(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function WN(e,t){var n=T.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var HN=typeof window<"u"?v.useLayoutEffect:v.useEffect,eg=new WeakMap;function qN(e,t){var n=WN(null,function(r){return e.forEach(function(s){return gu(s,r)})});return HN(function(){var r=eg.get(n);if(r){var s=new Set(r),o=new Set(e),i=n.current;s.forEach(function(a){o.has(a)||gu(a,null)}),o.forEach(function(a){s.has(a)||gu(a,i)})}eg.set(n,e)},[e]),n}function KN(e){return e}function ZN(e,t){t===void 0&&(t=KN);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var i=t(o,r);return n.push(i),function(){n=n.filter(function(a){return a!==i})}},assignSyncMedium:function(o){for(r=!0;n.length;){var i=n;n=[],i.forEach(o)}n={push:function(a){return o(a)},filter:function(){return n}}},assignMedium:function(o){r=!0;var i=[];if(n.length){var a=n;n=[],a.forEach(o),i=n}var c=function(){var u=i;i=[],u.forEach(o)},l=function(){return Promise.resolve().then(c)};l(),n={push:function(u){i.push(u),l()},filter:function(u){return i=i.filter(u),n}}}};return s}function GN(e){e===void 0&&(e={});var t=ZN(null);return t.options=Sn({async:!0,ssr:!1},e),t}var f_=function(e){var t=e.sideCar,n=d_(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return v.createElement(r,Sn({},n))};f_.isSideCarExport=!0;function YN(e,t){return e.useMedium(t),f_}var h_=GN(),yu=function(){},al=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:yu,onWheelCapture:yu,onTouchMoveCapture:yu}),s=r[0],o=r[1],i=e.forwardProps,a=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,h=e.noRelative,p=e.noIsolation,m=e.inert,y=e.allowPinchZoom,b=e.as,x=b===void 0?"div":b,_=e.gapMode,w=d_(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,C=qN([n,t]),k=Sn(Sn({},w),s);return v.createElement(v.Fragment,null,u&&v.createElement(S,{sideCar:h_,removeScrollBar:l,shards:d,noRelative:h,noIsolation:p,inert:m,setCallbacks:o,allowPinchZoom:!!y,lockRef:n,gapMode:_}),i?v.cloneElement(v.Children.only(a),Sn(Sn({},k),{ref:C})):v.createElement(x,Sn({},k,{className:c,ref:C}),a))});al.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};al.classNames={fullWidth:ja,zeroRight:Ia};var XN=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function JN(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=XN();return t&&e.setAttribute("nonce",t),e}function QN(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function eD(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var tD=function(){var e=0,t=null;return{add:function(n){e==0&&(t=JN())&&(QN(t,n),eD(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},nD=function(){var e=tD();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},p_=function(){var e=nD(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},rD={left:0,top:0,right:0,gap:0},bu=function(e){return parseInt(e||"",10)||0},sD=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[bu(n),bu(r),bu(s)]},oD=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return rD;var t=sD(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},iD=p_(),Ds="data-scroll-locked",aD=function(e,t,n,r){var s=e.left,o=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
22
+ .`.concat(BN,` {
23
+ overflow: hidden `).concat(r,`;
24
+ padding-right: `).concat(a,"px ").concat(r,`;
25
+ }
26
+ body[`).concat(Ds,`] {
27
+ overflow: hidden `).concat(r,`;
28
+ overscroll-behavior: contain;
29
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
30
+ padding-left: `.concat(s,`px;
31
+ padding-top: `).concat(o,`px;
32
+ padding-right: `).concat(i,`px;
33
+ margin-left:0;
34
+ margin-top:0;
35
+ margin-right: `).concat(a,"px ").concat(r,`;
36
+ `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
37
+ }
38
+
39
+ .`).concat(Ia,` {
40
+ right: `).concat(a,"px ").concat(r,`;
41
+ }
42
+
43
+ .`).concat(ja,` {
44
+ margin-right: `).concat(a,"px ").concat(r,`;
45
+ }
46
+
47
+ .`).concat(Ia," .").concat(Ia,` {
48
+ right: 0 `).concat(r,`;
49
+ }
50
+
51
+ .`).concat(ja," .").concat(ja,` {
52
+ margin-right: 0 `).concat(r,`;
53
+ }
54
+
55
+ body[`).concat(Ds,`] {
56
+ `).concat(UN,": ").concat(a,`px;
57
+ }
58
+ `)},tg=function(){var e=parseInt(document.body.getAttribute(Ds)||"0",10);return isFinite(e)?e:0},cD=function(){v.useEffect(function(){return document.body.setAttribute(Ds,(tg()+1).toString()),function(){var e=tg()-1;e<=0?document.body.removeAttribute(Ds):document.body.setAttribute(Ds,e.toString())}},[])},lD=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;cD();var o=v.useMemo(function(){return oD(s)},[s]);return v.createElement(iD,{styles:aD(o,!t,s,n?"":"!important")})},wd=!1;if(typeof window<"u")try{var na=Object.defineProperty({},"passive",{get:function(){return wd=!0,!0}});window.addEventListener("test",na,na),window.removeEventListener("test",na,na)}catch{wd=!1}var vs=wd?{passive:!1}:!1,uD=function(e){return e.tagName==="TEXTAREA"},m_=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!uD(e)&&n[t]==="visible")},dD=function(e){return m_(e,"overflowY")},fD=function(e){return m_(e,"overflowX")},ng=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=g_(e,r);if(s){var o=y_(e,r),i=o[1],a=o[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},hD=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},pD=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},g_=function(e,t){return e==="v"?dD(t):fD(t)},y_=function(e,t){return e==="v"?hD(t):pD(t)},mD=function(e,t){return e==="h"&&t==="rtl"?-1:1},gD=function(e,t,n,r,s){var o=mD(e,window.getComputedStyle(t).direction),i=o*r,a=n.target,c=t.contains(a),l=!1,u=i>0,d=0,f=0;do{if(!a)break;var h=y_(e,a),p=h[0],m=h[1],y=h[2],b=m-y-o*p;(p||b)&&g_(e,a)&&(d+=b,f+=p);var x=a.parentNode;a=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(u&&Math.abs(d)<1||!u&&Math.abs(f)<1)&&(l=!0),l},ra=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},rg=function(e){return[e.deltaX,e.deltaY]},sg=function(e){return e&&"current"in e?e.current:e},yD=function(e,t){return e[0]===t[0]&&e[1]===t[1]},bD=function(e){return`
59
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
60
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
61
+ `)},vD=0,xs=[];function xD(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),s=v.useState(vD++)[0],o=v.useState(p_)[0],i=v.useRef(e);v.useEffect(function(){i.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var m=VN([e.lockRef.current],(e.shards||[]).map(sg),!0).filter(Boolean);return m.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),m.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=v.useCallback(function(m,y){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var b=ra(m),x=n.current,_="deltaX"in m?m.deltaX:x[0]-b[0],w="deltaY"in m?m.deltaY:x[1]-b[1],S,C=m.target,k=Math.abs(_)>Math.abs(w)?"h":"v";if("touches"in m&&k==="h"&&C.type==="range")return!1;var E=window.getSelection(),P=E&&E.anchorNode,O=P?P===C||P.contains(C):!1;if(O)return!1;var N=ng(k,C);if(!N)return!0;if(N?S=k:(S=k==="v"?"h":"v",N=ng(k,C)),!N)return!1;if(!r.current&&"changedTouches"in m&&(_||w)&&(r.current=S),!S)return!0;var A=r.current||S;return gD(A,y,m,A==="h"?_:w)},[]),c=v.useCallback(function(m){var y=m;if(!(!xs.length||xs[xs.length-1]!==o)){var b="deltaY"in y?rg(y):ra(y),x=t.current.filter(function(S){return S.name===y.type&&(S.target===y.target||y.target===S.shadowParent)&&yD(S.delta,b)})[0];if(x&&x.should){y.cancelable&&y.preventDefault();return}if(!x){var _=(i.current.shards||[]).map(sg).filter(Boolean).filter(function(S){return S.contains(y.target)}),w=_.length>0?a(y,_[0]):!i.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),l=v.useCallback(function(m,y,b,x){var _={name:m,delta:y,target:b,should:x,shadowParent:_D(b)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(w){return w!==_})},1)},[]),u=v.useCallback(function(m){n.current=ra(m),r.current=void 0},[]),d=v.useCallback(function(m){l(m.type,rg(m),m.target,a(m,e.lockRef.current))},[]),f=v.useCallback(function(m){l(m.type,ra(m),m.target,a(m,e.lockRef.current))},[]);v.useEffect(function(){return xs.push(o),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",c,vs),document.addEventListener("touchmove",c,vs),document.addEventListener("touchstart",u,vs),function(){xs=xs.filter(function(m){return m!==o}),document.removeEventListener("wheel",c,vs),document.removeEventListener("touchmove",c,vs),document.removeEventListener("touchstart",u,vs)}},[]);var h=e.removeScrollBar,p=e.inert;return v.createElement(v.Fragment,null,p?v.createElement(o,{styles:bD(s)}):null,h?v.createElement(lD,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function _D(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const wD=YN(h_,xD);var cl=v.forwardRef(function(e,t){return v.createElement(al,Sn({},e,{ref:t,sideCar:wD}))});cl.classNames=al.classNames;var Sd=["Enter"," "],SD=["ArrowDown","PageUp","Home"],b_=["ArrowUp","PageDown","End"],ED=[...SD,...b_],kD={ltr:[...Sd,"ArrowRight"],rtl:[...Sd,"ArrowLeft"]},CD={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ci="Menu",[ri,RD,PD]=Ff(Ci),[us,v_]=wr(Ci,[PD,ol,o_]),ll=ol(),x_=o_(),[OD,ds]=us(Ci),[TD,Ri]=us(Ci),__=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:o,modal:i=!0}=e,a=ll(t),[c,l]=v.useState(null),u=v.useRef(!1),d=On(o),f=zf(s);return v.useEffect(()=>{const h=()=>{u.current=!0,document.addEventListener("pointerdown",p,{capture:!0,once:!0}),document.addEventListener("pointermove",p,{capture:!0,once:!0})},p=()=>u.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",p,{capture:!0}),document.removeEventListener("pointermove",p,{capture:!0})}},[]),g.jsx(e_,{...a,children:g.jsx(OD,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:g.jsx(TD,{scope:t,onClose:v.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:i,children:r})})})};__.displayName=Ci;var MD="MenuAnchor",Yf=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=ll(n);return g.jsx(t_,{...s,...r,ref:t})});Yf.displayName=MD;var Xf="MenuPortal",[AD,w_]=us(Xf,{forceMount:void 0}),S_=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,o=ds(Xf,t);return g.jsx(AD,{scope:t,forceMount:n,children:g.jsx(Xn,{present:n||o.open,children:g.jsx(il,{asChild:!0,container:s,children:r})})})};S_.displayName=Xf;var en="MenuContent",[ND,Jf]=us(en),E_=v.forwardRef((e,t)=>{const n=w_(en,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=ds(en,e.__scopeMenu),i=Ri(en,e.__scopeMenu);return g.jsx(ri.Provider,{scope:e.__scopeMenu,children:g.jsx(Xn,{present:r||o.open,children:g.jsx(ri.Slot,{scope:e.__scopeMenu,children:i.modal?g.jsx(DD,{...s,ref:t}):g.jsx(ID,{...s,ref:t})})})})}),DD=v.forwardRef((e,t)=>{const n=ds(en,e.__scopeMenu),r=v.useRef(null),s=Pe(t,r);return v.useEffect(()=>{const o=r.current;if(o)return Gf(o)},[]),g.jsx(Qf,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:re(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),ID=v.forwardRef((e,t)=>{const n=ds(en,e.__scopeMenu);return g.jsx(Qf,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),jD=AN("MenuContent.ScrollLock"),Qf=v.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,disableOutsideScroll:p,...m}=e,y=ds(en,n),b=Ri(en,n),x=ll(n),_=x_(n),w=RD(n),[S,C]=v.useState(null),k=v.useRef(null),E=Pe(t,k,y.onContentChange),P=v.useRef(0),O=v.useRef(""),N=v.useRef(0),A=v.useRef(null),j=v.useRef("right"),$=v.useRef(0),q=p?cl:v.Fragment,D=p?{as:jD,allowPinchZoom:!0}:void 0,H=W=>{const se=O.current+W,I=w().filter(V=>!V.disabled),Y=document.activeElement,K=I.find(V=>V.ref.current===Y)?.textValue,Z=I.map(V=>V.textValue),oe=ZD(Z,se,K),ce=I.find(V=>V.textValue===oe)?.ref.current;(function V(ee){O.current=ee,window.clearTimeout(P.current),ee!==""&&(P.current=window.setTimeout(()=>V(""),1e3))})(se),ce&&setTimeout(()=>ce.focus())};v.useEffect(()=>()=>window.clearTimeout(P.current),[]),$f();const F=v.useCallback(W=>j.current===A.current?.side&&YD(W,A.current?.area),[]);return g.jsx(ND,{scope:n,searchRef:O,onItemEnter:v.useCallback(W=>{F(W)&&W.preventDefault()},[F]),onItemLeave:v.useCallback(W=>{F(W)||(k.current?.focus(),C(null))},[F]),onTriggerLeave:v.useCallback(W=>{F(W)&&W.preventDefault()},[F]),pointerGraceTimerRef:N,onPointerGraceIntentChange:v.useCallback(W=>{A.current=W},[]),children:g.jsx(q,{...D,children:g.jsx(el,{asChild:!0,trapped:s,onMountAutoFocus:re(o,W=>{W.preventDefault(),k.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:g.jsx(Qc,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,children:g.jsx(TN,{asChild:!0,..._,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:re(c,W=>{b.isUsingKeyboardRef.current||W.preventDefault()}),preventScrollOnEntryFocus:!0,children:g.jsx(n_,{role:"menu","aria-orientation":"vertical","data-state":$_(y.open),"data-radix-menu-content":"",dir:b.dir,...x,...m,ref:E,style:{outline:"none",...m.style},onKeyDown:re(m.onKeyDown,W=>{const I=W.target.closest("[data-radix-menu-content]")===W.currentTarget,Y=W.ctrlKey||W.altKey||W.metaKey,K=W.key.length===1;I&&(W.key==="Tab"&&W.preventDefault(),!Y&&K&&H(W.key));const Z=k.current;if(W.target!==Z||!ED.includes(W.key))return;W.preventDefault();const ce=w().filter(V=>!V.disabled).map(V=>V.ref.current);b_.includes(W.key)&&ce.reverse(),qD(ce)}),onBlur:re(e.onBlur,W=>{W.currentTarget.contains(W.target)||(window.clearTimeout(P.current),O.current="")}),onPointerMove:re(e.onPointerMove,si(W=>{const se=W.target,I=$.current!==W.clientX;if(W.currentTarget.contains(se)&&I){const Y=W.clientX>$.current?"right":"left";j.current=Y,$.current=W.clientX}}))})})})})})})});E_.displayName=en;var LD="MenuGroup",eh=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return g.jsx(be.div,{role:"group",...r,ref:t})});eh.displayName=LD;var FD="MenuLabel",k_=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return g.jsx(be.div,{...r,ref:t})});k_.displayName=FD;var yc="MenuItem",og="menu.itemSelect",ul=v.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,o=v.useRef(null),i=Ri(yc,e.__scopeMenu),a=Jf(yc,e.__scopeMenu),c=Pe(t,o),l=v.useRef(!1),u=()=>{const d=o.current;if(!n&&d){const f=new CustomEvent(og,{bubbles:!0,cancelable:!0});d.addEventListener(og,h=>r?.(h),{once:!0}),Px(d,f),f.defaultPrevented?l.current=!1:i.onClose()}};return g.jsx(C_,{...s,ref:c,disabled:n,onClick:re(e.onClick,u),onPointerDown:d=>{e.onPointerDown?.(d),l.current=!0},onPointerUp:re(e.onPointerUp,d=>{l.current||d.currentTarget?.click()}),onKeyDown:re(e.onKeyDown,d=>{const f=a.searchRef.current!=="";n||f&&d.key===" "||Sd.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});ul.displayName=yc;var C_=v.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...o}=e,i=Jf(yc,n),a=x_(n),c=v.useRef(null),l=Pe(t,c),[u,d]=v.useState(!1),[f,h]=v.useState("");return v.useEffect(()=>{const p=c.current;p&&h((p.textContent??"").trim())},[o.children]),g.jsx(ri.ItemSlot,{scope:n,disabled:r,textValue:s??f,children:g.jsx(MN,{asChild:!0,...a,focusable:!r,children:g.jsx(be.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:l,onPointerMove:re(e.onPointerMove,si(p=>{r?i.onItemLeave(p):(i.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:re(e.onPointerLeave,si(p=>i.onItemLeave(p))),onFocus:re(e.onFocus,()=>d(!0)),onBlur:re(e.onBlur,()=>d(!1))})})})}),zD="MenuCheckboxItem",R_=v.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return g.jsx(A_,{scope:e.__scopeMenu,checked:n,children:g.jsx(ul,{role:"menuitemcheckbox","aria-checked":bc(n)?"mixed":n,...s,ref:t,"data-state":nh(n),onSelect:re(s.onSelect,()=>r?.(bc(n)?!0:!n),{checkForDefaultPrevented:!1})})})});R_.displayName=zD;var P_="MenuRadioGroup",[$D,VD]=us(P_,{value:void 0,onValueChange:()=>{}}),O_=v.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,o=On(r);return g.jsx($D,{scope:e.__scopeMenu,value:n,onValueChange:o,children:g.jsx(eh,{...s,ref:t})})});O_.displayName=P_;var T_="MenuRadioItem",M_=v.forwardRef((e,t)=>{const{value:n,...r}=e,s=VD(T_,e.__scopeMenu),o=n===s.value;return g.jsx(A_,{scope:e.__scopeMenu,checked:o,children:g.jsx(ul,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":nh(o),onSelect:re(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});M_.displayName=T_;var th="MenuItemIndicator",[A_,BD]=us(th,{checked:!1}),N_=v.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,o=BD(th,n);return g.jsx(Xn,{present:r||bc(o.checked)||o.checked===!0,children:g.jsx(be.span,{...s,ref:t,"data-state":nh(o.checked)})})});N_.displayName=th;var UD="MenuSeparator",D_=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return g.jsx(be.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});D_.displayName=UD;var WD="MenuArrow",I_=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=ll(n);return g.jsx(r_,{...s,...r,ref:t})});I_.displayName=WD;var HD="MenuSub",[ZH,j_]=us(HD),Po="MenuSubTrigger",L_=v.forwardRef((e,t)=>{const n=ds(Po,e.__scopeMenu),r=Ri(Po,e.__scopeMenu),s=j_(Po,e.__scopeMenu),o=Jf(Po,e.__scopeMenu),i=v.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=o,l={__scopeMenu:e.__scopeMenu},u=v.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return v.useEffect(()=>u,[u]),v.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),c(null)}},[a,c]),g.jsx(Yf,{asChild:!0,...l,children:g.jsx(C_,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":$_(n.open),...e,ref:Yn(t,s.onTriggerChange),onClick:d=>{e.onClick?.(d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:re(e.onPointerMove,si(d=>{o.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:re(e.onPointerLeave,si(d=>{u();const f=n.content?.getBoundingClientRect();if(f){const h=n.content?.dataset.side,p=h==="right",m=p?-5:5,y=f[p?"left":"right"],b=f[p?"right":"left"];o.onPointerGraceIntentChange({area:[{x:d.clientX+m,y:d.clientY},{x:y,y:f.top},{x:b,y:f.top},{x:b,y:f.bottom},{x:y,y:f.bottom}],side:h}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(d),d.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:re(e.onKeyDown,d=>{const f=o.searchRef.current!=="";e.disabled||f&&d.key===" "||kD[r.dir].includes(d.key)&&(n.onOpenChange(!0),n.content?.focus(),d.preventDefault())})})})});L_.displayName=Po;var F_="MenuSubContent",z_=v.forwardRef((e,t)=>{const n=w_(en,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=ds(en,e.__scopeMenu),i=Ri(en,e.__scopeMenu),a=j_(F_,e.__scopeMenu),c=v.useRef(null),l=Pe(t,c);return g.jsx(ri.Provider,{scope:e.__scopeMenu,children:g.jsx(Xn,{present:r||o.open,children:g.jsx(ri.Slot,{scope:e.__scopeMenu,children:g.jsx(Qf,{id:a.contentId,"aria-labelledby":a.triggerId,...s,ref:l,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{i.isUsingKeyboardRef.current&&c.current?.focus(),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:re(e.onFocusOutside,u=>{u.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:re(e.onEscapeKeyDown,u=>{i.onClose(),u.preventDefault()}),onKeyDown:re(e.onKeyDown,u=>{const d=u.currentTarget.contains(u.target),f=CD[i.dir].includes(u.key);d&&f&&(o.onOpenChange(!1),a.trigger?.focus(),u.preventDefault())})})})})})});z_.displayName=F_;function $_(e){return e?"open":"closed"}function bc(e){return e==="indeterminate"}function nh(e){return bc(e)?"indeterminate":e?"checked":"unchecked"}function qD(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function KD(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function ZD(e,t,n){const s=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=KD(e,Math.max(o,0));s.length===1&&(i=i.filter(l=>l!==n));const c=i.find(l=>l.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function GD(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const a=t[o],c=t[i],l=a.x,u=a.y,d=c.x,f=c.y;u>r!=f>r&&n<(d-l)*(r-u)/(f-u)+l&&(s=!s)}return s}function YD(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return GD(n,t)}function si(e){return t=>t.pointerType==="mouse"?e(t):void 0}var XD=__,JD=Yf,QD=S_,eI=E_,tI=eh,nI=k_,rI=ul,sI=R_,oI=O_,iI=M_,aI=N_,cI=D_,lI=I_,uI=L_,dI=z_,dl="DropdownMenu",[fI]=wr(dl,[v_]),Rt=v_(),[hI,V_]=fI(dl),B_=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,c=Rt(t),l=v.useRef(null),[u,d]=Zs({prop:s,defaultProp:o??!1,onChange:i,caller:dl});return g.jsx(hI,{scope:t,triggerId:Hn(),triggerRef:l,contentId:Hn(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(f=>!f),[d]),modal:a,children:g.jsx(XD,{...c,open:u,onOpenChange:d,dir:r,modal:a,children:n})})};B_.displayName=dl;var U_="DropdownMenuTrigger",W_=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,o=V_(U_,n),i=Rt(n);return g.jsx(JD,{asChild:!0,...i,children:g.jsx(be.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:Yn(t,o.triggerRef),onPointerDown:re(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:re(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});W_.displayName=U_;var pI="DropdownMenuPortal",H_=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Rt(t);return g.jsx(QD,{...r,...n})};H_.displayName=pI;var q_="DropdownMenuContent",K_=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=V_(q_,n),o=Rt(n),i=v.useRef(!1);return g.jsx(eI,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...r,ref:t,onCloseAutoFocus:re(e.onCloseAutoFocus,a=>{i.current||s.triggerRef.current?.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:re(e.onInteractOutside,a=>{const c=a.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,u=c.button===2||l;(!s.modal||u)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});K_.displayName=q_;var mI="DropdownMenuGroup",gI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Rt(n);return g.jsx(tI,{...s,...r,ref:t})});gI.displayName=mI;var yI="DropdownMenuLabel",bI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Rt(n);return g.jsx(nI,{...s,...r,ref:t})});bI.displayName=yI;var vI="DropdownMenuItem",Z_=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Rt(n);return g.jsx(rI,{...s,...r,ref:t})});Z_.displayName=vI;var xI="DropdownMenuCheckboxItem",_I=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Rt(n);return g.jsx(sI,{...s,...r,ref:t})});_I.displayName=xI;var wI="DropdownMenuRadioGroup",SI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Rt(n);return g.jsx(oI,{...s,...r,ref:t})});SI.displayName=wI;var EI="DropdownMenuRadioItem",kI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Rt(n);return g.jsx(iI,{...s,...r,ref:t})});kI.displayName=EI;var CI="DropdownMenuItemIndicator",RI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Rt(n);return g.jsx(aI,{...s,...r,ref:t})});RI.displayName=CI;var PI="DropdownMenuSeparator",OI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Rt(n);return g.jsx(cI,{...s,...r,ref:t})});OI.displayName=PI;var TI="DropdownMenuArrow",MI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Rt(n);return g.jsx(lI,{...s,...r,ref:t})});MI.displayName=TI;var AI="DropdownMenuSubTrigger",NI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Rt(n);return g.jsx(uI,{...s,...r,ref:t})});NI.displayName=AI;var DI="DropdownMenuSubContent",II=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Rt(n);return g.jsx(dI,{...s,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});II.displayName=DI;var jI=B_,LI=W_,FI=H_,zI=K_,$I=Z_;function VI({...e}){return g.jsx(jI,{"data-slot":"dropdown-menu",...e})}function BI({...e}){return g.jsx(LI,{"data-slot":"dropdown-menu-trigger",...e})}function UI({className:e,sideOffset:t=4,...n}){return g.jsx(FI,{children:g.jsx(zI,{"data-slot":"dropdown-menu-content",sideOffset:t,className:Se("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function sa({className:e,inset:t,variant:n="default",...r}){return g.jsx($I,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:Se("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:ps-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}const WI=e=>{switch(e.toLowerCase()){case"http":return g.jsx(WM,{size:20});case"ping":return g.jsx(cu,{size:20});case"tcp":return g.jsx(s1,{size:20});case"dns":return g.jsx(n1,{size:20});case"keyword":return g.jsx(Ex,{size:20});case"json_query":return g.jsx($M,{size:20});case"push":return g.jsx(e1,{size:20});case"steam":return g.jsx(cu,{size:20});default:return g.jsx(cu,{size:20})}},HI=T.memo(function({summary:t,onEdit:n,onDelete:r,onPause:s,onClone:o,onDetails:i}){const{monitor:a,latest:c,bars:l,uptimePct:u}=t,d=c?.status??"unknown",f=d==="up"?"text-emerald-500":d==="down"?"text-red-500":"text-muted-foreground",h=d==="up"?"hover:border-emerald-500/50":d==="down"?"hover:border-red-500/50":"hover:border-neutral-500/50";return g.jsxs("div",{className:Se("bg-card hover:bg-muted/50 relative cursor-pointer rounded-lg border p-4 transition-all duration-200 hover:shadow-sm flex flex-col justify-between",h),onClick:()=>i(a),children:[g.jsxs("div",{className:"flex items-start justify-between mb-4",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("div",{className:"bg-muted flex size-10 items-center justify-center rounded-lg p-2 text-muted-foreground",children:WI(a.type)}),g.jsxs("div",{children:[g.jsx("h3",{className:"font-semibold line-clamp-1",children:a.name}),g.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-2",children:[g.jsx("span",{className:"uppercase",children:a.type}),g.jsx("span",{children:"•"}),g.jsxs("span",{children:[a.intervalSeconds,"s"]})]})]})]}),g.jsxs(VI,{children:[g.jsx(BI,{asChild:!0,children:g.jsx(gt,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground",onClick:p=>p.stopPropagation(),children:g.jsx(BM,{className:"h-4 w-4"})})}),g.jsxs(UI,{align:"end",children:[g.jsxs(sa,{onClick:p=>{p.stopPropagation(),n(a)},children:[g.jsx(wx,{className:"mr-2 h-4 w-4"})," Edit"]}),g.jsxs(sa,{onClick:p=>{p.stopPropagation(),o(a)},children:[g.jsx(xx,{className:"mr-2 h-4 w-4"})," Clone"]}),g.jsxs(sa,{onClick:p=>{p.stopPropagation(),s(a)},children:[a.isPaused?g.jsx(Sx,{className:"mr-2 h-4 w-4"}):g.jsx(_x,{className:"mr-2 h-4 w-4"}),a.isPaused?"Resume":"Pause"]}),g.jsxs(sa,{className:"text-red-600",onClick:p=>{p.stopPropagation(),r(a)},children:[g.jsx(jf,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})]}),g.jsxs("div",{className:"space-y-4 mb-2",children:[g.jsxs("div",{className:"flex justify-between items-end text-sm",children:[g.jsx("div",{className:"text-muted-foreground",children:"Status"}),g.jsxs("div",{className:Se("font-medium flex items-center gap-2",f),children:[g.jsx("span",{className:Se("h-2 w-2 rounded-full",d==="up"?"bg-emerald-500":d==="down"?"bg-red-500":"bg-neutral-400")}),a.isPaused?"Paused":d.toUpperCase()]})]}),g.jsxs("div",{className:"flex justify-between items-end text-sm",children:[g.jsx("div",{className:"text-muted-foreground",children:"Response"}),g.jsx("div",{className:"font-medium",children:c?.pingMs?`${c.pingMs} ms`:"—"})]}),g.jsxs("div",{className:"space-y-1.5",children:[g.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[g.jsx("span",{children:"Uptime (24h)"}),g.jsxs("span",{className:u>=98?"text-emerald-500":"text-yellow-500",children:[Math.round(u),"%"]})]}),g.jsx("div",{className:"flex gap-[2px] h-6 items-end",children:l.slice(-20).map((p,m)=>g.jsx("div",{className:Se("w-1.5 rounded-sm opacity-80",p==="up"?"bg-emerald-500 h-4":p==="down"?"bg-red-500 h-4":"bg-neutral-300 dark:bg-neutral-700 h-4")},m))})]})]})]})}),ig=(e,t,n)=>{if(e&&"reportValidity"in e){const r=X(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},Ed=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?ig(r.ref,n,e):r&&r.refs&&r.refs.forEach(s=>ig(s,n,e))}},ag=(e,t)=>{t.shouldUseNativeValidation&&Ed(e,t);const n={};for(const r in e){const s=X(t.fields,r),o=Object.assign(e[r]||{},{ref:s&&s.ref});if(qI(t.names||Object.keys(e),r)){const i=Object.assign({},X(n,r));ke(i,"root",o),ke(n,r,i)}else ke(n,r,o)}return n},qI=(e,t)=>{const n=cg(t);return e.some(r=>cg(r).match(`^${n}\\.\\d+`))};function cg(e){return e.replace(/\]|\[/g,"")}function U(e,t,n){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const l=i.prototype,u=Object.keys(l);for(let d=0;d<u.length;d++){const f=u[d];f in a||(a[f]=l[f].bind(a))}}const s=n?.Parent??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function i(a){var c;const l=n?.Parent?new o:this;r(l,a),(c=l._zod).deferred??(c.deferred=[]);for(const u of l._zod.deferred)u();return l}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Is extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class G_ extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Y_={};function ns(e){return Y_}function X_(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,s])=>t.indexOf(+r)===-1).map(([r,s])=>s)}function kd(e,t){return typeof t=="bigint"?t.toString():t}function rh(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function sh(e){return e==null}function oh(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function KI(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let s=(r.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c?.[1]&&(s=Number.parseInt(c[1]))}const o=n>s?n:s,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}const lg=Symbol("evaluating");function Re(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==lg)return r===void 0&&(r=lg,r=n()),r},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function fs(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Sr(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function ug(e){return JSON.stringify(e)}function ZI(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const J_="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function vc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const GI=rh(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function oi(e){if(vc(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(vc(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Q_(e){return oi(e)?{...e}:Array.isArray(e)?[...e]:e}const YI=new Set(["string","number","symbol"]);function fl(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Er(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function ie(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function XI(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const JI={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function QI(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const o=Sr(e._zod.def,{get shape(){const i={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=n.shape[a])}return fs(this,"shape",i),i},checks:[]});return Er(e,o)}function ej(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const o=Sr(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return fs(this,"shape",i),i},checks:[]});return Er(e,o)}function tj(e,t){if(!oi(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const o=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=Sr(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return fs(this,"shape",o),o}});return Er(e,s)}function nj(e,t){if(!oi(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Sr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return fs(this,"shape",r),r}});return Er(e,n)}function rj(e,t){const n=Sr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return fs(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Er(e,n)}function sj(e,t,n){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=Sr(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(n)for(const l in n){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(c[l]=e?new e({type:"optional",innerType:a[l]}):a[l])}else for(const l in a)c[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return fs(this,"shape",c),c},checks:[]});return Er(t,i)}function oj(e,t,n){const r=Sr(t._zod.def,{get shape(){const s=t._zod.def.shape,o={...s};if(n)for(const i in n){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(o[i]=new e({type:"nonoptional",innerType:s[i]}))}else for(const i in s)o[i]=new e({type:"nonoptional",innerType:s[i]});return fs(this,"shape",o),o}});return Er(t,r)}function Cs(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ew(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function oa(e){return typeof e=="string"?e:e?.message}function rs(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const s=oa(e.inst?._zod.def?.error?.(e))??oa(t?.error?.(e))??oa(n.customError?.(e))??oa(n.localeError?.(e))??"Invalid input";r.message=s}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function ih(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ii(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const tw=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,kd,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ah=U("$ZodError",tw),hl=U("$ZodError",tw,{Parent:Error});function ij(e,t=n=>n.message){const n={},r=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):r.push(t(s));return{formErrors:r,fieldErrors:n}}function aj(e,t=n=>n.message){const n={_errors:[]},r=s=>{for(const o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(i=>r({issues:i}));else if(o.code==="invalid_key")r({issues:o.issues});else if(o.code==="invalid_element")r({issues:o.issues});else if(o.path.length===0)n._errors.push(t(o));else{let i=n,a=0;for(;a<o.path.length;){const c=o.path[a];a===o.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(o))):i[c]=i[c]||{_errors:[]},i=i[c],a++}}};return r(e),n}const pl=e=>(t,n,r,s)=>{const o=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Is;if(i.issues.length){const a=new(s?.Err??e)(i.issues.map(c=>rs(c,o,ns())));throw J_(a,s?.callee),a}return i.value},cj=pl(hl),ml=e=>async(t,n,r,s)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(s?.Err??e)(i.issues.map(c=>rs(c,o,ns())));throw J_(a,s?.callee),a}return i.value},lj=ml(hl),gl=e=>(t,n,r)=>{const s=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw new Is;return o.issues.length?{success:!1,error:new(e??ah)(o.issues.map(i=>rs(i,s,ns())))}:{success:!0,data:o.value}},uj=gl(hl),yl=e=>async(t,n,r)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},s);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(i=>rs(i,s,ns())))}:{success:!0,data:o.value}},dj=yl(hl),fj=e=>(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return pl(e)(t,n,s)},hj=e=>(t,n,r)=>pl(e)(t,n,r),pj=e=>async(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ml(e)(t,n,s)},mj=e=>async(t,n,r)=>ml(e)(t,n,r),gj=e=>(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return gl(e)(t,n,s)},yj=e=>(t,n,r)=>gl(e)(t,n,r),bj=e=>async(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return yl(e)(t,n,s)},vj=e=>async(t,n,r)=>yl(e)(t,n,r),xj=/^[cC][^\s-]{8,}$/,_j=/^[0-9a-z]+$/,wj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Sj=/^[0-9a-vA-V]{20}$/,Ej=/^[A-Za-z0-9]{27}$/,kj=/^[a-zA-Z0-9_-]{21}$/,Cj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Rj=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,dg=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Pj=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Oj="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Tj(){return new RegExp(Oj,"u")}const Mj=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Aj=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Nj=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Dj=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ij=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,nw=/^[A-Za-z0-9_-]*$/,jj=/^\+[1-9]\d{6,14}$/,rw="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Lj=new RegExp(`^${rw}$`);function sw(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Fj(e){return new RegExp(`^${sw(e)}$`)}function zj(e){const t=sw({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${rw}T(?:${r})$`)}const $j=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Vj=/^-?\d+$/,Bj=/^-?\d+(?:\.\d+)?$/,Uj=/^[^A-Z]*$/,Wj=/^[^a-z]*$/,jt=U("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ow={number:"number",bigint:"bigint",object:"date"},iw=U("$ZodCheckLessThan",(e,t)=>{jt.init(e,t);const n=ow[typeof t.value];e._zod.onattach.push(r=>{const s=r._zod.bag,o=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),aw=U("$ZodCheckGreaterThan",(e,t)=>{jt.init(e,t);const n=ow[typeof t.value];e._zod.onattach.push(r=>{const s=r._zod.bag,o=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Hj=U("$ZodCheckMultipleOf",(e,t)=>{jt.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):KI(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),qj=U("$ZodCheckNumberFormat",(e,t)=>{jt.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[s,o]=JI[t.format];e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,a.minimum=s,a.maximum=o,n&&(a.pattern=Vj)}),e._zod.check=i=>{const a=i.value;if(n){if(!Number.isInteger(a)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<s&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),a>o&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Kj=U("$ZodCheckMaxLength",(e,t)=>{var n;jt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!sh(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const s=r.value;if(s.length<=t.maximum)return;const i=ih(s);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Zj=U("$ZodCheckMinLength",(e,t)=>{var n;jt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!sh(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const s=r.value;if(s.length>=t.minimum)return;const i=ih(s);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Gj=U("$ZodCheckLengthEquals",(e,t)=>{var n;jt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!sh(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=r=>{const s=r.value,o=s.length;if(o===t.length)return;const i=ih(s),a=o>t.length;r.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),bl=U("$ZodCheckStringFormat",(e,t)=>{var n,r;jt.init(e,t),e._zod.onattach.push(s=>{const o=s._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Yj=U("$ZodCheckRegex",(e,t)=>{bl.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Xj=U("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Uj),bl.init(e,t)}),Jj=U("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Wj),bl.init(e,t)}),Qj=U("$ZodCheckIncludes",(e,t)=>{jt.init(e,t);const n=fl(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),eL=U("$ZodCheckStartsWith",(e,t)=>{jt.init(e,t);const n=new RegExp(`^${fl(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),tL=U("$ZodCheckEndsWith",(e,t)=>{jt.init(e,t);const n=new RegExp(`.*${fl(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),nL=U("$ZodCheckOverwrite",(e,t)=>{jt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class rL{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
62
+ `).filter(i=>i),s=Math.min(...r.map(i=>i.length-i.trimStart().length)),o=r.map(i=>i.slice(s)).map(i=>" ".repeat(this.indent*2)+i);for(const i of o)this.content.push(i)}compile(){const t=Function,n=this?.args,s=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...n,s.join(`
63
+ `))}}const sL={major:4,minor:3,patch:6},Qe=U("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=sL;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const s of r)for(const o of s._zod.onattach)o(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(i,a,c)=>{let l=Cs(i),u;for(const d of a){if(d._zod.def.when){if(!d._zod.def.when(i))continue}else if(l)continue;const f=i.issues.length,h=d._zod.check(i);if(h instanceof Promise&&c?.async===!1)throw new Is;if(u||h instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await h,i.issues.length!==f&&(l||(l=Cs(i,f)))});else{if(i.issues.length===f)continue;l||(l=Cs(i,f))}}return u?u.then(()=>i):i},o=(i,a,c)=>{if(Cs(i))return i.aborted=!0,i;const l=s(a,r,c);if(l instanceof Promise){if(c.async===!1)throw new Is;return l.then(u=>e._zod.parse(u,c))}return e._zod.parse(l,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){const l=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(u=>o(u,i,a)):o(l,i,a)}const c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Is;return c.then(l=>s(l,r,a))}return s(c,r,a)}}Re(e,"~standard",()=>({validate:s=>{try{const o=uj(e,s);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return dj(e,s).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),ch=U("$ZodString",(e,t)=>{Qe.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??$j(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Ve=U("$ZodStringFormat",(e,t)=>{bl.init(e,t),ch.init(e,t)}),oL=U("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Rj),Ve.init(e,t)}),iL=U("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=dg(r))}else t.pattern??(t.pattern=dg());Ve.init(e,t)}),aL=U("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Pj),Ve.init(e,t)}),cL=U("$ZodURL",(e,t)=>{Ve.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),s=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=s.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),lL=U("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Tj()),Ve.init(e,t)}),uL=U("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=kj),Ve.init(e,t)}),dL=U("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=xj),Ve.init(e,t)}),fL=U("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=_j),Ve.init(e,t)}),hL=U("$ZodULID",(e,t)=>{t.pattern??(t.pattern=wj),Ve.init(e,t)}),pL=U("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Sj),Ve.init(e,t)}),mL=U("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ej),Ve.init(e,t)}),gL=U("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=zj(t)),Ve.init(e,t)}),yL=U("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Lj),Ve.init(e,t)}),bL=U("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Fj(t)),Ve.init(e,t)}),vL=U("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Cj),Ve.init(e,t)}),xL=U("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Mj),Ve.init(e,t),e._zod.bag.format="ipv4"}),_L=U("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Aj),Ve.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),wL=U("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Nj),Ve.init(e,t)}),SL=U("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Dj),Ve.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[s,o]=r;if(!o)throw new Error;const i=Number(o);if(`${i}`!==o)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${s}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function cw(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const EL=U("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ij),Ve.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{cw(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function kL(e){if(!nw.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return cw(n)}const CL=U("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=nw),Ve.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{kL(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),RL=U("$ZodE164",(e,t)=>{t.pattern??(t.pattern=jj),Ve.init(e,t)});function PL(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const s=JSON.parse(atob(r));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const OL=U("$ZodJWT",(e,t)=>{Ve.init(e,t),e._zod.check=n=>{PL(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),lw=U("$ZodNumber",(e,t)=>{Qe.init(e,t),e._zod.pattern=e._zod.bag.pattern??Bj,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const o=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...o?{received:o}:{}}),n}}),TL=U("$ZodNumberFormat",(e,t)=>{qj.init(e,t),lw.init(e,t)}),ML=U("$ZodUnknown",(e,t)=>{Qe.init(e,t),e._zod.parse=n=>n}),AL=U("$ZodNever",(e,t)=>{Qe.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function fg(e,t,n){e.issues.length&&t.issues.push(...ew(n,e.issues)),t.value[n]=e.value}const NL=U("$ZodArray",(e,t)=>{Qe.init(e,t),e._zod.parse=(n,r)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const o=[];for(let i=0;i<s.length;i++){const a=s[i],c=t.element._zod.run({value:a,issues:[]},r);c instanceof Promise?o.push(c.then(l=>fg(l,n,i))):fg(c,n,i)}return o.length?Promise.all(o).then(()=>n):n}});function xc(e,t,n,r,s){if(e.issues.length){if(s&&!(n in r))return;t.issues.push(...ew(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function uw(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=XI(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function dw(e,t,n,r,s,o){const i=[],a=s.keySet,c=s.catchall._zod,l=c.def.type,u=c.optout==="optional";for(const d in t){if(a.has(d))continue;if(l==="never"){i.push(d);continue}const f=c.run({value:t[d],issues:[]},r);f instanceof Promise?e.push(f.then(h=>xc(h,n,d,t,u))):xc(f,n,d,t,u)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const DL=U("$ZodObject",(e,t)=>{if(Qe.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=rh(()=>uw(t));Re(e._zod,"propValues",()=>{const a=t.shape,c={};for(const l in a){const u=a[l]._zod;if(u.values){c[l]??(c[l]=new Set);for(const d of u.values)c[l].add(d)}}return c});const s=vc,o=t.catchall;let i;e._zod.parse=(a,c)=>{i??(i=r.value);const l=a.value;if(!s(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),a;a.value={};const u=[],d=i.shape;for(const f of i.keys){const h=d[f],p=h._zod.optout==="optional",m=h._zod.run({value:l[f],issues:[]},c);m instanceof Promise?u.push(m.then(y=>xc(y,a,f,l,p))):xc(m,a,f,l,p)}return o?dw(u,l,a,c,r.value,e):u.length?Promise.all(u).then(()=>a):a}}),IL=U("$ZodObjectJIT",(e,t)=>{DL.init(e,t);const n=e._zod.parse,r=rh(()=>uw(t)),s=f=>{const h=new rL(["shape","payload","ctx"]),p=r.value,m=_=>{const w=ug(_);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};h.write("const input = payload.value;");const y=Object.create(null);let b=0;for(const _ of p.keys)y[_]=`key_${b++}`;h.write("const newResult = {};");for(const _ of p.keys){const w=y[_],S=ug(_),k=f[_]?._zod?.optout==="optional";h.write(`const ${w} = ${m(_)};`),k?h.write(`
64
+ if (${w}.issues.length) {
65
+ if (${S} in input) {
66
+ payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
67
+ ...iss,
68
+ path: iss.path ? [${S}, ...iss.path] : [${S}]
69
+ })));
70
+ }
71
+ }
72
+
73
+ if (${w}.value === undefined) {
74
+ if (${S} in input) {
75
+ newResult[${S}] = undefined;
76
+ }
77
+ } else {
78
+ newResult[${S}] = ${w}.value;
79
+ }
80
+
81
+ `):h.write(`
82
+ if (${w}.issues.length) {
83
+ payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
84
+ ...iss,
85
+ path: iss.path ? [${S}, ...iss.path] : [${S}]
86
+ })));
87
+ }
88
+
89
+ if (${w}.value === undefined) {
90
+ if (${S} in input) {
91
+ newResult[${S}] = undefined;
92
+ }
93
+ } else {
94
+ newResult[${S}] = ${w}.value;
95
+ }
96
+
97
+ `)}h.write("payload.value = newResult;"),h.write("return payload;");const x=h.compile();return(_,w)=>x(f,_,w)};let o;const i=vc,a=!Y_.jitless,l=a&&GI.value,u=t.catchall;let d;e._zod.parse=(f,h)=>{d??(d=r.value);const p=f.value;return i(p)?a&&l&&h?.async===!1&&h.jitless!==!0?(o||(o=s(t.shape)),f=o(f,h),u?dw([],p,f,h,d,e):f):n(f,h):(f.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),f)}});function hg(e,t,n,r){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const s=e.filter(o=>!Cs(o));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(i=>rs(i,r,ns())))}),t)}const jL=U("$ZodUnion",(e,t)=>{Qe.init(e,t),Re(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),Re(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),Re(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),Re(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${s.map(o=>oh(o.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(s,o)=>{if(n)return r(s,o);let i=!1;const a=[];for(const c of t.options){const l=c._zod.run({value:s.value,issues:[]},o);if(l instanceof Promise)a.push(l),i=!0;else{if(l.issues.length===0)return l;a.push(l)}}return i?Promise.all(a).then(c=>hg(c,s,e,o)):hg(a,s,e,o)}}),LL=U("$ZodIntersection",(e,t)=>{Qe.init(e,t),e._zod.parse=(n,r)=>{const s=n.value,o=t.left._zod.run({value:s,issues:[]},r),i=t.right._zod.run({value:s,issues:[]},r);return o instanceof Promise||i instanceof Promise?Promise.all([o,i]).then(([c,l])=>pg(n,c,l)):pg(n,o,i)}});function Cd(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(oi(e)&&oi(t)){const n=Object.keys(t),r=Object.keys(e).filter(o=>n.indexOf(o)!==-1),s={...e,...t};for(const o of r){const i=Cd(e[o],t[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};s[o]=i.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const s=e[r],o=t[r],i=Cd(s,o);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function pg(e,t,n){const r=new Map;let s;for(const a of t.issues)if(a.code==="unrecognized_keys"){s??(s=a);for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(a);const o=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(o.length&&s&&e.issues.push({...s,keys:o}),Cs(e))return e;const i=Cd(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const FL=U("$ZodEnum",(e,t)=>{Qe.init(e,t);const n=X_(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(s=>YI.has(typeof s)).map(s=>typeof s=="string"?fl(s):s.toString()).join("|")})$`),e._zod.parse=(s,o)=>{const i=s.value;return r.has(i)||s.issues.push({code:"invalid_value",values:n,input:i,inst:e}),s}}),zL=U("$ZodTransform",(e,t)=>{Qe.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new G_(e.constructor.name);const s=t.transform(n.value,n);if(r.async)return(s instanceof Promise?s:Promise.resolve(s)).then(i=>(n.value=i,n));if(s instanceof Promise)throw new Is;return n.value=s,n}});function mg(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const fw=U("$ZodOptional",(e,t)=>{Qe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Re(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Re(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${oh(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(o=>mg(o,n.value)):mg(s,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),$L=U("$ZodExactOptional",(e,t)=>{fw.init(e,t),Re(e._zod,"values",()=>t.innerType._zod.values),Re(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),VL=U("$ZodNullable",(e,t)=>{Qe.init(e,t),Re(e._zod,"optin",()=>t.innerType._zod.optin),Re(e._zod,"optout",()=>t.innerType._zod.optout),Re(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${oh(n.source)}|null)$`):void 0}),Re(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),BL=U("$ZodDefault",(e,t)=>{Qe.init(e,t),e._zod.optin="optional",Re(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(o=>gg(o,t)):gg(s,t)}});function gg(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const UL=U("$ZodPrefault",(e,t)=>{Qe.init(e,t),e._zod.optin="optional",Re(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),WL=U("$ZodNonOptional",(e,t)=>{Qe.init(e,t),Re(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(o=>yg(o,e)):yg(s,e)}});function yg(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const HL=U("$ZodCatch",(e,t)=>{Qe.init(e,t),Re(e._zod,"optin",()=>t.innerType._zod.optin),Re(e._zod,"optout",()=>t.innerType._zod.optout),Re(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>rs(i,r,ns()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(o=>rs(o,r,ns()))},input:n.value}),n.issues=[]),n)}}),qL=U("$ZodPipe",(e,t)=>{Qe.init(e,t),Re(e._zod,"values",()=>t.in._zod.values),Re(e._zod,"optin",()=>t.in._zod.optin),Re(e._zod,"optout",()=>t.out._zod.optout),Re(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const o=t.out._zod.run(n,r);return o instanceof Promise?o.then(i=>ia(i,t.in,r)):ia(o,t.in,r)}const s=t.in._zod.run(n,r);return s instanceof Promise?s.then(o=>ia(o,t.out,r)):ia(s,t.out,r)}});function ia(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const KL=U("$ZodReadonly",(e,t)=>{Qe.init(e,t),Re(e._zod,"propValues",()=>t.innerType._zod.propValues),Re(e._zod,"values",()=>t.innerType._zod.values),Re(e._zod,"optin",()=>t.innerType?._zod?.optin),Re(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(bg):bg(s)}});function bg(e){return e.value=Object.freeze(e.value),e}const ZL=U("$ZodCustom",(e,t)=>{jt.init(e,t),Qe.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,s=t.fn(r);if(s instanceof Promise)return s.then(o=>vg(o,n,r,e));vg(s,n,r,e)}});function vg(e,t,n,r){if(!e){const s={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(s.params=r._zod.def.params),t.issues.push(ii(s))}}var xg;class GL{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const s={...r,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function YL(){return new GL}(xg=globalThis).__zod_globalRegistry??(xg.__zod_globalRegistry=YL());const Oo=globalThis.__zod_globalRegistry;function XL(e,t){return new e({type:"string",...ie(t)})}function JL(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ie(t)})}function _g(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ie(t)})}function QL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ie(t)})}function eF(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ie(t)})}function tF(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ie(t)})}function nF(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ie(t)})}function rF(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ie(t)})}function sF(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ie(t)})}function oF(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ie(t)})}function iF(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ie(t)})}function aF(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ie(t)})}function cF(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ie(t)})}function lF(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ie(t)})}function uF(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ie(t)})}function dF(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ie(t)})}function fF(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ie(t)})}function hF(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ie(t)})}function pF(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ie(t)})}function mF(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ie(t)})}function gF(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ie(t)})}function yF(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ie(t)})}function bF(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ie(t)})}function vF(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ie(t)})}function xF(e,t){return new e({type:"string",format:"date",check:"string_format",...ie(t)})}function _F(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ie(t)})}function wF(e,t){return new e({type:"string",format:"duration",check:"string_format",...ie(t)})}function SF(e,t){return new e({type:"number",coerce:!0,checks:[],...ie(t)})}function EF(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ie(t)})}function kF(e){return new e({type:"unknown"})}function CF(e,t){return new e({type:"never",...ie(t)})}function wg(e,t){return new iw({check:"less_than",...ie(t),value:e,inclusive:!1})}function vu(e,t){return new iw({check:"less_than",...ie(t),value:e,inclusive:!0})}function Sg(e,t){return new aw({check:"greater_than",...ie(t),value:e,inclusive:!1})}function xu(e,t){return new aw({check:"greater_than",...ie(t),value:e,inclusive:!0})}function Eg(e,t){return new Hj({check:"multiple_of",...ie(t),value:e})}function hw(e,t){return new Kj({check:"max_length",...ie(t),maximum:e})}function _c(e,t){return new Zj({check:"min_length",...ie(t),minimum:e})}function pw(e,t){return new Gj({check:"length_equals",...ie(t),length:e})}function RF(e,t){return new Yj({check:"string_format",format:"regex",...ie(t),pattern:e})}function PF(e){return new Xj({check:"string_format",format:"lowercase",...ie(e)})}function OF(e){return new Jj({check:"string_format",format:"uppercase",...ie(e)})}function TF(e,t){return new Qj({check:"string_format",format:"includes",...ie(t),includes:e})}function MF(e,t){return new eL({check:"string_format",format:"starts_with",...ie(t),prefix:e})}function AF(e,t){return new tL({check:"string_format",format:"ends_with",...ie(t),suffix:e})}function so(e){return new nL({check:"overwrite",tx:e})}function NF(e){return so(t=>t.normalize(e))}function DF(){return so(e=>e.trim())}function IF(){return so(e=>e.toLowerCase())}function jF(){return so(e=>e.toUpperCase())}function LF(){return so(e=>ZI(e))}function FF(e,t,n){return new e({type:"array",element:t,...ie(n)})}function zF(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ie(n)})}function $F(e){const t=VF(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(ii(r,n.value,t._zod.def));else{const s=r;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),n.issues.push(ii(s))}},e(n.value,n)));return t}function VF(e,t){const n=new jt({check:"custom",...ie(t)});return n._zod.check=e,n}function mw(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Oo,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function dt(e,t,n={path:[],schemaPath:[]}){var r;const s=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{const u={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,u);else{const f=i.schema,h=t.processors[s.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);h(e,t,f,u)}const d=e._zod.parent;d&&(i.ref||(i.ref=d),dt(d,t,u),t.seen.get(d).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&St(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function gw(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const i of e.seen.entries()){const a=e.metadataRegistry.get(i[0])?.id;if(a){const c=r.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,i[0])}}const s=i=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const d=e.external.registry.get(i[0])?.id,f=e.external.uri??(p=>p);if(d)return{ref:f(d)};const h=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=h,{defId:h,ref:`${f("__shared")}#/${a}/${h}`}}if(i[1]===n)return{ref:"#"};const l=`#/${a}/`,u=i[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+u}},o=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:c,defId:l}=s(i);a.def={...a.schema},l&&(a.defId=l);const u=a.schema;for(const d in u)delete u[d];u.$ref=c};if(e.cycles==="throw")for(const i of e.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
98
+
99
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const a=i[1];if(t===i[0]){o(i);continue}if(e.external){const l=e.external.registry.get(i[0])?.id;if(t!==i[0]&&l){o(i);continue}}if(e.metadataRegistry.get(i[0])?.id){o(i);continue}if(a.cycle){o(i);continue}if(a.count>1&&e.reused==="ref"){o(i);continue}}}function yw(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=i=>{const a=e.seen.get(i);if(a.ref===null)return;const c=a.def??a.schema,l={...c},u=a.ref;if(a.ref=null,u){r(u);const f=e.seen.get(u),h=f.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(h)):Object.assign(c,h),Object.assign(c,l),i._zod.parent===u)for(const m in c)m==="$ref"||m==="allOf"||m in l||delete c[m];if(h.$ref&&f.def)for(const m in c)m==="$ref"||m==="allOf"||m in f.def&&JSON.stringify(c[m])===JSON.stringify(f.def[m])&&delete c[m]}const d=i._zod.parent;if(d&&d!==u){r(d);const f=e.seen.get(d);if(f?.schema.$ref&&(c.$ref=f.schema.$ref,f.def))for(const h in c)h==="$ref"||h==="allOf"||h in f.def&&JSON.stringify(c[h])===JSON.stringify(f.def[h])&&delete c[h]}e.override({zodSchema:i,jsonSchema:c,path:a.path??[]})};for(const i of[...e.seen.entries()].reverse())r(i[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const i=e.external.registry.get(t)?.id;if(!i)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(i)}Object.assign(s,n.def??n.schema);const o=e.external?.defs??{};for(const i of e.seen.entries()){const a=i[1];a.def&&a.defId&&(o[a.defId]=a.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?s.$defs=o:s.definitions=o);try{const i=JSON.parse(JSON.stringify(s));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:wc(t,"input",e.processors),output:wc(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function St(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return St(r.element,n);if(r.type==="set")return St(r.valueType,n);if(r.type==="lazy")return St(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return St(r.innerType,n);if(r.type==="intersection")return St(r.left,n)||St(r.right,n);if(r.type==="record"||r.type==="map")return St(r.keyType,n)||St(r.valueType,n);if(r.type==="pipe")return St(r.in,n)||St(r.out,n);if(r.type==="object"){for(const s in r.shape)if(St(r.shape[s],n))return!0;return!1}if(r.type==="union"){for(const s of r.options)if(St(s,n))return!0;return!1}if(r.type==="tuple"){for(const s of r.items)if(St(s,n))return!0;return!!(r.rest&&St(r.rest,n))}return!1}const BF=(e,t={})=>n=>{const r=mw({...n,processors:t});return dt(e,r),gw(r,e),yw(r,e)},wc=(e,t,n={})=>r=>{const{libraryOptions:s,target:o}=r??{},i=mw({...s??{},target:o,io:t,processors:n});return dt(e,i),gw(i,e),yw(i,e)},UF={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},WF=(e,t,n,r)=>{const s=n;s.type="string";const{minimum:o,maximum:i,format:a,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof o=="number"&&(s.minLength=o),typeof i=="number"&&(s.maxLength=i),a&&(s.format=UF[a]??a,s.format===""&&delete s.format,a==="time"&&delete s.format),l&&(s.contentEncoding=l),c&&c.size>0){const u=[...c];u.length===1?s.pattern=u[0].source:u.length>1&&(s.allOf=[...u.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},HF=(e,t,n,r)=>{const s=n,{minimum:o,maximum:i,format:a,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof a=="string"&&a.includes("int")?s.type="integer":s.type="number",typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.minimum=u,s.exclusiveMinimum=!0):s.exclusiveMinimum=u),typeof o=="number"&&(s.minimum=o,typeof u=="number"&&t.target!=="draft-04"&&(u>=o?delete s.minimum:delete s.exclusiveMinimum)),typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.maximum=l,s.exclusiveMaximum=!0):s.exclusiveMaximum=l),typeof i=="number"&&(s.maximum=i,typeof l=="number"&&t.target!=="draft-04"&&(l<=i?delete s.maximum:delete s.exclusiveMaximum)),typeof c=="number"&&(s.multipleOf=c)},qF=(e,t,n,r)=>{n.not={}},KF=(e,t,n,r)=>{},ZF=(e,t,n,r)=>{const s=e._zod.def,o=X_(s.entries);o.every(i=>typeof i=="number")&&(n.type="number"),o.every(i=>typeof i=="string")&&(n.type="string"),n.enum=o},GF=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},YF=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},XF=(e,t,n,r)=>{const s=n,o=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(s.minItems=i),typeof a=="number"&&(s.maxItems=a),s.type="array",s.items=dt(o.element,t,{...r,path:[...r.path,"items"]})},JF=(e,t,n,r)=>{const s=n,o=e._zod.def;s.type="object",s.properties={};const i=o.shape;for(const l in i)s.properties[l]=dt(i[l],t,{...r,path:[...r.path,"properties",l]});const a=new Set(Object.keys(i)),c=new Set([...a].filter(l=>{const u=o.shape[l]._zod;return t.io==="input"?u.optin===void 0:u.optout===void 0}));c.size>0&&(s.required=Array.from(c)),o.catchall?._zod.def.type==="never"?s.additionalProperties=!1:o.catchall?o.catchall&&(s.additionalProperties=dt(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},QF=(e,t,n,r)=>{const s=e._zod.def,o=s.inclusive===!1,i=s.options.map((a,c)=>dt(a,t,{...r,path:[...r.path,o?"oneOf":"anyOf",c]}));o?n.oneOf=i:n.anyOf=i},e2=(e,t,n,r)=>{const s=e._zod.def,o=dt(s.left,t,{...r,path:[...r.path,"allOf",0]}),i=dt(s.right,t,{...r,path:[...r.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,c=[...a(o)?o.allOf:[o],...a(i)?i.allOf:[i]];n.allOf=c},t2=(e,t,n,r)=>{const s=e._zod.def,o=dt(s.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=s.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},n2=(e,t,n,r)=>{const s=e._zod.def;dt(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType},r2=(e,t,n,r)=>{const s=e._zod.def;dt(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},s2=(e,t,n,r)=>{const s=e._zod.def;dt(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},o2=(e,t,n,r)=>{const s=e._zod.def;dt(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType;let i;try{i=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},i2=(e,t,n,r)=>{const s=e._zod.def,o=t.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;dt(o,t,r);const i=t.seen.get(e);i.ref=o},a2=(e,t,n,r)=>{const s=e._zod.def;dt(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType,n.readOnly=!0},bw=(e,t,n,r)=>{const s=e._zod.def;dt(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType};function kg(e,t){try{var n=e()}catch(r){return t(r)}return n&&n.then?n.then(void 0,t):n}function c2(e,t){for(var n={};e.length;){var r=e[0],s=r.code,o=r.message,i=r.path.join(".");if(!n[i])if("unionErrors"in r){var a=r.unionErrors[0].errors[0];n[i]={message:a.message,type:a.code}}else n[i]={message:o,type:s};if("unionErrors"in r&&r.unionErrors.forEach(function(u){return u.errors.forEach(function(d){return e.push(d)})}),t){var c=n[i].types,l=c&&c[r.code];n[i]=Sf(i,t,n,s,l?[].concat(l,r.message):r.message)}e.shift()}return n}function l2(e,t){for(var n={};e.length;){var r=e[0],s=r.code,o=r.message,i=r.path.join(".");if(!n[i])if(r.code==="invalid_union"&&r.errors.length>0){var a=r.errors[0][0];n[i]={message:a.message,type:a.code}}else n[i]={message:o,type:s};if(r.code==="invalid_union"&&r.errors.forEach(function(u){return u.forEach(function(d){return e.push(d)})}),t){var c=n[i].types,l=c&&c[r.code];n[i]=Sf(i,t,n,s,l?[].concat(l,r.message):r.message)}e.shift()}return n}function vw(e,t,n){if(n===void 0&&(n={}),(function(r){return"_def"in r&&typeof r._def=="object"&&"typeName"in r._def})(e))return function(r,s,o){try{return Promise.resolve(kg(function(){return Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(i){return o.shouldUseNativeValidation&&Ed({},o),{errors:{},values:n.raw?Object.assign({},r):i}})},function(i){if((function(a){return Array.isArray(a?.issues)})(i))return{values:{},errors:ag(c2(i.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}};if((function(r){return"_zod"in r&&typeof r._zod=="object"})(e))return function(r,s,o){try{return Promise.resolve(kg(function(){return Promise.resolve((n.mode==="sync"?cj:lj)(e,r,t)).then(function(i){return o.shouldUseNativeValidation&&Ed({},o),{errors:{},values:n.raw?Object.assign({},r):i}})},function(i){if((function(a){return a instanceof ah})(i))return{values:{},errors:ag(l2(i.issues,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}};throw new Error("Invalid input: not a Zod schema")}const u2=U("ZodISODateTime",(e,t)=>{gL.init(e,t),Be.init(e,t)});function d2(e){return vF(u2,e)}const f2=U("ZodISODate",(e,t)=>{yL.init(e,t),Be.init(e,t)});function h2(e){return xF(f2,e)}const p2=U("ZodISOTime",(e,t)=>{bL.init(e,t),Be.init(e,t)});function m2(e){return _F(p2,e)}const g2=U("ZodISODuration",(e,t)=>{vL.init(e,t),Be.init(e,t)});function y2(e){return wF(g2,e)}const b2=(e,t)=>{ah.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>aj(e,n)},flatten:{value:n=>ij(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,kd,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,kd,2)}},isEmpty:{get(){return e.issues.length===0}}})},nn=U("ZodError",b2,{Parent:Error}),v2=pl(nn),x2=ml(nn),_2=gl(nn),w2=yl(nn),S2=fj(nn),E2=hj(nn),k2=pj(nn),C2=mj(nn),R2=gj(nn),P2=yj(nn),O2=bj(nn),T2=vj(nn),et=U("ZodType",(e,t)=>(Qe.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:wc(e,"input"),output:wc(e,"output")}}),e.toJSONSchema=BF(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Sr(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>Er(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>v2(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>_2(e,n,r),e.parseAsync=async(n,r)=>x2(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>w2(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>S2(e,n,r),e.decode=(n,r)=>E2(e,n,r),e.encodeAsync=async(n,r)=>k2(e,n,r),e.decodeAsync=async(n,r)=>C2(e,n,r),e.safeEncode=(n,r)=>R2(e,n,r),e.safeDecode=(n,r)=>P2(e,n,r),e.safeEncodeAsync=async(n,r)=>O2(e,n,r),e.safeDecodeAsync=async(n,r)=>T2(e,n,r),e.refine=(n,r)=>e.check(wz(n,r)),e.superRefine=n=>e.check(Sz(n)),e.overwrite=n=>e.check(so(n)),e.optional=()=>Og(e),e.exactOptional=()=>lz(e),e.nullable=()=>Tg(e),e.nullish=()=>Og(Tg(e)),e.nonoptional=n=>mz(e,n),e.array=()=>ez(e),e.or=n=>rz([e,n]),e.and=n=>oz(e,n),e.transform=n=>Mg(e,az(n)),e.default=n=>fz(e,n),e.prefault=n=>pz(e,n),e.catch=n=>yz(e,n),e.pipe=n=>Mg(e,n),e.readonly=()=>xz(e),e.describe=n=>{const r=e.clone();return Oo.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return Oo.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Oo.get(e);const r=e.clone();return Oo.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),xw=U("_ZodString",(e,t)=>{ch.init(e,t),et.init(e,t),e._zod.processJSONSchema=(r,s,o)=>WF(e,r,s);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(RF(...r)),e.includes=(...r)=>e.check(TF(...r)),e.startsWith=(...r)=>e.check(MF(...r)),e.endsWith=(...r)=>e.check(AF(...r)),e.min=(...r)=>e.check(_c(...r)),e.max=(...r)=>e.check(hw(...r)),e.length=(...r)=>e.check(pw(...r)),e.nonempty=(...r)=>e.check(_c(1,...r)),e.lowercase=r=>e.check(PF(r)),e.uppercase=r=>e.check(OF(r)),e.trim=()=>e.check(DF()),e.normalize=(...r)=>e.check(NF(...r)),e.toLowerCase=()=>e.check(IF()),e.toUpperCase=()=>e.check(jF()),e.slugify=()=>e.check(LF())}),M2=U("ZodString",(e,t)=>{ch.init(e,t),xw.init(e,t),e.email=n=>e.check(JL(A2,n)),e.url=n=>e.check(rF(N2,n)),e.jwt=n=>e.check(bF(Z2,n)),e.emoji=n=>e.check(sF(D2,n)),e.guid=n=>e.check(_g(Cg,n)),e.uuid=n=>e.check(QL(aa,n)),e.uuidv4=n=>e.check(eF(aa,n)),e.uuidv6=n=>e.check(tF(aa,n)),e.uuidv7=n=>e.check(nF(aa,n)),e.nanoid=n=>e.check(oF(I2,n)),e.guid=n=>e.check(_g(Cg,n)),e.cuid=n=>e.check(iF(j2,n)),e.cuid2=n=>e.check(aF(L2,n)),e.ulid=n=>e.check(cF(F2,n)),e.base64=n=>e.check(mF(H2,n)),e.base64url=n=>e.check(gF(q2,n)),e.xid=n=>e.check(lF(z2,n)),e.ksuid=n=>e.check(uF($2,n)),e.ipv4=n=>e.check(dF(V2,n)),e.ipv6=n=>e.check(fF(B2,n)),e.cidrv4=n=>e.check(hF(U2,n)),e.cidrv6=n=>e.check(pF(W2,n)),e.e164=n=>e.check(yF(K2,n)),e.datetime=n=>e.check(d2(n)),e.date=n=>e.check(h2(n)),e.time=n=>e.check(m2(n)),e.duration=n=>e.check(y2(n))});function pt(e){return XL(M2,e)}const Be=U("ZodStringFormat",(e,t)=>{Ve.init(e,t),xw.init(e,t)}),A2=U("ZodEmail",(e,t)=>{aL.init(e,t),Be.init(e,t)}),Cg=U("ZodGUID",(e,t)=>{oL.init(e,t),Be.init(e,t)}),aa=U("ZodUUID",(e,t)=>{iL.init(e,t),Be.init(e,t)}),N2=U("ZodURL",(e,t)=>{cL.init(e,t),Be.init(e,t)}),D2=U("ZodEmoji",(e,t)=>{lL.init(e,t),Be.init(e,t)}),I2=U("ZodNanoID",(e,t)=>{uL.init(e,t),Be.init(e,t)}),j2=U("ZodCUID",(e,t)=>{dL.init(e,t),Be.init(e,t)}),L2=U("ZodCUID2",(e,t)=>{fL.init(e,t),Be.init(e,t)}),F2=U("ZodULID",(e,t)=>{hL.init(e,t),Be.init(e,t)}),z2=U("ZodXID",(e,t)=>{pL.init(e,t),Be.init(e,t)}),$2=U("ZodKSUID",(e,t)=>{mL.init(e,t),Be.init(e,t)}),V2=U("ZodIPv4",(e,t)=>{xL.init(e,t),Be.init(e,t)}),B2=U("ZodIPv6",(e,t)=>{_L.init(e,t),Be.init(e,t)}),U2=U("ZodCIDRv4",(e,t)=>{wL.init(e,t),Be.init(e,t)}),W2=U("ZodCIDRv6",(e,t)=>{SL.init(e,t),Be.init(e,t)}),H2=U("ZodBase64",(e,t)=>{EL.init(e,t),Be.init(e,t)}),q2=U("ZodBase64URL",(e,t)=>{CL.init(e,t),Be.init(e,t)}),K2=U("ZodE164",(e,t)=>{RL.init(e,t),Be.init(e,t)}),Z2=U("ZodJWT",(e,t)=>{OL.init(e,t),Be.init(e,t)}),_w=U("ZodNumber",(e,t)=>{lw.init(e,t),et.init(e,t),e._zod.processJSONSchema=(r,s,o)=>HF(e,r,s),e.gt=(r,s)=>e.check(Sg(r,s)),e.gte=(r,s)=>e.check(xu(r,s)),e.min=(r,s)=>e.check(xu(r,s)),e.lt=(r,s)=>e.check(wg(r,s)),e.lte=(r,s)=>e.check(vu(r,s)),e.max=(r,s)=>e.check(vu(r,s)),e.int=r=>e.check(Rg(r)),e.safe=r=>e.check(Rg(r)),e.positive=r=>e.check(Sg(0,r)),e.nonnegative=r=>e.check(xu(0,r)),e.negative=r=>e.check(wg(0,r)),e.nonpositive=r=>e.check(vu(0,r)),e.multipleOf=(r,s)=>e.check(Eg(r,s)),e.step=(r,s)=>e.check(Eg(r,s)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null}),G2=U("ZodNumberFormat",(e,t)=>{TL.init(e,t),_w.init(e,t)});function Rg(e){return EF(G2,e)}const Y2=U("ZodUnknown",(e,t)=>{ML.init(e,t),et.init(e,t),e._zod.processJSONSchema=(n,r,s)=>KF()});function Pg(){return kF(Y2)}const X2=U("ZodNever",(e,t)=>{AL.init(e,t),et.init(e,t),e._zod.processJSONSchema=(n,r,s)=>qF(e,n,r)});function J2(e){return CF(X2,e)}const Q2=U("ZodArray",(e,t)=>{NL.init(e,t),et.init(e,t),e._zod.processJSONSchema=(n,r,s)=>XF(e,n,r,s),e.element=t.element,e.min=(n,r)=>e.check(_c(n,r)),e.nonempty=n=>e.check(_c(1,n)),e.max=(n,r)=>e.check(hw(n,r)),e.length=(n,r)=>e.check(pw(n,r)),e.unwrap=()=>e.element});function ez(e,t){return FF(Q2,e,t)}const tz=U("ZodObject",(e,t)=>{IL.init(e,t),et.init(e,t),e._zod.processJSONSchema=(n,r,s)=>JF(e,n,r,s),Re(e,"shape",()=>t.shape),e.keyof=()=>lh(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Pg()}),e.loose=()=>e.clone({...e._zod.def,catchall:Pg()}),e.strict=()=>e.clone({...e._zod.def,catchall:J2()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>tj(e,n),e.safeExtend=n=>nj(e,n),e.merge=n=>rj(e,n),e.pick=n=>QI(e,n),e.omit=n=>ej(e,n),e.partial=(...n)=>sj(Sw,e,n[0]),e.required=(...n)=>oj(Ew,e,n[0])});function ww(e,t){const n={type:"object",shape:e??{},...ie(t)};return new tz(n)}const nz=U("ZodUnion",(e,t)=>{jL.init(e,t),et.init(e,t),e._zod.processJSONSchema=(n,r,s)=>QF(e,n,r,s),e.options=t.options});function rz(e,t){return new nz({type:"union",options:e,...ie(t)})}const sz=U("ZodIntersection",(e,t)=>{LL.init(e,t),et.init(e,t),e._zod.processJSONSchema=(n,r,s)=>e2(e,n,r,s)});function oz(e,t){return new sz({type:"intersection",left:e,right:t})}const Rd=U("ZodEnum",(e,t)=>{FL.init(e,t),et.init(e,t),e._zod.processJSONSchema=(r,s,o)=>ZF(e,r,s),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,s)=>{const o={};for(const i of r)if(n.has(i))o[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Rd({...t,checks:[],...ie(s),entries:o})},e.exclude=(r,s)=>{const o={...t.entries};for(const i of r)if(n.has(i))delete o[i];else throw new Error(`Key ${i} not found in enum`);return new Rd({...t,checks:[],...ie(s),entries:o})}});function lh(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Rd({type:"enum",entries:n,...ie(t)})}const iz=U("ZodTransform",(e,t)=>{zL.init(e,t),et.init(e,t),e._zod.processJSONSchema=(n,r,s)=>YF(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new G_(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(ii(o,n.value,t));else{const i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(ii(i))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(o=>(n.value=o,n)):(n.value=s,n)}});function az(e){return new iz({type:"transform",transform:e})}const Sw=U("ZodOptional",(e,t)=>{fw.init(e,t),et.init(e,t),e._zod.processJSONSchema=(n,r,s)=>bw(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Og(e){return new Sw({type:"optional",innerType:e})}const cz=U("ZodExactOptional",(e,t)=>{$L.init(e,t),et.init(e,t),e._zod.processJSONSchema=(n,r,s)=>bw(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function lz(e){return new cz({type:"optional",innerType:e})}const uz=U("ZodNullable",(e,t)=>{VL.init(e,t),et.init(e,t),e._zod.processJSONSchema=(n,r,s)=>t2(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Tg(e){return new uz({type:"nullable",innerType:e})}const dz=U("ZodDefault",(e,t)=>{BL.init(e,t),et.init(e,t),e._zod.processJSONSchema=(n,r,s)=>r2(e,n,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fz(e,t){return new dz({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Q_(t)}})}const hz=U("ZodPrefault",(e,t)=>{UL.init(e,t),et.init(e,t),e._zod.processJSONSchema=(n,r,s)=>s2(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function pz(e,t){return new hz({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Q_(t)}})}const Ew=U("ZodNonOptional",(e,t)=>{WL.init(e,t),et.init(e,t),e._zod.processJSONSchema=(n,r,s)=>n2(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function mz(e,t){return new Ew({type:"nonoptional",innerType:e,...ie(t)})}const gz=U("ZodCatch",(e,t)=>{HL.init(e,t),et.init(e,t),e._zod.processJSONSchema=(n,r,s)=>o2(e,n,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yz(e,t){return new gz({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const bz=U("ZodPipe",(e,t)=>{qL.init(e,t),et.init(e,t),e._zod.processJSONSchema=(n,r,s)=>i2(e,n,r,s),e.in=t.in,e.out=t.out});function Mg(e,t){return new bz({type:"pipe",in:e,out:t})}const vz=U("ZodReadonly",(e,t)=>{KL.init(e,t),et.init(e,t),e._zod.processJSONSchema=(n,r,s)=>a2(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function xz(e){return new vz({type:"readonly",innerType:e})}const _z=U("ZodCustom",(e,t)=>{ZL.init(e,t),et.init(e,t),e._zod.processJSONSchema=(n,r,s)=>GF(e,n)});function wz(e,t={}){return zF(_z,e,t)}function Sz(e){return $F(e)}function js(e){return SF(_w,e)}function nt({className:e,type:t,...n}){return g.jsx("input",{type:t,"data-slot":"input",className:Se("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm"," focus-visible:ring-ring/50 focus-visible:ring-[1px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...n})}function Ag(e,[t,n]){return Math.min(n,Math.max(t,e))}function Ez(e){const t=kz(e),n=v.forwardRef((r,s)=>{const{children:o,...i}=r,a=v.Children.toArray(o),c=a.find(Rz);if(c){const l=c.props.children,u=a.map(d=>d===c?v.Children.count(l)>1?v.Children.only(null):v.isValidElement(l)?l.props.children:null:d);return g.jsx(t,{...i,ref:s,children:v.isValidElement(l)?v.cloneElement(l,void 0,u):null})}return g.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function kz(e){const t=v.forwardRef((n,r)=>{const{children:s,...o}=n;if(v.isValidElement(s)){const i=Oz(s),a=Pz(o,s.props);return s.type!==v.Fragment&&(a.ref=r?Yn(r,i):i),v.cloneElement(s,a)}return v.Children.count(s)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Cz=Symbol("radix.slottable");function Rz(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Cz}function Pz(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...a)=>{const c=o(...a);return s(...a),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function Oz(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function kw(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Cw=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Tz="VisuallyHidden",Mz=v.forwardRef((e,t)=>g.jsx(be.span,{...e,ref:t,style:{...Cw,...e.style}}));Mz.displayName=Tz;var Az=[" ","Enter","ArrowUp","ArrowDown"],Nz=[" ","Enter"],ss="Select",[vl,xl,Dz]=Ff(ss),[oo]=wr(ss,[Dz,ol]),_l=ol(),[Iz,kr]=oo(ss),[jz,Lz]=oo(ss),Rw=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:o,value:i,defaultValue:a,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:h,form:p}=e,m=_l(t),[y,b]=v.useState(null),[x,_]=v.useState(null),[w,S]=v.useState(!1),C=zf(l),[k,E]=Zs({prop:r,defaultProp:s??!1,onChange:o,caller:ss}),[P,O]=Zs({prop:i,defaultProp:a,onChange:c,caller:ss}),N=v.useRef(null),A=y?p||!!y.closest("form"):!0,[j,$]=v.useState(new Set),q=Array.from(j).map(D=>D.props.value).join(";");return g.jsx(e_,{...m,children:g.jsxs(Iz,{required:h,scope:t,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:_,valueNodeHasChildren:w,onValueNodeHasChildrenChange:S,contentId:Hn(),value:P,onValueChange:O,open:k,onOpenChange:E,dir:C,triggerPointerDownPosRef:N,disabled:f,children:[g.jsx(vl.Provider,{scope:t,children:g.jsx(jz,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(D=>{$(H=>new Set(H).add(D))},[]),onNativeOptionRemove:v.useCallback(D=>{$(H=>{const F=new Set(H);return F.delete(D),F})},[]),children:n})}),A?g.jsxs(Gw,{"aria-hidden":!0,required:h,tabIndex:-1,name:u,autoComplete:d,value:P,onChange:D=>O(D.target.value),disabled:f,form:p,children:[P===void 0?g.jsx("option",{value:""}):null,Array.from(j)]},q):null]})})};Rw.displayName=ss;var Pw="SelectTrigger",Ow=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,o=_l(n),i=kr(Pw,n),a=i.disabled||r,c=Pe(t,i.onTriggerChange),l=xl(n),u=v.useRef("touch"),[d,f,h]=Xw(m=>{const y=l().filter(_=>!_.disabled),b=y.find(_=>_.value===i.value),x=Jw(y,m,b);x!==void 0&&i.onValueChange(x.value)}),p=m=>{a||(i.onOpenChange(!0),h()),m&&(i.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return g.jsx(t_,{asChild:!0,...o,children:g.jsx(be.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Yw(i.value)?"":void 0,...s,ref:c,onClick:re(s.onClick,m=>{m.currentTarget.focus(),u.current!=="mouse"&&p(m)}),onPointerDown:re(s.onPointerDown,m=>{u.current=m.pointerType;const y=m.target;y.hasPointerCapture(m.pointerId)&&y.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(p(m),m.preventDefault())}),onKeyDown:re(s.onKeyDown,m=>{const y=d.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&f(m.key),!(y&&m.key===" ")&&Az.includes(m.key)&&(p(),m.preventDefault())})})})});Ow.displayName=Pw;var Tw="SelectValue",Mw=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:o,placeholder:i="",...a}=e,c=kr(Tw,n),{onValueNodeHasChildrenChange:l}=c,u=o!==void 0,d=Pe(t,c.onValueNodeChange);return vt(()=>{l(u)},[l,u]),g.jsx(be.span,{...a,ref:d,style:{pointerEvents:"none"},children:Yw(c.value)?g.jsx(g.Fragment,{children:i}):o})});Mw.displayName=Tw;var Fz="SelectIcon",Aw=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return g.jsx(be.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});Aw.displayName=Fz;var zz="SelectPortal",Nw=e=>g.jsx(il,{asChild:!0,...e});Nw.displayName=zz;var os="SelectContent",Dw=v.forwardRef((e,t)=>{const n=kr(os,e.__scopeSelect),[r,s]=v.useState();if(vt(()=>{s(new DocumentFragment)},[]),!n.open){const o=r;return o?Ic.createPortal(g.jsx(Iw,{scope:e.__scopeSelect,children:g.jsx(vl.Slot,{scope:e.__scopeSelect,children:g.jsx("div",{children:e.children})})}),o):null}return g.jsx(jw,{...e,ref:t})});Dw.displayName=os;var cn=10,[Iw,Cr]=oo(os),$z="SelectContentImpl",Vz=Ez("SelectContent.RemoveScroll"),jw=v.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:a,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:h,sticky:p,hideWhenDetached:m,avoidCollisions:y,...b}=e,x=kr(os,n),[_,w]=v.useState(null),[S,C]=v.useState(null),k=Pe(t,V=>w(V)),[E,P]=v.useState(null),[O,N]=v.useState(null),A=xl(n),[j,$]=v.useState(!1),q=v.useRef(!1);v.useEffect(()=>{if(_)return Gf(_)},[_]),$f();const D=v.useCallback(V=>{const[ee,...me]=A().map(ge=>ge.ref.current),[le]=me.slice(-1),fe=document.activeElement;for(const ge of V)if(ge===fe||(ge?.scrollIntoView({block:"nearest"}),ge===ee&&S&&(S.scrollTop=0),ge===le&&S&&(S.scrollTop=S.scrollHeight),ge?.focus(),document.activeElement!==fe))return},[A,S]),H=v.useCallback(()=>D([E,_]),[D,E,_]);v.useEffect(()=>{j&&H()},[j,H]);const{onOpenChange:F,triggerPointerDownPosRef:W}=x;v.useEffect(()=>{if(_){let V={x:0,y:0};const ee=le=>{V={x:Math.abs(Math.round(le.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(le.pageY)-(W.current?.y??0))}},me=le=>{V.x<=10&&V.y<=10?le.preventDefault():_.contains(le.target)||F(!1),document.removeEventListener("pointermove",ee),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",ee),document.addEventListener("pointerup",me,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ee),document.removeEventListener("pointerup",me,{capture:!0})}}},[_,F,W]),v.useEffect(()=>{const V=()=>F(!1);return window.addEventListener("blur",V),window.addEventListener("resize",V),()=>{window.removeEventListener("blur",V),window.removeEventListener("resize",V)}},[F]);const[se,I]=Xw(V=>{const ee=A().filter(fe=>!fe.disabled),me=ee.find(fe=>fe.ref.current===document.activeElement),le=Jw(ee,V,me);le&&setTimeout(()=>le.ref.current.focus())}),Y=v.useCallback((V,ee,me)=>{const le=!q.current&&!me;(x.value!==void 0&&x.value===ee||le)&&(P(V),le&&(q.current=!0))},[x.value]),K=v.useCallback(()=>_?.focus(),[_]),Z=v.useCallback((V,ee,me)=>{const le=!q.current&&!me;(x.value!==void 0&&x.value===ee||le)&&N(V)},[x.value]),oe=r==="popper"?Pd:Lw,ce=oe===Pd?{side:a,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:h,sticky:p,hideWhenDetached:m,avoidCollisions:y}:{};return g.jsx(Iw,{scope:n,content:_,viewport:S,onViewportChange:C,itemRefCallback:Y,selectedItem:E,onItemLeave:K,itemTextRefCallback:Z,focusSelectedItem:H,selectedItemText:O,position:r,isPositioned:j,searchRef:se,children:g.jsx(cl,{as:Vz,allowPinchZoom:!0,children:g.jsx(el,{asChild:!0,trapped:x.open,onMountAutoFocus:V=>{V.preventDefault()},onUnmountAutoFocus:re(s,V=>{x.trigger?.focus({preventScroll:!0}),V.preventDefault()}),children:g.jsx(Qc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:V=>V.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:g.jsx(oe,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:V=>V.preventDefault(),...b,...ce,onPlaced:()=>$(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:re(b.onKeyDown,V=>{const ee=V.ctrlKey||V.altKey||V.metaKey;if(V.key==="Tab"&&V.preventDefault(),!ee&&V.key.length===1&&I(V.key),["ArrowUp","ArrowDown","Home","End"].includes(V.key)){let le=A().filter(fe=>!fe.disabled).map(fe=>fe.ref.current);if(["ArrowUp","End"].includes(V.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(V.key)){const fe=V.target,ge=le.indexOf(fe);le=le.slice(ge+1)}setTimeout(()=>D(le)),V.preventDefault()}})})})})})})});jw.displayName=$z;var Bz="SelectItemAlignedPosition",Lw=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,o=kr(os,n),i=Cr(os,n),[a,c]=v.useState(null),[l,u]=v.useState(null),d=Pe(t,k=>u(k)),f=xl(n),h=v.useRef(!1),p=v.useRef(!0),{viewport:m,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=i,_=v.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&l&&m&&y&&b){const k=o.trigger.getBoundingClientRect(),E=l.getBoundingClientRect(),P=o.valueNode.getBoundingClientRect(),O=b.getBoundingClientRect();if(o.dir!=="rtl"){const fe=O.left-E.left,ge=P.left-fe,Ze=k.left-ge,_t=k.width+Ze,rn=Math.max(_t,E.width),qt=window.innerWidth-cn,st=Ag(ge,[cn,Math.max(cn,qt-rn)]);a.style.minWidth=_t+"px",a.style.left=st+"px"}else{const fe=E.right-O.right,ge=window.innerWidth-P.right-fe,Ze=window.innerWidth-k.right-ge,_t=k.width+Ze,rn=Math.max(_t,E.width),qt=window.innerWidth-cn,st=Ag(ge,[cn,Math.max(cn,qt-rn)]);a.style.minWidth=_t+"px",a.style.right=st+"px"}const N=f(),A=window.innerHeight-cn*2,j=m.scrollHeight,$=window.getComputedStyle(l),q=parseInt($.borderTopWidth,10),D=parseInt($.paddingTop,10),H=parseInt($.borderBottomWidth,10),F=parseInt($.paddingBottom,10),W=q+D+j+F+H,se=Math.min(y.offsetHeight*5,W),I=window.getComputedStyle(m),Y=parseInt(I.paddingTop,10),K=parseInt(I.paddingBottom,10),Z=k.top+k.height/2-cn,oe=A-Z,ce=y.offsetHeight/2,V=y.offsetTop+ce,ee=q+D+V,me=W-ee;if(ee<=Z){const fe=N.length>0&&y===N[N.length-1].ref.current;a.style.bottom="0px";const ge=l.clientHeight-m.offsetTop-m.offsetHeight,Ze=Math.max(oe,ce+(fe?K:0)+ge+H),_t=ee+Ze;a.style.height=_t+"px"}else{const fe=N.length>0&&y===N[0].ref.current;a.style.top="0px";const Ze=Math.max(Z,q+m.offsetTop+(fe?Y:0)+ce)+me;a.style.height=Ze+"px",m.scrollTop=ee-Z+m.offsetTop}a.style.margin=`${cn}px 0`,a.style.minHeight=se+"px",a.style.maxHeight=A+"px",r?.(),requestAnimationFrame(()=>h.current=!0)}},[f,o.trigger,o.valueNode,a,l,m,y,b,o.dir,r]);vt(()=>_(),[_]);const[w,S]=v.useState();vt(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]);const C=v.useCallback(k=>{k&&p.current===!0&&(_(),x?.(),p.current=!1)},[_,x]);return g.jsx(Wz,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:C,children:g.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:g.jsx(be.div,{...s,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Lw.displayName=Bz;var Uz="SelectPopperPosition",Pd=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=cn,...o}=e,i=_l(n);return g.jsx(n_,{...i,...o,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Pd.displayName=Uz;var[Wz,uh]=oo(os,{}),Od="SelectViewport",Fw=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,o=Cr(Od,n),i=uh(Od,n),a=Pe(t,o.onViewportChange),c=v.useRef(0);return g.jsxs(g.Fragment,{children:[g.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),g.jsx(vl.Slot,{scope:n,children:g.jsx(be.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:re(s.onScroll,l=>{const u=l.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:f}=i;if(f?.current&&d){const h=Math.abs(c.current-u.scrollTop);if(h>0){const p=window.innerHeight-cn*2,m=parseFloat(d.style.minHeight),y=parseFloat(d.style.height),b=Math.max(m,y);if(b<p){const x=b+h,_=Math.min(p,x),w=x-_;d.style.height=_+"px",d.style.bottom==="0px"&&(u.scrollTop=w>0?w:0,d.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});Fw.displayName=Od;var zw="SelectGroup",[Hz,qz]=oo(zw),Kz=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Hn();return g.jsx(Hz,{scope:n,id:s,children:g.jsx(be.div,{role:"group","aria-labelledby":s,...r,ref:t})})});Kz.displayName=zw;var $w="SelectLabel",Zz=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=qz($w,n);return g.jsx(be.div,{id:s.id,...r,ref:t})});Zz.displayName=$w;var Sc="SelectItem",[Gz,Vw]=oo(Sc),Bw=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:o,...i}=e,a=kr(Sc,n),c=Cr(Sc,n),l=a.value===r,[u,d]=v.useState(o??""),[f,h]=v.useState(!1),p=Pe(t,x=>c.itemRefCallback?.(x,r,s)),m=Hn(),y=v.useRef("touch"),b=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return g.jsx(Gz,{scope:n,value:r,disabled:s,textId:m,isSelected:l,onItemTextChange:v.useCallback(x=>{d(_=>_||(x?.textContent??"").trim())},[]),children:g.jsx(vl.ItemSlot,{scope:n,value:r,disabled:s,textValue:u,children:g.jsx(be.div,{role:"option","aria-labelledby":m,"data-highlighted":f?"":void 0,"aria-selected":l&&f,"data-state":l?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:p,onFocus:re(i.onFocus,()=>h(!0)),onBlur:re(i.onBlur,()=>h(!1)),onClick:re(i.onClick,()=>{y.current!=="mouse"&&b()}),onPointerUp:re(i.onPointerUp,()=>{y.current==="mouse"&&b()}),onPointerDown:re(i.onPointerDown,x=>{y.current=x.pointerType}),onPointerMove:re(i.onPointerMove,x=>{y.current=x.pointerType,s?c.onItemLeave?.():y.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:re(i.onPointerLeave,x=>{x.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:re(i.onKeyDown,x=>{c.searchRef?.current!==""&&x.key===" "||(Nz.includes(x.key)&&b(),x.key===" "&&x.preventDefault())})})})})});Bw.displayName=Sc;var To="SelectItemText",Uw=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...o}=e,i=kr(To,n),a=Cr(To,n),c=Vw(To,n),l=Lz(To,n),[u,d]=v.useState(null),f=Pe(t,b=>d(b),c.onItemTextChange,b=>a.itemTextRefCallback?.(b,c.value,c.disabled)),h=u?.textContent,p=v.useMemo(()=>g.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:m,onNativeOptionRemove:y}=l;return vt(()=>(m(p),()=>y(p)),[m,y,p]),g.jsxs(g.Fragment,{children:[g.jsx(be.span,{id:c.textId,...o,ref:f}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Ic.createPortal(o.children,i.valueNode):null]})});Uw.displayName=To;var Ww="SelectItemIndicator",Hw=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Vw(Ww,n).isSelected?g.jsx(be.span,{"aria-hidden":!0,...r,ref:t}):null});Hw.displayName=Ww;var Td="SelectScrollUpButton",qw=v.forwardRef((e,t)=>{const n=Cr(Td,e.__scopeSelect),r=uh(Td,e.__scopeSelect),[s,o]=v.useState(!1),i=Pe(t,r.onScrollButtonChange);return vt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const l=c.scrollTop>0;o(l)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?g.jsx(Zw,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});qw.displayName=Td;var Md="SelectScrollDownButton",Kw=v.forwardRef((e,t)=>{const n=Cr(Md,e.__scopeSelect),r=uh(Md,e.__scopeSelect),[s,o]=v.useState(!1),i=Pe(t,r.onScrollButtonChange);return vt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const l=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)<l;o(u)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?g.jsx(Zw,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});Kw.displayName=Md;var Zw=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,o=Cr("SelectScrollButton",n),i=v.useRef(null),a=xl(n),c=v.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),vt(()=>{a().find(u=>u.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[a]),g.jsx(be.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:re(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:re(s.onPointerMove,()=>{o.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:re(s.onPointerLeave,()=>{c()})})}),Yz="SelectSeparator",Xz=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return g.jsx(be.div,{"aria-hidden":!0,...r,ref:t})});Xz.displayName=Yz;var Ad="SelectArrow",Jz=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=_l(n),o=kr(Ad,n),i=Cr(Ad,n);return o.open&&i.position==="popper"?g.jsx(r_,{...s,...r,ref:t}):null});Jz.displayName=Ad;var Qz="SelectBubbleInput",Gw=v.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const s=v.useRef(null),o=Pe(r,s),i=kw(t);return v.useEffect(()=>{const a=s.current;if(!a)return;const c=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&u){const d=new Event("change",{bubbles:!0});u.call(a,t),a.dispatchEvent(d)}},[i,t]),g.jsx(be.select,{...n,style:{...Cw,...n.style},ref:o,defaultValue:t})});Gw.displayName=Qz;function Yw(e){return e===""||e===void 0}function Xw(e){const t=On(e),n=v.useRef(""),r=v.useRef(0),s=v.useCallback(i=>{const a=n.current+i;t(a),(function c(l){n.current=l,window.clearTimeout(r.current),l!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(a)},[t]),o=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,o]}function Jw(e,t,n){const s=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=e$(e,Math.max(o,0));s.length===1&&(i=i.filter(l=>l!==n));const c=i.find(l=>l.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function e$(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var t$=Rw,n$=Ow,r$=Mw,s$=Aw,o$=Nw,i$=Dw,a$=Fw,c$=Bw,l$=Uw,u$=Hw,d$=qw,f$=Kw;function Ls({...e}){return g.jsx(t$,{"data-slot":"select",...e})}function Fs({...e}){return g.jsx(r$,{"data-slot":"select-value",...e})}function zs({className:e,size:t="default",children:n,...r}){return g.jsxs(n$,{"data-slot":"select-trigger","data-size":t,className:Se("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,g.jsx(s$,{asChild:!0,children:g.jsx(vx,{className:"size-4 opacity-50"})})]})}function $s({className:e,children:t,position:n="popper",...r}){return g.jsx(o$,{children:g.jsxs(i$,{"data-slot":"select-content",className:Se("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[g.jsx(h$,{}),g.jsx(a$,{className:Se("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),g.jsx(p$,{})]})})}function Vs({className:e,children:t,...n}){return g.jsxs(c$,{"data-slot":"select-item",className:Se("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 ps-2 pe-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[g.jsx("span",{className:"absolute end-2 flex size-3.5 items-center justify-center",children:g.jsx(u$,{children:g.jsx(bx,{className:"size-4"})})}),g.jsx(l$,{children:t})]})}function h$({className:e,...t}){return g.jsx(d$,{"data-slot":"select-scroll-up-button",className:Se("flex cursor-default items-center justify-center py-1",e),...t,children:g.jsx(LM,{className:"size-4"})})}function p$({className:e,...t}){return g.jsx(f$,{"data-slot":"select-scroll-down-button",className:Se("flex cursor-default items-center justify-center py-1",e),...t,children:g.jsx(vx,{className:"size-4"})})}var m$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],g$=m$.reduce((e,t)=>{const n=Cx(`Primitive.${t}`),r=v.forwardRef((s,o)=>{const{asChild:i,...a}=s,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(c,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),y$="Label",Qw=v.forwardRef((e,t)=>g.jsx(g$.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Qw.displayName=y$;var b$=Qw;function e0({className:e,...t}){return g.jsx(b$,{"data-slot":"label",className:Se("flex items-center gap-2 text-sm mb-2 leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}const t0=pO,n0=v.createContext({}),Ne=({...e})=>g.jsx(n0.Provider,{value:{name:e.name},children:g.jsx(fO,{...e})}),dh=()=>{const e=v.useContext(n0),t=v.useContext(r0),{getFieldState:n}=hO(),r=Ev({name:e.name}),s=n(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:o}=t;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...s}},r0=v.createContext({});function De({className:e,...t}){const n=v.useId();return g.jsx(r0.Provider,{value:{id:n},children:g.jsx("div",{"data-slot":"form-item",className:Se("grid gap-2",e),...t})})}function Ie({className:e,children:t,required:n,...r}){const{error:s,formItemId:o}=dh();return g.jsxs(e0,{"data-slot":"form-label","data-error":!!s,className:e,htmlFor:o,...r,children:[t,n&&g.jsx("span",{className:"text-destructive",children:"*"})]})}function je({...e}){const{error:t,formItemId:n,formDescriptionId:r,formMessageId:s}=dh();return g.jsx(Lf,{"data-slot":"form-control",id:n,"aria-describedby":t?`${r} ${s}`:`${r}`,"aria-invalid":!!t,...e})}function Le({className:e,...t}){const{error:n,formMessageId:r}=dh(),s=n?String(n?.message??""):t.children;return s?g.jsx("p",{"data-slot":"form-message",id:r,className:Se("text-destructive text-sm",e),...t,children:s}):null}function v$(e){const t=x$(e),n=v.forwardRef((r,s)=>{const{children:o,...i}=r,a=v.Children.toArray(o),c=a.find(w$);if(c){const l=c.props.children,u=a.map(d=>d===c?v.Children.count(l)>1?v.Children.only(null):v.isValidElement(l)?l.props.children:null:d);return g.jsx(t,{...i,ref:s,children:v.isValidElement(l)?v.cloneElement(l,void 0,u):null})}return g.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function x$(e){const t=v.forwardRef((n,r)=>{const{children:s,...o}=n;if(v.isValidElement(s)){const i=E$(s),a=S$(o,s.props);return s.type!==v.Fragment&&(a.ref=r?Yn(r,i):i),v.cloneElement(s,a)}return v.Children.count(s)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _$=Symbol("radix.slottable");function w$(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_$}function S$(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...a)=>{const c=o(...a);return s(...a),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function E$(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var wl="Dialog",[s0]=wr(wl),[k$,yn]=s0(wl),o0=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,a=v.useRef(null),c=v.useRef(null),[l,u]=Zs({prop:r,defaultProp:s??!1,onChange:o,caller:wl});return g.jsx(k$,{scope:t,triggerRef:a,contentRef:c,contentId:Hn(),titleId:Hn(),descriptionId:Hn(),open:l,onOpenChange:u,onOpenToggle:v.useCallback(()=>u(d=>!d),[u]),modal:i,children:n})};o0.displayName=wl;var i0="DialogTrigger",C$=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yn(i0,n),o=Pe(t,s.triggerRef);return g.jsx(be.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":ph(s.open),...r,ref:o,onClick:re(e.onClick,s.onOpenToggle)})});C$.displayName=i0;var fh="DialogPortal",[R$,a0]=s0(fh,{forceMount:void 0}),c0=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,o=yn(fh,t);return g.jsx(R$,{scope:t,forceMount:n,children:v.Children.map(r,i=>g.jsx(Xn,{present:n||o.open,children:g.jsx(il,{asChild:!0,container:s,children:i})}))})};c0.displayName=fh;var Ec="DialogOverlay",l0=v.forwardRef((e,t)=>{const n=a0(Ec,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=yn(Ec,e.__scopeDialog);return o.modal?g.jsx(Xn,{present:r||o.open,children:g.jsx(O$,{...s,ref:t})}):null});l0.displayName=Ec;var P$=v$("DialogOverlay.RemoveScroll"),O$=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yn(Ec,n);return g.jsx(cl,{as:P$,allowPinchZoom:!0,shards:[s.contentRef],children:g.jsx(be.div,{"data-state":ph(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),is="DialogContent",u0=v.forwardRef((e,t)=>{const n=a0(is,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=yn(is,e.__scopeDialog);return g.jsx(Xn,{present:r||o.open,children:o.modal?g.jsx(T$,{...s,ref:t}):g.jsx(M$,{...s,ref:t})})});u0.displayName=is;var T$=v.forwardRef((e,t)=>{const n=yn(is,e.__scopeDialog),r=v.useRef(null),s=Pe(t,n.contentRef,r);return v.useEffect(()=>{const o=r.current;if(o)return Gf(o)},[]),g.jsx(d0,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:re(e.onCloseAutoFocus,o=>{o.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:re(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&o.preventDefault()}),onFocusOutside:re(e.onFocusOutside,o=>o.preventDefault())})}),M$=v.forwardRef((e,t)=>{const n=yn(is,e.__scopeDialog),r=v.useRef(!1),s=v.useRef(!1);return g.jsx(d0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(r.current||n.triggerRef.current?.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;n.triggerRef.current?.contains(i)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),d0=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=e,a=yn(is,n),c=v.useRef(null),l=Pe(t,c);return $f(),g.jsxs(g.Fragment,{children:[g.jsx(el,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:g.jsx(Qc,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":ph(a.open),...i,ref:l,onDismiss:()=>a.onOpenChange(!1)})}),g.jsxs(g.Fragment,{children:[g.jsx(A$,{titleId:a.titleId}),g.jsx(D$,{contentRef:c,descriptionId:a.descriptionId})]})]})}),hh="DialogTitle",f0=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yn(hh,n);return g.jsx(be.h2,{id:s.titleId,...r,ref:t})});f0.displayName=hh;var h0="DialogDescription",p0=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yn(h0,n);return g.jsx(be.p,{id:s.descriptionId,...r,ref:t})});p0.displayName=h0;var m0="DialogClose",g0=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yn(m0,n);return g.jsx(be.button,{type:"button",...r,ref:t,onClick:re(e.onClick,()=>s.onOpenChange(!1))})});g0.displayName=m0;function ph(e){return e?"open":"closed"}var y0="DialogTitleWarning",[GH,b0]=g1(y0,{contentName:is,titleName:hh,docsSlug:"dialog"}),A$=({titleId:e})=>{const t=b0(y0),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
100
+
101
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
102
+
103
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},N$="DialogDescriptionWarning",D$=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${b0(N$).contentName}}.`;return v.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},I$=o0,j$=c0,L$=l0,F$=u0,z$=f0,$$=p0,V$=g0;function v0({...e}){return g.jsx(I$,{"data-slot":"dialog",...e})}function B$({...e}){return g.jsx(j$,{"data-slot":"dialog-portal",...e})}function U$({className:e,...t}){return g.jsx(L$,{"data-slot":"dialog-overlay",className:Se("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function x0({className:e,children:t,showCloseButton:n=!0,...r}){return g.jsxs(B$,{"data-slot":"dialog-portal",children:[g.jsx(U$,{}),g.jsxs(F$,{"data-slot":"dialog-content",className:Se("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...r,children:[t,n&&g.jsxs(V$,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute end-4 top-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[g.jsx(a1,{}),g.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function _0({className:e,...t}){return g.jsx("div",{"data-slot":"dialog-header",className:Se("flex flex-col gap-2 text-center sm:text-start",e),...t})}function w0({className:e,...t}){return g.jsx("div",{"data-slot":"dialog-footer",className:Se("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function S0({className:e,...t}){return g.jsx(z$,{"data-slot":"dialog-title",className:Se("text-lg leading-none font-semibold",e),...t})}function E0({className:e,...t}){return g.jsx($$,{"data-slot":"dialog-description",className:Se("text-muted-foreground text-sm",e),...t})}const W$=ww({name:pt().min(1,"Name is required"),type:lh(["http","tcp","keyword","json_query","websocket","ping","dns","push","steam","docker"]),intervalSeconds:js().min(1,"Interval must be at least 1s"),timeoutMs:js().min(100,"Timeout must be at least 100ms"),url:pt().optional(),host:pt().optional(),port:js().optional(),method:pt().optional(),keyword:pt().optional(),jsonQuery:pt().optional(),expectedValue:pt().optional(),dnsRecordType:pt().optional()});function Nd({open:e,onOpenChange:t,monitor:n,onSubmit:r}){const s=!!n,[o,i]=v.useState(!1),a=Cf({resolver:vw(W$),defaultValues:{name:"",type:"http",intervalSeconds:20,timeoutMs:8e3,method:"GET",url:"",host:"",keyword:"",jsonQuery:"",expectedValue:""}});v.useEffect(()=>{e&&(n?a.reset({name:n.name,type:n.type,intervalSeconds:n.intervalSeconds,timeoutMs:n.timeoutMs,url:n.url??"",host:n.host??"",port:n.port,method:n.method??"GET",keyword:n.keyword??"",jsonQuery:n.jsonQuery??"",expectedValue:n.expectedValue??"",dnsRecordType:n.dnsRecordType??""}):a.reset({name:"",type:"http",intervalSeconds:20,timeoutMs:8e3,method:"GET",url:"",host:"",keyword:"",jsonQuery:"",expectedValue:""}))},[e,n,a]);const c=a.watch("type"),l=async u=>{i(!0);try{await r(u),t(!1)}catch(d){console.error(d)}finally{i(!1)}};return g.jsx(v0,{open:e,onOpenChange:t,children:g.jsxs(x0,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[g.jsxs(_0,{children:[g.jsx(S0,{children:s?"Edit Monitor":"New Monitor"}),g.jsx(E0,{children:s?"Update monitor configuration.":"Configure parameters for a new uptime monitor."})]}),g.jsx(t0,{...a,children:g.jsxs("form",{onSubmit:a.handleSubmit(l),className:"space-y-4",children:[g.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[g.jsx(Ne,{control:a.control,name:"name",render:({field:u})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Name"}),g.jsx(je,{children:g.jsx(nt,{placeholder:"My Website",...u})}),g.jsx(Le,{})]})}),g.jsx(Ne,{control:a.control,name:"type",render:({field:u})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Type"}),g.jsxs(Ls,{onValueChange:u.onChange,defaultValue:u.value,value:u.value,children:[g.jsx(je,{children:g.jsx(zs,{children:g.jsx(Fs,{placeholder:"Select type"})})}),g.jsx($s,{children:["http","tcp","keyword","json_query","websocket","ping","dns","push","steam","docker"].map(d=>g.jsx(Vs,{value:d,children:d.toUpperCase()},d))})]}),g.jsx(Le,{})]})}),g.jsx(Ne,{control:a.control,name:"intervalSeconds",render:({field:u})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Interval (s)"}),g.jsx(je,{children:g.jsx(nt,{type:"number",...u})}),g.jsx(Le,{})]})}),g.jsx(Ne,{control:a.control,name:"timeoutMs",render:({field:u})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Timeout (ms)"}),g.jsx(je,{children:g.jsx(nt,{type:"number",...u})}),g.jsx(Le,{})]})})]}),(c==="http"||c==="keyword"||c==="json_query"||c==="websocket")&&g.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[g.jsx(Ne,{control:a.control,name:"url",render:({field:u})=>g.jsxs(De,{className:"sm:col-span-2",children:[g.jsx(Ie,{children:"URL"}),g.jsx(je,{children:g.jsx(nt,{placeholder:"https://example.com",...u})}),g.jsx(Le,{})]})}),c!=="websocket"&&g.jsx(Ne,{control:a.control,name:"method",render:({field:u})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Method"}),g.jsxs(Ls,{onValueChange:u.onChange,defaultValue:u.value,value:u.value,children:[g.jsx(je,{children:g.jsx(zs,{children:g.jsx(Fs,{placeholder:"Select method"})})}),g.jsx($s,{children:["GET","POST","PUT","DELETE"].map(d=>g.jsx(Vs,{value:d,children:d},d))})]}),g.jsx(Le,{})]})})]}),(c==="tcp"||c==="ping"||c==="dns"||c==="steam")&&g.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[g.jsx(Ne,{control:a.control,name:"host",render:({field:u})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Host"}),g.jsx(je,{children:g.jsx(nt,{placeholder:"example.com",...u})}),g.jsx(Le,{})]})}),(c==="tcp"||c==="steam")&&g.jsx(Ne,{control:a.control,name:"port",render:({field:u})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Port"}),g.jsx(je,{children:g.jsx(nt,{type:"number",...u})}),g.jsx(Le,{})]})}),c==="dns"&&g.jsx(Ne,{control:a.control,name:"dnsRecordType",render:({field:u})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Record Type"}),g.jsxs(Ls,{onValueChange:u.onChange,defaultValue:u.value,value:u.value,children:[g.jsx(je,{children:g.jsx(zs,{children:g.jsx(Fs,{placeholder:"Select Record Type"})})}),g.jsx($s,{children:["A","AAAA","CNAME","TXT","MX","NS"].map(d=>g.jsx(Vs,{value:d,children:d},d))})]}),g.jsx(Le,{})]})})]}),c==="keyword"&&g.jsx(Ne,{control:a.control,name:"keyword",render:({field:u})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Keyword"}),g.jsx(je,{children:g.jsx(nt,{placeholder:"Search string...",...u})}),g.jsx(Le,{})]})}),c==="json_query"&&g.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[g.jsx(Ne,{control:a.control,name:"jsonQuery",render:({field:u})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"JSON Query (jq)"}),g.jsx(je,{children:g.jsx(nt,{placeholder:"$.data.status",...u})}),g.jsx(Le,{})]})}),g.jsx(Ne,{control:a.control,name:"expectedValue",render:({field:u})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Expected Value"}),g.jsx(je,{children:g.jsx(nt,{placeholder:"healthy",...u})}),g.jsx(Le,{})]})})]}),c==="push"&&g.jsx("div",{className:"rounded-lg border bg-muted p-4 text-sm text-muted-foreground",children:"Push monitors generate a token on create. You will see the Push URL in the monitor details after saving."}),g.jsxs(w0,{children:[g.jsx(gt,{type:"button",variant:"outline",onClick:()=>t(!1),disabled:o,children:"Cancel"}),g.jsxs(gt,{type:"submit",disabled:o,children:[o&&g.jsx(If,{className:"mr-2 h-4 w-4 animate-spin"}),s?"Update":"Create"]})]})]})})]})})}function k0({open:e,onOpenChange:t,monitor:n,onConfirm:r}){const[s,o]=T.useState(!1);async function i(){o(!0);try{await r(),t(!1)}catch(a){console.error(a)}finally{o(!1)}}return g.jsx(v0,{open:e,onOpenChange:t,children:g.jsxs(x0,{className:"sm:max-w-md",children:[g.jsxs(_0,{children:[g.jsx(S0,{children:"Delete Monitor"}),g.jsxs(E0,{children:["Are you sure you want to delete ",g.jsx("span",{className:"font-semibold text-foreground",children:n?.name}),"? This action cannot be undone and will delete all historical data for this monitor."]})]}),g.jsxs(w0,{children:[g.jsx(gt,{variant:"outline",onClick:()=>t(!1),disabled:s,children:"Cancel"}),g.jsxs(gt,{variant:"destructive",onClick:i,disabled:s,children:[s?g.jsx(If,{className:"mr-2 h-4 w-4 animate-spin"}):g.jsx(jf,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]})})}function H$(){const e=Hv(),t=ls(),{data:n,loading:r}=qv(k=>k.monitors),[s,o]=v.useState(""),[i,a]=v.useState(!1),[c,l]=v.useState(!1),[u,d]=v.useState(!1),[f,h]=v.useState(null);v.useEffect(()=>{e(Ur(60));const k=setInterval(()=>e(Ur(60)),3e4);return()=>clearInterval(k)},[e]);const p=v.useMemo(()=>{if(!s)return n;const k=s.toLowerCase();return n.filter(E=>E.monitor.name.toLowerCase().includes(k)||E.monitor.host?.toLowerCase().includes(k))},[n,s]),m=async k=>{try{await e(px(k)).unwrap(),Ee.success("Monitor created"),e(Ur(60))}catch(E){throw Ee.error(E||"Failed to create monitor"),E}},y=async k=>{if(f)try{await e(Df({id:f.id,data:k})).unwrap(),Ee.success("Monitor updated"),e(Ur(60))}catch(E){throw Ee.error(E||"Failed to update monitor"),E}},b=async()=>{if(f)try{await e(Nf(f.id)).unwrap(),Ee.success("Monitor deleted")}catch(k){throw Ee.error(k||"Failed to delete monitor"),k}},x=async k=>{try{await e(dc({id:k.id,paused:!k.isPaused})).unwrap(),Ee.success(k.isPaused?"Resumed":"Paused")}catch(E){Ee.error(E||"Failed to toggle pause")}},_=async k=>{Ee.info("Clone feature coming soon")},w=k=>{h(k),l(!0)},S=k=>{h(k),d(!0)},C=k=>{t({to:"/monitors/$id",params:{id:k.id}})};return g.jsxs("div",{className:"space-y-6",children:[g.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[g.jsxs("div",{children:[g.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Monitors"}),g.jsx("p",{className:"text-muted-foreground",children:"Manage your uptime monitors and status checks."})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs("div",{className:"relative w-full md:w-auto",children:[g.jsx(Ex,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),g.jsx(nt,{placeholder:"Search monitors...",value:s,onChange:k=>o(k.target.value),className:"pl-8 w-full md:w-[250px]"})]}),g.jsxs(gt,{onClick:()=>{h(null),a(!0)},children:[g.jsx(Mm,{className:"mr-2 h-4 w-4"})," Add Monitor"]})]})]}),r&&n.length===0?g.jsx("div",{className:"flex h-64 items-center justify-center",children:g.jsx(If,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):p.length===0?g.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center animate-in fade-in-50",children:[g.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:g.jsx(KM,{className:"h-6 w-6 text-muted-foreground"})}),g.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No monitors found"}),g.jsx("p",{className:"mb-4 mt-2 text-sm text-muted-foreground",children:s?"Try adjusting your search terms.":"Get started by adding your first monitor."}),!s&&g.jsxs(gt,{onClick:()=>a(!0),children:[g.jsx(Mm,{className:"mr-2 h-4 w-4"})," Add Monitor"]})]}):g.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:p.map(k=>g.jsx(HI,{summary:k,onEdit:w,onDelete:S,onPause:x,onClone:_,onDetails:C},k.monitor.id))}),g.jsx(Nd,{open:i,onOpenChange:a,onSubmit:m}),g.jsx(Nd,{open:c,onOpenChange:l,monitor:f,onSubmit:y}),g.jsx(k0,{open:u,onOpenChange:d,monitor:f,onConfirm:b})]})}function Rs({className:e,...t}){return g.jsx("div",{"data-slot":"card",className:Se("bg-card text-card-foreground flex flex-col gap-4 rounded-xl border py-6 shadow-sm",e),...t})}function Ps({className:e,...t}){return g.jsx("div",{"data-slot":"card-header",className:Se("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function Os({className:e,...t}){return g.jsx("div",{"data-slot":"card-title",className:Se("leading-none font-semibold",e),...t})}function C0({className:e,...t}){return g.jsx("div",{"data-slot":"card-description",className:Se("text-muted-foreground text-sm",e),...t})}function Ts({className:e,...t}){return g.jsx("div",{"data-slot":"card-content",className:Se("px-6",e),...t})}const q$=ww({name:pt().min(1,"Name is required"),type:lh(["http","tcp","keyword","json_query","websocket","ping","dns","push","steam","docker"]),intervalSeconds:js().min(1,"Interval must be at least 1s"),timeoutMs:js().min(100,"Timeout must be at least 100ms"),url:pt().optional(),host:pt().optional(),port:js().optional(),method:pt().optional(),keyword:pt().optional(),jsonQuery:pt().optional(),expectedValue:pt().optional(),dnsRecordType:pt().optional()});function Ng(){const e=ls(),n=pi({strict:!1})?.id,r=Cf({resolver:vw(q$),defaultValues:{name:"",type:"http",intervalSeconds:20,timeoutMs:8e3,method:"GET",url:"",host:"",keyword:"",jsonQuery:"",expectedValue:""}}),{reset:s,watch:o,control:i}=r;v.useEffect(()=>{n&&(async()=>{try{const u=(await Te.get("/monitors")).data.monitors.find(d=>d.id===n);u&&s({...u,intervalSeconds:u.intervalSeconds,timeoutMs:u.timeoutMs})}catch{Ee.error("Failed to load monitor")}})()},[n,s]);const a=o("type"),c=async l=>{try{const u={...l};n?(await Te.put(`/monitors/${n}`,u),Ee.success("Monitor updated")):(await Te.post("/monitors",u),Ee.success("Monitor created")),e({to:"/"})}catch(u){Ee.error(u?.response?.data?.detail??"Save failed")}};return g.jsxs("div",{className:"mx-auto max-w-3xl space-y-6",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(gt,{variant:"ghost",size:"icon",onClick:()=>e({to:"/"}),children:g.jsx(yx,{className:"h-4 w-4"})}),g.jsx("h2",{className:"text-xl font-semibold",children:n?"Edit Monitor":"New Monitor"})]}),g.jsxs(Rs,{children:[g.jsxs(Ps,{children:[g.jsx(Os,{children:"Monitor Configuration"}),g.jsx(C0,{children:"Configure the settings for your uptime monitor."})]}),g.jsx(Ts,{children:g.jsx(t0,{...r,children:g.jsxs("form",{onSubmit:r.handleSubmit(c),className:"space-y-6",children:[g.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[g.jsx(Ne,{control:i,name:"name",render:({field:l})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Name"}),g.jsx(je,{children:g.jsx(nt,{placeholder:"My Website",...l})}),g.jsx(Le,{})]})}),g.jsx(Ne,{control:i,name:"type",render:({field:l})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Type"}),g.jsxs(Ls,{onValueChange:l.onChange,defaultValue:l.value,value:l.value,children:[g.jsx(je,{children:g.jsx(zs,{children:g.jsx(Fs,{placeholder:"Select type"})})}),g.jsx($s,{children:["http","tcp","keyword","json_query","websocket","ping","dns","push","steam","docker"].map(u=>g.jsx(Vs,{value:u,children:u.toUpperCase()},u))})]}),g.jsx(Le,{})]})}),g.jsx(Ne,{control:i,name:"intervalSeconds",render:({field:l})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Interval (s)"}),g.jsx(je,{children:g.jsx(nt,{type:"number",...l})}),g.jsx(Le,{})]})}),g.jsx(Ne,{control:i,name:"timeoutMs",render:({field:l})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Timeout (ms)"}),g.jsx(je,{children:g.jsx(nt,{type:"number",...l})}),g.jsx(Le,{})]})})]}),(a==="http"||a==="keyword"||a==="json_query"||a==="websocket")&&g.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[g.jsx(Ne,{control:i,name:"url",render:({field:l})=>g.jsxs(De,{className:"sm:col-span-2",children:[g.jsx(Ie,{children:"URL"}),g.jsx(je,{children:g.jsx(nt,{placeholder:"https://example.com",...l})}),g.jsx(Le,{})]})}),a!=="websocket"&&g.jsx(Ne,{control:i,name:"method",render:({field:l})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Method"}),g.jsxs(Ls,{onValueChange:l.onChange,defaultValue:l.value,value:l.value,children:[g.jsx(je,{children:g.jsx(zs,{children:g.jsx(Fs,{placeholder:"Select method"})})}),g.jsx($s,{children:["GET","POST","PUT","DELETE"].map(u=>g.jsx(Vs,{value:u,children:u},u))})]}),g.jsx(Le,{})]})})]}),(a==="tcp"||a==="ping"||a==="dns"||a==="steam")&&g.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[g.jsx(Ne,{control:i,name:"host",render:({field:l})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Host"}),g.jsx(je,{children:g.jsx(nt,{placeholder:"example.com",...l})}),g.jsx(Le,{})]})}),(a==="tcp"||a==="steam")&&g.jsx(Ne,{control:i,name:"port",render:({field:l})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Port"}),g.jsx(je,{children:g.jsx(nt,{type:"number",...l})}),g.jsx(Le,{})]})}),a==="dns"&&g.jsx(Ne,{control:i,name:"dnsRecordType",render:({field:l})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Record Type"}),g.jsxs(Ls,{onValueChange:l.onChange,defaultValue:l.value,value:l.value,children:[g.jsx(je,{children:g.jsx(zs,{children:g.jsx(Fs,{placeholder:"Select Record Type"})})}),g.jsx($s,{children:["A","AAAA","CNAME","TXT","MX","NS"].map(u=>g.jsx(Vs,{value:u,children:u},u))})]}),g.jsx(Le,{})]})})]}),a==="keyword"&&g.jsx(Ne,{control:i,name:"keyword",render:({field:l})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Keyword"}),g.jsx(je,{children:g.jsx(nt,{placeholder:"Search string...",...l})}),g.jsx(Le,{})]})}),a==="json_query"&&g.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[g.jsx(Ne,{control:i,name:"jsonQuery",render:({field:l})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"JSON Query (jq)"}),g.jsx(je,{children:g.jsx(nt,{placeholder:"$.data.status",...l})}),g.jsx(Le,{})]})}),g.jsx(Ne,{control:i,name:"expectedValue",render:({field:l})=>g.jsxs(De,{children:[g.jsx(Ie,{children:"Expected Value"}),g.jsx(je,{children:g.jsx(nt,{placeholder:"healthy",...l})}),g.jsx(Le,{})]})})]}),a==="push"&&g.jsx("div",{className:"rounded-lg border bg-muted p-4 text-sm text-muted-foreground",children:"Push monitors generate a token on create. You will see the Push URL in the monitor details after saving."}),g.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[g.jsx(gt,{type:"button",variant:"outline",onClick:()=>e({to:"/"}),children:"Cancel"}),g.jsx(gt,{type:"submit",disabled:r.formState.isSubmitting,children:r.formState.isSubmitting?"Saving...":"Save Monitor"})]})]})})})]})]})}const Mn=Object.create(null);Mn.open="0";Mn.close="1";Mn.ping="2";Mn.pong="3";Mn.message="4";Mn.upgrade="5";Mn.noop="6";const La=Object.create(null);Object.keys(Mn).forEach(e=>{La[Mn[e]]=e});const Dd={type:"error",data:"parser error"},R0=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",P0=typeof ArrayBuffer=="function",O0=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,mh=({type:e,data:t},n,r)=>R0&&t instanceof Blob?n?r(t):Dg(t,r):P0&&(t instanceof ArrayBuffer||O0(t))?n?r(t):Dg(new Blob([t]),r):r(Mn[e]+(t||"")),Dg=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function Ig(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let _u;function K$(e,t){if(R0&&e.data instanceof Blob)return e.data.arrayBuffer().then(Ig).then(t);if(P0&&(e.data instanceof ArrayBuffer||O0(e.data)))return t(Ig(e.data));mh(e,!1,n=>{_u||(_u=new TextEncoder),t(_u.encode(n))})}const jg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Mo=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<jg.length;e++)Mo[jg.charCodeAt(e)]=e;const Z$=e=>{let t=e.length*.75,n=e.length,r,s=0,o,i,a,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const l=new ArrayBuffer(t),u=new Uint8Array(l);for(r=0;r<n;r+=4)o=Mo[e.charCodeAt(r)],i=Mo[e.charCodeAt(r+1)],a=Mo[e.charCodeAt(r+2)],c=Mo[e.charCodeAt(r+3)],u[s++]=o<<2|i>>4,u[s++]=(i&15)<<4|a>>2,u[s++]=(a&3)<<6|c&63;return l},G$=typeof ArrayBuffer=="function",gh=(e,t)=>{if(typeof e!="string")return{type:"message",data:T0(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:Y$(e.substring(1),t)}:La[n]?e.length>1?{type:La[n],data:e.substring(1)}:{type:La[n]}:Dd},Y$=(e,t)=>{if(G$){const n=Z$(e);return T0(n,t)}else return{base64:!0,data:e}},T0=(e,t)=>t==="blob"?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,M0="",X$=(e,t)=>{const n=e.length,r=new Array(n);let s=0;e.forEach((o,i)=>{mh(o,!1,a=>{r[i]=a,++s===n&&t(r.join(M0))})})},J$=(e,t)=>{const n=e.split(M0),r=[];for(let s=0;s<n.length;s++){const o=gh(n[s],t);if(r.push(o),o.type==="error")break}return r};function Q$(){return new TransformStream({transform(e,t){K$(e,n=>{const r=n.length;let s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);const o=new DataView(s.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{s=new Uint8Array(9);const o=new DataView(s.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(s[0]|=128),t.enqueue(s),t.enqueue(n)})}})}let wu;function ca(e){return e.reduce((t,n)=>t+n.length,0)}function la(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let s=0;s<t;s++)n[s]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function eV(e,t){wu||(wu=new TextDecoder);const n=[];let r=0,s=-1,o=!1;return new TransformStream({transform(i,a){for(n.push(i);;){if(r===0){if(ca(n)<1)break;const c=la(n,1);o=(c[0]&128)===128,s=c[0]&127,s<126?r=3:s===126?r=1:r=2}else if(r===1){if(ca(n)<2)break;const c=la(n,2);s=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(ca(n)<8)break;const c=la(n,8),l=new DataView(c.buffer,c.byteOffset,c.length),u=l.getUint32(0);if(u>Math.pow(2,21)-1){a.enqueue(Dd);break}s=u*Math.pow(2,32)+l.getUint32(4),r=3}else{if(ca(n)<s)break;const c=la(n,s);a.enqueue(gh(o?c:wu.decode(c),t)),r=0}if(s===0||s>e){a.enqueue(Dd);break}}}})}const A0=4;function Xe(e){if(e)return tV(e)}function tV(e){for(var t in Xe.prototype)e[t]=Xe.prototype[t];return e}Xe.prototype.on=Xe.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Xe.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Xe.prototype.off=Xe.prototype.removeListener=Xe.prototype.removeAllListeners=Xe.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,s=0;s<n.length;s++)if(r=n[s],r===t||r.fn===t){n.splice(s,1);break}return n.length===0&&delete this._callbacks["$"+e],this};Xe.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,s=n.length;r<s;++r)n[r].apply(this,t)}return this};Xe.prototype.emitReserved=Xe.prototype.emit;Xe.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};Xe.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Sl=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Xt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),nV="arraybuffer";function N0(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const rV=Xt.setTimeout,sV=Xt.clearTimeout;function El(e,t){t.useNativeTimers?(e.setTimeoutFn=rV.bind(Xt),e.clearTimeoutFn=sV.bind(Xt)):(e.setTimeoutFn=Xt.setTimeout.bind(Xt),e.clearTimeoutFn=Xt.clearTimeout.bind(Xt))}const oV=1.33;function iV(e){return typeof e=="string"?aV(e):Math.ceil((e.byteLength||e.size)*oV)}function aV(e){let t=0,n=0;for(let r=0,s=e.length;r<s;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function D0(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function cV(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function lV(e){let t={},n=e.split("&");for(let r=0,s=n.length;r<s;r++){let o=n[r].split("=");t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return t}class uV extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class yh extends Xe{constructor(t){super(),this.writable=!1,El(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,r){return super.emitReserved("error",new uV(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=gh(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=cV(t);return n.length?"?"+n:""}}class dV extends yh{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};J$(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,X$(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=D0()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let I0=!1;try{I0=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const fV=I0;function hV(){}class pV extends dV{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(s,o)=>{this.onError("xhr post error",s,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class Cn extends Xe{constructor(t,n,r){super(),this.createRequest=t,El(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const n=N0(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let s in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(s)&&r.setRequestHeader(s,this._opts.extraHeaders[s])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var s;r.readyState===3&&((s=this._opts.cookieJar)===null||s===void 0||s.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(s){this.setTimeoutFn(()=>{this._onError(s)},0);return}typeof document<"u"&&(this._index=Cn.requestsCount++,Cn.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=hV,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Cn.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Cn.requestsCount=0;Cn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Lg);else if(typeof addEventListener=="function"){const e="onpagehide"in Xt?"pagehide":"unload";addEventListener(e,Lg,!1)}}function Lg(){for(let e in Cn.requests)Cn.requests.hasOwnProperty(e)&&Cn.requests[e].abort()}const mV=(function(){const e=j0({xdomain:!1});return e&&e.responseType!==null})();class gV extends pV{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=mV&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Cn(j0,this.uri(),t)}}function j0(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||fV))return new XMLHttpRequest}catch{}if(!t)try{return new Xt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const L0=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class yV extends yh{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=L0?{}:N0(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],s=n===t.length-1;mh(r,this.supportsBinary,o=>{try{this.doWrite(r,o)}catch{}s&&Sl(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=D0()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const Su=Xt.WebSocket||Xt.MozWebSocket;class bV extends yV{createSocket(t,n,r){return L0?new Su(t,n,r):n?new Su(t,n):new Su(t)}doWrite(t,n){this.ws.send(n)}}class vV extends yh{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=eV(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),s=Q$();s.readable.pipeTo(t.writable),this._writer=s.writable.getWriter();const o=()=>{r.read().then(({done:a,value:c})=>{a||(this.onPacket(c),o())}).catch(a=>{})};o();const i={type:"open"};this.query.sid&&(i.data=`{"sid":"${this.query.sid}"}`),this._writer.write(i).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],s=n===t.length-1;this._writer.write(r).then(()=>{s&&Sl(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const xV={websocket:bV,webtransport:vV,polling:gV},_V=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,wV=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Id(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let s=_V.exec(e||""),o={},i=14;for(;i--;)o[wV[i]]=s[i]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=SV(o,o.path),o.queryKey=EV(o,o.query),o}function SV(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function EV(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,o){s&&(n[s]=o)}),n}const jd=typeof addEventListener=="function"&&typeof removeEventListener=="function",Fa=[];jd&&addEventListener("offline",()=>{Fa.forEach(e=>e())},!1);class fr extends Xe{constructor(t,n){if(super(),this.binaryType=nV,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const r=Id(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=Id(n.host).host);El(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const s=r.prototype.name;this.transports.push(s),this._transportsByName[s]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=lV(this.opts.query)),jd&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Fa.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=A0,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&fr.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",fr.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const s=this.writeBuffer[r].data;if(s&&(n+=iV(s)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Sl(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,s){if(typeof n=="function"&&(s=n,n=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),s&&this.once("flush",s),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(fr.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),jd&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Fa.indexOf(this._offlineEventListener);r!==-1&&Fa.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}fr.protocol=A0;class kV extends fr{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),r=!1;fr.priorWebsocketSuccess=!1;const s=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",d=>{if(!r)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;fr.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(u(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const f=new Error("probe error");f.transport=n.name,this.emitReserved("upgradeError",f)}}))};function o(){r||(r=!0,u(),n.close(),n=null)}const i=d=>{const f=new Error("probe error: "+d);f.transport=n.name,o(),this.emitReserved("upgradeError",f)};function a(){i("transport closed")}function c(){i("socket closed")}function l(d){n&&d.name!==n.name&&o()}const u=()=>{n.removeListener("open",s),n.removeListener("error",i),n.removeListener("close",a),this.off("close",c),this.off("upgrading",l)};n.once("open",s),n.once("error",i),n.once("close",a),this.once("close",c),this.once("upgrading",l),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let r=0;r<t.length;r++)~this.transports.indexOf(t[r])&&n.push(t[r]);return n}}let CV=class extends kV{constructor(t,n={}){const r=typeof t=="object"?t:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(s=>xV[s]).filter(s=>!!s)),super(t,r)}};function RV(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=Id(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+t,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}const PV=typeof ArrayBuffer=="function",OV=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,F0=Object.prototype.toString,TV=typeof Blob=="function"||typeof Blob<"u"&&F0.call(Blob)==="[object BlobConstructor]",MV=typeof File=="function"||typeof File<"u"&&F0.call(File)==="[object FileConstructor]";function bh(e){return PV&&(e instanceof ArrayBuffer||OV(e))||TV&&e instanceof Blob||MV&&e instanceof File}function za(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(za(e[n]))return!0;return!1}if(bh(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return za(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&za(e[n]))return!0;return!1}function AV(e){const t=[],n=e.data,r=e;return r.data=Ld(n,t),r.attachments=t.length,{packet:r,buffers:t}}function Ld(e,t){if(!e)return e;if(bh(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=Ld(e[r],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=Ld(e[r],t));return n}return e}function NV(e,t){return e.data=Fd(e.data,t),delete e.attachments,e}function Fd(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Fd(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Fd(e[n],t));return e}const DV=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var _e;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(_e||(_e={}));class IV{constructor(t){this.replacer=t}encode(t){return(t.type===_e.EVENT||t.type===_e.ACK)&&za(t)?this.encodeAsBinary({type:t.type===_e.EVENT?_e.BINARY_EVENT:_e.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===_e.BINARY_EVENT||t.type===_e.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=AV(t),r=this.encodeAsString(n.packet),s=n.buffers;return s.unshift(r),s}}class vh extends Xe{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const r=n.type===_e.BINARY_EVENT;r||n.type===_e.BINARY_ACK?(n.type=r?_e.EVENT:_e.ACK,this.reconstructor=new jV(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(bh(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const r={type:Number(t.charAt(0))};if(_e[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===_e.BINARY_EVENT||r.type===_e.BINARY_ACK){const o=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const i=t.substring(o,n);if(i!=Number(i)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(i)}if(t.charAt(n+1)==="/"){const o=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););r.nsp=t.substring(o,n)}else r.nsp="/";const s=t.charAt(n+1);if(s!==""&&Number(s)==s){const o=n+1;for(;++n;){const i=t.charAt(n);if(i==null||Number(i)!=i){--n;break}if(n===t.length)break}r.id=Number(t.substring(o,n+1))}if(t.charAt(++n)){const o=this.tryParse(t.substr(n));if(vh.isPayloadValid(r.type,o))r.data=o;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case _e.CONNECT:return Fg(n);case _e.DISCONNECT:return n===void 0;case _e.CONNECT_ERROR:return typeof n=="string"||Fg(n);case _e.EVENT:case _e.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&DV.indexOf(n[0])===-1);case _e.ACK:case _e.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class jV{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=NV(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Fg(e){return Object.prototype.toString.call(e)==="[object Object]"}const LV=Object.freeze(Object.defineProperty({__proto__:null,Decoder:vh,Encoder:IV,get PacketType(){return _e}},Symbol.toStringTag,{value:"Module"}));function ln(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const FV=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class z0 extends Xe{constructor(t,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[ln(t,"open",this.onopen.bind(this)),ln(t,"packet",this.onpacket.bind(this)),ln(t,"error",this.onerror.bind(this)),ln(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var r,s,o;if(FV.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const i={type:_e.EVENT,data:n};if(i.options={},i.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const u=this.ids++,d=n.pop();this._registerAckCallback(u,d),i.id=u}const a=(s=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||s===void 0?void 0:s.writable,c=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!a||(c?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(t,n){var r;const s=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(s===void 0){this.acks[t]=n;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===t&&this.sendBuffer.splice(a,1);n.call(this,new Error("operation has timed out"))},s),i=(...a)=>{this.io.clearTimeoutFn(o),n.apply(this,a)};i.withError=!0,this.acks[t]=i}emitWithAck(t,...n){return new Promise((r,s)=>{const o=(i,a)=>i?s(i):r(a);o.withError=!0,n.push(o),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((s,...o)=>(this._queue[0],s!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(s)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:_e.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case _e.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case _e.EVENT:case _e.BINARY_EVENT:this.onevent(t);break;case _e.ACK:case _e.BINARY_ACK:this.onack(t);break;case _e.DISCONNECT:this.ondisconnect();break;case _e.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...s){r||(r=!0,n.packet({type:_e.ACK,id:t,data:s}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:_e.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,t.data)}}}function io(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}io.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0};io.prototype.reset=function(){this.attempts=0};io.prototype.setMin=function(e){this.ms=e};io.prototype.setMax=function(e){this.max=e};io.prototype.setJitter=function(e){this.jitter=e};class zd extends Xe{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,El(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new io({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const s=n.parser||LV;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new CV(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const s=ln(n,"open",function(){r.onopen(),t&&t()}),o=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},i=ln(n,"error",o);if(this._timeout!==!1){const a=this._timeout,c=this.setTimeoutFn(()=>{s(),o(new Error("timeout")),n.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(s),this.subs.push(i),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(ln(t,"ping",this.onping.bind(this)),ln(t,"data",this.ondata.bind(this)),ln(t,"error",this.onerror.bind(this)),ln(t,"close",this.onclose.bind(this)),ln(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){Sl(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new z0(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;r<n.length;r++)this.engine.write(n[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(s=>{s?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",s)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const xo={};function $a(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=RV(e,t.path||"/socket.io"),r=n.source,s=n.id,o=n.path,i=xo[s]&&o in xo[s].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||i;let c;return a?c=new zd(r,t):(xo[s]||(xo[s]=new zd(r,t)),c=xo[s]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign($a,{Manager:zd,Socket:z0,io:$a,connect:$a});function Pi(e){return e+.5|0}const ir=(e,t,n)=>Math.max(Math.min(e,n),t);function Ao(e){return ir(Pi(e*2.55),0,255)}function hr(e){return ir(Pi(e*255),0,255)}function $n(e){return ir(Pi(e/2.55)/100,0,1)}function zg(e){return ir(Pi(e*100),0,100)}const Zt={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},$d=[..."0123456789ABCDEF"],zV=e=>$d[e&15],$V=e=>$d[(e&240)>>4]+$d[e&15],ua=e=>(e&240)>>4===(e&15),VV=e=>ua(e.r)&&ua(e.g)&&ua(e.b)&&ua(e.a);function BV(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&Zt[e[1]]*17,g:255&Zt[e[2]]*17,b:255&Zt[e[3]]*17,a:t===5?Zt[e[4]]*17:255}:(t===7||t===9)&&(n={r:Zt[e[1]]<<4|Zt[e[2]],g:Zt[e[3]]<<4|Zt[e[4]],b:Zt[e[5]]<<4|Zt[e[6]],a:t===9?Zt[e[7]]<<4|Zt[e[8]]:255})),n}const UV=(e,t)=>e<255?t(e):"";function WV(e){var t=VV(e)?zV:$V;return e?"#"+t(e.r)+t(e.g)+t(e.b)+UV(e.a,t):void 0}const HV=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function $0(e,t,n){const r=t*Math.min(n,1-n),s=(o,i=(o+e/30)%12)=>n-r*Math.max(Math.min(i-3,9-i,1),-1);return[s(0),s(8),s(4)]}function qV(e,t,n){const r=(s,o=(s+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[r(5),r(3),r(1)]}function KV(e,t,n){const r=$0(e,1,.5);let s;for(t+n>1&&(s=1/(t+n),t*=s,n*=s),s=0;s<3;s++)r[s]*=1-t-n,r[s]+=t;return r}function ZV(e,t,n,r,s){return e===s?(t-n)/r+(t<n?6:0):t===s?(n-e)/r+2:(e-t)/r+4}function xh(e){const n=e.r/255,r=e.g/255,s=e.b/255,o=Math.max(n,r,s),i=Math.min(n,r,s),a=(o+i)/2;let c,l,u;return o!==i&&(u=o-i,l=a>.5?u/(2-o-i):u/(o+i),c=ZV(n,r,s,u,o),c=c*60+.5),[c|0,l||0,a]}function _h(e,t,n,r){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,r)).map(hr)}function wh(e,t,n){return _h($0,e,t,n)}function GV(e,t,n){return _h(KV,e,t,n)}function YV(e,t,n){return _h(qV,e,t,n)}function V0(e){return(e%360+360)%360}function XV(e){const t=HV.exec(e);let n=255,r;if(!t)return;t[5]!==r&&(n=t[6]?Ao(+t[5]):hr(+t[5]));const s=V0(+t[2]),o=+t[3]/100,i=+t[4]/100;return t[1]==="hwb"?r=GV(s,o,i):t[1]==="hsv"?r=YV(s,o,i):r=wh(s,o,i),{r:r[0],g:r[1],b:r[2],a:n}}function JV(e,t){var n=xh(e);n[0]=V0(n[0]+t),n=wh(n),e.r=n[0],e.g=n[1],e.b=n[2]}function QV(e){if(!e)return;const t=xh(e),n=t[0],r=zg(t[1]),s=zg(t[2]);return e.a<255?`hsla(${n}, ${r}%, ${s}%, ${$n(e.a)})`:`hsl(${n}, ${r}%, ${s}%)`}const $g={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"},Vg={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 eB(){const e={},t=Object.keys(Vg),n=Object.keys($g);let r,s,o,i,a;for(r=0;r<t.length;r++){for(i=a=t[r],s=0;s<n.length;s++)o=n[s],a=a.replace(o,$g[o]);o=parseInt(Vg[i],16),e[a]=[o>>16&255,o>>8&255,o&255]}return e}let da;function tB(e){da||(da=eB(),da.transparent=[0,0,0,0]);const t=da[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const nB=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function rB(e){const t=nB.exec(e);let n=255,r,s,o;if(t){if(t[7]!==r){const i=+t[7];n=t[8]?Ao(i):ir(i*255,0,255)}return r=+t[1],s=+t[3],o=+t[5],r=255&(t[2]?Ao(r):ir(r,0,255)),s=255&(t[4]?Ao(s):ir(s,0,255)),o=255&(t[6]?Ao(o):ir(o,0,255)),{r,g:s,b:o,a:n}}}function sB(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${$n(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const Eu=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,_s=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function oB(e,t,n){const r=_s($n(e.r)),s=_s($n(e.g)),o=_s($n(e.b));return{r:hr(Eu(r+n*(_s($n(t.r))-r))),g:hr(Eu(s+n*(_s($n(t.g))-s))),b:hr(Eu(o+n*(_s($n(t.b))-o))),a:e.a+n*(t.a-e.a)}}function fa(e,t,n){if(e){let r=xh(e);r[t]=Math.max(0,Math.min(r[t]+r[t]*n,t===0?360:1)),r=wh(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function B0(e,t){return e&&Object.assign(t||{},e)}function Bg(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=hr(e[3]))):(t=B0(e,{r:0,g:0,b:0,a:1}),t.a=hr(t.a)),t}function iB(e){return e.charAt(0)==="r"?rB(e):XV(e)}class ai{constructor(t){if(t instanceof ai)return t;const n=typeof t;let r;n==="object"?r=Bg(t):n==="string"&&(r=BV(t)||tB(t)||iB(t)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var t=B0(this._rgb);return t&&(t.a=$n(t.a)),t}set rgb(t){this._rgb=Bg(t)}rgbString(){return this._valid?sB(this._rgb):void 0}hexString(){return this._valid?WV(this._rgb):void 0}hslString(){return this._valid?QV(this._rgb):void 0}mix(t,n){if(t){const r=this.rgb,s=t.rgb;let o;const i=n===o?.5:n,a=2*i-1,c=r.a-s.a,l=((a*c===-1?a:(a+c)/(1+a*c))+1)/2;o=1-l,r.r=255&l*r.r+o*s.r+.5,r.g=255&l*r.g+o*s.g+.5,r.b=255&l*r.b+o*s.b+.5,r.a=i*r.a+(1-i)*s.a,this.rgb=r}return this}interpolate(t,n){return t&&(this._rgb=oB(this._rgb,t._rgb,n)),this}clone(){return new ai(this.rgb)}alpha(t){return this._rgb.a=hr(t),this}clearer(t){const n=this._rgb;return n.a*=1-t,this}greyscale(){const t=this._rgb,n=Pi(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){const n=this._rgb;return n.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return fa(this._rgb,2,t),this}darken(t){return fa(this._rgb,2,-t),this}saturate(t){return fa(this._rgb,1,t),this}desaturate(t){return fa(this._rgb,1,-t),this}rotate(t){return JV(this._rgb,t),this}}function In(){}const aB=(()=>{let e=0;return()=>e++})();function ye(e){return e==null}function ze(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function xe(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function We(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function Ft(e,t){return We(e)?e:t}function de(e,t){return typeof e>"u"?t:e}const cB=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100:+e/t,U0=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function Me(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function Ce(e,t,n,r){let s,o,i;if(ze(e))for(o=e.length,s=0;s<o;s++)t.call(n,e[s],s);else if(xe(e))for(i=Object.keys(e),o=i.length,s=0;s<o;s++)t.call(n,e[i[s]],i[s])}function kc(e,t){let n,r,s,o;if(!e||!t||e.length!==t.length)return!1;for(n=0,r=e.length;n<r;++n)if(s=e[n],o=t[n],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function Cc(e){if(ze(e))return e.map(Cc);if(xe(e)){const t=Object.create(null),n=Object.keys(e),r=n.length;let s=0;for(;s<r;++s)t[n[s]]=Cc(e[n[s]]);return t}return e}function W0(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function lB(e,t,n,r){if(!W0(e))return;const s=t[e],o=n[e];xe(s)&&xe(o)?ci(s,o,r):t[e]=Cc(o)}function ci(e,t,n){const r=ze(t)?t:[t],s=r.length;if(!xe(e))return e;n=n||{};const o=n.merger||lB;let i;for(let a=0;a<s;++a){if(i=r[a],!xe(i))continue;const c=Object.keys(i);for(let l=0,u=c.length;l<u;++l)o(c[l],e,i,n)}return e}function Vo(e,t){return ci(e,t,{merger:uB})}function uB(e,t,n){if(!W0(e))return;const r=t[e],s=n[e];xe(r)&&xe(s)?Vo(r,s):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=Cc(s))}const Ug={"":e=>e,x:e=>e.x,y:e=>e.y};function dB(e){const t=e.split("."),n=[];let r="";for(const s of t)r+=s,r.endsWith("\\")?r=r.slice(0,-1)+".":(n.push(r),r="");return n}function fB(e){const t=dB(e);return n=>{for(const r of t){if(r==="")break;n=n&&n[r]}return n}}function br(e,t){return(Ug[t]||(Ug[t]=fB(t)))(e)}function Sh(e){return e.charAt(0).toUpperCase()+e.slice(1)}const li=e=>typeof e<"u",vr=e=>typeof e=="function",Wg=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function hB(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const we=Math.PI,Ae=2*we,pB=Ae+we,Rc=Number.POSITIVE_INFINITY,mB=we/180,He=we/2,Mr=we/4,Hg=we*2/3,ar=Math.log10,Rn=Math.sign;function Bo(e,t,n){return Math.abs(e-t)<n}function qg(e){const t=Math.round(e);e=Bo(e,t,e/1e3)?t:e;const n=Math.pow(10,Math.floor(ar(e))),r=e/n;return(r<=1?1:r<=2?2:r<=5?5:10)*n}function gB(e){const t=[],n=Math.sqrt(e);let r;for(r=1;r<n;r++)e%r===0&&(t.push(r),t.push(e/r));return n===(n|0)&&t.push(n),t.sort((s,o)=>s-o).pop(),t}function yB(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function Ys(e){return!yB(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function bB(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function H0(e,t,n){let r,s,o;for(r=0,s=e.length;r<s;r++)o=e[r][n],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function fn(e){return e*(we/180)}function Eh(e){return e*(180/we)}function Kg(e){if(!We(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function q0(e,t){const n=t.x-e.x,r=t.y-e.y,s=Math.sqrt(n*n+r*r);let o=Math.atan2(r,n);return o<-.5*we&&(o+=Ae),{angle:o,distance:s}}function Vd(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function vB(e,t){return(e-t+pB)%Ae-we}function mt(e){return(e%Ae+Ae)%Ae}function ui(e,t,n,r){const s=mt(e),o=mt(t),i=mt(n),a=mt(o-s),c=mt(i-s),l=mt(s-o),u=mt(s-i);return s===o||s===i||r&&o===i||a>c&&l<u}function at(e,t,n){return Math.max(t,Math.min(n,e))}function xB(e){return at(e,-32768,32767)}function Bn(e,t,n,r=1e-6){return e>=Math.min(t,n)-r&&e<=Math.max(t,n)+r}function kh(e,t,n){n=n||(i=>e[i]<t);let r=e.length-1,s=0,o;for(;r-s>1;)o=s+r>>1,n(o)?s=o:r=o;return{lo:s,hi:r}}const Un=(e,t,n,r)=>kh(e,n,r?s=>{const o=e[s][t];return o<n||o===n&&e[s+1][t]===n}:s=>e[s][t]<n),_B=(e,t,n)=>kh(e,n,r=>e[r][t]>=n);function wB(e,t,n){let r=0,s=e.length;for(;r<s&&e[r]<t;)r++;for(;s>r&&e[s-1]>n;)s--;return r>0||s<e.length?e.slice(r,s):e}const K0=["push","pop","shift","splice","unshift"];function SB(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),K0.forEach(n=>{const r="_onData"+Sh(n),s=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...o){const i=s.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[r]=="function"&&a[r](...o)}),i}})})}function Zg(e,t){const n=e._chartjs;if(!n)return;const r=n.listeners,s=r.indexOf(t);s!==-1&&r.splice(s,1),!(r.length>0)&&(K0.forEach(o=>{delete e[o]}),delete e._chartjs)}function Z0(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const G0=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function Y0(e,t){let n=[],r=!1;return function(...s){n=s,r||(r=!0,G0.call(window,()=>{r=!1,e.apply(t,n)}))}}function EB(e,t){let n;return function(...r){return t?(clearTimeout(n),n=setTimeout(e,t,r)):e.apply(this,r),t}}const Ch=e=>e==="start"?"left":e==="end"?"right":"center",ht=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,kB=(e,t,n,r)=>e===(r?"left":"right")?n:e==="center"?(t+n)/2:t;function X0(e,t,n){const r=t.length;let s=0,o=r;if(e._sorted){const{iScale:i,vScale:a,_parsed:c}=e,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,u=i.axis,{min:d,max:f,minDefined:h,maxDefined:p}=i.getUserBounds();if(h){if(s=Math.min(Un(c,u,d).lo,n?r:Un(t,u,i.getPixelForValue(d)).lo),l){const m=c.slice(0,s+1).reverse().findIndex(y=>!ye(y[a.axis]));s-=Math.max(0,m)}s=at(s,0,r-1)}if(p){let m=Math.max(Un(c,i.axis,f,!0).hi+1,n?0:Un(t,u,i.getPixelForValue(f),!0).hi+1);if(l){const y=c.slice(m-1).findIndex(b=>!ye(b[a.axis]));m+=Math.max(0,y)}o=at(m,s,r)-s}else o=r-s}return{start:s,count:o}}function J0(e){const{xScale:t,yScale:n,_scaleRanges:r}=e,s={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!r)return e._scaleRanges=s,!0;const o=r.xmin!==t.min||r.xmax!==t.max||r.ymin!==n.min||r.ymax!==n.max;return Object.assign(r,s),o}const ha=e=>e===0||e===1,Gg=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*Ae/n)),Yg=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*Ae/n)+1,Uo={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*He)+1,easeOutSine:e=>Math.sin(e*He),easeInOutSine:e=>-.5*(Math.cos(we*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>ha(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>ha(e)?e:Gg(e,.075,.3),easeOutElastic:e=>ha(e)?e:Yg(e,.075,.3),easeInOutElastic(e){return ha(e)?e:e<.5?.5*Gg(e*2,.1125,.45):.5+.5*Yg(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-Uo.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?Uo.easeInBounce(e*2)*.5:Uo.easeOutBounce(e*2-1)*.5+.5};function Rh(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Xg(e){return Rh(e)?e:new ai(e)}function ku(e){return Rh(e)?e:new ai(e).saturate(.5).darken(.1).hexString()}const CB=["x","y","borderWidth","radius","tension"],RB=["color","borderColor","backgroundColor"];function PB(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:RB},numbers:{type:"number",properties:CB}}),e.describe("animations",{_fallback:"animation"}),e.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:t=>t|0}}}})}function OB(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Jg=new Map;function TB(e,t){t=t||{};const n=e+JSON.stringify(t);let r=Jg.get(n);return r||(r=new Intl.NumberFormat(e,t),Jg.set(n,r)),r}function Oi(e,t,n){return TB(t,n).format(e)}const Q0={values(e){return ze(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const r=this.chart.options.locale;let s,o=e;if(n.length>1){const l=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(l<1e-4||l>1e15)&&(s="scientific"),o=MB(e,n)}const i=ar(Math.abs(o)),a=isNaN(i)?1:Math.max(Math.min(-1*Math.floor(i),20),0),c={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(c,this.options.ticks.format),Oi(e,r,c)},logarithmic(e,t,n){if(e===0)return"0";const r=n[t].significand||e/Math.pow(10,Math.floor(ar(e)));return[1,2,3,5,10,15].includes(r)||t>.8*n.length?Q0.numeric.call(this,e,t,n):""}};function MB(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var kl={formatters:Q0};function AB(e){e.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:(t,n)=>n.lineWidth,tickColor:(t,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:kl.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const as=Object.create(null),Bd=Object.create(null);function Wo(e,t){if(!t)return e;const n=t.split(".");for(let r=0,s=n.length;r<s;++r){const o=n[r];e=e[o]||(e[o]=Object.create(null))}return e}function Cu(e,t,n){return typeof t=="string"?ci(Wo(e,t),n):ci(Wo(e,""),t)}class NB{constructor(t,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=r=>r.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=(r,s)=>ku(s.backgroundColor),this.hoverBorderColor=(r,s)=>ku(s.borderColor),this.hoverColor=(r,s)=>ku(s.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(t),this.apply(n)}set(t,n){return Cu(this,t,n)}get(t){return Wo(this,t)}describe(t,n){return Cu(Bd,t,n)}override(t,n){return Cu(as,t,n)}route(t,n,r,s){const o=Wo(this,t),i=Wo(this,r),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const c=this[a],l=i[s];return xe(c)?Object.assign({},l,c):de(c,l)},set(c){this[a]=c}}})}apply(t){t.forEach(n=>n(this))}}var $e=new NB({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[PB,OB,AB]);function DB(e){return!e||ye(e.size)||ye(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function Pc(e,t,n,r,s){let o=t[s];return o||(o=t[s]=e.measureText(s).width,n.push(s)),o>r&&(r=o),r}function IB(e,t,n,r){r=r||{};let s=r.data=r.data||{},o=r.garbageCollect=r.garbageCollect||[];r.font!==t&&(s=r.data={},o=r.garbageCollect=[],r.font=t),e.save(),e.font=t;let i=0;const a=n.length;let c,l,u,d,f;for(c=0;c<a;c++)if(d=n[c],d!=null&&!ze(d))i=Pc(e,s,o,i,d);else if(ze(d))for(l=0,u=d.length;l<u;l++)f=d[l],f!=null&&!ze(f)&&(i=Pc(e,s,o,i,f));e.restore();const h=o.length/2;if(h>n.length){for(c=0;c<h;c++)delete s[o[c]];o.splice(0,h)}return i}function Ar(e,t,n){const r=e.currentDevicePixelRatio,s=n!==0?Math.max(n/2,.5):0;return Math.round((t-s)*r)/r+s}function Qg(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function Ud(e,t,n,r){eS(e,t,n,r,null)}function eS(e,t,n,r,s){let o,i,a,c,l,u,d,f;const h=t.pointStyle,p=t.rotation,m=t.radius;let y=(p||0)*mB;if(h&&typeof h=="object"&&(o=h.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,r),e.rotate(y),e.drawImage(h,-h.width/2,-h.height/2,h.width,h.height),e.restore();return}if(!(isNaN(m)||m<=0)){switch(e.beginPath(),h){default:s?e.ellipse(n,r,s/2,m,0,0,Ae):e.arc(n,r,m,0,Ae),e.closePath();break;case"triangle":u=s?s/2:m,e.moveTo(n+Math.sin(y)*u,r-Math.cos(y)*m),y+=Hg,e.lineTo(n+Math.sin(y)*u,r-Math.cos(y)*m),y+=Hg,e.lineTo(n+Math.sin(y)*u,r-Math.cos(y)*m),e.closePath();break;case"rectRounded":l=m*.516,c=m-l,i=Math.cos(y+Mr)*c,d=Math.cos(y+Mr)*(s?s/2-l:c),a=Math.sin(y+Mr)*c,f=Math.sin(y+Mr)*(s?s/2-l:c),e.arc(n-d,r-a,l,y-we,y-He),e.arc(n+f,r-i,l,y-He,y),e.arc(n+d,r+a,l,y,y+He),e.arc(n-f,r+i,l,y+He,y+we),e.closePath();break;case"rect":if(!p){c=Math.SQRT1_2*m,u=s?s/2:c,e.rect(n-u,r-c,2*u,2*c);break}y+=Mr;case"rectRot":d=Math.cos(y)*(s?s/2:m),i=Math.cos(y)*m,a=Math.sin(y)*m,f=Math.sin(y)*(s?s/2:m),e.moveTo(n-d,r-a),e.lineTo(n+f,r-i),e.lineTo(n+d,r+a),e.lineTo(n-f,r+i),e.closePath();break;case"crossRot":y+=Mr;case"cross":d=Math.cos(y)*(s?s/2:m),i=Math.cos(y)*m,a=Math.sin(y)*m,f=Math.sin(y)*(s?s/2:m),e.moveTo(n-d,r-a),e.lineTo(n+d,r+a),e.moveTo(n+f,r-i),e.lineTo(n-f,r+i);break;case"star":d=Math.cos(y)*(s?s/2:m),i=Math.cos(y)*m,a=Math.sin(y)*m,f=Math.sin(y)*(s?s/2:m),e.moveTo(n-d,r-a),e.lineTo(n+d,r+a),e.moveTo(n+f,r-i),e.lineTo(n-f,r+i),y+=Mr,d=Math.cos(y)*(s?s/2:m),i=Math.cos(y)*m,a=Math.sin(y)*m,f=Math.sin(y)*(s?s/2:m),e.moveTo(n-d,r-a),e.lineTo(n+d,r+a),e.moveTo(n+f,r-i),e.lineTo(n-f,r+i);break;case"line":i=s?s/2:Math.cos(y)*m,a=Math.sin(y)*m,e.moveTo(n-i,r-a),e.lineTo(n+i,r+a);break;case"dash":e.moveTo(n,r),e.lineTo(n+Math.cos(y)*(s?s/2:m),r+Math.sin(y)*m);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function Wn(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function Cl(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function Rl(e){e.restore()}function jB(e,t,n,r,s){if(!t)return e.lineTo(n.x,n.y);if(s==="middle"){const o=(t.x+n.x)/2;e.lineTo(o,t.y),e.lineTo(o,n.y)}else s==="after"!=!!r?e.lineTo(t.x,n.y):e.lineTo(n.x,t.y);e.lineTo(n.x,n.y)}function LB(e,t,n,r){if(!t)return e.lineTo(n.x,n.y);e.bezierCurveTo(r?t.cp1x:t.cp2x,r?t.cp1y:t.cp2y,r?n.cp2x:n.cp1x,r?n.cp2y:n.cp1y,n.x,n.y)}function FB(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),ye(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function zB(e,t,n,r,s){if(s.strikethrough||s.underline){const o=e.measureText(r),i=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,c=n-o.actualBoundingBoxAscent,l=n+o.actualBoundingBoxDescent,u=s.strikethrough?(c+l)/2:l;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=s.decorationWidth||2,e.moveTo(i,u),e.lineTo(a,u),e.stroke()}}function $B(e,t){const n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function cs(e,t,n,r,s,o={}){const i=ze(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="";let c,l;for(e.save(),e.font=s.string,FB(e,o),c=0;c<i.length;++c)l=i[c],o.backdrop&&$B(e,o.backdrop),a&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),ye(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(l,n,r,o.maxWidth)),e.fillText(l,n,r,o.maxWidth),zB(e,n,r,l,o),r+=Number(s.lineHeight);e.restore()}function di(e,t){const{x:n,y:r,w:s,h:o,radius:i}=t;e.arc(n+i.topLeft,r+i.topLeft,i.topLeft,1.5*we,we,!0),e.lineTo(n,r+o-i.bottomLeft),e.arc(n+i.bottomLeft,r+o-i.bottomLeft,i.bottomLeft,we,He,!0),e.lineTo(n+s-i.bottomRight,r+o),e.arc(n+s-i.bottomRight,r+o-i.bottomRight,i.bottomRight,He,0,!0),e.lineTo(n+s,r+i.topRight),e.arc(n+s-i.topRight,r+i.topRight,i.topRight,0,-He,!0),e.lineTo(n+i.topLeft,r)}const VB=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,BB=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function UB(e,t){const n=(""+e).match(VB);if(!n||n[1]==="normal")return t*1.2;switch(e=+n[2],n[3]){case"px":return e;case"%":e/=100;break}return t*e}const WB=e=>+e||0;function Ph(e,t){const n={},r=xe(t),s=r?Object.keys(t):t,o=xe(e)?r?i=>de(e[i],e[t[i]]):i=>e[i]:()=>e;for(const i of s)n[i]=WB(o(i));return n}function tS(e){return Ph(e,{top:"y",right:"x",bottom:"y",left:"x"})}function Zr(e){return Ph(e,["topLeft","topRight","bottomLeft","bottomRight"])}function xt(e){const t=tS(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function rt(e,t){e=e||{},t=t||$e.font;let n=de(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let r=de(e.style,t.style);r&&!(""+r).match(BB)&&(console.warn('Invalid font style specified: "'+r+'"'),r=void 0);const s={family:de(e.family,t.family),lineHeight:UB(de(e.lineHeight,t.lineHeight),n),size:n,style:r,weight:de(e.weight,t.weight),string:""};return s.string=DB(s),s}function No(e,t,n,r){let s,o,i;for(s=0,o=e.length;s<o;++s)if(i=e[s],i!==void 0&&i!==void 0)return i}function HB(e,t,n){const{min:r,max:s}=e,o=U0(t,(s-r)/2),i=(a,c)=>n&&a===0?0:a+c;return{min:i(r,-Math.abs(o)),max:i(s,o)}}function Rr(e,t){return Object.assign(Object.create(e),t)}function Oh(e,t=[""],n,r,s=()=>e[0]){const o=n||e;typeof r>"u"&&(r=oS("_fallback",e));const i={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:r,_getTarget:s,override:a=>Oh([a,...e],t,o,r)};return new Proxy(i,{deleteProperty(a,c){return delete a[c],delete a._keys,delete e[0][c],!0},get(a,c){return rS(a,c,()=>QB(c,t,e,a))},getOwnPropertyDescriptor(a,c){return Reflect.getOwnPropertyDescriptor(a._scopes[0],c)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,c){return ty(a).includes(c)},ownKeys(a){return ty(a)},set(a,c,l){const u=a._storage||(a._storage=s());return a[c]=u[c]=l,delete a._keys,!0}})}function Xs(e,t,n,r){const s={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:nS(e,r),setContext:o=>Xs(e,o,n,r),override:o=>Xs(e.override(o),t,n,r)};return new Proxy(s,{deleteProperty(o,i){return delete o[i],delete e[i],!0},get(o,i,a){return rS(o,i,()=>KB(o,i,a))},getOwnPropertyDescriptor(o,i){return o._descriptors.allKeys?Reflect.has(e,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,i)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,i){return Reflect.has(e,i)},ownKeys(){return Reflect.ownKeys(e)},set(o,i,a){return e[i]=a,delete o[i],!0}})}function nS(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:r=t.indexable,_allKeys:s=t.allKeys}=e;return{allKeys:s,scriptable:n,indexable:r,isScriptable:vr(n)?n:()=>n,isIndexable:vr(r)?r:()=>r}}const qB=(e,t)=>e?e+Sh(t):t,Th=(e,t)=>xe(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function rS(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const r=n();return e[t]=r,r}function KB(e,t,n){const{_proxy:r,_context:s,_subProxy:o,_descriptors:i}=e;let a=r[t];return vr(a)&&i.isScriptable(t)&&(a=ZB(t,a,e,n)),ze(a)&&a.length&&(a=GB(t,a,e,i.isIndexable)),Th(t,a)&&(a=Xs(a,s,o&&o[t],i)),a}function ZB(e,t,n,r){const{_proxy:s,_context:o,_subProxy:i,_stack:a}=n;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let c=t(o,i||r);return a.delete(e),Th(e,c)&&(c=Mh(s._scopes,s,e,c)),c}function GB(e,t,n,r){const{_proxy:s,_context:o,_subProxy:i,_descriptors:a}=n;if(typeof o.index<"u"&&r(e))return t[o.index%t.length];if(xe(t[0])){const c=t,l=s._scopes.filter(u=>u!==c);t=[];for(const u of c){const d=Mh(l,s,e,u);t.push(Xs(d,o,i&&i[e],a))}}return t}function sS(e,t,n){return vr(e)?e(t,n):e}const YB=(e,t)=>e===!0?t:typeof e=="string"?br(t,e):void 0;function XB(e,t,n,r,s){for(const o of t){const i=YB(n,o);if(i){e.add(i);const a=sS(i._fallback,n,s);if(typeof a<"u"&&a!==n&&a!==r)return a}else if(i===!1&&typeof r<"u"&&n!==r)return null}return!1}function Mh(e,t,n,r){const s=t._rootScopes,o=sS(t._fallback,n,r),i=[...e,...s],a=new Set;a.add(r);let c=ey(a,i,n,o||n,r);return c===null||typeof o<"u"&&o!==n&&(c=ey(a,i,o,c,r),c===null)?!1:Oh(Array.from(a),[""],s,o,()=>JB(t,n,r))}function ey(e,t,n,r,s){for(;n;)n=XB(e,t,n,r,s);return n}function JB(e,t,n){const r=e._getTarget();t in r||(r[t]={});const s=r[t];return ze(s)&&xe(n)?n:s||{}}function QB(e,t,n,r){let s;for(const o of t)if(s=oS(qB(o,e),n),typeof s<"u")return Th(e,s)?Mh(n,r,e,s):s}function oS(e,t){for(const n of t){if(!n)continue;const r=n[e];if(typeof r<"u")return r}}function ty(e){let t=e._keys;return t||(t=e._keys=eU(e._scopes)),t}function eU(e){const t=new Set;for(const n of e)for(const r of Object.keys(n).filter(s=>!s.startsWith("_")))t.add(r);return Array.from(t)}function iS(e,t,n,r){const{iScale:s}=e,{key:o="r"}=this._parsing,i=new Array(r);let a,c,l,u;for(a=0,c=r;a<c;++a)l=a+n,u=t[l],i[a]={r:s.parse(br(u,o),l)};return i}const tU=Number.EPSILON||1e-14,Js=(e,t)=>t<e.length&&!e[t].skip&&e[t],aS=e=>e==="x"?"y":"x";function nU(e,t,n,r){const s=e.skip?t:e,o=t,i=n.skip?t:n,a=Vd(o,s),c=Vd(i,o);let l=a/(a+c),u=c/(a+c);l=isNaN(l)?0:l,u=isNaN(u)?0:u;const d=r*l,f=r*u;return{previous:{x:o.x-d*(i.x-s.x),y:o.y-d*(i.y-s.y)},next:{x:o.x+f*(i.x-s.x),y:o.y+f*(i.y-s.y)}}}function rU(e,t,n){const r=e.length;let s,o,i,a,c,l=Js(e,0);for(let u=0;u<r-1;++u)if(c=l,l=Js(e,u+1),!(!c||!l)){if(Bo(t[u],0,tU)){n[u]=n[u+1]=0;continue}s=n[u]/t[u],o=n[u+1]/t[u],a=Math.pow(s,2)+Math.pow(o,2),!(a<=9)&&(i=3/Math.sqrt(a),n[u]=s*i*t[u],n[u+1]=o*i*t[u])}}function sU(e,t,n="x"){const r=aS(n),s=e.length;let o,i,a,c=Js(e,0);for(let l=0;l<s;++l){if(i=a,a=c,c=Js(e,l+1),!a)continue;const u=a[n],d=a[r];i&&(o=(u-i[n])/3,a[`cp1${n}`]=u-o,a[`cp1${r}`]=d-o*t[l]),c&&(o=(c[n]-u)/3,a[`cp2${n}`]=u+o,a[`cp2${r}`]=d+o*t[l])}}function oU(e,t="x"){const n=aS(t),r=e.length,s=Array(r).fill(0),o=Array(r);let i,a,c,l=Js(e,0);for(i=0;i<r;++i)if(a=c,c=l,l=Js(e,i+1),!!c){if(l){const u=l[t]-c[t];s[i]=u!==0?(l[n]-c[n])/u:0}o[i]=a?l?Rn(s[i-1])!==Rn(s[i])?0:(s[i-1]+s[i])/2:s[i-1]:s[i]}rU(e,s,o),sU(e,o,t)}function pa(e,t,n){return Math.max(Math.min(e,n),t)}function iU(e,t){let n,r,s,o,i,a=Wn(e[0],t);for(n=0,r=e.length;n<r;++n)i=o,o=a,a=n<r-1&&Wn(e[n+1],t),o&&(s=e[n],i&&(s.cp1x=pa(s.cp1x,t.left,t.right),s.cp1y=pa(s.cp1y,t.top,t.bottom)),a&&(s.cp2x=pa(s.cp2x,t.left,t.right),s.cp2y=pa(s.cp2y,t.top,t.bottom)))}function aU(e,t,n,r,s){let o,i,a,c;if(t.spanGaps&&(e=e.filter(l=>!l.skip)),t.cubicInterpolationMode==="monotone")oU(e,s);else{let l=r?e[e.length-1]:e[0];for(o=0,i=e.length;o<i;++o)a=e[o],c=nU(l,a,e[Math.min(o+1,i-(r?0:1))%i],t.tension),a.cp1x=c.previous.x,a.cp1y=c.previous.y,a.cp2x=c.next.x,a.cp2y=c.next.y,l=a}t.capBezierPoints&&iU(e,n)}function Ah(){return typeof window<"u"&&typeof document<"u"}function Nh(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Oc(e,t,n){let r;return typeof e=="string"?(r=parseInt(e,10),e.indexOf("%")!==-1&&(r=r/100*t.parentNode[n])):r=e,r}const Pl=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function cU(e,t){return Pl(e).getPropertyValue(t)}const lU=["top","right","bottom","left"];function Gr(e,t,n){const r={};n=n?"-"+n:"";for(let s=0;s<4;s++){const o=lU[s];r[o]=parseFloat(e[t+"-"+o+n])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}const uU=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function dU(e,t){const n=e.touches,r=n&&n.length?n[0]:e,{offsetX:s,offsetY:o}=r;let i=!1,a,c;if(uU(s,o,e.target))a=s,c=o;else{const l=t.getBoundingClientRect();a=r.clientX-l.left,c=r.clientY-l.top,i=!0}return{x:a,y:c,box:i}}function Ir(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:r}=t,s=Pl(n),o=s.boxSizing==="border-box",i=Gr(s,"padding"),a=Gr(s,"border","width"),{x:c,y:l,box:u}=dU(e,n),d=i.left+(u&&a.left),f=i.top+(u&&a.top);let{width:h,height:p}=t;return o&&(h-=i.width+a.width,p-=i.height+a.height),{x:Math.round((c-d)/h*n.width/r),y:Math.round((l-f)/p*n.height/r)}}function fU(e,t,n){let r,s;if(t===void 0||n===void 0){const o=e&&Nh(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{const i=o.getBoundingClientRect(),a=Pl(o),c=Gr(a,"border","width"),l=Gr(a,"padding");t=i.width-l.width-c.width,n=i.height-l.height-c.height,r=Oc(a.maxWidth,o,"clientWidth"),s=Oc(a.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:r||Rc,maxHeight:s||Rc}}const cr=e=>Math.round(e*10)/10;function hU(e,t,n,r){const s=Pl(e),o=Gr(s,"margin"),i=Oc(s.maxWidth,e,"clientWidth")||Rc,a=Oc(s.maxHeight,e,"clientHeight")||Rc,c=fU(e,t,n);let{width:l,height:u}=c;if(s.boxSizing==="content-box"){const f=Gr(s,"border","width"),h=Gr(s,"padding");l-=h.width+f.width,u-=h.height+f.height}return l=Math.max(0,l-o.width),u=Math.max(0,r?l/r:u-o.height),l=cr(Math.min(l,i,c.maxWidth)),u=cr(Math.min(u,a,c.maxHeight)),l&&!u&&(u=cr(l/2)),(t!==void 0||n!==void 0)&&r&&c.height&&u>c.height&&(u=c.height,l=cr(Math.floor(u*r))),{width:l,height:u}}function ny(e,t,n){const r=t||1,s=cr(e.height*r),o=cr(e.width*r);e.height=cr(e.height),e.width=cr(e.width);const i=e.canvas;return i.style&&(n||!i.style.height&&!i.style.width)&&(i.style.height=`${e.height}px`,i.style.width=`${e.width}px`),e.currentDevicePixelRatio!==r||i.height!==s||i.width!==o?(e.currentDevicePixelRatio=r,i.height=s,i.width=o,e.ctx.setTransform(r,0,0,r,0,0),!0):!1}const pU=(function(){let e=!1;try{const t={get passive(){return e=!0,!1}};Ah()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function ry(e,t){const n=cU(e,t),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}function jr(e,t,n,r){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function mU(e,t,n,r){return{x:e.x+n*(t.x-e.x),y:r==="middle"?n<.5?e.y:t.y:r==="after"?n<1?e.y:t.y:n>0?t.y:e.y}}function gU(e,t,n,r){const s={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},i=jr(e,s,n),a=jr(s,o,n),c=jr(o,t,n),l=jr(i,a,n),u=jr(a,c,n);return jr(l,u,n)}const yU=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,r){return n-r},leftForLtr(n,r){return n-r}}},bU=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function Bs(e,t,n){return e?yU(t,n):bU()}function cS(e,t){let n,r;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,r=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=r)}function lS(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function uS(e){return e==="angle"?{between:ui,compare:vB,normalize:mt}:{between:Bn,compare:(t,n)=>t-n,normalize:t=>t}}function sy({start:e,end:t,count:n,loop:r,style:s}){return{start:e%n,end:t%n,loop:r&&(t-e+1)%n===0,style:s}}function vU(e,t,n){const{property:r,start:s,end:o}=n,{between:i,normalize:a}=uS(r),c=t.length;let{start:l,end:u,loop:d}=e,f,h;if(d){for(l+=c,u+=c,f=0,h=c;f<h&&i(a(t[l%c][r]),s,o);++f)l--,u--;l%=c,u%=c}return u<l&&(u+=c),{start:l,end:u,loop:d,style:e.style}}function dS(e,t,n){if(!n)return[e];const{property:r,start:s,end:o}=n,i=t.length,{compare:a,between:c,normalize:l}=uS(r),{start:u,end:d,loop:f,style:h}=vU(e,t,n),p=[];let m=!1,y=null,b,x,_;const w=()=>c(s,_,b)&&a(s,_)!==0,S=()=>a(o,b)===0||c(o,_,b),C=()=>m||w(),k=()=>!m||S();for(let E=u,P=u;E<=d;++E)x=t[E%i],!x.skip&&(b=l(x[r]),b!==_&&(m=c(b,s,o),y===null&&C()&&(y=a(b,s)===0?E:P),y!==null&&k()&&(p.push(sy({start:y,end:E,loop:f,count:i,style:h})),y=null),P=E,_=b));return y!==null&&p.push(sy({start:y,end:d,loop:f,count:i,style:h})),p}function fS(e,t){const n=[],r=e.segments;for(let s=0;s<r.length;s++){const o=dS(r[s],e.points,t);o.length&&n.push(...o)}return n}function xU(e,t,n,r){let s=0,o=t-1;if(n&&!r)for(;s<t&&!e[s].skip;)s++;for(;s<t&&e[s].skip;)s++;for(s%=t,n&&(o+=s);o>s&&e[o%t].skip;)o--;return o%=t,{start:s,end:o}}function _U(e,t,n,r){const s=e.length,o=[];let i=t,a=e[t],c;for(c=t+1;c<=n;++c){const l=e[c%s];l.skip||l.stop?a.skip||(r=!1,o.push({start:t%s,end:(c-1)%s,loop:r}),t=i=l.stop?c:null):(i=c,a.skip&&(t=c)),a=l}return i!==null&&o.push({start:t%s,end:i%s,loop:r}),o}function wU(e,t){const n=e.points,r=e.options.spanGaps,s=n.length;if(!s)return[];const o=!!e._loop,{start:i,end:a}=xU(n,s,o,r);if(r===!0)return oy(e,[{start:i,end:a,loop:o}],n,t);const c=a<i?a+s:a,l=!!e._fullLoop&&i===0&&a===s-1;return oy(e,_U(n,i,c,l),n,t)}function oy(e,t,n,r){return!r||!r.setContext||!n?t:SU(e,t,n,r)}function SU(e,t,n,r){const s=e._chart.getContext(),o=iy(e.options),{_datasetIndex:i,options:{spanGaps:a}}=e,c=n.length,l=[];let u=o,d=t[0].start,f=d;function h(p,m,y,b){const x=a?-1:1;if(p!==m){for(p+=c;n[p%c].skip;)p-=x;for(;n[m%c].skip;)m+=x;p%c!==m%c&&(l.push({start:p%c,end:m%c,loop:y,style:b}),u=b,d=m%c)}}for(const p of t){d=a?d:p.start;let m=n[d%c],y;for(f=d+1;f<=p.end;f++){const b=n[f%c];y=iy(r.setContext(Rr(s,{type:"segment",p0:m,p1:b,p0DataIndex:(f-1)%c,p1DataIndex:f%c,datasetIndex:i}))),EU(y,u)&&h(d,f-1,p.loop,u),m=b,u=y}d<f-1&&h(d,f-1,p.loop,u)}return l}function iy(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function EU(e,t){if(!t)return!1;const n=[],r=function(s,o){return Rh(o)?(n.includes(o)||n.push(o),n.indexOf(o)):o};return JSON.stringify(e,r)!==JSON.stringify(t,r)}function ma(e,t,n){return e.options.clip?e[n]:t[n]}function kU(e,t){const{xScale:n,yScale:r}=e;return n&&r?{left:ma(n,t,"left"),right:ma(n,t,"right"),top:ma(r,t,"top"),bottom:ma(r,t,"bottom")}:t}function hS(e,t){const n=t._clip;if(n.disabled)return!1;const r=kU(t,e.chartArea);return{left:n.left===!1?0:r.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:r.right+(n.right===!0?0:n.right),top:n.top===!1?0:r.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:r.bottom+(n.bottom===!0?0:n.bottom)}}class CU{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,r,s){const o=n.listeners[s],i=n.duration;o.forEach(a=>a({chart:t,initial:n.initial,numSteps:i,currentStep:Math.min(r-n.start,i)}))}_refresh(){this._request||(this._running=!0,this._request=G0.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((r,s)=>{if(!r.running||!r.items.length)return;const o=r.items;let i=o.length-1,a=!1,c;for(;i>=0;--i)c=o[i],c._active?(c._total>r.duration&&(r.duration=c._total),c.tick(t),a=!0):(o[i]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,r,t,"progress")),o.length||(r.running=!1,this._notify(s,r,t,"complete"),r.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let r=n.get(t);return r||(r={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,r)),r}listen(t,n,r){this._getAnims(t).listeners[n].push(r)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((r,s)=>Math.max(r,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const r=n.items;let s=r.length-1;for(;s>=0;--s)r[s].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Ln=new CU;const ay="transparent",RU={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const r=Xg(e||ay),s=r.valid&&Xg(t||ay);return s&&s.valid?s.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class PU{constructor(t,n,r,s){const o=n[r];s=No([t.to,s,o,t.from]);const i=No([t.from,o,s]);this._active=!0,this._fn=t.fn||RU[t.type||typeof i],this._easing=Uo[t.easing]||Uo.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=r,this._from=i,this._to=s,this._promises=void 0}active(){return this._active}update(t,n,r){if(this._active){this._notify(!1);const s=this._target[this._prop],o=r-this._start,i=this._duration-o;this._start=r,this._duration=Math.floor(Math.max(i,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=No([t.to,n,s,t.from]),this._from=No([t.from,s,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,r=this._duration,s=this._prop,o=this._from,i=this._loop,a=this._to;let c;if(this._active=o!==a&&(i||n<r),!this._active){this._target[s]=a,this._notify(!0);return}if(n<0){this._target[s]=o;return}c=n/r%2,c=i&&c>1?2-c:c,c=this._easing(Math.min(1,Math.max(0,c))),this._target[s]=this._fn(o,a,c)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,r)=>{t.push({res:n,rej:r})})}_notify(t){const n=t?"res":"rej",r=this._promises||[];for(let s=0;s<r.length;s++)r[s][n]()}}class pS{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!xe(t))return;const n=Object.keys($e.animation),r=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const o=t[s];if(!xe(o))return;const i={};for(const a of n)i[a]=o[a];(ze(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!r.has(a))&&r.set(a,i)})})}_animateOptions(t,n){const r=n.options,s=TU(t,r);if(!s)return[];const o=this._createAnimations(s,r);return r.$shared&&OU(t.options.$animations,r).then(()=>{t.options=r},()=>{}),o}_createAnimations(t,n){const r=this._properties,s=[],o=t.$animations||(t.$animations={}),i=Object.keys(n),a=Date.now();let c;for(c=i.length-1;c>=0;--c){const l=i[c];if(l.charAt(0)==="$")continue;if(l==="options"){s.push(...this._animateOptions(t,n));continue}const u=n[l];let d=o[l];const f=r.get(l);if(d)if(f&&d.active()){d.update(f,u,a);continue}else d.cancel();if(!f||!f.duration){t[l]=u;continue}o[l]=d=new PU(f,t,l,u),s.push(d)}return s}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const r=this._createAnimations(t,n);if(r.length)return Ln.add(this._chart,r),!0}}function OU(e,t){const n=[],r=Object.keys(t);for(let s=0;s<r.length;s++){const o=e[r[s]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}function TU(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function cy(e,t){const n=e&&e.options||{},r=n.reverse,s=n.min===void 0?t:0,o=n.max===void 0?t:0;return{start:r?o:s,end:r?s:o}}function MU(e,t,n){if(n===!1)return!1;const r=cy(e,n),s=cy(t,n);return{top:s.end,right:r.end,bottom:s.start,left:r.start}}function AU(e){let t,n,r,s;return xe(e)?(t=e.top,n=e.right,r=e.bottom,s=e.left):t=n=r=s=e,{top:t,right:n,bottom:r,left:s,disabled:e===!1}}function mS(e,t){const n=[],r=e._getSortedDatasetMetas(t);let s,o;for(s=0,o=r.length;s<o;++s)n.push(r[s].index);return n}function ly(e,t,n,r={}){const s=e.keys,o=r.mode==="single";let i,a,c,l;if(t===null)return;let u=!1;for(i=0,a=s.length;i<a;++i){if(c=+s[i],c===n){if(u=!0,r.all)continue;break}l=e.values[c],We(l)&&(o||t===0||Rn(t)===Rn(l))&&(t+=l)}return!u&&!r.all?0:t}function NU(e,t){const{iScale:n,vScale:r}=t,s=n.axis==="x"?"x":"y",o=r.axis==="x"?"x":"y",i=Object.keys(e),a=new Array(i.length);let c,l,u;for(c=0,l=i.length;c<l;++c)u=i[c],a[c]={[s]:u,[o]:e[u]};return a}function Ru(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function DU(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function IU(e){const{min:t,max:n,minDefined:r,maxDefined:s}=e.getUserBounds();return{min:r?t:Number.NEGATIVE_INFINITY,max:s?n:Number.POSITIVE_INFINITY}}function jU(e,t,n){const r=e[t]||(e[t]={});return r[n]||(r[n]={})}function uy(e,t,n,r){for(const s of t.getMatchingVisibleMetas(r).reverse()){const o=e[s.index];if(n&&o>0||!n&&o<0)return s.index}return null}function dy(e,t){const{chart:n,_cachedMeta:r}=e,s=n._stacks||(n._stacks={}),{iScale:o,vScale:i,index:a}=r,c=o.axis,l=i.axis,u=DU(o,i,r),d=t.length;let f;for(let h=0;h<d;++h){const p=t[h],{[c]:m,[l]:y}=p,b=p._stacks||(p._stacks={});f=b[l]=jU(s,u,m),f[a]=y,f._top=uy(f,i,!0,r.type),f._bottom=uy(f,i,!1,r.type);const x=f._visualValues||(f._visualValues={});x[a]=y}}function Pu(e,t){const n=e.scales;return Object.keys(n).filter(r=>n[r].axis===t).shift()}function LU(e,t){return Rr(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function FU(e,t,n){return Rr(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function _o(e,t){const n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t=t||e._parsed;for(const s of t){const o=s._stacks;if(!o||o[r]===void 0||o[r][n]===void 0)return;delete o[r][n],o[r]._visualValues!==void 0&&o[r]._visualValues[n]!==void 0&&delete o[r]._visualValues[n]}}}const Ou=e=>e==="reset"||e==="none",fy=(e,t)=>t?e:Object.assign({},e),zU=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:mS(n,!0),values:null};class Pr{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,n){this.chart=t,this._ctx=t.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 t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Ru(t.vScale,t),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(t){this.index!==t&&_o(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,r=this.getDataset(),s=(d,f,h,p)=>d==="x"?f:d==="r"?p:h,o=n.xAxisID=de(r.xAxisID,Pu(t,"x")),i=n.yAxisID=de(r.yAxisID,Pu(t,"y")),a=n.rAxisID=de(r.rAxisID,Pu(t,"r")),c=n.indexAxis,l=n.iAxisID=s(c,o,i,a),u=n.vAxisID=s(c,i,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(i),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(l),n.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Zg(this._data,this),t._stacked&&_o(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),r=this._data;if(xe(n)){const s=this._cachedMeta;this._data=NU(n,s)}else if(r!==n){if(r){Zg(r,this);const s=this._cachedMeta;_o(s),s._parsed=[]}n&&Object.isExtensible(n)&&SB(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,r=this.getDataset();let s=!1;this._dataCheck();const o=n._stacked;n._stacked=Ru(n.vScale,n),n.stack!==r.stack&&(s=!0,_o(n),n.stack=r.stack),this._resyncElements(t),(s||o!==n._stacked)&&(dy(this,n._parsed),n._stacked=Ru(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),r=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(r,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:r,_data:s}=this,{iScale:o,_stacked:i}=r,a=o.axis;let c=t===0&&n===s.length?!0:r._sorted,l=t>0&&r._parsed[t-1],u,d,f;if(this._parsing===!1)r._parsed=s,r._sorted=!0,f=s;else{ze(s[t])?f=this.parseArrayData(r,s,t,n):xe(s[t])?f=this.parseObjectData(r,s,t,n):f=this.parsePrimitiveData(r,s,t,n);const h=()=>d[a]===null||l&&d[a]<l[a];for(u=0;u<n;++u)r._parsed[u+t]=d=f[u],c&&(h()&&(c=!1),l=d);r._sorted=c}i&&dy(this,f)}parsePrimitiveData(t,n,r,s){const{iScale:o,vScale:i}=t,a=o.axis,c=i.axis,l=o.getLabels(),u=o===i,d=new Array(s);let f,h,p;for(f=0,h=s;f<h;++f)p=f+r,d[f]={[a]:u||o.parse(l[p],p),[c]:i.parse(n[p],p)};return d}parseArrayData(t,n,r,s){const{xScale:o,yScale:i}=t,a=new Array(s);let c,l,u,d;for(c=0,l=s;c<l;++c)u=c+r,d=n[u],a[c]={x:o.parse(d[0],u),y:i.parse(d[1],u)};return a}parseObjectData(t,n,r,s){const{xScale:o,yScale:i}=t,{xAxisKey:a="x",yAxisKey:c="y"}=this._parsing,l=new Array(s);let u,d,f,h;for(u=0,d=s;u<d;++u)f=u+r,h=n[f],l[u]={x:o.parse(br(h,a),f),y:i.parse(br(h,c),f)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,r){const s=this.chart,o=this._cachedMeta,i=n[t.axis],a={keys:mS(s,!0),values:n._stacks[t.axis]._visualValues};return ly(a,i,o.index,{mode:r})}updateRangeFromParsed(t,n,r,s){const o=r[n.axis];let i=o===null?NaN:o;const a=s&&r._stacks[n.axis];s&&a&&(s.values=a,i=ly(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,i),t.max=Math.max(t.max,i)}getMinMax(t,n){const r=this._cachedMeta,s=r._parsed,o=r._sorted&&t===r.iScale,i=s.length,a=this._getOtherScale(t),c=zU(n,r,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:d}=IU(a);let f,h;function p(){h=s[f];const m=h[a.axis];return!We(h[t.axis])||u>m||d<m}for(f=0;f<i&&!(!p()&&(this.updateRangeFromParsed(l,t,h,c),o));++f);if(o){for(f=i-1;f>=0;--f)if(!p()){this.updateRangeFromParsed(l,t,h,c);break}}return l}getAllParsedValues(t){const n=this._cachedMeta._parsed,r=[];let s,o,i;for(s=0,o=n.length;s<o;++s)i=n[s][t.axis],We(i)&&r.push(i);return r}getMaxOverflow(){return!1}getLabelAndValue(t){const n=this._cachedMeta,r=n.iScale,s=n.vScale,o=this.getParsed(t);return{label:r?""+r.getLabelForValue(o[r.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){const n=this._cachedMeta;this.update(t||"default"),n._clip=AU(de(this.options.clip,MU(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this.chart,r=this._cachedMeta,s=r.data||[],o=n.chartArea,i=[],a=this._drawStart||0,c=this._drawCount||s.length-a,l=this.options.drawActiveElementsOnTop;let u;for(r.dataset&&r.dataset.draw(t,o,a,c),u=a;u<a+c;++u){const d=s[u];d.hidden||(d.active&&l?i.push(d):d.draw(t,o))}for(u=0;u<i.length;++u)i[u].draw(t,o)}getStyle(t,n){const r=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(r):this.resolveDataElementOptions(t||0,r)}getContext(t,n,r){const s=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const i=this._cachedMeta.data[t];o=i.$context||(i.$context=FU(this.getContext(),t,i)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=LU(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!n,o.mode=r,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",r){const s=n==="active",o=this._cachedDataOpts,i=t+"-"+n,a=o[i],c=this.enableOptionSharing&&li(r);if(a)return fy(a,c);const l=this.chart.config,u=l.datasetElementScopeKeys(this._type,t),d=s?[`${t}Hover`,"hover",t,""]:[t,""],f=l.getOptionScopes(this.getDataset(),u),h=Object.keys($e.elements[t]),p=()=>this.getContext(r,s,n),m=l.resolveNamedOptions(f,h,p,d);return m.$shared&&(m.$shared=c,o[i]=Object.freeze(fy(m,c))),m}_resolveAnimations(t,n,r){const s=this.chart,o=this._cachedDataOpts,i=`animation-${n}`,a=o[i];if(a)return a;let c;if(s.options.animation!==!1){const u=this.chart.config,d=u.datasetAnimationScopeKeys(this._type,n),f=u.getOptionScopes(this.getDataset(),d);c=u.createResolver(f,this.getContext(t,r,n))}const l=new pS(s,c&&c.animations);return c&&c._cacheable&&(o[i]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||Ou(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const r=this.resolveDataElementOptions(t,n),s=this._sharedOptions,o=this.getSharedOptions(r),i=this.includeOptions(n,o)||o!==s;return this.updateSharedOptions(o,n,r),{sharedOptions:o,includeOptions:i}}updateElement(t,n,r,s){Ou(s)?Object.assign(t,r):this._resolveAnimations(n,s).update(t,r)}updateSharedOptions(t,n,r){t&&!Ou(n)&&this._resolveAnimations(void 0,n).update(t,r)}_setStyle(t,n,r,s){t.active=s;const o=this.getStyle(n,s);this._resolveAnimations(n,r,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,r){this._setStyle(t,r,"active",!1)}setHoverStyle(t,n,r){this._setStyle(t,r,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,r=this._cachedMeta.data;for(const[a,c,l]of this._syncList)this[a](c,l);this._syncList=[];const s=r.length,o=n.length,i=Math.min(o,s);i&&this.parse(0,i),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,n,r=!0){const s=this._cachedMeta,o=s.data,i=t+n;let a;const c=l=>{for(l.length+=n,a=l.length-1;a>=i;a--)l[a]=l[a-n]};for(c(o),a=t;a<i;++a)o[a]=new this.dataElementType;this._parsing&&c(s._parsed),this.parse(t,n),r&&this.updateElements(o,t,n,"reset")}updateElements(t,n,r,s){}_removeElements(t,n){const r=this._cachedMeta;if(this._parsing){const s=r._parsed.splice(t,n);r._stacked&&_o(r,s)}r.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[n,r,s]=t;this[n](r,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);const r=arguments.length-2;r&&this._sync(["_insertElements",t,r])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function $U(e,t){if(!e._cache.$bar){const n=e.getMatchingVisibleMetas(t);let r=[];for(let s=0,o=n.length;s<o;s++)r=r.concat(n[s].controller.getAllParsedValues(e));e._cache.$bar=Z0(r.sort((s,o)=>s-o))}return e._cache.$bar}function VU(e){const t=e.iScale,n=$U(t,e.type);let r=t._length,s,o,i,a;const c=()=>{i===32767||i===-32768||(li(a)&&(r=Math.min(r,Math.abs(i-a)||r)),a=i)};for(s=0,o=n.length;s<o;++s)i=t.getPixelForValue(n[s]),c();for(a=void 0,s=0,o=t.ticks.length;s<o;++s)i=t.getPixelForTick(s),c();return r}function BU(e,t,n,r){const s=n.barThickness;let o,i;return ye(s)?(o=t.min*n.categoryPercentage,i=n.barPercentage):(o=s*r,i=1),{chunk:o/r,ratio:i,start:t.pixels[e]-o/2}}function UU(e,t,n,r){const s=t.pixels,o=s[e];let i=e>0?s[e-1]:null,a=e<s.length-1?s[e+1]:null;const c=n.categoryPercentage;i===null&&(i=o-(a===null?t.end-t.start:a-o)),a===null&&(a=o+o-i);const l=o-(o-Math.min(i,a))/2*c;return{chunk:Math.abs(a-i)/2*c/r,ratio:n.barPercentage,start:l}}function WU(e,t,n,r){const s=n.parse(e[0],r),o=n.parse(e[1],r),i=Math.min(s,o),a=Math.max(s,o);let c=i,l=a;Math.abs(i)>Math.abs(a)&&(c=a,l=i),t[n.axis]=l,t._custom={barStart:c,barEnd:l,start:s,end:o,min:i,max:a}}function gS(e,t,n,r){return ze(e)?WU(e,t,n,r):t[n.axis]=n.parse(e,r),t}function hy(e,t,n,r){const s=e.iScale,o=e.vScale,i=s.getLabels(),a=s===o,c=[];let l,u,d,f;for(l=n,u=n+r;l<u;++l)f=t[l],d={},d[s.axis]=a||s.parse(i[l],l),c.push(gS(f,d,o,l));return c}function Tu(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function HU(e,t,n){return e!==0?Rn(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}function qU(e){let t,n,r,s,o;return e.horizontal?(t=e.base>e.x,n="left",r="right"):(t=e.base<e.y,n="bottom",r="top"),t?(s="end",o="start"):(s="start",o="end"),{start:n,end:r,reverse:t,top:s,bottom:o}}function KU(e,t,n,r){let s=t.borderSkipped;const o={};if(!s){e.borderSkipped=o;return}if(s===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:i,end:a,reverse:c,top:l,bottom:u}=qU(e);s==="middle"&&n&&(e.enableBorderRadius=!0,(n._top||0)===r?s=l:(n._bottom||0)===r?s=u:(o[py(u,i,a,c)]=!0,s=l)),o[py(s,i,a,c)]=!0,e.borderSkipped=o}function py(e,t,n,r){return r?(e=ZU(e,t,n),e=my(e,n,t)):e=my(e,t,n),e}function ZU(e,t,n){return e===t?n:e===n?t:e}function my(e,t,n){return e==="start"?t:e==="end"?n:e}function GU(e,{inflateAmount:t},n){e.inflateAmount=t==="auto"?n===1?.33:0:t}class YU extends Pr{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,n,r,s){return hy(t,n,r,s)}parseArrayData(t,n,r,s){return hy(t,n,r,s)}parseObjectData(t,n,r,s){const{iScale:o,vScale:i}=t,{xAxisKey:a="x",yAxisKey:c="y"}=this._parsing,l=o.axis==="x"?a:c,u=i.axis==="x"?a:c,d=[];let f,h,p,m;for(f=r,h=r+s;f<h;++f)m=n[f],p={},p[o.axis]=o.parse(br(m,l),f),d.push(gS(br(m,u),p,i,f));return d}updateRangeFromParsed(t,n,r,s){super.updateRangeFromParsed(t,n,r,s);const o=r._custom;o&&n===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const n=this._cachedMeta,{iScale:r,vScale:s}=n,o=this.getParsed(t),i=o._custom,a=Tu(i)?"["+i.start+", "+i.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+r.getLabelForValue(o[r.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,t)}updateElements(t,n,r,s){const o=s==="reset",{index:i,_cachedMeta:{vScale:a}}=this,c=a.getBasePixel(),l=a.isHorizontal(),u=this._getRuler(),{sharedOptions:d,includeOptions:f}=this._getSharedOptions(n,s);for(let h=n;h<n+r;h++){const p=this.getParsed(h),m=o||ye(p[a.axis])?{base:c,head:c}:this._calculateBarValuePixels(h),y=this._calculateBarIndexPixels(h,u),b=(p._stacks||{})[a.axis],x={horizontal:l,base:m.base,enableBorderRadius:!b||Tu(p._custom)||i===b._top||i===b._bottom,x:l?m.head:y.center,y:l?y.center:m.head,height:l?y.size:Math.abs(m.size),width:l?Math.abs(m.size):y.size};f&&(x.options=d||this.resolveDataElementOptions(h,t[h].active?"active":s));const _=x.options||t[h].options;KU(x,_,b,i),GU(x,_,u.ratio),this.updateElement(t[h],h,x,s)}}_getStacks(t,n){const{iScale:r}=this._cachedMeta,s=r.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),o=r.options.stacked,i=[],a=this._cachedMeta.controller.getParsed(n),c=a&&a[r.axis],l=u=>{const d=u._parsed.find(h=>h[r.axis]===c),f=d&&d[u.vScale.axis];if(ye(f)||isNaN(f))return!0};for(const u of s)if(!(n!==void 0&&l(u))&&((o===!1||i.indexOf(u.stack)===-1||o===void 0&&u.stack===void 0)&&i.push(u.stack),u.index===t))break;return i.length||i.push(void 0),i}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(t).filter(r=>t[r].axis===n).shift()}_getAxis(){const t={},n=this.getFirstScaleIdForIndexAxis();for(const r of this.chart.data.datasets)t[de(this.chart.options.indexAxis==="x"?r.xAxisID:r.yAxisID,n)]=!0;return Object.keys(t)}_getStackIndex(t,n,r){const s=this._getStacks(t,r),o=n!==void 0?s.indexOf(n):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,n=this._cachedMeta,r=n.iScale,s=[];let o,i;for(o=0,i=n.data.length;o<i;++o)s.push(r.getPixelForValue(this.getParsed(o)[r.axis],o));const a=t.barThickness;return{min:a||VU(n),pixels:s,start:r._startPixel,end:r._endPixel,stackCount:this._getStackCount(),scale:r,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:n,_stacked:r,index:s},options:{base:o,minBarLength:i}}=this,a=o||0,c=this.getParsed(t),l=c._custom,u=Tu(l);let d=c[n.axis],f=0,h=r?this.applyStack(n,c,r):d,p,m;h!==d&&(f=h-d,h=d),u&&(d=l.barStart,h=l.barEnd-l.barStart,d!==0&&Rn(d)!==Rn(l.barEnd)&&(f=0),f+=d);const y=!ye(o)&&!u?o:f;let b=n.getPixelForValue(y);if(this.chart.getDataVisibility(t)?p=n.getPixelForValue(f+h):p=b,m=p-b,Math.abs(m)<i){m=HU(m,n,a)*i,d===a&&(b-=m/2);const x=n.getPixelForDecimal(0),_=n.getPixelForDecimal(1),w=Math.min(x,_),S=Math.max(x,_);b=Math.max(Math.min(b,S),w),p=b+m,r&&!u&&(c._stacks[n.axis]._visualValues[s]=n.getValueForPixel(p)-n.getValueForPixel(b))}if(b===n.getPixelForValue(a)){const x=Rn(m)*n.getLineWidthForValue(a)/2;b+=x,m-=x}return{size:m,base:b,head:p,center:p+m/2}}_calculateBarIndexPixels(t,n){const r=n.scale,s=this.options,o=s.skipNull,i=de(s.maxBarThickness,1/0);let a,c;const l=this._getAxisCount();if(n.grouped){const u=o?this._getStackCount(t):n.stackCount,d=s.barThickness==="flex"?UU(t,n,s,u*l):BU(t,n,s,u*l),f=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,h=this._getAxis().indexOf(de(f,this.getFirstScaleIdForIndexAxis())),p=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+h;a=d.start+d.chunk*p+d.chunk/2,c=Math.min(i,d.chunk*d.ratio)}else a=r.getPixelForValue(this.getParsed(t)[r.axis],t),c=Math.min(i,n.min*n.ratio);return{base:a-c/2,head:a+c/2,center:a,size:c}}draw(){const t=this._cachedMeta,n=t.vScale,r=t.data,s=r.length;let o=0;for(;o<s;++o)this.getParsed(o)[n.axis]!==null&&!r[o].hidden&&r[o].draw(this._ctx)}}class XU extends Pr{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,n,r,s){const o=super.parsePrimitiveData(t,n,r,s);for(let i=0;i<o.length;i++)o[i]._custom=this.resolveDataElementOptions(i+r).radius;return o}parseArrayData(t,n,r,s){const o=super.parseArrayData(t,n,r,s);for(let i=0;i<o.length;i++){const a=n[r+i];o[i]._custom=de(a[2],this.resolveDataElementOptions(i+r).radius)}return o}parseObjectData(t,n,r,s){const o=super.parseObjectData(t,n,r,s);for(let i=0;i<o.length;i++){const a=n[r+i];o[i]._custom=de(a&&a.r&&+a.r,this.resolveDataElementOptions(i+r).radius)}return o}getMaxOverflow(){const t=this._cachedMeta.data;let n=0;for(let r=t.length-1;r>=0;--r)n=Math.max(n,t[r].size(this.resolveDataElementOptions(r))/2);return n>0&&n}getLabelAndValue(t){const n=this._cachedMeta,r=this.chart.data.labels||[],{xScale:s,yScale:o}=n,i=this.getParsed(t),a=s.getLabelForValue(i.x),c=o.getLabelForValue(i.y),l=i._custom;return{label:r[t]||"",value:"("+a+", "+c+(l?", "+l:"")+")"}}update(t){const n=this._cachedMeta.data;this.updateElements(n,0,n.length,t)}updateElements(t,n,r,s){const o=s==="reset",{iScale:i,vScale:a}=this._cachedMeta,{sharedOptions:c,includeOptions:l}=this._getSharedOptions(n,s),u=i.axis,d=a.axis;for(let f=n;f<n+r;f++){const h=t[f],p=!o&&this.getParsed(f),m={},y=m[u]=o?i.getPixelForDecimal(.5):i.getPixelForValue(p[u]),b=m[d]=o?a.getBasePixel():a.getPixelForValue(p[d]);m.skip=isNaN(y)||isNaN(b),l&&(m.options=c||this.resolveDataElementOptions(f,h.active?"active":s),o&&(m.options.radius=0)),this.updateElement(h,f,m,s)}}resolveDataElementOptions(t,n){const r=this.getParsed(t);let s=super.resolveDataElementOptions(t,n);s.$shared&&(s=Object.assign({},s,{$shared:!1}));const o=s.radius;return n!=="active"&&(s.radius=0),s.radius+=de(r&&r._custom,o),s}}function JU(e,t,n){let r=1,s=1,o=0,i=0;if(t<Ae){const a=e,c=a+t,l=Math.cos(a),u=Math.sin(a),d=Math.cos(c),f=Math.sin(c),h=(_,w,S)=>ui(_,a,c,!0)?1:Math.max(w,w*n,S,S*n),p=(_,w,S)=>ui(_,a,c,!0)?-1:Math.min(w,w*n,S,S*n),m=h(0,l,d),y=h(He,u,f),b=p(we,l,d),x=p(we+He,u,f);r=(m-b)/2,s=(y-x)/2,o=-(m+b)/2,i=-(y+x)/2}return{ratioX:r,ratioY:s,offsetX:o,offsetY:i}}class Dh extends Pr{static id="doughnut";static 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,indexAxis:"r"};static descriptors={_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data,{labels:{pointStyle:r,textAlign:s,color:o,useBorderRadius:i,borderRadius:a}}=t.legend.options;return n.labels.length&&n.datasets.length?n.labels.map((c,l)=>{const d=t.getDatasetMeta(0).controller.getStyle(l);return{text:c,fillStyle:d.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(l),lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:d.borderWidth,strokeStyle:d.borderColor,textAlign:s,pointStyle:r,borderRadius:i&&(a||d.borderRadius),index:l}}):[]}},onClick(t,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}}};constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){const r=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=r;else{let o=c=>+r[c];if(xe(r[t])){const{key:c="value"}=this._parsing;o=l=>+br(r[l],c)}let i,a;for(i=t,a=t+n;i<a;++i)s._parsed[i]=o(i)}}_getRotation(){return fn(this.options.rotation-90)}_getCircumference(){return fn(this.options.circumference)}_getRotationExtents(){let t=Ae,n=-Ae;for(let r=0;r<this.chart.data.datasets.length;++r)if(this.chart.isDatasetVisible(r)&&this.chart.getDatasetMeta(r).type===this._type){const s=this.chart.getDatasetMeta(r).controller,o=s._getRotation(),i=s._getCircumference();t=Math.min(t,o),n=Math.max(n,o+i)}return{rotation:t,circumference:n-t}}update(t){const n=this.chart,{chartArea:r}=n,s=this._cachedMeta,o=s.data,i=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,a=Math.max((Math.min(r.width,r.height)-i)/2,0),c=Math.min(cB(this.options.cutout,a),1),l=this._getRingWeight(this.index),{circumference:u,rotation:d}=this._getRotationExtents(),{ratioX:f,ratioY:h,offsetX:p,offsetY:m}=JU(d,u,c),y=(r.width-i)/f,b=(r.height-i)/h,x=Math.max(Math.min(y,b)/2,0),_=U0(this.options.radius,x),w=Math.max(_*c,0),S=(_-w)/this._getVisibleDatasetWeightTotal();this.offsetX=p*_,this.offsetY=m*_,s.total=this.calculateTotal(),this.outerRadius=_-S*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-S*l,0),this.updateElements(o,0,o.length,t)}_circumference(t,n){const r=this.options,s=this._cachedMeta,o=this._getCircumference();return n&&r.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*o/Ae)}updateElements(t,n,r,s){const o=s==="reset",i=this.chart,a=i.chartArea,l=i.options.animation,u=(a.left+a.right)/2,d=(a.top+a.bottom)/2,f=o&&l.animateScale,h=f?0:this.innerRadius,p=f?0:this.outerRadius,{sharedOptions:m,includeOptions:y}=this._getSharedOptions(n,s);let b=this._getRotation(),x;for(x=0;x<n;++x)b+=this._circumference(x,o);for(x=n;x<n+r;++x){const _=this._circumference(x,o),w=t[x],S={x:u+this.offsetX,y:d+this.offsetY,startAngle:b,endAngle:b+_,circumference:_,outerRadius:p,innerRadius:h};y&&(S.options=m||this.resolveDataElementOptions(x,w.active?"active":s)),b+=_,this.updateElement(w,x,S,s)}}calculateTotal(){const t=this._cachedMeta,n=t.data;let r=0,s;for(s=0;s<n.length;s++){const o=t._parsed[s];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(s)&&!n[s].hidden&&(r+=Math.abs(o))}return r}calculateCircumference(t){const n=this._cachedMeta.total;return n>0&&!isNaN(t)?Ae*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,r=this.chart,s=r.data.labels||[],o=Oi(n._parsed[t],r.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let n=0;const r=this.chart;let s,o,i,a,c;if(!t){for(s=0,o=r.data.datasets.length;s<o;++s)if(r.isDatasetVisible(s)){i=r.getDatasetMeta(s),t=i.data,a=i.controller;break}}if(!t)return 0;for(s=0,o=t.length;s<o;++s)c=a.resolveDataElementOptions(s),c.borderAlign!=="inner"&&(n=Math.max(n,c.borderWidth||0,c.hoverBorderWidth||0));return n}getMaxOffset(t){let n=0;for(let r=0,s=t.length;r<s;++r){const o=this.resolveDataElementOptions(r);n=Math.max(n,o.offset||0,o.hoverOffset||0)}return n}_getRingWeightOffset(t){let n=0;for(let r=0;r<t;++r)this.chart.isDatasetVisible(r)&&(n+=this._getRingWeight(r));return n}_getRingWeight(t){return Math.max(de(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class yS extends Pr{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:r,data:s=[],_dataset:o}=n,i=this.chart._animationsDisabled;let{start:a,count:c}=X0(n,s,i);this._drawStart=a,this._drawCount=c,J0(n)&&(a=0,c=s.length),r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!o._decimated,r.points=s;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(r,void 0,{animated:!i,options:l},t),this.updateElements(s,a,c,t)}updateElements(t,n,r,s){const o=s==="reset",{iScale:i,vScale:a,_stacked:c,_dataset:l}=this._cachedMeta,{sharedOptions:u,includeOptions:d}=this._getSharedOptions(n,s),f=i.axis,h=a.axis,{spanGaps:p,segment:m}=this.options,y=Ys(p)?p:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||s==="none",x=n+r,_=t.length;let w=n>0&&this.getParsed(n-1);for(let S=0;S<_;++S){const C=t[S],k=b?C:{};if(S<n||S>=x){k.skip=!0;continue}const E=this.getParsed(S),P=ye(E[h]),O=k[f]=i.getPixelForValue(E[f],S),N=k[h]=o||P?a.getBasePixel():a.getPixelForValue(c?this.applyStack(a,E,c):E[h],S);k.skip=isNaN(O)||isNaN(N)||P,k.stop=S>0&&Math.abs(E[f]-w[f])>y,m&&(k.parsed=E,k.raw=l.data[S]),d&&(k.options=u||this.resolveDataElementOptions(S,C.active?"active":s)),b||this.updateElement(C,S,k,s),w=E}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,r=n.options&&n.options.borderWidth||0,s=t.data||[];if(!s.length)return r;const o=s[0].size(this.resolveDataElementOptions(0)),i=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(r,o,i)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}class bS extends Pr{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data;if(n.labels.length&&n.datasets.length){const{labels:{pointStyle:r,color:s}}=t.legend.options;return n.labels.map((o,i)=>{const c=t.getDatasetMeta(0).controller.getStyle(i);return{text:o,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:s,lineWidth:c.borderWidth,pointStyle:r,hidden:!t.getDataVisibility(i),index:i}})}return[]}},onClick(t,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,n){super(t,n),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const n=this._cachedMeta,r=this.chart,s=r.data.labels||[],o=Oi(n._parsed[t].r,r.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,n,r,s){return iS.bind(this)(t,n,r,s)}update(t){const n=this._cachedMeta.data;this._updateRadius(),this.updateElements(n,0,n.length,t)}getMinMax(){const t=this._cachedMeta,n={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((r,s)=>{const o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(o<n.min&&(n.min=o),o>n.max&&(n.max=o))}),n}_updateRadius(){const t=this.chart,n=t.chartArea,r=t.options,s=Math.min(n.right-n.left,n.bottom-n.top),o=Math.max(s/2,0),i=Math.max(r.cutoutPercentage?o/100*r.cutoutPercentage:1,0),a=(o-i)/t.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,n,r,s){const o=s==="reset",i=this.chart,c=i.options.animation,l=this._cachedMeta.rScale,u=l.xCenter,d=l.yCenter,f=l.getIndexAngle(0)-.5*we;let h=f,p;const m=360/this.countVisibleElements();for(p=0;p<n;++p)h+=this._computeAngle(p,s,m);for(p=n;p<n+r;p++){const y=t[p];let b=h,x=h+this._computeAngle(p,s,m),_=i.getDataVisibility(p)?l.getDistanceFromCenterForValue(this.getParsed(p).r):0;h=x,o&&(c.animateScale&&(_=0),c.animateRotate&&(b=x=f));const w={x:u,y:d,innerRadius:0,outerRadius:_,startAngle:b,endAngle:x,options:this.resolveDataElementOptions(p,y.active?"active":s)};this.updateElement(y,p,w,s)}}countVisibleElements(){const t=this._cachedMeta;let n=0;return t.data.forEach((r,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&n++}),n}_computeAngle(t,n,r){return this.chart.getDataVisibility(t)?fn(this.resolveDataElementOptions(t,n).angle||r):0}}class QU extends Dh{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}}class e5 extends Pr{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const n=this._cachedMeta.vScale,r=this.getParsed(t);return{label:n.getLabels()[t],value:""+n.getLabelForValue(r[n.axis])}}parseObjectData(t,n,r,s){return iS.bind(this)(t,n,r,s)}update(t){const n=this._cachedMeta,r=n.dataset,s=n.data||[],o=n.iScale.getLabels();if(r.points=s,t!=="resize"){const i=this.resolveDatasetElementOptions(t);this.options.showLine||(i.borderWidth=0);const a={_loop:!0,_fullLoop:o.length===s.length,options:i};this.updateElement(r,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,n,r,s){const o=this._cachedMeta.rScale,i=s==="reset";for(let a=n;a<n+r;a++){const c=t[a],l=this.resolveDataElementOptions(a,c.active?"active":s),u=o.getPointPositionForValue(a,this.getParsed(a).r),d=i?o.xCenter:u.x,f=i?o.yCenter:u.y,h={x:d,y:f,angle:u.angle,skip:isNaN(d)||isNaN(f),options:l};this.updateElement(c,a,h,s)}}}class t5 extends Pr{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const n=this._cachedMeta,r=this.chart.data.labels||[],{xScale:s,yScale:o}=n,i=this.getParsed(t),a=s.getLabelForValue(i.x),c=o.getLabelForValue(i.y);return{label:r[t]||"",value:"("+a+", "+c+")"}}update(t){const n=this._cachedMeta,{data:r=[]}=n,s=this.chart._animationsDisabled;let{start:o,count:i}=X0(n,r,s);if(this._drawStart=o,this._drawCount=i,J0(n)&&(o=0,i=r.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:a,_dataset:c}=n;a._chart=this.chart,a._datasetIndex=this.index,a._decimated=!!c._decimated,a.points=r;const l=this.resolveDatasetElementOptions(t);l.segment=this.options.segment,this.updateElement(a,void 0,{animated:!s,options:l},t)}else this.datasetElementType&&(delete n.dataset,this.datasetElementType=!1);this.updateElements(r,o,i,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,n,r,s){const o=s==="reset",{iScale:i,vScale:a,_stacked:c,_dataset:l}=this._cachedMeta,u=this.resolveDataElementOptions(n,s),d=this.getSharedOptions(u),f=this.includeOptions(s,d),h=i.axis,p=a.axis,{spanGaps:m,segment:y}=this.options,b=Ys(m)?m:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||s==="none";let _=n>0&&this.getParsed(n-1);for(let w=n;w<n+r;++w){const S=t[w],C=this.getParsed(w),k=x?S:{},E=ye(C[p]),P=k[h]=i.getPixelForValue(C[h],w),O=k[p]=o||E?a.getBasePixel():a.getPixelForValue(c?this.applyStack(a,C,c):C[p],w);k.skip=isNaN(P)||isNaN(O)||E,k.stop=w>0&&Math.abs(C[h]-_[h])>b,y&&(k.parsed=C,k.raw=l.data[w]),f&&(k.options=d||this.resolveDataElementOptions(w,S.active?"active":s)),x||this.updateElement(S,w,k,s),_=C}this.updateSharedOptions(d,s,u)}getMaxOverflow(){const t=this._cachedMeta,n=t.data||[];if(!this.options.showLine){let a=0;for(let c=n.length-1;c>=0;--c)a=Math.max(a,n[c].size(this.resolveDataElementOptions(c))/2);return a>0&&a}const r=t.dataset,s=r.options&&r.options.borderWidth||0;if(!n.length)return s;const o=n[0].size(this.resolveDataElementOptions(0)),i=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(s,o,i)/2}}var n5=Object.freeze({__proto__:null,BarController:YU,BubbleController:XU,DoughnutController:Dh,LineController:yS,PieController:QU,PolarAreaController:bS,RadarController:e5,ScatterController:t5});function Nr(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Ih{static override(t){Object.assign(Ih.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return Nr()}parse(){return Nr()}format(){return Nr()}add(){return Nr()}diff(){return Nr()}startOf(){return Nr()}endOf(){return Nr()}}var r5={_date:Ih};function s5(e,t,n,r){const{controller:s,data:o,_sorted:i}=e,a=s._cachedMeta.iScale,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&i&&o.length){const l=a._reversePixels?_B:Un;if(r){if(s._sharedOptions){const u=o[0],d=typeof u.getRange=="function"&&u.getRange(t);if(d){const f=l(o,t,n-d),h=l(o,t,n+d);return{lo:f.lo,hi:h.hi}}}}else{const u=l(o,t,n);if(c){const{vScale:d}=s._cachedMeta,{_parsed:f}=e,h=f.slice(0,u.lo+1).reverse().findIndex(m=>!ye(m[d.axis]));u.lo-=Math.max(0,h);const p=f.slice(u.hi).findIndex(m=>!ye(m[d.axis]));u.hi+=Math.max(0,p)}return u}}return{lo:0,hi:o.length-1}}function Ol(e,t,n,r,s){const o=e.getSortedVisibleDatasetMetas(),i=n[t];for(let a=0,c=o.length;a<c;++a){const{index:l,data:u}=o[a],{lo:d,hi:f}=s5(o[a],t,i,s);for(let h=d;h<=f;++h){const p=u[h];p.skip||r(p,l,h)}}}function o5(e){const t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(r,s){const o=t?Math.abs(r.x-s.x):0,i=n?Math.abs(r.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(i,2))}}function Mu(e,t,n,r,s){const o=[];return!s&&!e.isPointInArea(t)||Ol(e,n,t,function(a,c,l){!s&&!Wn(a,e.chartArea,0)||a.inRange(t.x,t.y,r)&&o.push({element:a,datasetIndex:c,index:l})},!0),o}function i5(e,t,n,r){let s=[];function o(i,a,c){const{startAngle:l,endAngle:u}=i.getProps(["startAngle","endAngle"],r),{angle:d}=q0(i,{x:t.x,y:t.y});ui(d,l,u)&&s.push({element:i,datasetIndex:a,index:c})}return Ol(e,n,t,o),s}function a5(e,t,n,r,s,o){let i=[];const a=o5(n);let c=Number.POSITIVE_INFINITY;function l(u,d,f){const h=u.inRange(t.x,t.y,s);if(r&&!h)return;const p=u.getCenterPoint(s);if(!(!!o||e.isPointInArea(p))&&!h)return;const y=a(t,p);y<c?(i=[{element:u,datasetIndex:d,index:f}],c=y):y===c&&i.push({element:u,datasetIndex:d,index:f})}return Ol(e,n,t,l),i}function Au(e,t,n,r,s,o){return!o&&!e.isPointInArea(t)?[]:n==="r"&&!r?i5(e,t,n,s):a5(e,t,n,r,s,o)}function gy(e,t,n,r,s){const o=[],i=n==="x"?"inXRange":"inYRange";let a=!1;return Ol(e,n,t,(c,l,u)=>{c[i]&&c[i](t[n],s)&&(o.push({element:c,datasetIndex:l,index:u}),a=a||c.inRange(t.x,t.y,s))}),r&&!a?[]:o}var c5={modes:{index(e,t,n,r){const s=Ir(t,e),o=n.axis||"x",i=n.includeInvisible||!1,a=n.intersect?Mu(e,s,o,r,i):Au(e,s,o,!1,r,i),c=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(l=>{const u=a[0].index,d=l.data[u];d&&!d.skip&&c.push({element:d,datasetIndex:l.index,index:u})}),c):[]},dataset(e,t,n,r){const s=Ir(t,e),o=n.axis||"xy",i=n.includeInvisible||!1;let a=n.intersect?Mu(e,s,o,r,i):Au(e,s,o,!1,r,i);if(a.length>0){const c=a[0].datasetIndex,l=e.getDatasetMeta(c).data;a=[];for(let u=0;u<l.length;++u)a.push({element:l[u],datasetIndex:c,index:u})}return a},point(e,t,n,r){const s=Ir(t,e),o=n.axis||"xy",i=n.includeInvisible||!1;return Mu(e,s,o,r,i)},nearest(e,t,n,r){const s=Ir(t,e),o=n.axis||"xy",i=n.includeInvisible||!1;return Au(e,s,o,n.intersect,r,i)},x(e,t,n,r){const s=Ir(t,e);return gy(e,s,"x",n.intersect,r)},y(e,t,n,r){const s=Ir(t,e);return gy(e,s,"y",n.intersect,r)}}};const vS=["left","top","right","bottom"];function wo(e,t){return e.filter(n=>n.pos===t)}function yy(e,t){return e.filter(n=>vS.indexOf(n.pos)===-1&&n.box.axis===t)}function So(e,t){return e.sort((n,r)=>{const s=t?r:n,o=t?n:r;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function l5(e){const t=[];let n,r,s,o,i,a;for(n=0,r=(e||[]).length;n<r;++n)s=e[n],{position:o,options:{stack:i,stackWeight:a=1}}=s,t.push({index:n,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:i&&o+i,stackWeight:a});return t}function u5(e){const t={};for(const n of e){const{stack:r,pos:s,stackWeight:o}=n;if(!r||!vS.includes(s))continue;const i=t[r]||(t[r]={count:0,placed:0,weight:0,size:0});i.count++,i.weight+=o}return t}function d5(e,t){const n=u5(e),{vBoxMaxWidth:r,hBoxMaxHeight:s}=t;let o,i,a;for(o=0,i=e.length;o<i;++o){a=e[o];const{fullSize:c}=a.box,l=n[a.stack],u=l&&a.stackWeight/l.weight;a.horizontal?(a.width=u?u*r:c&&t.availableWidth,a.height=s):(a.width=r,a.height=u?u*s:c&&t.availableHeight)}return n}function f5(e){const t=l5(e),n=So(t.filter(l=>l.box.fullSize),!0),r=So(wo(t,"left"),!0),s=So(wo(t,"right")),o=So(wo(t,"top"),!0),i=So(wo(t,"bottom")),a=yy(t,"x"),c=yy(t,"y");return{fullSize:n,leftAndTop:r.concat(o),rightAndBottom:s.concat(c).concat(i).concat(a),chartArea:wo(t,"chartArea"),vertical:r.concat(s).concat(c),horizontal:o.concat(i).concat(a)}}function by(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function xS(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function h5(e,t,n,r){const{pos:s,box:o}=n,i=e.maxPadding;if(!xe(s)){n.size&&(e[s]-=n.size);const d=r[n.stack]||{size:0,count:1};d.size=Math.max(d.size,n.horizontal?o.height:o.width),n.size=d.size/d.count,e[s]+=n.size}o.getPadding&&xS(i,o.getPadding());const a=Math.max(0,t.outerWidth-by(i,e,"left","right")),c=Math.max(0,t.outerHeight-by(i,e,"top","bottom")),l=a!==e.w,u=c!==e.h;return e.w=a,e.h=c,n.horizontal?{same:l,other:u}:{same:u,other:l}}function p5(e){const t=e.maxPadding;function n(r){const s=Math.max(t[r]-e[r],0);return e[r]+=s,s}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function m5(e,t){const n=t.maxPadding;function r(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(i=>{o[i]=Math.max(t[i],n[i])}),o}return r(e?["left","right"]:["top","bottom"])}function Do(e,t,n,r){const s=[];let o,i,a,c,l,u;for(o=0,i=e.length,l=0;o<i;++o){a=e[o],c=a.box,c.update(a.width||t.w,a.height||t.h,m5(a.horizontal,t));const{same:d,other:f}=h5(t,n,a,r);l|=d&&s.length,u=u||f,c.fullSize||s.push(a)}return l&&Do(s,t,n,r)||u}function ga(e,t,n,r,s){e.top=n,e.left=t,e.right=t+r,e.bottom=n+s,e.width=r,e.height=s}function vy(e,t,n,r){const s=n.padding;let{x:o,y:i}=t;for(const a of e){const c=a.box,l=r[a.stack]||{placed:0,weight:1},u=a.stackWeight/l.weight||1;if(a.horizontal){const d=t.w*u,f=l.size||c.height;li(l.start)&&(i=l.start),c.fullSize?ga(c,s.left,i,n.outerWidth-s.right-s.left,f):ga(c,t.left+l.placed,i,d,f),l.start=i,l.placed+=d,i=c.bottom}else{const d=t.h*u,f=l.size||c.width;li(l.start)&&(o=l.start),c.fullSize?ga(c,o,s.top,f,n.outerHeight-s.bottom-s.top):ga(c,o,t.top+l.placed,f,d),l.start=o,l.placed+=d,o=c.right}}t.x=o,t.y=i}var bt={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,r){if(!e)return;const s=xt(e.options.layout.padding),o=Math.max(t-s.width,0),i=Math.max(n-s.height,0),a=f5(e.boxes),c=a.vertical,l=a.horizontal;Ce(e.boxes,m=>{typeof m.beforeLayout=="function"&&m.beforeLayout()});const u=c.reduce((m,y)=>y.box.options&&y.box.options.display===!1?m:m+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:n,padding:s,availableWidth:o,availableHeight:i,vBoxMaxWidth:o/2/u,hBoxMaxHeight:i/2}),f=Object.assign({},s);xS(f,xt(r));const h=Object.assign({maxPadding:f,w:o,h:i,x:s.left,y:s.top},s),p=d5(c.concat(l),d);Do(a.fullSize,h,d,p),Do(c,h,d,p),Do(l,h,d,p)&&Do(c,h,d,p),p5(h),vy(a.leftAndTop,h,d,p),h.x+=h.w,h.y+=h.h,vy(a.rightAndBottom,h,d,p),e.chartArea={left:h.left,top:h.top,right:h.left+h.w,bottom:h.top+h.h,height:h.h,width:h.w},Ce(a.chartArea,m=>{const y=m.box;Object.assign(y,e.chartArea),y.update(h.w,h.h,{left:0,top:0,right:0,bottom:0})})}};class _S{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,r){}removeEventListener(t,n,r){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,r,s){return n=Math.max(0,n||t.width),r=r||t.height,{width:n,height:Math.max(0,s?Math.floor(n/s):r)}}isAttached(t){return!0}updateConfig(t){}}class g5 extends _S{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Va="$chartjs",y5={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},xy=e=>e===null||e==="";function b5(e,t){const n=e.style,r=e.getAttribute("height"),s=e.getAttribute("width");if(e[Va]={initial:{height:r,width:s,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",xy(s)){const o=ry(e,"width");o!==void 0&&(e.width=o)}if(xy(r))if(e.style.height==="")e.height=e.width/(t||2);else{const o=ry(e,"height");o!==void 0&&(e.height=o)}return e}const wS=pU?{passive:!0}:!1;function v5(e,t,n){e&&e.addEventListener(t,n,wS)}function x5(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,wS)}function _5(e,t){const n=y5[e.type]||e.type,{x:r,y:s}=Ir(e,t);return{type:n,chart:t,native:e,x:r!==void 0?r:null,y:s!==void 0?s:null}}function Tc(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function w5(e,t,n){const r=e.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||Tc(a.addedNodes,r),i=i&&!Tc(a.removedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function S5(e,t,n){const r=e.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||Tc(a.removedNodes,r),i=i&&!Tc(a.addedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const fi=new Map;let _y=0;function SS(){const e=window.devicePixelRatio;e!==_y&&(_y=e,fi.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function E5(e,t){fi.size||window.addEventListener("resize",SS),fi.set(e,t)}function k5(e){fi.delete(e),fi.size||window.removeEventListener("resize",SS)}function C5(e,t,n){const r=e.canvas,s=r&&Nh(r);if(!s)return;const o=Y0((a,c)=>{const l=s.clientWidth;n(a,c),l<s.clientWidth&&n()},window),i=new ResizeObserver(a=>{const c=a[0],l=c.contentRect.width,u=c.contentRect.height;l===0&&u===0||o(l,u)});return i.observe(s),E5(e,o),i}function Nu(e,t,n){n&&n.disconnect(),t==="resize"&&k5(e)}function R5(e,t,n){const r=e.canvas,s=Y0(o=>{e.ctx!==null&&n(_5(o,e))},e);return v5(r,t,s),s}class P5 extends _S{acquireContext(t,n){const r=t&&t.getContext&&t.getContext("2d");return r&&r.canvas===t?(b5(t,n),r):null}releaseContext(t){const n=t.canvas;if(!n[Va])return!1;const r=n[Va].initial;["height","width"].forEach(o=>{const i=r[o];ye(i)?n.removeAttribute(o):n.setAttribute(o,i)});const s=r.style||{};return Object.keys(s).forEach(o=>{n.style[o]=s[o]}),n.width=n.width,delete n[Va],!0}addEventListener(t,n,r){this.removeEventListener(t,n);const s=t.$proxies||(t.$proxies={}),i={attach:w5,detach:S5,resize:C5}[n]||R5;s[n]=i(t,n,r)}removeEventListener(t,n){const r=t.$proxies||(t.$proxies={}),s=r[n];if(!s)return;({attach:Nu,detach:Nu,resize:Nu}[n]||x5)(t,n,s),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,r,s){return hU(t,n,r,s)}isAttached(t){const n=t&&Nh(t);return!!(n&&n.isConnected)}}function O5(e){return!Ah()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?g5:P5}let Jn=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:n,y:r}=this.getProps(["x","y"],t);return{x:n,y:r}}hasValue(){return Ys(this.x)&&Ys(this.y)}getProps(t,n){const r=this.$animations;if(!n||!r)return this;const s={};return t.forEach(o=>{s[o]=r[o]&&r[o].active()?r[o]._to:this[o]}),s}};function T5(e,t){const n=e.options.ticks,r=M5(e),s=Math.min(n.maxTicksLimit||r,r),o=n.major.enabled?N5(t):[],i=o.length,a=o[0],c=o[i-1],l=[];if(i>s)return D5(t,l,o,i/s),l;const u=A5(o,t,s);if(i>0){let d,f;const h=i>1?Math.round((c-a)/(i-1)):null;for(ya(t,l,u,ye(h)?0:a-h,a),d=0,f=i-1;d<f;d++)ya(t,l,u,o[d],o[d+1]);return ya(t,l,u,c,ye(h)?t.length:c+h),l}return ya(t,l,u),l}function M5(e){const t=e.options.offset,n=e._tickSize(),r=e._length/n+(t?0:1),s=e._maxLength/n;return Math.floor(Math.min(r,s))}function A5(e,t,n){const r=I5(e),s=t.length/n;if(!r)return Math.max(s,1);const o=gB(r);for(let i=0,a=o.length-1;i<a;i++){const c=o[i];if(c>s)return c}return Math.max(s,1)}function N5(e){const t=[];let n,r;for(n=0,r=e.length;n<r;n++)e[n].major&&t.push(n);return t}function D5(e,t,n,r){let s=0,o=n[0],i;for(r=Math.ceil(r),i=0;i<e.length;i++)i===o&&(t.push(e[i]),s++,o=n[s*r])}function ya(e,t,n,r,s){const o=de(r,0),i=Math.min(de(s,e.length),e.length);let a=0,c,l,u;for(n=Math.ceil(n),s&&(c=s-r,n=c/Math.floor(c/n)),u=o;u<0;)a++,u=Math.round(o+a*n);for(l=Math.max(o,0);l<i;l++)l===u&&(t.push(e[l]),a++,u=Math.round(o+a*n))}function I5(e){const t=e.length;let n,r;if(t<2)return!1;for(r=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==r)return!1;return r}const j5=e=>e==="left"?"right":e==="right"?"left":e,wy=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,Sy=(e,t)=>Math.min(t||e,e);function Ey(e,t){const n=[],r=e.length/t,s=e.length;let o=0;for(;o<s;o+=r)n.push(e[Math.floor(o)]);return n}function L5(e,t,n){const r=e.ticks.length,s=Math.min(t,r-1),o=e._startPixel,i=e._endPixel,a=1e-6;let c=e.getPixelForTick(s),l;if(!(n&&(r===1?l=Math.max(c-o,i-c):t===0?l=(e.getPixelForTick(1)-c)/2:l=(c-e.getPixelForTick(s-1))/2,c+=s<t?l:-l,c<o-a||c>i+a)))return c}function F5(e,t){Ce(e,n=>{const r=n.gc,s=r.length/2;let o;if(s>t){for(o=0;o<s;++o)delete n.data[r[o]];r.splice(0,s)}})}function Eo(e){return e.drawTicks?e.tickLength:0}function ky(e,t){if(!e.display)return 0;const n=rt(e.font,t),r=xt(e.padding);return(ze(e.text)?e.text.length:1)*n.lineHeight+r.height}function z5(e,t){return Rr(e,{scale:t,type:"scale"})}function $5(e,t,n){return Rr(e,{tick:n,index:t,type:"tick"})}function V5(e,t,n){let r=Ch(e);return(n&&t!=="right"||!n&&t==="right")&&(r=j5(r)),r}function B5(e,t,n,r){const{top:s,left:o,bottom:i,right:a,chart:c}=e,{chartArea:l,scales:u}=c;let d=0,f,h,p;const m=i-s,y=a-o;if(e.isHorizontal()){if(h=ht(r,o,a),xe(n)){const b=Object.keys(n)[0],x=n[b];p=u[b].getPixelForValue(x)+m-t}else n==="center"?p=(l.bottom+l.top)/2+m-t:p=wy(e,n,t);f=a-o}else{if(xe(n)){const b=Object.keys(n)[0],x=n[b];h=u[b].getPixelForValue(x)-y+t}else n==="center"?h=(l.left+l.right)/2-y+t:h=wy(e,n,t);p=ht(r,i,s),d=n==="left"?-He:He}return{titleX:h,titleY:p,maxWidth:f,rotation:d}}class hs extends Jn{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.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(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:r,_suggestedMax:s}=this;return t=Ft(t,Number.POSITIVE_INFINITY),n=Ft(n,Number.NEGATIVE_INFINITY),r=Ft(r,Number.POSITIVE_INFINITY),s=Ft(s,Number.NEGATIVE_INFINITY),{min:Ft(t,r),max:Ft(n,s),minDefined:We(t),maxDefined:We(n)}}getMinMax(t){let{min:n,max:r,minDefined:s,maxDefined:o}=this.getUserBounds(),i;if(s&&o)return{min:n,max:r};const a=this.getMatchingVisibleMetas();for(let c=0,l=a.length;c<l;++c)i=a[c].controller.getMinMax(this,t),s||(n=Math.min(n,i.min)),o||(r=Math.max(r,i.max));return n=o&&n>r?r:n,r=s&&n>r?n:r,{min:Ft(n,Ft(r,n)),max:Ft(r,Ft(n,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){Me(this.options.beforeUpdate,[this])}update(t,n,r){const{beginAtZero:s,grace:o,ticks:i}=this.options,a=i.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=r=Object.assign({left:0,right:0,top:0,bottom:0},r),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+r.left+r.right:this.height+r.top+r.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=HB(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const c=a<this.ticks.length;this._convertTicksToLabels(c?Ey(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),i.display&&(i.autoSkip||i.source==="auto")&&(this.ticks=T5(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),c&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,r;this.isHorizontal()?(n=this.left,r=this.right):(n=this.top,r=this.bottom,t=!t),this._startPixel=n,this._endPixel=r,this._reversePixels=t,this._length=r-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){Me(this.options.afterUpdate,[this])}beforeSetDimensions(){Me(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(){Me(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),Me(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){Me(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const n=this.options.ticks;let r,s,o;for(r=0,s=t.length;r<s;r++)o=t[r],o.label=Me(n.callback,[o.value,r,t],this)}afterTickToLabelConversion(){Me(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){Me(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,r=Sy(this.ticks.length,t.ticks.maxTicksLimit),s=n.minRotation||0,o=n.maxRotation;let i=s,a,c,l;if(!this._isVisible()||!n.display||s>=o||r<=1||!this.isHorizontal()){this.labelRotation=s;return}const u=this._getLabelSizes(),d=u.widest.width,f=u.highest.height,h=at(this.chart.width-d,0,this.maxWidth);a=t.offset?this.maxWidth/r:h/(r-1),d+6>a&&(a=h/(r-(t.offset?.5:1)),c=this.maxHeight-Eo(t.grid)-n.padding-ky(t.title,this.chart.options.font),l=Math.sqrt(d*d+f*f),i=Eh(Math.min(Math.asin(at((u.highest.height+6)/a,-1,1)),Math.asin(at(c/l,-1,1))-Math.asin(at(f/l,-1,1)))),i=Math.max(s,Math.min(o,i))),this.labelRotation=i}afterCalculateLabelRotation(){Me(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){Me(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:r,title:s,grid:o}}=this,i=this._isVisible(),a=this.isHorizontal();if(i){const c=ky(s,n.options.font);if(a?(t.width=this.maxWidth,t.height=Eo(o)+c):(t.height=this.maxHeight,t.width=Eo(o)+c),r.display&&this.ticks.length){const{first:l,last:u,widest:d,highest:f}=this._getLabelSizes(),h=r.padding*2,p=fn(this.labelRotation),m=Math.cos(p),y=Math.sin(p);if(a){const b=r.mirror?0:y*d.width+m*f.height;t.height=Math.min(this.maxHeight,t.height+b+h)}else{const b=r.mirror?0:m*d.width+y*f.height;t.width=Math.min(this.maxWidth,t.width+b+h)}this._calculatePadding(l,u,y,m)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,r,s){const{ticks:{align:o,padding:i},position:a}=this.options,c=this.labelRotation!==0,l=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,h=0;c?l?(f=s*t.width,h=r*n.height):(f=r*t.height,h=s*n.width):o==="start"?h=n.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,h=n.width/2),this.paddingLeft=Math.max((f-u+i)*this.width/(this.width-u),0),this.paddingRight=Math.max((h-d+i)*this.width/(this.width-d),0)}else{let u=n.height/2,d=t.height/2;o==="start"?(u=0,d=t.height):o==="end"&&(u=n.height,d=0),this.paddingTop=u+i,this.paddingBottom=d+i}}_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(){Me(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,r;for(n=0,r=t.length;n<r;n++)ye(t[n].label)&&(t.splice(n,1),r--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const n=this.options.ticks.sampleSize;let r=this.ticks;n<r.length&&(r=Ey(r,n)),this._labelSizes=t=this._computeLabelSizes(r,r.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,r){const{ctx:s,_longestTextCache:o}=this,i=[],a=[],c=Math.floor(n/Sy(n,r));let l=0,u=0,d,f,h,p,m,y,b,x,_,w,S;for(d=0;d<n;d+=c){if(p=t[d].label,m=this._resolveTickFontOptions(d),s.font=y=m.string,b=o[y]=o[y]||{data:{},gc:[]},x=m.lineHeight,_=w=0,!ye(p)&&!ze(p))_=Pc(s,b.data,b.gc,_,p),w=x;else if(ze(p))for(f=0,h=p.length;f<h;++f)S=p[f],!ye(S)&&!ze(S)&&(_=Pc(s,b.data,b.gc,_,S),w+=x);i.push(_),a.push(w),l=Math.max(_,l),u=Math.max(w,u)}F5(o,n);const C=i.indexOf(l),k=a.indexOf(u),E=P=>({width:i[P]||0,height:a[P]||0});return{first:E(0),last:E(n-1),widest:E(C),highest:E(k),widths:i,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return xB(this._alignToPixels?Ar(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&t<n.length){const r=n[t];return r.$context||(r.$context=$5(this.getContext(),t,r))}return this.$context||(this.$context=z5(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=fn(this.labelRotation),r=Math.abs(Math.cos(n)),s=Math.abs(Math.sin(n)),o=this._getLabelSizes(),i=t.autoSkipPadding||0,a=o?o.widest.width+i:0,c=o?o.highest.height+i:0;return this.isHorizontal()?c*r>a*s?a/r:c/s:c*s<a*r?c/r:a/s}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const n=this.axis,r=this.chart,s=this.options,{grid:o,position:i,border:a}=s,c=o.offset,l=this.isHorizontal(),d=this.ticks.length+(c?1:0),f=Eo(o),h=[],p=a.setContext(this.getContext()),m=p.display?p.width:0,y=m/2,b=function(D){return Ar(r,D,m)};let x,_,w,S,C,k,E,P,O,N,A,j;if(i==="top")x=b(this.bottom),k=this.bottom-f,P=x-y,N=b(t.top)+y,j=t.bottom;else if(i==="bottom")x=b(this.top),N=t.top,j=b(t.bottom)-y,k=x+y,P=this.top+f;else if(i==="left")x=b(this.right),C=this.right-f,E=x-y,O=b(t.left)+y,A=t.right;else if(i==="right")x=b(this.left),O=t.left,A=b(t.right)-y,C=x+y,E=this.left+f;else if(n==="x"){if(i==="center")x=b((t.top+t.bottom)/2+.5);else if(xe(i)){const D=Object.keys(i)[0],H=i[D];x=b(this.chart.scales[D].getPixelForValue(H))}N=t.top,j=t.bottom,k=x+y,P=k+f}else if(n==="y"){if(i==="center")x=b((t.left+t.right)/2);else if(xe(i)){const D=Object.keys(i)[0],H=i[D];x=b(this.chart.scales[D].getPixelForValue(H))}C=x-y,E=C-f,O=t.left,A=t.right}const $=de(s.ticks.maxTicksLimit,d),q=Math.max(1,Math.ceil(d/$));for(_=0;_<d;_+=q){const D=this.getContext(_),H=o.setContext(D),F=a.setContext(D),W=H.lineWidth,se=H.color,I=F.dash||[],Y=F.dashOffset,K=H.tickWidth,Z=H.tickColor,oe=H.tickBorderDash||[],ce=H.tickBorderDashOffset;w=L5(this,_,c),w!==void 0&&(S=Ar(r,w,W),l?C=E=O=A=S:k=P=N=j=S,h.push({tx1:C,ty1:k,tx2:E,ty2:P,x1:O,y1:N,x2:A,y2:j,width:W,color:se,borderDash:I,borderDashOffset:Y,tickWidth:K,tickColor:Z,tickBorderDash:oe,tickBorderDashOffset:ce}))}return this._ticksLength=d,this._borderValue=x,h}_computeLabelItems(t){const n=this.axis,r=this.options,{position:s,ticks:o}=r,i=this.isHorizontal(),a=this.ticks,{align:c,crossAlign:l,padding:u,mirror:d}=o,f=Eo(r.grid),h=f+u,p=d?-u:h,m=-fn(this.labelRotation),y=[];let b,x,_,w,S,C,k,E,P,O,N,A,j="middle";if(s==="top")C=this.bottom-p,k=this._getXAxisLabelAlignment();else if(s==="bottom")C=this.top+p,k=this._getXAxisLabelAlignment();else if(s==="left"){const q=this._getYAxisLabelAlignment(f);k=q.textAlign,S=q.x}else if(s==="right"){const q=this._getYAxisLabelAlignment(f);k=q.textAlign,S=q.x}else if(n==="x"){if(s==="center")C=(t.top+t.bottom)/2+h;else if(xe(s)){const q=Object.keys(s)[0],D=s[q];C=this.chart.scales[q].getPixelForValue(D)+h}k=this._getXAxisLabelAlignment()}else if(n==="y"){if(s==="center")S=(t.left+t.right)/2-h;else if(xe(s)){const q=Object.keys(s)[0],D=s[q];S=this.chart.scales[q].getPixelForValue(D)}k=this._getYAxisLabelAlignment(f).textAlign}n==="y"&&(c==="start"?j="top":c==="end"&&(j="bottom"));const $=this._getLabelSizes();for(b=0,x=a.length;b<x;++b){_=a[b],w=_.label;const q=o.setContext(this.getContext(b));E=this.getPixelForTick(b)+o.labelOffset,P=this._resolveTickFontOptions(b),O=P.lineHeight,N=ze(w)?w.length:1;const D=N/2,H=q.color,F=q.textStrokeColor,W=q.textStrokeWidth;let se=k;i?(S=E,k==="inner"&&(b===x-1?se=this.options.reverse?"left":"right":b===0?se=this.options.reverse?"right":"left":se="center"),s==="top"?l==="near"||m!==0?A=-N*O+O/2:l==="center"?A=-$.highest.height/2-D*O+O:A=-$.highest.height+O/2:l==="near"||m!==0?A=O/2:l==="center"?A=$.highest.height/2-D*O:A=$.highest.height-N*O,d&&(A*=-1),m!==0&&!q.showLabelBackdrop&&(S+=O/2*Math.sin(m))):(C=E,A=(1-N)*O/2);let I;if(q.showLabelBackdrop){const Y=xt(q.backdropPadding),K=$.heights[b],Z=$.widths[b];let oe=A-Y.top,ce=0-Y.left;switch(j){case"middle":oe-=K/2;break;case"bottom":oe-=K;break}switch(k){case"center":ce-=Z/2;break;case"right":ce-=Z;break;case"inner":b===x-1?ce-=Z:b>0&&(ce-=Z/2);break}I={left:ce,top:oe,width:Z+Y.width,height:K+Y.height,color:q.backdropColor}}y.push({label:w,font:P,textOffset:A,options:{rotation:m,color:H,strokeColor:F,strokeWidth:W,textAlign:se,textBaseline:j,translation:[S,C],backdrop:I}})}return y}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-fn(this.labelRotation))return t==="top"?"left":"right";let s="center";return n.align==="start"?s="left":n.align==="end"?s="right":n.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:r,mirror:s,padding:o}}=this.options,i=this._getLabelSizes(),a=t+o,c=i.widest.width;let l,u;return n==="left"?s?(u=this.right+o,r==="near"?l="left":r==="center"?(l="center",u+=c/2):(l="right",u+=c)):(u=this.right-a,r==="near"?l="right":r==="center"?(l="center",u-=c/2):(l="left",u=this.left)):n==="right"?s?(u=this.left+o,r==="near"?l="right":r==="center"?(l="center",u-=c/2):(l="left",u-=c)):(u=this.left+a,r==="near"?l="left":r==="center"?(l="center",u+=c/2):(l="right",u=this.right)):l="right",{textAlign:l,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:r,top:s,width:o,height:i}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(r,s,o,i),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?n.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const n=this.options.grid,r=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,i;const a=(c,l,u)=>{!u.width||!u.color||(r.save(),r.lineWidth=u.width,r.strokeStyle=u.color,r.setLineDash(u.borderDash||[]),r.lineDashOffset=u.borderDashOffset,r.beginPath(),r.moveTo(c.x,c.y),r.lineTo(l.x,l.y),r.stroke(),r.restore())};if(n.display)for(o=0,i=s.length;o<i;++o){const c=s[o];n.drawOnChartArea&&a({x:c.x1,y:c.y1},{x:c.x2,y:c.y2},c),n.drawTicks&&a({x:c.tx1,y:c.ty1},{x:c.tx2,y:c.ty2},{color:c.tickColor,width:c.tickWidth,borderDash:c.tickBorderDash,borderDashOffset:c.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:n,options:{border:r,grid:s}}=this,o=r.setContext(this.getContext()),i=r.display?o.width:0;if(!i)return;const a=s.setContext(this.getContext(0)).lineWidth,c=this._borderValue;let l,u,d,f;this.isHorizontal()?(l=Ar(t,this.left,i)-i/2,u=Ar(t,this.right,a)+a/2,d=f=c):(d=Ar(t,this.top,i)-i/2,f=Ar(t,this.bottom,a)+a/2,l=u=c),n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.beginPath(),n.moveTo(l,d),n.lineTo(u,f),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const r=this.ctx,s=this._computeLabelArea();s&&Cl(r,s);const o=this.getLabelItems(t);for(const i of o){const a=i.options,c=i.font,l=i.label,u=i.textOffset;cs(r,l,0,u,c,a)}s&&Rl(r)}drawTitle(){const{ctx:t,options:{position:n,title:r,reverse:s}}=this;if(!r.display)return;const o=rt(r.font),i=xt(r.padding),a=r.align;let c=o.lineHeight/2;n==="bottom"||n==="center"||xe(n)?(c+=i.bottom,ze(r.text)&&(c+=o.lineHeight*(r.text.length-1))):c+=i.top;const{titleX:l,titleY:u,maxWidth:d,rotation:f}=B5(this,c,n,a);cs(t,r.text,0,0,o,{color:r.color,maxWidth:d,rotation:f,textAlign:V5(a,n,s),textBaseline:"middle",translation:[l,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,n=t.ticks&&t.ticks.z||0,r=de(t.grid&&t.grid.z,-1),s=de(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==hs.prototype.draw?[{z:n,draw:o=>{this.draw(o)}}]:[{z:r,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),r=this.axis+"AxisID",s=[];let o,i;for(o=0,i=n.length;o<i;++o){const a=n[o];a[r]===this.id&&(!t||a.type===t)&&s.push(a)}return s}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return rt(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class ba{constructor(t,n,r){this.type=t,this.scope=n,this.override=r,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const n=Object.getPrototypeOf(t);let r;H5(n)&&(r=this.register(n));const s=this.items,o=t.id,i=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,U5(t,i,r),this.override&&$e.override(t.id,t.overrides)),i}get(t){return this.items[t]}unregister(t){const n=this.items,r=t.id,s=this.scope;r in n&&delete n[r],s&&r in $e[s]&&(delete $e[s][r],this.override&&delete as[r])}}function U5(e,t,n){const r=ci(Object.create(null),[n?$e.get(n):{},$e.get(t),e.defaults]);$e.set(t,r),e.defaultRoutes&&W5(t,e.defaultRoutes),e.descriptors&&$e.describe(t,e.descriptors)}function W5(e,t){Object.keys(t).forEach(n=>{const r=n.split("."),s=r.pop(),o=[e].concat(r).join("."),i=t[n].split("."),a=i.pop(),c=i.join(".");$e.route(o,s,c,a)})}function H5(e){return"id"in e&&"defaults"in e}class q5{constructor(){this.controllers=new ba(Pr,"datasets",!0),this.elements=new ba(Jn,"elements"),this.plugins=new ba(Object,"plugins"),this.scales=new ba(hs,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,r){[...n].forEach(s=>{const o=r||this._getRegistryForType(s);r||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):Ce(s,i=>{const a=r||this._getRegistryForType(i);this._exec(t,a,i)})})}_exec(t,n,r){const s=Sh(t);Me(r["before"+s],[],r),n[t](r),Me(r["after"+s],[],r)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){const r=this._typedRegistries[n];if(r.isForType(t))return r}return this.plugins}_get(t,n,r){const s=n.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+r+".");return s}}var wn=new q5;class K5{constructor(){this._init=void 0}notify(t,n,r,s){if(n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;const o=s?this._descriptors(t).filter(s):this._descriptors(t),i=this._notify(o,t,n,r);return n==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),i}_notify(t,n,r,s){s=s||{};for(const o of t){const i=o.plugin,a=i[r],c=[n,s,o.options];if(Me(a,c,i)===!1&&s.cancelable)return!1}return!0}invalidate(){ye(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){const r=t&&t.config,s=de(r.options&&r.options.plugins,{}),o=Z5(r);return s===!1&&!n?[]:Y5(t,o,s,n)}_notifyStateChanges(t){const n=this._oldCache||[],r=this._cache,s=(o,i)=>o.filter(a=>!i.some(c=>a.plugin.id===c.plugin.id));this._notify(s(n,r),t,"stop"),this._notify(s(r,n),t,"start")}}function Z5(e){const t={},n=[],r=Object.keys(wn.plugins.items);for(let o=0;o<r.length;o++)n.push(wn.getPlugin(r[o]));const s=e.plugins||[];for(let o=0;o<s.length;o++){const i=s[o];n.indexOf(i)===-1&&(n.push(i),t[i.id]=!0)}return{plugins:n,localIds:t}}function G5(e,t){return!t&&e===!1?null:e===!0?{}:e}function Y5(e,{plugins:t,localIds:n},r,s){const o=[],i=e.getContext();for(const a of t){const c=a.id,l=G5(r[c],s);l!==null&&o.push({plugin:a,options:X5(e.config,{plugin:a,local:n[c]},l,i)})}return o}function X5(e,{plugin:t,local:n},r,s){const o=e.pluginScopeKeys(t),i=e.getOptionScopes(r,o);return n&&t.defaults&&i.push(t.defaults),e.createResolver(i,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Wd(e,t){const n=$e.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function J5(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function Q5(e,t){return e===t?"_index_":"_value_"}function Cy(e){if(e==="x"||e==="y"||e==="r")return e}function eW(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function Hd(e,...t){if(Cy(e))return e;for(const n of t){const r=n.axis||eW(n.position)||e.length>1&&Cy(e[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function Ry(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function tW(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(r=>r.xAxisID===e||r.yAxisID===e);if(n.length)return Ry(e,"x",n[0])||Ry(e,"y",n[0])}return{}}function nW(e,t){const n=as[e.type]||{scales:{}},r=t.scales||{},s=Wd(e.type,t),o=Object.create(null);return Object.keys(r).forEach(i=>{const a=r[i];if(!xe(a))return console.error(`Invalid scale configuration for scale: ${i}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${i}`);const c=Hd(i,a,tW(i,e),$e.scales[a.type]),l=Q5(c,s),u=n.scales||{};o[i]=Vo(Object.create(null),[{axis:c},a,u[c],u[l]])}),e.data.datasets.forEach(i=>{const a=i.type||e.type,c=i.indexAxis||Wd(a,t),u=(as[a]||{}).scales||{};Object.keys(u).forEach(d=>{const f=J5(d,c),h=i[f+"AxisID"]||f;o[h]=o[h]||Object.create(null),Vo(o[h],[{axis:f},r[h],u[d]])})}),Object.keys(o).forEach(i=>{const a=o[i];Vo(a,[$e.scales[a.type],$e.scale])}),o}function ES(e){const t=e.options||(e.options={});t.plugins=de(t.plugins,{}),t.scales=nW(e,t)}function kS(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function rW(e){return e=e||{},e.data=kS(e.data),ES(e),e}const Py=new Map,CS=new Set;function va(e,t){let n=Py.get(e);return n||(n=t(),Py.set(e,n),CS.add(n)),n}const ko=(e,t,n)=>{const r=br(t,n);r!==void 0&&e.add(r)};class sW{constructor(t){this._config=rW(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=kS(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),ES(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return va(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return va(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return va(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,r=this.type;return va(`${r}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const r=this._scopeCache;let s=r.get(t);return(!s||n)&&(s=new Map,r.set(t,s)),s}getOptionScopes(t,n,r){const{options:s,type:o}=this,i=this._cachedScopes(t,r),a=i.get(n);if(a)return a;const c=new Set;n.forEach(u=>{t&&(c.add(t),u.forEach(d=>ko(c,t,d))),u.forEach(d=>ko(c,s,d)),u.forEach(d=>ko(c,as[o]||{},d)),u.forEach(d=>ko(c,$e,d)),u.forEach(d=>ko(c,Bd,d))});const l=Array.from(c);return l.length===0&&l.push(Object.create(null)),CS.has(n)&&i.set(n,l),l}chartOptionScopes(){const{options:t,type:n}=this;return[t,as[n]||{},$e.datasets[n]||{},{type:n},$e,Bd]}resolveNamedOptions(t,n,r,s=[""]){const o={$shared:!0},{resolver:i,subPrefixes:a}=Oy(this._resolverCache,t,s);let c=i;if(iW(i,n)){o.$shared=!1,r=vr(r)?r():r;const l=this.createResolver(t,r,a);c=Xs(i,r,l)}for(const l of n)o[l]=c[l];return o}createResolver(t,n,r=[""],s){const{resolver:o}=Oy(this._resolverCache,t,r);return xe(n)?Xs(o,n,void 0,s):o}}function Oy(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));const s=n.join();let o=r.get(s);return o||(o={resolver:Oh(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},r.set(s,o)),o}const oW=e=>xe(e)&&Object.getOwnPropertyNames(e).some(t=>vr(e[t]));function iW(e,t){const{isScriptable:n,isIndexable:r}=nS(e);for(const s of t){const o=n(s),i=r(s),a=(i||o)&&e[s];if(o&&(vr(a)||oW(a))||i&&ze(a))return!0}return!1}var aW="4.5.1";const cW=["top","bottom","left","right","chartArea"];function Ty(e,t){return e==="top"||e==="bottom"||cW.indexOf(e)===-1&&t==="x"}function My(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function Ay(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),Me(n&&n.onComplete,[e],t)}function lW(e){const t=e.chart,n=t.options.animation;Me(n&&n.onProgress,[e],t)}function RS(e){return Ah()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Ba={},Ny=e=>{const t=RS(e);return Object.values(Ba).filter(n=>n.canvas===t).pop()};function uW(e,t,n){const r=Object.keys(e);for(const s of r){const o=+s;if(o>=t){const i=e[s];delete e[s],(n>0||o>t)&&(e[o+n]=i)}}}function dW(e,t,n,r){return!n||e.type==="mouseout"?null:r?t:e}let Ti=class{static defaults=$e;static instances=Ba;static overrides=as;static registry=wn;static version=aW;static getChart=Ny;static register(...t){wn.add(...t),Dy()}static unregister(...t){wn.remove(...t),Dy()}constructor(t,n){const r=this.config=new sW(n),s=RS(t),o=Ny(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const i=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||O5(s)),this.platform.updateConfig(r);const a=this.platform.acquireContext(s,i.aspectRatio),c=a&&a.canvas,l=c&&c.height,u=c&&c.width;if(this.id=aB(),this.ctx=a,this.canvas=c,this.width=u,this.height=l,this._options=i,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 K5,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=EB(d=>this.update(d),i.resizeDelay||0),this._dataChanges=[],Ba[this.id]=this,!a||!c){console.error("Failed to create chart: can't acquire context from the given item");return}Ln.listen(this,"complete",Ay),Ln.listen(this,"progress",lW),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:r,height:s,_aspectRatio:o}=this;return ye(t)?n&&o?o:s?r/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return wn}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ny(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Qg(this.canvas,this.ctx),this}stop(){return Ln.stop(this),this}resize(t,n){Ln.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const r=this.options,s=this.canvas,o=r.maintainAspectRatio&&this.aspectRatio,i=this.platform.getMaximumSize(s,t,n,o),a=r.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=i.width,this.height=i.height,this._aspectRatio=this.aspectRatio,ny(this,a,!0)&&(this.notifyPlugins("resize",{size:i}),Me(r.onResize,[this,i],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};Ce(n,(r,s)=>{r.id=s})}buildOrUpdateScales(){const t=this.options,n=t.scales,r=this.scales,s=Object.keys(r).reduce((i,a)=>(i[a]=!1,i),{});let o=[];n&&(o=o.concat(Object.keys(n).map(i=>{const a=n[i],c=Hd(i,a),l=c==="r",u=c==="x";return{options:a,dposition:l?"chartArea":u?"bottom":"left",dtype:l?"radialLinear":u?"category":"linear"}}))),Ce(o,i=>{const a=i.options,c=a.id,l=Hd(c,a),u=de(a.type,i.dtype);(a.position===void 0||Ty(a.position,l)!==Ty(i.dposition))&&(a.position=i.dposition),s[c]=!0;let d=null;if(c in r&&r[c].type===u)d=r[c];else{const f=wn.getScale(u);d=new f({id:c,type:u,ctx:this.ctx,chart:this}),r[d.id]=d}d.init(a,t)}),Ce(s,(i,a)=>{i||delete r[a]}),Ce(r,i=>{bt.configure(this,i,i.options),bt.addBox(this,i)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,r=t.length;if(t.sort((s,o)=>s.index-o.index),r>n){for(let s=n;s<r;++s)this._destroyDatasetMeta(s);t.splice(n,r-n)}this._sortedMetasets=t.slice(0).sort(My("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((r,s)=>{n.filter(o=>o===r._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let r,s;for(this._removeUnreferencedMetasets(),r=0,s=n.length;r<s;r++){const o=n[r];let i=this.getDatasetMeta(r);const a=o.type||this.config.type;if(i.type&&i.type!==a&&(this._destroyDatasetMeta(r),i=this.getDatasetMeta(r)),i.type=a,i.indexAxis=o.indexAxis||Wd(a,this.options),i.order=o.order||0,i.index=r,i.label=""+o.label,i.visible=this.isDatasetVisible(r),i.controller)i.controller.updateIndex(r),i.controller.linkScales();else{const c=wn.getController(a),{datasetElementType:l,dataElementType:u}=$e.datasets[a];Object.assign(c,{dataElementType:wn.getElement(u),datasetElementType:l&&wn.getElement(l)}),i.controller=new c(this,r),t.push(i.controller)}}return this._updateMetasets(),t}_resetElements(){Ce(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const r=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!r.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let i=0;for(let l=0,u=this.data.datasets.length;l<u;l++){const{controller:d}=this.getDatasetMeta(l),f=!s&&o.indexOf(d)===-1;d.buildOrUpdateElements(f),i=Math.max(+d.getMaxOverflow(),i)}i=this._minPadding=r.layout.autoPadding?i:0,this._updateLayout(i),s||Ce(o,l=>{l.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(My("z","_idx"));const{_active:a,_lastEvent:c}=this;c?this._eventHandler(c,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){Ce(this.scales,t=>{bt.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(t.events);(!Wg(n,r)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:r,start:s,count:o}of n){const i=r==="_removeElements"?-o:o;uW(t,s,i)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,r=o=>new Set(t.filter(i=>i[0]===o).map((i,a)=>a+","+i.splice(1).join(","))),s=r(0);for(let o=1;o<n;o++)if(!Wg(s,r(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;bt.update(this,this.width,this.height,t);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],Ce(this.boxes,s=>{r&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,r=this.data.datasets.length;n<r;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,r=this.data.datasets.length;n<r;++n)this._updateDataset(n,vr(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){const r=this.getDatasetMeta(t),s={meta:r,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(r.controller._update(n),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Ln.has(this)?this.attached&&!Ln.running(this)&&Ln.start(this):(this.draw(),Ay({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:r,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(r,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const n=this._sortedMetasets,r=[];let s,o;for(s=0,o=n.length;s<o;++s){const i=n[s];(!t||i.visible)&&r.push(i)}return r}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,r={meta:t,index:t.index,cancelable:!0},s=hS(this,t);this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&Cl(n,s),t.controller.draw(),s&&Rl(n),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return Wn(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,r,s){const o=c5.modes[n];return typeof o=="function"?o(this,t,r,s):[]}getDatasetMeta(t){const n=this.data.datasets[t],r=this._metasets;let s=r.filter(o=>o&&o._dataset===n).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},r.push(s)),s}getContext(){return this.$context||(this.$context=Rr(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const r=this.getDatasetMeta(t);return typeof r.hidden=="boolean"?!r.hidden:!n.hidden}setDatasetVisibility(t,n){const r=this.getDatasetMeta(t);r.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,r){const s=r?"show":"hide",o=this.getDatasetMeta(t),i=o.controller._resolveAnimations(void 0,s);li(n)?(o.data[n].hidden=!r,this.update()):(this.setDatasetVisibility(t,r),i.update(o,{visible:r}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),Ln.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Qg(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete Ba[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,n=this.platform,r=(o,i)=>{n.addEventListener(this,o,i),t[o]=i},s=(o,i,a)=>{o.offsetX=i,o.offsetY=a,this._eventHandler(o)};Ce(this.options.events,o=>r(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,r=(c,l)=>{n.addEventListener(this,c,l),t[c]=l},s=(c,l)=>{t[c]&&(n.removeEventListener(this,c,l),delete t[c])},o=(c,l)=>{this.canvas&&this.resize(c,l)};let i;const a=()=>{s("attach",a),this.attached=!0,this.resize(),r("resize",o),r("detach",i)};i=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),r("attach",a)},n.isAttached(this.canvas)?a():i()}unbindEvents(){Ce(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},Ce(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,r){const s=r?"set":"remove";let o,i,a,c;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,c=t.length;a<c;++a){i=t[a];const l=i&&this.getDatasetMeta(i.datasetIndex).controller;l&&l[s+"HoverStyle"](i.element,i.datasetIndex,i.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],r=t.map(({datasetIndex:o,index:i})=>{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[i],index:i}});!kc(r,n)&&(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,n))}notifyPlugins(t,n,r){return this._plugins.notify(this,t,n,r)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,r){const s=this.options.hover,o=(c,l)=>c.filter(u=>!l.some(d=>u.datasetIndex===d.datasetIndex&&u.index===d.index)),i=o(n,t),a=r?t:o(t,n);i.length&&this.updateHoverStyle(i,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,n){const r={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},s=i=>(i.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",r,s)===!1)return;const o=this._handleEvent(t,n,r.inChartArea);return r.cancelable=!1,this.notifyPlugins("afterEvent",r,s),(o||r.changed)&&this.render(),this}_handleEvent(t,n,r){const{_active:s=[],options:o}=this,i=n,a=this._getActiveElements(t,s,r,i),c=hB(t),l=dW(t,this._lastEvent,r,c);r&&(this._lastEvent=null,Me(o.onHover,[t,a,this],this),c&&Me(o.onClick,[t,a,this],this));const u=!kc(a,s);return(u||n)&&(this._active=a,this._updateHoverStyles(a,s,n)),this._lastEvent=l,u}_getActiveElements(t,n,r,s){if(t.type==="mouseout")return[];if(!r)return n;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}};function Dy(){return Ce(Ti.instances,e=>e._plugins.invalidate())}function fW(e,t,n){const{startAngle:r,x:s,y:o,outerRadius:i,innerRadius:a,options:c}=t,{borderWidth:l,borderJoinStyle:u}=c,d=Math.min(l/i,mt(r-n));if(e.beginPath(),e.arc(s,o,i-l/2,r+d/2,n-d/2),a>0){const f=Math.min(l/a,mt(r-n));e.arc(s,o,a+l/2,n-f/2,r+f/2,!0)}else{const f=Math.min(l/2,i*mt(r-n));if(u==="round")e.arc(s,o,f,n-we/2,r+we/2,!0);else if(u==="bevel"){const h=2*f*f,p=-h*Math.cos(n+we/2)+s,m=-h*Math.sin(n+we/2)+o,y=h*Math.cos(r+we/2)+s,b=h*Math.sin(r+we/2)+o;e.lineTo(p,m),e.lineTo(y,b)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}function hW(e,t,n){const{startAngle:r,pixelMargin:s,x:o,y:i,outerRadius:a,innerRadius:c}=t;let l=s/a;e.beginPath(),e.arc(o,i,a,r-l,n+l),c>s?(l=s/c,e.arc(o,i,c,n+l,r-l,!0)):e.arc(o,i,s,n+He,r-He),e.closePath(),e.clip()}function pW(e){return Ph(e,["outerStart","outerEnd","innerStart","innerEnd"])}function mW(e,t,n,r){const s=pW(e.options.borderRadius),o=(n-t)/2,i=Math.min(o,r*t/2),a=c=>{const l=(n-Math.min(o,c))*r/2;return at(c,0,Math.min(o,l))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:at(s.innerStart,0,i),innerEnd:at(s.innerEnd,0,i)}}function ws(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function Mc(e,t,n,r,s,o){const{x:i,y:a,startAngle:c,pixelMargin:l,innerRadius:u}=t,d=Math.max(t.outerRadius+r+n-l,0),f=u>0?u+r+n+l:0;let h=0;const p=s-c;if(r){const q=u>0?u-r:0,D=d>0?d-r:0,H=(q+D)/2,F=H!==0?p*H/(H+r):p;h=(p-F)/2}const m=Math.max(.001,p*d-n/we)/d,y=(p-m)/2,b=c+y+h,x=s-y-h,{outerStart:_,outerEnd:w,innerStart:S,innerEnd:C}=mW(t,f,d,x-b),k=d-_,E=d-w,P=b+_/k,O=x-w/E,N=f+S,A=f+C,j=b+S/N,$=x-C/A;if(e.beginPath(),o){const q=(P+O)/2;if(e.arc(i,a,d,P,q),e.arc(i,a,d,q,O),w>0){const W=ws(E,O,i,a);e.arc(W.x,W.y,w,O,x+He)}const D=ws(A,x,i,a);if(e.lineTo(D.x,D.y),C>0){const W=ws(A,$,i,a);e.arc(W.x,W.y,C,x+He,$+Math.PI)}const H=(x-C/f+(b+S/f))/2;if(e.arc(i,a,f,x-C/f,H,!0),e.arc(i,a,f,H,b+S/f,!0),S>0){const W=ws(N,j,i,a);e.arc(W.x,W.y,S,j+Math.PI,b-He)}const F=ws(k,b,i,a);if(e.lineTo(F.x,F.y),_>0){const W=ws(k,P,i,a);e.arc(W.x,W.y,_,b-He,P)}}else{e.moveTo(i,a);const q=Math.cos(P)*d+i,D=Math.sin(P)*d+a;e.lineTo(q,D);const H=Math.cos(O)*d+i,F=Math.sin(O)*d+a;e.lineTo(H,F)}e.closePath()}function gW(e,t,n,r,s){const{fullCircles:o,startAngle:i,circumference:a}=t;let c=t.endAngle;if(o){Mc(e,t,n,r,c,s);for(let l=0;l<o;++l)e.fill();isNaN(a)||(c=i+(a%Ae||Ae))}return Mc(e,t,n,r,c,s),e.fill(),c}function yW(e,t,n,r,s){const{fullCircles:o,startAngle:i,circumference:a,options:c}=t,{borderWidth:l,borderJoinStyle:u,borderDash:d,borderDashOffset:f,borderRadius:h}=c,p=c.borderAlign==="inner";if(!l)return;e.setLineDash(d||[]),e.lineDashOffset=f,p?(e.lineWidth=l*2,e.lineJoin=u||"round"):(e.lineWidth=l,e.lineJoin=u||"bevel");let m=t.endAngle;if(o){Mc(e,t,n,r,m,s);for(let y=0;y<o;++y)e.stroke();isNaN(a)||(m=i+(a%Ae||Ae))}p&&hW(e,t,m),c.selfJoin&&m-i>=we&&h===0&&u!=="miter"&&fW(e,t,m),o||(Mc(e,t,n,r,m,s),e.stroke())}class bW extends Jn{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),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,t&&Object.assign(this,t)}inRange(t,n,r){const s=this.getProps(["x","y"],r),{angle:o,distance:i}=q0(s,{x:t,y:n}),{startAngle:a,endAngle:c,innerRadius:l,outerRadius:u,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],r),f=(this.options.spacing+this.options.borderWidth)/2,h=de(d,c-a),p=ui(o,a,c)&&a!==c,m=h>=Ae||p,y=Bn(i,l+f,u+f);return m&&y}getCenterPoint(t){const{x:n,y:r,startAngle:s,endAngle:o,innerRadius:i,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:c,spacing:l}=this.options,u=(s+o)/2,d=(i+a+l+c)/2;return{x:n+Math.cos(u)*d,y:r+Math.sin(u)*d}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:n,circumference:r}=this,s=(n.offset||0)/4,o=(n.spacing||0)/2,i=n.circular;if(this.pixelMargin=n.borderAlign==="inner"?.33:0,this.fullCircles=r>Ae?Math.floor(r/Ae):0,r===0||this.innerRadius<0||this.outerRadius<0)return;t.save();const a=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(a)*s,Math.sin(a)*s);const c=1-Math.sin(Math.min(we,r||0)),l=s*c;t.fillStyle=n.backgroundColor,t.strokeStyle=n.borderColor,gW(t,this,l,o,i),yW(t,this,l,o,i),t.restore()}}function PS(e,t,n=t){e.lineCap=de(n.borderCapStyle,t.borderCapStyle),e.setLineDash(de(n.borderDash,t.borderDash)),e.lineDashOffset=de(n.borderDashOffset,t.borderDashOffset),e.lineJoin=de(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=de(n.borderWidth,t.borderWidth),e.strokeStyle=de(n.borderColor,t.borderColor)}function vW(e,t,n){e.lineTo(n.x,n.y)}function xW(e){return e.stepped?jB:e.tension||e.cubicInterpolationMode==="monotone"?LB:vW}function OS(e,t,n={}){const r=e.length,{start:s=0,end:o=r-1}=n,{start:i,end:a}=t,c=Math.max(s,i),l=Math.min(o,a),u=s<i&&o<i||s>a&&o>a;return{count:r,start:c,loop:t.loop,ilen:l<c&&!u?r+l-c:l-c}}function _W(e,t,n,r){const{points:s,options:o}=t,{count:i,start:a,loop:c,ilen:l}=OS(s,n,r),u=xW(o);let{move:d=!0,reverse:f}=r||{},h,p,m;for(h=0;h<=l;++h)p=s[(a+(f?l-h:h))%i],!p.skip&&(d?(e.moveTo(p.x,p.y),d=!1):u(e,m,p,f,o.stepped),m=p);return c&&(p=s[(a+(f?l:0))%i],u(e,m,p,f,o.stepped)),!!c}function wW(e,t,n,r){const s=t.points,{count:o,start:i,ilen:a}=OS(s,n,r),{move:c=!0,reverse:l}=r||{};let u=0,d=0,f,h,p,m,y,b;const x=w=>(i+(l?a-w:w))%o,_=()=>{m!==y&&(e.lineTo(u,y),e.lineTo(u,m),e.lineTo(u,b))};for(c&&(h=s[x(0)],e.moveTo(h.x,h.y)),f=0;f<=a;++f){if(h=s[x(f)],h.skip)continue;const w=h.x,S=h.y,C=w|0;C===p?(S<m?m=S:S>y&&(y=S),u=(d*u+w)/++d):(_(),e.lineTo(w,S),p=C,d=0,m=y=S),b=S}_()}function qd(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?wW:_W}function SW(e){return e.stepped?mU:e.tension||e.cubicInterpolationMode==="monotone"?gU:jr}function EW(e,t,n,r){let s=t._path;s||(s=t._path=new Path2D,t.path(s,n,r)&&s.closePath()),PS(e,t.options),e.stroke(s)}function kW(e,t,n,r){const{segments:s,options:o}=t,i=qd(t);for(const a of s)PS(e,o,a.style),e.beginPath(),i(e,t,a,{start:n,end:n+r-1})&&e.closePath(),e.stroke()}const CW=typeof Path2D=="function";function RW(e,t,n,r){CW&&!t.options.segment?EW(e,t,n,r):kW(e,t,n,r)}class Mi extends Jn{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const r=this.options;if((r.tension||r.cubicInterpolationMode==="monotone")&&!r.stepped&&!this._pointsUpdated){const s=r.spanGaps?this._loop:this._fullLoop;aU(this._points,r,t,s,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=wU(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,r=t.length;return r&&n[t[r-1].end]}interpolate(t,n){const r=this.options,s=t[n],o=this.points,i=fS(this,{property:n,start:s,end:s});if(!i.length)return;const a=[],c=SW(r);let l,u;for(l=0,u=i.length;l<u;++l){const{start:d,end:f}=i[l],h=o[d],p=o[f];if(h===p){a.push(h);continue}const m=Math.abs((s-h[n])/(p[n]-h[n])),y=c(h,p,m,r.stepped);y[n]=t[n],a.push(y)}return a.length===1?a[0]:a}pathSegment(t,n,r){return qd(this)(t,this,n,r)}path(t,n,r){const s=this.segments,o=qd(this);let i=this._loop;n=n||0,r=r||this.points.length-n;for(const a of s)i&=o(t,this,a,{start:n,end:n+r-1});return!!i}draw(t,n,r,s){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),RW(t,this,r,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function Iy(e,t,n,r){const s=e.options,{[n]:o}=e.getProps([n],r);return Math.abs(t-o)<s.radius+s.hitRadius}class TS extends Jn{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,n,r){const s=this.options,{x:o,y:i}=this.getProps(["x","y"],r);return Math.pow(t-o,2)+Math.pow(n-i,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,n){return Iy(this,t,"x",n)}inYRange(t,n){return Iy(this,t,"y",n)}getCenterPoint(t){const{x:n,y:r}=this.getProps(["x","y"],t);return{x:n,y:r}}size(t){t=t||this.options||{};let n=t.radius||0;n=Math.max(n,n&&t.hoverRadius||0);const r=n&&t.borderWidth||0;return(n+r)*2}draw(t,n){const r=this.options;this.skip||r.radius<.1||!Wn(this,n,this.size(r)/2)||(t.strokeStyle=r.borderColor,t.lineWidth=r.borderWidth,t.fillStyle=r.backgroundColor,Ud(t,r,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function MS(e,t){const{x:n,y:r,base:s,width:o,height:i}=e.getProps(["x","y","base","width","height"],t);let a,c,l,u,d;return e.horizontal?(d=i/2,a=Math.min(n,s),c=Math.max(n,s),l=r-d,u=r+d):(d=o/2,a=n-d,c=n+d,l=Math.min(r,s),u=Math.max(r,s)),{left:a,top:l,right:c,bottom:u}}function lr(e,t,n,r){return e?0:at(t,n,r)}function PW(e,t,n){const r=e.options.borderWidth,s=e.borderSkipped,o=tS(r);return{t:lr(s.top,o.top,0,n),r:lr(s.right,o.right,0,t),b:lr(s.bottom,o.bottom,0,n),l:lr(s.left,o.left,0,t)}}function OW(e,t,n){const{enableBorderRadius:r}=e.getProps(["enableBorderRadius"]),s=e.options.borderRadius,o=Zr(s),i=Math.min(t,n),a=e.borderSkipped,c=r||xe(s);return{topLeft:lr(!c||a.top||a.left,o.topLeft,0,i),topRight:lr(!c||a.top||a.right,o.topRight,0,i),bottomLeft:lr(!c||a.bottom||a.left,o.bottomLeft,0,i),bottomRight:lr(!c||a.bottom||a.right,o.bottomRight,0,i)}}function TW(e){const t=MS(e),n=t.right-t.left,r=t.bottom-t.top,s=PW(e,n/2,r/2),o=OW(e,n/2,r/2);return{outer:{x:t.left,y:t.top,w:n,h:r,radius:o},inner:{x:t.left+s.l,y:t.top+s.t,w:n-s.l-s.r,h:r-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function Du(e,t,n,r){const s=t===null,o=n===null,a=e&&!(s&&o)&&MS(e,r);return a&&(s||Bn(t,a.left,a.right))&&(o||Bn(n,a.top,a.bottom))}function MW(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function AW(e,t){e.rect(t.x,t.y,t.w,t.h)}function Iu(e,t,n={}){const r=e.x!==n.x?-t:0,s=e.y!==n.y?-t:0,o=(e.x+e.w!==n.x+n.w?t:0)-r,i=(e.y+e.h!==n.y+n.h?t:0)-s;return{x:e.x+r,y:e.y+s,w:e.w+o,h:e.h+i,radius:e.radius}}class NW extends Jn{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){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,t&&Object.assign(this,t)}draw(t){const{inflateAmount:n,options:{borderColor:r,backgroundColor:s}}=this,{inner:o,outer:i}=TW(this),a=MW(i.radius)?di:AW;t.save(),(i.w!==o.w||i.h!==o.h)&&(t.beginPath(),a(t,Iu(i,n,o)),t.clip(),a(t,Iu(o,-n,i)),t.fillStyle=r,t.fill("evenodd")),t.beginPath(),a(t,Iu(o,n)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,n,r){return Du(this,t,n,r)}inXRange(t,n){return Du(this,t,null,n)}inYRange(t,n){return Du(this,null,t,n)}getCenterPoint(t){const{x:n,y:r,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(n+s)/2:n,y:o?r:(r+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}var DW=Object.freeze({__proto__:null,ArcElement:bW,BarElement:NW,LineElement:Mi,PointElement:TS});const Kd=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],jy=Kd.map(e=>e.replace("rgb(","rgba(").replace(")",", 0.5)"));function AS(e){return Kd[e%Kd.length]}function NS(e){return jy[e%jy.length]}function IW(e,t){return e.borderColor=AS(t),e.backgroundColor=NS(t),++t}function jW(e,t){return e.backgroundColor=e.data.map(()=>AS(t++)),t}function LW(e,t){return e.backgroundColor=e.data.map(()=>NS(t++)),t}function FW(e){let t=0;return(n,r)=>{const s=e.getDatasetMeta(r).controller;s instanceof Dh?t=jW(n,t):s instanceof bS?t=LW(n,t):s&&(t=IW(n,t))}}function Ly(e){let t;for(t in e)if(e[t].borderColor||e[t].backgroundColor)return!0;return!1}function zW(e){return e&&(e.borderColor||e.backgroundColor)}function $W(){return $e.borderColor!=="rgba(0,0,0,0.1)"||$e.backgroundColor!=="rgba(0,0,0,0.1)"}var VW={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(e,t,n){if(!n.enabled)return;const{data:{datasets:r},options:s}=e.config,{elements:o}=s,i=Ly(r)||zW(s)||o&&Ly(o)||$W();if(!n.forceOverride&&i)return;const a=FW(e);r.forEach(a)}};function BW(e,t,n,r,s){const o=s.samples||r;if(o>=n)return e.slice(t,t+n);const i=[],a=(n-2)/(o-2);let c=0;const l=t+n-1;let u=t,d,f,h,p,m;for(i[c++]=e[u],d=0;d<o-2;d++){let y=0,b=0,x;const _=Math.floor((d+1)*a)+1+t,w=Math.min(Math.floor((d+2)*a)+1,n)+t,S=w-_;for(x=_;x<w;x++)y+=e[x].x,b+=e[x].y;y/=S,b/=S;const C=Math.floor(d*a)+1+t,k=Math.min(Math.floor((d+1)*a)+1,n)+t,{x:E,y:P}=e[u];for(h=p=-1,x=C;x<k;x++)p=.5*Math.abs((E-y)*(e[x].y-P)-(E-e[x].x)*(b-P)),p>h&&(h=p,f=e[x],m=x);i[c++]=f,u=m}return i[c++]=e[l],i}function UW(e,t,n,r){let s=0,o=0,i,a,c,l,u,d,f,h,p,m;const y=[],b=t+n-1,x=e[t].x,w=e[b].x-x;for(i=t;i<t+n;++i){a=e[i],c=(a.x-x)/w*r,l=a.y;const S=c|0;if(S===u)l<p?(p=l,d=i):l>m&&(m=l,f=i),s=(o*s+a.x)/++o;else{const C=i-1;if(!ye(d)&&!ye(f)){const k=Math.min(d,f),E=Math.max(d,f);k!==h&&k!==C&&y.push({...e[k],x:s}),E!==h&&E!==C&&y.push({...e[E],x:s})}i>0&&C!==h&&y.push(e[C]),y.push(a),u=S,o=0,p=m=l,d=f=h=i}}return y}function DS(e){if(e._decimated){const t=e._data;delete e._decimated,delete e._data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function Fy(e){e.data.datasets.forEach(t=>{DS(t)})}function WW(e,t){const n=t.length;let r=0,s;const{iScale:o}=e,{min:i,max:a,minDefined:c,maxDefined:l}=o.getUserBounds();return c&&(r=at(Un(t,o.axis,i).lo,0,n-1)),l?s=at(Un(t,o.axis,a).hi+1,r,n)-r:s=n-r,{start:r,count:s}}var HW={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(e,t,n)=>{if(!n.enabled){Fy(e);return}const r=e.width;e.data.datasets.forEach((s,o)=>{const{_data:i,indexAxis:a}=s,c=e.getDatasetMeta(o),l=i||s.data;if(No([a,e.options.indexAxis])==="y"||!c.controller.supportsDecimation)return;const u=e.scales[c.xAxisID];if(u.type!=="linear"&&u.type!=="time"||e.options.parsing)return;let{start:d,count:f}=WW(c,l);const h=n.threshold||4*r;if(f<=h){DS(s);return}ye(i)&&(s._data=l,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(m){this._data=m}}));let p;switch(n.algorithm){case"lttb":p=BW(l,d,f,r,n);break;case"min-max":p=UW(l,d,f,r);break;default:throw new Error(`Unsupported decimation algorithm '${n.algorithm}'`)}s._decimated=p})},destroy(e){Fy(e)}};function qW(e,t,n){const r=e.segments,s=e.points,o=t.points,i=[];for(const a of r){let{start:c,end:l}=a;l=Tl(c,l,s);const u=Zd(n,s[c],s[l],a.loop);if(!t.segments){i.push({source:a,target:u,start:s[c],end:s[l]});continue}const d=fS(t,u);for(const f of d){const h=Zd(n,o[f.start],o[f.end],f.loop),p=dS(a,s,h);for(const m of p)i.push({source:m,target:f,start:{[n]:zy(u,h,"start",Math.max)},end:{[n]:zy(u,h,"end",Math.min)}})}}return i}function Zd(e,t,n,r){if(r)return;let s=t[e],o=n[e];return e==="angle"&&(s=mt(s),o=mt(o)),{property:e,start:s,end:o}}function KW(e,t){const{x:n=null,y:r=null}=e||{},s=t.points,o=[];return t.segments.forEach(({start:i,end:a})=>{a=Tl(i,a,s);const c=s[i],l=s[a];r!==null?(o.push({x:c.x,y:r}),o.push({x:l.x,y:r})):n!==null&&(o.push({x:n,y:c.y}),o.push({x:n,y:l.y}))}),o}function Tl(e,t,n){for(;t>e;t--){const r=n[t];if(!isNaN(r.x)&&!isNaN(r.y))break}return t}function zy(e,t,n,r){return e&&t?r(e[n],t[n]):e?e[n]:t?t[n]:0}function IS(e,t){let n=[],r=!1;return ze(e)?(r=!0,n=e):n=KW(e,t),n.length?new Mi({points:n,options:{tension:0},_loop:r,_fullLoop:r}):null}function $y(e){return e&&e.fill!==!1}function ZW(e,t,n){let s=e[t].fill;const o=[t];let i;if(!n)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!We(s))return s;if(i=e[s],!i)return!1;if(i.visible)return s;o.push(s),s=i.fill}return!1}function GW(e,t,n){const r=QW(e);if(xe(r))return isNaN(r.value)?!1:r;let s=parseFloat(r);return We(s)&&Math.floor(s)===s?YW(r[0],t,s,n):["origin","start","end","stack","shape"].indexOf(r)>=0&&r}function YW(e,t,n,r){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=r?!1:n}function XW(e,t){let n=null;return e==="start"?n=t.bottom:e==="end"?n=t.top:xe(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function JW(e,t,n){let r;return e==="start"?r=n:e==="end"?r=t.options.reverse?t.min:t.max:xe(e)?r=e.value:r=t.getBaseValue(),r}function QW(e){const t=e.options,n=t.fill;let r=de(n&&n.target,n);return r===void 0&&(r=!!t.backgroundColor),r===!1||r===null?!1:r===!0?"origin":r}function e4(e){const{scale:t,index:n,line:r}=e,s=[],o=r.segments,i=r.points,a=t4(t,n);a.push(IS({x:null,y:t.bottom},r));for(let c=0;c<o.length;c++){const l=o[c];for(let u=l.start;u<=l.end;u++)n4(s,i[u],a)}return new Mi({points:s,options:{}})}function t4(e,t){const n=[],r=e.getMatchingVisibleMetas("line");for(let s=0;s<r.length;s++){const o=r[s];if(o.index===t)break;o.hidden||n.unshift(o.dataset)}return n}function n4(e,t,n){const r=[];for(let s=0;s<n.length;s++){const o=n[s],{first:i,last:a,point:c}=r4(o,t,"x");if(!(!c||i&&a)){if(i)r.unshift(c);else if(e.push(c),!a)break}}e.push(...r)}function r4(e,t,n){const r=e.interpolate(t,n);if(!r)return{};const s=r[n],o=e.segments,i=e.points;let a=!1,c=!1;for(let l=0;l<o.length;l++){const u=o[l],d=i[u.start][n],f=i[u.end][n];if(Bn(s,d,f)){a=s===d,c=s===f;break}}return{first:a,last:c,point:r}}class jS{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,n,r){const{x:s,y:o,radius:i}=this;return n=n||{start:0,end:Ae},t.arc(s,o,i,n.end,n.start,!0),!r.bounds}interpolate(t){const{x:n,y:r,radius:s}=this,o=t.angle;return{x:n+Math.cos(o)*s,y:r+Math.sin(o)*s,angle:o}}}function s4(e){const{chart:t,fill:n,line:r}=e;if(We(n))return o4(t,n);if(n==="stack")return e4(e);if(n==="shape")return!0;const s=i4(e);return s instanceof jS?s:IS(s,r)}function o4(e,t){const n=e.getDatasetMeta(t);return n&&e.isDatasetVisible(t)?n.dataset:null}function i4(e){return(e.scale||{}).getPointPositionForValue?c4(e):a4(e)}function a4(e){const{scale:t={},fill:n}=e,r=XW(n,t);if(We(r)){const s=t.isHorizontal();return{x:s?r:null,y:s?null:r}}return null}function c4(e){const{scale:t,fill:n}=e,r=t.options,s=t.getLabels().length,o=r.reverse?t.max:t.min,i=JW(n,t,o),a=[];if(r.grid.circular){const c=t.getPointPositionForValue(0,o);return new jS({x:c.x,y:c.y,radius:t.getDistanceFromCenterForValue(i)})}for(let c=0;c<s;++c)a.push(t.getPointPositionForValue(c,i));return a}function ju(e,t,n){const r=s4(t),{chart:s,index:o,line:i,scale:a,axis:c}=t,l=i.options,u=l.fill,d=l.backgroundColor,{above:f=d,below:h=d}=u||{},p=s.getDatasetMeta(o),m=hS(s,p);r&&i.points.length&&(Cl(e,n),l4(e,{line:i,target:r,above:f,below:h,area:n,scale:a,axis:c,clip:m}),Rl(e))}function l4(e,t){const{line:n,target:r,above:s,below:o,area:i,scale:a,clip:c}=t,l=n._loop?"angle":t.axis;e.save();let u=o;o!==s&&(l==="x"?(Vy(e,r,i.top),Lu(e,{line:n,target:r,color:s,scale:a,property:l,clip:c}),e.restore(),e.save(),Vy(e,r,i.bottom)):l==="y"&&(By(e,r,i.left),Lu(e,{line:n,target:r,color:o,scale:a,property:l,clip:c}),e.restore(),e.save(),By(e,r,i.right),u=s)),Lu(e,{line:n,target:r,color:u,scale:a,property:l,clip:c}),e.restore()}function Vy(e,t,n){const{segments:r,points:s}=t;let o=!0,i=!1;e.beginPath();for(const a of r){const{start:c,end:l}=a,u=s[c],d=s[Tl(c,l,s)];o?(e.moveTo(u.x,u.y),o=!1):(e.lineTo(u.x,n),e.lineTo(u.x,u.y)),i=!!t.pathSegment(e,a,{move:i}),i?e.closePath():e.lineTo(d.x,n)}e.lineTo(t.first().x,n),e.closePath(),e.clip()}function By(e,t,n){const{segments:r,points:s}=t;let o=!0,i=!1;e.beginPath();for(const a of r){const{start:c,end:l}=a,u=s[c],d=s[Tl(c,l,s)];o?(e.moveTo(u.x,u.y),o=!1):(e.lineTo(n,u.y),e.lineTo(u.x,u.y)),i=!!t.pathSegment(e,a,{move:i}),i?e.closePath():e.lineTo(n,d.y)}e.lineTo(n,t.first().y),e.closePath(),e.clip()}function Lu(e,t){const{line:n,target:r,property:s,color:o,scale:i,clip:a}=t,c=qW(n,r,s);for(const{source:l,target:u,start:d,end:f}of c){const{style:{backgroundColor:h=o}={}}=l,p=r!==!0;e.save(),e.fillStyle=h,u4(e,i,a,p&&Zd(s,d,f)),e.beginPath();const m=!!n.pathSegment(e,l);let y;if(p){m?e.closePath():Uy(e,r,f,s);const b=!!r.pathSegment(e,u,{move:m,reverse:!0});y=m&&b,y||Uy(e,r,d,s)}e.closePath(),e.fill(y?"evenodd":"nonzero"),e.restore()}}function u4(e,t,n,r){const s=t.chart.chartArea,{property:o,start:i,end:a}=r||{};if(o==="x"||o==="y"){let c,l,u,d;o==="x"?(c=i,l=s.top,u=a,d=s.bottom):(c=s.left,l=i,u=s.right,d=a),e.beginPath(),n&&(c=Math.max(c,n.left),u=Math.min(u,n.right),l=Math.max(l,n.top),d=Math.min(d,n.bottom)),e.rect(c,l,u-c,d-l),e.clip()}}function Uy(e,t,n,r){const s=t.interpolate(n,r);s&&e.lineTo(s.x,s.y)}var LS={id:"filler",afterDatasetsUpdate(e,t,n){const r=(e.data.datasets||[]).length,s=[];let o,i,a,c;for(i=0;i<r;++i)o=e.getDatasetMeta(i),a=o.dataset,c=null,a&&a.options&&a instanceof Mi&&(c={visible:e.isDatasetVisible(i),index:i,fill:GW(a,i,r),chart:e,axis:o.controller.options.indexAxis,scale:o.vScale,line:a}),o.$filler=c,s.push(c);for(i=0;i<r;++i)c=s[i],!(!c||c.fill===!1)&&(c.fill=ZW(s,i,n.propagate))},beforeDraw(e,t,n){const r=n.drawTime==="beforeDraw",s=e.getSortedVisibleDatasetMetas(),o=e.chartArea;for(let i=s.length-1;i>=0;--i){const a=s[i].$filler;a&&(a.line.updateControlPoints(o,a.axis),r&&a.fill&&ju(e.ctx,a,o))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!=="beforeDatasetsDraw")return;const r=e.getSortedVisibleDatasetMetas();for(let s=r.length-1;s>=0;--s){const o=r[s].$filler;$y(o)&&ju(e.ctx,o,e.chartArea)}},beforeDatasetDraw(e,t,n){const r=t.meta.$filler;!$y(r)||n.drawTime!=="beforeDatasetDraw"||ju(e.ctx,r,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Wy=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}},d4=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class Hy extends Jn{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.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(t,n,r){this.maxWidth=t,this.maxHeight=n,this._margins=r,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 t=this.options.labels||{};let n=Me(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(r=>t.filter(r,this.chart.data))),t.sort&&(n=n.sort((r,s)=>t.sort(r,s,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const r=t.labels,s=rt(r.font),o=s.size,i=this._computeTitleHeight(),{boxWidth:a,itemHeight:c}=Wy(r,o);let l,u;n.font=s.string,this.isHorizontal()?(l=this.maxWidth,u=this._fitRows(i,o,a,c)+10):(u=this.maxHeight,l=this._fitCols(i,s,a,c)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,n,r,s){const{ctx:o,maxWidth:i,options:{labels:{padding:a}}}=this,c=this.legendHitBoxes=[],l=this.lineWidths=[0],u=s+a;let d=t;o.textAlign="left",o.textBaseline="middle";let f=-1,h=-u;return this.legendItems.forEach((p,m)=>{const y=r+n/2+o.measureText(p.text).width;(m===0||l[l.length-1]+y+2*a>i)&&(d+=u,l[l.length-(m>0?0:1)]=0,h+=u,f++),c[m]={left:0,top:h,row:f,width:y,height:s},l[l.length-1]+=y+a}),d}_fitCols(t,n,r,s){const{ctx:o,maxHeight:i,options:{labels:{padding:a}}}=this,c=this.legendHitBoxes=[],l=this.columnSizes=[],u=i-t;let d=a,f=0,h=0,p=0,m=0;return this.legendItems.forEach((y,b)=>{const{itemWidth:x,itemHeight:_}=f4(r,n,o,y,s);b>0&&h+_+2*a>u&&(d+=f+a,l.push({width:f,height:h}),p+=f+a,m++,f=h=0),c[b]={left:p,top:h,col:m,width:x,height:_},f=Math.max(f,x),h+=_+a}),d+=f,l.push({width:f,height:h}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:r,labels:{padding:s},rtl:o}}=this,i=Bs(o,this.left,this.width);if(this.isHorizontal()){let a=0,c=ht(r,this.left+s,this.right-this.lineWidths[a]);for(const l of n)a!==l.row&&(a=l.row,c=ht(r,this.left+s,this.right-this.lineWidths[a])),l.top+=this.top+t+s,l.left=i.leftForLtr(i.x(c),l.width),c+=l.width+s}else{let a=0,c=ht(r,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const l of n)l.col!==a&&(a=l.col,c=ht(r,this.top+t+s,this.bottom-this.columnSizes[a].height)),l.top=c,l.left+=this.left+s,l.left=i.leftForLtr(i.x(l.left),l.width),c+=l.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Cl(t,this),this._draw(),Rl(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:r,ctx:s}=this,{align:o,labels:i}=t,a=$e.color,c=Bs(t.rtl,this.left,this.width),l=rt(i.font),{padding:u}=i,d=l.size,f=d/2;let h;this.drawTitle(),s.textAlign=c.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=l.string;const{boxWidth:p,boxHeight:m,itemHeight:y}=Wy(i,d),b=function(C,k,E){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;s.save();const P=de(E.lineWidth,1);if(s.fillStyle=de(E.fillStyle,a),s.lineCap=de(E.lineCap,"butt"),s.lineDashOffset=de(E.lineDashOffset,0),s.lineJoin=de(E.lineJoin,"miter"),s.lineWidth=P,s.strokeStyle=de(E.strokeStyle,a),s.setLineDash(de(E.lineDash,[])),i.usePointStyle){const O={radius:m*Math.SQRT2/2,pointStyle:E.pointStyle,rotation:E.rotation,borderWidth:P},N=c.xPlus(C,p/2),A=k+f;eS(s,O,N,A,i.pointStyleWidth&&p)}else{const O=k+Math.max((d-m)/2,0),N=c.leftForLtr(C,p),A=Zr(E.borderRadius);s.beginPath(),Object.values(A).some(j=>j!==0)?di(s,{x:N,y:O,w:p,h:m,radius:A}):s.rect(N,O,p,m),s.fill(),P!==0&&s.stroke()}s.restore()},x=function(C,k,E){cs(s,E.text,C,k+y/2,l,{strikethrough:E.hidden,textAlign:c.textAlign(E.textAlign)})},_=this.isHorizontal(),w=this._computeTitleHeight();_?h={x:ht(o,this.left+u,this.right-r[0]),y:this.top+u+w,line:0}:h={x:this.left+u,y:ht(o,this.top+w+u,this.bottom-n[0].height),line:0},cS(this.ctx,t.textDirection);const S=y+u;this.legendItems.forEach((C,k)=>{s.strokeStyle=C.fontColor,s.fillStyle=C.fontColor;const E=s.measureText(C.text).width,P=c.textAlign(C.textAlign||(C.textAlign=i.textAlign)),O=p+f+E;let N=h.x,A=h.y;c.setWidth(this.width),_?k>0&&N+O+u>this.right&&(A=h.y+=S,h.line++,N=h.x=ht(o,this.left+u,this.right-r[h.line])):k>0&&A+S>this.bottom&&(N=h.x=N+n[h.line].width+u,h.line++,A=h.y=ht(o,this.top+w+u,this.bottom-n[h.line].height));const j=c.x(N);if(b(j,A,C),N=kB(P,N+p+f,_?N+O:this.right,t.rtl),x(c.x(N),A,C),_)h.x+=O+u;else if(typeof C.text!="string"){const $=l.lineHeight;h.y+=FS(C,$)+u}else h.y+=S}),lS(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,r=rt(n.font),s=xt(n.padding);if(!n.display)return;const o=Bs(t.rtl,this.left,this.width),i=this.ctx,a=n.position,c=r.size/2,l=s.top+c;let u,d=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),u=this.top+l,d=ht(t.align,d,this.right-f);else{const p=this.columnSizes.reduce((m,y)=>Math.max(m,y.height),0);u=l+ht(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const h=ht(a,d,d+f);i.textAlign=o.textAlign(Ch(a)),i.textBaseline="middle",i.strokeStyle=n.color,i.fillStyle=n.color,i.font=r.string,cs(i,n.text,h,u,r)}_computeTitleHeight(){const t=this.options.title,n=rt(t.font),r=xt(t.padding);return t.display?n.lineHeight+r.height:0}_getLegendItemAt(t,n){let r,s,o;if(Bn(t,this.left,this.right)&&Bn(n,this.top,this.bottom)){for(o=this.legendHitBoxes,r=0;r<o.length;++r)if(s=o[r],Bn(t,s.left,s.left+s.width)&&Bn(n,s.top,s.top+s.height))return this.legendItems[r]}return null}handleEvent(t){const n=this.options;if(!m4(t.type,n))return;const r=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,o=d4(s,r);s&&!o&&Me(n.onLeave,[t,s,this],this),this._hoveredItem=r,r&&!o&&Me(n.onHover,[t,r,this],this)}else r&&Me(n.onClick,[t,r,this],this)}}function f4(e,t,n,r,s){const o=h4(r,e,t,n),i=p4(s,r,t.lineHeight);return{itemWidth:o,itemHeight:i}}function h4(e,t,n,r){let s=e.text;return s&&typeof s!="string"&&(s=s.reduce((o,i)=>o.length>i.length?o:i)),t+n.size/2+r.measureText(s).width}function p4(e,t,n){let r=e;return typeof t.text!="string"&&(r=FS(t,n)),r}function FS(e,t){const n=e.text?e.text.length:0;return t*n}function m4(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var zS={id:"legend",_element:Hy,start(e,t,n){const r=e.legend=new Hy({ctx:e.ctx,options:n,chart:e});bt.configure(e,r,n),bt.addBox(e,r)},stop(e){bt.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const r=e.legend;bt.configure(e,r,n),r.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const r=t.datasetIndex,s=n.chart;s.isDatasetVisible(r)?(s.hide(r),t.hidden=!0):(s.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:s,color:o,useBorderRadius:i,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(c=>{const l=c.controller.getStyle(n?0:void 0),u=xt(l.borderWidth);return{text:t[c.index].label,fillStyle:l.backgroundColor,fontColor:o,hidden:!c.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:l.borderColor,pointStyle:r||l.pointStyle,rotation:l.rotation,textAlign:s||l.textAlign,borderRadius:i&&(a||l.borderRadius),datasetIndex:c.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};class jh extends Jn{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,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.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n){const r=this.options;if(this.left=0,this.top=0,!r.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=n;const s=ze(r.text)?r.text.length:1;this._padding=xt(r.padding);const o=s*rt(r.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:n,left:r,bottom:s,right:o,options:i}=this,a=i.align;let c=0,l,u,d;return this.isHorizontal()?(u=ht(a,r,o),d=n+t,l=o-r):(i.position==="left"?(u=r+t,d=ht(a,s,n),c=we*-.5):(u=o-t,d=ht(a,n,s),c=we*.5),l=s-n),{titleX:u,titleY:d,maxWidth:l,rotation:c}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const r=rt(n.font),o=r.lineHeight/2+this._padding.top,{titleX:i,titleY:a,maxWidth:c,rotation:l}=this._drawArgs(o);cs(t,n.text,0,0,r,{color:n.color,maxWidth:c,rotation:l,textAlign:Ch(n.align),textBaseline:"middle",translation:[i,a]})}}function g4(e,t){const n=new jh({ctx:e.ctx,options:t,chart:e});bt.configure(e,n,t),bt.addBox(e,n),e.titleBlock=n}var y4={id:"title",_element:jh,start(e,t,n){g4(e,n)},stop(e){const t=e.titleBlock;bt.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const r=e.titleBlock;bt.configure(e,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const xa=new WeakMap;var b4={id:"subtitle",start(e,t,n){const r=new jh({ctx:e.ctx,options:n,chart:e});bt.configure(e,r,n),bt.addBox(e,r),xa.set(e,r)},stop(e){bt.removeBox(e,xa.get(e)),xa.delete(e)},beforeUpdate(e,t,n){const r=xa.get(e);bt.configure(e,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Io={average(e){if(!e.length)return!1;let t,n,r=new Set,s=0,o=0;for(t=0,n=e.length;t<n;++t){const a=e[t].element;if(a&&a.hasValue()){const c=a.tooltipPosition();r.add(c.x),s+=c.y,++o}}return o===0||r.size===0?!1:{x:[...r].reduce((a,c)=>a+c)/r.size,y:s/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,r=t.y,s=Number.POSITIVE_INFINITY,o,i,a;for(o=0,i=e.length;o<i;++o){const c=e[o].element;if(c&&c.hasValue()){const l=c.getCenterPoint(),u=Vd(t,l);u<s&&(s=u,a=c)}}if(a){const c=a.tooltipPosition();n=c.x,r=c.y}return{x:n,y:r}}};function _n(e,t){return t&&(ze(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Fn(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
12
104
  `)>-1?e.split(`
13
- `):e}function lR(e,t){const{element:s,datasetIndex:n,index:i}=t,r=e.getDatasetMeta(n).controller,{label:o,value:a}=r.getLabelAndValue(i);return{chart:e,label:o,parsed:r.getParsed(i),raw:e.data.datasets[n].data[i],formattedValue:a,dataset:r.getDataset(),dataIndex:i,datasetIndex:n,element:s}}function sd(e,t){const s=e.chart.ctx,{body:n,footer:i,title:r}=e,{boxWidth:o,boxHeight:a}=t,l=Nt(t.bodyFont),c=Nt(t.titleFont),u=Nt(t.footerFont),d=r.length,h=i.length,f=n.length,p=Yt(t.padding);let m=p.height,g=0,b=n.reduce((v,S)=>v+S.before.length+S.lines.length+S.after.length,0);if(b+=e.beforeBody.length+e.afterBody.length,d&&(m+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),b){const v=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;m+=f*v+(b-f)*l.lineHeight+(b-1)*t.bodySpacing}h&&(m+=t.footerMarginTop+h*u.lineHeight+(h-1)*t.footerSpacing);let x=0;const w=function(v){g=Math.max(g,s.measureText(v).width+x)};return s.save(),s.font=c.string,mt(e.title,w),s.font=l.string,mt(e.beforeBody.concat(e.afterBody),w),x=t.displayColors?o+2+t.boxPadding:0,mt(n,v=>{mt(v.before,w),mt(v.lines,w),mt(v.after,w)}),x=0,s.font=u.string,mt(e.footer,w),s.restore(),g+=p.width,{width:g,height:m}}function cR(e,t){const{y:s,height:n}=t;return s<n/2?"top":s>e.height-n/2?"bottom":"center"}function uR(e,t,s,n){const{x:i,width:r}=n,o=s.caretSize+s.caretPadding;if(e==="left"&&i+r+o>t.width||e==="right"&&i-r-o<0)return!0}function dR(e,t,s,n){const{x:i,width:r}=s,{width:o,chartArea:{left:a,right:l}}=e;let c="center";return n==="center"?c=i<=(a+l)/2?"left":"right":i<=r/2?c="left":i>=o-r/2&&(c="right"),uR(c,e,t,s)&&(c="center"),c}function nd(e,t,s){const n=s.yAlign||t.yAlign||cR(e,s);return{xAlign:s.xAlign||t.xAlign||dR(e,t,s,n),yAlign:n}}function hR(e,t){let{x:s,width:n}=e;return t==="right"?s-=n:t==="center"&&(s-=n/2),s}function fR(e,t,s){let{y:n,height:i}=e;return t==="top"?n+=s:t==="bottom"?n-=i+s:n-=i/2,n}function id(e,t,s,n){const{caretSize:i,caretPadding:r,cornerRadius:o}=e,{xAlign:a,yAlign:l}=s,c=i+r,{topLeft:u,topRight:d,bottomLeft:h,bottomRight:f}=js(o);let p=hR(t,a);const m=fR(t,l,c);return l==="center"?a==="left"?p+=c:a==="right"&&(p-=c):a==="left"?p-=Math.max(u,h)+i:a==="right"&&(p+=Math.max(d,f)+i),{x:jt(p,0,n.width-t.width),y:jt(m,0,n.height-t.height)}}function Ki(e,t,s){const n=Yt(s.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-n.right:e.x+n.left}function rd(e){return Oe([],We(e))}function pR(e,t,s){return bs(e,{tooltip:t,tooltipItems:s,type:"tooltip"})}function od(e,t){const s=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return s?e.override(s):e}const dp={beforeTitle:ze,title(e){if(e.length>0){const t=e[0],s=t.chart.data.labels,n=s?s.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(n>0&&t.dataIndex<n)return s[t.dataIndex]}return""},afterTitle:ze,beforeBody:ze,beforeLabel:ze,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const s=e.formattedValue;return lt(s)||(t+=s),t},labelColor(e){const s=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:s.borderColor,backgroundColor:s.backgroundColor,borderWidth:s.borderWidth,borderDash:s.borderDash,borderDashOffset:s.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const s=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:s.pointStyle,rotation:s.rotation}},afterLabel:ze,afterBody:ze,beforeFooter:ze,footer:ze,afterFooter:ze};function Jt(e,t,s,n){const i=e[t].call(s,n);return typeof i>"u"?dp[t].call(s,n):i}class ad extends Je{static positioners=zn;constructor(t){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=t.chart,this.options=t.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(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const s=this.chart,n=this.options.setContext(this.getContext()),i=n.enabled&&s.options.animation&&n.animations,r=new Bf(this.chart,i);return i._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=pR(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,s){const{callbacks:n}=s,i=Jt(n,"beforeTitle",this,t),r=Jt(n,"title",this,t),o=Jt(n,"afterTitle",this,t);let a=[];return a=Oe(a,We(i)),a=Oe(a,We(r)),a=Oe(a,We(o)),a}getBeforeBody(t,s){return rd(Jt(s.callbacks,"beforeBody",this,t))}getBody(t,s){const{callbacks:n}=s,i=[];return mt(t,r=>{const o={before:[],lines:[],after:[]},a=od(n,r);Oe(o.before,We(Jt(a,"beforeLabel",this,r))),Oe(o.lines,Jt(a,"label",this,r)),Oe(o.after,We(Jt(a,"afterLabel",this,r))),i.push(o)}),i}getAfterBody(t,s){return rd(Jt(s.callbacks,"afterBody",this,t))}getFooter(t,s){const{callbacks:n}=s,i=Jt(n,"beforeFooter",this,t),r=Jt(n,"footer",this,t),o=Jt(n,"afterFooter",this,t);let a=[];return a=Oe(a,We(i)),a=Oe(a,We(r)),a=Oe(a,We(o)),a}_createItems(t){const s=this._active,n=this.chart.data,i=[],r=[],o=[];let a=[],l,c;for(l=0,c=s.length;l<c;++l)a.push(lR(this.chart,s[l]));return t.filter&&(a=a.filter((u,d,h)=>t.filter(u,d,h,n))),t.itemSort&&(a=a.sort((u,d)=>t.itemSort(u,d,n))),mt(a,u=>{const d=od(t.callbacks,u);i.push(Jt(d,"labelColor",this,u)),r.push(Jt(d,"labelPointStyle",this,u)),o.push(Jt(d,"labelTextColor",this,u))}),this.labelColors=i,this.labelPointStyles=r,this.labelTextColors=o,this.dataPoints=a,a}update(t,s){const n=this.options.setContext(this.getContext()),i=this._active;let r,o=[];if(!i.length)this.opacity!==0&&(r={opacity:0});else{const a=zn[n.position].call(this,i,this._eventPosition);o=this._createItems(n),this.title=this.getTitle(o,n),this.beforeBody=this.getBeforeBody(o,n),this.body=this.getBody(o,n),this.afterBody=this.getAfterBody(o,n),this.footer=this.getFooter(o,n);const l=this._size=sd(this,n),c=Object.assign({},a,l),u=nd(this.chart,n,c),d=id(n,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,r={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:s})}drawCaret(t,s,n,i){const r=this.getCaretPosition(t,n,i);s.lineTo(r.x1,r.y1),s.lineTo(r.x2,r.y2),s.lineTo(r.x3,r.y3)}getCaretPosition(t,s,n){const{xAlign:i,yAlign:r}=this,{caretSize:o,cornerRadius:a}=n,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:d}=js(a),{x:h,y:f}=t,{width:p,height:m}=s;let g,b,x,w,v,S;return r==="center"?(v=f+m/2,i==="left"?(g=h,b=g-o,w=v+o,S=v-o):(g=h+p,b=g+o,w=v-o,S=v+o),x=g):(i==="left"?b=h+Math.max(l,u)+o:i==="right"?b=h+p-Math.max(c,d)-o:b=this.caretX,r==="top"?(w=f,v=w-o,g=b-o,x=b+o):(w=f+m,v=w+o,g=b+o,x=b-o),S=w),{x1:g,x2:b,x3:x,y1:w,y2:v,y3:S}}drawTitle(t,s,n){const i=this.title,r=i.length;let o,a,l;if(r){const c=on(n.rtl,this.x,this.width);for(t.x=Ki(this,n.titleAlign,n),s.textAlign=c.textAlign(n.titleAlign),s.textBaseline="middle",o=Nt(n.titleFont),a=n.titleSpacing,s.fillStyle=n.titleColor,s.font=o.string,l=0;l<r;++l)s.fillText(i[l],c.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+a,l+1===r&&(t.y+=n.titleMarginBottom-a)}}_drawColorBox(t,s,n,i,r){const o=this.labelColors[n],a=this.labelPointStyles[n],{boxHeight:l,boxWidth:c}=r,u=Nt(r.bodyFont),d=Ki(this,"left",r),h=i.x(d),f=l<u.lineHeight?(u.lineHeight-l)/2:0,p=s.y+f;if(r.usePointStyle){const m={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},g=i.leftForLtr(h,c)+c/2,b=p+l/2;t.strokeStyle=r.multiKeyBackground,t.fillStyle=r.multiKeyBackground,pa(t,m,g,b),t.strokeStyle=o.borderColor,t.fillStyle=o.backgroundColor,pa(t,m,g,b)}else{t.lineWidth=ut(o.borderWidth)?Math.max(...Object.values(o.borderWidth)):o.borderWidth||1,t.strokeStyle=o.borderColor,t.setLineDash(o.borderDash||[]),t.lineDashOffset=o.borderDashOffset||0;const m=i.leftForLtr(h,c),g=i.leftForLtr(i.xPlus(h,1),c-2),b=js(o.borderRadius);Object.values(b).some(x=>x!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,ii(t,{x:m,y:p,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=o.backgroundColor,t.beginPath(),ii(t,{x:g,y:p+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(m,p,c,l),t.strokeRect(m,p,c,l),t.fillStyle=o.backgroundColor,t.fillRect(g,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,s,n){const{body:i}=this,{bodySpacing:r,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=n,d=Nt(n.bodyFont);let h=d.lineHeight,f=0;const p=on(n.rtl,this.x,this.width),m=function(_){s.fillText(_,p.x(t.x+f),t.y+h/2),t.y+=h+r},g=p.textAlign(o);let b,x,w,v,S,P,R;for(s.textAlign=o,s.textBaseline="middle",s.font=d.string,t.x=Ki(this,g,n),s.fillStyle=n.bodyColor,mt(this.beforeBody,m),f=a&&g!=="right"?o==="center"?c/2+u:c+2+u:0,v=0,P=i.length;v<P;++v){for(b=i[v],x=this.labelTextColors[v],s.fillStyle=x,mt(b.before,m),w=b.lines,a&&w.length&&(this._drawColorBox(s,t,v,p,n),h=Math.max(d.lineHeight,l)),S=0,R=w.length;S<R;++S)m(w[S]),h=d.lineHeight;mt(b.after,m)}f=0,h=d.lineHeight,mt(this.afterBody,m),t.y-=r}drawFooter(t,s,n){const i=this.footer,r=i.length;let o,a;if(r){const l=on(n.rtl,this.x,this.width);for(t.x=Ki(this,n.footerAlign,n),t.y+=n.footerMarginTop,s.textAlign=l.textAlign(n.footerAlign),s.textBaseline="middle",o=Nt(n.footerFont),s.fillStyle=n.footerColor,s.font=o.string,a=0;a<r;++a)s.fillText(i[a],l.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+n.footerSpacing}}drawBackground(t,s,n,i){const{xAlign:r,yAlign:o}=this,{x:a,y:l}=t,{width:c,height:u}=n,{topLeft:d,topRight:h,bottomLeft:f,bottomRight:p}=js(i.cornerRadius);s.fillStyle=i.backgroundColor,s.strokeStyle=i.borderColor,s.lineWidth=i.borderWidth,s.beginPath(),s.moveTo(a+d,l),o==="top"&&this.drawCaret(t,s,n,i),s.lineTo(a+c-h,l),s.quadraticCurveTo(a+c,l,a+c,l+h),o==="center"&&r==="right"&&this.drawCaret(t,s,n,i),s.lineTo(a+c,l+u-p),s.quadraticCurveTo(a+c,l+u,a+c-p,l+u),o==="bottom"&&this.drawCaret(t,s,n,i),s.lineTo(a+f,l+u),s.quadraticCurveTo(a,l+u,a,l+u-f),o==="center"&&r==="left"&&this.drawCaret(t,s,n,i),s.lineTo(a,l+d),s.quadraticCurveTo(a,l,a+d,l),s.closePath(),s.fill(),i.borderWidth>0&&s.stroke()}_updateAnimationTarget(t){const s=this.chart,n=this.$animations,i=n&&n.x,r=n&&n.y;if(i||r){const o=zn[t.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=sd(this,t),l=Object.assign({},o,this._size),c=nd(s,t,l),u=id(t,l,c,s);(i._to!==u.x||r._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const s=this.options.setContext(this.getContext());let n=this.opacity;if(!n)return;this._updateAnimationTarget(s);const i={width:this.width,height:this.height},r={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;const o=Yt(s.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;s.enabled&&a&&(t.save(),t.globalAlpha=n,this.drawBackground(r,t,i,s),Lf(t,s.textDirection),r.y+=o.top,this.drawTitle(r,t,s),this.drawBody(r,t,s),this.drawFooter(r,t,s),Df(t,s.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,s){const n=this._active,i=t.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}}),r=!wr(n,i),o=this._positionChanged(i,s);(r||o)&&(this._active=i,this._eventPosition=s,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,s,n=!0){if(s&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const i=this.options,r=this._active||[],o=this._getActiveElements(t,r,s,n),a=this._positionChanged(o,t),l=s||!wr(o,r)||a;return l&&(this._active=o,(i.enabled||i.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,s))),l}_getActiveElements(t,s,n,i){const r=this.options;if(t.type==="mouseout")return[];if(!i)return s.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const o=this.chart.getElementsAtEventForMode(t,r.mode,r,n);return r.reverse&&o.reverse(),o}_positionChanged(t,s){const{caretX:n,caretY:i,options:r}=this,o=zn[r.position].call(this,t,s);return o!==!1&&(n!==o.x||i!==o.y)}}var hp={id:"tooltip",_element:ad,positioners:zn,afterInit(e,t,s){s&&(e.tooltip=new ad({chart:e,options:s}))},beforeUpdate(e,t,s){e.tooltip&&e.tooltip.initialize(s)},reset(e,t,s){e.tooltip&&e.tooltip.initialize(s)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const s={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...s,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",s)}},afterEvent(e,t){if(e.tooltip){const s=t.replay;e.tooltip.handleEvent(t.event,s,t.inChartArea)&&(t.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:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.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:dp},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},mR=Object.freeze({__proto__:null,Colors:Tk,Decimation:Dk,Filler:lp,Legend:up,SubTitle:aR,Title:oR,Tooltip:hp});const gR=(e,t,s,n)=>(typeof t=="string"?(s=e.push(t)-1,n.unshift({index:s,label:t})):isNaN(t)&&(s=null),s);function bR(e,t,s,n){const i=e.indexOf(t);if(i===-1)return gR(e,t,s,n);const r=e.lastIndexOf(t);return i!==r?s:i}const yR=(e,t)=>e===null?null:jt(Math.round(e),0,t);function ld(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class fp extends Ys{static id="category";static defaults={ticks:{callback:ld}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const s=this._addedLabels;if(s.length){const n=this.getLabels();for(const{index:i,label:r}of s)n[i]===r&&n.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,s){if(lt(t))return null;const n=this.getLabels();return s=isFinite(s)&&n[s]===t?s:bR(n,t,nt(s,t),this._addedLabels),yR(s,n.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:s}=this.getUserBounds();let{min:n,max:i}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(n=0),s||(i=this.getLabels().length-1)),this.min=n,this.max=i}buildTicks(){const t=this.min,s=this.max,n=this.options.offset,i=[];let r=this.getLabels();r=t===0&&s===r.length-1?r:r.slice(t,s+1),this._valueRange=Math.max(r.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let o=t;o<=s;o++)i.push({value:o});return i}getLabelForValue(t){return ld.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const s=this.ticks;return t<0||t>s.length-1?null:this.getPixelForValue(s[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function xR(e,t){const s=[],{bounds:i,step:r,min:o,max:a,precision:l,count:c,maxTicks:u,maxDigits:d,includeBounds:h}=e,f=r||1,p=u-1,{min:m,max:g}=t,b=!lt(o),x=!lt(a),w=!lt(c),v=(g-m)/(d+1);let S=su((g-m)/p/f)*f,P,R,_,C;if(S<1e-14&&!b&&!x)return[{value:m},{value:g}];C=Math.ceil(g/S)-Math.floor(m/S),C>p&&(S=su(C*S/p/f)*f),lt(l)||(P=Math.pow(10,l),S=Math.ceil(S*P)/P),i==="ticks"?(R=Math.floor(m/S)*S,_=Math.ceil(g/S)*S):(R=m,_=g),b&&x&&r&&a_((a-o)/r,S/1e3)?(C=Math.round(Math.min((a-o)/S,u)),S=(a-o)/C,R=o,_=a):w?(R=b?o:R,_=x?a:_,C=c-1,S=(_-R)/C):(C=(_-R)/S,Kn(C,Math.round(C),S/1e3)?C=Math.round(C):C=Math.ceil(C));const N=Math.max(nu(S),nu(R));P=Math.pow(10,lt(l)?N:l),R=Math.round(R*P)/P,_=Math.round(_*P)/P;let j=0;for(b&&(h&&R!==o?(s.push({value:o}),R<o&&j++,Kn(Math.round((R+j*S)*P)/P,o,cd(o,v,e))&&j++):R<o&&j++);j<C;++j){const A=Math.round((R+j*S)*P)/P;if(x&&A>a)break;s.push({value:A})}return x&&h&&_!==a?s.length&&Kn(s[s.length-1].value,a,cd(a,v,e))?s[s.length-1].value=a:s.push({value:a}):(!x||_===a)&&s.push({value:_}),s}function cd(e,t,{horizontal:s,minRotation:n}){const i=ke(n),r=(s?Math.sin(i):Math.cos(i))||.001,o=.75*t*(""+e).length;return Math.min(t/r,o)}class Or extends Ys{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,s){return lt(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:s,maxDefined:n}=this.getUserBounds();let{min:i,max:r}=this;const o=l=>i=s?i:l,a=l=>r=n?r:l;if(t){const l=Fe(i),c=Fe(r);l<0&&c<0?a(0):l>0&&c>0&&o(0)}if(i===r){let l=r===0?1:Math.abs(r*.05);a(r+l),t||o(i-l)}this.min=i,this.max=r}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:s,stepSize:n}=t,i;return n?(i=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,i>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${i} ticks. Limiting to 1000.`),i=1e3)):(i=this.computeTickLimit(),s=s||11),s&&(i=Math.min(s,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,s=t.ticks;let n=this.getTickLimit();n=Math.max(2,n);const i={maxTicks:n,bounds:t.bounds,min:t.min,max:t.max,precision:s.precision,step:s.stepSize,count:s.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:s.minRotation||0,includeBounds:s.includeBounds!==!1},r=this._range||this,o=xR(i,r);return t.bounds==="ticks"&&gf(o,this,"value"),t.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const t=this.ticks;let s=this.min,n=this.max;if(super.configure(),this.options.offset&&t.length){const i=(n-s)/Math.max(t.length-1,1)/2;s-=i,n+=i}this._startValue=s,this._endValue=n,this._valueRange=n-s}getLabelForValue(t){return gi(t,this.chart.options.locale,this.options.ticks.format)}}class pp extends Or{static id="linear";static defaults={ticks:{callback:Ur.formatters.numeric}};determineDataLimits(){const{min:t,max:s}=this.getMinMax(!0);this.min=Pt(t)?t:0,this.max=Pt(s)?s:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),s=t?this.width:this.height,n=ke(this.options.ticks.minRotation),i=(t?Math.sin(n):Math.cos(n))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(s/Math.min(40,r.lineHeight/i))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const oi=e=>Math.floor(as(e)),Es=(e,t)=>Math.pow(10,oi(e)+t);function ud(e){return e/Math.pow(10,oi(e))===1}function dd(e,t,s){const n=Math.pow(10,s),i=Math.floor(e/n);return Math.ceil(t/n)-i}function vR(e,t){const s=t-e;let n=oi(s);for(;dd(e,t,n)>10;)n++;for(;dd(e,t,n)<10;)n--;return Math.min(n,oi(e))}function _R(e,{min:t,max:s}){t=ae(e.min,t);const n=[],i=oi(t);let r=vR(t,s),o=r<0?Math.pow(10,Math.abs(r)):1;const a=Math.pow(10,r),l=i>r?Math.pow(10,i):0,c=Math.round((t-l)*o)/o,u=Math.floor((t-l)/a/10)*a*10;let d=Math.floor((c-u)/Math.pow(10,r)),h=ae(e.min,Math.round((l+u+d*Math.pow(10,r))*o)/o);for(;h<s;)n.push({value:h,major:ud(h),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(r++,d=2,o=r>=0?1:o),h=Math.round((l+u+d*Math.pow(10,r))*o)/o;const f=ae(e.max,h);return n.push({value:f,major:ud(f),significand:d}),n}class wR extends Ys{static id="logarithmic";static defaults={ticks:{callback:Ur.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,s){const n=Or.prototype.parse.apply(this,[t,s]);if(n===0){this._zero=!0;return}return Pt(n)&&n>0?n:null}determineDataLimits(){const{min:t,max:s}=this.getMinMax(!0);this.min=Pt(t)?Math.max(0,t):null,this.max=Pt(s)?Math.max(0,s):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Pt(this._userMin)&&(this.min=t===Es(this.min,0)?Es(this.min,-1):Es(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:s}=this.getUserBounds();let n=this.min,i=this.max;const r=a=>n=t?n:a,o=a=>i=s?i:a;n===i&&(n<=0?(r(1),o(10)):(r(Es(n,-1)),o(Es(i,1)))),n<=0&&r(Es(i,-1)),i<=0&&o(Es(n,1)),this.min=n,this.max=i}buildTicks(){const t=this.options,s={min:this._userMin,max:this._userMax},n=_R(s,this);return t.bounds==="ticks"&&gf(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}getLabelForValue(t){return t===void 0?"0":gi(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=as(t),this._valueRange=as(this.max)-as(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(as(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const s=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+s*this._valueRange)}}function va(e){const t=e.ticks;if(t.display&&e.display){const s=Yt(t.backdropPadding);return nt(t.font&&t.font.size,wt.font.size)+s.height}return 0}function SR(e,t,s){return s=_t(s)?s:[s],{w:k_(e,t.string,s),h:s.length*t.lineHeight}}function hd(e,t,s,n,i){return e===n||e===i?{start:t-s/2,end:t+s/2}:e<n||e>i?{start:t-s,end:t}:{start:t,end:t+s}}function kR(e){const t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},s=Object.assign({},t),n=[],i=[],r=e._pointLabels.length,o=e.options.pointLabels,a=o.centerPointLabels?pt/r:0;for(let l=0;l<r;l++){const c=o.setContext(e.getPointLabelContext(l));i[l]=c.padding;const u=e.getPointPosition(l,e.drawingArea+i[l],a),d=Nt(c.font),h=SR(e.ctx,d,e._pointLabels[l]);n[l]=h;const f=$t(e.getIndexAngle(l)+a),p=Math.round(tl(f)),m=hd(p,u.x,h.w,0,180),g=hd(p,u.y,h.h,90,270);RR(s,t,f,m,g)}e.setCenterPoint(t.l-s.l,s.r-t.r,t.t-s.t,s.b-t.b),e._pointLabelItems=CR(e,n,i)}function RR(e,t,s,n,i){const r=Math.abs(Math.sin(s)),o=Math.abs(Math.cos(s));let a=0,l=0;n.start<t.l?(a=(t.l-n.start)/r,e.l=Math.min(e.l,t.l-a)):n.end>t.r&&(a=(n.end-t.r)/r,e.r=Math.max(e.r,t.r+a)),i.start<t.t?(l=(t.t-i.start)/o,e.t=Math.min(e.t,t.t-l)):i.end>t.b&&(l=(i.end-t.b)/o,e.b=Math.max(e.b,t.b+l))}function PR(e,t,s){const n=e.drawingArea,{extra:i,additionalAngle:r,padding:o,size:a}=s,l=e.getPointPosition(t,n+i+o,r),c=Math.round(tl($t(l.angle+Et))),u=MR(l.y,a.h,c),d=OR(c),h=TR(l.x,a.w,d);return{visible:!0,x:l.x,y:u,textAlign:d,left:h,top:u,right:h+a.w,bottom:u+a.h}}function ER(e,t){if(!t)return!0;const{left:s,top:n,right:i,bottom:r}=e;return!(Xe({x:s,y:n},t)||Xe({x:s,y:r},t)||Xe({x:i,y:n},t)||Xe({x:i,y:r},t))}function CR(e,t,s){const n=[],i=e._pointLabels.length,r=e.options,{centerPointLabels:o,display:a}=r.pointLabels,l={extra:va(r)/2,additionalAngle:o?pt/i:0};let c;for(let u=0;u<i;u++){l.padding=s[u],l.size=t[u];const d=PR(e,u,l);n.push(d),a==="auto"&&(d.visible=ER(d,c),d.visible&&(c=d))}return n}function OR(e){return e===0||e===180?"center":e<180?"left":"right"}function TR(e,t,s){return s==="right"?e-=t:s==="center"&&(e-=t/2),e}function MR(e,t,s){return s===90||s===270?e-=t/2:(s>270||s<90)&&(e-=t),e}function AR(e,t,s){const{left:n,top:i,right:r,bottom:o}=s,{backdropColor:a}=t;if(!lt(a)){const l=js(t.borderRadius),c=Yt(t.backdropPadding);e.fillStyle=a;const u=n-c.left,d=i-c.top,h=r-n+c.width,f=o-i+c.height;Object.values(l).some(p=>p!==0)?(e.beginPath(),ii(e,{x:u,y:d,w:h,h:f,radius:l}),e.fill()):e.fillRect(u,d,h,f)}}function LR(e,t){const{ctx:s,options:{pointLabels:n}}=e;for(let i=t-1;i>=0;i--){const r=e._pointLabelItems[i];if(!r.visible)continue;const o=n.setContext(e.getPointLabelContext(i));AR(s,o,r);const a=Nt(o.font),{x:l,y:c,textAlign:u}=r;$s(s,e._pointLabels[i],l,c+a.lineHeight/2,a,{color:o.color,textAlign:u,textBaseline:"middle"})}}function mp(e,t,s,n){const{ctx:i}=e;if(s)i.arc(e.xCenter,e.yCenter,t,0,xt);else{let r=e.getPointPosition(0,t);i.moveTo(r.x,r.y);for(let o=1;o<n;o++)r=e.getPointPosition(o,t),i.lineTo(r.x,r.y)}}function DR(e,t,s,n,i){const r=e.ctx,o=t.circular,{color:a,lineWidth:l}=t;!o&&!n||!a||!l||s<0||(r.save(),r.strokeStyle=a,r.lineWidth=l,r.setLineDash(i.dash||[]),r.lineDashOffset=i.dashOffset,r.beginPath(),mp(e,s,o,n),r.closePath(),r.stroke(),r.restore())}function NR(e,t,s){return bs(e,{label:s,index:t,type:"pointLabel"})}class FR extends Or{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ur.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=Yt(va(this.options)/2),s=this.width=this.maxWidth-t.width,n=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+s/2+t.left),this.yCenter=Math.floor(this.top+n/2+t.top),this.drawingArea=Math.floor(Math.min(s,n)/2)}determineDataLimits(){const{min:t,max:s}=this.getMinMax(!1);this.min=Pt(t)&&!isNaN(t)?t:0,this.max=Pt(s)&&!isNaN(s)?s:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/va(this.options))}generateTickLabels(t){Or.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((s,n)=>{const i=gt(this.options.pointLabels.callback,[s,n],this);return i||i===0?i:""}).filter((s,n)=>this.chart.getDataVisibility(n))}fit(){const t=this.options;t.display&&t.pointLabels.display?kR(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,s,n,i){this.xCenter+=Math.floor((t-s)/2),this.yCenter+=Math.floor((n-i)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,s,n,i))}getIndexAngle(t){const s=xt/(this._pointLabels.length||1),n=this.options.startAngle||0;return $t(t*s+ke(n))}getDistanceFromCenterForValue(t){if(lt(t))return NaN;const s=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*s:(t-this.min)*s}getValueForDistanceFromCenter(t){if(lt(t))return NaN;const s=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-s:this.min+s}getPointLabelContext(t){const s=this._pointLabels||[];if(t>=0&&t<s.length){const n=s[t];return NR(this.getContext(),t,n)}}getPointPosition(t,s,n=0){const i=this.getIndexAngle(t)-Et+n;return{x:Math.cos(i)*s+this.xCenter,y:Math.sin(i)*s+this.yCenter,angle:i}}getPointPositionForValue(t,s){return this.getPointPosition(t,this.getDistanceFromCenterForValue(s))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:s,top:n,right:i,bottom:r}=this._pointLabelItems[t];return{left:s,top:n,right:i,bottom:r}}drawBackground(){const{backgroundColor:t,grid:{circular:s}}=this.options;if(t){const n=this.ctx;n.save(),n.beginPath(),mp(this,this.getDistanceFromCenterForValue(this._endValue),s,this._pointLabels.length),n.closePath(),n.fillStyle=t,n.fill(),n.restore()}}drawGrid(){const t=this.ctx,s=this.options,{angleLines:n,grid:i,border:r}=s,o=this._pointLabels.length;let a,l,c;if(s.pointLabels.display&&LR(this,o),i.display&&this.ticks.forEach((u,d)=>{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(u.value);const h=this.getContext(d),f=i.setContext(h),p=r.setContext(h);DR(this,f,l,o,p)}}),n.display){for(t.save(),a=o-1;a>=0;a--){const u=n.setContext(this.getPointLabelContext(a)),{color:d,lineWidth:h}=u;!h||!d||(t.lineWidth=h,t.strokeStyle=d,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,l=this.getDistanceFromCenterForValue(s.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,s=this.options,n=s.ticks;if(!n.display)return;const i=this.getIndexAngle(0);let r,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(i),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!s.reverse)return;const c=n.setContext(this.getContext(l)),u=Nt(c.font);if(r=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=u.string,o=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const d=Yt(c.backdropPadding);t.fillRect(-o/2-d.left,-r-u.size/2-d.top,o+d.width,u.size+d.height)}$s(t,a.label,0,-r,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}const Gr={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}},ne=Object.keys(Gr);function fd(e,t){return e-t}function pd(e,t){if(lt(t))return null;const s=e._adapter,{parser:n,round:i,isoWeekday:r}=e._parseOpts;let o=t;return typeof n=="function"&&(o=n(o)),Pt(o)||(o=typeof n=="string"?s.parse(o,n):s.parse(o)),o===null?null:(i&&(o=i==="week"&&(dn(r)||r===!0)?s.startOf(o,"isoWeek",r):s.startOf(o,i)),+o)}function md(e,t,s,n){const i=ne.length;for(let r=ne.indexOf(e);r<i-1;++r){const o=Gr[ne[r]],a=o.steps?o.steps:Number.MAX_SAFE_INTEGER;if(o.common&&Math.ceil((s-t)/(a*o.size))<=n)return ne[r]}return ne[i-1]}function IR(e,t,s,n,i){for(let r=ne.length-1;r>=ne.indexOf(s);r--){const o=ne[r];if(Gr[o].common&&e._adapter.diff(i,n,o)>=t-1)return o}return ne[s?ne.indexOf(s):0]}function jR(e){for(let t=ne.indexOf(e)+1,s=ne.length;t<s;++t)if(Gr[ne[t]].common)return ne[t]}function gd(e,t,s){if(!s)e[t]=!0;else if(s.length){const{lo:n,hi:i}=el(s,t),r=s[n]>=t?s[n]:s[i];e[r]=!0}}function BR(e,t,s,n){const i=e._adapter,r=+i.startOf(t[0].value,n),o=t[t.length-1].value;let a,l;for(a=r;a<=o;a=+i.add(a,1,n))l=s[a],l>=0&&(t[l].major=!0);return t}function bd(e,t,s){const n=[],i={},r=t.length;let o,a;for(o=0;o<r;++o)a=t[o],i[a]=o,n.push({value:a,major:!1});return r===0||!s?n:BR(e,n,i,s)}class Tr extends Ys{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,s={}){const n=t.time||(t.time={}),i=this._adapter=new qw._date(t.adapters.date);i.init(s),qn(n.displayFormats,i.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(t),this._normalized=s.normalized}parse(t,s){return t===void 0?null:pd(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,s=this._adapter,n=t.time.unit||"day";let{min:i,max:r,minDefined:o,maxDefined:a}=this.getUserBounds();function l(c){!o&&!isNaN(c.min)&&(i=Math.min(i,c.min)),!a&&!isNaN(c.max)&&(r=Math.max(r,c.max))}(!o||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),i=Pt(i)&&!isNaN(i)?i:+s.startOf(Date.now(),n),r=Pt(r)&&!isNaN(r)?r:+s.endOf(Date.now(),n)+1,this.min=Math.min(i,r-1),this.max=Math.max(i+1,r)}_getLabelBounds(){const t=this.getLabelTimestamps();let s=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return t.length&&(s=t[0],n=t[t.length-1]),{min:s,max:n}}buildTicks(){const t=this.options,s=t.time,n=t.ticks,i=n.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&i.length&&(this.min=this._userMin||i[0],this.max=this._userMax||i[i.length-1]);const r=this.min,o=this.max,a=d_(i,r,o);return this._unit=s.unit||(n.autoSkip?md(s.minUnit,this.min,this.max,this._getLabelCapacity(r)):IR(this,a.length,s.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit==="year"?void 0:jR(this._unit),this.initOffsets(i),t.reverse&&a.reverse(),bd(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let s=0,n=0,i,r;this.options.offset&&t.length&&(i=this.getDecimalForValue(t[0]),t.length===1?s=1-i:s=(this.getDecimalForValue(t[1])-i)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?n=r:n=(r-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;s=jt(s,0,o),n=jt(n,0,o),this._offsets={start:s,end:n,factor:1/(s+1+n)}}_generate(){const t=this._adapter,s=this.min,n=this.max,i=this.options,r=i.time,o=r.unit||md(r.minUnit,s,n,this._getLabelCapacity(s)),a=nt(i.ticks.stepSize,1),l=o==="week"?r.isoWeekday:!1,c=dn(l)||l===!0,u={};let d=s,h,f;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":o),t.diff(n,s,o)>1e5*a)throw new Error(s+" and "+n+" are too far apart with stepSize of "+a+" "+o);const p=i.ticks.source==="data"&&this.getDataTimestamps();for(h=d,f=0;h<n;h=+t.add(h,a,o),f++)gd(u,h,p);return(h===n||i.bounds==="ticks"||f===1)&&gd(u,h,p),Object.keys(u).sort(fd).map(m=>+m)}getLabelForValue(t){const s=this._adapter,n=this.options.time;return n.tooltipFormat?s.format(t,n.tooltipFormat):s.format(t,n.displayFormats.datetime)}format(t,s){const i=this.options.time.displayFormats,r=this._unit,o=s||i[r];return this._adapter.format(t,o)}_tickFormatFunction(t,s,n,i){const r=this.options,o=r.ticks.callback;if(o)return gt(o,[t,s,n],this);const a=r.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],d=c&&a[c],h=n[s],f=c&&d&&h&&h.major;return this._adapter.format(t,i||(f?d:u))}generateTickLabels(t){let s,n,i;for(s=0,n=t.length;s<n;++s)i=t[s],i.label=this._tickFormatFunction(i.value,s,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const s=this._offsets,n=this.getDecimalForValue(t);return this.getPixelForDecimal((s.start+n)*s.factor)}getValueForPixel(t){const s=this._offsets,n=this.getDecimalForPixel(t)/s.factor-s.end;return this.min+n*(this.max-this.min)}_getLabelSize(t){const s=this.options.ticks,n=this.ctx.measureText(t).width,i=ke(this.isHorizontal()?s.maxRotation:s.minRotation),r=Math.cos(i),o=Math.sin(i),a=this._resolveTickFontOptions(0).size;return{w:n*r+a*o,h:n*o+a*r}}_getLabelCapacity(t){const s=this.options.time,n=s.displayFormats,i=n[s.unit]||n.millisecond,r=this._tickFormatFunction(t,0,bd(this,[t],this._majorUnit),i),o=this._getLabelSize(r),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],s,n;if(t.length)return t;const i=this.getMatchingVisibleMetas();if(this._normalized&&i.length)return this._cache.data=i[0].controller.getAllParsedValues(this);for(s=0,n=i.length;s<n;++s)t=t.concat(i[s].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let s,n;if(t.length)return t;const i=this.getLabels();for(s=0,n=i.length;s<n;++s)t.push(pd(this,i[s]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return xf(t.sort(fd))}}function Yi(e,t,s){let n=0,i=e.length-1,r,o,a,l;s?(t>=e[n].pos&&t<=e[i].pos&&({lo:n,hi:i}=Ge(e,"pos",t)),{pos:r,time:a}=e[n],{pos:o,time:l}=e[i]):(t>=e[n].time&&t<=e[i].time&&({lo:n,hi:i}=Ge(e,"time",t)),{time:r,pos:a}=e[n],{time:o,pos:l}=e[i]);const c=o-r;return c?a+(l-a)*(t-r)/c:a}class VR extends Tr{static id="timeseries";static defaults=Tr.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),s=this._table=this.buildLookupTable(t);this._minPos=Yi(s,this.min),this._tableRange=Yi(s,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:s,max:n}=this,i=[],r=[];let o,a,l,c,u;for(o=0,a=t.length;o<a;++o)c=t[o],c>=s&&c<=n&&i.push(c);if(i.length<2)return[{time:s,pos:0},{time:n,pos:1}];for(o=0,a=i.length;o<a;++o)u=i[o+1],l=i[o-1],c=i[o],Math.round((u+l)/2)!==c&&r.push({time:c,pos:o/(a-1)});return r}_generate(){const t=this.min,s=this.max;let n=super.getDataTimestamps();return(!n.includes(t)||!n.length)&&n.splice(0,0,t),(!n.includes(s)||n.length===1)&&n.push(s),n.sort((i,r)=>i-r)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const s=this.getDataTimestamps(),n=this.getLabelTimestamps();return s.length&&n.length?t=this.normalize(s.concat(n)):t=s.length?s:n,t=this._cache.all=t,t}getDecimalForValue(t){return(Yi(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const s=this._offsets,n=this.getDecimalForPixel(t)/s.factor-s.end;return Yi(this._table,n*this._tableRange+this._minPos,!0)}}var zR=Object.freeze({__proto__:null,CategoryScale:fp,LinearScale:pp,LogarithmicScale:wR,RadialLinearScale:FR,TimeScale:Tr,TimeSeriesScale:VR});const HR=[$w,Sk,mR,zR],gp="label";function yd(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function UR(e,t){const s=e.options;s&&t&&Object.assign(s,t)}function bp(e,t){e.labels=t}function yp(e,t,s=gp){const n=[];e.datasets=t.map(i=>{const r=e.datasets.find(o=>o[s]===i[s]);return!r||!i.data||n.includes(r)?{...i}:(n.push(r),Object.assign(r,i),r)})}function WR(e,t=gp){const s={labels:[],datasets:[]};return bp(s,e.labels),yp(s,e.datasets,t),s}function $R(e,t){const{height:s=150,width:n=300,redraw:i=!1,datasetIdKey:r,type:o,data:a,options:l,plugins:c=[],fallbackContent:u,updateMode:d,...h}=e,f=L.useRef(null),p=L.useRef(null),m=()=>{f.current&&(p.current=new bi(f.current,{type:o,data:WR(a,r),options:l&&{...l},plugins:c}),yd(t,p.current))},g=()=>{yd(t,null),p.current&&(p.current.destroy(),p.current=null)};return L.useEffect(()=>{!i&&p.current&&l&&UR(p.current,l)},[i,l]),L.useEffect(()=>{!i&&p.current&&bp(p.current.config.data,a.labels)},[i,a.labels]),L.useEffect(()=>{!i&&p.current&&a.datasets&&yp(p.current.config.data,a.datasets,r)},[i,a.datasets]),L.useEffect(()=>{p.current&&(i?(g(),setTimeout(m)):p.current.update(d))},[i,l,a.labels,a.datasets,d]),L.useEffect(()=>{p.current&&(g(),setTimeout(m))},[o]),L.useEffect(()=>(m(),()=>g()),[]),y.jsx("canvas",{ref:f,role:"img",height:s,width:n,...h,children:u})}const qR=L.forwardRef($R);function KR(e,t){return bi.register(t),L.forwardRef((s,n)=>y.jsx(qR,{...s,ref:n,type:e}))}const YR=KR("line",Hf);bi.register(...HR);bi.register(fp,pp,ep,yi,lp,hp,up,Tr);const GR={id:"downBandPlugin",beforeDraw:e=>{const{ctx:t,chartArea:s,data:n}=e;if(!s)return;n?.datasets?.[0]?.meta?.raw;const i=n?.datasets?.[0]?.status??[];if(!Array.isArray(i)||i.length===0)return;t.save(),t.fillStyle="rgba(239, 68, 68, 0.14)";const r=e.scales.x;for(let o=0;o<i.length;o++){if(i[o]!=="down")continue;const a=r.getPixelForValue(o-.5),l=r.getPixelForValue(o+.5);t.fillRect(a,s.top,l-a,s.bottom-s.top)}t.restore()}};function XR({points:e}){const t=e.map(o=>new Date(o.t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})),s=e.map(o=>o.status==="down"?null:o.ping),n=e.map(o=>o.status),i={labels:t,datasets:[{label:"Ping (ms)",data:s,tension:.25,pointRadius:0,fill:!0,status:n}]},r={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{callbacks:{label:o=>{const a=o.dataIndex;if(n[a]==="down")return"Down";const c=o.parsed.y;return c!=null?`${c} ms`:"—"}}}},scales:{x:{ticks:{maxTicksLimit:8}},y:{beginAtZero:!0}},animation:!1};return y.jsxs("div",{className:"h-64 w-full rounded-2xl border border-neutral-200 bg-white p-3 dark:border-neutral-800 dark:bg-neutral-950",children:[y.jsx("div",{className:"mb-2 text-sm font-semibold",children:"Response Time"}),y.jsx("div",{className:"h-[220px]",children:y.jsx(YR,{data:i,options:r,plugins:[GR]})})]})}function QR(){const{id:e}=ai({strict:!1}),t=qs(),{data:s,refetch:n}=ps({queryKey:["monitors"],queryFn:async()=>(await bt.get("/monitors")).data.monitors,refetchInterval:3e4}),i=(s??[]).find(v=>v.id===e),{data:r,refetch:o}=ps({queryKey:["monitor-results",e],queryFn:async()=>(await bt.get(`/monitors/${e}/results?limit=180`)).data.results,enabled:!!e,refetchInterval:3e4}),[a,l]=Q.useState(null);if(Q.useEffect(()=>{if(!e)return;let v=null;return v=rr(Zo.apiBase,{path:Zo.wsPath,transports:["websocket"]}),v.on("monitor:update",S=>{S.monitorId===e&&(l(S),o())}),()=>{v?.disconnect()}},[e,o]),!i)return y.jsx("div",{className:"text-sm text-neutral-500",children:"Monitor not found."});const c=(r??[]).slice().reverse(),u=a??r?.[0]??null,d=u?.status??"unknown",h=d==="up"?"bg-emerald-500":d==="down"?"bg-red-500":"bg-neutral-400",f=c.map(v=>({t:new Date(v.checkedAt).getTime(),ping:v.pingMs??null,status:v.status??"unknown"})),p=c.filter(v=>v.status==="up"||v.status==="down"),m=p.length?p.filter(v=>v.status==="up").length/p.length*100:0,g=(()=>{const v=c.map(S=>S.pingMs).filter(S=>typeof S=="number");return v.length?Math.round(v.reduce((S,P)=>S+P,0)/v.length):null})();async function b(){try{await bt.post(`/monitors/${e}/pause`,{paused:!i.isPaused}),yt.success(i.isPaused?"Resumed":"Paused"),await n()}catch(v){yt.error(v?.response?.data?.detail??"Failed")}}async function x(){try{const S=(await bt.post(`/monitors/${e}/clone`)).data.monitor.id;yt.success("Cloned (paused)"),await n(),t({to:"/monitors/$id",params:{id:S}})}catch(v){yt.error(v?.response?.data?.detail??"Clone failed")}}async function w(){if(confirm(`Delete monitor "${i.name}"?`))try{await bt.delete(`/monitors/${e}`),yt.success("Deleted"),await n(),t({to:"/"})}catch(v){yt.error(v?.response?.data?.detail??"Delete failed")}}return y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[y.jsxs("div",{children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("div",{className:Ke("h-3 w-3 rounded-full",h)}),y.jsx("div",{className:"text-xl font-semibold",children:i.name}),i.isPaused?y.jsx("span",{className:"rounded-full bg-neutral-200 px-2 py-0.5 text-xs dark:bg-neutral-800",children:"Paused"}):null]}),y.jsxs("div",{className:"mt-1 text-sm text-neutral-500 dark:text-neutral-400",children:[i.type," • interval ",i.intervalSeconds,"s"]})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsxs("button",{className:"inline-flex items-center gap-2 rounded-xl border px-3 py-2 hover:bg-neutral-50 dark:border-neutral-800 dark:hover:bg-neutral-900",onClick:b,children:[i.isPaused?y.jsx(Gh,{size:16}):y.jsx(Kh,{size:16}),i.isPaused?"Resume":"Pause"]}),y.jsxs("button",{className:"inline-flex items-center gap-2 rounded-xl border px-3 py-2 hover:bg-neutral-50 dark:border-neutral-800 dark:hover:bg-neutral-900",onClick:()=>t({to:"/monitors/$id/edit",params:{id:e}}),children:[y.jsx(Yh,{size:16})," Edit"]}),y.jsxs("button",{className:"inline-flex items-center gap-2 rounded-xl border px-3 py-2 hover:bg-neutral-50 dark:border-neutral-800 dark:hover:bg-neutral-900",onClick:x,children:[y.jsx(qh,{size:16})," Clone"]}),y.jsxs("button",{className:"inline-flex items-center gap-2 rounded-xl border px-3 py-2 text-red-600 hover:bg-neutral-50 dark:border-neutral-800 dark:hover:bg-neutral-900",onClick:w,children:[y.jsx(Xh,{size:16})," Delete"]})]})]}),y.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[y.jsxs(Ae,{children:[y.jsx(Le,{children:y.jsx("div",{className:"text-sm font-semibold",children:"Status"})}),y.jsxs(De,{children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("div",{className:Ke("h-2.5 w-2.5 rounded-full",h)}),y.jsx("div",{className:"text-lg font-semibold",children:d.toUpperCase()})]}),y.jsx("div",{className:"mt-1 text-sm text-neutral-500 dark:text-neutral-400",children:u?.message??"—"})]})]}),y.jsxs(Ae,{children:[y.jsx(Le,{children:y.jsx("div",{className:"text-sm font-semibold",children:"Uptime"})}),y.jsxs(De,{children:[y.jsxs("div",{className:"text-2xl font-semibold",children:[m.toFixed(1),"%"]}),y.jsxs("div",{className:"mt-1 text-sm text-neutral-500 dark:text-neutral-400",children:["(last ",c.length," checks)"]})]})]}),y.jsxs(Ae,{children:[y.jsx(Le,{children:y.jsx("div",{className:"text-sm font-semibold",children:"Avg Response"})}),y.jsxs(De,{children:[y.jsx("div",{className:"text-2xl font-semibold",children:g!=null?`${g} ms`:"—"}),y.jsxs("div",{className:"mt-1 text-sm text-neutral-500 dark:text-neutral-400",children:["Latest: ",u?.pingMs!=null?`${u.pingMs} ms`:"—"]})]})]})]}),y.jsx(XR,{points:f.slice(-120)}),y.jsx(JR,{monitorId:e})]})}function JR({monitorId:e}){const{data:t}=ps({queryKey:["notifications"],queryFn:async()=>(await bt.get("/notifications")).data.notifications}),{data:s,refetch:n}=ps({queryKey:["monitor-notifications",e],queryFn:async()=>(await bt.get(`/notifications/monitor/${e}`)).data.links}),i=new Set((s??[]).map(o=>o.notificationId));async function r(o){await bt.post(`/notifications/monitor/${e}`,{notificationIds:o}),yt.success("Notifications updated"),await n()}return y.jsxs(Ae,{children:[y.jsxs(Le,{children:[y.jsx("div",{className:"text-sm font-semibold",children:"Notifications"}),y.jsx("div",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"Send webhook when status changes."})]}),y.jsx(De,{children:!t||t.length===0?y.jsx("div",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"No notifications configured. Go to Settings → Notifications."}):y.jsx("div",{className:"space-y-2",children:t.map(o=>y.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[y.jsx("input",{type:"checkbox",checked:i.has(o.id),onChange:a=>{const l=new Set(i);a.target.checked?l.add(o.id):l.delete(o.id),r(Array.from(l))}}),y.jsx("span",{className:"font-medium",children:o.name}),y.jsx("span",{className:"text-neutral-500 dark:text-neutral-400 truncate",children:o.webhookUrl})]},o.id))})})]})}function ZR(){const e=ps({queryKey:["statusPages"],queryFn:async()=>(await bt.get("/status-pages")).data.statusPages});ps({queryKey:["monitors"],queryFn:async()=>(await bt.get("/monitors")).data.monitors});const[t,s]=Q.useState(!1),[n,i]=Q.useState("My Status Page"),[r,o]=Q.useState("my-status");async function a(){s(!0);try{await bt.post("/status-pages",{name:n,slug:r,domains:[]}),yt.success("Created"),e.refetch()}catch(l){yt.error(l?.response?.data?.detail??"Create failed")}finally{s(!1)}}return y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{children:[y.jsx("div",{className:"text-2xl font-semibold",children:"Status Pages"}),y.jsx("div",{className:"text-sm text-neutral-600",children:"This scaffold includes JSON endpoints for a public status page."})]}),y.jsxs(Ae,{children:[y.jsx(Le,{className:"font-semibold",children:"Create"}),y.jsxs(De,{className:"grid gap-3 sm:grid-cols-3",children:[y.jsxs("div",{children:[y.jsx("label",{className:"text-sm",children:"Name"}),y.jsx("input",{className:"mt-1 w-full rounded-xl border px-3 py-2",value:n,onChange:l=>i(l.target.value)})]}),y.jsxs("div",{children:[y.jsx("label",{className:"text-sm",children:"Slug"}),y.jsx("input",{className:"mt-1 w-full rounded-xl border px-3 py-2",value:r,onChange:l=>o(l.target.value)})]}),y.jsx("div",{className:"flex items-end",children:y.jsx("button",{disabled:t,className:"w-full rounded-xl bg-neutral-900 px-3 py-2 text-white hover:bg-neutral-800 disabled:opacity-60",onClick:a,children:t?"Creating...":"Create"})})]})]}),y.jsx("div",{className:"grid gap-3",children:(e.data??[]).map(l=>y.jsxs(Ae,{children:[y.jsxs(Le,{className:"flex items-center justify-between",children:[y.jsxs("div",{children:[y.jsx("div",{className:"font-semibold",children:l.name}),y.jsxs("div",{className:"text-xs text-neutral-600",children:["slug: ",l.slug]})]}),y.jsx("a",{className:"rounded-xl border px-3 py-1 text-sm hover:bg-neutral-50",href:`/status-pages/public/${l.slug}`,target:"_blank",rel:"noreferrer",children:"Public JSON"})]}),y.jsxs(De,{className:"text-sm text-neutral-700",children:["Mapping UI is intentionally minimal in this scaffold; integrate a proper editor when needed.",y.jsx("div",{className:"mt-2 text-xs text-neutral-500",children:"Tip: map status pages to domains using Host / X-Forwarded-Host header like Uptime Kuma does."})]})]},l.id))})]})}function tP(){const{data:e,refetch:t}=ps({queryKey:["notifications"],queryFn:async()=>(await bt.get("/notifications")).data.notifications}),[s,n]=Q.useState(""),[i,r]=Q.useState("");async function o(){if(!s.trim()||!i.trim()){yt.error("Name and webhook URL required");return}try{await bt.post("/notifications",{name:s,webhookUrl:i}),n(""),r(""),yt.success("Notification created"),await t()}catch(l){yt.error(l?.response?.data?.detail??"Failed")}}async function a(l){if(confirm("Delete this notification?"))try{await bt.delete(`/notifications/${l}`),yt.success("Deleted"),await t()}catch(c){yt.error(c?.response?.data?.detail??"Delete failed")}}return y.jsxs("div",{className:"mx-auto max-w-3xl space-y-4",children:[y.jsxs(Ae,{children:[y.jsxs(Le,{children:[y.jsx("div",{className:"text-lg font-semibold",children:"Notifications"}),y.jsx("div",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:"Webhook notifications on monitor status changes."})]}),y.jsxs(De,{children:[y.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[y.jsxs("div",{children:[y.jsx("label",{className:"text-sm",children:"Name"}),y.jsx("input",{value:s,onChange:l=>n(l.target.value),className:"mt-1 w-full rounded-xl border px-3 py-2 dark:border-neutral-800 dark:bg-neutral-950"})]}),y.jsxs("div",{className:"md:col-span-2",children:[y.jsx("label",{className:"text-sm",children:"Webhook URL"}),y.jsx("input",{value:i,onChange:l=>r(l.target.value),placeholder:"https://...",className:"mt-1 w-full rounded-xl border px-3 py-2 dark:border-neutral-800 dark:bg-neutral-950"})]})]}),y.jsx("div",{className:"mt-3",children:y.jsx("button",{onClick:o,className:"rounded-xl bg-neutral-900 px-4 py-2 text-white hover:bg-neutral-800 dark:bg-neutral-100 dark:text-neutral-900 dark:hover:bg-neutral-200",children:"Add"})})]})]}),y.jsxs(Ae,{children:[y.jsx(Le,{children:y.jsx("div",{className:"text-sm font-semibold",children:"Configured Notifications"})}),y.jsx(De,{children:(e??[]).length===0?y.jsx("div",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"No notifications yet."}):y.jsx("div",{className:"space-y-2",children:(e??[]).map(l=>y.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-xl border p-3 dark:border-neutral-800",children:[y.jsxs("div",{className:"min-w-0",children:[y.jsx("div",{className:"font-semibold",children:l.name}),y.jsx("div",{className:"truncate text-sm text-neutral-500 dark:text-neutral-400",children:l.webhookUrl})]}),y.jsx("button",{className:"rounded-xl border px-3 py-2 text-red-600 hover:bg-neutral-50 dark:border-neutral-800 dark:hover:bg-neutral-900",onClick:()=>a(l.id),children:"Delete"})]},l.id))})})]})]})}function eP(){const e=Br(),t=Sh();return y.jsxs("div",{className:"min-h-screen bg-neutral-50 text-neutral-900 dark:bg-neutral-950 dark:text-neutral-100",children:[y.jsx("header",{className:"sticky top-0 z-10 h-14 border-b border-neutral-200 bg-white/80 backdrop-blur dark:border-neutral-800 dark:bg-neutral-950/80",children:y.jsxs("div",{className:"mx-auto flex h-14 max-w-7xl items-center justify-between px-4",children:[y.jsx("div",{className:"font-semibold",children:"PulseWatch"}),y.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[y.jsx("button",{className:"rounded-xl border border-neutral-200 px-3 py-1 hover:bg-neutral-50 dark:border-neutral-800 dark:hover:bg-neutral-900",onClick:()=>t.toggle(),title:"Toggle theme",children:t.mode==="dark"?"Dark":"Light"}),e.email?y.jsx("span",{className:"text-neutral-600 dark:text-neutral-400",children:e.email}):null,e.token?y.jsx("button",{className:"rounded-xl border border-neutral-200 px-3 py-1 hover:bg-neutral-50 dark:border-neutral-800 dark:hover:bg-neutral-900",onClick:e.logout,children:"Logout"}):null]})]})}),y.jsx("main",{className:"h-[calc(100vh-56px)]",children:y.jsx(Ma,{})}),y.jsx(wb,{richColors:!0})]})}const Gi=eg({component:eP}),sP=()=>{const{token:e}=Br.getState();if(!e)throw Ed({to:"/login"})};function fl(e=!0){const t=He({getParentRoute:()=>Gi,id:"workspace",beforeLoad:e?sP:void 0,component:D0}),s=t.addChildren([He({getParentRoute:()=>t,path:"/",component:N0}),He({getParentRoute:()=>t,path:"/monitors/new",component:Uc}),He({getParentRoute:()=>t,path:"/monitors/$id",component:QR}),He({getParentRoute:()=>t,path:"/monitors/$id/edit",component:Uc}),He({getParentRoute:()=>t,path:"/status-pages",component:ZR}),He({getParentRoute:()=>t,path:"/settings/notifications",component:tP})]);if(e){const n=He({getParentRoute:()=>Gi,path:"/login",component:y0});return Gi.addChildren([s,n])}else return Gi.addChildren([s])}Hd({routeTree:fl(!0)});const nP=new Fg;function iP({apiBase:e}){L.useEffect(()=>{e&&(bt.defaults.baseURL=e),ix()},[e]);const t=L.useMemo(()=>Hd({routeTree:fl(!1)}),[]);return y.jsx(jg,{client:nP,children:y.jsx(dg,{router:t})})}exports.PulseWatch=iP;exports.api=bt;exports.createRouteTree=fl;
105
+ `):e}function v4(e,t){const{element:n,datasetIndex:r,index:s}=t,o=e.getDatasetMeta(r).controller,{label:i,value:a}=o.getLabelAndValue(s);return{chart:e,label:i,parsed:o.getParsed(s),raw:e.data.datasets[r].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:r,element:n}}function qy(e,t){const n=e.chart.ctx,{body:r,footer:s,title:o}=e,{boxWidth:i,boxHeight:a}=t,c=rt(t.bodyFont),l=rt(t.titleFont),u=rt(t.footerFont),d=o.length,f=s.length,h=r.length,p=xt(t.padding);let m=p.height,y=0,b=r.reduce((w,S)=>w+S.before.length+S.lines.length+S.after.length,0);if(b+=e.beforeBody.length+e.afterBody.length,d&&(m+=d*l.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),b){const w=t.displayColors?Math.max(a,c.lineHeight):c.lineHeight;m+=h*w+(b-h)*c.lineHeight+(b-1)*t.bodySpacing}f&&(m+=t.footerMarginTop+f*u.lineHeight+(f-1)*t.footerSpacing);let x=0;const _=function(w){y=Math.max(y,n.measureText(w).width+x)};return n.save(),n.font=l.string,Ce(e.title,_),n.font=c.string,Ce(e.beforeBody.concat(e.afterBody),_),x=t.displayColors?i+2+t.boxPadding:0,Ce(r,w=>{Ce(w.before,_),Ce(w.lines,_),Ce(w.after,_)}),x=0,n.font=u.string,Ce(e.footer,_),n.restore(),y+=p.width,{width:y,height:m}}function x4(e,t){const{y:n,height:r}=t;return n<r/2?"top":n>e.height-r/2?"bottom":"center"}function _4(e,t,n,r){const{x:s,width:o}=r,i=n.caretSize+n.caretPadding;if(e==="left"&&s+o+i>t.width||e==="right"&&s-o-i<0)return!0}function w4(e,t,n,r){const{x:s,width:o}=n,{width:i,chartArea:{left:a,right:c}}=e;let l="center";return r==="center"?l=s<=(a+c)/2?"left":"right":s<=o/2?l="left":s>=i-o/2&&(l="right"),_4(l,e,t,n)&&(l="center"),l}function Ky(e,t,n){const r=n.yAlign||t.yAlign||x4(e,n);return{xAlign:n.xAlign||t.xAlign||w4(e,t,n,r),yAlign:r}}function S4(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function E4(e,t,n){let{y:r,height:s}=e;return t==="top"?r+=n:t==="bottom"?r-=s+n:r-=s/2,r}function Zy(e,t,n,r){const{caretSize:s,caretPadding:o,cornerRadius:i}=e,{xAlign:a,yAlign:c}=n,l=s+o,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:h}=Zr(i);let p=S4(t,a);const m=E4(t,c,l);return c==="center"?a==="left"?p+=l:a==="right"&&(p-=l):a==="left"?p-=Math.max(u,f)+s:a==="right"&&(p+=Math.max(d,h)+s),{x:at(p,0,r.width-t.width),y:at(m,0,r.height-t.height)}}function _a(e,t,n){const r=xt(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function Gy(e){return _n([],Fn(e))}function k4(e,t,n){return Rr(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function Yy(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const $S={beforeTitle:In,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(r>0&&t.dataIndex<r)return n[t.dataIndex]}return""},afterTitle:In,beforeBody:In,beforeLabel:In,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return ye(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.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(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:In,afterBody:In,beforeFooter:In,footer:In,afterFooter:In};function Pt(e,t,n,r){const s=e[t].call(n,r);return typeof s>"u"?$S[t].call(n,r):s}class Xy extends Jn{static positioners=Io;constructor(t){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=t.chart,this.options=t.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(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,r=this.options.setContext(this.getContext()),s=r.enabled&&n.options.animation&&r.animations,o=new pS(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=k4(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:r}=n,s=Pt(r,"beforeTitle",this,t),o=Pt(r,"title",this,t),i=Pt(r,"afterTitle",this,t);let a=[];return a=_n(a,Fn(s)),a=_n(a,Fn(o)),a=_n(a,Fn(i)),a}getBeforeBody(t,n){return Gy(Pt(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,s=[];return Ce(t,o=>{const i={before:[],lines:[],after:[]},a=Yy(r,o);_n(i.before,Fn(Pt(a,"beforeLabel",this,o))),_n(i.lines,Pt(a,"label",this,o)),_n(i.after,Fn(Pt(a,"afterLabel",this,o))),s.push(i)}),s}getAfterBody(t,n){return Gy(Pt(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:r}=n,s=Pt(r,"beforeFooter",this,t),o=Pt(r,"footer",this,t),i=Pt(r,"afterFooter",this,t);let a=[];return a=_n(a,Fn(s)),a=_n(a,Fn(o)),a=_n(a,Fn(i)),a}_createItems(t){const n=this._active,r=this.chart.data,s=[],o=[],i=[];let a=[],c,l;for(c=0,l=n.length;c<l;++c)a.push(v4(this.chart,n[c]));return t.filter&&(a=a.filter((u,d,f)=>t.filter(u,d,f,r))),t.itemSort&&(a=a.sort((u,d)=>t.itemSort(u,d,r))),Ce(a,u=>{const d=Yy(t.callbacks,u);s.push(Pt(d,"labelColor",this,u)),o.push(Pt(d,"labelPointStyle",this,u)),i.push(Pt(d,"labelTextColor",this,u))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=i,this.dataPoints=a,a}update(t,n){const r=this.options.setContext(this.getContext()),s=this._active;let o,i=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=Io[r.position].call(this,s,this._eventPosition);i=this._createItems(r),this.title=this.getTitle(i,r),this.beforeBody=this.getBeforeBody(i,r),this.body=this.getBody(i,r),this.afterBody=this.getAfterBody(i,r),this.footer=this.getFooter(i,r);const c=this._size=qy(this,r),l=Object.assign({},a,c),u=Ky(this.chart,r,l),d=Zy(r,l,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:d.x,y:d.y,width:c.width,height:c.height,caretX:a.x,caretY:a.y}}this._tooltipItems=i,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,r,s){const o=this.getCaretPosition(t,r,s);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,r){const{xAlign:s,yAlign:o}=this,{caretSize:i,cornerRadius:a}=r,{topLeft:c,topRight:l,bottomLeft:u,bottomRight:d}=Zr(a),{x:f,y:h}=t,{width:p,height:m}=n;let y,b,x,_,w,S;return o==="center"?(w=h+m/2,s==="left"?(y=f,b=y-i,_=w+i,S=w-i):(y=f+p,b=y+i,_=w-i,S=w+i),x=y):(s==="left"?b=f+Math.max(c,u)+i:s==="right"?b=f+p-Math.max(l,d)-i:b=this.caretX,o==="top"?(_=h,w=_-i,y=b-i,x=b+i):(_=h+m,w=_+i,y=b+i,x=b-i),S=_),{x1:y,x2:b,x3:x,y1:_,y2:w,y3:S}}drawTitle(t,n,r){const s=this.title,o=s.length;let i,a,c;if(o){const l=Bs(r.rtl,this.x,this.width);for(t.x=_a(this,r.titleAlign,r),n.textAlign=l.textAlign(r.titleAlign),n.textBaseline="middle",i=rt(r.titleFont),a=r.titleSpacing,n.fillStyle=r.titleColor,n.font=i.string,c=0;c<o;++c)n.fillText(s[c],l.x(t.x),t.y+i.lineHeight/2),t.y+=i.lineHeight+a,c+1===o&&(t.y+=r.titleMarginBottom-a)}}_drawColorBox(t,n,r,s,o){const i=this.labelColors[r],a=this.labelPointStyles[r],{boxHeight:c,boxWidth:l}=o,u=rt(o.bodyFont),d=_a(this,"left",o),f=s.x(d),h=c<u.lineHeight?(u.lineHeight-c)/2:0,p=n.y+h;if(o.usePointStyle){const m={radius:Math.min(l,c)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},y=s.leftForLtr(f,l)+l/2,b=p+c/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Ud(t,m,y,b),t.strokeStyle=i.borderColor,t.fillStyle=i.backgroundColor,Ud(t,m,y,b)}else{t.lineWidth=xe(i.borderWidth)?Math.max(...Object.values(i.borderWidth)):i.borderWidth||1,t.strokeStyle=i.borderColor,t.setLineDash(i.borderDash||[]),t.lineDashOffset=i.borderDashOffset||0;const m=s.leftForLtr(f,l),y=s.leftForLtr(s.xPlus(f,1),l-2),b=Zr(i.borderRadius);Object.values(b).some(x=>x!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,di(t,{x:m,y:p,w:l,h:c,radius:b}),t.fill(),t.stroke(),t.fillStyle=i.backgroundColor,t.beginPath(),di(t,{x:y,y:p+1,w:l-2,h:c-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(m,p,l,c),t.strokeRect(m,p,l,c),t.fillStyle=i.backgroundColor,t.fillRect(y,p+1,l-2,c-2))}t.fillStyle=this.labelTextColors[r]}drawBody(t,n,r){const{body:s}=this,{bodySpacing:o,bodyAlign:i,displayColors:a,boxHeight:c,boxWidth:l,boxPadding:u}=r,d=rt(r.bodyFont);let f=d.lineHeight,h=0;const p=Bs(r.rtl,this.x,this.width),m=function(E){n.fillText(E,p.x(t.x+h),t.y+f/2),t.y+=f+o},y=p.textAlign(i);let b,x,_,w,S,C,k;for(n.textAlign=i,n.textBaseline="middle",n.font=d.string,t.x=_a(this,y,r),n.fillStyle=r.bodyColor,Ce(this.beforeBody,m),h=a&&y!=="right"?i==="center"?l/2+u:l+2+u:0,w=0,C=s.length;w<C;++w){for(b=s[w],x=this.labelTextColors[w],n.fillStyle=x,Ce(b.before,m),_=b.lines,a&&_.length&&(this._drawColorBox(n,t,w,p,r),f=Math.max(d.lineHeight,c)),S=0,k=_.length;S<k;++S)m(_[S]),f=d.lineHeight;Ce(b.after,m)}h=0,f=d.lineHeight,Ce(this.afterBody,m),t.y-=o}drawFooter(t,n,r){const s=this.footer,o=s.length;let i,a;if(o){const c=Bs(r.rtl,this.x,this.width);for(t.x=_a(this,r.footerAlign,r),t.y+=r.footerMarginTop,n.textAlign=c.textAlign(r.footerAlign),n.textBaseline="middle",i=rt(r.footerFont),n.fillStyle=r.footerColor,n.font=i.string,a=0;a<o;++a)n.fillText(s[a],c.x(t.x),t.y+i.lineHeight/2),t.y+=i.lineHeight+r.footerSpacing}}drawBackground(t,n,r,s){const{xAlign:o,yAlign:i}=this,{x:a,y:c}=t,{width:l,height:u}=r,{topLeft:d,topRight:f,bottomLeft:h,bottomRight:p}=Zr(s.cornerRadius);n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,n.lineWidth=s.borderWidth,n.beginPath(),n.moveTo(a+d,c),i==="top"&&this.drawCaret(t,n,r,s),n.lineTo(a+l-f,c),n.quadraticCurveTo(a+l,c,a+l,c+f),i==="center"&&o==="right"&&this.drawCaret(t,n,r,s),n.lineTo(a+l,c+u-p),n.quadraticCurveTo(a+l,c+u,a+l-p,c+u),i==="bottom"&&this.drawCaret(t,n,r,s),n.lineTo(a+h,c+u),n.quadraticCurveTo(a,c+u,a,c+u-h),i==="center"&&o==="left"&&this.drawCaret(t,n,r,s),n.lineTo(a,c+d),n.quadraticCurveTo(a,c,a+d,c),n.closePath(),n.fill(),s.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,r=this.$animations,s=r&&r.x,o=r&&r.y;if(s||o){const i=Io[t.position].call(this,this._active,this._eventPosition);if(!i)return;const a=this._size=qy(this,t),c=Object.assign({},i,this._size),l=Ky(n,t,c),u=Zy(t,c,l,n);(s._to!==u.x||o._to!==u.y)&&(this.xAlign=l.xAlign,this.yAlign=l.yAlign,this.width=a.width,this.height=a.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const i=xt(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=r,this.drawBackground(o,t,s,n),cS(t,n.textDirection),o.y+=i.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),lS(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const r=this._active,s=t.map(({datasetIndex:a,index:c})=>{const l=this.chart.getDatasetMeta(a);if(!l)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:l.data[c],index:c}}),o=!kc(r,s),i=this._positionChanged(s,n);(o||i)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],i=this._getActiveElements(t,o,n,r),a=this._positionChanged(i,t),c=n||!kc(i,o)||a;return c&&(this._active=i,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),c}_getActiveElements(t,n,r,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const i=this.chart.getElementsAtEventForMode(t,o.mode,o,r);return o.reverse&&i.reverse(),i}_positionChanged(t,n){const{caretX:r,caretY:s,options:o}=this,i=Io[o.position].call(this,t,n);return i!==!1&&(r!==i.x||s!==i.y)}}var VS={id:"tooltip",_element:Xy,positioners:Io,afterInit(e,t,n){n&&(e.tooltip=new Xy({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.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:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.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:$S},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},C4=Object.freeze({__proto__:null,Colors:VW,Decimation:HW,Filler:LS,Legend:zS,SubTitle:b4,Title:y4,Tooltip:VS});const R4=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function P4(e,t,n,r){const s=e.indexOf(t);if(s===-1)return R4(e,t,n,r);const o=e.lastIndexOf(t);return s!==o?n:s}const O4=(e,t)=>e===null?null:at(Math.round(e),0,t);function Jy(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class BS extends hs{static id="category";static defaults={ticks:{callback:Jy}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const r=this.getLabels();for(const{index:s,label:o}of n)r[s]===o&&r.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(ye(t))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===t?n:P4(r,t,de(n,t),this._addedLabels),O4(n,r.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:r,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(r=0),n||(s=this.getLabels().length-1)),this.min=r,this.max=s}buildTicks(){const t=this.min,n=this.max,r=this.options.offset,s=[];let o=this.getLabels();o=t===0&&n===o.length-1?o:o.slice(t,n+1),this._valueRange=Math.max(o.length-(r?0:1),1),this._startValue=this.min-(r?.5:0);for(let i=t;i<=n;i++)s.push({value:i});return s}getLabelForValue(t){return Jy.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function T4(e,t){const n=[],{bounds:s,step:o,min:i,max:a,precision:c,count:l,maxTicks:u,maxDigits:d,includeBounds:f}=e,h=o||1,p=u-1,{min:m,max:y}=t,b=!ye(i),x=!ye(a),_=!ye(l),w=(y-m)/(d+1);let S=qg((y-m)/p/h)*h,C,k,E,P;if(S<1e-14&&!b&&!x)return[{value:m},{value:y}];P=Math.ceil(y/S)-Math.floor(m/S),P>p&&(S=qg(P*S/p/h)*h),ye(c)||(C=Math.pow(10,c),S=Math.ceil(S*C)/C),s==="ticks"?(k=Math.floor(m/S)*S,E=Math.ceil(y/S)*S):(k=m,E=y),b&&x&&o&&bB((a-i)/o,S/1e3)?(P=Math.round(Math.min((a-i)/S,u)),S=(a-i)/P,k=i,E=a):_?(k=b?i:k,E=x?a:E,P=l-1,S=(E-k)/P):(P=(E-k)/S,Bo(P,Math.round(P),S/1e3)?P=Math.round(P):P=Math.ceil(P));const O=Math.max(Kg(S),Kg(k));C=Math.pow(10,ye(c)?O:c),k=Math.round(k*C)/C,E=Math.round(E*C)/C;let N=0;for(b&&(f&&k!==i?(n.push({value:i}),k<i&&N++,Bo(Math.round((k+N*S)*C)/C,i,Qy(i,w,e))&&N++):k<i&&N++);N<P;++N){const A=Math.round((k+N*S)*C)/C;if(x&&A>a)break;n.push({value:A})}return x&&f&&E!==a?n.length&&Bo(n[n.length-1].value,a,Qy(a,w,e))?n[n.length-1].value=a:n.push({value:a}):(!x||E===a)&&n.push({value:E}),n}function Qy(e,t,{horizontal:n,minRotation:r}){const s=fn(r),o=(n?Math.sin(s):Math.cos(s))||.001,i=.75*t*(""+e).length;return Math.min(t/o,i)}class Ac extends hs{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return ye(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:s,max:o}=this;const i=c=>s=n?s:c,a=c=>o=r?o:c;if(t){const c=Rn(s),l=Rn(o);c<0&&l<0?a(0):c>0&&l>0&&i(0)}if(s===o){let c=o===0?1:Math.abs(o*.05);a(o+c),t||i(s-c)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=t,s;return r?(s=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let r=this.getTickLimit();r=Math.max(2,r);const s={maxTicks:r,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,i=T4(s,o);return t.bounds==="ticks"&&H0(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}configure(){const t=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&t.length){const s=(r-n)/Math.max(t.length-1,1)/2;n-=s,r+=s}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(t){return Oi(t,this.chart.options.locale,this.options.ticks.format)}}class US extends Ac{static id="linear";static defaults={ticks:{callback:kl.formatters.numeric}};determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=We(t)?t:0,this.max=We(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=fn(this.options.ticks.minRotation),s=(t?Math.sin(r):Math.cos(r))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const hi=e=>Math.floor(ar(e)),Dr=(e,t)=>Math.pow(10,hi(e)+t);function eb(e){return e/Math.pow(10,hi(e))===1}function tb(e,t,n){const r=Math.pow(10,n),s=Math.floor(e/r);return Math.ceil(t/r)-s}function M4(e,t){const n=t-e;let r=hi(n);for(;tb(e,t,r)>10;)r++;for(;tb(e,t,r)<10;)r--;return Math.min(r,hi(e))}function A4(e,{min:t,max:n}){t=Ft(e.min,t);const r=[],s=hi(t);let o=M4(t,n),i=o<0?Math.pow(10,Math.abs(o)):1;const a=Math.pow(10,o),c=s>o?Math.pow(10,s):0,l=Math.round((t-c)*i)/i,u=Math.floor((t-c)/a/10)*a*10;let d=Math.floor((l-u)/Math.pow(10,o)),f=Ft(e.min,Math.round((c+u+d*Math.pow(10,o))*i)/i);for(;f<n;)r.push({value:f,major:eb(f),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,i=o>=0?1:i),f=Math.round((c+u+d*Math.pow(10,o))*i)/i;const h=Ft(e.max,f);return r.push({value:h,major:eb(h),significand:d}),r}class N4 extends hs{static id="logarithmic";static defaults={ticks:{callback:kl.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const r=Ac.prototype.parse.apply(this,[t,n]);if(r===0){this._zero=!0;return}return We(r)&&r>0?r:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=We(t)?Math.max(0,t):null,this.max=We(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!We(this._userMin)&&(this.min=t===Dr(this.min,0)?Dr(this.min,-1):Dr(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let r=this.min,s=this.max;const o=a=>r=t?r:a,i=a=>s=n?s:a;r===s&&(r<=0?(o(1),i(10)):(o(Dr(r,-1)),i(Dr(s,1)))),r<=0&&o(Dr(s,-1)),s<=0&&i(Dr(r,1)),this.min=r,this.max=s}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},r=A4(n,this);return t.bounds==="ticks"&&H0(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}getLabelForValue(t){return t===void 0?"0":Oi(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=ar(t),this._valueRange=ar(this.max)-ar(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(ar(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}function Gd(e){const t=e.ticks;if(t.display&&e.display){const n=xt(t.backdropPadding);return de(t.font&&t.font.size,$e.font.size)+n.height}return 0}function D4(e,t,n){return n=ze(n)?n:[n],{w:IB(e,t.string,n),h:n.length*t.lineHeight}}function nb(e,t,n,r,s){return e===r||e===s?{start:t-n/2,end:t+n/2}:e<r||e>s?{start:t-n,end:t}:{start:t,end:t+n}}function I4(e){const t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),r=[],s=[],o=e._pointLabels.length,i=e.options.pointLabels,a=i.centerPointLabels?we/o:0;for(let c=0;c<o;c++){const l=i.setContext(e.getPointLabelContext(c));s[c]=l.padding;const u=e.getPointPosition(c,e.drawingArea+s[c],a),d=rt(l.font),f=D4(e.ctx,d,e._pointLabels[c]);r[c]=f;const h=mt(e.getIndexAngle(c)+a),p=Math.round(Eh(h)),m=nb(p,u.x,f.w,0,180),y=nb(p,u.y,f.h,90,270);j4(n,t,h,m,y)}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=z4(e,r,s)}function j4(e,t,n,r,s){const o=Math.abs(Math.sin(n)),i=Math.abs(Math.cos(n));let a=0,c=0;r.start<t.l?(a=(t.l-r.start)/o,e.l=Math.min(e.l,t.l-a)):r.end>t.r&&(a=(r.end-t.r)/o,e.r=Math.max(e.r,t.r+a)),s.start<t.t?(c=(t.t-s.start)/i,e.t=Math.min(e.t,t.t-c)):s.end>t.b&&(c=(s.end-t.b)/i,e.b=Math.max(e.b,t.b+c))}function L4(e,t,n){const r=e.drawingArea,{extra:s,additionalAngle:o,padding:i,size:a}=n,c=e.getPointPosition(t,r+s+i,o),l=Math.round(Eh(mt(c.angle+He))),u=B4(c.y,a.h,l),d=$4(l),f=V4(c.x,a.w,d);return{visible:!0,x:c.x,y:u,textAlign:d,left:f,top:u,right:f+a.w,bottom:u+a.h}}function F4(e,t){if(!t)return!0;const{left:n,top:r,right:s,bottom:o}=e;return!(Wn({x:n,y:r},t)||Wn({x:n,y:o},t)||Wn({x:s,y:r},t)||Wn({x:s,y:o},t))}function z4(e,t,n){const r=[],s=e._pointLabels.length,o=e.options,{centerPointLabels:i,display:a}=o.pointLabels,c={extra:Gd(o)/2,additionalAngle:i?we/s:0};let l;for(let u=0;u<s;u++){c.padding=n[u],c.size=t[u];const d=L4(e,u,c);r.push(d),a==="auto"&&(d.visible=F4(d,l),d.visible&&(l=d))}return r}function $4(e){return e===0||e===180?"center":e<180?"left":"right"}function V4(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function B4(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function U4(e,t,n){const{left:r,top:s,right:o,bottom:i}=n,{backdropColor:a}=t;if(!ye(a)){const c=Zr(t.borderRadius),l=xt(t.backdropPadding);e.fillStyle=a;const u=r-l.left,d=s-l.top,f=o-r+l.width,h=i-s+l.height;Object.values(c).some(p=>p!==0)?(e.beginPath(),di(e,{x:u,y:d,w:f,h,radius:c}),e.fill()):e.fillRect(u,d,f,h)}}function W4(e,t){const{ctx:n,options:{pointLabels:r}}=e;for(let s=t-1;s>=0;s--){const o=e._pointLabelItems[s];if(!o.visible)continue;const i=r.setContext(e.getPointLabelContext(s));U4(n,i,o);const a=rt(i.font),{x:c,y:l,textAlign:u}=o;cs(n,e._pointLabels[s],c,l+a.lineHeight/2,a,{color:i.color,textAlign:u,textBaseline:"middle"})}}function WS(e,t,n,r){const{ctx:s}=e;if(n)s.arc(e.xCenter,e.yCenter,t,0,Ae);else{let o=e.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let i=1;i<r;i++)o=e.getPointPosition(i,t),s.lineTo(o.x,o.y)}}function H4(e,t,n,r,s){const o=e.ctx,i=t.circular,{color:a,lineWidth:c}=t;!i&&!r||!a||!c||n<0||(o.save(),o.strokeStyle=a,o.lineWidth=c,o.setLineDash(s.dash||[]),o.lineDashOffset=s.dashOffset,o.beginPath(),WS(e,n,i,r),o.closePath(),o.stroke(),o.restore())}function q4(e,t,n){return Rr(e,{label:n,index:t,type:"pointLabel"})}class K4 extends Ac{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:kl.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=xt(Gd(this.options)/2),n=this.width=this.maxWidth-t.width,r=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+n/2+t.left),this.yCenter=Math.floor(this.top+r/2+t.top),this.drawingArea=Math.floor(Math.min(n,r)/2)}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!1);this.min=We(t)&&!isNaN(t)?t:0,this.max=We(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Gd(this.options))}generateTickLabels(t){Ac.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,r)=>{const s=Me(this.options.pointLabels.callback,[n,r],this);return s||s===0?s:""}).filter((n,r)=>this.chart.getDataVisibility(r))}fit(){const t=this.options;t.display&&t.pointLabels.display?I4(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,n,r,s){this.xCenter+=Math.floor((t-n)/2),this.yCenter+=Math.floor((r-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,n,r,s))}getIndexAngle(t){const n=Ae/(this._pointLabels.length||1),r=this.options.startAngle||0;return mt(t*n+fn(r))}getDistanceFromCenterForValue(t){if(ye(t))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*n:(t-this.min)*n}getValueForDistanceFromCenter(t){if(ye(t))return NaN;const n=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(t){const n=this._pointLabels||[];if(t>=0&&t<n.length){const r=n[t];return q4(this.getContext(),t,r)}}getPointPosition(t,n,r=0){const s=this.getIndexAngle(t)-He+r;return{x:Math.cos(s)*n+this.xCenter,y:Math.sin(s)*n+this.yCenter,angle:s}}getPointPositionForValue(t,n){return this.getPointPosition(t,this.getDistanceFromCenterForValue(n))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:n,top:r,right:s,bottom:o}=this._pointLabelItems[t];return{left:n,top:r,right:s,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:n}}=this.options;if(t){const r=this.ctx;r.save(),r.beginPath(),WS(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),r.closePath(),r.fillStyle=t,r.fill(),r.restore()}}drawGrid(){const t=this.ctx,n=this.options,{angleLines:r,grid:s,border:o}=n,i=this._pointLabels.length;let a,c,l;if(n.pointLabels.display&&W4(this,i),s.display&&this.ticks.forEach((u,d)=>{if(d!==0||d===0&&this.min<0){c=this.getDistanceFromCenterForValue(u.value);const f=this.getContext(d),h=s.setContext(f),p=o.setContext(f);H4(this,h,c,i,p)}}),r.display){for(t.save(),a=i-1;a>=0;a--){const u=r.setContext(this.getPointLabelContext(a)),{color:d,lineWidth:f}=u;!f||!d||(t.lineWidth=f,t.strokeStyle=d,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,c=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),l=this.getPointPosition(a,c),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,n=this.options,r=n.ticks;if(!r.display)return;const s=this.getIndexAngle(0);let o,i;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,c)=>{if(c===0&&this.min>=0&&!n.reverse)return;const l=r.setContext(this.getContext(c)),u=rt(l.font);if(o=this.getDistanceFromCenterForValue(this.ticks[c].value),l.showLabelBackdrop){t.font=u.string,i=t.measureText(a.label).width,t.fillStyle=l.backdropColor;const d=xt(l.backdropPadding);t.fillRect(-i/2-d.left,-o-u.size/2-d.top,i+d.width,u.size+d.height)}cs(t,a.label,0,-o,u,{color:l.color,strokeColor:l.textStrokeColor,strokeWidth:l.textStrokeWidth})}),t.restore()}drawTitle(){}}const Ml={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}},Nt=Object.keys(Ml);function rb(e,t){return e-t}function sb(e,t){if(ye(t))return null;const n=e._adapter,{parser:r,round:s,isoWeekday:o}=e._parseOpts;let i=t;return typeof r=="function"&&(i=r(i)),We(i)||(i=typeof r=="string"?n.parse(i,r):n.parse(i)),i===null?null:(s&&(i=s==="week"&&(Ys(o)||o===!0)?n.startOf(i,"isoWeek",o):n.startOf(i,s)),+i)}function ob(e,t,n,r){const s=Nt.length;for(let o=Nt.indexOf(e);o<s-1;++o){const i=Ml[Nt[o]],a=i.steps?i.steps:Number.MAX_SAFE_INTEGER;if(i.common&&Math.ceil((n-t)/(a*i.size))<=r)return Nt[o]}return Nt[s-1]}function Z4(e,t,n,r,s){for(let o=Nt.length-1;o>=Nt.indexOf(n);o--){const i=Nt[o];if(Ml[i].common&&e._adapter.diff(s,r,i)>=t-1)return i}return Nt[n?Nt.indexOf(n):0]}function G4(e){for(let t=Nt.indexOf(e)+1,n=Nt.length;t<n;++t)if(Ml[Nt[t]].common)return Nt[t]}function ib(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:r,hi:s}=kh(n,t),o=n[r]>=t?n[r]:n[s];e[o]=!0}}function Y4(e,t,n,r){const s=e._adapter,o=+s.startOf(t[0].value,r),i=t[t.length-1].value;let a,c;for(a=o;a<=i;a=+s.add(a,1,r))c=n[a],c>=0&&(t[c].major=!0);return t}function ab(e,t,n){const r=[],s={},o=t.length;let i,a;for(i=0;i<o;++i)a=t[i],s[a]=i,r.push({value:a,major:!1});return o===0||!n?r:Y4(e,r,s,n)}class Nc extends hs{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const r=t.time||(t.time={}),s=this._adapter=new r5._date(t.adapters.date);s.init(n),Vo(r.displayFormats,s.formats()),this._parseOpts={parser:r.parser,round:r.round,isoWeekday:r.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:sb(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,r=t.time.unit||"day";let{min:s,max:o,minDefined:i,maxDefined:a}=this.getUserBounds();function c(l){!i&&!isNaN(l.min)&&(s=Math.min(s,l.min)),!a&&!isNaN(l.max)&&(o=Math.max(o,l.max))}(!i||!a)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(!1))),s=We(s)&&!isNaN(s)?s:+n.startOf(Date.now(),r),o=We(o)&&!isNaN(o)?o:+n.endOf(Date.now(),r)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],r=t[t.length-1]),{min:n,max:r}}buildTicks(){const t=this.options,n=t.time,r=t.ticks,s=r.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const o=this.min,i=this.max,a=wB(s,o,i);return this._unit=n.unit||(r.autoSkip?ob(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):Z4(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:G4(this._unit),this.initOffsets(s),t.reverse&&a.reverse(),ab(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,r=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?n=1-s:n=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?r=o:r=(o-this.getDecimalForValue(t[t.length-2]))/2);const i=t.length<3?.5:.25;n=at(n,0,i),r=at(r,0,i),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const t=this._adapter,n=this.min,r=this.max,s=this.options,o=s.time,i=o.unit||ob(o.minUnit,n,r,this._getLabelCapacity(n)),a=de(s.ticks.stepSize,1),c=i==="week"?o.isoWeekday:!1,l=Ys(c)||c===!0,u={};let d=n,f,h;if(l&&(d=+t.startOf(d,"isoWeek",c)),d=+t.startOf(d,l?"day":i),t.diff(r,n,i)>1e5*a)throw new Error(n+" and "+r+" are too far apart with stepSize of "+a+" "+i);const p=s.ticks.source==="data"&&this.getDataTimestamps();for(f=d,h=0;f<r;f=+t.add(f,a,i),h++)ib(u,f,p);return(f===r||s.bounds==="ticks"||h===1)&&ib(u,f,p),Object.keys(u).sort(rb).map(m=>+m)}getLabelForValue(t){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(t,r.tooltipFormat):n.format(t,r.displayFormats.datetime)}format(t,n){const s=this.options.time.displayFormats,o=this._unit,i=n||s[o];return this._adapter.format(t,i)}_tickFormatFunction(t,n,r,s){const o=this.options,i=o.ticks.callback;if(i)return Me(i,[t,n,r],this);const a=o.time.displayFormats,c=this._unit,l=this._majorUnit,u=c&&a[c],d=l&&a[l],f=r[n],h=l&&d&&f&&f.major;return this._adapter.format(t,s||(h?d:u))}generateTickLabels(t){let n,r,s;for(n=0,r=t.length;n<r;++n)s=t[n],s.label=this._tickFormatFunction(s.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,r=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+r)*n.factor)}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+r*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,r=this.ctx.measureText(t).width,s=fn(this.isHorizontal()?n.maxRotation:n.minRotation),o=Math.cos(s),i=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:r*o+a*i,h:r*i+a*o}}_getLabelCapacity(t){const n=this.options.time,r=n.displayFormats,s=r[n.unit]||r.millisecond,o=this._tickFormatFunction(t,0,ab(this,[t],this._majorUnit),s),i=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/i.w:this.height/i.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,r;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,r=s.length;n<r;++n)t=t.concat(s[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,r;if(t.length)return t;const s=this.getLabels();for(n=0,r=s.length;n<r;++n)t.push(sb(this,s[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Z0(t.sort(rb))}}function wa(e,t,n){let r=0,s=e.length-1,o,i,a,c;n?(t>=e[r].pos&&t<=e[s].pos&&({lo:r,hi:s}=Un(e,"pos",t)),{pos:o,time:a}=e[r],{pos:i,time:c}=e[s]):(t>=e[r].time&&t<=e[s].time&&({lo:r,hi:s}=Un(e,"time",t)),{time:o,pos:a}=e[r],{time:i,pos:c}=e[s]);const l=i-o;return l?a+(c-a)*(t-o)/l:a}class X4 extends Nc{static id="timeseries";static defaults=Nc.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=wa(n,this.min),this._tableRange=wa(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:r}=this,s=[],o=[];let i,a,c,l,u;for(i=0,a=t.length;i<a;++i)l=t[i],l>=n&&l<=r&&s.push(l);if(s.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(i=0,a=s.length;i<a;++i)u=s[i+1],c=s[i-1],l=s[i],Math.round((u+c)/2)!==l&&o.push({time:l,pos:i/(a-1)});return o}_generate(){const t=this.min,n=this.max;let r=super.getDataTimestamps();return(!r.includes(t)||!r.length)&&r.splice(0,0,t),(!r.includes(n)||r.length===1)&&r.push(n),r.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?t=this.normalize(n.concat(r)):t=n.length?n:r,t=this._cache.all=t,t}getDecimalForValue(t){return(wa(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return wa(this._table,r*this._tableRange+this._minPos,!0)}}var J4=Object.freeze({__proto__:null,CategoryScale:BS,LinearScale:US,LogarithmicScale:N4,RadialLinearScale:K4,TimeScale:Nc,TimeSeriesScale:X4});const Q4=[n5,DW,C4,J4],HS="label";function cb(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function eH(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function qS(e,t){e.labels=t}function KS(e,t,n=HS){const r=[];e.datasets=t.map(s=>{const o=e.datasets.find(i=>i[n]===s[n]);return!o||!s.data||r.includes(o)?{...s}:(r.push(o),Object.assign(o,s),o)})}function tH(e,t=HS){const n={labels:[],datasets:[]};return qS(n,e.labels),KS(n,e.datasets,t),n}function nH(e,t){const{height:n=150,width:r=300,redraw:s=!1,datasetIdKey:o,type:i,data:a,options:c,plugins:l=[],fallbackContent:u,updateMode:d,...f}=e,h=T.useRef(null),p=T.useRef(null),m=()=>{h.current&&(p.current=new Ti(h.current,{type:i,data:tH(a,o),options:c&&{...c},plugins:l}),cb(t,p.current))},y=()=>{cb(t,null),p.current&&(p.current.destroy(),p.current=null)};return T.useEffect(()=>{!s&&p.current&&c&&eH(p.current,c)},[s,c]),T.useEffect(()=>{!s&&p.current&&qS(p.current.config.data,a.labels)},[s,a.labels]),T.useEffect(()=>{!s&&p.current&&a.datasets&&KS(p.current.config.data,a.datasets,o)},[s,a.datasets]),T.useEffect(()=>{p.current&&(s?(y(),setTimeout(m)):p.current.update(d))},[s,c,a.labels,a.datasets,d]),T.useEffect(()=>{p.current&&(y(),setTimeout(m))},[i]),T.useEffect(()=>(m(),()=>y()),[]),g.jsx("canvas",{ref:h,role:"img",height:n,width:r,...f,children:u})}const rH=T.forwardRef(nH);function sH(e,t){return Ti.register(t),T.forwardRef((n,r)=>g.jsx(rH,{...n,ref:r,type:e}))}const oH=sH("line",yS);Ti.register(...Q4);Ti.register(BS,US,TS,Mi,LS,VS,zS,Nc);const iH={id:"downBandPlugin",beforeDraw:e=>{const{ctx:t,chartArea:n,data:r}=e;if(!n)return;r?.datasets?.[0]?.meta?.raw;const s=r?.datasets?.[0]?.status??[];if(!Array.isArray(s)||s.length===0)return;t.save(),t.fillStyle="rgba(239, 68, 68, 0.14)";const o=e.scales.x;for(let i=0;i<s.length;i++){if(s[i]!=="down")continue;const a=o.getPixelForValue(i-.5),c=o.getPixelForValue(i+.5);t.fillRect(a,n.top,c-a,n.bottom-n.top)}t.restore()}};function aH({points:e}){const t=e.map(i=>new Date(i.t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})),n=e.map(i=>i.status==="down"?null:i.ping),r=e.map(i=>i.status),s={labels:t,datasets:[{label:"Ping (ms)",data:n,tension:.25,pointRadius:0,fill:!0,status:r}]},o={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{callbacks:{label:i=>{const a=i.dataIndex;if(r[a]==="down")return"Down";const l=i.parsed.y;return l!=null?`${l} ms`:"—"}}}},scales:{x:{ticks:{maxTicksLimit:8}},y:{beginAtZero:!0}},animation:!1};return g.jsxs("div",{className:"h-64 w-full rounded-2xl border border-neutral-200 bg-white p-3 dark:border-neutral-800 dark:bg-neutral-950",children:[g.jsx("div",{className:"mb-2 text-sm font-semibold",children:"Response Time"}),g.jsx("div",{className:"h-[220px]",children:g.jsx(oH,{data:s,options:o,plugins:[iH]})})]})}const cH=Rx("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{success:"bg-green-500 text-white",default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function lH({className:e,variant:t,asChild:n=!1,...r}){const s=n?Lf:"span";return g.jsx(s,{"data-slot":"badge",className:Se(cH({variant:t}),e),...r})}var Al="Checkbox",[uH]=wr(Al),[dH,Lh]=uH(Al);function fH(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:s,disabled:o,form:i,name:a,onCheckedChange:c,required:l,value:u="on",internal_do_not_use_render:d}=e,[f,h]=Zs({prop:n,defaultProp:s??!1,onChange:c,caller:Al}),[p,m]=v.useState(null),[y,b]=v.useState(null),x=v.useRef(!1),_=p?!!i||!!p.closest("form"):!0,w={checked:f,disabled:o,setChecked:h,control:p,setControl:m,name:a,form:i,value:u,hasConsumerStoppedPropagationRef:x,required:l,defaultChecked:pr(s)?!1:s,isFormControl:_,bubbleInput:y,setBubbleInput:b};return g.jsx(dH,{scope:t,...w,children:hH(d)?d(w):r})}var ZS="CheckboxTrigger",GS=v.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},s)=>{const{control:o,value:i,disabled:a,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:h,bubbleInput:p}=Lh(ZS,e),m=Pe(s,u),y=v.useRef(c);return v.useEffect(()=>{const b=o?.form;if(b){const x=()=>d(y.current);return b.addEventListener("reset",x),()=>b.removeEventListener("reset",x)}},[o,d]),g.jsx(be.button,{type:"button",role:"checkbox","aria-checked":pr(c)?"mixed":c,"aria-required":l,"data-state":tE(c),"data-disabled":a?"":void 0,disabled:a,value:i,...r,ref:m,onKeyDown:re(t,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:re(n,b=>{d(x=>pr(x)?!0:!x),p&&h&&(f.current=b.isPropagationStopped(),f.current||b.stopPropagation())})})});GS.displayName=ZS;var YS=v.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:s,defaultChecked:o,required:i,disabled:a,value:c,onCheckedChange:l,form:u,...d}=e;return g.jsx(fH,{__scopeCheckbox:n,checked:s,defaultChecked:o,disabled:a,required:i,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:f})=>g.jsxs(g.Fragment,{children:[g.jsx(GS,{...d,ref:t,__scopeCheckbox:n}),f&&g.jsx(eE,{__scopeCheckbox:n})]})})});YS.displayName=Al;var XS="CheckboxIndicator",JS=v.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...s}=e,o=Lh(XS,n);return g.jsx(Xn,{present:r||pr(o.checked)||o.checked===!0,children:g.jsx(be.span,{"data-state":tE(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});JS.displayName=XS;var QS="CheckboxBubbleInput",eE=v.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:o,defaultChecked:i,required:a,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:h}=Lh(QS,e),p=Pe(n,h),m=kw(o),y=Wx(r);v.useEffect(()=>{const x=f;if(!x)return;const _=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(_,"checked").set,C=!s.current;if(m!==o&&S){const k=new Event("click",{bubbles:C});x.indeterminate=pr(o),S.call(x,pr(o)?!1:o),x.dispatchEvent(k)}},[f,m,o,s]);const b=v.useRef(pr(o)?!1:o);return g.jsx(be.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??b.current,required:a,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:p,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});eE.displayName=QS;function hH(e){return typeof e=="function"}function pr(e){return e==="indeterminate"}function tE(e){return pr(e)?"indeterminate":e?"checked":"unchecked"}function pH({className:e,...t}){return g.jsx(YS,{"data-slot":"checkbox",className:Se("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:g.jsx(JS,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:g.jsx(bx,{className:"size-3.5"})})})}function mH(){const{id:e}=pi({strict:!1}),t=ls(),n=Hv(),{current:r,currentResults:s,loading:o}=qv(O=>O.monitors),[i,a]=v.useState(!1),[c,l]=v.useState(!1);v.useEffect(()=>{if(!e)return;n(ks(e)),n(Aa(e));const O=setInterval(()=>{n(Aa(e)),n(ks(e))},3e4);return()=>clearInterval(O)},[e,n]);const[u,d]=v.useState(null);if(v.useEffect(()=>{if(!e)return;let O=null;return O=$a(td.apiBase,{path:td.wsPath,transports:["websocket"]}),O.on("monitor:update",N=>{N.monitorId===e&&(d(N),n(Aa(e)),n(ks(e)))}),()=>{O?.disconnect()}},[e,n]),!r)return g.jsxs("div",{className:"flex flex-col items-center justify-center p-12 text-muted-foreground",children:[g.jsx("div",{children:o?"Loading...":"Monitor not found."}),g.jsx(gt,{variant:"link",onClick:()=>t({to:"/"}),children:"Back to Monitors"})]});const f=(s??[]).slice().reverse(),h=f.slice(-40).map(O=>O.status),p=u??s?.[0]??null,m=p?.status??"unknown",y=m==="up"?"text-emerald-500":m==="down"?"text-red-500":"text-muted-foreground",b=m==="up"?"bg-emerald-500":m==="down"?"bg-red-500":"bg-neutral-400",x=f.map(O=>({t:new Date(O.checkedAt).getTime(),ping:O.pingMs??null,status:O.status??"unknown"})),_=f.filter(O=>O.status==="up"||O.status==="down"),w=_.length?_.filter(O=>O.status==="up").length/_.length*100:0,S=(()=>{const O=f.map(N=>N.pingMs).filter(N=>typeof N=="number");return O.length?Math.round(O.reduce((N,A)=>N+A,0)/O.length):null})();async function C(){if(r)try{await n(dc({id:e,paused:!r.isPaused})).unwrap(),Ee.success(r.isPaused?"Resumed":"Paused")}catch(O){Ee.error(O??"Failed")}}async function k(){try{const N=(await Te.post(`/monitors/${e}/clone`)).data.monitor.id;Ee.success("Cloned (paused)"),n(Na()),t({to:"/monitors/$id",params:{id:N}})}catch(O){Ee.error(O?.response?.data?.detail??"Clone failed")}}async function E(){try{await n(Nf(e)).unwrap(),Ee.success("Deleted"),t({to:"/"})}catch(O){Ee.error(O??"Delete failed")}}const P=async O=>{try{await n(Df({id:r.id,data:O})).unwrap(),Ee.success("Monitor updated"),n(ks(e))}catch(N){throw Ee.error(N||"Failed to update monitor"),N}};return g.jsxs("div",{className:"space-y-6",children:[g.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-start md:justify-between",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(gt,{variant:"ghost",size:"icon",className:"-ml-2 h-8 w-8 text-muted-foreground",onClick:()=>t({to:"/"}),children:g.jsx(yx,{className:"h-4 w-4"})}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("div",{className:Se("h-3 w-3 rounded-full",b)}),g.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:r.name}),r.isPaused&&g.jsx(lH,{variant:"secondary",children:"Paused"})]})]}),g.jsxs("div",{className:"text-sm text-muted-foreground ml-10",children:[r.type.toUpperCase()," • Interval: ",r.intervalSeconds,"s • ",r.url||r.host||"No target"]}),g.jsx("div",{className:"ml-10 pt-1",children:g.jsxs("div",{className:"flex gap-[2px] items-end h-6",children:[h.map((O,N)=>g.jsx("div",{className:Se("w-1.5 rounded-sm opacity-90 transition-all hover:scale-110 hover:opacity-100",O==="up"?"bg-emerald-500 h-4":O==="down"?"bg-red-500 h-4":"bg-neutral-300 dark:bg-neutral-800 h-4"),title:O},N)),h.length===0&&g.jsx("div",{className:"text-xs text-muted-foreground",children:"No data yet"})]})})]}),g.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[g.jsxs(gt,{variant:"outline",size:"sm",onClick:C,children:[r.isPaused?g.jsx(Sx,{className:"mr-2 h-4 w-4"}):g.jsx(_x,{className:"mr-2 h-4 w-4"}),r.isPaused?"Resume":"Pause"]}),g.jsxs(gt,{variant:"outline",size:"sm",onClick:()=>l(!0),children:[g.jsx(wx,{className:"mr-2 h-4 w-4"})," Edit"]}),g.jsxs(gt,{variant:"outline",size:"sm",onClick:k,children:[g.jsx(xx,{className:"mr-2 h-4 w-4"})," Clone"]}),g.jsxs(gt,{variant:"destructive",size:"sm",onClick:()=>a(!0),children:[g.jsx(jf,{className:"mr-2 h-4 w-4"})," Delete"]})]})]}),g.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[g.jsxs(Rs,{children:[g.jsx(Ps,{className:"pb-2",children:g.jsx(Os,{className:"text-sm font-medium text-muted-foreground",children:"Status"})}),g.jsxs(Ts,{children:[g.jsx("div",{className:`text-2xl font-bold ${y}`,children:m.toUpperCase()}),g.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:p?.message??"—"})]})]}),g.jsxs(Rs,{children:[g.jsx(Ps,{className:"pb-2",children:g.jsx(Os,{className:"text-sm font-medium text-muted-foreground",children:"Uptime (24h)"})}),g.jsxs(Ts,{children:[g.jsxs("div",{className:"text-2xl font-bold",children:[w.toFixed(1),"%"]}),g.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Last ",s.length," checks"]})]})]}),g.jsxs(Rs,{children:[g.jsx(Ps,{className:"pb-2",children:g.jsx(Os,{className:"text-sm font-medium text-muted-foreground",children:"Avg Response"})}),g.jsxs(Ts,{children:[g.jsx("div",{className:"text-2xl font-bold",children:S!=null?`${S} ms`:"—"}),g.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Latest: ",p?.pingMs!=null?`${p.pingMs} ms`:"—"]})]})]})]}),g.jsxs(Rs,{children:[g.jsx(Ps,{children:g.jsx(Os,{children:"Response Time History"})}),g.jsx(Ts,{children:g.jsx(aH,{points:x.slice(-120)})})]}),g.jsx(gH,{monitorId:e}),g.jsx(k0,{open:i,onOpenChange:a,monitor:r,onConfirm:E}),g.jsx(Nd,{open:c,onOpenChange:l,monitor:r,onSubmit:P})]})}function gH({monitorId:e}){const{data:t}=Go({queryKey:["notifications"],queryFn:async()=>(await Te.get("/notifications")).data.notifications}),{data:n,refetch:r}=Go({queryKey:["monitor-notifications",e],queryFn:async()=>(await Te.get(`/notifications/monitor/${e}`)).data.links}),s=new Set((n??[]).map(i=>i.notificationId));async function o(i){await Te.post(`/notifications/monitor/${e}`,{notificationIds:i}),Ee.success("Notifications updated"),await r()}return g.jsxs(Rs,{children:[g.jsxs(Ps,{children:[g.jsx(Os,{children:"Notifications"}),g.jsx(C0,{children:"Select which notification channels to alert when this monitor goes down."})]}),g.jsx(Ts,{children:!t||t.length===0?g.jsx("div",{className:"text-sm text-muted-foreground",children:"No notifications configured. Go to Settings → Notifications to add channels."}):g.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:t.map(i=>g.jsxs("div",{className:"flex items-start space-x-2 rounded-md border p-3",children:[g.jsx(pH,{id:i.id,checked:s.has(i.id),onCheckedChange:a=>{const c=new Set(s);a?c.add(i.id):c.delete(i.id),o(Array.from(c))}}),g.jsxs("div",{className:"grid gap-1.5 leading-none",children:[g.jsx(e0,{htmlFor:i.id,className:"font-medium cursor-pointer",children:i.name}),g.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[200px]",title:i.webhookUrl,children:i.webhookUrl})]})]},i.id))})})]})}function yH(){const e=Go({queryKey:["statusPages"],queryFn:async()=>(await Te.get("/status-pages")).data.statusPages});Go({queryKey:["monitors"],queryFn:async()=>(await Te.get("/monitors")).data.monitors});const[t,n]=v.useState(!1),[r,s]=v.useState("My Status Page"),[o,i]=v.useState("my-status");async function a(){n(!0);try{await Te.post("/status-pages",{name:r,slug:o,domains:[]}),Ee.success("Created"),e.refetch()}catch(c){Ee.error(c?.response?.data?.detail??"Create failed")}finally{n(!1)}}return g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{children:[g.jsx("div",{className:"text-2xl font-semibold",children:"Status Pages"}),g.jsx("div",{className:"text-sm text-neutral-600",children:"This scaffold includes JSON endpoints for a public status page."})]}),g.jsxs(Yo,{children:[g.jsx(Xo,{className:"font-semibold",children:"Create"}),g.jsxs(Jo,{className:"grid gap-3 sm:grid-cols-3",children:[g.jsxs("div",{children:[g.jsx("label",{className:"text-sm",children:"Name"}),g.jsx("input",{className:"mt-1 w-full rounded-xl border px-3 py-2",value:r,onChange:c=>s(c.target.value)})]}),g.jsxs("div",{children:[g.jsx("label",{className:"text-sm",children:"Slug"}),g.jsx("input",{className:"mt-1 w-full rounded-xl border px-3 py-2",value:o,onChange:c=>i(c.target.value)})]}),g.jsx("div",{className:"flex items-end",children:g.jsx("button",{disabled:t,className:"w-full rounded-xl bg-neutral-900 px-3 py-2 text-white hover:bg-neutral-800 disabled:opacity-60",onClick:a,children:t?"Creating...":"Create"})})]})]}),g.jsx("div",{className:"grid gap-3",children:(e.data??[]).map(c=>g.jsxs(Yo,{children:[g.jsxs(Xo,{className:"flex items-center justify-between",children:[g.jsxs("div",{children:[g.jsx("div",{className:"font-semibold",children:c.name}),g.jsxs("div",{className:"text-xs text-neutral-600",children:["slug: ",c.slug]})]}),g.jsx("a",{className:"rounded-xl border px-3 py-1 text-sm hover:bg-neutral-50",href:`/status-pages/public/${c.slug}`,target:"_blank",rel:"noreferrer",children:"Public JSON"})]}),g.jsxs(Jo,{className:"text-sm text-neutral-700",children:["Mapping UI is intentionally minimal in this scaffold; integrate a proper editor when needed.",g.jsx("div",{className:"mt-2 text-xs text-neutral-500",children:"Tip: map status pages to domains using Host / X-Forwarded-Host header like Uptime Kuma does."})]})]},c.id))})]})}function bH(){const{data:e,refetch:t}=Go({queryKey:["notifications"],queryFn:async()=>(await Te.get("/notifications")).data.notifications}),[n,r]=v.useState(""),[s,o]=v.useState("");async function i(){if(!n.trim()||!s.trim()){Ee.error("Name and webhook URL required");return}try{await Te.post("/notifications",{name:n,webhookUrl:s}),r(""),o(""),Ee.success("Notification created"),await t()}catch(c){Ee.error(c?.response?.data?.detail??"Failed")}}async function a(c){if(confirm("Delete this notification?"))try{await Te.delete(`/notifications/${c}`),Ee.success("Deleted"),await t()}catch(l){Ee.error(l?.response?.data?.detail??"Delete failed")}}return g.jsxs("div",{className:"mx-auto max-w-3xl space-y-4",children:[g.jsxs(Yo,{children:[g.jsxs(Xo,{children:[g.jsx("div",{className:"text-lg font-semibold",children:"Notifications"}),g.jsx("div",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:"Webhook notifications on monitor status changes."})]}),g.jsxs(Jo,{children:[g.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[g.jsxs("div",{children:[g.jsx("label",{className:"text-sm",children:"Name"}),g.jsx("input",{value:n,onChange:c=>r(c.target.value),className:"mt-1 w-full rounded-xl border px-3 py-2 dark:border-neutral-800 dark:bg-neutral-950"})]}),g.jsxs("div",{className:"md:col-span-2",children:[g.jsx("label",{className:"text-sm",children:"Webhook URL"}),g.jsx("input",{value:s,onChange:c=>o(c.target.value),placeholder:"https://...",className:"mt-1 w-full rounded-xl border px-3 py-2 dark:border-neutral-800 dark:bg-neutral-950"})]})]}),g.jsx("div",{className:"mt-3",children:g.jsx("button",{onClick:i,className:"rounded-xl bg-neutral-900 px-4 py-2 text-white hover:bg-neutral-800 dark:bg-neutral-100 dark:text-neutral-900 dark:hover:bg-neutral-200",children:"Add"})})]})]}),g.jsxs(Yo,{children:[g.jsx(Xo,{children:g.jsx("div",{className:"text-sm font-semibold",children:"Configured Notifications"})}),g.jsx(Jo,{children:(e??[]).length===0?g.jsx("div",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"No notifications yet."}):g.jsx("div",{className:"space-y-2",children:(e??[]).map(c=>g.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-xl border p-3 dark:border-neutral-800",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"font-semibold",children:c.name}),g.jsx("div",{className:"truncate text-sm text-neutral-500 dark:text-neutral-400",children:c.webhookUrl})]}),g.jsx("button",{className:"rounded-xl border px-3 py-2 text-red-600 hover:bg-neutral-50 dark:border-neutral-800 dark:hover:bg-neutral-900",onClick:()=>a(c.id),children:"Delete"})]},c.id))})})]})]})}function vH(){return Wc(),vv(),g.jsxs("div",{className:"min-h-screen bg-neutral-50 text-neutral-900 dark:bg-neutral-950 dark:text-neutral-100",children:[g.jsx("main",{className:"min-h-screen",children:g.jsx(of,{})}),g.jsx(ER,{richColors:!0})]})}const Sa=Fk({component:vH}),xH=()=>{const{token:e}=Wc.getState();if(!e)throw yb({to:"/login"})};function Nl(e=!0){const t=jn({getParentRoute:()=>Sa,id:"workspace",beforeLoad:e?xH:void 0,component:yT}),n=t.addChildren([jn({getParentRoute:()=>t,path:"/",component:H$}),jn({getParentRoute:()=>t,path:"/monitors/new",component:Ng}),jn({getParentRoute:()=>t,path:"/monitors/$id",component:mH}),jn({getParentRoute:()=>t,path:"/monitors/$id/edit",component:Ng}),jn({getParentRoute:()=>t,path:"/status-pages",component:yH}),jn({getParentRoute:()=>t,path:"/settings/notifications",component:bH})]);if(e){const r=jn({getParentRoute:()=>Sa,path:"/login",component:gT});return Sa.addChildren([n,r])}else return Sa.addChildren([n])}af({routeTree:Nl(!0)});const nE=sM({reducer:{monitors:CM}}),_H=new Vb;function wH({apiBase:e,token:t,basePath:n}){T.useEffect(()=>{iO(e,t)},[e,t]);const r=T.useMemo(()=>af({routeTree:Nl(!1),basepath:n||"/"}),[n]);return g.jsx(Hb,{store:nE,children:g.jsx(Ub,{client:_H,children:g.jsx(Nb,{router:r})})})}const SH=new Vb;function EH({apiBase:e}){T.useEffect(()=>{e&&(Te.defaults.baseURL=e),aO()},[e]);const t=T.useMemo(()=>af({routeTree:Nl(!1)}),[]);return g.jsx(Hb,{store:nE,children:g.jsx(Ub,{client:SH,children:g.jsx(Nb,{router:t})})})}const kH=[{title:"Monitors",url:"/monitors",icon:"Activity"},{title:"Status Pages",url:"/status-pages",icon:"Globe"},{title:"Notifications",url:"/settings/notifications",icon:"Bell"}];exports.PulsePage=wH;exports.PulseWatch=EH;exports.api=Te;exports.createRouteTree=Nl;exports.pulseNavItems=kH;