-
Notifications
You must be signed in to change notification settings - Fork 0
/
www.js
1 lines (1 loc) · 208 KB
/
www.js
1
var jr=Object.defineProperty,Br=Object.defineProperties;var Vr=Object.getOwnPropertyDescriptors;var Fs=Object.getOwnPropertySymbols;var Hr=Object.prototype.hasOwnProperty,Wr=Object.prototype.propertyIsEnumerable;var Di=(i,t,e)=>t in i?jr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,$=(i,t)=>{for(var e in t||(t={}))Hr.call(t,e)&&Di(i,e,t[e]);if(Fs)for(var e of Fs(t))Wr.call(t,e)&&Di(i,e,t[e]);return i},dt=(i,t)=>Br(i,Vr(t));var k=(i,t,e)=>(Di(i,typeof t!="symbol"?t+"":t,e),e);const Ti=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ei=Symbol(),zs=new Map;class Ns{constructor(t,e){if(this._$cssResult$=!0,e!==Ei)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let t=zs.get(this.cssText);return Ti&&t===void 0&&(zs.set(this.cssText,t=new CSSStyleSheet),t.replaceSync(this.cssText)),t}toString(){return this.cssText}}const Ur=i=>new Ns(typeof i=="string"?i:i+"",Ei),it=(i,...t)=>{const e=i.length===1?i[0]:t.reduce((s,n,o)=>s+(r=>{if(r._$cssResult$===!0)return r.cssText;if(typeof r=="number")return r;throw Error("use css function "+r+". Use unsafeCSS")})(n)+i[o+1],i[0]);return new Ns(e,Ei)},Yr=(i,t)=>{Ti?i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{const s=document.createElement("style"),n=window.litNonce;n!==void 0&&s.setAttribute("nonce",n),s.textContent=e.cssText,i.appendChild(s)})},js=Ti?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return Ur(e)})(i):i;var Ii;const Bs=window.reactiveElementPolyfillSupport,Li={toAttribute(i,t){switch(t){case Boolean:i=i?"":null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},Vs=(i,t)=>t!==i&&(t==t||i==i),Ri={attribute:!0,type:String,converter:Li,reflect:!1,hasChanged:Vs};class Nt extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var e;(e=this.l)!==null&&e!==void 0||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach((e,s)=>{const n=this._$Eh(s,e);n!==void 0&&(this._$Eu.set(n,s),t.push(n))}),t}static createProperty(t,e=Ri){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const s=typeof t=="symbol"?Symbol():"__"+t,n=this.getPropertyDescriptor(t,s,e);n!==void 0&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,s){return{get(){return this[e]},set(n){const o=this[t];this[e]=n,this.requestUpdate(t,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||Ri}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const e=this.properties,s=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of s)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const n of s)e.unshift(js(n))}else t!==void 0&&e.push(js(t));return e}static _$Eh(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}o(){var t;this._$Ev=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Ep(),this.requestUpdate(),(t=this.constructor.l)===null||t===void 0||t.forEach(e=>e(this))}addController(t){var e,s;((e=this._$Em)!==null&&e!==void 0?e:this._$Em=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((s=t.hostConnected)===null||s===void 0||s.call(t))}removeController(t){var e;(e=this._$Em)===null||e===void 0||e.splice(this._$Em.indexOf(t)>>>0,1)}_$Ep(){this.constructor.elementProperties.forEach((t,e)=>{this.hasOwnProperty(e)&&(this._$Et.set(e,this[e]),delete this[e])})}createRenderRoot(){var t;const e=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return Yr(e,this.constructor.elementStyles),e}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$Em)===null||t===void 0||t.forEach(e=>{var s;return(s=e.hostConnected)===null||s===void 0?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$Em)===null||t===void 0||t.forEach(e=>{var s;return(s=e.hostDisconnected)===null||s===void 0?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$Eg(t,e,s=Ri){var n,o;const r=this.constructor._$Eh(t,s);if(r!==void 0&&s.reflect===!0){const a=((o=(n=s.converter)===null||n===void 0?void 0:n.toAttribute)!==null&&o!==void 0?o:Li.toAttribute)(e,s.type);this._$Ei=t,a==null?this.removeAttribute(r):this.setAttribute(r,a),this._$Ei=null}}_$AK(t,e){var s,n,o;const r=this.constructor,a=r._$Eu.get(t);if(a!==void 0&&this._$Ei!==a){const c=r.getPropertyOptions(a),l=c.converter,h=(o=(n=(s=l)===null||s===void 0?void 0:s.fromAttribute)!==null&&n!==void 0?n:typeof l=="function"?l:null)!==null&&o!==void 0?o:Li.fromAttribute;this._$Ei=a,this[a]=h(e,c.type),this._$Ei=null}}requestUpdate(t,e,s){let n=!0;t!==void 0&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||Vs)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$Ei!==t&&(this._$ES===void 0&&(this._$ES=new Map),this._$ES.set(t,s))):n=!1),!this.isUpdatePending&&n&&(this._$Ev=this._$EC())}async _$EC(){this.isUpdatePending=!0;try{await this._$Ev}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach((n,o)=>this[o]=n),this._$Et=void 0);let e=!1;const s=this._$AL;try{e=this.shouldUpdate(s),e?(this.willUpdate(s),(t=this._$Em)===null||t===void 0||t.forEach(n=>{var o;return(o=n.hostUpdate)===null||o===void 0?void 0:o.call(n)}),this.update(s)):this._$EU()}catch(n){throw e=!1,this._$EU(),n}e&&this._$AE(s)}willUpdate(t){}_$AE(t){var e;(e=this._$Em)===null||e===void 0||e.forEach(s=>{var n;return(n=s.hostUpdated)===null||n===void 0?void 0:n.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ev}shouldUpdate(t){return!0}update(t){this._$ES!==void 0&&(this._$ES.forEach((e,s)=>this._$Eg(s,this[s],e)),this._$ES=void 0),this._$EU()}updated(t){}firstUpdated(t){}}Nt.finalized=!0,Nt.elementProperties=new Map,Nt.elementStyles=[],Nt.shadowRootOptions={mode:"open"},Bs==null||Bs({ReactiveElement:Nt}),((Ii=globalThis.reactiveElementVersions)!==null&&Ii!==void 0?Ii:globalThis.reactiveElementVersions=[]).push("1.0.1");var Fi;const je=globalThis.trustedTypes,Hs=je?je.createPolicy("lit-html",{createHTML:i=>i}):void 0,ut=`lit$${(Math.random()+"").slice(9)}$`,Ws="?"+ut,qr=`<${Ws}>`,jt=document,ie=(i="")=>jt.createComment(i),se=i=>i===null||typeof i!="object"&&typeof i!="function",Us=Array.isArray,Xr=i=>{var t;return Us(i)||typeof((t=i)===null||t===void 0?void 0:t[Symbol.iterator])=="function"},ne=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ys=/-->/g,qs=/>/g,vt=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,Xs=/'/g,Ks=/"/g,Gs=/^(?:script|style|textarea)$/i,Qs=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),C=Qs(1),Kr=Qs(2),Bt=Symbol.for("lit-noChange"),R=Symbol.for("lit-nothing"),Zs=new WeakMap,Gr=(i,t,e)=>{var s,n;const o=(s=e==null?void 0:e.renderBefore)!==null&&s!==void 0?s:t;let r=o._$litPart$;if(r===void 0){const a=(n=e==null?void 0:e.renderBefore)!==null&&n!==void 0?n:null;o._$litPart$=r=new re(t.insertBefore(ie(),a),a,void 0,e!=null?e:{})}return r._$AI(i),r},Vt=jt.createTreeWalker(jt,129,null,!1),Qr=(i,t)=>{const e=i.length-1,s=[];let n,o=t===2?"<svg>":"",r=ne;for(let c=0;c<e;c++){const l=i[c];let h,d,u=-1,f=0;for(;f<l.length&&(r.lastIndex=f,d=r.exec(l),d!==null);)f=r.lastIndex,r===ne?d[1]==="!--"?r=Ys:d[1]!==void 0?r=qs:d[2]!==void 0?(Gs.test(d[2])&&(n=RegExp("</"+d[2],"g")),r=vt):d[3]!==void 0&&(r=vt):r===vt?d[0]===">"?(r=n!=null?n:ne,u=-1):d[1]===void 0?u=-2:(u=r.lastIndex-d[2].length,h=d[1],r=d[3]===void 0?vt:d[3]==='"'?Ks:Xs):r===Ks||r===Xs?r=vt:r===Ys||r===qs?r=ne:(r=vt,n=void 0);const p=r===vt&&i[c+1].startsWith("/>")?" ":"";o+=r===ne?l+qr:u>=0?(s.push(h),l.slice(0,u)+"$lit$"+l.slice(u)+ut+p):l+ut+(u===-2?(s.push(void 0),c):p)}const a=o+(i[e]||"<?>")+(t===2?"</svg>":"");return[Hs!==void 0?Hs.createHTML(a):a,s]};class oe{constructor({strings:t,_$litType$:e},s){let n;this.parts=[];let o=0,r=0;const a=t.length-1,c=this.parts,[l,h]=Qr(t,e);if(this.el=oe.createElement(l,s),Vt.currentNode=this.el.content,e===2){const d=this.el.content,u=d.firstChild;u.remove(),d.append(...u.childNodes)}for(;(n=Vt.nextNode())!==null&&c.length<a;){if(n.nodeType===1){if(n.hasAttributes()){const d=[];for(const u of n.getAttributeNames())if(u.endsWith("$lit$")||u.startsWith(ut)){const f=h[r++];if(d.push(u),f!==void 0){const p=n.getAttribute(f.toLowerCase()+"$lit$").split(ut),g=/([.?@])?(.*)/.exec(f);c.push({type:1,index:o,name:g[2],strings:p,ctor:g[1]==="."?Jr:g[1]==="?"?ta:g[1]==="@"?ea:Be})}else c.push({type:6,index:o})}for(const u of d)n.removeAttribute(u)}if(Gs.test(n.tagName)){const d=n.textContent.split(ut),u=d.length-1;if(u>0){n.textContent=je?je.emptyScript:"";for(let f=0;f<u;f++)n.append(d[f],ie()),Vt.nextNode(),c.push({type:2,index:++o});n.append(d[u],ie())}}}else if(n.nodeType===8)if(n.data===Ws)c.push({type:2,index:o});else{let d=-1;for(;(d=n.data.indexOf(ut,d+1))!==-1;)c.push({type:7,index:o}),d+=ut.length-1}o++}}static createElement(t,e){const s=jt.createElement("template");return s.innerHTML=t,s}}function Ht(i,t,e=i,s){var n,o,r,a;if(t===Bt)return t;let c=s!==void 0?(n=e._$Cl)===null||n===void 0?void 0:n[s]:e._$Cu;const l=se(t)?void 0:t._$litDirective$;return(c==null?void 0:c.constructor)!==l&&((o=c==null?void 0:c._$AO)===null||o===void 0||o.call(c,!1),l===void 0?c=void 0:(c=new l(i),c._$AT(i,e,s)),s!==void 0?((r=(a=e)._$Cl)!==null&&r!==void 0?r:a._$Cl=[])[s]=c:e._$Cu=c),c!==void 0&&(t=Ht(i,c._$AS(i,t.values),c,s)),t}class Zr{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:s},parts:n}=this._$AD,o=((e=t==null?void 0:t.creationScope)!==null&&e!==void 0?e:jt).importNode(s,!0);Vt.currentNode=o;let r=Vt.nextNode(),a=0,c=0,l=n[0];for(;l!==void 0;){if(a===l.index){let h;l.type===2?h=new re(r,r.nextSibling,this,t):l.type===1?h=new l.ctor(r,l.name,l.strings,this,t):l.type===6&&(h=new ia(r,this,t)),this.v.push(h),l=n[++c]}a!==(l==null?void 0:l.index)&&(r=Vt.nextNode(),a++)}return o}m(t){let e=0;for(const s of this.v)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class re{constructor(t,e,s,n){var o;this.type=2,this._$AH=R,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cg=(o=n==null?void 0:n.isConnected)===null||o===void 0||o}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&t.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Ht(this,t,e),se(t)?t===R||t==null||t===""?(this._$AH!==R&&this._$AR(),this._$AH=R):t!==this._$AH&&t!==Bt&&this.$(t):t._$litType$!==void 0?this.T(t):t.nodeType!==void 0?this.S(t):Xr(t)?this.M(t):this.$(t)}A(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==R&&se(this._$AH)?this._$AA.nextSibling.data=t:this.S(jt.createTextNode(t)),this._$AH=t}T(t){var e;const{values:s,_$litType$:n}=t,o=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=oe.createElement(n.h,this.options)),n);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===o)this._$AH.m(s);else{const r=new Zr(o,this),a=r.p(this.options);r.m(s),this.S(a),this._$AH=r}}_$AC(t){let e=Zs.get(t.strings);return e===void 0&&Zs.set(t.strings,e=new oe(t)),e}M(t){Us(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,n=0;for(const o of t)n===e.length?e.push(s=new re(this.A(ie()),this.A(ie()),this,this.options)):s=e[n],s._$AI(o),n++;n<e.length&&(this._$AR(s&&s._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var s;for((s=this._$AP)===null||s===void 0||s.call(this,!1,!0,e);t&&t!==this._$AB;){const n=t.nextSibling;t.remove(),t=n}}setConnected(t){var e;this._$AM===void 0&&(this._$Cg=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}}class Be{constructor(t,e,s,n,o){this.type=1,this._$AH=R,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=R}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,s,n){const o=this.strings;let r=!1;if(o===void 0)t=Ht(this,t,e,0),r=!se(t)||t!==this._$AH&&t!==Bt,r&&(this._$AH=t);else{const a=t;let c,l;for(t=o[0],c=0;c<o.length-1;c++)l=Ht(this,a[s+c],e,c),l===Bt&&(l=this._$AH[c]),r||(r=!se(l)||l!==this._$AH[c]),l===R?t=R:t!==R&&(t+=(l!=null?l:"")+o[c+1]),this._$AH[c]=l}r&&!n&&this.k(t)}k(t){t===R?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}}class Jr extends Be{constructor(){super(...arguments),this.type=3}k(t){this.element[this.name]=t===R?void 0:t}}class ta extends Be{constructor(){super(...arguments),this.type=4}k(t){t&&t!==R?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name)}}class ea extends Be{constructor(t,e,s,n,o){super(t,e,s,n,o),this.type=5}_$AI(t,e=this){var s;if((t=(s=Ht(this,t,e,0))!==null&&s!==void 0?s:R)===Bt)return;const n=this._$AH,o=t===R&&n!==R||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,r=t!==R&&(n===R||o);o&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,s;typeof this._$AH=="function"?this._$AH.call((s=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&s!==void 0?s:this.element,t):this._$AH.handleEvent(t)}}class ia{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Ht(this,t)}}const Js=window.litHtmlPolyfillSupport;Js==null||Js(oe,re),((Fi=globalThis.litHtmlVersions)!==null&&Fi!==void 0?Fi:globalThis.litHtmlVersions=[]).push("2.0.1");var zi,Ni;class J extends Nt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const s=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=s.firstChild),s}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=Gr(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Dt)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Dt)===null||t===void 0||t.setConnected(!1)}render(){return Bt}}J.finalized=!0,J._$litElement$=!0,(zi=globalThis.litElementHydrateSupport)===null||zi===void 0||zi.call(globalThis,{LitElement:J});const tn=globalThis.litElementPolyfillSupport;tn==null||tn({LitElement:J});((Ni=globalThis.litElementVersions)!==null&&Ni!==void 0?Ni:globalThis.litElementVersions=[]).push("3.0.1");const Wt=i=>t=>typeof t=="function"?((e,s)=>(window.customElements.define(e,s),s))(i,t):((e,s)=>{const{kind:n,elements:o}=s;return{kind:n,elements:o,finisher(r){window.customElements.define(e,r)}}})(i,t),sa=(i,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?dt($({},t),{finisher(e){e.createProperty(t.key,i)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){typeof t.initializer=="function"&&(this[t.key]=t.initializer.call(this))},finisher(e){e.createProperty(t.key,i)}};function st(i){return(t,e)=>e!==void 0?((s,n,o)=>{n.constructor.createProperty(o,s)})(i,t,e):sa(i,t)}function ft(i){return st(dt($({},i),{state:!0}))}const na=({finisher:i,descriptor:t})=>(e,s)=>{var n;if(s===void 0){const o=(n=e.originalKey)!==null&&n!==void 0?n:e.key,r=t!=null?{kind:"method",placement:"prototype",key:o,descriptor:t(e.key)}:dt($({},e),{key:o});return i!=null&&(r.finisher=function(a){i(a,o)}),r}{const o=e.constructor;t!==void 0&&Object.defineProperty(e,s,t(s)),i==null||i(o,s)}};function oa(i,t){return na({descriptor:e=>{const s={get(){var n,o;return(o=(n=this.renderRoot)===null||n===void 0?void 0:n.querySelector(i))!==null&&o!==void 0?o:null},enumerable:!0,configurable:!0};if(t){const n=typeof e=="symbol"?Symbol():"__"+e;s.get=function(){var o,r;return this[n]===void 0&&(this[n]=(r=(o=this.renderRoot)===null||o===void 0?void 0:o.querySelector(i))!==null&&r!==void 0?r:null),this[n]}}return s}})}var ji=it`:host,button,input,select{font-family:ui-monospace,system-ui,Helvetica,Roboto,Oxygen,Ubuntu,sans-serif;--primary-color:#03a9f4;transition:all 350ms!important}`,en=it`.btn,button{cursor:pointer;border-radius:4px;color:#03a9f4;border:none;background-color:unset;padding:8px;font-weight:500;font-size:12.25px;letter-spacing:1.09375px;text-transform:uppercase;margin-right:-8px}.btn:active,button:active{background-image:rgba(127,127,127,.2);transition-duration:1s}.btn:hover,button:hover{background-color:rgba(127,127,127,.2);transition-duration:1s}`,ra=it`input[type=text]{width:100%!important;height:1rem!important}`,aa=it`:host{position:relative}select{background-color:inherit;color:inherit;width:100%;border-radius:4px}option{color:currentColor;background-color:var(--primary-color,currentColor)}input[type=range],input[type=text]{width:calc(100% - 3rem);height:.75rem}.range{text-align:center}.entity-row{display:flex;align-items:center;flex-direction:row;transition:all .3s ease-out 0s;min-height:40px;position:relative}.entity-row.expanded{min-height:240px}.entity-row:nth-child(2n){background-color:rgba(90,90,90,.1)}.entity-row iconify-icon{vertical-align:middle}.entity-row>:nth-child(1){flex:0 0 40px;color:#44739e;line-height:40px;text-align:center}.entity-row>:nth-child(2){flex:1 1 50%;margin-left:16px;margin-right:8px;text-wrap:nowrap}.entity-row>:nth-child(3){flex:1 1 50%;margin-right:8px;text-align:right;display:flex;justify-content:space-between}.entity-row>:nth-child(3)>:only-child{margin-left:auto}.binary_sensor_off{color:rgba(127,127,127,.7)}.singlebutton-row button{margin:auto;display:flex}input[type=color]::-webkit-color-swatch-wrapper{padding:0!important}`,Bi=it`.tab-header{display:inline-flex;min-height:40px;font-weight:400;padding-inline:1.5em;align-items:center;border-radius:12px 12px 0 0;background-color:rgba(127,127,127,.3);margin-top:1em;user-select:none}.tab-container{border:2px solid rgba(127,127,127,.3);border-radius:0 12px 12px 12px}`;function ae(i){return i+.5|0}const pt=(i,t,e)=>Math.max(Math.min(i,e),t);function ce(i){return pt(ae(i*2.55),0,255)}function gt(i){return pt(ae(i*255),0,255)}function nt(i){return pt(ae(i/2.55)/100,0,1)}function sn(i){return pt(ae(i*100),0,100)}const K={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},Vi=[..."0123456789ABCDEF"],ca=i=>Vi[i&15],la=i=>Vi[(i&240)>>4]+Vi[i&15],Ve=i=>(i&240)>>4==(i&15),ha=i=>Ve(i.r)&&Ve(i.g)&&Ve(i.b)&&Ve(i.a);function da(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&K[i[1]]*17,g:255&K[i[2]]*17,b:255&K[i[3]]*17,a:t===5?K[i[4]]*17:255}:(t===7||t===9)&&(e={r:K[i[1]]<<4|K[i[2]],g:K[i[3]]<<4|K[i[4]],b:K[i[5]]<<4|K[i[6]],a:t===9?K[i[7]]<<4|K[i[8]]:255})),e}const ua=(i,t)=>i<255?t(i):"";function fa(i){var t=ha(i)?ca:la;return i?"#"+t(i.r)+t(i.g)+t(i.b)+ua(i.a,t):void 0}const pa=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function nn(i,t,e){const s=t*Math.min(e,1-e),n=(o,r=(o+i/30)%12)=>e-s*Math.max(Math.min(r-3,9-r,1),-1);return[n(0),n(8),n(4)]}function ga(i,t,e){const s=(n,o=(n+i/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[s(5),s(3),s(1)]}function ma(i,t,e){const s=nn(i,1,.5);let n;for(t+e>1&&(n=1/(t+e),t*=n,e*=n),n=0;n<3;n++)s[n]*=1-t-e,s[n]+=t;return s}function ba(i,t,e,s,n){return i===n?(t-e)/s+(t<e?6:0):t===n?(e-i)/s+2:(i-t)/s+4}function Hi(i){const t=255,e=i.r/t,s=i.g/t,n=i.b/t,o=Math.max(e,s,n),r=Math.min(e,s,n),a=(o+r)/2;let c,l,h;return o!==r&&(h=o-r,l=a>.5?h/(2-o-r):h/(o+r),c=ba(e,s,n,h,o),c=c*60+.5),[c|0,l||0,a]}function Wi(i,t,e,s){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,s)).map(gt)}function Ui(i,t,e){return Wi(nn,i,t,e)}function _a(i,t,e){return Wi(ma,i,t,e)}function ya(i,t,e){return Wi(ga,i,t,e)}function on(i){return(i%360+360)%360}function xa(i){const t=pa.exec(i);let e=255,s;if(!t)return;t[5]!==s&&(e=t[6]?ce(+t[5]):gt(+t[5]));const n=on(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?s=_a(n,o,r):t[1]==="hsv"?s=ya(n,o,r):s=Ui(n,o,r),{r:s[0],g:s[1],b:s[2],a:e}}function va(i,t){var e=Hi(i);e[0]=on(e[0]+t),e=Ui(e),i.r=e[0],i.g=e[1],i.b=e[2]}function wa(i){if(!i)return;const t=Hi(i),e=t[0],s=sn(t[1]),n=sn(t[2]);return i.a<255?`hsla(${e}, ${s}%, ${n}%, ${nt(i.a)})`:`hsl(${e}, ${s}%, ${n}%)`}const rn={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"},an={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 ka(){const i={},t=Object.keys(an),e=Object.keys(rn);let s,n,o,r,a;for(s=0;s<t.length;s++){for(r=a=t[s],n=0;n<e.length;n++)o=e[n],a=a.replace(o,rn[o]);o=parseInt(an[r],16),i[a]=[o>>16&255,o>>8&255,o&255]}return i}let He;function Sa(i){He||(He=ka(),He.transparent=[0,0,0,0]);const t=He[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const Ma=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Oa(i){const t=Ma.exec(i);let e=255,s,n,o;if(!!t){if(t[7]!==s){const r=+t[7];e=t[8]?ce(r):pt(r*255,0,255)}return s=+t[1],n=+t[3],o=+t[5],s=255&(t[2]?ce(s):pt(s,0,255)),n=255&(t[4]?ce(n):pt(n,0,255)),o=255&(t[6]?ce(o):pt(o,0,255)),{r:s,g:n,b:o,a:e}}}function Ca(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${nt(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const Yi=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,Ut=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function Aa(i,t,e){const s=Ut(nt(i.r)),n=Ut(nt(i.g)),o=Ut(nt(i.b));return{r:gt(Yi(s+e*(Ut(nt(t.r))-s))),g:gt(Yi(n+e*(Ut(nt(t.g))-n))),b:gt(Yi(o+e*(Ut(nt(t.b))-o))),a:i.a+e*(t.a-i.a)}}function We(i,t,e){if(i){let s=Hi(i);s[t]=Math.max(0,Math.min(s[t]+s[t]*e,t===0?360:1)),s=Ui(s),i.r=s[0],i.g=s[1],i.b=s[2]}}function cn(i,t){return i&&Object.assign(t||{},i)}function ln(i){var t={r:0,g:0,b:0,a:255};return Array.isArray(i)?i.length>=3&&(t={r:i[0],g:i[1],b:i[2],a:255},i.length>3&&(t.a=gt(i[3]))):(t=cn(i,{r:0,g:0,b:0,a:1}),t.a=gt(t.a)),t}function Pa(i){return i.charAt(0)==="r"?Oa(i):xa(i)}class le{constructor(t){if(t instanceof le)return t;const e=typeof t;let s;e==="object"?s=ln(t):e==="string"&&(s=da(t)||Sa(t)||Pa(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=cn(this._rgb);return t&&(t.a=nt(t.a)),t}set rgb(t){this._rgb=ln(t)}rgbString(){return this._valid?Ca(this._rgb):void 0}hexString(){return this._valid?fa(this._rgb):void 0}hslString(){return this._valid?wa(this._rgb):void 0}mix(t,e){if(t){const s=this.rgb,n=t.rgb;let o;const r=e===o?.5:e,a=2*r-1,c=s.a-n.a,l=((a*c==-1?a:(a+c)/(1+a*c))+1)/2;o=1-l,s.r=255&l*s.r+o*n.r+.5,s.g=255&l*s.g+o*n.g+.5,s.b=255&l*s.b+o*n.b+.5,s.a=r*s.a+(1-r)*n.a,this.rgb=s}return this}interpolate(t,e){return t&&(this._rgb=Aa(this._rgb,t._rgb,e)),this}clone(){return new le(this.rgb)}alpha(t){return this._rgb.a=gt(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=ae(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return We(this._rgb,2,t),this}darken(t){return We(this._rgb,2,-t),this}saturate(t){return We(this._rgb,1,t),this}desaturate(t){return We(this._rgb,1,-t),this}rotate(t){return va(this._rgb,t),this}}const $a=(()=>{let i=0;return()=>i++})();function T(i){return i===null||typeof i=="undefined"}function F(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function A(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function B(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function q(i,t){return B(i)?i:t}function D(i,t){return typeof i=="undefined"?t:i}const Da=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100:+i/t,hn=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function E(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function W(i,t,e,s){let n,o,r;if(F(i))if(o=i.length,s)for(n=o-1;n>=0;n--)t.call(e,i[n],n);else for(n=0;n<o;n++)t.call(e,i[n],n);else if(A(i))for(r=Object.keys(i),o=r.length,n=0;n<o;n++)t.call(e,i[r[n]],r[n])}function dn(i,t){let e,s,n,o;if(!i||!t||i.length!==t.length)return!1;for(e=0,s=i.length;e<s;++e)if(n=i[e],o=t[e],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function Ue(i){if(F(i))return i.map(Ue);if(A(i)){const t=Object.create(null),e=Object.keys(i),s=e.length;let n=0;for(;n<s;++n)t[e[n]]=Ue(i[e[n]]);return t}return i}function un(i){return["__proto__","prototype","constructor"].indexOf(i)===-1}function Ta(i,t,e,s){if(!un(i))return;const n=t[i],o=e[i];A(n)&&A(o)?he(n,o,s):t[i]=Ue(o)}function he(i,t,e){const s=F(t)?t:[t],n=s.length;if(!A(i))return i;e=e||{};const o=e.merger||Ta;let r;for(let a=0;a<n;++a){if(r=s[a],!A(r))continue;const c=Object.keys(r);for(let l=0,h=c.length;l<h;++l)o(c[l],i,r,e)}return i}function de(i,t){return he(i,t,{merger:Ea})}function Ea(i,t,e){if(!un(i))return;const s=t[i],n=e[i];A(s)&&A(n)?de(s,n):Object.prototype.hasOwnProperty.call(t,i)||(t[i]=Ue(n))}const fn={"":i=>i,x:i=>i.x,y:i=>i.y};function Ia(i){const t=i.split("."),e=[];let s="";for(const n of t)s+=n,s.endsWith("\\")?s=s.slice(0,-1)+".":(e.push(s),s="");return e}function La(i){const t=Ia(i);return e=>{for(const s of t){if(s==="")break;e=e&&e[s]}return e}}function Yt(i,t){return(fn[t]||(fn[t]=La(t)))(i)}function qi(i){return i.charAt(0).toUpperCase()+i.slice(1)}const Ye=i=>typeof i!="undefined",mt=i=>typeof i=="function",pn=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function Ra(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const z=Math.PI,H=2*z,Fa=H+z,qe=Number.POSITIVE_INFINITY,za=z/180,U=z/2,wt=z/4,gn=z*2/3,bt=Math.log10,qt=Math.sign;function ue(i,t,e){return Math.abs(i-t)<e}function mn(i){const t=Math.round(i);i=ue(i,t,i/1e3)?t:i;const e=Math.pow(10,Math.floor(bt(i))),s=i/e;return(s<=1?1:s<=2?2:s<=5?5:10)*e}function Na(i){const t=[],e=Math.sqrt(i);let s;for(s=1;s<e;s++)i%s==0&&(t.push(s),t.push(i/s));return e===(e|0)&&t.push(e),t.sort((n,o)=>n-o).pop(),t}function fe(i){return!isNaN(parseFloat(i))&&isFinite(i)}function ja(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function bn(i,t,e){let s,n,o;for(s=0,n=i.length;s<n;s++)o=i[s][e],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function G(i){return i*(z/180)}function Xi(i){return i*(180/z)}function _n(i){if(!B(i))return;let t=1,e=0;for(;Math.round(i*t)/t!==i;)t*=10,e++;return e}function Ba(i,t){const e=t.x-i.x,s=t.y-i.y,n=Math.sqrt(e*e+s*s);let o=Math.atan2(s,e);return o<-.5*z&&(o+=H),{angle:o,distance:n}}function yn(i,t){return Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2))}function Va(i,t){return(i-t+Fa)%H-z}function Q(i){return(i%H+H)%H}function Xe(i,t,e,s){const n=Q(i),o=Q(t),r=Q(e),a=Q(o-n),c=Q(r-n),l=Q(n-o),h=Q(n-r);return n===o||n===r||s&&o===r||a>c&&l<h}function tt(i,t,e){return Math.max(t,Math.min(e,i))}function Ha(i){return tt(i,-32768,32767)}function Wa(i,t,e,s=1e-6){return i>=Math.min(t,e)-s&&i<=Math.max(t,e)+s}function Ki(i,t,e){e=e||(r=>i[r]<t);let s=i.length-1,n=0,o;for(;s-n>1;)o=n+s>>1,e(o)?n=o:s=o;return{lo:n,hi:s}}const kt=(i,t,e,s)=>Ki(i,e,s?n=>{const o=i[n][t];return o<e||o===e&&i[n+1][t]===e}:n=>i[n][t]<e),Ua=(i,t,e)=>Ki(i,e,s=>i[s][t]>=e);function Ya(i,t,e){let s=0,n=i.length;for(;s<n&&i[s]<t;)s++;for(;n>s&&i[n-1]>e;)n--;return s>0||n<i.length?i.slice(s,n):i}const xn=["push","pop","shift","splice","unshift"];function qa(i,t){if(i._chartjs){i._chartjs.listeners.push(t);return}Object.defineProperty(i,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),xn.forEach(e=>{const s="_onData"+qi(e),n=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){const r=n.apply(this,o);return i._chartjs.listeners.forEach(a=>{typeof a[s]=="function"&&a[s](...o)}),r}})})}function vn(i,t){const e=i._chartjs;if(!e)return;const s=e.listeners,n=s.indexOf(t);n!==-1&&s.splice(n,1),!(s.length>0)&&(xn.forEach(o=>{delete i[o]}),delete i._chartjs)}function Xa(i){const t=new Set(i);return t.size===i.length?i:Array.from(t)}const wn=function(){return typeof window=="undefined"?function(i){return i()}:window.requestAnimationFrame}();function kn(i,t){let e=[],s=!1;return function(...n){e=n,s||(s=!0,wn.call(window,()=>{s=!1,i.apply(t,e)}))}}function Ka(i,t){let e;return function(...s){return t?(clearTimeout(e),e=setTimeout(i,t,s)):i.apply(this,s),t}}const Ga=i=>i==="start"?"left":i==="end"?"right":"center",Sn=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2;function Qa(i,t,e){const s=t.length;let n=0,o=s;if(i._sorted){const{iScale:r,_parsed:a}=i,c=r.axis,{min:l,max:h,minDefined:d,maxDefined:u}=r.getUserBounds();d&&(n=tt(Math.min(kt(a,c,l).lo,e?s:kt(t,c,r.getPixelForValue(l)).lo),0,s-1)),u?o=tt(Math.max(kt(a,r.axis,h,!0).hi+1,e?0:kt(t,c,r.getPixelForValue(h),!0).hi+1),n,s)-n:o=s-n}return{start:n,count:o}}function Za(i){const{xScale:t,yScale:e,_scaleRanges:s}=i,n={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!s)return i._scaleRanges=n,!0;const o=s.xmin!==t.min||s.xmax!==t.max||s.ymin!==e.min||s.ymax!==e.max;return Object.assign(s,n),o}const Ke=i=>i===0||i===1,Mn=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*H/e)),On=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*H/e)+1,pe={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>-i*(i-2),easeInOutQuad:i=>(i/=.5)<1?.5*i*i:-.5*(--i*(i-2)-1),easeInCubic:i=>i*i*i,easeOutCubic:i=>(i-=1)*i*i+1,easeInOutCubic:i=>(i/=.5)<1?.5*i*i*i:.5*((i-=2)*i*i+2),easeInQuart:i=>i*i*i*i,easeOutQuart:i=>-((i-=1)*i*i*i-1),easeInOutQuart:i=>(i/=.5)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2),easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>(i-=1)*i*i*i*i+1,easeInOutQuint:i=>(i/=.5)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2),easeInSine:i=>-Math.cos(i*U)+1,easeOutSine:i=>Math.sin(i*U),easeInOutSine:i=>-.5*(Math.cos(z*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>Ke(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>Ke(i)?i:Mn(i,.075,.3),easeOutElastic:i=>Ke(i)?i:On(i,.075,.3),easeInOutElastic(i){const t=.1125,e=.45;return Ke(i)?i:i<.5?.5*Mn(i*2,t,e):.5+.5*On(i*2-1,t,e)},easeInBack(i){const t=1.70158;return i*i*((t+1)*i-t)},easeOutBack(i){const t=1.70158;return(i-=1)*i*((t+1)*i+t)+1},easeInOutBack(i){let t=1.70158;return(i/=.5)<1?.5*(i*i*(((t*=1.525)+1)*i-t)):.5*((i-=2)*i*(((t*=1.525)+1)*i+t)+2)},easeInBounce:i=>1-pe.easeOutBounce(1-i),easeOutBounce(i){const t=7.5625,e=2.75;return i<1/e?t*i*i:i<2/e?t*(i-=1.5/e)*i+.75:i<2.5/e?t*(i-=2.25/e)*i+.9375:t*(i-=2.625/e)*i+.984375},easeInOutBounce:i=>i<.5?pe.easeInBounce(i*2)*.5:pe.easeOutBounce(i*2-1)*.5+.5};function Gi(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Cn(i){return Gi(i)?i:new le(i)}function Qi(i){return Gi(i)?i:new le(i).saturate(.5).darken(.1).hexString()}const Ja=["x","y","borderWidth","radius","tension"],tc=["color","borderColor","backgroundColor"];function ec(i){i.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),i.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),i.set("animations",{colors:{type:"color",properties:tc},numbers:{type:"number",properties:Ja}}),i.describe("animations",{_fallback:"animation"}),i.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function ic(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const An=new Map;function sc(i,t){t=t||{};const e=i+JSON.stringify(t);let s=An.get(e);return s||(s=new Intl.NumberFormat(i,t),An.set(e,s)),s}function ge(i,t,e){return sc(t,e).format(i)}const Pn={values(i){return F(i)?i:""+i},numeric(i,t,e){if(i===0)return"0";const s=this.chart.options.locale;let n,o=i;if(e.length>1){const l=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(l<1e-4||l>1e15)&&(n="scientific"),o=nc(i,e)}const r=bt(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),c={notation:n,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(c,this.options.ticks.format),ge(i,s,c)},logarithmic(i,t,e){if(i===0)return"0";const s=e[t].significand||i/Math.pow(10,Math.floor(bt(i)));return[1,2,3,5,10,15].includes(s)||t>.8*e.length?Pn.numeric.call(this,i,t,e):""}};function nc(i,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&i!==Math.floor(i)&&(e=i-Math.floor(i)),e}var Ge={formatters:Pn};function oc(i){i.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.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:Ge.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),i.route("scale.ticks","color","","color"),i.route("scale.grid","color","","borderColor"),i.route("scale.border","color","","borderColor"),i.route("scale.title","color","","color"),i.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),i.describe("scales",{_fallback:"scale"}),i.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const St=Object.create(null),Zi=Object.create(null);function me(i,t){if(!t)return i;const e=t.split(".");for(let s=0,n=e.length;s<n;++s){const o=e[s];i=i[o]||(i[o]=Object.create(null))}return i}function Ji(i,t,e){return typeof t=="string"?he(me(i,t),e):he(me(i,""),t)}class rc{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=s=>s.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(s,n)=>Qi(n.backgroundColor),this.hoverBorderColor=(s,n)=>Qi(n.borderColor),this.hoverColor=(s,n)=>Qi(n.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return Ji(this,t,e)}get(t){return me(this,t)}describe(t,e){return Ji(Zi,t,e)}override(t,e){return Ji(St,t,e)}route(t,e,s,n){const o=me(this,t),r=me(this,s),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const c=this[a],l=r[n];return A(c)?Object.assign({},l,c):D(c,l)},set(c){this[a]=c}}})}apply(t){t.forEach(e=>e(this))}}var N=new rc({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[ec,ic,oc]);function ac(i){return!i||T(i.size)||T(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function Qe(i,t,e,s,n){let o=t[n];return o||(o=t[n]=i.measureText(n).width,e.push(n)),o>s&&(s=o),s}function cc(i,t,e,s){s=s||{};let n=s.data=s.data||{},o=s.garbageCollect=s.garbageCollect||[];s.font!==t&&(n=s.data={},o=s.garbageCollect=[],s.font=t),i.save(),i.font=t;let r=0;const a=e.length;let c,l,h,d,u;for(c=0;c<a;c++)if(d=e[c],d!=null&&!F(d))r=Qe(i,n,o,r,d);else if(F(d))for(l=0,h=d.length;l<h;l++)u=d[l],u!=null&&!F(u)&&(r=Qe(i,n,o,r,u));i.restore();const f=o.length/2;if(f>e.length){for(c=0;c<f;c++)delete n[o[c]];o.splice(0,f)}return r}function Mt(i,t,e){const s=i.currentDevicePixelRatio,n=e!==0?Math.max(e/2,.5):0;return Math.round((t-n)*s)/s+n}function $n(i,t){t=t||i.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,i.width,i.height),t.restore()}function lc(i,t,e,s){hc(i,t,e,s,null)}function hc(i,t,e,s,n){let o,r,a,c,l,h,d,u;const f=t.pointStyle,p=t.rotation,g=t.radius;let m=(p||0)*za;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){i.save(),i.translate(e,s),i.rotate(m),i.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),i.restore();return}if(!(isNaN(g)||g<=0)){switch(i.beginPath(),f){default:n?i.ellipse(e,s,n/2,g,0,0,H):i.arc(e,s,g,0,H),i.closePath();break;case"triangle":h=n?n/2:g,i.moveTo(e+Math.sin(m)*h,s-Math.cos(m)*g),m+=gn,i.lineTo(e+Math.sin(m)*h,s-Math.cos(m)*g),m+=gn,i.lineTo(e+Math.sin(m)*h,s-Math.cos(m)*g),i.closePath();break;case"rectRounded":l=g*.516,c=g-l,r=Math.cos(m+wt)*c,d=Math.cos(m+wt)*(n?n/2-l:c),a=Math.sin(m+wt)*c,u=Math.sin(m+wt)*(n?n/2-l:c),i.arc(e-d,s-a,l,m-z,m-U),i.arc(e+u,s-r,l,m-U,m),i.arc(e+d,s+a,l,m,m+U),i.arc(e-u,s+r,l,m+U,m+z),i.closePath();break;case"rect":if(!p){c=Math.SQRT1_2*g,h=n?n/2:c,i.rect(e-h,s-c,2*h,2*c);break}m+=wt;case"rectRot":d=Math.cos(m)*(n?n/2:g),r=Math.cos(m)*g,a=Math.sin(m)*g,u=Math.sin(m)*(n?n/2:g),i.moveTo(e-d,s-a),i.lineTo(e+u,s-r),i.lineTo(e+d,s+a),i.lineTo(e-u,s+r),i.closePath();break;case"crossRot":m+=wt;case"cross":d=Math.cos(m)*(n?n/2:g),r=Math.cos(m)*g,a=Math.sin(m)*g,u=Math.sin(m)*(n?n/2:g),i.moveTo(e-d,s-a),i.lineTo(e+d,s+a),i.moveTo(e+u,s-r),i.lineTo(e-u,s+r);break;case"star":d=Math.cos(m)*(n?n/2:g),r=Math.cos(m)*g,a=Math.sin(m)*g,u=Math.sin(m)*(n?n/2:g),i.moveTo(e-d,s-a),i.lineTo(e+d,s+a),i.moveTo(e+u,s-r),i.lineTo(e-u,s+r),m+=wt,d=Math.cos(m)*(n?n/2:g),r=Math.cos(m)*g,a=Math.sin(m)*g,u=Math.sin(m)*(n?n/2:g),i.moveTo(e-d,s-a),i.lineTo(e+d,s+a),i.moveTo(e+u,s-r),i.lineTo(e-u,s+r);break;case"line":r=n?n/2:Math.cos(m)*g,a=Math.sin(m)*g,i.moveTo(e-r,s-a),i.lineTo(e+r,s+a);break;case"dash":i.moveTo(e,s),i.lineTo(e+Math.cos(m)*(n?n/2:g),s+Math.sin(m)*g);break;case!1:i.closePath();break}i.fill(),t.borderWidth>0&&i.stroke()}}function ot(i,t,e){return e=e||.5,!t||i&&i.x>t.left-e&&i.x<t.right+e&&i.y>t.top-e&&i.y<t.bottom+e}function Dn(i,t){i.save(),i.beginPath(),i.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),i.clip()}function Tn(i){i.restore()}function dc(i,t,e,s,n){if(!t)return i.lineTo(e.x,e.y);if(n==="middle"){const o=(t.x+e.x)/2;i.lineTo(o,t.y),i.lineTo(o,e.y)}else n==="after"!=!!s?i.lineTo(t.x,e.y):i.lineTo(e.x,t.y);i.lineTo(e.x,e.y)}function uc(i,t,e,s){if(!t)return i.lineTo(e.x,e.y);i.bezierCurveTo(s?t.cp1x:t.cp2x,s?t.cp1y:t.cp2y,s?e.cp2x:e.cp1x,s?e.cp2y:e.cp1y,e.x,e.y)}function fc(i,t){t.translation&&i.translate(t.translation[0],t.translation[1]),T(t.rotation)||i.rotate(t.rotation),t.color&&(i.fillStyle=t.color),t.textAlign&&(i.textAlign=t.textAlign),t.textBaseline&&(i.textBaseline=t.textBaseline)}function pc(i,t,e,s,n){if(n.strikethrough||n.underline){const o=i.measureText(s),r=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,c=e-o.actualBoundingBoxAscent,l=e+o.actualBoundingBoxDescent,h=n.strikethrough?(c+l)/2:l;i.strokeStyle=i.fillStyle,i.beginPath(),i.lineWidth=n.decorationWidth||2,i.moveTo(r,h),i.lineTo(a,h),i.stroke()}}function gc(i,t){const e=i.fillStyle;i.fillStyle=t.color,i.fillRect(t.left,t.top,t.width,t.height),i.fillStyle=e}function Ze(i,t,e,s,n,o={}){const r=F(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="";let c,l;for(i.save(),i.font=n.string,fc(i,o),c=0;c<r.length;++c)l=r[c],o.backdrop&&gc(i,o.backdrop),a&&(o.strokeColor&&(i.strokeStyle=o.strokeColor),T(o.strokeWidth)||(i.lineWidth=o.strokeWidth),i.strokeText(l,e,s,o.maxWidth)),i.fillText(l,e,s,o.maxWidth),pc(i,e,s,l,o),s+=Number(n.lineHeight);i.restore()}function mc(i,t){const{x:e,y:s,w:n,h:o,radius:r}=t;i.arc(e+r.topLeft,s+r.topLeft,r.topLeft,1.5*z,z,!0),i.lineTo(e,s+o-r.bottomLeft),i.arc(e+r.bottomLeft,s+o-r.bottomLeft,r.bottomLeft,z,U,!0),i.lineTo(e+n-r.bottomRight,s+o),i.arc(e+n-r.bottomRight,s+o-r.bottomRight,r.bottomRight,U,0,!0),i.lineTo(e+n,s+r.topRight),i.arc(e+n-r.topRight,s+r.topRight,r.topRight,0,-U,!0),i.lineTo(e+r.topLeft,s)}const bc=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,_c=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function yc(i,t){const e=(""+i).match(bc);if(!e||e[1]==="normal")return t*1.2;switch(i=+e[2],e[3]){case"px":return i;case"%":i/=100;break}return t*i}const xc=i=>+i||0;function En(i,t){const e={},s=A(t),n=s?Object.keys(t):t,o=A(i)?s?r=>D(i[r],i[t[r]]):r=>i[r]:()=>i;for(const r of n)e[r]=xc(o(r));return e}function vc(i){return En(i,{top:"y",right:"x",bottom:"y",left:"x"})}function wc(i){return En(i,["topLeft","topRight","bottomLeft","bottomRight"])}function rt(i){const t=vc(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Xt(i,t){i=i||{},t=t||N.font;let e=D(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let s=D(i.style,t.style);s&&!(""+s).match(_c)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:D(i.family,t.family),lineHeight:yc(D(i.lineHeight,t.lineHeight),e),size:e,style:s,weight:D(i.weight,t.weight),string:""};return n.string=ac(n),n}function Je(i,t,e,s){let n=!0,o,r,a;for(o=0,r=i.length;o<r;++o)if(a=i[o],a!==void 0&&(t!==void 0&&typeof a=="function"&&(a=a(t),n=!1),e!==void 0&&F(a)&&(a=a[e%a.length],n=!1),a!==void 0))return s&&!n&&(s.cacheable=!1),a}function kc(i,t,e){const{min:s,max:n}=i,o=hn(t,(n-s)/2),r=(a,c)=>e&&a===0?0:a+c;return{min:r(s,-Math.abs(o)),max:r(n,o)}}function Ot(i,t){return Object.assign(Object.create(i),t)}function ts(i,t=[""],e,s,n=()=>i[0]){const o=e||i;typeof s=="undefined"&&(s=zn("_fallback",i));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:s,_getTarget:n,override:a=>ts([a,...i],t,o,s)};return new Proxy(r,{deleteProperty(a,c){return delete a[c],delete a._keys,delete i[0][c],!0},get(a,c){return Ln(a,c,()=>Dc(c,t,i,a))},getOwnPropertyDescriptor(a,c){return Reflect.getOwnPropertyDescriptor(a._scopes[0],c)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(a,c){return Nn(a).includes(c)},ownKeys(a){return Nn(a)},set(a,c,l){const h=a._storage||(a._storage=n());return a[c]=h[c]=l,delete a._keys,!0}})}function Kt(i,t,e,s){const n={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:In(i,s),setContext:o=>Kt(i,o,e,s),override:o=>Kt(i.override(o),t,e,s)};return new Proxy(n,{deleteProperty(o,r){return delete o[r],delete i[r],!0},get(o,r,a){return Ln(o,r,()=>Mc(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(i,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,r)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,r){return Reflect.has(i,r)},ownKeys(){return Reflect.ownKeys(i)},set(o,r,a){return i[r]=a,delete o[r],!0}})}function In(i,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:s=t.indexable,_allKeys:n=t.allKeys}=i;return{allKeys:n,scriptable:e,indexable:s,isScriptable:mt(e)?e:()=>e,isIndexable:mt(s)?s:()=>s}}const Sc=(i,t)=>i?i+qi(t):t,es=(i,t)=>A(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Ln(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t))return i[t];const s=e();return i[t]=s,s}function Mc(i,t,e){const{_proxy:s,_context:n,_subProxy:o,_descriptors:r}=i;let a=s[t];return mt(a)&&r.isScriptable(t)&&(a=Oc(t,a,i,e)),F(a)&&a.length&&(a=Cc(t,a,i,r.isIndexable)),es(t,a)&&(a=Kt(a,n,o&&o[t],r)),a}function Oc(i,t,e,s){const{_proxy:n,_context:o,_subProxy:r,_stack:a}=e;if(a.has(i))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+i);a.add(i);let c=t(o,r||s);return a.delete(i),es(i,c)&&(c=is(n._scopes,n,i,c)),c}function Cc(i,t,e,s){const{_proxy:n,_context:o,_subProxy:r,_descriptors:a}=e;if(typeof o.index!="undefined"&&s(i))return t[o.index%t.length];if(A(t[0])){const c=t,l=n._scopes.filter(h=>h!==c);t=[];for(const h of c){const d=is(l,n,i,h);t.push(Kt(d,o,r&&r[i],a))}}return t}function Rn(i,t,e){return mt(i)?i(t,e):i}const Ac=(i,t)=>i===!0?t:typeof i=="string"?Yt(t,i):void 0;function Pc(i,t,e,s,n){for(const o of t){const r=Ac(e,o);if(r){i.add(r);const a=Rn(r._fallback,e,n);if(typeof a!="undefined"&&a!==e&&a!==s)return a}else if(r===!1&&typeof s!="undefined"&&e!==s)return null}return!1}function is(i,t,e,s){const n=t._rootScopes,o=Rn(t._fallback,e,s),r=[...i,...n],a=new Set;a.add(s);let c=Fn(a,r,e,o||e,s);return c===null||typeof o!="undefined"&&o!==e&&(c=Fn(a,r,o,c,s),c===null)?!1:ts(Array.from(a),[""],n,o,()=>$c(t,e,s))}function Fn(i,t,e,s,n){for(;e;)e=Pc(i,t,e,s,n);return e}function $c(i,t,e){const s=i._getTarget();t in s||(s[t]={});const n=s[t];return F(n)&&A(e)?e:n||{}}function Dc(i,t,e,s){let n;for(const o of t)if(n=zn(Sc(o,i),e),typeof n!="undefined")return es(i,n)?is(e,s,i,n):n}function zn(i,t){for(const e of t){if(!e)continue;const s=e[i];if(typeof s!="undefined")return s}}function Nn(i){let t=i._keys;return t||(t=i._keys=Tc(i._scopes)),t}function Tc(i){const t=new Set;for(const e of i)for(const s of Object.keys(e).filter(n=>!n.startsWith("_")))t.add(s);return Array.from(t)}function Ec(i,t,e,s){const{iScale:n}=i,{key:o="r"}=this._parsing,r=new Array(s);let a,c,l,h;for(a=0,c=s;a<c;++a)l=a+e,h=t[l],r[a]={r:n.parse(Yt(h,o),l)};return r}const Ic=Number.EPSILON||1e-14,Gt=(i,t)=>t<i.length&&!i[t].skip&&i[t],jn=i=>i==="x"?"y":"x";function Lc(i,t,e,s){const n=i.skip?t:i,o=t,r=e.skip?t:e,a=yn(o,n),c=yn(r,o);let l=a/(a+c),h=c/(a+c);l=isNaN(l)?0:l,h=isNaN(h)?0:h;const d=s*l,u=s*h;return{previous:{x:o.x-d*(r.x-n.x),y:o.y-d*(r.y-n.y)},next:{x:o.x+u*(r.x-n.x),y:o.y+u*(r.y-n.y)}}}function Rc(i,t,e){const s=i.length;let n,o,r,a,c,l=Gt(i,0);for(let h=0;h<s-1;++h)if(c=l,l=Gt(i,h+1),!(!c||!l)){if(ue(t[h],0,Ic)){e[h]=e[h+1]=0;continue}n=e[h]/t[h],o=e[h+1]/t[h],a=Math.pow(n,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),e[h]=n*r*t[h],e[h+1]=o*r*t[h])}}function Fc(i,t,e="x"){const s=jn(e),n=i.length;let o,r,a,c=Gt(i,0);for(let l=0;l<n;++l){if(r=a,a=c,c=Gt(i,l+1),!a)continue;const h=a[e],d=a[s];r&&(o=(h-r[e])/3,a[`cp1${e}`]=h-o,a[`cp1${s}`]=d-o*t[l]),c&&(o=(c[e]-h)/3,a[`cp2${e}`]=h+o,a[`cp2${s}`]=d+o*t[l])}}function zc(i,t="x"){const e=jn(t),s=i.length,n=Array(s).fill(0),o=Array(s);let r,a,c,l=Gt(i,0);for(r=0;r<s;++r)if(a=c,c=l,l=Gt(i,r+1),!!c){if(l){const h=l[t]-c[t];n[r]=h!==0?(l[e]-c[e])/h:0}o[r]=a?l?qt(n[r-1])!==qt(n[r])?0:(n[r-1]+n[r])/2:n[r-1]:n[r]}Rc(i,n,o),Fc(i,o,t)}function ti(i,t,e){return Math.max(Math.min(i,e),t)}function Nc(i,t){let e,s,n,o,r,a=ot(i[0],t);for(e=0,s=i.length;e<s;++e)r=o,o=a,a=e<s-1&&ot(i[e+1],t),!!o&&(n=i[e],r&&(n.cp1x=ti(n.cp1x,t.left,t.right),n.cp1y=ti(n.cp1y,t.top,t.bottom)),a&&(n.cp2x=ti(n.cp2x,t.left,t.right),n.cp2y=ti(n.cp2y,t.top,t.bottom)))}function jc(i,t,e,s,n){let o,r,a,c;if(t.spanGaps&&(i=i.filter(l=>!l.skip)),t.cubicInterpolationMode==="monotone")zc(i,n);else{let l=s?i[i.length-1]:i[0];for(o=0,r=i.length;o<r;++o)a=i[o],c=Lc(l,a,i[Math.min(o+1,r-(s?0:1))%r],t.tension),a.cp1x=c.previous.x,a.cp1y=c.previous.y,a.cp2x=c.next.x,a.cp2y=c.next.y,l=a}t.capBezierPoints&&Nc(i,e)}function ss(){return typeof window!="undefined"&&typeof document!="undefined"}function ns(i){let t=i.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function ei(i,t,e){let s;return typeof i=="string"?(s=parseInt(i,10),i.indexOf("%")!==-1&&(s=s/100*t.parentNode[e])):s=i,s}const ii=i=>i.ownerDocument.defaultView.getComputedStyle(i,null);function Bc(i,t){return ii(i).getPropertyValue(t)}const Vc=["top","right","bottom","left"];function Ct(i,t,e){const s={};e=e?"-"+e:"";for(let n=0;n<4;n++){const o=Vc[n];s[o]=parseFloat(i[t+"-"+o+e])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const Hc=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function Wc(i,t){const e=i.touches,s=e&&e.length?e[0]:i,{offsetX:n,offsetY:o}=s;let r=!1,a,c;if(Hc(n,o,i.target))a=n,c=o;else{const l=t.getBoundingClientRect();a=s.clientX-l.left,c=s.clientY-l.top,r=!0}return{x:a,y:c,box:r}}function At(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:s}=t,n=ii(e),o=n.boxSizing==="border-box",r=Ct(n,"padding"),a=Ct(n,"border","width"),{x:c,y:l,box:h}=Wc(i,e),d=r.left+(h&&a.left),u=r.top+(h&&a.top);let{width:f,height:p}=t;return o&&(f-=r.width+a.width,p-=r.height+a.height),{x:Math.round((c-d)/f*e.width/s),y:Math.round((l-u)/p*e.height/s)}}function Uc(i,t,e){let s,n;if(t===void 0||e===void 0){const o=ns(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const r=o.getBoundingClientRect(),a=ii(o),c=Ct(a,"border","width"),l=Ct(a,"padding");t=r.width-l.width-c.width,e=r.height-l.height-c.height,s=ei(a.maxWidth,o,"clientWidth"),n=ei(a.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:s||qe,maxHeight:n||qe}}const si=i=>Math.round(i*10)/10;function Yc(i,t,e,s){const n=ii(i),o=Ct(n,"margin"),r=ei(n.maxWidth,i,"clientWidth")||qe,a=ei(n.maxHeight,i,"clientHeight")||qe,c=Uc(i,t,e);let{width:l,height:h}=c;if(n.boxSizing==="content-box"){const u=Ct(n,"border","width"),f=Ct(n,"padding");l-=f.width+u.width,h-=f.height+u.height}return l=Math.max(0,l-o.width),h=Math.max(0,s?l/s:h-o.height),l=si(Math.min(l,r,c.maxWidth)),h=si(Math.min(h,a,c.maxHeight)),l&&!h&&(h=si(l/2)),(t!==void 0||e!==void 0)&&s&&c.height&&h>c.height&&(h=c.height,l=si(Math.floor(h*s))),{width:l,height:h}}function Bn(i,t,e){const s=t||1,n=Math.floor(i.height*s),o=Math.floor(i.width*s);i.height=Math.floor(i.height),i.width=Math.floor(i.width);const r=i.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${i.height}px`,r.style.width=`${i.width}px`),i.currentDevicePixelRatio!==s||r.height!==n||r.width!==o?(i.currentDevicePixelRatio=s,r.height=n,r.width=o,i.ctx.setTransform(s,0,0,s,0,0),!0):!1}const qc=function(){let i=!1;try{const t={get passive(){return i=!0,!1}};ss()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return i}();function Vn(i,t){const e=Bc(i,t),s=e&&e.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function Pt(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function Xc(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:s==="middle"?e<.5?i.y:t.y:s==="after"?e<1?i.y:t.y:e>0?t.y:i.y}}function Kc(i,t,e,s){const n={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},r=Pt(i,n,e),a=Pt(n,o,e),c=Pt(o,t,e),l=Pt(r,a,e),h=Pt(a,c,e);return Pt(l,h,e)}function Hn(i){return i==="angle"?{between:Xe,compare:Va,normalize:Q}:{between:Wa,compare:(t,e)=>t-e,normalize:t=>t}}function Wn({start:i,end:t,count:e,loop:s,style:n}){return{start:i%e,end:t%e,loop:s&&(t-i+1)%e==0,style:n}}function Gc(i,t,e){const{property:s,start:n,end:o}=e,{between:r,normalize:a}=Hn(s),c=t.length;let{start:l,end:h,loop:d}=i,u,f;if(d){for(l+=c,h+=c,u=0,f=c;u<f&&r(a(t[l%c][s]),n,o);++u)l--,h--;l%=c,h%=c}return h<l&&(h+=c),{start:l,end:h,loop:d,style:i.style}}function Qc(i,t,e){if(!e)return[i];const{property:s,start:n,end:o}=e,r=t.length,{compare:a,between:c,normalize:l}=Hn(s),{start:h,end:d,loop:u,style:f}=Gc(i,t,e),p=[];let g=!1,m=null,b,_,v;const M=()=>c(n,v,b)&&a(n,v)!==0,y=()=>a(o,b)===0||c(o,v,b),x=()=>g||M(),w=()=>!g||y();for(let S=h,O=h;S<=d;++S)_=t[S%r],!_.skip&&(b=l(_[s]),b!==v&&(g=c(b,n,o),m===null&&x()&&(m=a(b,n)===0?S:O),m!==null&&w()&&(p.push(Wn({start:m,end:S,loop:u,count:r,style:f})),m=null),O=S,v=b));return m!==null&&p.push(Wn({start:m,end:d,loop:u,count:r,style:f})),p}function Zc(i,t){const e=[],s=i.segments;for(let n=0;n<s.length;n++){const o=Qc(s[n],i.points,t);o.length&&e.push(...o)}return e}function Jc(i,t,e,s){let n=0,o=t-1;if(e&&!s)for(;n<t&&!i[n].skip;)n++;for(;n<t&&i[n].skip;)n++;for(n%=t,e&&(o+=n);o>n&&i[o%t].skip;)o--;return o%=t,{start:n,end:o}}function tl(i,t,e,s){const n=i.length,o=[];let r=t,a=i[t],c;for(c=t+1;c<=e;++c){const l=i[c%n];l.skip||l.stop?a.skip||(s=!1,o.push({start:t%n,end:(c-1)%n,loop:s}),t=r=l.stop?c:null):(r=c,a.skip&&(t=c)),a=l}return r!==null&&o.push({start:t%n,end:r%n,loop:s}),o}function el(i,t){const e=i.points,s=i.options.spanGaps,n=e.length;if(!n)return[];const o=!!i._loop,{start:r,end:a}=Jc(e,n,o,s);if(s===!0)return Un(i,[{start:r,end:a,loop:o}],e,t);const c=a<r?a+n:a,l=!!i._fullLoop&&r===0&&a===n-1;return Un(i,tl(e,r,c,l),e,t)}function Un(i,t,e,s){return!s||!s.setContext||!e?t:il(i,t,e,s)}function il(i,t,e,s){const n=i._chart.getContext(),o=Yn(i.options),{_datasetIndex:r,options:{spanGaps:a}}=i,c=e.length,l=[];let h=o,d=t[0].start,u=d;function f(p,g,m,b){const _=a?-1:1;if(p!==g){for(p+=c;e[p%c].skip;)p-=_;for(;e[g%c].skip;)g+=_;p%c!=g%c&&(l.push({start:p%c,end:g%c,loop:m,style:b}),h=b,d=g%c)}}for(const p of t){d=a?d:p.start;let g=e[d%c],m;for(u=d+1;u<=p.end;u++){const b=e[u%c];m=Yn(s.setContext(Ot(n,{type:"segment",p0:g,p1:b,p0DataIndex:(u-1)%c,p1DataIndex:u%c,datasetIndex:r}))),sl(m,h)&&f(d,u-1,p.loop,h),g=b,h=m}d<u-1&&f(d,u-1,p.loop,h)}return l}function Yn(i){return{backgroundColor:i.backgroundColor,borderCapStyle:i.borderCapStyle,borderDash:i.borderDash,borderDashOffset:i.borderDashOffset,borderJoinStyle:i.borderJoinStyle,borderWidth:i.borderWidth,borderColor:i.borderColor}}function sl(i,t){if(!t)return!1;const e=[],s=function(n,o){return Gi(o)?(e.includes(o)||e.push(o),e.indexOf(o)):o};return JSON.stringify(i,s)!==JSON.stringify(t,s)}class nl{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,s,n){const o=e.listeners[n],r=e.duration;o.forEach(a=>a({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(s-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=wn.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((s,n)=>{if(!s.running||!s.items.length)return;const o=s.items;let r=o.length-1,a=!1,c;for(;r>=0;--r)c=o[r],c._active?(c._total>s.duration&&(s.duration=c._total),c.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,s,t,"progress")),o.length||(s.running=!1,this._notify(n,s,t,"complete"),s.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let s=e.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,s)),s}listen(t,e,s){this._getAnims(t).listeners[e].push(s)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);!e||(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((s,n)=>Math.max(s,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const s=e.items;let n=s.length-1;for(;n>=0;--n)s[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var at=new nl;const qn="transparent",ol={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const s=Cn(i||qn),n=s.valid&&Cn(t||qn);return n&&n.valid?n.mix(s,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class rl{constructor(t,e,s,n){const o=e[s];n=Je([t.to,n,o,t.from]);const r=Je([t.from,o,n]);this._active=!0,this._fn=t.fn||ol[t.type||typeof r],this._easing=pe[t.easing]||pe.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=s,this._from=r,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,s){if(this._active){this._notify(!1);const n=this._target[this._prop],o=s-this._start,r=this._duration-o;this._start=s,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Je([t.to,e,n,t.from]),this._from=Je([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,s=this._duration,n=this._prop,o=this._from,r=this._loop,a=this._to;let c;if(this._active=o!==a&&(r||e<s),!this._active){this._target[n]=a,this._notify(!0);return}if(e<0){this._target[n]=o;return}c=e/s%2,c=r&&c>1?2-c:c,c=this._easing(Math.min(1,Math.max(0,c))),this._target[n]=this._fn(o,a,c)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,s)=>{t.push({res:e,rej:s})})}_notify(t){const e=t?"res":"rej",s=this._promises||[];for(let n=0;n<s.length;n++)s[n][e]()}}class al{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!A(t))return;const e=Object.keys(N.animation),s=this._properties;Object.getOwnPropertyNames(t).forEach(n=>{const o=t[n];if(!A(o))return;const r={};for(const a of e)r[a]=o[a];(F(o.properties)&&o.properties||[n]).forEach(a=>{(a===n||!s.has(a))&&s.set(a,r)})})}_animateOptions(t,e){const s=e.options,n=ll(t,s);if(!n)return[];const o=this._createAnimations(n,s);return s.$shared&&cl(t.options.$animations,s).then(()=>{t.options=s},()=>{}),o}_createAnimations(t,e){const s=this._properties,n=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let c;for(c=r.length-1;c>=0;--c){const l=r[c];if(l.charAt(0)==="$")continue;if(l==="options"){n.push(...this._animateOptions(t,e));continue}const h=e[l];let d=o[l];const u=s.get(l);if(d)if(u&&d.active()){d.update(u,h,a);continue}else d.cancel();if(!u||!u.duration){t[l]=h;continue}o[l]=d=new rl(u,t,l,h),n.push(d)}return n}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const s=this._createAnimations(t,e);if(s.length)return at.add(this._chart,s),!0}}function cl(i,t){const e=[],s=Object.keys(t);for(let n=0;n<s.length;n++){const o=i[s[n]];o&&o.active()&&e.push(o.wait())}return Promise.all(e)}function ll(i,t){if(!t)return;let e=i.options;if(!e){i.options=t;return}return e.$shared&&(i.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function Xn(i,t){const e=i&&i.options||{},s=e.reverse,n=e.min===void 0?t:0,o=e.max===void 0?t:0;return{start:s?o:n,end:s?n:o}}function hl(i,t,e){if(e===!1)return!1;const s=Xn(i,e),n=Xn(t,e);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}function dl(i){let t,e,s,n;return A(i)?(t=i.top,e=i.right,s=i.bottom,n=i.left):t=e=s=n=i,{top:t,right:e,bottom:s,left:n,disabled:i===!1}}function Kn(i,t){const e=[],s=i._getSortedDatasetMetas(t);let n,o;for(n=0,o=s.length;n<o;++n)e.push(s[n].index);return e}function Gn(i,t,e,s={}){const n=i.keys,o=s.mode==="single";let r,a,c,l;if(t!==null){for(r=0,a=n.length;r<a;++r){if(c=+n[r],c===e){if(s.all)continue;break}l=i.values[c],B(l)&&(o||t===0||qt(t)===qt(l))&&(t+=l)}return t}}function ul(i){const t=Object.keys(i),e=new Array(t.length);let s,n,o;for(s=0,n=t.length;s<n;++s)o=t[s],e[s]={x:o,y:i[o]};return e}function Qn(i,t){const e=i&&i.options.stacked;return e||e===void 0&&t.stack!==void 0}function fl(i,t,e){return`${i.id}.${t.id}.${e.stack||e.type}`}function pl(i){const{min:t,max:e,minDefined:s,maxDefined:n}=i.getUserBounds();return{min:s?t:Number.NEGATIVE_INFINITY,max:n?e:Number.POSITIVE_INFINITY}}function gl(i,t,e){const s=i[t]||(i[t]={});return s[e]||(s[e]={})}function Zn(i,t,e,s){for(const n of t.getMatchingVisibleMetas(s).reverse()){const o=i[n.index];if(e&&o>0||!e&&o<0)return n.index}return null}function Jn(i,t){const{chart:e,_cachedMeta:s}=i,n=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=s,c=o.axis,l=r.axis,h=fl(o,r,s),d=t.length;let u;for(let f=0;f<d;++f){const p=t[f],{[c]:g,[l]:m}=p,b=p._stacks||(p._stacks={});u=b[l]=gl(n,h,g),u[a]=m,u._top=Zn(u,r,!0,s.type),u._bottom=Zn(u,r,!1,s.type);const _=u._visualValues||(u._visualValues={});_[a]=m}}function os(i,t){const e=i.scales;return Object.keys(e).filter(s=>e[s].axis===t).shift()}function ml(i,t){return Ot(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function bl(i,t,e){return Ot(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function be(i,t){const e=i.controller.index,s=i.vScale&&i.vScale.axis;if(!!s){t=t||i._parsed;for(const n of t){const o=n._stacks;if(!o||o[s]===void 0||o[s][e]===void 0)return;delete o[s][e],o[s]._visualValues!==void 0&&o[s]._visualValues[e]!==void 0&&delete o[s]._visualValues[e]}}}const rs=i=>i==="reset"||i==="none",to=(i,t)=>t?i:Object.assign({},i),_l=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:Kn(e,!0),values:null};class $t{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Qn(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&be(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,s=this.getDataset(),n=(d,u,f,p)=>d==="x"?u:d==="r"?p:f,o=e.xAxisID=D(s.xAxisID,os(t,"x")),r=e.yAxisID=D(s.yAxisID,os(t,"y")),a=e.rAxisID=D(s.rAxisID,os(t,"r")),c=e.indexAxis,l=e.iAxisID=n(c,o,r,a),h=e.vAxisID=n(c,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&vn(this._data,this),t._stacked&&be(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),s=this._data;if(A(e))this._data=ul(e);else if(s!==e){if(s){vn(s,this);const n=this._cachedMeta;be(n),n._parsed=[]}e&&Object.isExtensible(e)&&qa(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,s=this.getDataset();let n=!1;this._dataCheck();const o=e._stacked;e._stacked=Qn(e.vScale,e),e.stack!==s.stack&&(n=!0,be(e),e.stack=s.stack),this._resyncElements(t),(n||o!==e._stacked)&&Jn(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:s,_data:n}=this,{iScale:o,_stacked:r}=s,a=o.axis;let c=t===0&&e===n.length?!0:s._sorted,l=t>0&&s._parsed[t-1],h,d,u;if(this._parsing===!1)s._parsed=n,s._sorted=!0,u=n;else{F(n[t])?u=this.parseArrayData(s,n,t,e):A(n[t])?u=this.parseObjectData(s,n,t,e):u=this.parsePrimitiveData(s,n,t,e);const f=()=>d[a]===null||l&&d[a]<l[a];for(h=0;h<e;++h)s._parsed[h+t]=d=u[h],c&&(f()&&(c=!1),l=d);s._sorted=c}r&&Jn(this,u)}parsePrimitiveData(t,e,s,n){const{iScale:o,vScale:r}=t,a=o.axis,c=r.axis,l=o.getLabels(),h=o===r,d=new Array(n);let u,f,p;for(u=0,f=n;u<f;++u)p=u+s,d[u]={[a]:h||o.parse(l[p],p),[c]:r.parse(e[p],p)};return d}parseArrayData(t,e,s,n){const{xScale:o,yScale:r}=t,a=new Array(n);let c,l,h,d;for(c=0,l=n;c<l;++c)h=c+s,d=e[h],a[c]={x:o.parse(d[0],h),y:r.parse(d[1],h)};return a}parseObjectData(t,e,s,n){const{xScale:o,yScale:r}=t,{xAxisKey:a="x",yAxisKey:c="y"}=this._parsing,l=new Array(n);let h,d,u,f;for(h=0,d=n;h<d;++h)u=h+s,f=e[u],l[h]={x:o.parse(Yt(f,a),u),y:r.parse(Yt(f,c),u)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,s){const n=this.chart,o=this._cachedMeta,r=e[t.axis],a={keys:Kn(n,!0),values:e._stacks[t.axis]._visualValues};return Gn(a,r,o.index,{mode:s})}updateRangeFromParsed(t,e,s,n){const o=s[e.axis];let r=o===null?NaN:o;const a=n&&s._stacks[e.axis];n&&a&&(n.values=a,r=Gn(n,o,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,e){const s=this._cachedMeta,n=s._parsed,o=s._sorted&&t===s.iScale,r=n.length,a=this._getOtherScale(t),c=_l(e,s,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:d}=pl(a);let u,f;function p(){f=n[u];const g=f[a.axis];return!B(f[t.axis])||h>g||d<g}for(u=0;u<r&&!(!p()&&(this.updateRangeFromParsed(l,t,f,c),o));++u);if(o){for(u=r-1;u>=0;--u)if(!p()){this.updateRangeFromParsed(l,t,f,c);break}}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,s=[];let n,o,r;for(n=0,o=e.length;n<o;++n)r=e[n][t.axis],B(r)&&s.push(r);return s}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,s=e.iScale,n=e.vScale,o=this.getParsed(t);return{label:s?""+s.getLabelForValue(o[s.axis]):"",value:n?""+n.getLabelForValue(o[n.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=dl(D(this.options.clip,hl(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,s=this._cachedMeta,n=s.data||[],o=e.chartArea,r=[],a=this._drawStart||0,c=this._drawCount||n.length-a,l=this.options.drawActiveElementsOnTop;let h;for(s.dataset&&s.dataset.draw(t,o,a,c),h=a;h<a+c;++h){const d=n[h];d.hidden||(d.active&&l?r.push(d):d.draw(t,o))}for(h=0;h<r.length;++h)r[h].draw(t,o)}getStyle(t,e){const s=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(s):this.resolveDataElementOptions(t||0,s)}getContext(t,e,s){const n=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const r=this._cachedMeta.data[t];o=r.$context||(r.$context=bl(this.getContext(),t,r)),o.parsed=this.getParsed(t),o.raw=n.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=ml(this.chart.getContext(),this.index)),o.dataset=n,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=s,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",s){const n=e==="active",o=this._cachedDataOpts,r=t+"-"+e,a=o[r],c=this.enableOptionSharing&&Ye(s);if(a)return to(a,c);const l=this.chart.config,h=l.datasetElementScopeKeys(this._type,t),d=n?[`${t}Hover`,"hover",t,""]:[t,""],u=l.getOptionScopes(this.getDataset(),h),f=Object.keys(N.elements[t]),p=()=>this.getContext(s,n,e),g=l.resolveNamedOptions(u,f,p,d);return g.$shared&&(g.$shared=c,o[r]=Object.freeze(to(g,c))),g}_resolveAnimations(t,e,s){const n=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let c;if(n.options.animation!==!1){const h=this.chart.config,d=h.datasetAnimationScopeKeys(this._type,e),u=h.getOptionScopes(this.getDataset(),d);c=h.createResolver(u,this.getContext(t,s,e))}const l=new al(n,c&&c.animations);return c&&c._cacheable&&(o[r]=Object.freeze(l)),l}getSharedOptions(t){if(!!t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||rs(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const s=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(s),r=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,s),{sharedOptions:o,includeOptions:r}}updateElement(t,e,s,n){rs(n)?Object.assign(t,s):this._resolveAnimations(e,n).update(t,s)}updateSharedOptions(t,e,s){t&&!rs(e)&&this._resolveAnimations(void 0,e).update(t,s)}_setStyle(t,e,s,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,s,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,s){this._setStyle(t,s,"active",!1)}setHoverStyle(t,e,s){this._setStyle(t,s,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,s=this._cachedMeta.data;for(const[a,c,l]of this._syncList)this[a](c,l);this._syncList=[];const n=s.length,o=e.length,r=Math.min(o,n);r&&this.parse(0,r),o>n?this._insertElements(n,o-n,t):o<n&&this._removeElements(o,n-o)}_insertElements(t,e,s=!0){const n=this._cachedMeta,o=n.data,r=t+e;let a;const c=l=>{for(l.length+=e,a=l.length-1;a>=r;a--)l[a]=l[a-e]};for(c(o),a=t;a<r;++a)o[a]=new this.dataElementType;this._parsing&&c(n._parsed),this.parse(t,e),s&&this.updateElements(o,t,e,"reset")}updateElements(t,e,s,n){}_removeElements(t,e){const s=this._cachedMeta;if(this._parsing){const n=s._parsed.splice(t,e);s._stacked&&be(s,n)}s.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,s,n]=t;this[e](s,n)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const s=arguments.length-2;s&&this._sync(["_insertElements",t,s])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}k($t,"defaults",{}),k($t,"datasetElementType",null),k($t,"dataElementType",null);function yl(i,t,e){let s=1,n=1,o=0,r=0;if(t<H){const a=i,c=a+t,l=Math.cos(a),h=Math.sin(a),d=Math.cos(c),u=Math.sin(c),f=(v,M,y)=>Xe(v,a,c,!0)?1:Math.max(M,M*e,y,y*e),p=(v,M,y)=>Xe(v,a,c,!0)?-1:Math.min(M,M*e,y,y*e),g=f(0,l,d),m=f(U,h,u),b=p(z,l,d),_=p(z+U,h,u);s=(g-b)/2,n=(m-_)/2,o=-(g+b)/2,r=-(m+_)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:r}}class _e extends $t{constructor(t,e){super(t,e);this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const s=this.getDataset().data,n=this._cachedMeta;if(this._parsing===!1)n._parsed=s;else{let o=c=>+s[c];if(A(s[t])){const{key:c="value"}=this._parsing;o=l=>+Yt(s[l],c)}let r,a;for(r=t,a=t+e;r<a;++r)n._parsed[r]=o(r)}}_getRotation(){return G(this.options.rotation-90)}_getCircumference(){return G(this.options.circumference)}_getRotationExtents(){let t=H,e=-H;for(let s=0;s<this.chart.data.datasets.length;++s)if(this.chart.isDatasetVisible(s)&&this.chart.getDatasetMeta(s).type===this._type){const n=this.chart.getDatasetMeta(s).controller,o=n._getRotation(),r=n._getCircumference();t=Math.min(t,o),e=Math.max(e,o+r)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:s}=e,n=this._cachedMeta,o=n.data,r=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,a=Math.max((Math.min(s.width,s.height)-r)/2,0),c=Math.min(Da(this.options.cutout,a),1),l=this._getRingWeight(this.index),{circumference:h,rotation:d}=this._getRotationExtents(),{ratioX:u,ratioY:f,offsetX:p,offsetY:g}=yl(d,h,c),m=(s.width-r)/u,b=(s.height-r)/f,_=Math.max(Math.min(m,b)/2,0),v=hn(this.options.radius,_),M=Math.max(v*c,0),y=(v-M)/this._getVisibleDatasetWeightTotal();this.offsetX=p*v,this.offsetY=g*v,n.total=this.calculateTotal(),this.outerRadius=v-y*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-y*l,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){const s=this.options,n=this._cachedMeta,o=this._getCircumference();return e&&s.animation.animateRotate||!this.chart.getDataVisibility(t)||n._parsed[t]===null||n.data[t].hidden?0:this.calculateCircumference(n._parsed[t]*o/H)}updateElements(t,e,s,n){const o=n==="reset",r=this.chart,a=r.chartArea,l=r.options.animation,h=(a.left+a.right)/2,d=(a.top+a.bottom)/2,u=o&&l.animateScale,f=u?0:this.innerRadius,p=u?0:this.outerRadius,{sharedOptions:g,includeOptions:m}=this._getSharedOptions(e,n);let b=this._getRotation(),_;for(_=0;_<e;++_)b+=this._circumference(_,o);for(_=e;_<e+s;++_){const v=this._circumference(_,o),M=t[_],y={x:h+this.offsetX,y:d+this.offsetY,startAngle:b,endAngle:b+v,circumference:v,outerRadius:p,innerRadius:f};m&&(y.options=g||this.resolveDataElementOptions(_,M.active?"active":n)),b+=v,this.updateElement(M,_,y,n)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let s=0,n;for(n=0;n<e.length;n++){const o=t._parsed[n];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(n)&&!e[n].hidden&&(s+=Math.abs(o))}return s}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?H*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,s=this.chart,n=s.data.labels||[],o=ge(e._parsed[t],s.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const s=this.chart;let n,o,r,a,c;if(!t){for(n=0,o=s.data.datasets.length;n<o;++n)if(s.isDatasetVisible(n)){r=s.getDatasetMeta(n),t=r.data,a=r.controller;break}}if(!t)return 0;for(n=0,o=t.length;n<o;++n)c=a.resolveDataElementOptions(n),c.borderAlign!=="inner"&&(e=Math.max(e,c.borderWidth||0,c.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let s=0,n=t.length;s<n;++s){const o=this.resolveDataElementOptions(s);e=Math.max(e,o.offset||0,o.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let s=0;s<t;++s)this.chart.isDatasetVisible(s)&&(e+=this._getRingWeight(s));return e}_getRingWeight(t){return Math.max(D(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}k(_e,"id","doughnut"),k(_e,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),k(_e,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),k(_e,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:s,color:n}}=t.legend.options;return e.labels.map((o,r)=>{const c=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:n,lineWidth:c.borderWidth,pointStyle:s,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,s){s.chart.toggleDataVisibility(e.index),s.chart.update()}}}});class ni extends $t{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:s,data:n=[],_dataset:o}=e,r=this.chart._animationsDisabled;let{start:a,count:c}=Qa(e,n,r);this._drawStart=a,this._drawCount=c,Za(e)&&(a=0,c=n.length),s._chart=this.chart,s._datasetIndex=this.index,s._decimated=!!o._decimated,s.points=n;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(s,void 0,{animated:!r,options:l},t),this.updateElements(n,a,c,t)}updateElements(t,e,s,n){const o=n==="reset",{iScale:r,vScale:a,_stacked:c,_dataset:l}=this._cachedMeta,{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,n),u=r.axis,f=a.axis,{spanGaps:p,segment:g}=this.options,m=fe(p)?p:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||n==="none",_=e+s,v=t.length;let M=e>0&&this.getParsed(e-1);for(let y=0;y<v;++y){const x=t[y],w=b?x:{};if(y<e||y>=_){w.skip=!0;continue}const S=this.getParsed(y),O=T(S[f]),P=w[u]=r.getPixelForValue(S[u],y),I=w[f]=o||O?a.getBasePixel():a.getPixelForValue(c?this.applyStack(a,S,c):S[f],y);w.skip=isNaN(P)||isNaN(I)||O,w.stop=y>0&&Math.abs(S[u]-M[u])>m,g&&(w.parsed=S,w.raw=l.data[y]),d&&(w.options=h||this.resolveDataElementOptions(y,x.active?"active":n)),b||this.updateElement(x,y,w,n),M=S}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,s=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return s;const o=n[0].size(this.resolveDataElementOptions(0)),r=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(s,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}k(ni,"id","line"),k(ni,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),k(ni,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class oi extends $t{constructor(t,e){super(t,e);this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,s=this.chart,n=s.data.labels||[],o=ge(e._parsed[t].r,s.options.locale);return{label:n[t]||"",value:o}}parseObjectData(t,e,s,n){return Ec.bind(this)(t,e,s,n)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((s,n)=>{const o=this.getParsed(n).r;!isNaN(o)&&this.chart.getDataVisibility(n)&&(o<e.min&&(e.min=o),o>e.max&&(e.max=o))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,s=t.options,n=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(n/2,0),r=Math.max(s.cutoutPercentage?o/100*s.cutoutPercentage:1,0),a=(o-r)/t.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,s,n){const o=n==="reset",r=this.chart,c=r.options.animation,l=this._cachedMeta.rScale,h=l.xCenter,d=l.yCenter,u=l.getIndexAngle(0)-.5*z;let f=u,p;const g=360/this.countVisibleElements();for(p=0;p<e;++p)f+=this._computeAngle(p,n,g);for(p=e;p<e+s;p++){const m=t[p];let b=f,_=f+this._computeAngle(p,n,g),v=r.getDataVisibility(p)?l.getDistanceFromCenterForValue(this.getParsed(p).r):0;f=_,o&&(c.animateScale&&(v=0),c.animateRotate&&(b=_=u));const M={x:h,y:d,innerRadius:0,outerRadius:v,startAngle:b,endAngle:_,options:this.resolveDataElementOptions(p,m.active?"active":n)};this.updateElement(m,p,M,n)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach((s,n)=>{!isNaN(this.getParsed(n).r)&&this.chart.getDataVisibility(n)&&e++}),e}_computeAngle(t,e,s){return this.chart.getDataVisibility(t)?G(this.resolveDataElementOptions(t,e).angle||s):0}}k(oi,"id","polarArea"),k(oi,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),k(oi,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:s,color:n}}=t.legend.options;return e.labels.map((o,r)=>{const c=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:n,lineWidth:c.borderWidth,pointStyle:s,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,s){s.chart.toggleDataVisibility(e.index),s.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});function Dt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class as{constructor(t){k(this,"options");this.options=t||{}}static override(t){Object.assign(as.prototype,t)}init(){}formats(){return Dt()}parse(){return Dt()}format(){return Dt()}add(){return Dt()}diff(){return Dt()}startOf(){return Dt()}endOf(){return Dt()}}var xl={_date:as};function vl(i,t,e,s){const{controller:n,data:o,_sorted:r}=i,a=n._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const c=a._reversePixels?Ua:kt;if(s){if(n._sharedOptions){const l=o[0],h=typeof l.getRange=="function"&&l.getRange(t);if(h){const d=c(o,t,e-h),u=c(o,t,e+h);return{lo:d.lo,hi:u.hi}}}}else return c(o,t,e)}return{lo:0,hi:o.length-1}}function ye(i,t,e,s,n){const o=i.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,c=o.length;a<c;++a){const{index:l,data:h}=o[a],{lo:d,hi:u}=vl(o[a],t,r,n);for(let f=d;f<=u;++f){const p=h[f];p.skip||s(p,l,f)}}}function wl(i){const t=i.indexOf("x")!==-1,e=i.indexOf("y")!==-1;return function(s,n){const o=t?Math.abs(s.x-n.x):0,r=e?Math.abs(s.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function cs(i,t,e,s,n){const o=[];return!n&&!i.isPointInArea(t)||ye(i,e,t,function(a,c,l){!n&&!ot(a,i.chartArea,0)||a.inRange(t.x,t.y,s)&&o.push({element:a,datasetIndex:c,index:l})},!0),o}function kl(i,t,e,s){let n=[];function o(r,a,c){const{startAngle:l,endAngle:h}=r.getProps(["startAngle","endAngle"],s),{angle:d}=Ba(r,{x:t.x,y:t.y});Xe(d,l,h)&&n.push({element:r,datasetIndex:a,index:c})}return ye(i,e,t,o),n}function Sl(i,t,e,s,n,o){let r=[];const a=wl(e);let c=Number.POSITIVE_INFINITY;function l(h,d,u){const f=h.inRange(t.x,t.y,n);if(s&&!f)return;const p=h.getCenterPoint(n);if(!(!!o||i.isPointInArea(p))&&!f)return;const m=a(t,p);m<c?(r=[{element:h,datasetIndex:d,index:u}],c=m):m===c&&r.push({element:h,datasetIndex:d,index:u})}return ye(i,e,t,l),r}function ls(i,t,e,s,n,o){return!o&&!i.isPointInArea(t)?[]:e==="r"&&!s?kl(i,t,e,n):Sl(i,t,e,s,n,o)}function eo(i,t,e,s,n){const o=[],r=e==="x"?"inXRange":"inYRange";let a=!1;return ye(i,e,t,(c,l,h)=>{c[r](t[e],n)&&(o.push({element:c,datasetIndex:l,index:h}),a=a||c.inRange(t.x,t.y,n))}),s&&!a?[]:o}var Ml={evaluateInteractionItems:ye,modes:{index(i,t,e,s){const n=At(t,i),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?cs(i,n,o,s,r):ls(i,n,o,!1,s,r),c=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(l=>{const h=a[0].index,d=l.data[h];d&&!d.skip&&c.push({element:d,datasetIndex:l.index,index:h})}),c):[]},dataset(i,t,e,s){const n=At(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?cs(i,n,o,s,r):ls(i,n,o,!1,s,r);if(a.length>0){const c=a[0].datasetIndex,l=i.getDatasetMeta(c).data;a=[];for(let h=0;h<l.length;++h)a.push({element:l[h],datasetIndex:c,index:h})}return a},point(i,t,e,s){const n=At(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;return cs(i,n,o,s,r)},nearest(i,t,e,s){const n=At(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;return ls(i,n,o,e.intersect,s,r)},x(i,t,e,s){const n=At(t,i);return eo(i,n,"x",e.intersect,s)},y(i,t,e,s){const n=At(t,i);return eo(i,n,"y",e.intersect,s)}}};const io=["left","top","right","bottom"];function xe(i,t){return i.filter(e=>e.pos===t)}function so(i,t){return i.filter(e=>io.indexOf(e.pos)===-1&&e.box.axis===t)}function ve(i,t){return i.sort((e,s)=>{const n=t?s:e,o=t?e:s;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function Ol(i){const t=[];let e,s,n,o,r,a;for(e=0,s=(i||[]).length;e<s;++e)n=i[e],{position:o,options:{stack:r,stackWeight:a=1}}=n,t.push({index:e,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:r&&o+r,stackWeight:a});return t}function Cl(i){const t={};for(const e of i){const{stack:s,pos:n,stackWeight:o}=e;if(!s||!io.includes(n))continue;const r=t[s]||(t[s]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return t}function Al(i,t){const e=Cl(i),{vBoxMaxWidth:s,hBoxMaxHeight:n}=t;let o,r,a;for(o=0,r=i.length;o<r;++o){a=i[o];const{fullSize:c}=a.box,l=e[a.stack],h=l&&a.stackWeight/l.weight;a.horizontal?(a.width=h?h*s:c&&t.availableWidth,a.height=n):(a.width=s,a.height=h?h*n:c&&t.availableHeight)}return e}function Pl(i){const t=Ol(i),e=ve(t.filter(l=>l.box.fullSize),!0),s=ve(xe(t,"left"),!0),n=ve(xe(t,"right")),o=ve(xe(t,"top"),!0),r=ve(xe(t,"bottom")),a=so(t,"x"),c=so(t,"y");return{fullSize:e,leftAndTop:s.concat(o),rightAndBottom:n.concat(c).concat(r).concat(a),chartArea:xe(t,"chartArea"),vertical:s.concat(n).concat(c),horizontal:o.concat(r).concat(a)}}function no(i,t,e,s){return Math.max(i[e],t[e])+Math.max(i[s],t[s])}function oo(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function $l(i,t,e,s){const{pos:n,box:o}=e,r=i.maxPadding;if(!A(n)){e.size&&(i[n]-=e.size);const d=s[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,i[n]+=e.size}o.getPadding&&oo(r,o.getPadding());const a=Math.max(0,t.outerWidth-no(r,i,"left","right")),c=Math.max(0,t.outerHeight-no(r,i,"top","bottom")),l=a!==i.w,h=c!==i.h;return i.w=a,i.h=c,e.horizontal?{same:l,other:h}:{same:h,other:l}}function Dl(i){const t=i.maxPadding;function e(s){const n=Math.max(t[s]-i[s],0);return i[s]+=n,n}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function Tl(i,t){const e=t.maxPadding;function s(n){const o={left:0,top:0,right:0,bottom:0};return n.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return s(i?["left","right"]:["top","bottom"])}function we(i,t,e,s){const n=[];let o,r,a,c,l,h;for(o=0,r=i.length,l=0;o<r;++o){a=i[o],c=a.box,c.update(a.width||t.w,a.height||t.h,Tl(a.horizontal,t));const{same:d,other:u}=$l(t,e,a,s);l|=d&&n.length,h=h||u,c.fullSize||n.push(a)}return l&&we(n,t,e,s)||h}function ri(i,t,e,s,n){i.top=e,i.left=t,i.right=t+s,i.bottom=e+n,i.width=s,i.height=n}function ro(i,t,e,s){const n=e.padding;let{x:o,y:r}=t;for(const a of i){const c=a.box,l=s[a.stack]||{count:1,placed:0,weight:1},h=a.stackWeight/l.weight||1;if(a.horizontal){const d=t.w*h,u=l.size||c.height;Ye(l.start)&&(r=l.start),c.fullSize?ri(c,n.left,r,e.outerWidth-n.right-n.left,u):ri(c,t.left+l.placed,r,d,u),l.start=r,l.placed+=d,r=c.bottom}else{const d=t.h*h,u=l.size||c.width;Ye(l.start)&&(o=l.start),c.fullSize?ri(c,o,n.top,u,e.outerHeight-n.bottom-n.top):ri(c,o,t.top+l.placed,u,d),l.start=o,l.placed+=d,o=c.right}}t.x=o,t.y=r}var ai={addBox(i,t){i.boxes||(i.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},i.boxes.push(t)},removeBox(i,t){const e=i.boxes?i.boxes.indexOf(t):-1;e!==-1&&i.boxes.splice(e,1)},configure(i,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(i,t,e,s){if(!i)return;const n=rt(i.options.layout.padding),o=Math.max(t-n.width,0),r=Math.max(e-n.height,0),a=Pl(i.boxes),c=a.vertical,l=a.horizontal;W(i.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});const h=c.reduce((g,m)=>m.box.options&&m.box.options.display===!1?g:g+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),u=Object.assign({},n);oo(u,rt(s));const f=Object.assign({maxPadding:u,w:o,h:r,x:n.left,y:n.top},n),p=Al(c.concat(l),d);we(a.fullSize,f,d,p),we(c,f,d,p),we(l,f,d,p)&&we(c,f,d,p),Dl(f),ro(a.leftAndTop,f,d,p),f.x+=f.w,f.y+=f.h,ro(a.rightAndBottom,f,d,p),i.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},W(a.chartArea,g=>{const m=g.box;Object.assign(m,i.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class ao{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,s){}removeEventListener(t,e,s){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,s,n){return e=Math.max(0,e||t.width),s=s||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):s)}}isAttached(t){return!0}updateConfig(t){}}class El extends ao{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const ci="$chartjs",Il={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},co=i=>i===null||i==="";function Ll(i,t){const e=i.style,s=i.getAttribute("height"),n=i.getAttribute("width");if(i[ci]={initial:{height:s,width:n,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",co(n)){const o=Vn(i,"width");o!==void 0&&(i.width=o)}if(co(s))if(i.style.height==="")i.height=i.width/(t||2);else{const o=Vn(i,"height");o!==void 0&&(i.height=o)}return i}const lo=qc?{passive:!0}:!1;function Rl(i,t,e){i.addEventListener(t,e,lo)}function Fl(i,t,e){i.canvas.removeEventListener(t,e,lo)}function zl(i,t){const e=Il[i.type]||i.type,{x:s,y:n}=At(i,t);return{type:e,chart:t,native:i,x:s!==void 0?s:null,y:n!==void 0?n:null}}function li(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function Nl(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||li(a.addedNodes,s),r=r&&!li(a.removedNodes,s);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function jl(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||li(a.removedNodes,s),r=r&&!li(a.addedNodes,s);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const ke=new Map;let ho=0;function uo(){const i=window.devicePixelRatio;i!==ho&&(ho=i,ke.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function Bl(i,t){ke.size||window.addEventListener("resize",uo),ke.set(i,t)}function Vl(i){ke.delete(i),ke.size||window.removeEventListener("resize",uo)}function Hl(i,t,e){const s=i.canvas,n=s&&ns(s);if(!n)return;const o=kn((a,c)=>{const l=n.clientWidth;e(a,c),l<n.clientWidth&&e()},window),r=new ResizeObserver(a=>{const c=a[0],l=c.contentRect.width,h=c.contentRect.height;l===0&&h===0||o(l,h)});return r.observe(n),Bl(i,o),r}function hs(i,t,e){e&&e.disconnect(),t==="resize"&&Vl(i)}function Wl(i,t,e){const s=i.canvas,n=kn(o=>{i.ctx!==null&&e(zl(o,i))},i);return Rl(s,t,n),n}class Ul extends ao{acquireContext(t,e){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(Ll(t,e),s):null}releaseContext(t){const e=t.canvas;if(!e[ci])return!1;const s=e[ci].initial;["height","width"].forEach(o=>{const r=s[o];T(r)?e.removeAttribute(o):e.setAttribute(o,r)});const n=s.style||{};return Object.keys(n).forEach(o=>{e.style[o]=n[o]}),e.width=e.width,delete e[ci],!0}addEventListener(t,e,s){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),r={attach:Nl,detach:jl,resize:Hl}[e]||Wl;n[e]=r(t,e,s)}removeEventListener(t,e){const s=t.$proxies||(t.$proxies={}),n=s[e];if(!n)return;({attach:hs,detach:hs,resize:hs}[e]||Fl)(t,e,n),s[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,s,n){return Yc(t,e,s,n)}isAttached(t){const e=ns(t);return!!(e&&e.isConnected)}}function Yl(i){return!ss()||typeof OffscreenCanvas!="undefined"&&i instanceof OffscreenCanvas?El:Ul}class Qt{constructor(){k(this,"x");k(this,"y");k(this,"active",!1);k(this,"options");k(this,"$animations")}tooltipPosition(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}hasValue(){return fe(this.x)&&fe(this.y)}getProps(t,e){const s=this.$animations;if(!e||!s)return this;const n={};return t.forEach(o=>{n[o]=s[o]&&s[o].active()?s[o]._to:this[o]}),n}}k(Qt,"defaults",{}),k(Qt,"defaultRoutes");function ql(i,t){const e=i.options.ticks,s=Xl(i),n=Math.min(e.maxTicksLimit||s,s),o=e.major.enabled?Gl(t):[],r=o.length,a=o[0],c=o[r-1],l=[];if(r>n)return Ql(t,l,o,r/n),l;const h=Kl(o,t,n);if(r>0){let d,u;const f=r>1?Math.round((c-a)/(r-1)):null;for(hi(t,l,h,T(f)?0:a-f,a),d=0,u=r-1;d<u;d++)hi(t,l,h,o[d],o[d+1]);return hi(t,l,h,c,T(f)?t.length:c+f),l}return hi(t,l,h),l}function Xl(i){const t=i.options.offset,e=i._tickSize(),s=i._length/e+(t?0:1),n=i._maxLength/e;return Math.floor(Math.min(s,n))}function Kl(i,t,e){const s=Zl(i),n=t.length/e;if(!s)return Math.max(n,1);const o=Na(s);for(let r=0,a=o.length-1;r<a;r++){const c=o[r];if(c>n)return c}return Math.max(n,1)}function Gl(i){const t=[];let e,s;for(e=0,s=i.length;e<s;e++)i[e].major&&t.push(e);return t}function Ql(i,t,e,s){let n=0,o=e[0],r;for(s=Math.ceil(s),r=0;r<i.length;r++)r===o&&(t.push(i[r]),n++,o=e[n*s])}function hi(i,t,e,s,n){const o=D(s,0),r=Math.min(D(n,i.length),i.length);let a=0,c,l,h;for(e=Math.ceil(e),n&&(c=n-s,e=c/Math.floor(c/e)),h=o;h<0;)a++,h=Math.round(o+a*e);for(l=Math.max(o,0);l<r;l++)l===h&&(t.push(i[l]),a++,h=Math.round(o+a*e))}function Zl(i){const t=i.length;let e,s;if(t<2)return!1;for(s=i[0],e=1;e<t;++e)if(i[e]-i[e-1]!==s)return!1;return s}const Jl=i=>i==="left"?"right":i==="right"?"left":i,fo=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,po=(i,t)=>Math.min(t||i,i);function go(i,t){const e=[],s=i.length/t,n=i.length;let o=0;for(;o<n;o+=s)e.push(i[Math.floor(o)]);return e}function th(i,t,e){const s=i.ticks.length,n=Math.min(t,s-1),o=i._startPixel,r=i._endPixel,a=1e-6;let c=i.getPixelForTick(n),l;if(!(e&&(s===1?l=Math.max(c-o,r-c):t===0?l=(i.getPixelForTick(1)-c)/2:l=(c-i.getPixelForTick(n-1))/2,c+=n<t?l:-l,c<o-a||c>r+a)))return c}function eh(i,t){W(i,e=>{const s=e.gc,n=s.length/2;let o;if(n>t){for(o=0;o<n;++o)delete e.data[s[o]];s.splice(0,n)}})}function Se(i){return i.drawTicks?i.tickLength:0}function mo(i,t){if(!i.display)return 0;const e=Xt(i.font,t),s=rt(i.padding);return(F(i.text)?i.text.length:1)*e.lineHeight+s.height}function ih(i,t){return Ot(i,{scale:t,type:"scale"})}function sh(i,t,e){return Ot(i,{tick:e,index:t,type:"tick"})}function nh(i,t,e){let s=Ga(i);return(e&&t!=="right"||!e&&t==="right")&&(s=Jl(s)),s}function oh(i,t,e,s){const{top:n,left:o,bottom:r,right:a,chart:c}=i,{chartArea:l,scales:h}=c;let d=0,u,f,p;const g=r-n,m=a-o;if(i.isHorizontal()){if(f=Sn(s,o,a),A(e)){const b=Object.keys(e)[0],_=e[b];p=h[b].getPixelForValue(_)+g-t}else e==="center"?p=(l.bottom+l.top)/2+g-t:p=fo(i,e,t);u=a-o}else{if(A(e)){const b=Object.keys(e)[0],_=e[b];f=h[b].getPixelForValue(_)-m+t}else e==="center"?f=(l.left+l.right)/2-m+t:f=fo(i,e,t);p=Sn(s,r,n),d=e==="left"?-U:U}return{titleX:f,titleY:p,maxWidth:u,rotation:d}}class Tt extends Qt{constructor(t){super();this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:s,_suggestedMax:n}=this;return t=q(t,Number.POSITIVE_INFINITY),e=q(e,Number.NEGATIVE_INFINITY),s=q(s,Number.POSITIVE_INFINITY),n=q(n,Number.NEGATIVE_INFINITY),{min:q(t,s),max:q(e,n),minDefined:B(t),maxDefined:B(e)}}getMinMax(t){let{min:e,max:s,minDefined:n,maxDefined:o}=this.getUserBounds(),r;if(n&&o)return{min:e,max:s};const a=this.getMatchingVisibleMetas();for(let c=0,l=a.length;c<l;++c)r=a[c].controller.getMinMax(this,t),n||(e=Math.min(e,r.min)),o||(s=Math.max(s,r.max));return e=o&&e>s?s:e,s=n&&e>s?e:s,{min:q(e,q(s,e)),max:q(s,q(e,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){E(this.options.beforeUpdate,[this])}update(t,e,s){const{beginAtZero:n,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=kc(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const c=a<this.ticks.length;this._convertTicksToLabels(c?go(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=ql(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),c&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,s;this.isHorizontal()?(e=this.left,s=this.right):(e=this.top,s=this.bottom,t=!t),this._startPixel=e,this._endPixel=s,this._reversePixels=t,this._length=s-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){E(this.options.afterUpdate,[this])}beforeSetDimensions(){E(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){E(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),E(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){E(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let s,n,o;for(s=0,n=t.length;s<n;s++)o=t[s],o.label=E(e.callback,[o.value,s,t],this)}afterTickToLabelConversion(){E(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){E(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,s=po(this.ticks.length,t.ticks.maxTicksLimit),n=e.minRotation||0,o=e.maxRotation;let r=n,a,c,l;if(!this._isVisible()||!e.display||n>=o||s<=1||!this.isHorizontal()){this.labelRotation=n;return}const h=this._getLabelSizes(),d=h.widest.width,u=h.highest.height,f=tt(this.chart.width-d,0,this.maxWidth);a=t.offset?this.maxWidth/s:f/(s-1),d+6>a&&(a=f/(s-(t.offset?.5:1)),c=this.maxHeight-Se(t.grid)-e.padding-mo(t.title,this.chart.options.font),l=Math.sqrt(d*d+u*u),r=Xi(Math.min(Math.asin(tt((h.highest.height+6)/a,-1,1)),Math.asin(tt(c/l,-1,1))-Math.asin(tt(u/l,-1,1)))),r=Math.max(n,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){E(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){E(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:s,title:n,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const c=mo(n,e.options.font);if(a?(t.width=this.maxWidth,t.height=Se(o)+c):(t.height=this.maxHeight,t.width=Se(o)+c),s.display&&this.ticks.length){const{first:l,last:h,widest:d,highest:u}=this._getLabelSizes(),f=s.padding*2,p=G(this.labelRotation),g=Math.cos(p),m=Math.sin(p);if(a){const b=s.mirror?0:m*d.width+g*u.height;t.height=Math.min(this.maxHeight,t.height+b+f)}else{const b=s.mirror?0:g*d.width+m*u.height;t.width=Math.min(this.maxWidth,t.width+b+f)}this._calculatePadding(l,h,m,g)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,s,n){const{ticks:{align:o,padding:r},position:a}=this.options,c=this.labelRotation!==0,l=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let u=0,f=0;c?l?(u=n*t.width,f=s*e.height):(u=s*t.height,f=n*e.width):o==="start"?f=e.width:o==="end"?u=t.width:o!=="inner"&&(u=t.width/2,f=e.width/2),this.paddingLeft=Math.max((u-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-d+r)*this.width/(this.width-d),0)}else{let h=e.height/2,d=t.height/2;o==="start"?(h=0,d=t.height):o==="end"&&(h=e.height,d=0),this.paddingTop=h+r,this.paddingBottom=d+r}}_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(){E(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,s;for(e=0,s=t.length;e<s;e++)T(t[e].label)&&(t.splice(e,1),s--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let s=this.ticks;e<s.length&&(s=go(s,e)),this._labelSizes=t=this._computeLabelSizes(s,s.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,s){const{ctx:n,_longestTextCache:o}=this,r=[],a=[],c=Math.floor(e/po(e,s));let l=0,h=0,d,u,f,p,g,m,b,_,v,M,y;for(d=0;d<e;d+=c){if(p=t[d].label,g=this._resolveTickFontOptions(d),n.font=m=g.string,b=o[m]=o[m]||{data:{},gc:[]},_=g.lineHeight,v=M=0,!T(p)&&!F(p))v=Qe(n,b.data,b.gc,v,p),M=_;else if(F(p))for(u=0,f=p.length;u<f;++u)y=p[u],!T(y)&&!F(y)&&(v=Qe(n,b.data,b.gc,v,y),M+=_);r.push(v),a.push(M),l=Math.max(v,l),h=Math.max(M,h)}eh(o,e);const x=r.indexOf(l),w=a.indexOf(h),S=O=>({width:r[O]||0,height:a[O]||0});return{first:S(0),last:S(e-1),widest:S(x),highest:S(w),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Ha(this._alignToPixels?Mt(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const s=e[t];return s.$context||(s.$context=sh(this.getContext(),t,s))}return this.$context||(this.$context=ih(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=G(this.labelRotation),s=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),o=this._getLabelSizes(),r=t.autoSkipPadding||0,a=o?o.widest.width+r:0,c=o?o.highest.height+r:0;return this.isHorizontal()?c*s>a*n?a/s:c/n:c*n<a*s?c/s:a/n}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,s=this.chart,n=this.options,{grid:o,position:r,border:a}=n,c=o.offset,l=this.isHorizontal(),d=this.ticks.length+(c?1:0),u=Se(o),f=[],p=a.setContext(this.getContext()),g=p.display?p.width:0,m=g/2,b=function(V){return Mt(s,V,g)};let _,v,M,y,x,w,S,O,P,I,j,Z;if(r==="top")_=b(this.bottom),w=this.bottom-u,O=_-m,I=b(t.top)+m,Z=t.bottom;else if(r==="bottom")_=b(this.top),I=t.top,Z=b(t.bottom)-m,w=_+m,O=this.top+u;else if(r==="left")_=b(this.right),x=this.right-u,S=_-m,P=b(t.left)+m,j=t.right;else if(r==="right")_=b(this.left),P=t.left,j=b(t.right)-m,x=_+m,S=this.left+u;else if(e==="x"){if(r==="center")_=b((t.top+t.bottom)/2+.5);else if(A(r)){const V=Object.keys(r)[0],X=r[V];_=b(this.chart.scales[V].getPixelForValue(X))}I=t.top,Z=t.bottom,w=_+m,O=w+u}else if(e==="y"){if(r==="center")_=b((t.left+t.right)/2);else if(A(r)){const V=Object.keys(r)[0],X=r[V];_=b(this.chart.scales[V].getPixelForValue(X))}x=_-m,S=x-u,P=t.left,j=t.right}const ht=D(n.ticks.maxTicksLimit,d),L=Math.max(1,Math.ceil(d/ht));for(v=0;v<d;v+=L){const V=this.getContext(v),X=o.setContext(V),Fe=a.setContext(V),ze=X.lineWidth,Ft=X.color,Ne=Fe.dash||[],zt=Fe.dashOffset,te=X.tickWidth,yt=X.tickColor,ee=X.tickBorderDash||[],xt=X.tickBorderDashOffset;M=th(this,v,c),M!==void 0&&(y=Mt(s,M,ze),l?x=S=P=j=y:w=O=I=Z=y,f.push({tx1:x,ty1:w,tx2:S,ty2:O,x1:P,y1:I,x2:j,y2:Z,width:ze,color:Ft,borderDash:Ne,borderDashOffset:zt,tickWidth:te,tickColor:yt,tickBorderDash:ee,tickBorderDashOffset:xt}))}return this._ticksLength=d,this._borderValue=_,f}_computeLabelItems(t){const e=this.axis,s=this.options,{position:n,ticks:o}=s,r=this.isHorizontal(),a=this.ticks,{align:c,crossAlign:l,padding:h,mirror:d}=o,u=Se(s.grid),f=u+h,p=d?-h:f,g=-G(this.labelRotation),m=[];let b,_,v,M,y,x,w,S,O,P,I,j,Z="middle";if(n==="top")x=this.bottom-p,w=this._getXAxisLabelAlignment();else if(n==="bottom")x=this.top+p,w=this._getXAxisLabelAlignment();else if(n==="left"){const L=this._getYAxisLabelAlignment(u);w=L.textAlign,y=L.x}else if(n==="right"){const L=this._getYAxisLabelAlignment(u);w=L.textAlign,y=L.x}else if(e==="x"){if(n==="center")x=(t.top+t.bottom)/2+f;else if(A(n)){const L=Object.keys(n)[0],V=n[L];x=this.chart.scales[L].getPixelForValue(V)+f}w=this._getXAxisLabelAlignment()}else if(e==="y"){if(n==="center")y=(t.left+t.right)/2-f;else if(A(n)){const L=Object.keys(n)[0],V=n[L];y=this.chart.scales[L].getPixelForValue(V)}w=this._getYAxisLabelAlignment(u).textAlign}e==="y"&&(c==="start"?Z="top":c==="end"&&(Z="bottom"));const ht=this._getLabelSizes();for(b=0,_=a.length;b<_;++b){v=a[b],M=v.label;const L=o.setContext(this.getContext(b));S=this.getPixelForTick(b)+o.labelOffset,O=this._resolveTickFontOptions(b),P=O.lineHeight,I=F(M)?M.length:1;const V=I/2,X=L.color,Fe=L.textStrokeColor,ze=L.textStrokeWidth;let Ft=w;r?(y=S,w==="inner"&&(b===_-1?Ft=this.options.reverse?"left":"right":b===0?Ft=this.options.reverse?"right":"left":Ft="center"),n==="top"?l==="near"||g!==0?j=-I*P+P/2:l==="center"?j=-ht.highest.height/2-V*P+P:j=-ht.highest.height+P/2:l==="near"||g!==0?j=P/2:l==="center"?j=ht.highest.height/2-V*P:j=ht.highest.height-I*P,d&&(j*=-1),g!==0&&!L.showLabelBackdrop&&(y+=P/2*Math.sin(g))):(x=S,j=(1-I)*P/2);let Ne;if(L.showLabelBackdrop){const zt=rt(L.backdropPadding),te=ht.heights[b],yt=ht.widths[b];let ee=j-zt.top,xt=0-zt.left;switch(Z){case"middle":ee-=te/2;break;case"bottom":ee-=te;break}switch(w){case"center":xt-=yt/2;break;case"right":xt-=yt;break;case"inner":b===_-1?xt-=yt:b>0&&(xt-=yt/2);break}Ne={left:xt,top:ee,width:yt+zt.width,height:te+zt.height,color:L.backdropColor}}m.push({label:M,font:O,textOffset:j,options:{rotation:g,color:X,strokeColor:Fe,strokeWidth:ze,textAlign:Ft,textBaseline:Z,translation:[y,x],backdrop:Ne}})}return m}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-G(this.labelRotation))return t==="top"?"left":"right";let n="center";return e.align==="start"?n="left":e.align==="end"?n="right":e.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:s,mirror:n,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,c=r.widest.width;let l,h;return e==="left"?n?(h=this.right+o,s==="near"?l="left":s==="center"?(l="center",h+=c/2):(l="right",h+=c)):(h=this.right-a,s==="near"?l="right":s==="center"?(l="center",h-=c/2):(l="left",h=this.left)):e==="right"?n?(h=this.left+o,s==="near"?l="right":s==="center"?(l="center",h-=c/2):(l="left",h-=c)):(h=this.left+a,s==="near"?l="left":s==="center"?(l="center",h+=c/2):(l="right",h=this.right)):l="right",{textAlign:l,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:s,top:n,width:o,height:r}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(s,n,o,r),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const n=this.ticks.findIndex(o=>o.value===t);return n>=0?e.setContext(this.getContext(n)).lineWidth:0}drawGrid(t){const e=this.options.grid,s=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(c,l,h)=>{!h.width||!h.color||(s.save(),s.lineWidth=h.width,s.strokeStyle=h.color,s.setLineDash(h.borderDash||[]),s.lineDashOffset=h.borderDashOffset,s.beginPath(),s.moveTo(c.x,c.y),s.lineTo(l.x,l.y),s.stroke(),s.restore())};if(e.display)for(o=0,r=n.length;o<r;++o){const c=n[o];e.drawOnChartArea&&a({x:c.x1,y:c.y1},{x:c.x2,y:c.y2},c),e.drawTicks&&a({x:c.tx1,y:c.ty1},{x:c.tx2,y:c.ty2},{color:c.tickColor,width:c.tickWidth,borderDash:c.tickBorderDash,borderDashOffset:c.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:s,grid:n}}=this,o=s.setContext(this.getContext()),r=s.display?o.width:0;if(!r)return;const a=n.setContext(this.getContext(0)).lineWidth,c=this._borderValue;let l,h,d,u;this.isHorizontal()?(l=Mt(t,this.left,r)-r/2,h=Mt(t,this.right,a)+a/2,d=u=c):(d=Mt(t,this.top,r)-r/2,u=Mt(t,this.bottom,a)+a/2,l=h=c),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(l,d),e.lineTo(h,u),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const s=this.ctx,n=this._computeLabelArea();n&&Dn(s,n);const o=this.getLabelItems(t);for(const r of o){const a=r.options,c=r.font,l=r.label,h=r.textOffset;Ze(s,l,0,h,c,a)}n&&Tn(s)}drawTitle(){const{ctx:t,options:{position:e,title:s,reverse:n}}=this;if(!s.display)return;const o=Xt(s.font),r=rt(s.padding),a=s.align;let c=o.lineHeight/2;e==="bottom"||e==="center"||A(e)?(c+=r.bottom,F(s.text)&&(c+=o.lineHeight*(s.text.length-1))):c+=r.top;const{titleX:l,titleY:h,maxWidth:d,rotation:u}=oh(this,c,e,a);Ze(t,s.text,0,0,o,{color:s.color,maxWidth:d,rotation:u,textAlign:nh(a,e,n),textBaseline:"middle",translation:[l,h]})}draw(t){!this._isVisible()||(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,s=D(t.grid&&t.grid.z,-1),n=D(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==Tt.prototype.draw?[{z:e,draw:o=>{this.draw(o)}}]:[{z:s,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",n=[];let o,r;for(o=0,r=e.length;o<r;++o){const a=e[o];a[s]===this.id&&(!t||a.type===t)&&n.push(a)}return n}_resolveTickFontOptions(t){const e=this.options.ticks.setContext(this.getContext(t));return Xt(e.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class di{constructor(t,e,s){this.type=t,this.scope=e,this.override=s,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let s;ch(e)&&(s=this.register(e));const n=this.items,o=t.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in n||(n[o]=t,rh(t,r,s),this.override&&N.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){const e=this.items,s=t.id,n=this.scope;s in e&&delete e[s],n&&s in N[n]&&(delete N[n][s],this.override&&delete St[s])}}function rh(i,t,e){const s=he(Object.create(null),[e?N.get(e):{},N.get(t),i.defaults]);N.set(t,s),i.defaultRoutes&&ah(t,i.defaultRoutes),i.descriptors&&N.describe(t,i.descriptors)}function ah(i,t){Object.keys(t).forEach(e=>{const s=e.split("."),n=s.pop(),o=[i].concat(s).join("."),r=t[e].split("."),a=r.pop(),c=r.join(".");N.route(o,n,c,a)})}function ch(i){return"id"in i&&"defaults"in i}class lh{constructor(){this.controllers=new di($t,"datasets",!0),this.elements=new di(Qt,"elements"),this.plugins=new di(Object,"plugins"),this.scales=new di(Tt,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,s){[...e].forEach(n=>{const o=s||this._getRegistryForType(n);s||o.isForType(n)||o===this.plugins&&n.id?this._exec(t,o,n):W(n,r=>{const a=s||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,s){const n=qi(t);E(s["before"+n],[],s),e[t](s),E(s["after"+n],[],s)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const s=this._typedRegistries[e];if(s.isForType(t))return s}return this.plugins}_get(t,e,s){const n=e.get(t);if(n===void 0)throw new Error('"'+t+'" is not a registered '+s+".");return n}}var et=new lh;class hh{constructor(){this._init=[]}notify(t,e,s,n){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=n?this._descriptors(t).filter(n):this._descriptors(t),r=this._notify(o,t,e,s);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),r}_notify(t,e,s,n){n=n||{};for(const o of t){const r=o.plugin,a=r[s],c=[e,n,o.options];if(E(a,c,r)===!1&&n.cancelable)return!1}return!0}invalidate(){T(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const s=t&&t.config,n=D(s.options&&s.options.plugins,{}),o=dh(s);return n===!1&&!e?[]:fh(t,o,n,e)}_notifyStateChanges(t){const e=this._oldCache||[],s=this._cache,n=(o,r)=>o.filter(a=>!r.some(c=>a.plugin.id===c.plugin.id));this._notify(n(e,s),t,"stop"),this._notify(n(s,e),t,"start")}}function dh(i){const t={},e=[],s=Object.keys(et.plugins.items);for(let o=0;o<s.length;o++)e.push(et.getPlugin(s[o]));const n=i.plugins||[];for(let o=0;o<n.length;o++){const r=n[o];e.indexOf(r)===-1&&(e.push(r),t[r.id]=!0)}return{plugins:e,localIds:t}}function uh(i,t){return!t&&i===!1?null:i===!0?{}:i}function fh(i,{plugins:t,localIds:e},s,n){const o=[],r=i.getContext();for(const a of t){const c=a.id,l=uh(s[c],n);l!==null&&o.push({plugin:a,options:ph(i.config,{plugin:a,local:e[c]},l,r)})}return o}function ph(i,{plugin:t,local:e},s,n){const o=i.pluginScopeKeys(t),r=i.getOptionScopes(s,o);return e&&t.defaults&&r.push(t.defaults),i.createResolver(r,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function ds(i,t){const e=N.datasets[i]||{};return((t.datasets||{})[i]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function gh(i,t){let e=i;return i==="_index_"?e=t:i==="_value_"&&(e=t==="x"?"y":"x"),e}function mh(i,t){return i===t?"_index_":"_value_"}function bo(i){if(i==="x"||i==="y"||i==="r")return i}function bh(i){if(i==="top"||i==="bottom")return"x";if(i==="left"||i==="right")return"y"}function us(i,...t){if(bo(i))return i;for(const e of t){const s=e.axis||bh(e.position)||i.length>1&&bo(i[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function _o(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function _h(i,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(s=>s.xAxisID===i||s.yAxisID===i);if(e.length)return _o(i,"x",e[0])||_o(i,"y",e[0])}return{}}function yh(i,t){const e=St[i.type]||{scales:{}},s=t.scales||{},n=ds(i.type,t),o=Object.create(null);return Object.keys(s).forEach(r=>{const a=s[r];if(!A(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const c=us(r,a,_h(r,i),N.scales[a.type]),l=mh(c,n),h=e.scales||{};o[r]=de(Object.create(null),[{axis:c},a,h[c],h[l]])}),i.data.datasets.forEach(r=>{const a=r.type||i.type,c=r.indexAxis||ds(a,t),h=(St[a]||{}).scales||{};Object.keys(h).forEach(d=>{const u=gh(d,c),f=r[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),de(o[f],[{axis:u},s[f],h[d]])})}),Object.keys(o).forEach(r=>{const a=o[r];de(a,[N.scales[a.type],N.scale])}),o}function yo(i){const t=i.options||(i.options={});t.plugins=D(t.plugins,{}),t.scales=yh(i,t)}function xo(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function xh(i){return i=i||{},i.data=xo(i.data),yo(i),i}const vo=new Map,wo=new Set;function ui(i,t){let e=vo.get(i);return e||(e=t(),vo.set(i,e),wo.add(e)),e}const Me=(i,t,e)=>{const s=Yt(t,e);s!==void 0&&i.add(s)};class vh{constructor(t){this._config=xh(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=xo(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),yo(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return ui(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return ui(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return ui(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,s=this.type;return ui(`${s}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const s=this._scopeCache;let n=s.get(t);return(!n||e)&&(n=new Map,s.set(t,n)),n}getOptionScopes(t,e,s){const{options:n,type:o}=this,r=this._cachedScopes(t,s),a=r.get(e);if(a)return a;const c=new Set;e.forEach(h=>{t&&(c.add(t),h.forEach(d=>Me(c,t,d))),h.forEach(d=>Me(c,n,d)),h.forEach(d=>Me(c,St[o]||{},d)),h.forEach(d=>Me(c,N,d)),h.forEach(d=>Me(c,Zi,d))});const l=Array.from(c);return l.length===0&&l.push(Object.create(null)),wo.has(e)&&r.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,St[e]||{},N.datasets[e]||{},{type:e},N,Zi]}resolveNamedOptions(t,e,s,n=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=ko(this._resolverCache,t,n);let c=r;if(kh(r,e)){o.$shared=!1,s=mt(s)?s():s;const l=this.createResolver(t,s,a);c=Kt(r,s,l)}for(const l of e)o[l]=c[l];return o}createResolver(t,e,s=[""],n){const{resolver:o}=ko(this._resolverCache,t,s);return A(e)?Kt(o,e,void 0,n):o}}function ko(i,t,e){let s=i.get(t);s||(s=new Map,i.set(t,s));const n=e.join();let o=s.get(n);return o||(o={resolver:ts(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},s.set(n,o)),o}const wh=i=>A(i)&&Object.getOwnPropertyNames(i).some(t=>mt(i[t]));function kh(i,t){const{isScriptable:e,isIndexable:s}=In(i);for(const n of t){const o=e(n),r=s(n),a=(r||o)&&i[n];if(o&&(mt(a)||wh(a))||r&&F(a))return!0}return!1}var Sh="4.4.1";const Mh=["top","bottom","left","right","chartArea"];function So(i,t){return i==="top"||i==="bottom"||Mh.indexOf(i)===-1&&t==="x"}function Mo(i,t){return function(e,s){return e[i]===s[i]?e[t]-s[t]:e[i]-s[i]}}function Oo(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),E(e&&e.onComplete,[i],t)}function Oh(i){const t=i.chart,e=t.options.animation;E(e&&e.onProgress,[i],t)}function Co(i){return ss()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const fi={},Ao=i=>{const t=Co(i);return Object.values(fi).filter(e=>e.canvas===t).pop()};function Ch(i,t,e){const s=Object.keys(i);for(const n of s){const o=+n;if(o>=t){const r=i[n];delete i[n],(e>0||o>t)&&(i[o+e]=r)}}}function Ah(i,t,e,s){return!e||i.type==="mouseout"?null:s?t:i}function pi(i,t,e){return i.options.clip?i[e]:t[e]}function Ph(i,t){const{xScale:e,yScale:s}=i;return e&&s?{left:pi(e,t,"left"),right:pi(e,t,"right"),top:pi(s,t,"top"),bottom:pi(s,t,"bottom")}:t}class ct{static register(...t){et.add(...t),Po()}static unregister(...t){et.remove(...t),Po()}constructor(t,e){const s=this.config=new vh(e),n=Co(t),o=Ao(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||Yl(n)),this.platform.updateConfig(s);const a=this.platform.acquireContext(n,r.aspectRatio),c=a&&a.canvas,l=c&&c.height,h=c&&c.width;if(this.id=$a(),this.ctx=a,this.canvas=c,this.width=h,this.height=l,this._options=r,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 hh,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Ka(d=>this.update(d),r.resizeDelay||0),this._dataChanges=[],fi[this.id]=this,!a||!c){console.error("Failed to create chart: can't acquire context from the given item");return}at.listen(this,"complete",Oo),at.listen(this,"progress",Oh),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:s,height:n,_aspectRatio:o}=this;return T(t)?e&&o?o:n?s/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return et}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Bn(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return $n(this.canvas,this.ctx),this}stop(){return at.stop(this),this}resize(t,e){at.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const s=this.options,n=this.canvas,o=s.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(n,t,e,o),a=s.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,!!Bn(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),E(s.onResize,[this,r],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};W(e,(s,n)=>{s.id=n})}buildOrUpdateScales(){const t=this.options,e=t.scales,s=this.scales,n=Object.keys(s).reduce((r,a)=>(r[a]=!1,r),{});let o=[];e&&(o=o.concat(Object.keys(e).map(r=>{const a=e[r],c=us(r,a),l=c==="r",h=c==="x";return{options:a,dposition:l?"chartArea":h?"bottom":"left",dtype:l?"radialLinear":h?"category":"linear"}}))),W(o,r=>{const a=r.options,c=a.id,l=us(c,a),h=D(a.type,r.dtype);(a.position===void 0||So(a.position,l)!==So(r.dposition))&&(a.position=r.dposition),n[c]=!0;let d=null;if(c in s&&s[c].type===h)d=s[c];else{const u=et.getScale(h);d=new u({id:c,type:h,ctx:this.ctx,chart:this}),s[d.id]=d}d.init(a,t)}),W(n,(r,a)=>{r||delete s[a]}),W(s,r=>{ai.configure(this,r,r.options),ai.addBox(this,r)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,s=t.length;if(t.sort((n,o)=>n.index-o.index),s>e){for(let n=e;n<s;++n)this._destroyDatasetMeta(n);t.splice(e,s-e)}this._sortedMetasets=t.slice(0).sort(Mo("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((s,n)=>{e.filter(o=>o===s._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let s,n;for(this._removeUnreferencedMetasets(),s=0,n=e.length;s<n;s++){const o=e[s];let r=this.getDatasetMeta(s);const a=o.type||this.config.type;if(r.type&&r.type!==a&&(this._destroyDatasetMeta(s),r=this.getDatasetMeta(s)),r.type=a,r.indexAxis=o.indexAxis||ds(a,this.options),r.order=o.order||0,r.index=s,r.label=""+o.label,r.visible=this.isDatasetVisible(s),r.controller)r.controller.updateIndex(s),r.controller.linkScales();else{const c=et.getController(a),{datasetElementType:l,dataElementType:h}=N.datasets[a];Object.assign(c,{dataElementType:et.getElement(h),datasetElementType:l&&et.getElement(l)}),r.controller=new c(this,s),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){W(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const s=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let l=0,h=this.data.datasets.length;l<h;l++){const{controller:d}=this.getDatasetMeta(l),u=!n&&o.indexOf(d)===-1;d.buildOrUpdateElements(u),r=Math.max(+d.getMaxOverflow(),r)}r=this._minPadding=s.layout.autoPadding?r:0,this._updateLayout(r),n||W(o,l=>{l.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Mo("z","_idx"));const{_active:a,_lastEvent:c}=this;c?this._eventHandler(c,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){W(this.scales,t=>{ai.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!pn(e,s)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:s,start:n,count:o}of e){const r=s==="_removeElements"?-o:o;Ch(t,n,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,s=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),n=s(0);for(let o=1;o<e;o++)if(!pn(n,s(o)))return;return Array.from(n).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;ai.update(this,this.width,this.height,t);const e=this.chartArea,s=e.width<=0||e.height<=0;this._layers=[],W(this.boxes,n=>{s&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,o)=>{n._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,s=this.data.datasets.length;e<s;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,s=this.data.datasets.length;e<s;++e)this._updateDataset(e,mt(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const s=this.getDatasetMeta(t),n={meta:s,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",n)!==!1&&(s.controller._update(e),n.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",n))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(at.has(this)?this.attached&&!at.running(this)&&at.start(this):(this.draw(),Oo({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:s,height:n}=this._resizeBeforeDraw;this._resize(s,n),this._resizeBeforeDraw=null}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,s=[];let n,o;for(n=0,o=e.length;n<o;++n){const r=e[n];(!t||r.visible)&&s.push(r)}return s}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,s=t._clip,n=!s.disabled,o=Ph(t,this.chartArea),r={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(n&&Dn(e,{left:s.left===!1?0:o.left-s.left,right:s.right===!1?this.width:o.right+s.right,top:s.top===!1?0:o.top-s.top,bottom:s.bottom===!1?this.height:o.bottom+s.bottom}),t.controller.draw(),n&&Tn(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return ot(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,s,n){const o=Ml.modes[e];return typeof o=="function"?o(this,t,s,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],s=this._metasets;let n=s.filter(o=>o&&o._dataset===e).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},s.push(n)),n}getContext(){return this.$context||(this.$context=Ot(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!e.hidden}setDatasetVisibility(t,e){const s=this.getDatasetMeta(t);s.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,s){const n=s?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,n);Ye(e)?(o.data[e].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),r.update(o,{visible:s}),this.update(a=>a.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),at.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),$n(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete fi[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,s=(o,r)=>{e.addEventListener(this,o,r),t[o]=r},n=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};W(this.options.events,o=>s(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,s=(c,l)=>{e.addEventListener(this,c,l),t[c]=l},n=(c,l)=>{t[c]&&(e.removeEventListener(this,c,l),delete t[c])},o=(c,l)=>{this.canvas&&this.resize(c,l)};let r;const a=()=>{n("attach",a),this.attached=!0,this.resize(),s("resize",o),s("detach",r)};r=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),s("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){W(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},W(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,s){const n=s?"set":"remove";let o,r,a,c;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),a=0,c=t.length;a<c;++a){r=t[a];const l=r&&this.getDatasetMeta(r.datasetIndex).controller;l&&l[n+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],s=t.map(({datasetIndex:o,index:r})=>{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!dn(s,e)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,e))}notifyPlugins(t,e,s){return this._plugins.notify(this,t,e,s)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,s){const n=this.options.hover,o=(c,l)=>c.filter(h=>!l.some(d=>h.datasetIndex===d.datasetIndex&&h.index===d.index)),r=o(e,t),a=s?t:o(t,e);r.length&&this.updateHoverStyle(r,n.mode,!1),a.length&&n.mode&&this.updateHoverStyle(a,n.mode,!0)}_eventHandler(t,e){const s={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",s,n)===!1)return;const o=this._handleEvent(t,e,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,n),(o||s.changed)&&this.render(),this}_handleEvent(t,e,s){const{_active:n=[],options:o}=this,r=e,a=this._getActiveElements(t,n,s,r),c=Ra(t),l=Ah(t,this._lastEvent,s,c);s&&(this._lastEvent=null,E(o.onHover,[t,a,this],this),c&&E(o.onClick,[t,a,this],this));const h=!dn(a,n);return(h||e)&&(this._active=a,this._updateHoverStyles(a,n,e)),this._lastEvent=l,h}_getActiveElements(t,e,s,n){if(t.type==="mouseout")return[];if(!s)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}}k(ct,"defaults",N),k(ct,"instances",fi),k(ct,"overrides",St),k(ct,"registry",et),k(ct,"version",Sh),k(ct,"getChart",Ao);function Po(){return W(ct.instances,i=>i._plugins.invalidate())}function $o(i,t,e=t){i.lineCap=D(e.borderCapStyle,t.borderCapStyle),i.setLineDash(D(e.borderDash,t.borderDash)),i.lineDashOffset=D(e.borderDashOffset,t.borderDashOffset),i.lineJoin=D(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=D(e.borderWidth,t.borderWidth),i.strokeStyle=D(e.borderColor,t.borderColor)}function $h(i,t,e){i.lineTo(e.x,e.y)}function Dh(i){return i.stepped?dc:i.tension||i.cubicInterpolationMode==="monotone"?uc:$h}function Do(i,t,e={}){const s=i.length,{start:n=0,end:o=s-1}=e,{start:r,end:a}=t,c=Math.max(n,r),l=Math.min(o,a),h=n<r&&o<r||n>a&&o>a;return{count:s,start:c,loop:t.loop,ilen:l<c&&!h?s+l-c:l-c}}function Th(i,t,e,s){const{points:n,options:o}=t,{count:r,start:a,loop:c,ilen:l}=Do(n,e,s),h=Dh(o);let{move:d=!0,reverse:u}=s||{},f,p,g;for(f=0;f<=l;++f)p=n[(a+(u?l-f:f))%r],!p.skip&&(d?(i.moveTo(p.x,p.y),d=!1):h(i,g,p,u,o.stepped),g=p);return c&&(p=n[(a+(u?l:0))%r],h(i,g,p,u,o.stepped)),!!c}function Eh(i,t,e,s){const n=t.points,{count:o,start:r,ilen:a}=Do(n,e,s),{move:c=!0,reverse:l}=s||{};let h=0,d=0,u,f,p,g,m,b;const _=M=>(r+(l?a-M:M))%o,v=()=>{g!==m&&(i.lineTo(h,m),i.lineTo(h,g),i.lineTo(h,b))};for(c&&(f=n[_(0)],i.moveTo(f.x,f.y)),u=0;u<=a;++u){if(f=n[_(u)],f.skip)continue;const M=f.x,y=f.y,x=M|0;x===p?(y<g?g=y:y>m&&(m=y),h=(d*h+M)/++d):(v(),i.lineTo(M,y),p=x,d=0,g=m=y),b=y}v()}function fs(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Eh:Th}function Ih(i){return i.stepped?Xc:i.tension||i.cubicInterpolationMode==="monotone"?Kc:Pt}function Lh(i,t,e,s){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,s)&&n.closePath()),$o(i,t.options),i.stroke(n)}function Rh(i,t,e,s){const{segments:n,options:o}=t,r=fs(t);for(const a of n)$o(i,o,a.style),i.beginPath(),r(i,t,a,{start:e,end:e+s-1})&&i.closePath(),i.stroke()}const Fh=typeof Path2D=="function";function zh(i,t,e,s){Fh&&!t.options.segment?Lh(i,t,e,s):Rh(i,t,e,s)}class Oe extends Qt{constructor(t){super();this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const s=this.options;if((s.tension||s.cubicInterpolationMode==="monotone")&&!s.stepped&&!this._pointsUpdated){const n=s.spanGaps?this._loop:this._fullLoop;jc(this._points,s,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=el(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,s=t.length;return s&&e[t[s-1].end]}interpolate(t,e){const s=this.options,n=t[e],o=this.points,r=Zc(this,{property:e,start:n,end:n});if(!r.length)return;const a=[],c=Ih(s);let l,h;for(l=0,h=r.length;l<h;++l){const{start:d,end:u}=r[l],f=o[d],p=o[u];if(f===p){a.push(f);continue}const g=Math.abs((n-f[e])/(p[e]-f[e])),m=c(f,p,g,s.stepped);m[e]=t[e],a.push(m)}return a.length===1?a[0]:a}pathSegment(t,e,s){return fs(this)(t,this,e,s)}path(t,e,s){const n=this.segments,o=fs(this);let r=this._loop;e=e||0,s=s||this.points.length-e;for(const a of n)r&=o(t,this,a,{start:e,end:e+s-1});return!!r}draw(t,e,s,n){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),zh(t,this,s,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}k(Oe,"id","line"),k(Oe,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),k(Oe,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),k(Oe,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function To(i,t,e,s){const n=i.options,{[e]:o}=i.getProps([e],s);return Math.abs(t-o)<n.radius+n.hitRadius}class gi extends Qt{constructor(t){super();k(this,"parsed");k(this,"skip");k(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,s){const n=this.options,{x:o,y:r}=this.getProps(["x","y"],s);return Math.pow(t-o,2)+Math.pow(e-r,2)<Math.pow(n.hitRadius+n.radius,2)}inXRange(t,e){return To(this,t,"x",e)}inYRange(t,e){return To(this,t,"y",e)}getCenterPoint(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}size(t){t=t||this.options||{};let e=t.radius||0;e=Math.max(e,e&&t.hoverRadius||0);const s=e&&t.borderWidth||0;return(e+s)*2}draw(t,e){const s=this.options;this.skip||s.radius<.1||!ot(this,e,this.size(s)/2)||(t.strokeStyle=s.borderColor,t.lineWidth=s.borderWidth,t.fillStyle=s.backgroundColor,lc(t,s,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}k(gi,"id","point"),k(gi,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),k(gi,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});const ps=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],Eo=ps.map(i=>i.replace("rgb(","rgba(").replace(")",", 0.5)"));function Io(i){return ps[i%ps.length]}function Lo(i){return Eo[i%Eo.length]}function Nh(i,t){return i.borderColor=Io(t),i.backgroundColor=Lo(t),++t}function jh(i,t){return i.backgroundColor=i.data.map(()=>Io(t++)),t}function Bh(i,t){return i.backgroundColor=i.data.map(()=>Lo(t++)),t}function Vh(i){let t=0;return(e,s)=>{const n=i.getDatasetMeta(s).controller;n instanceof _e?t=jh(e,t):n instanceof oi?t=Bh(e,t):n&&(t=Nh(e,t))}}function Ro(i){let t;for(t in i)if(i[t].borderColor||i[t].backgroundColor)return!0;return!1}function Hh(i){return i&&(i.borderColor||i.backgroundColor)}var Wh={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(i,t,e){if(!e.enabled)return;const{data:{datasets:s},options:n}=i.config,{elements:o}=n;if(!e.forceOverride&&(Ro(s)||Hh(n)||o&&Ro(o)))return;const r=Vh(i);s.forEach(r)}};const Uh=(i,t,e,s)=>(typeof t=="string"?(e=i.push(t)-1,s.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function Yh(i,t,e,s){const n=i.indexOf(t);if(n===-1)return Uh(i,t,e,s);const o=i.lastIndexOf(t);return n!==o?e:n}const qh=(i,t)=>i===null?null:tt(Math.round(i),0,t);function Fo(i){const t=this.getLabels();return i>=0&&i<t.length?t[i]:i}class gs extends Tt{constructor(t){super(t);this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const s=this.getLabels();for(const{index:n,label:o}of e)s[n]===o&&s.splice(n,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(T(t))return null;const s=this.getLabels();return e=isFinite(e)&&s[e]===t?e:Yh(s,t,D(e,t),this._addedLabels),qh(e,s.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:s,max:n}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(s=0),e||(n=this.getLabels().length-1)),this.min=s,this.max=n}buildTicks(){const t=this.min,e=this.max,s=this.options.offset,n=[];let o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(s?0:1),1),this._startValue=this.min-(s?.5:0);for(let r=t;r<=e;r++)n.push({value:r});return n}getLabelForValue(t){return Fo.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}k(gs,"id","category"),k(gs,"defaults",{ticks:{callback:Fo}});function Xh(i,t){const e=[],s=1e-14,{bounds:n,step:o,min:r,max:a,precision:c,count:l,maxTicks:h,maxDigits:d,includeBounds:u}=i,f=o||1,p=h-1,{min:g,max:m}=t,b=!T(r),_=!T(a),v=!T(l),M=(m-g)/(d+1);let y=mn((m-g)/p/f)*f,x,w,S,O;if(y<s&&!b&&!_)return[{value:g},{value:m}];O=Math.ceil(m/y)-Math.floor(g/y),O>p&&(y=mn(O*y/p/f)*f),T(c)||(x=Math.pow(10,c),y=Math.ceil(y*x)/x),n==="ticks"?(w=Math.floor(g/y)*y,S=Math.ceil(m/y)*y):(w=g,S=m),b&&_&&o&&ja((a-r)/o,y/1e3)?(O=Math.round(Math.min((a-r)/y,h)),y=(a-r)/O,w=r,S=a):v?(w=b?r:w,S=_?a:S,O=l-1,y=(S-w)/O):(O=(S-w)/y,ue(O,Math.round(O),y/1e3)?O=Math.round(O):O=Math.ceil(O));const P=Math.max(_n(y),_n(w));x=Math.pow(10,T(c)?P:c),w=Math.round(w*x)/x,S=Math.round(S*x)/x;let I=0;for(b&&(u&&w!==r?(e.push({value:r}),w<r&&I++,ue(Math.round((w+I*y)*x)/x,r,zo(r,M,i))&&I++):w<r&&I++);I<O;++I){const j=Math.round((w+I*y)*x)/x;if(_&&j>a)break;e.push({value:j})}return _&&u&&S!==a?e.length&&ue(e[e.length-1].value,a,zo(a,M,i))?e[e.length-1].value=a:e.push({value:a}):(!_||S===a)&&e.push({value:S}),e}function zo(i,t,{horizontal:e,minRotation:s}){const n=G(s),o=(e?Math.sin(n):Math.cos(n))||.001,r=.75*t*(""+i).length;return Math.min(t/o,r)}class mi extends Tt{constructor(t){super(t);this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return T(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:s}=this.getUserBounds();let{min:n,max:o}=this;const r=c=>n=e?n:c,a=c=>o=s?o:c;if(t){const c=qt(n),l=qt(o);c<0&&l<0?a(0):c>0&&l>0&&r(0)}if(n===o){let c=o===0?1:Math.abs(o*.05);a(o+c),t||r(n-c)}this.min=n,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:s}=t,n;return s?(n=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const n={maxTicks:s,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=Xh(n,o);return t.bounds==="ticks"&&bn(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let e=this.min,s=this.max;if(super.configure(),this.options.offset&&t.length){const n=(s-e)/Math.max(t.length-1,1)/2;e-=n,s+=n}this._startValue=e,this._endValue=s,this._valueRange=s-e}getLabelForValue(t){return ge(t,this.chart.options.locale,this.options.ticks.format)}}class ms extends mi{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=B(t)?t:0,this.max=B(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,s=G(this.options.ticks.minRotation),n=(t?Math.sin(s):Math.cos(s))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}k(ms,"id","linear"),k(ms,"defaults",{ticks:{callback:Ge.formatters.numeric}});const Ce=i=>Math.floor(bt(i)),Et=(i,t)=>Math.pow(10,Ce(i)+t);function No(i){return i/Math.pow(10,Ce(i))===1}function jo(i,t,e){const s=Math.pow(10,e),n=Math.floor(i/s);return Math.ceil(t/s)-n}function Kh(i,t){const e=t-i;let s=Ce(e);for(;jo(i,t,s)>10;)s++;for(;jo(i,t,s)<10;)s--;return Math.min(s,Ce(i))}function Gh(i,{min:t,max:e}){t=q(i.min,t);const s=[],n=Ce(t);let o=Kh(t,e),r=o<0?Math.pow(10,Math.abs(o)):1;const a=Math.pow(10,o),c=n>o?Math.pow(10,n):0,l=Math.round((t-c)*r)/r,h=Math.floor((t-c)/a/10)*a*10;let d=Math.floor((l-h)/Math.pow(10,o)),u=q(i.min,Math.round((c+h+d*Math.pow(10,o))*r)/r);for(;u<e;)s.push({value:u,major:No(u),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,r=o>=0?1:r),u=Math.round((c+h+d*Math.pow(10,o))*r)/r;const f=q(i.max,u);return s.push({value:f,major:No(f),significand:d}),s}class Bo extends Tt{constructor(t){super(t);this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const s=mi.prototype.parse.apply(this,[t,e]);if(s===0){this._zero=!0;return}return B(s)&&s>0?s:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=B(t)?Math.max(0,t):null,this.max=B(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!B(this._userMin)&&(this.min=t===Et(this.min,0)?Et(this.min,-1):Et(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let s=this.min,n=this.max;const o=a=>s=t?s:a,r=a=>n=e?n:a;s===n&&(s<=0?(o(1),r(10)):(o(Et(s,-1)),r(Et(n,1)))),s<=0&&o(Et(n,-1)),n<=0&&r(Et(s,1)),this.min=s,this.max=n}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},s=Gh(e,this);return t.bounds==="ticks"&&bn(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}getLabelForValue(t){return t===void 0?"0":ge(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=bt(t),this._valueRange=bt(this.max)-bt(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(bt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}k(Bo,"id","logarithmic"),k(Bo,"defaults",{ticks:{callback:Ge.formatters.logarithmic,major:{enabled:!0}}});function bs(i){const t=i.ticks;if(t.display&&i.display){const e=rt(t.backdropPadding);return D(t.font&&t.font.size,N.font.size)+e.height}return 0}function Qh(i,t,e){return e=F(e)?e:[e],{w:cc(i,t.string,e),h:e.length*t.lineHeight}}function Vo(i,t,e,s,n){return i===s||i===n?{start:t-e/2,end:t+e/2}:i<s||i>n?{start:t-e,end:t}:{start:t,end:t+e}}function Zh(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),s=[],n=[],o=i._pointLabels.length,r=i.options.pointLabels,a=r.centerPointLabels?z/o:0;for(let c=0;c<o;c++){const l=r.setContext(i.getPointLabelContext(c));n[c]=l.padding;const h=i.getPointPosition(c,i.drawingArea+n[c],a),d=Xt(l.font),u=Qh(i.ctx,d,i._pointLabels[c]);s[c]=u;const f=Q(i.getIndexAngle(c)+a),p=Math.round(Xi(f)),g=Vo(p,h.x,u.w,0,180),m=Vo(p,h.y,u.h,90,270);Jh(e,t,f,g,m)}i.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),i._pointLabelItems=id(i,s,n)}function Jh(i,t,e,s,n){const o=Math.abs(Math.sin(e)),r=Math.abs(Math.cos(e));let a=0,c=0;s.start<t.l?(a=(t.l-s.start)/o,i.l=Math.min(i.l,t.l-a)):s.end>t.r&&(a=(s.end-t.r)/o,i.r=Math.max(i.r,t.r+a)),n.start<t.t?(c=(t.t-n.start)/r,i.t=Math.min(i.t,t.t-c)):n.end>t.b&&(c=(n.end-t.b)/r,i.b=Math.max(i.b,t.b+c))}function td(i,t,e){const s=i.drawingArea,{extra:n,additionalAngle:o,padding:r,size:a}=e,c=i.getPointPosition(t,s+n+r,o),l=Math.round(Xi(Q(c.angle+U))),h=od(c.y,a.h,l),d=sd(l),u=nd(c.x,a.w,d);return{visible:!0,x:c.x,y:h,textAlign:d,left:u,top:h,right:u+a.w,bottom:h+a.h}}function ed(i,t){if(!t)return!0;const{left:e,top:s,right:n,bottom:o}=i;return!(ot({x:e,y:s},t)||ot({x:e,y:o},t)||ot({x:n,y:s},t)||ot({x:n,y:o},t))}function id(i,t,e){const s=[],n=i._pointLabels.length,o=i.options,{centerPointLabels:r,display:a}=o.pointLabels,c={extra:bs(o)/2,additionalAngle:r?z/n:0};let l;for(let h=0;h<n;h++){c.padding=e[h],c.size=t[h];const d=td(i,h,c);s.push(d),a==="auto"&&(d.visible=ed(d,l),d.visible&&(l=d))}return s}function sd(i){return i===0||i===180?"center":i<180?"left":"right"}function nd(i,t,e){return e==="right"?i-=t:e==="center"&&(i-=t/2),i}function od(i,t,e){return e===90||e===270?i-=t/2:(e>270||e<90)&&(i-=t),i}function rd(i,t,e){const{left:s,top:n,right:o,bottom:r}=e,{backdropColor:a}=t;if(!T(a)){const c=wc(t.borderRadius),l=rt(t.backdropPadding);i.fillStyle=a;const h=s-l.left,d=n-l.top,u=o-s+l.width,f=r-n+l.height;Object.values(c).some(p=>p!==0)?(i.beginPath(),mc(i,{x:h,y:d,w:u,h:f,radius:c}),i.fill()):i.fillRect(h,d,u,f)}}function ad(i,t){const{ctx:e,options:{pointLabels:s}}=i;for(let n=t-1;n>=0;n--){const o=i._pointLabelItems[n];if(!o.visible)continue;const r=s.setContext(i.getPointLabelContext(n));rd(e,r,o);const a=Xt(r.font),{x:c,y:l,textAlign:h}=o;Ze(e,i._pointLabels[n],c,l+a.lineHeight/2,a,{color:r.color,textAlign:h,textBaseline:"middle"})}}function Ho(i,t,e,s){const{ctx:n}=i;if(e)n.arc(i.xCenter,i.yCenter,t,0,H);else{let o=i.getPointPosition(0,t);n.moveTo(o.x,o.y);for(let r=1;r<s;r++)o=i.getPointPosition(r,t),n.lineTo(o.x,o.y)}}function cd(i,t,e,s,n){const o=i.ctx,r=t.circular,{color:a,lineWidth:c}=t;!r&&!s||!a||!c||e<0||(o.save(),o.strokeStyle=a,o.lineWidth=c,o.setLineDash(n.dash),o.lineDashOffset=n.dashOffset,o.beginPath(),Ho(i,e,r,s),o.closePath(),o.stroke(),o.restore())}function ld(i,t,e){return Ot(i,{label:e,index:t,type:"pointLabel"})}class bi extends mi{constructor(t){super(t);this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=rt(bs(this.options)/2),e=this.width=this.maxWidth-t.width,s=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+s/2+t.top),this.drawingArea=Math.floor(Math.min(e,s)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=B(t)&&!isNaN(t)?t:0,this.max=B(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/bs(this.options))}generateTickLabels(t){mi.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,s)=>{const n=E(this.options.pointLabels.callback,[e,s],this);return n||n===0?n:""}).filter((e,s)=>this.chart.getDataVisibility(s))}fit(){const t=this.options;t.display&&t.pointLabels.display?Zh(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,s,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((s-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,s,n))}getIndexAngle(t){const e=H/(this._pointLabels.length||1),s=this.options.startAngle||0;return Q(t*e+G(s))}getDistanceFromCenterForValue(t){if(T(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(T(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const s=e[t];return ld(this.getContext(),t,s)}}getPointPosition(t,e,s=0){const n=this.getIndexAngle(t)-U+s;return{x:Math.cos(n)*e+this.xCenter,y:Math.sin(n)*e+this.yCenter,angle:n}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:s,right:n,bottom:o}=this._pointLabelItems[t];return{left:e,top:s,right:n,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const s=this.ctx;s.save(),s.beginPath(),Ho(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),s.closePath(),s.fillStyle=t,s.fill(),s.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:s,grid:n,border:o}=e,r=this._pointLabels.length;let a,c,l;if(e.pointLabels.display&&ad(this,r),n.display&&this.ticks.forEach((h,d)=>{if(d!==0){c=this.getDistanceFromCenterForValue(h.value);const u=this.getContext(d),f=n.setContext(u),p=o.setContext(u);cd(this,f,c,r,p)}}),s.display){for(t.save(),a=r-1;a>=0;a--){const h=s.setContext(this.getPointLabelContext(a)),{color:d,lineWidth:u}=h;!u||!d||(t.lineWidth=u,t.strokeStyle=d,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,c=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),l=this.getPointPosition(a,c),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,s=e.ticks;if(!s.display)return;const n=this.getIndexAngle(0);let o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,c)=>{if(c===0&&!e.reverse)return;const l=s.setContext(this.getContext(c)),h=Xt(l.font);if(o=this.getDistanceFromCenterForValue(this.ticks[c].value),l.showLabelBackdrop){t.font=h.string,r=t.measureText(a.label).width,t.fillStyle=l.backdropColor;const d=rt(l.backdropPadding);t.fillRect(-r/2-d.left,-o-h.size/2-d.top,r+d.width,h.size+d.height)}Ze(t,a.label,0,-o,h,{color:l.color,strokeColor:l.textStrokeColor,strokeWidth:l.textStrokeWidth})}),t.restore()}drawTitle(){}}k(bi,"id","radialLinear"),k(bi,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ge.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),k(bi,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),k(bi,"descriptors",{angleLines:{_fallback:"grid"}});const _i={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}},Y=Object.keys(_i);function Wo(i,t){return i-t}function Uo(i,t){if(T(t))return null;const e=i._adapter,{parser:s,round:n,isoWeekday:o}=i._parseOpts;let r=t;return typeof s=="function"&&(r=s(r)),B(r)||(r=typeof s=="string"?e.parse(r,s):e.parse(r)),r===null?null:(n&&(r=n==="week"&&(fe(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,n)),+r)}function Yo(i,t,e,s){const n=Y.length;for(let o=Y.indexOf(i);o<n-1;++o){const r=_i[Y[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((e-t)/(a*r.size))<=s)return Y[o]}return Y[n-1]}function hd(i,t,e,s,n){for(let o=Y.length-1;o>=Y.indexOf(e);o--){const r=Y[o];if(_i[r].common&&i._adapter.diff(n,s,r)>=t-1)return r}return Y[e?Y.indexOf(e):0]}function dd(i){for(let t=Y.indexOf(i)+1,e=Y.length;t<e;++t)if(_i[Y[t]].common)return Y[t]}function qo(i,t,e){if(!e)i[t]=!0;else if(e.length){const{lo:s,hi:n}=Ki(e,t),o=e[s]>=t?e[s]:e[n];i[o]=!0}}function ud(i,t,e,s){const n=i._adapter,o=+n.startOf(t[0].value,s),r=t[t.length-1].value;let a,c;for(a=o;a<=r;a=+n.add(a,1,s))c=e[a],c>=0&&(t[c].major=!0);return t}function Xo(i,t,e){const s=[],n={},o=t.length;let r,a;for(r=0;r<o;++r)a=t[r],n[a]=r,s.push({value:a,major:!1});return o===0||!e?s:ud(i,s,n,e)}class yi extends Tt{constructor(t){super(t);this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const s=t.time||(t.time={}),n=this._adapter=new xl._date(t.adapters.date);n.init(e),de(s.displayFormats,n.formats()),this._parseOpts={parser:s.parser,round:s.round,isoWeekday:s.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:Uo(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,s=t.time.unit||"day";let{min:n,max:o,minDefined:r,maxDefined:a}=this.getUserBounds();function c(l){!r&&!isNaN(l.min)&&(n=Math.min(n,l.min)),!a&&!isNaN(l.max)&&(o=Math.max(o,l.max))}(!r||!a)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(!1))),n=B(n)&&!isNaN(n)?n:+e.startOf(Date.now(),s),o=B(o)&&!isNaN(o)?o:+e.endOf(Date.now(),s)+1,this.min=Math.min(n,o-1),this.max=Math.max(n+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],s=t[t.length-1]),{min:e,max:s}}buildTicks(){const t=this.options,e=t.time,s=t.ticks,n=s.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);const o=this.min,r=this.max,a=Ya(n,o,r);return this._unit=e.unit||(s.autoSkip?Yo(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):hd(this,a.length,e.minUnit,this.min,this.max)),this._majorUnit=!s.major.enabled||this._unit==="year"?void 0:dd(this._unit),this.initOffsets(n),t.reverse&&a.reverse(),Xo(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,s=0,n,o;this.options.offset&&t.length&&(n=this.getDecimalForValue(t[0]),t.length===1?e=1-n:e=(this.getDecimalForValue(t[1])-n)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?s=o:s=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;e=tt(e,0,r),s=tt(s,0,r),this._offsets={start:e,end:s,factor:1/(e+1+s)}}_generate(){const t=this._adapter,e=this.min,s=this.max,n=this.options,o=n.time,r=o.unit||Yo(o.minUnit,e,s,this._getLabelCapacity(e)),a=D(n.ticks.stepSize,1),c=r==="week"?o.isoWeekday:!1,l=fe(c)||c===!0,h={};let d=e,u,f;if(l&&(d=+t.startOf(d,"isoWeek",c)),d=+t.startOf(d,l?"day":r),t.diff(s,e,r)>1e5*a)throw new Error(e+" and "+s+" are too far apart with stepSize of "+a+" "+r);const p=n.ticks.source==="data"&&this.getDataTimestamps();for(u=d,f=0;u<s;u=+t.add(u,a,r),f++)qo(h,u,p);return(u===s||n.bounds==="ticks"||f===1)&&qo(h,u,p),Object.keys(h).sort(Wo).map(g=>+g)}getLabelForValue(t){const e=this._adapter,s=this.options.time;return s.tooltipFormat?e.format(t,s.tooltipFormat):e.format(t,s.displayFormats.datetime)}format(t,e){const n=this.options.time.displayFormats,o=this._unit,r=e||n[o];return this._adapter.format(t,r)}_tickFormatFunction(t,e,s,n){const o=this.options,r=o.ticks.callback;if(r)return E(r,[t,e,s],this);const a=o.time.displayFormats,c=this._unit,l=this._majorUnit,h=c&&a[c],d=l&&a[l],u=s[e],f=l&&d&&u&&u.major;return this._adapter.format(t,n||(f?d:h))}generateTickLabels(t){let e,s,n;for(e=0,s=t.length;e<s;++e)n=t[e],n.label=this._tickFormatFunction(n.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,s=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+s)*e.factor)}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+s*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,s=this.ctx.measureText(t).width,n=G(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(n),r=Math.sin(n),a=this._resolveTickFontOptions(0).size;return{w:s*o+a*r,h:s*r+a*o}}_getLabelCapacity(t){const e=this.options.time,s=e.displayFormats,n=s[e.unit]||s.millisecond,o=this._tickFormatFunction(t,0,Xo(this,[t],this._majorUnit),n),r=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,s;if(t.length)return t;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,s=n.length;e<s;++e)t=t.concat(n[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let e,s;if(t.length)return t;const n=this.getLabels();for(e=0,s=n.length;e<s;++e)t.push(Uo(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Xa(t.sort(Wo))}}k(yi,"id","time"),k(yi,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function xi(i,t,e){let s=0,n=i.length-1,o,r,a,c;e?(t>=i[s].pos&&t<=i[n].pos&&({lo:s,hi:n}=kt(i,"pos",t)),{pos:o,time:a}=i[s],{pos:r,time:c}=i[n]):(t>=i[s].time&&t<=i[n].time&&({lo:s,hi:n}=kt(i,"time",t)),{time:o,pos:a}=i[s],{time:r,pos:c}=i[n]);const l=r-o;return l?a+(c-a)*(t-o)/l:a}class Ko extends yi{constructor(t){super(t);this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=xi(e,this.min),this._tableRange=xi(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:s}=this,n=[],o=[];let r,a,c,l,h;for(r=0,a=t.length;r<a;++r)l=t[r],l>=e&&l<=s&&n.push(l);if(n.length<2)return[{time:e,pos:0},{time:s,pos:1}];for(r=0,a=n.length;r<a;++r)h=n[r+1],c=n[r-1],l=n[r],Math.round((h+c)/2)!==l&&o.push({time:l,pos:r/(a-1)});return o}_generate(){const t=this.min,e=this.max;let s=super.getDataTimestamps();return(!s.includes(t)||!s.length)&&s.splice(0,0,t),(!s.includes(e)||s.length===1)&&s.push(e),s.sort((n,o)=>n-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),s=this.getLabelTimestamps();return e.length&&s.length?t=this.normalize(e.concat(s)):t=e.length?e:s,t=this._cache.all=t,t}getDecimalForValue(t){return(xi(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return xi(this._table,s*this._tableRange+this._minPos,!0)}}k(Ko,"id","timeseries"),k(Ko,"defaults",yi.defaults);var fd=Object.defineProperty,pd=Object.getOwnPropertyDescriptor,Go=(i,t,e,s)=>{for(var n=s>1?void 0:s?pd(t,e):t,o=i.length-1,r;o>=0;o--)(r=i[o])&&(n=(s?r(t,e,n):r(n))||n);return s&&n&&fd(t,e,n),n};ct.register(Wh,ni,gs,ms,gi,Oe);let _s=class extends J{constructor(){super();this.chartdata=[]}updated(i){var t;super.updated(i),i.has("chartdata")&&(this.chartSubComponent.data.datasets[0].data=this.chartdata,this.chartSubComponent.data.labels=this.chartdata,(t=this.chartSubComponent)==null||t.update())}firstUpdated(){const i=this.renderRoot.querySelector("canvas").getContext("2d");this.chartSubComponent=new ct(i,{type:"line",data:{labels:this.chartdata,datasets:[{data:this.chartdata,borderWidth:1,tension:.3}]},options:{plugins:{legend:{display:!1}},scales:{x:{display:!1},y:{position:"right"}},responsive:!0,maintainAspectRatio:!1}})}static get styles(){return it`:host{position:absolute;left:24px;height:42px!important;width:calc(100% - 42px);z-index:-100;opacity:.1}:host-context(.expanded){height:240px!important;opacity:.5}`}render(){return C`<canvas></canvas>`}};Go([st({type:Array})],_s.prototype,"chartdata",2);_s=Go([Wt("esp-entity-chart")],_s);const Qo=Object.freeze({left:0,top:0,width:16,height:16}),vi=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Ae=Object.freeze($($({},Qo),vi)),ys=Object.freeze(dt($({},Ae),{body:"",hidden:!1})),gd=Object.freeze({width:null,height:null}),Zo=Object.freeze($($({},gd),vi));function md(i,t=0){const e=i.replace(/^-?[0-9.]*/,"");function s(n){for(;n<0;)n+=4;return n%4}if(e===""){const n=parseInt(i);return isNaN(n)?0:s(n)}else if(e!==i){let n=0;switch(e){case"%":n=25;break;case"deg":n=90}if(n){let o=parseFloat(i.slice(0,i.length-e.length));return isNaN(o)?0:(o=o/n,o%1==0?s(o):0)}}return t}const bd=/[\s,]+/;function _d(i,t){t.split(bd).forEach(e=>{switch(e.trim()){case"horizontal":i.hFlip=!0;break;case"vertical":i.vFlip=!0;break}})}const Jo=dt($({},Zo),{preserveAspectRatio:""});function tr(i){const t=$({},Jo),e=(s,n)=>i.getAttribute(s)||n;return t.width=e("width",null),t.height=e("height",null),t.rotate=md(e("rotate","")),_d(t,e("flip","")),t.preserveAspectRatio=e("preserveAspectRatio",e("preserveaspectratio","")),t}function yd(i,t){for(const e in Jo)if(i[e]!==t[e])return!0;return!1}const Pe=/^[a-z0-9]+(-[a-z0-9]+)*$/,$e=(i,t,e,s="")=>{const n=i.split(":");if(i.slice(0,1)==="@"){if(n.length<2||n.length>3)return null;s=n.shift().slice(1)}if(n.length>3||!n.length)return null;if(n.length>1){const a=n.pop(),c=n.pop(),l={provider:n.length>0?n[0]:s,prefix:c,name:a};return t&&!wi(l)?null:l}const o=n[0],r=o.split("-");if(r.length>1){const a={provider:s,prefix:r.shift(),name:r.join("-")};return t&&!wi(a)?null:a}if(e&&s===""){const a={provider:s,prefix:"",name:o};return t&&!wi(a,e)?null:a}return null},wi=(i,t)=>i?!!((i.provider===""||i.provider.match(Pe))&&(t&&i.prefix===""||i.prefix.match(Pe))&&i.name.match(Pe)):!1;function xd(i,t){const e={};!i.hFlip!=!t.hFlip&&(e.hFlip=!0),!i.vFlip!=!t.vFlip&&(e.vFlip=!0);const s=((i.rotate||0)+(t.rotate||0))%4;return s&&(e.rotate=s),e}function er(i,t){const e=xd(i,t);for(const s in ys)s in vi?s in i&&!(s in e)&&(e[s]=vi[s]):s in t?e[s]=t[s]:s in i&&(e[s]=i[s]);return e}function vd(i,t){const e=i.icons,s=i.aliases||Object.create(null),n=Object.create(null);function o(r){if(e[r])return n[r]=[];if(!(r in n)){n[r]=null;const a=s[r]&&s[r].parent,c=a&&o(a);c&&(n[r]=[a].concat(c))}return n[r]}return(t||Object.keys(e).concat(Object.keys(s))).forEach(o),n}function wd(i,t,e){const s=i.icons,n=i.aliases||Object.create(null);let o={};function r(a){o=er(s[a]||n[a],o)}return r(t),e.forEach(r),er(i,o)}function ir(i,t){const e=[];if(typeof i!="object"||typeof i.icons!="object")return e;i.not_found instanceof Array&&i.not_found.forEach(n=>{t(n,null),e.push(n)});const s=vd(i);for(const n in s){const o=s[n];o&&(t(n,wd(i,n,o)),e.push(n))}return e}const kd=$({provider:"",aliases:{},not_found:{}},Qo);function xs(i,t){for(const e in t)if(e in i&&typeof i[e]!=typeof t[e])return!1;return!0}function sr(i){if(typeof i!="object"||i===null)return null;const t=i;if(typeof t.prefix!="string"||!i.icons||typeof i.icons!="object"||!xs(i,kd))return null;const e=t.icons;for(const n in e){const o=e[n];if(!n.match(Pe)||typeof o.body!="string"||!xs(o,ys))return null}const s=t.aliases||Object.create(null);for(const n in s){const o=s[n],r=o.parent;if(!n.match(Pe)||typeof r!="string"||!e[r]&&!s[r]||!xs(o,ys))return null}return t}const ki=Object.create(null);function Sd(i,t){return{provider:i,prefix:t,icons:Object.create(null),missing:new Set}}function _t(i,t){const e=ki[i]||(ki[i]=Object.create(null));return e[t]||(e[t]=Sd(i,t))}function vs(i,t){return sr(t)?ir(t,(e,s)=>{s?i.icons[e]=s:i.missing.add(e)}):[]}function Md(i,t,e){try{if(typeof e.body=="string")return i.icons[t]=$({},e),!0}catch{}return!1}function Od(i,t){let e=[];return(typeof i=="string"?[i]:Object.keys(ki)).forEach(n=>{(typeof n=="string"&&typeof t=="string"?[t]:Object.keys(ki[n]||{})).forEach(r=>{const a=_t(n,r);e=e.concat(Object.keys(a.icons).map(c=>(n!==""?"@"+n+":":"")+r+":"+c))})}),e}let De=!1;function nr(i){return typeof i=="boolean"&&(De=i),De}function Te(i){const t=typeof i=="string"?$e(i,!0,De):i;if(t){const e=_t(t.provider,t.prefix),s=t.name;return e.icons[s]||(e.missing.has(s)?null:void 0)}}function or(i,t){const e=$e(i,!0,De);if(!e)return!1;const s=_t(e.provider,e.prefix);return Md(s,e.name,t)}function rr(i,t){if(typeof i!="object")return!1;if(typeof t!="string"&&(t=i.provider||""),De&&!t&&!i.prefix){let n=!1;return sr(i)&&(i.prefix="",ir(i,(o,r)=>{r&&or(o,r)&&(n=!0)})),n}const e=i.prefix;if(!wi({provider:t,prefix:e,name:"a"}))return!1;const s=_t(t,e);return!!vs(s,i)}function Cd(i){return!!Te(i)}function Ad(i){const t=Te(i);return t?$($({},Ae),t):null}function Pd(i){const t={loaded:[],missing:[],pending:[]},e=Object.create(null);i.sort((n,o)=>n.provider!==o.provider?n.provider.localeCompare(o.provider):n.prefix!==o.prefix?n.prefix.localeCompare(o.prefix):n.name.localeCompare(o.name));let s={provider:"",prefix:"",name:""};return i.forEach(n=>{if(s.name===n.name&&s.prefix===n.prefix&&s.provider===n.provider)return;s=n;const o=n.provider,r=n.prefix,a=n.name,c=e[o]||(e[o]=Object.create(null)),l=c[r]||(c[r]=_t(o,r));let h;a in l.icons?h=t.loaded:r===""||l.missing.has(a)?h=t.missing:h=t.pending;const d={provider:o,prefix:r,name:a};h.push(d)}),t}function ar(i,t){i.forEach(e=>{const s=e.loaderCallbacks;s&&(e.loaderCallbacks=s.filter(n=>n.id!==t))})}function $d(i){i.pendingCallbacksFlag||(i.pendingCallbacksFlag=!0,setTimeout(()=>{i.pendingCallbacksFlag=!1;const t=i.loaderCallbacks?i.loaderCallbacks.slice(0):[];if(!t.length)return;let e=!1;const s=i.provider,n=i.prefix;t.forEach(o=>{const r=o.icons,a=r.pending.length;r.pending=r.pending.filter(c=>{if(c.prefix!==n)return!0;const l=c.name;if(i.icons[l])r.loaded.push({provider:s,prefix:n,name:l});else if(i.missing.has(l))r.missing.push({provider:s,prefix:n,name:l});else return e=!0,!0;return!1}),r.pending.length!==a&&(e||ar([i],o.id),o.callback(r.loaded.slice(0),r.missing.slice(0),r.pending.slice(0),o.abort))})}))}let Dd=0;function Td(i,t,e){const s=Dd++,n=ar.bind(null,e,s);if(!t.pending.length)return n;const o={id:s,icons:t,callback:i,abort:n};return e.forEach(r=>{(r.loaderCallbacks||(r.loaderCallbacks=[])).push(o)}),n}const ws=Object.create(null);function cr(i,t){ws[i]=t}function ks(i){return ws[i]||ws[""]}function Ed(i,t=!0,e=!1){const s=[];return i.forEach(n=>{const o=typeof n=="string"?$e(n,t,e):n;o&&s.push(o)}),s}var Id={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Ld(i,t,e,s){const n=i.resources.length,o=i.random?Math.floor(Math.random()*n):i.index;let r;if(i.random){let x=i.resources.slice(0);for(r=[];x.length>1;){const w=Math.floor(Math.random()*x.length);r.push(x[w]),x=x.slice(0,w).concat(x.slice(w+1))}r=r.concat(x)}else r=i.resources.slice(o).concat(i.resources.slice(0,o));const a=Date.now();let c="pending",l=0,h,d=null,u=[],f=[];typeof s=="function"&&f.push(s);function p(){d&&(clearTimeout(d),d=null)}function g(){c==="pending"&&(c="aborted"),p(),u.forEach(x=>{x.status==="pending"&&(x.status="aborted")}),u=[]}function m(x,w){w&&(f=[]),typeof x=="function"&&f.push(x)}function b(){return{startTime:a,payload:t,status:c,queriesSent:l,queriesPending:u.length,subscribe:m,abort:g}}function _(){c="failed",f.forEach(x=>{x(void 0,h)})}function v(){u.forEach(x=>{x.status==="pending"&&(x.status="aborted")}),u=[]}function M(x,w,S){const O=w!=="success";switch(u=u.filter(P=>P!==x),c){case"pending":break;case"failed":if(O||!i.dataAfterTimeout)return;break;default:return}if(w==="abort"){h=S,_();return}if(O){h=S,u.length||(r.length?y():_());return}if(p(),v(),!i.random){const P=i.resources.indexOf(x.resource);P!==-1&&P!==i.index&&(i.index=P)}c="completed",f.forEach(P=>{P(S)})}function y(){if(c!=="pending")return;p();const x=r.shift();if(x===void 0){if(u.length){d=setTimeout(()=>{p(),c==="pending"&&(v(),_())},i.timeout);return}_();return}const w={status:"pending",resource:x,callback:(S,O)=>{M(w,S,O)}};u.push(w),l++,d=setTimeout(y,i.rotate),e(x,t,w.callback)}return setTimeout(y),b}function lr(i){const t=$($({},Id),i);let e=[];function s(){e=e.filter(a=>a().status==="pending")}function n(a,c,l){const h=Ld(t,a,c,(d,u)=>{s(),l&&l(d,u)});return e.push(h),h}function o(a){return e.find(c=>a(c))||null}return{query:n,find:o,setIndex:a=>{t.index=a},getIndex:()=>t.index,cleanup:s}}function Ss(i){let t;if(typeof i.resources=="string")t=[i.resources];else if(t=i.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:i.path||"/",maxURL:i.maxURL||500,rotate:i.rotate||750,timeout:i.timeout||5e3,random:i.random===!0,index:i.index||0,dataAfterTimeout:i.dataAfterTimeout!==!1}}const Si=Object.create(null),Ee=["https://api.simplesvg.com","https://api.unisvg.com"],Mi=[];for(;Ee.length>0;)Ee.length===1||Math.random()>.5?Mi.push(Ee.shift()):Mi.push(Ee.pop());Si[""]=Ss({resources:["https://api.iconify.design"].concat(Mi)});function hr(i,t){const e=Ss(t);return e===null?!1:(Si[i]=e,!0)}function Oi(i){return Si[i]}function Rd(){return Object.keys(Si)}function dr(){}const Ms=Object.create(null);function Fd(i){if(!Ms[i]){const t=Oi(i);if(!t)return;const e=lr(t),s={config:t,redundancy:e};Ms[i]=s}return Ms[i]}function ur(i,t,e){let s,n;if(typeof i=="string"){const o=ks(i);if(!o)return e(void 0,424),dr;n=o.send;const r=Fd(i);r&&(s=r.redundancy)}else{const o=Ss(i);if(o){s=lr(o);const r=i.resources?i.resources[0]:"",a=ks(r);a&&(n=a.send)}}return!s||!n?(e(void 0,424),dr):s.query(t,n,e)().abort}const fr="iconify2",Ie="iconify",pr=Ie+"-count",gr=Ie+"-version",mr=36e5,zd=168;function Os(i,t){try{return i.getItem(t)}catch{}}function Cs(i,t,e){try{return i.setItem(t,e),!0}catch{}}function br(i,t){try{i.removeItem(t)}catch{}}function As(i,t){return Cs(i,pr,t.toString())}function Ps(i){return parseInt(Os(i,pr))||0}const It={local:!0,session:!0},_r={local:new Set,session:new Set};let $s=!1;function Nd(i){$s=i}let Ci=typeof window=="undefined"?{}:window;function yr(i){const t=i+"Storage";try{if(Ci&&Ci[t]&&typeof Ci[t].length=="number")return Ci[t]}catch{}It[i]=!1}function xr(i,t){const e=yr(i);if(!e)return;const s=Os(e,gr);if(s!==fr){if(s){const a=Ps(e);for(let c=0;c<a;c++)br(e,Ie+c.toString())}Cs(e,gr,fr),As(e,0);return}const n=Math.floor(Date.now()/mr)-zd,o=a=>{const c=Ie+a.toString(),l=Os(e,c);if(typeof l=="string"){try{const h=JSON.parse(l);if(typeof h=="object"&&typeof h.cached=="number"&&h.cached>n&&typeof h.provider=="string"&&typeof h.data=="object"&&typeof h.data.prefix=="string"&&t(h,a))return!0}catch{}br(e,c)}};let r=Ps(e);for(let a=r-1;a>=0;a--)o(a)||(a===r-1?(r--,As(e,r)):_r[i].add(a))}function vr(){if(!$s){Nd(!0);for(const i in It)xr(i,t=>{const e=t.data,s=t.provider,n=e.prefix,o=_t(s,n);if(!vs(o,e).length)return!1;const r=e.lastModified||-1;return o.lastModifiedCached=o.lastModifiedCached?Math.min(o.lastModifiedCached,r):r,!0})}}function jd(i,t){const e=i.lastModifiedCached;if(e&&e>=t)return e===t;if(i.lastModifiedCached=t,e)for(const s in It)xr(s,n=>{const o=n.data;return n.provider!==i.provider||o.prefix!==i.prefix||o.lastModified===t});return!0}function Bd(i,t){$s||vr();function e(s){let n;if(!It[s]||!(n=yr(s)))return;const o=_r[s];let r;if(o.size)o.delete(r=Array.from(o).shift());else if(r=Ps(n),!As(n,r+1))return;const a={cached:Math.floor(Date.now()/mr),provider:i.provider,data:t};return Cs(n,Ie+r.toString(),JSON.stringify(a))}t.lastModified&&!jd(i,t.lastModified)||!Object.keys(t.icons).length||(t.not_found&&(t=Object.assign({},t),delete t.not_found),e("local")||e("session"))}function wr(){}function Vd(i){i.iconsLoaderFlag||(i.iconsLoaderFlag=!0,setTimeout(()=>{i.iconsLoaderFlag=!1,$d(i)}))}function Hd(i,t){i.iconsToLoad?i.iconsToLoad=i.iconsToLoad.concat(t).sort():i.iconsToLoad=t,i.iconsQueueFlag||(i.iconsQueueFlag=!0,setTimeout(()=>{i.iconsQueueFlag=!1;const{provider:e,prefix:s}=i,n=i.iconsToLoad;delete i.iconsToLoad;let o;if(!n||!(o=ks(e)))return;o.prepare(e,s,n).forEach(a=>{ur(e,a,c=>{if(typeof c!="object")a.icons.forEach(l=>{i.missing.add(l)});else try{const l=vs(i,c);if(!l.length)return;const h=i.pendingIcons;h&&l.forEach(d=>{h.delete(d)}),Bd(i,c)}catch(l){console.error(l)}Vd(i)})})}))}const Ds=(i,t)=>{const e=Ed(i,!0,nr()),s=Pd(e);if(!s.pending.length){let c=!0;return t&&setTimeout(()=>{c&&t(s.loaded,s.missing,s.pending,wr)}),()=>{c=!1}}const n=Object.create(null),o=[];let r,a;return s.pending.forEach(c=>{const{provider:l,prefix:h}=c;if(h===a&&l===r)return;r=l,a=h,o.push(_t(l,h));const d=n[l]||(n[l]=Object.create(null));d[h]||(d[h]=[])}),s.pending.forEach(c=>{const{provider:l,prefix:h,name:d}=c,u=_t(l,h),f=u.pendingIcons||(u.pendingIcons=new Set);f.has(d)||(f.add(d),n[l][h].push(d))}),o.forEach(c=>{const{provider:l,prefix:h}=c;n[l][h].length&&Hd(c,n[l][h])}),t?Td(t,s,o):wr},Wd=i=>new Promise((t,e)=>{const s=typeof i=="string"?$e(i,!0):i;if(!s){e(i);return}Ds([s||i],n=>{if(n.length&&s){const o=Te(s);if(o){t($($({},Ae),o));return}}e(i)})});function Ud(i){try{const t=typeof i=="string"?JSON.parse(i):i;if(typeof t.body=="string")return $({},t)}catch{}}function Yd(i,t){const e=typeof i=="string"?$e(i,!0,!0):null;if(!e){const o=Ud(i);return{value:i,data:o}}const s=Te(e);if(s!==void 0||!e.prefix)return{value:i,name:e,data:s};const n=Ds([e],()=>t(i,e,Te(e)));return{value:i,name:e,loading:n}}function Ts(i){return i.hasAttribute("inline")}let kr=!1;try{kr=navigator.vendor.indexOf("Apple")===0}catch{}function qd(i,t){switch(t){case"svg":case"bg":case"mask":return t}return t!=="style"&&(kr||i.indexOf("<a")===-1)?"svg":i.indexOf("currentColor")===-1?"bg":"mask"}const Xd=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Kd=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Es(i,t,e){if(t===1)return i;if(e=e||100,typeof i=="number")return Math.ceil(i*t*e)/e;if(typeof i!="string")return i;const s=i.split(Xd);if(s===null||!s.length)return i;const n=[];let o=s.shift(),r=Kd.test(o);for(;;){if(r){const a=parseFloat(o);isNaN(a)?n.push(o):n.push(Math.ceil(a*t*e)/e)}else n.push(o);if(o=s.shift(),o===void 0)return n.join("");r=!r}}const Gd=i=>i==="unset"||i==="undefined"||i==="none";function Sr(i,t){const e=$($({},Ae),i),s=$($({},Zo),t),n={left:e.left,top:e.top,width:e.width,height:e.height};let o=e.body;[e,s].forEach(p=>{const g=[],m=p.hFlip,b=p.vFlip;let _=p.rotate;m?b?_+=2:(g.push("translate("+(n.width+n.left).toString()+" "+(0-n.top).toString()+")"),g.push("scale(-1 1)"),n.top=n.left=0):b&&(g.push("translate("+(0-n.left).toString()+" "+(n.height+n.top).toString()+")"),g.push("scale(1 -1)"),n.top=n.left=0);let v;switch(_<0&&(_-=Math.floor(_/4)*4),_=_%4,_){case 1:v=n.height/2+n.top,g.unshift("rotate(90 "+v.toString()+" "+v.toString()+")");break;case 2:g.unshift("rotate(180 "+(n.width/2+n.left).toString()+" "+(n.height/2+n.top).toString()+")");break;case 3:v=n.width/2+n.left,g.unshift("rotate(-90 "+v.toString()+" "+v.toString()+")");break}_%2==1&&(n.left!==n.top&&(v=n.left,n.left=n.top,n.top=v),n.width!==n.height&&(v=n.width,n.width=n.height,n.height=v)),g.length&&(o='<g transform="'+g.join(" ")+'">'+o+"</g>")});const r=s.width,a=s.height,c=n.width,l=n.height;let h,d;r===null?(d=a===null?"1em":a==="auto"?l:a,h=Es(d,c/l)):(h=r==="auto"?c:r,d=a===null?Es(h,l/c):a==="auto"?l:a);const u={},f=(p,g)=>{Gd(g)||(u[p]=g.toString())};return f("width",h),f("height",d),u.viewBox=n.left.toString()+" "+n.top.toString()+" "+c.toString()+" "+l.toString(),{attributes:u,body:o}}const Qd=()=>{let i;try{if(i=fetch,typeof i=="function")return i}catch{}};let Ai=Qd();function Zd(i){Ai=i}function Jd(){return Ai}function tu(i,t){const e=Oi(i);if(!e)return 0;let s;if(!e.maxURL)s=0;else{let n=0;e.resources.forEach(r=>{n=Math.max(n,r.length)});const o=t+".json?icons=";s=e.maxURL-n-e.path.length-o.length}return s}function eu(i){return i===404}const iu=(i,t,e)=>{const s=[],n=tu(i,t),o="icons";let r={type:o,provider:i,prefix:t,icons:[]},a=0;return e.forEach((c,l)=>{a+=c.length+1,a>=n&&l>0&&(s.push(r),r={type:o,provider:i,prefix:t,icons:[]},a=c.length),r.icons.push(c)}),s.push(r),s};function su(i){if(typeof i=="string"){const t=Oi(i);if(t)return t.path}return"/"}const nu=(i,t,e)=>{if(!Ai){e("abort",424);return}let s=su(t.provider);switch(t.type){case"icons":{const o=t.prefix,a=t.icons.join(","),c=new URLSearchParams({icons:a});s+=o+".json?"+c.toString();break}case"custom":{const o=t.uri;s+=o.slice(0,1)==="/"?o.slice(1):o;break}default:e("abort",400);return}let n=503;Ai(i+s).then(o=>{const r=o.status;if(r!==200){setTimeout(()=>{e(eu(r)?"abort":"next",r)});return}return n=501,o.json()}).then(o=>{if(typeof o!="object"||o===null){setTimeout(()=>{o===404?e("abort",o):e("next",n)});return}setTimeout(()=>{e("success",o)})}).catch(()=>{e("next",n)})},ou={prepare:iu,send:nu};function Mr(i,t){switch(i){case"local":case"session":It[i]=t;break;case"all":for(const e in It)It[e]=t;break}}const Is="data-style";let Or="";function ru(i){Or=i}function Cr(i,t){let e=Array.from(i.childNodes).find(s=>s.hasAttribute&&s.hasAttribute(Is));e||(e=document.createElement("style"),e.setAttribute(Is,Is),i.appendChild(e)),e.textContent=":host{display:inline-block;vertical-align:"+(t?"-0.125em":"0")+"}span,svg{display:block}"+Or}function Ar(){cr("",ou),nr(!0);let i;try{i=window}catch{}if(i){if(vr(),i.IconifyPreload!==void 0){const e=i.IconifyPreload,s="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(n=>{try{(typeof n!="object"||n===null||n instanceof Array||typeof n.icons!="object"||typeof n.prefix!="string"||!rr(n))&&console.error(s)}catch{console.error(s)}})}if(i.IconifyProviders!==void 0){const e=i.IconifyProviders;if(typeof e=="object"&&e!==null)for(const s in e){const n="IconifyProviders["+s+"] is invalid.";try{const o=e[s];if(typeof o!="object"||!o||o.resources===void 0)continue;hr(s,o)||console.error(n)}catch{console.error(n)}}}}return{enableCache:e=>Mr(e,!0),disableCache:e=>Mr(e,!1),iconExists:Cd,getIcon:Ad,listIcons:Od,addIcon:or,addCollection:rr,calculateSize:Es,buildIcon:Sr,loadIcons:Ds,loadIcon:Wd,addAPIProvider:hr,appendCustomStyle:ru,_api:{getAPIConfig:Oi,setAPIModule:cr,sendAPIQuery:ur,setFetch:Zd,getFetch:Jd,listAPIProviders:Rd}}}function Pr(i,t){let e=i.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const s in t)e+=" "+s+'="'+t[s]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+e+">"+i+"</svg>"}function au(i){return i.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function cu(i){return"data:image/svg+xml,"+au(i)}function lu(i){return'url("'+cu(i)+'")'}const Ls={"background-color":"currentColor"},$r={"background-color":"transparent"},Dr={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},Tr={"-webkit-mask":Ls,mask:Ls,background:$r};for(const i in Tr){const t=Tr[i];for(const e in Dr)t[i+"-"+e]=Dr[e]}function Er(i){return i?i+(i.match(/^[-0-9.]+$/)?"px":""):"inherit"}function hu(i,t,e){const s=document.createElement("span");let n=i.body;n.indexOf("<a")!==-1&&(n+="<!-- "+Date.now()+" -->");const o=i.attributes,r=Pr(n,dt($({},o),{width:t.width+"",height:t.height+""})),a=lu(r),c=s.style,l=$({"--svg":a,width:Er(o.width),height:Er(o.height)},e?Ls:$r);for(const h in l)c.setProperty(h,l[h]);return s}let Le;function du(){try{Le=window.trustedTypes.createPolicy("iconify",{createHTML:i=>i})}catch{Le=null}}function uu(i){return Le===void 0&&du(),Le?Le.createHTML(i):i}function fu(i){const t=document.createElement("span"),e=i.attributes;let s="";e.width||(s="width: inherit;"),e.height||(s+="height: inherit;"),s&&(e.style=s);const n=Pr(i.body,e);return t.innerHTML=uu(n),t.firstChild}function Ir(i,t){const e=t.icon.data,s=t.customisations,n=Sr(e,s);s.preserveAspectRatio&&(n.attributes.preserveAspectRatio=s.preserveAspectRatio);const o=t.renderedMode;let r;switch(o){case"svg":r=fu(n);break;default:r=hu(n,$($({},Ae),e),o==="mask")}const a=Array.from(i.childNodes).find(c=>{const l=c.tagName&&c.tagName.toUpperCase();return l==="SPAN"||l==="SVG"});a?r.tagName==="SPAN"&&a.tagName===r.tagName?a.setAttribute("style",r.getAttribute("style")):i.replaceChild(r,a):i.appendChild(r)}function Lr(i,t,e){const s=e&&(e.rendered?e:e.lastRender);return{rendered:!1,inline:t,icon:i,lastRender:s}}function pu(i="iconify-icon"){let t,e;try{t=window.customElements,e=window.HTMLElement}catch{return}if(!t||!e)return;const s=t.get(i);if(s)return s;const n=["icon","mode","inline","width","height","rotate","flip"],o=class extends e{constructor(){super();k(this,"_shadowRoot");k(this,"_state");k(this,"_checkQueued",!1);const a=this._shadowRoot=this.attachShadow({mode:"open"}),c=Ts(this);Cr(a,c),this._state=Lr({value:""},c),this._queueCheck()}static get observedAttributes(){return n.slice(0)}attributeChangedCallback(a){if(a==="inline"){const c=Ts(this),l=this._state;c!==l.inline&&(l.inline=c,Cr(this._shadowRoot,c))}else this._queueCheck()}get icon(){const a=this.getAttribute("icon");if(a&&a.slice(0,1)==="{")try{return JSON.parse(a)}catch{}return a}set icon(a){typeof a=="object"&&(a=JSON.stringify(a)),this.setAttribute("icon",a)}get inline(){return Ts(this)}set inline(a){a?this.setAttribute("inline","true"):this.removeAttribute("inline")}restartAnimation(){const a=this._state;if(a.rendered){const c=this._shadowRoot;if(a.renderedMode==="svg")try{c.lastChild.setCurrentTime(0);return}catch{}Ir(c,a)}}get status(){const a=this._state;return a.rendered?"rendered":a.icon.data===null?"failed":"loading"}_queueCheck(){this._checkQueued||(this._checkQueued=!0,setTimeout(()=>{this._check()}))}_check(){if(!this._checkQueued)return;this._checkQueued=!1;const a=this._state,c=this.getAttribute("icon");if(c!==a.icon.value){this._iconChanged(c);return}if(!a.rendered)return;const l=this.getAttribute("mode"),h=tr(this);(a.attrMode!==l||yd(a.customisations,h))&&this._renderIcon(a.icon,h,l)}_iconChanged(a){const c=Yd(a,(l,h,d)=>{const u=this._state;if(u.rendered||this.getAttribute("icon")!==l)return;const f={value:l,name:h,data:d};f.data?this._gotIconData(f):u.icon=f});c.data?this._gotIconData(c):this._state=Lr(c,this._state.inline,this._state)}_gotIconData(a){this._checkQueued=!1,this._renderIcon(a,tr(this),this.getAttribute("mode"))}_renderIcon(a,c,l){const h=qd(a.data.body,l),d=this._state.inline;Ir(this._shadowRoot,this._state={rendered:!0,icon:a,inline:d,customisations:c,attrMode:l,renderedMode:h})}};n.forEach(a=>{a in o.prototype||Object.defineProperty(o.prototype,a,{get:function(){return this.getAttribute(a)},set:function(c){c!==null?this.setAttribute(a,c):this.removeAttribute(a)}})});const r=Ar();for(const a in r)o[a]=o.prototype[a]=r[a];return t.define(i,o),o}pu()||Ar();var gu=Object.defineProperty,mu=Object.getOwnPropertyDescriptor,Pi=(i,t,e,s)=>{for(var n=s>1?void 0:s?mu(t,e):t,o=i.length-1,r;o>=0;o--)(r=i[o])&&(n=(s?r(t,e,n):r(n))||n);return s&&n&&gu(t,e,n),n};const Rr="ON",Fr="OFF";function Rs(){let i=window.location.pathname;return i.endsWith("/")?i.slice(0,-1):i}let lt=class extends J{constructor(){super(...arguments);this.entities=[],this.has_controls=!1,this.show_all=!1,this._actionRenderer=new bu,this._basePath=Rs()}connectedCallback(){var i;super.connectedCallback(),(i=window.source)==null||i.addEventListener("state",t=>{const e=t,s=JSON.parse(e.data);let n=this.entities.findIndex(o=>o.unique_id===s.id);if(n===-1&&s.id){let o=s.id.split("-"),r=dt($({},s),{domain:o[0],unique_id:s.id,id:o.slice(1).join("-"),entity_category:s.entity_category,value_numeric_history:[s.value]});r.has_action=this.hasAction(r),r.has_action&&(this.has_controls=!0),this.entities.push(r),this.entities.sort((a,c)=>a.entity_category<c.entity_category||a.entity_category==c.entity_category&&a.name<c.name?-1:1),this.requestUpdate()}else{if(typeof s.value=="number"){let o=[...this.entities[n].value_numeric_history];o.push(s.value),this.entities[n].value_numeric_history=o.splice(-50)}delete s.id,delete s.domain,delete s.unique_id,Object.assign(this.entities[n],s),this.requestUpdate()}})}hasAction(i){return`render_${i.domain}`in this._actionRenderer}control(i){return this._actionRenderer.entity=i,this._actionRenderer.actioner=this,this._actionRenderer.exec(`render_${i.domain}`)}restAction(i,t){fetch(`${this._basePath}/${i.domain}/${i.id}/${t}`,{method:"POST",body:"true"}).then(e=>{console.log(e)})}renderShowAll(){if(!this.show_all&&this.entities.find(i=>i.is_disabled_by_default))return C`<div class="singlebutton-row"><button class="abutton" @click="${i=>this.show_all=!0}">Show All</button></div>`}render(){function i(n,o){return n.reduce(function(r,a){return(r.get(a[o])||(()=>{let c=[];return r.set(a[o],c),c})()).push(a),r},new Map)}const t=this.show_all?this.entities:this.entities.filter(n=>!n.is_disabled_by_default),e=i(t,"entity_category"),s=Array.from(e,([n,o])=>({name:n,value:o}));return C`<div>${s.map(n=>C`<div class="tab-header">${lt.ENTITY_CATEGORIES[parseInt(n.name)]||lt.ENTITY_UNDEFINED}</div><div class="tab-container">${n.value.map((o,r)=>C`<div class="entity-row" .domain="${o.domain}" @click="${this._handleEntityRowClick}"><div>${o.icon?C`<iconify-icon icon="${o.icon}" height="24px"></iconify-icon>`:R}</div><div>${o.name}</div><div>${this.has_controls&&o.has_action?this.control(o):C`<div>${o.state}</div>`}</div>${o.domain==="sensor"?C`<esp-entity-chart .chartdata="${o.value_numeric_history}"></esp-entity-chart>`:R}</div>`)}</div>`)} ${this.renderShowAll()}</div>`}static get styles(){return[ji,en,ra,aa,Bi]}_handleEntityRowClick(i){var t,e;((t=i==null?void 0:i.currentTarget)==null?void 0:t.domain)==="sensor"&&((i==null?void 0:i.ctrlKey)||i.stopPropagation(),(e=i==null?void 0:i.currentTarget)==null||e.classList.toggle("expanded",i.ctrlKey?!0:void 0))}};lt.ENTITY_UNDEFINED="States";lt.ENTITY_CATEGORIES=["Sensor and Control","Configuration","Diagnostic"];Pi([ft()],lt.prototype,"entities",2);Pi([ft()],lt.prototype,"has_controls",2);Pi([ft()],lt.prototype,"show_all",2);lt=Pi([Wt("esp-entity-table")],lt);class bu{exec(t){if(!this[t]||typeof this[t]!="function"){console.log(`ActionRenderer.${t} is not callable`);return}return this[t]()}_actionButton(t,e,s){if(!t)return;let n=s||e.toLowerCase();return C`<button class="abutton" @click="${()=>{var o;return(o=this.actioner)==null?void 0:o.restAction(t,n)}}">${e}</button>`}_switch(t){return C`<esp-switch color="var(--primary-color,currentColor)" .state="${t.state}" @state="${e=>{var n;let s="turn_"+e.detail.state;(n=this.actioner)==null||n.restAction(t,s.toLowerCase())}}"></esp-switch>`}_select(t,e,s,n,o){return C`<select @change="${r=>{var c,l;const a=(c=r.target)==null?void 0:c.value;(l=this.actioner)==null||l.restAction(t,`${e}?${s}=${encodeURIComponent(a)}`)}}">${n.map(r=>C`<option value="${r}" ?selected="${r==o}">${r}</option>`)}</select>`}_range(t,e,s,n,o,r,a){return C`<div class="range"><label>${o||0}</label> <input type="${t.mode==1?"number":"range"}" name="${t.unique_id}" id="${t.unique_id}" step="${a||1}" min="${o||Math.min(0,n)}" max="${r||Math.max(10,n)}" .value="${n}" @change="${c=>{var h,d;const l=(h=c.target)==null?void 0:h.value;(d=this.actioner)==null||d.restAction(t,`${e}?${s}=${l}`)}}"> <label>${r||100}</label></div>`}_textinput(t,e,s,n,o,r,a){return C`<input type="${t.mode==1?"password":"text"}" name="${t.unique_id}" id="${t.unique_id}" minlength="${o||Math.min(0,n)}" maxlength="${r||Math.max(255,n)}" pattern="${a||""}" value="${n}" @change="${c=>{var h,d;const l=(h=c.target)==null?void 0:h.value;(d=this.actioner)==null||d.restAction(t,`${e}?${s}=${encodeURIComponent(l)}`)}}">`}_datetime(t,e,s,n){let o="";return n.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2})?$/)?o="datetime-local":n.match(/^\d{4}-\d{2}-\d{2}$/)?o="date":n.match(/^\d{2}:\d{2}(:\d{2})?$/)&&(o="time"),console.log("type"),console.log(o),C`<input type="${o}" name="${t.unique_id}" id="${t.unique_id}" value="${n}" @change="${r=>{var c,l;const a=(c=r.target)==null?void 0:c.value;(l=this.actioner)==null||l.restAction(t,`${e}?${s}=${a}`)}}">`}_colorpicker(t,e,s){function n(r){return Number(r).toString(16).padStart(2,"0")}function o(r){var c;const a=((c=r.match(/[0-9a-f]{2}/gi))==null?void 0:c.map(l=>parseInt(l,16)))||[0,0,0];return`r=${a[0]}&g=${a[1]}&b=${a[2]}`}return C`<div class="colorpicker"><input type="color" name="${t.unique_id}" id="${t.unique_id}" value="#${n(s==null?void 0:s.r)}${n(s==null?void 0:s.g)}${n(s==null?void 0:s.b)}" @change="${r=>{var c,l;const a=(c=r.target)==null?void 0:c.value;(l=this.actioner)==null||l.restAction(t,`${e}?${o(a)}`)}}"></div>`}render_binary_sensor(){var e;if(!this.entity)return;const t=this.entity.state==Rr;return C`<iconify-icon class="binary_sensor_${(e=this.entity.state)==null?void 0:e.toLowerCase()}" icon="mdi:checkbox-${t?"marked-circle":"blank-circle-outline"}" height="24px"></iconify-icon>`}render_switch(){if(!!this.entity)return this.entity.assumed_state?C`${this._actionButton(this.entity,"\u274C","turn_off")} ${this._actionButton(this.entity,"\u2714\uFE0F","turn_on")}`:this._switch(this.entity)}render_fan(){if(!!this.entity)return[this.entity.speed," ",this.entity.speed_level,this._switch(this.entity),this.entity.speed_count?this._range(this.entity,`turn_${this.entity.state.toLowerCase()}`,"speed_level",this.entity.speed_level?this.entity.speed_level:0,0,this.entity.speed_count,1):""]}render_light(){var t,e;if(!!this.entity)return[C`<div class="entity">${this._switch(this.entity)} ${this.entity.brightness?this._range(this.entity,"turn_on","brightness",this.entity.brightness,0,255,1):""} ${this.entity.color_mode==="rgb"||this.entity.color_mode==="rgbw"?this._colorpicker(this.entity,"turn_on",(t=this.entity)==null?void 0:t.color):""} ${((e=this.entity.effects)==null?void 0:e.filter(s=>s!="None").length)?this._select(this.entity,"turn_on","effect",this.entity.effects||[],this.entity.effect):""}</div>`]}render_lock(){if(!!this.entity)return C`${this._actionButton(this.entity,"\u{1F510}","lock")} ${this._actionButton(this.entity,"\u{1F513}","unlock")} ${this._actionButton(this.entity,"\u2191","open")}`}render_cover(){if(!!this.entity)return C`${this._actionButton(this.entity,"\u2191","open")} ${this._actionButton(this.entity,"\u2610","stop")} ${this._actionButton(this.entity,"\u2193","close")}`}render_button(){if(!!this.entity)return C`${this._actionButton(this.entity,"PRESS","press")}`}render_select(){if(!!this.entity)return this._select(this.entity,"set","option",this.entity.option||[],this.entity.value)}render_number(){if(!!this.entity)return C`${this._range(this.entity,"set","value",this.entity.value,this.entity.min_value,this.entity.max_value,this.entity.step)} ${this.entity.uom}`}render_datetime(){if(!!this.entity)return C`${this._datetime(this.entity,"set","value",this.entity.value)} ${this.entity.uom}`}render_text(){if(!!this.entity)return this._textinput(this.entity,"set","value",this.entity.value,this.entity.min_length,this.entity.max_length,this.entity.pattern)}render_climate(){if(!this.entity)return;let t,e;this.entity.target_temperature_low!==void 0&&this.entity.target_temperature_high!==void 0?(e=C`${this.entity.target_temperature_low} .. ${this.entity.target_temperature_high}`,t=C`${this._range(this.entity,"set","target_temperature_low",this.entity.target_temperature_low,this.entity.min_temp,this.entity.max_temp,this.entity.step)} ${this._range(this.entity,"set","target_temperature_high",this.entity.target_temperature_high,this.entity.min_temp,this.entity.max_temp,this.entity.step)}`):(e=C`${this.entity.target_temperature}`,t=C`${this._range(this.entity,"set","target_temperature",this.entity.target_temperature,this.entity.min_temp,this.entity.max_temp,this.entity.step)}`);let s=C``;return(this.entity.modes?this.entity.modes.length:0)>0&&(s=C`Mode:<br>${this._select(this.entity,"set","mode",this.entity.modes||[],this.entity.mode||"")}`),C`<label>Current: ${this.entity.current_temperature}, Target: ${e}</label> ${t} ${s}`}}var _u=Object.defineProperty,yu=Object.getOwnPropertyDescriptor,$i=(i,t,e,s)=>{for(var n=s>1?void 0:s?yu(t,e):t,o=i.length-1,r;o>=0;o--)(r=i[o])&&(n=(s?r(t,e,n):r(n))||n);return s&&n&&_u(t,e,n),n};let Re=class extends J{constructor(){super();this.rows=10,this.scheme="",this.logs=[]}connectedCallback(){var i;super.connectedCallback(),(i=window.source)==null||i.addEventListener("log",t=>{const s=t.data;let o=s.slice(10,s.length-4).split(":").slice(0,2).join(":"),r=s.slice(12+o.length,s.length-4);const c={type:{"[1;31m":"e","[0;33m":"w","[0;32m":"i","[0;35m":"c","[0;36m":"d","[0;37m":"v"}[s.slice(0,7)],level:s.slice(7,10),tag:o,detail:r,when:new Date().toTimeString().split(" ")[0]};this.logs.push(c),this.logs=this.logs.slice(-this.rows)})}render(){return C`<div class="tab-header">Debug Log</div><div class="tab-container"><div class="logs" color-scheme="${this.scheme}"><div class="thead trow"><div>Time</div><div>Level</div><div>Tag</div><div>Message</div></div><div class="tbody">${this.logs.map(i=>C`<div class="trow ${i.type}"><div>${i.when}</div><div>${i.level}</div><div>${i.tag}</div><div>${i.detail}</div></div>`)}</div></div></div>`}static get styles(){return[Bi,it`.tbody .trow:nth-child(2n),.thead{background-color:rgba(127,127,127,.05)}.trow div{font-family:monospace;width:100%;line-height:1.2rem}.trow{display:flex}.thead{line-height:1rem}.thead .trow{text-align:left;padding:.25rem .5rem}.trow{display:flex}.trow>div{align-self:flex-start;padding-right:.25em;flex:2 0;overflow:hidden;text-overflow:ellipsis}.trow>div:nth-child(2){flex:1 0}.trow>div:nth-child(3){flex:3 0}.trow>div:last-child{flex:15 0;padding-right:0}pre{margin:0}.v{color:#888}.d{color:#0dd}.c{color:#ff00ff}.i{color:#32cd32}.w{color:#ff0}.e{color:red;font-weight:700}.logs[color-scheme=light]{font-weight:700}.logs[color-scheme=light] .w{color:#cc0}.logs[color-scheme=dark] .d{color:#0aa}.logs{overflow-x:auto;border-radius:12px;border-width:1px;border-style:solid;border-color:rgba(127,127,127,.12);transition:all .3s ease-out 0s;font-size:14px;padding:16px}@media (max-width:1024px){.trow>div:nth-child(2){display:none!important}}`]}};$i([st({type:Number})],Re.prototype,"rows",2);$i([st({type:String})],Re.prototype,"scheme",2);$i([ft()],Re.prototype,"logs",2);Re=$i([Wt("esp-log")],Re);var xu=Object.defineProperty,vu=Object.getOwnPropertyDescriptor,Zt=(i,t,e,s)=>{for(var n=s>1?void 0:s?vu(t,e):t,o=i.length-1,r;o>=0;o--)(r=i[o])&&(n=(s?r(t,e,n):r(n))||n);return s&&n&&xu(t,e,n),n};const zr="checkbox-lever";let Lt=class extends J{constructor(){super(...arguments);this.checkbox=null,this.stateOn=Rr,this.stateOff=Fr,this.state=Fr,this.color="currentColor",this.disabled=!1}firstUpdated(i){var t;this.checkbox=(t=this.shadowRoot)==null?void 0:t.getElementById(zr)}isOn(){return this.state===this.stateOn}toggle(i){const t=this.isOn()?this.stateOff:this.stateOn;let e=new CustomEvent("state",{detail:{state:t,id:this.id}});this.dispatchEvent(e)}render(){return C`<div class="sw"><label><input id="${zr}" type="checkbox" .checked="${this.isOn()}" .disabled="${this.disabled}" @click="${this.toggle}"> <span style="color:${this.color}" class="lever"></span></label></div>`}static get styles(){return[ji,it`.sw,.sw *{-webkit-tap-highlight-color:transparent;user-select:none;cursor:pointer}input[type=checkbox]{opacity:0;width:0;height:0}input[type=checkbox]:checked+.lever{background-color:currentColor;background-image:linear-gradient(0deg,rgba(255,255,255,.5) 0,rgba(255,255,255,.5) 100%)}input[type=checkbox]:checked+.lever:after,input[type=checkbox]:checked+.lever:before{left:18px}input[type=checkbox]:checked+.lever:after{background-color:currentColor}input[type=checkbox]:not(:checked)+.lever:after{background-color:rgba(127,127,127,.5)}.lever{content:"";display:inline-block;position:relative;width:36px;height:14px;background-image:linear-gradient(0deg,rgba(127,127,127,.5) 0,rgba(127,127,127,.5) 100%);background-color:inherit;border-radius:15px;transition:background .3s ease;vertical-align:middle}.lever:after,.lever:before{content:"";position:absolute;display:inline-block;width:20px;height:20px;border-radius:50%;left:0;top:-3px;transition:left .3s ease,background .3s ease,box-shadow .1s ease,transform .1s ease}.lever:before{background-color:currentColor;background-image:linear-gradient(0deg,rgba(255,255,255,.9) 0,rgba(255,255,255,.9) 100%)}.lever:after{background-color:#f1f1f1;box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12)}input[type=checkbox]:checked:not(:disabled).tabbed:focus~.lever::before,input[type=checkbox]:checked:not(:disabled)~.lever:active::before{transform:scale(2.4);background-color:rgba(255,255,255,.9) 0;background-image:linear-gradient(0deg,rgba(255,255,255,.9) 0,rgba(255,255,255,.9) 100%)}input[type=checkbox]:not(:disabled).tabbed:focus~.lever::before,input[type=checkbox]:not(:disabled)~.lever:active:before{transform:scale(2.4);background-color:rgba(0,0,0,.08)}input[type=checkbox][disabled]+.lever{cursor:default;background-color:rgba(0,0,0,.12)}input[type=checkbox][disabled]+.lever:after,input[type=checkbox][disabled]:checked+.lever:after{background-color:#949494}`]}};Zt([st({type:String})],Lt.prototype,"stateOn",2);Zt([st({type:String})],Lt.prototype,"stateOff",2);Zt([st({type:String})],Lt.prototype,"state",2);Zt([st({type:String})],Lt.prototype,"color",2);Zt([st({type:Boolean})],Lt.prototype,"disabled",2);Lt=Zt([Wt("esp-switch")],Lt);var wu='<svg xmlns="http://www.w3.org/2000/svg" viewBox="7 8 73 60" width="52" height="40"><g style="fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"><g id="b"><path d="M27 15v-3c0-1 1-2.7 2-2.7 2 0 3 1.7 3 2.7v3" id="a" style="stroke-linecap:butt"/><use x="9" href="#a"/><use x="18" href="#a"/><use x="27" href="#a"/><use x="36" href="#a"/><use x="45" href="#a"/></g><use transform="matrix(1 0 0 -1 0 72)" href="#b"/><path d="M78 16H26c-1 0-1 1-1 1v38c0 1 0 1 1 1h52c1 0 1 0 1-1V17s0-1-1-1z" class="box"/><path d="M40 38h2.9v7.8h17V38h2.9l-2.9-2.9V30h-1.8v3.3l-6.8-6.8z" stroke="none" fill="currentColor"/><path d="M24 54H8v-4h12v-4H8v-4h12v-4H8v-4h12v-4H8V18" style="stroke-linecap:butt"/></g></svg>',ku=Object.defineProperty,Su=Object.getOwnPropertyDescriptor,Mu=(i,t,e,s)=>{for(var n=s>1?void 0:s?Su(t,e):t,o=i.length-1,r;o>=0;o--)(r=i[o])&&(n=(s?r(t,e,n):r(n))||n);return s&&n&&ku(t,e,n),n};let Nr=class extends J{render(){return Kr([wu])}};Nr=Mu([Wt("esp-logo")],Nr);var Ou=it`.flex-grid-half{display:grid;grid-template-columns:500px 2fr}.flex-grid-half.expanded_entity,.flex-grid-half.expanded_logs{grid-template-columns:1fr}.flex-grid-half .col{margin:8px}.flex-grid-half .col:nth-child(2){overflow:hidden}.flex-grid-half.expanded_logs .col:nth-child(1){display:none}.flex-grid-half.expanded_entity .col:nth-child(2){display:none}@media (max-width:1024px){.flex-grid,.flex-grid-half{display:block}.flex-grid-half .col{width:100%!important;margin:0 0 10px 0!important;display:block!important}}*{box-sizing:border-box}.flex-grid{margin:0 0 20px 0}h1{text-align:center;width:100%;line-height:1.1em;margin-block:.25em}header div{text-align:center;width:100%}header #logo,header iconify-icon{float:right;font-size:2.5rem;color:rgba(127,127,127,.5)}header #logo{float:left;color:rgba(127,127,127,.5)}esp-logo{float:left;line-height:1em;font-size:initial}form{display:flex;justify-content:space-between;background-color:rgba(127,127,127,.05);border-radius:12px;border-width:1px;border-style:solid;border-color:rgba(127,127,127,.12)}form .btn{margin-right:0}`,Cu=Object.defineProperty,Au=Object.getOwnPropertyDescriptor,Jt=(i,t,e,s)=>{for(var n=s>1?void 0:s?Au(t,e):t,o=i.length-1,r;o>=0;o--)(r=i[o])&&(n=(s?r(t,e,n):r(n))||n);return s&&n&&Cu(t,e,n),n};window.source=new EventSource(Rs()+"/events");function Pu(i){const t=Math.sign(i);if(i===0)return new Intl.RelativeTimeFormat("en").format(0,"second");const e=[{type:"year",seconds:12*30*24*60*60*1e3},{type:"month",seconds:30*24*60*60*1e3},{type:"week",seconds:7*24*60*60*1e3},{type:"day",seconds:24*60*60*1e3},{type:"hour",seconds:60*60*1e3},{type:"minute",seconds:60*1e3},{type:"second",seconds:1e3}];let s="";const n=new Intl.RelativeTimeFormat("en");let o=0;for(let r of e){const a=Math.trunc(Math.abs(i/r.seconds));if(a>0){const c=n.format(a*t,r.type);if(i-=a*r.seconds*t,s+=o===0&&r.type!="second"?c.replace(" ago"," "):c,o++>=1)break}}return s}let Rt=class extends J{constructor(){super();this.scheme="",this.ping=0,this.connected=!0,this.lastUpdate=0,this.version="2.0.5",this.config={ota:!1,log:!0,title:"",comment:""},this.darkQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.frames=[{},{color:"red",transform:"scale(1.25)"},{}];const i=document.querySelector("script#config");i&&this.setConfig(JSON.parse(i.innerText))}setConfig(i){"log"in i||(i.log=this.config.log),this.config=i,document.title=i.title,document.documentElement.lang=i.lang}firstUpdated(i){super.firstUpdated(i),document.getElementsByTagName("head")[0].innerHTML+='<meta name=viewport content="width=device-width, initial-scale=1,user-scalable=no">';const t=document.querySelector("link[rel~='icon']");t.href='data:image/svg+xml,<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg"><style>path{stroke-width:1;fill:black;stroke:black;stroke-linecap:round;stroke-linejoin:round}@media (prefers-color-scheme:dark){path{fill:white;stroke:white}}</style><path d="M1.3 18H5v10h21.8V18h3.7l-3.7-3.7V7.8h-2.4V12l-8.7-8.7L1.3 18Z"/></svg>',this.scheme=this.schemeDefault(),window.source.addEventListener("ping",e=>{var s;((s=e.data)==null?void 0:s.length)&&(this.setConfig(JSON.parse(e.data)),this.requestUpdate()),this._updateUptime(e),this.lastUpdate=Date.now()}),window.source.addEventListener("log",e=>{this._updateUptime(e),this.lastUpdate=Date.now()}),window.source.addEventListener("state",e=>{this.lastUpdate=Date.now()}),window.source.addEventListener("error",e=>{console.dir(e),this.connected=!1,this.requestUpdate()}),setInterval(()=>{this.connected=!!this.ping&&Date.now()-this.lastUpdate<15e3},5e3)}schemeDefault(){return this.darkQuery.matches?"dark":"light"}updated(i){super.updated(i),i.has("scheme")&&document.documentElement.style.setProperty("color-scheme",this.scheme),i.has("ping")&&this.ping&&this.beat.animate(this.frames,1e3)}uptime(){return`${Pu(-this.ping|0)}`}renderOta(){if(this.config.ota){let i=Rs();return C`<div class="tab-header">OTA Update</div><form method="POST" action="${i}/update" enctype="multipart/form-data" class="tab-container"><input class="btn" type="file" name="update"> <input class="btn" type="submit" value="Update"></form>`}}renderLog(){return this.config.log?C`<section id="col_logs" class="col" @dblclick="${this._handleDblClick}"><esp-log rows="50" .scheme="${this.scheme}"></esp-log></section>`:R}renderTitle(){return C`<h1>${this.config.title||C` `}</h1><div>${[this.config.comment,`started ${this.uptime()}`].filter(i=>i).map(i=>`${i}`).join(" \xB7 ")}</div>`}render(){return C`<header><a href="https://esphome.io/web-api" id="logo" title="${this.version}"><esp-logo></esp-logo></a><iconify-icon .icon="${this.connected?"mdi:heart":"mdi:heart-off"}" .title="${this.uptime()}" class="top-icon" id="beat"></iconify-icon><a href="#" id="scheme" @click="${()=>{this.scheme=this.scheme!=="dark"?"dark":"light"}}"><iconify-icon icon="mdi:theme-light-dark" class="top-icon"></iconify-icon></a>${this.renderTitle()}</header><main class="flex-grid-half" @toggle-layout="${this._handleLayoutToggle}"><section id="col_entities" class="col" @dblclick="${this._handleDblClick}"><esp-entity-table .scheme="${this.scheme}"></esp-entity-table>${this.renderOta()}</section>${this.renderLog()}</main>`}_handleDblClick(i){var t,e,s,n,o,r;(s=(t=i.currentTarget)==null?void 0:t.parentNode)==null||s.classList.toggle("expanded_entity",((e=i.currentTarget)==null?void 0:e.id)==="col_entities"?void 0:!1),(r=(n=i.currentTarget)==null?void 0:n.parentNode)==null||r.classList.toggle("expanded_logs",((o=i.currentTarget)==null?void 0:o.id)==="col_logs"?void 0:!1)}_updateUptime(i){i.lastEventId&&(this.ping=parseInt(i.lastEventId),this.connected=!0,this.requestUpdate())}static get styles(){return[ji,en,Ou,Bi]}};Jt([ft()],Rt.prototype,"scheme",2);Jt([ft()],Rt.prototype,"ping",2);Jt([ft()],Rt.prototype,"connected",2);Jt([ft()],Rt.prototype,"lastUpdate",2);Jt([oa("#beat")],Rt.prototype,"beat",2);Rt=Jt([Wt("esp-app")],Rt);