0}_computeGridLineItems(e){const t=this.axis,i=this.chart,n=this.options,{grid:o,position:r,border:a}=n,l=o.offset,d=this.isHorizontal(),p=this.ticks.length+(l?1:0),m=getTickMarkLength(o),v=[],y=a.setContext(this.getContext()),b=y.display?y.width:0,S=b/2,E=function($){return _alignPixel(i,$,b)};let T,R,A,D,x,M,I,V,U,B,Y,ne;if(r==="top")T=E(this.bottom),M=this.bottom-m,V=T-S,B=E(e.top)+S,ne=e.bottom;else if(r==="bottom")T=E(this.top),B=e.top,ne=E(e.bottom)-S,M=T+S,V=this.top+m;else if(r==="left")T=E(this.right),x=this.right-m,I=T-S,U=E(e.left)+S,Y=e.right;else if(r==="right")T=E(this.left),U=e.left,Y=E(e.right)-S,x=T+S,I=this.left+m;else if(t==="x"){if(r==="center")T=E((e.top+e.bottom)/2+.5);else if(isObject(r)){const $=Object.keys(r)[0],q=r[$];T=E(this.chart.scales[$].getPixelForValue(q))}B=e.top,ne=e.bottom,M=T+S,V=M+m}else if(t==="y"){if(r==="center")T=E((e.left+e.right)/2);else if(isObject(r)){const $=Object.keys(r)[0],q=r[$];T=E(this.chart.scales[$].getPixelForValue(q))}x=T-S,I=x-m,U=e.left,Y=e.right}const ee=valueOrDefault(n.ticks.maxTicksLimit,p),F=Math.max(1,Math.ceil(p/ee));for(R=0;R0&&(ie-=le/2);break}ue={left:ie,top:oe,width:le+ve.width,height:ae+ve.height,color:F.backdropColor}}S.push({label:A,font:V,textOffset:Y,options:{rotation:b,color:q,strokeColor:W,strokeWidth:J,textAlign:K,textBaseline:ne,translation:[D,x],backdrop:ue}})}return S}_getXAxisLabelAlignment(){const{position:e,ticks:t}=this.options;if(-toRadians(this.labelRotation))return e==="top"?"left":"right";let n="center";return t.align==="start"?n="left":t.align==="end"?n="right":t.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(e){const{position:t,ticks:{crossAlign:i,mirror:n,padding:o}}=this.options,r=this._getLabelSizes(),a=e+o,l=r.widest.width;let d,h;return t==="left"?n?(h=this.right+o,i==="near"?d="left":i==="center"?(d="center",h+=l/2):(d="right",h+=l)):(h=this.right-a,i==="near"?d="right":i==="center"?(d="center",h-=l/2):(d="left",h=this.left)):t==="right"?n?(h=this.left+o,i==="near"?d="right":i==="center"?(d="center",h-=l/2):(d="left",h-=l)):(h=this.left+a,i==="near"?d="left":i==="center"?(d="center",h+=l/2):(d="right",h=this.right)):d="right",{textAlign:d,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,t=this.options.position;if(t==="left"||t==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(t==="top"||t==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:t},left:i,top:n,width:o,height:r}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(i,n,o,r),e.restore())}getLineWidthForValue(e){const t=this.options.grid;if(!this._isVisible()||!t.display)return 0;const n=this.ticks.findIndex(o=>o.value===e);return n>=0?t.setContext(this.getContext(n)).lineWidth:0}drawGrid(e){const t=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let o,r;const a=(l,d,h)=>{!h.width||!h.color||(i.save(),i.lineWidth=h.width,i.strokeStyle=h.color,i.setLineDash(h.borderDash||[]),i.lineDashOffset=h.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(d.x,d.y),i.stroke(),i.restore())};if(t.display)for(o=0,r=n.length;o{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:t,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(e){const t=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[];let o,r;for(o=0,r=t.length;o{const i=t.split("."),n=i.pop(),o=[s].concat(i).join("."),r=e[t].split("."),a=r.pop(),l=r.join(".");defaults.route(o,n,l,a)})}function isIChartComponent(s){return"id"in s&&"defaults"in s}class Registry{constructor(){this.controllers=new TypedRegistry(DatasetController,"datasets",!0),this.elements=new TypedRegistry(Element$1,"elements"),this.plugins=new TypedRegistry(Object,"plugins"),this.scales=new TypedRegistry(Scale,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,t,i){[...t].forEach(n=>{const o=i||this._getRegistryForType(n);i||o.isForType(n)||o===this.plugins&&n.id?this._exec(e,o,n):each(n,r=>{const a=i||this._getRegistryForType(r);this._exec(e,a,r)})})}_exec(e,t,i){const n=_capitalize(e);callback(i["before"+n],[],i),t[e](i),callback(i["after"+n],[],i)}_getRegistryForType(e){for(let t=0;to.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(n(t,i),e,"stop"),this._notify(n(i,t),e,"start")}}function allPlugins(s){const e={},t=[],i=Object.keys(registry.plugins.items);for(let o=0;o1&&idMatchesAxis(s[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${s}' axis. Please provide 'axis' or 'position' option.`)}function getAxisFromDataset(s,e,t){if(t[e+"AxisID"]===s)return{axis:e}}function retrieveAxisFromDatasets(s,e){if(e.data&&e.data.datasets){const t=e.data.datasets.filter(i=>i.xAxisID===s||i.yAxisID===s);if(t.length)return getAxisFromDataset(s,"x",t[0])||getAxisFromDataset(s,"y",t[0])}return{}}function mergeScaleConfig(s,e){const t=overrides[s.type]||{scales:{}},i=e.scales||{},n=getIndexAxis(s.type,e),o=Object.create(null);return Object.keys(i).forEach(r=>{const a=i[r];if(!isObject(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 l=determineAxis(r,a,retrieveAxisFromDatasets(r,s),defaults.scales[a.type]),d=getDefaultScaleIDFromAxis(l,n),h=t.scales||{};o[r]=mergeIf(Object.create(null),[{axis:l},a,h[l],h[d]])}),s.data.datasets.forEach(r=>{const a=r.type||s.type,l=r.indexAxis||getIndexAxis(a,e),h=(overrides[a]||{}).scales||{};Object.keys(h).forEach(p=>{const m=getAxisFromDefaultScaleID(p,l),v=r[m+"AxisID"]||m;o[v]=o[v]||Object.create(null),mergeIf(o[v],[{axis:m},i[v],h[p]])})}),Object.keys(o).forEach(r=>{const a=o[r];mergeIf(a,[defaults.scales[a.type],defaults.scale])}),o}function initOptions(s){const e=s.options||(s.options={});e.plugins=valueOrDefault(e.plugins,{}),e.scales=mergeScaleConfig(s,e)}function initData(s){return s=s||{},s.datasets=s.datasets||[],s.labels=s.labels||[],s}function initConfig(s){return s=s||{},s.data=initData(s.data),initOptions(s),s}const keyCache=new Map,keysCached=new Set;function cachedKeys(s,e){let t=keyCache.get(s);return t||(t=e(),keyCache.set(s,t),keysCached.add(t)),t}const addIfFound=(s,e,t)=>{const i=resolveObjectKey(e,t);i!==void 0&&s.add(i)};class Config{constructor(e){this._config=initConfig(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=initData(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),initOptions(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return cachedKeys(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,t){return cachedKeys(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,t){return cachedKeys(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,""]])}pluginScopeKeys(e){const t=e.id,i=this.type;return cachedKeys(`${i}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){const i=this._scopeCache;let n=i.get(e);return(!n||t)&&(n=new Map,i.set(e,n)),n}getOptionScopes(e,t,i){const{options:n,type:o}=this,r=this._cachedScopes(e,i),a=r.get(t);if(a)return a;const l=new Set;t.forEach(h=>{e&&(l.add(e),h.forEach(p=>addIfFound(l,e,p))),h.forEach(p=>addIfFound(l,n,p)),h.forEach(p=>addIfFound(l,overrides[o]||{},p)),h.forEach(p=>addIfFound(l,defaults,p)),h.forEach(p=>addIfFound(l,descriptors,p))});const d=Array.from(l);return d.length===0&&d.push(Object.create(null)),keysCached.has(t)&&r.set(t,d),d}chartOptionScopes(){const{options:e,type:t}=this;return[e,overrides[t]||{},defaults.datasets[t]||{},{type:t},defaults,descriptors]}resolveNamedOptions(e,t,i,n=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=getResolver(this._resolverCache,e,n);let l=r;if(needContext(r,t)){o.$shared=!1,i=isFunction$1(i)?i():i;const d=this.createResolver(e,i,a);l=_attachContext(r,i,d)}for(const d of t)o[d]=l[d];return o}createResolver(e,t,i=[""],n){const{resolver:o}=getResolver(this._resolverCache,e,i);return isObject(t)?_attachContext(o,t,void 0,n):o}}function getResolver(s,e,t){let i=s.get(e);i||(i=new Map,s.set(e,i));const n=t.join();let o=i.get(n);return o||(o={resolver:_createResolver(e,t),subPrefixes:t.filter(a=>!a.toLowerCase().includes("hover"))},i.set(n,o)),o}const hasFunction=s=>isObject(s)&&Object.getOwnPropertyNames(s).some(e=>isFunction$1(s[e]));function needContext(s,e){const{isScriptable:t,isIndexable:i}=_descriptors(s);for(const n of e){const o=t(n),r=i(n),a=(r||o)&&s[n];if(o&&(isFunction$1(a)||hasFunction(a))||r&&isArray(a))return!0}return!1}var version="4.4.2";const KNOWN_POSITIONS=["top","bottom","left","right","chartArea"];function positionIsHorizontal(s,e){return s==="top"||s==="bottom"||KNOWN_POSITIONS.indexOf(s)===-1&&e==="x"}function compare2Level(s,e){return function(t,i){return t[s]===i[s]?t[e]-i[e]:t[s]-i[s]}}function onAnimationsComplete(s){const e=s.chart,t=e.options.animation;e.notifyPlugins("afterRender"),callback(t&&t.onComplete,[s],e)}function onAnimationProgress(s){const e=s.chart,t=e.options.animation;callback(t&&t.onProgress,[s],e)}function getCanvas(s){return _isDomSupported()&&typeof s=="string"?s=document.getElementById(s):s&&s.length&&(s=s[0]),s&&s.canvas&&(s=s.canvas),s}const instances={},getChart=s=>{const e=getCanvas(s);return Object.values(instances).filter(t=>t.canvas===e).pop()};function moveNumericKeys(s,e,t){const i=Object.keys(s);for(const n of i){const o=+n;if(o>=e){const r=s[n];delete s[n],(t>0||o>e)&&(s[o+t]=r)}}}function determineLastEvent(s,e,t,i){return!t||s.type==="mouseout"?null:i?e:s}function getSizeForArea(s,e,t){return s.options.clip?s[t]:e[t]}function getDatasetArea(s,e){const{xScale:t,yScale:i}=s;return t&&i?{left:getSizeForArea(t,e,"left"),right:getSizeForArea(t,e,"right"),top:getSizeForArea(i,e,"top"),bottom:getSizeForArea(i,e,"bottom")}:e}class Chart{static register(...e){registry.add(...e),invalidatePlugins()}static unregister(...e){registry.remove(...e),invalidatePlugins()}constructor(e,t){const i=this.config=new Config(t),n=getCanvas(e),o=getChart(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=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||_detectPlatform(n)),this.platform.updateConfig(i);const a=this.platform.acquireContext(n,r.aspectRatio),l=a&&a.canvas,d=l&&l.height,h=l&&l.width;if(this.id=uid(),this.ctx=a,this.canvas=l,this.width=h,this.height=d,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 PluginService,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=debounce$3(p=>this.update(p),r.resizeDelay||0),this._dataChanges=[],instances[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}animator.listen(this,"complete",onAnimationsComplete),animator.listen(this,"progress",onAnimationProgress),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:t},width:i,height:n,_aspectRatio:o}=this;return isNullOrUndef(e)?t&&o?o:n?i/n:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return registry}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():retinaScale(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return clearCanvas(this.canvas,this.ctx),this}stop(){return animator.stop(this),this}resize(e,t){animator.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){const i=this.options,n=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(n,e,t,o),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,retinaScale(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),callback(i.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const t=this.options.scales||{};each(t,(i,n)=>{i.id=n})}buildOrUpdateScales(){const e=this.options,t=e.scales,i=this.scales,n=Object.keys(i).reduce((r,a)=>(r[a]=!1,r),{});let o=[];t&&(o=o.concat(Object.keys(t).map(r=>{const a=t[r],l=determineAxis(r,a),d=l==="r",h=l==="x";return{options:a,dposition:d?"chartArea":h?"bottom":"left",dtype:d?"radialLinear":h?"category":"linear"}}))),each(o,r=>{const a=r.options,l=a.id,d=determineAxis(l,a),h=valueOrDefault(a.type,r.dtype);(a.position===void 0||positionIsHorizontal(a.position,d)!==positionIsHorizontal(r.dposition))&&(a.position=r.dposition),n[l]=!0;let p=null;if(l in i&&i[l].type===h)p=i[l];else{const m=registry.getScale(h);p=new m({id:l,type:h,ctx:this.ctx,chart:this}),i[p.id]=p}p.init(a,e)}),each(n,(r,a)=>{r||delete i[a]}),each(i,r=>{layouts.configure(this,r,r.options),layouts.addBox(this,r)})}_updateMetasets(){const e=this._metasets,t=this.data.datasets.length,i=e.length;if(e.sort((n,o)=>n.index-o.index),i>t){for(let n=t;nt.length&&delete this._stacks,e.forEach((i,n)=>{t.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){const e=[],t=this.data.datasets;let i,n;for(this._removeUnreferencedMetasets(),i=0,n=t.length;i{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const t=this.config;t.update();const i=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let d=0,h=this.data.datasets.length;d{d.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(compare2Level("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){each(this.scales,e=>{layouts.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,t=new Set(Object.keys(this._listeners)),i=new Set(e.events);(!setsEqual(t,i)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(const{method:i,start:n,count:o}of t){const r=i==="_removeElements"?-o:o;moveNumericKeys(e,n,r)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const t=this.data.datasets.length,i=o=>new Set(e.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),n=i(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;layouts.update(this,this.width,this.height,e);const t=this.chartArea,i=t.width<=0||t.height<=0;this._layers=[],each(this.boxes,n=>{i&&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(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let t=0,i=this.data.datasets.length;t=0;--t)this._drawDataset(e[t]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const t=this.ctx,i=e._clip,n=!i.disabled,o=getDatasetArea(e,this.chartArea),r={meta:e,index:e.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(n&&clipArea(t,{left:i.left===!1?0:o.left-i.left,right:i.right===!1?this.width:o.right+i.right,top:i.top===!1?0:o.top-i.top,bottom:i.bottom===!1?this.height:o.bottom+i.bottom}),e.controller.draw(),n&&unclipArea(t),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(e){return _isPointInArea(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,i,n){const o=Interaction.modes[t];return typeof o=="function"?o(this,e,i,n):[]}getDatasetMeta(e){const t=this.data.datasets[e],i=this._metasets;let n=i.filter(o=>o&&o._dataset===t).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},i.push(n)),n}getContext(){return this.$context||(this.$context=createContext(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const t=this.data.datasets[e];if(!t)return!1;const i=this.getDatasetMeta(e);return typeof i.hidden=="boolean"?!i.hidden:!t.hidden}setDatasetVisibility(e,t){const i=this.getDatasetMeta(e);i.hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,i){const n=i?"show":"hide",o=this.getDatasetMeta(e),r=o.controller._resolveAnimations(void 0,n);defined$1(t)?(o.data[t].hidden=!i,this.update()):(this.setDatasetVisibility(e,i),r.update(o,{visible:i}),this.update(a=>a.datasetIndex===e?n:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){const t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),animator.remove(this),e=0,t=this.data.datasets.length;e{t.addEventListener(this,o,r),e[o]=r},n=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};each(this.options.events,o=>i(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,t=this.platform,i=(l,d)=>{t.addEventListener(this,l,d),e[l]=d},n=(l,d)=>{e[l]&&(t.removeEventListener(this,l,d),delete e[l])},o=(l,d)=>{this.canvas&&this.resize(l,d)};let r;const a=()=>{n("attach",a),this.attached=!0,this.resize(),i("resize",o),i("detach",r)};r=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),i("attach",a)},t.isAttached(this.canvas)?a():r()}unbindEvents(){each(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},each(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,i){const n=i?"set":"remove";let o,r,a,l;for(t==="dataset"&&(o=this.getDatasetMeta(e[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),a=0,l=e.length;a{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}});!_elementsEqual(i,t)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,t))}notifyPlugins(e,t,i){return this._plugins.notify(this,e,t,i)}isPluginEnabled(e){return this._plugins._cache.filter(t=>t.plugin.id===e).length===1}_updateHoverStyles(e,t,i){const n=this.options.hover,o=(l,d)=>l.filter(h=>!d.some(p=>h.datasetIndex===p.datasetIndex&&h.index===p.index)),r=o(t,e),a=i?e:o(e,t);r.length&&this.updateHoverStyle(r,n.mode,!1),a.length&&n.mode&&this.updateHoverStyle(a,n.mode,!0)}_eventHandler(e,t){const i={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},n=r=>(r.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",i,n)===!1)return;const o=this._handleEvent(e,t,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(o||i.changed)&&this.render(),this}_handleEvent(e,t,i){const{_active:n=[],options:o}=this,r=t,a=this._getActiveElements(e,n,i,r),l=_isClickEvent(e),d=determineLastEvent(e,this._lastEvent,i,l);i&&(this._lastEvent=null,callback(o.onHover,[e,a,this],this),l&&callback(o.onClick,[e,a,this],this));const h=!_elementsEqual(a,n);return(h||t)&&(this._active=a,this._updateHoverStyles(a,n,t)),this._lastEvent=d,h}_getActiveElements(e,t,i,n){if(e.type==="mouseout")return[];if(!i)return t;const o=this.options.hover;return this.getElementsAtEventForMode(e,o.mode,o,n)}}G(Chart,"defaults",defaults),G(Chart,"instances",instances),G(Chart,"overrides",overrides),G(Chart,"registry",registry),G(Chart,"version",version),G(Chart,"getChart",getChart);function invalidatePlugins(){return each(Chart.instances,s=>s._plugins.invalidate())}function clipArc(s,e,t){const{startAngle:i,pixelMargin:n,x:o,y:r,outerRadius:a,innerRadius:l}=e;let d=n/a;s.beginPath(),s.arc(o,r,a,i-d,t+d),l>n?(d=n/l,s.arc(o,r,l,t+d,i-d,!0)):s.arc(o,r,n,t+HALF_PI,i-HALF_PI),s.closePath(),s.clip()}function toRadiusCorners(s){return _readValueToProps(s,["outerStart","outerEnd","innerStart","innerEnd"])}function parseBorderRadius$1(s,e,t,i){const n=toRadiusCorners(s.options.borderRadius),o=(t-e)/2,r=Math.min(o,i*e/2),a=l=>{const d=(t-Math.min(o,l))*i/2;return _limitValue(l,0,Math.min(o,d))};return{outerStart:a(n.outerStart),outerEnd:a(n.outerEnd),innerStart:_limitValue(n.innerStart,0,r),innerEnd:_limitValue(n.innerEnd,0,r)}}function rThetaToXY(s,e,t,i){return{x:t+s*Math.cos(e),y:i+s*Math.sin(e)}}function pathArc(s,e,t,i,n,o){const{x:r,y:a,startAngle:l,pixelMargin:d,innerRadius:h}=e,p=Math.max(e.outerRadius+i+t-d,0),m=h>0?h+i+t+d:0;let v=0;const y=n-l;if(i){const F=h>0?h-i:0,$=p>0?p-i:0,q=(F+$)/2,W=q!==0?y*q/(q+i):y;v=(y-W)/2}const b=Math.max(.001,y*p-t/PI)/p,S=(y-b)/2,E=l+S+v,T=n-S-v,{outerStart:R,outerEnd:A,innerStart:D,innerEnd:x}=parseBorderRadius$1(e,m,p,T-E),M=p-R,I=p-A,V=E+R/M,U=T-A/I,B=m+D,Y=m+x,ne=E+D/B,ee=T-x/Y;if(s.beginPath(),o){const F=(V+U)/2;if(s.arc(r,a,p,V,F),s.arc(r,a,p,F,U),A>0){const J=rThetaToXY(I,U,r,a);s.arc(J.x,J.y,A,U,T+HALF_PI)}const $=rThetaToXY(Y,T,r,a);if(s.lineTo($.x,$.y),x>0){const J=rThetaToXY(Y,ee,r,a);s.arc(J.x,J.y,x,T+HALF_PI,ee+Math.PI)}const q=(T-x/m+(E+D/m))/2;if(s.arc(r,a,m,T-x/m,q,!0),s.arc(r,a,m,q,E+D/m,!0),D>0){const J=rThetaToXY(B,ne,r,a);s.arc(J.x,J.y,D,ne+Math.PI,E-HALF_PI)}const W=rThetaToXY(M,E,r,a);if(s.lineTo(W.x,W.y),R>0){const J=rThetaToXY(M,V,r,a);s.arc(J.x,J.y,R,E-HALF_PI,V)}}else{s.moveTo(r,a);const F=Math.cos(V)*p+r,$=Math.sin(V)*p+a;s.lineTo(F,$);const q=Math.cos(U)*p+r,W=Math.sin(U)*p+a;s.lineTo(q,W)}s.closePath()}function drawArc(s,e,t,i,n){const{fullCircles:o,startAngle:r,circumference:a}=e;let l=e.endAngle;if(o){pathArc(s,e,t,i,l,n);for(let d=0;d=TAU||_angleBetween(r,l,d),S=_isBetween(a,h+v,p+v);return b&&S}getCenterPoint(t){const{x:i,y:n,startAngle:o,endAngle:r,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:d,spacing:h}=this.options,p=(o+r)/2,m=(a+l+h+d)/2;return{x:i+Math.cos(p)*m,y:n+Math.sin(p)*m}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:i,circumference:n}=this,o=(i.offset||0)/4,r=(i.spacing||0)/2,a=i.circular;if(this.pixelMargin=i.borderAlign==="inner"?.33:0,this.fullCircles=n>TAU?Math.floor(n/TAU):0,n===0||this.innerRadius<0||this.outerRadius<0)return;t.save();const l=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(l)*o,Math.sin(l)*o);const d=1-Math.sin(Math.min(PI,n||0)),h=o*d;t.fillStyle=i.backgroundColor,t.strokeStyle=i.borderColor,drawArc(t,this,h,r,a),drawBorder(t,this,h,r,a),t.restore()}}G(ArcElement,"id","arc"),G(ArcElement,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),G(ArcElement,"defaultRoutes",{backgroundColor:"backgroundColor"}),G(ArcElement,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"});function setStyle$1(s,e,t=e){s.lineCap=valueOrDefault(t.borderCapStyle,e.borderCapStyle),s.setLineDash(valueOrDefault(t.borderDash,e.borderDash)),s.lineDashOffset=valueOrDefault(t.borderDashOffset,e.borderDashOffset),s.lineJoin=valueOrDefault(t.borderJoinStyle,e.borderJoinStyle),s.lineWidth=valueOrDefault(t.borderWidth,e.borderWidth),s.strokeStyle=valueOrDefault(t.borderColor,e.borderColor)}function lineTo(s,e,t){s.lineTo(t.x,t.y)}function getLineMethod(s){return s.stepped?_steppedLineTo:s.tension||s.cubicInterpolationMode==="monotone"?_bezierCurveTo:lineTo}function pathVars(s,e,t={}){const i=s.length,{start:n=0,end:o=i-1}=t,{start:r,end:a}=e,l=Math.max(n,r),d=Math.min(o,a),h=na&&o>a;return{count:i,start:l,loop:e.loop,ilen:d(r+(d?a-A:A))%o,R=()=>{b!==S&&(s.lineTo(h,S),s.lineTo(h,b),s.lineTo(h,E))};for(l&&(v=n[T(0)],s.moveTo(v.x,v.y)),m=0;m<=a;++m){if(v=n[T(m)],v.skip)continue;const A=v.x,D=v.y,x=A|0;x===y?(DS&&(S=D),h=(p*h+A)/++p):(R(),s.lineTo(A,D),y=x,p=0,b=S=D),E=D}R()}function _getSegmentMethod(s){const e=s.options,t=e.borderDash&&e.borderDash.length;return!s._decimated&&!s._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!t?fastPathSegment:pathSegment}function _getInterpolationMethod(s){return s.stepped?_steppedInterpolation:s.tension||s.cubicInterpolationMode==="monotone"?_bezierInterpolation:_pointInLine}function strokePathWithCache(s,e,t,i){let n=e._path;n||(n=e._path=new Path2D,e.path(n,t,i)&&n.closePath()),setStyle$1(s,e.options),s.stroke(n)}function strokePathDirect(s,e,t,i){const{segments:n,options:o}=e,r=_getSegmentMethod(e);for(const a of n)setStyle$1(s,o,a.style),s.beginPath(),r(s,e,a,{start:t,end:t+i-1})&&s.closePath(),s.stroke()}const usePath2D=typeof Path2D=="function";function draw(s,e,t,i){usePath2D&&!e.options.segment?strokePathWithCache(s,e,t,i):strokePathDirect(s,e,t,i)}class LineElement extends Element$1{constructor(e){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,e&&Object.assign(this,e)}updateControlPoints(e,t){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const n=i.spanGaps?this._loop:this._fullLoop;_updateBezierControlPoints(this._points,i,e,n,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=_computeSegments(this,this.options.segment))}first(){const e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){const e=this.segments,t=this.points,i=e.length;return i&&t[e[i-1].end]}interpolate(e,t){const i=this.options,n=e[t],o=this.points,r=_boundSegments(this,{property:t,start:n,end:n});if(!r.length)return;const a=[],l=_getInterpolationMethod(i);let d,h;for(d=0,h=r.length;de!=="borderDash"&&e!=="fill"});function inRange$1(s,e,t,i){const n=s.options,{[t]:o}=s.getProps([t],i);return Math.abs(e-o)s.replace("rgb(","rgba(").replace(")",", 0.5)"));function getBorderColor(s){return BORDER_COLORS[s%BORDER_COLORS.length]}function getBackgroundColor(s){return BACKGROUND_COLORS[s%BACKGROUND_COLORS.length]}function colorizeDefaultDataset(s,e){return s.borderColor=getBorderColor(e),s.backgroundColor=getBackgroundColor(e),++e}function colorizeDoughnutDataset(s,e){return s.backgroundColor=s.data.map(()=>getBorderColor(e++)),e}function colorizePolarAreaDataset(s,e){return s.backgroundColor=s.data.map(()=>getBackgroundColor(e++)),e}function getColorizer(s){let e=0;return(t,i)=>{const n=s.getDatasetMeta(i).controller;n instanceof DoughnutController?e=colorizeDoughnutDataset(t,e):n instanceof PolarAreaController?e=colorizePolarAreaDataset(t,e):n&&(e=colorizeDefaultDataset(t,e))}}function containsColorsDefinitions(s){let e;for(e in s)if(s[e].borderColor||s[e].backgroundColor)return!0;return!1}function containsColorsDefinition(s){return s&&(s.borderColor||s.backgroundColor)}var plugin_colors={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(s,e,t){if(!t.enabled)return;const{data:{datasets:i},options:n}=s.config,{elements:o}=n;if(!t.forceOverride&&(containsColorsDefinitions(i)||containsColorsDefinition(n)||o&&containsColorsDefinitions(o)))return;const r=getColorizer(s);i.forEach(r)}};function _segments(s,e,t){const i=s.segments,n=s.points,o=e.points,r=[];for(const a of i){let{start:l,end:d}=a;d=_findSegmentEnd(l,d,n);const h=_getBounds(t,n[l],n[d],a.loop);if(!e.segments){r.push({source:a,target:h,start:n[l],end:n[d]});continue}const p=_boundSegments(e,h);for(const m of p){const v=_getBounds(t,o[m.start],o[m.end],m.loop),y=_boundSegment(a,n,v);for(const b of y)r.push({source:b,target:m,start:{[t]:_getEdge(h,v,"start",Math.max)},end:{[t]:_getEdge(h,v,"end",Math.min)}})}}return r}function _getBounds(s,e,t,i){if(i)return;let n=e[s],o=t[s];return s==="angle"&&(n=_normalizeAngle(n),o=_normalizeAngle(o)),{property:s,start:n,end:o}}function _pointsFromSegments(s,e){const{x:t=null,y:i=null}=s||{},n=e.points,o=[];return e.segments.forEach(({start:r,end:a})=>{a=_findSegmentEnd(r,a,n);const l=n[r],d=n[a];i!==null?(o.push({x:l.x,y:i}),o.push({x:d.x,y:i})):t!==null&&(o.push({x:t,y:l.y}),o.push({x:t,y:d.y}))}),o}function _findSegmentEnd(s,e,t){for(;e>s;e--){const i=t[e];if(!isNaN(i.x)&&!isNaN(i.y))break}return e}function _getEdge(s,e,t,i){return s&&e?i(s[t],e[t]):s?s[t]:e?e[t]:0}function _createBoundaryLine(s,e){let t=[],i=!1;return isArray(s)?(i=!0,t=s):t=_pointsFromSegments(s,e),t.length?new LineElement({points:t,options:{tension:0},_loop:i,_fullLoop:i}):null}function _shouldApplyFill(s){return s&&s.fill!==!1}function _resolveTarget(s,e,t){let n=s[e].fill;const o=[e];let r;if(!t)return n;for(;n!==!1&&o.indexOf(n)===-1;){if(!isNumberFinite(n))return n;if(r=s[n],!r)return!1;if(r.visible)return n;o.push(n),n=r.fill}return!1}function _decodeFill(s,e,t){const i=parseFillOption(s);if(isObject(i))return isNaN(i.value)?!1:i;let n=parseFloat(i);return isNumberFinite(n)&&Math.floor(n)===n?decodeTargetIndex(i[0],e,n,t):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function decodeTargetIndex(s,e,t,i){return(s==="-"||s==="+")&&(t=e+t),t===e||t<0||t>=i?!1:t}function _getTargetPixel(s,e){let t=null;return s==="start"?t=e.bottom:s==="end"?t=e.top:isObject(s)?t=e.getPixelForValue(s.value):e.getBasePixel&&(t=e.getBasePixel()),t}function _getTargetValue(s,e,t){let i;return s==="start"?i=t:s==="end"?i=e.options.reverse?e.min:e.max:isObject(s)?i=s.value:i=e.getBaseValue(),i}function parseFillOption(s){const e=s.options,t=e.fill;let i=valueOrDefault(t&&t.target,t);return i===void 0&&(i=!!e.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function _buildStackLine(s){const{scale:e,index:t,line:i}=s,n=[],o=i.segments,r=i.points,a=getLinesBelow(e,t);a.push(_createBoundaryLine({x:null,y:e.bottom},i));for(let l=0;l=0;--r){const a=n[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),i&&a.fill&&_drawfill(s.ctx,a,o))}},beforeDatasetsDraw(s,e,t){if(t.drawTime!=="beforeDatasetsDraw")return;const i=s.getSortedVisibleDatasetMetas();for(let n=i.length-1;n>=0;--n){const o=i[n].$filler;_shouldApplyFill(o)&&_drawfill(s.ctx,o,s.chartArea)}},beforeDatasetDraw(s,e,t){const i=e.meta.$filler;!_shouldApplyFill(i)||t.drawTime!=="beforeDatasetDraw"||_drawfill(s.ctx,i,s.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const getBoxSize=(s,e)=>{let{boxHeight:t=e,boxWidth:i=e}=s;return s.usePointStyle&&(t=Math.min(t,e),i=s.pointStyleWidth||Math.min(i,e)),{boxWidth:i,boxHeight:t,itemHeight:Math.max(e,t)}},itemsEqual=(s,e)=>s!==null&&e!==null&&s.datasetIndex===e.datasetIndex&&s.index===e.index;class Legend extends Element$1{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t,i){this.maxWidth=e,this.maxHeight=t,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const e=this.options.labels||{};let t=callback(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter(i=>e.filter(i,this.chart.data))),e.sort&&(t=t.sort((i,n)=>e.sort(i,n,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){const{options:e,ctx:t}=this;if(!e.display){this.width=this.height=0;return}const i=e.labels,n=toFont(i.font),o=n.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=getBoxSize(i,o);let d,h;t.font=n.string,this.isHorizontal()?(d=this.maxWidth,h=this._fitRows(r,o,a,l)+10):(h=this.maxHeight,d=this._fitCols(r,n,a,l)+10),this.width=Math.min(d,e.maxWidth||this.maxWidth),this.height=Math.min(h,e.maxHeight||this.maxHeight)}_fitRows(e,t,i,n){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],d=this.lineWidths=[0],h=n+a;let p=e;o.textAlign="left",o.textBaseline="middle";let m=-1,v=-h;return this.legendItems.forEach((y,b)=>{const S=i+t/2+o.measureText(y.text).width;(b===0||d[d.length-1]+S+2*a>r)&&(p+=h,d[d.length-(b>0?0:1)]=0,v+=h,m++),l[b]={left:0,top:v,row:m,width:S,height:n},d[d.length-1]+=S+a}),p}_fitCols(e,t,i,n){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],d=this.columnSizes=[],h=r-e;let p=a,m=0,v=0,y=0,b=0;return this.legendItems.forEach((S,E)=>{const{itemWidth:T,itemHeight:R}=calculateItemSize(i,t,o,S,n);E>0&&v+R+2*a>h&&(p+=m+a,d.push({width:m,height:v}),y+=m+a,b++,m=v=0),l[E]={left:y,top:v,col:b,width:T,height:R},m=Math.max(m,T),v+=R+a}),p+=m,d.push({width:m,height:v}),p}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:i,labels:{padding:n},rtl:o}}=this,r=getRtlAdapter(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=_alignStartEnd(i,this.left+n,this.right-this.lineWidths[a]);for(const d of t)a!==d.row&&(a=d.row,l=_alignStartEnd(i,this.left+n,this.right-this.lineWidths[a])),d.top+=this.top+e+n,d.left=r.leftForLtr(r.x(l),d.width),l+=d.width+n}else{let a=0,l=_alignStartEnd(i,this.top+e+n,this.bottom-this.columnSizes[a].height);for(const d of t)d.col!==a&&(a=d.col,l=_alignStartEnd(i,this.top+e+n,this.bottom-this.columnSizes[a].height)),d.top=l,d.left+=this.left+n,d.left=r.leftForLtr(r.x(d.left),d.width),l+=d.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const e=this.ctx;clipArea(e,this),this._draw(),unclipArea(e)}}_draw(){const{options:e,columnSizes:t,lineWidths:i,ctx:n}=this,{align:o,labels:r}=e,a=defaults.color,l=getRtlAdapter(e.rtl,this.left,this.width),d=toFont(r.font),{padding:h}=r,p=d.size,m=p/2;let v;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=d.string;const{boxWidth:y,boxHeight:b,itemHeight:S}=getBoxSize(r,p),E=function(x,M,I){if(isNaN(y)||y<=0||isNaN(b)||b<0)return;n.save();const V=valueOrDefault(I.lineWidth,1);if(n.fillStyle=valueOrDefault(I.fillStyle,a),n.lineCap=valueOrDefault(I.lineCap,"butt"),n.lineDashOffset=valueOrDefault(I.lineDashOffset,0),n.lineJoin=valueOrDefault(I.lineJoin,"miter"),n.lineWidth=V,n.strokeStyle=valueOrDefault(I.strokeStyle,a),n.setLineDash(valueOrDefault(I.lineDash,[])),r.usePointStyle){const U={radius:b*Math.SQRT2/2,pointStyle:I.pointStyle,rotation:I.rotation,borderWidth:V},B=l.xPlus(x,y/2),Y=M+m;drawPointLegend(n,U,B,Y,r.pointStyleWidth&&y)}else{const U=M+Math.max((p-b)/2,0),B=l.leftForLtr(x,y),Y=toTRBLCorners(I.borderRadius);n.beginPath(),Object.values(Y).some(ne=>ne!==0)?addRoundedRectPath(n,{x:B,y:U,w:y,h:b,radius:Y}):n.rect(B,U,y,b),n.fill(),V!==0&&n.stroke()}n.restore()},T=function(x,M,I){renderText(n,I.text,x,M+S/2,d,{strikethrough:I.hidden,textAlign:l.textAlign(I.textAlign)})},R=this.isHorizontal(),A=this._computeTitleHeight();R?v={x:_alignStartEnd(o,this.left+h,this.right-i[0]),y:this.top+h+A,line:0}:v={x:this.left+h,y:_alignStartEnd(o,this.top+A+h,this.bottom-t[0].height),line:0},overrideTextDirection(this.ctx,e.textDirection);const D=S+h;this.legendItems.forEach((x,M)=>{n.strokeStyle=x.fontColor,n.fillStyle=x.fontColor;const I=n.measureText(x.text).width,V=l.textAlign(x.textAlign||(x.textAlign=r.textAlign)),U=y+m+I;let B=v.x,Y=v.y;l.setWidth(this.width),R?M>0&&B+U+h>this.right&&(Y=v.y+=D,v.line++,B=v.x=_alignStartEnd(o,this.left+h,this.right-i[v.line])):M>0&&Y+D>this.bottom&&(B=v.x=B+t[v.line].width+h,v.line++,Y=v.y=_alignStartEnd(o,this.top+A+h,this.bottom-t[v.line].height));const ne=l.x(B);if(E(ne,Y,x),B=_textX(V,B+y+m,R?B+U:this.right,e.rtl),T(l.x(B),Y,x),R)v.x+=U+h;else if(typeof x.text!="string"){const ee=d.lineHeight;v.y+=calculateLegendItemHeight(x,ee)+h}else v.y+=D}),restoreTextDirection(this.ctx,e.textDirection)}drawTitle(){const e=this.options,t=e.title,i=toFont(t.font),n=toPadding(t.padding);if(!t.display)return;const o=getRtlAdapter(e.rtl,this.left,this.width),r=this.ctx,a=t.position,l=i.size/2,d=n.top+l;let h,p=this.left,m=this.width;if(this.isHorizontal())m=Math.max(...this.lineWidths),h=this.top+d,p=_alignStartEnd(e.align,p,this.right-m);else{const y=this.columnSizes.reduce((b,S)=>Math.max(b,S.height),0);h=d+_alignStartEnd(e.align,this.top,this.bottom-y-e.labels.padding-this._computeTitleHeight())}const v=_alignStartEnd(a,p,p+m);r.textAlign=o.textAlign(_toLeftRightCenter(a)),r.textBaseline="middle",r.strokeStyle=t.color,r.fillStyle=t.color,r.font=i.string,renderText(r,t.text,v,h,i)}_computeTitleHeight(){const e=this.options.title,t=toFont(e.font),i=toPadding(e.padding);return e.display?t.lineHeight+i.height:0}_getLegendItemAt(e,t){let i,n,o;if(_isBetween(e,this.left,this.right)&&_isBetween(t,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;io.length>r.length?o:r)),e+t.size/2+i.measureText(n).width}function calculateItemHeight(s,e,t){let i=s;return typeof e.text!="string"&&(i=calculateLegendItemHeight(e,t)),i}function calculateLegendItemHeight(s,e){const t=s.text?s.text.length:0;return e*t}function isListened(s,e){return!!((s==="mousemove"||s==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(s==="click"||s==="mouseup"))}var plugin_legend={id:"legend",_element:Legend,start(s,e,t){const i=s.legend=new Legend({ctx:s.ctx,options:t,chart:s});layouts.configure(s,i,t),layouts.addBox(s,i)},stop(s){layouts.removeBox(s,s.legend),delete s.legend},beforeUpdate(s,e,t){const i=s.legend;layouts.configure(s,i,t),i.options=t},afterUpdate(s){const e=s.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(s,e){e.replay||s.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(s,e,t){const i=e.datasetIndex,n=t.chart;n.isDatasetVisible(i)?(n.hide(i),e.hidden=!0):(n.show(i),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:s=>s.chart.options.color,boxWidth:40,padding:10,generateLabels(s){const e=s.data.datasets,{labels:{usePointStyle:t,pointStyle:i,textAlign:n,color:o,useBorderRadius:r,borderRadius:a}}=s.legend.options;return s._getSortedDatasetMetas().map(l=>{const d=l.controller.getStyle(t?0:void 0),h=toPadding(d.borderWidth);return{text:e[l.index].label,fillStyle:d.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:d.borderCapStyle,lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:d.borderColor,pointStyle:i||d.pointStyle,rotation:d.rotation,textAlign:n||d.textAlign,borderRadius:r&&(a||d.borderRadius),datasetIndex:l.index}},this)}},title:{color:s=>s.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:s=>!s.startsWith("on"),labels:{_scriptable:s=>!["generateLabels","filter","sort"].includes(s)}}};const positioners={average(s){if(!s.length)return!1;let e,t,i=new Set,n=0,o=0;for(e=0,t=s.length;ea+l)/i.size,y:n/o}},nearest(s,e){if(!s.length)return!1;let t=e.x,i=e.y,n=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=s.length;o-1?s.split(`
-`):s}function createTooltipItem(s,e){const{element:t,datasetIndex:i,index:n}=e,o=s.getDatasetMeta(i).controller,{label:r,value:a}=o.getLabelAndValue(n);return{chart:s,label:r,parsed:o.getParsed(n),raw:s.data.datasets[i].data[n],formattedValue:a,dataset:o.getDataset(),dataIndex:n,datasetIndex:i,element:t}}function getTooltipSize(s,e){const t=s.chart.ctx,{body:i,footer:n,title:o}=s,{boxWidth:r,boxHeight:a}=e,l=toFont(e.bodyFont),d=toFont(e.titleFont),h=toFont(e.footerFont),p=o.length,m=n.length,v=i.length,y=toPadding(e.padding);let b=y.height,S=0,E=i.reduce((A,D)=>A+D.before.length+D.lines.length+D.after.length,0);if(E+=s.beforeBody.length+s.afterBody.length,p&&(b+=p*d.lineHeight+(p-1)*e.titleSpacing+e.titleMarginBottom),E){const A=e.displayColors?Math.max(a,l.lineHeight):l.lineHeight;b+=v*A+(E-v)*l.lineHeight+(E-1)*e.bodySpacing}m&&(b+=e.footerMarginTop+m*h.lineHeight+(m-1)*e.footerSpacing);let T=0;const R=function(A){S=Math.max(S,t.measureText(A).width+T)};return t.save(),t.font=d.string,each(s.title,R),t.font=l.string,each(s.beforeBody.concat(s.afterBody),R),T=e.displayColors?r+2+e.boxPadding:0,each(i,A=>{each(A.before,R),each(A.lines,R),each(A.after,R)}),T=0,t.font=h.string,each(s.footer,R),t.restore(),S+=y.width,{width:S,height:b}}function determineYAlign(s,e){const{y:t,height:i}=e;return ts.height-i/2?"bottom":"center"}function doesNotFitWithAlign(s,e,t,i){const{x:n,width:o}=i,r=t.caretSize+t.caretPadding;if(s==="left"&&n+o+r>e.width||s==="right"&&n-o-r<0)return!0}function determineXAlign(s,e,t,i){const{x:n,width:o}=t,{width:r,chartArea:{left:a,right:l}}=s;let d="center";return i==="center"?d=n<=(a+l)/2?"left":"right":n<=o/2?d="left":n>=r-o/2&&(d="right"),doesNotFitWithAlign(d,s,e,t)&&(d="center"),d}function determineAlignment(s,e,t){const i=t.yAlign||e.yAlign||determineYAlign(s,t);return{xAlign:t.xAlign||e.xAlign||determineXAlign(s,e,t,i),yAlign:i}}function alignX(s,e){let{x:t,width:i}=s;return e==="right"?t-=i:e==="center"&&(t-=i/2),t}function alignY(s,e,t){let{y:i,height:n}=s;return e==="top"?i+=t:e==="bottom"?i-=n+t:i-=n/2,i}function getBackgroundPoint(s,e,t,i){const{caretSize:n,caretPadding:o,cornerRadius:r}=s,{xAlign:a,yAlign:l}=t,d=n+o,{topLeft:h,topRight:p,bottomLeft:m,bottomRight:v}=toTRBLCorners(r);let y=alignX(e,a);const b=alignY(e,l,d);return l==="center"?a==="left"?y+=d:a==="right"&&(y-=d):a==="left"?y-=Math.max(h,m)+n:a==="right"&&(y+=Math.max(p,v)+n),{x:_limitValue(y,0,i.width-e.width),y:_limitValue(b,0,i.height-e.height)}}function getAlignedX(s,e,t){const i=toPadding(t.padding);return e==="center"?s.x+s.width/2:e==="right"?s.x+s.width-i.right:s.x+i.left}function getBeforeAfterBodyLines(s){return pushOrConcat([],splitNewlines(s))}function createTooltipContext(s,e,t){return createContext(s,{tooltip:e,tooltipItems:t,type:"tooltip"})}function overrideCallbacks(s,e){const t=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return t?s.override(t):s}const defaultCallbacks={beforeTitle:noop$1,title(s){if(s.length>0){const e=s[0],t=e.chart.data.labels,i=t?t.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(i>0&&e.dataIndex"u"?defaultCallbacks[e].call(t,i):n}class Tooltip extends Element$1{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const t=this.chart,i=this.options.setContext(this.getContext()),n=i.enabled&&t.options.animation&&i.animations,o=new Animations(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=createTooltipContext(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,t){const{callbacks:i}=t,n=invokeCallbackWithFallback(i,"beforeTitle",this,e),o=invokeCallbackWithFallback(i,"title",this,e),r=invokeCallbackWithFallback(i,"afterTitle",this,e);let a=[];return a=pushOrConcat(a,splitNewlines(n)),a=pushOrConcat(a,splitNewlines(o)),a=pushOrConcat(a,splitNewlines(r)),a}getBeforeBody(e,t){return getBeforeAfterBodyLines(invokeCallbackWithFallback(t.callbacks,"beforeBody",this,e))}getBody(e,t){const{callbacks:i}=t,n=[];return each(e,o=>{const r={before:[],lines:[],after:[]},a=overrideCallbacks(i,o);pushOrConcat(r.before,splitNewlines(invokeCallbackWithFallback(a,"beforeLabel",this,o))),pushOrConcat(r.lines,invokeCallbackWithFallback(a,"label",this,o)),pushOrConcat(r.after,splitNewlines(invokeCallbackWithFallback(a,"afterLabel",this,o))),n.push(r)}),n}getAfterBody(e,t){return getBeforeAfterBodyLines(invokeCallbackWithFallback(t.callbacks,"afterBody",this,e))}getFooter(e,t){const{callbacks:i}=t,n=invokeCallbackWithFallback(i,"beforeFooter",this,e),o=invokeCallbackWithFallback(i,"footer",this,e),r=invokeCallbackWithFallback(i,"afterFooter",this,e);let a=[];return a=pushOrConcat(a,splitNewlines(n)),a=pushOrConcat(a,splitNewlines(o)),a=pushOrConcat(a,splitNewlines(r)),a}_createItems(e){const t=this._active,i=this.chart.data,n=[],o=[],r=[];let a=[],l,d;for(l=0,d=t.length;le.filter(h,p,m,i))),e.itemSort&&(a=a.sort((h,p)=>e.itemSort(h,p,i))),each(a,h=>{const p=overrideCallbacks(e.callbacks,h);n.push(invokeCallbackWithFallback(p,"labelColor",this,h)),o.push(invokeCallbackWithFallback(p,"labelPointStyle",this,h)),r.push(invokeCallbackWithFallback(p,"labelTextColor",this,h))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(e,t){const i=this.options.setContext(this.getContext()),n=this._active;let o,r=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{const a=positioners[i.position].call(this,n,this._eventPosition);r=this._createItems(i),this.title=this.getTitle(r,i),this.beforeBody=this.getBeforeBody(r,i),this.body=this.getBody(r,i),this.afterBody=this.getAfterBody(r,i),this.footer=this.getFooter(r,i);const l=this._size=getTooltipSize(this,i),d=Object.assign({},a,l),h=determineAlignment(this.chart,i,d),p=getBackgroundPoint(i,d,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:p.x,y:p.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),e&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,i,n){const o=this.getCaretPosition(e,i,n);t.lineTo(o.x1,o.y1),t.lineTo(o.x2,o.y2),t.lineTo(o.x3,o.y3)}getCaretPosition(e,t,i){const{xAlign:n,yAlign:o}=this,{caretSize:r,cornerRadius:a}=i,{topLeft:l,topRight:d,bottomLeft:h,bottomRight:p}=toTRBLCorners(a),{x:m,y:v}=e,{width:y,height:b}=t;let S,E,T,R,A,D;return o==="center"?(A=v+b/2,n==="left"?(S=m,E=S-r,R=A+r,D=A-r):(S=m+y,E=S+r,R=A-r,D=A+r),T=S):(n==="left"?E=m+Math.max(l,h)+r:n==="right"?E=m+y-Math.max(d,p)-r:E=this.caretX,o==="top"?(R=v,A=R-r,S=E-r,T=E+r):(R=v+b,A=R+r,S=E+r,T=E-r),D=R),{x1:S,x2:E,x3:T,y1:R,y2:A,y3:D}}drawTitle(e,t,i){const n=this.title,o=n.length;let r,a,l;if(o){const d=getRtlAdapter(i.rtl,this.x,this.width);for(e.x=getAlignedX(this,i.titleAlign,i),t.textAlign=d.textAlign(i.titleAlign),t.textBaseline="middle",r=toFont(i.titleFont),a=i.titleSpacing,t.fillStyle=i.titleColor,t.font=r.string,l=0;lT!==0)?(e.beginPath(),e.fillStyle=o.multiKeyBackground,addRoundedRectPath(e,{x:b,y,w:d,h:l,radius:E}),e.fill(),e.stroke(),e.fillStyle=r.backgroundColor,e.beginPath(),addRoundedRectPath(e,{x:S,y:y+1,w:d-2,h:l-2,radius:E}),e.fill()):(e.fillStyle=o.multiKeyBackground,e.fillRect(b,y,d,l),e.strokeRect(b,y,d,l),e.fillStyle=r.backgroundColor,e.fillRect(S,y+1,d-2,l-2))}e.fillStyle=this.labelTextColors[i]}drawBody(e,t,i){const{body:n}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:d,boxPadding:h}=i,p=toFont(i.bodyFont);let m=p.lineHeight,v=0;const y=getRtlAdapter(i.rtl,this.x,this.width),b=function(I){t.fillText(I,y.x(e.x+v),e.y+m/2),e.y+=m+o},S=y.textAlign(r);let E,T,R,A,D,x,M;for(t.textAlign=r,t.textBaseline="middle",t.font=p.string,e.x=getAlignedX(this,S,i),t.fillStyle=i.bodyColor,each(this.beforeBody,b),v=a&&S!=="right"?r==="center"?d/2+h:d+2+h:0,A=0,x=n.length;A0&&t.stroke()}_updateAnimationTarget(e){const t=this.chart,i=this.$animations,n=i&&i.x,o=i&&i.y;if(n||o){const r=positioners[e.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=getTooltipSize(this,e),l=Object.assign({},r,this._size),d=determineAlignment(t,e,l),h=getBackgroundPoint(e,l,d,t);(n._to!==h.x||o._to!==h.y)&&(this.xAlign=d.xAlign,this.yAlign=d.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(e){const t=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(t);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const r=toPadding(t.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&a&&(e.save(),e.globalAlpha=i,this.drawBackground(o,e,n,t),overrideTextDirection(e,t.textDirection),o.y+=r.top,this.drawTitle(o,e,t),this.drawBody(o,e,t),this.drawFooter(o,e,t),restoreTextDirection(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){const i=this._active,n=e.map(({datasetIndex:a,index:l})=>{const d=this.chart.getDatasetMeta(a);if(!d)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:d.data[l],index:l}}),o=!_elementsEqual(i,n),r=this._positionChanged(n,t);(o||r)&&(this._active=n,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,i=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],r=this._getActiveElements(e,o,t,i),a=this._positionChanged(r,e),l=t||!_elementsEqual(r,o)||a;return l&&(this._active=r,(n.enabled||n.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),l}_getActiveElements(e,t,i,n){const o=this.options;if(e.type==="mouseout")return[];if(!n)return t.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(e,o.mode,o,i);return o.reverse&&r.reverse(),r}_positionChanged(e,t){const{caretX:i,caretY:n,options:o}=this,r=positioners[o.position].call(this,e,t);return r!==!1&&(i!==r.x||n!==r.y)}}G(Tooltip,"positioners",positioners);var plugin_tooltip={id:"tooltip",_element:Tooltip,positioners,afterInit(s,e,t){t&&(s.tooltip=new Tooltip({chart:s,options:t}))},beforeUpdate(s,e,t){s.tooltip&&s.tooltip.initialize(t)},reset(s,e,t){s.tooltip&&s.tooltip.initialize(t)},afterDraw(s){const e=s.tooltip;if(e&&e._willRender()){const t={tooltip:e};if(s.notifyPlugins("beforeTooltipDraw",{...t,cancelable:!0})===!1)return;e.draw(s.ctx),s.notifyPlugins("afterTooltipDraw",t)}},afterEvent(s,e){if(s.tooltip){const t=e.replay;s.tooltip.handleEvent(e.event,t,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(s,e)=>e.bodyFont.size,boxWidth:(s,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:defaultCallbacks},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:s=>s!=="filter"&&s!=="itemSort"&&s!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const addIfString=(s,e,t,i)=>(typeof e=="string"?(t=s.push(e)-1,i.unshift({index:t,label:e})):isNaN(e)&&(t=null),t);function findOrAddLabel(s,e,t,i){const n=s.indexOf(e);if(n===-1)return addIfString(s,e,t,i);const o=s.lastIndexOf(e);return n!==o?t:n}const validIndex=(s,e)=>s===null?null:_limitValue(Math.round(s),0,e);function _getLabelForValue(s){const e=this.getLabels();return s>=0&&st.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}G(CategoryScale,"id","category"),G(CategoryScale,"defaults",{ticks:{callback:_getLabelForValue}});function generateTicks$1(s,e){const t=[],{bounds:n,step:o,min:r,max:a,precision:l,count:d,maxTicks:h,maxDigits:p,includeBounds:m}=s,v=o||1,y=h-1,{min:b,max:S}=e,E=!isNullOrUndef(r),T=!isNullOrUndef(a),R=!isNullOrUndef(d),A=(S-b)/(p+1);let D=niceNum((S-b)/y/v)*v,x,M,I,V;if(D<1e-14&&!E&&!T)return[{value:b},{value:S}];V=Math.ceil(S/D)-Math.floor(b/D),V>y&&(D=niceNum(V*D/y/v)*v),isNullOrUndef(l)||(x=Math.pow(10,l),D=Math.ceil(D*x)/x),n==="ticks"?(M=Math.floor(b/D)*D,I=Math.ceil(S/D)*D):(M=b,I=S),E&&T&&o&&almostWhole((a-r)/o,D/1e3)?(V=Math.round(Math.min((a-r)/D,h)),D=(a-r)/V,M=r,I=a):R?(M=E?r:M,I=T?a:I,V=d-1,D=(I-M)/V):(V=(I-M)/D,almostEquals(V,Math.round(V),D/1e3)?V=Math.round(V):V=Math.ceil(V));const z=Math.max(_decimalPlaces(D),_decimalPlaces(M));x=Math.pow(10,isNullOrUndef(l)?z:l),M=Math.round(M*x)/x,I=Math.round(I*x)/x;let B=0;for(E&&(m&&M!==r?(t.push({value:r}),Ma)break;t.push({value:K})}return T&&m&&I!==a?t.length&&almostEquals(t[t.length-1].value,a,relativeLabelSize(a,A,s))?t[t.length-1].value=a:t.push({value:a}):(!T||I===a)&&t.push({value:I}),t}function relativeLabelSize(s,e,{horizontal:t,minRotation:i}){const n=toRadians(i),o=(t?Math.sin(n):Math.cos(n))||.001,r=.75*e*(""+s).length;return Math.min(e/o,r)}class LinearScaleBase extends Scale{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return isNullOrUndef(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:t,maxDefined:i}=this.getUserBounds();let{min:n,max:o}=this;const r=l=>n=t?n:l,a=l=>o=i?o:l;if(e){const l=sign(n),d=sign(o);l<0&&d<0?a(0):l>0&&d>0&&r(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);a(o+l),e||r(n-l)}this.min=n,this.max=o}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:t,stepSize:i}=e,n;return i?(n=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),t=t||11),t&&(n=Math.min(t,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,t=e.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n={maxTicks:i,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},o=this._range||this,r=generateTicks$1(n,o);return e.bounds==="ticks"&&_setMinAndMaxByKey(r,this,"value"),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const e=this.ticks;let t=this.min,i=this.max;if(super.configure(),this.options.offset&&e.length){const n=(i-t)/Math.max(e.length-1,1)/2;t-=n,i+=n}this._startValue=t,this._endValue=i,this._valueRange=i-t}getLabelForValue(e){return formatNumber(e,this.chart.options.locale,this.options.ticks.format)}}class LinearScale extends LinearScaleBase{determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=isNumberFinite(e)?e:0,this.max=isNumberFinite(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),t=e?this.width:this.height,i=toRadians(this.options.ticks.minRotation),n=(e?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,o.lineHeight/n))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}G(LinearScale,"id","linear"),G(LinearScale,"defaults",{ticks:{callback:Ticks.formatters.numeric}});const log10Floor=s=>Math.floor(log10(s)),changeExponent=(s,e)=>Math.pow(10,log10Floor(s)+e);function isMajor(s){return s/Math.pow(10,log10Floor(s))===1}function steps(s,e,t){const i=Math.pow(10,t),n=Math.floor(s/i);return Math.ceil(e/i)-n}function startExp(s,e){const t=e-s;let i=log10Floor(t);for(;steps(s,e,i)>10;)i++;for(;steps(s,e,i)<10;)i--;return Math.min(i,log10Floor(s))}function generateTicks(s,{min:e,max:t}){e=finiteOrDefault(s.min,e);const i=[],n=log10Floor(e);let o=startExp(e,t),r=o<0?Math.pow(10,Math.abs(o)):1;const a=Math.pow(10,o),l=n>o?Math.pow(10,n):0,d=Math.round((e-l)*r)/r,h=Math.floor((e-l)/a/10)*a*10;let p=Math.floor((d-h)/Math.pow(10,o)),m=finiteOrDefault(s.min,Math.round((l+h+p*Math.pow(10,o))*r)/r);for(;m=10?p=p<15?15:20:p++,p>=20&&(o++,p=2,r=o>=0?1:r),m=Math.round((l+h+p*Math.pow(10,o))*r)/r;const v=finiteOrDefault(s.max,m);return i.push({value:v,major:isMajor(v),significand:p}),i}class LogarithmicScale extends Scale{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,t){const i=LinearScaleBase.prototype.parse.apply(this,[e,t]);if(i===0){this._zero=!0;return}return isNumberFinite(i)&&i>0?i:null}determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=isNumberFinite(e)?Math.max(0,e):null,this.max=isNumberFinite(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!isNumberFinite(this._userMin)&&(this.min=e===changeExponent(this.min,0)?changeExponent(this.min,-1):changeExponent(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:e,maxDefined:t}=this.getUserBounds();let i=this.min,n=this.max;const o=a=>i=e?i:a,r=a=>n=t?n:a;i===n&&(i<=0?(o(1),r(10)):(o(changeExponent(i,-1)),r(changeExponent(n,1)))),i<=0&&o(changeExponent(n,-1)),n<=0&&r(changeExponent(i,1)),this.min=i,this.max=n}buildTicks(){const e=this.options,t={min:this._userMin,max:this._userMax},i=generateTicks(t,this);return e.bounds==="ticks"&&_setMinAndMaxByKey(i,this,"value"),e.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(e){return e===void 0?"0":formatNumber(e,this.chart.options.locale,this.options.ticks.format)}configure(){const e=this.min;super.configure(),this._startValue=log10(e),this._valueRange=log10(this.max)-log10(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(log10(e)-this._startValue)/this._valueRange)}getValueForPixel(e){const t=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+t*this._valueRange)}}G(LogarithmicScale,"id","logarithmic"),G(LogarithmicScale,"defaults",{ticks:{callback:Ticks.formatters.logarithmic,major:{enabled:!0}}});function getTickBackdropHeight(s){const e=s.ticks;if(e.display&&s.display){const t=toPadding(e.backdropPadding);return valueOrDefault(e.font&&e.font.size,defaults.font.size)+t.height}return 0}function measureLabelSize(s,e,t){return t=isArray(t)?t:[t],{w:_longestText(s,e.string,t),h:t.length*e.lineHeight}}function determineLimits(s,e,t,i,n){return s===i||s===n?{start:e-t/2,end:e+t/2}:sn?{start:e-t,end:e}:{start:e,end:e+t}}function fitWithPointLabels(s){const e={l:s.left+s._padding.left,r:s.right-s._padding.right,t:s.top+s._padding.top,b:s.bottom-s._padding.bottom},t=Object.assign({},e),i=[],n=[],o=s._pointLabels.length,r=s.options.pointLabels,a=r.centerPointLabels?PI/o:0;for(let l=0;le.r&&(a=(i.end-e.r)/o,s.r=Math.max(s.r,e.r+a)),n.starte.b&&(l=(n.end-e.b)/r,s.b=Math.max(s.b,e.b+l))}function createPointLabelItem(s,e,t){const i=s.drawingArea,{extra:n,additionalAngle:o,padding:r,size:a}=t,l=s.getPointPosition(e,i+n+r,o),d=Math.round(toDegrees(_normalizeAngle(l.angle+HALF_PI))),h=yForAngle(l.y,a.h,d),p=getTextAlignForAngle(d),m=leftForTextAlign(l.x,a.w,p);return{visible:!0,x:l.x,y:h,textAlign:p,left:m,top:h,right:m+a.w,bottom:h+a.h}}function isNotOverlapped(s,e){if(!e)return!0;const{left:t,top:i,right:n,bottom:o}=s;return!(_isPointInArea({x:t,y:i},e)||_isPointInArea({x:t,y:o},e)||_isPointInArea({x:n,y:i},e)||_isPointInArea({x:n,y:o},e))}function buildPointLabelItems(s,e,t){const i=[],n=s._pointLabels.length,o=s.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:getTickBackdropHeight(o)/2,additionalAngle:r?PI/n:0};let d;for(let h=0;h270||t<90)&&(s-=e),s}function drawPointLabelBox(s,e,t){const{left:i,top:n,right:o,bottom:r}=t,{backdropColor:a}=e;if(!isNullOrUndef(a)){const l=toTRBLCorners(e.borderRadius),d=toPadding(e.backdropPadding);s.fillStyle=a;const h=i-d.left,p=n-d.top,m=o-i+d.width,v=r-n+d.height;Object.values(l).some(y=>y!==0)?(s.beginPath(),addRoundedRectPath(s,{x:h,y:p,w:m,h:v,radius:l}),s.fill()):s.fillRect(h,p,m,v)}}function drawPointLabels(s,e){const{ctx:t,options:{pointLabels:i}}=s;for(let n=e-1;n>=0;n--){const o=s._pointLabelItems[n];if(!o.visible)continue;const r=i.setContext(s.getPointLabelContext(n));drawPointLabelBox(t,r,o);const a=toFont(r.font),{x:l,y:d,textAlign:h}=o;renderText(t,s._pointLabels[n],l,d+a.lineHeight/2,a,{color:r.color,textAlign:h,textBaseline:"middle"})}}function pathRadiusLine(s,e,t,i){const{ctx:n}=s;if(t)n.arc(s.xCenter,s.yCenter,e,0,TAU);else{let o=s.getPointPosition(0,e);n.moveTo(o.x,o.y);for(let r=1;r{const n=callback(this.options.pointLabels.callback,[t,i],this);return n||n===0?n:""}).filter((t,i)=>this.chart.getDataVisibility(i))}fit(){const e=this.options;e.display&&e.pointLabels.display?fitWithPointLabels(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,t,i,n){this.xCenter+=Math.floor((e-t)/2),this.yCenter+=Math.floor((i-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,t,i,n))}getIndexAngle(e){const t=TAU/(this._pointLabels.length||1),i=this.options.startAngle||0;return _normalizeAngle(e*t+toRadians(i))}getDistanceFromCenterForValue(e){if(isNullOrUndef(e))return NaN;const t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*t:(e-this.min)*t}getValueForDistanceFromCenter(e){if(isNullOrUndef(e))return NaN;const t=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(e){const t=this._pointLabels||[];if(e>=0&&e{if(p!==0||p===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);const m=this.getContext(p),v=n.setContext(m),y=o.setContext(m);drawRadiusLine(this,v,l,r,y)}}),i.display){for(e.save(),a=r-1;a>=0;a--){const h=i.setContext(this.getPointLabelContext(a)),{color:p,lineWidth:m}=h;!m||!p||(e.lineWidth=m,e.strokeStyle=p,e.setLineDash(h.borderDash),e.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(t.ticks.reverse?this.min:this.max),d=this.getPointPosition(a,l),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(d.x,d.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){const e=this.ctx,t=this.options,i=t.ticks;if(!i.display)return;const n=this.getIndexAngle(0);let o,r;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(n),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!t.reverse)return;const d=i.setContext(this.getContext(l)),h=toFont(d.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),d.showLabelBackdrop){e.font=h.string,r=e.measureText(a.label).width,e.fillStyle=d.backdropColor;const p=toPadding(d.backdropPadding);e.fillRect(-r/2-p.left,-o-h.size/2-p.top,r+p.width,h.size+p.height)}renderText(e,a.label,0,-o,h,{color:d.color,strokeColor:d.textStrokeColor,strokeWidth:d.textStrokeWidth})}),e.restore()}drawTitle(){}}G(RadialLinearScale,"id","radialLinear"),G(RadialLinearScale,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ticks.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}}),G(RadialLinearScale,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),G(RadialLinearScale,"descriptors",{angleLines:{_fallback:"grid"}});const INTERVALS={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}},UNITS=Object.keys(INTERVALS);function sorter(s,e){return s-e}function parse(s,e){if(isNullOrUndef(e))return null;const t=s._adapter,{parser:i,round:n,isoWeekday:o}=s._parseOpts;let r=e;return typeof i=="function"&&(r=i(r)),isNumberFinite(r)||(r=typeof i=="string"?t.parse(r,i):t.parse(r)),r===null?null:(n&&(r=n==="week"&&(isNumber(o)||o===!0)?t.startOf(r,"isoWeek",o):t.startOf(r,n)),+r)}function determineUnitForAutoTicks(s,e,t,i){const n=UNITS.length;for(let o=UNITS.indexOf(s);o=UNITS.indexOf(t);o--){const r=UNITS[o];if(INTERVALS[r].common&&s._adapter.diff(n,i,r)>=e-1)return r}return UNITS[t?UNITS.indexOf(t):0]}function determineMajorUnit(s){for(let e=UNITS.indexOf(s)+1,t=UNITS.length;e=e?t[i]:t[n];s[o]=!0}}function setMajorTicks(s,e,t,i){const n=s._adapter,o=+n.startOf(e[0].value,i),r=e[e.length-1].value;let a,l;for(a=o;a<=r;a=+n.add(a,1,i))l=t[a],l>=0&&(e[l].major=!0);return e}function ticksFromTimestamps(s,e,t){const i=[],n={},o=e.length;let r,a;for(r=0;r+e.value))}initOffsets(e=[]){let t=0,i=0,n,o;this.options.offset&&e.length&&(n=this.getDecimalForValue(e[0]),e.length===1?t=1-n:t=(this.getDecimalForValue(e[1])-n)/2,o=this.getDecimalForValue(e[e.length-1]),e.length===1?i=o:i=(o-this.getDecimalForValue(e[e.length-2]))/2);const r=e.length<3?.5:.25;t=_limitValue(t,0,r),i=_limitValue(i,0,r),this._offsets={start:t,end:i,factor:1/(t+1+i)}}_generate(){const e=this._adapter,t=this.min,i=this.max,n=this.options,o=n.time,r=o.unit||determineUnitForAutoTicks(o.minUnit,t,i,this._getLabelCapacity(t)),a=valueOrDefault(n.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,d=isNumber(l)||l===!0,h={};let p=t,m,v;if(d&&(p=+e.startOf(p,"isoWeek",l)),p=+e.startOf(p,d?"day":r),e.diff(i,t,r)>1e5*a)throw new Error(t+" and "+i+" are too far apart with stepSize of "+a+" "+r);const y=n.ticks.source==="data"&&this.getDataTimestamps();for(m=p,v=0;m+b)}getLabelForValue(e){const t=this._adapter,i=this.options.time;return i.tooltipFormat?t.format(e,i.tooltipFormat):t.format(e,i.displayFormats.datetime)}format(e,t){const n=this.options.time.displayFormats,o=this._unit,r=t||n[o];return this._adapter.format(e,r)}_tickFormatFunction(e,t,i,n){const o=this.options,r=o.ticks.callback;if(r)return callback(r,[e,t,i],this);const a=o.time.displayFormats,l=this._unit,d=this._majorUnit,h=l&&a[l],p=d&&a[d],m=i[t],v=d&&p&&m&&m.major;return this._adapter.format(e,n||(v?p:h))}generateTickLabels(e){let t,i,n;for(t=0,i=e.length;t0?a:1}getDataTimestamps(){let e=this._cache.data||[],t,i;if(e.length)return e;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(t=0,i=n.length;t=s[i].pos&&e<=s[n].pos&&({lo:i,hi:n}=_lookupByKey(s,"pos",e)),{pos:o,time:a}=s[i],{pos:r,time:l}=s[n]):(e>=s[i].time&&e<=s[n].time&&({lo:i,hi:n}=_lookupByKey(s,"time",e)),{time:o,pos:a}=s[i],{time:r,pos:l}=s[n]);const d=r-o;return d?a+(l-a)*(e-o)/d:a}class TimeSeriesScale extends TimeScale{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=interpolate(t,this.min),this._tableRange=interpolate(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:t,max:i}=this,n=[],o=[];let r,a,l,d,h;for(r=0,a=e.length;r=t&&d<=i&&n.push(d);if(n.length<2)return[{time:t,pos:0},{time:i,pos:1}];for(r=0,a=n.length;rn-o)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const t=this.getDataTimestamps(),i=this.getLabelTimestamps();return t.length&&i.length?e=this.normalize(t.concat(i)):e=t.length?t:i,e=this._cache.all=e,e}getDecimalForValue(e){return(interpolate(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const t=this._offsets,i=this.getDecimalForPixel(e)/t.factor-t.end;return interpolate(this._table,i*this._tableRange+this._minPos,!0)}}G(TimeSeriesScale,"id","timeseries"),G(TimeSeriesScale,"defaults",TimeScale.defaults);/*!
+`):s}function createTooltipItem(s,e){const{element:t,datasetIndex:i,index:n}=e,o=s.getDatasetMeta(i).controller,{label:r,value:a}=o.getLabelAndValue(n);return{chart:s,label:r,parsed:o.getParsed(n),raw:s.data.datasets[i].data[n],formattedValue:a,dataset:o.getDataset(),dataIndex:n,datasetIndex:i,element:t}}function getTooltipSize(s,e){const t=s.chart.ctx,{body:i,footer:n,title:o}=s,{boxWidth:r,boxHeight:a}=e,l=toFont(e.bodyFont),d=toFont(e.titleFont),h=toFont(e.footerFont),p=o.length,m=n.length,v=i.length,y=toPadding(e.padding);let b=y.height,S=0,E=i.reduce((A,D)=>A+D.before.length+D.lines.length+D.after.length,0);if(E+=s.beforeBody.length+s.afterBody.length,p&&(b+=p*d.lineHeight+(p-1)*e.titleSpacing+e.titleMarginBottom),E){const A=e.displayColors?Math.max(a,l.lineHeight):l.lineHeight;b+=v*A+(E-v)*l.lineHeight+(E-1)*e.bodySpacing}m&&(b+=e.footerMarginTop+m*h.lineHeight+(m-1)*e.footerSpacing);let T=0;const R=function(A){S=Math.max(S,t.measureText(A).width+T)};return t.save(),t.font=d.string,each(s.title,R),t.font=l.string,each(s.beforeBody.concat(s.afterBody),R),T=e.displayColors?r+2+e.boxPadding:0,each(i,A=>{each(A.before,R),each(A.lines,R),each(A.after,R)}),T=0,t.font=h.string,each(s.footer,R),t.restore(),S+=y.width,{width:S,height:b}}function determineYAlign(s,e){const{y:t,height:i}=e;return ts.height-i/2?"bottom":"center"}function doesNotFitWithAlign(s,e,t,i){const{x:n,width:o}=i,r=t.caretSize+t.caretPadding;if(s==="left"&&n+o+r>e.width||s==="right"&&n-o-r<0)return!0}function determineXAlign(s,e,t,i){const{x:n,width:o}=t,{width:r,chartArea:{left:a,right:l}}=s;let d="center";return i==="center"?d=n<=(a+l)/2?"left":"right":n<=o/2?d="left":n>=r-o/2&&(d="right"),doesNotFitWithAlign(d,s,e,t)&&(d="center"),d}function determineAlignment(s,e,t){const i=t.yAlign||e.yAlign||determineYAlign(s,t);return{xAlign:t.xAlign||e.xAlign||determineXAlign(s,e,t,i),yAlign:i}}function alignX(s,e){let{x:t,width:i}=s;return e==="right"?t-=i:e==="center"&&(t-=i/2),t}function alignY(s,e,t){let{y:i,height:n}=s;return e==="top"?i+=t:e==="bottom"?i-=n+t:i-=n/2,i}function getBackgroundPoint(s,e,t,i){const{caretSize:n,caretPadding:o,cornerRadius:r}=s,{xAlign:a,yAlign:l}=t,d=n+o,{topLeft:h,topRight:p,bottomLeft:m,bottomRight:v}=toTRBLCorners(r);let y=alignX(e,a);const b=alignY(e,l,d);return l==="center"?a==="left"?y+=d:a==="right"&&(y-=d):a==="left"?y-=Math.max(h,m)+n:a==="right"&&(y+=Math.max(p,v)+n),{x:_limitValue(y,0,i.width-e.width),y:_limitValue(b,0,i.height-e.height)}}function getAlignedX(s,e,t){const i=toPadding(t.padding);return e==="center"?s.x+s.width/2:e==="right"?s.x+s.width-i.right:s.x+i.left}function getBeforeAfterBodyLines(s){return pushOrConcat([],splitNewlines(s))}function createTooltipContext(s,e,t){return createContext(s,{tooltip:e,tooltipItems:t,type:"tooltip"})}function overrideCallbacks(s,e){const t=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return t?s.override(t):s}const defaultCallbacks={beforeTitle:noop$1,title(s){if(s.length>0){const e=s[0],t=e.chart.data.labels,i=t?t.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(i>0&&e.dataIndex"u"?defaultCallbacks[e].call(t,i):n}class Tooltip extends Element$1{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const t=this.chart,i=this.options.setContext(this.getContext()),n=i.enabled&&t.options.animation&&i.animations,o=new Animations(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=createTooltipContext(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,t){const{callbacks:i}=t,n=invokeCallbackWithFallback(i,"beforeTitle",this,e),o=invokeCallbackWithFallback(i,"title",this,e),r=invokeCallbackWithFallback(i,"afterTitle",this,e);let a=[];return a=pushOrConcat(a,splitNewlines(n)),a=pushOrConcat(a,splitNewlines(o)),a=pushOrConcat(a,splitNewlines(r)),a}getBeforeBody(e,t){return getBeforeAfterBodyLines(invokeCallbackWithFallback(t.callbacks,"beforeBody",this,e))}getBody(e,t){const{callbacks:i}=t,n=[];return each(e,o=>{const r={before:[],lines:[],after:[]},a=overrideCallbacks(i,o);pushOrConcat(r.before,splitNewlines(invokeCallbackWithFallback(a,"beforeLabel",this,o))),pushOrConcat(r.lines,invokeCallbackWithFallback(a,"label",this,o)),pushOrConcat(r.after,splitNewlines(invokeCallbackWithFallback(a,"afterLabel",this,o))),n.push(r)}),n}getAfterBody(e,t){return getBeforeAfterBodyLines(invokeCallbackWithFallback(t.callbacks,"afterBody",this,e))}getFooter(e,t){const{callbacks:i}=t,n=invokeCallbackWithFallback(i,"beforeFooter",this,e),o=invokeCallbackWithFallback(i,"footer",this,e),r=invokeCallbackWithFallback(i,"afterFooter",this,e);let a=[];return a=pushOrConcat(a,splitNewlines(n)),a=pushOrConcat(a,splitNewlines(o)),a=pushOrConcat(a,splitNewlines(r)),a}_createItems(e){const t=this._active,i=this.chart.data,n=[],o=[],r=[];let a=[],l,d;for(l=0,d=t.length;le.filter(h,p,m,i))),e.itemSort&&(a=a.sort((h,p)=>e.itemSort(h,p,i))),each(a,h=>{const p=overrideCallbacks(e.callbacks,h);n.push(invokeCallbackWithFallback(p,"labelColor",this,h)),o.push(invokeCallbackWithFallback(p,"labelPointStyle",this,h)),r.push(invokeCallbackWithFallback(p,"labelTextColor",this,h))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(e,t){const i=this.options.setContext(this.getContext()),n=this._active;let o,r=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{const a=positioners[i.position].call(this,n,this._eventPosition);r=this._createItems(i),this.title=this.getTitle(r,i),this.beforeBody=this.getBeforeBody(r,i),this.body=this.getBody(r,i),this.afterBody=this.getAfterBody(r,i),this.footer=this.getFooter(r,i);const l=this._size=getTooltipSize(this,i),d=Object.assign({},a,l),h=determineAlignment(this.chart,i,d),p=getBackgroundPoint(i,d,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:p.x,y:p.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),e&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,i,n){const o=this.getCaretPosition(e,i,n);t.lineTo(o.x1,o.y1),t.lineTo(o.x2,o.y2),t.lineTo(o.x3,o.y3)}getCaretPosition(e,t,i){const{xAlign:n,yAlign:o}=this,{caretSize:r,cornerRadius:a}=i,{topLeft:l,topRight:d,bottomLeft:h,bottomRight:p}=toTRBLCorners(a),{x:m,y:v}=e,{width:y,height:b}=t;let S,E,T,R,A,D;return o==="center"?(A=v+b/2,n==="left"?(S=m,E=S-r,R=A+r,D=A-r):(S=m+y,E=S+r,R=A-r,D=A+r),T=S):(n==="left"?E=m+Math.max(l,h)+r:n==="right"?E=m+y-Math.max(d,p)-r:E=this.caretX,o==="top"?(R=v,A=R-r,S=E-r,T=E+r):(R=v+b,A=R+r,S=E+r,T=E-r),D=R),{x1:S,x2:E,x3:T,y1:R,y2:A,y3:D}}drawTitle(e,t,i){const n=this.title,o=n.length;let r,a,l;if(o){const d=getRtlAdapter(i.rtl,this.x,this.width);for(e.x=getAlignedX(this,i.titleAlign,i),t.textAlign=d.textAlign(i.titleAlign),t.textBaseline="middle",r=toFont(i.titleFont),a=i.titleSpacing,t.fillStyle=i.titleColor,t.font=r.string,l=0;lT!==0)?(e.beginPath(),e.fillStyle=o.multiKeyBackground,addRoundedRectPath(e,{x:b,y,w:d,h:l,radius:E}),e.fill(),e.stroke(),e.fillStyle=r.backgroundColor,e.beginPath(),addRoundedRectPath(e,{x:S,y:y+1,w:d-2,h:l-2,radius:E}),e.fill()):(e.fillStyle=o.multiKeyBackground,e.fillRect(b,y,d,l),e.strokeRect(b,y,d,l),e.fillStyle=r.backgroundColor,e.fillRect(S,y+1,d-2,l-2))}e.fillStyle=this.labelTextColors[i]}drawBody(e,t,i){const{body:n}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:d,boxPadding:h}=i,p=toFont(i.bodyFont);let m=p.lineHeight,v=0;const y=getRtlAdapter(i.rtl,this.x,this.width),b=function(I){t.fillText(I,y.x(e.x+v),e.y+m/2),e.y+=m+o},S=y.textAlign(r);let E,T,R,A,D,x,M;for(t.textAlign=r,t.textBaseline="middle",t.font=p.string,e.x=getAlignedX(this,S,i),t.fillStyle=i.bodyColor,each(this.beforeBody,b),v=a&&S!=="right"?r==="center"?d/2+h:d+2+h:0,A=0,x=n.length;A0&&t.stroke()}_updateAnimationTarget(e){const t=this.chart,i=this.$animations,n=i&&i.x,o=i&&i.y;if(n||o){const r=positioners[e.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=getTooltipSize(this,e),l=Object.assign({},r,this._size),d=determineAlignment(t,e,l),h=getBackgroundPoint(e,l,d,t);(n._to!==h.x||o._to!==h.y)&&(this.xAlign=d.xAlign,this.yAlign=d.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(e){const t=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(t);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const r=toPadding(t.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&a&&(e.save(),e.globalAlpha=i,this.drawBackground(o,e,n,t),overrideTextDirection(e,t.textDirection),o.y+=r.top,this.drawTitle(o,e,t),this.drawBody(o,e,t),this.drawFooter(o,e,t),restoreTextDirection(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){const i=this._active,n=e.map(({datasetIndex:a,index:l})=>{const d=this.chart.getDatasetMeta(a);if(!d)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:d.data[l],index:l}}),o=!_elementsEqual(i,n),r=this._positionChanged(n,t);(o||r)&&(this._active=n,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,i=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],r=this._getActiveElements(e,o,t,i),a=this._positionChanged(r,e),l=t||!_elementsEqual(r,o)||a;return l&&(this._active=r,(n.enabled||n.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),l}_getActiveElements(e,t,i,n){const o=this.options;if(e.type==="mouseout")return[];if(!n)return t.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(e,o.mode,o,i);return o.reverse&&r.reverse(),r}_positionChanged(e,t){const{caretX:i,caretY:n,options:o}=this,r=positioners[o.position].call(this,e,t);return r!==!1&&(i!==r.x||n!==r.y)}}G(Tooltip,"positioners",positioners);var plugin_tooltip={id:"tooltip",_element:Tooltip,positioners,afterInit(s,e,t){t&&(s.tooltip=new Tooltip({chart:s,options:t}))},beforeUpdate(s,e,t){s.tooltip&&s.tooltip.initialize(t)},reset(s,e,t){s.tooltip&&s.tooltip.initialize(t)},afterDraw(s){const e=s.tooltip;if(e&&e._willRender()){const t={tooltip:e};if(s.notifyPlugins("beforeTooltipDraw",{...t,cancelable:!0})===!1)return;e.draw(s.ctx),s.notifyPlugins("afterTooltipDraw",t)}},afterEvent(s,e){if(s.tooltip){const t=e.replay;s.tooltip.handleEvent(e.event,t,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(s,e)=>e.bodyFont.size,boxWidth:(s,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:defaultCallbacks},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:s=>s!=="filter"&&s!=="itemSort"&&s!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const addIfString=(s,e,t,i)=>(typeof e=="string"?(t=s.push(e)-1,i.unshift({index:t,label:e})):isNaN(e)&&(t=null),t);function findOrAddLabel(s,e,t,i){const n=s.indexOf(e);if(n===-1)return addIfString(s,e,t,i);const o=s.lastIndexOf(e);return n!==o?t:n}const validIndex=(s,e)=>s===null?null:_limitValue(Math.round(s),0,e);function _getLabelForValue(s){const e=this.getLabels();return s>=0&&st.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}G(CategoryScale,"id","category"),G(CategoryScale,"defaults",{ticks:{callback:_getLabelForValue}});function generateTicks$1(s,e){const t=[],{bounds:n,step:o,min:r,max:a,precision:l,count:d,maxTicks:h,maxDigits:p,includeBounds:m}=s,v=o||1,y=h-1,{min:b,max:S}=e,E=!isNullOrUndef(r),T=!isNullOrUndef(a),R=!isNullOrUndef(d),A=(S-b)/(p+1);let D=niceNum((S-b)/y/v)*v,x,M,I,V;if(D<1e-14&&!E&&!T)return[{value:b},{value:S}];V=Math.ceil(S/D)-Math.floor(b/D),V>y&&(D=niceNum(V*D/y/v)*v),isNullOrUndef(l)||(x=Math.pow(10,l),D=Math.ceil(D*x)/x),n==="ticks"?(M=Math.floor(b/D)*D,I=Math.ceil(S/D)*D):(M=b,I=S),E&&T&&o&&almostWhole((a-r)/o,D/1e3)?(V=Math.round(Math.min((a-r)/D,h)),D=(a-r)/V,M=r,I=a):R?(M=E?r:M,I=T?a:I,V=d-1,D=(I-M)/V):(V=(I-M)/D,almostEquals(V,Math.round(V),D/1e3)?V=Math.round(V):V=Math.ceil(V));const U=Math.max(_decimalPlaces(D),_decimalPlaces(M));x=Math.pow(10,isNullOrUndef(l)?U:l),M=Math.round(M*x)/x,I=Math.round(I*x)/x;let B=0;for(E&&(m&&M!==r?(t.push({value:r}),Ma)break;t.push({value:Y})}return T&&m&&I!==a?t.length&&almostEquals(t[t.length-1].value,a,relativeLabelSize(a,A,s))?t[t.length-1].value=a:t.push({value:a}):(!T||I===a)&&t.push({value:I}),t}function relativeLabelSize(s,e,{horizontal:t,minRotation:i}){const n=toRadians(i),o=(t?Math.sin(n):Math.cos(n))||.001,r=.75*e*(""+s).length;return Math.min(e/o,r)}class LinearScaleBase extends Scale{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return isNullOrUndef(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:t,maxDefined:i}=this.getUserBounds();let{min:n,max:o}=this;const r=l=>n=t?n:l,a=l=>o=i?o:l;if(e){const l=sign(n),d=sign(o);l<0&&d<0?a(0):l>0&&d>0&&r(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);a(o+l),e||r(n-l)}this.min=n,this.max=o}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:t,stepSize:i}=e,n;return i?(n=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),t=t||11),t&&(n=Math.min(t,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,t=e.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n={maxTicks:i,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},o=this._range||this,r=generateTicks$1(n,o);return e.bounds==="ticks"&&_setMinAndMaxByKey(r,this,"value"),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const e=this.ticks;let t=this.min,i=this.max;if(super.configure(),this.options.offset&&e.length){const n=(i-t)/Math.max(e.length-1,1)/2;t-=n,i+=n}this._startValue=t,this._endValue=i,this._valueRange=i-t}getLabelForValue(e){return formatNumber(e,this.chart.options.locale,this.options.ticks.format)}}class LinearScale extends LinearScaleBase{determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=isNumberFinite(e)?e:0,this.max=isNumberFinite(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),t=e?this.width:this.height,i=toRadians(this.options.ticks.minRotation),n=(e?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,o.lineHeight/n))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}G(LinearScale,"id","linear"),G(LinearScale,"defaults",{ticks:{callback:Ticks.formatters.numeric}});const log10Floor=s=>Math.floor(log10(s)),changeExponent=(s,e)=>Math.pow(10,log10Floor(s)+e);function isMajor(s){return s/Math.pow(10,log10Floor(s))===1}function steps(s,e,t){const i=Math.pow(10,t),n=Math.floor(s/i);return Math.ceil(e/i)-n}function startExp(s,e){const t=e-s;let i=log10Floor(t);for(;steps(s,e,i)>10;)i++;for(;steps(s,e,i)<10;)i--;return Math.min(i,log10Floor(s))}function generateTicks(s,{min:e,max:t}){e=finiteOrDefault(s.min,e);const i=[],n=log10Floor(e);let o=startExp(e,t),r=o<0?Math.pow(10,Math.abs(o)):1;const a=Math.pow(10,o),l=n>o?Math.pow(10,n):0,d=Math.round((e-l)*r)/r,h=Math.floor((e-l)/a/10)*a*10;let p=Math.floor((d-h)/Math.pow(10,o)),m=finiteOrDefault(s.min,Math.round((l+h+p*Math.pow(10,o))*r)/r);for(;m=10?p=p<15?15:20:p++,p>=20&&(o++,p=2,r=o>=0?1:r),m=Math.round((l+h+p*Math.pow(10,o))*r)/r;const v=finiteOrDefault(s.max,m);return i.push({value:v,major:isMajor(v),significand:p}),i}class LogarithmicScale extends Scale{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,t){const i=LinearScaleBase.prototype.parse.apply(this,[e,t]);if(i===0){this._zero=!0;return}return isNumberFinite(i)&&i>0?i:null}determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=isNumberFinite(e)?Math.max(0,e):null,this.max=isNumberFinite(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!isNumberFinite(this._userMin)&&(this.min=e===changeExponent(this.min,0)?changeExponent(this.min,-1):changeExponent(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:e,maxDefined:t}=this.getUserBounds();let i=this.min,n=this.max;const o=a=>i=e?i:a,r=a=>n=t?n:a;i===n&&(i<=0?(o(1),r(10)):(o(changeExponent(i,-1)),r(changeExponent(n,1)))),i<=0&&o(changeExponent(n,-1)),n<=0&&r(changeExponent(i,1)),this.min=i,this.max=n}buildTicks(){const e=this.options,t={min:this._userMin,max:this._userMax},i=generateTicks(t,this);return e.bounds==="ticks"&&_setMinAndMaxByKey(i,this,"value"),e.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(e){return e===void 0?"0":formatNumber(e,this.chart.options.locale,this.options.ticks.format)}configure(){const e=this.min;super.configure(),this._startValue=log10(e),this._valueRange=log10(this.max)-log10(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(log10(e)-this._startValue)/this._valueRange)}getValueForPixel(e){const t=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+t*this._valueRange)}}G(LogarithmicScale,"id","logarithmic"),G(LogarithmicScale,"defaults",{ticks:{callback:Ticks.formatters.logarithmic,major:{enabled:!0}}});function getTickBackdropHeight(s){const e=s.ticks;if(e.display&&s.display){const t=toPadding(e.backdropPadding);return valueOrDefault(e.font&&e.font.size,defaults.font.size)+t.height}return 0}function measureLabelSize(s,e,t){return t=isArray(t)?t:[t],{w:_longestText(s,e.string,t),h:t.length*e.lineHeight}}function determineLimits(s,e,t,i,n){return s===i||s===n?{start:e-t/2,end:e+t/2}:sn?{start:e-t,end:e}:{start:e,end:e+t}}function fitWithPointLabels(s){const e={l:s.left+s._padding.left,r:s.right-s._padding.right,t:s.top+s._padding.top,b:s.bottom-s._padding.bottom},t=Object.assign({},e),i=[],n=[],o=s._pointLabels.length,r=s.options.pointLabels,a=r.centerPointLabels?PI/o:0;for(let l=0;le.r&&(a=(i.end-e.r)/o,s.r=Math.max(s.r,e.r+a)),n.starte.b&&(l=(n.end-e.b)/r,s.b=Math.max(s.b,e.b+l))}function createPointLabelItem(s,e,t){const i=s.drawingArea,{extra:n,additionalAngle:o,padding:r,size:a}=t,l=s.getPointPosition(e,i+n+r,o),d=Math.round(toDegrees(_normalizeAngle(l.angle+HALF_PI))),h=yForAngle(l.y,a.h,d),p=getTextAlignForAngle(d),m=leftForTextAlign(l.x,a.w,p);return{visible:!0,x:l.x,y:h,textAlign:p,left:m,top:h,right:m+a.w,bottom:h+a.h}}function isNotOverlapped(s,e){if(!e)return!0;const{left:t,top:i,right:n,bottom:o}=s;return!(_isPointInArea({x:t,y:i},e)||_isPointInArea({x:t,y:o},e)||_isPointInArea({x:n,y:i},e)||_isPointInArea({x:n,y:o},e))}function buildPointLabelItems(s,e,t){const i=[],n=s._pointLabels.length,o=s.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:getTickBackdropHeight(o)/2,additionalAngle:r?PI/n:0};let d;for(let h=0;h270||t<90)&&(s-=e),s}function drawPointLabelBox(s,e,t){const{left:i,top:n,right:o,bottom:r}=t,{backdropColor:a}=e;if(!isNullOrUndef(a)){const l=toTRBLCorners(e.borderRadius),d=toPadding(e.backdropPadding);s.fillStyle=a;const h=i-d.left,p=n-d.top,m=o-i+d.width,v=r-n+d.height;Object.values(l).some(y=>y!==0)?(s.beginPath(),addRoundedRectPath(s,{x:h,y:p,w:m,h:v,radius:l}),s.fill()):s.fillRect(h,p,m,v)}}function drawPointLabels(s,e){const{ctx:t,options:{pointLabels:i}}=s;for(let n=e-1;n>=0;n--){const o=s._pointLabelItems[n];if(!o.visible)continue;const r=i.setContext(s.getPointLabelContext(n));drawPointLabelBox(t,r,o);const a=toFont(r.font),{x:l,y:d,textAlign:h}=o;renderText(t,s._pointLabels[n],l,d+a.lineHeight/2,a,{color:r.color,textAlign:h,textBaseline:"middle"})}}function pathRadiusLine(s,e,t,i){const{ctx:n}=s;if(t)n.arc(s.xCenter,s.yCenter,e,0,TAU);else{let o=s.getPointPosition(0,e);n.moveTo(o.x,o.y);for(let r=1;r{const n=callback(this.options.pointLabels.callback,[t,i],this);return n||n===0?n:""}).filter((t,i)=>this.chart.getDataVisibility(i))}fit(){const e=this.options;e.display&&e.pointLabels.display?fitWithPointLabels(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,t,i,n){this.xCenter+=Math.floor((e-t)/2),this.yCenter+=Math.floor((i-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,t,i,n))}getIndexAngle(e){const t=TAU/(this._pointLabels.length||1),i=this.options.startAngle||0;return _normalizeAngle(e*t+toRadians(i))}getDistanceFromCenterForValue(e){if(isNullOrUndef(e))return NaN;const t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*t:(e-this.min)*t}getValueForDistanceFromCenter(e){if(isNullOrUndef(e))return NaN;const t=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(e){const t=this._pointLabels||[];if(e>=0&&e{if(p!==0||p===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);const m=this.getContext(p),v=n.setContext(m),y=o.setContext(m);drawRadiusLine(this,v,l,r,y)}}),i.display){for(e.save(),a=r-1;a>=0;a--){const h=i.setContext(this.getPointLabelContext(a)),{color:p,lineWidth:m}=h;!m||!p||(e.lineWidth=m,e.strokeStyle=p,e.setLineDash(h.borderDash),e.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(t.ticks.reverse?this.min:this.max),d=this.getPointPosition(a,l),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(d.x,d.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){const e=this.ctx,t=this.options,i=t.ticks;if(!i.display)return;const n=this.getIndexAngle(0);let o,r;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(n),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!t.reverse)return;const d=i.setContext(this.getContext(l)),h=toFont(d.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),d.showLabelBackdrop){e.font=h.string,r=e.measureText(a.label).width,e.fillStyle=d.backdropColor;const p=toPadding(d.backdropPadding);e.fillRect(-r/2-p.left,-o-h.size/2-p.top,r+p.width,h.size+p.height)}renderText(e,a.label,0,-o,h,{color:d.color,strokeColor:d.textStrokeColor,strokeWidth:d.textStrokeWidth})}),e.restore()}drawTitle(){}}G(RadialLinearScale,"id","radialLinear"),G(RadialLinearScale,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ticks.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}}),G(RadialLinearScale,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),G(RadialLinearScale,"descriptors",{angleLines:{_fallback:"grid"}});const INTERVALS={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}},UNITS=Object.keys(INTERVALS);function sorter(s,e){return s-e}function parse(s,e){if(isNullOrUndef(e))return null;const t=s._adapter,{parser:i,round:n,isoWeekday:o}=s._parseOpts;let r=e;return typeof i=="function"&&(r=i(r)),isNumberFinite(r)||(r=typeof i=="string"?t.parse(r,i):t.parse(r)),r===null?null:(n&&(r=n==="week"&&(isNumber(o)||o===!0)?t.startOf(r,"isoWeek",o):t.startOf(r,n)),+r)}function determineUnitForAutoTicks(s,e,t,i){const n=UNITS.length;for(let o=UNITS.indexOf(s);o=UNITS.indexOf(t);o--){const r=UNITS[o];if(INTERVALS[r].common&&s._adapter.diff(n,i,r)>=e-1)return r}return UNITS[t?UNITS.indexOf(t):0]}function determineMajorUnit(s){for(let e=UNITS.indexOf(s)+1,t=UNITS.length;e=e?t[i]:t[n];s[o]=!0}}function setMajorTicks(s,e,t,i){const n=s._adapter,o=+n.startOf(e[0].value,i),r=e[e.length-1].value;let a,l;for(a=o;a<=r;a=+n.add(a,1,i))l=t[a],l>=0&&(e[l].major=!0);return e}function ticksFromTimestamps(s,e,t){const i=[],n={},o=e.length;let r,a;for(r=0;r+e.value))}initOffsets(e=[]){let t=0,i=0,n,o;this.options.offset&&e.length&&(n=this.getDecimalForValue(e[0]),e.length===1?t=1-n:t=(this.getDecimalForValue(e[1])-n)/2,o=this.getDecimalForValue(e[e.length-1]),e.length===1?i=o:i=(o-this.getDecimalForValue(e[e.length-2]))/2);const r=e.length<3?.5:.25;t=_limitValue(t,0,r),i=_limitValue(i,0,r),this._offsets={start:t,end:i,factor:1/(t+1+i)}}_generate(){const e=this._adapter,t=this.min,i=this.max,n=this.options,o=n.time,r=o.unit||determineUnitForAutoTicks(o.minUnit,t,i,this._getLabelCapacity(t)),a=valueOrDefault(n.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,d=isNumber(l)||l===!0,h={};let p=t,m,v;if(d&&(p=+e.startOf(p,"isoWeek",l)),p=+e.startOf(p,d?"day":r),e.diff(i,t,r)>1e5*a)throw new Error(t+" and "+i+" are too far apart with stepSize of "+a+" "+r);const y=n.ticks.source==="data"&&this.getDataTimestamps();for(m=p,v=0;m+b)}getLabelForValue(e){const t=this._adapter,i=this.options.time;return i.tooltipFormat?t.format(e,i.tooltipFormat):t.format(e,i.displayFormats.datetime)}format(e,t){const n=this.options.time.displayFormats,o=this._unit,r=t||n[o];return this._adapter.format(e,r)}_tickFormatFunction(e,t,i,n){const o=this.options,r=o.ticks.callback;if(r)return callback(r,[e,t,i],this);const a=o.time.displayFormats,l=this._unit,d=this._majorUnit,h=l&&a[l],p=d&&a[d],m=i[t],v=d&&p&&m&&m.major;return this._adapter.format(e,n||(v?p:h))}generateTickLabels(e){let t,i,n;for(t=0,i=e.length;t0?a:1}getDataTimestamps(){let e=this._cache.data||[],t,i;if(e.length)return e;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(t=0,i=n.length;t=s[i].pos&&e<=s[n].pos&&({lo:i,hi:n}=_lookupByKey(s,"pos",e)),{pos:o,time:a}=s[i],{pos:r,time:l}=s[n]):(e>=s[i].time&&e<=s[n].time&&({lo:i,hi:n}=_lookupByKey(s,"time",e)),{time:o,pos:a}=s[i],{time:r,pos:l}=s[n]);const d=r-o;return d?a+(l-a)*(e-o)/d:a}class TimeSeriesScale extends TimeScale{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=interpolate(t,this.min),this._tableRange=interpolate(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:t,max:i}=this,n=[],o=[];let r,a,l,d,h;for(r=0,a=e.length;r=t&&d<=i&&n.push(d);if(n.length<2)return[{time:t,pos:0},{time:i,pos:1}];for(r=0,a=n.length;rn-o)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const t=this.getDataTimestamps(),i=this.getLabelTimestamps();return t.length&&i.length?e=this.normalize(t.concat(i)):e=t.length?t:i,e=this._cache.all=e,e}getDecimalForValue(e){return(interpolate(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const t=this._offsets,i=this.getDecimalForPixel(e)/t.factor-t.end;return interpolate(this._table,i*this._tableRange+this._minPos,!0)}}G(TimeSeriesScale,"id","timeseries"),G(TimeSeriesScale,"defaults",TimeScale.defaults);/*!
* chartjs-chart-sankey v0.12.0
* https://github.com/kurkle/chartjs-chart-sankey#readme
* (c) 2022 Jukka Kurkela
@@ -51,7 +55,7 @@ ${t?'Expression: "'+t+`"
`,n.append(r),n.classList.add("d-flex","justify-content-between"),r.addEventListener("click",a=>{this._searchInput.value=t.label,this._searchInput.focus()})}return o.addEventListener("mouseenter",r=>{this._keyboardNavigation||(this.removeSelection(),n.querySelector("a").classList.add(...this._activeClasses()))}),o.addEventListener("mousedown",r=>{r.preventDefault()}),o.addEventListener("click",r=>{r.preventDefault(),this._preventInput=!0,this._searchInput.value=decodeHtml(t.label),this._hiddenInput&&(this._hiddenInput.value=t.value),this._config.onSelectItem(t,this),this.hideSuggestions(),this._preventInput=!1}),n}_showSuggestions(){if(document.activeElement!=this._searchInput)return;const e=normalize$1(this._searchInput.value);this._dropElement.innerHTML="";const t=Object.keys(this._items);let i=0,n=null;const o=[];for(let r=0;r0&&this._config.searchFields.forEach(m=>{const v=normalize$1(l[m]);let y=!1;if(this._config.fuzzy)y=fuzzyMatch$1(v,e);else{const b=v.indexOf(e);y=this._config.startsWith?b===0:b>=0}y&&(h=!0)});const p=h||e.length===0;if(d||h){if(i++,l.group&&!o.includes(l.group)){const v=this._createGroup(l.group);this._dropElement.appendChild(v),o.push(l.group)}const m=this._createItem(e,l);if(!n&&p&&(n=m),this._dropElement.appendChild(m),this._config.maximumItems>0&&i>=this._config.maximumItems)break}}if(n&&this._config.autoselectFirst&&(this.removeSelection(),this._moveSelection(NEXT$1,n)),i===0)if(this._config.notFoundMessage){const r=this._createLi();r.innerHTML=`${this._config.notFoundMessage}`,this._dropElement.appendChild(r),this._showDropdown()}else this.hideSuggestions();else this._showDropdown()}_createLi(){const e=document.createElement("li");return e.setAttribute("role","presentation"),e}_showDropdown(){this._dropElement.classList.add(SHOW_CLASS$1),this._dropElement.setAttribute("role","menu"),attrs$1(this._searchInput,{"aria-expanded":"true"}),this._positionMenu()}toggleSuggestions(e=!0){this._dropElement.classList.contains(SHOW_CLASS$1)?this.hideSuggestions():this.showOrSearch(e)}hideSuggestions(){this._dropElement.classList.remove(SHOW_CLASS$1),attrs$1(this._searchInput,{"aria-expanded":"false"}),this.removeSelection()}getInput(){return this._searchInput}getDropMenu(){return this._dropElement}_positionMenu(){const e=window.getComputedStyle(this._searchInput),t=this._searchInput.getBoundingClientRect(),i=e.direction==="rtl",n=this._config.fullWidth,o=this._config.fixed;let r=null,a=null;o&&(r=t.x,a=t.y+t.height,i&&!n&&(r-=this._dropElement.offsetWidth-t.width)),this._dropElement.style.transform="unset",n&&(this._dropElement.style.width=this._searchInput.offsetWidth+"px"),r!==null&&(this._dropElement.style.left=r+"px"),a!==null&&(this._dropElement.style.top=a+"px");const l=this._dropElement.getBoundingClientRect(),d=window.innerHeight;if(l.y+l.height>d){const h=n?t.height+4:t.height;this._dropElement.style.transform="translateY(calc(-100.1% - "+h+"px))"}}_fetchData(){this._items={},this._addItems(this._config.items);const e=this._config.datalist;if(e){const t=document.querySelector(`#${e}`);if(t){const i=Array.from(t.children).map(n=>{const o=n.getAttribute("value")??n.innerHTML.toLowerCase(),r=n.innerHTML;return{value:o,label:r}});this._addItems(i)}else console.error(`Datalist not found ${e}`)}this._setHiddenVal(),this._config.server&&!this._config.liveServer&&this._loadFromServer()}_setHiddenVal(){if(this._config.hiddenInput&&!this._config.hiddenValue)for(const[e,t]of Object.entries(this._items))t.label==this._searchInput.value&&(this._hiddenInput.value=e)}_addItems(e){const t=Object.keys(e);for(let i=0;il.group=o.group),this._addItems(o.items);continue}const r=typeof o=="string"?o:o.label,a=typeof o!="object"?{}:o;a.label=o[this._config.labelField]??r,a.value=o[this._config.valueField]??n,a.label&&(this._items[a.value]=a)}}_loadFromServer(e=!1){this._abortController&&this._abortController.abort(),this._abortController=new AbortController;let t=this._searchInput.dataset.serverParams||{};typeof t=="string"&&(t=JSON.parse(t));const i=Object.assign({},this._config.serverParams,t);if(i[this._config.queryParam]=this._searchInput.value,this._config.noCache&&(i.t=Date.now()),i.related){const a=document.getElementById(i.related);if(a){i.related=a.value;const l=a.getAttribute("name");l&&(i[l]=a.value)}}const n=new URLSearchParams(i);let o=this._config.server,r=Object.assign(this._config.fetchOptions,{method:this._config.serverMethod||"GET",signal:this._abortController.signal});r.method==="POST"?r.body=n:o+="?"+n.toString(),this._searchInput.classList.add(LOADING_CLASS$1),this._config.onBeforeFetch(this),fetch(o,r).then(a=>this._config.onServerResponse(a,this)).then(a=>{const l=nested$1(this._config.serverDataKey,a)||a;this.setData(l),this._setHiddenVal(),this._abortController=null,e&&this._showSuggestions()}).catch(a=>{a.name==="AbortError"||this._abortController.signal.aborted||console.error(a)}).finally(a=>{this._searchInput.classList.remove(LOADING_CLASS$1),this._config.onAfterFetch(this)})}}const DEFAULTS={items:[],allowNew:!1,showAllSuggestions:!1,badgeStyle:"primary",allowClear:!1,clearEnd:!1,selected:[],regex:"",separator:[],max:0,clearLabel:"Clear",searchLabel:"Type a value",showDropIcon:!0,keepOpen:!1,allowSame:!1,baseClass:"",placeholder:"",addOnBlur:!1,showDisabled:!1,hideNativeValidation:!1,suggestionsThreshold:-1,maximumItems:0,autoselectFirst:!0,updateOnSelect:!1,highlightTyped:!1,highlightClass:"",fullWidth:!0,fixed:!1,fuzzy:!1,startsWith:!1,singleBadge:!1,activeClasses:["bg-primary","text-white"],labelField:"label",valueField:"value",searchFields:["label"],queryParam:"query",server:"",serverMethod:"GET",serverParams:{},serverDataKey:"data",fetchOptions:{},liveServer:!1,noCache:!0,allowHtml:!1,debounceTime:300,notFoundMessage:"",inputFilter:s=>s,sanitizer:s=>sanitize(s),onRenderItem:(s,e,t)=>t.config("allowHtml")?e:t.config("sanitizer")(e),onSelectItem:(s,e)=>{},onClearItem:(s,e)=>{},onCreateItem:(s,e)=>{},onBlur:(s,e)=>{},onFocus:(s,e)=>{},onCanAdd:(s,e,t)=>{},confirmClear:(s,e)=>Promise.resolve(),confirmAdd:(s,e)=>Promise.resolve(),onServerResponse:(s,e)=>s.json()},CLASS_PREFIX="tags-",LOADING_CLASS="is-loading",ACTIVE_CLASS="is-active",INVALID_CLASS="is-invalid",MAX_REACHED_CLASS="is-max-reached",SHOW_CLASS="show",VALUE_ATTRIBUTE="data-value",NEXT="next",PREV="prev",FOCUS_CLASS="form-control-focus",PLACEHOLDER_CLASS="form-placeholder-shown",DISABLED_CLASS="form-control-disabled",INSTANCE_MAP=new WeakMap;let counter=0,tooltip=window.bootstrap&&window.bootstrap.Tooltip;function debounce$1(s,e=300){let t;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{s.apply(this,i)},e)}}function calcTextWidth(s,e=null){const t=ce("span");document.body.appendChild(t),t.style.fontSize=e||"inherit",t.style.height="auto",t.style.width="auto",t.style.position="absolute",t.style.whiteSpace="no-wrap",t.innerHTML=sanitize(s);const i=Math.ceil(t.clientWidth);return document.body.removeChild(t),i}function sanitize(s){return s.replace(/[\x26\x0A\<>'"]/g,function(e){return""+e.charCodeAt(0)+";"})}function removeDiacritics(s){return s.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function normalize(s){return s?removeDiacritics(s.toString()).toLowerCase():""}function fuzzyMatch(s,e){if(s.indexOf(e)>=0)return!0;let t=0;for(let i=0;it[i],e)}class Tags{constructor(e,t={}){if(!(e instanceof HTMLElement)){console.error("Invalid element",e);return}INSTANCE_MAP.set(e,this),counter++,this._selectElement=e,this._configure(t),this._keyboardNavigation=!1,this._searchFunc=debounce$1(()=>{this._loadFromServer(!0)},this._config.debounceTime),this._fireEvents=!0,this._configureParent(),this._holderElement=ce("div"),this._containerElement=ce("div"),this._dropElement=ce("ul"),this._searchInput=ce("input"),this._holderElement.appendChild(this._containerElement),this._selectElement.parentElement.insertBefore(this._holderElement,this._selectElement),this._configureHolderElement(),this._configureContainerElement(),this._configureSelectElement(),this._configureSearchInput(),this._configureDropElement(),this.resetState(),this.handleEvent=i=>{this._handleEvent(i)},this._config.fixed&&(document.addEventListener("scroll",this,!0),window.addEventListener("resize",this)),["focus","blur","input","keydown","paste"].forEach(i=>{this._searchInput.addEventListener(i,this)}),["mousemove","mouseleave"].forEach(i=>{this._dropElement.addEventListener(i,this)}),this.loadData(!0)}static init(e="select[multiple]",t={},i=!1){let n=document.querySelectorAll(e);for(let o=0;o{this._searchInput.removeEventListener(e,this)}),["mousemove","mouseleave"].forEach(e=>{this._dropElement.removeEventListener(e,this)}),this._config.fixed&&(document.removeEventListener("scroll",this,!0),window.removeEventListener("resize",this)),this._selectElement.style.display="block",this._holderElement.parentElement.removeChild(this._holderElement),this.parentForm&&this.parentForm.removeEventListener("reset",this),INSTANCE_MAP.delete(this._selectElement)}handleEvent(e){this._handleEvent(e)}_handleEvent(e){["scroll","resize"].includes(e.type)?(this._timer&&window.cancelAnimationFrame(this._timer),this._timer=window.requestAnimationFrame(()=>{this[`on${e.type}`](e)})):this[`on${e.type}`](e)}_configure(e={}){this._config=Object.assign({},DEFAULTS,{showDropIcon:!!this._findOption()});const t=this._selectElement.dataset.config?JSON.parse(this._selectElement.dataset.config):{},i={...e,...t,...this._selectElement.dataset};for(const[n,o]of Object.entries(DEFAULTS)){if(n=="config"||i[n]===void 0)continue;const r=i[n];switch(typeof o){case"number":this._config[n]=parseInt(r);break;case"boolean":this._config[n]=parseBool(r);break;case"string":this._config[n]=r.toString();break;case"object":this._config[n]=r,typeof r=="string"&&(["{","["].includes(r[0])?this._config[n]=JSON.parse(r):this._config[n]=r.split(r.includes("|")?"|":","));break;case"function":this._config[n]=typeof r=="string"?r.split(".").reduce((a,l)=>a[l],window):r,this._config[n]||console.error("Invalid function",r);break;default:this._config[n]=r;break}}this._config.placeholder||(this._config.placeholder=this._getPlaceholder()),this._config.suggestionsThreshold==-1&&(this._config.suggestionsThreshold=this._config.liveServer?1:0)}config(e=null){return e?this._config[e]:this._config}setConfig(e,t){this._config[e]=t}_configureParent(){for(this.overflowParent=null,this.parentForm=this._selectElement.parentElement;this.parentForm&&(this.parentForm.style.overflow==="hidden"&&(this.overflowParent=this.parentForm),this.parentForm=this.parentForm.parentElement,!(this.parentForm&&this.parentForm.nodeName=="FORM")););this.parentForm&&this.parentForm.addEventListener("reset",this)}_getPlaceholder(){if(this._selectElement.hasAttribute("placeholder"))return this._selectElement.getAttribute("placeholder");if(this._selectElement.dataset.placeholder)return this._selectElement.dataset.placeholder;let e=this._selectElement.querySelector("option");return!e||!this._config.autoselectFirst?"":(rmAttr(e,"selected"),e.selected=!1,e.value?"":e.textContent)}_configureSelectElement(){const e=this._selectElement;this._config.hideNativeValidation?(e.style.position="absolute",e.style.left="-9999px"):e.style.cssText="height:1px;width:1px;opacity:0;padding:0;margin:0;border:0;float:left;flex-basis:100%;min-height:unset;",e.tabIndex=-1,e.addEventListener("focus",t=>{this.onclick(t)}),e.addEventListener("invalid",t=>{this._holderElement.classList.add(INVALID_CLASS)})}_configureDropElement(){const e=this._dropElement;e.classList.add("dropdown-menu",CLASS_PREFIX+"menu"),e.id=CLASS_PREFIX+"menu-"+counter,e.setAttribute("role","menu");const t=e.style;t.padding="0",t.maxHeight="280px",this._config.fullWidth||(t.maxWidth="360px"),this._config.fixed&&(t.position="fixed"),t.overflowY="auto",t.overscrollBehavior="contain",t.textAlign="unset",e.addEventListener("mouseenter",i=>{this._keyboardNavigation=!1}),this._holderElement.appendChild(e),this._searchInput.setAttribute("aria-controls",e.id)}_configureHolderElement(){const e=this._holderElement;e.classList.add("form-control","dropdown"),["form-select-lg","form-select-sm","is-invalid","is-valid"].forEach(t=>{this._selectElement.classList.contains(t)&&e.classList.add(t)}),this._config.suggestionsThreshold==0&&this._config.showDropIcon&&e.classList.add("form-select"),this.overflowParent&&(e.style.position="inherit"),e.style.height="auto",e.addEventListener("click",this)}_configureContainerElement(){this._containerElement.addEventListener("click",t=>{this.isDisabled()||this._searchInput.style.visibility!="hidden"&&this._searchInput.focus()});const e=this._containerElement.style;e.display="flex",e.alignItems="center",e.flexWrap="wrap"}_configureSearchInput(){const e=this._searchInput;e.type="text",e.autocomplete="off",e.spellcheck=!1,attrs(e,{"aria-autocomplete":"list","aria-haspopup":"menu","aria-expanded":"false","aria-label":this._config.searchLabel,role:"combobox"}),e.style.cssText="background-color:transparent;color:currentColor;border:0;padding:0;outline:0;max-width:100%",this.resetSearchInput(!0),this._containerElement.appendChild(e),this._rtl=window.getComputedStyle(e).direction==="rtl"}onfocus(e){this._holderElement.classList.add(FOCUS_CLASS),this.showOrSearch(),this._config.onFocus(e,this)}onblur(e){if(e.relatedTarget&&e.relatedTarget.classList.contains("modal")){this._searchInput.focus();return}this.afteronblur(e)}afteronblur(e){this._abortController&&this._abortController.abort();let t=!0;if(this._config.addOnBlur&&this._searchInput.value&&(t=this._enterValue()),this._holderElement.classList.remove(FOCUS_CLASS),this.hideSuggestions(t),this._fireEvents){const i=this.getSelection(),n={selection:i?i.dataset.value:null,input:this._searchInput.value};this._config.onBlur(e,this),this._selectElement.dispatchEvent(new CustomEvent("tags.blur",{bubbles:!0,detail:n}))}}onpaste(e){const i=(e.clipboardData||window.clipboardData).getData("text/plain").replace(/\r\n|\n/g," ");if(i.length>2&&this._config.separator.length){const n=splitMulti(i,this._config.separator).filter(o=>o);n.length>1&&(e.preventDefault(),n.forEach(o=>{this._addPastedValue(o)}))}}_addPastedValue(e){let t=e,i={};if(this._config.allowNew)i.new=1;else{const n=this.getSelection();if(!n)return;e=n.getAttribute(VALUE_ATTRIBUTE),t=n.dataset.label}this._config.confirmAdd(e,this).then(()=>{this._add(t,e,i)}).catch(()=>{})}oninput(e){const t=this._config.inputFilter(this._searchInput.value);if(t!=this._searchInput.value&&(this._searchInput.value=t),t){const i=t.slice(-1);if(this._config.separator.length&&this._config.separator.includes(i)){this._searchInput.value=this._searchInput.value.slice(0,-1);let n=this._searchInput.value;this._addPastedValue(n);return}}setTimeout(()=>{this._adjustWidth()}),this.showOrSearch()}onkeydown(e){let t=e.keyCode||e.key;const i=e.target;switch(e.keyCode==229&&(t=i.value.charAt(i.selectionStart-1).charCodeAt(0)),t){case 13:case"Enter":e.preventDefault(),this._enterValue();break;case 38:case"ArrowUp":e.preventDefault(),this._keyboardNavigation=!0,this._moveSelection(PREV);break;case 40:case"ArrowDown":e.preventDefault(),this._keyboardNavigation=!0,this.isDropdownVisible()?this._moveSelection(NEXT):this.showOrSearch(!1);break;case 8:case"Backspace":const n=this.getLastItem();this._searchInput.value.length==0&&n&&this._config.confirmClear(n,this).then(()=>{this.removeLastItem(),this._adjustWidth(),this.showOrSearch()}).catch(()=>{});break;case 27:case"Escape":this._searchInput.focus(),this.hideSuggestions();break}}onmousemove(e){this._keyboardNavigation=!1}onmouseleave(e){this.removeSelection()}onscroll(e){this._positionMenu()}onresize(e){this._positionMenu()}onclick(e=null){!this.isSingle()&&this.isMaxReached()||this._searchInput.focus()}onreset(e){this.reset()}loadData(e=!1){Object.keys(this._config.items).length>0?this.setData(this._config.items,!0):this.resetSuggestions(!0),this._config.server&&(this._config.liveServer||this._loadFromServer(!e))}_setSelectedAttributes(){const e=this._selectElement.selectedOptions||[];for(let t=0;t({value:n.getAttribute("value"),label:n.textContent,disabled:n.disabled,selected:n.selected,data:Object.assign({disabled:n.disabled},n.dataset)});let i=Array.from(this._selectElement.children).filter(n=>n.hasAttribute("label")||!n.disabled||this._config.showDisabled).map(n=>n.hasAttribute("label")?{group:n.getAttribute("label"),items:Array.from(n.children).map(o=>t(o))}:t(n));this.setData(i,e)}_enterValue(){let e=this.getSelection();if(e)return e.click(),!0;if(this._config.allowNew&&this._searchInput.value){let t=this._searchInput.value;return this._config.confirmAdd(t,this).then(()=>{this._add(t,t,{new:1})}).catch(()=>{}),!0}return!1}_loadFromServer(e=!1){this._abortController&&this._abortController.abort(),this._abortController=new AbortController;let t=this._selectElement.dataset.serverParams||{};typeof t=="string"&&(t=JSON.parse(t));const i=Object.assign({},this._config.serverParams,t);if(i[this._config.queryParam]=this._searchInput.value,this._config.noCache&&(i.t=Date.now()),i.related){const a=document.getElementById(i.related);if(a){i.related=a.value;const l=a.getAttribute("name");l&&(i[l]=a.value)}}const n=new URLSearchParams(i);let o=this._config.server,r=Object.assign(this._config.fetchOptions,{method:this._config.serverMethod||"GET",signal:this._abortController.signal});r.method==="POST"?r.body=n:o+="?"+n.toString(),this._holderElement.classList.add(LOADING_CLASS),fetch(o,r).then(a=>this._config.onServerResponse(a,this)).then(a=>{const l=nested(this._config.serverDataKey,a)||a;this.setData(l,!e),this._abortController=null,e&&this._showSuggestions()}).catch(a=>{a.name==="AbortError"||this._abortController.signal.aborted||console.error(a)}).finally(a=>{this._holderElement.classList.remove(LOADING_CLASS)})}_add(e,t=null,i={}){if(!this.canAdd(e,i))return null;const n=this.addItem(e,t,i);return this._resetHtmlState(),this._config.keepOpen?this._showSuggestions():this.resetSearchInput(),n}_isItemEnabled(e){if(e.style.display==="none")return!1;const t=e.firstElementChild;return t.tagName==="A"&&!t.classList.contains("disabled")}_moveSelection(e=NEXT,t=null){const i=this.getSelection();if(i){const n=e===NEXT?"nextSibling":"previousSibling";t=i.parentNode;do t=t[n];while(t&&!this._isItemEnabled(t));t?i.classList.remove(...this._activeClasses()):i&&(t=i.parentElement)}else{if(e===PREV)return t;if(!t)for(t=this._dropElement.firstChild;t&&!this._isItemEnabled(t);)t=t.nextSibling}if(t){const n=t.offsetHeight,o=t.offsetTop,r=t.parentNode,a=r.offsetHeight,l=r.scrollHeight,d=r.offsetTop;if(n===0&&setTimeout(()=>{r.scrollTop=0}),e===PREV){const p=o-d>10?o-d:0;r.scrollTop=p}else o+n-(a+r.scrollTop)>0&&n>0&&(r.scrollTop=o+n-a+1,r.scrollTop+a>=l-10&&(r.scrollTop=o-d));const h=t.querySelector("a");h.classList.add(...this._activeClasses()),this._searchInput.setAttribute("aria-activedescendant",h.id),this._config.updateOnSelect&&(this._searchInput.value=h.dataset.label,this._adjustWidth())}else this._searchInput.setAttribute("aria-activedescendant","");return t}_adjustWidth(){this._holderElement.classList.remove(PLACEHOLDER_CLASS),this._searchInput.value?this._searchInput.size=this._searchInput.value.length:this.getSelectedValues().length?(this._searchInput.placeholder="",this._searchInput.size=1):(this._searchInput.size=this._config.placeholder.length>0?this._config.placeholder.length:1,this._searchInput.placeholder=this._config.placeholder,this._holderElement.classList.add(PLACEHOLDER_CLASS));const e=this._searchInput.value||this._searchInput.placeholder,t=window.getComputedStyle(this._holderElement).fontSize,i=calcTextWidth(e,t)+16;this._searchInput.style.width=i+"px"}_buildSuggestions(e){for(;this._dropElement.lastChild;)this._dropElement.removeChild(this._dropElement.lastChild);let t=0,i=1;for(let n=0;n',this._dropElement.appendChild(n)}}_buildSuggestionsItem(e,t){if(!e[this._config.valueField])return;const i=e[this._config.valueField],n=e[this._config.labelField];let o=this._config.onRenderItem(e,n,this);const r=ce("li");r.setAttribute("role","presentation"),e.group_id&&r.setAttribute("data-group-id",""+e.group_id);const a=ce("a");r.append(a),a.id=this._dropElement.id+"-"+t,a.classList.add("dropdown-item","text-truncate"),e.disabled&&a.classList.add("disabled"),a.setAttribute(VALUE_ATTRIBUTE,i),a.dataset.label=n;const l={};this._config.searchFields.forEach(d=>{l[d]=e[d]}),a.dataset.searchData=JSON.stringify(l),a.setAttribute("href","#"),a.innerHTML=o,this._dropElement.appendChild(r),a.addEventListener("mouseenter",d=>{this._keyboardNavigation||(this.removeSelection(),r.querySelector("a").classList.add(...this._activeClasses()))}),a.addEventListener("mousedown",d=>{d.preventDefault()}),a.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),this._config.confirmAdd(i,this).then(()=>{this._add(n,i,e.data),this._config.onSelectItem(e,this)}).catch(()=>{})})}initialOptions(){return this._selectElement.querySelectorAll("option[data-init]")}_removeSelectedAttrs(){this._selectElement.querySelectorAll("option").forEach(e=>{rmAttr(e,"selected")})}reset(){this.removeAll(),this._fireEvents=!1;const e=this.initialOptions();this._removeSelectedAttrs();for(let t=0;tt.value)}getAvailableValues(){const e=this._selectElement.querySelectorAll("option");return Array.from(e).map(t=>t.value)}showOrSearch(e=!0){if(e&&!this._shouldShow()){this.hideSuggestions(!1);return}this._config.liveServer?this._searchFunc():this._showSuggestions()}hideSuggestions(e=!0){this._dropElement.classList.remove(SHOW_CLASS),attrs(this._searchInput,{"aria-expanded":"false"}),this.removeSelection(),e&&this._holderElement.classList.remove(INVALID_CLASS)}toggleSuggestions(e=!0,t=!0){this._dropElement.classList.contains(SHOW_CLASS)?this.hideSuggestions(t):this.showOrSearch(e)}_shouldShow(){return this.isDisabled()||this.isMaxReached()?!1:this._searchInput.value.length>=this._config.suggestionsThreshold}_showSuggestions(){if(this._searchInput.style.visibility=="hidden")return;const e=normalize(this._searchInput.value),t={},i=this._dropElement.querySelectorAll("li");let n=0,o=null,r=!1,a={};for(let l=0;l0){const y=JSON.parse(h.dataset.searchData);this._config.searchFields.forEach(b=>{const S=normalize(y[b]);let E=!1;if(this._config.fuzzy)E=fuzzyMatch(S,e);else{const T=S.indexOf(e);E=this._config.startsWith?T===0:T>=0}E&&(m=!0)})}const v=m||e.length===0;if(p||m?(n++,showItem(d),d.dataset.groupId&&(a[d.dataset.groupId]=!0),!o&&this._isItemEnabled(d)&&v&&(o=d),this._config.maximumItems>0&&n>this._config.maximumItems&&hideItem(d)):hideItem(d),this._config.highlightTyped){const y=h.textContent,b=normalize(y).indexOf(e),S=y.substring(0,b)+`${y.substring(b,b+e.length)}`+y.substring(b+e.length,y.length);h.innerHTML=S}this._isItemEnabled(d)&&(r=!0)}if(!this._config.allowNew&&!(e.length===0&&!r)&&this._holderElement.classList.add(INVALID_CLASS),this._config.allowNew&&this._config.regex&&this.isInvalid()&&this._holderElement.classList.remove(INVALID_CLASS),Array.from(i).filter(l=>l.dataset.id).forEach(l=>{a[l.dataset.id]===!0&&showItem(l)}),r&&(this._holderElement.classList.remove(INVALID_CLASS),o&&this._config.autoselectFirst&&(this.removeSelection(),this._moveSelection(NEXT,o))),n===0)if(this._config.notFoundMessage){const l=this._dropElement.querySelector("."+CLASS_PREFIX+"not-found");l.style.display="block";const d=this._config.notFoundMessage.replace("{{tag}}",this._searchInput.value);l.innerHTML=`${d}`,this._showDropdown()}else this.hideSuggestions(!1);else this._showDropdown()}_showDropdown(){const e=this._dropElement.classList.contains(SHOW_CLASS);e||(this._dropElement.classList.add(SHOW_CLASS),attrs(this._searchInput,{"aria-expanded":"true"})),this._positionMenu(e)}_positionMenu(e=!1){const t=this._rtl,i=this._config.fixed,n=this._config.fullWidth,o=this._searchInput.getBoundingClientRect(),r=this._holderElement.getBoundingClientRect();let a=0,l=0;if(i?n?(a=r.x,l=r.y+r.height+2):(a=o.x,l=o.y+o.height):n?(a=0,l=r.height+2):(a=this._searchInput.offsetLeft,l=this._searchInput.offsetHeight+this._searchInput.offsetTop),t&&!n&&(a-=this._dropElement.offsetWidth-o.width),!n){const p=Math.min(window.innerWidth,document.body.offsetWidth),m=t?o.x+o.width-this._dropElement.offsetWidth-1:p-1-(o.x+this._dropElement.offsetWidth);m<0&&(a=t?a-m:a+m)}n&&(this._dropElement.style.width=this._holderElement.offsetWidth+"px"),e||(this._dropElement.style.transform="unset"),Object.assign(this._dropElement.style,{left:a+"px",top:l+"px"});const d=this._dropElement.getBoundingClientRect(),h=window.innerHeight;if(d.y+d.height>h||this._dropElement.style.transform.includes("translateY")){const p=n?r.height+4:o.height;this._dropElement.style.transform="translateY(calc(-100.1% - "+p+"px))"}}_getBootstrapVersion(){let e=5,t=window.jQuery;return t&&t.fn.tooltip&&t.fn.tooltip.Constructor&&(e=parseInt(t.fn.tooltip.Constructor.VERSION.charAt(0))),e}_isSelected(e){return!!Array.from(this._selectElement.querySelectorAll("option")).find(n=>n.textContent==e&&n.getAttribute("selected"))}_isSelectable(e){const i=Array.from(this._selectElement.querySelectorAll("option")).filter(n=>n.textContent==e);return!(i.length>0&&!i.find(o=>!o.getAttribute("selected")))}hasItem(e){for(let t of this._config.items){const i=t.items||[t];for(let n of i)if(n[this._config.labelField]==e)return!0}return!1}getItem(e){for(let t of this._config.items){const i=t.items||[t];for(let n of i)if(n[this._config.valueField]==e)return n}return null}_validateRegex(e){return new RegExp(this._config.regex.trim()).test(e)}getSelection(){return this._dropElement.querySelector("a."+ACTIVE_CLASS)}removeSelection(){const e=this.getSelection();e&&e.classList.remove(...this._activeClasses())}_activeClasses(){return[...this._config.activeClasses,ACTIVE_CLASS]}getActiveSelection(){return this.getSelection()}removeActiveSelection(){return this.removeSelection()}removeAll(){this.getSelectedValues().forEach(t=>{this.removeItem(t,!0)}),this._adjustWidth()}removeLastItem(e=!1){let t=this.getLastItem();t&&this.removeItem(t,e)}getLastItem(){let e=this._containerElement.querySelectorAll("span."+CLASS_PREFIX+"badge");return e.length?e[e.length-1].getAttribute(VALUE_ATTRIBUTE):void 0}enable(){this._selectElement.setAttribute("disabled",""),this.resetState()}disable(){rmAttr(this._selectElement,"disabled"),this.resetState()}isDisabled(){return this._selectElement.hasAttribute("disabled")||this._selectElement.disabled||this._selectElement.hasAttribute("readonly")}isDropdownVisible(){return this._dropElement.classList.contains(SHOW_CLASS)}isInvalid(){return this._holderElement.classList.contains(INVALID_CLASS)}isSingle(){return!this._selectElement.hasAttribute("multiple")}isMaxReached(){return this._config.max&&this.getSelectedValues().length>=this._config.max}canAdd(e,t={}){if(!e||t.new&&!this._config.allowNew||!t.new&&!this.hasItem(e)||this.isDisabled())return!1;if(!this.isSingle()&&!this._config.allowSame){if(t.new){if(this._isSelected(e))return!1}else if(!this._isSelectable(e))return!1}return this.isMaxReached()?!1:this._config.regex&&t.new&&!this._validateRegex(e)?(this._holderElement.classList.add(INVALID_CLASS),!1):this._config.onCanAdd&&this._config.onCanAdd(e,t,this)===!1?(this._holderElement.classList.add(INVALID_CLASS),!1):!0}getData(){return this._config.items}setData(e,t=!1){Array.isArray(e)||(e=Object.entries(e).map(([i,n])=>({value:i,label:n}))),this._config.items!=e&&(this._config.items=e),t&&(this._removeSelectedAttrs(),e.reduce((n,o)=>n.concat(o.group?o.items:[o]),[]).forEach(n=>{const o=n[this._config.valueField],r=n[this._config.labelField];if(o&&(n.selected||this._config.selected.includes(o))){const a=this.addItem(r,o,n.data);a&&a.setAttribute("data-init","true")}})),this._buildSuggestions(e),this._resetHtmlState()}_findOption(e=null,t="",i=0){const o="option"+(e===null?"":'[value="'+CSS.escape(e)+'"]')+t;return this._selectElement.querySelectorAll(o)[i]||null}setItem(e,t={}){let i=null,n=this._findOption(e,":not([selected])");n&&(i=this.addItem(n.textContent,n.value,t));let o=this.getItem(e);if(o){const r=o[this._config.valueField],a=o[this._config.labelField];i=this.addItem(a,r,t)}return this._adjustWidth(),this._checkMax(),i}addItem(e,t=null,i={}){t||(t=e),this.isSingle()&&this.getSelectedValues().length&&this.removeLastItem(!0);let n=this._findOption(t,":not([selected])");if(!n){n=ce("option"),n.value=t,n.innerText=e;for(const[o,r]of Object.entries(i))n.dataset[o]=r;this._selectElement.appendChild(n),this._config.onCreateItem(n,this)}return n&&(i=Object.assign({title:n.getAttribute("title")},i,n.dataset)),n.setAttribute("selected","selected"),n.selected=!0,this._createBadge(e,t,i),this._fireEvents&&this._selectElement.dispatchEvent(new Event("change",{bubbles:!0})),n}_resetHtmlState(){const e=this._selectElement.innerHTML;this._selectElement.innerHTML="",this._selectElement.innerHTML=e,this._adjustWidth()}_createBadge(e,t=null,i={}){const n=this._getBootstrapVersion()===5,o=i.disabled&&parseBool(i.disabled),r=this._config.allowClear&&!o;let a=this._config.allowHtml?e:this._config.sanitizer(e),l=ce("span"),d=[CLASS_PREFIX+"badge"];const h=this.isSingle()&&!this._config.singleBadge;if(!h){d.push("badge");let m=this._config.badgeStyle;i.badgeStyle&&(m=i.badgeStyle),i.badgeClass&&d.push(...i.badgeClass.split(" ")),this._config.baseClass?d.push(...this._config.baseClass.split(" ")):n?d=[...d,"bg-"+m,"text-truncate"]:d=[...d,"badge-"+m],l.style.maxWidth="100%"}o&&d.push("disabled","opacity-50");const p=h?0:2;if(l.style.margin=p+"px 6px "+p+"px 0px",l.style.marginBlock=p+"px",l.style.marginInline="0px 6px",l.style.display="flex",l.style.alignItems="center",l.classList.add(...d),l.setAttribute(VALUE_ATTRIBUTE,t),i.title&&l.setAttribute("title",i.title),r){const m=d.includes("text-dark")||h?"btn-close":"btn-close btn-close-white";let v="margin-inline: 0px 6px;",y="left";this._config.clearEnd&&(y="right"),y=="right"&&(v="margin-inline: 6px 0px;");const b=n?'':'';a=y=="left"?b+a:a+b}l.innerHTML=a,this._containerElement.insertBefore(l,this._searchInput),i.title&&tooltip&&n&&tooltip.getOrCreateInstance(l),r&&l.querySelector("button").addEventListener("click",m=>{m.preventDefault(),m.stopPropagation(),this.isDisabled()||this._config.confirmClear(t,this).then(()=>{this.removeItem(t),document.activeElement.blur(),this._adjustWidth()}).catch(()=>{})})}getHolder(){return this._holderElement}clear(){this.hideSuggestions(),this.reset()}updateData(e){this.setData(e,!1),this.reset()}removeItem(e,t=!1){const i=CSS.escape(e);let n=this._containerElement.querySelectorAll("span["+VALUE_ATTRIBUTE+'="'+i+'"]');if(!n.length)return;const o=n.length-1,r=n[o];r&&(r.dataset.bsOriginalTitle&&tooltip.getOrCreateInstance(r).dispose(),r.remove());let a=this._findOption(e,"[selected]",o);a&&(rmAttr(a,"selected"),a.selected=!1,this._fireEvents&&!t&&this._selectElement.dispatchEvent(new Event("change",{bubbles:!0}))),this._searchInput.style.visibility=="hidden"&&!this.isMaxReached()&&(this._searchInput.style.visibility="visible",this._holderElement.classList.remove(MAX_REACHED_CLASS)),t||this._config.onClearItem(e,this)}}var leafletSrc={exports:{}};/* @preserve
* Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
* (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
- */(function(s,e){(function(t,i){i(e)})(commonjsGlobal,function(t){var i="1.9.4";function n(c){var u,g,C,w;for(g=1,C=arguments.length;g"u"||!L||!L.Mixin)){c=R(c)?c:[c];for(var u=0;u0?Math.floor(c):Math.ceil(c)};W.prototype={clone:function(){return new W(this.x,this.y)},add:function(c){return this.clone()._add(U(c))},_add:function(c){return this.x+=c.x,this.y+=c.y,this},subtract:function(c){return this.clone()._subtract(U(c))},_subtract:function(c){return this.x-=c.x,this.y-=c.y,this},divideBy:function(c){return this.clone()._divideBy(c)},_divideBy:function(c){return this.x/=c,this.y/=c,this},multiplyBy:function(c){return this.clone()._multiplyBy(c)},_multiplyBy:function(c){return this.x*=c,this.y*=c,this},scaleBy:function(c){return new W(this.x*c.x,this.y*c.y)},unscaleBy:function(c){return new W(this.x/c.x,this.y/c.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=X(this.x),this.y=X(this.y),this},distanceTo:function(c){c=U(c);var u=c.x-this.x,g=c.y-this.y;return Math.sqrt(u*u+g*g)},equals:function(c){return c=U(c),c.x===this.x&&c.y===this.y},contains:function(c){return c=U(c),Math.abs(c.x)<=Math.abs(this.x)&&Math.abs(c.y)<=Math.abs(this.y)},toString:function(){return"Point("+m(this.x)+", "+m(this.y)+")"}};function U(c,u,g){return c instanceof W?c:R(c)?new W(c[0],c[1]):c==null?c:typeof c=="object"&&"x"in c&&"y"in c?new W(c.x,c.y):new W(c,u,g)}function se(c,u){if(c)for(var g=u?[c,u]:c,C=0,w=g.length;C=this.min.x&&g.x<=this.max.x&&u.y>=this.min.y&&g.y<=this.max.y},intersects:function(c){c=pe(c);var u=this.min,g=this.max,C=c.min,w=c.max,P=w.x>=u.x&&C.x<=g.x,O=w.y>=u.y&&C.y<=g.y;return P&&O},overlaps:function(c){c=pe(c);var u=this.min,g=this.max,C=c.min,w=c.max,P=w.x>u.x&&C.xu.y&&C.y=u.lat&&w.lat<=g.lat&&C.lng>=u.lng&&w.lng<=g.lng},intersects:function(c){c=oe(c);var u=this._southWest,g=this._northEast,C=c.getSouthWest(),w=c.getNorthEast(),P=w.lat>=u.lat&&C.lat<=g.lat,O=w.lng>=u.lng&&C.lng<=g.lng;return P&&O},overlaps:function(c){c=oe(c);var u=this._southWest,g=this._northEast,C=c.getSouthWest(),w=c.getNorthEast(),P=w.lat>u.lat&&C.latu.lng&&C.lng1,Yn=function(){var c=!1;try{var u=Object.defineProperty({},"passive",{get:function(){c=!0}});window.addEventListener("testPassiveEventSupport",p,u),window.removeEventListener("testPassiveEventSupport",p,u)}catch{}return c}(),qn=function(){return!!document.createElement("canvas").getContext}(),ti=!!(document.createElementNS&&Mt("svg").createSVGRect),Xn=!!ti&&function(){var c=document.createElement("div");return c.innerHTML="",(c.firstChild&&c.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),Qn=!ti&&function(){try{var c=document.createElement("div");c.innerHTML='';var u=c.firstChild;return u.style.behavior="url(#default#VML)",u&&typeof u.adj=="object"}catch{return!1}}(),Zn=navigator.platform.indexOf("Mac")===0,Jn=navigator.platform.indexOf("Linux")===0;function Me(c){return navigator.userAgent.toLowerCase().indexOf(c)>=0}var Q={ie:Ze,ielt9:Jt,edge:Oe,webkit:Ge,android:ht,android23:ft,androidStock:xt,opera:Je,chrome:mt,gecko:vt,safari:Gn,phantom:Mi,opera12:xi,win:Vn,ie3d:Li,webkit3d:ei,gecko3d:Fi,any3d:Hn,mobile:Ct,mobileWebkit:Wn,mobileWebkit3d:Bn,msPointer:Ii,pointer:Ni,touch:zn,touchNative:ki,mobileOpera:jn,mobileGecko:Un,retina:Kn,passiveEvents:Yn,canvas:qn,svg:ti,vml:Qn,inlineSvg:Xn,mac:Zn,linux:Jn},$i=Q.msPointer?"MSPointerDown":"pointerdown",Gi=Q.msPointer?"MSPointerMove":"pointermove",Vi=Q.msPointer?"MSPointerUp":"pointerup",Hi=Q.msPointer?"MSPointerCancel":"pointercancel",ii={touchstart:$i,touchmove:Gi,touchend:Vi,touchcancel:Hi},Wi={touchstart:rs,touchmove:Lt,touchend:Lt,touchcancel:Lt},et={},Bi=!1;function ts(c,u,g){return u==="touchstart"&&os(),Wi[u]?(g=Wi[u].bind(this,g),c.addEventListener(ii[u],g,!1),g):(console.warn("wrong event specified:",u),p)}function is(c,u,g){if(!ii[u]){console.warn("wrong event specified:",u);return}c.removeEventListener(ii[u],g,!1)}function ns(c){et[c.pointerId]=c}function ss(c){et[c.pointerId]&&(et[c.pointerId]=c)}function zi(c){delete et[c.pointerId]}function os(){Bi||(document.addEventListener($i,ns,!0),document.addEventListener(Gi,ss,!0),document.addEventListener(Vi,zi,!0),document.addEventListener(Hi,zi,!0),Bi=!0)}function Lt(c,u){if(u.pointerType!==(u.MSPOINTER_TYPE_MOUSE||"mouse")){u.touches=[];for(var g in et)u.touches.push(et[g]);u.changedTouches=[u],c(u)}}function rs(c,u){u.MSPOINTER_TYPE_TOUCH&&u.pointerType===u.MSPOINTER_TYPE_TOUCH&&ye(u),Lt(c,u)}function as(c){var u={},g,C;for(C in c)g=c[C],u[C]=g&&g.bind?g.bind(c):g;return c=u,u.type="dblclick",u.detail=2,u.isTrusted=!1,u._simulated=!0,u}var ls=200;function ds(c,u){c.addEventListener("dblclick",u);var g=0,C;function w(P){if(P.detail!==1){C=P.detail;return}if(!(P.pointerType==="mouse"||P.sourceCapabilities&&!P.sourceCapabilities.firesTouchEvents)){var O=qi(P);if(!(O.some(function($){return $ instanceof HTMLLabelElement&&$.attributes.for})&&!O.some(function($){return $ instanceof HTMLInputElement||$ instanceof HTMLSelectElement}))){var N=Date.now();N-g<=ls?(C++,C===2&&u(as(P))):C=1,g=N}}}return c.addEventListener("click",w),{dblclick:u,simDblclick:w}}function us(c,u){c.removeEventListener("dblclick",u.dblclick),c.removeEventListener("click",u.simDblclick)}var ni=Nt(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),_t=Nt(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),ji=_t==="webkitTransition"||_t==="OTransition"?_t+"End":"transitionend";function Ui(c){return typeof c=="string"?document.getElementById(c):c}function yt(c,u){var g=c.style[u]||c.currentStyle&&c.currentStyle[u];if((!g||g==="auto")&&document.defaultView){var C=document.defaultView.getComputedStyle(c,null);g=C?C[u]:null}return g==="auto"?null:g}function he(c,u,g){var C=document.createElement(c);return C.className=u||"",g&&g.appendChild(C),C}function ge(c){var u=c.parentNode;u&&u.removeChild(c)}function Ft(c){for(;c.firstChild;)c.removeChild(c.firstChild)}function tt(c){var u=c.parentNode;u&&u.lastChild!==c&&u.appendChild(c)}function nt(c){var u=c.parentNode;u&&u.firstChild!==c&&u.insertBefore(c,u.firstChild)}function si(c,u){if(c.classList!==void 0)return c.classList.contains(u);var g=It(c);return g.length>0&&new RegExp("(^|\\s)"+u+"(\\s|$)").test(g)}function re(c,u){if(c.classList!==void 0)for(var g=y(u),C=0,w=g.length;C0?2*window.devicePixelRatio:1;function Qi(c){return Q.edge?c.wheelDeltaY/2:c.deltaY&&c.deltaMode===0?-c.deltaY/fs:c.deltaY&&c.deltaMode===1?-c.deltaY*20:c.deltaY&&c.deltaMode===2?-c.deltaY*60:c.deltaX||c.deltaZ?0:c.wheelDelta?(c.wheelDeltaY||c.wheelDelta)/2:c.detail&&Math.abs(c.detail)<32765?-c.detail*20:c.detail?c.detail/-32765*60:0}function Ci(c,u){var g=u.relatedTarget;if(!g)return!0;try{for(;g&&g!==c;)g=g.parentNode}catch{return!1}return g!==c}var gs={__proto__:null,on:ne,off:fe,stopPropagation:Ue,disableScrollPropagation:mi,disableClickPropagation:Et,preventDefault:ye,stop:Ke,getPropagationPath:qi,getMousePosition:Xi,getWheelDelta:Qi,isExternalTarget:Ci,addListener:ne,removeListener:fe},Zi=Y.extend({run:function(c,u,g,C){this.stop(),this._el=c,this._inProgress=!0,this._duration=g||.25,this._easeOutPower=1/Math.max(C||.5,.2),this._startPos=je(c),this._offset=u.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=B(this._animate,this),this._step()},_step:function(c){var u=+new Date-this._startTime,g=this._duration*1e3;uthis.options.maxZoom)?this.setZoom(c):this},panInsideBounds:function(c,u){this._enforcingBounds=!0;var g=this.getCenter(),C=this._limitCenter(g,this._zoom,oe(c));return g.equals(C)||this.panTo(C,u),this._enforcingBounds=!1,this},panInside:function(c,u){u=u||{};var g=U(u.paddingTopLeft||u.padding||[0,0]),C=U(u.paddingBottomRight||u.padding||[0,0]),w=this.project(this.getCenter()),P=this.project(c),O=this.getPixelBounds(),N=pe([O.min.add(g),O.max.subtract(C)]),$=N.getSize();if(!N.contains(P)){this._enforcingBounds=!0;var H=P.subtract(N.getCenter()),q=N.extend(P).getSize().subtract($);w.x+=H.x<0?-q.x:q.x,w.y+=H.y<0?-q.y:q.y,this.panTo(this.unproject(w),u),this._enforcingBounds=!1}return this},invalidateSize:function(c){if(!this._loaded)return this;c=n({animate:!1,pan:!0},c===!0?{animate:!0}:c);var u=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var g=this.getSize(),C=u.divideBy(2).round(),w=g.divideBy(2).round(),P=C.subtract(w);return!P.x&&!P.y?this:(c.animate&&c.pan?this.panBy(P):(c.pan&&this._rawPanBy(P),this.fire("move"),c.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(r(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:u,newSize:g}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(c){if(c=this._locateOptions=n({timeout:1e4,watch:!1},c),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var u=r(this._handleGeolocationResponse,this),g=r(this._handleGeolocationError,this);return c.watch?this._locationWatchId=navigator.geolocation.watchPosition(u,g,c):navigator.geolocation.getCurrentPosition(u,g,c),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(c){if(this._container._leaflet_id){var u=c.code,g=c.message||(u===1?"permission denied":u===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:u,message:"Geolocation error: "+g+"."})}},_handleGeolocationResponse:function(c){if(this._container._leaflet_id){var u=c.coords.latitude,g=c.coords.longitude,C=new ie(u,g),w=C.toBounds(c.coords.accuracy*2),P=this._locateOptions;if(P.setView){var O=this.getBoundsZoom(w);this.setView(C,P.maxZoom?Math.min(O,P.maxZoom):O)}var N={latlng:C,bounds:w,timestamp:c.timestamp};for(var $ in c.coords)typeof c.coords[$]=="number"&&(N[$]=c.coords[$]);this.fire("locationfound",N)}},addHandler:function(c,u){if(!u)return this;var g=this[c]=new u(this);return this._handlers.push(g),this.options[c]&&g.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),ge(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(K(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var c;for(c in this._layers)this._layers[c].remove();for(c in this._panes)ge(this._panes[c]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(c,u){var g="leaflet-pane"+(c?" leaflet-"+c.replace("Pane","")+"-pane":""),C=he("div",g,u||this._mapPane);return c&&(this._panes[c]=C),C},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var c=this.getPixelBounds(),u=this.unproject(c.getBottomLeft()),g=this.unproject(c.getTopRight());return new ae(u,g)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(c,u,g){c=oe(c),g=U(g||[0,0]);var C=this.getZoom()||0,w=this.getMinZoom(),P=this.getMaxZoom(),O=c.getNorthWest(),N=c.getSouthEast(),$=this.getSize().subtract(g),H=pe(this.project(N,C),this.project(O,C)).getSize(),q=Q.any3d?this.options.zoomSnap:1,ee=$.x/H.x,le=$.y/H.y,we=u?Math.max(ee,le):Math.min(ee,le);return C=this.getScaleZoom(we,C),q&&(C=Math.round(C/(q/100))*(q/100),C=u?Math.ceil(C/q)*q:Math.floor(C/q)*q),Math.max(w,Math.min(P,C))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new W(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(c,u){var g=this._getTopLeftPoint(c,u);return new se(g,g.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(c){return this.options.crs.getProjectedBounds(c===void 0?this.getZoom():c)},getPane:function(c){return typeof c=="string"?this._panes[c]:c},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(c,u){var g=this.options.crs;return u=u===void 0?this._zoom:u,g.scale(c)/g.scale(u)},getScaleZoom:function(c,u){var g=this.options.crs;u=u===void 0?this._zoom:u;var C=g.zoom(c*g.scale(u));return isNaN(C)?1/0:C},project:function(c,u){return u=u===void 0?this._zoom:u,this.options.crs.latLngToPoint(te(c),u)},unproject:function(c,u){return u=u===void 0?this._zoom:u,this.options.crs.pointToLatLng(U(c),u)},layerPointToLatLng:function(c){var u=U(c).add(this.getPixelOrigin());return this.unproject(u)},latLngToLayerPoint:function(c){var u=this.project(te(c))._round();return u._subtract(this.getPixelOrigin())},wrapLatLng:function(c){return this.options.crs.wrapLatLng(te(c))},wrapLatLngBounds:function(c){return this.options.crs.wrapLatLngBounds(oe(c))},distance:function(c,u){return this.options.crs.distance(te(c),te(u))},containerPointToLayerPoint:function(c){return U(c).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(c){return U(c).add(this._getMapPanePos())},containerPointToLatLng:function(c){var u=this.containerPointToLayerPoint(U(c));return this.layerPointToLatLng(u)},latLngToContainerPoint:function(c){return this.layerPointToContainerPoint(this.latLngToLayerPoint(te(c)))},mouseEventToContainerPoint:function(c){return Xi(c,this._container)},mouseEventToLayerPoint:function(c){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(c))},mouseEventToLatLng:function(c){return this.layerPointToLatLng(this.mouseEventToLayerPoint(c))},_initContainer:function(c){var u=this._container=Ui(c);if(u){if(u._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");ne(u,"scroll",this._onScroll,this),this._containerId=l(u)},_initLayout:function(){var c=this._container;this._fadeAnimated=this.options.fadeAnimation&&Q.any3d,re(c,"leaflet-container"+(Q.touch?" leaflet-touch":"")+(Q.retina?" leaflet-retina":"")+(Q.ielt9?" leaflet-oldie":"")+(Q.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var u=yt(c,"position");u!=="absolute"&&u!=="relative"&&u!=="fixed"&&u!=="sticky"&&(c.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var c=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),ve(this._mapPane,new W(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(re(c.markerPane,"leaflet-zoom-hide"),re(c.shadowPane,"leaflet-zoom-hide"))},_resetView:function(c,u,g){ve(this._mapPane,new W(0,0));var C=!this._loaded;this._loaded=!0,u=this._limitZoom(u),this.fire("viewprereset");var w=this._zoom!==u;this._moveStart(w,g)._move(c,u)._moveEnd(w),this.fire("viewreset"),C&&this.fire("load")},_moveStart:function(c,u){return c&&this.fire("zoomstart"),u||this.fire("movestart"),this},_move:function(c,u,g,C){u===void 0&&(u=this._zoom);var w=this._zoom!==u;return this._zoom=u,this._lastCenter=c,this._pixelOrigin=this._getNewPixelOrigin(c),C?g&&g.pinch&&this.fire("zoom",g):((w||g&&g.pinch)&&this.fire("zoom",g),this.fire("move",g)),this},_moveEnd:function(c){return c&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return K(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(c){ve(this._mapPane,this._getMapPanePos().subtract(c))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(c){this._targets={},this._targets[l(this._container)]=this;var u=c?fe:ne;u(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&u(window,"resize",this._onResize,this),Q.any3d&&this.options.transform3DLimit&&(c?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){K(this._resizeRequest),this._resizeRequest=B(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var c=this._getMapPanePos();Math.max(Math.abs(c.x),Math.abs(c.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(c,u){for(var g=[],C,w=u==="mouseout"||u==="mouseover",P=c.target||c.srcElement,O=!1;P;){if(C=this._targets[l(P)],C&&(u==="click"||u==="preclick")&&this._draggableMoved(C)){O=!0;break}if(C&&C.listens(u,!0)&&(w&&!Ci(P,c)||(g.push(C),w))||P===this._container)break;P=P.parentNode}return!g.length&&!O&&!w&&this.listens(u,!0)&&(g=[this]),g},_isClickDisabled:function(c){for(;c&&c!==this._container;){if(c._leaflet_disable_click)return!0;c=c.parentNode}},_handleDOMEvent:function(c){var u=c.target||c.srcElement;if(!(!this._loaded||u._leaflet_disable_events||c.type==="click"&&this._isClickDisabled(u))){var g=c.type;g==="mousedown"&&di(u),this._fireDOMEvent(c,g)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(c,u,g){if(c.type==="click"){var C=n({},c);C.type="preclick",this._fireDOMEvent(C,C.type,g)}var w=this._findEventTargets(c,u);if(g){for(var P=[],O=0;O0?Math.round(c-u)/2:Math.max(0,Math.ceil(c))-Math.max(0,Math.floor(u))},_limitZoom:function(c){var u=this.getMinZoom(),g=this.getMaxZoom(),C=Q.any3d?this.options.zoomSnap:1;return C&&(c=Math.round(c/C)*C),Math.max(u,Math.min(g,c))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){me(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(c,u){var g=this._getCenterOffset(c)._trunc();return(u&&u.animate)!==!0&&!this.getSize().contains(g)?!1:(this.panBy(g,u),!0)},_createAnimProxy:function(){var c=this._proxy=he("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(c),this.on("zoomanim",function(u){var g=ni,C=this._proxy.style[g];ze(this._proxy,this.project(u.center,u.zoom),this.getZoomScale(u.zoom,1)),C===this._proxy.style[g]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){ge(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var c=this.getCenter(),u=this.getZoom();ze(this._proxy,this.project(c,u),this.getZoomScale(u,1))},_catchTransitionEnd:function(c){this._animatingZoom&&c.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(c,u,g){if(this._animatingZoom)return!0;if(g=g||{},!this._zoomAnimated||g.animate===!1||this._nothingToAnimate()||Math.abs(u-this._zoom)>this.options.zoomAnimationThreshold)return!1;var C=this.getZoomScale(u),w=this._getCenterOffset(c)._divideBy(1-1/C);return g.animate!==!0&&!this.getSize().contains(w)?!1:(B(function(){this._moveStart(!0,g.noMoveStart||!1)._animateZoom(c,u,!0)},this),!0)},_animateZoom:function(c,u,g,C){this._mapPane&&(g&&(this._animatingZoom=!0,this._animateToCenter=c,this._animateToZoom=u,re(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:c,zoom:u,noUpdate:C}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(r(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&me(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function ms(c,u){return new ue(c,u)}var Ae=Z.extend({options:{position:"topright"},initialize:function(c){b(this,c)},getPosition:function(){return this.options.position},setPosition:function(c){var u=this._map;return u&&u.removeControl(this),this.options.position=c,u&&u.addControl(this),this},getContainer:function(){return this._container},addTo:function(c){this.remove(),this._map=c;var u=this._container=this.onAdd(c),g=this.getPosition(),C=c._controlCorners[g];return re(u,"leaflet-control"),g.indexOf("bottom")!==-1?C.insertBefore(u,C.firstChild):C.appendChild(u),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(ge(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(c){this._map&&c&&c.screenX>0&&c.screenY>0&&this._map.getContainer().focus()}}),Pt=function(c){return new Ae(c)};ue.include({addControl:function(c){return c.addTo(this),this},removeControl:function(c){return c.remove(),this},_initControlPos:function(){var c=this._controlCorners={},u="leaflet-",g=this._controlContainer=he("div",u+"control-container",this._container);function C(w,P){var O=u+w+" "+u+P;c[w+P]=he("div",O,g)}C("top","left"),C("top","right"),C("bottom","left"),C("bottom","right")},_clearControlPos:function(){for(var c in this._controlCorners)ge(this._controlCorners[c]);ge(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var Ji=Ae.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(c,u,g,C){return g1,this._baseLayersList.style.display=c?"":"none"),this._separator.style.display=u&&c?"":"none",this},_onLayerChange:function(c){this._handlingClick||this._update();var u=this._getLayer(l(c.target)),g=u.overlay?c.type==="add"?"overlayadd":"overlayremove":c.type==="add"?"baselayerchange":null;g&&this._map.fire(g,u)},_createRadioElement:function(c,u){var g='