From fd6ae77ebe72964ff43554d927954e977dedb193 Mon Sep 17 00:00:00 2001 From: Baitinq <30861839+Baitinq@users.noreply.github.com> Date: Wed, 3 Jul 2024 08:10:56 +0000 Subject: Deploying to gh-pages from @ Baitinq/fs-tracer-frontend@064188855bdf8528e78afa684f3a247b64c69332 🚀 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/browser-BKlBOY-Q.js | 1 - assets/browser-CZGeQ-QM.js | 1 + assets/index-DEqzNWr_.js | 84 ---------------------------------------------- assets/index-DeaNyDD-.css | 1 - assets/index-RT7aBB16.css | 1 + assets/index-lfXooNgj.js | 84 ++++++++++++++++++++++++++++++++++++++++++++++ index.html | 4 +-- 7 files changed, 88 insertions(+), 88 deletions(-) delete mode 100644 assets/browser-BKlBOY-Q.js create mode 100644 assets/browser-CZGeQ-QM.js delete mode 100644 assets/index-DEqzNWr_.js delete mode 100644 assets/index-DeaNyDD-.css create mode 100644 assets/index-RT7aBB16.css create mode 100644 assets/index-lfXooNgj.js diff --git a/assets/browser-BKlBOY-Q.js b/assets/browser-BKlBOY-Q.js deleted file mode 100644 index 152bc88..0000000 --- a/assets/browser-BKlBOY-Q.js +++ /dev/null @@ -1 +0,0 @@ -import{g as a}from"./index-DEqzNWr_.js";function f(t,s){for(var o=0;oe[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var c=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")};const i=a(c),u=f({__proto__:null,default:i},[c]);export{u as b}; diff --git a/assets/browser-CZGeQ-QM.js b/assets/browser-CZGeQ-QM.js new file mode 100644 index 0000000..a50f942 --- /dev/null +++ b/assets/browser-CZGeQ-QM.js @@ -0,0 +1 @@ +import{g as a}from"./index-lfXooNgj.js";function f(t,s){for(var o=0;oe[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var c=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")};const i=a(c),u=f({__proto__:null,default:i},[c]);export{u as b}; diff --git a/assets/index-DEqzNWr_.js b/assets/index-DEqzNWr_.js deleted file mode 100644 index c9c8212..0000000 --- a/assets/index-DEqzNWr_.js +++ /dev/null @@ -1,84 +0,0 @@ -var Xm=Object.defineProperty;var Jm=(t,e,n)=>e in t?Xm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var I=(t,e,n)=>(Jm(t,typeof e!="symbol"?e+"":e,n),n);function Zm(t,e){for(var n=0;ni[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();function e0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Lf={exports:{}},Ho={},Mf={exports:{}},N={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var es=Symbol.for("react.element"),t0=Symbol.for("react.portal"),n0=Symbol.for("react.fragment"),i0=Symbol.for("react.strict_mode"),r0=Symbol.for("react.profiler"),s0=Symbol.for("react.provider"),o0=Symbol.for("react.context"),a0=Symbol.for("react.forward_ref"),l0=Symbol.for("react.suspense"),u0=Symbol.for("react.memo"),c0=Symbol.for("react.lazy"),Ic=Symbol.iterator;function h0(t){return t===null||typeof t!="object"?null:(t=Ic&&t[Ic]||t["@@iterator"],typeof t=="function"?t:null)}var Rf={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},If=Object.assign,Af={};function ji(t,e,n){this.props=t,this.context=e,this.refs=Af,this.updater=n||Rf}ji.prototype.isReactComponent={};ji.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};ji.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Df(){}Df.prototype=ji.prototype;function vu(t,e,n){this.props=t,this.context=e,this.refs=Af,this.updater=n||Rf}var _u=vu.prototype=new Df;_u.constructor=vu;If(_u,ji.prototype);_u.isPureReactComponent=!0;var Ac=Array.isArray,jf=Object.prototype.hasOwnProperty,wu={current:null},Nf={key:!0,ref:!0,__self:!0,__source:!0};function Ff(t,e,n){var i,r={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)jf.call(e,i)&&!Nf.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(a===1)r.children=n;else if(1>>1,Q=T[Y];if(0>>1;Yr(Et,A))Oer(ls,Et)?(T[Y]=ls,T[Oe]=A,Y=Oe):(T[Y]=Et,T[Te]=A,Y=Te);else if(Oer(ls,A))T[Y]=ls,T[Oe]=A,Y=Oe;else break e}}return R}function r(T,R){var A=T.sortIndex-R.sortIndex;return A!==0?A:T.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,h=null,d=3,f=!1,m=!1,y=!1,v=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(T){for(var R=n(u);R!==null;){if(R.callback===null)i(u);else if(R.startTime<=T)i(u),R.sortIndex=R.expirationTime,e(l,R);else break;R=n(u)}}function w(T){if(y=!1,_(T),!m)if(n(l)!==null)m=!0,K(x);else{var R=n(u);R!==null&&ge(w,R.startTime-T)}}function x(T,R){m=!1,y&&(y=!1,p(S),S=-1),f=!0;var A=d;try{for(_(R),h=n(l);h!==null&&(!(h.expirationTime>R)||T&&!D());){var Y=h.callback;if(typeof Y=="function"){h.callback=null,d=h.priorityLevel;var Q=Y(h.expirationTime<=R);R=t.unstable_now(),typeof Q=="function"?h.callback=Q:h===n(l)&&i(l),_(R)}else i(l);h=n(l)}if(h!==null)var vt=!0;else{var Te=n(u);Te!==null&&ge(w,Te.startTime-R),vt=!1}return vt}finally{h=null,d=A,f=!1}}var b=!1,k=null,S=-1,M=5,L=-1;function D(){return!(t.unstable_now()-LT||125Y?(T.sortIndex=A,e(u,T),n(l)===null&&T===n(u)&&(y?(p(S),S=-1):y=!0,ge(w,A-Y))):(T.sortIndex=Q,e(l,T),m||f||(m=!0,K(x))),T},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(T){var R=d;return function(){var A=d;d=R;try{return T.apply(this,arguments)}finally{d=A}}}})(Vf);Bf.exports=Vf;var b0=Bf.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var S0=E,Ge=b0;function C(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ol=Object.prototype.hasOwnProperty,C0=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,jc={},Nc={};function E0(t){return ol.call(Nc,t)?!0:ol.call(jc,t)?!1:C0.test(t)?Nc[t]=!0:(jc[t]=!0,!1)}function P0(t,e,n,i){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function T0(t,e,n,i){if(e===null||typeof e>"u"||P0(t,e,n,i))return!0;if(i)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Ie(t,e,n,i,r,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var ke={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){ke[t]=new Ie(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];ke[e]=new Ie(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){ke[t]=new Ie(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){ke[t]=new Ie(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){ke[t]=new Ie(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){ke[t]=new Ie(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){ke[t]=new Ie(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){ke[t]=new Ie(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){ke[t]=new Ie(t,5,!1,t.toLowerCase(),null,!1,!1)});var ku=/[\-:]([a-z])/g;function bu(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(ku,bu);ke[e]=new Ie(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(ku,bu);ke[e]=new Ie(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(ku,bu);ke[e]=new Ie(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){ke[t]=new Ie(t,1,!1,t.toLowerCase(),null,!1,!1)});ke.xlinkHref=new Ie("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){ke[t]=new Ie(t,1,!1,t.toLowerCase(),null,!0,!0)});function Su(t,e,n,i){var r=ke.hasOwnProperty(e)?ke[e]:null;(r!==null?r.type!==0:i||!(2a||r[o]!==s[a]){var l=` -`+r[o].replace(" at new "," at ");return t.displayName&&l.includes("")&&(l=l.replace("",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{_a=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?ir(t):""}function O0(t){switch(t.tag){case 5:return ir(t.type);case 16:return ir("Lazy");case 13:return ir("Suspense");case 19:return ir("SuspenseList");case 0:case 2:case 15:return t=wa(t.type,!1),t;case 11:return t=wa(t.type.render,!1),t;case 1:return t=wa(t.type,!0),t;default:return""}}function cl(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case oi:return"Fragment";case si:return"Portal";case al:return"Profiler";case Cu:return"StrictMode";case ll:return"Suspense";case ul:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Kf:return(t.displayName||"Context")+".Consumer";case Hf:return(t._context.displayName||"Context")+".Provider";case Eu:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Pu:return e=t.displayName||null,e!==null?e:cl(t.type)||"Memo";case Ht:e=t._payload,t=t._init;try{return cl(t(e))}catch{}}return null}function L0(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return cl(e);case 8:return e===Cu?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function fn(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Gf(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function M0(t){var e=Gf(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),i=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function hs(t){t._valueTracker||(t._valueTracker=M0(t))}function qf(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),i="";return t&&(i=Gf(t)?t.checked?"true":"false":t.value),t=i,t!==n?(e.setValue(t),!0):!1}function lo(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function hl(t,e){var n=e.checked;return ie({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function zc(t,e){var n=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;n=fn(e.value!=null?e.value:n),t._wrapperState={initialChecked:i,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Qf(t,e){e=e.checked,e!=null&&Su(t,"checked",e,!1)}function dl(t,e){Qf(t,e);var n=fn(e.value),i=e.type;if(n!=null)i==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(i==="submit"||i==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?fl(t,e.type,n):e.hasOwnProperty("defaultValue")&&fl(t,e.type,fn(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function $c(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function fl(t,e,n){(e!=="number"||lo(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var rr=Array.isArray;function yi(t,e,n,i){if(t=t.options,e){e={};for(var r=0;r"+e.valueOf().toString()+"",e=ds.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Lr(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var dr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},R0=["Webkit","ms","Moz","O"];Object.keys(dr).forEach(function(t){R0.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),dr[e]=dr[t]})});function ep(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||dr.hasOwnProperty(t)&&dr[t]?(""+e).trim():e+"px"}function tp(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var i=n.indexOf("--")===0,r=ep(n,e[n],i);n==="float"&&(n="cssFloat"),i?t.setProperty(n,r):t[n]=r}}var I0=ie({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ml(t,e){if(e){if(I0[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(C(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(C(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(C(61))}if(e.style!=null&&typeof e.style!="object")throw Error(C(62))}}function yl(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var vl=null;function Tu(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var _l=null,vi=null,_i=null;function Vc(t){if(t=is(t)){if(typeof _l!="function")throw Error(C(280));var e=t.stateNode;e&&(e=Qo(e),_l(t.stateNode,t.type,e))}}function np(t){vi?_i?_i.push(t):_i=[t]:vi=t}function ip(){if(vi){var t=vi,e=_i;if(_i=vi=null,Vc(t),e)for(t=0;t>>=0,t===0?32:31-(W0(t)/H0|0)|0}var fs=64,ps=4194304;function sr(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function fo(t,e){var n=t.pendingLanes;if(n===0)return 0;var i=0,r=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~r;a!==0?i=sr(a):(s&=o,s!==0&&(i=sr(s)))}else o=n&~r,o!==0?i=sr(o):s!==0&&(i=sr(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=i;0n;n++)e.push(t);return e}function ts(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-pt(e),t[e]=n}function q0(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var i=t.eventTimes;for(t=t.expirationTimes;0=pr),Jc=" ",Zc=!1;function bp(t,e){switch(t){case"keyup":return by.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Sp(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ai=!1;function Cy(t,e){switch(t){case"compositionend":return Sp(e);case"keypress":return e.which!==32?null:(Zc=!0,Jc);case"textInput":return t=e.data,t===Jc&&Zc?null:t;default:return null}}function Ey(t,e){if(ai)return t==="compositionend"||!ju&&bp(t,e)?(t=xp(),qs=Iu=Xt=null,ai=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ih(n)}}function Tp(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Tp(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Op(){for(var t=window,e=lo();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=lo(t.document)}return e}function Nu(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function Dy(t){var e=Op(),n=t.focusedElem,i=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&Tp(n.ownerDocument.documentElement,n)){if(i!==null&&Nu(n)){if(e=i.start,t=i.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var r=n.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!t.extend&&s>i&&(r=i,i=s,s=r),r=rh(n,s);var o=rh(n,i);r&&o&&(t.rangeCount!==1||t.anchorNode!==r.node||t.anchorOffset!==r.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),t.removeAllRanges(),s>i?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,li=null,Cl=null,mr=null,El=!1;function sh(t,e,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;El||li==null||li!==lo(i)||(i=li,"selectionStart"in i&&Nu(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),mr&&jr(mr,i)||(mr=i,i=mo(Cl,"onSelect"),0hi||(t.current=Rl[hi],Rl[hi]=null,hi--)}function q(t,e){hi++,Rl[hi]=t.current,t.current=e}var pn={},Pe=yn(pn),Fe=yn(!1),$n=pn;function Ci(t,e){var n=t.type.contextTypes;if(!n)return pn;var i=t.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in n)r[s]=e[s];return i&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=r),r}function ze(t){return t=t.childContextTypes,t!=null}function vo(){Z(Fe),Z(Pe)}function dh(t,e,n){if(Pe.current!==pn)throw Error(C(168));q(Pe,e),q(Fe,n)}function Fp(t,e,n){var i=t.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return n;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(C(108,L0(t)||"Unknown",r));return ie({},n,i)}function _o(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||pn,$n=Pe.current,q(Pe,t),q(Fe,Fe.current),!0}function fh(t,e,n){var i=t.stateNode;if(!i)throw Error(C(169));n?(t=Fp(t,e,$n),i.__reactInternalMemoizedMergedChildContext=t,Z(Fe),Z(Pe),q(Pe,t)):Z(Fe),q(Fe,n)}var Mt=null,Xo=!1,Aa=!1;function zp(t){Mt===null?Mt=[t]:Mt.push(t)}function Yy(t){Xo=!0,zp(t)}function vn(){if(!Aa&&Mt!==null){Aa=!0;var t=0,e=W;try{var n=Mt;for(W=1;t>=o,r-=o,It=1<<32-pt(e)+r|n<S?(M=k,k=null):M=k.sibling;var L=d(p,k,_[S],w);if(L===null){k===null&&(k=M);break}t&&k&&L.alternate===null&&e(p,k),g=s(L,g,S),b===null?x=L:b.sibling=L,b=L,k=M}if(S===_.length)return n(p,k),ee&&En(p,S),x;if(k===null){for(;S<_.length;S++)k=h(p,_[S],w),k!==null&&(g=s(k,g,S),b===null?x=k:b.sibling=k,b=k);return ee&&En(p,S),x}for(k=i(p,k);S<_.length;S++)M=f(k,p,S,_[S],w),M!==null&&(t&&M.alternate!==null&&k.delete(M.key===null?S:M.key),g=s(M,g,S),b===null?x=M:b.sibling=M,b=M);return t&&k.forEach(function(D){return e(p,D)}),ee&&En(p,S),x}function y(p,g,_,w){var x=Vi(_);if(typeof x!="function")throw Error(C(150));if(_=x.call(_),_==null)throw Error(C(151));for(var b=x=null,k=g,S=g=0,M=null,L=_.next();k!==null&&!L.done;S++,L=_.next()){k.index>S?(M=k,k=null):M=k.sibling;var D=d(p,k,L.value,w);if(D===null){k===null&&(k=M);break}t&&k&&D.alternate===null&&e(p,k),g=s(D,g,S),b===null?x=D:b.sibling=D,b=D,k=M}if(L.done)return n(p,k),ee&&En(p,S),x;if(k===null){for(;!L.done;S++,L=_.next())L=h(p,L.value,w),L!==null&&(g=s(L,g,S),b===null?x=L:b.sibling=L,b=L);return ee&&En(p,S),x}for(k=i(p,k);!L.done;S++,L=_.next())L=f(k,p,S,L.value,w),L!==null&&(t&&L.alternate!==null&&k.delete(L.key===null?S:L.key),g=s(L,g,S),b===null?x=L:b.sibling=L,b=L);return t&&k.forEach(function(B){return e(p,B)}),ee&&En(p,S),x}function v(p,g,_,w){if(typeof _=="object"&&_!==null&&_.type===oi&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case cs:e:{for(var x=_.key,b=g;b!==null;){if(b.key===x){if(x=_.type,x===oi){if(b.tag===7){n(p,b.sibling),g=r(b,_.props.children),g.return=p,p=g;break e}}else if(b.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===Ht&&mh(x)===b.type){n(p,b.sibling),g=r(b,_.props),g.ref=Gi(p,b,_),g.return=p,p=g;break e}n(p,b);break}else e(p,b);b=b.sibling}_.type===oi?(g=Nn(_.props.children,p.mode,w,_.key),g.return=p,p=g):(w=io(_.type,_.key,_.props,null,p.mode,w),w.ref=Gi(p,g,_),w.return=p,p=w)}return o(p);case si:e:{for(b=_.key;g!==null;){if(g.key===b)if(g.tag===4&&g.stateNode.containerInfo===_.containerInfo&&g.stateNode.implementation===_.implementation){n(p,g.sibling),g=r(g,_.children||[]),g.return=p,p=g;break e}else{n(p,g);break}else e(p,g);g=g.sibling}g=Ba(_,p.mode,w),g.return=p,p=g}return o(p);case Ht:return b=_._init,v(p,g,b(_._payload),w)}if(rr(_))return m(p,g,_,w);if(Vi(_))return y(p,g,_,w);xs(p,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,g!==null&&g.tag===6?(n(p,g.sibling),g=r(g,_),g.return=p,p=g):(n(p,g),g=Ua(_,p.mode,w),g.return=p,p=g),o(p)):n(p,g)}return v}var Pi=Vp(!0),Wp=Vp(!1),ko=yn(null),bo=null,pi=null,Uu=null;function Bu(){Uu=pi=bo=null}function Vu(t){var e=ko.current;Z(ko),t._currentValue=e}function Dl(t,e,n){for(;t!==null;){var i=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),t===n)break;t=t.return}}function xi(t,e){bo=t,Uu=pi=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Ne=!0),t.firstContext=null)}function rt(t){var e=t._currentValue;if(Uu!==t)if(t={context:t,memoizedValue:e,next:null},pi===null){if(bo===null)throw Error(C(308));pi=t,bo.dependencies={lanes:0,firstContext:t}}else pi=pi.next=t;return e}var In=null;function Wu(t){In===null?In=[t]:In.push(t)}function Hp(t,e,n,i){var r=e.interleaved;return r===null?(n.next=n,Wu(e)):(n.next=r.next,r.next=n),e.interleaved=n,zt(t,i)}function zt(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Kt=!1;function Hu(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Kp(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function jt(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function ln(t,e,n){var i=t.updateQueue;if(i===null)return null;if(i=i.shared,z&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,zt(t,n)}return r=i.interleaved,r===null?(e.next=e,Wu(i)):(e.next=r.next,r.next=e),i.interleaved=e,zt(t,n)}function Xs(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,Lu(t,n)}}function yh(t,e){var n=t.updateQueue,i=t.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var r=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?r=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?r=s=e:s=s.next=e}else r=s=e;n={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function So(t,e,n,i){var r=t.updateQueue;Kt=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?s=u:o.next=u,o=l;var c=t.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==o&&(a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l))}if(s!==null){var h=r.baseState;o=0,c=u=l=null,a=s;do{var d=a.lane,f=a.eventTime;if((i&d)===d){c!==null&&(c=c.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=t,y=a;switch(d=e,f=n,y.tag){case 1:if(m=y.payload,typeof m=="function"){h=m.call(f,h,d);break e}h=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=y.payload,d=typeof m=="function"?m.call(f,h,d):m,d==null)break e;h=ie({},h,d);break e;case 2:Kt=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,d=r.effects,d===null?r.effects=[a]:d.push(a))}else f={eventTime:f,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(u=c=f,l=h):c=c.next=f,o|=d;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;d=a,a=d.next,d.next=null,r.lastBaseUpdate=d,r.shared.pending=null}}while(!0);if(c===null&&(l=h),r.baseState=l,r.firstBaseUpdate=u,r.lastBaseUpdate=c,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);Vn|=o,t.lanes=o,t.memoizedState=h}}function vh(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var i=ja.transition;ja.transition={};try{t(!1),e()}finally{W=n,ja.transition=i}}function ug(){return st().memoizedState}function Xy(t,e,n){var i=cn(t);if(n={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null},cg(t))hg(e,n);else if(n=Hp(t,e,n,i),n!==null){var r=Me();gt(n,t,i,r),dg(n,e,i)}}function Jy(t,e,n){var i=cn(t),r={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null};if(cg(t))hg(e,r);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,n);if(r.hasEagerState=!0,r.eagerState=a,yt(a,o)){var l=e.interleaved;l===null?(r.next=r,Wu(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}n=Hp(t,e,r,i),n!==null&&(r=Me(),gt(n,t,i,r),dg(n,e,i))}}function cg(t){var e=t.alternate;return t===ne||e!==null&&e===ne}function hg(t,e){yr=Eo=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function dg(t,e,n){if(n&4194240){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,Lu(t,n)}}var Po={readContext:rt,useCallback:be,useContext:be,useEffect:be,useImperativeHandle:be,useInsertionEffect:be,useLayoutEffect:be,useMemo:be,useReducer:be,useRef:be,useState:be,useDebugValue:be,useDeferredValue:be,useTransition:be,useMutableSource:be,useSyncExternalStore:be,useId:be,unstable_isNewReconciler:!1},Zy={readContext:rt,useCallback:function(t,e){return xt().memoizedState=[t,e===void 0?null:e],t},useContext:rt,useEffect:wh,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Zs(4194308,4,rg.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Zs(4194308,4,t,e)},useInsertionEffect:function(t,e){return Zs(4,2,t,e)},useMemo:function(t,e){var n=xt();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var i=xt();return e=n!==void 0?n(e):e,i.memoizedState=i.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},i.queue=t,t=t.dispatch=Xy.bind(null,ne,t),[i.memoizedState,t]},useRef:function(t){var e=xt();return t={current:t},e.memoizedState=t},useState:_h,useDebugValue:Zu,useDeferredValue:function(t){return xt().memoizedState=t},useTransition:function(){var t=_h(!1),e=t[0];return t=Qy.bind(null,t[1]),xt().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var i=ne,r=xt();if(ee){if(n===void 0)throw Error(C(407));n=n()}else{if(n=e(),ve===null)throw Error(C(349));Bn&30||Qp(i,e,n)}r.memoizedState=n;var s={value:n,getSnapshot:e};return r.queue=s,wh(Jp.bind(null,i,s,t),[t]),i.flags|=2048,Wr(9,Xp.bind(null,i,s,n,e),void 0,null),n},useId:function(){var t=xt(),e=ve.identifierPrefix;if(ee){var n=At,i=It;n=(i&~(1<<32-pt(i)-1)).toString(32)+n,e=":"+e+"R"+n,n=Br++,0<\/script>",t=t.removeChild(t.firstChild)):typeof i.is=="string"?t=o.createElement(n,{is:i.is}):(t=o.createElement(n),n==="select"&&(o=t,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):t=o.createElementNS(t,n),t[bt]=e,t[zr]=i,kg(t,e,!1,!1),e.stateNode=t;e:{switch(o=yl(n,i),n){case"dialog":X("cancel",t),X("close",t),r=i;break;case"iframe":case"object":case"embed":X("load",t),r=i;break;case"video":case"audio":for(r=0;rLi&&(e.flags|=128,i=!0,qi(s,!1),e.lanes=4194304)}else{if(!i)if(t=Co(o),t!==null){if(e.flags|=128,i=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),qi(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!ee)return Se(e),null}else 2*ae()-s.renderingStartTime>Li&&n!==1073741824&&(e.flags|=128,i=!0,qi(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=ae(),e.sibling=null,n=te.current,q(te,i?n&1|2:n&1),e):(Se(e),null);case 22:case 23:return sc(),i=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?Ve&1073741824&&(Se(e),e.subtreeFlags&6&&(e.flags|=8192)):Se(e),null;case 24:return null;case 25:return null}throw Error(C(156,e.tag))}function av(t,e){switch(zu(e),e.tag){case 1:return ze(e.type)&&vo(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ti(),Z(Fe),Z(Pe),Gu(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Yu(e),null;case 13:if(Z(te),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(C(340));Ei()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Z(te),null;case 4:return Ti(),null;case 10:return Vu(e.type._context),null;case 22:case 23:return sc(),null;case 24:return null;default:return null}}var bs=!1,Ee=!1,lv=typeof WeakSet=="function"?WeakSet:Set,O=null;function gi(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(i){se(t,e,i)}else n.current=null}function Wl(t,e,n){try{n()}catch(i){se(t,e,i)}}var Mh=!1;function uv(t,e){if(Pl=po,t=Op(),Nu(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,u=0,c=0,h=t,d=null;t:for(;;){for(var f;h!==n||r!==0&&h.nodeType!==3||(a=o+r),h!==s||i!==0&&h.nodeType!==3||(l=o+i),h.nodeType===3&&(o+=h.nodeValue.length),(f=h.firstChild)!==null;)d=h,h=f;for(;;){if(h===t)break t;if(d===n&&++u===r&&(a=o),d===s&&++c===i&&(l=o),(f=h.nextSibling)!==null)break;h=d,d=h.parentNode}h=f}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Tl={focusedElem:t,selectionRange:n},po=!1,O=e;O!==null;)if(e=O,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,O=t;else for(;O!==null;){e=O;try{var m=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var y=m.memoizedProps,v=m.memoizedState,p=e.stateNode,g=p.getSnapshotBeforeUpdate(e.elementType===e.type?y:ut(e.type,y),v);p.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var _=e.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(C(163))}}catch(w){se(e,e.return,w)}if(t=e.sibling,t!==null){t.return=e.return,O=t;break}O=e.return}return m=Mh,Mh=!1,m}function vr(t,e,n){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&t)===t){var s=r.destroy;r.destroy=void 0,s!==void 0&&Wl(e,n,s)}r=r.next}while(r!==i)}}function ea(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var i=n.create;n.destroy=i()}n=n.next}while(n!==e)}}function Hl(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function Cg(t){var e=t.alternate;e!==null&&(t.alternate=null,Cg(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[bt],delete e[zr],delete e[Ml],delete e[Hy],delete e[Ky])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Eg(t){return t.tag===5||t.tag===3||t.tag===4}function Rh(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Eg(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Kl(t,e,n){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=yo));else if(i!==4&&(t=t.child,t!==null))for(Kl(t,e,n),t=t.sibling;t!==null;)Kl(t,e,n),t=t.sibling}function Yl(t,e,n){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(i!==4&&(t=t.child,t!==null))for(Yl(t,e,n),t=t.sibling;t!==null;)Yl(t,e,n),t=t.sibling}var we=null,ct=!1;function Bt(t,e,n){for(n=n.child;n!==null;)Pg(t,e,n),n=n.sibling}function Pg(t,e,n){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(Ko,n)}catch{}switch(n.tag){case 5:Ee||gi(n,e);case 6:var i=we,r=ct;we=null,Bt(t,e,n),we=i,ct=r,we!==null&&(ct?(t=we,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):we.removeChild(n.stateNode));break;case 18:we!==null&&(ct?(t=we,n=n.stateNode,t.nodeType===8?Ia(t.parentNode,n):t.nodeType===1&&Ia(t,n),Ar(t)):Ia(we,n.stateNode));break;case 4:i=we,r=ct,we=n.stateNode.containerInfo,ct=!0,Bt(t,e,n),we=i,ct=r;break;case 0:case 11:case 14:case 15:if(!Ee&&(i=n.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Wl(n,e,o),r=r.next}while(r!==i)}Bt(t,e,n);break;case 1:if(!Ee&&(gi(n,e),i=n.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=n.memoizedProps,i.state=n.memoizedState,i.componentWillUnmount()}catch(a){se(n,e,a)}Bt(t,e,n);break;case 21:Bt(t,e,n);break;case 22:n.mode&1?(Ee=(i=Ee)||n.memoizedState!==null,Bt(t,e,n),Ee=i):Bt(t,e,n);break;default:Bt(t,e,n)}}function Ih(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new lv),e.forEach(function(i){var r=vv.bind(null,t,i);n.has(i)||(n.add(i),i.then(r,r))})}}function at(t,e){var n=e.deletions;if(n!==null)for(var i=0;ir&&(r=o),i&=~s}if(i=r,i=ae()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*hv(i/1960))-i,10t?16:t,Jt===null)var i=!1;else{if(t=Jt,Jt=null,Lo=0,z&6)throw Error(C(331));var r=z;for(z|=4,O=t.current;O!==null;){var s=O,o=s.child;if(O.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lae()-ic?jn(t,0):nc|=n),$e(t,e)}function Dg(t,e){e===0&&(t.mode&1?(e=ps,ps<<=1,!(ps&130023424)&&(ps=4194304)):e=1);var n=Me();t=zt(t,e),t!==null&&(ts(t,e,n),$e(t,n))}function yv(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Dg(t,n)}function vv(t,e){var n=0;switch(t.tag){case 13:var i=t.stateNode,r=t.memoizedState;r!==null&&(n=r.retryLane);break;case 19:i=t.stateNode;break;default:throw Error(C(314))}i!==null&&i.delete(e),Dg(t,n)}var jg;jg=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Fe.current)Ne=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Ne=!1,sv(t,e,n);Ne=!!(t.flags&131072)}else Ne=!1,ee&&e.flags&1048576&&$p(e,xo,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;eo(t,e),t=e.pendingProps;var r=Ci(e,Pe.current);xi(e,n),r=Qu(null,e,i,t,r,n);var s=Xu();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,ze(i)?(s=!0,_o(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,Hu(e),r.updater=Zo,e.stateNode=r,r._reactInternals=e,Nl(e,i,t,n),e=$l(null,e,i,!0,s,n)):(e.tag=0,ee&&s&&Fu(e),Le(null,e,r,n),e=e.child),e;case 16:i=e.elementType;e:{switch(eo(t,e),t=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=wv(i),t=ut(i,t),r){case 0:e=zl(null,e,i,t,n);break e;case 1:e=Th(null,e,i,t,n);break e;case 11:e=Eh(null,e,i,t,n);break e;case 14:e=Ph(null,e,i,ut(i.type,t),n);break e}throw Error(C(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ut(i,r),zl(t,e,i,r,n);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ut(i,r),Th(t,e,i,r,n);case 3:e:{if(_g(e),t===null)throw Error(C(387));i=e.pendingProps,s=e.memoizedState,r=s.element,Kp(t,e),So(e,i,null,n);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=Oi(Error(C(423)),e),e=Oh(t,e,i,n,r);break e}else if(i!==r){r=Oi(Error(C(424)),e),e=Oh(t,e,i,n,r);break e}else for(We=an(e.stateNode.containerInfo.firstChild),Ye=e,ee=!0,ft=null,n=Wp(e,null,i,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ei(),i===r){e=$t(t,e,n);break e}Le(t,e,i,n)}e=e.child}return e;case 5:return Yp(e),t===null&&Al(e),i=e.type,r=e.pendingProps,s=t!==null?t.memoizedProps:null,o=r.children,Ol(i,r)?o=null:s!==null&&Ol(i,s)&&(e.flags|=32),vg(t,e),Le(t,e,o,n),e.child;case 6:return t===null&&Al(e),null;case 13:return wg(t,e,n);case 4:return Ku(e,e.stateNode.containerInfo),i=e.pendingProps,t===null?e.child=Pi(e,null,i,n):Le(t,e,i,n),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ut(i,r),Eh(t,e,i,r,n);case 7:return Le(t,e,e.pendingProps,n),e.child;case 8:return Le(t,e,e.pendingProps.children,n),e.child;case 12:return Le(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,q(ko,i._currentValue),i._currentValue=o,s!==null)if(yt(s.value,o)){if(s.children===r.children&&!Fe.current){e=$t(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===i){if(s.tag===1){l=jt(-1,n&-n),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Dl(s.return,n,e),a.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(C(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Dl(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Le(t,e,r.children,n),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,xi(e,n),r=rt(r),i=i(r),e.flags|=1,Le(t,e,i,n),e.child;case 14:return i=e.type,r=ut(i,e.pendingProps),r=ut(i.type,r),Ph(t,e,i,r,n);case 15:return mg(t,e,e.type,e.pendingProps,n);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ut(i,r),eo(t,e),e.tag=1,ze(i)?(t=!0,_o(e)):t=!1,xi(e,n),fg(e,i,r),Nl(e,i,r,n),$l(null,e,i,!0,t,n);case 19:return xg(t,e,n);case 22:return yg(t,e,n)}throw Error(C(156,e.tag))};function Ng(t,e){return cp(t,e)}function _v(t,e,n,i){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function tt(t,e,n,i){return new _v(t,e,n,i)}function ac(t){return t=t.prototype,!(!t||!t.isReactComponent)}function wv(t){if(typeof t=="function")return ac(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Eu)return 11;if(t===Pu)return 14}return 2}function hn(t,e){var n=t.alternate;return n===null?(n=tt(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function io(t,e,n,i,r,s){var o=2;if(i=t,typeof t=="function")ac(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case oi:return Nn(n.children,r,s,e);case Cu:o=8,r|=8;break;case al:return t=tt(12,n,e,r|2),t.elementType=al,t.lanes=s,t;case ll:return t=tt(13,n,e,r),t.elementType=ll,t.lanes=s,t;case ul:return t=tt(19,n,e,r),t.elementType=ul,t.lanes=s,t;case Yf:return na(n,r,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Hf:o=10;break e;case Kf:o=9;break e;case Eu:o=11;break e;case Pu:o=14;break e;case Ht:o=16,i=null;break e}throw Error(C(130,t==null?t:typeof t,""))}return e=tt(o,n,e,r),e.elementType=t,e.type=i,e.lanes=s,e}function Nn(t,e,n,i){return t=tt(7,t,i,e),t.lanes=n,t}function na(t,e,n,i){return t=tt(22,t,i,e),t.elementType=Yf,t.lanes=n,t.stateNode={isHidden:!1},t}function Ua(t,e,n){return t=tt(6,t,null,e),t.lanes=n,t}function Ba(t,e,n){return e=tt(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function xv(t,e,n,i,r){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ka(0),this.expirationTimes=ka(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ka(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function lc(t,e,n,i,r,s,o,a,l){return t=new xv(t,e,n,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=tt(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:i,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hu(s),t}function kv(t,e,n){var i=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Ug)}catch(t){console.error(t)}}Ug(),Uf.exports=qe;var Pv=Uf.exports,Uh=Pv;sl.createRoot=Uh.createRoot,sl.hydrateRoot=Uh.hydrateRoot;/** - * @remix-run/router v1.16.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Kr(){return Kr=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function Bg(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Ov(){return Math.random().toString(36).substr(2,8)}function Vh(t,e){return{usr:t.state,key:t.key,idx:e}}function Jl(t,e,n,i){return n===void 0&&(n=null),Kr({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?$i(e):e,{state:n,key:e&&e.key||i||Ov()})}function Vg(t){let{pathname:e="/",search:n="",hash:i=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),i&&i!=="#"&&(e+=i.charAt(0)==="#"?i:"#"+i),e}function $i(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let i=t.indexOf("?");i>=0&&(e.search=t.substr(i),t=t.substr(0,i)),t&&(e.pathname=t)}return e}function Lv(t,e,n,i){i===void 0&&(i={});let{window:r=document.defaultView,v5Compat:s=!1}=i,o=r.history,a=Zt.Pop,l=null,u=c();u==null&&(u=0,o.replaceState(Kr({},o.state,{idx:u}),""));function c(){return(o.state||{idx:null}).idx}function h(){a=Zt.Pop;let v=c(),p=v==null?null:v-u;u=v,l&&l({action:a,location:y.location,delta:p})}function d(v,p){a=Zt.Push;let g=Jl(y.location,v,p);u=c()+1;let _=Vh(g,u),w=y.createHref(g);try{o.pushState(_,"",w)}catch(x){if(x instanceof DOMException&&x.name==="DataCloneError")throw x;r.location.assign(w)}s&&l&&l({action:a,location:y.location,delta:1})}function f(v,p){a=Zt.Replace;let g=Jl(y.location,v,p);u=c();let _=Vh(g,u),w=y.createHref(g);o.replaceState(_,"",w),s&&l&&l({action:a,location:y.location,delta:0})}function m(v){let p=r.location.origin!=="null"?r.location.origin:r.location.href,g=typeof v=="string"?v:Vg(v);return g=g.replace(/ $/,"%20"),pe(p,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,p)}let y={get action(){return a},get location(){return t(r,o)},listen(v){if(l)throw new Error("A history only accepts one active listener");return r.addEventListener(Bh,h),l=v,()=>{r.removeEventListener(Bh,h),l=null}},createHref(v){return e(r,v)},createURL:m,encodeLocation(v){let p=m(v);return{pathname:p.pathname,search:p.search,hash:p.hash}},push:d,replace:f,go(v){return o.go(v)}};return y}var Wh;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Wh||(Wh={}));function Mv(t,e,n){n===void 0&&(n="/");let i=typeof e=="string"?$i(e):e,r=Kg(i.pathname||"/",n);if(r==null)return null;let s=Wg(t);Rv(s);let o=null;for(let a=0;o==null&&a{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};l.relativePath.startsWith("/")&&(pe(l.relativePath.startsWith(i),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+i+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(i.length));let u=Fn([i,l.relativePath]),c=n.concat(l);s.children&&s.children.length>0&&(pe(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Wg(s.children,e,c,u)),!(s.path==null&&!s.index)&&e.push({path:u,score:zv(u,s.index),routesMeta:c})};return t.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))r(s,o);else for(let l of Hg(s.path))r(s,o,l)}),e}function Hg(t){let e=t.split("/");if(e.length===0)return[];let[n,...i]=e,r=n.endsWith("?"),s=n.replace(/\?$/,"");if(i.length===0)return r?[s,""]:[s];let o=Hg(i.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),r&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function Rv(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:$v(e.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}const Iv=/^:[\w-]+$/,Av=3,Dv=2,jv=1,Nv=10,Fv=-2,Hh=t=>t==="*";function zv(t,e){let n=t.split("/"),i=n.length;return n.some(Hh)&&(i+=Fv),e&&(i+=Dv),n.filter(r=>!Hh(r)).reduce((r,s)=>r+(Iv.test(s)?Av:s===""?jv:Nv),i)}function $v(t,e){return t.length===e.length&&t.slice(0,-1).every((i,r)=>i===e[r])?t[t.length-1]-e[e.length-1]:0}function Uv(t,e){let{routesMeta:n}=t,i={},r="/",s=[];for(let o=0;o{let{paramName:d,isOptional:f}=c;if(d==="*"){let y=a[h]||"";o=s.slice(0,s.length-y.length).replace(/(.)\/+$/,"$1")}const m=a[h];return f&&!m?u[d]=void 0:u[d]=(m||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:o,pattern:t}}function Vv(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),Bg(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let i=[],r="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(i.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(i.push({paramName:"*"}),r+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":t!==""&&t!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,e?void 0:"i"),i]}function Wv(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Bg(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Kg(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,i=t.charAt(n);return i&&i!=="/"?null:t.slice(n)||"/"}function Hv(t,e){e===void 0&&(e="/");let{pathname:n,search:i="",hash:r=""}=typeof t=="string"?$i(t):t;return{pathname:n?n.startsWith("/")?n:Kv(n,e):e,search:Xv(i),hash:Jv(r)}}function Kv(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function Va(t,e,n,i){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(i)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Yv(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Gv(t,e){let n=Yv(t);return e?n.map((i,r)=>r===t.length-1?i.pathname:i.pathnameBase):n.map(i=>i.pathnameBase)}function qv(t,e,n,i){i===void 0&&(i=!1);let r;typeof t=="string"?r=$i(t):(r=Kr({},t),pe(!r.pathname||!r.pathname.includes("?"),Va("?","pathname","search",r)),pe(!r.pathname||!r.pathname.includes("#"),Va("#","pathname","hash",r)),pe(!r.search||!r.search.includes("#"),Va("#","search","hash",r)));let s=t===""||r.pathname==="",o=s?"/":r.pathname,a;if(o==null)a=n;else{let h=e.length-1;if(!i&&o.startsWith("..")){let d=o.split("/");for(;d[0]==="..";)d.shift(),h-=1;r.pathname=d.join("/")}a=h>=0?e[h]:"/"}let l=Hv(r,a),u=o&&o!=="/"&&o.endsWith("/"),c=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}const Fn=t=>t.join("/").replace(/\/\/+/g,"/"),Qv=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Xv=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Jv=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function Zv(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Yg=["post","put","patch","delete"];new Set(Yg);const e_=["get",...Yg];new Set(e_);/** - * React Router v6.23.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Yr(){return Yr=Object.assign?Object.assign.bind():function(t){for(var e=1;e{a.current=!0}),E.useCallback(function(u,c){if(c===void 0&&(c={}),!a.current)return;if(typeof u=="number"){i.go(u);return}let h=qv(u,JSON.parse(o),s,c.relative==="path");t==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:Fn([e,h.pathname])),(c.replace?i.replace:i.push)(h,c.state,c)},[e,i,o,s,t])}function i_(t,e){return r_(t,e)}function r_(t,e,n,i){ua()||pe(!1);let{navigator:r}=E.useContext(aa),{matches:s}=E.useContext(Ui),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=qg(),c;if(e){var h;let v=typeof e=="string"?$i(e):e;l==="/"||(h=v.pathname)!=null&&h.startsWith(l)||pe(!1),c=v}else c=u;let d=c.pathname||"/",f=d;if(l!=="/"){let v=l.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(v.length).join("/")}let m=Mv(t,{pathname:f}),y=u_(m&&m.map(v=>Object.assign({},v,{params:Object.assign({},a,v.params),pathname:Fn([l,r.encodeLocation?r.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?l:Fn([l,r.encodeLocation?r.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),s,n,i);return e&&y?E.createElement(la.Provider,{value:{location:Yr({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:Zt.Pop}},y):y}function s_(){let t=f_(),e=Zv(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,r={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},e),n?E.createElement("pre",{style:r},n):null,null)}const o_=E.createElement(s_,null);class a_ extends E.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?E.createElement(Ui.Provider,{value:this.props.routeContext},E.createElement(Gg.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function l_(t){let{routeContext:e,match:n,children:i}=t,r=E.useContext(dc);return r&&r.static&&r.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=n.route.id),E.createElement(Ui.Provider,{value:e},i)}function u_(t,e,n,i){var r;if(e===void 0&&(e=[]),n===void 0&&(n=null),i===void 0&&(i=null),t==null){var s;if((s=n)!=null&&s.errors)t=n.matches;else return null}let o=t,a=(r=n)==null?void 0:r.errors;if(a!=null){let c=o.findIndex(h=>h.route.id&&(a==null?void 0:a[h.route.id])!==void 0);c>=0||pe(!1),o=o.slice(0,Math.min(o.length,c+1))}let l=!1,u=-1;if(n&&i&&i.v7_partialHydration)for(let c=0;c=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((c,h,d)=>{let f,m=!1,y=null,v=null;n&&(f=a&&h.route.id?a[h.route.id]:void 0,y=h.route.errorElement||o_,l&&(u<0&&d===0?(m=!0,v=null):u===d&&(m=!0,v=h.route.hydrateFallbackElement||null)));let p=e.concat(o.slice(0,d+1)),g=()=>{let _;return f?_=y:m?_=v:h.route.Component?_=E.createElement(h.route.Component,null):h.route.element?_=h.route.element:_=c,E.createElement(l_,{match:h,routeContext:{outlet:c,matches:p,isDataRoute:n!=null},children:_})};return n&&(h.route.ErrorBoundary||h.route.errorElement||d===0)?E.createElement(a_,{location:n.location,revalidation:n.revalidation,component:y,error:f,children:g(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):g()},null)}var Xg=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(Xg||{}),Io=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Io||{});function c_(t){let e=E.useContext(dc);return e||pe(!1),e}function h_(t){let e=E.useContext(t_);return e||pe(!1),e}function d_(t){let e=E.useContext(Ui);return e||pe(!1),e}function Jg(t){let e=d_(),n=e.matches[e.matches.length-1];return n.route.id||pe(!1),n.route.id}function f_(){var t;let e=E.useContext(Gg),n=h_(Io.UseRouteError),i=Jg(Io.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[i]}function p_(){let{router:t}=c_(Xg.UseNavigateStable),e=Jg(Io.UseNavigateStable),n=E.useRef(!1);return Qg(()=>{n.current=!0}),E.useCallback(function(r,s){s===void 0&&(s={}),n.current&&(typeof r=="number"?t.navigate(r):t.navigate(r,Yr({fromRouteId:e},s)))},[t,e])}function ii(t){pe(!1)}function g_(t){let{basename:e="/",children:n=null,location:i,navigationType:r=Zt.Pop,navigator:s,static:o=!1,future:a}=t;ua()&&pe(!1);let l=e.replace(/^\/*/,"/"),u=E.useMemo(()=>({basename:l,navigator:s,static:o,future:Yr({v7_relativeSplatPath:!1},a)}),[l,a,s,o]);typeof i=="string"&&(i=$i(i));let{pathname:c="/",search:h="",hash:d="",state:f=null,key:m="default"}=i,y=E.useMemo(()=>{let v=Kg(c,l);return v==null?null:{location:{pathname:v,search:h,hash:d,state:f,key:m},navigationType:r}},[l,c,h,d,f,m,r]);return y==null?null:E.createElement(aa.Provider,{value:u},E.createElement(la.Provider,{children:n,value:y}))}function m_(t){let{children:e,location:n}=t;return i_(Zl(e),n)}new Promise(()=>{});function Zl(t,e){e===void 0&&(e=[]);let n=[];return E.Children.forEach(t,(i,r)=>{if(!E.isValidElement(i))return;let s=[...e,r];if(i.type===E.Fragment){n.push.apply(n,Zl(i.props.children,s));return}i.type!==ii&&pe(!1),!i.props.index||!i.props.children||pe(!1);let o={id:i.props.id||s.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,loader:i.props.loader,action:i.props.action,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(o.children=Zl(i.props.children,s)),n.push(o)}),n}/** - * React Router DOM v6.23.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */const y_="6";try{window.__reactRouterVersion=y_}catch{}const v_="startTransition",Kh=m0[v_];function __(t){let{basename:e,children:n,future:i,window:r}=t,s=E.useRef();s.current==null&&(s.current=Tv({window:r,v5Compat:!0}));let o=s.current,[a,l]=E.useState({action:o.action,location:o.location}),{v7_startTransition:u}=i||{},c=E.useCallback(h=>{u&&Kh?Kh(()=>l(h)):l(h)},[l,u]);return E.useLayoutEffect(()=>o.listen(c),[o,c]),E.createElement(g_,{basename:e,children:n,location:a.location,navigationType:a.action,navigator:o,future:i})}var Yh;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Yh||(Yh={}));var Gh;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Gh||(Gh={}));const w_="modulepreload",x_=function(t,e){return new URL(t,e).href},qh={},Mi=function(e,n,i){let r=Promise.resolve();if(n&&n.length>0){const s=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=Promise.all(n.map(l=>{if(l=x_(l,i),l in qh)return;qh[l]=!0;const u=l.endsWith(".css"),c=u?'[rel="stylesheet"]':"";if(!!i)for(let f=s.length-1;f>=0;f--){const m=s[f];if(m.href===l&&(!u||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${c}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":w_,u||(d.as="script",d.crossOrigin=""),d.href=l,a&&d.setAttribute("nonce",a),document.head.appendChild(d),u)return new Promise((f,m)=>{d.addEventListener("load",f),d.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${l}`)))})}))}return r.then(()=>e()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})},k_=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>Mi(()=>Promise.resolve().then(()=>ss),void 0,import.meta.url).then(({default:i})=>i(...n)):e=fetch,(...n)=>e(...n)};class fc extends Error{constructor(e,n="FunctionsError",i){super(e),this.name=n,this.context=i}}class b_ extends fc{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class S_ extends fc{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class C_ extends fc{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var eu;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(eu||(eu={}));var E_=function(t,e,n,i){function r(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(i.next(c))}catch(h){o(h)}}function l(c){try{u(i.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):r(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};class P_{constructor(e,{headers:n={},customFetch:i,region:r=eu.Any}={}){this.url=e,this.headers=n,this.region=r,this.fetch=k_(i)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,n={}){var i;return E_(this,void 0,void 0,function*(){try{const{headers:r,method:s,body:o}=n;let a={},{region:l}=n;l||(l=this.region),l&&l!=="any"&&(a["x-region"]=l);let u;o&&(r&&!Object.prototype.hasOwnProperty.call(r,"Content-Type")||!r)&&(typeof Blob<"u"&&o instanceof Blob||o instanceof ArrayBuffer?(a["Content-Type"]="application/octet-stream",u=o):typeof o=="string"?(a["Content-Type"]="text/plain",u=o):typeof FormData<"u"&&o instanceof FormData?u=o:(a["Content-Type"]="application/json",u=JSON.stringify(o)));const c=yield this.fetch(`${this.url}/${e}`,{method:s||"POST",headers:Object.assign(Object.assign(Object.assign({},a),this.headers),r),body:u}).catch(m=>{throw new b_(m)}),h=c.headers.get("x-relay-error");if(h&&h==="true")throw new S_(c);if(!c.ok)throw new C_(c);let d=((i=c.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),f;return d==="application/json"?f=yield c.json():d==="application/octet-stream"?f=yield c.blob():d==="text/event-stream"?f=c:d==="multipart/form-data"?f=yield c.formData():f=yield c.text(),{data:f,error:null}}catch(r){return{data:null,error:r}}})}}var T_=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},Ri=T_();const O_=Ri.fetch,pc=Ri.fetch.bind(Ri),Zg=Ri.Headers,L_=Ri.Request,M_=Ri.Response,ss=Object.freeze(Object.defineProperty({__proto__:null,Headers:Zg,Request:L_,Response:M_,default:pc,fetch:O_},Symbol.toStringTag,{value:"Module"}));class R_ extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}}class I_{constructor(e){this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=e.headers,this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle,e.fetch?this.fetch=e.fetch:typeof fetch>"u"?this.fetch=pc:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}then(e,n){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),this.method!=="GET"&&this.method!=="HEAD"&&(this.headers["Content-Type"]="application/json");const i=this.fetch;let r=i(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async s=>{var o,a,l;let u=null,c=null,h=null,d=s.status,f=s.statusText;if(s.ok){if(this.method!=="HEAD"){const p=await s.text();p===""||(this.headers.Accept==="text/csv"||this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?c=p:c=JSON.parse(p))}const y=(o=this.headers.Prefer)===null||o===void 0?void 0:o.match(/count=(exact|planned|estimated)/),v=(a=s.headers.get("content-range"))===null||a===void 0?void 0:a.split("/");y&&v&&v.length>1&&(h=parseInt(v[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(c)&&(c.length>1?(u={code:"PGRST116",details:`Results contain ${c.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},c=null,h=null,d=406,f="Not Acceptable"):c.length===1?c=c[0]:c=null)}else{const y=await s.text();try{u=JSON.parse(y),Array.isArray(u)&&s.status===404&&(c=[],u=null,d=200,f="OK")}catch{s.status===404&&y===""?(d=204,f="No Content"):u={message:y}}if(u&&this.isMaybeSingle&&(!((l=u==null?void 0:u.details)===null||l===void 0)&&l.includes("0 rows"))&&(u=null,d=200,f="OK"),u&&this.shouldThrowOnError)throw new R_(u)}return{error:u,data:c,count:h,status:d,statusText:f}});return this.shouldThrowOnError||(r=r.catch(s=>{var o,a,l;return{error:{message:`${(o=s==null?void 0:s.name)!==null&&o!==void 0?o:"FetchError"}: ${s==null?void 0:s.message}`,details:`${(a=s==null?void 0:s.stack)!==null&&a!==void 0?a:""}`,hint:"",code:`${(l=s==null?void 0:s.code)!==null&&l!==void 0?l:""}`},data:null,count:null,status:0,statusText:""}})),r.then(e,n)}}class A_ extends I_{select(e){let n=!1;const i=(e??"*").split("").map(r=>/\s/.test(r)&&!n?"":(r==='"'&&(n=!n),r)).join("");return this.url.searchParams.set("select",i),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(e,{ascending:n=!0,nullsFirst:i,foreignTable:r,referencedTable:s=r}={}){const o=s?`${s}.order`:"order",a=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${a?`${a},`:""}${e}.${n?"asc":"desc"}${i===void 0?"":i?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:n,referencedTable:i=n}={}){const r=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,n,{foreignTable:i,referencedTable:r=i}={}){const s=typeof r>"u"?"offset":`${r}.offset`,o=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(o,`${n-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return this.method==="GET"?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain({analyze:e=!1,verbose:n=!1,settings:i=!1,buffers:r=!1,wal:s=!1,format:o="text"}={}){var a;const l=[e?"analyze":null,n?"verbose":null,i?"settings":null,r?"buffers":null,s?"wal":null].filter(Boolean).join("|"),u=(a=this.headers.Accept)!==null&&a!==void 0?a:"application/json";return this.headers.Accept=`application/vnd.pgrst.plan+${o}; for="${u}"; options=${l};`,o==="json"?this:this}rollback(){var e;return((e=this.headers.Prefer)!==null&&e!==void 0?e:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}}class ri extends A_{eq(e,n){return this.url.searchParams.append(e,`eq.${n}`),this}neq(e,n){return this.url.searchParams.append(e,`neq.${n}`),this}gt(e,n){return this.url.searchParams.append(e,`gt.${n}`),this}gte(e,n){return this.url.searchParams.append(e,`gte.${n}`),this}lt(e,n){return this.url.searchParams.append(e,`lt.${n}`),this}lte(e,n){return this.url.searchParams.append(e,`lte.${n}`),this}like(e,n){return this.url.searchParams.append(e,`like.${n}`),this}likeAllOf(e,n){return this.url.searchParams.append(e,`like(all).{${n.join(",")}}`),this}likeAnyOf(e,n){return this.url.searchParams.append(e,`like(any).{${n.join(",")}}`),this}ilike(e,n){return this.url.searchParams.append(e,`ilike.${n}`),this}ilikeAllOf(e,n){return this.url.searchParams.append(e,`ilike(all).{${n.join(",")}}`),this}ilikeAnyOf(e,n){return this.url.searchParams.append(e,`ilike(any).{${n.join(",")}}`),this}is(e,n){return this.url.searchParams.append(e,`is.${n}`),this}in(e,n){const i=Array.from(new Set(n)).map(r=>typeof r=="string"&&new RegExp("[,()]").test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`in.(${i})`),this}contains(e,n){return typeof n=="string"?this.url.searchParams.append(e,`cs.${n}`):Array.isArray(n)?this.url.searchParams.append(e,`cs.{${n.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(n)}`),this}containedBy(e,n){return typeof n=="string"?this.url.searchParams.append(e,`cd.${n}`):Array.isArray(n)?this.url.searchParams.append(e,`cd.{${n.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(n)}`),this}rangeGt(e,n){return this.url.searchParams.append(e,`sr.${n}`),this}rangeGte(e,n){return this.url.searchParams.append(e,`nxl.${n}`),this}rangeLt(e,n){return this.url.searchParams.append(e,`sl.${n}`),this}rangeLte(e,n){return this.url.searchParams.append(e,`nxr.${n}`),this}rangeAdjacent(e,n){return this.url.searchParams.append(e,`adj.${n}`),this}overlaps(e,n){return typeof n=="string"?this.url.searchParams.append(e,`ov.${n}`):this.url.searchParams.append(e,`ov.{${n.join(",")}}`),this}textSearch(e,n,{config:i,type:r}={}){let s="";r==="plain"?s="pl":r==="phrase"?s="ph":r==="websearch"&&(s="w");const o=i===void 0?"":`(${i})`;return this.url.searchParams.append(e,`${s}fts${o}.${n}`),this}match(e){return Object.entries(e).forEach(([n,i])=>{this.url.searchParams.append(n,`eq.${i}`)}),this}not(e,n,i){return this.url.searchParams.append(e,`not.${n}.${i}`),this}or(e,{foreignTable:n,referencedTable:i=n}={}){const r=i?`${i}.or`:"or";return this.url.searchParams.append(r,`(${e})`),this}filter(e,n,i){return this.url.searchParams.append(e,`${n}.${i}`),this}}class D_{constructor(e,{headers:n={},schema:i,fetch:r}){this.url=e,this.headers=n,this.schema=i,this.fetch=r}select(e,{head:n=!1,count:i}={}){const r=n?"HEAD":"GET";let s=!1;const o=(e??"*").split("").map(a=>/\s/.test(a)&&!s?"":(a==='"'&&(s=!s),a)).join("");return this.url.searchParams.set("select",o),i&&(this.headers.Prefer=`count=${i}`),new ri({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(e,{count:n,defaultToNull:i=!0}={}){const r="POST",s=[];if(this.headers.Prefer&&s.push(this.headers.Prefer),n&&s.push(`count=${n}`),i||s.push("missing=default"),this.headers.Prefer=s.join(","),Array.isArray(e)){const o=e.reduce((a,l)=>a.concat(Object.keys(l)),[]);if(o.length>0){const a=[...new Set(o)].map(l=>`"${l}"`);this.url.searchParams.set("columns",a.join(","))}}return new ri({method:r,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}upsert(e,{onConflict:n,ignoreDuplicates:i=!1,count:r,defaultToNull:s=!0}={}){const o="POST",a=[`resolution=${i?"ignore":"merge"}-duplicates`];if(n!==void 0&&this.url.searchParams.set("on_conflict",n),this.headers.Prefer&&a.push(this.headers.Prefer),r&&a.push(`count=${r}`),s||a.push("missing=default"),this.headers.Prefer=a.join(","),Array.isArray(e)){const l=e.reduce((u,c)=>u.concat(Object.keys(c)),[]);if(l.length>0){const u=[...new Set(l)].map(c=>`"${c}"`);this.url.searchParams.set("columns",u.join(","))}}return new ri({method:o,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}update(e,{count:n}={}){const i="PATCH",r=[];return this.headers.Prefer&&r.push(this.headers.Prefer),n&&r.push(`count=${n}`),this.headers.Prefer=r.join(","),new ri({method:i,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}delete({count:e}={}){const n="DELETE",i=[];return e&&i.push(`count=${e}`),this.headers.Prefer&&i.unshift(this.headers.Prefer),this.headers.Prefer=i.join(","),new ri({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}}const j_="1.15.2",N_={"X-Client-Info":`postgrest-js/${j_}`};class gc{constructor(e,{headers:n={},schema:i,fetch:r}={}){this.url=e,this.headers=Object.assign(Object.assign({},N_),n),this.schemaName=i,this.fetch=r}from(e){const n=new URL(`${this.url}/${e}`);return new D_(n,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new gc(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,n={},{head:i=!1,get:r=!1,count:s}={}){let o;const a=new URL(`${this.url}/rpc/${e}`);let l;i||r?(o=i?"HEAD":"GET",Object.entries(n).filter(([c,h])=>h!==void 0).map(([c,h])=>[c,Array.isArray(h)?`{${h.join(",")}}`:`${h}`]).forEach(([c,h])=>{a.searchParams.append(c,h)})):(o="POST",l=n);const u=Object.assign({},this.headers);return s&&(u.Prefer=`count=${s}`),new ri({method:o,url:a,headers:u,schema:this.schemaName,body:l,fetch:this.fetch,allowEmpty:!1})}}const F_="2.9.5",z_={"X-Client-Info":`realtime-js/${F_}`},$_="1.0.0",em=1e4,U_=1e3;var bi;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(bi||(bi={}));var Ue;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(Ue||(Ue={}));var ht;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(ht||(ht={}));var tu;(function(t){t.websocket="websocket"})(tu||(tu={}));var Mn;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(Mn||(Mn={}));class tm{constructor(e,n){this.callback=e,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}class B_{constructor(){this.HEADER_LENGTH=1}decode(e,n){return e.constructor===ArrayBuffer?n(this._binaryDecode(e)):n(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const n=new DataView(e),i=new TextDecoder;return this._decodeBroadcast(e,n,i)}_decodeBroadcast(e,n,i){const r=n.getUint8(1),s=n.getUint8(2);let o=this.HEADER_LENGTH+2;const a=i.decode(e.slice(o,o+r));o=o+r;const l=i.decode(e.slice(o,o+s));o=o+s;const u=JSON.parse(i.decode(e.slice(o,e.byteLength)));return{ref:null,topic:a,event:l,payload:u}}}class Wa{constructor(e,n,i={},r=em){this.channel=e,this.event=n,this.payload=i,this.timeout=r,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,n){var i;return this._hasReceived(e)&&n((i=this.receivedResp)===null||i===void 0?void 0:i.response),this.recHooks.push({status:e,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:n}){this.recHooks.filter(i=>i.status===e).forEach(i=>i.callback(n))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var Qh;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(Qh||(Qh={}));class xr{constructor(e,n){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const i=(n==null?void 0:n.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(i.state,{},r=>{const{onJoin:s,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=xr.syncState(this.state,r,s,o),this.pendingDiffs.forEach(l=>{this.state=xr.syncDiff(this.state,l,s,o)}),this.pendingDiffs=[],a()}),this.channel._on(i.diff,{},r=>{const{onJoin:s,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(r):(this.state=xr.syncDiff(this.state,r,s,o),a())}),this.onJoin((r,s,o)=>{this.channel._trigger("presence",{event:"join",key:r,currentPresences:s,newPresences:o})}),this.onLeave((r,s,o)=>{this.channel._trigger("presence",{event:"leave",key:r,currentPresences:s,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,n,i,r){const s=this.cloneDeep(e),o=this.transformState(n),a={},l={};return this.map(s,(u,c)=>{o[u]||(l[u]=c)}),this.map(o,(u,c)=>{const h=s[u];if(h){const d=c.map(v=>v.presence_ref),f=h.map(v=>v.presence_ref),m=c.filter(v=>f.indexOf(v.presence_ref)<0),y=h.filter(v=>d.indexOf(v.presence_ref)<0);m.length>0&&(a[u]=m),y.length>0&&(l[u]=y)}else a[u]=c}),this.syncDiff(s,{joins:a,leaves:l},i,r)}static syncDiff(e,n,i,r){const{joins:s,leaves:o}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return i||(i=()=>{}),r||(r=()=>{}),this.map(s,(a,l)=>{var u;const c=(u=e[a])!==null&&u!==void 0?u:[];if(e[a]=this.cloneDeep(l),c.length>0){const h=e[a].map(f=>f.presence_ref),d=c.filter(f=>h.indexOf(f.presence_ref)<0);e[a].unshift(...d)}i(a,c,l)}),this.map(o,(a,l)=>{let u=e[a];if(!u)return;const c=l.map(h=>h.presence_ref);u=u.filter(h=>c.indexOf(h.presence_ref)<0),e[a]=u,r(a,u,l),u.length===0&&delete e[a]}),e}static map(e,n){return Object.getOwnPropertyNames(e).map(i=>n(i,e[i]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((n,i)=>{const r=e[i];return"metas"in r?n[i]=r.metas.map(s=>(s.presence_ref=s.phx_ref,delete s.phx_ref,delete s.phx_ref_prev,s)):n[i]=r,n},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var G;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(G||(G={}));const Xh=(t,e,n={})=>{var i;const r=(i=n.skipTypes)!==null&&i!==void 0?i:[];return Object.keys(e).reduce((s,o)=>(s[o]=V_(o,t,e,r),s),{})},V_=(t,e,n,i)=>{const r=e.find(a=>a.name===t),s=r==null?void 0:r.type,o=n[t];return s&&!i.includes(s)?nm(s,o):nu(o)},nm=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return Y_(e,n)}switch(t){case G.bool:return W_(e);case G.float4:case G.float8:case G.int2:case G.int4:case G.int8:case G.numeric:case G.oid:return H_(e);case G.json:case G.jsonb:return K_(e);case G.timestamp:return G_(e);case G.abstime:case G.date:case G.daterange:case G.int4range:case G.int8range:case G.money:case G.reltime:case G.text:case G.time:case G.timestamptz:case G.timetz:case G.tsrange:case G.tstzrange:return nu(e);default:return nu(e)}},nu=t=>t,W_=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},H_=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},K_=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t},Y_=(t,e)=>{if(typeof t!="string")return t;const n=t.length-1,i=t[n];if(t[0]==="{"&&i==="}"){let s;const o=t.slice(1,n);try{s=JSON.parse("["+o+"]")}catch{s=o?o.split(","):[]}return s.map(a=>nm(e,a))}return t},G_=t=>typeof t=="string"?t.replace(" ","T"):t;var Jh;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(Jh||(Jh={}));var Zh;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes"})(Zh||(Zh={}));var ed;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(ed||(ed={}));class mc{constructor(e,n={config:{}},i){this.topic=e,this.params=n,this.socket=i,this.bindings={},this.state=Ue.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:""}},n.config),this.timeout=this.socket.timeout,this.joinPush=new Wa(this,ht.join,this.params,this.timeout),this.rejoinTimer=new tm(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ue.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(r=>r.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Ue.closed,this.socket._remove(this)}),this._onError(r=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,r),this.state=Ue.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ue.errored,this.rejoinTimer.scheduleTimeout())}),this._on(ht.reply,{},(r,s)=>{this._trigger(this._replyEventName(s),r)}),this.presence=new xr(this),this.broadcastEndpointURL=this._broadcastEndpointURL()}subscribe(e,n=this.timeout){var i,r;if(this.socket.isConnected()||this.socket.connect(),this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";{const{config:{broadcast:s,presence:o}}=this.params;this._onError(u=>e&&e("CHANNEL_ERROR",u)),this._onClose(()=>e&&e("CLOSED"));const a={},l={broadcast:s,presence:o,postgres_changes:(r=(i=this.bindings.postgres_changes)===null||i===void 0?void 0:i.map(u=>u.filter))!==null&&r!==void 0?r:[]};this.socket.accessToken&&(a.access_token=this.socket.accessToken),this.updateJoinPayload(Object.assign({config:l},a)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",({postgres_changes:u})=>{var c;if(this.socket.accessToken&&this.socket.setAuth(this.socket.accessToken),u===void 0){e&&e("SUBSCRIBED");return}else{const h=this.bindings.postgres_changes,d=(c=h==null?void 0:h.length)!==null&&c!==void 0?c:0,f=[];for(let m=0;m{e&&e("CHANNEL_ERROR",new Error(JSON.stringify(Object.values(u).join(", ")||"error")))}).receive("timeout",()=>{e&&e("TIMED_OUT")})}return this}presenceState(){return this.presence.state}async track(e,n={}){return await this.send({type:"presence",event:"track",payload:e},n.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,n,i){return this._on(e,n,i)}async send(e,n={}){var i,r;if(!this._canPush()&&e.type==="broadcast"){const{event:s,payload:o}=e,a={method:"POST",headers:{apikey:(i=this.socket.apiKey)!==null&&i!==void 0?i:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:o}]})};try{return(await this._fetchWithTimeout(this.broadcastEndpointURL,a,(r=n.timeout)!==null&&r!==void 0?r:this.timeout)).ok?"ok":"error"}catch(l){return l.name==="AbortError"?"timed out":"error"}}else return new Promise(s=>{var o,a,l;const u=this._push(e.type,e,n.timeout||this.timeout);e.type==="broadcast"&&!(!((l=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||l===void 0)&&l.ack)&&s("ok"),u.receive("ok",()=>s("ok")),u.receive("error",()=>s("error")),u.receive("timeout",()=>s("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Ue.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(ht.close,"leave",this._joinRef())};return this.rejoinTimer.reset(),this.joinPush.destroy(),new Promise(i=>{const r=new Wa(this,ht.leave,{},e);r.receive("ok",()=>{n(),i("ok")}).receive("timeout",()=>{n(),i("timed out")}).receive("error",()=>{i("error")}),r.send(),this._canPush()||r.trigger("ok",{})})}_broadcastEndpointURL(){let e=this.socket.endPoint;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")+"/api/broadcast"}async _fetchWithTimeout(e,n,i){const r=new AbortController,s=setTimeout(()=>r.abort(),i),o=await this.socket.fetch(e,Object.assign(Object.assign({},n),{signal:r.signal}));return clearTimeout(s),o}_push(e,n,i=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let r=new Wa(this,e,n,i);return this._canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}_onMessage(e,n,i){return n}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,n,i){var r,s;const o=e.toLocaleLowerCase(),{close:a,error:l,leave:u,join:c}=ht;if(i&&[a,l,u,c].indexOf(o)>=0&&i!==this._joinRef())return;let d=this._onMessage(o,n,i);if(n&&!d)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(r=this.bindings.postgres_changes)===null||r===void 0||r.filter(f=>{var m,y,v;return((m=f.filter)===null||m===void 0?void 0:m.event)==="*"||((v=(y=f.filter)===null||y===void 0?void 0:y.event)===null||v===void 0?void 0:v.toLocaleLowerCase())===o}).map(f=>f.callback(d,i)):(s=this.bindings[o])===null||s===void 0||s.filter(f=>{var m,y,v,p,g,_;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in f){const w=f.id,x=(m=f.filter)===null||m===void 0?void 0:m.event;return w&&((y=n.ids)===null||y===void 0?void 0:y.includes(w))&&(x==="*"||(x==null?void 0:x.toLocaleLowerCase())===((v=n.data)===null||v===void 0?void 0:v.type.toLocaleLowerCase()))}else{const w=(g=(p=f==null?void 0:f.filter)===null||p===void 0?void 0:p.event)===null||g===void 0?void 0:g.toLocaleLowerCase();return w==="*"||w===((_=n==null?void 0:n.event)===null||_===void 0?void 0:_.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===o}).map(f=>{if(typeof d=="object"&&"ids"in d){const m=d.data,{schema:y,table:v,commit_timestamp:p,type:g,errors:_}=m;d=Object.assign(Object.assign({},{schema:y,table:v,commit_timestamp:p,eventType:g,new:{},old:{},errors:_}),this._getPayloadRecords(m))}f.callback(d,i)})}_isClosed(){return this.state===Ue.closed}_isJoined(){return this.state===Ue.joined}_isJoining(){return this.state===Ue.joining}_isLeaving(){return this.state===Ue.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,n,i){const r=e.toLocaleLowerCase(),s={type:r,filter:n,callback:i};return this.bindings[r]?this.bindings[r].push(s):this.bindings[r]=[s],this}_off(e,n){const i=e.toLocaleLowerCase();return this.bindings[i]=this.bindings[i].filter(r=>{var s;return!(((s=r.type)===null||s===void 0?void 0:s.toLocaleLowerCase())===i&&mc.isEqual(r.filter,n))}),this}static isEqual(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const i in e)if(e[i]!==n[i])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(ht.close,{},e)}_onError(e){this._on(ht.error,{},n=>e(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Ue.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=Xh(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=Xh(e.columns,e.old_record)),n}}const q_=()=>{},Q_=typeof WebSocket<"u";class X_{constructor(e,n){var i;this.accessToken=null,this.apiKey=null,this.channels=[],this.endPoint="",this.headers=z_,this.params={},this.timeout=em,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=q_,this.conn=null,this.sendBuffer=[],this.serializer=new B_,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this._resolveFetch=s=>{let o;return s?o=s:typeof fetch>"u"?o=(...a)=>Mi(()=>Promise.resolve().then(()=>ss),void 0,import.meta.url).then(({default:l})=>l(...a)):o=fetch,(...a)=>o(...a)},this.endPoint=`${e}/${tu.websocket}`,n!=null&&n.transport?this.transport=n.transport:this.transport=null,n!=null&&n.params&&(this.params=n.params),n!=null&&n.headers&&(this.headers=Object.assign(Object.assign({},this.headers),n.headers)),n!=null&&n.timeout&&(this.timeout=n.timeout),n!=null&&n.logger&&(this.logger=n.logger),n!=null&&n.heartbeatIntervalMs&&(this.heartbeatIntervalMs=n.heartbeatIntervalMs);const r=(i=n==null?void 0:n.params)===null||i===void 0?void 0:i.apikey;r&&(this.accessToken=r,this.apiKey=r),this.reconnectAfterMs=n!=null&&n.reconnectAfterMs?n.reconnectAfterMs:s=>[1e3,2e3,5e3,1e4][s-1]||1e4,this.encode=n!=null&&n.encode?n.encode:(s,o)=>o(JSON.stringify(s)),this.decode=n!=null&&n.decode?n.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new tm(async()=>{this.disconnect(),this.connect()},this.reconnectAfterMs),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){if(!this.conn){if(this.transport){this.conn=new this.transport(this._endPointURL(),void 0,{headers:this.headers});return}if(Q_){this.conn=new WebSocket(this._endPointURL()),this.setupConnection();return}this.conn=new J_(this._endPointURL(),void 0,{close:()=>{this.conn=null}}),Mi(()=>import("./browser-BKlBOY-Q.js").then(e=>e.b),[],import.meta.url).then(({default:e})=>{this.conn=new e(this._endPointURL(),void 0,{headers:this.headers}),this.setupConnection()})}}disconnect(e,n){this.conn&&(this.conn.onclose=function(){},e?this.conn.close(e,n??""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}getChannels(){return this.channels}async removeChannel(e){const n=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const e=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.disconnect(),e}log(e,n,i){this.logger(e,n,i)}connectionState(){switch(this.conn&&this.conn.readyState){case bi.connecting:return Mn.Connecting;case bi.open:return Mn.Open;case bi.closing:return Mn.Closing;default:return Mn.Closed}}isConnected(){return this.connectionState()===Mn.Open}channel(e,n={config:{}}){const i=new mc(`realtime:${e}`,n,this);return this.channels.push(i),i}push(e){const{topic:n,event:i,payload:r,ref:s}=e,o=()=>{this.encode(e,a=>{var l;(l=this.conn)===null||l===void 0||l.send(a)})};this.log("push",`${n} ${i} (${s})`,r),this.isConnected()?o():this.sendBuffer.push(o)}setAuth(e){this.accessToken=e,this.channels.forEach(n=>{e&&n.updateJoinPayload({access_token:e}),n.joinedOnce&&n._isJoined()&&n._push(ht.access_token,{access_token:e})})}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let n=this.channels.find(i=>i.topic===e&&(i._isJoined()||i._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${e}"`),n.unsubscribe())}_remove(e){this.channels=this.channels.filter(n=>n._joinRef()!==e._joinRef())}setupConnection(){this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:$_}))}_onConnMessage(e){this.decode(e.data,n=>{let{topic:i,event:r,payload:s,ref:o}=n;(o&&o===this.pendingHeartbeatRef||r===(s==null?void 0:s.type))&&(this.pendingHeartbeatRef=null),this.log("receive",`${s.status||""} ${i} ${r} ${o&&"("+o+")"||""}`,s),this.channels.filter(a=>a._isMember(i)).forEach(a=>a._trigger(r,s,o)),this.stateChangeCallbacks.message.forEach(a=>a(n))})}_onConnOpen(){this.log("transport",`connected to ${this._endPointURL()}`),this._flushSendBuffer(),this.reconnectTimer.reset(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this._sendHeartbeat(),this.heartbeatIntervalMs),this.stateChangeCallbacks.open.forEach(e=>e())}_onConnClose(e){this.log("transport","close",e),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(n=>n(e))}_onConnError(e){this.log("transport",e.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach(n=>n(e))}_triggerChanError(){this.channels.forEach(e=>e._trigger(ht.error))}_appendParams(e,n){if(Object.keys(n).length===0)return e;const i=e.match(/\?/)?"&":"?",r=new URLSearchParams(n);return`${e}${i}${r}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_sendHeartbeat(){var e;if(this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),(e=this.conn)===null||e===void 0||e.close(U_,"hearbeat timeout");return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth(this.accessToken)}}}class J_{constructor(e,n,i){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=bi.connecting,this.send=()=>{},this.url=null,this.url=e,this.close=i.close}}class yc extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function Ce(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}class Z_ extends yc{constructor(e,n){super(e),this.name="StorageApiError",this.status=n}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class td extends yc{constructor(e,n){super(e),this.name="StorageUnknownError",this.originalError=n}}var ew=function(t,e,n,i){function r(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(i.next(c))}catch(h){o(h)}}function l(c){try{u(i.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):r(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};const im=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>Mi(()=>Promise.resolve().then(()=>ss),void 0,import.meta.url).then(({default:i})=>i(...n)):e=fetch,(...n)=>e(...n)},tw=()=>ew(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield Mi(()=>Promise.resolve().then(()=>ss),void 0,import.meta.url)).Response:Response});var Bi=function(t,e,n,i){function r(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(i.next(c))}catch(h){o(h)}}function l(c){try{u(i.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):r(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};const Ha=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),nw=(t,e)=>Bi(void 0,void 0,void 0,function*(){const n=yield tw();t instanceof n?t.json().then(i=>{e(new Z_(Ha(i),t.status||500))}).catch(i=>{e(new td(Ha(i),i))}):e(new td(Ha(t),t))}),iw=(t,e,n,i)=>{const r={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?r:(r.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),r.body=JSON.stringify(i),Object.assign(Object.assign({},r),n))};function ha(t,e,n,i,r,s){return Bi(this,void 0,void 0,function*(){return new Promise((o,a)=>{t(n,iw(e,i,r,s)).then(l=>{if(!l.ok)throw l;return i!=null&&i.noResolveJson?l:l.json()}).then(l=>o(l)).catch(l=>nw(l,a))})})}function iu(t,e,n,i){return Bi(this,void 0,void 0,function*(){return ha(t,"GET",e,n,i)})}function Yt(t,e,n,i,r){return Bi(this,void 0,void 0,function*(){return ha(t,"POST",e,i,r,n)})}function rw(t,e,n,i,r){return Bi(this,void 0,void 0,function*(){return ha(t,"PUT",e,i,r,n)})}function rm(t,e,n,i,r){return Bi(this,void 0,void 0,function*(){return ha(t,"DELETE",e,i,r,n)})}var Xe=function(t,e,n,i){function r(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(i.next(c))}catch(h){o(h)}}function l(c){try{u(i.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):r(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};const sw={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},nd={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class ow{constructor(e,n={},i,r){this.url=e,this.headers=n,this.bucketId=i,this.fetch=im(r)}uploadOrUpdate(e,n,i,r){return Xe(this,void 0,void 0,function*(){try{let s;const o=Object.assign(Object.assign({},nd),r),a=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(o.upsert)});typeof Blob<"u"&&i instanceof Blob?(s=new FormData,s.append("cacheControl",o.cacheControl),s.append("",i)):typeof FormData<"u"&&i instanceof FormData?(s=i,s.append("cacheControl",o.cacheControl)):(s=i,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType);const l=this._removeEmptyFolders(n),u=this._getFinalPath(l),c=yield this.fetch(`${this.url}/object/${u}`,Object.assign({method:e,body:s,headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{})),h=yield c.json();return c.ok?{data:{path:l,id:h.Id,fullPath:h.Key},error:null}:{data:null,error:h}}catch(s){if(Ce(s))return{data:null,error:s};throw s}})}upload(e,n,i){return Xe(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,n,i)})}uploadToSignedUrl(e,n,i,r){return Xe(this,void 0,void 0,function*(){const s=this._removeEmptyFolders(e),o=this._getFinalPath(s),a=new URL(this.url+`/object/upload/sign/${o}`);a.searchParams.set("token",n);try{let l;const u=Object.assign({upsert:nd.upsert},r),c=Object.assign(Object.assign({},this.headers),{"x-upsert":String(u.upsert)});typeof Blob<"u"&&i instanceof Blob?(l=new FormData,l.append("cacheControl",u.cacheControl),l.append("",i)):typeof FormData<"u"&&i instanceof FormData?(l=i,l.append("cacheControl",u.cacheControl)):(l=i,c["cache-control"]=`max-age=${u.cacheControl}`,c["content-type"]=u.contentType);const h=yield this.fetch(a.toString(),{method:"PUT",body:l,headers:c}),d=yield h.json();return h.ok?{data:{path:s,fullPath:d.Key},error:null}:{data:null,error:d}}catch(l){if(Ce(l))return{data:null,error:l};throw l}})}createSignedUploadUrl(e){return Xe(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e);const i=yield Yt(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:this.headers}),r=new URL(this.url+i.url),s=r.searchParams.get("token");if(!s)throw new yc("No token returned by API");return{data:{signedUrl:r.toString(),path:e,token:s},error:null}}catch(n){if(Ce(n))return{data:null,error:n};throw n}})}update(e,n,i){return Xe(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,n,i)})}move(e,n){return Xe(this,void 0,void 0,function*(){try{return{data:yield Yt(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:n},{headers:this.headers}),error:null}}catch(i){if(Ce(i))return{data:null,error:i};throw i}})}copy(e,n){return Xe(this,void 0,void 0,function*(){try{return{data:{path:(yield Yt(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:n},{headers:this.headers})).Key},error:null}}catch(i){if(Ce(i))return{data:null,error:i};throw i}})}createSignedUrl(e,n,i){return Xe(this,void 0,void 0,function*(){try{let r=this._getFinalPath(e),s=yield Yt(this.fetch,`${this.url}/object/sign/${r}`,Object.assign({expiresIn:n},i!=null&&i.transform?{transform:i.transform}:{}),{headers:this.headers});const o=i!=null&&i.download?`&download=${i.download===!0?"":i.download}`:"";return s={signedUrl:encodeURI(`${this.url}${s.signedURL}${o}`)},{data:s,error:null}}catch(r){if(Ce(r))return{data:null,error:r};throw r}})}createSignedUrls(e,n,i){return Xe(this,void 0,void 0,function*(){try{const r=yield Yt(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:n,paths:e},{headers:this.headers}),s=i!=null&&i.download?`&download=${i.download===!0?"":i.download}`:"";return{data:r.map(o=>Object.assign(Object.assign({},o),{signedUrl:o.signedURL?encodeURI(`${this.url}${o.signedURL}${s}`):null})),error:null}}catch(r){if(Ce(r))return{data:null,error:r};throw r}})}download(e,n){return Xe(this,void 0,void 0,function*(){const r=typeof(n==null?void 0:n.transform)<"u"?"render/image/authenticated":"object",s=this.transformOptsToQueryString((n==null?void 0:n.transform)||{}),o=s?`?${s}`:"";try{const a=this._getFinalPath(e);return{data:yield(yield iu(this.fetch,`${this.url}/${r}/${a}${o}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(a){if(Ce(a))return{data:null,error:a};throw a}})}getPublicUrl(e,n){const i=this._getFinalPath(e),r=[],s=n!=null&&n.download?`download=${n.download===!0?"":n.download}`:"";s!==""&&r.push(s);const a=typeof(n==null?void 0:n.transform)<"u"?"render/image":"object",l=this.transformOptsToQueryString((n==null?void 0:n.transform)||{});l!==""&&r.push(l);let u=r.join("&");return u!==""&&(u=`?${u}`),{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${i}${u}`)}}}remove(e){return Xe(this,void 0,void 0,function*(){try{return{data:yield rm(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(n){if(Ce(n))return{data:null,error:n};throw n}})}list(e,n,i){return Xe(this,void 0,void 0,function*(){try{const r=Object.assign(Object.assign(Object.assign({},sw),n),{prefix:e||""});return{data:yield Yt(this.fetch,`${this.url}/object/list/${this.bucketId}`,r,{headers:this.headers},i),error:null}}catch(r){if(Ce(r))return{data:null,error:r};throw r}})}_getFinalPath(e){return`${this.bucketId}/${e}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const n=[];return e.width&&n.push(`width=${e.width}`),e.height&&n.push(`height=${e.height}`),e.resize&&n.push(`resize=${e.resize}`),e.format&&n.push(`format=${e.format}`),e.quality&&n.push(`quality=${e.quality}`),n.join("&")}}const aw="2.5.5",lw={"X-Client-Info":`storage-js/${aw}`};var Jn=function(t,e,n,i){function r(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(i.next(c))}catch(h){o(h)}}function l(c){try{u(i.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):r(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};class uw{constructor(e,n={},i){this.url=e,this.headers=Object.assign(Object.assign({},lw),n),this.fetch=im(i)}listBuckets(){return Jn(this,void 0,void 0,function*(){try{return{data:yield iu(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(Ce(e))return{data:null,error:e};throw e}})}getBucket(e){return Jn(this,void 0,void 0,function*(){try{return{data:yield iu(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(n){if(Ce(n))return{data:null,error:n};throw n}})}createBucket(e,n={public:!1}){return Jn(this,void 0,void 0,function*(){try{return{data:yield Yt(this.fetch,`${this.url}/bucket`,{id:e,name:e,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if(Ce(i))return{data:null,error:i};throw i}})}updateBucket(e,n){return Jn(this,void 0,void 0,function*(){try{return{data:yield rw(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if(Ce(i))return{data:null,error:i};throw i}})}emptyBucket(e){return Jn(this,void 0,void 0,function*(){try{return{data:yield Yt(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(n){if(Ce(n))return{data:null,error:n};throw n}})}deleteBucket(e){return Jn(this,void 0,void 0,function*(){try{return{data:yield rm(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(n){if(Ce(n))return{data:null,error:n};throw n}})}}class cw extends uw{constructor(e,n={},i){super(e,n,i)}from(e){return new ow(this.url,this.headers,e,this.fetch)}}const hw="2.43.4";let ar="";typeof Deno<"u"?ar="deno":typeof document<"u"?ar="web":typeof navigator<"u"&&navigator.product==="ReactNative"?ar="react-native":ar="node";const dw={"X-Client-Info":`supabase-js-${ar}/${hw}`},fw={headers:dw},pw={schema:"public"},gw={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},mw={};var yw=function(t,e,n,i){function r(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(i.next(c))}catch(h){o(h)}}function l(c){try{u(i.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):r(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};const vw=t=>{let e;return t?e=t:typeof fetch>"u"?e=pc:e=fetch,(...n)=>e(...n)},_w=()=>typeof Headers>"u"?Zg:Headers,ww=(t,e,n)=>{const i=vw(n),r=_w();return(s,o)=>yw(void 0,void 0,void 0,function*(){var a;const l=(a=yield e())!==null&&a!==void 0?a:t;let u=new r(o==null?void 0:o.headers);return u.has("apikey")||u.set("apikey",t),u.has("Authorization")||u.set("Authorization",`Bearer ${l}`),i(s,Object.assign(Object.assign({},o),{headers:u}))})};function xw(t){return t.replace(/\/$/,"")}function kw(t,e){const{db:n,auth:i,realtime:r,global:s}=t,{db:o,auth:a,realtime:l,global:u}=e;return{db:Object.assign(Object.assign({},o),n),auth:Object.assign(Object.assign({},a),i),realtime:Object.assign(Object.assign({},l),r),global:Object.assign(Object.assign({},u),s)}}const sm="2.64.2",bw="http://localhost:9999",Sw="supabase.auth.token",Cw={"X-Client-Info":`gotrue-js/${sm}`},id=10,ru="X-Supabase-Api-Version",om={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}};function Ew(t){return Math.round(Date.now()/1e3)+t}function Pw(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}const lt=()=>typeof document<"u",wn={tested:!1,writable:!1},kr=()=>{if(!lt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(wn.tested)return wn.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),wn.tested=!0,wn.writable=!0}catch{wn.tested=!0,wn.writable=!1}return wn.writable};function Ka(t){const e={},n=new URL(t);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((r,s)=>{e[s]=r})}catch{}return n.searchParams.forEach((i,r)=>{e[r]=i}),e}const am=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>Mi(()=>Promise.resolve().then(()=>ss),void 0,import.meta.url).then(({default:i})=>i(...n)):e=fetch,(...n)=>e(...n)},Tw=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",lm=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},Es=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return n}},Ya=async(t,e)=>{await t.removeItem(e)};function Ow(t){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let n="",i,r,s,o,a,l,u,c=0;for(t=t.replace("-","+").replace("_","/");c>4,r=(a&15)<<4|l>>2,s=(l&3)<<6|u,n=n+String.fromCharCode(i),l!=64&&r!=0&&(n=n+String.fromCharCode(r)),u!=64&&s!=0&&(n=n+String.fromCharCode(s));return n}class da{constructor(){this.promise=new da.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}da.promiseConstructor=Promise;function rd(t){const e=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i,n=t.split(".");if(n.length!==3)throw new Error("JWT is not valid: not a JWT structure");if(!e.test(n[1]))throw new Error("JWT is not valid: payload is not in base64url format");const i=n[1];return JSON.parse(Ow(i))}async function Lw(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function Mw(t,e){return new Promise((i,r)=>{(async()=>{for(let s=0;s<1/0;s++)try{const o=await t(s);if(!e(s,null,o)){i(o);return}}catch(o){if(!e(s,o)){r(o);return}}})()})}function Rw(t){return("0"+t.toString(16)).substr(-2)}function Iw(){const e=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",i=n.length;let r="";for(let s=0;s<56;s++)r+=n.charAt(Math.floor(Math.random()*i));return r}return crypto.getRandomValues(e),Array.from(e,Rw).join("")}async function Aw(t){const n=new TextEncoder().encode(t),i=await crypto.subtle.digest("SHA-256",n),r=new Uint8Array(i);return Array.from(r).map(s=>String.fromCharCode(s)).join("")}function Dw(t){return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function jw(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const n=await Aw(t);return Dw(n)}async function Zn(t,e,n=!1){const i=Iw();let r=i;n&&(r+="/PASSWORD_RECOVERY"),await lm(t,`${e}-code-verifier`,r);const s=await jw(i);return[s,i===s?"plain":"s256"]}const Nw=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Fw(t){const e=t.headers.get(ru);if(!e||!e.match(Nw))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}class vc extends Error{constructor(e,n,i){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=i}}function j(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class zw extends vc{constructor(e,n,i){super(e,n,i),this.name="AuthApiError",this.status=n,this.code=i}}function $w(t){return j(t)&&t.name==="AuthApiError"}class um extends vc{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class qn extends vc{constructor(e,n,i,r){super(e,i,r),this.name=n,this.status=i}}class xn extends qn{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}class Ga extends qn{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Ps extends qn{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Ts extends qn{constructor(e,n=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class sd extends qn{constructor(e,n=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class su extends qn{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function qa(t){return j(t)&&t.name==="AuthRetryableFetchError"}class od extends qn{constructor(e,n,i){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=i}}var Uw=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(t);rt.msg||t.message||t.error_description||t.error||JSON.stringify(t),Bw=[502,503,504];async function ad(t){var e;if(!Tw(t))throw new su(Tn(t),0);if(Bw.includes(t.status))throw new su(Tn(t),t.status);let n;try{n=await t.json()}catch(s){throw new um(Tn(s),s)}let i;const r=Fw(t);if(r&&r.getTime()>=om["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?i=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(i=n.error_code),i){if(i==="weak_password")throw new od(Tn(n),t.status,((e=n.weak_password)===null||e===void 0?void 0:e.reasons)||[])}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((s,o)=>s&&typeof o=="string",!0))throw new od(Tn(n),t.status,n.weak_password.reasons);throw new zw(Tn(n),t.status||500,i)}const Vw=(t,e,n,i)=>{const r={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?r:(r.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),r.body=JSON.stringify(i),Object.assign(Object.assign({},r),n))};async function F(t,e,n,i){var r;const s=Object.assign({},i==null?void 0:i.headers);s[ru]||(s[ru]=om["2024-01-01"].name),i!=null&&i.jwt&&(s.Authorization=`Bearer ${i.jwt}`);const o=(r=i==null?void 0:i.query)!==null&&r!==void 0?r:{};i!=null&&i.redirectTo&&(o.redirect_to=i.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await Ww(t,e,n+a,{headers:s,noResolveJson:i==null?void 0:i.noResolveJson},{},i==null?void 0:i.body);return i!=null&&i.xform?i==null?void 0:i.xform(l):{data:Object.assign({},l),error:null}}async function Ww(t,e,n,i,r,s){const o=Vw(e,i,r,s);let a;try{a=await t(n,Object.assign({},o))}catch(l){throw console.error(l),new su(Tn(l),0)}if(a.ok||await ad(a),i!=null&&i.noResolveJson)return a;try{return await a.json()}catch(l){await ad(l)}}function Wt(t){var e;let n=null;Gw(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=Ew(t.expires_in)));const i=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:i},error:null}}function ld(t){const e=Wt(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((n,i)=>n&&typeof i=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Qt(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function Hw(t){return{data:t,error:null}}function Kw(t){const{action_link:e,email_otp:n,hashed_token:i,redirect_to:r,verification_type:s}=t,o=Uw(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:n,hashed_token:i,redirect_to:r,verification_type:s},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function Yw(t){return t}function Gw(t){return t.access_token&&t.refresh_token&&t.expires_in}var qw=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(t);r0&&(f.forEach(m=>{const y=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(m.split(";")[1].split("=")[1]);u[`${v}Page`]=y}),u.total=parseInt(d)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(j(u))return{data:{users:[]},error:u};throw u}}async getUserById(e){try{return await F(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Qt})}catch(n){if(j(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){try{return await F(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:Qt})}catch(i){if(j(i))return{data:{user:null},error:i};throw i}}async deleteUser(e,n=!1){try{return await F(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:Qt})}catch(i){if(j(i))return{data:{user:null},error:i};throw i}}async _listFactors(e){try{const{data:n,error:i}=await F(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:r=>({data:{factors:r},error:null})});return{data:n,error:i}}catch(n){if(j(n))return{data:null,error:n};throw n}}async _deleteFactor(e){try{return{data:await F(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(j(n))return{data:null,error:n};throw n}}}const Xw={getItem:t=>kr()?globalThis.localStorage.getItem(t):null,setItem:(t,e)=>{kr()&&globalThis.localStorage.setItem(t,e)},removeItem:t=>{kr()&&globalThis.localStorage.removeItem(t)}};function ud(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}function Jw(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}const ei={debug:!!(globalThis&&kr()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class cm extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class Zw extends cm{}async function ex(t,e,n){ei.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const i=new globalThis.AbortController;return e>0&&setTimeout(()=>{i.abort(),ei.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:i.signal},async r=>{if(r){ei.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,r.name);try{return await n()}finally{ei.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,r.name)}}else{if(e===0)throw ei.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new Zw(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(ei.debug)try{const s=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(s,null," "))}catch(s){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",s)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await n()}})}Jw();const tx={url:bw,storageKey:Sw,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Cw,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1},Xi=30*1e3,cd=3;async function hd(t,e,n){return await n()}class Gr{constructor(e){var n,i;this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=Gr.nextInstanceID,Gr.nextInstanceID+=1,this.instanceID>0&<()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const r=Object.assign(Object.assign({},tx),e);if(this.logDebugMessages=!!r.debug,typeof r.debug=="function"&&(this.logger=r.debug),this.persistSession=r.persistSession,this.storageKey=r.storageKey,this.autoRefreshToken=r.autoRefreshToken,this.admin=new Qw({url:r.url,headers:r.headers,fetch:r.fetch}),this.url=r.url,this.headers=r.headers,this.fetch=am(r.fetch),this.lock=r.lock||hd,this.detectSessionInUrl=r.detectSessionInUrl,this.flowType=r.flowType,this.hasCustomAuthorizationHeader=r.hasCustomAuthorizationHeader,r.lock?this.lock=r.lock:lt()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=ex:this.lock=hd,this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?r.storage?this.storage=r.storage:kr()?this.storage=Xw:(this.memoryStorage={},this.storage=ud(this.memoryStorage)):(this.memoryStorage={},this.storage=ud(this.memoryStorage)),lt()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(s){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",s)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async s=>{this._debug("received broadcast notification from other tab or client",s),await this._notifyAllSubscribers(s.data.event,s.data.session,!1)})}this.initialize()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${sm}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){try{const e=lt()?await this._isPKCEFlow():!1;if(this._debug("#_initialize()","begin","is PKCE flow",e),e||this.detectSessionInUrl&&this._isImplicitGrantFlow()){const{data:n,error:i}=await this._getSessionFromURL(e);if(i)return this._debug("#_initialize()","error detecting session from URL",i),(i==null?void 0:i.message)==="Identity is already linked"||(i==null?void 0:i.message)==="Identity is already linked to another user"?{error:i}:(await this._removeSession(),{error:i});const{session:r,redirectType:s}=n;return this._debug("#_initialize()","detected session in URL",r,"redirect type",s),await this._saveSession(r),setTimeout(async()=>{s==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",r):await this._notifyAllSubscribers("SIGNED_IN",r)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){return j(e)?{error:e}:{error:new um("Unexpected error during initialization",e)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var n,i,r;try{await this._removeSession();const s=await F(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(i=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.data)!==null&&i!==void 0?i:{},gotrue_meta_security:{captcha_token:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}},xform:Wt}),{data:o,error:a}=s;if(a||!o)return{data:{user:null,session:null},error:a};const l=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),{data:{user:u,session:l},error:null}}catch(s){if(j(s))return{data:{user:null,session:null},error:s};throw s}}async signUp(e){var n,i,r;try{await this._removeSession();let s;if("email"in e){const{email:c,password:h,options:d}=e;let f=null,m=null;this.flowType==="pkce"&&([f,m]=await Zn(this.storage,this.storageKey)),s=await F(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d==null?void 0:d.emailRedirectTo,body:{email:c,password:h,data:(n=d==null?void 0:d.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken},code_challenge:f,code_challenge_method:m},xform:Wt})}else if("phone"in e){const{phone:c,password:h,options:d}=e;s=await F(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:c,password:h,data:(i=d==null?void 0:d.data)!==null&&i!==void 0?i:{},channel:(r=d==null?void 0:d.channel)!==null&&r!==void 0?r:"sms",gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:Wt})}else throw new Ps("You must provide either an email or phone number and a password");const{data:o,error:a}=s;if(a||!o)return{data:{user:null,session:null},error:a};const l=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),{data:{user:u,session:l},error:null}}catch(s){if(j(s))return{data:{user:null,session:null},error:s};throw s}}async signInWithPassword(e){try{await this._removeSession();let n;if("email"in e){const{email:s,password:o,options:a}=e;n=await F(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:ld})}else if("phone"in e){const{phone:s,password:o,options:a}=e;n=await F(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:ld})}else throw new Ps("You must provide either an email or phone number and a password");const{data:i,error:r}=n;return r?{data:{user:null,session:null},error:r}:!i||!i.session||!i.user?{data:{user:null,session:null},error:new Ga}:(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign({user:i.user,session:i.session},i.weak_password?{weakPassword:i.weak_password}:null),error:r})}catch(n){if(j(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOAuth(e){var n,i,r,s;return await this._removeSession(),await this._handleProviderSignIn(e.provider,{redirectTo:(n=e.options)===null||n===void 0?void 0:n.redirectTo,scopes:(i=e.options)===null||i===void 0?void 0:i.scopes,queryParams:(r=e.options)===null||r===void 0?void 0:r.queryParams,skipBrowserRedirect:(s=e.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async _exchangeCodeForSession(e){const n=await Es(this.storage,`${this.storageKey}-code-verifier`),[i,r]=(n??"").split("/"),{data:s,error:o}=await F(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:i},xform:Wt});return await Ya(this.storage,`${this.storageKey}-code-verifier`),o?{data:{user:null,session:null,redirectType:null},error:o}:!s||!s.session||!s.user?{data:{user:null,session:null,redirectType:null},error:new Ga}:(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:Object.assign(Object.assign({},s),{redirectType:r??null}),error:o})}async signInWithIdToken(e){await this._removeSession();try{const{options:n,provider:i,token:r,access_token:s,nonce:o}=e,a=await F(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:i,id_token:r,access_token:s,nonce:o,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:Wt}),{data:l,error:u}=a;return u?{data:{user:null,session:null},error:u}:!l||!l.session||!l.user?{data:{user:null,session:null},error:new Ga}:(l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),{data:l,error:u})}catch(n){if(j(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOtp(e){var n,i,r,s,o;try{if(await this._removeSession(),"email"in e){const{email:a,options:l}=e;let u=null,c=null;this.flowType==="pkce"&&([u,c]=await Zn(this.storage,this.storageKey));const{error:h}=await F(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(n=l==null?void 0:l.data)!==null&&n!==void 0?n:{},create_user:(i=l==null?void 0:l.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:u,code_challenge_method:c},redirectTo:l==null?void 0:l.emailRedirectTo});return{data:{user:null,session:null},error:h}}if("phone"in e){const{phone:a,options:l}=e,{data:u,error:c}=await F(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(r=l==null?void 0:l.data)!==null&&r!==void 0?r:{},create_user:(s=l==null?void 0:l.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(o=l==null?void 0:l.channel)!==null&&o!==void 0?o:"sms"}});return{data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:c}}throw new Ps("You must provide either an email or phone number.")}catch(a){if(j(a))return{data:{user:null,session:null},error:a};throw a}}async verifyOtp(e){var n,i;try{e.type!=="email_change"&&e.type!=="phone_change"&&await this._removeSession();let r,s;"options"in e&&(r=(n=e.options)===null||n===void 0?void 0:n.redirectTo,s=(i=e.options)===null||i===void 0?void 0:i.captchaToken);const{data:o,error:a}=await F(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:r,xform:Wt});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,u=o.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),{data:{user:u,session:l},error:null}}catch(r){if(j(r))return{data:{user:null,session:null},error:r};throw r}}async signInWithSSO(e){var n,i,r;try{await this._removeSession();let s=null,o=null;return this.flowType==="pkce"&&([s,o]=await Zn(this.storage,this.storageKey)),await F(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(i=(n=e.options)===null||n===void 0?void 0:n.redirectTo)!==null&&i!==void 0?i:void 0}),!((r=e==null?void 0:e.options)===null||r===void 0)&&r.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:s,code_challenge_method:o}),headers:this.headers,xform:Hw})}catch(s){if(j(s))return{data:null,error:s};throw s}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:n},error:i}=e;if(i)throw i;if(!n)throw new xn;const{error:r}=await F(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return{data:{user:null,session:null},error:r}})}catch(e){if(j(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{e.type!="email_change"&&e.type!="phone_change"&&await this._removeSession();const n=`${this.url}/resend`;if("email"in e){const{email:i,type:r,options:s}=e,{error:o}=await F(this.fetch,"POST",n,{headers:this.headers,body:{email:i,type:r,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},redirectTo:s==null?void 0:s.emailRedirectTo});return{data:{user:null,session:null},error:o}}else if("phone"in e){const{phone:i,type:r,options:s}=e,{data:o,error:a}=await F(this.fetch,"POST",n,{headers:this.headers,body:{phone:i,type:r,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}}});return{data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:a}}throw new Ps("You must provide either an email or phone number and a type")}catch(n){if(j(n))return{data:{user:null,session:null},error:n};throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async n=>n))}async _acquireLock(e,n){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const i=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await i,await n()))();return this.pendingInLock.push((async()=>{try{await r}catch{}})()),r}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const i=n();for(this.pendingInLock.push((async()=>{try{await i}catch{}})()),await i;this.pendingInLock.length;){const r=[...this.pendingInLock];await Promise.all(r),this.pendingInLock.splice(0,r.length)}return await i}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await e(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const n=await Es(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?e=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const i=e.expires_at?e.expires_at<=Date.now()/1e3:!1;if(this._debug("#__loadSession()",`session has${i?"":" not"} expired`,"expires_at",e.expires_at),!i){if(this.storage.isServer){const o=this.suppressGetSessionWarning;e=new Proxy(e,{get(l,u,c){return!o&&u==="user"&&console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and many not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),Reflect.get(l,u,c)}})}return{data:{session:e},error:null}}const{session:r,error:s}=await this._callRefreshToken(e.refresh_token);return s?{data:{session:null},error:s}:{data:{session:r},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await F(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Qt}):await this._useSession(async n=>{var i,r,s;const{data:o,error:a}=n;if(a)throw a;return!(!((i=o.session)===null||i===void 0)&&i.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new xn}:await F(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(r=o.session)===null||r===void 0?void 0:r.access_token)!==null&&s!==void 0?s:void 0,xform:Qt})})}catch(n){if(j(n))return{data:{user:null},error:n};throw n}}async updateUser(e,n={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,n))}async _updateUser(e,n={}){try{return await this._useSession(async i=>{const{data:r,error:s}=i;if(s)throw s;if(!r.session)throw new xn;const o=r.session;let a=null,l=null;this.flowType==="pkce"&&e.email!=null&&([a,l]=await Zn(this.storage,this.storageKey));const{data:u,error:c}=await F(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:l}),jwt:o.access_token,xform:Qt});if(c)throw c;return o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),{data:{user:o.user},error:null}})}catch(i){if(j(i))return{data:{user:null},error:i};throw i}}_decodeJWT(e){return rd(e)}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new xn;const n=Date.now()/1e3;let i=n,r=!0,s=null;const o=rd(e.access_token);if(o.exp&&(i=o.exp,r=i<=n),r){const{session:a,error:l}=await this._callRefreshToken(e.refresh_token);if(l)return{data:{user:null,session:null},error:l};if(!a)return{data:{user:null,session:null},error:null};s=a}else{const{data:a,error:l}=await this._getUser(e.access_token);if(l)throw l;s={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:i-n,expires_at:i},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return{data:{user:s.user,session:s},error:null}}catch(n){if(j(n))return{data:{session:null,user:null},error:n};throw n}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async n=>{var i;if(!e){const{data:o,error:a}=n;if(a)throw a;e=(i=o.session)!==null&&i!==void 0?i:void 0}if(!(e!=null&&e.refresh_token))throw new xn;const{session:r,error:s}=await this._callRefreshToken(e.refresh_token);return s?{data:{user:null,session:null},error:s}:r?{data:{user:r.user,session:r},error:null}:{data:{user:null,session:null},error:null}})}catch(n){if(j(n))return{data:{user:null,session:null},error:n};throw n}}async _getSessionFromURL(e){try{if(!lt())throw new Ts("No browser detected.");if(this.flowType==="implicit"&&!this._isImplicitGrantFlow())throw new Ts("Not a valid implicit grant flow url.");if(this.flowType=="pkce"&&!e)throw new sd("Not a valid PKCE flow url.");const n=Ka(window.location.href);if(e){if(!n.code)throw new sd("No code detected.");const{data:g,error:_}=await this._exchangeCodeForSession(n.code);if(_)throw _;const w=new URL(window.location.href);return w.searchParams.delete("code"),window.history.replaceState(window.history.state,"",w.toString()),{data:{session:g.session,redirectType:null},error:null}}if(n.error||n.error_description||n.error_code)throw new Ts(n.error_description||"Error in URL with unspecified error_description",{error:n.error||"unspecified_error",code:n.error_code||"unspecified_code"});const{provider_token:i,provider_refresh_token:r,access_token:s,refresh_token:o,expires_in:a,expires_at:l,token_type:u}=n;if(!s||!a||!o||!u)throw new Ts("No session defined in URL");const c=Math.round(Date.now()/1e3),h=parseInt(a);let d=c+h;l&&(d=parseInt(l));const f=d-c;f*1e3<=Xi&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${h}s`);const m=d-h;c-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,d,c):c-m<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clok for skew",m,d,c);const{data:y,error:v}=await this._getUser(s);if(v)throw v;const p={provider_token:i,provider_refresh_token:r,access_token:s,expires_in:h,expires_at:d,refresh_token:o,token_type:u,user:y.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:p,redirectType:n.type},error:null}}catch(n){if(j(n))return{data:{session:null,redirectType:null},error:n};throw n}}_isImplicitGrantFlow(){const e=Ka(window.location.href);return!!(lt()&&(e.access_token||e.error_description))}async _isPKCEFlow(){const e=Ka(window.location.href),n=await Es(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&n)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async n=>{var i;const{data:r,error:s}=n;if(s)return{error:s};const o=(i=r.session)===null||i===void 0?void 0:i.access_token;if(o){const{error:a}=await this.admin.signOut(o,e);if(a&&!($w(a)&&(a.status===404||a.status===401||a.status===403)))return{error:a}}return e!=="others"&&(await this._removeSession(),await Ya(this.storage,`${this.storageKey}-code-verifier`),await this._notifyAllSubscribers("SIGNED_OUT",null)),{error:null}})}onAuthStateChange(e){const n=Pw(),i={id:n,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,i),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:i}}}async _emitInitialSession(e){return await this._useSession(async n=>{var i,r;try{const{data:{session:s},error:o}=n;if(o)throw o;await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",e,"session",s)}catch(s){await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",s),console.error(s)}})}async resetPasswordForEmail(e,n={}){let i=null,r=null;this.flowType==="pkce"&&([i,r]=await Zn(this.storage,this.storageKey,!0));try{return await F(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:i,code_challenge_method:r,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(s){if(j(s))return{data:null,error:s};throw s}}async getUserIdentities(){var e;try{const{data:n,error:i}=await this.getUser();if(i)throw i;return{data:{identities:(e=n.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(n){if(j(n))return{data:null,error:n};throw n}}async linkIdentity(e){var n;try{const{data:i,error:r}=await this._useSession(async s=>{var o,a,l,u,c;const{data:h,error:d}=s;if(d)throw d;const f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await F(this.fetch,"GET",f,{headers:this.headers,jwt:(c=(u=h.session)===null||u===void 0?void 0:u.access_token)!==null&&c!==void 0?c:void 0})});if(r)throw r;return lt()&&!(!((n=e.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(i==null?void 0:i.url),{data:{provider:e.provider,url:i==null?void 0:i.url},error:null}}catch(i){if(j(i))return{data:{provider:e.provider,url:null},error:i};throw i}}async unlinkIdentity(e){try{return await this._useSession(async n=>{var i,r;const{data:s,error:o}=n;if(o)throw o;return await F(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(r=(i=s.session)===null||i===void 0?void 0:i.access_token)!==null&&r!==void 0?r:void 0})})}catch(n){if(j(n))return{data:null,error:n};throw n}}async _refreshAccessToken(e){const n=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{const i=Date.now();return await Mw(async r=>(r>0&&await Lw(200*Math.pow(2,r-1)),this._debug(n,"refreshing attempt",r),await F(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Wt})),(r,s)=>{const o=200*Math.pow(2,r);return s&&qa(s)&&Date.now()+o-i{try{await a.callback(e,n)}catch(l){s.push(l)}});if(await Promise.all(o),s.length>0){for(let a=0;athis._autoRefreshTokenTick(),Xi);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async n=>{const{data:{session:i}}=n;if(!i||!i.refresh_token||!i.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const r=Math.floor((i.expires_at*1e3-e)/Xi);this._debug("#_autoRefreshTokenTick()",`access token expires in ${r} ticks, a tick lasts ${Xi}ms, refresh threshold is ${cd} ticks`),r<=cd&&await this._callRefreshToken(i.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof cm)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!lt()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const n=`#_onVisibilityChanged(${e})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,n,i){const r=[`provider=${encodeURIComponent(n)}`];if(i!=null&&i.redirectTo&&r.push(`redirect_to=${encodeURIComponent(i.redirectTo)}`),i!=null&&i.scopes&&r.push(`scopes=${encodeURIComponent(i.scopes)}`),this.flowType==="pkce"){const[s,o]=await Zn(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(o)}`});r.push(a.toString())}if(i!=null&&i.queryParams){const s=new URLSearchParams(i.queryParams);r.push(s.toString())}return i!=null&&i.skipBrowserRedirect&&r.push(`skip_http_redirect=${i.skipBrowserRedirect}`),`${e}?${r.join("&")}`}async _unenroll(e){try{return await this._useSession(async n=>{var i;const{data:r,error:s}=n;return s?{data:null,error:s}:await F(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(i=r==null?void 0:r.session)===null||i===void 0?void 0:i.access_token})})}catch(n){if(j(n))return{data:null,error:n};throw n}}async _enroll(e){try{return await this._useSession(async n=>{var i,r;const{data:s,error:o}=n;if(o)return{data:null,error:o};const{data:a,error:l}=await F(this.fetch,"POST",`${this.url}/factors`,{body:{friendly_name:e.friendlyName,factor_type:e.factorType,issuer:e.issuer},headers:this.headers,jwt:(i=s==null?void 0:s.session)===null||i===void 0?void 0:i.access_token});return l?{data:null,error:l}:(!((r=a==null?void 0:a.totp)===null||r===void 0)&&r.qr_code&&(a.totp.qr_code=`data:image/svg+xml;utf-8,${a.totp.qr_code}`),{data:a,error:null})})}catch(n){if(j(n))return{data:null,error:n};throw n}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var i;const{data:r,error:s}=n;if(s)return{data:null,error:s};const{data:o,error:a}=await F(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:(i=r==null?void 0:r.session)===null||i===void 0?void 0:i.access_token});return a?{data:null,error:a}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),{data:o,error:a})})}catch(n){if(j(n))return{data:null,error:n};throw n}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var i;const{data:r,error:s}=n;return s?{data:null,error:s}:await F(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{headers:this.headers,jwt:(i=r==null?void 0:r.session)===null||i===void 0?void 0:i.access_token})})}catch(n){if(j(n))return{data:null,error:n};throw n}})}async _challengeAndVerify(e){const{data:n,error:i}=await this._challenge({factorId:e.factorId});return i?{data:null,error:i}:await this._verify({factorId:e.factorId,challengeId:n.id,code:e.code})}async _listFactors(){const{data:{user:e},error:n}=await this.getUser();if(n)return{data:null,error:n};const i=(e==null?void 0:e.factors)||[],r=i.filter(s=>s.factor_type==="totp"&&s.status==="verified");return{data:{all:i,totp:r},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var n,i;const{data:{session:r},error:s}=e;if(s)return{data:null,error:s};if(!r)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const o=this._decodeJWT(r.access_token);let a=null;o.aal&&(a=o.aal);let l=a;((i=(n=r.user.factors)===null||n===void 0?void 0:n.filter(h=>h.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(l="aal2");const c=o.amr||[];return{data:{currentLevel:a,nextLevel:l,currentAuthenticationMethods:c},error:null}}))}}Gr.nextInstanceID=0;const nx=Gr;class ix extends nx{constructor(e){super(e)}}var rx=function(t,e,n,i){function r(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(i.next(c))}catch(h){o(h)}}function l(c){try{u(i.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):r(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};class sx{constructor(e,n,i){var r,s,o;if(this.supabaseUrl=e,this.supabaseKey=n,!e)throw new Error("supabaseUrl is required.");if(!n)throw new Error("supabaseKey is required.");const a=xw(e);this.realtimeUrl=`${a}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${a}/auth/v1`,this.storageUrl=`${a}/storage/v1`,this.functionsUrl=`${a}/functions/v1`;const l=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,u={db:pw,realtime:mw,auth:Object.assign(Object.assign({},gw),{storageKey:l}),global:fw},c=kw(i??{},u);this.storageKey=(r=c.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(s=c.global.headers)!==null&&s!==void 0?s:{},this.auth=this._initSupabaseAuthClient((o=c.auth)!==null&&o!==void 0?o:{},this.headers,c.global.fetch),this.fetch=ww(n,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},c.realtime)),this.rest=new gc(`${a}/rest/v1`,{headers:this.headers,schema:c.db.schema,fetch:this.fetch}),this._listenForAuthEvents()}get functions(){return new P_(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new cw(this.storageUrl,this.headers,this.fetch)}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,n={},i={}){return this.rest.rpc(e,n,i)}channel(e,n={config:{}}){return this.realtime.channel(e,n)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,n;return rx(this,void 0,void 0,function*(){const{data:i}=yield this.auth.getSession();return(n=(e=i.session)===null||e===void 0?void 0:e.access_token)!==null&&n!==void 0?n:null})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:n,detectSessionInUrl:i,storage:r,storageKey:s,flowType:o,debug:a},l,u){var c;const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new ix({url:this.authUrl,headers:Object.assign(Object.assign({},h),l),storageKey:s,autoRefreshToken:e,persistSession:n,detectSessionInUrl:i,storage:r,flowType:o,debug:a,fetch:u,hasCustomAuthorizationHeader:(c="Authorization"in this.headers)!==null&&c!==void 0?c:!1})}_initRealtimeClient(e){return new X_(this.realtimeUrl,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,i)=>{this._handleTokenChanged(n,"CLIENT",i==null?void 0:i.access_token)})}_handleTokenChanged(e,n,i){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==i?(this.realtime.setAuth(i??null),this.changedAccessToken=i):e==="SIGNED_OUT"&&(this.realtime.setAuth(this.supabaseKey),n=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const ox=(t,e,n)=>new sx(t,e,n);function ti(t){return P.jsxs("div",{role:"button",className:"flex items-center w-full p-3 leading-tight transition-all rounded-lg outline-none text-start hover:bg-blue-500",children:[P.jsx("div",{className:"grid mr-4 place-items-center",children:P.jsx("i",{className:t.icon})}),P.jsx("a",{href:t.href,children:t.name})]})}function hm(){return P.jsxs("div",{className:"relative flex h-full w-full max-w-[20rem] flex-col rounded-xl bg-white bg-clip-border p-4 text-gray-700 shadow-xl shadow-blue-gray-900/5",children:[P.jsx("div",{className:"p-4 mb-2",children:P.jsx("h5",{className:"block font-sans text-xl antialiased font-semibold leading-snug tracking-normal text-blue-gray-900",children:P.jsx("a",{href:"/",children:"fs-tracer"})})}),P.jsxs("nav",{className:"flex min-w-[240px] flex-col gap-1 p-2 font-sans text-base font-normal text-blue-gray-700",children:[P.jsx(ti,{name:"Home",icon:"fa-solid fa-house",href:"/"}),P.jsx(ti,{name:"Recent files",icon:"fa-solid fa-folder",href:"/recent"}),P.jsx(ti,{name:"Search",icon:"fa-solid fa-magnifying-glass",href:"/search"}),P.jsx(ti,{name:"Monitoring",icon:"fa-solid fa-chart-column",href:"/monitoring"}),P.jsx(ti,{name:"Setup",icon:"fa-solid fa-gear",href:"/setup"}),P.jsx(ti,{name:"Logout",icon:"fa-solid fa-right-from-bracket",href:"/logout"})]})]})}/*! - * @kurkle/color v0.3.2 - * https://github.com/kurkle/color#readme - * (c) 2023 Jukka Kurkela - * Released under the MIT License - */function os(t){return t+.5|0}const en=(t,e,n)=>Math.max(Math.min(t,n),e);function lr(t){return en(os(t*2.55),0,255)}function dn(t){return en(os(t*255),0,255)}function Rt(t){return en(os(t/2.55)/100,0,1)}function dd(t){return en(os(t*100),0,100)}const Je={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},ou=[..."0123456789ABCDEF"],ax=t=>ou[t&15],lx=t=>ou[(t&240)>>4]+ou[t&15],Os=t=>(t&240)>>4===(t&15),ux=t=>Os(t.r)&&Os(t.g)&&Os(t.b)&&Os(t.a);function cx(t){var e=t.length,n;return t[0]==="#"&&(e===4||e===5?n={r:255&Je[t[1]]*17,g:255&Je[t[2]]*17,b:255&Je[t[3]]*17,a:e===5?Je[t[4]]*17:255}:(e===7||e===9)&&(n={r:Je[t[1]]<<4|Je[t[2]],g:Je[t[3]]<<4|Je[t[4]],b:Je[t[5]]<<4|Je[t[6]],a:e===9?Je[t[7]]<<4|Je[t[8]]:255})),n}const hx=(t,e)=>t<255?e(t):"";function dx(t){var e=ux(t)?ax:lx;return t?"#"+e(t.r)+e(t.g)+e(t.b)+hx(t.a,e):void 0}const fx=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function dm(t,e,n){const i=e*Math.min(n,1-n),r=(s,o=(s+t/30)%12)=>n-i*Math.max(Math.min(o-3,9-o,1),-1);return[r(0),r(8),r(4)]}function px(t,e,n){const i=(r,s=(r+t/60)%6)=>n-n*e*Math.max(Math.min(s,4-s,1),0);return[i(5),i(3),i(1)]}function gx(t,e,n){const i=dm(t,1,.5);let r;for(e+n>1&&(r=1/(e+n),e*=r,n*=r),r=0;r<3;r++)i[r]*=1-e-n,i[r]+=e;return i}function mx(t,e,n,i,r){return t===r?(e-n)/i+(e.5?c/(2-s-o):c/(s+o),l=mx(n,i,r,c,s),l=l*60+.5),[l|0,u||0,a]}function wc(t,e,n,i){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,n,i)).map(dn)}function xc(t,e,n){return wc(dm,t,e,n)}function yx(t,e,n){return wc(gx,t,e,n)}function vx(t,e,n){return wc(px,t,e,n)}function fm(t){return(t%360+360)%360}function _x(t){const e=fx.exec(t);let n=255,i;if(!e)return;e[5]!==i&&(n=e[6]?lr(+e[5]):dn(+e[5]));const r=fm(+e[2]),s=+e[3]/100,o=+e[4]/100;return e[1]==="hwb"?i=yx(r,s,o):e[1]==="hsv"?i=vx(r,s,o):i=xc(r,s,o),{r:i[0],g:i[1],b:i[2],a:n}}function wx(t,e){var n=_c(t);n[0]=fm(n[0]+e),n=xc(n),t.r=n[0],t.g=n[1],t.b=n[2]}function xx(t){if(!t)return;const e=_c(t),n=e[0],i=dd(e[1]),r=dd(e[2]);return t.a<255?`hsla(${n}, ${i}%, ${r}%, ${Rt(t.a)})`:`hsl(${n}, ${i}%, ${r}%)`}const fd={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"},pd={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 kx(){const t={},e=Object.keys(pd),n=Object.keys(fd);let i,r,s,o,a;for(i=0;i>16&255,s>>8&255,s&255]}return t}let Ls;function bx(t){Ls||(Ls=kx(),Ls.transparent=[0,0,0,0]);const e=Ls[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}const Sx=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Cx(t){const e=Sx.exec(t);let n=255,i,r,s;if(e){if(e[7]!==i){const o=+e[7];n=e[8]?lr(o):en(o*255,0,255)}return i=+e[1],r=+e[3],s=+e[5],i=255&(e[2]?lr(i):en(i,0,255)),r=255&(e[4]?lr(r):en(r,0,255)),s=255&(e[6]?lr(s):en(s,0,255)),{r:i,g:r,b:s,a:n}}}function Ex(t){return t&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${Rt(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`)}const Qa=t=>t<=.0031308?t*12.92:Math.pow(t,1/2.4)*1.055-.055,ni=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function Px(t,e,n){const i=ni(Rt(t.r)),r=ni(Rt(t.g)),s=ni(Rt(t.b));return{r:dn(Qa(i+n*(ni(Rt(e.r))-i))),g:dn(Qa(r+n*(ni(Rt(e.g))-r))),b:dn(Qa(s+n*(ni(Rt(e.b))-s))),a:t.a+n*(e.a-t.a)}}function Ms(t,e,n){if(t){let i=_c(t);i[e]=Math.max(0,Math.min(i[e]+i[e]*n,e===0?360:1)),i=xc(i),t.r=i[0],t.g=i[1],t.b=i[2]}}function pm(t,e){return t&&Object.assign(e||{},t)}function gd(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=dn(t[3]))):(e=pm(t,{r:0,g:0,b:0,a:1}),e.a=dn(e.a)),e}function Tx(t){return t.charAt(0)==="r"?Cx(t):_x(t)}class qr{constructor(e){if(e instanceof qr)return e;const n=typeof e;let i;n==="object"?i=gd(e):n==="string"&&(i=cx(e)||bx(e)||Tx(e)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var e=pm(this._rgb);return e&&(e.a=Rt(e.a)),e}set rgb(e){this._rgb=gd(e)}rgbString(){return this._valid?Ex(this._rgb):void 0}hexString(){return this._valid?dx(this._rgb):void 0}hslString(){return this._valid?xx(this._rgb):void 0}mix(e,n){if(e){const i=this.rgb,r=e.rgb;let s;const o=n===s?.5:n,a=2*o-1,l=i.a-r.a,u=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;s=1-u,i.r=255&u*i.r+s*r.r+.5,i.g=255&u*i.g+s*r.g+.5,i.b=255&u*i.b+s*r.b+.5,i.a=o*i.a+(1-o)*r.a,this.rgb=i}return this}interpolate(e,n){return e&&(this._rgb=Px(this._rgb,e._rgb,n)),this}clone(){return new qr(this.rgb)}alpha(e){return this._rgb.a=dn(e),this}clearer(e){const n=this._rgb;return n.a*=1-e,this}greyscale(){const e=this._rgb,n=os(e.r*.3+e.g*.59+e.b*.11);return e.r=e.g=e.b=n,this}opaquer(e){const n=this._rgb;return n.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return Ms(this._rgb,2,e),this}darken(e){return Ms(this._rgb,2,-e),this}saturate(e){return Ms(this._rgb,1,e),this}desaturate(e){return Ms(this._rgb,1,-e),this}rotate(e){return wx(this._rgb,e),this}}/*! - * Chart.js v4.4.3 - * https://www.chartjs.org - * (c) 2024 Chart.js Contributors - * Released under the MIT License - */function Pt(){}const Ox=(()=>{let t=0;return()=>t++})();function J(t){return t===null||typeof t>"u"}function le(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function U(t){return t!==null&&Object.prototype.toString.call(t)==="[object Object]"}function ye(t){return(typeof t=="number"||t instanceof Number)&&isFinite(+t)}function Be(t,e){return ye(t)?t:e}function H(t,e){return typeof t>"u"?e:t}const Lx=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100*e:+t;function re(t,e,n){if(t&&typeof t.call=="function")return t.apply(n,e)}function V(t,e,n,i){let r,s,o;if(le(t))for(s=t.length,r=0;rt,x:t=>t.x,y:t=>t.y};function Ix(t){const e=t.split("."),n=[];let i="";for(const r of e)i+=r,i.endsWith("\\")?i=i.slice(0,-1)+".":(n.push(i),i="");return n}function Ax(t){const e=Ix(t);return n=>{for(const i of e){if(i==="")break;n=n&&n[i]}return n}}function jo(t,e){return(md[e]||(md[e]=Ax(e)))(t)}function kc(t){return t.charAt(0).toUpperCase()+t.slice(1)}const No=t=>typeof t<"u",gn=t=>typeof t=="function",yd=(t,e)=>{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0};function Dx(t){return t.type==="mouseup"||t.type==="click"||t.type==="contextmenu"}const _e=Math.PI,mt=2*_e,jx=mt+_e,Fo=Number.POSITIVE_INFINITY,Nx=_e/180,He=_e/2,kn=_e/4,vd=_e*2/3,tn=Math.log10,Ii=Math.sign;function Sr(t,e,n){return Math.abs(t-e)r-s).pop(),e}function Xr(t){return!isNaN(parseFloat(t))&&isFinite(t)}function zx(t,e){const n=Math.round(t);return n-e<=t&&n+e>=t}function mm(t,e,n){let i,r,s;for(i=0,r=t.length;il&&u=Math.min(e,n)-i&&t<=Math.max(e,n)+i}function Sc(t,e,n){n=n||(o=>t[o]1;)s=r+i>>1,n(s)?r=s:i=s;return{lo:r,hi:i}}const Dn=(t,e,n,i)=>Sc(t,n,i?r=>{const s=t[r][e];return st[r][e]Sc(t,n,i=>t[i][e]>=n);function Hx(t,e,n){let i=0,r=t.length;for(;ii&&t[r-1]>n;)r--;return i>0||r{const i="_onData"+kc(n),r=t[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!1,value(...s){const o=r.apply(this,s);return t._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...s)}),o}})})}function xd(t,e){const n=t._chartjs;if(!n)return;const i=n.listeners,r=i.indexOf(e);r!==-1&&i.splice(r,1),!(i.length>0)&&(vm.forEach(s=>{delete t[s]}),delete t._chartjs)}function Yx(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const _m=function(){return typeof window>"u"?function(t){return t()}:window.requestAnimationFrame}();function wm(t,e){let n=[],i=!1;return function(...r){n=r,i||(i=!0,_m.call(window,()=>{i=!1,t.apply(e,n)}))}}function Gx(t,e){let n;return function(...i){return e?(clearTimeout(n),n=setTimeout(t,e,i)):t.apply(this,i),e}}const qx=t=>t==="start"?"left":t==="end"?"right":"center",kd=(t,e,n)=>t==="start"?e:t==="end"?n:(e+n)/2;function Qx(t,e,n){const i=e.length;let r=0,s=i;if(t._sorted){const{iScale:o,_parsed:a}=t,l=o.axis,{min:u,max:c,minDefined:h,maxDefined:d}=o.getUserBounds();h&&(r=nt(Math.min(Dn(a,l,u).lo,n?i:Dn(e,l,o.getPixelForValue(u)).lo),0,i-1)),d?s=nt(Math.max(Dn(a,o.axis,c,!0).hi+1,n?0:Dn(e,l,o.getPixelForValue(c),!0).hi+1),r,i)-r:s=i-r}return{start:r,count:s}}function Xx(t){const{xScale:e,yScale:n,_scaleRanges:i}=t,r={xmin:e.min,xmax:e.max,ymin:n.min,ymax:n.max};if(!i)return t._scaleRanges=r,!0;const s=i.xmin!==e.min||i.xmax!==e.max||i.ymin!==n.min||i.ymax!==n.max;return Object.assign(i,r),s}const Rs=t=>t===0||t===1,bd=(t,e,n)=>-(Math.pow(2,10*(t-=1))*Math.sin((t-e)*mt/n)),Sd=(t,e,n)=>Math.pow(2,-10*t)*Math.sin((t-e)*mt/n)+1,Cr={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>-Math.cos(t*He)+1,easeOutSine:t=>Math.sin(t*He),easeInOutSine:t=>-.5*(Math.cos(_e*t)-1),easeInExpo:t=>t===0?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>t===1?1:-Math.pow(2,-10*t)+1,easeInOutExpo:t=>Rs(t)?t:t<.5?.5*Math.pow(2,10*(t*2-1)):.5*(-Math.pow(2,-10*(t*2-1))+2),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>Rs(t)?t:bd(t,.075,.3),easeOutElastic:t=>Rs(t)?t:Sd(t,.075,.3),easeInOutElastic(t){return Rs(t)?t:t<.5?.5*bd(t*2,.1125,.45):.5+.5*Sd(t*2-1,.1125,.45)},easeInBack(t){return t*t*((1.70158+1)*t-1.70158)},easeOutBack(t){return(t-=1)*t*((1.70158+1)*t+1.70158)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?.5*(t*t*(((e*=1.525)+1)*t-e)):.5*((t-=2)*t*(((e*=1.525)+1)*t+e)+2)},easeInBounce:t=>1-Cr.easeOutBounce(1-t),easeOutBounce(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:t=>t<.5?Cr.easeInBounce(t*2)*.5:Cr.easeOutBounce(t*2-1)*.5+.5};function Cc(t){if(t&&typeof t=="object"){const e=t.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function Cd(t){return Cc(t)?t:new qr(t)}function Xa(t){return Cc(t)?t:new qr(t).saturate(.5).darken(.1).hexString()}const Jx=["x","y","borderWidth","radius","tension"],Zx=["color","borderColor","backgroundColor"];function e1(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:e=>e!=="onProgress"&&e!=="onComplete"&&e!=="fn"}),t.set("animations",{colors:{type:"color",properties:Zx},numbers:{type:"number",properties:Jx}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:e=>e|0}}}})}function t1(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Ed=new Map;function n1(t,e){e=e||{};const n=t+JSON.stringify(e);let i=Ed.get(n);return i||(i=new Intl.NumberFormat(t,e),Ed.set(n,i)),i}function Ec(t,e,n){return n1(e,n).format(t)}const xm={values(t){return le(t)?t:""+t},numeric(t,e,n){if(t===0)return"0";const i=this.chart.options.locale;let r,s=t;if(n.length>1){const u=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(u<1e-4||u>1e15)&&(r="scientific"),s=i1(t,n)}const o=tn(Math.abs(s)),a=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),l={notation:r,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Ec(t,i,l)},logarithmic(t,e,n){if(t===0)return"0";const i=n[e].significand||t/Math.pow(10,Math.floor(tn(t)));return[1,2,3,5,10,15].includes(i)||e>.8*n.length?xm.numeric.call(this,t,e,n):""}};function i1(t,e){let n=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(n)>=1&&t!==Math.floor(t)&&(n=t-Math.floor(t)),n}var fa={formatters:xm};function r1(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(e,n)=>n.lineWidth,tickColor:(e,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:fa.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:e=>!e.startsWith("before")&&!e.startsWith("after")&&e!=="callback"&&e!=="parser",_indexable:e=>e!=="borderDash"&&e!=="tickBorderDash"&&e!=="dash"}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:e=>e!=="backdropPadding"&&e!=="callback",_indexable:e=>e!=="backdropPadding"})}const Hn=Object.create(null),lu=Object.create(null);function Er(t,e){if(!e)return t;const n=e.split(".");for(let i=0,r=n.length;ii.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=(i,r)=>Xa(r.backgroundColor),this.hoverBorderColor=(i,r)=>Xa(r.borderColor),this.hoverColor=(i,r)=>Xa(r.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e),this.apply(n)}set(e,n){return Ja(this,e,n)}get(e){return Er(this,e)}describe(e,n){return Ja(lu,e,n)}override(e,n){return Ja(Hn,e,n)}route(e,n,i,r){const s=Er(this,e),o=Er(this,i),a="_"+n;Object.defineProperties(s,{[a]:{value:s[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[a],u=o[r];return U(l)?Object.assign({},u,l):H(l,u)},set(l){this[a]=l}}})}apply(e){e.forEach(n=>n(this))}}var ue=new s1({_scriptable:t=>!t.startsWith("on"),_indexable:t=>t!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[e1,t1,r1]);function o1(t){return!t||J(t.size)||J(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function zo(t,e,n,i,r){let s=e[r];return s||(s=e[r]=t.measureText(r).width,n.push(r)),s>i&&(i=s),i}function a1(t,e,n,i){i=i||{};let r=i.data=i.data||{},s=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(r=i.data={},s=i.garbageCollect=[],i.font=e),t.save(),t.font=e;let o=0;const a=n.length;let l,u,c,h,d;for(l=0;ln.length){for(l=0;l0&&t.stroke()}}function Dt(t,e,n){return n=n||.5,!e||t&&t.x>e.left-n&&t.xe.top-n&&t.y0&&s.strokeColor!=="";let l,u;for(t.save(),t.font=r.string,h1(t,s),l=0;l+t||0;function Sm(t,e){const n={},i=U(e),r=i?Object.keys(e):e,s=U(t)?i?o=>H(t[o],t[e[o]]):o=>t[o]:()=>t;for(const o of r)n[o]=y1(s(o));return n}function v1(t){return Sm(t,{top:"y",right:"x",bottom:"y",left:"x"})}function Pr(t){return Sm(t,["topLeft","topRight","bottomLeft","bottomRight"])}function ot(t){const e=v1(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Ke(t,e){t=t||{},e=e||ue.font;let n=H(t.size,e.size);typeof n=="string"&&(n=parseInt(n,10));let i=H(t.style,e.style);i&&!(""+i).match(g1)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const r={family:H(t.family,e.family),lineHeight:m1(H(t.lineHeight,e.lineHeight),n),size:n,style:i,weight:H(t.weight,e.weight),string:""};return r.string=o1(r),r}function Is(t,e,n,i){let r,s,o;for(r=0,s=t.length;rn&&a===0?0:a+l;return{min:o(i,-Math.abs(s)),max:o(r,s)}}function _n(t,e){return Object.assign(Object.create(t),e)}function Pc(t,e=[""],n,i,r=()=>t[0]){const s=n||t;typeof i>"u"&&(i=Tm("_fallback",t));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:s,_fallback:i,_getTarget:r,override:a=>Pc([a,...t],e,s,i)};return new Proxy(o,{deleteProperty(a,l){return delete a[l],delete a._keys,delete t[0][l],!0},get(a,l){return Em(a,l,()=>P1(l,e,t,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(t[0])},has(a,l){return Od(a).includes(l)},ownKeys(a){return Od(a)},set(a,l,u){const c=a._storage||(a._storage=r());return a[l]=c[l]=u,delete a._keys,!0}})}function Ai(t,e,n,i){const r={_cacheable:!1,_proxy:t,_context:e,_subProxy:n,_stack:new Set,_descriptors:Cm(t,i),setContext:s=>Ai(t,s,n,i),override:s=>Ai(t.override(s),e,n,i)};return new Proxy(r,{deleteProperty(s,o){return delete s[o],delete t[o],!0},get(s,o,a){return Em(s,o,()=>x1(s,o,a))},getOwnPropertyDescriptor(s,o){return s._descriptors.allKeys?Reflect.has(t,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,o)},getPrototypeOf(){return Reflect.getPrototypeOf(t)},has(s,o){return Reflect.has(t,o)},ownKeys(){return Reflect.ownKeys(t)},set(s,o,a){return t[o]=a,delete s[o],!0}})}function Cm(t,e={scriptable:!0,indexable:!0}){const{_scriptable:n=e.scriptable,_indexable:i=e.indexable,_allKeys:r=e.allKeys}=t;return{allKeys:r,scriptable:n,indexable:i,isScriptable:gn(n)?n:()=>n,isIndexable:gn(i)?i:()=>i}}const w1=(t,e)=>t?t+kc(e):e,Tc=(t,e)=>U(e)&&t!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function Em(t,e,n){if(Object.prototype.hasOwnProperty.call(t,e)||e==="constructor")return t[e];const i=n();return t[e]=i,i}function x1(t,e,n){const{_proxy:i,_context:r,_subProxy:s,_descriptors:o}=t;let a=i[e];return gn(a)&&o.isScriptable(e)&&(a=k1(e,a,t,n)),le(a)&&a.length&&(a=b1(e,a,t,o.isIndexable)),Tc(e,a)&&(a=Ai(a,r,s&&s[e],o)),a}function k1(t,e,n,i){const{_proxy:r,_context:s,_subProxy:o,_stack:a}=n;if(a.has(t))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+t);a.add(t);let l=e(s,o||i);return a.delete(t),Tc(t,l)&&(l=Oc(r._scopes,r,t,l)),l}function b1(t,e,n,i){const{_proxy:r,_context:s,_subProxy:o,_descriptors:a}=n;if(typeof s.index<"u"&&i(t))return e[s.index%e.length];if(U(e[0])){const l=e,u=r._scopes.filter(c=>c!==l);e=[];for(const c of l){const h=Oc(u,r,t,c);e.push(Ai(h,s,o&&o[t],a))}}return e}function Pm(t,e,n){return gn(t)?t(e,n):t}const S1=(t,e)=>t===!0?e:typeof t=="string"?jo(e,t):void 0;function C1(t,e,n,i,r){for(const s of e){const o=S1(n,s);if(o){t.add(o);const a=Pm(o._fallback,n,r);if(typeof a<"u"&&a!==n&&a!==i)return a}else if(o===!1&&typeof i<"u"&&n!==i)return null}return!1}function Oc(t,e,n,i){const r=e._rootScopes,s=Pm(e._fallback,n,i),o=[...t,...r],a=new Set;a.add(i);let l=Td(a,o,n,s||n,i);return l===null||typeof s<"u"&&s!==n&&(l=Td(a,o,s,l,i),l===null)?!1:Pc(Array.from(a),[""],r,s,()=>E1(e,n,i))}function Td(t,e,n,i,r){for(;n;)n=C1(t,e,n,i,r);return n}function E1(t,e,n){const i=t._getTarget();e in i||(i[e]={});const r=i[e];return le(r)&&U(n)?n:r||{}}function P1(t,e,n,i){let r;for(const s of e)if(r=Tm(w1(s,t),n),typeof r<"u")return Tc(t,r)?Oc(n,i,t,r):r}function Tm(t,e){for(const n of e){if(!n)continue;const i=n[t];if(typeof i<"u")return i}}function Od(t){let e=t._keys;return e||(e=t._keys=T1(t._scopes)),e}function T1(t){const e=new Set;for(const n of t)for(const i of Object.keys(n).filter(r=>!r.startsWith("_")))e.add(i);return Array.from(e)}const O1=Number.EPSILON||1e-14,Di=(t,e)=>et==="x"?"y":"x";function L1(t,e,n,i){const r=t.skip?e:t,s=e,o=n.skip?e:n,a=au(s,r),l=au(o,s);let u=a/(a+l),c=l/(a+l);u=isNaN(u)?0:u,c=isNaN(c)?0:c;const h=i*u,d=i*c;return{previous:{x:s.x-h*(o.x-r.x),y:s.y-h*(o.y-r.y)},next:{x:s.x+d*(o.x-r.x),y:s.y+d*(o.y-r.y)}}}function M1(t,e,n){const i=t.length;let r,s,o,a,l,u=Di(t,0);for(let c=0;c!u.skip)),e.cubicInterpolationMode==="monotone")I1(t,r);else{let u=i?t[t.length-1]:t[0];for(s=0,o=t.length;st.ownerDocument.defaultView.getComputedStyle(t,null);function j1(t,e){return pa(t).getPropertyValue(e)}const N1=["top","right","bottom","left"];function zn(t,e,n){const i={};n=n?"-"+n:"";for(let r=0;r<4;r++){const s=N1[r];i[s]=parseFloat(t[e+"-"+s+n])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const F1=(t,e,n)=>(t>0||e>0)&&(!n||!n.shadowRoot);function z1(t,e){const n=t.touches,i=n&&n.length?n[0]:t,{offsetX:r,offsetY:s}=i;let o=!1,a,l;if(F1(r,s,t.target))a=r,l=s;else{const u=e.getBoundingClientRect();a=i.clientX-u.left,l=i.clientY-u.top,o=!0}return{x:a,y:l,box:o}}function On(t,e){if("native"in t)return t;const{canvas:n,currentDevicePixelRatio:i}=e,r=pa(n),s=r.boxSizing==="border-box",o=zn(r,"padding"),a=zn(r,"border","width"),{x:l,y:u,box:c}=z1(t,n),h=o.left+(c&&a.left),d=o.top+(c&&a.top);let{width:f,height:m}=e;return s&&(f-=o.width+a.width,m-=o.height+a.height),{x:Math.round((l-h)/f*n.width/i),y:Math.round((u-d)/m*n.height/i)}}function $1(t,e,n){let i,r;if(e===void 0||n===void 0){const s=t&&Mc(t);if(!s)e=t.clientWidth,n=t.clientHeight;else{const o=s.getBoundingClientRect(),a=pa(s),l=zn(a,"border","width"),u=zn(a,"padding");e=o.width-u.width-l.width,n=o.height-u.height-l.height,i=Uo(a.maxWidth,s,"clientWidth"),r=Uo(a.maxHeight,s,"clientHeight")}}return{width:e,height:n,maxWidth:i||Fo,maxHeight:r||Fo}}const Ds=t=>Math.round(t*10)/10;function U1(t,e,n,i){const r=pa(t),s=zn(r,"margin"),o=Uo(r.maxWidth,t,"clientWidth")||Fo,a=Uo(r.maxHeight,t,"clientHeight")||Fo,l=$1(t,e,n);let{width:u,height:c}=l;if(r.boxSizing==="content-box"){const d=zn(r,"border","width"),f=zn(r,"padding");u-=f.width+d.width,c-=f.height+d.height}return u=Math.max(0,u-s.width),c=Math.max(0,i?u/i:c-s.height),u=Ds(Math.min(u,o,l.maxWidth)),c=Ds(Math.min(c,a,l.maxHeight)),u&&!c&&(c=Ds(u/2)),(e!==void 0||n!==void 0)&&i&&l.height&&c>l.height&&(c=l.height,u=Ds(Math.floor(c*i))),{width:u,height:c}}function Ld(t,e,n){const i=e||1,r=Math.floor(t.height*i),s=Math.floor(t.width*i);t.height=Math.floor(t.height),t.width=Math.floor(t.width);const o=t.canvas;return o.style&&(n||!o.style.height&&!o.style.width)&&(o.style.height=`${t.height}px`,o.style.width=`${t.width}px`),t.currentDevicePixelRatio!==i||o.height!==r||o.width!==s?(t.currentDevicePixelRatio=i,o.height=r,o.width=s,t.ctx.setTransform(i,0,0,i,0,0),!0):!1}const B1=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};Lc()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch{}return t}();function Md(t,e){const n=j1(t,e),i=n&&n.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Ln(t,e,n,i){return{x:t.x+n*(e.x-t.x),y:t.y+n*(e.y-t.y)}}function V1(t,e,n,i){return{x:t.x+n*(e.x-t.x),y:i==="middle"?n<.5?t.y:e.y:i==="after"?n<1?t.y:e.y:n>0?e.y:t.y}}function W1(t,e,n,i){const r={x:t.cp2x,y:t.cp2y},s={x:e.cp1x,y:e.cp1y},o=Ln(t,r,n),a=Ln(r,s,n),l=Ln(s,e,n),u=Ln(o,a,n),c=Ln(a,l,n);return Ln(u,c,n)}const H1=function(t,e){return{x(n){return t+t+e-n},setWidth(n){e=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,i){return n-i},leftForLtr(n,i){return n-i}}},K1=function(){return{x(t){return t},setWidth(t){},textAlign(t){return t},xPlus(t,e){return t+e},leftForLtr(t,e){return t}}};function Za(t,e,n){return t?H1(e,n):K1()}function Y1(t,e){let n,i;(e==="ltr"||e==="rtl")&&(n=t.canvas.style,i=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",e,"important"),t.prevTextDirection=i)}function G1(t,e){e!==void 0&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Lm(t){return t==="angle"?{between:ym,compare:Ux,normalize:dt}:{between:Vx,compare:(e,n)=>e-n,normalize:e=>e}}function Rd({start:t,end:e,count:n,loop:i,style:r}){return{start:t%n,end:e%n,loop:i&&(e-t+1)%n===0,style:r}}function q1(t,e,n){const{property:i,start:r,end:s}=n,{between:o,normalize:a}=Lm(i),l=e.length;let{start:u,end:c,loop:h}=t,d,f;if(h){for(u+=l,c+=l,d=0,f=l;dl(r,_,p)&&a(r,_)!==0,x=()=>a(s,p)===0||l(s,_,p),b=()=>y||w(),k=()=>!y||x();for(let S=c,M=c;S<=h;++S)g=e[S%o],!g.skip&&(p=u(g[i]),p!==_&&(y=l(p,r,s),v===null&&b()&&(v=a(p,r)===0?S:M),v!==null&&k()&&(m.push(Rd({start:v,end:S,loop:d,count:o,style:f})),v=null),M=S,_=p));return v!==null&&m.push(Rd({start:v,end:h,loop:d,count:o,style:f})),m}function X1(t,e){const n=[],i=t.segments;for(let r=0;rr&&t[s%e].skip;)s--;return s%=e,{start:r,end:s}}function Z1(t,e,n,i){const r=t.length,s=[];let o=e,a=t[e],l;for(l=e+1;l<=n;++l){const u=t[l%r];u.skip||u.stop?a.skip||(i=!1,s.push({start:e%r,end:(l-1)%r,loop:i}),e=o=u.stop?l:null):(o=l,a.skip&&(e=l)),a=u}return o!==null&&s.push({start:e%r,end:o%r,loop:i}),s}function ek(t,e){const n=t.points,i=t.options.spanGaps,r=n.length;if(!r)return[];const s=!!t._loop,{start:o,end:a}=J1(n,r,s,i);if(i===!0)return Id(t,[{start:o,end:a,loop:s}],n,e);const l=aa({chart:e,initial:n.initial,numSteps:o,currentStep:Math.min(i-n.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=_m.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let n=0;this._charts.forEach((i,r)=>{if(!i.running||!i.items.length)return;const s=i.items;let o=s.length-1,a=!1,l;for(;o>=0;--o)l=s[o],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(e),a=!0):(s[o]=s[s.length-1],s.pop());a&&(r.draw(),this._notify(r,i,e,"progress")),s.length||(i.running=!1,this._notify(r,i,e,"complete"),i.initial=!1),n+=s.length}),this._lastDate=e,n===0&&(this._running=!1)}_getAnims(e){const n=this._charts;let i=n.get(e);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(e,i)),i}listen(e,n,i){this._getAnims(e).listeners[n].push(i)}add(e,n){!n||!n.length||this._getAnims(e).items.push(...n)}has(e){return this._getAnims(e).items.length>0}start(e){const n=this._charts.get(e);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((i,r)=>Math.max(i,r._duration),0),this._refresh())}running(e){if(!this._running)return!1;const n=this._charts.get(e);return!(!n||!n.running||!n.items.length)}stop(e){const n=this._charts.get(e);if(!n||!n.items.length)return;const i=n.items;let r=i.length-1;for(;r>=0;--r)i[r].cancel();n.items=[],this._notify(e,n,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var Tt=new ik;const Dd="transparent",rk={boolean(t,e,n){return n>.5?e:t},color(t,e,n){const i=Cd(t||Dd),r=i.valid&&Cd(e||Dd);return r&&r.valid?r.mix(i,n).hexString():e},number(t,e,n){return t+(e-t)*n}};class sk{constructor(e,n,i,r){const s=n[i];r=Is([e.to,r,s,e.from]);const o=Is([e.from,s,r]);this._active=!0,this._fn=e.fn||rk[e.type||typeof o],this._easing=Cr[e.easing]||Cr.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=n,this._prop=i,this._from=o,this._to=r,this._promises=void 0}active(){return this._active}update(e,n,i){if(this._active){this._notify(!1);const r=this._target[this._prop],s=i-this._start,o=this._duration-s;this._start=i,this._duration=Math.floor(Math.max(o,e.duration)),this._total+=s,this._loop=!!e.loop,this._to=Is([e.to,n,r,e.from]),this._from=Is([e.from,r,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const n=e-this._start,i=this._duration,r=this._prop,s=this._from,o=this._loop,a=this._to;let l;if(this._active=s!==a&&(o||n1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[r]=this._fn(s,a,l)}wait(){const e=this._promises||(this._promises=[]);return new Promise((n,i)=>{e.push({res:n,rej:i})})}_notify(e){const n=e?"res":"rej",i=this._promises||[];for(let r=0;r{const s=e[r];if(!U(s))return;const o={};for(const a of n)o[a]=s[a];(le(s.properties)&&s.properties||[r]).forEach(a=>{(a===r||!i.has(a))&&i.set(a,o)})})}_animateOptions(e,n){const i=n.options,r=ak(e,i);if(!r)return[];const s=this._createAnimations(r,i);return i.$shared&&ok(e.options.$animations,i).then(()=>{e.options=i},()=>{}),s}_createAnimations(e,n){const i=this._properties,r=[],s=e.$animations||(e.$animations={}),o=Object.keys(n),a=Date.now();let l;for(l=o.length-1;l>=0;--l){const u=o[l];if(u.charAt(0)==="$")continue;if(u==="options"){r.push(...this._animateOptions(e,n));continue}const c=n[u];let h=s[u];const d=i.get(u);if(h)if(d&&h.active()){h.update(d,c,a);continue}else h.cancel();if(!d||!d.duration){e[u]=c;continue}s[u]=h=new sk(d,e,u,c),r.push(h)}return r}update(e,n){if(this._properties.size===0){Object.assign(e,n);return}const i=this._createAnimations(e,n);if(i.length)return Tt.add(this._chart,i),!0}}function ok(t,e){const n=[],i=Object.keys(e);for(let r=0;r0||!n&&s<0)return r.index}return null}function $d(t,e){const{chart:n,_cachedMeta:i}=t,r=n._stacks||(n._stacks={}),{iScale:s,vScale:o,index:a}=i,l=s.axis,u=o.axis,c=hk(s,o,i),h=e.length;let d;for(let f=0;fn[i].axis===e).shift()}function pk(t,e){return _n(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function gk(t,e,n){return _n(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:n,index:e,mode:"default",type:"data"})}function Ji(t,e){const n=t.controller.index,i=t.vScale&&t.vScale.axis;if(i){e=e||t._parsed;for(const r of e){const s=r._stacks;if(!s||s[i]===void 0||s[i][n]===void 0)return;delete s[i][n],s[i]._visualValues!==void 0&&s[i]._visualValues[n]!==void 0&&delete s[i]._visualValues[n]}}}const tl=t=>t==="reset"||t==="none",Ud=(t,e)=>e?t:Object.assign({},t),mk=(t,e,n)=>t&&!e.hidden&&e._stacked&&{keys:Rm(n,!0),values:null};class Tr{constructor(e,n){this.chart=e,this._ctx=e.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=Fd(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(e){this.index!==e&&Ji(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,n=this._cachedMeta,i=this.getDataset(),r=(h,d,f,m)=>h==="x"?d:h==="r"?m:f,s=n.xAxisID=H(i.xAxisID,el(e,"x")),o=n.yAxisID=H(i.yAxisID,el(e,"y")),a=n.rAxisID=H(i.rAxisID,el(e,"r")),l=n.indexAxis,u=n.iAxisID=r(l,s,o,a),c=n.vAxisID=r(l,o,s,a);n.xScale=this.getScaleForId(s),n.yScale=this.getScaleForId(o),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(u),n.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const n=this._cachedMeta;return e===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&xd(this._data,this),e._stacked&&Ji(e)}_dataCheck(){const e=this.getDataset(),n=e.data||(e.data=[]),i=this._data;if(U(n)){const r=this._cachedMeta;this._data=ck(n,r)}else if(i!==n){if(i){xd(i,this);const r=this._cachedMeta;Ji(r),r._parsed=[]}n&&Object.isExtensible(n)&&Kx(n,this),this._syncList=[],this._data=n}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const n=this._cachedMeta,i=this.getDataset();let r=!1;this._dataCheck();const s=n._stacked;n._stacked=Fd(n.vScale,n),n.stack!==i.stack&&(r=!0,Ji(n),n.stack=i.stack),this._resyncElements(e),(r||s!==n._stacked)&&$d(this,n._parsed)}configure(){const e=this.chart.config,n=e.datasetScopeKeys(this._type),i=e.getOptionScopes(this.getDataset(),n,!0);this.options=e.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,n){const{_cachedMeta:i,_data:r}=this,{iScale:s,_stacked:o}=i,a=s.axis;let l=e===0&&n===r.length?!0:i._sorted,u=e>0&&i._parsed[e-1],c,h,d;if(this._parsing===!1)i._parsed=r,i._sorted=!0,d=r;else{le(r[e])?d=this.parseArrayData(i,r,e,n):U(r[e])?d=this.parseObjectData(i,r,e,n):d=this.parsePrimitiveData(i,r,e,n);const f=()=>h[a]===null||u&&h[a]y||h=0;--d)if(!m()){this.updateRangeFromParsed(u,e,f,l);break}}return u}getAllParsedValues(e){const n=this._cachedMeta._parsed,i=[];let r,s,o;for(r=0,s=n.length;r=0&&ethis.getContext(i,r,n),y=u.resolveNamedOptions(d,f,m,h);return y.$shared&&(y.$shared=l,s[o]=Object.freeze(Ud(y,l))),y}_resolveAnimations(e,n,i){const r=this.chart,s=this._cachedDataOpts,o=`animation-${n}`,a=s[o];if(a)return a;let l;if(r.options.animation!==!1){const c=this.chart.config,h=c.datasetAnimationScopeKeys(this._type,n),d=c.getOptionScopes(this.getDataset(),h);l=c.createResolver(d,this.getContext(e,i,n))}const u=new Mm(r,l&&l.animations);return l&&l._cacheable&&(s[o]=Object.freeze(u)),u}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,n){return!n||tl(e)||this.chart._animationsDisabled}_getSharedOptions(e,n){const i=this.resolveDataElementOptions(e,n),r=this._sharedOptions,s=this.getSharedOptions(i),o=this.includeOptions(n,s)||s!==r;return this.updateSharedOptions(s,n,i),{sharedOptions:s,includeOptions:o}}updateElement(e,n,i,r){tl(r)?Object.assign(e,i):this._resolveAnimations(n,r).update(e,i)}updateSharedOptions(e,n,i){e&&!tl(n)&&this._resolveAnimations(void 0,n).update(e,i)}_setStyle(e,n,i,r){e.active=r;const s=this.getStyle(n,r);this._resolveAnimations(n,i,r).update(e,{options:!r&&this.getSharedOptions(s)||s})}removeHoverStyle(e,n,i){this._setStyle(e,i,"active",!1)}setHoverStyle(e,n,i){this._setStyle(e,i,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const n=this._data,i=this._cachedMeta.data;for(const[a,l,u]of this._syncList)this[a](l,u);this._syncList=[];const r=i.length,s=n.length,o=Math.min(s,r);o&&this.parse(0,o),s>r?this._insertElements(r,s-r,e):s{for(u.length+=n,a=u.length-1;a>=o;a--)u[a]=u[a-n]};for(l(s),a=e;a0&&this.getParsed(n-1);for(let x=0;x<_;++x){const b=e[x],k=p?b:{};if(x=g){k.skip=!0;continue}const S=this.getParsed(x),M=J(S[f]),L=k[d]=o.getPixelForValue(S[d],x),D=k[f]=s||M?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,S,l):S[f],x);k.skip=isNaN(L)||isNaN(D)||M,k.stop=x>0&&Math.abs(S[d]-w[d])>v,y&&(k.parsed=S,k.raw=u.data[x]),h&&(k.options=c||this.resolveDataElementOptions(x,b.active?"active":r)),p||this.updateElement(b,x,k,r),w=S}}getMaxOverflow(){const e=this._cachedMeta,n=e.dataset,i=n.options&&n.options.borderWidth||0,r=e.data||[];if(!r.length)return i;const s=r[0].size(this.resolveDataElementOptions(0)),o=r[r.length-1].size(this.resolveDataElementOptions(r.length-1));return Math.max(i,s,o)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}I(ro,"id","line"),I(ro,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),I(ro,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});function Sn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Rc{constructor(e){I(this,"options");this.options=e||{}}static override(e){Object.assign(Rc.prototype,e)}init(){}formats(){return Sn()}parse(){return Sn()}format(){return Sn()}add(){return Sn()}diff(){return Sn()}startOf(){return Sn()}endOf(){return Sn()}}var yk={_date:Rc};function vk(t,e,n,i){const{controller:r,data:s,_sorted:o}=t,a=r._cachedMeta.iScale;if(a&&e===a.axis&&e!=="r"&&o&&s.length){const l=a._reversePixels?Wx:Dn;if(i){if(r._sharedOptions){const u=s[0],c=typeof u.getRange=="function"&&u.getRange(e);if(c){const h=l(s,e,n-c),d=l(s,e,n+c);return{lo:h.lo,hi:d.hi}}}}else return l(s,e,n)}return{lo:0,hi:s.length-1}}function as(t,e,n,i,r){const s=t.getSortedVisibleDatasetMetas(),o=n[e];for(let a=0,l=s.length;a{l[o](e[n],r)&&(s.push({element:l,datasetIndex:u,index:c}),a=a||l.inRange(e.x,e.y,r))}),i&&!a?[]:s}var kk={evaluateInteractionItems:as,modes:{index(t,e,n,i){const r=On(e,t),s=n.axis||"x",o=n.includeInvisible||!1,a=n.intersect?nl(t,r,s,i,o):il(t,r,s,!1,i,o),l=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach(u=>{const c=a[0].index,h=u.data[c];h&&!h.skip&&l.push({element:h,datasetIndex:u.index,index:c})}),l):[]},dataset(t,e,n,i){const r=On(e,t),s=n.axis||"xy",o=n.includeInvisible||!1;let a=n.intersect?nl(t,r,s,i,o):il(t,r,s,!1,i,o);if(a.length>0){const l=a[0].datasetIndex,u=t.getDatasetMeta(l).data;a=[];for(let c=0;cn.pos===e)}function Vd(t,e){return t.filter(n=>Im.indexOf(n.pos)===-1&&n.box.axis===e)}function er(t,e){return t.sort((n,i)=>{const r=e?i:n,s=e?n:i;return r.weight===s.weight?r.index-s.index:r.weight-s.weight})}function bk(t){const e=[];let n,i,r,s,o,a;for(n=0,i=(t||[]).length;nu.box.fullSize),!0),i=er(Zi(e,"left"),!0),r=er(Zi(e,"right")),s=er(Zi(e,"top"),!0),o=er(Zi(e,"bottom")),a=Vd(e,"x"),l=Vd(e,"y");return{fullSize:n,leftAndTop:i.concat(s),rightAndBottom:r.concat(l).concat(o).concat(a),chartArea:Zi(e,"chartArea"),vertical:i.concat(r).concat(l),horizontal:s.concat(o).concat(a)}}function Wd(t,e,n,i){return Math.max(t[n],e[n])+Math.max(t[i],e[i])}function Am(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function Pk(t,e,n,i){const{pos:r,box:s}=n,o=t.maxPadding;if(!U(r)){n.size&&(t[r]-=n.size);const h=i[n.stack]||{size:0,count:1};h.size=Math.max(h.size,n.horizontal?s.height:s.width),n.size=h.size/h.count,t[r]+=n.size}s.getPadding&&Am(o,s.getPadding());const a=Math.max(0,e.outerWidth-Wd(o,t,"left","right")),l=Math.max(0,e.outerHeight-Wd(o,t,"top","bottom")),u=a!==t.w,c=l!==t.h;return t.w=a,t.h=l,n.horizontal?{same:u,other:c}:{same:c,other:u}}function Tk(t){const e=t.maxPadding;function n(i){const r=Math.max(e[i]-t[i],0);return t[i]+=r,r}t.y+=n("top"),t.x+=n("left"),n("right"),n("bottom")}function Ok(t,e){const n=e.maxPadding;function i(r){const s={left:0,top:0,right:0,bottom:0};return r.forEach(o=>{s[o]=Math.max(e[o],n[o])}),s}return i(t?["left","right"]:["top","bottom"])}function ur(t,e,n,i){const r=[];let s,o,a,l,u,c;for(s=0,o=t.length,u=0;s{typeof y.beforeLayout=="function"&&y.beforeLayout()});const c=l.reduce((y,v)=>v.box.options&&v.box.options.display===!1?y:y+1,0)||1,h=Object.freeze({outerWidth:e,outerHeight:n,padding:r,availableWidth:s,availableHeight:o,vBoxMaxWidth:s/2/c,hBoxMaxHeight:o/2}),d=Object.assign({},r);Am(d,ot(i));const f=Object.assign({maxPadding:d,w:s,h:o,x:r.left,y:r.top},r),m=Ck(l.concat(u),h);ur(a.fullSize,f,h,m),ur(l,f,h,m),ur(u,f,h,m)&&ur(l,f,h,m),Tk(f),Hd(a.leftAndTop,f,h,m),f.x+=f.w,f.y+=f.h,Hd(a.rightAndBottom,f,h,m),t.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},V(a.chartArea,y=>{const v=y.box;Object.assign(v,t.chartArea),v.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class Dm{acquireContext(e,n){}releaseContext(e){return!1}addEventListener(e,n,i){}removeEventListener(e,n,i){}getDevicePixelRatio(){return 1}getMaximumSize(e,n,i,r){return n=Math.max(0,n||e.width),i=i||e.height,{width:n,height:Math.max(0,r?Math.floor(n/r):i)}}isAttached(e){return!0}updateConfig(e){}}class Lk extends Dm{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const so="$chartjs",Mk={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Kd=t=>t===null||t==="";function Rk(t,e){const n=t.style,i=t.getAttribute("height"),r=t.getAttribute("width");if(t[so]={initial:{height:i,width:r,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Kd(r)){const s=Md(t,"width");s!==void 0&&(t.width=s)}if(Kd(i))if(t.style.height==="")t.height=t.width/(e||2);else{const s=Md(t,"height");s!==void 0&&(t.height=s)}return t}const jm=B1?{passive:!0}:!1;function Ik(t,e,n){t&&t.addEventListener(e,n,jm)}function Ak(t,e,n){t&&t.canvas&&t.canvas.removeEventListener(e,n,jm)}function Dk(t,e){const n=Mk[t.type]||t.type,{x:i,y:r}=On(t,e);return{type:n,chart:e,native:t,x:i!==void 0?i:null,y:r!==void 0?r:null}}function Bo(t,e){for(const n of t)if(n===e||n.contains(e))return!0}function jk(t,e,n){const i=t.canvas,r=new MutationObserver(s=>{let o=!1;for(const a of s)o=o||Bo(a.addedNodes,i),o=o&&!Bo(a.removedNodes,i);o&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}function Nk(t,e,n){const i=t.canvas,r=new MutationObserver(s=>{let o=!1;for(const a of s)o=o||Bo(a.removedNodes,i),o=o&&!Bo(a.addedNodes,i);o&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}const Jr=new Map;let Yd=0;function Nm(){const t=window.devicePixelRatio;t!==Yd&&(Yd=t,Jr.forEach((e,n)=>{n.currentDevicePixelRatio!==t&&e()}))}function Fk(t,e){Jr.size||window.addEventListener("resize",Nm),Jr.set(t,e)}function zk(t){Jr.delete(t),Jr.size||window.removeEventListener("resize",Nm)}function $k(t,e,n){const i=t.canvas,r=i&&Mc(i);if(!r)return;const s=wm((a,l)=>{const u=r.clientWidth;n(a,l),u{const l=a[0],u=l.contentRect.width,c=l.contentRect.height;u===0&&c===0||s(u,c)});return o.observe(r),Fk(t,s),o}function rl(t,e,n){n&&n.disconnect(),e==="resize"&&zk(t)}function Uk(t,e,n){const i=t.canvas,r=wm(s=>{t.ctx!==null&&n(Dk(s,t))},t);return Ik(i,e,r),r}class Bk extends Dm{acquireContext(e,n){const i=e&&e.getContext&&e.getContext("2d");return i&&i.canvas===e?(Rk(e,n),i):null}releaseContext(e){const n=e.canvas;if(!n[so])return!1;const i=n[so].initial;["height","width"].forEach(s=>{const o=i[s];J(o)?n.removeAttribute(s):n.setAttribute(s,o)});const r=i.style||{};return Object.keys(r).forEach(s=>{n.style[s]=r[s]}),n.width=n.width,delete n[so],!0}addEventListener(e,n,i){this.removeEventListener(e,n);const r=e.$proxies||(e.$proxies={}),o={attach:jk,detach:Nk,resize:$k}[n]||Uk;r[n]=o(e,n,i)}removeEventListener(e,n){const i=e.$proxies||(e.$proxies={}),r=i[n];if(!r)return;({attach:rl,detach:rl,resize:rl}[n]||Ak)(e,n,r),i[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,n,i,r){return U1(e,n,i,r)}isAttached(e){const n=e&&Mc(e);return!!(n&&n.isConnected)}}function Vk(t){return!Lc()||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas?Lk:Bk}class Kn{constructor(){I(this,"x");I(this,"y");I(this,"active",!1);I(this,"options");I(this,"$animations")}tooltipPosition(e){const{x:n,y:i}=this.getProps(["x","y"],e);return{x:n,y:i}}hasValue(){return Xr(this.x)&&Xr(this.y)}getProps(e,n){const i=this.$animations;if(!n||!i)return this;const r={};return e.forEach(s=>{r[s]=i[s]&&i[s].active()?i[s]._to:this[s]}),r}}I(Kn,"defaults",{}),I(Kn,"defaultRoutes");function Wk(t,e){const n=t.options.ticks,i=Hk(t),r=Math.min(n.maxTicksLimit||i,i),s=n.major.enabled?Yk(e):[],o=s.length,a=s[0],l=s[o-1],u=[];if(o>r)return Gk(e,u,s,o/r),u;const c=Kk(s,e,r);if(o>0){let h,d;const f=o>1?Math.round((l-a)/(o-1)):null;for(Fs(e,u,c,J(f)?0:a-f,a),h=0,d=o-1;hr)return l}return Math.max(r,1)}function Yk(t){const e=[];let n,i;for(n=0,i=t.length;nt==="left"?"right":t==="right"?"left":t,Gd=(t,e,n)=>e==="top"||e==="left"?t[e]+n:t[e]-n,qd=(t,e)=>Math.min(e||t,t);function Qd(t,e){const n=[],i=t.length/e,r=t.length;let s=0;for(;so+a)))return l}function Jk(t,e){V(t,n=>{const i=n.gc,r=i.length/2;let s;if(r>e){for(s=0;si?i:n,i=r&&n>i?n:i,{min:Be(n,Be(i,n)),max:Be(i,Be(n,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){re(this.options.beforeUpdate,[this])}update(e,n,i){const{beginAtZero:r,grace:s,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=n,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=_1(this,s,r),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=s||i<=1||!this.isHorizontal()){this.labelRotation=r;return}const c=this._getLabelSizes(),h=c.widest.width,d=c.highest.height,f=nt(this.chart.width-h,0,this.maxWidth);a=e.offset?this.maxWidth/i:f/(i-1),h+6>a&&(a=f/(i-(e.offset?.5:1)),l=this.maxHeight-tr(e.grid)-n.padding-Xd(e.title,this.chart.options.font),u=Math.sqrt(h*h+d*d),o=bc(Math.min(Math.asin(nt((c.highest.height+6)/a,-1,1)),Math.asin(nt(l/u,-1,1))-Math.asin(nt(d/u,-1,1)))),o=Math.max(r,Math.min(s,o))),this.labelRotation=o}afterCalculateLabelRotation(){re(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){re(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:n,options:{ticks:i,title:r,grid:s}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const l=Xd(r,n.options.font);if(a?(e.width=this.maxWidth,e.height=tr(s)+l):(e.height=this.maxHeight,e.width=tr(s)+l),i.display&&this.ticks.length){const{first:u,last:c,widest:h,highest:d}=this._getLabelSizes(),f=i.padding*2,m=nn(this.labelRotation),y=Math.cos(m),v=Math.sin(m);if(a){const p=i.mirror?0:v*h.width+y*d.height;e.height=Math.min(this.maxHeight,e.height+p+f)}else{const p=i.mirror?0:y*h.width+v*d.height;e.width=Math.min(this.maxWidth,e.width+p+f)}this._calculatePadding(u,c,v,y)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,n,i,r){const{ticks:{align:s,padding:o},position:a}=this.options,l=this.labelRotation!==0,u=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const c=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,f=0;l?u?(d=r*e.width,f=i*n.height):(d=i*e.height,f=r*n.width):s==="start"?f=n.width:s==="end"?d=e.width:s!=="inner"&&(d=e.width/2,f=n.width/2),this.paddingLeft=Math.max((d-c+o)*this.width/(this.width-c),0),this.paddingRight=Math.max((f-h+o)*this.width/(this.width-h),0)}else{let c=n.height/2,h=e.height/2;s==="start"?(c=0,h=e.height):s==="end"&&(c=n.height,h=0),this.paddingTop=c+o,this.paddingBottom=h+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(){re(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:n}=this.options;return n==="top"||n==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let n,i;for(n=0,i=e.length;n({width:o[M]||0,height:a[M]||0});return{first:S(0),last:S(n-1),widest:S(b),highest:S(k),widths:o,heights:a}}getLabelForValue(e){return e}getPixelForValue(e,n){return NaN}getValueForPixel(e){}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const n=this._startPixel+e*this._length;return Bx(this._alignToPixels?bn(this.chart,n,0):n)}getDecimalForPixel(e){const n=(e-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:n}=this;return e<0&&n<0?n:e>0&&n>0?e:0}getContext(e){const n=this.ticks||[];if(e>=0&&ea*r?a/i:l/r:l*r0}_computeGridLineItems(e){const n=this.axis,i=this.chart,r=this.options,{grid:s,position:o,border:a}=r,l=s.offset,u=this.isHorizontal(),h=this.ticks.length+(l?1:0),d=tr(s),f=[],m=a.setContext(this.getContext()),y=m.display?m.width:0,v=y/2,p=function(K){return bn(i,K,y)};let g,_,w,x,b,k,S,M,L,D,B,ce;if(o==="top")g=p(this.bottom),k=this.bottom-d,M=g-v,D=p(e.top)+v,ce=e.bottom;else if(o==="bottom")g=p(this.top),D=e.top,ce=p(e.bottom)-v,k=g+v,M=this.top+d;else if(o==="left")g=p(this.right),b=this.right-d,S=g-v,L=p(e.left)+v,B=e.right;else if(o==="right")g=p(this.left),L=e.left,B=p(e.right)-v,b=g+v,S=this.left+d;else if(n==="x"){if(o==="center")g=p((e.top+e.bottom)/2+.5);else if(U(o)){const K=Object.keys(o)[0],ge=o[K];g=p(this.chart.scales[K].getPixelForValue(ge))}D=e.top,ce=e.bottom,k=g+v,M=k+d}else if(n==="y"){if(o==="center")g=p((e.left+e.right)/2);else if(U(o)){const K=Object.keys(o)[0],ge=o[K];g=p(this.chart.scales[K].getPixelForValue(ge))}b=g-v,S=b-d,L=e.left,B=e.right}const oe=H(r.ticks.maxTicksLimit,h),$=Math.max(1,Math.ceil(h/oe));for(_=0;_0&&(Oe-=Te/2);break}Y={left:Oe,top:Et,width:Te+Q.width,height:vt+Q.height,color:$.backdropColor}}v.push({label:w,font:M,textOffset:B,options:{rotation:y,color:ge,strokeColor:T,strokeWidth:R,textAlign:A,textBaseline:ce,translation:[x,b],backdrop:Y}})}return v}_getXAxisLabelAlignment(){const{position:e,ticks:n}=this.options;if(-nn(this.labelRotation))return e==="top"?"left":"right";let r="center";return n.align==="start"?r="left":n.align==="end"?r="right":n.align==="inner"&&(r="inner"),r}_getYAxisLabelAlignment(e){const{position:n,ticks:{crossAlign:i,mirror:r,padding:s}}=this.options,o=this._getLabelSizes(),a=e+s,l=o.widest.width;let u,c;return n==="left"?r?(c=this.right+s,i==="near"?u="left":i==="center"?(u="center",c+=l/2):(u="right",c+=l)):(c=this.right-a,i==="near"?u="right":i==="center"?(u="center",c-=l/2):(u="left",c=this.left)):n==="right"?r?(c=this.left+s,i==="near"?u="right":i==="center"?(u="center",c-=l/2):(u="left",c-=l)):(c=this.left+a,i==="near"?u="left":i==="center"?(u="center",c+=l/2):(u="right",c=this.right)):u="right",{textAlign:u,x:c}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:n},left:i,top:r,width:s,height:o}=this;n&&(e.save(),e.fillStyle=n,e.fillRect(i,r,s,o),e.restore())}getLineWidthForValue(e){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const r=this.ticks.findIndex(s=>s.value===e);return r>=0?n.setContext(this.getContext(r)).lineWidth:0}drawGrid(e){const n=this.options.grid,i=this.ctx,r=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let s,o;const a=(l,u,c)=>{!c.width||!c.color||(i.save(),i.lineWidth=c.width,i.strokeStyle=c.color,i.setLineDash(c.borderDash||[]),i.lineDashOffset=c.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(u.x,u.y),i.stroke(),i.restore())};if(n.display)for(s=0,o=r.length;s{this.draw(s)}}]:[{z:i,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:r,draw:()=>{this.drawBorder()}},{z:n,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(e){const n=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",r=[];let s,o;for(s=0,o=n.length;s{const i=n.split("."),r=i.pop(),s=[t].concat(i).join("."),o=e[n].split("."),a=o.pop(),l=o.join(".");ue.route(s,r,l,a)})}function sb(t){return"id"in t&&"defaults"in t}class ob{constructor(){this.controllers=new zs(Tr,"datasets",!0),this.elements=new zs(Kn,"elements"),this.plugins=new zs(Object,"plugins"),this.scales=new zs(Qn,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,n,i){[...n].forEach(r=>{const s=i||this._getRegistryForType(r);i||s.isForType(r)||s===this.plugins&&r.id?this._exec(e,s,r):V(r,o=>{const a=i||this._getRegistryForType(o);this._exec(e,a,o)})})}_exec(e,n,i){const r=kc(e);re(i["before"+r],[],i),n[e](i),re(i["after"+r],[],i)}_getRegistryForType(e){for(let n=0;ns.filter(a=>!o.some(l=>a.plugin.id===l.plugin.id));this._notify(r(n,i),e,"stop"),this._notify(r(i,n),e,"start")}}function lb(t){const e={},n=[],i=Object.keys(kt.plugins.items);for(let s=0;s1&&Jd(t[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function Zd(t,e,n){if(n[e+"AxisID"]===t)return{axis:e}}function gb(t,e){if(e.data&&e.data.datasets){const n=e.data.datasets.filter(i=>i.xAxisID===t||i.yAxisID===t);if(n.length)return Zd(t,"x",n[0])||Zd(t,"y",n[0])}return{}}function mb(t,e){const n=Hn[t.type]||{scales:{}},i=e.scales||{},r=hu(t.type,e),s=Object.create(null);return Object.keys(i).forEach(o=>{const a=i[o];if(!U(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=du(o,a,gb(o,t),ue.scales[a.type]),u=fb(l,r),c=n.scales||{};s[o]=br(Object.create(null),[{axis:l},a,c[l],c[u]])}),t.data.datasets.forEach(o=>{const a=o.type||t.type,l=o.indexAxis||hu(a,e),c=(Hn[a]||{}).scales||{};Object.keys(c).forEach(h=>{const d=db(h,l),f=o[d+"AxisID"]||d;s[f]=s[f]||Object.create(null),br(s[f],[{axis:d},i[f],c[h]])})}),Object.keys(s).forEach(o=>{const a=s[o];br(a,[ue.scales[a.type],ue.scale])}),s}function Fm(t){const e=t.options||(t.options={});e.plugins=H(e.plugins,{}),e.scales=mb(t,e)}function zm(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function yb(t){return t=t||{},t.data=zm(t.data),Fm(t),t}const ef=new Map,$m=new Set;function $s(t,e){let n=ef.get(t);return n||(n=e(),ef.set(t,n),$m.add(n)),n}const nr=(t,e,n)=>{const i=jo(e,n);i!==void 0&&t.add(i)};class vb{constructor(e){this._config=yb(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=zm(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),Fm(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return $s(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,n){return $s(`${e}.transition.${n}`,()=>[[`datasets.${e}.transitions.${n}`,`transitions.${n}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,n){return $s(`${e}-${n}`,()=>[[`datasets.${e}.elements.${n}`,`datasets.${e}`,`elements.${n}`,""]])}pluginScopeKeys(e){const n=e.id,i=this.type;return $s(`${i}-plugin-${n}`,()=>[[`plugins.${n}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,n){const i=this._scopeCache;let r=i.get(e);return(!r||n)&&(r=new Map,i.set(e,r)),r}getOptionScopes(e,n,i){const{options:r,type:s}=this,o=this._cachedScopes(e,i),a=o.get(n);if(a)return a;const l=new Set;n.forEach(c=>{e&&(l.add(e),c.forEach(h=>nr(l,e,h))),c.forEach(h=>nr(l,r,h)),c.forEach(h=>nr(l,Hn[s]||{},h)),c.forEach(h=>nr(l,ue,h)),c.forEach(h=>nr(l,lu,h))});const u=Array.from(l);return u.length===0&&u.push(Object.create(null)),$m.has(n)&&o.set(n,u),u}chartOptionScopes(){const{options:e,type:n}=this;return[e,Hn[n]||{},ue.datasets[n]||{},{type:n},ue,lu]}resolveNamedOptions(e,n,i,r=[""]){const s={$shared:!0},{resolver:o,subPrefixes:a}=tf(this._resolverCache,e,r);let l=o;if(wb(o,n)){s.$shared=!1,i=gn(i)?i():i;const u=this.createResolver(e,i,a);l=Ai(o,i,u)}for(const u of n)s[u]=l[u];return s}createResolver(e,n,i=[""],r){const{resolver:s}=tf(this._resolverCache,e,i);return U(n)?Ai(s,n,void 0,r):s}}function tf(t,e,n){let i=t.get(e);i||(i=new Map,t.set(e,i));const r=n.join();let s=i.get(r);return s||(s={resolver:Pc(e,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},i.set(r,s)),s}const _b=t=>U(t)&&Object.getOwnPropertyNames(t).some(e=>gn(t[e]));function wb(t,e){const{isScriptable:n,isIndexable:i}=Cm(t);for(const r of e){const s=n(r),o=i(r),a=(o||s)&&t[r];if(s&&(gn(a)||_b(a))||o&&le(a))return!0}return!1}var xb="4.4.3";const kb=["top","bottom","left","right","chartArea"];function nf(t,e){return t==="top"||t==="bottom"||kb.indexOf(t)===-1&&e==="x"}function rf(t,e){return function(n,i){return n[t]===i[t]?n[e]-i[e]:n[t]-i[t]}}function sf(t){const e=t.chart,n=e.options.animation;e.notifyPlugins("afterRender"),re(n&&n.onComplete,[t],e)}function bb(t){const e=t.chart,n=e.options.animation;re(n&&n.onProgress,[t],e)}function Um(t){return Lc()&&typeof t=="string"?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const oo={},of=t=>{const e=Um(t);return Object.values(oo).filter(n=>n.canvas===e).pop()};function Sb(t,e,n){const i=Object.keys(t);for(const r of i){const s=+r;if(s>=e){const o=t[r];delete t[r],(n>0||s>e)&&(t[s+n]=o)}}}function Cb(t,e,n,i){return!n||t.type==="mouseout"?null:i?e:t}function Us(t,e,n){return t.options.clip?t[n]:e[n]}function Eb(t,e){const{xScale:n,yScale:i}=t;return n&&i?{left:Us(n,e,"left"),right:Us(n,e,"right"),top:Us(i,e,"top"),bottom:Us(i,e,"bottom")}:e}var Vt;let ga=(Vt=class{static register(...e){kt.add(...e),af()}static unregister(...e){kt.remove(...e),af()}constructor(e,n){const i=this.config=new vb(n),r=Um(e),s=of(r);if(s)throw new Error("Canvas is already in use. Chart with ID '"+s.id+"' must be destroyed before the canvas with ID '"+s.canvas.id+"' can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||Vk(r)),this.platform.updateConfig(i);const a=this.platform.acquireContext(r,o.aspectRatio),l=a&&a.canvas,u=l&&l.height,c=l&&l.width;if(this.id=Ox(),this.ctx=a,this.canvas=l,this.width=c,this.height=u,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 ab,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Gx(h=>this.update(h),o.resizeDelay||0),this._dataChanges=[],oo[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Tt.listen(this,"complete",sf),Tt.listen(this,"progress",bb),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:n},width:i,height:r,_aspectRatio:s}=this;return J(e)?n&&s?s:r?i/r:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return kt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Ld(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Pd(this.canvas,this.ctx),this}stop(){return Tt.stop(this),this}resize(e,n){Tt.running(this)?this._resizeBeforeDraw={width:e,height:n}:this._resize(e,n)}_resize(e,n){const i=this.options,r=this.canvas,s=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(r,e,n,s),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,Ld(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),re(i.onResize,[this,o],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};V(n,(i,r)=>{i.id=r})}buildOrUpdateScales(){const e=this.options,n=e.scales,i=this.scales,r=Object.keys(i).reduce((o,a)=>(o[a]=!1,o),{});let s=[];n&&(s=s.concat(Object.keys(n).map(o=>{const a=n[o],l=du(o,a),u=l==="r",c=l==="x";return{options:a,dposition:u?"chartArea":c?"bottom":"left",dtype:u?"radialLinear":c?"category":"linear"}}))),V(s,o=>{const a=o.options,l=a.id,u=du(l,a),c=H(a.type,o.dtype);(a.position===void 0||nf(a.position,u)!==nf(o.dposition))&&(a.position=o.dposition),r[l]=!0;let h=null;if(l in i&&i[l].type===c)h=i[l];else{const d=kt.getScale(c);h=new d({id:l,type:c,ctx:this.ctx,chart:this}),i[h.id]=h}h.init(a,e)}),V(r,(o,a)=>{o||delete i[a]}),V(i,o=>{Ns.configure(this,o,o.options),Ns.addBox(this,o)})}_updateMetasets(){const e=this._metasets,n=this.data.datasets.length,i=e.length;if(e.sort((r,s)=>r.index-s.index),i>n){for(let r=n;rn.length&&delete this._stacks,e.forEach((i,r)=>{n.filter(s=>s===i._dataset).length===0&&this._destroyDatasetMeta(r)})}buildOrUpdateControllers(){const e=[],n=this.data.datasets;let i,r;for(this._removeUnreferencedMetasets(),i=0,r=n.length;i{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const n=this.config;n.update();const i=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const s=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let u=0,c=this.data.datasets.length;u{u.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(rf("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){V(this.scales,e=>{Ns.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,n=new Set(Object.keys(this._listeners)),i=new Set(e.events);(!yd(n,i)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,n=this._getUniformDataChanges()||[];for(const{method:i,start:r,count:s}of n){const o=i==="_removeElements"?-s:s;Sb(e,r,o)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const n=this.data.datasets.length,i=s=>new Set(e.filter(o=>o[0]===s).map((o,a)=>a+","+o.splice(1).join(","))),r=i(0);for(let s=1;ss.split(",")).map(s=>({method:s[1],start:+s[2],count:+s[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Ns.update(this,this.width,this.height,e);const n=this.chartArea,i=n.width<=0||n.height<=0;this._layers=[],V(this.boxes,r=>{i&&r.position==="chartArea"||(r.configure&&r.configure(),this._layers.push(...r._layers()))},this),this._layers.forEach((r,s)=>{r._idx=s}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let n=0,i=this.data.datasets.length;n=0;--n)this._drawDataset(e[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const n=this.ctx,i=e._clip,r=!i.disabled,s=Eb(e,this.chartArea),o={meta:e,index:e.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",o)!==!1&&(r&&km(n,{left:i.left===!1?0:s.left-i.left,right:i.right===!1?this.width:s.right+i.right,top:i.top===!1?0:s.top-i.top,bottom:i.bottom===!1?this.height:s.bottom+i.bottom}),e.controller.draw(),r&&bm(n),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(e){return Dt(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,n,i,r){const s=kk.modes[n];return typeof s=="function"?s(this,e,i,r):[]}getDatasetMeta(e){const n=this.data.datasets[e],i=this._metasets;let r=i.filter(s=>s&&s._dataset===n).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:e,_dataset:n,_parsed:[],_sorted:!1},i.push(r)),r}getContext(){return this.$context||(this.$context=_n(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const n=this.data.datasets[e];if(!n)return!1;const i=this.getDatasetMeta(e);return typeof i.hidden=="boolean"?!i.hidden:!n.hidden}setDatasetVisibility(e,n){const i=this.getDatasetMeta(e);i.hidden=!n}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,n,i){const r=i?"show":"hide",s=this.getDatasetMeta(e),o=s.controller._resolveAnimations(void 0,r);No(n)?(s.data[n].hidden=!i,this.update()):(this.setDatasetVisibility(e,i),o.update(s,{visible:i}),this.update(a=>a.datasetIndex===e?r:void 0))}hide(e,n){this._updateVisibility(e,n,!1)}show(e,n){this._updateVisibility(e,n,!0)}_destroyDatasetMeta(e){const n=this._metasets[e];n&&n.controller&&n.controller._destroy(),delete this._metasets[e]}_stop(){let e,n;for(this.stop(),Tt.remove(this),e=0,n=this.data.datasets.length;e{n.addEventListener(this,s,o),e[s]=o},r=(s,o,a)=>{s.offsetX=o,s.offsetY=a,this._eventHandler(s)};V(this.options.events,s=>i(s,r))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,n=this.platform,i=(l,u)=>{n.addEventListener(this,l,u),e[l]=u},r=(l,u)=>{e[l]&&(n.removeEventListener(this,l,u),delete e[l])},s=(l,u)=>{this.canvas&&this.resize(l,u)};let o;const a=()=>{r("attach",a),this.attached=!0,this.resize(),i("resize",s),i("detach",o)};o=()=>{this.attached=!1,r("resize",s),this._stop(),this._resize(0,0),i("attach",a)},n.isAttached(this.canvas)?a():o()}unbindEvents(){V(this._listeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._listeners={},V(this._responsiveListeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,n,i){const r=i?"set":"remove";let s,o,a,l;for(n==="dataset"&&(s=this.getDatasetMeta(e[0].datasetIndex),s.controller["_"+r+"DatasetHoverStyle"]()),a=0,l=e.length;a{const a=this.getDatasetMeta(s);if(!a)throw new Error("No dataset found at index "+s);return{datasetIndex:s,element:a.data[o],index:o}});!Ao(i,n)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,n))}notifyPlugins(e,n,i){return this._plugins.notify(this,e,n,i)}isPluginEnabled(e){return this._plugins._cache.filter(n=>n.plugin.id===e).length===1}_updateHoverStyles(e,n,i){const r=this.options.hover,s=(l,u)=>l.filter(c=>!u.some(h=>c.datasetIndex===h.datasetIndex&&c.index===h.index)),o=s(n,e),a=i?e:s(e,n);o.length&&this.updateHoverStyle(o,r.mode,!1),a.length&&r.mode&&this.updateHoverStyle(a,r.mode,!0)}_eventHandler(e,n){const i={event:e,replay:n,cancelable:!0,inChartArea:this.isPointInArea(e)},r=o=>(o.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",i,r)===!1)return;const s=this._handleEvent(e,n,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,r),(s||i.changed)&&this.render(),this}_handleEvent(e,n,i){const{_active:r=[],options:s}=this,o=n,a=this._getActiveElements(e,r,i,o),l=Dx(e),u=Cb(e,this._lastEvent,i,l);i&&(this._lastEvent=null,re(s.onHover,[e,a,this],this),l&&re(s.onClick,[e,a,this],this));const c=!Ao(a,r);return(c||n)&&(this._active=a,this._updateHoverStyles(a,r,n)),this._lastEvent=u,c}_getActiveElements(e,n,i,r){if(e.type==="mouseout")return[];if(!i)return n;const s=this.options.hover;return this.getElementsAtEventForMode(e,s.mode,s,r)}},I(Vt,"defaults",ue),I(Vt,"instances",oo),I(Vt,"overrides",Hn),I(Vt,"registry",kt),I(Vt,"version",xb),I(Vt,"getChart",of),Vt);function af(){return V(ga.instances,t=>t._plugins.invalidate())}function Bm(t,e,n=e){t.lineCap=H(n.borderCapStyle,e.borderCapStyle),t.setLineDash(H(n.borderDash,e.borderDash)),t.lineDashOffset=H(n.borderDashOffset,e.borderDashOffset),t.lineJoin=H(n.borderJoinStyle,e.borderJoinStyle),t.lineWidth=H(n.borderWidth,e.borderWidth),t.strokeStyle=H(n.borderColor,e.borderColor)}function Pb(t,e,n){t.lineTo(n.x,n.y)}function Tb(t){return t.stepped?u1:t.tension||t.cubicInterpolationMode==="monotone"?c1:Pb}function Vm(t,e,n={}){const i=t.length,{start:r=0,end:s=i-1}=n,{start:o,end:a}=e,l=Math.max(r,o),u=Math.min(s,a),c=ra&&s>a;return{count:i,start:l,loop:e.loop,ilen:u(o+(u?a-w:w))%s,_=()=>{y!==v&&(t.lineTo(c,v),t.lineTo(c,y),t.lineTo(c,p))};for(l&&(f=r[g(0)],t.moveTo(f.x,f.y)),d=0;d<=a;++d){if(f=r[g(d)],f.skip)continue;const w=f.x,x=f.y,b=w|0;b===m?(xv&&(v=x),c=(h*c+w)/++h):(_(),t.lineTo(w,x),m=b,h=0,y=v=x),p=x}_()}function fu(t){const e=t.options,n=e.borderDash&&e.borderDash.length;return!t._decimated&&!t._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!n?Lb:Ob}function Mb(t){return t.stepped?V1:t.tension||t.cubicInterpolationMode==="monotone"?W1:Ln}function Rb(t,e,n,i){let r=e._path;r||(r=e._path=new Path2D,e.path(r,n,i)&&r.closePath()),Bm(t,e.options),t.stroke(r)}function Ib(t,e,n,i){const{segments:r,options:s}=e,o=fu(e);for(const a of r)Bm(t,s,a.style),t.beginPath(),o(t,e,a,{start:n,end:n+i-1})&&t.closePath(),t.stroke()}const Ab=typeof Path2D=="function";function Db(t,e,n,i){Ab&&!e.options.segment?Rb(t,e,n,i):Ib(t,e,n,i)}class cr extends Kn{constructor(e){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,e&&Object.assign(this,e)}updateControlPoints(e,n){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const r=i.spanGaps?this._loop:this._fullLoop;D1(this._points,i,e,r,n),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=ek(this,this.options.segment))}first(){const e=this.segments,n=this.points;return e.length&&n[e[0].start]}last(){const e=this.segments,n=this.points,i=e.length;return i&&n[e[i-1].end]}interpolate(e,n){const i=this.options,r=e[n],s=this.points,o=X1(this,{property:n,start:r,end:r});if(!o.length)return;const a=[],l=Mb(i);let u,c;for(u=0,c=o.length;ue!=="borderDash"&&e!=="fill"});function lf(t,e,n,i){const r=t.options,{[n]:s}=t.getProps([n],i);return Math.abs(e-s)a+l)/i.size,y:r/s}},nearest(t,e){if(!t.length)return!1;let n=e.x,i=e.y,r=Number.POSITIVE_INFINITY,s,o,a;for(s=0,o=t.length;s-1?t.split(` -`):t}function jb(t,e){const{element:n,datasetIndex:i,index:r}=e,s=t.getDatasetMeta(i).controller,{label:o,value:a}=s.getLabelAndValue(r);return{chart:t,label:o,parsed:s.getParsed(r),raw:t.data.datasets[i].data[r],formattedValue:a,dataset:s.getDataset(),dataIndex:r,datasetIndex:i,element:n}}function uf(t,e){const n=t.chart.ctx,{body:i,footer:r,title:s}=t,{boxWidth:o,boxHeight:a}=e,l=Ke(e.bodyFont),u=Ke(e.titleFont),c=Ke(e.footerFont),h=s.length,d=r.length,f=i.length,m=ot(e.padding);let y=m.height,v=0,p=i.reduce((w,x)=>w+x.before.length+x.lines.length+x.after.length,0);if(p+=t.beforeBody.length+t.afterBody.length,h&&(y+=h*u.lineHeight+(h-1)*e.titleSpacing+e.titleMarginBottom),p){const w=e.displayColors?Math.max(a,l.lineHeight):l.lineHeight;y+=f*w+(p-f)*l.lineHeight+(p-1)*e.bodySpacing}d&&(y+=e.footerMarginTop+d*c.lineHeight+(d-1)*e.footerSpacing);let g=0;const _=function(w){v=Math.max(v,n.measureText(w).width+g)};return n.save(),n.font=u.string,V(t.title,_),n.font=l.string,V(t.beforeBody.concat(t.afterBody),_),g=e.displayColors?o+2+e.boxPadding:0,V(i,w=>{V(w.before,_),V(w.lines,_),V(w.after,_)}),g=0,n.font=c.string,V(t.footer,_),n.restore(),v+=m.width,{width:v,height:y}}function Nb(t,e){const{y:n,height:i}=e;return nt.height-i/2?"bottom":"center"}function Fb(t,e,n,i){const{x:r,width:s}=i,o=n.caretSize+n.caretPadding;if(t==="left"&&r+s+o>e.width||t==="right"&&r-s-o<0)return!0}function zb(t,e,n,i){const{x:r,width:s}=n,{width:o,chartArea:{left:a,right:l}}=t;let u="center";return i==="center"?u=r<=(a+l)/2?"left":"right":r<=s/2?u="left":r>=o-s/2&&(u="right"),Fb(u,t,e,n)&&(u="center"),u}function cf(t,e,n){const i=n.yAlign||e.yAlign||Nb(t,n);return{xAlign:n.xAlign||e.xAlign||zb(t,e,n,i),yAlign:i}}function $b(t,e){let{x:n,width:i}=t;return e==="right"?n-=i:e==="center"&&(n-=i/2),n}function Ub(t,e,n){let{y:i,height:r}=t;return e==="top"?i+=n:e==="bottom"?i-=r+n:i-=r/2,i}function hf(t,e,n,i){const{caretSize:r,caretPadding:s,cornerRadius:o}=t,{xAlign:a,yAlign:l}=n,u=r+s,{topLeft:c,topRight:h,bottomLeft:d,bottomRight:f}=Pr(o);let m=$b(e,a);const y=Ub(e,l,u);return l==="center"?a==="left"?m+=u:a==="right"&&(m-=u):a==="left"?m-=Math.max(c,d)+r:a==="right"&&(m+=Math.max(h,f)+r),{x:nt(m,0,i.width-e.width),y:nt(y,0,i.height-e.height)}}function Bs(t,e,n){const i=ot(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-i.right:t.x+i.left}function df(t){return wt([],Ot(t))}function Bb(t,e,n){return _n(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function ff(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const Wm={beforeTitle:Pt,title(t){if(t.length>0){const e=t[0],n=e.chart.data.labels,i=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(i>0&&e.dataIndex"u"?Wm[e].call(n,i):r}class pu extends Kn{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const n=this.chart,i=this.options.setContext(this.getContext()),r=i.enabled&&n.options.animation&&i.animations,s=new Mm(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(s)),s}getContext(){return this.$context||(this.$context=Bb(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:i}=n,r=Ae(i,"beforeTitle",this,e),s=Ae(i,"title",this,e),o=Ae(i,"afterTitle",this,e);let a=[];return a=wt(a,Ot(r)),a=wt(a,Ot(s)),a=wt(a,Ot(o)),a}getBeforeBody(e,n){return df(Ae(n.callbacks,"beforeBody",this,e))}getBody(e,n){const{callbacks:i}=n,r=[];return V(e,s=>{const o={before:[],lines:[],after:[]},a=ff(i,s);wt(o.before,Ot(Ae(a,"beforeLabel",this,s))),wt(o.lines,Ae(a,"label",this,s)),wt(o.after,Ot(Ae(a,"afterLabel",this,s))),r.push(o)}),r}getAfterBody(e,n){return df(Ae(n.callbacks,"afterBody",this,e))}getFooter(e,n){const{callbacks:i}=n,r=Ae(i,"beforeFooter",this,e),s=Ae(i,"footer",this,e),o=Ae(i,"afterFooter",this,e);let a=[];return a=wt(a,Ot(r)),a=wt(a,Ot(s)),a=wt(a,Ot(o)),a}_createItems(e){const n=this._active,i=this.chart.data,r=[],s=[],o=[];let a=[],l,u;for(l=0,u=n.length;le.filter(c,h,d,i))),e.itemSort&&(a=a.sort((c,h)=>e.itemSort(c,h,i))),V(a,c=>{const h=ff(e.callbacks,c);r.push(Ae(h,"labelColor",this,c)),s.push(Ae(h,"labelPointStyle",this,c)),o.push(Ae(h,"labelTextColor",this,c))}),this.labelColors=r,this.labelPointStyles=s,this.labelTextColors=o,this.dataPoints=a,a}update(e,n){const i=this.options.setContext(this.getContext()),r=this._active;let s,o=[];if(!r.length)this.opacity!==0&&(s={opacity:0});else{const a=hr[i.position].call(this,r,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const l=this._size=uf(this,i),u=Object.assign({},a,l),c=cf(this.chart,i,u),h=hf(i,u,c,this.chart);this.xAlign=c.xAlign,this.yAlign=c.yAlign,s={opacity:1,x:h.x,y:h.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,s&&this._resolveAnimations().update(this,s),e&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(e,n,i,r){const s=this.getCaretPosition(e,i,r);n.lineTo(s.x1,s.y1),n.lineTo(s.x2,s.y2),n.lineTo(s.x3,s.y3)}getCaretPosition(e,n,i){const{xAlign:r,yAlign:s}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:l,topRight:u,bottomLeft:c,bottomRight:h}=Pr(a),{x:d,y:f}=e,{width:m,height:y}=n;let v,p,g,_,w,x;return s==="center"?(w=f+y/2,r==="left"?(v=d,p=v-o,_=w+o,x=w-o):(v=d+m,p=v+o,_=w-o,x=w+o),g=v):(r==="left"?p=d+Math.max(l,c)+o:r==="right"?p=d+m-Math.max(u,h)-o:p=this.caretX,s==="top"?(_=f,w=_-o,v=p-o,g=p+o):(_=f+y,w=_+o,v=p+o,g=p-o),x=_),{x1:v,x2:p,x3:g,y1:_,y2:w,y3:x}}drawTitle(e,n,i){const r=this.title,s=r.length;let o,a,l;if(s){const u=Za(i.rtl,this.x,this.width);for(e.x=Bs(this,i.titleAlign,i),n.textAlign=u.textAlign(i.titleAlign),n.textBaseline="middle",o=Ke(i.titleFont),a=i.titleSpacing,n.fillStyle=i.titleColor,n.font=o.string,l=0;lg!==0)?(e.beginPath(),e.fillStyle=s.multiKeyBackground,cu(e,{x:y,y:m,w:u,h:l,radius:p}),e.fill(),e.stroke(),e.fillStyle=o.backgroundColor,e.beginPath(),cu(e,{x:v,y:m+1,w:u-2,h:l-2,radius:p}),e.fill()):(e.fillStyle=s.multiKeyBackground,e.fillRect(y,m,u,l),e.strokeRect(y,m,u,l),e.fillStyle=o.backgroundColor,e.fillRect(v,m+1,u-2,l-2))}e.fillStyle=this.labelTextColors[i]}drawBody(e,n,i){const{body:r}=this,{bodySpacing:s,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:u,boxPadding:c}=i,h=Ke(i.bodyFont);let d=h.lineHeight,f=0;const m=Za(i.rtl,this.x,this.width),y=function(S){n.fillText(S,m.x(e.x+f),e.y+d/2),e.y+=d+s},v=m.textAlign(o);let p,g,_,w,x,b,k;for(n.textAlign=o,n.textBaseline="middle",n.font=h.string,e.x=Bs(this,v,i),n.fillStyle=i.bodyColor,V(this.beforeBody,y),f=a&&v!=="right"?o==="center"?u/2+c:u+2+c:0,w=0,b=r.length;w0&&n.stroke()}_updateAnimationTarget(e){const n=this.chart,i=this.$animations,r=i&&i.x,s=i&&i.y;if(r||s){const o=hr[e.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=uf(this,e),l=Object.assign({},o,this._size),u=cf(n,e,l),c=hf(e,l,u,n);(r._to!==c.x||s._to!==c.y)&&(this.xAlign=u.xAlign,this.yAlign=u.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(e){const n=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(n);const r={width:this.width,height:this.height},s={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=ot(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(e.save(),e.globalAlpha=i,this.drawBackground(s,e,r,n),Y1(e,n.textDirection),s.y+=o.top,this.drawTitle(s,e,n),this.drawBody(s,e,n),this.drawFooter(s,e,n),G1(e,n.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,n){const i=this._active,r=e.map(({datasetIndex:a,index:l})=>{const u=this.chart.getDatasetMeta(a);if(!u)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:u.data[l],index:l}}),s=!Ao(i,r),o=this._positionChanged(r,n);(s||o)&&(this._active=r,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,n,i=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const r=this.options,s=this._active||[],o=this._getActiveElements(e,s,n,i),a=this._positionChanged(o,e),l=n||!Ao(o,s)||a;return l&&(this._active=o,(r.enabled||r.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,n))),l}_getActiveElements(e,n,i,r){const s=this.options;if(e.type==="mouseout")return[];if(!r)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const o=this.chart.getElementsAtEventForMode(e,s.mode,s,i);return s.reverse&&o.reverse(),o}_positionChanged(e,n){const{caretX:i,caretY:r,options:s}=this,o=hr[s.position].call(this,e,n);return o!==!1&&(i!==o.x||r!==o.y)}}I(pu,"positioners",hr);var Vb={id:"tooltip",_element:pu,positioners:hr,afterInit(t,e,n){n&&(t.tooltip=new pu({chart:t,options:n}))},beforeUpdate(t,e,n){t.tooltip&&t.tooltip.initialize(n)},reset(t,e,n){t.tooltip&&t.tooltip.initialize(n)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const n={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",n)}},afterEvent(t,e){if(t.tooltip){const n=e.replay;t.tooltip.handleEvent(e.event,n,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Wm},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Wb=(t,e,n,i)=>(typeof e=="string"?(n=t.push(e)-1,i.unshift({index:n,label:e})):isNaN(e)&&(n=null),n);function Hb(t,e,n,i){const r=t.indexOf(e);if(r===-1)return Wb(t,e,n,i);const s=t.lastIndexOf(e);return r!==s?n:r}const Kb=(t,e)=>t===null?null:nt(Math.round(t),0,e);function pf(t){const e=this.getLabels();return t>=0&&tn.length-1?null:this.getPixelForValue(n[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}I(gu,"id","category"),I(gu,"defaults",{ticks:{callback:pf}});function Yb(t,e){const n=[],{bounds:r,step:s,min:o,max:a,precision:l,count:u,maxTicks:c,maxDigits:h,includeBounds:d}=t,f=s||1,m=c-1,{min:y,max:v}=e,p=!J(o),g=!J(a),_=!J(u),w=(v-y)/(h+1);let x=_d((v-y)/m/f)*f,b,k,S,M;if(x<1e-14&&!p&&!g)return[{value:y},{value:v}];M=Math.ceil(v/x)-Math.floor(y/x),M>m&&(x=_d(M*x/m/f)*f),J(l)||(b=Math.pow(10,l),x=Math.ceil(x*b)/b),r==="ticks"?(k=Math.floor(y/x)*x,S=Math.ceil(v/x)*x):(k=y,S=v),p&&g&&s&&zx((a-o)/s,x/1e3)?(M=Math.round(Math.min((a-o)/x,c)),x=(a-o)/M,k=o,S=a):_?(k=p?o:k,S=g?a:S,M=u-1,x=(S-k)/M):(M=(S-k)/x,Sr(M,Math.round(M),x/1e3)?M=Math.round(M):M=Math.ceil(M));const L=Math.max(wd(x),wd(k));b=Math.pow(10,J(l)?L:l),k=Math.round(k*b)/b,S=Math.round(S*b)/b;let D=0;for(p&&(d&&k!==o?(n.push({value:o}),ka)break;n.push({value:B})}return g&&d&&S!==a?n.length&&Sr(n[n.length-1].value,a,gf(a,w,t))?n[n.length-1].value=a:n.push({value:a}):(!g||S===a)&&n.push({value:S}),n}function gf(t,e,{horizontal:n,minRotation:i}){const r=nn(i),s=(n?Math.sin(r):Math.cos(r))||.001,o=.75*e*(""+t).length;return Math.min(e/s,o)}class Vo extends Qn{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,n){return J(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:n,maxDefined:i}=this.getUserBounds();let{min:r,max:s}=this;const o=l=>r=n?r:l,a=l=>s=i?s:l;if(e){const l=Ii(r),u=Ii(s);l<0&&u<0?a(0):l>0&&u>0&&o(0)}if(r===s){let l=s===0?1:Math.abs(s*.05);a(s+l),e||o(r-l)}this.min=r,this.max=s}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:n,stepSize:i}=e,r;return i?(r=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,r>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${r} ticks. Limiting to 1000.`),r=1e3)):(r=this.computeTickLimit(),n=n||11),n&&(r=Math.min(n,r)),r}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,n=e.ticks;let i=this.getTickLimit();i=Math.max(2,i);const r={maxTicks:i,bounds:e.bounds,min:e.min,max:e.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},s=this._range||this,o=Yb(r,s);return e.bounds==="ticks"&&mm(o,this,"value"),e.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const e=this.ticks;let n=this.min,i=this.max;if(super.configure(),this.options.offset&&e.length){const r=(i-n)/Math.max(e.length-1,1)/2;n-=r,i+=r}this._startValue=n,this._endValue=i,this._valueRange=i-n}getLabelForValue(e){return Ec(e,this.chart.options.locale,this.options.ticks.format)}}class mu extends Vo{determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=ye(e)?e:0,this.max=ye(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),n=e?this.width:this.height,i=nn(this.options.ticks.minRotation),r=(e?Math.sin(i):Math.cos(i))||.001,s=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,s.lineHeight/r))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}I(mu,"id","linear"),I(mu,"defaults",{ticks:{callback:fa.formatters.numeric}});const Zr=t=>Math.floor(tn(t)),Cn=(t,e)=>Math.pow(10,Zr(t)+e);function mf(t){return t/Math.pow(10,Zr(t))===1}function yf(t,e,n){const i=Math.pow(10,n),r=Math.floor(t/i);return Math.ceil(e/i)-r}function Gb(t,e){const n=e-t;let i=Zr(n);for(;yf(t,e,i)>10;)i++;for(;yf(t,e,i)<10;)i--;return Math.min(i,Zr(t))}function qb(t,{min:e,max:n}){e=Be(t.min,e);const i=[],r=Zr(e);let s=Gb(e,n),o=s<0?Math.pow(10,Math.abs(s)):1;const a=Math.pow(10,s),l=r>s?Math.pow(10,r):0,u=Math.round((e-l)*o)/o,c=Math.floor((e-l)/a/10)*a*10;let h=Math.floor((u-c)/Math.pow(10,s)),d=Be(t.min,Math.round((l+c+h*Math.pow(10,s))*o)/o);for(;d=10?h=h<15?15:20:h++,h>=20&&(s++,h=2,o=s>=0?1:o),d=Math.round((l+c+h*Math.pow(10,s))*o)/o;const f=Be(t.max,d);return i.push({value:f,major:mf(f),significand:h}),i}class vf extends Qn{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,n){const i=Vo.prototype.parse.apply(this,[e,n]);if(i===0){this._zero=!0;return}return ye(i)&&i>0?i:null}determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=ye(e)?Math.max(0,e):null,this.max=ye(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!ye(this._userMin)&&(this.min=e===Cn(this.min,0)?Cn(this.min,-1):Cn(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:e,maxDefined:n}=this.getUserBounds();let i=this.min,r=this.max;const s=a=>i=e?i:a,o=a=>r=n?r:a;i===r&&(i<=0?(s(1),o(10)):(s(Cn(i,-1)),o(Cn(r,1)))),i<=0&&s(Cn(r,-1)),r<=0&&o(Cn(i,1)),this.min=i,this.max=r}buildTicks(){const e=this.options,n={min:this._userMin,max:this._userMax},i=qb(n,this);return e.bounds==="ticks"&&mm(i,this,"value"),e.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(e){return e===void 0?"0":Ec(e,this.chart.options.locale,this.options.ticks.format)}configure(){const e=this.min;super.configure(),this._startValue=tn(e),this._valueRange=tn(this.max)-tn(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(tn(e)-this._startValue)/this._valueRange)}getValueForPixel(e){const n=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+n*this._valueRange)}}I(vf,"id","logarithmic"),I(vf,"defaults",{ticks:{callback:fa.formatters.logarithmic,major:{enabled:!0}}});function yu(t){const e=t.ticks;if(e.display&&t.display){const n=ot(e.backdropPadding);return H(e.font&&e.font.size,ue.font.size)+n.height}return 0}function Qb(t,e,n){return n=le(n)?n:[n],{w:a1(t,e.string,n),h:n.length*e.lineHeight}}function _f(t,e,n,i,r){return t===i||t===r?{start:e-n/2,end:e+n/2}:tr?{start:e-n,end:e}:{start:e,end:e+n}}function Xb(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},n=Object.assign({},e),i=[],r=[],s=t._pointLabels.length,o=t.options.pointLabels,a=o.centerPointLabels?_e/s:0;for(let l=0;le.r&&(a=(i.end-e.r)/s,t.r=Math.max(t.r,e.r+a)),r.starte.b&&(l=(r.end-e.b)/o,t.b=Math.max(t.b,e.b+l))}function Zb(t,e,n){const i=t.drawingArea,{extra:r,additionalAngle:s,padding:o,size:a}=n,l=t.getPointPosition(e,i+r+o,s),u=Math.round(bc(dt(l.angle+He))),c=rS(l.y,a.h,u),h=nS(u),d=iS(l.x,a.w,h);return{visible:!0,x:l.x,y:c,textAlign:h,left:d,top:c,right:d+a.w,bottom:c+a.h}}function eS(t,e){if(!e)return!0;const{left:n,top:i,right:r,bottom:s}=t;return!(Dt({x:n,y:i},e)||Dt({x:n,y:s},e)||Dt({x:r,y:i},e)||Dt({x:r,y:s},e))}function tS(t,e,n){const i=[],r=t._pointLabels.length,s=t.options,{centerPointLabels:o,display:a}=s.pointLabels,l={extra:yu(s)/2,additionalAngle:o?_e/r:0};let u;for(let c=0;c270||n<90)&&(t-=e),t}function sS(t,e,n){const{left:i,top:r,right:s,bottom:o}=n,{backdropColor:a}=e;if(!J(a)){const l=Pr(e.borderRadius),u=ot(e.backdropPadding);t.fillStyle=a;const c=i-u.left,h=r-u.top,d=s-i+u.width,f=o-r+u.height;Object.values(l).some(m=>m!==0)?(t.beginPath(),cu(t,{x:c,y:h,w:d,h:f,radius:l}),t.fill()):t.fillRect(c,h,d,f)}}function oS(t,e){const{ctx:n,options:{pointLabels:i}}=t;for(let r=e-1;r>=0;r--){const s=t._pointLabelItems[r];if(!s.visible)continue;const o=i.setContext(t.getPointLabelContext(r));sS(n,o,s);const a=Ke(o.font),{x:l,y:u,textAlign:c}=s;$o(n,t._pointLabels[r],l,u+a.lineHeight/2,a,{color:o.color,textAlign:c,textBaseline:"middle"})}}function Hm(t,e,n,i){const{ctx:r}=t;if(n)r.arc(t.xCenter,t.yCenter,e,0,mt);else{let s=t.getPointPosition(0,e);r.moveTo(s.x,s.y);for(let o=1;o{const r=re(this.options.pointLabels.callback,[n,i],this);return r||r===0?r:""}).filter((n,i)=>this.chart.getDataVisibility(i))}fit(){const e=this.options;e.display&&e.pointLabels.display?Xb(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,n,i,r){this.xCenter+=Math.floor((e-n)/2),this.yCenter+=Math.floor((i-r)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,n,i,r))}getIndexAngle(e){const n=mt/(this._pointLabels.length||1),i=this.options.startAngle||0;return dt(e*n+nn(i))}getDistanceFromCenterForValue(e){if(J(e))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*n:(e-this.min)*n}getValueForDistanceFromCenter(e){if(J(e))return NaN;const n=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(e){const n=this._pointLabels||[];if(e>=0&&e{if(h!==0||h===0&&this.min<0){l=this.getDistanceFromCenterForValue(c.value);const d=this.getContext(h),f=r.setContext(d),m=s.setContext(d);aS(this,f,l,o,m)}}),i.display){for(e.save(),a=o-1;a>=0;a--){const c=i.setContext(this.getPointLabelContext(a)),{color:h,lineWidth:d}=c;!d||!h||(e.lineWidth=d,e.strokeStyle=h,e.setLineDash(c.borderDash),e.lineDashOffset=c.borderDashOffset,l=this.getDistanceFromCenterForValue(n.ticks.reverse?this.min:this.max),u=this.getPointPosition(a,l),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(u.x,u.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){const e=this.ctx,n=this.options,i=n.ticks;if(!i.display)return;const r=this.getIndexAngle(0);let s,o;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(r),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!n.reverse)return;const u=i.setContext(this.getContext(l)),c=Ke(u.font);if(s=this.getDistanceFromCenterForValue(this.ticks[l].value),u.showLabelBackdrop){e.font=c.string,o=e.measureText(a.label).width,e.fillStyle=u.backdropColor;const h=ot(u.backdropPadding);e.fillRect(-o/2-h.left,-s-c.size/2-h.top,o+h.width,c.size+h.height)}$o(e,a.label,0,-s,c,{color:u.color,strokeColor:u.textStrokeColor,strokeWidth:u.textStrokeWidth})}),e.restore()}drawTitle(){}}I(Vs,"id","radialLinear"),I(Vs,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:fa.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}}),I(Vs,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),I(Vs,"descriptors",{angleLines:{_fallback:"grid"}});const ma={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}},je=Object.keys(ma);function wf(t,e){return t-e}function xf(t,e){if(J(e))return null;const n=t._adapter,{parser:i,round:r,isoWeekday:s}=t._parseOpts;let o=e;return typeof i=="function"&&(o=i(o)),ye(o)||(o=typeof i=="string"?n.parse(o,i):n.parse(o)),o===null?null:(r&&(o=r==="week"&&(Xr(s)||s===!0)?n.startOf(o,"isoWeek",s):n.startOf(o,r)),+o)}function kf(t,e,n,i){const r=je.length;for(let s=je.indexOf(t);s=je.indexOf(n);s--){const o=je[s];if(ma[o].common&&t._adapter.diff(r,i,o)>=e-1)return o}return je[n?je.indexOf(n):0]}function cS(t){for(let e=je.indexOf(t)+1,n=je.length;e=e?n[i]:n[r];t[s]=!0}}function hS(t,e,n,i){const r=t._adapter,s=+r.startOf(e[0].value,i),o=e[e.length-1].value;let a,l;for(a=s;a<=o;a=+r.add(a,1,i))l=n[a],l>=0&&(e[l].major=!0);return e}function Sf(t,e,n){const i=[],r={},s=e.length;let o,a;for(o=0;o+e.value))}initOffsets(e=[]){let n=0,i=0,r,s;this.options.offset&&e.length&&(r=this.getDecimalForValue(e[0]),e.length===1?n=1-r:n=(this.getDecimalForValue(e[1])-r)/2,s=this.getDecimalForValue(e[e.length-1]),e.length===1?i=s:i=(s-this.getDecimalForValue(e[e.length-2]))/2);const o=e.length<3?.5:.25;n=nt(n,0,o),i=nt(i,0,o),this._offsets={start:n,end:i,factor:1/(n+1+i)}}_generate(){const e=this._adapter,n=this.min,i=this.max,r=this.options,s=r.time,o=s.unit||kf(s.minUnit,n,i,this._getLabelCapacity(n)),a=H(r.ticks.stepSize,1),l=o==="week"?s.isoWeekday:!1,u=Xr(l)||l===!0,c={};let h=n,d,f;if(u&&(h=+e.startOf(h,"isoWeek",l)),h=+e.startOf(h,u?"day":o),e.diff(i,n,o)>1e5*a)throw new Error(n+" and "+i+" are too far apart with stepSize of "+a+" "+o);const m=r.ticks.source==="data"&&this.getDataTimestamps();for(d=h,f=0;d+y)}getLabelForValue(e){const n=this._adapter,i=this.options.time;return i.tooltipFormat?n.format(e,i.tooltipFormat):n.format(e,i.displayFormats.datetime)}format(e,n){const r=this.options.time.displayFormats,s=this._unit,o=n||r[s];return this._adapter.format(e,o)}_tickFormatFunction(e,n,i,r){const s=this.options,o=s.ticks.callback;if(o)return re(o,[e,n,i],this);const a=s.time.displayFormats,l=this._unit,u=this._majorUnit,c=l&&a[l],h=u&&a[u],d=i[n],f=u&&h&&d&&d.major;return this._adapter.format(e,r||(f?h:c))}generateTickLabels(e){let n,i,r;for(n=0,i=e.length;n0?a:1}getDataTimestamps(){let e=this._cache.data||[],n,i;if(e.length)return e;const r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(n=0,i=r.length;n=t[i].pos&&e<=t[r].pos&&({lo:i,hi:r}=Dn(t,"pos",e)),{pos:s,time:a}=t[i],{pos:o,time:l}=t[r]):(e>=t[i].time&&e<=t[r].time&&({lo:i,hi:r}=Dn(t,"time",e)),{time:s,pos:a}=t[i],{time:o,pos:l}=t[r]);const u=o-s;return u?a+(l-a)*(e-s)/u:a}class Cf extends Wo{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(e);this._minPos=Ws(n,this.min),this._tableRange=Ws(n,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:n,max:i}=this,r=[],s=[];let o,a,l,u,c;for(o=0,a=e.length;o=n&&u<=i&&r.push(u);if(r.length<2)return[{time:n,pos:0},{time:i,pos:1}];for(o=0,a=r.length;or-s)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const n=this.getDataTimestamps(),i=this.getLabelTimestamps();return n.length&&i.length?e=this.normalize(n.concat(i)):e=n.length?n:i,e=this._cache.all=e,e}getDecimalForValue(e){return(Ws(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const n=this._offsets,i=this.getDecimalForPixel(e)/n.factor-n.end;return Ws(this._table,i*this._tableRange+this._minPos,!0)}}I(Cf,"id","timeseries"),I(Cf,"defaults",Wo.defaults);const Km="label";function Ef(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function dS(t,e){const n=t.options;n&&e&&Object.assign(n,e)}function Ym(t,e){t.labels=e}function Gm(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Km;const i=[];t.datasets=e.map(r=>{const s=t.datasets.find(o=>o[n]===r[n]);return!s||!r.data||i.includes(s)?{...r}:(i.push(s),Object.assign(s,r),s)})}function fS(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Km;const n={labels:[],datasets:[]};return Ym(n,t.labels),Gm(n,t.datasets,e),n}function pS(t,e){const{height:n=150,width:i=300,redraw:r=!1,datasetIdKey:s,type:o,data:a,options:l,plugins:u=[],fallbackContent:c,updateMode:h,...d}=t,f=E.useRef(null),m=E.useRef(),y=()=>{f.current&&(m.current=new ga(f.current,{type:o,data:fS(a,s),options:l&&{...l},plugins:u}),Ef(e,m.current))},v=()=>{Ef(e,null),m.current&&(m.current.destroy(),m.current=null)};return E.useEffect(()=>{!r&&m.current&&l&&dS(m.current,l)},[r,l]),E.useEffect(()=>{!r&&m.current&&Ym(m.current.config.data,a.labels)},[r,a.labels]),E.useEffect(()=>{!r&&m.current&&a.datasets&&Gm(m.current.config.data,a.datasets,s)},[r,a.datasets]),E.useEffect(()=>{m.current&&(r?(v(),setTimeout(y)):m.current.update(h))},[r,l,a.labels,a.datasets,h]),E.useEffect(()=>{m.current&&(v(),setTimeout(y))},[o]),E.useEffect(()=>(y(),()=>v()),[]),Ni.createElement("canvas",Object.assign({ref:f,role:"img",height:n,width:i},d),c)}const gS=E.forwardRef(pS);function mS(t,e){return ga.register(e),E.forwardRef((n,i)=>Ni.createElement(gS,Object.assign({},n,{ref:i,type:t})))}const yS=mS("line",ro);ga.register(gu,mu,ao,cr,Vb);function Pf(){const t={responsive:!0,scales:{x:{grid:{display:!1}},y:{ticks:{callback:function(i,r,s){return i+"wps"}},grid:{display:!1}}}},e=["January","February","March","April","May","June","July"],n={labels:e,datasets:[{label:"Dataset 1",data:e.map(()=>Math.random()*1e3),borderColor:"rgb(255, 99, 132)",backgroundColor:"rgba(255, 99, 132, 0.5)"},{label:"Dataset 2",data:e.map(()=>Math.random()*1e3),borderColor:"rgb(53, 162, 235)",backgroundColor:"rgba(53, 162, 235, 0.5)"}]};return P.jsxs("div",{children:[P.jsx("p",{className:"text-center",children:"File writes per second"}),P.jsx(yS,{data:n,options:t})]})}function vS(){return P.jsx(P.Fragment,{children:P.jsx("p",{children:"TODO"})})}function _S(t){const e=ca(),[n,i]=E.useState([]);E.useEffect(()=>{t.session||e("/login")},[t.session]);const r=E.useCallback(async()=>{const{data:s,error:o}=await t.supabase.from("file").select();if(o){console.error(o);return}i(s.map(a=>a))},[t.supabase]);return E.useEffect(()=>{r()},[]),P.jsx(P.Fragment,{children:P.jsxs("div",{className:"flex h-screen",children:[P.jsx(hm,{}),P.jsx("main",{className:"overflow-y-auto flex flex-col flex-1 mx-5",children:P.jsxs("div",{className:"flex flex-col w-full gap-7 flex-grow",children:[P.jsx("div",{className:"flex flex-row gap-7 flex-grow",children:P.jsx("div",{className:"ml-auto",children:P.jsx(vS,{})})}),P.jsxs("div",{className:"flex flex-row gap-7 flex-grow",children:[P.jsxs("div",{className:"w-1/2 flex flex-col",children:[P.jsx("p",{className:"text-center",children:"Active hosts"}),P.jsx("div",{className:"flex-grow block bg-white-500 border border-gray-200 rounded-lg shadow",children:P.jsxs("ol",{children:[P.jsx("li",{children:"Host 1"}),P.jsx("li",{children:"Host 2"})]})})]}),P.jsx("div",{className:"w-1/2 ml-auto",children:P.jsx(Pf,{})})]}),P.jsxs("div",{className:"flex flex-row gap-7 mb-5 flex-grow",children:[P.jsx("div",{className:"w-1/2 mr-auto",children:P.jsx(Pf,{})}),P.jsxs("div",{className:"w-1/2 flex flex-col",children:[P.jsx("p",{className:"text-center",children:"Most edited files"}),P.jsx("div",{className:"flex-grow block bg-white-500 border border-gray-200 rounded-lg shadow",children:P.jsxs("ol",{children:[P.jsx("li",{children:"File 1"}),P.jsx("li",{children:"File 2"})]})})]})]})]})})]})})}function wS(t={}){const{nonce:e,onScriptLoadSuccess:n,onScriptLoadError:i}=t,[r,s]=E.useState(!1),o=E.useRef(n);o.current=n;const a=E.useRef(i);return a.current=i,E.useEffect(()=>{const l=document.createElement("script");return l.src="https://accounts.google.com/gsi/client",l.async=!0,l.defer=!0,l.nonce=e,l.onload=()=>{var u;s(!0),(u=o.current)===null||u===void 0||u.call(o)},l.onerror=()=>{var u;s(!1),(u=a.current)===null||u===void 0||u.call(a)},document.body.appendChild(l),()=>{document.body.removeChild(l)}},[e]),r}const qm=E.createContext(null);function xS({clientId:t,nonce:e,onScriptLoadSuccess:n,onScriptLoadError:i,children:r}){const s=wS({nonce:e,onScriptLoadSuccess:n,onScriptLoadError:i}),o=E.useMemo(()=>({clientId:t,scriptLoadedSuccessfully:s}),[t,s]);return Ni.createElement(qm.Provider,{value:o},r)}function kS(){const t=E.useContext(qm);if(!t)throw new Error("Google OAuth components must be used within GoogleOAuthProvider");return t}function bS(t){var e;return(e=t==null?void 0:t.clientId)!==null&&e!==void 0?e:t==null?void 0:t.client_id}const SS={large:40,medium:32,small:20};function CS({onSuccess:t,onError:e,useOneTap:n,promptMomentNotification:i,type:r="standard",theme:s="outline",size:o="large",text:a,shape:l,logo_alignment:u,width:c,locale:h,click_listener:d,containerProps:f,...m}){const y=E.useRef(null),{clientId:v,scriptLoadedSuccessfully:p}=kS(),g=E.useRef(t);g.current=t;const _=E.useRef(e);_.current=e;const w=E.useRef(i);return w.current=i,E.useEffect(()=>{var x,b,k,S,M,L,D,B,ce;if(p)return(k=(b=(x=window==null?void 0:window.google)===null||x===void 0?void 0:x.accounts)===null||b===void 0?void 0:b.id)===null||k===void 0||k.initialize({client_id:v,callback:oe=>{var $;if(!(oe!=null&&oe.credential))return($=_.current)===null||$===void 0?void 0:$.call(_);const{credential:K,select_by:ge}=oe;g.current({credential:K,clientId:bS(oe),select_by:ge})},...m}),(L=(M=(S=window==null?void 0:window.google)===null||S===void 0?void 0:S.accounts)===null||M===void 0?void 0:M.id)===null||L===void 0||L.renderButton(y.current,{type:r,theme:s,size:o,text:a,shape:l,logo_alignment:u,width:c,locale:h,click_listener:d}),n&&((ce=(B=(D=window==null?void 0:window.google)===null||D===void 0?void 0:D.accounts)===null||B===void 0?void 0:B.id)===null||ce===void 0||ce.prompt(w.current)),()=>{var oe,$,K;n&&((K=($=(oe=window==null?void 0:window.google)===null||oe===void 0?void 0:oe.accounts)===null||$===void 0?void 0:$.id)===null||K===void 0||K.cancel())}},[v,p,n,r,s,o,a,l,u,c,h]),Ni.createElement("div",{...f,ref:y,style:{height:SS[o],...f==null?void 0:f.style}})}function ES(t){const e=ca();return E.useEffect(()=>{t.supabase.auth.getSession().then(({data:{session:i}})=>{t.setSession(i),console.log("LOGIN SESSION",i)});const{data:{subscription:n}}=t.supabase.auth.onAuthStateChange((i,r)=>{t.setSession(r),console.log("SESSION CHANGE",r)});return()=>n.unsubscribe()},[t.supabase]),E.useEffect(()=>{t.session&&e("/")},[t.session]),P.jsx(P.Fragment,{children:P.jsx("div",{className:"flex flex-col items-center h-screen w-screen",children:P.jsxs("div",{className:"flex flex-row items-center gap-x-8 m-auto",children:[P.jsx("div",{children:P.jsx("h1",{className:"text-4xl text-bold font-sans antialiased text-blue-700 tracking-wide",children:"fs-tracer"})}),P.jsx("div",{className:"block max-w-sm p-6 bg-white border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700",children:P.jsxs("div",{className:"mx-7 my-5",children:[P.jsx("h5",{className:"mb-2 text-2xl font-bold font-sans antialiased text-gray-900",children:"Hello!"}),P.jsxs("div",{className:"flex flex-row items-center gap-2",children:[P.jsx("span",{className:"font-normal text-gray-700 dark:text-gray-400",children:"Continue with"}),P.jsx("span",{children:P.jsx(xS,{clientId:"952965459060-nrnrsdoq22mf646vfa72hk410pvdda5q.apps.googleusercontent.com",children:P.jsx(CS,{onSuccess:async n=>{await t.supabase.auth.signInWithIdToken({provider:"google",token:n.credential})},onError:()=>{console.log("Login Failed")},width:7777,size:"large",type:"icon"})})})]})]})})]})})})}function PS(t){const e=ca();return E.useEffect(()=>{(async()=>{await t.supabase.auth.signOut()})(),e("/login")},[t.session]),P.jsx(P.Fragment,{})}function TS(t){const e=ca(),[n,i]=E.useState([]);E.useEffect(()=>{t.session||e("/login")},[t.session]);const r=E.useCallback(async()=>{const{data:s,error:o}=await t.supabase.from("file").select();if(o){console.error(o);return}i(s.map(a=>a))},[t.supabase]);return E.useEffect(()=>{r()},[]),P.jsx(P.Fragment,{children:P.jsxs("div",{className:"flex h-screen",children:[P.jsx(hm,{}),P.jsx("main",{className:"flex-1 overflow-y-auto",children:P.jsx("div",{children:n.map(s=>P.jsx("div",{children:P.jsxs("p",{className:"underline",children:["file: ",s.absolute_path]})},s.id))})})]})})}function Qm(t,e){window.dispatchEvent(new StorageEvent("storage",{key:t,newValue:e}))}const Tf=(t,e)=>{const n=JSON.stringify(e);window.localStorage.setItem(t,n),Qm(t,n)},OS=t=>{window.localStorage.removeItem(t),Qm(t,null)},Of=t=>window.localStorage.getItem(t),LS=t=>(window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)),MS=()=>{throw Error("useLocalStorage is a client-only hook")};function RS(t,e){const n=()=>Of(t),i=E.useSyncExternalStore(LS,n,MS),r=E.useCallback(s=>{try{const o=typeof s=="function"?s(JSON.parse(i)):s;o==null?OS(t):Tf(t,o)}catch(o){console.warn(o)}},[t,i]);return E.useEffect(()=>{Of(t)===null&&typeof e<"u"&&Tf(t,e)},[t,e]),[i?JSON.parse(i):e,r]}const Hs=ox("https://slpoocycjgqsuoedhkbn.supabase.co","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNscG9vY3ljamdxc3VvZWRoa2JuIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTUyMDU0MjUsImV4cCI6MjAzMDc4MTQyNX0.xZYRTRN65rlms1Hb96IBAQvw3EGtMzUxlGPP5TVey34");function IS(){const[t,e]=RS("session",null);return P.jsx(P.Fragment,{children:P.jsx(__,{basename:"/fs-tracer-frontend",children:P.jsxs(m_,{children:[P.jsx(ii,{index:!0,element:P.jsx(_S,{supabase:Hs,session:t})}),P.jsx(ii,{path:"/recent",element:P.jsx(TS,{supabase:Hs,session:t})}),P.jsx(ii,{path:"/login",element:P.jsx(ES,{supabase:Hs,session:t,setSession:e})}),P.jsx(ii,{path:"/logout",element:P.jsx(PS,{supabase:Hs,session:t,setSession:e})}),P.jsx(ii,{path:"*",element:P.jsx("p",{children:"notfound"})})]})})})}sl.createRoot(document.getElementById("root")).render(P.jsx(Ni.StrictMode,{children:P.jsx(IS,{})}));export{e0 as g}; diff --git a/assets/index-DeaNyDD-.css b/assets/index-DeaNyDD-.css deleted file mode 100644 index bb812ba..0000000 --- a/assets/index-DeaNyDD-.css +++ /dev/null @@ -1 +0,0 @@ -*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.relative{position:relative}.m-auto{margin:auto}.mx-5{margin-left:1.25rem;margin-right:1.25rem}.mx-7{margin-left:1.75rem;margin-right:1.75rem}.my-5{margin-top:1.25rem;margin-bottom:1.25rem}.mb-2{margin-bottom:.5rem}.mb-5{margin-bottom:1.25rem}.ml-auto{margin-left:auto}.mr-4{margin-right:1rem}.mr-auto{margin-right:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.contents{display:contents}.h-full{height:100%}.h-screen{height:100vh}.w-1\/2{width:50%}.w-full{width:100%}.w-screen{width:100vw}.min-w-\[240px\]{min-width:240px}.min-w-full{min-width:100%}.max-w-\[20rem\]{max-width:20rem}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.flex-grow{flex-grow:1}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.place-items-center{place-items:center}.items-center{align-items:center}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-7{gap:1.75rem}.gap-x-8{-moz-column-gap:2rem;column-gap:2rem}.overflow-y-auto{overflow-y:auto}.rounded-lg{border-radius:.5rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-clip-border{background-clip:border-box}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.text-center{text-align:center}.text-start{text-align:start}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-2xl{font-size:1.5rem;line-height:2rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-base{font-size:1rem;line-height:1.5rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-bold{font-weight:700}.font-normal{font-weight:400}.font-semibold{font-weight:600}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-normal{letter-spacing:0em}.tracking-wide{letter-spacing:.025em}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity))}.underline{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.hover\:bg-blue-500:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}@media (prefers-color-scheme: dark){.dark\:border-gray-700{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity))}.dark\:bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity))}.dark\:text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}} diff --git a/assets/index-RT7aBB16.css b/assets/index-RT7aBB16.css new file mode 100644 index 0000000..7795b12 --- /dev/null +++ b/assets/index-RT7aBB16.css @@ -0,0 +1 @@ +*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.relative{position:relative}.m-auto{margin:auto}.mx-5{margin-left:1.25rem;margin-right:1.25rem}.mx-7{margin-left:1.75rem;margin-right:1.75rem}.my-5{margin-top:1.25rem;margin-bottom:1.25rem}.mb-2{margin-bottom:.5rem}.mb-5{margin-bottom:1.25rem}.ml-auto{margin-left:auto}.mr-4{margin-right:1rem}.mr-auto{margin-right:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.contents{display:contents}.h-full{height:100%}.h-screen{height:100vh}.w-1\/2{width:50%}.w-full{width:100%}.w-screen{width:100vw}.min-w-\[240px\]{min-width:240px}.min-w-full{min-width:100%}.max-w-\[20rem\]{max-width:20rem}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.flex-grow{flex-grow:1}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.place-items-center{place-items:center}.items-center{align-items:center}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-7{gap:1.75rem}.gap-x-8{-moz-column-gap:2rem;column-gap:2rem}.overflow-y-auto{overflow-y:auto}.rounded-lg{border-radius:.5rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-black{--tw-border-opacity: 1;border-color:rgb(0 0 0 / var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-clip-border{background-clip:border-box}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.text-center{text-align:center}.text-start{text-align:start}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-2xl{font-size:1.5rem;line-height:2rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-base{font-size:1rem;line-height:1.5rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-bold{font-weight:700}.font-normal{font-weight:400}.font-semibold{font-weight:600}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-normal{letter-spacing:0em}.tracking-wide{letter-spacing:.025em}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity))}.underline{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.hover\:bg-blue-500:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}@media (prefers-color-scheme: dark){.dark\:border-gray-700{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity))}.dark\:bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity))}.dark\:text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}} diff --git a/assets/index-lfXooNgj.js b/assets/index-lfXooNgj.js new file mode 100644 index 0000000..a035353 --- /dev/null +++ b/assets/index-lfXooNgj.js @@ -0,0 +1,84 @@ +var Xm=Object.defineProperty;var Jm=(t,e,n)=>e in t?Xm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var I=(t,e,n)=>(Jm(t,typeof e!="symbol"?e+"":e,n),n);function Zm(t,e){for(var n=0;ni[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();function e0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Lf={exports:{}},Wo={},Mf={exports:{}},N={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var es=Symbol.for("react.element"),t0=Symbol.for("react.portal"),n0=Symbol.for("react.fragment"),i0=Symbol.for("react.strict_mode"),r0=Symbol.for("react.profiler"),s0=Symbol.for("react.provider"),o0=Symbol.for("react.context"),a0=Symbol.for("react.forward_ref"),l0=Symbol.for("react.suspense"),u0=Symbol.for("react.memo"),c0=Symbol.for("react.lazy"),Ic=Symbol.iterator;function h0(t){return t===null||typeof t!="object"?null:(t=Ic&&t[Ic]||t["@@iterator"],typeof t=="function"?t:null)}var Rf={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},If=Object.assign,Af={};function ji(t,e,n){this.props=t,this.context=e,this.refs=Af,this.updater=n||Rf}ji.prototype.isReactComponent={};ji.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};ji.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Df(){}Df.prototype=ji.prototype;function vu(t,e,n){this.props=t,this.context=e,this.refs=Af,this.updater=n||Rf}var _u=vu.prototype=new Df;_u.constructor=vu;If(_u,ji.prototype);_u.isPureReactComponent=!0;var Ac=Array.isArray,jf=Object.prototype.hasOwnProperty,wu={current:null},Nf={key:!0,ref:!0,__self:!0,__source:!0};function Ff(t,e,n){var i,r={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)jf.call(e,i)&&!Nf.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(a===1)r.children=n;else if(1>>1,Q=T[Y];if(0>>1;Yr(Et,A))Oer(ls,Et)?(T[Y]=ls,T[Oe]=A,Y=Oe):(T[Y]=Et,T[Te]=A,Y=Te);else if(Oer(ls,A))T[Y]=ls,T[Oe]=A,Y=Oe;else break e}}return R}function r(T,R){var A=T.sortIndex-R.sortIndex;return A!==0?A:T.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,h=null,d=3,f=!1,m=!1,y=!1,v=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(T){for(var R=n(u);R!==null;){if(R.callback===null)i(u);else if(R.startTime<=T)i(u),R.sortIndex=R.expirationTime,e(l,R);else break;R=n(u)}}function w(T){if(y=!1,_(T),!m)if(n(l)!==null)m=!0,K(x);else{var R=n(u);R!==null&&ge(w,R.startTime-T)}}function x(T,R){m=!1,y&&(y=!1,p(S),S=-1),f=!0;var A=d;try{for(_(R),h=n(l);h!==null&&(!(h.expirationTime>R)||T&&!D());){var Y=h.callback;if(typeof Y=="function"){h.callback=null,d=h.priorityLevel;var Q=Y(h.expirationTime<=R);R=t.unstable_now(),typeof Q=="function"?h.callback=Q:h===n(l)&&i(l),_(R)}else i(l);h=n(l)}if(h!==null)var vt=!0;else{var Te=n(u);Te!==null&&ge(w,Te.startTime-R),vt=!1}return vt}finally{h=null,d=A,f=!1}}var b=!1,k=null,S=-1,M=5,L=-1;function D(){return!(t.unstable_now()-LT||125Y?(T.sortIndex=A,e(u,T),n(l)===null&&T===n(u)&&(y?(p(S),S=-1):y=!0,ge(w,A-Y))):(T.sortIndex=Q,e(l,T),m||f||(m=!0,K(x))),T},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(T){var R=d;return function(){var A=d;d=R;try{return T.apply(this,arguments)}finally{d=A}}}})(Vf);Bf.exports=Vf;var b0=Bf.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var S0=E,Ge=b0;function C(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ol=Object.prototype.hasOwnProperty,C0=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,jc={},Nc={};function E0(t){return ol.call(Nc,t)?!0:ol.call(jc,t)?!1:C0.test(t)?Nc[t]=!0:(jc[t]=!0,!1)}function P0(t,e,n,i){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function T0(t,e,n,i){if(e===null||typeof e>"u"||P0(t,e,n,i))return!0;if(i)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Ie(t,e,n,i,r,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var ke={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){ke[t]=new Ie(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];ke[e]=new Ie(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){ke[t]=new Ie(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){ke[t]=new Ie(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){ke[t]=new Ie(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){ke[t]=new Ie(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){ke[t]=new Ie(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){ke[t]=new Ie(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){ke[t]=new Ie(t,5,!1,t.toLowerCase(),null,!1,!1)});var ku=/[\-:]([a-z])/g;function bu(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(ku,bu);ke[e]=new Ie(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(ku,bu);ke[e]=new Ie(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(ku,bu);ke[e]=new Ie(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){ke[t]=new Ie(t,1,!1,t.toLowerCase(),null,!1,!1)});ke.xlinkHref=new Ie("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){ke[t]=new Ie(t,1,!1,t.toLowerCase(),null,!0,!0)});function Su(t,e,n,i){var r=ke.hasOwnProperty(e)?ke[e]:null;(r!==null?r.type!==0:i||!(2a||r[o]!==s[a]){var l=` +`+r[o].replace(" at new "," at ");return t.displayName&&l.includes("")&&(l=l.replace("",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{_a=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?ir(t):""}function O0(t){switch(t.tag){case 5:return ir(t.type);case 16:return ir("Lazy");case 13:return ir("Suspense");case 19:return ir("SuspenseList");case 0:case 2:case 15:return t=wa(t.type,!1),t;case 11:return t=wa(t.type.render,!1),t;case 1:return t=wa(t.type,!0),t;default:return""}}function cl(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case oi:return"Fragment";case si:return"Portal";case al:return"Profiler";case Cu:return"StrictMode";case ll:return"Suspense";case ul:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Kf:return(t.displayName||"Context")+".Consumer";case Wf:return(t._context.displayName||"Context")+".Provider";case Eu:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Pu:return e=t.displayName||null,e!==null?e:cl(t.type)||"Memo";case Wt:e=t._payload,t=t._init;try{return cl(t(e))}catch{}}return null}function L0(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return cl(e);case 8:return e===Cu?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function fn(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Gf(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function M0(t){var e=Gf(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),i=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function hs(t){t._valueTracker||(t._valueTracker=M0(t))}function qf(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),i="";return t&&(i=Gf(t)?t.checked?"true":"false":t.value),t=i,t!==n?(e.setValue(t),!0):!1}function lo(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function hl(t,e){var n=e.checked;return ie({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function zc(t,e){var n=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;n=fn(e.value!=null?e.value:n),t._wrapperState={initialChecked:i,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Qf(t,e){e=e.checked,e!=null&&Su(t,"checked",e,!1)}function dl(t,e){Qf(t,e);var n=fn(e.value),i=e.type;if(n!=null)i==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(i==="submit"||i==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?fl(t,e.type,n):e.hasOwnProperty("defaultValue")&&fl(t,e.type,fn(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function $c(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function fl(t,e,n){(e!=="number"||lo(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var rr=Array.isArray;function yi(t,e,n,i){if(t=t.options,e){e={};for(var r=0;r"+e.valueOf().toString()+"",e=ds.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Lr(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var dr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},R0=["Webkit","ms","Moz","O"];Object.keys(dr).forEach(function(t){R0.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),dr[e]=dr[t]})});function ep(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||dr.hasOwnProperty(t)&&dr[t]?(""+e).trim():e+"px"}function tp(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var i=n.indexOf("--")===0,r=ep(n,e[n],i);n==="float"&&(n="cssFloat"),i?t.setProperty(n,r):t[n]=r}}var I0=ie({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ml(t,e){if(e){if(I0[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(C(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(C(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(C(61))}if(e.style!=null&&typeof e.style!="object")throw Error(C(62))}}function yl(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var vl=null;function Tu(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var _l=null,vi=null,_i=null;function Vc(t){if(t=is(t)){if(typeof _l!="function")throw Error(C(280));var e=t.stateNode;e&&(e=Qo(e),_l(t.stateNode,t.type,e))}}function np(t){vi?_i?_i.push(t):_i=[t]:vi=t}function ip(){if(vi){var t=vi,e=_i;if(_i=vi=null,Vc(t),e)for(t=0;t>>=0,t===0?32:31-(H0(t)/W0|0)|0}var fs=64,ps=4194304;function sr(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function fo(t,e){var n=t.pendingLanes;if(n===0)return 0;var i=0,r=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~r;a!==0?i=sr(a):(s&=o,s!==0&&(i=sr(s)))}else o=n&~r,o!==0?i=sr(o):s!==0&&(i=sr(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=i;0n;n++)e.push(t);return e}function ts(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-pt(e),t[e]=n}function q0(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var i=t.eventTimes;for(t=t.expirationTimes;0=pr),Jc=" ",Zc=!1;function bp(t,e){switch(t){case"keyup":return by.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Sp(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ai=!1;function Cy(t,e){switch(t){case"compositionend":return Sp(e);case"keypress":return e.which!==32?null:(Zc=!0,Jc);case"textInput":return t=e.data,t===Jc&&Zc?null:t;default:return null}}function Ey(t,e){if(ai)return t==="compositionend"||!ju&&bp(t,e)?(t=xp(),qs=Iu=Xt=null,ai=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ih(n)}}function Tp(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Tp(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Op(){for(var t=window,e=lo();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=lo(t.document)}return e}function Nu(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function Dy(t){var e=Op(),n=t.focusedElem,i=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&Tp(n.ownerDocument.documentElement,n)){if(i!==null&&Nu(n)){if(e=i.start,t=i.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var r=n.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!t.extend&&s>i&&(r=i,i=s,s=r),r=rh(n,s);var o=rh(n,i);r&&o&&(t.rangeCount!==1||t.anchorNode!==r.node||t.anchorOffset!==r.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),t.removeAllRanges(),s>i?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,li=null,Cl=null,mr=null,El=!1;function sh(t,e,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;El||li==null||li!==lo(i)||(i=li,"selectionStart"in i&&Nu(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),mr&&jr(mr,i)||(mr=i,i=mo(Cl,"onSelect"),0hi||(t.current=Rl[hi],Rl[hi]=null,hi--)}function q(t,e){hi++,Rl[hi]=t.current,t.current=e}var pn={},Pe=yn(pn),Fe=yn(!1),$n=pn;function Ci(t,e){var n=t.type.contextTypes;if(!n)return pn;var i=t.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in n)r[s]=e[s];return i&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=r),r}function ze(t){return t=t.childContextTypes,t!=null}function vo(){Z(Fe),Z(Pe)}function dh(t,e,n){if(Pe.current!==pn)throw Error(C(168));q(Pe,e),q(Fe,n)}function Fp(t,e,n){var i=t.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return n;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(C(108,L0(t)||"Unknown",r));return ie({},n,i)}function _o(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||pn,$n=Pe.current,q(Pe,t),q(Fe,Fe.current),!0}function fh(t,e,n){var i=t.stateNode;if(!i)throw Error(C(169));n?(t=Fp(t,e,$n),i.__reactInternalMemoizedMergedChildContext=t,Z(Fe),Z(Pe),q(Pe,t)):Z(Fe),q(Fe,n)}var Mt=null,Xo=!1,Aa=!1;function zp(t){Mt===null?Mt=[t]:Mt.push(t)}function Yy(t){Xo=!0,zp(t)}function vn(){if(!Aa&&Mt!==null){Aa=!0;var t=0,e=H;try{var n=Mt;for(H=1;t>=o,r-=o,It=1<<32-pt(e)+r|n<S?(M=k,k=null):M=k.sibling;var L=d(p,k,_[S],w);if(L===null){k===null&&(k=M);break}t&&k&&L.alternate===null&&e(p,k),g=s(L,g,S),b===null?x=L:b.sibling=L,b=L,k=M}if(S===_.length)return n(p,k),ee&&En(p,S),x;if(k===null){for(;S<_.length;S++)k=h(p,_[S],w),k!==null&&(g=s(k,g,S),b===null?x=k:b.sibling=k,b=k);return ee&&En(p,S),x}for(k=i(p,k);S<_.length;S++)M=f(k,p,S,_[S],w),M!==null&&(t&&M.alternate!==null&&k.delete(M.key===null?S:M.key),g=s(M,g,S),b===null?x=M:b.sibling=M,b=M);return t&&k.forEach(function(D){return e(p,D)}),ee&&En(p,S),x}function y(p,g,_,w){var x=Vi(_);if(typeof x!="function")throw Error(C(150));if(_=x.call(_),_==null)throw Error(C(151));for(var b=x=null,k=g,S=g=0,M=null,L=_.next();k!==null&&!L.done;S++,L=_.next()){k.index>S?(M=k,k=null):M=k.sibling;var D=d(p,k,L.value,w);if(D===null){k===null&&(k=M);break}t&&k&&D.alternate===null&&e(p,k),g=s(D,g,S),b===null?x=D:b.sibling=D,b=D,k=M}if(L.done)return n(p,k),ee&&En(p,S),x;if(k===null){for(;!L.done;S++,L=_.next())L=h(p,L.value,w),L!==null&&(g=s(L,g,S),b===null?x=L:b.sibling=L,b=L);return ee&&En(p,S),x}for(k=i(p,k);!L.done;S++,L=_.next())L=f(k,p,S,L.value,w),L!==null&&(t&&L.alternate!==null&&k.delete(L.key===null?S:L.key),g=s(L,g,S),b===null?x=L:b.sibling=L,b=L);return t&&k.forEach(function(B){return e(p,B)}),ee&&En(p,S),x}function v(p,g,_,w){if(typeof _=="object"&&_!==null&&_.type===oi&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case cs:e:{for(var x=_.key,b=g;b!==null;){if(b.key===x){if(x=_.type,x===oi){if(b.tag===7){n(p,b.sibling),g=r(b,_.props.children),g.return=p,p=g;break e}}else if(b.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===Wt&&mh(x)===b.type){n(p,b.sibling),g=r(b,_.props),g.ref=Gi(p,b,_),g.return=p,p=g;break e}n(p,b);break}else e(p,b);b=b.sibling}_.type===oi?(g=Nn(_.props.children,p.mode,w,_.key),g.return=p,p=g):(w=io(_.type,_.key,_.props,null,p.mode,w),w.ref=Gi(p,g,_),w.return=p,p=w)}return o(p);case si:e:{for(b=_.key;g!==null;){if(g.key===b)if(g.tag===4&&g.stateNode.containerInfo===_.containerInfo&&g.stateNode.implementation===_.implementation){n(p,g.sibling),g=r(g,_.children||[]),g.return=p,p=g;break e}else{n(p,g);break}else e(p,g);g=g.sibling}g=Ba(_,p.mode,w),g.return=p,p=g}return o(p);case Wt:return b=_._init,v(p,g,b(_._payload),w)}if(rr(_))return m(p,g,_,w);if(Vi(_))return y(p,g,_,w);xs(p,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,g!==null&&g.tag===6?(n(p,g.sibling),g=r(g,_),g.return=p,p=g):(n(p,g),g=Ua(_,p.mode,w),g.return=p,p=g),o(p)):n(p,g)}return v}var Pi=Vp(!0),Hp=Vp(!1),ko=yn(null),bo=null,pi=null,Uu=null;function Bu(){Uu=pi=bo=null}function Vu(t){var e=ko.current;Z(ko),t._currentValue=e}function Dl(t,e,n){for(;t!==null;){var i=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),t===n)break;t=t.return}}function xi(t,e){bo=t,Uu=pi=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Ne=!0),t.firstContext=null)}function rt(t){var e=t._currentValue;if(Uu!==t)if(t={context:t,memoizedValue:e,next:null},pi===null){if(bo===null)throw Error(C(308));pi=t,bo.dependencies={lanes:0,firstContext:t}}else pi=pi.next=t;return e}var In=null;function Hu(t){In===null?In=[t]:In.push(t)}function Wp(t,e,n,i){var r=e.interleaved;return r===null?(n.next=n,Hu(e)):(n.next=r.next,r.next=n),e.interleaved=n,zt(t,i)}function zt(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Kt=!1;function Wu(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Kp(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function jt(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function ln(t,e,n){var i=t.updateQueue;if(i===null)return null;if(i=i.shared,z&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,zt(t,n)}return r=i.interleaved,r===null?(e.next=e,Hu(i)):(e.next=r.next,r.next=e),i.interleaved=e,zt(t,n)}function Xs(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,Lu(t,n)}}function yh(t,e){var n=t.updateQueue,i=t.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var r=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?r=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?r=s=e:s=s.next=e}else r=s=e;n={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function So(t,e,n,i){var r=t.updateQueue;Kt=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?s=u:o.next=u,o=l;var c=t.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==o&&(a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l))}if(s!==null){var h=r.baseState;o=0,c=u=l=null,a=s;do{var d=a.lane,f=a.eventTime;if((i&d)===d){c!==null&&(c=c.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=t,y=a;switch(d=e,f=n,y.tag){case 1:if(m=y.payload,typeof m=="function"){h=m.call(f,h,d);break e}h=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=y.payload,d=typeof m=="function"?m.call(f,h,d):m,d==null)break e;h=ie({},h,d);break e;case 2:Kt=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,d=r.effects,d===null?r.effects=[a]:d.push(a))}else f={eventTime:f,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(u=c=f,l=h):c=c.next=f,o|=d;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;d=a,a=d.next,d.next=null,r.lastBaseUpdate=d,r.shared.pending=null}}while(!0);if(c===null&&(l=h),r.baseState=l,r.firstBaseUpdate=u,r.lastBaseUpdate=c,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);Vn|=o,t.lanes=o,t.memoizedState=h}}function vh(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var i=ja.transition;ja.transition={};try{t(!1),e()}finally{H=n,ja.transition=i}}function ug(){return st().memoizedState}function Xy(t,e,n){var i=cn(t);if(n={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null},cg(t))hg(e,n);else if(n=Wp(t,e,n,i),n!==null){var r=Me();gt(n,t,i,r),dg(n,e,i)}}function Jy(t,e,n){var i=cn(t),r={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null};if(cg(t))hg(e,r);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,n);if(r.hasEagerState=!0,r.eagerState=a,yt(a,o)){var l=e.interleaved;l===null?(r.next=r,Hu(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}n=Wp(t,e,r,i),n!==null&&(r=Me(),gt(n,t,i,r),dg(n,e,i))}}function cg(t){var e=t.alternate;return t===ne||e!==null&&e===ne}function hg(t,e){yr=Eo=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function dg(t,e,n){if(n&4194240){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,Lu(t,n)}}var Po={readContext:rt,useCallback:be,useContext:be,useEffect:be,useImperativeHandle:be,useInsertionEffect:be,useLayoutEffect:be,useMemo:be,useReducer:be,useRef:be,useState:be,useDebugValue:be,useDeferredValue:be,useTransition:be,useMutableSource:be,useSyncExternalStore:be,useId:be,unstable_isNewReconciler:!1},Zy={readContext:rt,useCallback:function(t,e){return xt().memoizedState=[t,e===void 0?null:e],t},useContext:rt,useEffect:wh,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Zs(4194308,4,rg.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Zs(4194308,4,t,e)},useInsertionEffect:function(t,e){return Zs(4,2,t,e)},useMemo:function(t,e){var n=xt();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var i=xt();return e=n!==void 0?n(e):e,i.memoizedState=i.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},i.queue=t,t=t.dispatch=Xy.bind(null,ne,t),[i.memoizedState,t]},useRef:function(t){var e=xt();return t={current:t},e.memoizedState=t},useState:_h,useDebugValue:Zu,useDeferredValue:function(t){return xt().memoizedState=t},useTransition:function(){var t=_h(!1),e=t[0];return t=Qy.bind(null,t[1]),xt().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var i=ne,r=xt();if(ee){if(n===void 0)throw Error(C(407));n=n()}else{if(n=e(),ve===null)throw Error(C(349));Bn&30||Qp(i,e,n)}r.memoizedState=n;var s={value:n,getSnapshot:e};return r.queue=s,wh(Jp.bind(null,i,s,t),[t]),i.flags|=2048,Hr(9,Xp.bind(null,i,s,n,e),void 0,null),n},useId:function(){var t=xt(),e=ve.identifierPrefix;if(ee){var n=At,i=It;n=(i&~(1<<32-pt(i)-1)).toString(32)+n,e=":"+e+"R"+n,n=Br++,0<\/script>",t=t.removeChild(t.firstChild)):typeof i.is=="string"?t=o.createElement(n,{is:i.is}):(t=o.createElement(n),n==="select"&&(o=t,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):t=o.createElementNS(t,n),t[bt]=e,t[zr]=i,kg(t,e,!1,!1),e.stateNode=t;e:{switch(o=yl(n,i),n){case"dialog":X("cancel",t),X("close",t),r=i;break;case"iframe":case"object":case"embed":X("load",t),r=i;break;case"video":case"audio":for(r=0;rLi&&(e.flags|=128,i=!0,qi(s,!1),e.lanes=4194304)}else{if(!i)if(t=Co(o),t!==null){if(e.flags|=128,i=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),qi(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!ee)return Se(e),null}else 2*ae()-s.renderingStartTime>Li&&n!==1073741824&&(e.flags|=128,i=!0,qi(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=ae(),e.sibling=null,n=te.current,q(te,i?n&1|2:n&1),e):(Se(e),null);case 22:case 23:return sc(),i=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?Ve&1073741824&&(Se(e),e.subtreeFlags&6&&(e.flags|=8192)):Se(e),null;case 24:return null;case 25:return null}throw Error(C(156,e.tag))}function av(t,e){switch(zu(e),e.tag){case 1:return ze(e.type)&&vo(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ti(),Z(Fe),Z(Pe),Gu(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Yu(e),null;case 13:if(Z(te),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(C(340));Ei()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Z(te),null;case 4:return Ti(),null;case 10:return Vu(e.type._context),null;case 22:case 23:return sc(),null;case 24:return null;default:return null}}var bs=!1,Ee=!1,lv=typeof WeakSet=="function"?WeakSet:Set,O=null;function gi(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(i){se(t,e,i)}else n.current=null}function Hl(t,e,n){try{n()}catch(i){se(t,e,i)}}var Mh=!1;function uv(t,e){if(Pl=po,t=Op(),Nu(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,u=0,c=0,h=t,d=null;t:for(;;){for(var f;h!==n||r!==0&&h.nodeType!==3||(a=o+r),h!==s||i!==0&&h.nodeType!==3||(l=o+i),h.nodeType===3&&(o+=h.nodeValue.length),(f=h.firstChild)!==null;)d=h,h=f;for(;;){if(h===t)break t;if(d===n&&++u===r&&(a=o),d===s&&++c===i&&(l=o),(f=h.nextSibling)!==null)break;h=d,d=h.parentNode}h=f}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Tl={focusedElem:t,selectionRange:n},po=!1,O=e;O!==null;)if(e=O,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,O=t;else for(;O!==null;){e=O;try{var m=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var y=m.memoizedProps,v=m.memoizedState,p=e.stateNode,g=p.getSnapshotBeforeUpdate(e.elementType===e.type?y:ut(e.type,y),v);p.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var _=e.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(C(163))}}catch(w){se(e,e.return,w)}if(t=e.sibling,t!==null){t.return=e.return,O=t;break}O=e.return}return m=Mh,Mh=!1,m}function vr(t,e,n){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&t)===t){var s=r.destroy;r.destroy=void 0,s!==void 0&&Hl(e,n,s)}r=r.next}while(r!==i)}}function ea(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var i=n.create;n.destroy=i()}n=n.next}while(n!==e)}}function Wl(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function Cg(t){var e=t.alternate;e!==null&&(t.alternate=null,Cg(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[bt],delete e[zr],delete e[Ml],delete e[Wy],delete e[Ky])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Eg(t){return t.tag===5||t.tag===3||t.tag===4}function Rh(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Eg(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Kl(t,e,n){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=yo));else if(i!==4&&(t=t.child,t!==null))for(Kl(t,e,n),t=t.sibling;t!==null;)Kl(t,e,n),t=t.sibling}function Yl(t,e,n){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(i!==4&&(t=t.child,t!==null))for(Yl(t,e,n),t=t.sibling;t!==null;)Yl(t,e,n),t=t.sibling}var we=null,ct=!1;function Bt(t,e,n){for(n=n.child;n!==null;)Pg(t,e,n),n=n.sibling}function Pg(t,e,n){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(Ko,n)}catch{}switch(n.tag){case 5:Ee||gi(n,e);case 6:var i=we,r=ct;we=null,Bt(t,e,n),we=i,ct=r,we!==null&&(ct?(t=we,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):we.removeChild(n.stateNode));break;case 18:we!==null&&(ct?(t=we,n=n.stateNode,t.nodeType===8?Ia(t.parentNode,n):t.nodeType===1&&Ia(t,n),Ar(t)):Ia(we,n.stateNode));break;case 4:i=we,r=ct,we=n.stateNode.containerInfo,ct=!0,Bt(t,e,n),we=i,ct=r;break;case 0:case 11:case 14:case 15:if(!Ee&&(i=n.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Hl(n,e,o),r=r.next}while(r!==i)}Bt(t,e,n);break;case 1:if(!Ee&&(gi(n,e),i=n.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=n.memoizedProps,i.state=n.memoizedState,i.componentWillUnmount()}catch(a){se(n,e,a)}Bt(t,e,n);break;case 21:Bt(t,e,n);break;case 22:n.mode&1?(Ee=(i=Ee)||n.memoizedState!==null,Bt(t,e,n),Ee=i):Bt(t,e,n);break;default:Bt(t,e,n)}}function Ih(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new lv),e.forEach(function(i){var r=vv.bind(null,t,i);n.has(i)||(n.add(i),i.then(r,r))})}}function at(t,e){var n=e.deletions;if(n!==null)for(var i=0;ir&&(r=o),i&=~s}if(i=r,i=ae()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*hv(i/1960))-i,10t?16:t,Jt===null)var i=!1;else{if(t=Jt,Jt=null,Lo=0,z&6)throw Error(C(331));var r=z;for(z|=4,O=t.current;O!==null;){var s=O,o=s.child;if(O.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lae()-ic?jn(t,0):nc|=n),$e(t,e)}function Dg(t,e){e===0&&(t.mode&1?(e=ps,ps<<=1,!(ps&130023424)&&(ps=4194304)):e=1);var n=Me();t=zt(t,e),t!==null&&(ts(t,e,n),$e(t,n))}function yv(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Dg(t,n)}function vv(t,e){var n=0;switch(t.tag){case 13:var i=t.stateNode,r=t.memoizedState;r!==null&&(n=r.retryLane);break;case 19:i=t.stateNode;break;default:throw Error(C(314))}i!==null&&i.delete(e),Dg(t,n)}var jg;jg=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Fe.current)Ne=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Ne=!1,sv(t,e,n);Ne=!!(t.flags&131072)}else Ne=!1,ee&&e.flags&1048576&&$p(e,xo,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;eo(t,e),t=e.pendingProps;var r=Ci(e,Pe.current);xi(e,n),r=Qu(null,e,i,t,r,n);var s=Xu();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,ze(i)?(s=!0,_o(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,Wu(e),r.updater=Zo,e.stateNode=r,r._reactInternals=e,Nl(e,i,t,n),e=$l(null,e,i,!0,s,n)):(e.tag=0,ee&&s&&Fu(e),Le(null,e,r,n),e=e.child),e;case 16:i=e.elementType;e:{switch(eo(t,e),t=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=wv(i),t=ut(i,t),r){case 0:e=zl(null,e,i,t,n);break e;case 1:e=Th(null,e,i,t,n);break e;case 11:e=Eh(null,e,i,t,n);break e;case 14:e=Ph(null,e,i,ut(i.type,t),n);break e}throw Error(C(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ut(i,r),zl(t,e,i,r,n);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ut(i,r),Th(t,e,i,r,n);case 3:e:{if(_g(e),t===null)throw Error(C(387));i=e.pendingProps,s=e.memoizedState,r=s.element,Kp(t,e),So(e,i,null,n);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=Oi(Error(C(423)),e),e=Oh(t,e,i,n,r);break e}else if(i!==r){r=Oi(Error(C(424)),e),e=Oh(t,e,i,n,r);break e}else for(He=an(e.stateNode.containerInfo.firstChild),Ye=e,ee=!0,ft=null,n=Hp(e,null,i,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ei(),i===r){e=$t(t,e,n);break e}Le(t,e,i,n)}e=e.child}return e;case 5:return Yp(e),t===null&&Al(e),i=e.type,r=e.pendingProps,s=t!==null?t.memoizedProps:null,o=r.children,Ol(i,r)?o=null:s!==null&&Ol(i,s)&&(e.flags|=32),vg(t,e),Le(t,e,o,n),e.child;case 6:return t===null&&Al(e),null;case 13:return wg(t,e,n);case 4:return Ku(e,e.stateNode.containerInfo),i=e.pendingProps,t===null?e.child=Pi(e,null,i,n):Le(t,e,i,n),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ut(i,r),Eh(t,e,i,r,n);case 7:return Le(t,e,e.pendingProps,n),e.child;case 8:return Le(t,e,e.pendingProps.children,n),e.child;case 12:return Le(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,q(ko,i._currentValue),i._currentValue=o,s!==null)if(yt(s.value,o)){if(s.children===r.children&&!Fe.current){e=$t(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===i){if(s.tag===1){l=jt(-1,n&-n),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Dl(s.return,n,e),a.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(C(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Dl(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Le(t,e,r.children,n),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,xi(e,n),r=rt(r),i=i(r),e.flags|=1,Le(t,e,i,n),e.child;case 14:return i=e.type,r=ut(i,e.pendingProps),r=ut(i.type,r),Ph(t,e,i,r,n);case 15:return mg(t,e,e.type,e.pendingProps,n);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ut(i,r),eo(t,e),e.tag=1,ze(i)?(t=!0,_o(e)):t=!1,xi(e,n),fg(e,i,r),Nl(e,i,r,n),$l(null,e,i,!0,t,n);case 19:return xg(t,e,n);case 22:return yg(t,e,n)}throw Error(C(156,e.tag))};function Ng(t,e){return cp(t,e)}function _v(t,e,n,i){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function tt(t,e,n,i){return new _v(t,e,n,i)}function ac(t){return t=t.prototype,!(!t||!t.isReactComponent)}function wv(t){if(typeof t=="function")return ac(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Eu)return 11;if(t===Pu)return 14}return 2}function hn(t,e){var n=t.alternate;return n===null?(n=tt(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function io(t,e,n,i,r,s){var o=2;if(i=t,typeof t=="function")ac(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case oi:return Nn(n.children,r,s,e);case Cu:o=8,r|=8;break;case al:return t=tt(12,n,e,r|2),t.elementType=al,t.lanes=s,t;case ll:return t=tt(13,n,e,r),t.elementType=ll,t.lanes=s,t;case ul:return t=tt(19,n,e,r),t.elementType=ul,t.lanes=s,t;case Yf:return na(n,r,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Wf:o=10;break e;case Kf:o=9;break e;case Eu:o=11;break e;case Pu:o=14;break e;case Wt:o=16,i=null;break e}throw Error(C(130,t==null?t:typeof t,""))}return e=tt(o,n,e,r),e.elementType=t,e.type=i,e.lanes=s,e}function Nn(t,e,n,i){return t=tt(7,t,i,e),t.lanes=n,t}function na(t,e,n,i){return t=tt(22,t,i,e),t.elementType=Yf,t.lanes=n,t.stateNode={isHidden:!1},t}function Ua(t,e,n){return t=tt(6,t,null,e),t.lanes=n,t}function Ba(t,e,n){return e=tt(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function xv(t,e,n,i,r){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ka(0),this.expirationTimes=ka(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ka(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function lc(t,e,n,i,r,s,o,a,l){return t=new xv(t,e,n,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=tt(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:i,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Wu(s),t}function kv(t,e,n){var i=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Ug)}catch(t){console.error(t)}}Ug(),Uf.exports=qe;var Pv=Uf.exports,Uh=Pv;sl.createRoot=Uh.createRoot,sl.hydrateRoot=Uh.hydrateRoot;/** + * @remix-run/router v1.16.1 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Kr(){return Kr=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function Bg(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Ov(){return Math.random().toString(36).substr(2,8)}function Vh(t,e){return{usr:t.state,key:t.key,idx:e}}function Jl(t,e,n,i){return n===void 0&&(n=null),Kr({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?$i(e):e,{state:n,key:e&&e.key||i||Ov()})}function Vg(t){let{pathname:e="/",search:n="",hash:i=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),i&&i!=="#"&&(e+=i.charAt(0)==="#"?i:"#"+i),e}function $i(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let i=t.indexOf("?");i>=0&&(e.search=t.substr(i),t=t.substr(0,i)),t&&(e.pathname=t)}return e}function Lv(t,e,n,i){i===void 0&&(i={});let{window:r=document.defaultView,v5Compat:s=!1}=i,o=r.history,a=Zt.Pop,l=null,u=c();u==null&&(u=0,o.replaceState(Kr({},o.state,{idx:u}),""));function c(){return(o.state||{idx:null}).idx}function h(){a=Zt.Pop;let v=c(),p=v==null?null:v-u;u=v,l&&l({action:a,location:y.location,delta:p})}function d(v,p){a=Zt.Push;let g=Jl(y.location,v,p);u=c()+1;let _=Vh(g,u),w=y.createHref(g);try{o.pushState(_,"",w)}catch(x){if(x instanceof DOMException&&x.name==="DataCloneError")throw x;r.location.assign(w)}s&&l&&l({action:a,location:y.location,delta:1})}function f(v,p){a=Zt.Replace;let g=Jl(y.location,v,p);u=c();let _=Vh(g,u),w=y.createHref(g);o.replaceState(_,"",w),s&&l&&l({action:a,location:y.location,delta:0})}function m(v){let p=r.location.origin!=="null"?r.location.origin:r.location.href,g=typeof v=="string"?v:Vg(v);return g=g.replace(/ $/,"%20"),pe(p,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,p)}let y={get action(){return a},get location(){return t(r,o)},listen(v){if(l)throw new Error("A history only accepts one active listener");return r.addEventListener(Bh,h),l=v,()=>{r.removeEventListener(Bh,h),l=null}},createHref(v){return e(r,v)},createURL:m,encodeLocation(v){let p=m(v);return{pathname:p.pathname,search:p.search,hash:p.hash}},push:d,replace:f,go(v){return o.go(v)}};return y}var Hh;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Hh||(Hh={}));function Mv(t,e,n){n===void 0&&(n="/");let i=typeof e=="string"?$i(e):e,r=Kg(i.pathname||"/",n);if(r==null)return null;let s=Hg(t);Rv(s);let o=null;for(let a=0;o==null&&a{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};l.relativePath.startsWith("/")&&(pe(l.relativePath.startsWith(i),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+i+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(i.length));let u=Fn([i,l.relativePath]),c=n.concat(l);s.children&&s.children.length>0&&(pe(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Hg(s.children,e,c,u)),!(s.path==null&&!s.index)&&e.push({path:u,score:zv(u,s.index),routesMeta:c})};return t.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))r(s,o);else for(let l of Wg(s.path))r(s,o,l)}),e}function Wg(t){let e=t.split("/");if(e.length===0)return[];let[n,...i]=e,r=n.endsWith("?"),s=n.replace(/\?$/,"");if(i.length===0)return r?[s,""]:[s];let o=Wg(i.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),r&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function Rv(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:$v(e.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}const Iv=/^:[\w-]+$/,Av=3,Dv=2,jv=1,Nv=10,Fv=-2,Wh=t=>t==="*";function zv(t,e){let n=t.split("/"),i=n.length;return n.some(Wh)&&(i+=Fv),e&&(i+=Dv),n.filter(r=>!Wh(r)).reduce((r,s)=>r+(Iv.test(s)?Av:s===""?jv:Nv),i)}function $v(t,e){return t.length===e.length&&t.slice(0,-1).every((i,r)=>i===e[r])?t[t.length-1]-e[e.length-1]:0}function Uv(t,e){let{routesMeta:n}=t,i={},r="/",s=[];for(let o=0;o{let{paramName:d,isOptional:f}=c;if(d==="*"){let y=a[h]||"";o=s.slice(0,s.length-y.length).replace(/(.)\/+$/,"$1")}const m=a[h];return f&&!m?u[d]=void 0:u[d]=(m||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:o,pattern:t}}function Vv(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),Bg(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let i=[],r="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(i.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(i.push({paramName:"*"}),r+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":t!==""&&t!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,e?void 0:"i"),i]}function Hv(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Bg(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Kg(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,i=t.charAt(n);return i&&i!=="/"?null:t.slice(n)||"/"}function Wv(t,e){e===void 0&&(e="/");let{pathname:n,search:i="",hash:r=""}=typeof t=="string"?$i(t):t;return{pathname:n?n.startsWith("/")?n:Kv(n,e):e,search:Xv(i),hash:Jv(r)}}function Kv(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function Va(t,e,n,i){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(i)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Yv(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Gv(t,e){let n=Yv(t);return e?n.map((i,r)=>r===t.length-1?i.pathname:i.pathnameBase):n.map(i=>i.pathnameBase)}function qv(t,e,n,i){i===void 0&&(i=!1);let r;typeof t=="string"?r=$i(t):(r=Kr({},t),pe(!r.pathname||!r.pathname.includes("?"),Va("?","pathname","search",r)),pe(!r.pathname||!r.pathname.includes("#"),Va("#","pathname","hash",r)),pe(!r.search||!r.search.includes("#"),Va("#","search","hash",r)));let s=t===""||r.pathname==="",o=s?"/":r.pathname,a;if(o==null)a=n;else{let h=e.length-1;if(!i&&o.startsWith("..")){let d=o.split("/");for(;d[0]==="..";)d.shift(),h-=1;r.pathname=d.join("/")}a=h>=0?e[h]:"/"}let l=Wv(r,a),u=o&&o!=="/"&&o.endsWith("/"),c=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}const Fn=t=>t.join("/").replace(/\/\/+/g,"/"),Qv=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Xv=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Jv=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function Zv(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Yg=["post","put","patch","delete"];new Set(Yg);const e_=["get",...Yg];new Set(e_);/** + * React Router v6.23.1 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Yr(){return Yr=Object.assign?Object.assign.bind():function(t){for(var e=1;e{a.current=!0}),E.useCallback(function(u,c){if(c===void 0&&(c={}),!a.current)return;if(typeof u=="number"){i.go(u);return}let h=qv(u,JSON.parse(o),s,c.relative==="path");t==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:Fn([e,h.pathname])),(c.replace?i.replace:i.push)(h,c.state,c)},[e,i,o,s,t])}function i_(t,e){return r_(t,e)}function r_(t,e,n,i){ua()||pe(!1);let{navigator:r}=E.useContext(aa),{matches:s}=E.useContext(Ui),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=qg(),c;if(e){var h;let v=typeof e=="string"?$i(e):e;l==="/"||(h=v.pathname)!=null&&h.startsWith(l)||pe(!1),c=v}else c=u;let d=c.pathname||"/",f=d;if(l!=="/"){let v=l.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(v.length).join("/")}let m=Mv(t,{pathname:f}),y=u_(m&&m.map(v=>Object.assign({},v,{params:Object.assign({},a,v.params),pathname:Fn([l,r.encodeLocation?r.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?l:Fn([l,r.encodeLocation?r.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),s,n,i);return e&&y?E.createElement(la.Provider,{value:{location:Yr({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:Zt.Pop}},y):y}function s_(){let t=f_(),e=Zv(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,r={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},e),n?E.createElement("pre",{style:r},n):null,null)}const o_=E.createElement(s_,null);class a_ extends E.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?E.createElement(Ui.Provider,{value:this.props.routeContext},E.createElement(Gg.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function l_(t){let{routeContext:e,match:n,children:i}=t,r=E.useContext(dc);return r&&r.static&&r.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=n.route.id),E.createElement(Ui.Provider,{value:e},i)}function u_(t,e,n,i){var r;if(e===void 0&&(e=[]),n===void 0&&(n=null),i===void 0&&(i=null),t==null){var s;if((s=n)!=null&&s.errors)t=n.matches;else return null}let o=t,a=(r=n)==null?void 0:r.errors;if(a!=null){let c=o.findIndex(h=>h.route.id&&(a==null?void 0:a[h.route.id])!==void 0);c>=0||pe(!1),o=o.slice(0,Math.min(o.length,c+1))}let l=!1,u=-1;if(n&&i&&i.v7_partialHydration)for(let c=0;c=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((c,h,d)=>{let f,m=!1,y=null,v=null;n&&(f=a&&h.route.id?a[h.route.id]:void 0,y=h.route.errorElement||o_,l&&(u<0&&d===0?(m=!0,v=null):u===d&&(m=!0,v=h.route.hydrateFallbackElement||null)));let p=e.concat(o.slice(0,d+1)),g=()=>{let _;return f?_=y:m?_=v:h.route.Component?_=E.createElement(h.route.Component,null):h.route.element?_=h.route.element:_=c,E.createElement(l_,{match:h,routeContext:{outlet:c,matches:p,isDataRoute:n!=null},children:_})};return n&&(h.route.ErrorBoundary||h.route.errorElement||d===0)?E.createElement(a_,{location:n.location,revalidation:n.revalidation,component:y,error:f,children:g(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):g()},null)}var Xg=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(Xg||{}),Io=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Io||{});function c_(t){let e=E.useContext(dc);return e||pe(!1),e}function h_(t){let e=E.useContext(t_);return e||pe(!1),e}function d_(t){let e=E.useContext(Ui);return e||pe(!1),e}function Jg(t){let e=d_(),n=e.matches[e.matches.length-1];return n.route.id||pe(!1),n.route.id}function f_(){var t;let e=E.useContext(Gg),n=h_(Io.UseRouteError),i=Jg(Io.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[i]}function p_(){let{router:t}=c_(Xg.UseNavigateStable),e=Jg(Io.UseNavigateStable),n=E.useRef(!1);return Qg(()=>{n.current=!0}),E.useCallback(function(r,s){s===void 0&&(s={}),n.current&&(typeof r=="number"?t.navigate(r):t.navigate(r,Yr({fromRouteId:e},s)))},[t,e])}function ii(t){pe(!1)}function g_(t){let{basename:e="/",children:n=null,location:i,navigationType:r=Zt.Pop,navigator:s,static:o=!1,future:a}=t;ua()&&pe(!1);let l=e.replace(/^\/*/,"/"),u=E.useMemo(()=>({basename:l,navigator:s,static:o,future:Yr({v7_relativeSplatPath:!1},a)}),[l,a,s,o]);typeof i=="string"&&(i=$i(i));let{pathname:c="/",search:h="",hash:d="",state:f=null,key:m="default"}=i,y=E.useMemo(()=>{let v=Kg(c,l);return v==null?null:{location:{pathname:v,search:h,hash:d,state:f,key:m},navigationType:r}},[l,c,h,d,f,m,r]);return y==null?null:E.createElement(aa.Provider,{value:u},E.createElement(la.Provider,{children:n,value:y}))}function m_(t){let{children:e,location:n}=t;return i_(Zl(e),n)}new Promise(()=>{});function Zl(t,e){e===void 0&&(e=[]);let n=[];return E.Children.forEach(t,(i,r)=>{if(!E.isValidElement(i))return;let s=[...e,r];if(i.type===E.Fragment){n.push.apply(n,Zl(i.props.children,s));return}i.type!==ii&&pe(!1),!i.props.index||!i.props.children||pe(!1);let o={id:i.props.id||s.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,loader:i.props.loader,action:i.props.action,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(o.children=Zl(i.props.children,s)),n.push(o)}),n}/** + * React Router DOM v6.23.1 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */const y_="6";try{window.__reactRouterVersion=y_}catch{}const v_="startTransition",Kh=m0[v_];function __(t){let{basename:e,children:n,future:i,window:r}=t,s=E.useRef();s.current==null&&(s.current=Tv({window:r,v5Compat:!0}));let o=s.current,[a,l]=E.useState({action:o.action,location:o.location}),{v7_startTransition:u}=i||{},c=E.useCallback(h=>{u&&Kh?Kh(()=>l(h)):l(h)},[l,u]);return E.useLayoutEffect(()=>o.listen(c),[o,c]),E.createElement(g_,{basename:e,children:n,location:a.location,navigationType:a.action,navigator:o,future:i})}var Yh;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Yh||(Yh={}));var Gh;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Gh||(Gh={}));const w_="modulepreload",x_=function(t,e){return new URL(t,e).href},qh={},Mi=function(e,n,i){let r=Promise.resolve();if(n&&n.length>0){const s=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=Promise.all(n.map(l=>{if(l=x_(l,i),l in qh)return;qh[l]=!0;const u=l.endsWith(".css"),c=u?'[rel="stylesheet"]':"";if(!!i)for(let f=s.length-1;f>=0;f--){const m=s[f];if(m.href===l&&(!u||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${c}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":w_,u||(d.as="script",d.crossOrigin=""),d.href=l,a&&d.setAttribute("nonce",a),document.head.appendChild(d),u)return new Promise((f,m)=>{d.addEventListener("load",f),d.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${l}`)))})}))}return r.then(()=>e()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})},k_=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>Mi(()=>Promise.resolve().then(()=>ss),void 0,import.meta.url).then(({default:i})=>i(...n)):e=fetch,(...n)=>e(...n)};class fc extends Error{constructor(e,n="FunctionsError",i){super(e),this.name=n,this.context=i}}class b_ extends fc{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class S_ extends fc{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class C_ extends fc{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var eu;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(eu||(eu={}));var E_=function(t,e,n,i){function r(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(i.next(c))}catch(h){o(h)}}function l(c){try{u(i.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):r(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};class P_{constructor(e,{headers:n={},customFetch:i,region:r=eu.Any}={}){this.url=e,this.headers=n,this.region=r,this.fetch=k_(i)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,n={}){var i;return E_(this,void 0,void 0,function*(){try{const{headers:r,method:s,body:o}=n;let a={},{region:l}=n;l||(l=this.region),l&&l!=="any"&&(a["x-region"]=l);let u;o&&(r&&!Object.prototype.hasOwnProperty.call(r,"Content-Type")||!r)&&(typeof Blob<"u"&&o instanceof Blob||o instanceof ArrayBuffer?(a["Content-Type"]="application/octet-stream",u=o):typeof o=="string"?(a["Content-Type"]="text/plain",u=o):typeof FormData<"u"&&o instanceof FormData?u=o:(a["Content-Type"]="application/json",u=JSON.stringify(o)));const c=yield this.fetch(`${this.url}/${e}`,{method:s||"POST",headers:Object.assign(Object.assign(Object.assign({},a),this.headers),r),body:u}).catch(m=>{throw new b_(m)}),h=c.headers.get("x-relay-error");if(h&&h==="true")throw new S_(c);if(!c.ok)throw new C_(c);let d=((i=c.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),f;return d==="application/json"?f=yield c.json():d==="application/octet-stream"?f=yield c.blob():d==="text/event-stream"?f=c:d==="multipart/form-data"?f=yield c.formData():f=yield c.text(),{data:f,error:null}}catch(r){return{data:null,error:r}}})}}var T_=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},Ri=T_();const O_=Ri.fetch,pc=Ri.fetch.bind(Ri),Zg=Ri.Headers,L_=Ri.Request,M_=Ri.Response,ss=Object.freeze(Object.defineProperty({__proto__:null,Headers:Zg,Request:L_,Response:M_,default:pc,fetch:O_},Symbol.toStringTag,{value:"Module"}));class R_ extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}}class I_{constructor(e){this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=e.headers,this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle,e.fetch?this.fetch=e.fetch:typeof fetch>"u"?this.fetch=pc:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}then(e,n){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),this.method!=="GET"&&this.method!=="HEAD"&&(this.headers["Content-Type"]="application/json");const i=this.fetch;let r=i(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async s=>{var o,a,l;let u=null,c=null,h=null,d=s.status,f=s.statusText;if(s.ok){if(this.method!=="HEAD"){const p=await s.text();p===""||(this.headers.Accept==="text/csv"||this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?c=p:c=JSON.parse(p))}const y=(o=this.headers.Prefer)===null||o===void 0?void 0:o.match(/count=(exact|planned|estimated)/),v=(a=s.headers.get("content-range"))===null||a===void 0?void 0:a.split("/");y&&v&&v.length>1&&(h=parseInt(v[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(c)&&(c.length>1?(u={code:"PGRST116",details:`Results contain ${c.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},c=null,h=null,d=406,f="Not Acceptable"):c.length===1?c=c[0]:c=null)}else{const y=await s.text();try{u=JSON.parse(y),Array.isArray(u)&&s.status===404&&(c=[],u=null,d=200,f="OK")}catch{s.status===404&&y===""?(d=204,f="No Content"):u={message:y}}if(u&&this.isMaybeSingle&&(!((l=u==null?void 0:u.details)===null||l===void 0)&&l.includes("0 rows"))&&(u=null,d=200,f="OK"),u&&this.shouldThrowOnError)throw new R_(u)}return{error:u,data:c,count:h,status:d,statusText:f}});return this.shouldThrowOnError||(r=r.catch(s=>{var o,a,l;return{error:{message:`${(o=s==null?void 0:s.name)!==null&&o!==void 0?o:"FetchError"}: ${s==null?void 0:s.message}`,details:`${(a=s==null?void 0:s.stack)!==null&&a!==void 0?a:""}`,hint:"",code:`${(l=s==null?void 0:s.code)!==null&&l!==void 0?l:""}`},data:null,count:null,status:0,statusText:""}})),r.then(e,n)}}class A_ extends I_{select(e){let n=!1;const i=(e??"*").split("").map(r=>/\s/.test(r)&&!n?"":(r==='"'&&(n=!n),r)).join("");return this.url.searchParams.set("select",i),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(e,{ascending:n=!0,nullsFirst:i,foreignTable:r,referencedTable:s=r}={}){const o=s?`${s}.order`:"order",a=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${a?`${a},`:""}${e}.${n?"asc":"desc"}${i===void 0?"":i?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:n,referencedTable:i=n}={}){const r=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,n,{foreignTable:i,referencedTable:r=i}={}){const s=typeof r>"u"?"offset":`${r}.offset`,o=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(o,`${n-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return this.method==="GET"?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain({analyze:e=!1,verbose:n=!1,settings:i=!1,buffers:r=!1,wal:s=!1,format:o="text"}={}){var a;const l=[e?"analyze":null,n?"verbose":null,i?"settings":null,r?"buffers":null,s?"wal":null].filter(Boolean).join("|"),u=(a=this.headers.Accept)!==null&&a!==void 0?a:"application/json";return this.headers.Accept=`application/vnd.pgrst.plan+${o}; for="${u}"; options=${l};`,o==="json"?this:this}rollback(){var e;return((e=this.headers.Prefer)!==null&&e!==void 0?e:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}}class ri extends A_{eq(e,n){return this.url.searchParams.append(e,`eq.${n}`),this}neq(e,n){return this.url.searchParams.append(e,`neq.${n}`),this}gt(e,n){return this.url.searchParams.append(e,`gt.${n}`),this}gte(e,n){return this.url.searchParams.append(e,`gte.${n}`),this}lt(e,n){return this.url.searchParams.append(e,`lt.${n}`),this}lte(e,n){return this.url.searchParams.append(e,`lte.${n}`),this}like(e,n){return this.url.searchParams.append(e,`like.${n}`),this}likeAllOf(e,n){return this.url.searchParams.append(e,`like(all).{${n.join(",")}}`),this}likeAnyOf(e,n){return this.url.searchParams.append(e,`like(any).{${n.join(",")}}`),this}ilike(e,n){return this.url.searchParams.append(e,`ilike.${n}`),this}ilikeAllOf(e,n){return this.url.searchParams.append(e,`ilike(all).{${n.join(",")}}`),this}ilikeAnyOf(e,n){return this.url.searchParams.append(e,`ilike(any).{${n.join(",")}}`),this}is(e,n){return this.url.searchParams.append(e,`is.${n}`),this}in(e,n){const i=Array.from(new Set(n)).map(r=>typeof r=="string"&&new RegExp("[,()]").test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`in.(${i})`),this}contains(e,n){return typeof n=="string"?this.url.searchParams.append(e,`cs.${n}`):Array.isArray(n)?this.url.searchParams.append(e,`cs.{${n.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(n)}`),this}containedBy(e,n){return typeof n=="string"?this.url.searchParams.append(e,`cd.${n}`):Array.isArray(n)?this.url.searchParams.append(e,`cd.{${n.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(n)}`),this}rangeGt(e,n){return this.url.searchParams.append(e,`sr.${n}`),this}rangeGte(e,n){return this.url.searchParams.append(e,`nxl.${n}`),this}rangeLt(e,n){return this.url.searchParams.append(e,`sl.${n}`),this}rangeLte(e,n){return this.url.searchParams.append(e,`nxr.${n}`),this}rangeAdjacent(e,n){return this.url.searchParams.append(e,`adj.${n}`),this}overlaps(e,n){return typeof n=="string"?this.url.searchParams.append(e,`ov.${n}`):this.url.searchParams.append(e,`ov.{${n.join(",")}}`),this}textSearch(e,n,{config:i,type:r}={}){let s="";r==="plain"?s="pl":r==="phrase"?s="ph":r==="websearch"&&(s="w");const o=i===void 0?"":`(${i})`;return this.url.searchParams.append(e,`${s}fts${o}.${n}`),this}match(e){return Object.entries(e).forEach(([n,i])=>{this.url.searchParams.append(n,`eq.${i}`)}),this}not(e,n,i){return this.url.searchParams.append(e,`not.${n}.${i}`),this}or(e,{foreignTable:n,referencedTable:i=n}={}){const r=i?`${i}.or`:"or";return this.url.searchParams.append(r,`(${e})`),this}filter(e,n,i){return this.url.searchParams.append(e,`${n}.${i}`),this}}class D_{constructor(e,{headers:n={},schema:i,fetch:r}){this.url=e,this.headers=n,this.schema=i,this.fetch=r}select(e,{head:n=!1,count:i}={}){const r=n?"HEAD":"GET";let s=!1;const o=(e??"*").split("").map(a=>/\s/.test(a)&&!s?"":(a==='"'&&(s=!s),a)).join("");return this.url.searchParams.set("select",o),i&&(this.headers.Prefer=`count=${i}`),new ri({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(e,{count:n,defaultToNull:i=!0}={}){const r="POST",s=[];if(this.headers.Prefer&&s.push(this.headers.Prefer),n&&s.push(`count=${n}`),i||s.push("missing=default"),this.headers.Prefer=s.join(","),Array.isArray(e)){const o=e.reduce((a,l)=>a.concat(Object.keys(l)),[]);if(o.length>0){const a=[...new Set(o)].map(l=>`"${l}"`);this.url.searchParams.set("columns",a.join(","))}}return new ri({method:r,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}upsert(e,{onConflict:n,ignoreDuplicates:i=!1,count:r,defaultToNull:s=!0}={}){const o="POST",a=[`resolution=${i?"ignore":"merge"}-duplicates`];if(n!==void 0&&this.url.searchParams.set("on_conflict",n),this.headers.Prefer&&a.push(this.headers.Prefer),r&&a.push(`count=${r}`),s||a.push("missing=default"),this.headers.Prefer=a.join(","),Array.isArray(e)){const l=e.reduce((u,c)=>u.concat(Object.keys(c)),[]);if(l.length>0){const u=[...new Set(l)].map(c=>`"${c}"`);this.url.searchParams.set("columns",u.join(","))}}return new ri({method:o,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}update(e,{count:n}={}){const i="PATCH",r=[];return this.headers.Prefer&&r.push(this.headers.Prefer),n&&r.push(`count=${n}`),this.headers.Prefer=r.join(","),new ri({method:i,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}delete({count:e}={}){const n="DELETE",i=[];return e&&i.push(`count=${e}`),this.headers.Prefer&&i.unshift(this.headers.Prefer),this.headers.Prefer=i.join(","),new ri({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}}const j_="1.15.2",N_={"X-Client-Info":`postgrest-js/${j_}`};class gc{constructor(e,{headers:n={},schema:i,fetch:r}={}){this.url=e,this.headers=Object.assign(Object.assign({},N_),n),this.schemaName=i,this.fetch=r}from(e){const n=new URL(`${this.url}/${e}`);return new D_(n,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new gc(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,n={},{head:i=!1,get:r=!1,count:s}={}){let o;const a=new URL(`${this.url}/rpc/${e}`);let l;i||r?(o=i?"HEAD":"GET",Object.entries(n).filter(([c,h])=>h!==void 0).map(([c,h])=>[c,Array.isArray(h)?`{${h.join(",")}}`:`${h}`]).forEach(([c,h])=>{a.searchParams.append(c,h)})):(o="POST",l=n);const u=Object.assign({},this.headers);return s&&(u.Prefer=`count=${s}`),new ri({method:o,url:a,headers:u,schema:this.schemaName,body:l,fetch:this.fetch,allowEmpty:!1})}}const F_="2.9.5",z_={"X-Client-Info":`realtime-js/${F_}`},$_="1.0.0",em=1e4,U_=1e3;var bi;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(bi||(bi={}));var Ue;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(Ue||(Ue={}));var ht;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(ht||(ht={}));var tu;(function(t){t.websocket="websocket"})(tu||(tu={}));var Mn;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(Mn||(Mn={}));class tm{constructor(e,n){this.callback=e,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}class B_{constructor(){this.HEADER_LENGTH=1}decode(e,n){return e.constructor===ArrayBuffer?n(this._binaryDecode(e)):n(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const n=new DataView(e),i=new TextDecoder;return this._decodeBroadcast(e,n,i)}_decodeBroadcast(e,n,i){const r=n.getUint8(1),s=n.getUint8(2);let o=this.HEADER_LENGTH+2;const a=i.decode(e.slice(o,o+r));o=o+r;const l=i.decode(e.slice(o,o+s));o=o+s;const u=JSON.parse(i.decode(e.slice(o,e.byteLength)));return{ref:null,topic:a,event:l,payload:u}}}class Ha{constructor(e,n,i={},r=em){this.channel=e,this.event=n,this.payload=i,this.timeout=r,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,n){var i;return this._hasReceived(e)&&n((i=this.receivedResp)===null||i===void 0?void 0:i.response),this.recHooks.push({status:e,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:n}){this.recHooks.filter(i=>i.status===e).forEach(i=>i.callback(n))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var Qh;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(Qh||(Qh={}));class xr{constructor(e,n){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const i=(n==null?void 0:n.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(i.state,{},r=>{const{onJoin:s,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=xr.syncState(this.state,r,s,o),this.pendingDiffs.forEach(l=>{this.state=xr.syncDiff(this.state,l,s,o)}),this.pendingDiffs=[],a()}),this.channel._on(i.diff,{},r=>{const{onJoin:s,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(r):(this.state=xr.syncDiff(this.state,r,s,o),a())}),this.onJoin((r,s,o)=>{this.channel._trigger("presence",{event:"join",key:r,currentPresences:s,newPresences:o})}),this.onLeave((r,s,o)=>{this.channel._trigger("presence",{event:"leave",key:r,currentPresences:s,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,n,i,r){const s=this.cloneDeep(e),o=this.transformState(n),a={},l={};return this.map(s,(u,c)=>{o[u]||(l[u]=c)}),this.map(o,(u,c)=>{const h=s[u];if(h){const d=c.map(v=>v.presence_ref),f=h.map(v=>v.presence_ref),m=c.filter(v=>f.indexOf(v.presence_ref)<0),y=h.filter(v=>d.indexOf(v.presence_ref)<0);m.length>0&&(a[u]=m),y.length>0&&(l[u]=y)}else a[u]=c}),this.syncDiff(s,{joins:a,leaves:l},i,r)}static syncDiff(e,n,i,r){const{joins:s,leaves:o}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return i||(i=()=>{}),r||(r=()=>{}),this.map(s,(a,l)=>{var u;const c=(u=e[a])!==null&&u!==void 0?u:[];if(e[a]=this.cloneDeep(l),c.length>0){const h=e[a].map(f=>f.presence_ref),d=c.filter(f=>h.indexOf(f.presence_ref)<0);e[a].unshift(...d)}i(a,c,l)}),this.map(o,(a,l)=>{let u=e[a];if(!u)return;const c=l.map(h=>h.presence_ref);u=u.filter(h=>c.indexOf(h.presence_ref)<0),e[a]=u,r(a,u,l),u.length===0&&delete e[a]}),e}static map(e,n){return Object.getOwnPropertyNames(e).map(i=>n(i,e[i]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((n,i)=>{const r=e[i];return"metas"in r?n[i]=r.metas.map(s=>(s.presence_ref=s.phx_ref,delete s.phx_ref,delete s.phx_ref_prev,s)):n[i]=r,n},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var G;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(G||(G={}));const Xh=(t,e,n={})=>{var i;const r=(i=n.skipTypes)!==null&&i!==void 0?i:[];return Object.keys(e).reduce((s,o)=>(s[o]=V_(o,t,e,r),s),{})},V_=(t,e,n,i)=>{const r=e.find(a=>a.name===t),s=r==null?void 0:r.type,o=n[t];return s&&!i.includes(s)?nm(s,o):nu(o)},nm=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return Y_(e,n)}switch(t){case G.bool:return H_(e);case G.float4:case G.float8:case G.int2:case G.int4:case G.int8:case G.numeric:case G.oid:return W_(e);case G.json:case G.jsonb:return K_(e);case G.timestamp:return G_(e);case G.abstime:case G.date:case G.daterange:case G.int4range:case G.int8range:case G.money:case G.reltime:case G.text:case G.time:case G.timestamptz:case G.timetz:case G.tsrange:case G.tstzrange:return nu(e);default:return nu(e)}},nu=t=>t,H_=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},W_=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},K_=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t},Y_=(t,e)=>{if(typeof t!="string")return t;const n=t.length-1,i=t[n];if(t[0]==="{"&&i==="}"){let s;const o=t.slice(1,n);try{s=JSON.parse("["+o+"]")}catch{s=o?o.split(","):[]}return s.map(a=>nm(e,a))}return t},G_=t=>typeof t=="string"?t.replace(" ","T"):t;var Jh;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(Jh||(Jh={}));var Zh;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes"})(Zh||(Zh={}));var ed;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(ed||(ed={}));class mc{constructor(e,n={config:{}},i){this.topic=e,this.params=n,this.socket=i,this.bindings={},this.state=Ue.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:""}},n.config),this.timeout=this.socket.timeout,this.joinPush=new Ha(this,ht.join,this.params,this.timeout),this.rejoinTimer=new tm(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ue.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(r=>r.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Ue.closed,this.socket._remove(this)}),this._onError(r=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,r),this.state=Ue.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ue.errored,this.rejoinTimer.scheduleTimeout())}),this._on(ht.reply,{},(r,s)=>{this._trigger(this._replyEventName(s),r)}),this.presence=new xr(this),this.broadcastEndpointURL=this._broadcastEndpointURL()}subscribe(e,n=this.timeout){var i,r;if(this.socket.isConnected()||this.socket.connect(),this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";{const{config:{broadcast:s,presence:o}}=this.params;this._onError(u=>e&&e("CHANNEL_ERROR",u)),this._onClose(()=>e&&e("CLOSED"));const a={},l={broadcast:s,presence:o,postgres_changes:(r=(i=this.bindings.postgres_changes)===null||i===void 0?void 0:i.map(u=>u.filter))!==null&&r!==void 0?r:[]};this.socket.accessToken&&(a.access_token=this.socket.accessToken),this.updateJoinPayload(Object.assign({config:l},a)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",({postgres_changes:u})=>{var c;if(this.socket.accessToken&&this.socket.setAuth(this.socket.accessToken),u===void 0){e&&e("SUBSCRIBED");return}else{const h=this.bindings.postgres_changes,d=(c=h==null?void 0:h.length)!==null&&c!==void 0?c:0,f=[];for(let m=0;m{e&&e("CHANNEL_ERROR",new Error(JSON.stringify(Object.values(u).join(", ")||"error")))}).receive("timeout",()=>{e&&e("TIMED_OUT")})}return this}presenceState(){return this.presence.state}async track(e,n={}){return await this.send({type:"presence",event:"track",payload:e},n.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,n,i){return this._on(e,n,i)}async send(e,n={}){var i,r;if(!this._canPush()&&e.type==="broadcast"){const{event:s,payload:o}=e,a={method:"POST",headers:{apikey:(i=this.socket.apiKey)!==null&&i!==void 0?i:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:o}]})};try{return(await this._fetchWithTimeout(this.broadcastEndpointURL,a,(r=n.timeout)!==null&&r!==void 0?r:this.timeout)).ok?"ok":"error"}catch(l){return l.name==="AbortError"?"timed out":"error"}}else return new Promise(s=>{var o,a,l;const u=this._push(e.type,e,n.timeout||this.timeout);e.type==="broadcast"&&!(!((l=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||l===void 0)&&l.ack)&&s("ok"),u.receive("ok",()=>s("ok")),u.receive("error",()=>s("error")),u.receive("timeout",()=>s("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Ue.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(ht.close,"leave",this._joinRef())};return this.rejoinTimer.reset(),this.joinPush.destroy(),new Promise(i=>{const r=new Ha(this,ht.leave,{},e);r.receive("ok",()=>{n(),i("ok")}).receive("timeout",()=>{n(),i("timed out")}).receive("error",()=>{i("error")}),r.send(),this._canPush()||r.trigger("ok",{})})}_broadcastEndpointURL(){let e=this.socket.endPoint;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")+"/api/broadcast"}async _fetchWithTimeout(e,n,i){const r=new AbortController,s=setTimeout(()=>r.abort(),i),o=await this.socket.fetch(e,Object.assign(Object.assign({},n),{signal:r.signal}));return clearTimeout(s),o}_push(e,n,i=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let r=new Ha(this,e,n,i);return this._canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}_onMessage(e,n,i){return n}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,n,i){var r,s;const o=e.toLocaleLowerCase(),{close:a,error:l,leave:u,join:c}=ht;if(i&&[a,l,u,c].indexOf(o)>=0&&i!==this._joinRef())return;let d=this._onMessage(o,n,i);if(n&&!d)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(r=this.bindings.postgres_changes)===null||r===void 0||r.filter(f=>{var m,y,v;return((m=f.filter)===null||m===void 0?void 0:m.event)==="*"||((v=(y=f.filter)===null||y===void 0?void 0:y.event)===null||v===void 0?void 0:v.toLocaleLowerCase())===o}).map(f=>f.callback(d,i)):(s=this.bindings[o])===null||s===void 0||s.filter(f=>{var m,y,v,p,g,_;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in f){const w=f.id,x=(m=f.filter)===null||m===void 0?void 0:m.event;return w&&((y=n.ids)===null||y===void 0?void 0:y.includes(w))&&(x==="*"||(x==null?void 0:x.toLocaleLowerCase())===((v=n.data)===null||v===void 0?void 0:v.type.toLocaleLowerCase()))}else{const w=(g=(p=f==null?void 0:f.filter)===null||p===void 0?void 0:p.event)===null||g===void 0?void 0:g.toLocaleLowerCase();return w==="*"||w===((_=n==null?void 0:n.event)===null||_===void 0?void 0:_.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===o}).map(f=>{if(typeof d=="object"&&"ids"in d){const m=d.data,{schema:y,table:v,commit_timestamp:p,type:g,errors:_}=m;d=Object.assign(Object.assign({},{schema:y,table:v,commit_timestamp:p,eventType:g,new:{},old:{},errors:_}),this._getPayloadRecords(m))}f.callback(d,i)})}_isClosed(){return this.state===Ue.closed}_isJoined(){return this.state===Ue.joined}_isJoining(){return this.state===Ue.joining}_isLeaving(){return this.state===Ue.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,n,i){const r=e.toLocaleLowerCase(),s={type:r,filter:n,callback:i};return this.bindings[r]?this.bindings[r].push(s):this.bindings[r]=[s],this}_off(e,n){const i=e.toLocaleLowerCase();return this.bindings[i]=this.bindings[i].filter(r=>{var s;return!(((s=r.type)===null||s===void 0?void 0:s.toLocaleLowerCase())===i&&mc.isEqual(r.filter,n))}),this}static isEqual(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const i in e)if(e[i]!==n[i])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(ht.close,{},e)}_onError(e){this._on(ht.error,{},n=>e(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Ue.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=Xh(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=Xh(e.columns,e.old_record)),n}}const q_=()=>{},Q_=typeof WebSocket<"u";class X_{constructor(e,n){var i;this.accessToken=null,this.apiKey=null,this.channels=[],this.endPoint="",this.headers=z_,this.params={},this.timeout=em,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=q_,this.conn=null,this.sendBuffer=[],this.serializer=new B_,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this._resolveFetch=s=>{let o;return s?o=s:typeof fetch>"u"?o=(...a)=>Mi(()=>Promise.resolve().then(()=>ss),void 0,import.meta.url).then(({default:l})=>l(...a)):o=fetch,(...a)=>o(...a)},this.endPoint=`${e}/${tu.websocket}`,n!=null&&n.transport?this.transport=n.transport:this.transport=null,n!=null&&n.params&&(this.params=n.params),n!=null&&n.headers&&(this.headers=Object.assign(Object.assign({},this.headers),n.headers)),n!=null&&n.timeout&&(this.timeout=n.timeout),n!=null&&n.logger&&(this.logger=n.logger),n!=null&&n.heartbeatIntervalMs&&(this.heartbeatIntervalMs=n.heartbeatIntervalMs);const r=(i=n==null?void 0:n.params)===null||i===void 0?void 0:i.apikey;r&&(this.accessToken=r,this.apiKey=r),this.reconnectAfterMs=n!=null&&n.reconnectAfterMs?n.reconnectAfterMs:s=>[1e3,2e3,5e3,1e4][s-1]||1e4,this.encode=n!=null&&n.encode?n.encode:(s,o)=>o(JSON.stringify(s)),this.decode=n!=null&&n.decode?n.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new tm(async()=>{this.disconnect(),this.connect()},this.reconnectAfterMs),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){if(!this.conn){if(this.transport){this.conn=new this.transport(this._endPointURL(),void 0,{headers:this.headers});return}if(Q_){this.conn=new WebSocket(this._endPointURL()),this.setupConnection();return}this.conn=new J_(this._endPointURL(),void 0,{close:()=>{this.conn=null}}),Mi(()=>import("./browser-CZGeQ-QM.js").then(e=>e.b),[],import.meta.url).then(({default:e})=>{this.conn=new e(this._endPointURL(),void 0,{headers:this.headers}),this.setupConnection()})}}disconnect(e,n){this.conn&&(this.conn.onclose=function(){},e?this.conn.close(e,n??""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}getChannels(){return this.channels}async removeChannel(e){const n=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const e=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.disconnect(),e}log(e,n,i){this.logger(e,n,i)}connectionState(){switch(this.conn&&this.conn.readyState){case bi.connecting:return Mn.Connecting;case bi.open:return Mn.Open;case bi.closing:return Mn.Closing;default:return Mn.Closed}}isConnected(){return this.connectionState()===Mn.Open}channel(e,n={config:{}}){const i=new mc(`realtime:${e}`,n,this);return this.channels.push(i),i}push(e){const{topic:n,event:i,payload:r,ref:s}=e,o=()=>{this.encode(e,a=>{var l;(l=this.conn)===null||l===void 0||l.send(a)})};this.log("push",`${n} ${i} (${s})`,r),this.isConnected()?o():this.sendBuffer.push(o)}setAuth(e){this.accessToken=e,this.channels.forEach(n=>{e&&n.updateJoinPayload({access_token:e}),n.joinedOnce&&n._isJoined()&&n._push(ht.access_token,{access_token:e})})}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let n=this.channels.find(i=>i.topic===e&&(i._isJoined()||i._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${e}"`),n.unsubscribe())}_remove(e){this.channels=this.channels.filter(n=>n._joinRef()!==e._joinRef())}setupConnection(){this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:$_}))}_onConnMessage(e){this.decode(e.data,n=>{let{topic:i,event:r,payload:s,ref:o}=n;(o&&o===this.pendingHeartbeatRef||r===(s==null?void 0:s.type))&&(this.pendingHeartbeatRef=null),this.log("receive",`${s.status||""} ${i} ${r} ${o&&"("+o+")"||""}`,s),this.channels.filter(a=>a._isMember(i)).forEach(a=>a._trigger(r,s,o)),this.stateChangeCallbacks.message.forEach(a=>a(n))})}_onConnOpen(){this.log("transport",`connected to ${this._endPointURL()}`),this._flushSendBuffer(),this.reconnectTimer.reset(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this._sendHeartbeat(),this.heartbeatIntervalMs),this.stateChangeCallbacks.open.forEach(e=>e())}_onConnClose(e){this.log("transport","close",e),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(n=>n(e))}_onConnError(e){this.log("transport",e.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach(n=>n(e))}_triggerChanError(){this.channels.forEach(e=>e._trigger(ht.error))}_appendParams(e,n){if(Object.keys(n).length===0)return e;const i=e.match(/\?/)?"&":"?",r=new URLSearchParams(n);return`${e}${i}${r}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_sendHeartbeat(){var e;if(this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),(e=this.conn)===null||e===void 0||e.close(U_,"hearbeat timeout");return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth(this.accessToken)}}}class J_{constructor(e,n,i){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=bi.connecting,this.send=()=>{},this.url=null,this.url=e,this.close=i.close}}class yc extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function Ce(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}class Z_ extends yc{constructor(e,n){super(e),this.name="StorageApiError",this.status=n}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class td extends yc{constructor(e,n){super(e),this.name="StorageUnknownError",this.originalError=n}}var ew=function(t,e,n,i){function r(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(i.next(c))}catch(h){o(h)}}function l(c){try{u(i.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):r(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};const im=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>Mi(()=>Promise.resolve().then(()=>ss),void 0,import.meta.url).then(({default:i})=>i(...n)):e=fetch,(...n)=>e(...n)},tw=()=>ew(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield Mi(()=>Promise.resolve().then(()=>ss),void 0,import.meta.url)).Response:Response});var Bi=function(t,e,n,i){function r(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(i.next(c))}catch(h){o(h)}}function l(c){try{u(i.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):r(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};const Wa=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),nw=(t,e)=>Bi(void 0,void 0,void 0,function*(){const n=yield tw();t instanceof n?t.json().then(i=>{e(new Z_(Wa(i),t.status||500))}).catch(i=>{e(new td(Wa(i),i))}):e(new td(Wa(t),t))}),iw=(t,e,n,i)=>{const r={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?r:(r.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),r.body=JSON.stringify(i),Object.assign(Object.assign({},r),n))};function ha(t,e,n,i,r,s){return Bi(this,void 0,void 0,function*(){return new Promise((o,a)=>{t(n,iw(e,i,r,s)).then(l=>{if(!l.ok)throw l;return i!=null&&i.noResolveJson?l:l.json()}).then(l=>o(l)).catch(l=>nw(l,a))})})}function iu(t,e,n,i){return Bi(this,void 0,void 0,function*(){return ha(t,"GET",e,n,i)})}function Yt(t,e,n,i,r){return Bi(this,void 0,void 0,function*(){return ha(t,"POST",e,i,r,n)})}function rw(t,e,n,i,r){return Bi(this,void 0,void 0,function*(){return ha(t,"PUT",e,i,r,n)})}function rm(t,e,n,i,r){return Bi(this,void 0,void 0,function*(){return ha(t,"DELETE",e,i,r,n)})}var Xe=function(t,e,n,i){function r(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(i.next(c))}catch(h){o(h)}}function l(c){try{u(i.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):r(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};const sw={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},nd={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class ow{constructor(e,n={},i,r){this.url=e,this.headers=n,this.bucketId=i,this.fetch=im(r)}uploadOrUpdate(e,n,i,r){return Xe(this,void 0,void 0,function*(){try{let s;const o=Object.assign(Object.assign({},nd),r),a=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(o.upsert)});typeof Blob<"u"&&i instanceof Blob?(s=new FormData,s.append("cacheControl",o.cacheControl),s.append("",i)):typeof FormData<"u"&&i instanceof FormData?(s=i,s.append("cacheControl",o.cacheControl)):(s=i,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType);const l=this._removeEmptyFolders(n),u=this._getFinalPath(l),c=yield this.fetch(`${this.url}/object/${u}`,Object.assign({method:e,body:s,headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{})),h=yield c.json();return c.ok?{data:{path:l,id:h.Id,fullPath:h.Key},error:null}:{data:null,error:h}}catch(s){if(Ce(s))return{data:null,error:s};throw s}})}upload(e,n,i){return Xe(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,n,i)})}uploadToSignedUrl(e,n,i,r){return Xe(this,void 0,void 0,function*(){const s=this._removeEmptyFolders(e),o=this._getFinalPath(s),a=new URL(this.url+`/object/upload/sign/${o}`);a.searchParams.set("token",n);try{let l;const u=Object.assign({upsert:nd.upsert},r),c=Object.assign(Object.assign({},this.headers),{"x-upsert":String(u.upsert)});typeof Blob<"u"&&i instanceof Blob?(l=new FormData,l.append("cacheControl",u.cacheControl),l.append("",i)):typeof FormData<"u"&&i instanceof FormData?(l=i,l.append("cacheControl",u.cacheControl)):(l=i,c["cache-control"]=`max-age=${u.cacheControl}`,c["content-type"]=u.contentType);const h=yield this.fetch(a.toString(),{method:"PUT",body:l,headers:c}),d=yield h.json();return h.ok?{data:{path:s,fullPath:d.Key},error:null}:{data:null,error:d}}catch(l){if(Ce(l))return{data:null,error:l};throw l}})}createSignedUploadUrl(e){return Xe(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e);const i=yield Yt(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:this.headers}),r=new URL(this.url+i.url),s=r.searchParams.get("token");if(!s)throw new yc("No token returned by API");return{data:{signedUrl:r.toString(),path:e,token:s},error:null}}catch(n){if(Ce(n))return{data:null,error:n};throw n}})}update(e,n,i){return Xe(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,n,i)})}move(e,n){return Xe(this,void 0,void 0,function*(){try{return{data:yield Yt(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:n},{headers:this.headers}),error:null}}catch(i){if(Ce(i))return{data:null,error:i};throw i}})}copy(e,n){return Xe(this,void 0,void 0,function*(){try{return{data:{path:(yield Yt(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:n},{headers:this.headers})).Key},error:null}}catch(i){if(Ce(i))return{data:null,error:i};throw i}})}createSignedUrl(e,n,i){return Xe(this,void 0,void 0,function*(){try{let r=this._getFinalPath(e),s=yield Yt(this.fetch,`${this.url}/object/sign/${r}`,Object.assign({expiresIn:n},i!=null&&i.transform?{transform:i.transform}:{}),{headers:this.headers});const o=i!=null&&i.download?`&download=${i.download===!0?"":i.download}`:"";return s={signedUrl:encodeURI(`${this.url}${s.signedURL}${o}`)},{data:s,error:null}}catch(r){if(Ce(r))return{data:null,error:r};throw r}})}createSignedUrls(e,n,i){return Xe(this,void 0,void 0,function*(){try{const r=yield Yt(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:n,paths:e},{headers:this.headers}),s=i!=null&&i.download?`&download=${i.download===!0?"":i.download}`:"";return{data:r.map(o=>Object.assign(Object.assign({},o),{signedUrl:o.signedURL?encodeURI(`${this.url}${o.signedURL}${s}`):null})),error:null}}catch(r){if(Ce(r))return{data:null,error:r};throw r}})}download(e,n){return Xe(this,void 0,void 0,function*(){const r=typeof(n==null?void 0:n.transform)<"u"?"render/image/authenticated":"object",s=this.transformOptsToQueryString((n==null?void 0:n.transform)||{}),o=s?`?${s}`:"";try{const a=this._getFinalPath(e);return{data:yield(yield iu(this.fetch,`${this.url}/${r}/${a}${o}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(a){if(Ce(a))return{data:null,error:a};throw a}})}getPublicUrl(e,n){const i=this._getFinalPath(e),r=[],s=n!=null&&n.download?`download=${n.download===!0?"":n.download}`:"";s!==""&&r.push(s);const a=typeof(n==null?void 0:n.transform)<"u"?"render/image":"object",l=this.transformOptsToQueryString((n==null?void 0:n.transform)||{});l!==""&&r.push(l);let u=r.join("&");return u!==""&&(u=`?${u}`),{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${i}${u}`)}}}remove(e){return Xe(this,void 0,void 0,function*(){try{return{data:yield rm(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(n){if(Ce(n))return{data:null,error:n};throw n}})}list(e,n,i){return Xe(this,void 0,void 0,function*(){try{const r=Object.assign(Object.assign(Object.assign({},sw),n),{prefix:e||""});return{data:yield Yt(this.fetch,`${this.url}/object/list/${this.bucketId}`,r,{headers:this.headers},i),error:null}}catch(r){if(Ce(r))return{data:null,error:r};throw r}})}_getFinalPath(e){return`${this.bucketId}/${e}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const n=[];return e.width&&n.push(`width=${e.width}`),e.height&&n.push(`height=${e.height}`),e.resize&&n.push(`resize=${e.resize}`),e.format&&n.push(`format=${e.format}`),e.quality&&n.push(`quality=${e.quality}`),n.join("&")}}const aw="2.5.5",lw={"X-Client-Info":`storage-js/${aw}`};var Jn=function(t,e,n,i){function r(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(i.next(c))}catch(h){o(h)}}function l(c){try{u(i.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):r(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};class uw{constructor(e,n={},i){this.url=e,this.headers=Object.assign(Object.assign({},lw),n),this.fetch=im(i)}listBuckets(){return Jn(this,void 0,void 0,function*(){try{return{data:yield iu(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(Ce(e))return{data:null,error:e};throw e}})}getBucket(e){return Jn(this,void 0,void 0,function*(){try{return{data:yield iu(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(n){if(Ce(n))return{data:null,error:n};throw n}})}createBucket(e,n={public:!1}){return Jn(this,void 0,void 0,function*(){try{return{data:yield Yt(this.fetch,`${this.url}/bucket`,{id:e,name:e,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if(Ce(i))return{data:null,error:i};throw i}})}updateBucket(e,n){return Jn(this,void 0,void 0,function*(){try{return{data:yield rw(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if(Ce(i))return{data:null,error:i};throw i}})}emptyBucket(e){return Jn(this,void 0,void 0,function*(){try{return{data:yield Yt(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(n){if(Ce(n))return{data:null,error:n};throw n}})}deleteBucket(e){return Jn(this,void 0,void 0,function*(){try{return{data:yield rm(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(n){if(Ce(n))return{data:null,error:n};throw n}})}}class cw extends uw{constructor(e,n={},i){super(e,n,i)}from(e){return new ow(this.url,this.headers,e,this.fetch)}}const hw="2.43.4";let ar="";typeof Deno<"u"?ar="deno":typeof document<"u"?ar="web":typeof navigator<"u"&&navigator.product==="ReactNative"?ar="react-native":ar="node";const dw={"X-Client-Info":`supabase-js-${ar}/${hw}`},fw={headers:dw},pw={schema:"public"},gw={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},mw={};var yw=function(t,e,n,i){function r(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(i.next(c))}catch(h){o(h)}}function l(c){try{u(i.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):r(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};const vw=t=>{let e;return t?e=t:typeof fetch>"u"?e=pc:e=fetch,(...n)=>e(...n)},_w=()=>typeof Headers>"u"?Zg:Headers,ww=(t,e,n)=>{const i=vw(n),r=_w();return(s,o)=>yw(void 0,void 0,void 0,function*(){var a;const l=(a=yield e())!==null&&a!==void 0?a:t;let u=new r(o==null?void 0:o.headers);return u.has("apikey")||u.set("apikey",t),u.has("Authorization")||u.set("Authorization",`Bearer ${l}`),i(s,Object.assign(Object.assign({},o),{headers:u}))})};function xw(t){return t.replace(/\/$/,"")}function kw(t,e){const{db:n,auth:i,realtime:r,global:s}=t,{db:o,auth:a,realtime:l,global:u}=e;return{db:Object.assign(Object.assign({},o),n),auth:Object.assign(Object.assign({},a),i),realtime:Object.assign(Object.assign({},l),r),global:Object.assign(Object.assign({},u),s)}}const sm="2.64.2",bw="http://localhost:9999",Sw="supabase.auth.token",Cw={"X-Client-Info":`gotrue-js/${sm}`},id=10,ru="X-Supabase-Api-Version",om={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}};function Ew(t){return Math.round(Date.now()/1e3)+t}function Pw(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}const lt=()=>typeof document<"u",wn={tested:!1,writable:!1},kr=()=>{if(!lt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(wn.tested)return wn.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),wn.tested=!0,wn.writable=!0}catch{wn.tested=!0,wn.writable=!1}return wn.writable};function Ka(t){const e={},n=new URL(t);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((r,s)=>{e[s]=r})}catch{}return n.searchParams.forEach((i,r)=>{e[r]=i}),e}const am=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>Mi(()=>Promise.resolve().then(()=>ss),void 0,import.meta.url).then(({default:i})=>i(...n)):e=fetch,(...n)=>e(...n)},Tw=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",lm=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},Es=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return n}},Ya=async(t,e)=>{await t.removeItem(e)};function Ow(t){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let n="",i,r,s,o,a,l,u,c=0;for(t=t.replace("-","+").replace("_","/");c>4,r=(a&15)<<4|l>>2,s=(l&3)<<6|u,n=n+String.fromCharCode(i),l!=64&&r!=0&&(n=n+String.fromCharCode(r)),u!=64&&s!=0&&(n=n+String.fromCharCode(s));return n}class da{constructor(){this.promise=new da.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}da.promiseConstructor=Promise;function rd(t){const e=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i,n=t.split(".");if(n.length!==3)throw new Error("JWT is not valid: not a JWT structure");if(!e.test(n[1]))throw new Error("JWT is not valid: payload is not in base64url format");const i=n[1];return JSON.parse(Ow(i))}async function Lw(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function Mw(t,e){return new Promise((i,r)=>{(async()=>{for(let s=0;s<1/0;s++)try{const o=await t(s);if(!e(s,null,o)){i(o);return}}catch(o){if(!e(s,o)){r(o);return}}})()})}function Rw(t){return("0"+t.toString(16)).substr(-2)}function Iw(){const e=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",i=n.length;let r="";for(let s=0;s<56;s++)r+=n.charAt(Math.floor(Math.random()*i));return r}return crypto.getRandomValues(e),Array.from(e,Rw).join("")}async function Aw(t){const n=new TextEncoder().encode(t),i=await crypto.subtle.digest("SHA-256",n),r=new Uint8Array(i);return Array.from(r).map(s=>String.fromCharCode(s)).join("")}function Dw(t){return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function jw(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const n=await Aw(t);return Dw(n)}async function Zn(t,e,n=!1){const i=Iw();let r=i;n&&(r+="/PASSWORD_RECOVERY"),await lm(t,`${e}-code-verifier`,r);const s=await jw(i);return[s,i===s?"plain":"s256"]}const Nw=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Fw(t){const e=t.headers.get(ru);if(!e||!e.match(Nw))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}class vc extends Error{constructor(e,n,i){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=i}}function j(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class zw extends vc{constructor(e,n,i){super(e,n,i),this.name="AuthApiError",this.status=n,this.code=i}}function $w(t){return j(t)&&t.name==="AuthApiError"}class um extends vc{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class qn extends vc{constructor(e,n,i,r){super(e,i,r),this.name=n,this.status=i}}class xn extends qn{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}class Ga extends qn{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Ps extends qn{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Ts extends qn{constructor(e,n=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class sd extends qn{constructor(e,n=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class su extends qn{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function qa(t){return j(t)&&t.name==="AuthRetryableFetchError"}class od extends qn{constructor(e,n,i){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=i}}var Uw=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(t);rt.msg||t.message||t.error_description||t.error||JSON.stringify(t),Bw=[502,503,504];async function ad(t){var e;if(!Tw(t))throw new su(Tn(t),0);if(Bw.includes(t.status))throw new su(Tn(t),t.status);let n;try{n=await t.json()}catch(s){throw new um(Tn(s),s)}let i;const r=Fw(t);if(r&&r.getTime()>=om["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?i=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(i=n.error_code),i){if(i==="weak_password")throw new od(Tn(n),t.status,((e=n.weak_password)===null||e===void 0?void 0:e.reasons)||[])}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((s,o)=>s&&typeof o=="string",!0))throw new od(Tn(n),t.status,n.weak_password.reasons);throw new zw(Tn(n),t.status||500,i)}const Vw=(t,e,n,i)=>{const r={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?r:(r.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),r.body=JSON.stringify(i),Object.assign(Object.assign({},r),n))};async function F(t,e,n,i){var r;const s=Object.assign({},i==null?void 0:i.headers);s[ru]||(s[ru]=om["2024-01-01"].name),i!=null&&i.jwt&&(s.Authorization=`Bearer ${i.jwt}`);const o=(r=i==null?void 0:i.query)!==null&&r!==void 0?r:{};i!=null&&i.redirectTo&&(o.redirect_to=i.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await Hw(t,e,n+a,{headers:s,noResolveJson:i==null?void 0:i.noResolveJson},{},i==null?void 0:i.body);return i!=null&&i.xform?i==null?void 0:i.xform(l):{data:Object.assign({},l),error:null}}async function Hw(t,e,n,i,r,s){const o=Vw(e,i,r,s);let a;try{a=await t(n,Object.assign({},o))}catch(l){throw console.error(l),new su(Tn(l),0)}if(a.ok||await ad(a),i!=null&&i.noResolveJson)return a;try{return await a.json()}catch(l){await ad(l)}}function Ht(t){var e;let n=null;Gw(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=Ew(t.expires_in)));const i=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:i},error:null}}function ld(t){const e=Ht(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((n,i)=>n&&typeof i=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Qt(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function Ww(t){return{data:t,error:null}}function Kw(t){const{action_link:e,email_otp:n,hashed_token:i,redirect_to:r,verification_type:s}=t,o=Uw(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:n,hashed_token:i,redirect_to:r,verification_type:s},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function Yw(t){return t}function Gw(t){return t.access_token&&t.refresh_token&&t.expires_in}var qw=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(t);r0&&(f.forEach(m=>{const y=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(m.split(";")[1].split("=")[1]);u[`${v}Page`]=y}),u.total=parseInt(d)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(j(u))return{data:{users:[]},error:u};throw u}}async getUserById(e){try{return await F(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Qt})}catch(n){if(j(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){try{return await F(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:Qt})}catch(i){if(j(i))return{data:{user:null},error:i};throw i}}async deleteUser(e,n=!1){try{return await F(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:Qt})}catch(i){if(j(i))return{data:{user:null},error:i};throw i}}async _listFactors(e){try{const{data:n,error:i}=await F(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:r=>({data:{factors:r},error:null})});return{data:n,error:i}}catch(n){if(j(n))return{data:null,error:n};throw n}}async _deleteFactor(e){try{return{data:await F(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(j(n))return{data:null,error:n};throw n}}}const Xw={getItem:t=>kr()?globalThis.localStorage.getItem(t):null,setItem:(t,e)=>{kr()&&globalThis.localStorage.setItem(t,e)},removeItem:t=>{kr()&&globalThis.localStorage.removeItem(t)}};function ud(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}function Jw(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}const ei={debug:!!(globalThis&&kr()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class cm extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class Zw extends cm{}async function ex(t,e,n){ei.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const i=new globalThis.AbortController;return e>0&&setTimeout(()=>{i.abort(),ei.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:i.signal},async r=>{if(r){ei.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,r.name);try{return await n()}finally{ei.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,r.name)}}else{if(e===0)throw ei.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new Zw(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(ei.debug)try{const s=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(s,null," "))}catch(s){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",s)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await n()}})}Jw();const tx={url:bw,storageKey:Sw,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Cw,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1},Xi=30*1e3,cd=3;async function hd(t,e,n){return await n()}class Gr{constructor(e){var n,i;this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=Gr.nextInstanceID,Gr.nextInstanceID+=1,this.instanceID>0&<()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const r=Object.assign(Object.assign({},tx),e);if(this.logDebugMessages=!!r.debug,typeof r.debug=="function"&&(this.logger=r.debug),this.persistSession=r.persistSession,this.storageKey=r.storageKey,this.autoRefreshToken=r.autoRefreshToken,this.admin=new Qw({url:r.url,headers:r.headers,fetch:r.fetch}),this.url=r.url,this.headers=r.headers,this.fetch=am(r.fetch),this.lock=r.lock||hd,this.detectSessionInUrl=r.detectSessionInUrl,this.flowType=r.flowType,this.hasCustomAuthorizationHeader=r.hasCustomAuthorizationHeader,r.lock?this.lock=r.lock:lt()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=ex:this.lock=hd,this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?r.storage?this.storage=r.storage:kr()?this.storage=Xw:(this.memoryStorage={},this.storage=ud(this.memoryStorage)):(this.memoryStorage={},this.storage=ud(this.memoryStorage)),lt()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(s){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",s)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async s=>{this._debug("received broadcast notification from other tab or client",s),await this._notifyAllSubscribers(s.data.event,s.data.session,!1)})}this.initialize()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${sm}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){try{const e=lt()?await this._isPKCEFlow():!1;if(this._debug("#_initialize()","begin","is PKCE flow",e),e||this.detectSessionInUrl&&this._isImplicitGrantFlow()){const{data:n,error:i}=await this._getSessionFromURL(e);if(i)return this._debug("#_initialize()","error detecting session from URL",i),(i==null?void 0:i.message)==="Identity is already linked"||(i==null?void 0:i.message)==="Identity is already linked to another user"?{error:i}:(await this._removeSession(),{error:i});const{session:r,redirectType:s}=n;return this._debug("#_initialize()","detected session in URL",r,"redirect type",s),await this._saveSession(r),setTimeout(async()=>{s==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",r):await this._notifyAllSubscribers("SIGNED_IN",r)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){return j(e)?{error:e}:{error:new um("Unexpected error during initialization",e)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var n,i,r;try{await this._removeSession();const s=await F(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(i=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.data)!==null&&i!==void 0?i:{},gotrue_meta_security:{captcha_token:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}},xform:Ht}),{data:o,error:a}=s;if(a||!o)return{data:{user:null,session:null},error:a};const l=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),{data:{user:u,session:l},error:null}}catch(s){if(j(s))return{data:{user:null,session:null},error:s};throw s}}async signUp(e){var n,i,r;try{await this._removeSession();let s;if("email"in e){const{email:c,password:h,options:d}=e;let f=null,m=null;this.flowType==="pkce"&&([f,m]=await Zn(this.storage,this.storageKey)),s=await F(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d==null?void 0:d.emailRedirectTo,body:{email:c,password:h,data:(n=d==null?void 0:d.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken},code_challenge:f,code_challenge_method:m},xform:Ht})}else if("phone"in e){const{phone:c,password:h,options:d}=e;s=await F(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:c,password:h,data:(i=d==null?void 0:d.data)!==null&&i!==void 0?i:{},channel:(r=d==null?void 0:d.channel)!==null&&r!==void 0?r:"sms",gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:Ht})}else throw new Ps("You must provide either an email or phone number and a password");const{data:o,error:a}=s;if(a||!o)return{data:{user:null,session:null},error:a};const l=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),{data:{user:u,session:l},error:null}}catch(s){if(j(s))return{data:{user:null,session:null},error:s};throw s}}async signInWithPassword(e){try{await this._removeSession();let n;if("email"in e){const{email:s,password:o,options:a}=e;n=await F(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:ld})}else if("phone"in e){const{phone:s,password:o,options:a}=e;n=await F(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:ld})}else throw new Ps("You must provide either an email or phone number and a password");const{data:i,error:r}=n;return r?{data:{user:null,session:null},error:r}:!i||!i.session||!i.user?{data:{user:null,session:null},error:new Ga}:(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign({user:i.user,session:i.session},i.weak_password?{weakPassword:i.weak_password}:null),error:r})}catch(n){if(j(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOAuth(e){var n,i,r,s;return await this._removeSession(),await this._handleProviderSignIn(e.provider,{redirectTo:(n=e.options)===null||n===void 0?void 0:n.redirectTo,scopes:(i=e.options)===null||i===void 0?void 0:i.scopes,queryParams:(r=e.options)===null||r===void 0?void 0:r.queryParams,skipBrowserRedirect:(s=e.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async _exchangeCodeForSession(e){const n=await Es(this.storage,`${this.storageKey}-code-verifier`),[i,r]=(n??"").split("/"),{data:s,error:o}=await F(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:i},xform:Ht});return await Ya(this.storage,`${this.storageKey}-code-verifier`),o?{data:{user:null,session:null,redirectType:null},error:o}:!s||!s.session||!s.user?{data:{user:null,session:null,redirectType:null},error:new Ga}:(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:Object.assign(Object.assign({},s),{redirectType:r??null}),error:o})}async signInWithIdToken(e){await this._removeSession();try{const{options:n,provider:i,token:r,access_token:s,nonce:o}=e,a=await F(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:i,id_token:r,access_token:s,nonce:o,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:Ht}),{data:l,error:u}=a;return u?{data:{user:null,session:null},error:u}:!l||!l.session||!l.user?{data:{user:null,session:null},error:new Ga}:(l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),{data:l,error:u})}catch(n){if(j(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOtp(e){var n,i,r,s,o;try{if(await this._removeSession(),"email"in e){const{email:a,options:l}=e;let u=null,c=null;this.flowType==="pkce"&&([u,c]=await Zn(this.storage,this.storageKey));const{error:h}=await F(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(n=l==null?void 0:l.data)!==null&&n!==void 0?n:{},create_user:(i=l==null?void 0:l.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:u,code_challenge_method:c},redirectTo:l==null?void 0:l.emailRedirectTo});return{data:{user:null,session:null},error:h}}if("phone"in e){const{phone:a,options:l}=e,{data:u,error:c}=await F(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(r=l==null?void 0:l.data)!==null&&r!==void 0?r:{},create_user:(s=l==null?void 0:l.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(o=l==null?void 0:l.channel)!==null&&o!==void 0?o:"sms"}});return{data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:c}}throw new Ps("You must provide either an email or phone number.")}catch(a){if(j(a))return{data:{user:null,session:null},error:a};throw a}}async verifyOtp(e){var n,i;try{e.type!=="email_change"&&e.type!=="phone_change"&&await this._removeSession();let r,s;"options"in e&&(r=(n=e.options)===null||n===void 0?void 0:n.redirectTo,s=(i=e.options)===null||i===void 0?void 0:i.captchaToken);const{data:o,error:a}=await F(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:r,xform:Ht});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,u=o.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),{data:{user:u,session:l},error:null}}catch(r){if(j(r))return{data:{user:null,session:null},error:r};throw r}}async signInWithSSO(e){var n,i,r;try{await this._removeSession();let s=null,o=null;return this.flowType==="pkce"&&([s,o]=await Zn(this.storage,this.storageKey)),await F(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(i=(n=e.options)===null||n===void 0?void 0:n.redirectTo)!==null&&i!==void 0?i:void 0}),!((r=e==null?void 0:e.options)===null||r===void 0)&&r.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:s,code_challenge_method:o}),headers:this.headers,xform:Ww})}catch(s){if(j(s))return{data:null,error:s};throw s}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:n},error:i}=e;if(i)throw i;if(!n)throw new xn;const{error:r}=await F(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return{data:{user:null,session:null},error:r}})}catch(e){if(j(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{e.type!="email_change"&&e.type!="phone_change"&&await this._removeSession();const n=`${this.url}/resend`;if("email"in e){const{email:i,type:r,options:s}=e,{error:o}=await F(this.fetch,"POST",n,{headers:this.headers,body:{email:i,type:r,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},redirectTo:s==null?void 0:s.emailRedirectTo});return{data:{user:null,session:null},error:o}}else if("phone"in e){const{phone:i,type:r,options:s}=e,{data:o,error:a}=await F(this.fetch,"POST",n,{headers:this.headers,body:{phone:i,type:r,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}}});return{data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:a}}throw new Ps("You must provide either an email or phone number and a type")}catch(n){if(j(n))return{data:{user:null,session:null},error:n};throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async n=>n))}async _acquireLock(e,n){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const i=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await i,await n()))();return this.pendingInLock.push((async()=>{try{await r}catch{}})()),r}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const i=n();for(this.pendingInLock.push((async()=>{try{await i}catch{}})()),await i;this.pendingInLock.length;){const r=[...this.pendingInLock];await Promise.all(r),this.pendingInLock.splice(0,r.length)}return await i}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await e(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const n=await Es(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?e=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const i=e.expires_at?e.expires_at<=Date.now()/1e3:!1;if(this._debug("#__loadSession()",`session has${i?"":" not"} expired`,"expires_at",e.expires_at),!i){if(this.storage.isServer){const o=this.suppressGetSessionWarning;e=new Proxy(e,{get(l,u,c){return!o&&u==="user"&&console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and many not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),Reflect.get(l,u,c)}})}return{data:{session:e},error:null}}const{session:r,error:s}=await this._callRefreshToken(e.refresh_token);return s?{data:{session:null},error:s}:{data:{session:r},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await F(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Qt}):await this._useSession(async n=>{var i,r,s;const{data:o,error:a}=n;if(a)throw a;return!(!((i=o.session)===null||i===void 0)&&i.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new xn}:await F(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(r=o.session)===null||r===void 0?void 0:r.access_token)!==null&&s!==void 0?s:void 0,xform:Qt})})}catch(n){if(j(n))return{data:{user:null},error:n};throw n}}async updateUser(e,n={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,n))}async _updateUser(e,n={}){try{return await this._useSession(async i=>{const{data:r,error:s}=i;if(s)throw s;if(!r.session)throw new xn;const o=r.session;let a=null,l=null;this.flowType==="pkce"&&e.email!=null&&([a,l]=await Zn(this.storage,this.storageKey));const{data:u,error:c}=await F(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:l}),jwt:o.access_token,xform:Qt});if(c)throw c;return o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),{data:{user:o.user},error:null}})}catch(i){if(j(i))return{data:{user:null},error:i};throw i}}_decodeJWT(e){return rd(e)}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new xn;const n=Date.now()/1e3;let i=n,r=!0,s=null;const o=rd(e.access_token);if(o.exp&&(i=o.exp,r=i<=n),r){const{session:a,error:l}=await this._callRefreshToken(e.refresh_token);if(l)return{data:{user:null,session:null},error:l};if(!a)return{data:{user:null,session:null},error:null};s=a}else{const{data:a,error:l}=await this._getUser(e.access_token);if(l)throw l;s={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:i-n,expires_at:i},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return{data:{user:s.user,session:s},error:null}}catch(n){if(j(n))return{data:{session:null,user:null},error:n};throw n}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async n=>{var i;if(!e){const{data:o,error:a}=n;if(a)throw a;e=(i=o.session)!==null&&i!==void 0?i:void 0}if(!(e!=null&&e.refresh_token))throw new xn;const{session:r,error:s}=await this._callRefreshToken(e.refresh_token);return s?{data:{user:null,session:null},error:s}:r?{data:{user:r.user,session:r},error:null}:{data:{user:null,session:null},error:null}})}catch(n){if(j(n))return{data:{user:null,session:null},error:n};throw n}}async _getSessionFromURL(e){try{if(!lt())throw new Ts("No browser detected.");if(this.flowType==="implicit"&&!this._isImplicitGrantFlow())throw new Ts("Not a valid implicit grant flow url.");if(this.flowType=="pkce"&&!e)throw new sd("Not a valid PKCE flow url.");const n=Ka(window.location.href);if(e){if(!n.code)throw new sd("No code detected.");const{data:g,error:_}=await this._exchangeCodeForSession(n.code);if(_)throw _;const w=new URL(window.location.href);return w.searchParams.delete("code"),window.history.replaceState(window.history.state,"",w.toString()),{data:{session:g.session,redirectType:null},error:null}}if(n.error||n.error_description||n.error_code)throw new Ts(n.error_description||"Error in URL with unspecified error_description",{error:n.error||"unspecified_error",code:n.error_code||"unspecified_code"});const{provider_token:i,provider_refresh_token:r,access_token:s,refresh_token:o,expires_in:a,expires_at:l,token_type:u}=n;if(!s||!a||!o||!u)throw new Ts("No session defined in URL");const c=Math.round(Date.now()/1e3),h=parseInt(a);let d=c+h;l&&(d=parseInt(l));const f=d-c;f*1e3<=Xi&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${h}s`);const m=d-h;c-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,d,c):c-m<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clok for skew",m,d,c);const{data:y,error:v}=await this._getUser(s);if(v)throw v;const p={provider_token:i,provider_refresh_token:r,access_token:s,expires_in:h,expires_at:d,refresh_token:o,token_type:u,user:y.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:p,redirectType:n.type},error:null}}catch(n){if(j(n))return{data:{session:null,redirectType:null},error:n};throw n}}_isImplicitGrantFlow(){const e=Ka(window.location.href);return!!(lt()&&(e.access_token||e.error_description))}async _isPKCEFlow(){const e=Ka(window.location.href),n=await Es(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&n)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async n=>{var i;const{data:r,error:s}=n;if(s)return{error:s};const o=(i=r.session)===null||i===void 0?void 0:i.access_token;if(o){const{error:a}=await this.admin.signOut(o,e);if(a&&!($w(a)&&(a.status===404||a.status===401||a.status===403)))return{error:a}}return e!=="others"&&(await this._removeSession(),await Ya(this.storage,`${this.storageKey}-code-verifier`),await this._notifyAllSubscribers("SIGNED_OUT",null)),{error:null}})}onAuthStateChange(e){const n=Pw(),i={id:n,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,i),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:i}}}async _emitInitialSession(e){return await this._useSession(async n=>{var i,r;try{const{data:{session:s},error:o}=n;if(o)throw o;await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",e,"session",s)}catch(s){await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",s),console.error(s)}})}async resetPasswordForEmail(e,n={}){let i=null,r=null;this.flowType==="pkce"&&([i,r]=await Zn(this.storage,this.storageKey,!0));try{return await F(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:i,code_challenge_method:r,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(s){if(j(s))return{data:null,error:s};throw s}}async getUserIdentities(){var e;try{const{data:n,error:i}=await this.getUser();if(i)throw i;return{data:{identities:(e=n.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(n){if(j(n))return{data:null,error:n};throw n}}async linkIdentity(e){var n;try{const{data:i,error:r}=await this._useSession(async s=>{var o,a,l,u,c;const{data:h,error:d}=s;if(d)throw d;const f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await F(this.fetch,"GET",f,{headers:this.headers,jwt:(c=(u=h.session)===null||u===void 0?void 0:u.access_token)!==null&&c!==void 0?c:void 0})});if(r)throw r;return lt()&&!(!((n=e.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(i==null?void 0:i.url),{data:{provider:e.provider,url:i==null?void 0:i.url},error:null}}catch(i){if(j(i))return{data:{provider:e.provider,url:null},error:i};throw i}}async unlinkIdentity(e){try{return await this._useSession(async n=>{var i,r;const{data:s,error:o}=n;if(o)throw o;return await F(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(r=(i=s.session)===null||i===void 0?void 0:i.access_token)!==null&&r!==void 0?r:void 0})})}catch(n){if(j(n))return{data:null,error:n};throw n}}async _refreshAccessToken(e){const n=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{const i=Date.now();return await Mw(async r=>(r>0&&await Lw(200*Math.pow(2,r-1)),this._debug(n,"refreshing attempt",r),await F(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Ht})),(r,s)=>{const o=200*Math.pow(2,r);return s&&qa(s)&&Date.now()+o-i{try{await a.callback(e,n)}catch(l){s.push(l)}});if(await Promise.all(o),s.length>0){for(let a=0;athis._autoRefreshTokenTick(),Xi);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async n=>{const{data:{session:i}}=n;if(!i||!i.refresh_token||!i.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const r=Math.floor((i.expires_at*1e3-e)/Xi);this._debug("#_autoRefreshTokenTick()",`access token expires in ${r} ticks, a tick lasts ${Xi}ms, refresh threshold is ${cd} ticks`),r<=cd&&await this._callRefreshToken(i.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof cm)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!lt()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const n=`#_onVisibilityChanged(${e})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,n,i){const r=[`provider=${encodeURIComponent(n)}`];if(i!=null&&i.redirectTo&&r.push(`redirect_to=${encodeURIComponent(i.redirectTo)}`),i!=null&&i.scopes&&r.push(`scopes=${encodeURIComponent(i.scopes)}`),this.flowType==="pkce"){const[s,o]=await Zn(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(o)}`});r.push(a.toString())}if(i!=null&&i.queryParams){const s=new URLSearchParams(i.queryParams);r.push(s.toString())}return i!=null&&i.skipBrowserRedirect&&r.push(`skip_http_redirect=${i.skipBrowserRedirect}`),`${e}?${r.join("&")}`}async _unenroll(e){try{return await this._useSession(async n=>{var i;const{data:r,error:s}=n;return s?{data:null,error:s}:await F(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(i=r==null?void 0:r.session)===null||i===void 0?void 0:i.access_token})})}catch(n){if(j(n))return{data:null,error:n};throw n}}async _enroll(e){try{return await this._useSession(async n=>{var i,r;const{data:s,error:o}=n;if(o)return{data:null,error:o};const{data:a,error:l}=await F(this.fetch,"POST",`${this.url}/factors`,{body:{friendly_name:e.friendlyName,factor_type:e.factorType,issuer:e.issuer},headers:this.headers,jwt:(i=s==null?void 0:s.session)===null||i===void 0?void 0:i.access_token});return l?{data:null,error:l}:(!((r=a==null?void 0:a.totp)===null||r===void 0)&&r.qr_code&&(a.totp.qr_code=`data:image/svg+xml;utf-8,${a.totp.qr_code}`),{data:a,error:null})})}catch(n){if(j(n))return{data:null,error:n};throw n}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var i;const{data:r,error:s}=n;if(s)return{data:null,error:s};const{data:o,error:a}=await F(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:(i=r==null?void 0:r.session)===null||i===void 0?void 0:i.access_token});return a?{data:null,error:a}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),{data:o,error:a})})}catch(n){if(j(n))return{data:null,error:n};throw n}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var i;const{data:r,error:s}=n;return s?{data:null,error:s}:await F(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{headers:this.headers,jwt:(i=r==null?void 0:r.session)===null||i===void 0?void 0:i.access_token})})}catch(n){if(j(n))return{data:null,error:n};throw n}})}async _challengeAndVerify(e){const{data:n,error:i}=await this._challenge({factorId:e.factorId});return i?{data:null,error:i}:await this._verify({factorId:e.factorId,challengeId:n.id,code:e.code})}async _listFactors(){const{data:{user:e},error:n}=await this.getUser();if(n)return{data:null,error:n};const i=(e==null?void 0:e.factors)||[],r=i.filter(s=>s.factor_type==="totp"&&s.status==="verified");return{data:{all:i,totp:r},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var n,i;const{data:{session:r},error:s}=e;if(s)return{data:null,error:s};if(!r)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const o=this._decodeJWT(r.access_token);let a=null;o.aal&&(a=o.aal);let l=a;((i=(n=r.user.factors)===null||n===void 0?void 0:n.filter(h=>h.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(l="aal2");const c=o.amr||[];return{data:{currentLevel:a,nextLevel:l,currentAuthenticationMethods:c},error:null}}))}}Gr.nextInstanceID=0;const nx=Gr;class ix extends nx{constructor(e){super(e)}}var rx=function(t,e,n,i){function r(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(i.next(c))}catch(h){o(h)}}function l(c){try{u(i.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):r(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};class sx{constructor(e,n,i){var r,s,o;if(this.supabaseUrl=e,this.supabaseKey=n,!e)throw new Error("supabaseUrl is required.");if(!n)throw new Error("supabaseKey is required.");const a=xw(e);this.realtimeUrl=`${a}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${a}/auth/v1`,this.storageUrl=`${a}/storage/v1`,this.functionsUrl=`${a}/functions/v1`;const l=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,u={db:pw,realtime:mw,auth:Object.assign(Object.assign({},gw),{storageKey:l}),global:fw},c=kw(i??{},u);this.storageKey=(r=c.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(s=c.global.headers)!==null&&s!==void 0?s:{},this.auth=this._initSupabaseAuthClient((o=c.auth)!==null&&o!==void 0?o:{},this.headers,c.global.fetch),this.fetch=ww(n,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},c.realtime)),this.rest=new gc(`${a}/rest/v1`,{headers:this.headers,schema:c.db.schema,fetch:this.fetch}),this._listenForAuthEvents()}get functions(){return new P_(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new cw(this.storageUrl,this.headers,this.fetch)}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,n={},i={}){return this.rest.rpc(e,n,i)}channel(e,n={config:{}}){return this.realtime.channel(e,n)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,n;return rx(this,void 0,void 0,function*(){const{data:i}=yield this.auth.getSession();return(n=(e=i.session)===null||e===void 0?void 0:e.access_token)!==null&&n!==void 0?n:null})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:n,detectSessionInUrl:i,storage:r,storageKey:s,flowType:o,debug:a},l,u){var c;const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new ix({url:this.authUrl,headers:Object.assign(Object.assign({},h),l),storageKey:s,autoRefreshToken:e,persistSession:n,detectSessionInUrl:i,storage:r,flowType:o,debug:a,fetch:u,hasCustomAuthorizationHeader:(c="Authorization"in this.headers)!==null&&c!==void 0?c:!1})}_initRealtimeClient(e){return new X_(this.realtimeUrl,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,i)=>{this._handleTokenChanged(n,"CLIENT",i==null?void 0:i.access_token)})}_handleTokenChanged(e,n,i){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==i?(this.realtime.setAuth(i??null),this.changedAccessToken=i):e==="SIGNED_OUT"&&(this.realtime.setAuth(this.supabaseKey),n=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const ox=(t,e,n)=>new sx(t,e,n);function ti(t){let e="flex items-center w-full p-3 leading-tight transition-all rounded-lg outline-none text-start hover:bg-blue-500";return t.name===t.currentPage&&(e+=" border-2 border-black"),P.jsxs("div",{role:"button",className:e,children:[P.jsx("div",{className:"grid mr-4 place-items-center",children:P.jsx("i",{className:t.icon})}),P.jsx("a",{href:t.href,children:t.name})]})}function hm(t){return P.jsxs("div",{className:"relative flex h-full w-full max-w-[20rem] flex-col rounded-xl bg-white bg-clip-border text-gray-700 shadow-xl shadow-blue-gray-900/5",children:[P.jsx("div",{className:"p-4 mb-2",children:P.jsx("h5",{className:"block font-sans text-xl antialiased font-semibold leading-snug tracking-normal text-blue-gray-900",children:P.jsx("a",{href:"/",children:"fs-tracer"})})}),P.jsxs("nav",{className:"flex min-w-[240px] flex-col gap-1 font-sans text-base font-normal text-blue-gray-700",children:[P.jsx(ti,{name:"Home",icon:"fa-solid fa-house",href:"/",currentPage:t.currentPage}),P.jsx(ti,{name:"Recent files",icon:"fa-solid fa-folder",href:"/recent",currentPage:t.currentPage}),P.jsx(ti,{name:"Search",icon:"fa-solid fa-magnifying-glass",href:"/search",currentPage:t.currentPage}),P.jsx(ti,{name:"Monitoring",icon:"fa-solid fa-chart-column",href:"/monitoring",currentPage:t.currentPage}),P.jsx(ti,{name:"Setup",icon:"fa-solid fa-gear",href:"/setup",currentPage:t.currentPage}),P.jsx(ti,{name:"Logout",icon:"fa-solid fa-right-from-bracket",href:"/logout",currentPage:t.currentPage})]})]})}/*! + * @kurkle/color v0.3.2 + * https://github.com/kurkle/color#readme + * (c) 2023 Jukka Kurkela + * Released under the MIT License + */function os(t){return t+.5|0}const en=(t,e,n)=>Math.max(Math.min(t,n),e);function lr(t){return en(os(t*2.55),0,255)}function dn(t){return en(os(t*255),0,255)}function Rt(t){return en(os(t/2.55)/100,0,1)}function dd(t){return en(os(t*100),0,100)}const Je={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},ou=[..."0123456789ABCDEF"],ax=t=>ou[t&15],lx=t=>ou[(t&240)>>4]+ou[t&15],Os=t=>(t&240)>>4===(t&15),ux=t=>Os(t.r)&&Os(t.g)&&Os(t.b)&&Os(t.a);function cx(t){var e=t.length,n;return t[0]==="#"&&(e===4||e===5?n={r:255&Je[t[1]]*17,g:255&Je[t[2]]*17,b:255&Je[t[3]]*17,a:e===5?Je[t[4]]*17:255}:(e===7||e===9)&&(n={r:Je[t[1]]<<4|Je[t[2]],g:Je[t[3]]<<4|Je[t[4]],b:Je[t[5]]<<4|Je[t[6]],a:e===9?Je[t[7]]<<4|Je[t[8]]:255})),n}const hx=(t,e)=>t<255?e(t):"";function dx(t){var e=ux(t)?ax:lx;return t?"#"+e(t.r)+e(t.g)+e(t.b)+hx(t.a,e):void 0}const fx=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function dm(t,e,n){const i=e*Math.min(n,1-n),r=(s,o=(s+t/30)%12)=>n-i*Math.max(Math.min(o-3,9-o,1),-1);return[r(0),r(8),r(4)]}function px(t,e,n){const i=(r,s=(r+t/60)%6)=>n-n*e*Math.max(Math.min(s,4-s,1),0);return[i(5),i(3),i(1)]}function gx(t,e,n){const i=dm(t,1,.5);let r;for(e+n>1&&(r=1/(e+n),e*=r,n*=r),r=0;r<3;r++)i[r]*=1-e-n,i[r]+=e;return i}function mx(t,e,n,i,r){return t===r?(e-n)/i+(e.5?c/(2-s-o):c/(s+o),l=mx(n,i,r,c,s),l=l*60+.5),[l|0,u||0,a]}function wc(t,e,n,i){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,n,i)).map(dn)}function xc(t,e,n){return wc(dm,t,e,n)}function yx(t,e,n){return wc(gx,t,e,n)}function vx(t,e,n){return wc(px,t,e,n)}function fm(t){return(t%360+360)%360}function _x(t){const e=fx.exec(t);let n=255,i;if(!e)return;e[5]!==i&&(n=e[6]?lr(+e[5]):dn(+e[5]));const r=fm(+e[2]),s=+e[3]/100,o=+e[4]/100;return e[1]==="hwb"?i=yx(r,s,o):e[1]==="hsv"?i=vx(r,s,o):i=xc(r,s,o),{r:i[0],g:i[1],b:i[2],a:n}}function wx(t,e){var n=_c(t);n[0]=fm(n[0]+e),n=xc(n),t.r=n[0],t.g=n[1],t.b=n[2]}function xx(t){if(!t)return;const e=_c(t),n=e[0],i=dd(e[1]),r=dd(e[2]);return t.a<255?`hsla(${n}, ${i}%, ${r}%, ${Rt(t.a)})`:`hsl(${n}, ${i}%, ${r}%)`}const fd={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"},pd={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 kx(){const t={},e=Object.keys(pd),n=Object.keys(fd);let i,r,s,o,a;for(i=0;i>16&255,s>>8&255,s&255]}return t}let Ls;function bx(t){Ls||(Ls=kx(),Ls.transparent=[0,0,0,0]);const e=Ls[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}const Sx=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Cx(t){const e=Sx.exec(t);let n=255,i,r,s;if(e){if(e[7]!==i){const o=+e[7];n=e[8]?lr(o):en(o*255,0,255)}return i=+e[1],r=+e[3],s=+e[5],i=255&(e[2]?lr(i):en(i,0,255)),r=255&(e[4]?lr(r):en(r,0,255)),s=255&(e[6]?lr(s):en(s,0,255)),{r:i,g:r,b:s,a:n}}}function Ex(t){return t&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${Rt(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`)}const Qa=t=>t<=.0031308?t*12.92:Math.pow(t,1/2.4)*1.055-.055,ni=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function Px(t,e,n){const i=ni(Rt(t.r)),r=ni(Rt(t.g)),s=ni(Rt(t.b));return{r:dn(Qa(i+n*(ni(Rt(e.r))-i))),g:dn(Qa(r+n*(ni(Rt(e.g))-r))),b:dn(Qa(s+n*(ni(Rt(e.b))-s))),a:t.a+n*(e.a-t.a)}}function Ms(t,e,n){if(t){let i=_c(t);i[e]=Math.max(0,Math.min(i[e]+i[e]*n,e===0?360:1)),i=xc(i),t.r=i[0],t.g=i[1],t.b=i[2]}}function pm(t,e){return t&&Object.assign(e||{},t)}function gd(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=dn(t[3]))):(e=pm(t,{r:0,g:0,b:0,a:1}),e.a=dn(e.a)),e}function Tx(t){return t.charAt(0)==="r"?Cx(t):_x(t)}class qr{constructor(e){if(e instanceof qr)return e;const n=typeof e;let i;n==="object"?i=gd(e):n==="string"&&(i=cx(e)||bx(e)||Tx(e)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var e=pm(this._rgb);return e&&(e.a=Rt(e.a)),e}set rgb(e){this._rgb=gd(e)}rgbString(){return this._valid?Ex(this._rgb):void 0}hexString(){return this._valid?dx(this._rgb):void 0}hslString(){return this._valid?xx(this._rgb):void 0}mix(e,n){if(e){const i=this.rgb,r=e.rgb;let s;const o=n===s?.5:n,a=2*o-1,l=i.a-r.a,u=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;s=1-u,i.r=255&u*i.r+s*r.r+.5,i.g=255&u*i.g+s*r.g+.5,i.b=255&u*i.b+s*r.b+.5,i.a=o*i.a+(1-o)*r.a,this.rgb=i}return this}interpolate(e,n){return e&&(this._rgb=Px(this._rgb,e._rgb,n)),this}clone(){return new qr(this.rgb)}alpha(e){return this._rgb.a=dn(e),this}clearer(e){const n=this._rgb;return n.a*=1-e,this}greyscale(){const e=this._rgb,n=os(e.r*.3+e.g*.59+e.b*.11);return e.r=e.g=e.b=n,this}opaquer(e){const n=this._rgb;return n.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return Ms(this._rgb,2,e),this}darken(e){return Ms(this._rgb,2,-e),this}saturate(e){return Ms(this._rgb,1,e),this}desaturate(e){return Ms(this._rgb,1,-e),this}rotate(e){return wx(this._rgb,e),this}}/*! + * Chart.js v4.4.3 + * https://www.chartjs.org + * (c) 2024 Chart.js Contributors + * Released under the MIT License + */function Pt(){}const Ox=(()=>{let t=0;return()=>t++})();function J(t){return t===null||typeof t>"u"}function le(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function U(t){return t!==null&&Object.prototype.toString.call(t)==="[object Object]"}function ye(t){return(typeof t=="number"||t instanceof Number)&&isFinite(+t)}function Be(t,e){return ye(t)?t:e}function W(t,e){return typeof t>"u"?e:t}const Lx=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100*e:+t;function re(t,e,n){if(t&&typeof t.call=="function")return t.apply(n,e)}function V(t,e,n,i){let r,s,o;if(le(t))for(s=t.length,r=0;rt,x:t=>t.x,y:t=>t.y};function Ix(t){const e=t.split("."),n=[];let i="";for(const r of e)i+=r,i.endsWith("\\")?i=i.slice(0,-1)+".":(n.push(i),i="");return n}function Ax(t){const e=Ix(t);return n=>{for(const i of e){if(i==="")break;n=n&&n[i]}return n}}function jo(t,e){return(md[e]||(md[e]=Ax(e)))(t)}function kc(t){return t.charAt(0).toUpperCase()+t.slice(1)}const No=t=>typeof t<"u",gn=t=>typeof t=="function",yd=(t,e)=>{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0};function Dx(t){return t.type==="mouseup"||t.type==="click"||t.type==="contextmenu"}const _e=Math.PI,mt=2*_e,jx=mt+_e,Fo=Number.POSITIVE_INFINITY,Nx=_e/180,We=_e/2,kn=_e/4,vd=_e*2/3,tn=Math.log10,Ii=Math.sign;function Sr(t,e,n){return Math.abs(t-e)r-s).pop(),e}function Xr(t){return!isNaN(parseFloat(t))&&isFinite(t)}function zx(t,e){const n=Math.round(t);return n-e<=t&&n+e>=t}function mm(t,e,n){let i,r,s;for(i=0,r=t.length;il&&u=Math.min(e,n)-i&&t<=Math.max(e,n)+i}function Sc(t,e,n){n=n||(o=>t[o]1;)s=r+i>>1,n(s)?r=s:i=s;return{lo:r,hi:i}}const Dn=(t,e,n,i)=>Sc(t,n,i?r=>{const s=t[r][e];return st[r][e]Sc(t,n,i=>t[i][e]>=n);function Wx(t,e,n){let i=0,r=t.length;for(;ii&&t[r-1]>n;)r--;return i>0||r{const i="_onData"+kc(n),r=t[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!1,value(...s){const o=r.apply(this,s);return t._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...s)}),o}})})}function xd(t,e){const n=t._chartjs;if(!n)return;const i=n.listeners,r=i.indexOf(e);r!==-1&&i.splice(r,1),!(i.length>0)&&(vm.forEach(s=>{delete t[s]}),delete t._chartjs)}function Yx(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const _m=function(){return typeof window>"u"?function(t){return t()}:window.requestAnimationFrame}();function wm(t,e){let n=[],i=!1;return function(...r){n=r,i||(i=!0,_m.call(window,()=>{i=!1,t.apply(e,n)}))}}function Gx(t,e){let n;return function(...i){return e?(clearTimeout(n),n=setTimeout(t,e,i)):t.apply(this,i),e}}const qx=t=>t==="start"?"left":t==="end"?"right":"center",kd=(t,e,n)=>t==="start"?e:t==="end"?n:(e+n)/2;function Qx(t,e,n){const i=e.length;let r=0,s=i;if(t._sorted){const{iScale:o,_parsed:a}=t,l=o.axis,{min:u,max:c,minDefined:h,maxDefined:d}=o.getUserBounds();h&&(r=nt(Math.min(Dn(a,l,u).lo,n?i:Dn(e,l,o.getPixelForValue(u)).lo),0,i-1)),d?s=nt(Math.max(Dn(a,o.axis,c,!0).hi+1,n?0:Dn(e,l,o.getPixelForValue(c),!0).hi+1),r,i)-r:s=i-r}return{start:r,count:s}}function Xx(t){const{xScale:e,yScale:n,_scaleRanges:i}=t,r={xmin:e.min,xmax:e.max,ymin:n.min,ymax:n.max};if(!i)return t._scaleRanges=r,!0;const s=i.xmin!==e.min||i.xmax!==e.max||i.ymin!==n.min||i.ymax!==n.max;return Object.assign(i,r),s}const Rs=t=>t===0||t===1,bd=(t,e,n)=>-(Math.pow(2,10*(t-=1))*Math.sin((t-e)*mt/n)),Sd=(t,e,n)=>Math.pow(2,-10*t)*Math.sin((t-e)*mt/n)+1,Cr={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>-Math.cos(t*We)+1,easeOutSine:t=>Math.sin(t*We),easeInOutSine:t=>-.5*(Math.cos(_e*t)-1),easeInExpo:t=>t===0?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>t===1?1:-Math.pow(2,-10*t)+1,easeInOutExpo:t=>Rs(t)?t:t<.5?.5*Math.pow(2,10*(t*2-1)):.5*(-Math.pow(2,-10*(t*2-1))+2),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>Rs(t)?t:bd(t,.075,.3),easeOutElastic:t=>Rs(t)?t:Sd(t,.075,.3),easeInOutElastic(t){return Rs(t)?t:t<.5?.5*bd(t*2,.1125,.45):.5+.5*Sd(t*2-1,.1125,.45)},easeInBack(t){return t*t*((1.70158+1)*t-1.70158)},easeOutBack(t){return(t-=1)*t*((1.70158+1)*t+1.70158)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?.5*(t*t*(((e*=1.525)+1)*t-e)):.5*((t-=2)*t*(((e*=1.525)+1)*t+e)+2)},easeInBounce:t=>1-Cr.easeOutBounce(1-t),easeOutBounce(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:t=>t<.5?Cr.easeInBounce(t*2)*.5:Cr.easeOutBounce(t*2-1)*.5+.5};function Cc(t){if(t&&typeof t=="object"){const e=t.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function Cd(t){return Cc(t)?t:new qr(t)}function Xa(t){return Cc(t)?t:new qr(t).saturate(.5).darken(.1).hexString()}const Jx=["x","y","borderWidth","radius","tension"],Zx=["color","borderColor","backgroundColor"];function e1(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:e=>e!=="onProgress"&&e!=="onComplete"&&e!=="fn"}),t.set("animations",{colors:{type:"color",properties:Zx},numbers:{type:"number",properties:Jx}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:e=>e|0}}}})}function t1(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Ed=new Map;function n1(t,e){e=e||{};const n=t+JSON.stringify(e);let i=Ed.get(n);return i||(i=new Intl.NumberFormat(t,e),Ed.set(n,i)),i}function Ec(t,e,n){return n1(e,n).format(t)}const xm={values(t){return le(t)?t:""+t},numeric(t,e,n){if(t===0)return"0";const i=this.chart.options.locale;let r,s=t;if(n.length>1){const u=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(u<1e-4||u>1e15)&&(r="scientific"),s=i1(t,n)}const o=tn(Math.abs(s)),a=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),l={notation:r,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Ec(t,i,l)},logarithmic(t,e,n){if(t===0)return"0";const i=n[e].significand||t/Math.pow(10,Math.floor(tn(t)));return[1,2,3,5,10,15].includes(i)||e>.8*n.length?xm.numeric.call(this,t,e,n):""}};function i1(t,e){let n=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(n)>=1&&t!==Math.floor(t)&&(n=t-Math.floor(t)),n}var fa={formatters:xm};function r1(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(e,n)=>n.lineWidth,tickColor:(e,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:fa.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:e=>!e.startsWith("before")&&!e.startsWith("after")&&e!=="callback"&&e!=="parser",_indexable:e=>e!=="borderDash"&&e!=="tickBorderDash"&&e!=="dash"}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:e=>e!=="backdropPadding"&&e!=="callback",_indexable:e=>e!=="backdropPadding"})}const Wn=Object.create(null),lu=Object.create(null);function Er(t,e){if(!e)return t;const n=e.split(".");for(let i=0,r=n.length;ii.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=(i,r)=>Xa(r.backgroundColor),this.hoverBorderColor=(i,r)=>Xa(r.borderColor),this.hoverColor=(i,r)=>Xa(r.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e),this.apply(n)}set(e,n){return Ja(this,e,n)}get(e){return Er(this,e)}describe(e,n){return Ja(lu,e,n)}override(e,n){return Ja(Wn,e,n)}route(e,n,i,r){const s=Er(this,e),o=Er(this,i),a="_"+n;Object.defineProperties(s,{[a]:{value:s[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[a],u=o[r];return U(l)?Object.assign({},u,l):W(l,u)},set(l){this[a]=l}}})}apply(e){e.forEach(n=>n(this))}}var ue=new s1({_scriptable:t=>!t.startsWith("on"),_indexable:t=>t!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[e1,t1,r1]);function o1(t){return!t||J(t.size)||J(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function zo(t,e,n,i,r){let s=e[r];return s||(s=e[r]=t.measureText(r).width,n.push(r)),s>i&&(i=s),i}function a1(t,e,n,i){i=i||{};let r=i.data=i.data||{},s=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(r=i.data={},s=i.garbageCollect=[],i.font=e),t.save(),t.font=e;let o=0;const a=n.length;let l,u,c,h,d;for(l=0;ln.length){for(l=0;l0&&t.stroke()}}function Dt(t,e,n){return n=n||.5,!e||t&&t.x>e.left-n&&t.xe.top-n&&t.y0&&s.strokeColor!=="";let l,u;for(t.save(),t.font=r.string,h1(t,s),l=0;l+t||0;function Sm(t,e){const n={},i=U(e),r=i?Object.keys(e):e,s=U(t)?i?o=>W(t[o],t[e[o]]):o=>t[o]:()=>t;for(const o of r)n[o]=y1(s(o));return n}function v1(t){return Sm(t,{top:"y",right:"x",bottom:"y",left:"x"})}function Pr(t){return Sm(t,["topLeft","topRight","bottomLeft","bottomRight"])}function ot(t){const e=v1(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Ke(t,e){t=t||{},e=e||ue.font;let n=W(t.size,e.size);typeof n=="string"&&(n=parseInt(n,10));let i=W(t.style,e.style);i&&!(""+i).match(g1)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const r={family:W(t.family,e.family),lineHeight:m1(W(t.lineHeight,e.lineHeight),n),size:n,style:i,weight:W(t.weight,e.weight),string:""};return r.string=o1(r),r}function Is(t,e,n,i){let r,s,o;for(r=0,s=t.length;rn&&a===0?0:a+l;return{min:o(i,-Math.abs(s)),max:o(r,s)}}function _n(t,e){return Object.assign(Object.create(t),e)}function Pc(t,e=[""],n,i,r=()=>t[0]){const s=n||t;typeof i>"u"&&(i=Tm("_fallback",t));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:s,_fallback:i,_getTarget:r,override:a=>Pc([a,...t],e,s,i)};return new Proxy(o,{deleteProperty(a,l){return delete a[l],delete a._keys,delete t[0][l],!0},get(a,l){return Em(a,l,()=>P1(l,e,t,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(t[0])},has(a,l){return Od(a).includes(l)},ownKeys(a){return Od(a)},set(a,l,u){const c=a._storage||(a._storage=r());return a[l]=c[l]=u,delete a._keys,!0}})}function Ai(t,e,n,i){const r={_cacheable:!1,_proxy:t,_context:e,_subProxy:n,_stack:new Set,_descriptors:Cm(t,i),setContext:s=>Ai(t,s,n,i),override:s=>Ai(t.override(s),e,n,i)};return new Proxy(r,{deleteProperty(s,o){return delete s[o],delete t[o],!0},get(s,o,a){return Em(s,o,()=>x1(s,o,a))},getOwnPropertyDescriptor(s,o){return s._descriptors.allKeys?Reflect.has(t,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,o)},getPrototypeOf(){return Reflect.getPrototypeOf(t)},has(s,o){return Reflect.has(t,o)},ownKeys(){return Reflect.ownKeys(t)},set(s,o,a){return t[o]=a,delete s[o],!0}})}function Cm(t,e={scriptable:!0,indexable:!0}){const{_scriptable:n=e.scriptable,_indexable:i=e.indexable,_allKeys:r=e.allKeys}=t;return{allKeys:r,scriptable:n,indexable:i,isScriptable:gn(n)?n:()=>n,isIndexable:gn(i)?i:()=>i}}const w1=(t,e)=>t?t+kc(e):e,Tc=(t,e)=>U(e)&&t!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function Em(t,e,n){if(Object.prototype.hasOwnProperty.call(t,e)||e==="constructor")return t[e];const i=n();return t[e]=i,i}function x1(t,e,n){const{_proxy:i,_context:r,_subProxy:s,_descriptors:o}=t;let a=i[e];return gn(a)&&o.isScriptable(e)&&(a=k1(e,a,t,n)),le(a)&&a.length&&(a=b1(e,a,t,o.isIndexable)),Tc(e,a)&&(a=Ai(a,r,s&&s[e],o)),a}function k1(t,e,n,i){const{_proxy:r,_context:s,_subProxy:o,_stack:a}=n;if(a.has(t))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+t);a.add(t);let l=e(s,o||i);return a.delete(t),Tc(t,l)&&(l=Oc(r._scopes,r,t,l)),l}function b1(t,e,n,i){const{_proxy:r,_context:s,_subProxy:o,_descriptors:a}=n;if(typeof s.index<"u"&&i(t))return e[s.index%e.length];if(U(e[0])){const l=e,u=r._scopes.filter(c=>c!==l);e=[];for(const c of l){const h=Oc(u,r,t,c);e.push(Ai(h,s,o&&o[t],a))}}return e}function Pm(t,e,n){return gn(t)?t(e,n):t}const S1=(t,e)=>t===!0?e:typeof t=="string"?jo(e,t):void 0;function C1(t,e,n,i,r){for(const s of e){const o=S1(n,s);if(o){t.add(o);const a=Pm(o._fallback,n,r);if(typeof a<"u"&&a!==n&&a!==i)return a}else if(o===!1&&typeof i<"u"&&n!==i)return null}return!1}function Oc(t,e,n,i){const r=e._rootScopes,s=Pm(e._fallback,n,i),o=[...t,...r],a=new Set;a.add(i);let l=Td(a,o,n,s||n,i);return l===null||typeof s<"u"&&s!==n&&(l=Td(a,o,s,l,i),l===null)?!1:Pc(Array.from(a),[""],r,s,()=>E1(e,n,i))}function Td(t,e,n,i,r){for(;n;)n=C1(t,e,n,i,r);return n}function E1(t,e,n){const i=t._getTarget();e in i||(i[e]={});const r=i[e];return le(r)&&U(n)?n:r||{}}function P1(t,e,n,i){let r;for(const s of e)if(r=Tm(w1(s,t),n),typeof r<"u")return Tc(t,r)?Oc(n,i,t,r):r}function Tm(t,e){for(const n of e){if(!n)continue;const i=n[t];if(typeof i<"u")return i}}function Od(t){let e=t._keys;return e||(e=t._keys=T1(t._scopes)),e}function T1(t){const e=new Set;for(const n of t)for(const i of Object.keys(n).filter(r=>!r.startsWith("_")))e.add(i);return Array.from(e)}const O1=Number.EPSILON||1e-14,Di=(t,e)=>et==="x"?"y":"x";function L1(t,e,n,i){const r=t.skip?e:t,s=e,o=n.skip?e:n,a=au(s,r),l=au(o,s);let u=a/(a+l),c=l/(a+l);u=isNaN(u)?0:u,c=isNaN(c)?0:c;const h=i*u,d=i*c;return{previous:{x:s.x-h*(o.x-r.x),y:s.y-h*(o.y-r.y)},next:{x:s.x+d*(o.x-r.x),y:s.y+d*(o.y-r.y)}}}function M1(t,e,n){const i=t.length;let r,s,o,a,l,u=Di(t,0);for(let c=0;c!u.skip)),e.cubicInterpolationMode==="monotone")I1(t,r);else{let u=i?t[t.length-1]:t[0];for(s=0,o=t.length;st.ownerDocument.defaultView.getComputedStyle(t,null);function j1(t,e){return pa(t).getPropertyValue(e)}const N1=["top","right","bottom","left"];function zn(t,e,n){const i={};n=n?"-"+n:"";for(let r=0;r<4;r++){const s=N1[r];i[s]=parseFloat(t[e+"-"+s+n])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const F1=(t,e,n)=>(t>0||e>0)&&(!n||!n.shadowRoot);function z1(t,e){const n=t.touches,i=n&&n.length?n[0]:t,{offsetX:r,offsetY:s}=i;let o=!1,a,l;if(F1(r,s,t.target))a=r,l=s;else{const u=e.getBoundingClientRect();a=i.clientX-u.left,l=i.clientY-u.top,o=!0}return{x:a,y:l,box:o}}function On(t,e){if("native"in t)return t;const{canvas:n,currentDevicePixelRatio:i}=e,r=pa(n),s=r.boxSizing==="border-box",o=zn(r,"padding"),a=zn(r,"border","width"),{x:l,y:u,box:c}=z1(t,n),h=o.left+(c&&a.left),d=o.top+(c&&a.top);let{width:f,height:m}=e;return s&&(f-=o.width+a.width,m-=o.height+a.height),{x:Math.round((l-h)/f*n.width/i),y:Math.round((u-d)/m*n.height/i)}}function $1(t,e,n){let i,r;if(e===void 0||n===void 0){const s=t&&Mc(t);if(!s)e=t.clientWidth,n=t.clientHeight;else{const o=s.getBoundingClientRect(),a=pa(s),l=zn(a,"border","width"),u=zn(a,"padding");e=o.width-u.width-l.width,n=o.height-u.height-l.height,i=Uo(a.maxWidth,s,"clientWidth"),r=Uo(a.maxHeight,s,"clientHeight")}}return{width:e,height:n,maxWidth:i||Fo,maxHeight:r||Fo}}const Ds=t=>Math.round(t*10)/10;function U1(t,e,n,i){const r=pa(t),s=zn(r,"margin"),o=Uo(r.maxWidth,t,"clientWidth")||Fo,a=Uo(r.maxHeight,t,"clientHeight")||Fo,l=$1(t,e,n);let{width:u,height:c}=l;if(r.boxSizing==="content-box"){const d=zn(r,"border","width"),f=zn(r,"padding");u-=f.width+d.width,c-=f.height+d.height}return u=Math.max(0,u-s.width),c=Math.max(0,i?u/i:c-s.height),u=Ds(Math.min(u,o,l.maxWidth)),c=Ds(Math.min(c,a,l.maxHeight)),u&&!c&&(c=Ds(u/2)),(e!==void 0||n!==void 0)&&i&&l.height&&c>l.height&&(c=l.height,u=Ds(Math.floor(c*i))),{width:u,height:c}}function Ld(t,e,n){const i=e||1,r=Math.floor(t.height*i),s=Math.floor(t.width*i);t.height=Math.floor(t.height),t.width=Math.floor(t.width);const o=t.canvas;return o.style&&(n||!o.style.height&&!o.style.width)&&(o.style.height=`${t.height}px`,o.style.width=`${t.width}px`),t.currentDevicePixelRatio!==i||o.height!==r||o.width!==s?(t.currentDevicePixelRatio=i,o.height=r,o.width=s,t.ctx.setTransform(i,0,0,i,0,0),!0):!1}const B1=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};Lc()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch{}return t}();function Md(t,e){const n=j1(t,e),i=n&&n.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Ln(t,e,n,i){return{x:t.x+n*(e.x-t.x),y:t.y+n*(e.y-t.y)}}function V1(t,e,n,i){return{x:t.x+n*(e.x-t.x),y:i==="middle"?n<.5?t.y:e.y:i==="after"?n<1?t.y:e.y:n>0?e.y:t.y}}function H1(t,e,n,i){const r={x:t.cp2x,y:t.cp2y},s={x:e.cp1x,y:e.cp1y},o=Ln(t,r,n),a=Ln(r,s,n),l=Ln(s,e,n),u=Ln(o,a,n),c=Ln(a,l,n);return Ln(u,c,n)}const W1=function(t,e){return{x(n){return t+t+e-n},setWidth(n){e=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,i){return n-i},leftForLtr(n,i){return n-i}}},K1=function(){return{x(t){return t},setWidth(t){},textAlign(t){return t},xPlus(t,e){return t+e},leftForLtr(t,e){return t}}};function Za(t,e,n){return t?W1(e,n):K1()}function Y1(t,e){let n,i;(e==="ltr"||e==="rtl")&&(n=t.canvas.style,i=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",e,"important"),t.prevTextDirection=i)}function G1(t,e){e!==void 0&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Lm(t){return t==="angle"?{between:ym,compare:Ux,normalize:dt}:{between:Vx,compare:(e,n)=>e-n,normalize:e=>e}}function Rd({start:t,end:e,count:n,loop:i,style:r}){return{start:t%n,end:e%n,loop:i&&(e-t+1)%n===0,style:r}}function q1(t,e,n){const{property:i,start:r,end:s}=n,{between:o,normalize:a}=Lm(i),l=e.length;let{start:u,end:c,loop:h}=t,d,f;if(h){for(u+=l,c+=l,d=0,f=l;dl(r,_,p)&&a(r,_)!==0,x=()=>a(s,p)===0||l(s,_,p),b=()=>y||w(),k=()=>!y||x();for(let S=c,M=c;S<=h;++S)g=e[S%o],!g.skip&&(p=u(g[i]),p!==_&&(y=l(p,r,s),v===null&&b()&&(v=a(p,r)===0?S:M),v!==null&&k()&&(m.push(Rd({start:v,end:S,loop:d,count:o,style:f})),v=null),M=S,_=p));return v!==null&&m.push(Rd({start:v,end:h,loop:d,count:o,style:f})),m}function X1(t,e){const n=[],i=t.segments;for(let r=0;rr&&t[s%e].skip;)s--;return s%=e,{start:r,end:s}}function Z1(t,e,n,i){const r=t.length,s=[];let o=e,a=t[e],l;for(l=e+1;l<=n;++l){const u=t[l%r];u.skip||u.stop?a.skip||(i=!1,s.push({start:e%r,end:(l-1)%r,loop:i}),e=o=u.stop?l:null):(o=l,a.skip&&(e=l)),a=u}return o!==null&&s.push({start:e%r,end:o%r,loop:i}),s}function ek(t,e){const n=t.points,i=t.options.spanGaps,r=n.length;if(!r)return[];const s=!!t._loop,{start:o,end:a}=J1(n,r,s,i);if(i===!0)return Id(t,[{start:o,end:a,loop:s}],n,e);const l=aa({chart:e,initial:n.initial,numSteps:o,currentStep:Math.min(i-n.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=_m.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let n=0;this._charts.forEach((i,r)=>{if(!i.running||!i.items.length)return;const s=i.items;let o=s.length-1,a=!1,l;for(;o>=0;--o)l=s[o],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(e),a=!0):(s[o]=s[s.length-1],s.pop());a&&(r.draw(),this._notify(r,i,e,"progress")),s.length||(i.running=!1,this._notify(r,i,e,"complete"),i.initial=!1),n+=s.length}),this._lastDate=e,n===0&&(this._running=!1)}_getAnims(e){const n=this._charts;let i=n.get(e);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(e,i)),i}listen(e,n,i){this._getAnims(e).listeners[n].push(i)}add(e,n){!n||!n.length||this._getAnims(e).items.push(...n)}has(e){return this._getAnims(e).items.length>0}start(e){const n=this._charts.get(e);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((i,r)=>Math.max(i,r._duration),0),this._refresh())}running(e){if(!this._running)return!1;const n=this._charts.get(e);return!(!n||!n.running||!n.items.length)}stop(e){const n=this._charts.get(e);if(!n||!n.items.length)return;const i=n.items;let r=i.length-1;for(;r>=0;--r)i[r].cancel();n.items=[],this._notify(e,n,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var Tt=new ik;const Dd="transparent",rk={boolean(t,e,n){return n>.5?e:t},color(t,e,n){const i=Cd(t||Dd),r=i.valid&&Cd(e||Dd);return r&&r.valid?r.mix(i,n).hexString():e},number(t,e,n){return t+(e-t)*n}};class sk{constructor(e,n,i,r){const s=n[i];r=Is([e.to,r,s,e.from]);const o=Is([e.from,s,r]);this._active=!0,this._fn=e.fn||rk[e.type||typeof o],this._easing=Cr[e.easing]||Cr.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=n,this._prop=i,this._from=o,this._to=r,this._promises=void 0}active(){return this._active}update(e,n,i){if(this._active){this._notify(!1);const r=this._target[this._prop],s=i-this._start,o=this._duration-s;this._start=i,this._duration=Math.floor(Math.max(o,e.duration)),this._total+=s,this._loop=!!e.loop,this._to=Is([e.to,n,r,e.from]),this._from=Is([e.from,r,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const n=e-this._start,i=this._duration,r=this._prop,s=this._from,o=this._loop,a=this._to;let l;if(this._active=s!==a&&(o||n1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[r]=this._fn(s,a,l)}wait(){const e=this._promises||(this._promises=[]);return new Promise((n,i)=>{e.push({res:n,rej:i})})}_notify(e){const n=e?"res":"rej",i=this._promises||[];for(let r=0;r{const s=e[r];if(!U(s))return;const o={};for(const a of n)o[a]=s[a];(le(s.properties)&&s.properties||[r]).forEach(a=>{(a===r||!i.has(a))&&i.set(a,o)})})}_animateOptions(e,n){const i=n.options,r=ak(e,i);if(!r)return[];const s=this._createAnimations(r,i);return i.$shared&&ok(e.options.$animations,i).then(()=>{e.options=i},()=>{}),s}_createAnimations(e,n){const i=this._properties,r=[],s=e.$animations||(e.$animations={}),o=Object.keys(n),a=Date.now();let l;for(l=o.length-1;l>=0;--l){const u=o[l];if(u.charAt(0)==="$")continue;if(u==="options"){r.push(...this._animateOptions(e,n));continue}const c=n[u];let h=s[u];const d=i.get(u);if(h)if(d&&h.active()){h.update(d,c,a);continue}else h.cancel();if(!d||!d.duration){e[u]=c;continue}s[u]=h=new sk(d,e,u,c),r.push(h)}return r}update(e,n){if(this._properties.size===0){Object.assign(e,n);return}const i=this._createAnimations(e,n);if(i.length)return Tt.add(this._chart,i),!0}}function ok(t,e){const n=[],i=Object.keys(e);for(let r=0;r0||!n&&s<0)return r.index}return null}function $d(t,e){const{chart:n,_cachedMeta:i}=t,r=n._stacks||(n._stacks={}),{iScale:s,vScale:o,index:a}=i,l=s.axis,u=o.axis,c=hk(s,o,i),h=e.length;let d;for(let f=0;fn[i].axis===e).shift()}function pk(t,e){return _n(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function gk(t,e,n){return _n(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:n,index:e,mode:"default",type:"data"})}function Ji(t,e){const n=t.controller.index,i=t.vScale&&t.vScale.axis;if(i){e=e||t._parsed;for(const r of e){const s=r._stacks;if(!s||s[i]===void 0||s[i][n]===void 0)return;delete s[i][n],s[i]._visualValues!==void 0&&s[i]._visualValues[n]!==void 0&&delete s[i]._visualValues[n]}}}const tl=t=>t==="reset"||t==="none",Ud=(t,e)=>e?t:Object.assign({},t),mk=(t,e,n)=>t&&!e.hidden&&e._stacked&&{keys:Rm(n,!0),values:null};class Tr{constructor(e,n){this.chart=e,this._ctx=e.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=Fd(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(e){this.index!==e&&Ji(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,n=this._cachedMeta,i=this.getDataset(),r=(h,d,f,m)=>h==="x"?d:h==="r"?m:f,s=n.xAxisID=W(i.xAxisID,el(e,"x")),o=n.yAxisID=W(i.yAxisID,el(e,"y")),a=n.rAxisID=W(i.rAxisID,el(e,"r")),l=n.indexAxis,u=n.iAxisID=r(l,s,o,a),c=n.vAxisID=r(l,o,s,a);n.xScale=this.getScaleForId(s),n.yScale=this.getScaleForId(o),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(u),n.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const n=this._cachedMeta;return e===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&xd(this._data,this),e._stacked&&Ji(e)}_dataCheck(){const e=this.getDataset(),n=e.data||(e.data=[]),i=this._data;if(U(n)){const r=this._cachedMeta;this._data=ck(n,r)}else if(i!==n){if(i){xd(i,this);const r=this._cachedMeta;Ji(r),r._parsed=[]}n&&Object.isExtensible(n)&&Kx(n,this),this._syncList=[],this._data=n}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const n=this._cachedMeta,i=this.getDataset();let r=!1;this._dataCheck();const s=n._stacked;n._stacked=Fd(n.vScale,n),n.stack!==i.stack&&(r=!0,Ji(n),n.stack=i.stack),this._resyncElements(e),(r||s!==n._stacked)&&$d(this,n._parsed)}configure(){const e=this.chart.config,n=e.datasetScopeKeys(this._type),i=e.getOptionScopes(this.getDataset(),n,!0);this.options=e.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,n){const{_cachedMeta:i,_data:r}=this,{iScale:s,_stacked:o}=i,a=s.axis;let l=e===0&&n===r.length?!0:i._sorted,u=e>0&&i._parsed[e-1],c,h,d;if(this._parsing===!1)i._parsed=r,i._sorted=!0,d=r;else{le(r[e])?d=this.parseArrayData(i,r,e,n):U(r[e])?d=this.parseObjectData(i,r,e,n):d=this.parsePrimitiveData(i,r,e,n);const f=()=>h[a]===null||u&&h[a]y||h=0;--d)if(!m()){this.updateRangeFromParsed(u,e,f,l);break}}return u}getAllParsedValues(e){const n=this._cachedMeta._parsed,i=[];let r,s,o;for(r=0,s=n.length;r=0&&ethis.getContext(i,r,n),y=u.resolveNamedOptions(d,f,m,h);return y.$shared&&(y.$shared=l,s[o]=Object.freeze(Ud(y,l))),y}_resolveAnimations(e,n,i){const r=this.chart,s=this._cachedDataOpts,o=`animation-${n}`,a=s[o];if(a)return a;let l;if(r.options.animation!==!1){const c=this.chart.config,h=c.datasetAnimationScopeKeys(this._type,n),d=c.getOptionScopes(this.getDataset(),h);l=c.createResolver(d,this.getContext(e,i,n))}const u=new Mm(r,l&&l.animations);return l&&l._cacheable&&(s[o]=Object.freeze(u)),u}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,n){return!n||tl(e)||this.chart._animationsDisabled}_getSharedOptions(e,n){const i=this.resolveDataElementOptions(e,n),r=this._sharedOptions,s=this.getSharedOptions(i),o=this.includeOptions(n,s)||s!==r;return this.updateSharedOptions(s,n,i),{sharedOptions:s,includeOptions:o}}updateElement(e,n,i,r){tl(r)?Object.assign(e,i):this._resolveAnimations(n,r).update(e,i)}updateSharedOptions(e,n,i){e&&!tl(n)&&this._resolveAnimations(void 0,n).update(e,i)}_setStyle(e,n,i,r){e.active=r;const s=this.getStyle(n,r);this._resolveAnimations(n,i,r).update(e,{options:!r&&this.getSharedOptions(s)||s})}removeHoverStyle(e,n,i){this._setStyle(e,i,"active",!1)}setHoverStyle(e,n,i){this._setStyle(e,i,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const n=this._data,i=this._cachedMeta.data;for(const[a,l,u]of this._syncList)this[a](l,u);this._syncList=[];const r=i.length,s=n.length,o=Math.min(s,r);o&&this.parse(0,o),s>r?this._insertElements(r,s-r,e):s{for(u.length+=n,a=u.length-1;a>=o;a--)u[a]=u[a-n]};for(l(s),a=e;a0&&this.getParsed(n-1);for(let x=0;x<_;++x){const b=e[x],k=p?b:{};if(x=g){k.skip=!0;continue}const S=this.getParsed(x),M=J(S[f]),L=k[d]=o.getPixelForValue(S[d],x),D=k[f]=s||M?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,S,l):S[f],x);k.skip=isNaN(L)||isNaN(D)||M,k.stop=x>0&&Math.abs(S[d]-w[d])>v,y&&(k.parsed=S,k.raw=u.data[x]),h&&(k.options=c||this.resolveDataElementOptions(x,b.active?"active":r)),p||this.updateElement(b,x,k,r),w=S}}getMaxOverflow(){const e=this._cachedMeta,n=e.dataset,i=n.options&&n.options.borderWidth||0,r=e.data||[];if(!r.length)return i;const s=r[0].size(this.resolveDataElementOptions(0)),o=r[r.length-1].size(this.resolveDataElementOptions(r.length-1));return Math.max(i,s,o)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}I(ro,"id","line"),I(ro,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),I(ro,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});function Sn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Rc{constructor(e){I(this,"options");this.options=e||{}}static override(e){Object.assign(Rc.prototype,e)}init(){}formats(){return Sn()}parse(){return Sn()}format(){return Sn()}add(){return Sn()}diff(){return Sn()}startOf(){return Sn()}endOf(){return Sn()}}var yk={_date:Rc};function vk(t,e,n,i){const{controller:r,data:s,_sorted:o}=t,a=r._cachedMeta.iScale;if(a&&e===a.axis&&e!=="r"&&o&&s.length){const l=a._reversePixels?Hx:Dn;if(i){if(r._sharedOptions){const u=s[0],c=typeof u.getRange=="function"&&u.getRange(e);if(c){const h=l(s,e,n-c),d=l(s,e,n+c);return{lo:h.lo,hi:d.hi}}}}else return l(s,e,n)}return{lo:0,hi:s.length-1}}function as(t,e,n,i,r){const s=t.getSortedVisibleDatasetMetas(),o=n[e];for(let a=0,l=s.length;a{l[o](e[n],r)&&(s.push({element:l,datasetIndex:u,index:c}),a=a||l.inRange(e.x,e.y,r))}),i&&!a?[]:s}var kk={evaluateInteractionItems:as,modes:{index(t,e,n,i){const r=On(e,t),s=n.axis||"x",o=n.includeInvisible||!1,a=n.intersect?nl(t,r,s,i,o):il(t,r,s,!1,i,o),l=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach(u=>{const c=a[0].index,h=u.data[c];h&&!h.skip&&l.push({element:h,datasetIndex:u.index,index:c})}),l):[]},dataset(t,e,n,i){const r=On(e,t),s=n.axis||"xy",o=n.includeInvisible||!1;let a=n.intersect?nl(t,r,s,i,o):il(t,r,s,!1,i,o);if(a.length>0){const l=a[0].datasetIndex,u=t.getDatasetMeta(l).data;a=[];for(let c=0;cn.pos===e)}function Vd(t,e){return t.filter(n=>Im.indexOf(n.pos)===-1&&n.box.axis===e)}function er(t,e){return t.sort((n,i)=>{const r=e?i:n,s=e?n:i;return r.weight===s.weight?r.index-s.index:r.weight-s.weight})}function bk(t){const e=[];let n,i,r,s,o,a;for(n=0,i=(t||[]).length;nu.box.fullSize),!0),i=er(Zi(e,"left"),!0),r=er(Zi(e,"right")),s=er(Zi(e,"top"),!0),o=er(Zi(e,"bottom")),a=Vd(e,"x"),l=Vd(e,"y");return{fullSize:n,leftAndTop:i.concat(s),rightAndBottom:r.concat(l).concat(o).concat(a),chartArea:Zi(e,"chartArea"),vertical:i.concat(r).concat(l),horizontal:s.concat(o).concat(a)}}function Hd(t,e,n,i){return Math.max(t[n],e[n])+Math.max(t[i],e[i])}function Am(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function Pk(t,e,n,i){const{pos:r,box:s}=n,o=t.maxPadding;if(!U(r)){n.size&&(t[r]-=n.size);const h=i[n.stack]||{size:0,count:1};h.size=Math.max(h.size,n.horizontal?s.height:s.width),n.size=h.size/h.count,t[r]+=n.size}s.getPadding&&Am(o,s.getPadding());const a=Math.max(0,e.outerWidth-Hd(o,t,"left","right")),l=Math.max(0,e.outerHeight-Hd(o,t,"top","bottom")),u=a!==t.w,c=l!==t.h;return t.w=a,t.h=l,n.horizontal?{same:u,other:c}:{same:c,other:u}}function Tk(t){const e=t.maxPadding;function n(i){const r=Math.max(e[i]-t[i],0);return t[i]+=r,r}t.y+=n("top"),t.x+=n("left"),n("right"),n("bottom")}function Ok(t,e){const n=e.maxPadding;function i(r){const s={left:0,top:0,right:0,bottom:0};return r.forEach(o=>{s[o]=Math.max(e[o],n[o])}),s}return i(t?["left","right"]:["top","bottom"])}function ur(t,e,n,i){const r=[];let s,o,a,l,u,c;for(s=0,o=t.length,u=0;s{typeof y.beforeLayout=="function"&&y.beforeLayout()});const c=l.reduce((y,v)=>v.box.options&&v.box.options.display===!1?y:y+1,0)||1,h=Object.freeze({outerWidth:e,outerHeight:n,padding:r,availableWidth:s,availableHeight:o,vBoxMaxWidth:s/2/c,hBoxMaxHeight:o/2}),d=Object.assign({},r);Am(d,ot(i));const f=Object.assign({maxPadding:d,w:s,h:o,x:r.left,y:r.top},r),m=Ck(l.concat(u),h);ur(a.fullSize,f,h,m),ur(l,f,h,m),ur(u,f,h,m)&&ur(l,f,h,m),Tk(f),Wd(a.leftAndTop,f,h,m),f.x+=f.w,f.y+=f.h,Wd(a.rightAndBottom,f,h,m),t.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},V(a.chartArea,y=>{const v=y.box;Object.assign(v,t.chartArea),v.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class Dm{acquireContext(e,n){}releaseContext(e){return!1}addEventListener(e,n,i){}removeEventListener(e,n,i){}getDevicePixelRatio(){return 1}getMaximumSize(e,n,i,r){return n=Math.max(0,n||e.width),i=i||e.height,{width:n,height:Math.max(0,r?Math.floor(n/r):i)}}isAttached(e){return!0}updateConfig(e){}}class Lk extends Dm{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const so="$chartjs",Mk={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Kd=t=>t===null||t==="";function Rk(t,e){const n=t.style,i=t.getAttribute("height"),r=t.getAttribute("width");if(t[so]={initial:{height:i,width:r,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Kd(r)){const s=Md(t,"width");s!==void 0&&(t.width=s)}if(Kd(i))if(t.style.height==="")t.height=t.width/(e||2);else{const s=Md(t,"height");s!==void 0&&(t.height=s)}return t}const jm=B1?{passive:!0}:!1;function Ik(t,e,n){t&&t.addEventListener(e,n,jm)}function Ak(t,e,n){t&&t.canvas&&t.canvas.removeEventListener(e,n,jm)}function Dk(t,e){const n=Mk[t.type]||t.type,{x:i,y:r}=On(t,e);return{type:n,chart:e,native:t,x:i!==void 0?i:null,y:r!==void 0?r:null}}function Bo(t,e){for(const n of t)if(n===e||n.contains(e))return!0}function jk(t,e,n){const i=t.canvas,r=new MutationObserver(s=>{let o=!1;for(const a of s)o=o||Bo(a.addedNodes,i),o=o&&!Bo(a.removedNodes,i);o&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}function Nk(t,e,n){const i=t.canvas,r=new MutationObserver(s=>{let o=!1;for(const a of s)o=o||Bo(a.removedNodes,i),o=o&&!Bo(a.addedNodes,i);o&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}const Jr=new Map;let Yd=0;function Nm(){const t=window.devicePixelRatio;t!==Yd&&(Yd=t,Jr.forEach((e,n)=>{n.currentDevicePixelRatio!==t&&e()}))}function Fk(t,e){Jr.size||window.addEventListener("resize",Nm),Jr.set(t,e)}function zk(t){Jr.delete(t),Jr.size||window.removeEventListener("resize",Nm)}function $k(t,e,n){const i=t.canvas,r=i&&Mc(i);if(!r)return;const s=wm((a,l)=>{const u=r.clientWidth;n(a,l),u{const l=a[0],u=l.contentRect.width,c=l.contentRect.height;u===0&&c===0||s(u,c)});return o.observe(r),Fk(t,s),o}function rl(t,e,n){n&&n.disconnect(),e==="resize"&&zk(t)}function Uk(t,e,n){const i=t.canvas,r=wm(s=>{t.ctx!==null&&n(Dk(s,t))},t);return Ik(i,e,r),r}class Bk extends Dm{acquireContext(e,n){const i=e&&e.getContext&&e.getContext("2d");return i&&i.canvas===e?(Rk(e,n),i):null}releaseContext(e){const n=e.canvas;if(!n[so])return!1;const i=n[so].initial;["height","width"].forEach(s=>{const o=i[s];J(o)?n.removeAttribute(s):n.setAttribute(s,o)});const r=i.style||{};return Object.keys(r).forEach(s=>{n.style[s]=r[s]}),n.width=n.width,delete n[so],!0}addEventListener(e,n,i){this.removeEventListener(e,n);const r=e.$proxies||(e.$proxies={}),o={attach:jk,detach:Nk,resize:$k}[n]||Uk;r[n]=o(e,n,i)}removeEventListener(e,n){const i=e.$proxies||(e.$proxies={}),r=i[n];if(!r)return;({attach:rl,detach:rl,resize:rl}[n]||Ak)(e,n,r),i[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,n,i,r){return U1(e,n,i,r)}isAttached(e){const n=e&&Mc(e);return!!(n&&n.isConnected)}}function Vk(t){return!Lc()||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas?Lk:Bk}class Kn{constructor(){I(this,"x");I(this,"y");I(this,"active",!1);I(this,"options");I(this,"$animations")}tooltipPosition(e){const{x:n,y:i}=this.getProps(["x","y"],e);return{x:n,y:i}}hasValue(){return Xr(this.x)&&Xr(this.y)}getProps(e,n){const i=this.$animations;if(!n||!i)return this;const r={};return e.forEach(s=>{r[s]=i[s]&&i[s].active()?i[s]._to:this[s]}),r}}I(Kn,"defaults",{}),I(Kn,"defaultRoutes");function Hk(t,e){const n=t.options.ticks,i=Wk(t),r=Math.min(n.maxTicksLimit||i,i),s=n.major.enabled?Yk(e):[],o=s.length,a=s[0],l=s[o-1],u=[];if(o>r)return Gk(e,u,s,o/r),u;const c=Kk(s,e,r);if(o>0){let h,d;const f=o>1?Math.round((l-a)/(o-1)):null;for(Fs(e,u,c,J(f)?0:a-f,a),h=0,d=o-1;hr)return l}return Math.max(r,1)}function Yk(t){const e=[];let n,i;for(n=0,i=t.length;nt==="left"?"right":t==="right"?"left":t,Gd=(t,e,n)=>e==="top"||e==="left"?t[e]+n:t[e]-n,qd=(t,e)=>Math.min(e||t,t);function Qd(t,e){const n=[],i=t.length/e,r=t.length;let s=0;for(;so+a)))return l}function Jk(t,e){V(t,n=>{const i=n.gc,r=i.length/2;let s;if(r>e){for(s=0;si?i:n,i=r&&n>i?n:i,{min:Be(n,Be(i,n)),max:Be(i,Be(n,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){re(this.options.beforeUpdate,[this])}update(e,n,i){const{beginAtZero:r,grace:s,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=n,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=_1(this,s,r),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=s||i<=1||!this.isHorizontal()){this.labelRotation=r;return}const c=this._getLabelSizes(),h=c.widest.width,d=c.highest.height,f=nt(this.chart.width-h,0,this.maxWidth);a=e.offset?this.maxWidth/i:f/(i-1),h+6>a&&(a=f/(i-(e.offset?.5:1)),l=this.maxHeight-tr(e.grid)-n.padding-Xd(e.title,this.chart.options.font),u=Math.sqrt(h*h+d*d),o=bc(Math.min(Math.asin(nt((c.highest.height+6)/a,-1,1)),Math.asin(nt(l/u,-1,1))-Math.asin(nt(d/u,-1,1)))),o=Math.max(r,Math.min(s,o))),this.labelRotation=o}afterCalculateLabelRotation(){re(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){re(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:n,options:{ticks:i,title:r,grid:s}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const l=Xd(r,n.options.font);if(a?(e.width=this.maxWidth,e.height=tr(s)+l):(e.height=this.maxHeight,e.width=tr(s)+l),i.display&&this.ticks.length){const{first:u,last:c,widest:h,highest:d}=this._getLabelSizes(),f=i.padding*2,m=nn(this.labelRotation),y=Math.cos(m),v=Math.sin(m);if(a){const p=i.mirror?0:v*h.width+y*d.height;e.height=Math.min(this.maxHeight,e.height+p+f)}else{const p=i.mirror?0:y*h.width+v*d.height;e.width=Math.min(this.maxWidth,e.width+p+f)}this._calculatePadding(u,c,v,y)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,n,i,r){const{ticks:{align:s,padding:o},position:a}=this.options,l=this.labelRotation!==0,u=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const c=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,f=0;l?u?(d=r*e.width,f=i*n.height):(d=i*e.height,f=r*n.width):s==="start"?f=n.width:s==="end"?d=e.width:s!=="inner"&&(d=e.width/2,f=n.width/2),this.paddingLeft=Math.max((d-c+o)*this.width/(this.width-c),0),this.paddingRight=Math.max((f-h+o)*this.width/(this.width-h),0)}else{let c=n.height/2,h=e.height/2;s==="start"?(c=0,h=e.height):s==="end"&&(c=n.height,h=0),this.paddingTop=c+o,this.paddingBottom=h+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(){re(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:n}=this.options;return n==="top"||n==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let n,i;for(n=0,i=e.length;n({width:o[M]||0,height:a[M]||0});return{first:S(0),last:S(n-1),widest:S(b),highest:S(k),widths:o,heights:a}}getLabelForValue(e){return e}getPixelForValue(e,n){return NaN}getValueForPixel(e){}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const n=this._startPixel+e*this._length;return Bx(this._alignToPixels?bn(this.chart,n,0):n)}getDecimalForPixel(e){const n=(e-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:n}=this;return e<0&&n<0?n:e>0&&n>0?e:0}getContext(e){const n=this.ticks||[];if(e>=0&&ea*r?a/i:l/r:l*r0}_computeGridLineItems(e){const n=this.axis,i=this.chart,r=this.options,{grid:s,position:o,border:a}=r,l=s.offset,u=this.isHorizontal(),h=this.ticks.length+(l?1:0),d=tr(s),f=[],m=a.setContext(this.getContext()),y=m.display?m.width:0,v=y/2,p=function(K){return bn(i,K,y)};let g,_,w,x,b,k,S,M,L,D,B,ce;if(o==="top")g=p(this.bottom),k=this.bottom-d,M=g-v,D=p(e.top)+v,ce=e.bottom;else if(o==="bottom")g=p(this.top),D=e.top,ce=p(e.bottom)-v,k=g+v,M=this.top+d;else if(o==="left")g=p(this.right),b=this.right-d,S=g-v,L=p(e.left)+v,B=e.right;else if(o==="right")g=p(this.left),L=e.left,B=p(e.right)-v,b=g+v,S=this.left+d;else if(n==="x"){if(o==="center")g=p((e.top+e.bottom)/2+.5);else if(U(o)){const K=Object.keys(o)[0],ge=o[K];g=p(this.chart.scales[K].getPixelForValue(ge))}D=e.top,ce=e.bottom,k=g+v,M=k+d}else if(n==="y"){if(o==="center")g=p((e.left+e.right)/2);else if(U(o)){const K=Object.keys(o)[0],ge=o[K];g=p(this.chart.scales[K].getPixelForValue(ge))}b=g-v,S=b-d,L=e.left,B=e.right}const oe=W(r.ticks.maxTicksLimit,h),$=Math.max(1,Math.ceil(h/oe));for(_=0;_0&&(Oe-=Te/2);break}Y={left:Oe,top:Et,width:Te+Q.width,height:vt+Q.height,color:$.backdropColor}}v.push({label:w,font:M,textOffset:B,options:{rotation:y,color:ge,strokeColor:T,strokeWidth:R,textAlign:A,textBaseline:ce,translation:[x,b],backdrop:Y}})}return v}_getXAxisLabelAlignment(){const{position:e,ticks:n}=this.options;if(-nn(this.labelRotation))return e==="top"?"left":"right";let r="center";return n.align==="start"?r="left":n.align==="end"?r="right":n.align==="inner"&&(r="inner"),r}_getYAxisLabelAlignment(e){const{position:n,ticks:{crossAlign:i,mirror:r,padding:s}}=this.options,o=this._getLabelSizes(),a=e+s,l=o.widest.width;let u,c;return n==="left"?r?(c=this.right+s,i==="near"?u="left":i==="center"?(u="center",c+=l/2):(u="right",c+=l)):(c=this.right-a,i==="near"?u="right":i==="center"?(u="center",c-=l/2):(u="left",c=this.left)):n==="right"?r?(c=this.left+s,i==="near"?u="right":i==="center"?(u="center",c-=l/2):(u="left",c-=l)):(c=this.left+a,i==="near"?u="left":i==="center"?(u="center",c+=l/2):(u="right",c=this.right)):u="right",{textAlign:u,x:c}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:n},left:i,top:r,width:s,height:o}=this;n&&(e.save(),e.fillStyle=n,e.fillRect(i,r,s,o),e.restore())}getLineWidthForValue(e){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const r=this.ticks.findIndex(s=>s.value===e);return r>=0?n.setContext(this.getContext(r)).lineWidth:0}drawGrid(e){const n=this.options.grid,i=this.ctx,r=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let s,o;const a=(l,u,c)=>{!c.width||!c.color||(i.save(),i.lineWidth=c.width,i.strokeStyle=c.color,i.setLineDash(c.borderDash||[]),i.lineDashOffset=c.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(u.x,u.y),i.stroke(),i.restore())};if(n.display)for(s=0,o=r.length;s{this.draw(s)}}]:[{z:i,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:r,draw:()=>{this.drawBorder()}},{z:n,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(e){const n=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",r=[];let s,o;for(s=0,o=n.length;s{const i=n.split("."),r=i.pop(),s=[t].concat(i).join("."),o=e[n].split("."),a=o.pop(),l=o.join(".");ue.route(s,r,l,a)})}function sb(t){return"id"in t&&"defaults"in t}class ob{constructor(){this.controllers=new zs(Tr,"datasets",!0),this.elements=new zs(Kn,"elements"),this.plugins=new zs(Object,"plugins"),this.scales=new zs(Qn,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,n,i){[...n].forEach(r=>{const s=i||this._getRegistryForType(r);i||s.isForType(r)||s===this.plugins&&r.id?this._exec(e,s,r):V(r,o=>{const a=i||this._getRegistryForType(o);this._exec(e,a,o)})})}_exec(e,n,i){const r=kc(e);re(i["before"+r],[],i),n[e](i),re(i["after"+r],[],i)}_getRegistryForType(e){for(let n=0;ns.filter(a=>!o.some(l=>a.plugin.id===l.plugin.id));this._notify(r(n,i),e,"stop"),this._notify(r(i,n),e,"start")}}function lb(t){const e={},n=[],i=Object.keys(kt.plugins.items);for(let s=0;s1&&Jd(t[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function Zd(t,e,n){if(n[e+"AxisID"]===t)return{axis:e}}function gb(t,e){if(e.data&&e.data.datasets){const n=e.data.datasets.filter(i=>i.xAxisID===t||i.yAxisID===t);if(n.length)return Zd(t,"x",n[0])||Zd(t,"y",n[0])}return{}}function mb(t,e){const n=Wn[t.type]||{scales:{}},i=e.scales||{},r=hu(t.type,e),s=Object.create(null);return Object.keys(i).forEach(o=>{const a=i[o];if(!U(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=du(o,a,gb(o,t),ue.scales[a.type]),u=fb(l,r),c=n.scales||{};s[o]=br(Object.create(null),[{axis:l},a,c[l],c[u]])}),t.data.datasets.forEach(o=>{const a=o.type||t.type,l=o.indexAxis||hu(a,e),c=(Wn[a]||{}).scales||{};Object.keys(c).forEach(h=>{const d=db(h,l),f=o[d+"AxisID"]||d;s[f]=s[f]||Object.create(null),br(s[f],[{axis:d},i[f],c[h]])})}),Object.keys(s).forEach(o=>{const a=s[o];br(a,[ue.scales[a.type],ue.scale])}),s}function Fm(t){const e=t.options||(t.options={});e.plugins=W(e.plugins,{}),e.scales=mb(t,e)}function zm(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function yb(t){return t=t||{},t.data=zm(t.data),Fm(t),t}const ef=new Map,$m=new Set;function $s(t,e){let n=ef.get(t);return n||(n=e(),ef.set(t,n),$m.add(n)),n}const nr=(t,e,n)=>{const i=jo(e,n);i!==void 0&&t.add(i)};class vb{constructor(e){this._config=yb(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=zm(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),Fm(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return $s(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,n){return $s(`${e}.transition.${n}`,()=>[[`datasets.${e}.transitions.${n}`,`transitions.${n}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,n){return $s(`${e}-${n}`,()=>[[`datasets.${e}.elements.${n}`,`datasets.${e}`,`elements.${n}`,""]])}pluginScopeKeys(e){const n=e.id,i=this.type;return $s(`${i}-plugin-${n}`,()=>[[`plugins.${n}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,n){const i=this._scopeCache;let r=i.get(e);return(!r||n)&&(r=new Map,i.set(e,r)),r}getOptionScopes(e,n,i){const{options:r,type:s}=this,o=this._cachedScopes(e,i),a=o.get(n);if(a)return a;const l=new Set;n.forEach(c=>{e&&(l.add(e),c.forEach(h=>nr(l,e,h))),c.forEach(h=>nr(l,r,h)),c.forEach(h=>nr(l,Wn[s]||{},h)),c.forEach(h=>nr(l,ue,h)),c.forEach(h=>nr(l,lu,h))});const u=Array.from(l);return u.length===0&&u.push(Object.create(null)),$m.has(n)&&o.set(n,u),u}chartOptionScopes(){const{options:e,type:n}=this;return[e,Wn[n]||{},ue.datasets[n]||{},{type:n},ue,lu]}resolveNamedOptions(e,n,i,r=[""]){const s={$shared:!0},{resolver:o,subPrefixes:a}=tf(this._resolverCache,e,r);let l=o;if(wb(o,n)){s.$shared=!1,i=gn(i)?i():i;const u=this.createResolver(e,i,a);l=Ai(o,i,u)}for(const u of n)s[u]=l[u];return s}createResolver(e,n,i=[""],r){const{resolver:s}=tf(this._resolverCache,e,i);return U(n)?Ai(s,n,void 0,r):s}}function tf(t,e,n){let i=t.get(e);i||(i=new Map,t.set(e,i));const r=n.join();let s=i.get(r);return s||(s={resolver:Pc(e,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},i.set(r,s)),s}const _b=t=>U(t)&&Object.getOwnPropertyNames(t).some(e=>gn(t[e]));function wb(t,e){const{isScriptable:n,isIndexable:i}=Cm(t);for(const r of e){const s=n(r),o=i(r),a=(o||s)&&t[r];if(s&&(gn(a)||_b(a))||o&&le(a))return!0}return!1}var xb="4.4.3";const kb=["top","bottom","left","right","chartArea"];function nf(t,e){return t==="top"||t==="bottom"||kb.indexOf(t)===-1&&e==="x"}function rf(t,e){return function(n,i){return n[t]===i[t]?n[e]-i[e]:n[t]-i[t]}}function sf(t){const e=t.chart,n=e.options.animation;e.notifyPlugins("afterRender"),re(n&&n.onComplete,[t],e)}function bb(t){const e=t.chart,n=e.options.animation;re(n&&n.onProgress,[t],e)}function Um(t){return Lc()&&typeof t=="string"?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const oo={},of=t=>{const e=Um(t);return Object.values(oo).filter(n=>n.canvas===e).pop()};function Sb(t,e,n){const i=Object.keys(t);for(const r of i){const s=+r;if(s>=e){const o=t[r];delete t[r],(n>0||s>e)&&(t[s+n]=o)}}}function Cb(t,e,n,i){return!n||t.type==="mouseout"?null:i?e:t}function Us(t,e,n){return t.options.clip?t[n]:e[n]}function Eb(t,e){const{xScale:n,yScale:i}=t;return n&&i?{left:Us(n,e,"left"),right:Us(n,e,"right"),top:Us(i,e,"top"),bottom:Us(i,e,"bottom")}:e}var Vt;let ga=(Vt=class{static register(...e){kt.add(...e),af()}static unregister(...e){kt.remove(...e),af()}constructor(e,n){const i=this.config=new vb(n),r=Um(e),s=of(r);if(s)throw new Error("Canvas is already in use. Chart with ID '"+s.id+"' must be destroyed before the canvas with ID '"+s.canvas.id+"' can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||Vk(r)),this.platform.updateConfig(i);const a=this.platform.acquireContext(r,o.aspectRatio),l=a&&a.canvas,u=l&&l.height,c=l&&l.width;if(this.id=Ox(),this.ctx=a,this.canvas=l,this.width=c,this.height=u,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 ab,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Gx(h=>this.update(h),o.resizeDelay||0),this._dataChanges=[],oo[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Tt.listen(this,"complete",sf),Tt.listen(this,"progress",bb),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:n},width:i,height:r,_aspectRatio:s}=this;return J(e)?n&&s?s:r?i/r:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return kt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Ld(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Pd(this.canvas,this.ctx),this}stop(){return Tt.stop(this),this}resize(e,n){Tt.running(this)?this._resizeBeforeDraw={width:e,height:n}:this._resize(e,n)}_resize(e,n){const i=this.options,r=this.canvas,s=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(r,e,n,s),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,Ld(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),re(i.onResize,[this,o],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};V(n,(i,r)=>{i.id=r})}buildOrUpdateScales(){const e=this.options,n=e.scales,i=this.scales,r=Object.keys(i).reduce((o,a)=>(o[a]=!1,o),{});let s=[];n&&(s=s.concat(Object.keys(n).map(o=>{const a=n[o],l=du(o,a),u=l==="r",c=l==="x";return{options:a,dposition:u?"chartArea":c?"bottom":"left",dtype:u?"radialLinear":c?"category":"linear"}}))),V(s,o=>{const a=o.options,l=a.id,u=du(l,a),c=W(a.type,o.dtype);(a.position===void 0||nf(a.position,u)!==nf(o.dposition))&&(a.position=o.dposition),r[l]=!0;let h=null;if(l in i&&i[l].type===c)h=i[l];else{const d=kt.getScale(c);h=new d({id:l,type:c,ctx:this.ctx,chart:this}),i[h.id]=h}h.init(a,e)}),V(r,(o,a)=>{o||delete i[a]}),V(i,o=>{Ns.configure(this,o,o.options),Ns.addBox(this,o)})}_updateMetasets(){const e=this._metasets,n=this.data.datasets.length,i=e.length;if(e.sort((r,s)=>r.index-s.index),i>n){for(let r=n;rn.length&&delete this._stacks,e.forEach((i,r)=>{n.filter(s=>s===i._dataset).length===0&&this._destroyDatasetMeta(r)})}buildOrUpdateControllers(){const e=[],n=this.data.datasets;let i,r;for(this._removeUnreferencedMetasets(),i=0,r=n.length;i{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const n=this.config;n.update();const i=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const s=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let u=0,c=this.data.datasets.length;u{u.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(rf("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){V(this.scales,e=>{Ns.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,n=new Set(Object.keys(this._listeners)),i=new Set(e.events);(!yd(n,i)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,n=this._getUniformDataChanges()||[];for(const{method:i,start:r,count:s}of n){const o=i==="_removeElements"?-s:s;Sb(e,r,o)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const n=this.data.datasets.length,i=s=>new Set(e.filter(o=>o[0]===s).map((o,a)=>a+","+o.splice(1).join(","))),r=i(0);for(let s=1;ss.split(",")).map(s=>({method:s[1],start:+s[2],count:+s[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Ns.update(this,this.width,this.height,e);const n=this.chartArea,i=n.width<=0||n.height<=0;this._layers=[],V(this.boxes,r=>{i&&r.position==="chartArea"||(r.configure&&r.configure(),this._layers.push(...r._layers()))},this),this._layers.forEach((r,s)=>{r._idx=s}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let n=0,i=this.data.datasets.length;n=0;--n)this._drawDataset(e[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const n=this.ctx,i=e._clip,r=!i.disabled,s=Eb(e,this.chartArea),o={meta:e,index:e.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",o)!==!1&&(r&&km(n,{left:i.left===!1?0:s.left-i.left,right:i.right===!1?this.width:s.right+i.right,top:i.top===!1?0:s.top-i.top,bottom:i.bottom===!1?this.height:s.bottom+i.bottom}),e.controller.draw(),r&&bm(n),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(e){return Dt(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,n,i,r){const s=kk.modes[n];return typeof s=="function"?s(this,e,i,r):[]}getDatasetMeta(e){const n=this.data.datasets[e],i=this._metasets;let r=i.filter(s=>s&&s._dataset===n).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:e,_dataset:n,_parsed:[],_sorted:!1},i.push(r)),r}getContext(){return this.$context||(this.$context=_n(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const n=this.data.datasets[e];if(!n)return!1;const i=this.getDatasetMeta(e);return typeof i.hidden=="boolean"?!i.hidden:!n.hidden}setDatasetVisibility(e,n){const i=this.getDatasetMeta(e);i.hidden=!n}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,n,i){const r=i?"show":"hide",s=this.getDatasetMeta(e),o=s.controller._resolveAnimations(void 0,r);No(n)?(s.data[n].hidden=!i,this.update()):(this.setDatasetVisibility(e,i),o.update(s,{visible:i}),this.update(a=>a.datasetIndex===e?r:void 0))}hide(e,n){this._updateVisibility(e,n,!1)}show(e,n){this._updateVisibility(e,n,!0)}_destroyDatasetMeta(e){const n=this._metasets[e];n&&n.controller&&n.controller._destroy(),delete this._metasets[e]}_stop(){let e,n;for(this.stop(),Tt.remove(this),e=0,n=this.data.datasets.length;e{n.addEventListener(this,s,o),e[s]=o},r=(s,o,a)=>{s.offsetX=o,s.offsetY=a,this._eventHandler(s)};V(this.options.events,s=>i(s,r))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,n=this.platform,i=(l,u)=>{n.addEventListener(this,l,u),e[l]=u},r=(l,u)=>{e[l]&&(n.removeEventListener(this,l,u),delete e[l])},s=(l,u)=>{this.canvas&&this.resize(l,u)};let o;const a=()=>{r("attach",a),this.attached=!0,this.resize(),i("resize",s),i("detach",o)};o=()=>{this.attached=!1,r("resize",s),this._stop(),this._resize(0,0),i("attach",a)},n.isAttached(this.canvas)?a():o()}unbindEvents(){V(this._listeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._listeners={},V(this._responsiveListeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,n,i){const r=i?"set":"remove";let s,o,a,l;for(n==="dataset"&&(s=this.getDatasetMeta(e[0].datasetIndex),s.controller["_"+r+"DatasetHoverStyle"]()),a=0,l=e.length;a{const a=this.getDatasetMeta(s);if(!a)throw new Error("No dataset found at index "+s);return{datasetIndex:s,element:a.data[o],index:o}});!Ao(i,n)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,n))}notifyPlugins(e,n,i){return this._plugins.notify(this,e,n,i)}isPluginEnabled(e){return this._plugins._cache.filter(n=>n.plugin.id===e).length===1}_updateHoverStyles(e,n,i){const r=this.options.hover,s=(l,u)=>l.filter(c=>!u.some(h=>c.datasetIndex===h.datasetIndex&&c.index===h.index)),o=s(n,e),a=i?e:s(e,n);o.length&&this.updateHoverStyle(o,r.mode,!1),a.length&&r.mode&&this.updateHoverStyle(a,r.mode,!0)}_eventHandler(e,n){const i={event:e,replay:n,cancelable:!0,inChartArea:this.isPointInArea(e)},r=o=>(o.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",i,r)===!1)return;const s=this._handleEvent(e,n,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,r),(s||i.changed)&&this.render(),this}_handleEvent(e,n,i){const{_active:r=[],options:s}=this,o=n,a=this._getActiveElements(e,r,i,o),l=Dx(e),u=Cb(e,this._lastEvent,i,l);i&&(this._lastEvent=null,re(s.onHover,[e,a,this],this),l&&re(s.onClick,[e,a,this],this));const c=!Ao(a,r);return(c||n)&&(this._active=a,this._updateHoverStyles(a,r,n)),this._lastEvent=u,c}_getActiveElements(e,n,i,r){if(e.type==="mouseout")return[];if(!i)return n;const s=this.options.hover;return this.getElementsAtEventForMode(e,s.mode,s,r)}},I(Vt,"defaults",ue),I(Vt,"instances",oo),I(Vt,"overrides",Wn),I(Vt,"registry",kt),I(Vt,"version",xb),I(Vt,"getChart",of),Vt);function af(){return V(ga.instances,t=>t._plugins.invalidate())}function Bm(t,e,n=e){t.lineCap=W(n.borderCapStyle,e.borderCapStyle),t.setLineDash(W(n.borderDash,e.borderDash)),t.lineDashOffset=W(n.borderDashOffset,e.borderDashOffset),t.lineJoin=W(n.borderJoinStyle,e.borderJoinStyle),t.lineWidth=W(n.borderWidth,e.borderWidth),t.strokeStyle=W(n.borderColor,e.borderColor)}function Pb(t,e,n){t.lineTo(n.x,n.y)}function Tb(t){return t.stepped?u1:t.tension||t.cubicInterpolationMode==="monotone"?c1:Pb}function Vm(t,e,n={}){const i=t.length,{start:r=0,end:s=i-1}=n,{start:o,end:a}=e,l=Math.max(r,o),u=Math.min(s,a),c=ra&&s>a;return{count:i,start:l,loop:e.loop,ilen:u(o+(u?a-w:w))%s,_=()=>{y!==v&&(t.lineTo(c,v),t.lineTo(c,y),t.lineTo(c,p))};for(l&&(f=r[g(0)],t.moveTo(f.x,f.y)),d=0;d<=a;++d){if(f=r[g(d)],f.skip)continue;const w=f.x,x=f.y,b=w|0;b===m?(xv&&(v=x),c=(h*c+w)/++h):(_(),t.lineTo(w,x),m=b,h=0,y=v=x),p=x}_()}function fu(t){const e=t.options,n=e.borderDash&&e.borderDash.length;return!t._decimated&&!t._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!n?Lb:Ob}function Mb(t){return t.stepped?V1:t.tension||t.cubicInterpolationMode==="monotone"?H1:Ln}function Rb(t,e,n,i){let r=e._path;r||(r=e._path=new Path2D,e.path(r,n,i)&&r.closePath()),Bm(t,e.options),t.stroke(r)}function Ib(t,e,n,i){const{segments:r,options:s}=e,o=fu(e);for(const a of r)Bm(t,s,a.style),t.beginPath(),o(t,e,a,{start:n,end:n+i-1})&&t.closePath(),t.stroke()}const Ab=typeof Path2D=="function";function Db(t,e,n,i){Ab&&!e.options.segment?Rb(t,e,n,i):Ib(t,e,n,i)}class cr extends Kn{constructor(e){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,e&&Object.assign(this,e)}updateControlPoints(e,n){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const r=i.spanGaps?this._loop:this._fullLoop;D1(this._points,i,e,r,n),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=ek(this,this.options.segment))}first(){const e=this.segments,n=this.points;return e.length&&n[e[0].start]}last(){const e=this.segments,n=this.points,i=e.length;return i&&n[e[i-1].end]}interpolate(e,n){const i=this.options,r=e[n],s=this.points,o=X1(this,{property:n,start:r,end:r});if(!o.length)return;const a=[],l=Mb(i);let u,c;for(u=0,c=o.length;ue!=="borderDash"&&e!=="fill"});function lf(t,e,n,i){const r=t.options,{[n]:s}=t.getProps([n],i);return Math.abs(e-s)a+l)/i.size,y:r/s}},nearest(t,e){if(!t.length)return!1;let n=e.x,i=e.y,r=Number.POSITIVE_INFINITY,s,o,a;for(s=0,o=t.length;s-1?t.split(` +`):t}function jb(t,e){const{element:n,datasetIndex:i,index:r}=e,s=t.getDatasetMeta(i).controller,{label:o,value:a}=s.getLabelAndValue(r);return{chart:t,label:o,parsed:s.getParsed(r),raw:t.data.datasets[i].data[r],formattedValue:a,dataset:s.getDataset(),dataIndex:r,datasetIndex:i,element:n}}function uf(t,e){const n=t.chart.ctx,{body:i,footer:r,title:s}=t,{boxWidth:o,boxHeight:a}=e,l=Ke(e.bodyFont),u=Ke(e.titleFont),c=Ke(e.footerFont),h=s.length,d=r.length,f=i.length,m=ot(e.padding);let y=m.height,v=0,p=i.reduce((w,x)=>w+x.before.length+x.lines.length+x.after.length,0);if(p+=t.beforeBody.length+t.afterBody.length,h&&(y+=h*u.lineHeight+(h-1)*e.titleSpacing+e.titleMarginBottom),p){const w=e.displayColors?Math.max(a,l.lineHeight):l.lineHeight;y+=f*w+(p-f)*l.lineHeight+(p-1)*e.bodySpacing}d&&(y+=e.footerMarginTop+d*c.lineHeight+(d-1)*e.footerSpacing);let g=0;const _=function(w){v=Math.max(v,n.measureText(w).width+g)};return n.save(),n.font=u.string,V(t.title,_),n.font=l.string,V(t.beforeBody.concat(t.afterBody),_),g=e.displayColors?o+2+e.boxPadding:0,V(i,w=>{V(w.before,_),V(w.lines,_),V(w.after,_)}),g=0,n.font=c.string,V(t.footer,_),n.restore(),v+=m.width,{width:v,height:y}}function Nb(t,e){const{y:n,height:i}=e;return nt.height-i/2?"bottom":"center"}function Fb(t,e,n,i){const{x:r,width:s}=i,o=n.caretSize+n.caretPadding;if(t==="left"&&r+s+o>e.width||t==="right"&&r-s-o<0)return!0}function zb(t,e,n,i){const{x:r,width:s}=n,{width:o,chartArea:{left:a,right:l}}=t;let u="center";return i==="center"?u=r<=(a+l)/2?"left":"right":r<=s/2?u="left":r>=o-s/2&&(u="right"),Fb(u,t,e,n)&&(u="center"),u}function cf(t,e,n){const i=n.yAlign||e.yAlign||Nb(t,n);return{xAlign:n.xAlign||e.xAlign||zb(t,e,n,i),yAlign:i}}function $b(t,e){let{x:n,width:i}=t;return e==="right"?n-=i:e==="center"&&(n-=i/2),n}function Ub(t,e,n){let{y:i,height:r}=t;return e==="top"?i+=n:e==="bottom"?i-=r+n:i-=r/2,i}function hf(t,e,n,i){const{caretSize:r,caretPadding:s,cornerRadius:o}=t,{xAlign:a,yAlign:l}=n,u=r+s,{topLeft:c,topRight:h,bottomLeft:d,bottomRight:f}=Pr(o);let m=$b(e,a);const y=Ub(e,l,u);return l==="center"?a==="left"?m+=u:a==="right"&&(m-=u):a==="left"?m-=Math.max(c,d)+r:a==="right"&&(m+=Math.max(h,f)+r),{x:nt(m,0,i.width-e.width),y:nt(y,0,i.height-e.height)}}function Bs(t,e,n){const i=ot(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-i.right:t.x+i.left}function df(t){return wt([],Ot(t))}function Bb(t,e,n){return _n(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function ff(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const Hm={beforeTitle:Pt,title(t){if(t.length>0){const e=t[0],n=e.chart.data.labels,i=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(i>0&&e.dataIndex"u"?Hm[e].call(n,i):r}class pu extends Kn{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const n=this.chart,i=this.options.setContext(this.getContext()),r=i.enabled&&n.options.animation&&i.animations,s=new Mm(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(s)),s}getContext(){return this.$context||(this.$context=Bb(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:i}=n,r=Ae(i,"beforeTitle",this,e),s=Ae(i,"title",this,e),o=Ae(i,"afterTitle",this,e);let a=[];return a=wt(a,Ot(r)),a=wt(a,Ot(s)),a=wt(a,Ot(o)),a}getBeforeBody(e,n){return df(Ae(n.callbacks,"beforeBody",this,e))}getBody(e,n){const{callbacks:i}=n,r=[];return V(e,s=>{const o={before:[],lines:[],after:[]},a=ff(i,s);wt(o.before,Ot(Ae(a,"beforeLabel",this,s))),wt(o.lines,Ae(a,"label",this,s)),wt(o.after,Ot(Ae(a,"afterLabel",this,s))),r.push(o)}),r}getAfterBody(e,n){return df(Ae(n.callbacks,"afterBody",this,e))}getFooter(e,n){const{callbacks:i}=n,r=Ae(i,"beforeFooter",this,e),s=Ae(i,"footer",this,e),o=Ae(i,"afterFooter",this,e);let a=[];return a=wt(a,Ot(r)),a=wt(a,Ot(s)),a=wt(a,Ot(o)),a}_createItems(e){const n=this._active,i=this.chart.data,r=[],s=[],o=[];let a=[],l,u;for(l=0,u=n.length;le.filter(c,h,d,i))),e.itemSort&&(a=a.sort((c,h)=>e.itemSort(c,h,i))),V(a,c=>{const h=ff(e.callbacks,c);r.push(Ae(h,"labelColor",this,c)),s.push(Ae(h,"labelPointStyle",this,c)),o.push(Ae(h,"labelTextColor",this,c))}),this.labelColors=r,this.labelPointStyles=s,this.labelTextColors=o,this.dataPoints=a,a}update(e,n){const i=this.options.setContext(this.getContext()),r=this._active;let s,o=[];if(!r.length)this.opacity!==0&&(s={opacity:0});else{const a=hr[i.position].call(this,r,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const l=this._size=uf(this,i),u=Object.assign({},a,l),c=cf(this.chart,i,u),h=hf(i,u,c,this.chart);this.xAlign=c.xAlign,this.yAlign=c.yAlign,s={opacity:1,x:h.x,y:h.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,s&&this._resolveAnimations().update(this,s),e&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(e,n,i,r){const s=this.getCaretPosition(e,i,r);n.lineTo(s.x1,s.y1),n.lineTo(s.x2,s.y2),n.lineTo(s.x3,s.y3)}getCaretPosition(e,n,i){const{xAlign:r,yAlign:s}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:l,topRight:u,bottomLeft:c,bottomRight:h}=Pr(a),{x:d,y:f}=e,{width:m,height:y}=n;let v,p,g,_,w,x;return s==="center"?(w=f+y/2,r==="left"?(v=d,p=v-o,_=w+o,x=w-o):(v=d+m,p=v+o,_=w-o,x=w+o),g=v):(r==="left"?p=d+Math.max(l,c)+o:r==="right"?p=d+m-Math.max(u,h)-o:p=this.caretX,s==="top"?(_=f,w=_-o,v=p-o,g=p+o):(_=f+y,w=_+o,v=p+o,g=p-o),x=_),{x1:v,x2:p,x3:g,y1:_,y2:w,y3:x}}drawTitle(e,n,i){const r=this.title,s=r.length;let o,a,l;if(s){const u=Za(i.rtl,this.x,this.width);for(e.x=Bs(this,i.titleAlign,i),n.textAlign=u.textAlign(i.titleAlign),n.textBaseline="middle",o=Ke(i.titleFont),a=i.titleSpacing,n.fillStyle=i.titleColor,n.font=o.string,l=0;lg!==0)?(e.beginPath(),e.fillStyle=s.multiKeyBackground,cu(e,{x:y,y:m,w:u,h:l,radius:p}),e.fill(),e.stroke(),e.fillStyle=o.backgroundColor,e.beginPath(),cu(e,{x:v,y:m+1,w:u-2,h:l-2,radius:p}),e.fill()):(e.fillStyle=s.multiKeyBackground,e.fillRect(y,m,u,l),e.strokeRect(y,m,u,l),e.fillStyle=o.backgroundColor,e.fillRect(v,m+1,u-2,l-2))}e.fillStyle=this.labelTextColors[i]}drawBody(e,n,i){const{body:r}=this,{bodySpacing:s,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:u,boxPadding:c}=i,h=Ke(i.bodyFont);let d=h.lineHeight,f=0;const m=Za(i.rtl,this.x,this.width),y=function(S){n.fillText(S,m.x(e.x+f),e.y+d/2),e.y+=d+s},v=m.textAlign(o);let p,g,_,w,x,b,k;for(n.textAlign=o,n.textBaseline="middle",n.font=h.string,e.x=Bs(this,v,i),n.fillStyle=i.bodyColor,V(this.beforeBody,y),f=a&&v!=="right"?o==="center"?u/2+c:u+2+c:0,w=0,b=r.length;w0&&n.stroke()}_updateAnimationTarget(e){const n=this.chart,i=this.$animations,r=i&&i.x,s=i&&i.y;if(r||s){const o=hr[e.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=uf(this,e),l=Object.assign({},o,this._size),u=cf(n,e,l),c=hf(e,l,u,n);(r._to!==c.x||s._to!==c.y)&&(this.xAlign=u.xAlign,this.yAlign=u.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(e){const n=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(n);const r={width:this.width,height:this.height},s={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=ot(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(e.save(),e.globalAlpha=i,this.drawBackground(s,e,r,n),Y1(e,n.textDirection),s.y+=o.top,this.drawTitle(s,e,n),this.drawBody(s,e,n),this.drawFooter(s,e,n),G1(e,n.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,n){const i=this._active,r=e.map(({datasetIndex:a,index:l})=>{const u=this.chart.getDatasetMeta(a);if(!u)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:u.data[l],index:l}}),s=!Ao(i,r),o=this._positionChanged(r,n);(s||o)&&(this._active=r,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,n,i=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const r=this.options,s=this._active||[],o=this._getActiveElements(e,s,n,i),a=this._positionChanged(o,e),l=n||!Ao(o,s)||a;return l&&(this._active=o,(r.enabled||r.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,n))),l}_getActiveElements(e,n,i,r){const s=this.options;if(e.type==="mouseout")return[];if(!r)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const o=this.chart.getElementsAtEventForMode(e,s.mode,s,i);return s.reverse&&o.reverse(),o}_positionChanged(e,n){const{caretX:i,caretY:r,options:s}=this,o=hr[s.position].call(this,e,n);return o!==!1&&(i!==o.x||r!==o.y)}}I(pu,"positioners",hr);var Vb={id:"tooltip",_element:pu,positioners:hr,afterInit(t,e,n){n&&(t.tooltip=new pu({chart:t,options:n}))},beforeUpdate(t,e,n){t.tooltip&&t.tooltip.initialize(n)},reset(t,e,n){t.tooltip&&t.tooltip.initialize(n)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const n={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",n)}},afterEvent(t,e){if(t.tooltip){const n=e.replay;t.tooltip.handleEvent(e.event,n,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Hm},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Hb=(t,e,n,i)=>(typeof e=="string"?(n=t.push(e)-1,i.unshift({index:n,label:e})):isNaN(e)&&(n=null),n);function Wb(t,e,n,i){const r=t.indexOf(e);if(r===-1)return Hb(t,e,n,i);const s=t.lastIndexOf(e);return r!==s?n:r}const Kb=(t,e)=>t===null?null:nt(Math.round(t),0,e);function pf(t){const e=this.getLabels();return t>=0&&tn.length-1?null:this.getPixelForValue(n[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}I(gu,"id","category"),I(gu,"defaults",{ticks:{callback:pf}});function Yb(t,e){const n=[],{bounds:r,step:s,min:o,max:a,precision:l,count:u,maxTicks:c,maxDigits:h,includeBounds:d}=t,f=s||1,m=c-1,{min:y,max:v}=e,p=!J(o),g=!J(a),_=!J(u),w=(v-y)/(h+1);let x=_d((v-y)/m/f)*f,b,k,S,M;if(x<1e-14&&!p&&!g)return[{value:y},{value:v}];M=Math.ceil(v/x)-Math.floor(y/x),M>m&&(x=_d(M*x/m/f)*f),J(l)||(b=Math.pow(10,l),x=Math.ceil(x*b)/b),r==="ticks"?(k=Math.floor(y/x)*x,S=Math.ceil(v/x)*x):(k=y,S=v),p&&g&&s&&zx((a-o)/s,x/1e3)?(M=Math.round(Math.min((a-o)/x,c)),x=(a-o)/M,k=o,S=a):_?(k=p?o:k,S=g?a:S,M=u-1,x=(S-k)/M):(M=(S-k)/x,Sr(M,Math.round(M),x/1e3)?M=Math.round(M):M=Math.ceil(M));const L=Math.max(wd(x),wd(k));b=Math.pow(10,J(l)?L:l),k=Math.round(k*b)/b,S=Math.round(S*b)/b;let D=0;for(p&&(d&&k!==o?(n.push({value:o}),ka)break;n.push({value:B})}return g&&d&&S!==a?n.length&&Sr(n[n.length-1].value,a,gf(a,w,t))?n[n.length-1].value=a:n.push({value:a}):(!g||S===a)&&n.push({value:S}),n}function gf(t,e,{horizontal:n,minRotation:i}){const r=nn(i),s=(n?Math.sin(r):Math.cos(r))||.001,o=.75*e*(""+t).length;return Math.min(e/s,o)}class Vo extends Qn{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,n){return J(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:n,maxDefined:i}=this.getUserBounds();let{min:r,max:s}=this;const o=l=>r=n?r:l,a=l=>s=i?s:l;if(e){const l=Ii(r),u=Ii(s);l<0&&u<0?a(0):l>0&&u>0&&o(0)}if(r===s){let l=s===0?1:Math.abs(s*.05);a(s+l),e||o(r-l)}this.min=r,this.max=s}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:n,stepSize:i}=e,r;return i?(r=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,r>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${r} ticks. Limiting to 1000.`),r=1e3)):(r=this.computeTickLimit(),n=n||11),n&&(r=Math.min(n,r)),r}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,n=e.ticks;let i=this.getTickLimit();i=Math.max(2,i);const r={maxTicks:i,bounds:e.bounds,min:e.min,max:e.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},s=this._range||this,o=Yb(r,s);return e.bounds==="ticks"&&mm(o,this,"value"),e.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const e=this.ticks;let n=this.min,i=this.max;if(super.configure(),this.options.offset&&e.length){const r=(i-n)/Math.max(e.length-1,1)/2;n-=r,i+=r}this._startValue=n,this._endValue=i,this._valueRange=i-n}getLabelForValue(e){return Ec(e,this.chart.options.locale,this.options.ticks.format)}}class mu extends Vo{determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=ye(e)?e:0,this.max=ye(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),n=e?this.width:this.height,i=nn(this.options.ticks.minRotation),r=(e?Math.sin(i):Math.cos(i))||.001,s=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,s.lineHeight/r))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}I(mu,"id","linear"),I(mu,"defaults",{ticks:{callback:fa.formatters.numeric}});const Zr=t=>Math.floor(tn(t)),Cn=(t,e)=>Math.pow(10,Zr(t)+e);function mf(t){return t/Math.pow(10,Zr(t))===1}function yf(t,e,n){const i=Math.pow(10,n),r=Math.floor(t/i);return Math.ceil(e/i)-r}function Gb(t,e){const n=e-t;let i=Zr(n);for(;yf(t,e,i)>10;)i++;for(;yf(t,e,i)<10;)i--;return Math.min(i,Zr(t))}function qb(t,{min:e,max:n}){e=Be(t.min,e);const i=[],r=Zr(e);let s=Gb(e,n),o=s<0?Math.pow(10,Math.abs(s)):1;const a=Math.pow(10,s),l=r>s?Math.pow(10,r):0,u=Math.round((e-l)*o)/o,c=Math.floor((e-l)/a/10)*a*10;let h=Math.floor((u-c)/Math.pow(10,s)),d=Be(t.min,Math.round((l+c+h*Math.pow(10,s))*o)/o);for(;d=10?h=h<15?15:20:h++,h>=20&&(s++,h=2,o=s>=0?1:o),d=Math.round((l+c+h*Math.pow(10,s))*o)/o;const f=Be(t.max,d);return i.push({value:f,major:mf(f),significand:h}),i}class vf extends Qn{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,n){const i=Vo.prototype.parse.apply(this,[e,n]);if(i===0){this._zero=!0;return}return ye(i)&&i>0?i:null}determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=ye(e)?Math.max(0,e):null,this.max=ye(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!ye(this._userMin)&&(this.min=e===Cn(this.min,0)?Cn(this.min,-1):Cn(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:e,maxDefined:n}=this.getUserBounds();let i=this.min,r=this.max;const s=a=>i=e?i:a,o=a=>r=n?r:a;i===r&&(i<=0?(s(1),o(10)):(s(Cn(i,-1)),o(Cn(r,1)))),i<=0&&s(Cn(r,-1)),r<=0&&o(Cn(i,1)),this.min=i,this.max=r}buildTicks(){const e=this.options,n={min:this._userMin,max:this._userMax},i=qb(n,this);return e.bounds==="ticks"&&mm(i,this,"value"),e.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(e){return e===void 0?"0":Ec(e,this.chart.options.locale,this.options.ticks.format)}configure(){const e=this.min;super.configure(),this._startValue=tn(e),this._valueRange=tn(this.max)-tn(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(tn(e)-this._startValue)/this._valueRange)}getValueForPixel(e){const n=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+n*this._valueRange)}}I(vf,"id","logarithmic"),I(vf,"defaults",{ticks:{callback:fa.formatters.logarithmic,major:{enabled:!0}}});function yu(t){const e=t.ticks;if(e.display&&t.display){const n=ot(e.backdropPadding);return W(e.font&&e.font.size,ue.font.size)+n.height}return 0}function Qb(t,e,n){return n=le(n)?n:[n],{w:a1(t,e.string,n),h:n.length*e.lineHeight}}function _f(t,e,n,i,r){return t===i||t===r?{start:e-n/2,end:e+n/2}:tr?{start:e-n,end:e}:{start:e,end:e+n}}function Xb(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},n=Object.assign({},e),i=[],r=[],s=t._pointLabels.length,o=t.options.pointLabels,a=o.centerPointLabels?_e/s:0;for(let l=0;le.r&&(a=(i.end-e.r)/s,t.r=Math.max(t.r,e.r+a)),r.starte.b&&(l=(r.end-e.b)/o,t.b=Math.max(t.b,e.b+l))}function Zb(t,e,n){const i=t.drawingArea,{extra:r,additionalAngle:s,padding:o,size:a}=n,l=t.getPointPosition(e,i+r+o,s),u=Math.round(bc(dt(l.angle+We))),c=rS(l.y,a.h,u),h=nS(u),d=iS(l.x,a.w,h);return{visible:!0,x:l.x,y:c,textAlign:h,left:d,top:c,right:d+a.w,bottom:c+a.h}}function eS(t,e){if(!e)return!0;const{left:n,top:i,right:r,bottom:s}=t;return!(Dt({x:n,y:i},e)||Dt({x:n,y:s},e)||Dt({x:r,y:i},e)||Dt({x:r,y:s},e))}function tS(t,e,n){const i=[],r=t._pointLabels.length,s=t.options,{centerPointLabels:o,display:a}=s.pointLabels,l={extra:yu(s)/2,additionalAngle:o?_e/r:0};let u;for(let c=0;c270||n<90)&&(t-=e),t}function sS(t,e,n){const{left:i,top:r,right:s,bottom:o}=n,{backdropColor:a}=e;if(!J(a)){const l=Pr(e.borderRadius),u=ot(e.backdropPadding);t.fillStyle=a;const c=i-u.left,h=r-u.top,d=s-i+u.width,f=o-r+u.height;Object.values(l).some(m=>m!==0)?(t.beginPath(),cu(t,{x:c,y:h,w:d,h:f,radius:l}),t.fill()):t.fillRect(c,h,d,f)}}function oS(t,e){const{ctx:n,options:{pointLabels:i}}=t;for(let r=e-1;r>=0;r--){const s=t._pointLabelItems[r];if(!s.visible)continue;const o=i.setContext(t.getPointLabelContext(r));sS(n,o,s);const a=Ke(o.font),{x:l,y:u,textAlign:c}=s;$o(n,t._pointLabels[r],l,u+a.lineHeight/2,a,{color:o.color,textAlign:c,textBaseline:"middle"})}}function Wm(t,e,n,i){const{ctx:r}=t;if(n)r.arc(t.xCenter,t.yCenter,e,0,mt);else{let s=t.getPointPosition(0,e);r.moveTo(s.x,s.y);for(let o=1;o{const r=re(this.options.pointLabels.callback,[n,i],this);return r||r===0?r:""}).filter((n,i)=>this.chart.getDataVisibility(i))}fit(){const e=this.options;e.display&&e.pointLabels.display?Xb(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,n,i,r){this.xCenter+=Math.floor((e-n)/2),this.yCenter+=Math.floor((i-r)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,n,i,r))}getIndexAngle(e){const n=mt/(this._pointLabels.length||1),i=this.options.startAngle||0;return dt(e*n+nn(i))}getDistanceFromCenterForValue(e){if(J(e))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*n:(e-this.min)*n}getValueForDistanceFromCenter(e){if(J(e))return NaN;const n=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(e){const n=this._pointLabels||[];if(e>=0&&e{if(h!==0||h===0&&this.min<0){l=this.getDistanceFromCenterForValue(c.value);const d=this.getContext(h),f=r.setContext(d),m=s.setContext(d);aS(this,f,l,o,m)}}),i.display){for(e.save(),a=o-1;a>=0;a--){const c=i.setContext(this.getPointLabelContext(a)),{color:h,lineWidth:d}=c;!d||!h||(e.lineWidth=d,e.strokeStyle=h,e.setLineDash(c.borderDash),e.lineDashOffset=c.borderDashOffset,l=this.getDistanceFromCenterForValue(n.ticks.reverse?this.min:this.max),u=this.getPointPosition(a,l),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(u.x,u.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){const e=this.ctx,n=this.options,i=n.ticks;if(!i.display)return;const r=this.getIndexAngle(0);let s,o;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(r),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!n.reverse)return;const u=i.setContext(this.getContext(l)),c=Ke(u.font);if(s=this.getDistanceFromCenterForValue(this.ticks[l].value),u.showLabelBackdrop){e.font=c.string,o=e.measureText(a.label).width,e.fillStyle=u.backdropColor;const h=ot(u.backdropPadding);e.fillRect(-o/2-h.left,-s-c.size/2-h.top,o+h.width,c.size+h.height)}$o(e,a.label,0,-s,c,{color:u.color,strokeColor:u.textStrokeColor,strokeWidth:u.textStrokeWidth})}),e.restore()}drawTitle(){}}I(Vs,"id","radialLinear"),I(Vs,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:fa.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}}),I(Vs,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),I(Vs,"descriptors",{angleLines:{_fallback:"grid"}});const ma={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}},je=Object.keys(ma);function wf(t,e){return t-e}function xf(t,e){if(J(e))return null;const n=t._adapter,{parser:i,round:r,isoWeekday:s}=t._parseOpts;let o=e;return typeof i=="function"&&(o=i(o)),ye(o)||(o=typeof i=="string"?n.parse(o,i):n.parse(o)),o===null?null:(r&&(o=r==="week"&&(Xr(s)||s===!0)?n.startOf(o,"isoWeek",s):n.startOf(o,r)),+o)}function kf(t,e,n,i){const r=je.length;for(let s=je.indexOf(t);s=je.indexOf(n);s--){const o=je[s];if(ma[o].common&&t._adapter.diff(r,i,o)>=e-1)return o}return je[n?je.indexOf(n):0]}function cS(t){for(let e=je.indexOf(t)+1,n=je.length;e=e?n[i]:n[r];t[s]=!0}}function hS(t,e,n,i){const r=t._adapter,s=+r.startOf(e[0].value,i),o=e[e.length-1].value;let a,l;for(a=s;a<=o;a=+r.add(a,1,i))l=n[a],l>=0&&(e[l].major=!0);return e}function Sf(t,e,n){const i=[],r={},s=e.length;let o,a;for(o=0;o+e.value))}initOffsets(e=[]){let n=0,i=0,r,s;this.options.offset&&e.length&&(r=this.getDecimalForValue(e[0]),e.length===1?n=1-r:n=(this.getDecimalForValue(e[1])-r)/2,s=this.getDecimalForValue(e[e.length-1]),e.length===1?i=s:i=(s-this.getDecimalForValue(e[e.length-2]))/2);const o=e.length<3?.5:.25;n=nt(n,0,o),i=nt(i,0,o),this._offsets={start:n,end:i,factor:1/(n+1+i)}}_generate(){const e=this._adapter,n=this.min,i=this.max,r=this.options,s=r.time,o=s.unit||kf(s.minUnit,n,i,this._getLabelCapacity(n)),a=W(r.ticks.stepSize,1),l=o==="week"?s.isoWeekday:!1,u=Xr(l)||l===!0,c={};let h=n,d,f;if(u&&(h=+e.startOf(h,"isoWeek",l)),h=+e.startOf(h,u?"day":o),e.diff(i,n,o)>1e5*a)throw new Error(n+" and "+i+" are too far apart with stepSize of "+a+" "+o);const m=r.ticks.source==="data"&&this.getDataTimestamps();for(d=h,f=0;d+y)}getLabelForValue(e){const n=this._adapter,i=this.options.time;return i.tooltipFormat?n.format(e,i.tooltipFormat):n.format(e,i.displayFormats.datetime)}format(e,n){const r=this.options.time.displayFormats,s=this._unit,o=n||r[s];return this._adapter.format(e,o)}_tickFormatFunction(e,n,i,r){const s=this.options,o=s.ticks.callback;if(o)return re(o,[e,n,i],this);const a=s.time.displayFormats,l=this._unit,u=this._majorUnit,c=l&&a[l],h=u&&a[u],d=i[n],f=u&&h&&d&&d.major;return this._adapter.format(e,r||(f?h:c))}generateTickLabels(e){let n,i,r;for(n=0,i=e.length;n0?a:1}getDataTimestamps(){let e=this._cache.data||[],n,i;if(e.length)return e;const r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(n=0,i=r.length;n=t[i].pos&&e<=t[r].pos&&({lo:i,hi:r}=Dn(t,"pos",e)),{pos:s,time:a}=t[i],{pos:o,time:l}=t[r]):(e>=t[i].time&&e<=t[r].time&&({lo:i,hi:r}=Dn(t,"time",e)),{time:s,pos:a}=t[i],{time:o,pos:l}=t[r]);const u=o-s;return u?a+(l-a)*(e-s)/u:a}class Cf extends Ho{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(e);this._minPos=Hs(n,this.min),this._tableRange=Hs(n,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:n,max:i}=this,r=[],s=[];let o,a,l,u,c;for(o=0,a=e.length;o=n&&u<=i&&r.push(u);if(r.length<2)return[{time:n,pos:0},{time:i,pos:1}];for(o=0,a=r.length;or-s)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const n=this.getDataTimestamps(),i=this.getLabelTimestamps();return n.length&&i.length?e=this.normalize(n.concat(i)):e=n.length?n:i,e=this._cache.all=e,e}getDecimalForValue(e){return(Hs(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const n=this._offsets,i=this.getDecimalForPixel(e)/n.factor-n.end;return Hs(this._table,i*this._tableRange+this._minPos,!0)}}I(Cf,"id","timeseries"),I(Cf,"defaults",Ho.defaults);const Km="label";function Ef(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function dS(t,e){const n=t.options;n&&e&&Object.assign(n,e)}function Ym(t,e){t.labels=e}function Gm(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Km;const i=[];t.datasets=e.map(r=>{const s=t.datasets.find(o=>o[n]===r[n]);return!s||!r.data||i.includes(s)?{...r}:(i.push(s),Object.assign(s,r),s)})}function fS(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Km;const n={labels:[],datasets:[]};return Ym(n,t.labels),Gm(n,t.datasets,e),n}function pS(t,e){const{height:n=150,width:i=300,redraw:r=!1,datasetIdKey:s,type:o,data:a,options:l,plugins:u=[],fallbackContent:c,updateMode:h,...d}=t,f=E.useRef(null),m=E.useRef(),y=()=>{f.current&&(m.current=new ga(f.current,{type:o,data:fS(a,s),options:l&&{...l},plugins:u}),Ef(e,m.current))},v=()=>{Ef(e,null),m.current&&(m.current.destroy(),m.current=null)};return E.useEffect(()=>{!r&&m.current&&l&&dS(m.current,l)},[r,l]),E.useEffect(()=>{!r&&m.current&&Ym(m.current.config.data,a.labels)},[r,a.labels]),E.useEffect(()=>{!r&&m.current&&a.datasets&&Gm(m.current.config.data,a.datasets,s)},[r,a.datasets]),E.useEffect(()=>{m.current&&(r?(v(),setTimeout(y)):m.current.update(h))},[r,l,a.labels,a.datasets,h]),E.useEffect(()=>{m.current&&(v(),setTimeout(y))},[o]),E.useEffect(()=>(y(),()=>v()),[]),Ni.createElement("canvas",Object.assign({ref:f,role:"img",height:n,width:i},d),c)}const gS=E.forwardRef(pS);function mS(t,e){return ga.register(e),E.forwardRef((n,i)=>Ni.createElement(gS,Object.assign({},n,{ref:i,type:t})))}const yS=mS("line",ro);ga.register(gu,mu,ao,cr,Vb);function Pf(){const t={responsive:!0,scales:{x:{grid:{display:!1}},y:{ticks:{callback:function(i,r,s){return i+"wps"}},grid:{display:!1}}}},e=["January","February","March","April","May","June","July"],n={labels:e,datasets:[{label:"Dataset 1",data:e.map(()=>Math.random()*1e3),borderColor:"rgb(255, 99, 132)",backgroundColor:"rgba(255, 99, 132, 0.5)"},{label:"Dataset 2",data:e.map(()=>Math.random()*1e3),borderColor:"rgb(53, 162, 235)",backgroundColor:"rgba(53, 162, 235, 0.5)"}]};return P.jsxs("div",{children:[P.jsx("p",{className:"text-center",children:"File writes per second"}),P.jsx(yS,{data:n,options:t})]})}function vS(){return P.jsx(P.Fragment,{children:P.jsx("p",{children:"TODO"})})}function _S(t){const e=ca(),[n,i]=E.useState([]);E.useEffect(()=>{t.session||e("/login")},[t.session]);const r=E.useCallback(async()=>{const{data:s,error:o}=await t.supabase.from("file").select();if(o){console.error(o);return}i(s.map(a=>a))},[t.supabase]);return E.useEffect(()=>{r()},[]),P.jsx(P.Fragment,{children:P.jsxs("div",{className:"flex h-screen",children:[P.jsx(hm,{currentPage:"Home"}),P.jsx("main",{className:"overflow-y-auto flex flex-col flex-1 mx-5",children:P.jsxs("div",{className:"flex flex-col w-full gap-7 flex-grow",children:[P.jsx("div",{className:"flex flex-row gap-7 flex-grow",children:P.jsx("div",{className:"ml-auto",children:P.jsx(vS,{})})}),P.jsxs("div",{className:"flex flex-row gap-7 flex-grow",children:[P.jsxs("div",{className:"w-1/2 flex flex-col",children:[P.jsx("p",{className:"text-center",children:"Active hosts"}),P.jsx("div",{className:"flex-grow block bg-white-500 border border-gray-200 rounded-lg shadow",children:P.jsxs("ol",{children:[P.jsx("li",{children:"Host 1"}),P.jsx("li",{children:"Host 2"})]})})]}),P.jsx("div",{className:"w-1/2 ml-auto",children:P.jsx(Pf,{})})]}),P.jsxs("div",{className:"flex flex-row gap-7 mb-5 flex-grow",children:[P.jsx("div",{className:"w-1/2 mr-auto",children:P.jsx(Pf,{})}),P.jsxs("div",{className:"w-1/2 flex flex-col",children:[P.jsx("p",{className:"text-center",children:"Most edited files"}),P.jsx("div",{className:"flex-grow block bg-white-500 border border-gray-200 rounded-lg shadow",children:P.jsxs("ol",{children:[P.jsx("li",{children:"File 1"}),P.jsx("li",{children:"File 2"})]})})]})]})]})})]})})}function wS(t={}){const{nonce:e,onScriptLoadSuccess:n,onScriptLoadError:i}=t,[r,s]=E.useState(!1),o=E.useRef(n);o.current=n;const a=E.useRef(i);return a.current=i,E.useEffect(()=>{const l=document.createElement("script");return l.src="https://accounts.google.com/gsi/client",l.async=!0,l.defer=!0,l.nonce=e,l.onload=()=>{var u;s(!0),(u=o.current)===null||u===void 0||u.call(o)},l.onerror=()=>{var u;s(!1),(u=a.current)===null||u===void 0||u.call(a)},document.body.appendChild(l),()=>{document.body.removeChild(l)}},[e]),r}const qm=E.createContext(null);function xS({clientId:t,nonce:e,onScriptLoadSuccess:n,onScriptLoadError:i,children:r}){const s=wS({nonce:e,onScriptLoadSuccess:n,onScriptLoadError:i}),o=E.useMemo(()=>({clientId:t,scriptLoadedSuccessfully:s}),[t,s]);return Ni.createElement(qm.Provider,{value:o},r)}function kS(){const t=E.useContext(qm);if(!t)throw new Error("Google OAuth components must be used within GoogleOAuthProvider");return t}function bS(t){var e;return(e=t==null?void 0:t.clientId)!==null&&e!==void 0?e:t==null?void 0:t.client_id}const SS={large:40,medium:32,small:20};function CS({onSuccess:t,onError:e,useOneTap:n,promptMomentNotification:i,type:r="standard",theme:s="outline",size:o="large",text:a,shape:l,logo_alignment:u,width:c,locale:h,click_listener:d,containerProps:f,...m}){const y=E.useRef(null),{clientId:v,scriptLoadedSuccessfully:p}=kS(),g=E.useRef(t);g.current=t;const _=E.useRef(e);_.current=e;const w=E.useRef(i);return w.current=i,E.useEffect(()=>{var x,b,k,S,M,L,D,B,ce;if(p)return(k=(b=(x=window==null?void 0:window.google)===null||x===void 0?void 0:x.accounts)===null||b===void 0?void 0:b.id)===null||k===void 0||k.initialize({client_id:v,callback:oe=>{var $;if(!(oe!=null&&oe.credential))return($=_.current)===null||$===void 0?void 0:$.call(_);const{credential:K,select_by:ge}=oe;g.current({credential:K,clientId:bS(oe),select_by:ge})},...m}),(L=(M=(S=window==null?void 0:window.google)===null||S===void 0?void 0:S.accounts)===null||M===void 0?void 0:M.id)===null||L===void 0||L.renderButton(y.current,{type:r,theme:s,size:o,text:a,shape:l,logo_alignment:u,width:c,locale:h,click_listener:d}),n&&((ce=(B=(D=window==null?void 0:window.google)===null||D===void 0?void 0:D.accounts)===null||B===void 0?void 0:B.id)===null||ce===void 0||ce.prompt(w.current)),()=>{var oe,$,K;n&&((K=($=(oe=window==null?void 0:window.google)===null||oe===void 0?void 0:oe.accounts)===null||$===void 0?void 0:$.id)===null||K===void 0||K.cancel())}},[v,p,n,r,s,o,a,l,u,c,h]),Ni.createElement("div",{...f,ref:y,style:{height:SS[o],...f==null?void 0:f.style}})}function ES(t){const e=ca();return E.useEffect(()=>{t.supabase.auth.getSession().then(({data:{session:i}})=>{t.setSession(i),console.log("LOGIN SESSION",i)});const{data:{subscription:n}}=t.supabase.auth.onAuthStateChange((i,r)=>{t.setSession(r),console.log("SESSION CHANGE",r)});return()=>n.unsubscribe()},[t.supabase]),E.useEffect(()=>{t.session&&e("/")},[t.session]),P.jsx(P.Fragment,{children:P.jsx("div",{className:"flex flex-col items-center h-screen w-screen",children:P.jsxs("div",{className:"flex flex-row items-center gap-x-8 m-auto",children:[P.jsx("div",{children:P.jsx("h1",{className:"text-4xl text-bold font-sans antialiased text-blue-700 tracking-wide",children:"fs-tracer"})}),P.jsx("div",{className:"block max-w-sm p-6 bg-white border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700",children:P.jsxs("div",{className:"mx-7 my-5",children:[P.jsx("h5",{className:"mb-2 text-2xl font-bold font-sans antialiased text-gray-900",children:"Hello!"}),P.jsxs("div",{className:"flex flex-row items-center gap-2",children:[P.jsx("span",{className:"font-normal text-gray-700 dark:text-gray-400",children:"Continue with"}),P.jsx("span",{children:P.jsx(xS,{clientId:"952965459060-nrnrsdoq22mf646vfa72hk410pvdda5q.apps.googleusercontent.com",children:P.jsx(CS,{onSuccess:async n=>{await t.supabase.auth.signInWithIdToken({provider:"google",token:n.credential})},onError:()=>{console.log("Login Failed")},width:7777,size:"large",type:"icon"})})})]})]})})]})})})}function PS(t){const e=ca();return E.useEffect(()=>{(async()=>{await t.supabase.auth.signOut()})(),e("/login")},[t.session]),P.jsx(P.Fragment,{})}function TS(t){const e=ca(),[n,i]=E.useState([]);E.useEffect(()=>{t.session||e("/login")},[t.session]);const r=E.useCallback(async()=>{const{data:s,error:o}=await t.supabase.from("file").select();if(o){console.error(o);return}i(s.map(a=>a))},[t.supabase]);return E.useEffect(()=>{r()},[]),P.jsx(P.Fragment,{children:P.jsxs("div",{className:"flex h-screen",children:[P.jsx(hm,{currentPage:"Recent"}),P.jsx("main",{className:"flex-1 overflow-y-auto",children:P.jsx("div",{children:n.map(s=>P.jsx("div",{children:P.jsxs("p",{className:"underline",children:["file: ",s.absolute_path]})},s.id))})})]})})}function Qm(t,e){window.dispatchEvent(new StorageEvent("storage",{key:t,newValue:e}))}const Tf=(t,e)=>{const n=JSON.stringify(e);window.localStorage.setItem(t,n),Qm(t,n)},OS=t=>{window.localStorage.removeItem(t),Qm(t,null)},Of=t=>window.localStorage.getItem(t),LS=t=>(window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)),MS=()=>{throw Error("useLocalStorage is a client-only hook")};function RS(t,e){const n=()=>Of(t),i=E.useSyncExternalStore(LS,n,MS),r=E.useCallback(s=>{try{const o=typeof s=="function"?s(JSON.parse(i)):s;o==null?OS(t):Tf(t,o)}catch(o){console.warn(o)}},[t,i]);return E.useEffect(()=>{Of(t)===null&&typeof e<"u"&&Tf(t,e)},[t,e]),[i?JSON.parse(i):e,r]}const Ws=ox("https://slpoocycjgqsuoedhkbn.supabase.co","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNscG9vY3ljamdxc3VvZWRoa2JuIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTUyMDU0MjUsImV4cCI6MjAzMDc4MTQyNX0.xZYRTRN65rlms1Hb96IBAQvw3EGtMzUxlGPP5TVey34");function IS(){const[t,e]=RS("session",null);return P.jsx(P.Fragment,{children:P.jsx(__,{basename:"/fs-tracer-frontend",children:P.jsxs(m_,{children:[P.jsx(ii,{index:!0,element:P.jsx(_S,{supabase:Ws,session:t})}),P.jsx(ii,{path:"/recent",element:P.jsx(TS,{supabase:Ws,session:t})}),P.jsx(ii,{path:"/login",element:P.jsx(ES,{supabase:Ws,session:t,setSession:e})}),P.jsx(ii,{path:"/logout",element:P.jsx(PS,{supabase:Ws,session:t,setSession:e})}),P.jsx(ii,{path:"*",element:P.jsx("p",{children:"notfound"})})]})})})}sl.createRoot(document.getElementById("root")).render(P.jsx(Ni.StrictMode,{children:P.jsx(IS,{})}));export{e0 as g}; diff --git a/index.html b/index.html index a8614d0..be9aec2 100644 --- a/index.html +++ b/index.html @@ -32,8 +32,8 @@ href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" }(window.location)) - - + +
-- cgit 1.4.1