react-semaphor 0.0.444 → 0.0.445

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -242,7 +242,7 @@ Valid keys: `+JSON.stringify(Object.keys(O),null," "));var Q=ne(W,J,H,G,Y+"."+J
242
242
  * Released under the MIT License
243
243
  */class nG{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,r,o){const i=n.listeners[o],s=n.duration;i.forEach(a=>a({chart:t,initial:n.initial,numSteps:s,currentStep:Math.min(r-n.start,s)}))}_refresh(){this._request||(this._running=!0,this._request=pT.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((r,o)=>{if(!r.running||!r.items.length)return;const i=r.items;let s=i.length-1,a=!1,l;for(;s>=0;--s)l=i[s],l._active?(l._total>r.duration&&(r.duration=l._total),l.tick(t),a=!0):(i[s]=i[i.length-1],i.pop());a&&(o.draw(),this._notify(o,r,t,"progress")),i.length||(r.running=!1,this._notify(o,r,t,"complete"),r.initial=!1),n+=i.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let r=n.get(t);return r||(r={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,r)),r}listen(t,n,r){this._getAnims(t).listeners[n].push(r)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((r,o)=>Math.max(r,o._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const r=n.items;let o=r.length-1;for(;o>=0;--o)r[o].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var pi=new nG;const j2="transparent",rG={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const r=P2(e||j2),o=r.valid&&P2(t||j2);return o&&o.valid?o.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class oG{constructor(t,n,r,o){const i=n[r];o=Ft([t.to,o,i,t.from]);const s=Ft([t.from,i,o]);this._active=!0,this._fn=t.fn||rG[t.type||typeof s],this._easing=rd[t.easing]||rd.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=r,this._from=s,this._to=o,this._promises=void 0}active(){return this._active}update(t,n,r){if(this._active){this._notify(!1);const o=this._target[this._prop],i=r-this._start,s=this._duration-i;this._start=r,this._duration=Math.floor(Math.max(s,t.duration)),this._total+=i,this._loop=!!t.loop,this._to=Ft([t.to,n,o,t.from]),this._from=Ft([t.from,o,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,r=this._duration,o=this._prop,i=this._from,s=this._loop,a=this._to;let l;if(this._active=i!==a&&(s||n<r),!this._active){this._target[o]=a,this._notify(!0);return}if(n<0){this._target[o]=i;return}l=n/r%2,l=s&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[o]=this._fn(i,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,r)=>{t.push({res:n,rej:r})})}_notify(t){const n=t?"res":"rej",r=this._promises||[];for(let o=0;o<r.length;o++)r[o][n]()}}class AT{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!tt(t))return;const n=Object.keys(zt.animation),r=this._properties;Object.getOwnPropertyNames(t).forEach(o=>{const i=t[o];if(!tt(i))return;const s={};for(const a of n)s[a]=i[a];(jt(i.properties)&&i.properties||[o]).forEach(a=>{(a===o||!r.has(a))&&r.set(a,s)})})}_animateOptions(t,n){const r=n.options,o=sG(t,r);if(!o)return[];const i=this._createAnimations(o,r);return r.$shared&&iG(t.options.$animations,r).then(()=>{t.options=r},()=>{}),i}_createAnimations(t,n){const r=this._properties,o=[],i=t.$animations||(t.$animations={}),s=Object.keys(n),a=Date.now();let l;for(l=s.length-1;l>=0;--l){const c=s[l];if(c.charAt(0)==="$")continue;if(c==="options"){o.push(...this._animateOptions(t,n));continue}const u=n[c];let d=i[c];const h=r.get(c);if(d)if(h&&d.active()){d.update(h,u,a);continue}else d.cancel();if(!h||!h.duration){t[c]=u;continue}i[c]=d=new oG(h,t,c,u),o.push(d)}return o}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const r=this._createAnimations(t,n);if(r.length)return pi.add(this._chart,r),!0}}function iG(e,t){const n=[],r=Object.keys(t);for(let o=0;o<r.length;o++){const i=e[r[o]];i&&i.active()&&n.push(i.wait())}return Promise.all(n)}function sG(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function $2(e,t){const n=e&&e.options||{},r=n.reverse,o=n.min===void 0?t:0,i=n.max===void 0?t:0;return{start:r?i:o,end:r?o:i}}function aG(e,t,n){if(n===!1)return!1;const r=$2(e,n),o=$2(t,n);return{top:o.end,right:r.end,bottom:o.start,left:r.start}}function lG(e){let t,n,r,o;return tt(e)?(t=e.top,n=e.right,r=e.bottom,o=e.left):t=n=r=o=e,{top:t,right:n,bottom:r,left:o,disabled:e===!1}}function TT(e,t){const n=[],r=e._getSortedDatasetMetas(t);let o,i;for(o=0,i=r.length;o<i;++o)n.push(r[o].index);return n}function z2(e,t,n,r={}){const o=e.keys,i=r.mode==="single";let s,a,l,c;if(t===null)return;let u=!1;for(s=0,a=o.length;s<a;++s){if(l=+o[s],l===n){if(u=!0,r.all)continue;break}c=e.values[l],Qt(c)&&(i||t===0||$o(t)===$o(c))&&(t+=c)}return!u&&!r.all?0:t}function cG(e,t){const{iScale:n,vScale:r}=t,o=n.axis==="x"?"x":"y",i=r.axis==="x"?"x":"y",s=Object.keys(e),a=new Array(s.length);let l,c,u;for(l=0,c=s.length;l<c;++l)u=s[l],a[l]={[o]:u,[i]:e[u]};return a}function F0(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function uG(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function dG(e){const{min:t,max:n,minDefined:r,maxDefined:o}=e.getUserBounds();return{min:r?t:Number.NEGATIVE_INFINITY,max:o?n:Number.POSITIVE_INFINITY}}function fG(e,t,n){const r=e[t]||(e[t]={});return r[n]||(r[n]={})}function B2(e,t,n,r){for(const o of t.getMatchingVisibleMetas(r).reverse()){const i=e[o.index];if(n&&i>0||!n&&i<0)return o.index}return null}function V2(e,t){const{chart:n,_cachedMeta:r}=e,o=n._stacks||(n._stacks={}),{iScale:i,vScale:s,index:a}=r,l=i.axis,c=s.axis,u=uG(i,s,r),d=t.length;let h;for(let f=0;f<d;++f){const p=t[f],{[l]:g,[c]:m}=p,b=p._stacks||(p._stacks={});h=b[c]=fG(o,u,g),h[a]=m,h._top=B2(h,s,!0,r.type),h._bottom=B2(h,s,!1,r.type);const v=h._visualValues||(h._visualValues={});v[a]=m}}function L0(e,t){const n=e.scales;return Object.keys(n).filter(r=>n[r].axis===t).shift()}function hG(e,t){return Ds(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function pG(e,t,n){return Ds(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function _u(e,t){const n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t=t||e._parsed;for(const o of t){const i=o._stacks;if(!i||i[r]===void 0||i[r][n]===void 0)return;delete i[r][n],i[r]._visualValues!==void 0&&i[r]._visualValues[n]!==void 0&&delete i[r]._visualValues[n]}}}const j0=e=>e==="reset"||e==="none",H2=(e,t)=>t?e:Object.assign({},e),gG=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:TT(n,!0),values:null};class Kr{constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=F0(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&_u(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,r=this.getDataset(),o=(d,h,f,p)=>d==="x"?h:d==="r"?p:f,i=n.xAxisID=Ae(r.xAxisID,L0(t,"x")),s=n.yAxisID=Ae(r.yAxisID,L0(t,"y")),a=n.rAxisID=Ae(r.rAxisID,L0(t,"r")),l=n.indexAxis,c=n.iAxisID=o(l,i,s,a),u=n.vAxisID=o(l,s,i,a);n.xScale=this.getScaleForId(i),n.yScale=this.getScaleForId(s),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&E2(this._data,this),t._stacked&&_u(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),r=this._data;if(tt(n)){const o=this._cachedMeta;this._data=cG(n,o)}else if(r!==n){if(r){E2(r,this);const o=this._cachedMeta;_u(o),o._parsed=[]}n&&Object.isExtensible(n)&&eq(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,r=this.getDataset();let o=!1;this._dataCheck();const i=n._stacked;n._stacked=F0(n.vScale,n),n.stack!==r.stack&&(o=!0,_u(n),n.stack=r.stack),this._resyncElements(t),(o||i!==n._stacked)&&(V2(this,n._parsed),n._stacked=F0(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),r=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(r,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:r,_data:o}=this,{iScale:i,_stacked:s}=r,a=i.axis;let l=t===0&&n===o.length?!0:r._sorted,c=t>0&&r._parsed[t-1],u,d,h;if(this._parsing===!1)r._parsed=o,r._sorted=!0,h=o;else{jt(o[t])?h=this.parseArrayData(r,o,t,n):tt(o[t])?h=this.parseObjectData(r,o,t,n):h=this.parsePrimitiveData(r,o,t,n);const f=()=>d[a]===null||c&&d[a]<c[a];for(u=0;u<n;++u)r._parsed[u+t]=d=h[u],l&&(f()&&(l=!1),c=d);r._sorted=l}s&&V2(this,h)}parsePrimitiveData(t,n,r,o){const{iScale:i,vScale:s}=t,a=i.axis,l=s.axis,c=i.getLabels(),u=i===s,d=new Array(o);let h,f,p;for(h=0,f=o;h<f;++h)p=h+r,d[h]={[a]:u||i.parse(c[p],p),[l]:s.parse(n[p],p)};return d}parseArrayData(t,n,r,o){const{xScale:i,yScale:s}=t,a=new Array(o);let l,c,u,d;for(l=0,c=o;l<c;++l)u=l+r,d=n[u],a[l]={x:i.parse(d[0],u),y:s.parse(d[1],u)};return a}parseObjectData(t,n,r,o){const{xScale:i,yScale:s}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(o);let u,d,h,f;for(u=0,d=o;u<d;++u)h=u+r,f=n[h],c[u]={x:i.parse(bs(f,a),h),y:s.parse(bs(f,l),h)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,r){const o=this.chart,i=this._cachedMeta,s=n[t.axis],a={keys:TT(o,!0),values:n._stacks[t.axis]._visualValues};return z2(a,s,i.index,{mode:r})}updateRangeFromParsed(t,n,r,o){const i=r[n.axis];let s=i===null?NaN:i;const a=o&&r._stacks[n.axis];o&&a&&(o.values=a,s=z2(o,i,this._cachedMeta.index)),t.min=Math.min(t.min,s),t.max=Math.max(t.max,s)}getMinMax(t,n){const r=this._cachedMeta,o=r._parsed,i=r._sorted&&t===r.iScale,s=o.length,a=this._getOtherScale(t),l=gG(n,r,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:d}=dG(a);let h,f;function p(){f=o[h];const g=f[a.axis];return!Qt(f[t.axis])||u>g||d<g}for(h=0;h<s&&!(!p()&&(this.updateRangeFromParsed(c,t,f,l),i));++h);if(i){for(h=s-1;h>=0;--h)if(!p()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const n=this._cachedMeta._parsed,r=[];let o,i,s;for(o=0,i=n.length;o<i;++o)s=n[o][t.axis],Qt(s)&&r.push(s);return r}getMaxOverflow(){return!1}getLabelAndValue(t){const n=this._cachedMeta,r=n.iScale,o=n.vScale,i=this.getParsed(t);return{label:r?""+r.getLabelForValue(i[r.axis]):"",value:o?""+o.getLabelForValue(i[o.axis]):""}}_update(t){const n=this._cachedMeta;this.update(t||"default"),n._clip=lG(Ae(this.options.clip,aG(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this.chart,r=this._cachedMeta,o=r.data||[],i=n.chartArea,s=[],a=this._drawStart||0,l=this._drawCount||o.length-a,c=this.options.drawActiveElementsOnTop;let u;for(r.dataset&&r.dataset.draw(t,i,a,l),u=a;u<a+l;++u){const d=o[u];d.hidden||(d.active&&c?s.push(d):d.draw(t,i))}for(u=0;u<s.length;++u)s[u].draw(t,i)}getStyle(t,n){const r=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(r):this.resolveDataElementOptions(t||0,r)}getContext(t,n,r){const o=this.getDataset();let i;if(t>=0&&t<this._cachedMeta.data.length){const s=this._cachedMeta.data[t];i=s.$context||(s.$context=pG(this.getContext(),t,s)),i.parsed=this.getParsed(t),i.raw=o.data[t],i.index=i.dataIndex=t}else i=this.$context||(this.$context=hG(this.chart.getContext(),this.index)),i.dataset=o,i.index=i.datasetIndex=this.index;return i.active=!!n,i.mode=r,i}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",r){const o=n==="active",i=this._cachedDataOpts,s=t+"-"+n,a=i[s],l=this.enableOptionSharing&&Ad(r);if(a)return H2(a,l);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),d=o?[`${t}Hover`,"hover",t,""]:[t,""],h=c.getOptionScopes(this.getDataset(),u),f=Object.keys(zt.elements[t]),p=()=>this.getContext(r,o,n),g=c.resolveNamedOptions(h,f,p,d);return g.$shared&&(g.$shared=l,i[s]=Object.freeze(H2(g,l))),g}_resolveAnimations(t,n,r){const o=this.chart,i=this._cachedDataOpts,s=`animation-${n}`,a=i[s];if(a)return a;let l;if(o.options.animation!==!1){const u=this.chart.config,d=u.datasetAnimationScopeKeys(this._type,n),h=u.getOptionScopes(this.getDataset(),d);l=u.createResolver(h,this.getContext(t,r,n))}const c=new AT(o,l&&l.animations);return l&&l._cacheable&&(i[s]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||j0(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const r=this.resolveDataElementOptions(t,n),o=this._sharedOptions,i=this.getSharedOptions(r),s=this.includeOptions(n,i)||i!==o;return this.updateSharedOptions(i,n,r),{sharedOptions:i,includeOptions:s}}updateElement(t,n,r,o){j0(o)?Object.assign(t,r):this._resolveAnimations(n,o).update(t,r)}updateSharedOptions(t,n,r){t&&!j0(n)&&this._resolveAnimations(void 0,n).update(t,r)}_setStyle(t,n,r,o){t.active=o;const i=this.getStyle(n,o);this._resolveAnimations(n,r,o).update(t,{options:!o&&this.getSharedOptions(i)||i})}removeHoverStyle(t,n,r){this._setStyle(t,r,"active",!1)}setHoverStyle(t,n,r){this._setStyle(t,r,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,r=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const o=r.length,i=n.length,s=Math.min(i,o);s&&this.parse(0,s),i>o?this._insertElements(o,i-o,t):i<o&&this._removeElements(i,o-i)}_insertElements(t,n,r=!0){const o=this._cachedMeta,i=o.data,s=t+n;let a;const l=c=>{for(c.length+=n,a=c.length-1;a>=s;a--)c[a]=c[a-n]};for(l(i),a=t;a<s;++a)i[a]=new this.dataElementType;this._parsing&&l(o._parsed),this.parse(t,n),r&&this.updateElements(i,t,n,"reset")}updateElements(t,n,r,o){}_removeElements(t,n){const r=this._cachedMeta;if(this._parsing){const o=r._parsed.splice(t,n);r._stacked&&_u(r,o)}r.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[n,r,o]=t;this[n](r,o)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);const r=arguments.length-2;r&&this._sync(["_insertElements",t,r])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}pe(Kr,"defaults",{}),pe(Kr,"datasetElementType",null),pe(Kr,"dataElementType",null);function mG(e,t){if(!e._cache.$bar){const n=e.getMatchingVisibleMetas(t);let r=[];for(let o=0,i=n.length;o<i;o++)r=r.concat(n[o].controller.getAllParsedValues(e));e._cache.$bar=hT(r.sort((o,i)=>o-i))}return e._cache.$bar}function bG(e){const t=e.iScale,n=mG(t,e.type);let r=t._length,o,i,s,a;const l=()=>{s===32767||s===-32768||(Ad(a)&&(r=Math.min(r,Math.abs(s-a)||r)),a=s)};for(o=0,i=n.length;o<i;++o)s=t.getPixelForValue(n[o]),l();for(a=void 0,o=0,i=t.ticks.length;o<i;++o)s=t.getPixelForTick(o),l();return r}function yG(e,t,n,r){const o=n.barThickness;let i,s;return ze(o)?(i=t.min*n.categoryPercentage,s=n.barPercentage):(i=o*r,s=1),{chunk:i/r,ratio:s,start:t.pixels[e]-i/2}}function vG(e,t,n,r){const o=t.pixels,i=o[e];let s=e>0?o[e-1]:null,a=e<o.length-1?o[e+1]:null;const l=n.categoryPercentage;s===null&&(s=i-(a===null?t.end-t.start:a-i)),a===null&&(a=i+i-s);const c=i-(i-Math.min(s,a))/2*l;return{chunk:Math.abs(a-s)/2*l/r,ratio:n.barPercentage,start:c}}function xG(e,t,n,r){const o=n.parse(e[0],r),i=n.parse(e[1],r),s=Math.min(o,i),a=Math.max(o,i);let l=s,c=a;Math.abs(s)>Math.abs(a)&&(l=a,c=s),t[n.axis]=c,t._custom={barStart:l,barEnd:c,start:o,end:i,min:s,max:a}}function IT(e,t,n,r){return jt(e)?xG(e,t,n,r):t[n.axis]=n.parse(e,r),t}function W2(e,t,n,r){const o=e.iScale,i=e.vScale,s=o.getLabels(),a=o===i,l=[];let c,u,d,h;for(c=n,u=n+r;c<u;++c)h=t[c],d={},d[o.axis]=a||o.parse(s[c],c),l.push(IT(h,d,i,c));return l}function $0(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function wG(e,t,n){return e!==0?$o(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}function SG(e){let t,n,r,o,i;return e.horizontal?(t=e.base>e.x,n="left",r="right"):(t=e.base<e.y,n="bottom",r="top"),t?(o="end",i="start"):(o="start",i="end"),{start:n,end:r,reverse:t,top:o,bottom:i}}function CG(e,t,n,r){let o=t.borderSkipped;const i={};if(!o){e.borderSkipped=i;return}if(o===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:s,end:a,reverse:l,top:c,bottom:u}=SG(e);o==="middle"&&n&&(e.enableBorderRadius=!0,(n._top||0)===r?o=c:(n._bottom||0)===r?o=u:(i[U2(u,s,a,l)]=!0,o=c)),i[U2(o,s,a,l)]=!0,e.borderSkipped=i}function U2(e,t,n,r){return r?(e=_G(e,t,n),e=q2(e,n,t)):e=q2(e,t,n),e}function _G(e,t,n){return e===t?n:e===n?t:e}function q2(e,t,n){return e==="start"?t:e==="end"?n:e}function EG(e,{inflateAmount:t},n){e.inflateAmount=t==="auto"?n===1?.33:0:t}class Ma extends Kr{parsePrimitiveData(t,n,r,o){return W2(t,n,r,o)}parseArrayData(t,n,r,o){return W2(t,n,r,o)}parseObjectData(t,n,r,o){const{iScale:i,vScale:s}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=i.axis==="x"?a:l,u=s.axis==="x"?a:l,d=[];let h,f,p,g;for(h=r,f=r+o;h<f;++h)g=n[h],p={},p[i.axis]=i.parse(bs(g,c),h),d.push(IT(bs(g,u),p,s,h));return d}updateRangeFromParsed(t,n,r,o){super.updateRangeFromParsed(t,n,r,o);const i=r._custom;i&&n===this._cachedMeta.vScale&&(t.min=Math.min(t.min,i.min),t.max=Math.max(t.max,i.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const n=this._cachedMeta,{iScale:r,vScale:o}=n,i=this.getParsed(t),s=i._custom,a=$0(s)?"["+s.start+", "+s.end+"]":""+o.getLabelForValue(i[o.axis]);return{label:""+r.getLabelForValue(i[r.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,t)}updateElements(t,n,r,o){const i=o==="reset",{index:s,_cachedMeta:{vScale:a}}=this,l=a.getBasePixel(),c=a.isHorizontal(),u=this._getRuler(),{sharedOptions:d,includeOptions:h}=this._getSharedOptions(n,o);for(let f=n;f<n+r;f++){const p=this.getParsed(f),g=i||ze(p[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),m=this._calculateBarIndexPixels(f,u),b=(p._stacks||{})[a.axis],v={horizontal:c,base:g.base,enableBorderRadius:!b||$0(p._custom)||s===b._top||s===b._bottom,x:c?g.head:m.center,y:c?m.center:g.head,height:c?m.size:Math.abs(g.size),width:c?Math.abs(g.size):m.size};h&&(v.options=d||this.resolveDataElementOptions(f,t[f].active?"active":o));const x=v.options||t[f].options;CG(v,x,b,s),EG(v,x,u.ratio),this.updateElement(t[f],f,v,o)}}_getStacks(t,n){const{iScale:r}=this._cachedMeta,o=r.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),i=r.options.stacked,s=[],a=this._cachedMeta.controller.getParsed(n),l=a&&a[r.axis],c=u=>{const d=u._parsed.find(f=>f[r.axis]===l),h=d&&d[u.vScale.axis];if(ze(h)||isNaN(h))return!0};for(const u of o)if(!(n!==void 0&&c(u))&&((i===!1||s.indexOf(u.stack)===-1||i===void 0&&u.stack===void 0)&&s.push(u.stack),u.index===t))break;return s.length||s.push(void 0),s}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,n,r){const o=this._getStacks(t,r),i=n!==void 0?o.indexOf(n):-1;return i===-1?o.length-1:i}_getRuler(){const t=this.options,n=this._cachedMeta,r=n.iScale,o=[];let i,s;for(i=0,s=n.data.length;i<s;++i)o.push(r.getPixelForValue(this.getParsed(i)[r.axis],i));const a=t.barThickness;return{min:a||bG(n),pixels:o,start:r._startPixel,end:r._endPixel,stackCount:this._getStackCount(),scale:r,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:n,_stacked:r,index:o},options:{base:i,minBarLength:s}}=this,a=i||0,l=this.getParsed(t),c=l._custom,u=$0(c);let d=l[n.axis],h=0,f=r?this.applyStack(n,l,r):d,p,g;f!==d&&(h=f-d,f=d),u&&(d=c.barStart,f=c.barEnd-c.barStart,d!==0&&$o(d)!==$o(c.barEnd)&&(h=0),h+=d);const m=!ze(i)&&!u?i:h;let b=n.getPixelForValue(m);if(this.chart.getDataVisibility(t)?p=n.getPixelForValue(h+f):p=b,g=p-b,Math.abs(g)<s){g=wG(g,n,a)*s,d===a&&(b-=g/2);const v=n.getPixelForDecimal(0),x=n.getPixelForDecimal(1),w=Math.min(v,x),C=Math.max(v,x);b=Math.max(Math.min(b,C),w),p=b+g,r&&!u&&(l._stacks[n.axis]._visualValues[o]=n.getValueForPixel(p)-n.getValueForPixel(b))}if(b===n.getPixelForValue(a)){const v=$o(g)*n.getLineWidthForValue(a)/2;b+=v,g-=v}return{size:g,base:b,head:p,center:p+g/2}}_calculateBarIndexPixels(t,n){const r=n.scale,o=this.options,i=o.skipNull,s=Ae(o.maxBarThickness,1/0);let a,l;if(n.grouped){const c=i?this._getStackCount(t):n.stackCount,u=o.barThickness==="flex"?vG(t,n,o,c):yG(t,n,o,c),d=this._getStackIndex(this.index,this._cachedMeta.stack,i?t:void 0);a=u.start+u.chunk*d+u.chunk/2,l=Math.min(s,u.chunk*u.ratio)}else a=r.getPixelForValue(this.getParsed(t)[r.axis],t),l=Math.min(s,n.min*n.ratio);return{base:a-l/2,head:a+l/2,center:a,size:l}}draw(){const t=this._cachedMeta,n=t.vScale,r=t.data,o=r.length;let i=0;for(;i<o;++i)this.getParsed(i)[n.axis]!==null&&!r[i].hidden&&r[i].draw(this._ctx)}}pe(Ma,"id","bar"),pe(Ma,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),pe(Ma,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});class kp extends Kr{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,n,r,o){const i=super.parsePrimitiveData(t,n,r,o);for(let s=0;s<i.length;s++)i[s]._custom=this.resolveDataElementOptions(s+r).radius;return i}parseArrayData(t,n,r,o){const i=super.parseArrayData(t,n,r,o);for(let s=0;s<i.length;s++){const a=n[r+s];i[s]._custom=Ae(a[2],this.resolveDataElementOptions(s+r).radius)}return i}parseObjectData(t,n,r,o){const i=super.parseObjectData(t,n,r,o);for(let s=0;s<i.length;s++){const a=n[r+s];i[s]._custom=Ae(a&&a.r&&+a.r,this.resolveDataElementOptions(s+r).radius)}return i}getMaxOverflow(){const t=this._cachedMeta.data;let n=0;for(let r=t.length-1;r>=0;--r)n=Math.max(n,t[r].size(this.resolveDataElementOptions(r))/2);return n>0&&n}getLabelAndValue(t){const n=this._cachedMeta,r=this.chart.data.labels||[],{xScale:o,yScale:i}=n,s=this.getParsed(t),a=o.getLabelForValue(s.x),l=i.getLabelForValue(s.y),c=s._custom;return{label:r[t]||"",value:"("+a+", "+l+(c?", "+c:"")+")"}}update(t){const n=this._cachedMeta.data;this.updateElements(n,0,n.length,t)}updateElements(t,n,r,o){const i=o==="reset",{iScale:s,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(n,o),u=s.axis,d=a.axis;for(let h=n;h<n+r;h++){const f=t[h],p=!i&&this.getParsed(h),g={},m=g[u]=i?s.getPixelForDecimal(.5):s.getPixelForValue(p[u]),b=g[d]=i?a.getBasePixel():a.getPixelForValue(p[d]);g.skip=isNaN(m)||isNaN(b),c&&(g.options=l||this.resolveDataElementOptions(h,f.active?"active":o),i&&(g.options.radius=0)),this.updateElement(f,h,g,o)}}resolveDataElementOptions(t,n){const r=this.getParsed(t);let o=super.resolveDataElementOptions(t,n);o.$shared&&(o=Object.assign({},o,{$shared:!1}));const i=o.radius;return n!=="active"&&(o.radius=0),o.radius+=Ae(r&&r._custom,i),o}}pe(kp,"id","bubble"),pe(kp,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),pe(kp,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});function RG(e,t,n){let r=1,o=1,i=0,s=0;if(t<$t){const a=e,l=a+t,c=Math.cos(a),u=Math.sin(a),d=Math.cos(l),h=Math.sin(l),f=(x,w,C)=>Td(x,a,l,!0)?1:Math.max(w,w*n,C,C*n),p=(x,w,C)=>Td(x,a,l,!0)?-1:Math.min(w,w*n,C,C*n),g=f(0,c,d),m=f(en,u,h),b=p(Bt,c,d),v=p(Bt+en,u,h);r=(g-b)/2,o=(m-v)/2,i=-(g+b)/2,s=-(m+v)/2}return{ratioX:r,ratioY:o,offsetX:i,offsetY:s}}class ca extends Kr{constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){const r=this.getDataset().data,o=this._cachedMeta;if(this._parsing===!1)o._parsed=r;else{let i=l=>+r[l];if(tt(r[t])){const{key:l="value"}=this._parsing;i=c=>+bs(r[c],l)}let s,a;for(s=t,a=t+n;s<a;++s)o._parsed[s]=i(s)}}_getRotation(){return co(this.options.rotation-90)}_getCircumference(){return co(this.options.circumference)}_getRotationExtents(){let t=$t,n=-$t;for(let r=0;r<this.chart.data.datasets.length;++r)if(this.chart.isDatasetVisible(r)&&this.chart.getDatasetMeta(r).type===this._type){const o=this.chart.getDatasetMeta(r).controller,i=o._getRotation(),s=o._getCircumference();t=Math.min(t,i),n=Math.max(n,i+s)}return{rotation:t,circumference:n-t}}update(t){const n=this.chart,{chartArea:r}=n,o=this._cachedMeta,i=o.data,s=this.getMaxBorderWidth()+this.getMaxOffset(i)+this.options.spacing,a=Math.max((Math.min(r.width,r.height)-s)/2,0),l=Math.min($U(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:u,rotation:d}=this._getRotationExtents(),{ratioX:h,ratioY:f,offsetX:p,offsetY:g}=RG(d,u,l),m=(r.width-s)/h,b=(r.height-s)/f,v=Math.max(Math.min(m,b)/2,0),x=lT(this.options.radius,v),w=Math.max(x*l,0),C=(x-w)/this._getVisibleDatasetWeightTotal();this.offsetX=p*x,this.offsetY=g*x,o.total=this.calculateTotal(),this.outerRadius=x-C*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-C*c,0),this.updateElements(i,0,i.length,t)}_circumference(t,n){const r=this.options,o=this._cachedMeta,i=this._getCircumference();return n&&r.animation.animateRotate||!this.chart.getDataVisibility(t)||o._parsed[t]===null||o.data[t].hidden?0:this.calculateCircumference(o._parsed[t]*i/$t)}updateElements(t,n,r,o){const i=o==="reset",s=this.chart,a=s.chartArea,c=s.options.animation,u=(a.left+a.right)/2,d=(a.top+a.bottom)/2,h=i&&c.animateScale,f=h?0:this.innerRadius,p=h?0:this.outerRadius,{sharedOptions:g,includeOptions:m}=this._getSharedOptions(n,o);let b=this._getRotation(),v;for(v=0;v<n;++v)b+=this._circumference(v,i);for(v=n;v<n+r;++v){const x=this._circumference(v,i),w=t[v],C={x:u+this.offsetX,y:d+this.offsetY,startAngle:b,endAngle:b+x,circumference:x,outerRadius:p,innerRadius:f};m&&(C.options=g||this.resolveDataElementOptions(v,w.active?"active":o)),b+=x,this.updateElement(w,v,C,o)}}calculateTotal(){const t=this._cachedMeta,n=t.data;let r=0,o;for(o=0;o<n.length;o++){const i=t._parsed[o];i!==null&&!isNaN(i)&&this.chart.getDataVisibility(o)&&!n[o].hidden&&(r+=Math.abs(i))}return r}calculateCircumference(t){const n=this._cachedMeta.total;return n>0&&!isNaN(t)?$t*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,r=this.chart,o=r.data.labels||[],i=Pf(n._parsed[t],r.options.locale);return{label:o[t]||"",value:i}}getMaxBorderWidth(t){let n=0;const r=this.chart;let o,i,s,a,l;if(!t){for(o=0,i=r.data.datasets.length;o<i;++o)if(r.isDatasetVisible(o)){s=r.getDatasetMeta(o),t=s.data,a=s.controller;break}}if(!t)return 0;for(o=0,i=t.length;o<i;++o)l=a.resolveDataElementOptions(o),l.borderAlign!=="inner"&&(n=Math.max(n,l.borderWidth||0,l.hoverBorderWidth||0));return n}getMaxOffset(t){let n=0;for(let r=0,o=t.length;r<o;++r){const i=this.resolveDataElementOptions(r);n=Math.max(n,i.offset||0,i.hoverOffset||0)}return n}_getRingWeightOffset(t){let n=0;for(let r=0;r<t;++r)this.chart.isDatasetVisible(r)&&(n+=this._getRingWeight(r));return n}_getRingWeight(t){return Math.max(Ae(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}pe(ca,"id","doughnut"),pe(ca,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),pe(ca,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),pe(ca,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data;if(n.labels.length&&n.datasets.length){const{labels:{pointStyle:r,color:o}}=t.legend.options;return n.labels.map((i,s)=>{const l=t.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:o,lineWidth:l.borderWidth,pointStyle:r,hidden:!t.getDataVisibility(s),index:s}})}return[]}},onClick(t,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}}});class Pp extends Kr{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:r,data:o=[],_dataset:i}=n,s=this.chart._animationsDisabled;let{start:a,count:l}=mT(n,o,s);this._drawStart=a,this._drawCount=l,bT(n)&&(a=0,l=o.length),r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!i._decimated,r.points=o;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(r,void 0,{animated:!s,options:c},t),this.updateElements(o,a,l,t)}updateElements(t,n,r,o){const i=o==="reset",{iScale:s,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:d}=this._getSharedOptions(n,o),h=s.axis,f=a.axis,{spanGaps:p,segment:g}=this.options,m=kc(p)?p:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||i||o==="none",v=n+r,x=t.length;let w=n>0&&this.getParsed(n-1);for(let C=0;C<x;++C){const S=t[C],E=b?S:{};if(C<n||C>=v){E.skip=!0;continue}const P=this.getParsed(C),M=ze(P[f]),D=E[h]=s.getPixelForValue(P[h],C),A=E[f]=i||M?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,P,l):P[f],C);E.skip=isNaN(D)||isNaN(A)||M,E.stop=C>0&&Math.abs(P[h]-w[h])>m,g&&(E.parsed=P,E.raw=c.data[C]),d&&(E.options=u||this.resolveDataElementOptions(C,S.active?"active":o)),b||this.updateElement(S,C,E,o),w=P}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,r=n.options&&n.options.borderWidth||0,o=t.data||[];if(!o.length)return r;const i=o[0].size(this.resolveDataElementOptions(0)),s=o[o.length-1].size(this.resolveDataElementOptions(o.length-1));return Math.max(r,i,s)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}pe(Pp,"id","line"),pe(Pp,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),pe(Pp,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class id extends Kr{constructor(t,n){super(t,n),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const n=this._cachedMeta,r=this.chart,o=r.data.labels||[],i=Pf(n._parsed[t].r,r.options.locale);return{label:o[t]||"",value:i}}parseObjectData(t,n,r,o){return ET.bind(this)(t,n,r,o)}update(t){const n=this._cachedMeta.data;this._updateRadius(),this.updateElements(n,0,n.length,t)}getMinMax(){const t=this._cachedMeta,n={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((r,o)=>{const i=this.getParsed(o).r;!isNaN(i)&&this.chart.getDataVisibility(o)&&(i<n.min&&(n.min=i),i>n.max&&(n.max=i))}),n}_updateRadius(){const t=this.chart,n=t.chartArea,r=t.options,o=Math.min(n.right-n.left,n.bottom-n.top),i=Math.max(o/2,0),s=Math.max(r.cutoutPercentage?i/100*r.cutoutPercentage:1,0),a=(i-s)/t.getVisibleDatasetCount();this.outerRadius=i-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,n,r,o){const i=o==="reset",s=this.chart,l=s.options.animation,c=this._cachedMeta.rScale,u=c.xCenter,d=c.yCenter,h=c.getIndexAngle(0)-.5*Bt;let f=h,p;const g=360/this.countVisibleElements();for(p=0;p<n;++p)f+=this._computeAngle(p,o,g);for(p=n;p<n+r;p++){const m=t[p];let b=f,v=f+this._computeAngle(p,o,g),x=s.getDataVisibility(p)?c.getDistanceFromCenterForValue(this.getParsed(p).r):0;f=v,i&&(l.animateScale&&(x=0),l.animateRotate&&(b=v=h));const w={x:u,y:d,innerRadius:0,outerRadius:x,startAngle:b,endAngle:v,options:this.resolveDataElementOptions(p,m.active?"active":o)};this.updateElement(m,p,w,o)}}countVisibleElements(){const t=this._cachedMeta;let n=0;return t.data.forEach((r,o)=>{!isNaN(this.getParsed(o).r)&&this.chart.getDataVisibility(o)&&n++}),n}_computeAngle(t,n,r){return this.chart.getDataVisibility(t)?co(this.resolveDataElementOptions(t,n).angle||r):0}}pe(id,"id","polarArea"),pe(id,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),pe(id,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data;if(n.labels.length&&n.datasets.length){const{labels:{pointStyle:r,color:o}}=t.legend.options;return n.labels.map((i,s)=>{const l=t.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:o,lineWidth:l.borderWidth,pointStyle:r,hidden:!t.getDataVisibility(s),index:s}})}return[]}},onClick(t,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});class dx extends ca{}pe(dx,"id","pie"),pe(dx,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});class Mp extends Kr{getLabelAndValue(t){const n=this._cachedMeta.vScale,r=this.getParsed(t);return{label:n.getLabels()[t],value:""+n.getLabelForValue(r[n.axis])}}parseObjectData(t,n,r,o){return ET.bind(this)(t,n,r,o)}update(t){const n=this._cachedMeta,r=n.dataset,o=n.data||[],i=n.iScale.getLabels();if(r.points=o,t!=="resize"){const s=this.resolveDatasetElementOptions(t);this.options.showLine||(s.borderWidth=0);const a={_loop:!0,_fullLoop:i.length===o.length,options:s};this.updateElement(r,void 0,a,t)}this.updateElements(o,0,o.length,t)}updateElements(t,n,r,o){const i=this._cachedMeta.rScale,s=o==="reset";for(let a=n;a<n+r;a++){const l=t[a],c=this.resolveDataElementOptions(a,l.active?"active":o),u=i.getPointPositionForValue(a,this.getParsed(a).r),d=s?i.xCenter:u.x,h=s?i.yCenter:u.y,f={x:d,y:h,angle:u.angle,skip:isNaN(d)||isNaN(h),options:c};this.updateElement(l,a,f,o)}}}pe(Mp,"id","radar"),pe(Mp,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),pe(Mp,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});class Dp extends Kr{getLabelAndValue(t){const n=this._cachedMeta,r=this.chart.data.labels||[],{xScale:o,yScale:i}=n,s=this.getParsed(t),a=o.getLabelForValue(s.x),l=i.getLabelForValue(s.y);return{label:r[t]||"",value:"("+a+", "+l+")"}}update(t){const n=this._cachedMeta,{data:r=[]}=n,o=this.chart._animationsDisabled;let{start:i,count:s}=mT(n,r,o);if(this._drawStart=i,this._drawCount=s,bT(n)&&(i=0,s=r.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:a,_dataset:l}=n;a._chart=this.chart,a._datasetIndex=this.index,a._decimated=!!l._decimated,a.points=r;const c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(a,void 0,{animated:!o,options:c},t)}else this.datasetElementType&&(delete n.dataset,this.datasetElementType=!1);this.updateElements(r,i,s,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,n,r,o){const i=o==="reset",{iScale:s,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,u=this.resolveDataElementOptions(n,o),d=this.getSharedOptions(u),h=this.includeOptions(o,d),f=s.axis,p=a.axis,{spanGaps:g,segment:m}=this.options,b=kc(g)?g:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||i||o==="none";let x=n>0&&this.getParsed(n-1);for(let w=n;w<n+r;++w){const C=t[w],S=this.getParsed(w),E=v?C:{},P=ze(S[p]),M=E[f]=s.getPixelForValue(S[f],w),D=E[p]=i||P?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,S,l):S[p],w);E.skip=isNaN(M)||isNaN(D)||P,E.stop=w>0&&Math.abs(S[f]-x[f])>b,m&&(E.parsed=S,E.raw=c.data[w]),h&&(E.options=d||this.resolveDataElementOptions(w,C.active?"active":o)),v||this.updateElement(C,w,E,o),x=S}this.updateSharedOptions(d,o,u)}getMaxOverflow(){const t=this._cachedMeta,n=t.data||[];if(!this.options.showLine){let a=0;for(let l=n.length-1;l>=0;--l)a=Math.max(a,n[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const r=t.dataset,o=r.options&&r.options.borderWidth||0;if(!n.length)return o;const i=n[0].size(this.resolveDataElementOptions(0)),s=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(o,i,s)/2}}pe(Dp,"id","scatter"),pe(Dp,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),pe(Dp,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});var kG=Object.freeze({__proto__:null,BarController:Ma,BubbleController:kp,DoughnutController:ca,LineController:Pp,PieController:dx,PolarAreaController:id,RadarController:Mp,ScatterController:Dp});function Gs(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class mS{constructor(t){pe(this,"options");this.options=t||{}}static override(t){Object.assign(mS.prototype,t)}init(){}formats(){return Gs()}parse(){return Gs()}format(){return Gs()}add(){return Gs()}diff(){return Gs()}startOf(){return Gs()}endOf(){return Gs()}}var PG={_date:mS};function MG(e,t,n,r){const{controller:o,data:i,_sorted:s}=e,a=o._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&s&&i.length){const c=a._reversePixels?ZU:Pi;if(r){if(o._sharedOptions){const u=i[0],d=typeof u.getRange=="function"&&u.getRange(t);if(d){const h=c(i,t,n-d),f=c(i,t,n+d);return{lo:h.lo,hi:f.hi}}}}else{const u=c(i,t,n);if(l){const{vScale:d}=o._cachedMeta,{_parsed:h}=e,f=h.slice(0,u.lo+1).reverse().findIndex(g=>!ze(g[d.axis]));u.lo-=Math.max(0,f);const p=h.slice(u.hi).findIndex(g=>!ze(g[d.axis]));u.hi+=Math.max(0,p)}return u}}return{lo:0,hi:i.length-1}}function $m(e,t,n,r,o){const i=e.getSortedVisibleDatasetMetas(),s=n[t];for(let a=0,l=i.length;a<l;++a){const{index:c,data:u}=i[a],{lo:d,hi:h}=MG(i[a],t,s,o);for(let f=d;f<=h;++f){const p=u[f];p.skip||r(p,c,f)}}}function DG(e){const t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(r,o){const i=t?Math.abs(r.x-o.x):0,s=n?Math.abs(r.y-o.y):0;return Math.sqrt(Math.pow(i,2)+Math.pow(s,2))}}function z0(e,t,n,r,o){const i=[];return!o&&!e.isPointInArea(t)||$m(e,n,t,function(a,l,c){!o&&!Mi(a,e.chartArea,0)||a.inRange(t.x,t.y,r)&&i.push({element:a,datasetIndex:l,index:c})},!0),i}function OG(e,t,n,r){let o=[];function i(s,a,l){const{startAngle:c,endAngle:u}=s.getProps(["startAngle","endAngle"],r),{angle:d}=dT(s,{x:t.x,y:t.y});Td(d,c,u)&&o.push({element:s,datasetIndex:a,index:l})}return $m(e,n,t,i),o}function AG(e,t,n,r,o,i){let s=[];const a=DG(n);let l=Number.POSITIVE_INFINITY;function c(u,d,h){const f=u.inRange(t.x,t.y,o);if(r&&!f)return;const p=u.getCenterPoint(o);if(!(!!i||e.isPointInArea(p))&&!f)return;const m=a(t,p);m<l?(s=[{element:u,datasetIndex:d,index:h}],l=m):m===l&&s.push({element:u,datasetIndex:d,index:h})}return $m(e,n,t,c),s}function B0(e,t,n,r,o,i){return!i&&!e.isPointInArea(t)?[]:n==="r"&&!r?OG(e,t,n,o):AG(e,t,n,r,o,i)}function G2(e,t,n,r,o){const i=[],s=n==="x"?"inXRange":"inYRange";let a=!1;return $m(e,n,t,(l,c,u)=>{l[s]&&l[s](t[n],o)&&(i.push({element:l,datasetIndex:c,index:u}),a=a||l.inRange(t.x,t.y,o))}),r&&!a?[]:i}var TG={modes:{index(e,t,n,r){const o=Zs(t,e),i=n.axis||"x",s=n.includeInvisible||!1,a=n.intersect?z0(e,o,i,r,s):B0(e,o,i,!1,r,s),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const u=a[0].index,d=c.data[u];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:u})}),l):[]},dataset(e,t,n,r){const o=Zs(t,e),i=n.axis||"xy",s=n.includeInvisible||!1;let a=n.intersect?z0(e,o,i,r,s):B0(e,o,i,!1,r,s);if(a.length>0){const l=a[0].datasetIndex,c=e.getDatasetMeta(l).data;a=[];for(let u=0;u<c.length;++u)a.push({element:c[u],datasetIndex:l,index:u})}return a},point(e,t,n,r){const o=Zs(t,e),i=n.axis||"xy",s=n.includeInvisible||!1;return z0(e,o,i,r,s)},nearest(e,t,n,r){const o=Zs(t,e),i=n.axis||"xy",s=n.includeInvisible||!1;return B0(e,o,i,n.intersect,r,s)},x(e,t,n,r){const o=Zs(t,e);return G2(e,o,"x",n.intersect,r)},y(e,t,n,r){const o=Zs(t,e);return G2(e,o,"y",n.intersect,r)}}};const NT=["left","top","right","bottom"];function Eu(e,t){return e.filter(n=>n.pos===t)}function Y2(e,t){return e.filter(n=>NT.indexOf(n.pos)===-1&&n.box.axis===t)}function Ru(e,t){return e.sort((n,r)=>{const o=t?r:n,i=t?n:r;return o.weight===i.weight?o.index-i.index:o.weight-i.weight})}function IG(e){const t=[];let n,r,o,i,s,a;for(n=0,r=(e||[]).length;n<r;++n)o=e[n],{position:i,options:{stack:s,stackWeight:a=1}}=o,t.push({index:n,box:o,pos:i,horizontal:o.isHorizontal(),weight:o.weight,stack:s&&i+s,stackWeight:a});return t}function NG(e){const t={};for(const n of e){const{stack:r,pos:o,stackWeight:i}=n;if(!r||!NT.includes(o))continue;const s=t[r]||(t[r]={count:0,placed:0,weight:0,size:0});s.count++,s.weight+=i}return t}function FG(e,t){const n=NG(e),{vBoxMaxWidth:r,hBoxMaxHeight:o}=t;let i,s,a;for(i=0,s=e.length;i<s;++i){a=e[i];const{fullSize:l}=a.box,c=n[a.stack],u=c&&a.stackWeight/c.weight;a.horizontal?(a.width=u?u*r:l&&t.availableWidth,a.height=o):(a.width=r,a.height=u?u*o:l&&t.availableHeight)}return n}function LG(e){const t=IG(e),n=Ru(t.filter(c=>c.box.fullSize),!0),r=Ru(Eu(t,"left"),!0),o=Ru(Eu(t,"right")),i=Ru(Eu(t,"top"),!0),s=Ru(Eu(t,"bottom")),a=Y2(t,"x"),l=Y2(t,"y");return{fullSize:n,leftAndTop:r.concat(i),rightAndBottom:o.concat(l).concat(s).concat(a),chartArea:Eu(t,"chartArea"),vertical:r.concat(o).concat(l),horizontal:i.concat(s).concat(a)}}function K2(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function FT(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function jG(e,t,n,r){const{pos:o,box:i}=n,s=e.maxPadding;if(!tt(o)){n.size&&(e[o]-=n.size);const d=r[n.stack]||{size:0,count:1};d.size=Math.max(d.size,n.horizontal?i.height:i.width),n.size=d.size/d.count,e[o]+=n.size}i.getPadding&&FT(s,i.getPadding());const a=Math.max(0,t.outerWidth-K2(s,e,"left","right")),l=Math.max(0,t.outerHeight-K2(s,e,"top","bottom")),c=a!==e.w,u=l!==e.h;return e.w=a,e.h=l,n.horizontal?{same:c,other:u}:{same:u,other:c}}function $G(e){const t=e.maxPadding;function n(r){const o=Math.max(t[r]-e[r],0);return e[r]+=o,o}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function zG(e,t){const n=t.maxPadding;function r(o){const i={left:0,top:0,right:0,bottom:0};return o.forEach(s=>{i[s]=Math.max(t[s],n[s])}),i}return r(e?["left","right"]:["top","bottom"])}function Hu(e,t,n,r){const o=[];let i,s,a,l,c,u;for(i=0,s=e.length,c=0;i<s;++i){a=e[i],l=a.box,l.update(a.width||t.w,a.height||t.h,zG(a.horizontal,t));const{same:d,other:h}=jG(t,n,a,r);c|=d&&o.length,u=u||h,l.fullSize||o.push(a)}return c&&Hu(o,t,n,r)||u}function Dh(e,t,n,r,o){e.top=n,e.left=t,e.right=t+r,e.bottom=n+o,e.width=r,e.height=o}function X2(e,t,n,r){const o=n.padding;let{x:i,y:s}=t;for(const a of e){const l=a.box,c=r[a.stack]||{placed:0,weight:1},u=a.stackWeight/c.weight||1;if(a.horizontal){const d=t.w*u,h=c.size||l.height;Ad(c.start)&&(s=c.start),l.fullSize?Dh(l,o.left,s,n.outerWidth-o.right-o.left,h):Dh(l,t.left+c.placed,s,d,h),c.start=s,c.placed+=d,s=l.bottom}else{const d=t.h*u,h=c.size||l.width;Ad(c.start)&&(i=c.start),l.fullSize?Dh(l,i,o.top,h,n.outerHeight-o.bottom-o.top):Dh(l,i,t.top+c.placed,h,d),c.start=i,c.placed+=d,i=l.right}}t.x=i,t.y=s}var Bn={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,r){if(!e)return;const o=On(e.options.layout.padding),i=Math.max(t-o.width,0),s=Math.max(n-o.height,0),a=LG(e.boxes),l=a.vertical,c=a.horizontal;yt(e.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});const u=l.reduce((g,m)=>m.box.options&&m.box.options.display===!1?g:g+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:n,padding:o,availableWidth:i,availableHeight:s,vBoxMaxWidth:i/2/u,hBoxMaxHeight:s/2}),h=Object.assign({},o);FT(h,On(r));const f=Object.assign({maxPadding:h,w:i,h:s,x:o.left,y:o.top},o),p=FG(l.concat(c),d);Hu(a.fullSize,f,d,p),Hu(l,f,d,p),Hu(c,f,d,p)&&Hu(l,f,d,p),$G(f),X2(a.leftAndTop,f,d,p),f.x+=f.w,f.y+=f.h,X2(a.rightAndBottom,f,d,p),e.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},yt(a.chartArea,g=>{const m=g.box;Object.assign(m,e.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class LT{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,r){}removeEventListener(t,n,r){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,r,o){return n=Math.max(0,n||t.width),r=r||t.height,{width:n,height:Math.max(0,o?Math.floor(n/o):r)}}isAttached(t){return!0}updateConfig(t){}}class BG extends LT{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Op="$chartjs",VG={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Q2=e=>e===null||e==="";function HG(e,t){const n=e.style,r=e.getAttribute("height"),o=e.getAttribute("width");if(e[Op]={initial:{height:r,width:o,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Q2(o)){const i=I2(e,"width");i!==void 0&&(e.width=i)}if(Q2(r))if(e.style.height==="")e.height=e.width/(t||2);else{const i=I2(e,"height");i!==void 0&&(e.height=i)}return e}const jT=Uq?{passive:!0}:!1;function WG(e,t,n){e&&e.addEventListener(t,n,jT)}function UG(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,jT)}function qG(e,t){const n=VG[e.type]||e.type,{x:r,y:o}=Zs(e,t);return{type:n,chart:t,native:e,x:r!==void 0?r:null,y:o!==void 0?o:null}}function cg(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function GG(e,t,n){const r=e.canvas,o=new MutationObserver(i=>{let s=!1;for(const a of i)s=s||cg(a.addedNodes,r),s=s&&!cg(a.removedNodes,r);s&&n()});return o.observe(document,{childList:!0,subtree:!0}),o}function YG(e,t,n){const r=e.canvas,o=new MutationObserver(i=>{let s=!1;for(const a of i)s=s||cg(a.removedNodes,r),s=s&&!cg(a.addedNodes,r);s&&n()});return o.observe(document,{childList:!0,subtree:!0}),o}const Nd=new Map;let Z2=0;function $T(){const e=window.devicePixelRatio;e!==Z2&&(Z2=e,Nd.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function KG(e,t){Nd.size||window.addEventListener("resize",$T),Nd.set(e,t)}function XG(e){Nd.delete(e),Nd.size||window.removeEventListener("resize",$T)}function QG(e,t,n){const r=e.canvas,o=r&&gS(r);if(!o)return;const i=gT((a,l)=>{const c=o.clientWidth;n(a,l),c<o.clientWidth&&n()},window),s=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||i(c,u)});return s.observe(o),KG(e,i),s}function V0(e,t,n){n&&n.disconnect(),t==="resize"&&XG(e)}function ZG(e,t,n){const r=e.canvas,o=gT(i=>{e.ctx!==null&&n(qG(i,e))},e);return WG(r,t,o),o}class JG extends LT{acquireContext(t,n){const r=t&&t.getContext&&t.getContext("2d");return r&&r.canvas===t?(HG(t,n),r):null}releaseContext(t){const n=t.canvas;if(!n[Op])return!1;const r=n[Op].initial;["height","width"].forEach(i=>{const s=r[i];ze(s)?n.removeAttribute(i):n.setAttribute(i,s)});const o=r.style||{};return Object.keys(o).forEach(i=>{n.style[i]=o[i]}),n.width=n.width,delete n[Op],!0}addEventListener(t,n,r){this.removeEventListener(t,n);const o=t.$proxies||(t.$proxies={}),s={attach:GG,detach:YG,resize:QG}[n]||ZG;o[n]=s(t,n,r)}removeEventListener(t,n){const r=t.$proxies||(t.$proxies={}),o=r[n];if(!o)return;({attach:V0,detach:V0,resize:V0}[n]||UG)(t,n,o),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,r,o){return Wq(t,n,r,o)}isAttached(t){const n=t&&gS(t);return!!(n&&n.isConnected)}}function eY(e){return!pS()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?BG:JG}var Rp;let ri=(Rp=class{constructor(){pe(this,"x");pe(this,"y");pe(this,"active",!1);pe(this,"options");pe(this,"$animations")}tooltipPosition(t){const{x:n,y:r}=this.getProps(["x","y"],t);return{x:n,y:r}}hasValue(){return kc(this.x)&&kc(this.y)}getProps(t,n){const r=this.$animations;if(!n||!r)return this;const o={};return t.forEach(i=>{o[i]=r[i]&&r[i].active()?r[i]._to:this[i]}),o}},pe(Rp,"defaults",{}),pe(Rp,"defaultRoutes"),Rp);function tY(e,t){const n=e.options.ticks,r=nY(e),o=Math.min(n.maxTicksLimit||r,r),i=n.major.enabled?oY(t):[],s=i.length,a=i[0],l=i[s-1],c=[];if(s>o)return iY(t,c,i,s/o),c;const u=rY(i,t,o);if(s>0){let d,h;const f=s>1?Math.round((l-a)/(s-1)):null;for(Oh(t,c,u,ze(f)?0:a-f,a),d=0,h=s-1;d<h;d++)Oh(t,c,u,i[d],i[d+1]);return Oh(t,c,u,l,ze(f)?t.length:l+f),c}return Oh(t,c,u),c}function nY(e){const t=e.options.offset,n=e._tickSize(),r=e._length/n+(t?0:1),o=e._maxLength/n;return Math.floor(Math.min(r,o))}function rY(e,t,n){const r=sY(e),o=t.length/n;if(!r)return Math.max(o,1);const i=GU(r);for(let s=0,a=i.length-1;s<a;s++){const l=i[s];if(l>o)return l}return Math.max(o,1)}function oY(e){const t=[];let n,r;for(n=0,r=e.length;n<r;n++)e[n].major&&t.push(n);return t}function iY(e,t,n,r){let o=0,i=n[0],s;for(r=Math.ceil(r),s=0;s<e.length;s++)s===i&&(t.push(e[s]),o++,i=n[o*r])}function Oh(e,t,n,r,o){const i=Ae(r,0),s=Math.min(Ae(o,e.length),e.length);let a=0,l,c,u;for(n=Math.ceil(n),o&&(l=o-r,n=l/Math.floor(l/n)),u=i;u<0;)a++,u=Math.round(i+a*n);for(c=Math.max(i,0);c<s;c++)c===u&&(t.push(e[c]),a++,u=Math.round(i+a*n))}function sY(e){const t=e.length;let n,r;if(t<2)return!1;for(r=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==r)return!1;return r}const aY=e=>e==="left"?"right":e==="right"?"left":e,J2=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,eR=(e,t)=>Math.min(t||e,e);function tR(e,t){const n=[],r=e.length/t,o=e.length;let i=0;for(;i<o;i+=r)n.push(e[Math.floor(i)]);return n}function lY(e,t,n){const r=e.ticks.length,o=Math.min(t,r-1),i=e._startPixel,s=e._endPixel,a=1e-6;let l=e.getPixelForTick(o),c;if(!(n&&(r===1?c=Math.max(l-i,s-l):t===0?c=(e.getPixelForTick(1)-l)/2:c=(l-e.getPixelForTick(o-1))/2,l+=o<t?c:-c,l<i-a||l>s+a)))return l}function cY(e,t){yt(e,n=>{const r=n.gc,o=r.length/2;let i;if(o>t){for(i=0;i<o;++i)delete n.data[r[i]];r.splice(0,o)}})}function ku(e){return e.drawTicks?e.tickLength:0}function nR(e,t){if(!e.display)return 0;const n=un(e.font,t),r=On(e.padding);return(jt(e.text)?e.text.length:1)*n.lineHeight+r.height}function uY(e,t){return Ds(e,{scale:t,type:"scale"})}function dY(e,t,n){return Ds(e,{tick:n,index:t,type:"tick"})}function fY(e,t,n){let r=lS(e);return(n&&t!=="right"||!n&&t==="right")&&(r=aY(r)),r}function hY(e,t,n,r){const{top:o,left:i,bottom:s,right:a,chart:l}=e,{chartArea:c,scales:u}=l;let d=0,h,f,p;const g=s-o,m=a-i;if(e.isHorizontal()){if(f=$n(r,i,a),tt(n)){const b=Object.keys(n)[0],v=n[b];p=u[b].getPixelForValue(v)+g-t}else n==="center"?p=(c.bottom+c.top)/2+g-t:p=J2(e,n,t);h=a-i}else{if(tt(n)){const b=Object.keys(n)[0],v=n[b];f=u[b].getPixelForValue(v)-m+t}else n==="center"?f=(c.left+c.right)/2-m+t:f=J2(e,n,t);p=$n(r,s,o),d=n==="left"?-en:en}return{titleX:f,titleY:p,maxWidth:h,rotation:d}}class Os extends ri{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:r,_suggestedMax:o}=this;return t=kr(t,Number.POSITIVE_INFINITY),n=kr(n,Number.NEGATIVE_INFINITY),r=kr(r,Number.POSITIVE_INFINITY),o=kr(o,Number.NEGATIVE_INFINITY),{min:kr(t,r),max:kr(n,o),minDefined:Qt(t),maxDefined:Qt(n)}}getMinMax(t){let{min:n,max:r,minDefined:o,maxDefined:i}=this.getUserBounds(),s;if(o&&i)return{min:n,max:r};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)s=a[l].controller.getMinMax(this,t),o||(n=Math.min(n,s.min)),i||(r=Math.max(r,s.max));return n=i&&n>r?r:n,r=o&&n>r?n:r,{min:kr(n,kr(r,n)),max:kr(r,kr(n,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){_t(this.options.beforeUpdate,[this])}update(t,n,r){const{beginAtZero:o,grace:i,ticks:s}=this.options,a=s.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=r=Object.assign({left:0,right:0,top:0,bottom:0},r),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+r.left+r.right:this.height+r.top+r.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Sq(this,i,o),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?tR(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),s.display&&(s.autoSkip||s.source==="auto")&&(this.ticks=tY(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,r;this.isHorizontal()?(n=this.left,r=this.right):(n=this.top,r=this.bottom,t=!t),this._startPixel=n,this._endPixel=r,this._reversePixels=t,this._length=r-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){_t(this.options.afterUpdate,[this])}beforeSetDimensions(){_t(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){_t(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),_t(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){_t(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const n=this.options.ticks;let r,o,i;for(r=0,o=t.length;r<o;r++)i=t[r],i.label=_t(n.callback,[i.value,r,t],this)}afterTickToLabelConversion(){_t(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){_t(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,r=eR(this.ticks.length,t.ticks.maxTicksLimit),o=n.minRotation||0,i=n.maxRotation;let s=o,a,l,c;if(!this._isVisible()||!n.display||o>=i||r<=1||!this.isHorizontal()){this.labelRotation=o;return}const u=this._getLabelSizes(),d=u.widest.width,h=u.highest.height,f=Sn(this.chart.width-d,0,this.maxWidth);a=t.offset?this.maxWidth/r:f/(r-1),d+6>a&&(a=f/(r-(t.offset?.5:1)),l=this.maxHeight-ku(t.grid)-n.padding-nR(t.title,this.chart.options.font),c=Math.sqrt(d*d+h*h),s=sS(Math.min(Math.asin(Sn((u.highest.height+6)/a,-1,1)),Math.asin(Sn(l/c,-1,1))-Math.asin(Sn(h/c,-1,1)))),s=Math.max(o,Math.min(i,s))),this.labelRotation=s}afterCalculateLabelRotation(){_t(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){_t(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:r,title:o,grid:i}}=this,s=this._isVisible(),a=this.isHorizontal();if(s){const l=nR(o,n.options.font);if(a?(t.width=this.maxWidth,t.height=ku(i)+l):(t.height=this.maxHeight,t.width=ku(i)+l),r.display&&this.ticks.length){const{first:c,last:u,widest:d,highest:h}=this._getLabelSizes(),f=r.padding*2,p=co(this.labelRotation),g=Math.cos(p),m=Math.sin(p);if(a){const b=r.mirror?0:m*d.width+g*h.height;t.height=Math.min(this.maxHeight,t.height+b+f)}else{const b=r.mirror?0:g*d.width+m*h.height;t.width=Math.min(this.maxWidth,t.width+b+f)}this._calculatePadding(c,u,m,g)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,r,o){const{ticks:{align:i,padding:s},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,f=0;l?c?(h=o*t.width,f=r*n.height):(h=r*t.height,f=o*n.width):i==="start"?f=n.width:i==="end"?h=t.width:i!=="inner"&&(h=t.width/2,f=n.width/2),this.paddingLeft=Math.max((h-u+s)*this.width/(this.width-u),0),this.paddingRight=Math.max((f-d+s)*this.width/(this.width-d),0)}else{let u=n.height/2,d=t.height/2;i==="start"?(u=0,d=t.height):i==="end"&&(u=n.height,d=0),this.paddingTop=u+s,this.paddingBottom=d+s}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){_t(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,r;for(n=0,r=t.length;n<r;n++)ze(t[n].label)&&(t.splice(n,1),r--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const n=this.options.ticks.sampleSize;let r=this.ticks;n<r.length&&(r=tR(r,n)),this._labelSizes=t=this._computeLabelSizes(r,r.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,r){const{ctx:o,_longestTextCache:i}=this,s=[],a=[],l=Math.floor(n/eR(n,r));let c=0,u=0,d,h,f,p,g,m,b,v,x,w,C;for(d=0;d<n;d+=l){if(p=t[d].label,g=this._resolveTickFontOptions(d),o.font=m=g.string,b=i[m]=i[m]||{data:{},gc:[]},v=g.lineHeight,x=w=0,!ze(p)&&!jt(p))x=sg(o,b.data,b.gc,x,p),w=v;else if(jt(p))for(h=0,f=p.length;h<f;++h)C=p[h],!ze(C)&&!jt(C)&&(x=sg(o,b.data,b.gc,x,C),w+=v);s.push(x),a.push(w),c=Math.max(x,c),u=Math.max(w,u)}cY(i,n);const S=s.indexOf(c),E=a.indexOf(u),P=M=>({width:s[M]||0,height:a[M]||0});return{first:P(0),last:P(n-1),widest:P(S),highest:P(E),widths:s,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return QU(this._alignToPixels?qs(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&t<n.length){const r=n[t];return r.$context||(r.$context=dY(this.getContext(),t,r))}return this.$context||(this.$context=uY(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=co(this.labelRotation),r=Math.abs(Math.cos(n)),o=Math.abs(Math.sin(n)),i=this._getLabelSizes(),s=t.autoSkipPadding||0,a=i?i.widest.width+s:0,l=i?i.highest.height+s:0;return this.isHorizontal()?l*r>a*o?a/r:l/o:l*o<a*r?l/r:a/o}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const n=this.axis,r=this.chart,o=this.options,{grid:i,position:s,border:a}=o,l=i.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),h=ku(i),f=[],p=a.setContext(this.getContext()),g=p.display?p.width:0,m=g/2,b=function(N){return qs(r,N,g)};let v,x,w,C,S,E,P,M,D,A,I,$;if(s==="top")v=b(this.bottom),E=this.bottom-h,M=v-m,A=b(t.top)+m,$=t.bottom;else if(s==="bottom")v=b(this.top),A=t.top,$=b(t.bottom)-m,E=v+m,M=this.top+h;else if(s==="left")v=b(this.right),S=this.right-h,P=v-m,D=b(t.left)+m,I=t.right;else if(s==="right")v=b(this.left),D=t.left,I=b(t.right)-m,S=v+m,P=this.left+h;else if(n==="x"){if(s==="center")v=b((t.top+t.bottom)/2+.5);else if(tt(s)){const N=Object.keys(s)[0],F=s[N];v=b(this.chart.scales[N].getPixelForValue(F))}A=t.top,$=t.bottom,E=v+m,M=E+h}else if(n==="y"){if(s==="center")v=b((t.left+t.right)/2);else if(tt(s)){const N=Object.keys(s)[0],F=s[N];v=b(this.chart.scales[N].getPixelForValue(F))}S=v-m,P=S-h,D=t.left,I=t.right}const j=Ae(o.ticks.maxTicksLimit,d),T=Math.max(1,Math.ceil(d/j));for(x=0;x<d;x+=T){const N=this.getContext(x),F=i.setContext(N),z=a.setContext(N),B=F.lineWidth,O=F.color,U=z.dash||[],L=z.dashOffset,k=F.tickWidth,H=F.tickColor,G=F.tickBorderDash||[],Y=F.tickBorderDashOffset;w=lY(this,x,l),w!==void 0&&(C=qs(r,w,B),c?S=P=D=I=C:E=M=A=$=C,f.push({tx1:S,ty1:E,tx2:P,ty2:M,x1:D,y1:A,x2:I,y2:$,width:B,color:O,borderDash:U,borderDashOffset:L,tickWidth:k,tickColor:H,tickBorderDash:G,tickBorderDashOffset:Y}))}return this._ticksLength=d,this._borderValue=v,f}_computeLabelItems(t){const n=this.axis,r=this.options,{position:o,ticks:i}=r,s=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:u,mirror:d}=i,h=ku(r.grid),f=h+u,p=d?-u:f,g=-co(this.labelRotation),m=[];let b,v,x,w,C,S,E,P,M,D,A,I,$="middle";if(o==="top")S=this.bottom-p,E=this._getXAxisLabelAlignment();else if(o==="bottom")S=this.top+p,E=this._getXAxisLabelAlignment();else if(o==="left"){const T=this._getYAxisLabelAlignment(h);E=T.textAlign,C=T.x}else if(o==="right"){const T=this._getYAxisLabelAlignment(h);E=T.textAlign,C=T.x}else if(n==="x"){if(o==="center")S=(t.top+t.bottom)/2+f;else if(tt(o)){const T=Object.keys(o)[0],N=o[T];S=this.chart.scales[T].getPixelForValue(N)+f}E=this._getXAxisLabelAlignment()}else if(n==="y"){if(o==="center")C=(t.left+t.right)/2-f;else if(tt(o)){const T=Object.keys(o)[0],N=o[T];C=this.chart.scales[T].getPixelForValue(N)}E=this._getYAxisLabelAlignment(h).textAlign}n==="y"&&(l==="start"?$="top":l==="end"&&($="bottom"));const j=this._getLabelSizes();for(b=0,v=a.length;b<v;++b){x=a[b],w=x.label;const T=i.setContext(this.getContext(b));P=this.getPixelForTick(b)+i.labelOffset,M=this._resolveTickFontOptions(b),D=M.lineHeight,A=jt(w)?w.length:1;const N=A/2,F=T.color,z=T.textStrokeColor,B=T.textStrokeWidth;let O=E;s?(C=P,E==="inner"&&(b===v-1?O=this.options.reverse?"left":"right":b===0?O=this.options.reverse?"right":"left":O="center"),o==="top"?c==="near"||g!==0?I=-A*D+D/2:c==="center"?I=-j.highest.height/2-N*D+D:I=-j.highest.height+D/2:c==="near"||g!==0?I=D/2:c==="center"?I=j.highest.height/2-N*D:I=j.highest.height-A*D,d&&(I*=-1),g!==0&&!T.showLabelBackdrop&&(C+=D/2*Math.sin(g))):(S=P,I=(1-A)*D/2);let U;if(T.showLabelBackdrop){const L=On(T.backdropPadding),k=j.heights[b],H=j.widths[b];let G=I-L.top,Y=0-L.left;switch($){case"middle":G-=k/2;break;case"bottom":G-=k;break}switch(E){case"center":Y-=H/2;break;case"right":Y-=H;break;case"inner":b===v-1?Y-=H:b>0&&(Y-=H/2);break}U={left:Y,top:G,width:H+L.width,height:k+L.height,color:T.backdropColor}}m.push({label:w,font:M,textOffset:I,options:{rotation:g,color:F,strokeColor:z,strokeWidth:B,textAlign:O,textBaseline:$,translation:[C,S],backdrop:U}})}return m}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-co(this.labelRotation))return t==="top"?"left":"right";let o="center";return n.align==="start"?o="left":n.align==="end"?o="right":n.align==="inner"&&(o="inner"),o}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:r,mirror:o,padding:i}}=this.options,s=this._getLabelSizes(),a=t+i,l=s.widest.width;let c,u;return n==="left"?o?(u=this.right+i,r==="near"?c="left":r==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-a,r==="near"?c="right":r==="center"?(c="center",u-=l/2):(c="left",u=this.left)):n==="right"?o?(u=this.left+i,r==="near"?c="right":r==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+a,r==="near"?c="left":r==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:r,top:o,width:i,height:s}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(r,o,i,s),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const o=this.ticks.findIndex(i=>i.value===t);return o>=0?n.setContext(this.getContext(o)).lineWidth:0}drawGrid(t){const n=this.options.grid,r=this.ctx,o=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let i,s;const a=(l,c,u)=>{!u.width||!u.color||(r.save(),r.lineWidth=u.width,r.strokeStyle=u.color,r.setLineDash(u.borderDash||[]),r.lineDashOffset=u.borderDashOffset,r.beginPath(),r.moveTo(l.x,l.y),r.lineTo(c.x,c.y),r.stroke(),r.restore())};if(n.display)for(i=0,s=o.length;i<s;++i){const l=o[i];n.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),n.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:n,options:{border:r,grid:o}}=this,i=r.setContext(this.getContext()),s=r.display?i.width:0;if(!s)return;const a=o.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,u,d,h;this.isHorizontal()?(c=qs(t,this.left,s)-s/2,u=qs(t,this.right,a)+a/2,d=h=l):(d=qs(t,this.top,s)-s/2,h=qs(t,this.bottom,a)+a/2,c=u=l),n.save(),n.lineWidth=i.width,n.strokeStyle=i.color,n.beginPath(),n.moveTo(c,d),n.lineTo(u,h),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const r=this.ctx,o=this._computeLabelArea();o&&Ea(r,o);const i=this.getLabelItems(t);for(const s of i){const a=s.options,l=s.font,c=s.label,u=s.textOffset;Wa(r,c,0,u,l,a)}o&&Ra(r)}drawTitle(){const{ctx:t,options:{position:n,title:r,reverse:o}}=this;if(!r.display)return;const i=un(r.font),s=On(r.padding),a=r.align;let l=i.lineHeight/2;n==="bottom"||n==="center"||tt(n)?(l+=s.bottom,jt(r.text)&&(l+=i.lineHeight*(r.text.length-1))):l+=s.top;const{titleX:c,titleY:u,maxWidth:d,rotation:h}=hY(this,l,n,a);Wa(t,r.text,0,0,i,{color:r.color,maxWidth:d,rotation:h,textAlign:fY(a,n,o),textBaseline:"middle",translation:[c,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,n=t.ticks&&t.ticks.z||0,r=Ae(t.grid&&t.grid.z,-1),o=Ae(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==Os.prototype.draw?[{z:n,draw:i=>{this.draw(i)}}]:[{z:r,draw:i=>{this.drawBackground(),this.drawGrid(i),this.drawTitle()}},{z:o,draw:()=>{this.drawBorder()}},{z:n,draw:i=>{this.drawLabels(i)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),r=this.axis+"AxisID",o=[];let i,s;for(i=0,s=n.length;i<s;++i){const a=n[i];a[r]===this.id&&(!t||a.type===t)&&o.push(a)}return o}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return un(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Ah{constructor(t,n,r){this.type=t,this.scope=n,this.override=r,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const n=Object.getPrototypeOf(t);let r;mY(n)&&(r=this.register(n));const o=this.items,i=t.id,s=this.scope+"."+i;if(!i)throw new Error("class does not have id: "+t);return i in o||(o[i]=t,pY(t,s,r),this.override&&zt.override(t.id,t.overrides)),s}get(t){return this.items[t]}unregister(t){const n=this.items,r=t.id,o=this.scope;r in n&&delete n[r],o&&r in zt[o]&&(delete zt[o][r],this.override&&delete Ha[r])}}function pY(e,t,n){const r=fn(Object.create(null),[n?zt.get(n):{},zt.get(t),e.defaults]);zt.set(t,r),e.defaultRoutes&&gY(t,e.defaultRoutes),e.descriptors&&zt.describe(t,e.descriptors)}function gY(e,t){Object.keys(t).forEach(n=>{const r=n.split("."),o=r.pop(),i=[e].concat(r).join("."),s=t[n].split("."),a=s.pop(),l=s.join(".");zt.route(i,o,l,a)})}function mY(e){return"id"in e&&"defaults"in e}class bY{constructor(){this.controllers=new Ah(Kr,"datasets",!0),this.elements=new Ah(ri,"elements"),this.plugins=new Ah(Object,"plugins"),this.scales=new Ah(Os,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,r){[...n].forEach(o=>{const i=r||this._getRegistryForType(o);r||i.isForType(o)||i===this.plugins&&o.id?this._exec(t,i,o):yt(o,s=>{const a=r||this._getRegistryForType(s);this._exec(t,a,s)})})}_exec(t,n,r){const o=iS(t);_t(r["before"+o],[],r),n[t](r),_t(r["after"+o],[],r)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){const r=this._typedRegistries[n];if(r.isForType(t))return r}return this.plugins}_get(t,n,r){const o=n.get(t);if(o===void 0)throw new Error('"'+t+'" is not a registered '+r+".");return o}}var ln=new bY;class yY{constructor(){this._init=[]}notify(t,n,r,o){n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const i=o?this._descriptors(t).filter(o):this._descriptors(t),s=this._notify(i,t,n,r);return n==="afterDestroy"&&(this._notify(i,t,"stop"),this._notify(this._init,t,"uninstall")),s}_notify(t,n,r,o){o=o||{};for(const i of t){const s=i.plugin,a=s[r],l=[n,o,i.options];if(_t(a,l,s)===!1&&o.cancelable)return!1}return!0}invalidate(){ze(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){const r=t&&t.config,o=Ae(r.options&&r.options.plugins,{}),i=vY(r);return o===!1&&!n?[]:wY(t,i,o,n)}_notifyStateChanges(t){const n=this._oldCache||[],r=this._cache,o=(i,s)=>i.filter(a=>!s.some(l=>a.plugin.id===l.plugin.id));this._notify(o(n,r),t,"stop"),this._notify(o(r,n),t,"start")}}function vY(e){const t={},n=[],r=Object.keys(ln.plugins.items);for(let i=0;i<r.length;i++)n.push(ln.getPlugin(r[i]));const o=e.plugins||[];for(let i=0;i<o.length;i++){const s=o[i];n.indexOf(s)===-1&&(n.push(s),t[s.id]=!0)}return{plugins:n,localIds:t}}function xY(e,t){return!t&&e===!1?null:e===!0?{}:e}function wY(e,{plugins:t,localIds:n},r,o){const i=[],s=e.getContext();for(const a of t){const l=a.id,c=xY(r[l],o);c!==null&&i.push({plugin:a,options:SY(e.config,{plugin:a,local:n[l]},c,s)})}return i}function SY(e,{plugin:t,local:n},r,o){const i=e.pluginScopeKeys(t),s=e.getOptionScopes(r,i);return n&&t.defaults&&s.push(t.defaults),e.createResolver(s,o,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function fx(e,t){const n=zt.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function CY(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function _Y(e,t){return e===t?"_index_":"_value_"}function rR(e){if(e==="x"||e==="y"||e==="r")return e}function EY(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function hx(e,...t){if(rR(e))return e;for(const n of t){const r=n.axis||EY(n.position)||e.length>1&&rR(e[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function oR(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function RY(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(r=>r.xAxisID===e||r.yAxisID===e);if(n.length)return oR(e,"x",n[0])||oR(e,"y",n[0])}return{}}function kY(e,t){const n=Ha[e.type]||{scales:{}},r=t.scales||{},o=fx(e.type,t),i=Object.create(null);return Object.keys(r).forEach(s=>{const a=r[s];if(!tt(a))return console.error(`Invalid scale configuration for scale: ${s}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${s}`);const l=hx(s,a,RY(s,e),zt.scales[a.type]),c=_Y(l,o),u=n.scales||{};i[s]=td(Object.create(null),[{axis:l},a,u[l],u[c]])}),e.data.datasets.forEach(s=>{const a=s.type||e.type,l=s.indexAxis||fx(a,t),u=(Ha[a]||{}).scales||{};Object.keys(u).forEach(d=>{const h=CY(d,l),f=s[h+"AxisID"]||h;i[f]=i[f]||Object.create(null),td(i[f],[{axis:h},r[f],u[d]])})}),Object.keys(i).forEach(s=>{const a=i[s];td(a,[zt.scales[a.type],zt.scale])}),i}function zT(e){const t=e.options||(e.options={});t.plugins=Ae(t.plugins,{}),t.scales=kY(e,t)}function BT(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function PY(e){return e=e||{},e.data=BT(e.data),zT(e),e}const iR=new Map,VT=new Set;function Th(e,t){let n=iR.get(e);return n||(n=t(),iR.set(e,n),VT.add(n)),n}const Pu=(e,t,n)=>{const r=bs(t,n);r!==void 0&&e.add(r)};class MY{constructor(t){this._config=PY(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=BT(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),zT(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Th(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return Th(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return Th(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,r=this.type;return Th(`${r}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const r=this._scopeCache;let o=r.get(t);return(!o||n)&&(o=new Map,r.set(t,o)),o}getOptionScopes(t,n,r){const{options:o,type:i}=this,s=this._cachedScopes(t,r),a=s.get(n);if(a)return a;const l=new Set;n.forEach(u=>{t&&(l.add(t),u.forEach(d=>Pu(l,t,d))),u.forEach(d=>Pu(l,o,d)),u.forEach(d=>Pu(l,Ha[i]||{},d)),u.forEach(d=>Pu(l,zt,d)),u.forEach(d=>Pu(l,ux,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),VT.has(n)&&s.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,Ha[n]||{},zt.datasets[n]||{},{type:n},zt,ux]}resolveNamedOptions(t,n,r,o=[""]){const i={$shared:!0},{resolver:s,subPrefixes:a}=sR(this._resolverCache,t,o);let l=s;if(OY(s,n)){i.$shared=!1,r=ys(r)?r():r;const c=this.createResolver(t,r,a);l=Pc(s,r,c)}for(const c of n)i[c]=l[c];return i}createResolver(t,n,r=[""],o){const{resolver:i}=sR(this._resolverCache,t,r);return tt(n)?Pc(i,n,void 0,o):i}}function sR(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));const o=n.join();let i=r.get(o);return i||(i={resolver:dS(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},r.set(o,i)),i}const DY=e=>tt(e)&&Object.getOwnPropertyNames(e).some(t=>ys(e[t]));function OY(e,t){const{isScriptable:n,isIndexable:r}=wT(e);for(const o of t){const i=n(o),s=r(o),a=(s||i)&&e[o];if(i&&(ys(a)||DY(a))||s&&jt(a))return!0}return!1}var AY="4.4.8";const TY=["top","bottom","left","right","chartArea"];function aR(e,t){return e==="top"||e==="bottom"||TY.indexOf(e)===-1&&t==="x"}function lR(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function cR(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),_t(n&&n.onComplete,[e],t)}function IY(e){const t=e.chart,n=t.options.animation;_t(n&&n.onProgress,[e],t)}function HT(e){return pS()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Ap={},uR=e=>{const t=HT(e);return Object.values(Ap).filter(n=>n.canvas===t).pop()};function NY(e,t,n){const r=Object.keys(e);for(const o of r){const i=+o;if(i>=t){const s=e[o];delete e[o],(n>0||i>t)&&(e[i+n]=s)}}}function FY(e,t,n,r){return!n||e.type==="mouseout"?null:r?t:e}function Ih(e,t,n){return e.options.clip?e[n]:t[n]}function LY(e,t){const{xScale:n,yScale:r}=e;return n&&r?{left:Ih(n,t,"left"),right:Ih(n,t,"right"),top:Ih(r,t,"top"),bottom:Ih(r,t,"bottom")}:t}class Pt{static register(...t){ln.add(...t),dR()}static unregister(...t){ln.remove(...t),dR()}constructor(t,n){const r=this.config=new MY(n),o=HT(t),i=uR(o);if(i)throw new Error("Canvas is already in use. Chart with ID '"+i.id+"' must be destroyed before the canvas with ID '"+i.canvas.id+"' can be reused.");const s=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||eY(o)),this.platform.updateConfig(r);const a=this.platform.acquireContext(o,s.aspectRatio),l=a&&a.canvas,c=l&&l.height,u=l&&l.width;if(this.id=jU(),this.ctx=a,this.canvas=l,this.width=u,this.height=c,this._options=s,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 yY,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=tq(d=>this.update(d),s.resizeDelay||0),this._dataChanges=[],Ap[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}pi.listen(this,"complete",cR),pi.listen(this,"progress",IY),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:r,height:o,_aspectRatio:i}=this;return ze(t)?n&&i?i:o?r/o:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return ln}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():T2(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return D2(this.canvas,this.ctx),this}stop(){return pi.stop(this),this}resize(t,n){pi.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const r=this.options,o=this.canvas,i=r.maintainAspectRatio&&this.aspectRatio,s=this.platform.getMaximumSize(o,t,n,i),a=r.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=s.width,this.height=s.height,this._aspectRatio=this.aspectRatio,T2(this,a,!0)&&(this.notifyPlugins("resize",{size:s}),_t(r.onResize,[this,s],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};yt(n,(r,o)=>{r.id=o})}buildOrUpdateScales(){const t=this.options,n=t.scales,r=this.scales,o=Object.keys(r).reduce((s,a)=>(s[a]=!1,s),{});let i=[];n&&(i=i.concat(Object.keys(n).map(s=>{const a=n[s],l=hx(s,a),c=l==="r",u=l==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),yt(i,s=>{const a=s.options,l=a.id,c=hx(l,a),u=Ae(a.type,s.dtype);(a.position===void 0||aR(a.position,c)!==aR(s.dposition))&&(a.position=s.dposition),o[l]=!0;let d=null;if(l in r&&r[l].type===u)d=r[l];else{const h=ln.getScale(u);d=new h({id:l,type:u,ctx:this.ctx,chart:this}),r[d.id]=d}d.init(a,t)}),yt(o,(s,a)=>{s||delete r[a]}),yt(r,s=>{Bn.configure(this,s,s.options),Bn.addBox(this,s)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,r=t.length;if(t.sort((o,i)=>o.index-i.index),r>n){for(let o=n;o<r;++o)this._destroyDatasetMeta(o);t.splice(n,r-n)}this._sortedMetasets=t.slice(0).sort(lR("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((r,o)=>{n.filter(i=>i===r._dataset).length===0&&this._destroyDatasetMeta(o)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let r,o;for(this._removeUnreferencedMetasets(),r=0,o=n.length;r<o;r++){const i=n[r];let s=this.getDatasetMeta(r);const a=i.type||this.config.type;if(s.type&&s.type!==a&&(this._destroyDatasetMeta(r),s=this.getDatasetMeta(r)),s.type=a,s.indexAxis=i.indexAxis||fx(a,this.options),s.order=i.order||0,s.index=r,s.label=""+i.label,s.visible=this.isDatasetVisible(r),s.controller)s.controller.updateIndex(r),s.controller.linkScales();else{const l=ln.getController(a),{datasetElementType:c,dataElementType:u}=zt.datasets[a];Object.assign(l,{dataElementType:ln.getElement(u),datasetElementType:c&&ln.getElement(c)}),s.controller=new l(this,r),t.push(s.controller)}}return this._updateMetasets(),t}_resetElements(){yt(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const r=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),o=this._animationsDisabled=!r.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const i=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let s=0;for(let c=0,u=this.data.datasets.length;c<u;c++){const{controller:d}=this.getDatasetMeta(c),h=!o&&i.indexOf(d)===-1;d.buildOrUpdateElements(h),s=Math.max(+d.getMaxOverflow(),s)}s=this._minPadding=r.layout.autoPadding?s:0,this._updateLayout(s),o||yt(i,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(lR("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){yt(this.scales,t=>{Bn.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(t.events);(!w2(n,r)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:r,start:o,count:i}of n){const s=r==="_removeElements"?-i:i;NY(t,o,s)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,r=i=>new Set(t.filter(s=>s[0]===i).map((s,a)=>a+","+s.splice(1).join(","))),o=r(0);for(let i=1;i<n;i++)if(!w2(o,r(i)))return;return Array.from(o).map(i=>i.split(",")).map(i=>({method:i[1],start:+i[2],count:+i[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Bn.update(this,this.width,this.height,t);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],yt(this.boxes,o=>{r&&o.position==="chartArea"||(o.configure&&o.configure(),this._layers.push(...o._layers()))},this),this._layers.forEach((o,i)=>{o._idx=i}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,r=this.data.datasets.length;n<r;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,r=this.data.datasets.length;n<r;++n)this._updateDataset(n,ys(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){const r=this.getDatasetMeta(t),o={meta:r,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",o)!==!1&&(r.controller._update(n),o.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",o))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(pi.has(this)?this.attached&&!pi.running(this)&&pi.start(this):(this.draw(),cR({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:r,height:o}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(r,o)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const n=this._sortedMetasets,r=[];let o,i;for(o=0,i=n.length;o<i;++o){const s=n[o];(!t||s.visible)&&r.push(s)}return r}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,r=t._clip,o=!r.disabled,i=LY(t,this.chartArea),s={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(o&&Ea(n,{left:r.left===!1?0:i.left-r.left,right:r.right===!1?this.width:i.right+r.right,top:r.top===!1?0:i.top-r.top,bottom:r.bottom===!1?this.height:i.bottom+r.bottom}),t.controller.draw(),o&&Ra(n),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return Mi(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,r,o){const i=TG.modes[n];return typeof i=="function"?i(this,t,r,o):[]}getDatasetMeta(t){const n=this.data.datasets[t],r=this._metasets;let o=r.filter(i=>i&&i._dataset===n).pop();return o||(o={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},r.push(o)),o}getContext(){return this.$context||(this.$context=Ds(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const r=this.getDatasetMeta(t);return typeof r.hidden=="boolean"?!r.hidden:!n.hidden}setDatasetVisibility(t,n){const r=this.getDatasetMeta(t);r.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,r){const o=r?"show":"hide",i=this.getDatasetMeta(t),s=i.controller._resolveAnimations(void 0,o);Ad(n)?(i.data[n].hidden=!r,this.update()):(this.setDatasetVisibility(t,r),s.update(i,{visible:r}),this.update(a=>a.datasetIndex===t?o:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),pi.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),D2(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete Ap[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,n=this.platform,r=(i,s)=>{n.addEventListener(this,i,s),t[i]=s},o=(i,s,a)=>{i.offsetX=s,i.offsetY=a,this._eventHandler(i)};yt(this.options.events,i=>r(i,o))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,r=(l,c)=>{n.addEventListener(this,l,c),t[l]=c},o=(l,c)=>{t[l]&&(n.removeEventListener(this,l,c),delete t[l])},i=(l,c)=>{this.canvas&&this.resize(l,c)};let s;const a=()=>{o("attach",a),this.attached=!0,this.resize(),r("resize",i),r("detach",s)};s=()=>{this.attached=!1,o("resize",i),this._stop(),this._resize(0,0),r("attach",a)},n.isAttached(this.canvas)?a():s()}unbindEvents(){yt(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},yt(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,r){const o=r?"set":"remove";let i,s,a,l;for(n==="dataset"&&(i=this.getDatasetMeta(t[0].datasetIndex),i.controller["_"+o+"DatasetHoverStyle"]()),a=0,l=t.length;a<l;++a){s=t[a];const c=s&&this.getDatasetMeta(s.datasetIndex).controller;c&&c[o+"HoverStyle"](s.element,s.datasetIndex,s.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],r=t.map(({datasetIndex:i,index:s})=>{const a=this.getDatasetMeta(i);if(!a)throw new Error("No dataset found at index "+i);return{datasetIndex:i,element:a.data[s],index:s}});!rg(r,n)&&(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,n))}notifyPlugins(t,n,r){return this._plugins.notify(this,t,n,r)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,r){const o=this.options.hover,i=(l,c)=>l.filter(u=>!c.some(d=>u.datasetIndex===d.datasetIndex&&u.index===d.index)),s=i(n,t),a=r?t:i(t,n);s.length&&this.updateHoverStyle(s,o.mode,!1),a.length&&o.mode&&this.updateHoverStyle(a,o.mode,!0)}_eventHandler(t,n){const r={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},o=s=>(s.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",r,o)===!1)return;const i=this._handleEvent(t,n,r.inChartArea);return r.cancelable=!1,this.notifyPlugins("afterEvent",r,o),(i||r.changed)&&this.render(),this}_handleEvent(t,n,r){const{_active:o=[],options:i}=this,s=n,a=this._getActiveElements(t,o,r,s),l=WU(t),c=FY(t,this._lastEvent,r,l);r&&(this._lastEvent=null,_t(i.onHover,[t,a,this],this),l&&_t(i.onClick,[t,a,this],this));const u=!rg(a,o);return(u||n)&&(this._active=a,this._updateHoverStyles(a,o,n)),this._lastEvent=c,u}_getActiveElements(t,n,r,o){if(t.type==="mouseout")return[];if(!r)return n;const i=this.options.hover;return this.getElementsAtEventForMode(t,i.mode,i,o)}}pe(Pt,"defaults",zt),pe(Pt,"instances",Ap),pe(Pt,"overrides",Ha),pe(Pt,"registry",ln),pe(Pt,"version",AY),pe(Pt,"getChart",uR);function dR(){return yt(Pt.instances,e=>e._plugins.invalidate())}function jY(e,t,n){const{startAngle:r,pixelMargin:o,x:i,y:s,outerRadius:a,innerRadius:l}=t;let c=o/a;e.beginPath(),e.arc(i,s,a,r-c,n+c),l>o?(c=o/l,e.arc(i,s,l,n+c,r-c,!0)):e.arc(i,s,o,n+en,r-en),e.closePath(),e.clip()}function $Y(e){return uS(e,["outerStart","outerEnd","innerStart","innerEnd"])}function zY(e,t,n,r){const o=$Y(e.options.borderRadius),i=(n-t)/2,s=Math.min(i,r*t/2),a=l=>{const c=(n-Math.min(i,l))*r/2;return Sn(l,0,Math.min(i,c))};return{outerStart:a(o.outerStart),outerEnd:a(o.outerEnd),innerStart:Sn(o.innerStart,0,s),innerEnd:Sn(o.innerEnd,0,s)}}function xl(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function ug(e,t,n,r,o,i){const{x:s,y:a,startAngle:l,pixelMargin:c,innerRadius:u}=t,d=Math.max(t.outerRadius+r+n-c,0),h=u>0?u+r+n+c:0;let f=0;const p=o-l;if(r){const T=u>0?u-r:0,N=d>0?d-r:0,F=(T+N)/2,z=F!==0?p*F/(F+r):p;f=(p-z)/2}const g=Math.max(.001,p*d-n/Bt)/d,m=(p-g)/2,b=l+m+f,v=o-m-f,{outerStart:x,outerEnd:w,innerStart:C,innerEnd:S}=zY(t,h,d,v-b),E=d-x,P=d-w,M=b+x/E,D=v-w/P,A=h+C,I=h+S,$=b+C/A,j=v-S/I;if(e.beginPath(),i){const T=(M+D)/2;if(e.arc(s,a,d,M,T),e.arc(s,a,d,T,D),w>0){const B=xl(P,D,s,a);e.arc(B.x,B.y,w,D,v+en)}const N=xl(I,v,s,a);if(e.lineTo(N.x,N.y),S>0){const B=xl(I,j,s,a);e.arc(B.x,B.y,S,v+en,j+Math.PI)}const F=(v-S/h+(b+C/h))/2;if(e.arc(s,a,h,v-S/h,F,!0),e.arc(s,a,h,F,b+C/h,!0),C>0){const B=xl(A,$,s,a);e.arc(B.x,B.y,C,$+Math.PI,b-en)}const z=xl(E,b,s,a);if(e.lineTo(z.x,z.y),x>0){const B=xl(E,M,s,a);e.arc(B.x,B.y,x,b-en,M)}}else{e.moveTo(s,a);const T=Math.cos(M)*d+s,N=Math.sin(M)*d+a;e.lineTo(T,N);const F=Math.cos(D)*d+s,z=Math.sin(D)*d+a;e.lineTo(F,z)}e.closePath()}function BY(e,t,n,r,o){const{fullCircles:i,startAngle:s,circumference:a}=t;let l=t.endAngle;if(i){ug(e,t,n,r,l,o);for(let c=0;c<i;++c)e.fill();isNaN(a)||(l=s+(a%$t||$t))}return ug(e,t,n,r,l,o),e.fill(),l}function VY(e,t,n,r,o){const{fullCircles:i,startAngle:s,circumference:a,options:l}=t,{borderWidth:c,borderJoinStyle:u,borderDash:d,borderDashOffset:h}=l,f=l.borderAlign==="inner";if(!c)return;e.setLineDash(d||[]),e.lineDashOffset=h,f?(e.lineWidth=c*2,e.lineJoin=u||"round"):(e.lineWidth=c,e.lineJoin=u||"bevel");let p=t.endAngle;if(i){ug(e,t,n,r,p,o);for(let g=0;g<i;++g)e.stroke();isNaN(a)||(p=s+(a%$t||$t))}f&&jY(e,t,p),i||(ug(e,t,n,r,p,o),e.stroke())}class Fl extends ri{constructor(n){super();pe(this,"circumference");pe(this,"endAngle");pe(this,"fullCircles");pe(this,"innerRadius");pe(this,"outerRadius");pe(this,"pixelMargin");pe(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,n&&Object.assign(this,n)}inRange(n,r,o){const i=this.getProps(["x","y"],o),{angle:s,distance:a}=dT(i,{x:n,y:r}),{startAngle:l,endAngle:c,innerRadius:u,outerRadius:d,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],o),f=(this.options.spacing+this.options.borderWidth)/2,p=Ae(h,c-l),g=Td(s,l,c)&&l!==c,m=p>=$t||g,b=ki(a,u+f,d+f);return m&&b}getCenterPoint(n){const{x:r,y:o,startAngle:i,endAngle:s,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:c,spacing:u}=this.options,d=(i+s)/2,h=(a+l+u+c)/2;return{x:r+Math.cos(d)*h,y:o+Math.sin(d)*h}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:r,circumference:o}=this,i=(r.offset||0)/4,s=(r.spacing||0)/2,a=r.circular;if(this.pixelMargin=r.borderAlign==="inner"?.33:0,this.fullCircles=o>$t?Math.floor(o/$t):0,o===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const l=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(l)*i,Math.sin(l)*i);const c=1-Math.sin(Math.min(Bt,o||0)),u=i*c;n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,BY(n,this,u,s,a),VY(n,this,u,s,a),n.restore()}}pe(Fl,"id","arc"),pe(Fl,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),pe(Fl,"defaultRoutes",{backgroundColor:"backgroundColor"}),pe(Fl,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function WT(e,t,n=t){e.lineCap=Ae(n.borderCapStyle,t.borderCapStyle),e.setLineDash(Ae(n.borderDash,t.borderDash)),e.lineDashOffset=Ae(n.borderDashOffset,t.borderDashOffset),e.lineJoin=Ae(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=Ae(n.borderWidth,t.borderWidth),e.strokeStyle=Ae(n.borderColor,t.borderColor)}function HY(e,t,n){e.lineTo(n.x,n.y)}function WY(e){return e.stepped?hq:e.tension||e.cubicInterpolationMode==="monotone"?pq:HY}function UT(e,t,n={}){const r=e.length,{start:o=0,end:i=r-1}=n,{start:s,end:a}=t,l=Math.max(o,s),c=Math.min(i,a),u=o<s&&i<s||o>a&&i>a;return{count:r,start:l,loop:t.loop,ilen:c<l&&!u?r+c-l:c-l}}function UY(e,t,n,r){const{points:o,options:i}=t,{count:s,start:a,loop:l,ilen:c}=UT(o,n,r),u=WY(i);let{move:d=!0,reverse:h}=r||{},f,p,g;for(f=0;f<=c;++f)p=o[(a+(h?c-f:f))%s],!p.skip&&(d?(e.moveTo(p.x,p.y),d=!1):u(e,g,p,h,i.stepped),g=p);return l&&(p=o[(a+(h?c:0))%s],u(e,g,p,h,i.stepped)),!!l}function qY(e,t,n,r){const o=t.points,{count:i,start:s,ilen:a}=UT(o,n,r),{move:l=!0,reverse:c}=r||{};let u=0,d=0,h,f,p,g,m,b;const v=w=>(s+(c?a-w:w))%i,x=()=>{g!==m&&(e.lineTo(u,m),e.lineTo(u,g),e.lineTo(u,b))};for(l&&(f=o[v(0)],e.moveTo(f.x,f.y)),h=0;h<=a;++h){if(f=o[v(h)],f.skip)continue;const w=f.x,C=f.y,S=w|0;S===p?(C<g?g=C:C>m&&(m=C),u=(d*u+w)/++d):(x(),e.lineTo(w,C),p=S,d=0,g=m=C),b=C}x()}function px(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?qY:UY}function GY(e){return e.stepped?qq:e.tension||e.cubicInterpolationMode==="monotone"?Gq:Js}function YY(e,t,n,r){let o=t._path;o||(o=t._path=new Path2D,t.path(o,n,r)&&o.closePath()),WT(e,t.options),e.stroke(o)}function KY(e,t,n,r){const{segments:o,options:i}=t,s=px(t);for(const a of o)WT(e,i,a.style),e.beginPath(),s(e,t,a,{start:n,end:n+r-1})&&e.closePath(),e.stroke()}const XY=typeof Path2D=="function";function QY(e,t,n,r){XY&&!t.options.segment?YY(e,t,n,r):KY(e,t,n,r)}class cs extends ri{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const r=this.options;if((r.tension||r.cubicInterpolationMode==="monotone")&&!r.stepped&&!this._pointsUpdated){const o=r.spanGaps?this._loop:this._fullLoop;jq(this._points,r,t,o,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Jq(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,r=t.length;return r&&n[t[r-1].end]}interpolate(t,n){const r=this.options,o=t[n],i=this.points,s=OT(this,{property:n,start:o,end:o});if(!s.length)return;const a=[],l=GY(r);let c,u;for(c=0,u=s.length;c<u;++c){const{start:d,end:h}=s[c],f=i[d],p=i[h];if(f===p){a.push(f);continue}const g=Math.abs((o-f[n])/(p[n]-f[n])),m=l(f,p,g,r.stepped);m[n]=t[n],a.push(m)}return a.length===1?a[0]:a}pathSegment(t,n,r){return px(this)(t,this,n,r)}path(t,n,r){const o=this.segments,i=px(this);let s=this._loop;n=n||0,r=r||this.points.length-n;for(const a of o)s&=i(t,this,a,{start:n,end:n+r-1});return!!s}draw(t,n,r,o){const i=this.options||{};(this.points||[]).length&&i.borderWidth&&(t.save(),QY(t,this,r,o),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}pe(cs,"id","line"),pe(cs,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),pe(cs,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),pe(cs,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function fR(e,t,n,r){const o=e.options,{[n]:i}=e.getProps([n],r);return Math.abs(t-i)<o.radius+o.hitRadius}class Da extends ri{constructor(n){super();pe(this,"parsed");pe(this,"skip");pe(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,n&&Object.assign(this,n)}inRange(n,r,o){const i=this.options,{x:s,y:a}=this.getProps(["x","y"],o);return Math.pow(n-s,2)+Math.pow(r-a,2)<Math.pow(i.hitRadius+i.radius,2)}inXRange(n,r){return fR(this,n,"x",r)}inYRange(n,r){return fR(this,n,"y",r)}getCenterPoint(n){const{x:r,y:o}=this.getProps(["x","y"],n);return{x:r,y:o}}size(n){n=n||this.options||{};let r=n.radius||0;r=Math.max(r,r&&n.hoverRadius||0);const o=r&&n.borderWidth||0;return(r+o)*2}draw(n,r){const o=this.options;this.skip||o.radius<.1||!Mi(this,r,this.size(o)/2)||(n.strokeStyle=o.borderColor,n.lineWidth=o.borderWidth,n.fillStyle=o.backgroundColor,ag(n,o,this.x,this.y))}getRange(){const n=this.options||{};return n.radius+n.hitRadius}}pe(Da,"id","point"),pe(Da,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),pe(Da,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function qT(e,t){const{x:n,y:r,base:o,width:i,height:s}=e.getProps(["x","y","base","width","height"],t);let a,l,c,u,d;return e.horizontal?(d=s/2,a=Math.min(n,o),l=Math.max(n,o),c=r-d,u=r+d):(d=i/2,a=n-d,l=n+d,c=Math.min(r,o),u=Math.max(r,o)),{left:a,top:c,right:l,bottom:u}}function us(e,t,n,r){return e?0:Sn(t,n,r)}function ZY(e,t,n){const r=e.options.borderWidth,o=e.borderSkipped,i=xT(r);return{t:us(o.top,i.top,0,n),r:us(o.right,i.right,0,t),b:us(o.bottom,i.bottom,0,n),l:us(o.left,i.left,0,t)}}function JY(e,t,n){const{enableBorderRadius:r}=e.getProps(["enableBorderRadius"]),o=e.options.borderRadius,i=ka(o),s=Math.min(t,n),a=e.borderSkipped,l=r||tt(o);return{topLeft:us(!l||a.top||a.left,i.topLeft,0,s),topRight:us(!l||a.top||a.right,i.topRight,0,s),bottomLeft:us(!l||a.bottom||a.left,i.bottomLeft,0,s),bottomRight:us(!l||a.bottom||a.right,i.bottomRight,0,s)}}function eK(e){const t=qT(e),n=t.right-t.left,r=t.bottom-t.top,o=ZY(e,n/2,r/2),i=JY(e,n/2,r/2);return{outer:{x:t.left,y:t.top,w:n,h:r,radius:i},inner:{x:t.left+o.l,y:t.top+o.t,w:n-o.l-o.r,h:r-o.t-o.b,radius:{topLeft:Math.max(0,i.topLeft-Math.max(o.t,o.l)),topRight:Math.max(0,i.topRight-Math.max(o.t,o.r)),bottomLeft:Math.max(0,i.bottomLeft-Math.max(o.b,o.l)),bottomRight:Math.max(0,i.bottomRight-Math.max(o.b,o.r))}}}}function H0(e,t,n,r){const o=t===null,i=n===null,a=e&&!(o&&i)&&qT(e,r);return a&&(o||ki(t,a.left,a.right))&&(i||ki(n,a.top,a.bottom))}function tK(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function nK(e,t){e.rect(t.x,t.y,t.w,t.h)}function W0(e,t,n={}){const r=e.x!==n.x?-t:0,o=e.y!==n.y?-t:0,i=(e.x+e.w!==n.x+n.w?t:0)-r,s=(e.y+e.h!==n.y+n.h?t:0)-o;return{x:e.x+r,y:e.y+o,w:e.w+i,h:e.h+s,radius:e.radius}}class zo extends ri{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:n,options:{borderColor:r,backgroundColor:o}}=this,{inner:i,outer:s}=eK(this),a=tK(s.radius)?Id:nK;t.save(),(s.w!==i.w||s.h!==i.h)&&(t.beginPath(),a(t,W0(s,n,i)),t.clip(),a(t,W0(i,-n,s)),t.fillStyle=r,t.fill("evenodd")),t.beginPath(),a(t,W0(i,n)),t.fillStyle=o,t.fill(),t.restore()}inRange(t,n,r){return H0(this,t,n,r)}inXRange(t,n){return H0(this,t,null,n)}inYRange(t,n){return H0(this,null,t,n)}getCenterPoint(t){const{x:n,y:r,base:o,horizontal:i}=this.getProps(["x","y","base","horizontal"],t);return{x:i?(n+o)/2:n,y:i?r:(r+o)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}pe(zo,"id","bar"),pe(zo,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),pe(zo,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});var rK=Object.freeze({__proto__:null,ArcElement:Fl,BarElement:zo,LineElement:cs,PointElement:Da});const gx=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],hR=gx.map(e=>e.replace("rgb(","rgba(").replace(")",", 0.5)"));function GT(e){return gx[e%gx.length]}function YT(e){return hR[e%hR.length]}function oK(e,t){return e.borderColor=GT(t),e.backgroundColor=YT(t),++t}function iK(e,t){return e.backgroundColor=e.data.map(()=>GT(t++)),t}function sK(e,t){return e.backgroundColor=e.data.map(()=>YT(t++)),t}function aK(e){let t=0;return(n,r)=>{const o=e.getDatasetMeta(r).controller;o instanceof ca?t=iK(n,t):o instanceof id?t=sK(n,t):o&&(t=oK(n,t))}}function pR(e){let t;for(t in e)if(e[t].borderColor||e[t].backgroundColor)return!0;return!1}function lK(e){return e&&(e.borderColor||e.backgroundColor)}function cK(){return zt.borderColor!=="rgba(0,0,0,0.1)"||zt.backgroundColor!=="rgba(0,0,0,0.1)"}var uK={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(e,t,n){if(!n.enabled)return;const{data:{datasets:r},options:o}=e.config,{elements:i}=o,s=pR(r)||lK(o)||i&&pR(i)||cK();if(!n.forceOverride&&s)return;const a=aK(e);r.forEach(a)}};function dK(e,t,n,r,o){const i=o.samples||r;if(i>=n)return e.slice(t,t+n);const s=[],a=(n-2)/(i-2);let l=0;const c=t+n-1;let u=t,d,h,f,p,g;for(s[l++]=e[u],d=0;d<i-2;d++){let m=0,b=0,v;const x=Math.floor((d+1)*a)+1+t,w=Math.min(Math.floor((d+2)*a)+1,n)+t,C=w-x;for(v=x;v<w;v++)m+=e[v].x,b+=e[v].y;m/=C,b/=C;const S=Math.floor(d*a)+1+t,E=Math.min(Math.floor((d+1)*a)+1,n)+t,{x:P,y:M}=e[u];for(f=p=-1,v=S;v<E;v++)p=.5*Math.abs((P-m)*(e[v].y-M)-(P-e[v].x)*(b-M)),p>f&&(f=p,h=e[v],g=v);s[l++]=h,u=g}return s[l++]=e[c],s}function fK(e,t,n,r){let o=0,i=0,s,a,l,c,u,d,h,f,p,g;const m=[],b=t+n-1,v=e[t].x,w=e[b].x-v;for(s=t;s<t+n;++s){a=e[s],l=(a.x-v)/w*r,c=a.y;const C=l|0;if(C===u)c<p?(p=c,d=s):c>g&&(g=c,h=s),o=(i*o+a.x)/++i;else{const S=s-1;if(!ze(d)&&!ze(h)){const E=Math.min(d,h),P=Math.max(d,h);E!==f&&E!==S&&m.push({...e[E],x:o}),P!==f&&P!==S&&m.push({...e[P],x:o})}s>0&&S!==f&&m.push(e[S]),m.push(a),u=C,i=0,p=g=c,d=h=f=s}}return m}function KT(e){if(e._decimated){const t=e._data;delete e._decimated,delete e._data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function gR(e){e.data.datasets.forEach(t=>{KT(t)})}function hK(e,t){const n=t.length;let r=0,o;const{iScale:i}=e,{min:s,max:a,minDefined:l,maxDefined:c}=i.getUserBounds();return l&&(r=Sn(Pi(t,i.axis,s).lo,0,n-1)),c?o=Sn(Pi(t,i.axis,a).hi+1,r,n)-r:o=n-r,{start:r,count:o}}var pK={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(e,t,n)=>{if(!n.enabled){gR(e);return}const r=e.width;e.data.datasets.forEach((o,i)=>{const{_data:s,indexAxis:a}=o,l=e.getDatasetMeta(i),c=s||o.data;if(Ft([a,e.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const u=e.scales[l.xAxisID];if(u.type!=="linear"&&u.type!=="time"||e.options.parsing)return;let{start:d,count:h}=hK(l,c);const f=n.threshold||4*r;if(h<=f){KT(o);return}ze(s)&&(o._data=c,delete o.data,Object.defineProperty(o,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(g){this._data=g}}));let p;switch(n.algorithm){case"lttb":p=dK(c,d,h,r,n);break;case"min-max":p=fK(c,d,h,r);break;default:throw new Error(`Unsupported decimation algorithm '${n.algorithm}'`)}o._decimated=p})},destroy(e){gR(e)}};function gK(e,t,n){const r=e.segments,o=e.points,i=t.points,s=[];for(const a of r){let{start:l,end:c}=a;c=bS(l,c,o);const u=mx(n,o[l],o[c],a.loop);if(!t.segments){s.push({source:a,target:u,start:o[l],end:o[c]});continue}const d=OT(t,u);for(const h of d){const f=mx(n,i[h.start],i[h.end],h.loop),p=DT(a,o,f);for(const g of p)s.push({source:g,target:h,start:{[n]:mR(u,f,"start",Math.max)},end:{[n]:mR(u,f,"end",Math.min)}})}}return s}function mx(e,t,n,r){if(r)return;let o=t[e],i=n[e];return e==="angle"&&(o=Mr(o),i=Mr(i)),{property:e,start:o,end:i}}function mK(e,t){const{x:n=null,y:r=null}=e||{},o=t.points,i=[];return t.segments.forEach(({start:s,end:a})=>{a=bS(s,a,o);const l=o[s],c=o[a];r!==null?(i.push({x:l.x,y:r}),i.push({x:c.x,y:r})):n!==null&&(i.push({x:n,y:l.y}),i.push({x:n,y:c.y}))}),i}function bS(e,t,n){for(;t>e;t--){const r=n[t];if(!isNaN(r.x)&&!isNaN(r.y))break}return t}function mR(e,t,n,r){return e&&t?r(e[n],t[n]):e?e[n]:t?t[n]:0}function XT(e,t){let n=[],r=!1;return jt(e)?(r=!0,n=e):n=mK(e,t),n.length?new cs({points:n,options:{tension:0},_loop:r,_fullLoop:r}):null}function bR(e){return e&&e.fill!==!1}function bK(e,t,n){let o=e[t].fill;const i=[t];let s;if(!n)return o;for(;o!==!1&&i.indexOf(o)===-1;){if(!Qt(o))return o;if(s=e[o],!s)return!1;if(s.visible)return o;i.push(o),o=s.fill}return!1}function yK(e,t,n){const r=SK(e);if(tt(r))return isNaN(r.value)?!1:r;let o=parseFloat(r);return Qt(o)&&Math.floor(o)===o?vK(r[0],t,o,n):["origin","start","end","stack","shape"].indexOf(r)>=0&&r}function vK(e,t,n,r){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=r?!1:n}function xK(e,t){let n=null;return e==="start"?n=t.bottom:e==="end"?n=t.top:tt(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function wK(e,t,n){let r;return e==="start"?r=n:e==="end"?r=t.options.reverse?t.min:t.max:tt(e)?r=e.value:r=t.getBaseValue(),r}function SK(e){const t=e.options,n=t.fill;let r=Ae(n&&n.target,n);return r===void 0&&(r=!!t.backgroundColor),r===!1||r===null?!1:r===!0?"origin":r}function CK(e){const{scale:t,index:n,line:r}=e,o=[],i=r.segments,s=r.points,a=_K(t,n);a.push(XT({x:null,y:t.bottom},r));for(let l=0;l<i.length;l++){const c=i[l];for(let u=c.start;u<=c.end;u++)EK(o,s[u],a)}return new cs({points:o,options:{}})}function _K(e,t){const n=[],r=e.getMatchingVisibleMetas("line");for(let o=0;o<r.length;o++){const i=r[o];if(i.index===t)break;i.hidden||n.unshift(i.dataset)}return n}function EK(e,t,n){const r=[];for(let o=0;o<n.length;o++){const i=n[o],{first:s,last:a,point:l}=RK(i,t,"x");if(!(!l||s&&a)){if(s)r.unshift(l);else if(e.push(l),!a)break}}e.push(...r)}function RK(e,t,n){const r=e.interpolate(t,n);if(!r)return{};const o=r[n],i=e.segments,s=e.points;let a=!1,l=!1;for(let c=0;c<i.length;c++){const u=i[c],d=s[u.start][n],h=s[u.end][n];if(ki(o,d,h)){a=o===d,l=o===h;break}}return{first:a,last:l,point:r}}class QT{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,n,r){const{x:o,y:i,radius:s}=this;return n=n||{start:0,end:$t},t.arc(o,i,s,n.end,n.start,!0),!r.bounds}interpolate(t){const{x:n,y:r,radius:o}=this,i=t.angle;return{x:n+Math.cos(i)*o,y:r+Math.sin(i)*o,angle:i}}}function kK(e){const{chart:t,fill:n,line:r}=e;if(Qt(n))return PK(t,n);if(n==="stack")return CK(e);if(n==="shape")return!0;const o=MK(e);return o instanceof QT?o:XT(o,r)}function PK(e,t){const n=e.getDatasetMeta(t);return n&&e.isDatasetVisible(t)?n.dataset:null}function MK(e){return(e.scale||{}).getPointPositionForValue?OK(e):DK(e)}function DK(e){const{scale:t={},fill:n}=e,r=xK(n,t);if(Qt(r)){const o=t.isHorizontal();return{x:o?r:null,y:o?null:r}}return null}function OK(e){const{scale:t,fill:n}=e,r=t.options,o=t.getLabels().length,i=r.reverse?t.max:t.min,s=wK(n,t,i),a=[];if(r.grid.circular){const l=t.getPointPositionForValue(0,i);return new QT({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(s)})}for(let l=0;l<o;++l)a.push(t.getPointPositionForValue(l,s));return a}function U0(e,t,n){const r=kK(t),{line:o,scale:i,axis:s}=t,a=o.options,l=a.fill,c=a.backgroundColor,{above:u=c,below:d=c}=l||{};r&&o.points.length&&(Ea(e,n),AK(e,{line:o,target:r,above:u,below:d,area:n,scale:i,axis:s}),Ra(e))}function AK(e,t){const{line:n,target:r,above:o,below:i,area:s,scale:a}=t,l=n._loop?"angle":t.axis;e.save(),l==="x"&&i!==o&&(yR(e,r,s.top),vR(e,{line:n,target:r,color:o,scale:a,property:l}),e.restore(),e.save(),yR(e,r,s.bottom)),vR(e,{line:n,target:r,color:i,scale:a,property:l}),e.restore()}function yR(e,t,n){const{segments:r,points:o}=t;let i=!0,s=!1;e.beginPath();for(const a of r){const{start:l,end:c}=a,u=o[l],d=o[bS(l,c,o)];i?(e.moveTo(u.x,u.y),i=!1):(e.lineTo(u.x,n),e.lineTo(u.x,u.y)),s=!!t.pathSegment(e,a,{move:s}),s?e.closePath():e.lineTo(d.x,n)}e.lineTo(t.first().x,n),e.closePath(),e.clip()}function vR(e,t){const{line:n,target:r,property:o,color:i,scale:s}=t,a=gK(n,r,o);for(const{source:l,target:c,start:u,end:d}of a){const{style:{backgroundColor:h=i}={}}=l,f=r!==!0;e.save(),e.fillStyle=h,TK(e,s,f&&mx(o,u,d)),e.beginPath();const p=!!n.pathSegment(e,l);let g;if(f){p?e.closePath():xR(e,r,d,o);const m=!!r.pathSegment(e,c,{move:p,reverse:!0});g=p&&m,g||xR(e,r,u,o)}e.closePath(),e.fill(g?"evenodd":"nonzero"),e.restore()}}function TK(e,t,n){const{top:r,bottom:o}=t.chart.chartArea,{property:i,start:s,end:a}=n||{};i==="x"&&(e.beginPath(),e.rect(s,r,a-s,o-r),e.clip())}function xR(e,t,n,r){const o=t.interpolate(n,r);o&&e.lineTo(o.x,o.y)}var IK={id:"filler",afterDatasetsUpdate(e,t,n){const r=(e.data.datasets||[]).length,o=[];let i,s,a,l;for(s=0;s<r;++s)i=e.getDatasetMeta(s),a=i.dataset,l=null,a&&a.options&&a instanceof cs&&(l={visible:e.isDatasetVisible(s),index:s,fill:yK(a,s,r),chart:e,axis:i.controller.options.indexAxis,scale:i.vScale,line:a}),i.$filler=l,o.push(l);for(s=0;s<r;++s)l=o[s],!(!l||l.fill===!1)&&(l.fill=bK(o,s,n.propagate))},beforeDraw(e,t,n){const r=n.drawTime==="beforeDraw",o=e.getSortedVisibleDatasetMetas(),i=e.chartArea;for(let s=o.length-1;s>=0;--s){const a=o[s].$filler;a&&(a.line.updateControlPoints(i,a.axis),r&&a.fill&&U0(e.ctx,a,i))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!=="beforeDatasetsDraw")return;const r=e.getSortedVisibleDatasetMetas();for(let o=r.length-1;o>=0;--o){const i=r[o].$filler;bR(i)&&U0(e.ctx,i,e.chartArea)}},beforeDatasetDraw(e,t,n){const r=t.meta.$filler;!bR(r)||n.drawTime!=="beforeDatasetDraw"||U0(e.ctx,r,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const wR=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}},NK=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class SR extends ri{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n,r){this.maxWidth=t,this.maxHeight=n,this._margins=r,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=_t(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(r=>t.filter(r,this.chart.data))),t.sort&&(n=n.sort((r,o)=>t.sort(r,o,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const r=t.labels,o=un(r.font),i=o.size,s=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=wR(r,i);let c,u;n.font=o.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(s,i,a,l)+10):(u=this.maxHeight,c=this._fitCols(s,o,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,n,r,o){const{ctx:i,maxWidth:s,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=o+a;let d=t;i.textAlign="left",i.textBaseline="middle";let h=-1,f=-u;return this.legendItems.forEach((p,g)=>{const m=r+n/2+i.measureText(p.text).width;(g===0||c[c.length-1]+m+2*a>s)&&(d+=u,c[c.length-(g>0?0:1)]=0,f+=u,h++),l[g]={left:0,top:f,row:h,width:m,height:o},c[c.length-1]+=m+a}),d}_fitCols(t,n,r,o){const{ctx:i,maxHeight:s,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=s-t;let d=a,h=0,f=0,p=0,g=0;return this.legendItems.forEach((m,b)=>{const{itemWidth:v,itemHeight:x}=FK(r,n,i,m,o);b>0&&f+x+2*a>u&&(d+=h+a,c.push({width:h,height:f}),p+=h+a,g++,h=f=0),l[b]={left:p,top:f,col:g,width:v,height:x},h=Math.max(h,v),f+=x+a}),d+=h,c.push({width:h,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:r,labels:{padding:o},rtl:i}}=this,s=Yl(i,this.left,this.width);if(this.isHorizontal()){let a=0,l=$n(r,this.left+o,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=$n(r,this.left+o,this.right-this.lineWidths[a])),c.top+=this.top+t+o,c.left=s.leftForLtr(s.x(l),c.width),l+=c.width+o}else{let a=0,l=$n(r,this.top+t+o,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=$n(r,this.top+t+o,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+o,c.left=s.leftForLtr(s.x(c.left),c.width),l+=c.height+o}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Ea(t,this),this._draw(),Ra(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:r,ctx:o}=this,{align:i,labels:s}=t,a=zt.color,l=Yl(t.rtl,this.left,this.width),c=un(s.font),{padding:u}=s,d=c.size,h=d/2;let f;this.drawTitle(),o.textAlign=l.textAlign("left"),o.textBaseline="middle",o.lineWidth=.5,o.font=c.string;const{boxWidth:p,boxHeight:g,itemHeight:m}=wR(s,d),b=function(S,E,P){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;o.save();const M=Ae(P.lineWidth,1);if(o.fillStyle=Ae(P.fillStyle,a),o.lineCap=Ae(P.lineCap,"butt"),o.lineDashOffset=Ae(P.lineDashOffset,0),o.lineJoin=Ae(P.lineJoin,"miter"),o.lineWidth=M,o.strokeStyle=Ae(P.strokeStyle,a),o.setLineDash(Ae(P.lineDash,[])),s.usePointStyle){const D={radius:g*Math.SQRT2/2,pointStyle:P.pointStyle,rotation:P.rotation,borderWidth:M},A=l.xPlus(S,p/2),I=E+h;vT(o,D,A,I,s.pointStyleWidth&&p)}else{const D=E+Math.max((d-g)/2,0),A=l.leftForLtr(S,p),I=ka(P.borderRadius);o.beginPath(),Object.values(I).some($=>$!==0)?Id(o,{x:A,y:D,w:p,h:g,radius:I}):o.rect(A,D,p,g),o.fill(),M!==0&&o.stroke()}o.restore()},v=function(S,E,P){Wa(o,P.text,S,E+m/2,c,{strikethrough:P.hidden,textAlign:l.textAlign(P.textAlign)})},x=this.isHorizontal(),w=this._computeTitleHeight();x?f={x:$n(i,this.left+u,this.right-r[0]),y:this.top+u+w,line:0}:f={x:this.left+u,y:$n(i,this.top+w+u,this.bottom-n[0].height),line:0},kT(this.ctx,t.textDirection);const C=m+u;this.legendItems.forEach((S,E)=>{o.strokeStyle=S.fontColor,o.fillStyle=S.fontColor;const P=o.measureText(S.text).width,M=l.textAlign(S.textAlign||(S.textAlign=s.textAlign)),D=p+h+P;let A=f.x,I=f.y;l.setWidth(this.width),x?E>0&&A+D+u>this.right&&(I=f.y+=C,f.line++,A=f.x=$n(i,this.left+u,this.right-r[f.line])):E>0&&I+C>this.bottom&&(A=f.x=A+n[f.line].width+u,f.line++,I=f.y=$n(i,this.top+w+u,this.bottom-n[f.line].height));const $=l.x(A);if(b($,I,S),A=nq(M,A+p+h,x?A+D:this.right,t.rtl),v(l.x(A),I,S),x)f.x+=D+u;else if(typeof S.text!="string"){const j=c.lineHeight;f.y+=ZT(S,j)+u}else f.y+=C}),PT(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,r=un(n.font),o=On(n.padding);if(!n.display)return;const i=Yl(t.rtl,this.left,this.width),s=this.ctx,a=n.position,l=r.size/2,c=o.top+l;let u,d=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),u=this.top+c,d=$n(t.align,d,this.right-h);else{const p=this.columnSizes.reduce((g,m)=>Math.max(g,m.height),0);u=c+$n(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const f=$n(a,d,d+h);s.textAlign=i.textAlign(lS(a)),s.textBaseline="middle",s.strokeStyle=n.color,s.fillStyle=n.color,s.font=r.string,Wa(s,n.text,f,u,r)}_computeTitleHeight(){const t=this.options.title,n=un(t.font),r=On(t.padding);return t.display?n.lineHeight+r.height:0}_getLegendItemAt(t,n){let r,o,i;if(ki(t,this.left,this.right)&&ki(n,this.top,this.bottom)){for(i=this.legendHitBoxes,r=0;r<i.length;++r)if(o=i[r],ki(t,o.left,o.left+o.width)&&ki(n,o.top,o.top+o.height))return this.legendItems[r]}return null}handleEvent(t){const n=this.options;if(!$K(t.type,n))return;const r=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const o=this._hoveredItem,i=NK(o,r);o&&!i&&_t(n.onLeave,[t,o,this],this),this._hoveredItem=r,r&&!i&&_t(n.onHover,[t,r,this],this)}else r&&_t(n.onClick,[t,r,this],this)}}function FK(e,t,n,r,o){const i=LK(r,e,t,n),s=jK(o,r,t.lineHeight);return{itemWidth:i,itemHeight:s}}function LK(e,t,n,r){let o=e.text;return o&&typeof o!="string"&&(o=o.reduce((i,s)=>i.length>s.length?i:s)),t+n.size/2+r.measureText(o).width}function jK(e,t,n){let r=e;return typeof t.text!="string"&&(r=ZT(t,n)),r}function ZT(e,t){const n=e.text?e.text.length:0;return t*n}function $K(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var zK={id:"legend",_element:SR,start(e,t,n){const r=e.legend=new SR({ctx:e.ctx,options:n,chart:e});Bn.configure(e,r,n),Bn.addBox(e,r)},stop(e){Bn.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const r=e.legend;Bn.configure(e,r,n),r.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const r=t.datasetIndex,o=n.chart;o.isDatasetVisible(r)?(o.hide(r),t.hidden=!0):(o.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:o,color:i,useBorderRadius:s,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),u=On(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:i,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:r||c.pointStyle,rotation:c.rotation,textAlign:o||c.textAlign,borderRadius:s&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};let yS=class extends ri{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n){const r=this.options;if(this.left=0,this.top=0,!r.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=n;const o=jt(r.text)?r.text.length:1;this._padding=On(r.padding);const i=o*un(r.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=i:this.width=i}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:n,left:r,bottom:o,right:i,options:s}=this,a=s.align;let l=0,c,u,d;return this.isHorizontal()?(u=$n(a,r,i),d=n+t,c=i-r):(s.position==="left"?(u=r+t,d=$n(a,o,n),l=Bt*-.5):(u=i-t,d=$n(a,n,o),l=Bt*.5),c=o-n),{titleX:u,titleY:d,maxWidth:c,rotation:l}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const r=un(n.font),i=r.lineHeight/2+this._padding.top,{titleX:s,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(i);Wa(t,n.text,0,0,r,{color:n.color,maxWidth:l,rotation:c,textAlign:lS(n.align),textBaseline:"middle",translation:[s,a]})}};function BK(e,t){const n=new yS({ctx:e.ctx,options:t,chart:e});Bn.configure(e,n,t),Bn.addBox(e,n),e.titleBlock=n}var VK={id:"title",_element:yS,start(e,t,n){BK(e,n)},stop(e){const t=e.titleBlock;Bn.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const r=e.titleBlock;Bn.configure(e,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Nh=new WeakMap;var HK={id:"subtitle",start(e,t,n){const r=new yS({ctx:e.ctx,options:n,chart:e});Bn.configure(e,r,n),Bn.addBox(e,r),Nh.set(e,r)},stop(e){Bn.removeBox(e,Nh.get(e)),Nh.delete(e)},beforeUpdate(e,t,n){const r=Nh.get(e);Bn.configure(e,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Wu={average(e){if(!e.length)return!1;let t,n,r=new Set,o=0,i=0;for(t=0,n=e.length;t<n;++t){const a=e[t].element;if(a&&a.hasValue()){const l=a.tooltipPosition();r.add(l.x),o+=l.y,++i}}return i===0||r.size===0?!1:{x:[...r].reduce((a,l)=>a+l)/r.size,y:o/i}},nearest(e,t){if(!e.length)return!1;let n=t.x,r=t.y,o=Number.POSITIVE_INFINITY,i,s,a;for(i=0,s=e.length;i<s;++i){const l=e[i].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),u=cx(t,c);u<o&&(o=u,a=l)}}if(a){const l=a.tooltipPosition();n=l.x,r=l.y}return{x:n,y:r}}};function _o(e,t){return t&&(jt(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function gi(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
244
244
  `)>-1?e.split(`
245
- `):e}function WK(e,t){const{element:n,datasetIndex:r,index:o}=t,i=e.getDatasetMeta(r).controller,{label:s,value:a}=i.getLabelAndValue(o);return{chart:e,label:s,parsed:i.getParsed(o),raw:e.data.datasets[r].data[o],formattedValue:a,dataset:i.getDataset(),dataIndex:o,datasetIndex:r,element:n}}function CR(e,t){const n=e.chart.ctx,{body:r,footer:o,title:i}=e,{boxWidth:s,boxHeight:a}=t,l=un(t.bodyFont),c=un(t.titleFont),u=un(t.footerFont),d=i.length,h=o.length,f=r.length,p=On(t.padding);let g=p.height,m=0,b=r.reduce((w,C)=>w+C.before.length+C.lines.length+C.after.length,0);if(b+=e.beforeBody.length+e.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),b){const w=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;g+=f*w+(b-f)*l.lineHeight+(b-1)*t.bodySpacing}h&&(g+=t.footerMarginTop+h*u.lineHeight+(h-1)*t.footerSpacing);let v=0;const x=function(w){m=Math.max(m,n.measureText(w).width+v)};return n.save(),n.font=c.string,yt(e.title,x),n.font=l.string,yt(e.beforeBody.concat(e.afterBody),x),v=t.displayColors?s+2+t.boxPadding:0,yt(r,w=>{yt(w.before,x),yt(w.lines,x),yt(w.after,x)}),v=0,n.font=u.string,yt(e.footer,x),n.restore(),m+=p.width,{width:m,height:g}}function UK(e,t){const{y:n,height:r}=t;return n<r/2?"top":n>e.height-r/2?"bottom":"center"}function qK(e,t,n,r){const{x:o,width:i}=r,s=n.caretSize+n.caretPadding;if(e==="left"&&o+i+s>t.width||e==="right"&&o-i-s<0)return!0}function GK(e,t,n,r){const{x:o,width:i}=n,{width:s,chartArea:{left:a,right:l}}=e;let c="center";return r==="center"?c=o<=(a+l)/2?"left":"right":o<=i/2?c="left":o>=s-i/2&&(c="right"),qK(c,e,t,n)&&(c="center"),c}function _R(e,t,n){const r=n.yAlign||t.yAlign||UK(e,n);return{xAlign:n.xAlign||t.xAlign||GK(e,t,n,r),yAlign:r}}function YK(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function KK(e,t,n){let{y:r,height:o}=e;return t==="top"?r+=n:t==="bottom"?r-=o+n:r-=o/2,r}function ER(e,t,n,r){const{caretSize:o,caretPadding:i,cornerRadius:s}=e,{xAlign:a,yAlign:l}=n,c=o+i,{topLeft:u,topRight:d,bottomLeft:h,bottomRight:f}=ka(s);let p=YK(t,a);const g=KK(t,l,c);return l==="center"?a==="left"?p+=c:a==="right"&&(p-=c):a==="left"?p-=Math.max(u,h)+o:a==="right"&&(p+=Math.max(d,f)+o),{x:Sn(p,0,r.width-t.width),y:Sn(g,0,r.height-t.height)}}function Fh(e,t,n){const r=On(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function RR(e){return _o([],gi(e))}function XK(e,t,n){return Ds(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function kR(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const JT={beforeTitle:ci,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(r>0&&t.dataIndex<r)return n[t.dataIndex]}return""},afterTitle:ci,beforeBody:ci,beforeLabel:ci,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return ze(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:ci,afterBody:ci,beforeFooter:ci,footer:ci,afterFooter:ci};function ar(e,t,n,r){const o=e[t].call(n,r);return typeof o>"u"?JT[t].call(n,r):o}var vv;let PR=(vv=class extends ri{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,r=this.options.setContext(this.getContext()),o=r.enabled&&n.options.animation&&r.animations,i=new AT(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=XK(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:r}=n,o=ar(r,"beforeTitle",this,t),i=ar(r,"title",this,t),s=ar(r,"afterTitle",this,t);let a=[];return a=_o(a,gi(o)),a=_o(a,gi(i)),a=_o(a,gi(s)),a}getBeforeBody(t,n){return RR(ar(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,o=[];return yt(t,i=>{const s={before:[],lines:[],after:[]},a=kR(r,i);_o(s.before,gi(ar(a,"beforeLabel",this,i))),_o(s.lines,ar(a,"label",this,i)),_o(s.after,gi(ar(a,"afterLabel",this,i))),o.push(s)}),o}getAfterBody(t,n){return RR(ar(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:r}=n,o=ar(r,"beforeFooter",this,t),i=ar(r,"footer",this,t),s=ar(r,"afterFooter",this,t);let a=[];return a=_o(a,gi(o)),a=_o(a,gi(i)),a=_o(a,gi(s)),a}_createItems(t){const n=this._active,r=this.chart.data,o=[],i=[],s=[];let a=[],l,c;for(l=0,c=n.length;l<c;++l)a.push(WK(this.chart,n[l]));return t.filter&&(a=a.filter((u,d,h)=>t.filter(u,d,h,r))),t.itemSort&&(a=a.sort((u,d)=>t.itemSort(u,d,r))),yt(a,u=>{const d=kR(t.callbacks,u);o.push(ar(d,"labelColor",this,u)),i.push(ar(d,"labelPointStyle",this,u)),s.push(ar(d,"labelTextColor",this,u))}),this.labelColors=o,this.labelPointStyles=i,this.labelTextColors=s,this.dataPoints=a,a}update(t,n){const r=this.options.setContext(this.getContext()),o=this._active;let i,s=[];if(!o.length)this.opacity!==0&&(i={opacity:0});else{const a=Wu[r.position].call(this,o,this._eventPosition);s=this._createItems(r),this.title=this.getTitle(s,r),this.beforeBody=this.getBeforeBody(s,r),this.body=this.getBody(s,r),this.afterBody=this.getAfterBody(s,r),this.footer=this.getFooter(s,r);const l=this._size=CR(this,r),c=Object.assign({},a,l),u=_R(this.chart,r,c),d=ER(r,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,i={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=s,this.$context=void 0,i&&this._resolveAnimations().update(this,i),t&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,r,o){const i=this.getCaretPosition(t,r,o);n.lineTo(i.x1,i.y1),n.lineTo(i.x2,i.y2),n.lineTo(i.x3,i.y3)}getCaretPosition(t,n,r){const{xAlign:o,yAlign:i}=this,{caretSize:s,cornerRadius:a}=r,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:d}=ka(a),{x:h,y:f}=t,{width:p,height:g}=n;let m,b,v,x,w,C;return i==="center"?(w=f+g/2,o==="left"?(m=h,b=m-s,x=w+s,C=w-s):(m=h+p,b=m+s,x=w-s,C=w+s),v=m):(o==="left"?b=h+Math.max(l,u)+s:o==="right"?b=h+p-Math.max(c,d)-s:b=this.caretX,i==="top"?(x=f,w=x-s,m=b-s,v=b+s):(x=f+g,w=x+s,m=b+s,v=b-s),C=x),{x1:m,x2:b,x3:v,y1:x,y2:w,y3:C}}drawTitle(t,n,r){const o=this.title,i=o.length;let s,a,l;if(i){const c=Yl(r.rtl,this.x,this.width);for(t.x=Fh(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",s=un(r.titleFont),a=r.titleSpacing,n.fillStyle=r.titleColor,n.font=s.string,l=0;l<i;++l)n.fillText(o[l],c.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+a,l+1===i&&(t.y+=r.titleMarginBottom-a)}}_drawColorBox(t,n,r,o,i){const s=this.labelColors[r],a=this.labelPointStyles[r],{boxHeight:l,boxWidth:c}=i,u=un(i.bodyFont),d=Fh(this,"left",i),h=o.x(d),f=l<u.lineHeight?(u.lineHeight-l)/2:0,p=n.y+f;if(i.usePointStyle){const g={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},m=o.leftForLtr(h,c)+c/2,b=p+l/2;t.strokeStyle=i.multiKeyBackground,t.fillStyle=i.multiKeyBackground,ag(t,g,m,b),t.strokeStyle=s.borderColor,t.fillStyle=s.backgroundColor,ag(t,g,m,b)}else{t.lineWidth=tt(s.borderWidth)?Math.max(...Object.values(s.borderWidth)):s.borderWidth||1,t.strokeStyle=s.borderColor,t.setLineDash(s.borderDash||[]),t.lineDashOffset=s.borderDashOffset||0;const g=o.leftForLtr(h,c),m=o.leftForLtr(o.xPlus(h,1),c-2),b=ka(s.borderRadius);Object.values(b).some(v=>v!==0)?(t.beginPath(),t.fillStyle=i.multiKeyBackground,Id(t,{x:g,y:p,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=s.backgroundColor,t.beginPath(),Id(t,{x:m,y:p+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=i.multiKeyBackground,t.fillRect(g,p,c,l),t.strokeRect(g,p,c,l),t.fillStyle=s.backgroundColor,t.fillRect(m,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[r]}drawBody(t,n,r){const{body:o}=this,{bodySpacing:i,bodyAlign:s,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=r,d=un(r.bodyFont);let h=d.lineHeight,f=0;const p=Yl(r.rtl,this.x,this.width),g=function(P){n.fillText(P,p.x(t.x+f),t.y+h/2),t.y+=h+i},m=p.textAlign(s);let b,v,x,w,C,S,E;for(n.textAlign=s,n.textBaseline="middle",n.font=d.string,t.x=Fh(this,m,r),n.fillStyle=r.bodyColor,yt(this.beforeBody,g),f=a&&m!=="right"?s==="center"?c/2+u:c+2+u:0,w=0,S=o.length;w<S;++w){for(b=o[w],v=this.labelTextColors[w],n.fillStyle=v,yt(b.before,g),x=b.lines,a&&x.length&&(this._drawColorBox(n,t,w,p,r),h=Math.max(d.lineHeight,l)),C=0,E=x.length;C<E;++C)g(x[C]),h=d.lineHeight;yt(b.after,g)}f=0,h=d.lineHeight,yt(this.afterBody,g),t.y-=i}drawFooter(t,n,r){const o=this.footer,i=o.length;let s,a;if(i){const l=Yl(r.rtl,this.x,this.width);for(t.x=Fh(this,r.footerAlign,r),t.y+=r.footerMarginTop,n.textAlign=l.textAlign(r.footerAlign),n.textBaseline="middle",s=un(r.footerFont),n.fillStyle=r.footerColor,n.font=s.string,a=0;a<i;++a)n.fillText(o[a],l.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+r.footerSpacing}}drawBackground(t,n,r,o){const{xAlign:i,yAlign:s}=this,{x:a,y:l}=t,{width:c,height:u}=r,{topLeft:d,topRight:h,bottomLeft:f,bottomRight:p}=ka(o.cornerRadius);n.fillStyle=o.backgroundColor,n.strokeStyle=o.borderColor,n.lineWidth=o.borderWidth,n.beginPath(),n.moveTo(a+d,l),s==="top"&&this.drawCaret(t,n,r,o),n.lineTo(a+c-h,l),n.quadraticCurveTo(a+c,l,a+c,l+h),s==="center"&&i==="right"&&this.drawCaret(t,n,r,o),n.lineTo(a+c,l+u-p),n.quadraticCurveTo(a+c,l+u,a+c-p,l+u),s==="bottom"&&this.drawCaret(t,n,r,o),n.lineTo(a+f,l+u),n.quadraticCurveTo(a,l+u,a,l+u-f),s==="center"&&i==="left"&&this.drawCaret(t,n,r,o),n.lineTo(a,l+d),n.quadraticCurveTo(a,l,a+d,l),n.closePath(),n.fill(),o.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,r=this.$animations,o=r&&r.x,i=r&&r.y;if(o||i){const s=Wu[t.position].call(this,this._active,this._eventPosition);if(!s)return;const a=this._size=CR(this,t),l=Object.assign({},s,this._size),c=_R(n,t,l),u=ER(t,l,c,n);(o._to!==u.x||i._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=s.x,this.caretY=s.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const o={width:this.width,height:this.height},i={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const s=On(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=r,this.drawBackground(i,t,o,n),kT(t,n.textDirection),i.y+=s.top,this.drawTitle(i,t,n),this.drawBody(i,t,n),this.drawFooter(i,t,n),PT(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const r=this._active,o=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),i=!rg(r,o),s=this._positionChanged(o,n);(i||s)&&(this._active=o,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const o=this.options,i=this._active||[],s=this._getActiveElements(t,i,n,r),a=this._positionChanged(s,t),l=n||!rg(s,i)||a;return l&&(this._active=s,(o.enabled||o.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,r,o){const i=this.options;if(t.type==="mouseout")return[];if(!o)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const s=this.chart.getElementsAtEventForMode(t,i.mode,i,r);return i.reverse&&s.reverse(),s}_positionChanged(t,n){const{caretX:r,caretY:o,options:i}=this,s=Wu[i.position].call(this,t,n);return s!==!1&&(r!==s.x||o!==s.y)}},pe(vv,"positioners",Wu),vv);var eI={id:"tooltip",_element:PR,positioners:Wu,afterInit(e,t,n){n&&(e.tooltip=new PR({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:JT},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},QK=Object.freeze({__proto__:null,Colors:uK,Decimation:pK,Filler:IK,Legend:zK,SubTitle:HK,Title:VK,Tooltip:eI});const ZK=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function JK(e,t,n,r){const o=e.indexOf(t);if(o===-1)return ZK(e,t,n,r);const i=e.lastIndexOf(t);return o!==i?n:o}const eX=(e,t)=>e===null?null:Sn(Math.round(e),0,t);function MR(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class Fd extends Os{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const r=this.getLabels();for(const{index:o,label:i}of n)r[o]===i&&r.splice(o,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(ze(t))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===t?n:JK(r,t,Ae(n,t),this._addedLabels),eX(n,r.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:r,max:o}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(r=0),n||(o=this.getLabels().length-1)),this.min=r,this.max=o}buildTicks(){const t=this.min,n=this.max,r=this.options.offset,o=[];let i=this.getLabels();i=t===0&&n===i.length-1?i:i.slice(t,n+1),this._valueRange=Math.max(i.length-(r?0:1),1),this._startValue=this.min-(r?.5:0);for(let s=t;s<=n;s++)o.push({value:s});return o}getLabelForValue(t){return MR.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}pe(Fd,"id","category"),pe(Fd,"defaults",{ticks:{callback:MR}});function tX(e,t){const n=[],{bounds:o,step:i,min:s,max:a,precision:l,count:c,maxTicks:u,maxDigits:d,includeBounds:h}=e,f=i||1,p=u-1,{min:g,max:m}=t,b=!ze(s),v=!ze(a),x=!ze(c),w=(m-g)/(d+1);let C=C2((m-g)/p/f)*f,S,E,P,M;if(C<1e-14&&!b&&!v)return[{value:g},{value:m}];M=Math.ceil(m/C)-Math.floor(g/C),M>p&&(C=C2(M*C/p/f)*f),ze(l)||(S=Math.pow(10,l),C=Math.ceil(C*S)/S),o==="ticks"?(E=Math.floor(g/C)*C,P=Math.ceil(m/C)*C):(E=g,P=m),b&&v&&i&&KU((a-s)/i,C/1e3)?(M=Math.round(Math.min((a-s)/C,u)),C=(a-s)/M,E=s,P=a):x?(E=b?s:E,P=v?a:P,M=c-1,C=(P-E)/M):(M=(P-E)/C,nd(M,Math.round(M),C/1e3)?M=Math.round(M):M=Math.ceil(M));const D=Math.max(_2(C),_2(E));S=Math.pow(10,ze(l)?D:l),E=Math.round(E*S)/S,P=Math.round(P*S)/S;let A=0;for(b&&(h&&E!==s?(n.push({value:s}),E<s&&A++,nd(Math.round((E+A*C)*S)/S,s,DR(s,w,e))&&A++):E<s&&A++);A<M;++A){const I=Math.round((E+A*C)*S)/S;if(v&&I>a)break;n.push({value:I})}return v&&h&&P!==a?n.length&&nd(n[n.length-1].value,a,DR(a,w,e))?n[n.length-1].value=a:n.push({value:a}):(!v||P===a)&&n.push({value:P}),n}function DR(e,t,{horizontal:n,minRotation:r}){const o=co(r),i=(n?Math.sin(o):Math.cos(o))||.001,s=.75*t*(""+e).length;return Math.min(t/i,s)}class dg extends Os{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return ze(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:o,max:i}=this;const s=l=>o=n?o:l,a=l=>i=r?i:l;if(t){const l=$o(o),c=$o(i);l<0&&c<0?a(0):l>0&&c>0&&s(0)}if(o===i){let l=i===0?1:Math.abs(i*.05);a(i+l),t||s(o-l)}this.min=o,this.max=i}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=t,o;return r?(o=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,o>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${o} ticks. Limiting to 1000.`),o=1e3)):(o=this.computeTickLimit(),n=n||11),n&&(o=Math.min(n,o)),o}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let r=this.getTickLimit();r=Math.max(2,r);const o={maxTicks:r,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},i=this._range||this,s=tX(o,i);return t.bounds==="ticks"&&uT(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}configure(){const t=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&t.length){const o=(r-n)/Math.max(t.length-1,1)/2;n-=o,r+=o}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(t){return Pf(t,this.chart.options.locale,this.options.ticks.format)}}class Ua extends dg{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Qt(t)?t:0,this.max=Qt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=co(this.options.ticks.minRotation),o=(t?Math.sin(r):Math.cos(r))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,i.lineHeight/o))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}pe(Ua,"id","linear"),pe(Ua,"defaults",{ticks:{callback:Lm.formatters.numeric}});const Ld=e=>Math.floor(ls(e)),Ys=(e,t)=>Math.pow(10,Ld(e)+t);function OR(e){return e/Math.pow(10,Ld(e))===1}function AR(e,t,n){const r=Math.pow(10,n),o=Math.floor(e/r);return Math.ceil(t/r)-o}function nX(e,t){const n=t-e;let r=Ld(n);for(;AR(e,t,r)>10;)r++;for(;AR(e,t,r)<10;)r--;return Math.min(r,Ld(e))}function rX(e,{min:t,max:n}){t=kr(e.min,t);const r=[],o=Ld(t);let i=nX(t,n),s=i<0?Math.pow(10,Math.abs(i)):1;const a=Math.pow(10,i),l=o>i?Math.pow(10,o):0,c=Math.round((t-l)*s)/s,u=Math.floor((t-l)/a/10)*a*10;let d=Math.floor((c-u)/Math.pow(10,i)),h=kr(e.min,Math.round((l+u+d*Math.pow(10,i))*s)/s);for(;h<n;)r.push({value:h,major:OR(h),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(i++,d=2,s=i>=0?1:s),h=Math.round((l+u+d*Math.pow(10,i))*s)/s;const f=kr(e.max,h);return r.push({value:f,major:OR(f),significand:d}),r}class Dc extends Os{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const r=dg.prototype.parse.apply(this,[t,n]);if(r===0){this._zero=!0;return}return Qt(r)&&r>0?r:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Qt(t)?Math.max(0,t):null,this.max=Qt(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Qt(this._userMin)&&(this.min=t===Ys(this.min,0)?Ys(this.min,-1):Ys(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let r=this.min,o=this.max;const i=a=>r=t?r:a,s=a=>o=n?o:a;r===o&&(r<=0?(i(1),s(10)):(i(Ys(r,-1)),s(Ys(o,1)))),r<=0&&i(Ys(o,-1)),o<=0&&s(Ys(r,1)),this.min=r,this.max=o}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},r=rX(n,this);return t.bounds==="ticks"&&uT(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}getLabelForValue(t){return t===void 0?"0":Pf(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=ls(t),this._valueRange=ls(this.max)-ls(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(ls(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}pe(Dc,"id","logarithmic"),pe(Dc,"defaults",{ticks:{callback:Lm.formatters.logarithmic,major:{enabled:!0}}});function bx(e){const t=e.ticks;if(t.display&&e.display){const n=On(t.backdropPadding);return Ae(t.font&&t.font.size,zt.font.size)+n.height}return 0}function oX(e,t,n){return n=jt(n)?n:[n],{w:fq(e,t.string,n),h:n.length*t.lineHeight}}function TR(e,t,n,r,o){return e===r||e===o?{start:t-n/2,end:t+n/2}:e<r||e>o?{start:t-n,end:t}:{start:t,end:t+n}}function iX(e){const t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),r=[],o=[],i=e._pointLabels.length,s=e.options.pointLabels,a=s.centerPointLabels?Bt/i:0;for(let l=0;l<i;l++){const c=s.setContext(e.getPointLabelContext(l));o[l]=c.padding;const u=e.getPointPosition(l,e.drawingArea+o[l],a),d=un(c.font),h=oX(e.ctx,d,e._pointLabels[l]);r[l]=h;const f=Mr(e.getIndexAngle(l)+a),p=Math.round(sS(f)),g=TR(p,u.x,h.w,0,180),m=TR(p,u.y,h.h,90,270);sX(n,t,f,g,m)}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=cX(e,r,o)}function sX(e,t,n,r,o){const i=Math.abs(Math.sin(n)),s=Math.abs(Math.cos(n));let a=0,l=0;r.start<t.l?(a=(t.l-r.start)/i,e.l=Math.min(e.l,t.l-a)):r.end>t.r&&(a=(r.end-t.r)/i,e.r=Math.max(e.r,t.r+a)),o.start<t.t?(l=(t.t-o.start)/s,e.t=Math.min(e.t,t.t-l)):o.end>t.b&&(l=(o.end-t.b)/s,e.b=Math.max(e.b,t.b+l))}function aX(e,t,n){const r=e.drawingArea,{extra:o,additionalAngle:i,padding:s,size:a}=n,l=e.getPointPosition(t,r+o+s,i),c=Math.round(sS(Mr(l.angle+en))),u=fX(l.y,a.h,c),d=uX(c),h=dX(l.x,a.w,d);return{visible:!0,x:l.x,y:u,textAlign:d,left:h,top:u,right:h+a.w,bottom:u+a.h}}function lX(e,t){if(!t)return!0;const{left:n,top:r,right:o,bottom:i}=e;return!(Mi({x:n,y:r},t)||Mi({x:n,y:i},t)||Mi({x:o,y:r},t)||Mi({x:o,y:i},t))}function cX(e,t,n){const r=[],o=e._pointLabels.length,i=e.options,{centerPointLabels:s,display:a}=i.pointLabels,l={extra:bx(i)/2,additionalAngle:s?Bt/o:0};let c;for(let u=0;u<o;u++){l.padding=n[u],l.size=t[u];const d=aX(e,u,l);r.push(d),a==="auto"&&(d.visible=lX(d,c),d.visible&&(c=d))}return r}function uX(e){return e===0||e===180?"center":e<180?"left":"right"}function dX(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function fX(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function hX(e,t,n){const{left:r,top:o,right:i,bottom:s}=n,{backdropColor:a}=t;if(!ze(a)){const l=ka(t.borderRadius),c=On(t.backdropPadding);e.fillStyle=a;const u=r-c.left,d=o-c.top,h=i-r+c.width,f=s-o+c.height;Object.values(l).some(p=>p!==0)?(e.beginPath(),Id(e,{x:u,y:d,w:h,h:f,radius:l}),e.fill()):e.fillRect(u,d,h,f)}}function pX(e,t){const{ctx:n,options:{pointLabels:r}}=e;for(let o=t-1;o>=0;o--){const i=e._pointLabelItems[o];if(!i.visible)continue;const s=r.setContext(e.getPointLabelContext(o));hX(n,s,i);const a=un(s.font),{x:l,y:c,textAlign:u}=i;Wa(n,e._pointLabels[o],l,c+a.lineHeight/2,a,{color:s.color,textAlign:u,textBaseline:"middle"})}}function tI(e,t,n,r){const{ctx:o}=e;if(n)o.arc(e.xCenter,e.yCenter,t,0,$t);else{let i=e.getPointPosition(0,t);o.moveTo(i.x,i.y);for(let s=1;s<r;s++)i=e.getPointPosition(s,t),o.lineTo(i.x,i.y)}}function gX(e,t,n,r,o){const i=e.ctx,s=t.circular,{color:a,lineWidth:l}=t;!s&&!r||!a||!l||n<0||(i.save(),i.strokeStyle=a,i.lineWidth=l,i.setLineDash(o.dash||[]),i.lineDashOffset=o.dashOffset,i.beginPath(),tI(e,n,s,r),i.closePath(),i.stroke(),i.restore())}function mX(e,t,n){return Ds(e,{label:n,index:t,type:"pointLabel"})}class Uu extends dg{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=On(bx(this.options)/2),n=this.width=this.maxWidth-t.width,r=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+n/2+t.left),this.yCenter=Math.floor(this.top+r/2+t.top),this.drawingArea=Math.floor(Math.min(n,r)/2)}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!1);this.min=Qt(t)&&!isNaN(t)?t:0,this.max=Qt(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/bx(this.options))}generateTickLabels(t){dg.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,r)=>{const o=_t(this.options.pointLabels.callback,[n,r],this);return o||o===0?o:""}).filter((n,r)=>this.chart.getDataVisibility(r))}fit(){const t=this.options;t.display&&t.pointLabels.display?iX(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,n,r,o){this.xCenter+=Math.floor((t-n)/2),this.yCenter+=Math.floor((r-o)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,n,r,o))}getIndexAngle(t){const n=$t/(this._pointLabels.length||1),r=this.options.startAngle||0;return Mr(t*n+co(r))}getDistanceFromCenterForValue(t){if(ze(t))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*n:(t-this.min)*n}getValueForDistanceFromCenter(t){if(ze(t))return NaN;const n=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(t){const n=this._pointLabels||[];if(t>=0&&t<n.length){const r=n[t];return mX(this.getContext(),t,r)}}getPointPosition(t,n,r=0){const o=this.getIndexAngle(t)-en+r;return{x:Math.cos(o)*n+this.xCenter,y:Math.sin(o)*n+this.yCenter,angle:o}}getPointPositionForValue(t,n){return this.getPointPosition(t,this.getDistanceFromCenterForValue(n))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:n,top:r,right:o,bottom:i}=this._pointLabelItems[t];return{left:n,top:r,right:o,bottom:i}}drawBackground(){const{backgroundColor:t,grid:{circular:n}}=this.options;if(t){const r=this.ctx;r.save(),r.beginPath(),tI(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),r.closePath(),r.fillStyle=t,r.fill(),r.restore()}}drawGrid(){const t=this.ctx,n=this.options,{angleLines:r,grid:o,border:i}=n,s=this._pointLabels.length;let a,l,c;if(n.pointLabels.display&&pX(this,s),o.display&&this.ticks.forEach((u,d)=>{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(u.value);const h=this.getContext(d),f=o.setContext(h),p=i.setContext(h);gX(this,f,l,s,p)}}),r.display){for(t.save(),a=s-1;a>=0;a--){const u=r.setContext(this.getPointLabelContext(a)),{color:d,lineWidth:h}=u;!h||!d||(t.lineWidth=h,t.strokeStyle=d,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,l=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,n=this.options,r=n.ticks;if(!r.display)return;const o=this.getIndexAngle(0);let i,s;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(o),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!n.reverse)return;const c=r.setContext(this.getContext(l)),u=un(c.font);if(i=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=u.string,s=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const d=On(c.backdropPadding);t.fillRect(-s/2-d.left,-i-u.size/2-d.top,s+d.width,u.size+d.height)}Wa(t,a.label,0,-i,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}pe(Uu,"id","radialLinear"),pe(Uu,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Lm.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),pe(Uu,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),pe(Uu,"descriptors",{angleLines:{_fallback:"grid"}});const zm={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}},gr=Object.keys(zm);function IR(e,t){return e-t}function NR(e,t){if(ze(t))return null;const n=e._adapter,{parser:r,round:o,isoWeekday:i}=e._parseOpts;let s=t;return typeof r=="function"&&(s=r(s)),Qt(s)||(s=typeof r=="string"?n.parse(s,r):n.parse(s)),s===null?null:(o&&(s=o==="week"&&(kc(i)||i===!0)?n.startOf(s,"isoWeek",i):n.startOf(s,o)),+s)}function FR(e,t,n,r){const o=gr.length;for(let i=gr.indexOf(e);i<o-1;++i){const s=zm[gr[i]],a=s.steps?s.steps:Number.MAX_SAFE_INTEGER;if(s.common&&Math.ceil((n-t)/(a*s.size))<=r)return gr[i]}return gr[o-1]}function bX(e,t,n,r,o){for(let i=gr.length-1;i>=gr.indexOf(n);i--){const s=gr[i];if(zm[s].common&&e._adapter.diff(o,r,s)>=t-1)return s}return gr[n?gr.indexOf(n):0]}function yX(e){for(let t=gr.indexOf(e)+1,n=gr.length;t<n;++t)if(zm[gr[t]].common)return gr[t]}function LR(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:r,hi:o}=aS(n,t),i=n[r]>=t?n[r]:n[o];e[i]=!0}}function vX(e,t,n,r){const o=e._adapter,i=+o.startOf(t[0].value,r),s=t[t.length-1].value;let a,l;for(a=i;a<=s;a=+o.add(a,1,r))l=n[a],l>=0&&(t[l].major=!0);return t}function jR(e,t,n){const r=[],o={},i=t.length;let s,a;for(s=0;s<i;++s)a=t[s],o[a]=s,r.push({value:a,major:!1});return i===0||!n?r:vX(e,r,o,n)}class jd extends Os{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const r=t.time||(t.time={}),o=this._adapter=new PG._date(t.adapters.date);o.init(n),td(r.displayFormats,o.formats()),this._parseOpts={parser:r.parser,round:r.round,isoWeekday:r.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:NR(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,r=t.time.unit||"day";let{min:o,max:i,minDefined:s,maxDefined:a}=this.getUserBounds();function l(c){!s&&!isNaN(c.min)&&(o=Math.min(o,c.min)),!a&&!isNaN(c.max)&&(i=Math.max(i,c.max))}(!s||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),o=Qt(o)&&!isNaN(o)?o:+n.startOf(Date.now(),r),i=Qt(i)&&!isNaN(i)?i:+n.endOf(Date.now(),r)+1,this.min=Math.min(o,i-1),this.max=Math.max(o+1,i)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],r=t[t.length-1]),{min:n,max:r}}buildTicks(){const t=this.options,n=t.time,r=t.ticks,o=r.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&o.length&&(this.min=this._userMin||o[0],this.max=this._userMax||o[o.length-1]);const i=this.min,s=this.max,a=JU(o,i,s);return this._unit=n.unit||(r.autoSkip?FR(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):bX(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:yX(this._unit),this.initOffsets(o),t.reverse&&a.reverse(),jR(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,r=0,o,i;this.options.offset&&t.length&&(o=this.getDecimalForValue(t[0]),t.length===1?n=1-o:n=(this.getDecimalForValue(t[1])-o)/2,i=this.getDecimalForValue(t[t.length-1]),t.length===1?r=i:r=(i-this.getDecimalForValue(t[t.length-2]))/2);const s=t.length<3?.5:.25;n=Sn(n,0,s),r=Sn(r,0,s),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const t=this._adapter,n=this.min,r=this.max,o=this.options,i=o.time,s=i.unit||FR(i.minUnit,n,r,this._getLabelCapacity(n)),a=Ae(o.ticks.stepSize,1),l=s==="week"?i.isoWeekday:!1,c=kc(l)||l===!0,u={};let d=n,h,f;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":s),t.diff(r,n,s)>1e5*a)throw new Error(n+" and "+r+" are too far apart with stepSize of "+a+" "+s);const p=o.ticks.source==="data"&&this.getDataTimestamps();for(h=d,f=0;h<r;h=+t.add(h,a,s),f++)LR(u,h,p);return(h===r||o.bounds==="ticks"||f===1)&&LR(u,h,p),Object.keys(u).sort(IR).map(g=>+g)}getLabelForValue(t){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(t,r.tooltipFormat):n.format(t,r.displayFormats.datetime)}format(t,n){const o=this.options.time.displayFormats,i=this._unit,s=n||o[i];return this._adapter.format(t,s)}_tickFormatFunction(t,n,r,o){const i=this.options,s=i.ticks.callback;if(s)return _t(s,[t,n,r],this);const a=i.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],d=c&&a[c],h=r[n],f=c&&d&&h&&h.major;return this._adapter.format(t,o||(f?d:u))}generateTickLabels(t){let n,r,o;for(n=0,r=t.length;n<r;++n)o=t[n],o.label=this._tickFormatFunction(o.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,r=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+r)*n.factor)}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+r*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,r=this.ctx.measureText(t).width,o=co(this.isHorizontal()?n.maxRotation:n.minRotation),i=Math.cos(o),s=Math.sin(o),a=this._resolveTickFontOptions(0).size;return{w:r*i+a*s,h:r*s+a*i}}_getLabelCapacity(t){const n=this.options.time,r=n.displayFormats,o=r[n.unit]||r.millisecond,i=this._tickFormatFunction(t,0,jR(this,[t],this._majorUnit),o),s=this._getLabelSize(i),a=Math.floor(this.isHorizontal()?this.width/s.w:this.height/s.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,r;if(t.length)return t;const o=this.getMatchingVisibleMetas();if(this._normalized&&o.length)return this._cache.data=o[0].controller.getAllParsedValues(this);for(n=0,r=o.length;n<r;++n)t=t.concat(o[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,r;if(t.length)return t;const o=this.getLabels();for(n=0,r=o.length;n<r;++n)t.push(NR(this,o[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return hT(t.sort(IR))}}pe(jd,"id","time"),pe(jd,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Lh(e,t,n){let r=0,o=e.length-1,i,s,a,l;n?(t>=e[r].pos&&t<=e[o].pos&&({lo:r,hi:o}=Pi(e,"pos",t)),{pos:i,time:a}=e[r],{pos:s,time:l}=e[o]):(t>=e[r].time&&t<=e[o].time&&({lo:r,hi:o}=Pi(e,"time",t)),{time:i,pos:a}=e[r],{time:s,pos:l}=e[o]);const c=s-i;return c?a+(l-a)*(t-i)/c:a}class yx extends jd{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=Lh(n,this.min),this._tableRange=Lh(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:r}=this,o=[],i=[];let s,a,l,c,u;for(s=0,a=t.length;s<a;++s)c=t[s],c>=n&&c<=r&&o.push(c);if(o.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(s=0,a=o.length;s<a;++s)u=o[s+1],l=o[s-1],c=o[s],Math.round((u+l)/2)!==c&&i.push({time:c,pos:s/(a-1)});return i}_generate(){const t=this.min,n=this.max;let r=super.getDataTimestamps();return(!r.includes(t)||!r.length)&&r.splice(0,0,t),(!r.includes(n)||r.length===1)&&r.push(n),r.sort((o,i)=>o-i)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?t=this.normalize(n.concat(r)):t=n.length?n:r,t=this._cache.all=t,t}getDecimalForValue(t){return(Lh(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return Lh(this._table,r*this._tableRange+this._minPos,!0)}}pe(yx,"id","timeseries"),pe(yx,"defaults",jd.defaults);var xX=Object.freeze({__proto__:null,CategoryScale:Fd,LinearScale:Ua,LogarithmicScale:Dc,RadialLinearScale:Uu,TimeScale:jd,TimeSeriesScale:yx});const wX=[kG,rK,QK,xX];class vs{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let r=0;for(let o=0;o<this._n&&o<32;o++){const i=n[o],s=t+i,a=Math.abs(t)<Math.abs(i)?t-(s-i):i-(s-t);a&&(n[r++]=a),t=s}return n[r]=t,this._n=r+1,this}valueOf(){const t=this._partials;let n=this._n,r,o,i,s=0;if(n>0){for(s=t[--n];n>0&&(r=s,o=t[--n],s=r+o,i=o-(s-r),!i););n>0&&(i<0&&t[n-1]<0||i>0&&t[n-1]>0)&&(o=i*2,r=s+o,o==r-s&&(s=r))}return s}}function*SX(e){for(const t of e)yield*t}function nI(e){return Array.from(SX(e))}function Ll(e,t,n){e=+e,t=+t,n=(o=arguments.length)<2?(t=e,e=0,1):o<3?1:+n;for(var r=-1,o=Math.max(0,Math.ceil((t-e)/n))|0,i=new Array(o);++r<o;)i[r]=e+r*n;return i}var ke=1e-6,rI=1e-12,Xe=Math.PI,Xt=Xe/2,$R=Xe/4,Fr=Xe*2,Qn=180/Xe,Et=Xe/180,at=Math.abs,Kc=Math.atan,Go=Math.atan2,$e=Math.cos,jh=Math.ceil,oI=Math.exp,fg=Math.log,q0=Math.pow,Ie=Math.sin,Yr=Math.sign||function(e){return e>0?1:e<0?-1:0},nr=Math.sqrt,vS=Math.tan;function iI(e){return e>1?0:e<-1?Xe:Math.acos(e)}function Zr(e){return e>1?Xt:e<-1?-Xt:Math.asin(e)}function wn(){}function hg(e,t){e&&BR.hasOwnProperty(e.type)&&BR[e.type](e,t)}var zR={Feature:function(e,t){hg(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,o=n.length;++r<o;)hg(n[r].geometry,t)}},BR={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)e=n[r],t.point(e[0],e[1],e[2])},LineString:function(e,t){vx(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)vx(n[r],t,0)},Polygon:function(e,t){VR(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)VR(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,o=n.length;++r<o;)hg(n[r],t)}};function vx(e,t,n){var r=-1,o=e.length-n,i;for(t.lineStart();++r<o;)i=e[r],t.point(i[0],i[1],i[2]);t.lineEnd()}function VR(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)vx(e[n],t,1);t.polygonEnd()}function na(e,t){e&&zR.hasOwnProperty(e.type)?zR[e.type](e,t):hg(e,t)}function xx(e){return[Go(e[1],e[0]),Zr(e[2])]}function Oc(e){var t=e[0],n=e[1],r=$e(n);return[r*$e(t),r*Ie(t),Ie(n)]}function $h(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function pg(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function G0(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function zh(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function wx(e){var t=nr(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function Sx(e,t){function n(r,o){return r=e(r,o),t(r[0],r[1])}return e.invert&&t.invert&&(n.invert=function(r,o){return r=t.invert(r,o),r&&e.invert(r[0],r[1])}),n}function Cx(e,t){return at(e)>Xe&&(e-=Math.round(e/Fr)*Fr),[e,t]}Cx.invert=Cx;function sI(e,t,n){return(e%=Fr)?t||n?Sx(WR(e),UR(t,n)):WR(e):t||n?UR(t,n):Cx}function HR(e){return function(t,n){return t+=e,at(t)>Xe&&(t-=Math.round(t/Fr)*Fr),[t,n]}}function WR(e){var t=HR(e);return t.invert=HR(-e),t}function UR(e,t){var n=$e(e),r=Ie(e),o=$e(t),i=Ie(t);function s(a,l){var c=$e(l),u=$e(a)*c,d=Ie(a)*c,h=Ie(l),f=h*n+u*r;return[Go(d*o-f*i,u*n-h*r),Zr(f*o+d*i)]}return s.invert=function(a,l){var c=$e(l),u=$e(a)*c,d=Ie(a)*c,h=Ie(l),f=h*o-d*i;return[Go(d*o+h*i,u*n+f*r),Zr(f*n-u*r)]},s}function CX(e){e=sI(e[0]*Et,e[1]*Et,e.length>2?e[2]*Et:0);function t(n){return n=e(n[0]*Et,n[1]*Et),n[0]*=Qn,n[1]*=Qn,n}return t.invert=function(n){return n=e.invert(n[0]*Et,n[1]*Et),n[0]*=Qn,n[1]*=Qn,n},t}function _X(e,t,n,r,o,i){if(n){var s=$e(t),a=Ie(t),l=r*n;o==null?(o=t+r*Fr,i=t-l/2):(o=qR(s,o),i=qR(s,i),(r>0?o<i:o>i)&&(o+=r*Fr));for(var c,u=o;r>0?u>i:u<i;u-=l)c=xx([s,-a*$e(u),-a*Ie(u)]),e.point(c[0],c[1])}}function qR(e,t){t=Oc(t),t[0]-=e,wx(t);var n=iI(-t[1]);return((-t[2]<0?-n:n)+Fr-ke)%Fr}function aI(){var e=[],t;return{point:function(n,r,o){t.push([n,r,o])},lineStart:function(){e.push(t=[])},lineEnd:wn,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Tp(e,t){return at(e[0]-t[0])<ke&&at(e[1]-t[1])<ke}function Bh(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function lI(e,t,n,r,o){var i=[],s=[],a,l;if(e.forEach(function(p){if(!((g=p.length-1)<=0)){var g,m=p[0],b=p[g],v;if(Tp(m,b)){if(!m[2]&&!b[2]){for(o.lineStart(),a=0;a<g;++a)o.point((m=p[a])[0],m[1]);o.lineEnd();return}b[0]+=2*ke}i.push(v=new Bh(m,p,null,!0)),s.push(v.o=new Bh(m,null,v,!1)),i.push(v=new Bh(b,p,null,!1)),s.push(v.o=new Bh(b,null,v,!0))}}),!!i.length){for(s.sort(t),GR(i),GR(s),a=0,l=s.length;a<l;++a)s[a].e=n=!n;for(var c=i[0],u,d;;){for(var h=c,f=!0;h.v;)if((h=h.n)===c)return;u=h.z,o.lineStart();do{if(h.v=h.o.v=!0,h.e){if(f)for(a=0,l=u.length;a<l;++a)o.point((d=u[a])[0],d[1]);else r(h.x,h.n.x,1,o);h=h.n}else{if(f)for(u=h.p.z,a=u.length-1;a>=0;--a)o.point((d=u[a])[0],d[1]);else r(h.x,h.p.x,-1,o);h=h.p}h=h.o,u=h.z,f=!f}while(!h.v);o.lineEnd()}}}function GR(e){if(t=e.length){for(var t,n=0,r=e[0],o;++n<t;)r.n=o=e[n],o.p=r,r=o;r.n=o=e[0],o.p=r}}function Y0(e){return at(e[0])<=Xe?e[0]:Yr(e[0])*((at(e[0])+Xe)%Fr-Xe)}function cI(e,t){var n=Y0(t),r=t[1],o=Ie(r),i=[Ie(n),-$e(n),0],s=0,a=0,l=new vs;o===1?r=Xt+ke:o===-1&&(r=-Xt-ke);for(var c=0,u=e.length;c<u;++c)if(h=(d=e[c]).length)for(var d,h,f=d[h-1],p=Y0(f),g=f[1]/2+$R,m=Ie(g),b=$e(g),v=0;v<h;++v,p=w,m=S,b=E,f=x){var x=d[v],w=Y0(x),C=x[1]/2+$R,S=Ie(C),E=$e(C),P=w-p,M=P>=0?1:-1,D=M*P,A=D>Xe,I=m*S;if(l.add(Go(I*M*Ie(D),b*E+I*$e(D))),s+=A?P+M*Fr:P,A^p>=n^w>=n){var $=pg(Oc(f),Oc(x));wx($);var j=pg(i,$);wx(j);var T=(A^P>=0?-1:1)*Zr(j[2]);(r>T||r===T&&($[0]||$[1]))&&(a+=A^P>=0?1:-1)}}return(s<-1e-6||s<ke&&l<-1e-12)^a&1}function uI(e,t,n,r){return function(o){var i=t(o),s=aI(),a=t(s),l=!1,c,u,d,h={point:f,lineStart:g,lineEnd:m,polygonStart:function(){h.point=b,h.lineStart=v,h.lineEnd=x,u=[],c=[]},polygonEnd:function(){h.point=f,h.lineStart=g,h.lineEnd=m,u=nI(u);var w=cI(c,r);u.length?(l||(o.polygonStart(),l=!0),lI(u,RX,w,n,o)):w&&(l||(o.polygonStart(),l=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),l&&(o.polygonEnd(),l=!1),u=c=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function f(w,C){e(w,C)&&o.point(w,C)}function p(w,C){i.point(w,C)}function g(){h.point=p,i.lineStart()}function m(){h.point=f,i.lineEnd()}function b(w,C){d.push([w,C]),a.point(w,C)}function v(){a.lineStart(),d=[]}function x(){b(d[0][0],d[0][1]),a.lineEnd();var w=a.clean(),C=s.result(),S,E=C.length,P,M,D;if(d.pop(),c.push(d),d=null,!!E){if(w&1){if(M=C[0],(P=M.length-1)>0){for(l||(o.polygonStart(),l=!0),o.lineStart(),S=0;S<P;++S)o.point((D=M[S])[0],D[1]);o.lineEnd()}return}E>1&&w&2&&C.push(C.pop().concat(C.shift())),u.push(C.filter(EX))}}return h}}function EX(e){return e.length>1}function RX(e,t){return((e=e.x)[0]<0?e[1]-Xt-ke:Xt-e[1])-((t=t.x)[0]<0?t[1]-Xt-ke:Xt-t[1])}const YR=uI(function(){return!0},kX,MX,[-Xe,-Xt]);function kX(e){var t=NaN,n=NaN,r=NaN,o;return{lineStart:function(){e.lineStart(),o=1},point:function(i,s){var a=i>0?Xe:-Xe,l=at(i-t);at(l-Xe)<ke?(e.point(t,n=(n+s)/2>0?Xt:-Xt),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(i,n),o=0):r!==a&&l>=Xe&&(at(t-r)<ke&&(t-=r*ke),at(i-a)<ke&&(i-=a*ke),n=PX(t,n,i,s),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),o=0),e.point(t=i,n=s),r=a},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-o}}}function PX(e,t,n,r){var o,i,s=Ie(e-n);return at(s)>ke?Kc((Ie(t)*(i=$e(r))*Ie(n)-Ie(r)*(o=$e(t))*Ie(e))/(o*i*s)):(t+r)/2}function MX(e,t,n,r){var o;if(e==null)o=n*Xt,r.point(-Xe,o),r.point(0,o),r.point(Xe,o),r.point(Xe,0),r.point(Xe,-o),r.point(0,-o),r.point(-Xe,-o),r.point(-Xe,0),r.point(-Xe,o);else if(at(e[0]-t[0])>ke){var i=e[0]<t[0]?Xe:-Xe;o=n*i/2,r.point(-i,o),r.point(0,o),r.point(i,o)}else r.point(t[0],t[1])}function DX(e){var t=$e(e),n=2*Et,r=t>0,o=at(t)>ke;function i(u,d,h,f){_X(f,e,n,h,u,d)}function s(u,d){return $e(u)*$e(d)>t}function a(u){var d,h,f,p,g;return{lineStart:function(){p=f=!1,g=1},point:function(m,b){var v=[m,b],x,w=s(m,b),C=r?w?0:c(m,b):w?c(m+(m<0?Xe:-Xe),b):0;if(!d&&(p=f=w)&&u.lineStart(),w!==f&&(x=l(d,v),(!x||Tp(d,x)||Tp(v,x))&&(v[2]=1)),w!==f)g=0,w?(u.lineStart(),x=l(v,d),u.point(x[0],x[1])):(x=l(d,v),u.point(x[0],x[1],2),u.lineEnd()),d=x;else if(o&&d&&r^w){var S;!(C&h)&&(S=l(v,d,!0))&&(g=0,r?(u.lineStart(),u.point(S[0][0],S[0][1]),u.point(S[1][0],S[1][1]),u.lineEnd()):(u.point(S[1][0],S[1][1]),u.lineEnd(),u.lineStart(),u.point(S[0][0],S[0][1],3)))}w&&(!d||!Tp(d,v))&&u.point(v[0],v[1]),d=v,f=w,h=C},lineEnd:function(){f&&u.lineEnd(),d=null},clean:function(){return g|(p&&f)<<1}}}function l(u,d,h){var f=Oc(u),p=Oc(d),g=[1,0,0],m=pg(f,p),b=$h(m,m),v=m[0],x=b-v*v;if(!x)return!h&&u;var w=t*b/x,C=-t*v/x,S=pg(g,m),E=zh(g,w),P=zh(m,C);G0(E,P);var M=S,D=$h(E,M),A=$h(M,M),I=D*D-A*($h(E,E)-1);if(!(I<0)){var $=nr(I),j=zh(M,(-D-$)/A);if(G0(j,E),j=xx(j),!h)return j;var T=u[0],N=d[0],F=u[1],z=d[1],B;N<T&&(B=T,T=N,N=B);var O=N-T,U=at(O-Xe)<ke,L=U||O<ke;if(!U&&z<F&&(B=F,F=z,z=B),L?U?F+z>0^j[1]<(at(j[0]-T)<ke?F:z):F<=j[1]&&j[1]<=z:O>Xe^(T<=j[0]&&j[0]<=N)){var k=zh(M,(-D+$)/A);return G0(k,E),[j,xx(k)]}}}function c(u,d){var h=r?e:Xe-e,f=0;return u<-h?f|=1:u>h&&(f|=2),d<-h?f|=4:d>h&&(f|=8),f}return uI(s,a,i,r?[0,-e]:[-Xe,e-Xe])}function OX(e,t,n,r,o,i){var s=e[0],a=e[1],l=t[0],c=t[1],u=0,d=1,h=l-s,f=c-a,p;if(p=n-s,!(!h&&p>0)){if(p/=h,h<0){if(p<u)return;p<d&&(d=p)}else if(h>0){if(p>d)return;p>u&&(u=p)}if(p=o-s,!(!h&&p<0)){if(p/=h,h<0){if(p>d)return;p>u&&(u=p)}else if(h>0){if(p<u)return;p<d&&(d=p)}if(p=r-a,!(!f&&p>0)){if(p/=f,f<0){if(p<u)return;p<d&&(d=p)}else if(f>0){if(p>d)return;p>u&&(u=p)}if(p=i-a,!(!f&&p<0)){if(p/=f,f<0){if(p>d)return;p>u&&(u=p)}else if(f>0){if(p<u)return;p<d&&(d=p)}return u>0&&(e[0]=s+u*h,e[1]=a+u*f),d<1&&(t[0]=s+d*h,t[1]=a+d*f),!0}}}}}var Vh=1e9,Hh=-1e9;function AX(e,t,n,r){function o(c,u){return e<=c&&c<=n&&t<=u&&u<=r}function i(c,u,d,h){var f=0,p=0;if(c==null||(f=s(c,d))!==(p=s(u,d))||l(c,u)<0^d>0)do h.point(f===0||f===3?e:n,f>1?r:t);while((f=(f+d+4)%4)!==p);else h.point(u[0],u[1])}function s(c,u){return at(c[0]-e)<ke?u>0?0:3:at(c[0]-n)<ke?u>0?2:1:at(c[1]-t)<ke?u>0?1:0:u>0?3:2}function a(c,u){return l(c.x,u.x)}function l(c,u){var d=s(c,1),h=s(u,1);return d!==h?d-h:d===0?u[1]-c[1]:d===1?c[0]-u[0]:d===2?c[1]-u[1]:u[0]-c[0]}return function(c){var u=c,d=aI(),h,f,p,g,m,b,v,x,w,C,S,E={point:P,lineStart:I,lineEnd:$,polygonStart:D,polygonEnd:A};function P(T,N){o(T,N)&&u.point(T,N)}function M(){for(var T=0,N=0,F=f.length;N<F;++N)for(var z=f[N],B=1,O=z.length,U=z[0],L,k,H=U[0],G=U[1];B<O;++B)L=H,k=G,U=z[B],H=U[0],G=U[1],k<=r?G>r&&(H-L)*(r-k)>(G-k)*(e-L)&&++T:G<=r&&(H-L)*(r-k)<(G-k)*(e-L)&&--T;return T}function D(){u=d,h=[],f=[],S=!0}function A(){var T=M(),N=S&&T,F=(h=nI(h)).length;(N||F)&&(c.polygonStart(),N&&(c.lineStart(),i(null,null,1,c),c.lineEnd()),F&&lI(h,a,T,i,c),c.polygonEnd()),u=c,h=f=p=null}function I(){E.point=j,f&&f.push(p=[]),C=!0,w=!1,v=x=NaN}function $(){h&&(j(g,m),b&&w&&d.rejoin(),h.push(d.result())),E.point=P,w&&u.lineEnd()}function j(T,N){var F=o(T,N);if(f&&p.push([T,N]),C)g=T,m=N,b=F,C=!1,F&&(u.lineStart(),u.point(T,N));else if(F&&w)u.point(T,N);else{var z=[v=Math.max(Hh,Math.min(Vh,v)),x=Math.max(Hh,Math.min(Vh,x))],B=[T=Math.max(Hh,Math.min(Vh,T)),N=Math.max(Hh,Math.min(Vh,N))];OX(z,B,e,t,n,r)?(w||(u.lineStart(),u.point(z[0],z[1])),u.point(B[0],B[1]),F||u.lineEnd(),S=!1):F&&(u.lineStart(),u.point(T,N),S=!1)}v=T,x=N,w=F}return E}}var _x,Ex,Ip,Np,Ac={sphere:wn,point:wn,lineStart:TX,lineEnd:wn,polygonStart:wn,polygonEnd:wn};function TX(){Ac.point=NX,Ac.lineEnd=IX}function IX(){Ac.point=Ac.lineEnd=wn}function NX(e,t){e*=Et,t*=Et,Ex=e,Ip=Ie(t),Np=$e(t),Ac.point=FX}function FX(e,t){e*=Et,t*=Et;var n=Ie(t),r=$e(t),o=at(e-Ex),i=$e(o),s=Ie(o),a=r*s,l=Np*n-Ip*r*i,c=Ip*n+Np*r*i;_x.add(Go(nr(a*a+l*l),c)),Ex=e,Ip=n,Np=r}function LX(e){return _x=new vs,na(e,Ac),+_x}var Rx=[null,null],jX={type:"LineString",coordinates:Rx};function kx(e,t){return Rx[0]=e,Rx[1]=t,LX(jX)}var KR={Feature:function(e,t){return gg(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,o=n.length;++r<o;)if(gg(n[r].geometry,t))return!0;return!1}},XR={Sphere:function(){return!0},Point:function(e,t){return QR(e.coordinates,t)},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)if(QR(n[r],t))return!0;return!1},LineString:function(e,t){return ZR(e.coordinates,t)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)if(ZR(n[r],t))return!0;return!1},Polygon:function(e,t){return JR(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)if(JR(n[r],t))return!0;return!1},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,o=n.length;++r<o;)if(gg(n[r],t))return!0;return!1}};function gg(e,t){return e&&XR.hasOwnProperty(e.type)?XR[e.type](e,t):!1}function QR(e,t){return kx(e,t)===0}function ZR(e,t){for(var n,r,o,i=0,s=e.length;i<s;i++){if(r=kx(e[i],t),r===0||i>0&&(o=kx(e[i],e[i-1]),o>0&&n<=o&&r<=o&&(n+r-o)*(1-Math.pow((n-r)/o,2))<rI*o))return!0;n=r}return!1}function JR(e,t){return!!cI(e.map($X),dI(t))}function $X(e){return e=e.map(dI),e.pop(),e}function dI(e){return[e[0]*Et,e[1]*Et]}function zX(e,t){return(e&&KR.hasOwnProperty(e.type)?KR[e.type]:gg)(e,t)}function ek(e,t,n){var r=Ll(e,t-ke,n).concat(t);return function(o){return r.map(function(i){return[o,i]})}}function tk(e,t,n){var r=Ll(e,t-ke,n).concat(t);return function(o){return r.map(function(i){return[i,o]})}}function fI(){var e,t,n,r,o,i,s,a,l=10,c=l,u=90,d=360,h,f,p,g,m=2.5;function b(){return{type:"MultiLineString",coordinates:v()}}function v(){return Ll(jh(r/u)*u,n,u).map(p).concat(Ll(jh(a/d)*d,s,d).map(g)).concat(Ll(jh(t/l)*l,e,l).filter(function(x){return at(x%u)>ke}).map(h)).concat(Ll(jh(i/c)*c,o,c).filter(function(x){return at(x%d)>ke}).map(f))}return b.lines=function(){return v().map(function(x){return{type:"LineString",coordinates:x}})},b.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(g(s).slice(1),p(n).reverse().slice(1),g(a).reverse().slice(1))]}},b.extent=function(x){return arguments.length?b.extentMajor(x).extentMinor(x):b.extentMinor()},b.extentMajor=function(x){return arguments.length?(r=+x[0][0],n=+x[1][0],a=+x[0][1],s=+x[1][1],r>n&&(x=r,r=n,n=x),a>s&&(x=a,a=s,s=x),b.precision(m)):[[r,a],[n,s]]},b.extentMinor=function(x){return arguments.length?(t=+x[0][0],e=+x[1][0],i=+x[0][1],o=+x[1][1],t>e&&(x=t,t=e,e=x),i>o&&(x=i,i=o,o=x),b.precision(m)):[[t,i],[e,o]]},b.step=function(x){return arguments.length?b.stepMajor(x).stepMinor(x):b.stepMinor()},b.stepMajor=function(x){return arguments.length?(u=+x[0],d=+x[1],b):[u,d]},b.stepMinor=function(x){return arguments.length?(l=+x[0],c=+x[1],b):[l,c]},b.precision=function(x){return arguments.length?(m=+x,h=ek(i,o,90),f=tk(t,e,m),p=ek(a,s,90),g=tk(r,n,m),b):m},b.extentMajor([[-180,-90+ke],[180,90-ke]]).extentMinor([[-180,-80-ke],[180,80+ke]])}function BX(){return fI()()}const Px=e=>e;var K0=new vs,Mx=new vs,hI,pI,Dx,Ox,Si={point:wn,lineStart:wn,lineEnd:wn,polygonStart:function(){Si.lineStart=VX,Si.lineEnd=WX},polygonEnd:function(){Si.lineStart=Si.lineEnd=Si.point=wn,K0.add(at(Mx)),Mx=new vs},result:function(){var e=K0/2;return K0=new vs,e}};function VX(){Si.point=HX}function HX(e,t){Si.point=gI,hI=Dx=e,pI=Ox=t}function gI(e,t){Mx.add(Ox*e-Dx*t),Dx=e,Ox=t}function WX(){gI(hI,pI)}var Tc=1/0,mg=Tc,$d=-Tc,bg=$d,yg={point:UX,lineStart:wn,lineEnd:wn,polygonStart:wn,polygonEnd:wn,result:function(){var e=[[Tc,mg],[$d,bg]];return $d=bg=-(mg=Tc=1/0),e}};function UX(e,t){e<Tc&&(Tc=e),e>$d&&($d=e),t<mg&&(mg=t),t>bg&&(bg=t)}var Ax=0,Tx=0,qu=0,vg=0,xg=0,jl=0,Ix=0,Nx=0,Gu=0,mI,bI,To,Io,Gr={point:qa,lineStart:nk,lineEnd:rk,polygonStart:function(){Gr.lineStart=YX,Gr.lineEnd=KX},polygonEnd:function(){Gr.point=qa,Gr.lineStart=nk,Gr.lineEnd=rk},result:function(){var e=Gu?[Ix/Gu,Nx/Gu]:jl?[vg/jl,xg/jl]:qu?[Ax/qu,Tx/qu]:[NaN,NaN];return Ax=Tx=qu=vg=xg=jl=Ix=Nx=Gu=0,e}};function qa(e,t){Ax+=e,Tx+=t,++qu}function nk(){Gr.point=qX}function qX(e,t){Gr.point=GX,qa(To=e,Io=t)}function GX(e,t){var n=e-To,r=t-Io,o=nr(n*n+r*r);vg+=o*(To+e)/2,xg+=o*(Io+t)/2,jl+=o,qa(To=e,Io=t)}function rk(){Gr.point=qa}function YX(){Gr.point=XX}function KX(){yI(mI,bI)}function XX(e,t){Gr.point=yI,qa(mI=To=e,bI=Io=t)}function yI(e,t){var n=e-To,r=t-Io,o=nr(n*n+r*r);vg+=o*(To+e)/2,xg+=o*(Io+t)/2,jl+=o,o=Io*e-To*t,Ix+=o*(To+e),Nx+=o*(Io+t),Gu+=o*3,qa(To=e,Io=t)}function vI(e){this._context=e}vI.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:{this._context.moveTo(e,t),this._point=1;break}case 1:{this._context.lineTo(e,t);break}default:{this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,Fr);break}}},result:wn};var Fx=new vs,X0,xI,wI,Yu,Ku,zd={point:wn,lineStart:function(){zd.point=QX},lineEnd:function(){X0&&SI(xI,wI),zd.point=wn},polygonStart:function(){X0=!0},polygonEnd:function(){X0=null},result:function(){var e=+Fx;return Fx=new vs,e}};function QX(e,t){zd.point=SI,xI=Yu=e,wI=Ku=t}function SI(e,t){Yu-=e,Ku-=t,Fx.add(nr(Yu*Yu+Ku*Ku)),Yu=e,Ku=t}let ok,wg,ik,sk;class ak{constructor(t){this._append=t==null?CI:ZX(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,n){switch(this._point){case 0:{this._append`M${t},${n}`,this._point=1;break}case 1:{this._append`L${t},${n}`;break}default:{if(this._append`M${t},${n}`,this._radius!==ik||this._append!==wg){const r=this._radius,o=this._;this._="",this._append`m0,${r}a${r},${r} 0 1,1 0,${-2*r}a${r},${r} 0 1,1 0,${2*r}z`,ik=r,wg=this._append,sk=this._,this._=o}this._+=sk;break}}}result(){const t=this._;return this._="",t.length?t:null}}function CI(e){let t=1;this._+=e[0];for(const n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function ZX(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return CI;if(t!==ok){const n=10**t;ok=t,wg=function(o){let i=1;this._+=o[0];for(const s=o.length;i<s;++i)this._+=Math.round(arguments[i]*n)/n+o[i]}}return wg}function lk(e,t){let n=3,r=4.5,o,i;function s(a){return a&&(typeof r=="function"&&i.pointRadius(+r.apply(this,arguments)),na(a,o(i))),i.result()}return s.area=function(a){return na(a,o(Si)),Si.result()},s.measure=function(a){return na(a,o(zd)),zd.result()},s.bounds=function(a){return na(a,o(yg)),yg.result()},s.centroid=function(a){return na(a,o(Gr)),Gr.result()},s.projection=function(a){return arguments.length?(o=a==null?(e=null,Px):(e=a).stream,s):e},s.context=function(a){return arguments.length?(i=a==null?(t=null,new ak(n)):new vI(t=a),typeof r!="function"&&i.pointRadius(r),s):t},s.pointRadius=function(a){return arguments.length?(r=typeof a=="function"?a:(i.pointRadius(+a),+a),s):r},s.digits=function(a){if(!arguments.length)return n;if(a==null)n=null;else{const l=Math.floor(a);if(!(l>=0))throw new RangeError(`invalid digits: ${a}`);n=l}return t===null&&(i=new ak(n)),s},s.projection(e).digits(n).context(t)}function xS(e){return function(t){var n=new Lx;for(var r in e)n[r]=e[r];return n.stream=t,n}}function Lx(){}Lx.prototype={constructor:Lx,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function wS(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),na(n,e.stream(yg)),t(yg.result()),r!=null&&e.clipExtent(r),e}function SS(e,t,n){return wS(e,function(r){var o=t[1][0]-t[0][0],i=t[1][1]-t[0][1],s=Math.min(o/(r[1][0]-r[0][0]),i/(r[1][1]-r[0][1])),a=+t[0][0]+(o-s*(r[1][0]+r[0][0]))/2,l=+t[0][1]+(i-s*(r[1][1]+r[0][1]))/2;e.scale(150*s).translate([a,l])},n)}function _I(e,t,n){return SS(e,[[0,0],t],n)}function EI(e,t,n){return wS(e,function(r){var o=+t,i=o/(r[1][0]-r[0][0]),s=(o-i*(r[1][0]+r[0][0]))/2,a=-i*r[0][1];e.scale(150*i).translate([s,a])},n)}function RI(e,t,n){return wS(e,function(r){var o=+t,i=o/(r[1][1]-r[0][1]),s=-i*r[0][0],a=(o-i*(r[1][1]+r[0][1]))/2;e.scale(150*i).translate([s,a])},n)}var ck=16,JX=$e(30*Et);function uk(e,t){return+t?tQ(e,t):eQ(e)}function eQ(e){return xS({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function tQ(e,t){function n(r,o,i,s,a,l,c,u,d,h,f,p,g,m){var b=c-r,v=u-o,x=b*b+v*v;if(x>4*t&&g--){var w=s+h,C=a+f,S=l+p,E=nr(w*w+C*C+S*S),P=Zr(S/=E),M=at(at(S)-1)<ke||at(i-d)<ke?(i+d)/2:Go(C,w),D=e(M,P),A=D[0],I=D[1],$=A-r,j=I-o,T=v*$-b*j;(T*T/x>t||at((b*$+v*j)/x-.5)>.3||s*h+a*f+l*p<JX)&&(n(r,o,i,s,a,l,A,I,M,w/=E,C/=E,S,g,m),m.point(A,I),n(A,I,M,w,C,S,c,u,d,h,f,p,g,m))}}return function(r){var o,i,s,a,l,c,u,d,h,f,p,g,m={point:b,lineStart:v,lineEnd:w,polygonStart:function(){r.polygonStart(),m.lineStart=C},polygonEnd:function(){r.polygonEnd(),m.lineStart=v}};function b(P,M){P=e(P,M),r.point(P[0],P[1])}function v(){d=NaN,m.point=x,r.lineStart()}function x(P,M){var D=Oc([P,M]),A=e(P,M);n(d,h,u,f,p,g,d=A[0],h=A[1],u=P,f=D[0],p=D[1],g=D[2],ck,r),r.point(d,h)}function w(){m.point=b,r.lineEnd()}function C(){v(),m.point=S,m.lineEnd=E}function S(P,M){x(o=P,M),i=d,s=h,a=f,l=p,c=g,m.point=x}function E(){n(d,h,u,f,p,g,i,s,o,a,l,c,ck,r),m.lineEnd=w,w()}return m}}var nQ=xS({point:function(e,t){this.stream.point(e*Et,t*Et)}});function rQ(e){return xS({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function oQ(e,t,n,r,o){function i(s,a){return s*=r,a*=o,[t+e*s,n-e*a]}return i.invert=function(s,a){return[(s-t)/e*r,(n-a)/e*o]},i}function dk(e,t,n,r,o,i){if(!i)return oQ(e,t,n,r,o);var s=$e(i),a=Ie(i),l=s*e,c=a*e,u=s/e,d=a/e,h=(a*n-s*t)/e,f=(a*t+s*n)/e;function p(g,m){return g*=r,m*=o,[l*g-c*m+t,n-c*g-l*m]}return p.invert=function(g,m){return[r*(u*g-d*m+h),o*(f-d*g-u*m)]},p}function zi(e){return kI(function(){return e})()}function kI(e){var t,n=150,r=480,o=250,i=0,s=0,a=0,l=0,c=0,u,d=0,h=1,f=1,p=null,g=YR,m=null,b,v,x,w=Px,C=.5,S,E,P,M,D;function A(T){return P(T[0]*Et,T[1]*Et)}function I(T){return T=P.invert(T[0],T[1]),T&&[T[0]*Qn,T[1]*Qn]}A.stream=function(T){return M&&D===T?M:M=nQ(rQ(u)(g(S(w(D=T)))))},A.preclip=function(T){return arguments.length?(g=T,p=void 0,j()):g},A.postclip=function(T){return arguments.length?(w=T,m=b=v=x=null,j()):w},A.clipAngle=function(T){return arguments.length?(g=+T?DX(p=T*Et):(p=null,YR),j()):p*Qn},A.clipExtent=function(T){return arguments.length?(w=T==null?(m=b=v=x=null,Px):AX(m=+T[0][0],b=+T[0][1],v=+T[1][0],x=+T[1][1]),j()):m==null?null:[[m,b],[v,x]]},A.scale=function(T){return arguments.length?(n=+T,$()):n},A.translate=function(T){return arguments.length?(r=+T[0],o=+T[1],$()):[r,o]},A.center=function(T){return arguments.length?(i=T[0]%360*Et,s=T[1]%360*Et,$()):[i*Qn,s*Qn]},A.rotate=function(T){return arguments.length?(a=T[0]%360*Et,l=T[1]%360*Et,c=T.length>2?T[2]%360*Et:0,$()):[a*Qn,l*Qn,c*Qn]},A.angle=function(T){return arguments.length?(d=T%360*Et,$()):d*Qn},A.reflectX=function(T){return arguments.length?(h=T?-1:1,$()):h<0},A.reflectY=function(T){return arguments.length?(f=T?-1:1,$()):f<0},A.precision=function(T){return arguments.length?(S=uk(E,C=T*T),j()):nr(C)},A.fitExtent=function(T,N){return SS(A,T,N)},A.fitSize=function(T,N){return _I(A,T,N)},A.fitWidth=function(T,N){return EI(A,T,N)},A.fitHeight=function(T,N){return RI(A,T,N)};function $(){var T=dk(n,0,0,h,f,d).apply(null,t(i,s)),N=dk(n,r-T[0],o-T[1],h,f,d);return u=sI(a,l,c),E=Sx(t,N),P=Sx(u,E),S=uk(E,C),j()}function j(){return M=D=null,A}return function(){return t=e.apply(this,arguments),A.invert=t.invert&&I,$()}}function CS(e){var t=0,n=Xe/3,r=kI(e),o=r(t,n);return o.parallels=function(i){return arguments.length?r(t=i[0]*Et,n=i[1]*Et):[t*Qn,n*Qn]},o}function iQ(e){var t=$e(e);function n(r,o){return[r*t,Ie(o)/t]}return n.invert=function(r,o){return[r/t,Zr(o*t)]},n}function sQ(e,t){var n=Ie(e),r=(n+Ie(t))/2;if(at(r)<ke)return iQ(e);var o=1+n*(2*r-n),i=nr(o)/r;function s(a,l){var c=nr(o-2*r*Ie(l))/r;return[c*Ie(a*=r),i-c*$e(a)]}return s.invert=function(a,l){var c=i-l,u=Go(a,at(c))*Yr(c);return c*r<0&&(u-=Xe*Yr(a)*Yr(c)),[u/r,Zr((o-(a*a+c*c)*r*r)/(2*r))]},s}function Sg(){return CS(sQ).scale(155.424).center([0,33.6442])}function PI(){return Sg().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function aQ(e){var t=e.length;return{point:function(n,r){for(var o=-1;++o<t;)e[o].point(n,r)},sphere:function(){for(var n=-1;++n<t;)e[n].sphere()},lineStart:function(){for(var n=-1;++n<t;)e[n].lineStart()},lineEnd:function(){for(var n=-1;++n<t;)e[n].lineEnd()},polygonStart:function(){for(var n=-1;++n<t;)e[n].polygonStart()},polygonEnd:function(){for(var n=-1;++n<t;)e[n].polygonEnd()}}}function lQ(){var e,t,n=PI(),r,o=Sg().rotate([154,0]).center([-2,58.5]).parallels([55,65]),i,s=Sg().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,l,c={point:function(h,f){l=[h,f]}};function u(h){var f=h[0],p=h[1];return l=null,r.point(f,p),l||(i.point(f,p),l)||(a.point(f,p),l)}u.invert=function(h){var f=n.scale(),p=n.translate(),g=(h[0]-p[0])/f,m=(h[1]-p[1])/f;return(m>=.12&&m<.234&&g>=-.425&&g<-.214?o:m>=.166&&m<.234&&g>=-.214&&g<-.115?s:n).invert(h)},u.stream=function(h){return e&&t===h?e:e=aQ([n.stream(t=h),o.stream(h),s.stream(h)])},u.precision=function(h){return arguments.length?(n.precision(h),o.precision(h),s.precision(h),d()):n.precision()},u.scale=function(h){return arguments.length?(n.scale(h),o.scale(h*.35),s.scale(h),u.translate(n.translate())):n.scale()},u.translate=function(h){if(!arguments.length)return n.translate();var f=n.scale(),p=+h[0],g=+h[1];return r=n.translate(h).clipExtent([[p-.455*f,g-.238*f],[p+.455*f,g+.238*f]]).stream(c),i=o.translate([p-.307*f,g+.201*f]).clipExtent([[p-.425*f+ke,g+.12*f+ke],[p-.214*f-ke,g+.234*f-ke]]).stream(c),a=s.translate([p-.205*f,g+.212*f]).clipExtent([[p-.214*f+ke,g+.166*f+ke],[p-.115*f-ke,g+.234*f-ke]]).stream(c),d()},u.fitExtent=function(h,f){return SS(u,h,f)},u.fitSize=function(h,f){return _I(u,h,f)},u.fitWidth=function(h,f){return EI(u,h,f)},u.fitHeight=function(h,f){return RI(u,h,f)};function d(){return e=t=null,u}return u.scale(1070)}function MI(e){return function(t,n){var r=$e(t),o=$e(n),i=e(r*o);return i===1/0?[2,0]:[i*o*Ie(t),i*Ie(n)]}}function Mf(e){return function(t,n){var r=nr(t*t+n*n),o=e(r),i=Ie(o),s=$e(o);return[Go(t*i,r*s),Zr(r&&n*i/r)]}}var DI=MI(function(e){return nr(2/(1+e))});DI.invert=Mf(function(e){return 2*Zr(e/2)});function cQ(){return zi(DI).scale(124.75).clipAngle(180-.001)}var OI=MI(function(e){return(e=iI(e))&&e/Ie(e)});OI.invert=Mf(function(e){return e});function uQ(){return zi(OI).scale(79.4188).clipAngle(180-.001)}function Bm(e,t){return[e,fg(vS((Xt+t)/2))]}Bm.invert=function(e,t){return[e,2*Kc(oI(t))-Xt]};function dQ(){return AI(Bm).scale(961/Fr)}function AI(e){var t=zi(e),n=t.center,r=t.scale,o=t.translate,i=t.clipExtent,s=null,a,l,c;t.scale=function(d){return arguments.length?(r(d),u()):r()},t.translate=function(d){return arguments.length?(o(d),u()):o()},t.center=function(d){return arguments.length?(n(d),u()):n()},t.clipExtent=function(d){return arguments.length?(d==null?s=a=l=c=null:(s=+d[0][0],a=+d[0][1],l=+d[1][0],c=+d[1][1]),u()):s==null?null:[[s,a],[l,c]]};function u(){var d=Xe*r(),h=t(CX(t.rotate()).invert([0,0]));return i(s==null?[[h[0]-d,h[1]-d],[h[0]+d,h[1]+d]]:e===Bm?[[Math.max(h[0]-d,s),a],[Math.min(h[0]+d,l),c]]:[[s,Math.max(h[1]-d,a)],[l,Math.min(h[1]+d,c)]])}return u()}function Wh(e){return vS((Xt+e)/2)}function fQ(e,t){var n=$e(e),r=e===t?Ie(e):fg(n/$e(t))/fg(Wh(t)/Wh(e)),o=n*q0(Wh(e),r)/r;if(!r)return Bm;function i(s,a){o>0?a<-Xt+ke&&(a=-Xt+ke):a>Xt-ke&&(a=Xt-ke);var l=o/q0(Wh(a),r);return[l*Ie(r*s),o-l*$e(r*s)]}return i.invert=function(s,a){var l=o-a,c=Yr(r)*nr(s*s+l*l),u=Go(s,at(l))*Yr(l);return l*r<0&&(u-=Xe*Yr(s)*Yr(l)),[u/r,2*Kc(q0(o/c,1/r))-Xt]},i}function hQ(){return CS(fQ).scale(109.5).parallels([30,30])}function Cg(e,t){return[e,t]}Cg.invert=Cg;function pQ(){return zi(Cg).scale(152.63)}function gQ(e,t){var n=$e(e),r=e===t?Ie(e):(n-$e(t))/(t-e),o=n/r+e;if(at(r)<ke)return Cg;function i(s,a){var l=o-a,c=r*s;return[l*Ie(c),o-l*$e(c)]}return i.invert=function(s,a){var l=o-a,c=Go(s,at(l))*Yr(l);return l*r<0&&(c-=Xe*Yr(s)*Yr(l)),[c/r,o-Yr(r)*nr(s*s+l*l)]},i}function mQ(){return CS(gQ).scale(131.154).center([0,13.9389])}var sd=1.340264,ad=-.081106,ld=893e-6,cd=.003796,_g=nr(3)/2,bQ=12;function TI(e,t){var n=Zr(_g*Ie(t)),r=n*n,o=r*r*r;return[e*$e(n)/(_g*(sd+3*ad*r+o*(7*ld+9*cd*r))),n*(sd+ad*r+o*(ld+cd*r))]}TI.invert=function(e,t){for(var n=t,r=n*n,o=r*r*r,i=0,s,a,l;i<bQ&&(a=n*(sd+ad*r+o*(ld+cd*r))-t,l=sd+3*ad*r+o*(7*ld+9*cd*r),n-=s=a/l,r=n*n,o=r*r*r,!(at(s)<rI));++i);return[_g*e*(sd+3*ad*r+o*(7*ld+9*cd*r))/$e(n),Zr(Ie(n)/_g)]};function yQ(){return zi(TI).scale(177.158)}function II(e,t){var n=$e(t),r=$e(e)*n;return[n*Ie(e)/r,Ie(t)/r]}II.invert=Mf(Kc);function vQ(){return zi(II).scale(144.049).clipAngle(60)}function NI(e,t){var n=t*t,r=n*n;return[e*(.8707-.131979*n+r*(-.013791+r*(.003971*n-.001529*r))),t*(1.007226+n*(.015085+r*(-.044475+.028874*n-.005916*r)))]}NI.invert=function(e,t){var n=t,r=25,o;do{var i=n*n,s=i*i;n-=o=(n*(1.007226+i*(.015085+s*(-.044475+.028874*i-.005916*s)))-t)/(1.007226+i*(.015085*3+s*(-.044475*7+.028874*9*i-.005916*11*s)))}while(at(o)>ke&&--r>0);return[e/(.8707+(i=n*n)*(-.131979+i*(-.013791+i*i*i*(.003971-.001529*i)))),n]};function xQ(){return zi(NI).scale(175.295)}function FI(e,t){return[$e(t)*Ie(e),Ie(t)]}FI.invert=Mf(Zr);function wQ(){return zi(FI).scale(249.5).clipAngle(90+ke)}function LI(e,t){var n=$e(t),r=1+$e(e)*n;return[n*Ie(e)/r,Ie(t)/r]}LI.invert=Mf(function(e){return 2*Kc(e)});function SQ(){return zi(LI).scale(250).clipAngle(142)}function jI(e,t){return[fg(vS((Xt+t)/2)),-e]}jI.invert=function(e,t){return[-t,2*Kc(oI(e))-Xt]};function CQ(){var e=AI(jI),t=e.center,n=e.rotate;return e.center=function(r){return arguments.length?t([-r[1],r[0]]):(r=t(),[r[1],-r[0]])},e.rotate=function(r){return arguments.length?n([r[0],r[1],r.length>2?r[2]+90:90]):(r=n(),[r[0],r[1],r[2]-90])},n([0,0,90]).scale(159.155)}function ht(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(r*6,++r*6);return n}function Vm(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function _S(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Xc(){}var Ga=.7,Ic=1/Ga,Kl="\\s*([+-]?\\d+)\\s*",Bd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Bo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_Q=/^#([0-9a-f]{3,8})$/,EQ=new RegExp(`^rgb\\(${Kl},${Kl},${Kl}\\)$`),RQ=new RegExp(`^rgb\\(${Bo},${Bo},${Bo}\\)$`),kQ=new RegExp(`^rgba\\(${Kl},${Kl},${Kl},${Bd}\\)$`),PQ=new RegExp(`^rgba\\(${Bo},${Bo},${Bo},${Bd}\\)$`),MQ=new RegExp(`^hsl\\(${Bd},${Bo},${Bo}\\)$`),DQ=new RegExp(`^hsla\\(${Bd},${Bo},${Bo},${Bd}\\)$`),fk={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Vm(Xc,ES,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:hk,formatHex:hk,formatHex8:OQ,formatHsl:AQ,formatRgb:pk,toString:pk});function hk(){return this.rgb().formatHex()}function OQ(){return this.rgb().formatHex8()}function AQ(){return zI(this).formatHsl()}function pk(){return this.rgb().formatRgb()}function ES(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=_Q.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?gk(t):n===3?new Vn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Uh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Uh(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=EQ.exec(e))?new Vn(t[1],t[2],t[3],1):(t=RQ.exec(e))?new Vn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=kQ.exec(e))?Uh(t[1],t[2],t[3],t[4]):(t=PQ.exec(e))?Uh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=MQ.exec(e))?yk(t[1],t[2]/100,t[3]/100,1):(t=DQ.exec(e))?yk(t[1],t[2]/100,t[3]/100,t[4]):fk.hasOwnProperty(e)?gk(fk[e]):e==="transparent"?new Vn(NaN,NaN,NaN,0):null}function gk(e){return new Vn(e>>16&255,e>>8&255,e&255,1)}function Uh(e,t,n,r){return r<=0&&(e=t=n=NaN),new Vn(e,t,n,r)}function $I(e){return e instanceof Xc||(e=ES(e)),e?(e=e.rgb(),new Vn(e.r,e.g,e.b,e.opacity)):new Vn}function Vd(e,t,n,r){return arguments.length===1?$I(e):new Vn(e,t,n,r??1)}function Vn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Vm(Vn,Vd,_S(Xc,{brighter(e){return e=e==null?Ic:Math.pow(Ic,e),new Vn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ga:Math.pow(Ga,e),new Vn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Vn(Oa(this.r),Oa(this.g),Oa(this.b),Eg(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:mk,formatHex:mk,formatHex8:TQ,formatRgb:bk,toString:bk}));function mk(){return`#${ua(this.r)}${ua(this.g)}${ua(this.b)}`}function TQ(){return`#${ua(this.r)}${ua(this.g)}${ua(this.b)}${ua((isNaN(this.opacity)?1:this.opacity)*255)}`}function bk(){const e=Eg(this.opacity);return`${e===1?"rgb(":"rgba("}${Oa(this.r)}, ${Oa(this.g)}, ${Oa(this.b)}${e===1?")":`, ${e})`}`}function Eg(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Oa(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ua(e){return e=Oa(e),(e<16?"0":"")+e.toString(16)}function yk(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new lo(e,t,n,r)}function zI(e){if(e instanceof lo)return new lo(e.h,e.s,e.l,e.opacity);if(e instanceof Xc||(e=ES(e)),!e)return new lo;if(e instanceof lo)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,a=i-o,l=(i+o)/2;return a?(t===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-t)/a+2:s=(t-n)/a+4,a/=l<.5?i+o:2-i-o,s*=60):a=l>0&&l<1?0:s,new lo(s,a,l,e.opacity)}function IQ(e,t,n,r){return arguments.length===1?zI(e):new lo(e,t,n,r??1)}function lo(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Vm(lo,IQ,_S(Xc,{brighter(e){return e=e==null?Ic:Math.pow(Ic,e),new lo(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ga:Math.pow(Ga,e),new lo(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new Vn(Q0(e>=240?e-240:e+120,o,r),Q0(e,o,r),Q0(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new lo(vk(this.h),qh(this.s),qh(this.l),Eg(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Eg(this.opacity);return`${e===1?"hsl(":"hsla("}${vk(this.h)}, ${qh(this.s)*100}%, ${qh(this.l)*100}%${e===1?")":`, ${e})`}`}}));function vk(e){return e=(e||0)%360,e<0?e+360:e}function qh(e){return Math.max(0,Math.min(1,e||0))}function Q0(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const NQ=Math.PI/180,FQ=180/Math.PI;var BI=-.14861,RS=1.78277,kS=-.29227,Hm=-.90649,Hd=1.97294,xk=Hd*Hm,wk=Hd*RS,Sk=RS*kS-Hm*BI;function LQ(e){if(e instanceof Aa)return new Aa(e.h,e.s,e.l,e.opacity);e instanceof Vn||(e=$I(e));var t=e.r/255,n=e.g/255,r=e.b/255,o=(Sk*r+xk*t-wk*n)/(Sk+xk-wk),i=r-o,s=(Hd*(n-o)-kS*i)/Hm,a=Math.sqrt(s*s+i*i)/(Hd*o*(1-o)),l=a?Math.atan2(s,i)*FQ-120:NaN;return new Aa(l<0?l+360:l,a,o,e.opacity)}function Yo(e,t,n,r){return arguments.length===1?LQ(e):new Aa(e,t,n,r??1)}function Aa(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Vm(Aa,Yo,_S(Xc,{brighter(e){return e=e==null?Ic:Math.pow(Ic,e),new Aa(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ga:Math.pow(Ga,e),new Aa(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*NQ,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),o=Math.sin(e);return new Vn(255*(t+n*(BI*r+RS*o)),255*(t+n*(kS*r+Hm*o)),255*(t+n*(Hd*r)),this.opacity)}}));function jQ(e,t,n,r,o){var i=e*e,s=i*e;return((1-3*e+3*i-s)*t+(4-6*i+3*s)*n+(1+3*e+3*i-3*s)*r+s*o)/6}function $Q(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),o=e[r],i=e[r+1],s=r>0?e[r-1]:2*o-i,a=r<t-1?e[r+2]:2*i-o;return jQ((n-r/t)*t,s,o,i,a)}}const PS=e=>()=>e;function VI(e,t){return function(n){return e+n*t}}function zQ(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function BQ(e,t){var n=t-e;return n?VI(e,n>180||n<-180?n-360*Math.round(n/360):n):PS(isNaN(e)?t:e)}function VQ(e){return(e=+e)==1?Xl:function(t,n){return n-t?zQ(t,n,e):PS(isNaN(t)?n:t)}}function Xl(e,t){var n=t-e;return n?VI(e,n):PS(isNaN(e)?t:e)}(function e(t){var n=VQ(t);function r(o,i){var s=n((o=Vd(o)).r,(i=Vd(i)).r),a=n(o.g,i.g),l=n(o.b,i.b),c=Xl(o.opacity,i.opacity);return function(u){return o.r=s(u),o.g=a(u),o.b=l(u),o.opacity=c(u),o+""}}return r.gamma=e,r})(1);function HQ(e){return function(t){var n=t.length,r=new Array(n),o=new Array(n),i=new Array(n),s,a;for(s=0;s<n;++s)a=Vd(t[s]),r[s]=a.r||0,o[s]=a.g||0,i[s]=a.b||0;return r=e(r),o=e(o),i=e(i),a.opacity=1,function(l){return a.r=r(l),a.g=o(l),a.b=i(l),a+""}}}var WQ=HQ($Q);function HI(e){return function t(n){n=+n;function r(o,i){var s=e((o=Yo(o)).h,(i=Yo(i)).h),a=Xl(o.s,i.s),l=Xl(o.l,i.l),c=Xl(o.opacity,i.opacity);return function(u){return o.h=s(u),o.s=a(u),o.l=l(Math.pow(u,n)),o.opacity=c(u),o+""}}return r.gamma=t,r}(1)}HI(BQ);var MS=HI(Xl);const Mt=e=>WQ(e[e.length-1]);var UQ=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(ht);const qQ=Mt(UQ);var GQ=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(ht);const YQ=Mt(GQ);var KQ=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(ht);const XQ=Mt(KQ);var QQ=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(ht);const ZQ=Mt(QQ);var JQ=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(ht);const eZ=Mt(JQ);var tZ=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(ht);const nZ=Mt(tZ);var rZ=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(ht);const oZ=Mt(rZ);var iZ=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(ht);const sZ=Mt(iZ);var aZ=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(ht);const lZ=Mt(aZ);var cZ=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(ht);const uZ=Mt(cZ);var dZ=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(ht);const fZ=Mt(dZ);var hZ=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(ht);const pZ=Mt(hZ);var gZ=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(ht);const mZ=Mt(gZ);var bZ=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(ht);const yZ=Mt(bZ);var vZ=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(ht);const xZ=Mt(vZ);var wZ=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(ht);const SZ=Mt(wZ);var CZ=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(ht);const _Z=Mt(CZ);var EZ=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(ht);const RZ=Mt(EZ);var kZ=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(ht);const PZ=Mt(kZ);var MZ=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(ht);const DZ=Mt(MZ);var OZ=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(ht);const AZ=Mt(OZ);var TZ=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(ht);const IZ=Mt(TZ);var NZ=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(ht);const FZ=Mt(NZ);var LZ=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(ht);const jZ=Mt(LZ);var $Z=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(ht);const zZ=Mt($Z);var BZ=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(ht);const VZ=Mt(BZ);var HZ=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(ht);const WZ=Mt(HZ);function UZ(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-e*(35.34-e*(2381.73-e*(6402.7-e*(7024.72-e*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+e*(170.73+e*(52.82-e*(131.46-e*(176.58-e*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+e*(442.36-e*(2482.43-e*(6167.24-e*(6614.94-e*2475.67)))))))+")"}const qZ=MS(Yo(300,.5,0),Yo(-240,.5,1));var GZ=MS(Yo(-100,.75,.35),Yo(80,1.5,.8)),YZ=MS(Yo(260,.75,.35),Yo(80,1.5,.8)),Gh=Yo();function KZ(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return Gh.h=360*e-100,Gh.s=1.5-1.5*t,Gh.l=.8-.9*t,Gh+""}var Yh=Vd(),XZ=Math.PI/3,QZ=Math.PI*2/3;function ZZ(e){var t;return e=(.5-e)*Math.PI,Yh.r=255*(t=Math.sin(e))*t,Yh.g=255*(t=Math.sin(e+XZ))*t,Yh.b=255*(t=Math.sin(e+QZ))*t,Yh+""}function JZ(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-e*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+e*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-e*6838.66)))))))+")"}function Wm(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}const eJ=Wm(ht("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));var tJ=Wm(ht("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),nJ=Wm(ht("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),rJ=Wm(ht("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function oJ(e){return e}function iJ(e){if(e==null)return oJ;var t,n,r=e.scale[0],o=e.scale[1],i=e.translate[0],s=e.translate[1];return function(a,l){l||(t=n=0);var c=2,u=a.length,d=new Array(u);for(d[0]=(t+=a[0])*r+i,d[1]=(n+=a[1])*o+s;c<u;)d[c]=a[c],++c;return d}}function sJ(e,t){for(var n,r=e.length,o=r-t;o<--r;)n=e[o],e[o++]=e[r],e[r]=n}function aJ(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(n){return Ck(e,n)})}:Ck(e,t)}function Ck(e,t){var n=t.id,r=t.bbox,o=t.properties==null?{}:t.properties,i=lJ(e,t);return n==null&&r==null?{type:"Feature",properties:o,geometry:i}:r==null?{type:"Feature",id:n,properties:o,geometry:i}:{type:"Feature",id:n,bbox:r,properties:o,geometry:i}}function lJ(e,t){var n=iJ(e.transform),r=e.arcs;function o(u,d){d.length&&d.pop();for(var h=r[u<0?~u:u],f=0,p=h.length;f<p;++f)d.push(n(h[f],f));u<0&&sJ(d,p)}function i(u){return n(u)}function s(u){for(var d=[],h=0,f=u.length;h<f;++h)o(u[h],d);return d.length<2&&d.push(d[0]),d}function a(u){for(var d=s(u);d.length<4;)d.push(d[0]);return d}function l(u){return u.map(a)}function c(u){var d=u.type,h;switch(d){case"GeometryCollection":return{type:d,geometries:u.geometries.map(c)};case"Point":h=i(u.coordinates);break;case"MultiPoint":h=u.coordinates.map(i);break;case"LineString":h=s(u.arcs);break;case"MultiLineString":h=u.arcs.map(s);break;case"Polygon":h=l(u.arcs);break;case"MultiPolygon":h=u.arcs.map(l);break;default:return null}return{type:d,coordinates:h}}return c(t)}const ud={geoAzimuthalEqualArea:cQ,geoAzimuthalEquidistant:uQ,geoGnomonic:vQ,geoOrthographic:wQ,geoStereographic:SQ,geoEqualEarth:yQ,geoAlbers:PI,geoAlbersUsa:lQ,geoConicConformal:hQ,geoConicEqualArea:Sg,geoConicEquidistant:mQ,geoEquirectangular:pQ,geoMercator:dQ,geoTransverseMercator:CQ,geoNaturalEarth1:xQ};Object.keys(ud).forEach(e=>{ud[`${e.charAt(3).toLowerCase()}${e.slice(4)}`]=ud[e]});class ll extends Os{constructor(t){super(t),this.outlineBounds=null,this.oldChartBounds=null,this.geoPath=lk()}init(t){t.position="chartArea",super.init(t),typeof t.projection=="function"?this.projection=t.projection:this.projection=(ud[t.projection]||ud.albersUsa)(),this.geoPath.projection(this.projection),this.outlineBounds=null,this.oldChartBounds=null}computeBounds(t){const n=lk(this.projection.fitWidth(1e3,t)).bounds(t),r=Math.ceil(n[1][1]-n[0][1]),o=Math.ceil(n[1][0]-n[0][0]),i=this.projection.translate();this.outlineBounds={width:o,height:r,aspectRatio:o/r,refScale:this.projection.scale(),refX:i[0],refY:i[1]}}updateBounds(){const t=this.chart.chartArea,n=this.outlineBounds;if(!n)return!1;const r=this.options.padding,o=typeof r=="number"?r:r.top,i=typeof r=="number"?r:r.left,s=typeof r=="number"?r:r.bottom,a=typeof r=="number"?r:r.right,l=t.right-t.left-i-a,c=t.bottom-t.top-o-s,u=this.oldChartBounds;this.oldChartBounds={chartWidth:l,chartHeight:c};const d=Math.min(l/n.width,c/n.height),h=n.width*d,f=n.height*d,p=(l-h)*.5+t.left+i,g=(c-f)*.5+t.top+o,m=this.options;return this.projection.scale(n.refScale*d*m.projectionScale).translate([d*n.refX+p+m.projectionOffset[0],d*n.refY+g+m.projectionOffset[1]]),!u||u.chartWidth!==this.oldChartBounds.chartWidth||u.chartHeight!==this.oldChartBounds.chartHeight}}ll.id="projection";ll.defaults={projection:"albersUsa",projectionScale:1,projectionOffset:[0,0],padding:0};ll.descriptors={_scriptable:e=>e!=="projection",_indexable:e=>e!=="projectionOffset"};const Um={position:"chartArea",property:"value",grid:{z:1,drawOnChartArea:!1},ticks:{z:1},legend:{align:"right",position:"bottom-right",length:100,width:50,margin:8,indicatorWidth:10}};function cJ(e){const{indicatorWidth:t,align:n,margin:r}=e,o=(typeof r=="number"?r:r.left)+(n==="right"?t:0),i=(typeof r=="number"?r:r.top)+(n==="bottom"?t:0),s=(typeof r=="number"?r:r.right)+(n==="left"?t:0),a=(typeof r=="number"?r:r.bottom)+(n==="top"?t:0);return{left:o,top:i,right:s,bottom:a}}function uJ(e,t,n,r,o){const{indicatorWidth:i,align:s,position:a}=t,l=s==="top"||s==="bottom",c=(s==="left"?o.w:n)+(l?i:0),u=(s==="top"?o.h:r)+(l?0:i),d=cJ(t);if(typeof a=="string")switch(a){case"top-left":return[d.left,d.top];case"top":return[(e.right-c)/2,d.top];case"left":return[d.left,(e.bottom-u)/2];case"top-right":return[e.right-c-d.right,d.top];case"bottom-right":return[e.right-c-d.right,e.bottom-u-d.bottom];case"bottom":return[(e.right-c)/2,e.bottom-u-d.bottom];case"bottom-left":return[d.left,e.bottom-u-d.bottom];default:return[e.right-c-d.right,(e.bottom-u)/2]}return[a.x,a.y]}class $l extends Ua{constructor(){super(...arguments),this.legendSize={w:0,h:0}}init(t){t.position="chartArea",super.init(t),this.axis="r"}parse(t,n){return t&&typeof t[this.options.property]=="number"?t[this.options.property]:super.parse(t,n)}isHorizontal(){return this.options.legend.align==="top"||this.options.legend.align==="bottom"}_getNormalizedValue(t){return t==null||Number.isNaN(t)?null:(t-this._startValue)/this._valueRange}update(t,n,r){const o=Math.min(n,this.bottom==null?Number.POSITIVE_INFINITY:this.bottom),i=Math.min(t,this.right==null?Number.POSITIVE_INFINITY:this.right),s=this.options.legend,a=this.isHorizontal(),l=(f,p)=>f<1?p*f:f,c=Math.min(i,l(a?s.length:s.width,i))-(a?0:s.indicatorWidth),u=Math.min(o,l(a?s.width:s.length,o))-(a?s.indicatorWidth:0);this.legendSize={w:c,h:u},this.bottom=u,this.height=u,this.right=c,this.width=c;const d=this.options.position;this.options.position=this.options.legend.align;const h=super.update(c,u,r);return this.options.position=d,this.height=Math.min(u,this.height),this.width=Math.min(c,this.width),h}_computeLabelArea(){}draw(t){if(!this._isVisible())return;const n=uJ(t,this.options.legend,this.width,this.height,this.legendSize),{ctx:r}=this;r.save(),r.translate(n[0],n[1]);const o=this.options.position;this.options.position=this.options.legend.align,super.draw({...t,bottom:this.height+10,right:this.width}),this.options.position=o;const{indicatorWidth:i}=this.options.legend;switch(this.options.legend.align){case"left":r.translate(this.legendSize.w,0);break;case"top":r.translate(0,this.legendSize.h);break;case"bottom":r.translate(0,-i);break;default:r.translate(-i,0);break}this._drawIndicator(),r.restore()}_drawIndicator(){}}class WI extends Dc{constructor(){super(...arguments),this.legendSize={w:0,h:0}}init(t){$l.prototype.init.call(this,t)}parse(t,n){return $l.prototype.parse.call(this,t,n)}isHorizontal(){return this.options.legend.align==="top"||this.options.legend.align==="bottom"}_getNormalizedValue(t){return t==null||Number.isNaN(t)?null:(Math.log10(t)-this._startValue)/this._valueRange}update(t,n,r){return $l.prototype.update.call(this,t,n,r)}_computeLabelArea(){}draw(t){return $l.prototype.draw.call(this,t)}_drawIndicator(){}}const Ci={interpolateBlues:IZ,interpolateBrBG:qQ,interpolateBuGn:uZ,interpolateBuPu:fZ,interpolateCividis:UZ,interpolateCool:YZ,interpolateCubehelixDefault:qZ,interpolateGnBu:pZ,interpolateGreens:FZ,interpolateGreys:jZ,interpolateInferno:nJ,interpolateMagma:tJ,interpolateOrRd:mZ,interpolateOranges:WZ,interpolatePRGn:YQ,interpolatePiYG:XQ,interpolatePlasma:rJ,interpolatePuBu:xZ,interpolatePuBuGn:yZ,interpolatePuOr:ZQ,interpolatePuRd:SZ,interpolatePurples:zZ,interpolateRainbow:KZ,interpolateRdBu:eZ,interpolateRdGy:nZ,interpolateRdPu:_Z,interpolateRdYlBu:oZ,interpolateRdYlGn:sZ,interpolateReds:VZ,interpolateSinebow:ZZ,interpolateSpectral:lZ,interpolateTurbo:JZ,interpolateViridis:eJ,interpolateWarm:GZ,interpolateYlGn:PZ,interpolateYlGnBu:RZ,interpolateYlOrBr:DZ,interpolateYlOrRd:AZ};Object.keys(Ci).forEach(e=>{Ci[`${e.charAt(11).toLowerCase()}${e.slice(12)}`]=Ci[e],Ci[e.slice(11)]=Ci[e]});function UI(e,t){const n=1/t;if(e<=n)return 0;if(e>=1-n)return 1;for(let r=0;r<1;r+=n)if(e<r)return r-n/2;return e}const qI={interpolate:"blues",missing:"transparent",quantize:0};class xs extends $l{get interpolate(){const t=this.options;return t?typeof t.interpolate=="function"?t.interpolate:Ci[t.interpolate]||Ci.blues:n=>`rgb(${n},${n},${n})`}getColorForValue(t){const n=this._getNormalizedValue(t);return n==null||Number.isNaN(n)?this.options.missing:this.getColor(n)}getColor(t){let n=t;return this.options.quantize>0&&(n=UI(n,this.options.quantize)),this.interpolate(n)}_drawIndicator(){const{indicatorWidth:t}=this.options.legend,n=this._reversePixels;if(this.isHorizontal()){const r=this.width;if(this.options.quantize>0){const o=r/this.options.quantize,i=n?s=>r-o-s:s=>s;for(let s=0;s<r;s+=o){const a=(s+o/2)/r;this.ctx.fillStyle=this.getColor(a),this.ctx.fillRect(i(s),0,o,t)}}else{const o=n?i=>r-1-i:i=>i;for(let i=0;i<r;i+=1)this.ctx.fillStyle=this.getColor((i+.5)/r),this.ctx.fillRect(o(i),0,1,t)}}else{const r=this.height;if(this.options.quantize>0){const o=r/this.options.quantize,i=n?s=>r-o-s:s=>s;for(let s=0;s<r;s+=o){const a=(s+o/2)/r;this.ctx.fillStyle=this.getColor(a),this.ctx.fillRect(0,i(s),t,o)}}else{const o=n?i=>r-1-i:i=>i;for(let i=0;i<r;i+=1)this.ctx.fillStyle=this.getColor((i+.5)/r),this.ctx.fillRect(0,o(i),t,1)}}}}xs.id="color";xs.defaults=fn({},[Ua.defaults,Um,qI]);xs.descriptors={_scriptable:e=>e!=="interpolate",_indexable:!1};class DS extends WI{constructor(){super(...arguments),this.interpolate=t=>`rgb(${t},${t},${t})`}init(t){super.init(t),typeof t.interpolate=="function"?this.interpolate=t.interpolate:this.interpolate=Ci[t.interpolate]||Ci.blues}getColorForValue(t){return xs.prototype.getColorForValue.call(this,t)}getColor(t){let n=t;return this.options.quantize>0&&(n=UI(n,this.options.quantize)),this.interpolate(n)}_drawIndicator(){return xs.prototype._drawIndicator.call(this)}}DS.id="colorLogarithmic";DS.defaults=fn({},[Dc.defaults,Um,qI]);DS.descriptors={_scriptable:e=>e!=="interpolate",_indexable:!1};const GI={missing:1,mode:"area",range:[2,20],legend:{align:"bottom",length:90,width:70,indicatorWidth:42}};class ws extends $l{constructor(){super(...arguments),this._model=null}getSizeForValue(t){const n=this._getNormalizedValue(t);return n==null||Number.isNaN(n)?this.options.missing:this.getSizeImpl(n)}getSizeImpl(t){const[n,r]=this.options.range;if(this.options.mode==="area"){const i=r*r*Math.PI,s=n*n*Math.PI,a=i-s,l=t*a+s;return Math.sqrt(l/Math.PI)}const o=r-n;return t*o+n}_drawIndicator(){const{ctx:t}=this,n=this.options.legend.indicatorWidth/2,r=this.isHorizontal(),o=this.ticks,i=this.getLabelItems(),s=i?i.map(a=>({[r?"x":"y"]:a.options.translation[r?0:1]})):o.map((a,l)=>({[r?"x":"y"]:this.getPixelForTick(l)}));if((this._gridLineItems||[]).forEach(a=>{if(t.save(),t.strokeStyle=a.color,t.lineWidth=a.width,t.setLineDash&&(t.setLineDash(a.borderDash),t.lineDashOffset=a.borderDashOffset),t.beginPath(),this.options.grid.drawTicks)switch(this.options.legend.align){case"left":t.moveTo(0,a.ty1),t.lineTo(n,a.ty2);break;case"top":t.moveTo(a.tx1,0),t.lineTo(a.tx2,n);break;case"bottom":t.moveTo(a.tx1,n),t.lineTo(a.tx2,n*2);break;default:t.moveTo(n,a.ty1),t.lineTo(n*2,a.ty2);break}t.stroke(),t.restore()}),this._model){const a=this._model;t.strokeStyle=a.borderColor,t.lineWidth=a.borderWidth||0,t.fillStyle=a.backgroundColor}else t.fillStyle="blue";o.forEach((a,l)=>{const c=s[l],u=this.getSizeForValue(a.value),d=r?c.x:n,h=r?n:c.y,f={pointStyle:"circle",borderWidth:0,...this._model||{},radius:u};ag(t,f,d,h)})}}ws.id="size";ws.defaults=fn({},[Ua.defaults,Um,GI]);ws.descriptors={_scriptable:!0,_indexable:e=>e!=="range"};class YI extends WI{constructor(){super(...arguments),this._model=null}getSizeForValue(t){const n=this._getNormalizedValue(t);return n==null||Number.isNaN(n)?this.options.missing:this.getSizeImpl(n)}getSizeImpl(t){return ws.prototype.getSizeImpl.call(this,t)}_drawIndicator(){ws.prototype._drawIndicator.call(this)}}YI.id="sizeLogarithmic";YI.defaults=fn({},[Dc.defaults,Um,GI]);function dJ(e,t){return[[e[0][0]-t,e[0][1]-t],[e[1][0]+t,e[1][1]+t]]}class Li extends ri{constructor(){super(...arguments),this.cache=void 0}inRange(t,n){const r=this.getBounds(),o=(Number.isNaN(t)||t>=r.x&&t<=r.x2)&&(Number.isNaN(n)||n>=r.y&&n<=r.y2),i=this.projectionScale.geoPath.projection();if(o&&!Number.isNaN(t)&&!Number.isNaN(n)&&typeof i.invert=="function"){const s=i.invert([t,n]);return s!=null&&zX(this.feature,s)}return o}inXRange(t){return this.inRange(t,Number.NaN)}inYRange(t){return this.inRange(Number.NaN,t)}getCenterPoint(){if(this.cache&&this.cache.center)return this.cache.center;let t;if(this.center){const n=this.projectionScale.projection([this.center.longitude,this.center.latitude]);t={x:n[0],y:n[1]}}else{const n=this.projectionScale.geoPath.centroid(this.feature);t={x:n[0],y:n[1]}}return this.cache={...this.cache||{},center:t},t}getBounds(){if(this.cache&&this.cache.bounds)return this.cache.bounds;const t=dJ(this.projectionScale.geoPath.bounds(this.feature),this.options.borderWidth/2),n={x:t[0][0],x2:t[1][0],y:t[0][1],y2:t[1][1],width:t[1][0]-t[0][0],height:t[1][1]-t[0][1]};return this.cache={...this.cache||{},bounds:n},n}_drawInCache(t){const n=this.getBounds();if(!Number.isFinite(n.x))return;const r=this.cache&&this.cache.canvas?this.cache.canvas:t.createElement("canvas"),o=Math.floor(n.x),i=Math.floor(n.y),s=Math.ceil(n.x+n.width),a=Math.ceil(n.y+n.height),l=this.pixelRatio||1,c=Math.ceil(Math.max(s-o,1)*l),u=Math.ceil(Math.max(a-i,1)*l);if(c<=0||u<=0)return;r.width=c,r.height=u;const d=r.getContext("2d");d&&(d.clearRect(0,0,r.width,r.height),d.save(),d.scale(l,l),d.translate(-o,-i),this._drawImpl(d),d.restore(),this.cache={...this.cache||{},canvas:r,canvasKey:this._optionsToKey()})}_optionsToKey(){const{options:t}=this;return`${t.backgroundColor};${t.borderColor};${t.borderWidth};${this.pixelRatio}`}_drawImpl(t){const{feature:n}=this,{options:r}=this;t.beginPath(),this.projectionScale.geoPath.context(t)(n),r.backgroundColor&&(t.fillStyle=r.backgroundColor,t.fill()),r.borderColor&&(t.strokeStyle=r.borderColor,t.lineWidth=r.borderWidth,t.stroke())}draw(t){const{feature:n}=this;if(!n)return;(!this.cache||this.cache.canvasKey!==this._optionsToKey())&&t.canvas.ownerDocument!=null&&this._drawInCache(t.canvas.ownerDocument);const r=this.getBounds();if(this.cache&&this.cache.canvas&&this.cache.canvas.width>0&&this.cache.canvas.height>0){const o=Math.floor(r.x),i=Math.floor(r.y),s=Math.ceil(r.x+r.width),a=Math.ceil(r.y+r.height),l=s-o,c=a-i;l>0&&c>0&&t.drawImage(this.cache.canvas,o,i,s-o,a-i)}else Number.isFinite(r.x)&&(t.save(),this._drawImpl(t),t.restore())}}Li.id="geoFeature";Li.defaults={...zo.defaults,outlineBackgroundColor:null,outlineBorderWidth:0,graticuleBorderColor:"#CCCCCC",graticuleBorderWidth:0};Li.defaultRoutes={outlineBorderColor:"borderColor",...zo.defaultRoutes||{}};const KI={showOutline:!1,showGraticule:!1,clipMap:!0},XI={scales:{projection:{axis:"x",type:ll.id,position:"chartArea",display:!1}}};function _k(e){const t={...e};return Object.keys(e).forEach(n=>{let r=n;if(n.startsWith("outline")){const o=n.slice(7);r=o[0].toLowerCase()+o.slice(1)}else if(n.startsWith("hoverOutline"))r=`hover${n.slice(12)}`;else return;delete t[n],t[r]=e[n]}),t}class QI extends Kr{getGeoDataset(){return super.getDataset()}getGeoOptions(){return this.chart.options}getProjectionScale(){return this.getScaleForId("projection")}linkScales(){const t=this.getGeoDataset(),n=this.getMeta();n.xAxisID="projection",t.xAxisID="projection",n.yAxisID="projection",t.yAxisID="projection",n.xScale=this.getScaleForId("projection"),n.yScale=this.getScaleForId("projection"),this.getProjectionScale().computeBounds(this.resolveOutline())}showOutline(){return Ae(this.getGeoDataset().showOutline,this.getGeoOptions().showOutline)}clipMap(){return Ae(this.getGeoDataset().clipMap,this.getGeoOptions().clipMap)}getGraticule(){return Ae(this.getGeoDataset().showGraticule,this.getGeoOptions().showGraticule)}update(t){super.update(t);const n=this.getMeta(),r=this.getProjectionScale(),o=r.updateBounds();if(this.showOutline()){const i=n.dataset;if(o&&delete i.cache,i.projectionScale=r,i.pixelRatio=this.chart.currentDevicePixelRatio,t!=="resize"){const s=_k(this.resolveDatasetElementOptions(t)),a={feature:this.resolveOutline(),options:s};this.updateElement(i,void 0,a,t),this.getGraticule()&&(n.graticule=s)}}else this.getGraticule()&&t!=="resize"&&(n.graticule=_k(this.resolveDatasetElementOptions(t)));this.updateElements(n.data,0,n.data.length,t),o&&n.data.forEach(i=>delete i.cache)}resolveOutline(){const n=this.getGeoDataset().outline||{type:"Sphere"};return Array.isArray(n)?{type:"FeatureCollection",features:n}:n}showGraticule(){const t=this.getGraticule(),n=this.getMeta().graticule;if(!t||!n)return;const{ctx:r}=this.chart,i=this.getProjectionScale().geoPath.context(r);if(r.save(),r.beginPath(),typeof t=="boolean")t&&i(BX());else{const s=fI();t.stepMajor&&s.stepMajor(t.stepMajor),t.stepMinor&&s.stepMinor(t.stepMinor),i(s())}r.strokeStyle=n.graticuleBorderColor,r.lineWidth=n.graticuleBorderWidth,r.stroke(),r.restore()}draw(){const{chart:t}=this,n=this.clipMap();let r=!1;(n===!0||n==="outline"||n==="outline+graticule")&&(r=!0,Ea(t.ctx,t.chartArea)),this.showOutline()&&this.getMeta().dataset&&this.getMeta().dataset.draw.call(this.getMeta().dataset,t.ctx,t.chartArea),n===!0||n==="graticule"||n==="outline+graticule"?r||Ea(t.ctx,t.chartArea):r&&(r=!1,Ra(t.ctx)),this.showGraticule(),n===!0||n==="items"?r||Ea(t.ctx,t.chartArea):r&&(r=!1,Ra(t.ctx)),this.getMeta().data.forEach(o=>o.draw.call(o,t.ctx,t.chartArea)),r&&(r=!1,Ra(t.ctx))}}function ZI(e,t,n,r=[],o=[]){ln.addControllers(n),Array.isArray(r)?ln.addElements(...r):ln.addElements(r),Array.isArray(o)?ln.addScales(...o):ln.addScales(o);const i=t;return i.type=e,i}class Qc extends QI{initialize(){super.initialize(),this.enableOptionSharing=!0}linkScales(){super.linkScales();const t=this.getGeoDataset(),n=this.getMeta();n.vAxisID="color",n.rAxisID="color",t.vAxisID="color",t.rAxisID="color",n.rScale=this.getScaleForId("color"),n.vScale=n.rScale,n.iScale=n.xScale,n.iAxisID=n.xAxisID,t.iAxisID=n.xAxisID}_getOtherScale(t){return t}parse(t,n){const r=this.getMeta().rScale,{data:o}=this.getDataset(),i=this._cachedMeta;for(let s=t;s<t+n;s+=1)i._parsed[s]={[r.axis]:r.parse(o[s],s)}}updateElements(t,n,r,o){const i=this.resolveDataElementOptions(n,o),s=this.getSharedOptions(i),a=this.includeOptions(o,s),l=this.getProjectionScale();this.updateSharedOptions(s,o,i);for(let c=n;c<n+r;c+=1){const u=t[c];u.projectionScale=l,u.feature=this._data[c].feature,u.center=this._data[c].center,u.pixelRatio=this.chart.currentDevicePixelRatio;const d=u.getCenterPoint(),h={x:d.x,y:d.y};a&&(h.options=s||this.resolveDataElementOptions(c,o)),this.updateElement(u,c,h,o)}}indexToColor(t){const n=this.getMeta().rScale;return n.getColorForValue(this.getParsed(t)[n.axis])}}Qc.id="choropleth";Qc.defaults=fn({},[KI,{datasetElementType:Li.id,dataElementType:Li.id}]);Qc.overrides=fn({},[XI,{plugins:{tooltip:{callbacks:{title(){return""},label(e){var t,n,r,o;return e.formattedValue==null?(n=(t=e.chart.data)===null||t===void 0?void 0:t.labels)===null||n===void 0?void 0:n[e.dataIndex]:`${(o=(r=e.chart.data)===null||r===void 0?void 0:r.labels)===null||o===void 0?void 0:o[e.dataIndex]}: ${e.formattedValue}`}}},colors:{enabled:!1}},scales:{color:{type:xs.id,axis:"x"}},elements:{geoFeature:{backgroundColor(e){return e.dataIndex==null?null:e.chart.getDatasetMeta(e.datasetIndex).controller.indexToColor(e.dataIndex)}}}}]);class fJ extends Pt{constructor(t,n){super(t,ZI("choropleth",n,Qc,Li,[xs,ll]))}}fJ.id=Qc.id;class Zc extends QI{initialize(){super.initialize(),this.enableOptionSharing=!0}linkScales(){super.linkScales();const t=this.getGeoDataset(),n=this.getMeta();n.vAxisID="size",n.rAxisID="size",t.vAxisID="size",t.rAxisID="size",n.rScale=this.getScaleForId("size"),n.vScale=n.rScale,n.iScale=n.xScale,n.iAxisID=n.xAxisID,t.iAxisID=n.xAxisID}_getOtherScale(t){return t}parse(t,n){const r=this.getMeta().rScale,o=this.getDataset().data,i=this._cachedMeta;for(let s=t;s<t+n;s+=1){const a=o[s];i._parsed[s]={x:a.longitude==null?a.x:a.longitude,y:a.latitude==null?a.y:a.latitude,[r.axis]:r.parse(a,s)}}}updateElements(t,n,r,o){const i=o==="reset",s=this.resolveDataElementOptions(n,o),a=this.getSharedOptions(s),l=this.includeOptions(o,a),c=this.getProjectionScale();this.getMeta().rScale._model=s,this.updateSharedOptions(a,o,s);for(let u=n;u<n+r;u+=1){const d=t[u],h=this.getParsed(u),f=c.projection([h.x,h.y]),p={x:f?f[0]:0,y:f?f[1]:0,skip:Number.isNaN(h.x)||Number.isNaN(h.y)};l&&(p.options=a||this.resolveDataElementOptions(u,o),i&&(p.options.radius=0)),this.updateElement(d,u,p,o)}}indexToRadius(t){const n=this.getMeta().rScale;return n.getSizeForValue(this.getParsed(t)[n.axis])}}Zc.id="bubbleMap";Zc.defaults=fn({},[KI,{dataElementType:Da.id,datasetElementType:Li.id,showOutline:!0,clipMap:"outline+graticule"}]);Zc.overrides=fn({},[XI,{plugins:{tooltip:{callbacks:{title(){return""},label(e){var t,n,r,o;return e.formattedValue==null?(n=(t=e.chart.data)===null||t===void 0?void 0:t.labels)===null||n===void 0?void 0:n[e.dataIndex]:`${(o=(r=e.chart.data)===null||r===void 0?void 0:r.labels)===null||o===void 0?void 0:o[e.dataIndex]}: ${e.formattedValue}`}}}},scales:{size:{axis:"x",type:ws.id}},elements:{point:{radius(e){return e.dataIndex==null?null:e.chart.getDatasetMeta(e.datasetIndex).controller.indexToRadius(e.dataIndex)},hoverRadius(e){return e.dataIndex==null?null:e.chart.getDatasetMeta(e.datasetIndex).controller.indexToRadius(e.dataIndex)+1}}}}]);class hJ extends Pt{constructor(t,n){super(t,ZI("bubbleMap",n,Zc,Li,[ws,ll]))}}hJ.id=Zc.id;function pJ(e){var n;return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0},y:{display:!0}},plugins:{...(n=e==null?void 0:e.options)==null?void 0:n.plugins,legend:{position:"bottom",align:"center"}}}}}function gJ(e){var n;return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{beginAtZero:!0,stack:1,reverse:!0},y:{stacked:!0,beginAtZero:!0}},plugins:{...(n=e==null?void 0:e.options)==null?void 0:n.plugins,legend:{position:"bottom",align:"center"}}}}}function mJ(e){var n;return{...e,type:"bar",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}},plugins:{...(n=e==null?void 0:e.options)==null?void 0:n.plugins,legend:{position:"bottom",align:"center"}}}}}function bJ(e,t=!1){var r;return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0,beginAtZero:!1},y:{display:!0,stacked:t}},plugins:{...(r=e==null?void 0:e.options)==null?void 0:r.plugins,legend:{position:"bottom",align:"center"}}}}}function yJ(e,t){var r,o,i,s,a;return{...e,type:t==="stackedBar"?"bar":"line",options:{...e==null?void 0:e.options,scales:{x:{...(o=(r=e==null?void 0:e.options)==null?void 0:r.scales)==null?void 0:o.x,display:!0,stacked:!0},y:{...(s=(i=e==null?void 0:e.options)==null?void 0:i.scales)==null?void 0:s.y,display:!0,stacked:t==="stackedBar"}},plugins:{...(a=e==null?void 0:e.options)==null?void 0:a.plugins,legend:{display:!1,position:"bottom",align:"center"}}}}}function vJ(e){var n;return{...e,type:"line",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}},plugins:{...(n=e==null?void 0:e.options)==null?void 0:n.plugins,legend:{position:"bottom",align:"center"}}}}}function xJ(e,t){var r;return{...t,type:e,options:{...t==null?void 0:t.options,scales:{x:{display:!1},y:{display:!1}},plugins:{...(r=t==null?void 0:t.options)==null?void 0:r.plugins,legend:{position:"bottom",align:"center",maxHeight:0,labels:{useBorderRadius:!0,borderRadius:2}}},borderRadius:0}}}function wJ(e){var r,o;const t=se.getState().theme;let n={...e,type:"radar",options:{...e==null?void 0:e.options,scales:{x:{display:!1},y:{display:!1},r:{grid:{display:!0},angleLines:{},ticks:{}}},plugins:{...(r=e==null?void 0:e.options)==null?void 0:r.plugins,legend:{position:"bottom",align:"center"}}}};return t==="dark"&&(n={...n,options:{...n.options,scales:{...(o=n==null?void 0:n.options)==null?void 0:o.scales,r:{grid:{color:bt.slate[800]},angleLines:{color:bt.slate[800]},ticks:{color:bt.slate[800],showLabelBackdrop:!1}}}}}),n}function SJ(e,t,n){const r={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{label:function(i){var f;const s=i.dataset.label,a=i.dataIndex,l=i.dataset.data,c=(f=l==null?void 0:l[a])==null?void 0:f.label,u=n==null?void 0:n[0],d=n==null?void 0:n[1],h=n==null?void 0:n[2];if(t==="bubble")return c?`${s} (${c}): ${u}: ${i.raw.x.toFixed(2)}, ${d}: ${i.raw.y.toFixed(2)}, ${h}: ${i.raw.r.toFixed(2)}`:`${s}: ${u}: ${i.raw.x.toFixed(2)}, ${d}: ${i.raw.y.toFixed(2)}, ${h}: ${i.raw.r.toFixed(2)}`;if(t==="scatter")return c?`${s} (${c}): ${u}: ${i.raw.x.toFixed(2)}, ${d}: ${i.raw.y.toFixed(2)}`:`${s}: ${u}: ${i.raw.x.toFixed(2)}, ${d}: ${i.raw.y.toFixed(2)}`}}},datalabels:{display:!1}},scales:{x:{title:{display:!0,text:n[0]},beginAtZero:!0,ticks:{precision:0}},y:{title:{display:!0,text:n[1]},beginAtZero:!0,ticks:{precision:0}}}};return{...e,options:{...e==null?void 0:e.options,...r}}}function CJ({data:e,cfg:t,customCfg:n,preferences:r,cardType:o}){var P,M,D,A,I;const i=((P=r==null?void 0:r.chartOptions)==null?void 0:P.indexAxis)||"y",s={...t,options:{indexAxis:i}},{metricKeys:a,dimensionKeys:l}=mn(e),c=JA(a,e),u=Gl(c,n);u.forEach(($,j)=>{var T,N,F;$.shrinkAnchor=((F=(N=(T=n==null?void 0:n.data)==null?void 0:T.datasets)==null?void 0:N[j])==null?void 0:F.shrinkAnchor)||"top"});const{plugins:d,options:h}=Fm((r==null?void 0:r.customVisualCode)||""),f=l[0],p=Nm(e,f),g=Mn((s==null?void 0:s.options)||{},(n==null?void 0:n.options)||{}),m=Mn(g,(r==null?void 0:r.chartOptions)||{});Array(u.length).fill(!0);const b=e.map($=>$[f]),v=e.map($=>$[a[0]]),x=(M=u[0])==null?void 0:M.backgroundColor.slice(),w={...m,plugins:{...m.plugins,legend:{...(D=m.plugins)==null?void 0:D.legend,labels:{generateLabels:$=>{const j=$.data.labels;return b.map((T,N)=>({text:T,fillStyle:x[N],hidden:!j.includes(T.toString()),index:N,datasetIndex:0,lineWidth:0}))}},onClick:($,j,T)=>{const N=T.chart,F=j.index,z=b[F],B=N.data.datasets[0],O=N.data.labels,U=B.data,L=B.backgroundColor,k=O.indexOf(z.toString());k>=0?(O.splice(k,1),U.splice(k,1),L.splice(k,1)):(O.splice(F,0,b[F].toString()),U.splice(F,0,Number(v[F])),L.splice(F,0,x[F])),N.update()}},datalabels:{...(A=m.plugins)==null?void 0:A.datalabels,anchor:$=>$.dataset.data[$.dataIndex]<.02?"end":"start",align:$=>$.dataset.data[$.dataIndex]<.02?"end":"center",textAlign:"center",font:{size:14},formatter:($,j)=>{var T,N,F,z;return br({number:Number($),decimalPlaces:((T=r==null?void 0:r.numberAxisFormat)==null?void 0:T.decimalPlaces)||0,useSuffix:!!((N=r==null?void 0:r.numberAxisFormat)!=null&&N.suffix),customSuffix:"",locale:((F=r==null?void 0:r.numberAxisFormat)==null?void 0:F.locale)||"",currency:((z=r==null?void 0:r.numberAxisFormat)==null?void 0:z.currency)||""})}},tooltip:{...(I=m.plugins)==null?void 0:I.tooltip,callbacks:{title:function($){var z,B,O,U;const T=((B=(z=$==null?void 0:$[0])==null?void 0:z.dataset)==null?void 0:B.data).reduce((L,k)=>L+k,0),F=(((O=$==null?void 0:$[0])==null?void 0:O.parsed[i==="x"?"y":"x"])/T*100).toFixed(2);return`${(U=$==null?void 0:$[0])==null?void 0:U.label} (${F}%)`},label:function($){var U,L,k,H;$.dataset.label;const j=$.dataset.data;j.reduce((G,Y)=>G+Y,0);const T=$.parsed[i==="x"?"y":"x"],N=j.indexOf(T),F=j[N-1],z=br({number:Number(T),decimalPlaces:((U=r==null?void 0:r.numberAxisFormat)==null?void 0:U.decimalPlaces)||0,useSuffix:!!((L=r==null?void 0:r.numberAxisFormat)!=null&&L.suffix),customSuffix:"",locale:((k=r==null?void 0:r.numberAxisFormat)==null?void 0:k.locale)||"",currency:((H=r==null?void 0:r.numberAxisFormat)==null?void 0:H.currency)||""});let B=0;return F!==void 0&&(B=Number((T/F*100).toFixed(2))),z+(F!==void 0?` (Conversion Rate: ${B}%)`:"")}}}}},C=Mn(m,w),S=Mn(C,h);return delete S.scales,{type:o,data:{labels:p,datasets:u},options:S,plugins:[...d]}}function _J({data:e,cfg:t,customCfg:n,preferences:r}){var C,S;const o=bJ(t),i=EJ(e),s=Gl(i,n),{plugins:a,options:l}=Fm((r==null?void 0:r.customVisualCode)||""),c=Mn((o==null?void 0:o.options)||{},(t==null?void 0:t.options)||{}),u=Mn(c,(r==null?void 0:r.chartOptions)||{}),d=Mn(u,(n==null?void 0:n.options)||{}),h={...d,plugins:{...d==null?void 0:d.plugins,tooltip:{...(C=d==null?void 0:d.plugins)==null?void 0:C.tooltip,callbacks:{label:function(E){if(Array.isArray(E.raw)&&E.raw.every(P=>P===null))return null}}}}},f=Mn(h,l),p=rT(t,r),g=Mn(f,p),m={...g,plugins:{...g==null?void 0:g.plugins,datalabels:{...(S=g==null?void 0:g.plugins)==null?void 0:S.datalabels,formatter:(E,P)=>E.map(D=>{var A,I,$,j;return br({number:Number(D),decimalPlaces:((A=r==null?void 0:r.numberAxisFormat)==null?void 0:A.decimalPlaces)||0,useSuffix:!!((I=r==null?void 0:r.numberAxisFormat)!=null&&I.suffix),customSuffix:"",locale:(($=r==null?void 0:r.numberAxisFormat)==null?void 0:$.locale)||"",currency:((j=r==null?void 0:r.numberAxisFormat)==null?void 0:j.currency)||""})}).slice(0,2).join(" - ")}}},{dimensionKeys:b}=mn(e),v=b[0];return{type:"bar",data:{labels:[...new Set(Nm(e,v))],datasets:s},options:m,plugins:[...a]}}function EJ(e){var d,h,f,p;const{dimensionKeys:t,metricKeys:n}=mn(e),r=se.getState().themeStyle,o=(h=(d=r==null?void 0:r.chart)==null?void 0:d.dataset)==null?void 0:h.backgroundColor,i=(p=(f=r==null?void 0:r.chart)==null?void 0:f.dataset)==null?void 0:p.borderColor,s=t==null?void 0:t[1],a=t==null?void 0:t[0],l=[...new Set(e.map(g=>g==null?void 0:g[a]))];return[...new Set(e.map(g=>g==null?void 0:g[s]))].map((g,m)=>{const b=e.filter(w=>(w==null?void 0:w[s])===g),x=l.map(w=>{const C=b.filter(S=>(S==null?void 0:S[a])===w);return C.length===0?[[null,null,null]]:C.map(S=>[S==null?void 0:S[n[0]],S==null?void 0:S[n[1]],S==null?void 0:S[n[2]],w])}).flat();return{label:g,data:x,backgroundColor:o==null?void 0:o[m%o.length],borderColor:i==null?void 0:i[m%i.length],borderSkipped:!1}})}function OS({data:e,cardType:t="bar",cfg:n,customCfg:r,provider:o="chartjs",userSettings:i,preferences:s,topoJson:a,queryConfig:l}){var h,f,p,g,m,b,v,x,w;let c=e;const u=l&&l.pivotColumns&&l.pivotColumns.length>0,d=l&&l.groupByColumns&&l.groupByColumns.length>0;if(u&&d&&(c=pU(e,(l==null?void 0:l.metricColumns)||[])),t==="map"){if(!a)return null;const C=(h=s==null?void 0:s.mapVisualOptions)==null?void 0:h.objectKey;if(!C)return null;const S=aJ(a,(f=a==null?void 0:a.objects)==null?void 0:f[C]).features;if(!S)return null;const E={plugins:{datalabels:{display:!1}},scales:{x:{display:!1,grid:{display:!1}},y:{display:!1,grid:{display:!1}},projection:{axis:"x",projection:((p=s==null?void 0:s.mapVisualOptions)==null?void 0:p.projection)||"mercator",projectionScale:((g=s==null?void 0:s.mapVisualOptions)==null?void 0:g.projectionScale)||1,projectionOffset:((m=s==null?void 0:s.mapVisualOptions)==null?void 0:m.projectionOffset)||[0,0]},color:{axis:"x",interpolate:((b=s==null?void 0:s.mapVisualOptions)==null?void 0:b.colorScale)||"blues",quantize:5,legend:{position:"bottom-right",align:"right"}}}},{keys:P}=mn(c),M=S.map(T=>{var B;const N=P==null?void 0:P[0],F=P==null?void 0:P[1],z=(B=c.find(O=>(O==null?void 0:O[N])===T.properties.NAME||(O==null?void 0:O[N])===T.properties.name))==null?void 0:B[F];return{feature:T,value:z}}),A=Gl([{label:C,data:M,borderColor:"lightgray"}],r),I={type:"choropleth",data:{labels:S.map(T=>T.properties.NAME||T.properties.name),datasets:A},options:E},{options:$}=sx({cfg:I,preferences:s,customCfg:r,cardType:t});return{...I,options:$}}if(t==="bar"){const C=mJ(n);return Ws({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="horizontalBar"){const C=pJ(n);return Ws({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="funnel")return CJ({data:c,cfg:n,customCfg:r,preferences:s,cardType:t});if(t==="pyramid"){const C=gJ(n),{dimensionKeys:S,metricKeys:E}=mn(c),P=ng({dataArray:c,groupKey:S[0],pivotKey:S[1],valueKey:E[0]}),M=Ws({data:P,cfg:C,customCfg:r,cardType:t,preferences:s}),D="x2";return{...M,data:{...M.data,datasets:M.data.datasets.map((I,$)=>$===1?{...I,xAxisID:D}:I)},options:{...M.options,scales:{...(v=M==null?void 0:M.options)==null?void 0:v.scales,[D]:{beginAtZero:!0,stack:1}}}}}if(t==="stackedBar"||t==="stackedLine"){const C=yJ(n,t),{dimensionKeys:S,metricKeys:E}=mn(c);return(!u||!d)&&(c=ng({dataArray:c,groupKey:S[0],pivotKey:S[1],valueKey:E[0],sortChart:s==null?void 0:s.sortChart})),Ws({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="line"){const C=vJ(n);return Ws({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="range")return _J({data:c,cfg:n,customCfg:r,preferences:s});if(t==="pie"||t==="doughnut"||t==="polarArea"){const C=xJ(t,n),{dimensionKeys:S,metricKeys:E}=mn(c),P=JA(E,c),M=Gl(P,r),{plugins:D,options:A}=Fm((s==null?void 0:s.customVisualCode)||""),I=S[0],$=Nm(c,I),j=Mn((C==null?void 0:C.options)||{},(r==null?void 0:r.options)||{}),T=Mn(j,(s==null?void 0:s.chartOptions)||{}),N={...T,plugins:{...T.plugins,datalabels:{...(x=T.plugins)==null?void 0:x.datalabels,formatter:(U,L)=>{var k,H,G,Y;return br({number:Number(U),decimalPlaces:((k=s==null?void 0:s.numberAxisFormat)==null?void 0:k.decimalPlaces)||0,useSuffix:!!((H=s==null?void 0:s.numberAxisFormat)!=null&&H.suffix),customSuffix:"",locale:((G=s==null?void 0:s.numberAxisFormat)==null?void 0:G.locale)||"",currency:((Y=s==null?void 0:s.numberAxisFormat)==null?void 0:Y.currency)||""})}},tooltip:{...(w=T.plugins)==null?void 0:w.tooltip,callbacks:{label:function(U){var W,q,X,J;U.dataset.label;const k=U.dataset.data.reduce((ne,Q)=>ne+Q,0),H=U.parsed,G=br({number:Number(H),decimalPlaces:((W=s==null?void 0:s.numberAxisFormat)==null?void 0:W.decimalPlaces)||0,useSuffix:!!((q=s==null?void 0:s.numberAxisFormat)!=null&&q.suffix),customSuffix:"",locale:((X=s==null?void 0:s.numberAxisFormat)==null?void 0:X.locale)||"",currency:((J=s==null?void 0:s.numberAxisFormat)==null?void 0:J.currency)||""}),Y=(H/k*100).toFixed(2);return G+` (${Y}%)`}}}}},F=Mn(T,N),z=Mn(F,A);return{type:t,data:{labels:$,datasets:M},options:z,plugins:[t==="doughnut"?{id:"doughnutLabel",beforeDatasetsDraw:function(U,L,k){var Q,oe,ee,ue;const{ctx:H,data:G}=U;H.save();const Y=U.getDatasetMeta(0).data[0].x,W=U.getDatasetMeta(0).data[0].y,q=Sc(kd()),X=window.getComputedStyle(H.canvas).fontFamily;H.font=`1em ${X}`,H.fontWeight="bolder",H.fillStyle=q,H.textAlign="center",H.textBaseline="middle";const J=G.datasets[0].data.reduce((he,we)=>he+we,0),ne=br({number:Number(J),decimalPlaces:((Q=s==null?void 0:s.numberAxisFormat)==null?void 0:Q.decimalPlaces)||0,useSuffix:!!((oe=s==null?void 0:s.numberAxisFormat)!=null&&oe.suffix),customSuffix:"",locale:((ee=s==null?void 0:s.numberAxisFormat)==null?void 0:ee.locale)||"",currency:((ue=s==null?void 0:s.numberAxisFormat)==null?void 0:ue.currency)||""});H.fillText(ne,Y,W)}}:"",...D]}}if(t==="radar"){const C=wJ(n);return Ws({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="bubble"||t==="scatter"){const{metricKeys:C}=mn(c),S=rU(c,t),E=Gl(S,r),P=SJ(n,t,C),{options:M}=sx({cardType:t,cfg:P,preferences:s,customCfg:r});return{type:t,data:{datasets:E},options:M}}return Ws({data:c,cfg:n,customCfg:r,cardType:t,preferences:s})}function RJ({chart:e,elementIndex:t,datasetIndex:n,cardType:r,cfg:o,apply:i}){const s=se.getState().theme;if(!o)return;const a=s==="dark"?"rgb(238,238,238,0.2)":"rgb(238,238,238,0.8)";["bar","line","horizontalBar","bubble","scatter"].includes(r)&&PJ(e,t,o,i,a),["pie","doughnut","polarArea","funnel"].includes(r)&&MJ(e,t,o,i,a),["stackedBar","pyramid"].includes(r)&&kJ({chart:e,elementIndex:t,datasetIndex:n,cfg:o,apply:i,blurColor:a})}function kJ(e){var a,l,c,u;const{chart:t,elementIndex:n,datasetIndex:r,cfg:o,apply:i,blurColor:s}=e;i?(l=(a=t==null?void 0:t.data)==null?void 0:a.datasets)==null||l.forEach((d,h)=>{var f,p;typeof d.backgroundColor=="string"&&(d.backgroundColor=new Array(d.data.length).fill(d.backgroundColor),d.borderColor=new Array(d.data.length).fill(d.borderColor)),d.backgroundColor=(f=d==null?void 0:d.backgroundColor)==null?void 0:f.map((g,m)=>m===n&&h===r?g:s),d.borderColor=(p=d==null?void 0:d.borderColor)==null?void 0:p.map((g,m)=>m===n&&h===r?g:s)}):(u=(c=t==null?void 0:t.data)==null?void 0:c.datasets)==null||u.forEach((d,h)=>{var f,p,g,m,b,v;d.backgroundColor=new Array(d.data.length).fill((g=(p=(f=o==null?void 0:o.data)==null?void 0:f.datasets)==null?void 0:p[h])==null?void 0:g.backgroundColor),d.borderColor=new Array(d.data.length).fill((v=(b=(m=o==null?void 0:o.data)==null?void 0:m.datasets)==null?void 0:b[h])==null?void 0:v.borderColor)}),t==null||t.update()}function PJ(e,t,n,r,o){var i,s,a,l;r?(s=(i=e==null?void 0:e.data)==null?void 0:i.datasets)==null||s.forEach(c=>{var u,d;typeof c.backgroundColor=="string"&&(c.backgroundColor=new Array(c.data.length).fill(c.backgroundColor),c.borderColor=new Array(c.data.length).fill(c.borderColor)),c.backgroundColor=(u=c==null?void 0:c.backgroundColor)==null?void 0:u.map((h,f)=>f===t?h:o),c.borderColor=(d=c==null?void 0:c.borderColor)==null?void 0:d.map((h,f)=>f===t?h:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,u)=>{var d,h,f,p,g,m;c.backgroundColor=new Array(c.data.length).fill((f=(h=(d=n==null?void 0:n.data)==null?void 0:d.datasets)==null?void 0:h[u])==null?void 0:f.backgroundColor),c.borderColor=new Array(c.data.length).fill((m=(g=(p=n==null?void 0:n.data)==null?void 0:p.datasets)==null?void 0:g[u])==null?void 0:m.borderColor)}),e==null||e.update()}function MJ(e,t,n,r,o){var i,s,a,l;r?(s=(i=e==null?void 0:e.data)==null?void 0:i.datasets)==null||s.forEach(c=>{var u,d;c.backgroundColor=(u=c==null?void 0:c.backgroundColor)==null?void 0:u.map((h,f)=>f===t?h:o),c.borderColor=(d=c==null?void 0:c.borderColor)==null?void 0:d.map((h,f)=>f===t?h:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,u)=>{var d,h,f,p,g,m,b,v;typeof c.backgroundColor=="string"&&(c.backgroundColor=(f=(h=(d=n==null?void 0:n.data)==null?void 0:d.datasets)==null?void 0:h[u])==null?void 0:f.backgroundColor,c.borderColor=(m=(g=(p=n==null?void 0:n.data)==null?void 0:p.datasets)==null?void 0:g[u])==null?void 0:m.borderColor),c.backgroundColor=(b=c==null?void 0:c.backgroundColor)==null?void 0:b.map((x,w)=>{var C;return(C=n.data.datasets[u].backgroundColor)==null?void 0:C[w]}),c.borderColor=(v=c==null?void 0:c.borderColor)==null?void 0:v.map((x,w)=>{var C;return(C=n.data.datasets[u].borderColor)==null?void 0:C[w]})}),e==null||e.update()}function DJ({card:e,data:t,datasetIndex:n,clickIndex:r,value:o}){var i,s,a,l,c,u;try{if(!t)return;const{keys:d,dimensionKeys:h,metricKeys:f}=mn(t);if(e.type==="map"){const p=d[0],g=((s=(i=o==null?void 0:o.feature)==null?void 0:i.properties)==null?void 0:s.name)||((l=(a=o==null?void 0:o.feature)==null?void 0:a.properties)==null?void 0:l.NAME);return[{columnName:p,columnValue:g}]}if(["bar","horizontalBar","line","pie","doughnut","radar","polarArea","funnel"].includes(e.type)){const p=h[0],g=(c=t[r])==null?void 0:c[p];return[{columnName:p,columnValue:g,metric:f[n],value:o}]}if(["stackedBar","pyramid"].includes(e.type)){const p=ng({dataArray:t,groupKey:h[0],pivotKey:h[1],valueKey:f[0]}),g=h[0],m=(u=p[r])==null?void 0:u[g],b=h[1],{metricKeys:v}=mn(p),x=v[n];return[{columnName:g,columnValue:m,metric:f[0],value:o},{columnName:b,columnValue:x,metric:f[0],value:o}]}if(e.type==="bubble"||e.type==="scatter"){const p=h[0],g=o.label;return[{columnName:p,columnValue:g,metric1:f[0],value1:o.x,metric2:f[1],value2:o.y,metric3:f==null?void 0:f[2],value3:o==null?void 0:o.r}]}}catch(d){console.error("Error in getAdhocFilter",d)}}function OJ(e,t){var r,o;if((((r=e.data.datasets)==null?void 0:r.filter(i=>!!i.fill))||[]).length>0){const i=(o=e==null?void 0:e.data.datasets)==null?void 0:o.map(a=>({...a,backgroundColor:[a.backgroundColor].map(l=>{const c=t.createLinearGradient(0,0,0,400);return c.addColorStop(0,l),c.addColorStop(.7,hU("--semaphor-background")),c})}));return{...e,data:{...e.data,datasets:i}}}return e}function JI(e){var a,l,c,u,d,h;const t=(((l=(a=e.preferences)==null?void 0:a.mapVisualOptions)==null?void 0:l.topoJsonUrl)==="custom"?(u=(c=e.preferences)==null?void 0:c.mapVisualOptions)==null?void 0:u.customTopoJsonUrl:(h=(d=e.preferences)==null?void 0:d.mapVisualOptions)==null?void 0:h.topoJsonUrl)||"",n=!!t&&e.type==="map",{data:r,isLoading:o,isFetching:i,isError:s}=wf({queryKey:["topojson",t],queryFn:()=>fetch(t).then(f=>f.json()),enabled:n,staleTime:1/0});return{data:r,isLoading:o,isFetching:i,isError:s}}function AJ(e){var s,a;const[t]=_.useState({id:"",title:"",type:"bar"}),{getCard:n}=tn(),r=n(e),o=e5(r||t),i={...r,data:((s=o==null?void 0:o.data)==null?void 0:s.records)||[]};return{...o,data:((a=o==null?void 0:o.data)==null?void 0:a.records)||[],card:i}}function e5(e){var D;const{onChartElementClicked:t}=jr(),[n,r]=_.useState(0),o=se(A=>A.themeStyle),i=se(A=>A.filteringCards),s=se(A=>A.selectedSheetId),a=se(A=>A.selectedLensId),l=se(A=>A.filterValues),c=_.useRef(l),u=(D=e==null?void 0:e.preferences)==null?void 0:D.onClickFilter,{addFilteringCard:d,addOrUpdateFilterValues:h,removeFilterValues:f,removeFilteringCard:p}=tn(),{data:g,isLoading:m,isFetching:b,isError:v,queryKey:x,isFilteringCard:w,isSingleCardFrame:C}=Fi(e),{data:S}=JI(e);let E;E=_.useMemo(()=>{if(!(!(g!=null&&g.records)||!(g!=null&&g.records.length)))return OS({data:g==null?void 0:g.records,cardType:e.type,queryConfig:e.queryConfig,customCfg:e.customCfg,preferences:e.preferences,topoJson:S})},[g==null?void 0:g.records,e,S,o]);const P=_.useRef({filteringCards:i});_.useEffect(()=>{e.connectionId&&!w&&(c.current=l)},[l,a,e.connectionId,w]),_.useEffect(()=>{var I;w&&(P.current.filteringCards=[...i||[]]),!w&&((I=P.current.filteringCards)==null?void 0:I.find($=>$.id===e.id))&&C&&r($=>$+1)},[w,C,e.id,i]);function M(A,I,$,j){var F;let T=!1;if(!(g!=null&&g.records))return;const N=DJ({card:e,data:g==null?void 0:g.records,datasetIndex:I,clickIndex:$,value:j});if(console.log("fieldValues",N),t==null||t(e,N),!!(((F=e==null?void 0:e.preferences)==null?void 0:F.onClickFilter)??[]).length){if(w){const z=e.id;f(z),p(e)}else{if(T=!0,!N)return;const z=[];N.forEach((B,O)=>{const U=u==null?void 0:u.find(k=>k.columnIndex===O);if(!U)return;const L={filterId:e.id+"-"+B.columnName+"-"+s,connectionId:e==null?void 0:e.connectionId,tableName:e.lastSelectedTable,name:B.columnName,expression:U.expression,valueType:hm(N[U.columnIndex].columnValue),operation:"=",values:[N[U.columnIndex].columnValue]};z.push(L)}),h(z),d(e)}RJ({chart:A,elementIndex:$,datasetIndex:I,cardType:e.type,cfg:E,apply:T})}}return{isError:v,isLoading:m,isFetching:b,data:g,visualKey:n,handleDatapointClick:M,cfg:E,queryKey:x}}function Vo({children:e,containerClassName:t,className:n,text:r,onSave:o,type:i="input",placeholder:s,enabled:a}){const[l,c]=_.useState(!1),[u,d]=_.useState(r),h=se(b=>b.isDashboardEditing);_.useEffect(()=>{d(b=>b!==r?r:b)},[r]);const f=b=>{b.stopPropagation(),h&&c(!0)};function p(b){if(b.stopPropagation(),b.key==="Escape"){c(!1);return}b.key==="Enter"&&b.shiftKey||(b.key==="Enter"||b.key==="Tab")&&(c(!1),o(u))}function g(){return i==="textarea"?y.jsx("textarea",{className:ie("resize rounded-sm bg-background px-2 py-1 text-sm outline-[0.5px] outline-muted",n),onChange:b=>d(b.target.value),value:u,autoFocus:!0,placeholder:s,onBlur:()=>c(!1),onKeyDown:p}):y.jsx("input",{onMouseDown:b=>b.stopPropagation(),type:"text",className:ie("rounded-sm bg-background px-2 py-1 text-sm outline-[0.5px] outline-muted",n),onChange:b=>d(b.target.value),value:u,autoFocus:!0,placeholder:s,onBlur:()=>c(!1),onKeyDown:p})}function m(){return a?y.jsxs("div",{className:"flex grow items-center gap-2",children:[y.jsx("div",{children:l?g():e}),!l&&y.jsx(Z1,{onClick:()=>c(!0),className:"hidden size-3 cursor-pointer text-muted-foreground group-hover/editable:block"})]}):e}return y.jsx("div",{className:ie("flex",t),role:"editable",onDoubleClick:f,onMouseDown:b=>b.stopPropagation(),children:y.jsx("div",{className:"group/editable flex grow items-center gap-2",children:m()})})}function t5(e){const{authToken:t}=jr(),n=gz(t==null?void 0:t.accessToken);function r(){var i,s,a,l,c,u;if((s=(i=e.preferences)==null?void 0:i.formatNumber)!=null&&s.currency&&((l=(a=e.preferences)==null?void 0:a.formatNumber)==null?void 0:l.currency)!=="none")return n!=null&&n.currency?n==null?void 0:n.currency:(u=(c=e.preferences)==null?void 0:c.formatNumber)==null?void 0:u.currency}function o(){var i,s,a,l,c,u;if((s=(i=e.preferences)==null?void 0:i.formatNumber)!=null&&s.locale&&((l=(a=e.preferences)==null?void 0:a.formatNumber)==null?void 0:l.locale)!=="none")return n!=null&&n.locale?n==null?void 0:n.locale:(u=(c=e.preferences)==null?void 0:c.formatNumber)==null?void 0:u.locale}return{getCurrency:r,getLocale:o}}function Rg({card:e,data:t}){var x,w,C,S,E,P,M,D,A,I,$,j,T,N,F,z;const n=se(B=>B.actions.setCardTitle),r=se(B=>B.actions.setCardDescription),o=se(B=>B.isVisualEditing),i=se(B=>B.isDashboardEditing),s=er(B=>B.card),a=er(B=>B.actions.setCard);er(B=>B.actions.setNumberFormat);const{getCurrency:l,getLocale:c}=t5(e),u=se(B=>B.selectedSheetId),d=(w=(x=e.preferences)==null?void 0:x.formatNumber)==null?void 0:w.colorRanges,{metricKeys:h}=mn(t),f=(C=t==null?void 0:t[0])==null?void 0:C[h==null?void 0:h[0]],p=(S=t==null?void 0:t[0])==null?void 0:S[h==null?void 0:h[1]],g=t&&t.length>0;function m(B){o?a({...s,title:B}):n(u,e.id,B)}function b(B){o?a({...s,description:B}):r(u,e.id,B)}const v=p&&p-f!==0?(f-p)/p:null;return y.jsxs("div",{className:"kpi-card flex grow flex-col overflow-auto",children:[y.jsxs(pm,{className:"grow pb-3",children:[y.jsx(Vo,{enabled:i,text:o?s.title:e.title,onSave:m,children:y.jsx("div",{className:"flex items-center gap-2",children:y.jsx(Gc,{className:"text-base font-medium text-muted-foreground",children:e.title})})}),g&&y.jsxs("div",{className:"flex flex-wrap items-end gap-3 text-foreground",children:[y.jsx("p",{style:{color:eS(f,d)},className:"text-3xl font-semibold",children:br({number:f,decimalPlaces:((P=(E=e.preferences)==null?void 0:E.formatNumber)==null?void 0:P.decimalPlaces)||0,useSuffix:!!((D=(M=e.preferences)==null?void 0:M.formatNumber)!=null&&D.suffix),customSuffix:((I=(A=e.preferences)==null?void 0:A.formatNumber)==null?void 0:I.suffix)||"",locale:c()||"",currency:l()||""})}),p&&y.jsxs("span",{className:"min-w-fit text-base font-normal text-muted-foreground",children:["from  ",br({number:p,decimalPlaces:((j=($=e.preferences)==null?void 0:$.formatNumber)==null?void 0:j.decimalPlaces)||0,useSuffix:!!((N=(T=e.preferences)==null?void 0:T.formatNumber)!=null&&N.suffix),customSuffix:((z=(F=e.preferences)==null?void 0:F.formatNumber)==null?void 0:z.suffix)||"",locale:c()||"",currency:l()||""})]})]})]}),v&&y.jsxs(gm,{className:"grow items-start gap-1 pb-4 text-sm",children:[y.jsx(n5,{children:v}),y.jsxs("div",{className:"flex gap-1 text-muted-foreground",children:[v>0?"up ":"down ",y.jsx(Vo,{enabled:i,text:e.description||"",onSave:b,children:e.description})]})]})]})}function n5({children:e,className:t}){var i,s;const n=se(a=>a.themeStyle),r=e>0?y.jsx("span",{children:"+"}):y.jsx("span",{children:"-"}),o=`${Math.abs(e*100).toFixed(0)}%`;return y.jsxs("div",{style:{borderRadius:(s=(i=n==null?void 0:n.chart)==null?void 0:i.options)==null?void 0:s.borderRadius},className:ie("flex items-center px-1 text-sm font-semibold",{"bg-green-600/10 text-green-600":e>0,"bg-destructive/10 text-destructive":e<0},t),children:[r,y.jsx("span",{className:"ml-[1px]",children:o})]})}const TJ=["top","right","bottom","left"],ji=Math.min,zn=Math.max,Wd=Math.round,Kh=Math.floor,Ho=e=>({x:e,y:e}),IJ={left:"right",right:"left",bottom:"top",top:"bottom"},NJ={start:"end",end:"start"};function jx(e,t,n){return zn(e,ji(t,n))}function Ko(e,t){return typeof e=="function"?e(t):e}function $i(e){return e.split("-")[0]}function Jc(e){return e.split("-")[1]}function AS(e){return e==="x"?"y":"x"}function TS(e){return e==="y"?"height":"width"}function Ss(e){return["top","bottom"].includes($i(e))?"y":"x"}function IS(e){return AS(Ss(e))}function FJ(e,t,n){n===void 0&&(n=!1);const r=Jc(e),o=IS(e),i=TS(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=kg(s)),[s,kg(s)]}function LJ(e){const t=kg(e);return[$x(e),t,$x(t)]}function $x(e){return e.replace(/start|end/g,t=>NJ[t])}function jJ(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function $J(e,t,n,r){const o=Jc(e);let i=jJ($i(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map($x)))),i}function kg(e){return e.replace(/left|right|bottom|top/g,t=>IJ[t])}function zJ(e){return{top:0,right:0,bottom:0,left:0,...e}}function r5(e){return typeof e!="number"?zJ(e):{top:e,right:e,bottom:e,left:e}}function Pg(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Ek(e,t,n){let{reference:r,floating:o}=e;const i=Ss(t),s=IS(t),a=TS(s),l=$i(t),c=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let f;switch(l){case"top":f={x:u,y:r.y-o.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-o.width,y:d};break;default:f={x:r.x,y:r.y}}switch(Jc(t)){case"start":f[s]-=h*(n&&c?-1:1);break;case"end":f[s]+=h*(n&&c?-1:1);break}return f}const BJ=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=Ek(c,r,l),h=r,f={},p=0;for(let g=0;g<a.length;g++){const{name:m,fn:b}=a[g],{x:v,y:x,data:w,reset:C}=await b({x:u,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:f,rects:c,platform:s,elements:{reference:e,floating:t}});u=v??u,d=x??d,f={...f,[m]:{...f[m],...w}},C&&p<=50&&(p++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(c=C.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:u,y:d}=Ek(c,h,l)),g=-1)}return{x:u,y:d,placement:h,strategy:o,middlewareData:f}};async function Nc(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:f=0}=Ko(t,e),p=r5(f),m=a[h?d==="floating"?"reference":"floating":d],b=Pg(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(m)))==null||n?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),w=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},C=Pg(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:x,strategy:l}):v);return{top:(b.top-C.top+p.top)/w.y,bottom:(C.bottom-b.bottom+p.bottom)/w.y,left:(b.left-C.left+p.left)/w.x,right:(C.right-b.right+p.right)/w.x}}const VJ=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=Ko(e,t)||{};if(c==null)return{};const d=r5(u),h={x:n,y:r},f=IS(o),p=TS(f),g=await s.getDimensions(c),m=f==="y",b=m?"top":"left",v=m?"bottom":"right",x=m?"clientHeight":"clientWidth",w=i.reference[p]+i.reference[f]-h[f]-i.floating[p],C=h[f]-i.reference[f],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let E=S?S[x]:0;(!E||!await(s.isElement==null?void 0:s.isElement(S)))&&(E=a.floating[x]||i.floating[p]);const P=w/2-C/2,M=E/2-g[p]/2-1,D=ji(d[b],M),A=ji(d[v],M),I=D,$=E-g[p]-A,j=E/2-g[p]/2+P,T=jx(I,j,$),N=!l.arrow&&Jc(o)!=null&&j!==T&&i.reference[p]/2-(j<I?D:A)-g[p]/2<0,F=N?j<I?j-I:j-$:0;return{[f]:h[f]+F,data:{[f]:T,centerOffset:j-T-F,...N&&{alignmentOffset:F}},reset:N}}}),HJ=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...m}=Ko(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=$i(o),v=Ss(a),x=$i(a)===a,w=await(l.isRTL==null?void 0:l.isRTL(c.floating)),C=h||(x||!g?[kg(a)]:LJ(a)),S=p!=="none";!h&&S&&C.push(...$J(a,g,p,w));const E=[a,...C],P=await Nc(t,m),M=[];let D=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&M.push(P[b]),d){const j=FJ(o,s,w);M.push(P[j[0]],P[j[1]])}if(D=[...D,{placement:o,overflows:M}],!M.every(j=>j<=0)){var A,I;const j=(((A=i.flip)==null?void 0:A.index)||0)+1,T=E[j];if(T)return{data:{index:j,overflows:D},reset:{placement:T}};let N=(I=D.filter(F=>F.overflows[0]<=0).sort((F,z)=>F.overflows[1]-z.overflows[1])[0])==null?void 0:I.placement;if(!N)switch(f){case"bestFit":{var $;const F=($=D.filter(z=>{if(S){const B=Ss(z.placement);return B===v||B==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(B=>B>0).reduce((B,O)=>B+O,0)]).sort((z,B)=>z[1]-B[1])[0])==null?void 0:$[0];F&&(N=F);break}case"initialPlacement":N=a;break}if(o!==N)return{reset:{placement:N}}}return{}}}};function Rk(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function kk(e){return TJ.some(t=>e[t]>=0)}const WJ=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Ko(e,t);switch(r){case"referenceHidden":{const i=await Nc(t,{...o,elementContext:"reference"}),s=Rk(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:kk(s)}}}case"escaped":{const i=await Nc(t,{...o,altBoundary:!0}),s=Rk(i,n.floating);return{data:{escapedOffsets:s,escaped:kk(s)}}}default:return{}}}}};async function UJ(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=$i(n),a=Jc(n),l=Ss(n)==="y",c=["left","top"].includes(s)?-1:1,u=i&&l?-1:1,d=Ko(t,e);let{mainAxis:h,crossAxis:f,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof p=="number"&&(f=a==="end"?p*-1:p),l?{x:f*u,y:h*c}:{x:h*c,y:f*u}}const qJ=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await UJ(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},GJ=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:m=>{let{x:b,y:v}=m;return{x:b,y:v}}},...l}=Ko(e,t),c={x:n,y:r},u=await Nc(t,l),d=Ss($i(o)),h=AS(d);let f=c[h],p=c[d];if(i){const m=h==="y"?"top":"left",b=h==="y"?"bottom":"right",v=f+u[m],x=f-u[b];f=jx(v,f,x)}if(s){const m=d==="y"?"top":"left",b=d==="y"?"bottom":"right",v=p+u[m],x=p-u[b];p=jx(v,p,x)}const g=a.fn({...t,[h]:f,[d]:p});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[h]:i,[d]:s}}}}}},YJ=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Ko(e,t),u={x:n,y:r},d=Ss(o),h=AS(d);let f=u[h],p=u[d];const g=Ko(a,t),m=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const x=h==="y"?"height":"width",w=i.reference[h]-i.floating[x]+m.mainAxis,C=i.reference[h]+i.reference[x]-m.mainAxis;f<w?f=w:f>C&&(f=C)}if(c){var b,v;const x=h==="y"?"width":"height",w=["top","left"].includes($i(o)),C=i.reference[d]-i.floating[x]+(w&&((b=s.offset)==null?void 0:b[d])||0)+(w?0:m.crossAxis),S=i.reference[d]+i.reference[x]+(w?0:((v=s.offset)==null?void 0:v[d])||0)-(w?m.crossAxis:0);p<C?p=C:p>S&&(p=S)}return{[h]:f,[d]:p}}}},KJ=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:l=()=>{},...c}=Ko(e,t),u=await Nc(t,c),d=$i(o),h=Jc(o),f=Ss(o)==="y",{width:p,height:g}=i.floating;let m,b;d==="top"||d==="bottom"?(m=d,b=h===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(b=d,m=h==="end"?"top":"bottom");const v=g-u.top-u.bottom,x=p-u.left-u.right,w=ji(g-u[m],v),C=ji(p-u[b],x),S=!t.middlewareData.shift;let E=w,P=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=v),S&&!h){const D=zn(u.left,0),A=zn(u.right,0),I=zn(u.top,0),$=zn(u.bottom,0);f?P=p-2*(D!==0||A!==0?D+A:zn(u.left,u.right)):E=g-2*(I!==0||$!==0?I+$:zn(u.top,u.bottom))}await l({...t,availableWidth:P,availableHeight:E});const M=await s.getDimensions(a.floating);return p!==M.width||g!==M.height?{reset:{rects:!0}}:{}}}};function qm(){return typeof window<"u"}function eu(e){return o5(e)?(e.nodeName||"").toLowerCase():"#document"}function Tr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function oi(e){var t;return(t=(o5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function o5(e){return qm()?e instanceof Node||e instanceof Tr(e).Node:!1}function Hn(e){return qm()?e instanceof Element||e instanceof Tr(e).Element:!1}function Xo(e){return qm()?e instanceof HTMLElement||e instanceof Tr(e).HTMLElement:!1}function Pk(e){return!qm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Tr(e).ShadowRoot}function Df(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=po(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function XJ(e){return["table","td","th"].includes(eu(e))}function Gm(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function NS(e){const t=FS(),n=Hn(e)?po(e):e;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function QJ(e){let t=Cs(e);for(;Xo(t)&&!Fc(t);){if(NS(t))return t;if(Gm(t))return null;t=Cs(t)}return null}function FS(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Fc(e){return["html","body","#document"].includes(eu(e))}function po(e){return Tr(e).getComputedStyle(e)}function Ym(e){return Hn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Cs(e){if(eu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Pk(e)&&e.host||oi(e);return Pk(t)?t.host:t}function i5(e){const t=Cs(e);return Fc(t)?e.ownerDocument?e.ownerDocument.body:e.body:Xo(t)&&Df(t)?t:i5(t)}function Ud(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=i5(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Tr(o);if(i){const a=zx(s);return t.concat(s,s.visualViewport||[],Df(o)?o:[],a&&n?Ud(a):[])}return t.concat(o,Ud(o,[],n))}function zx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function s5(e){const t=po(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Xo(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Wd(n)!==i||Wd(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function LS(e){return Hn(e)?e:e.contextElement}function Ql(e){const t=LS(e);if(!Xo(t))return Ho(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=s5(t);let s=(i?Wd(n.width):n.width)/r,a=(i?Wd(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const ZJ=Ho(0);function a5(e){const t=Tr(e);return!FS()||!t.visualViewport?ZJ:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function JJ(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Tr(e)?!1:t}function Ya(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=LS(e);let s=Ho(1);t&&(r?Hn(r)&&(s=Ql(r)):s=Ql(e));const a=JJ(i,n,r)?a5(i):Ho(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i){const h=Tr(i),f=r&&Hn(r)?Tr(r):r;let p=h,g=zx(p);for(;g&&r&&f!==p;){const m=Ql(g),b=g.getBoundingClientRect(),v=po(g),x=b.left+(g.clientLeft+parseFloat(v.paddingLeft))*m.x,w=b.top+(g.clientTop+parseFloat(v.paddingTop))*m.y;l*=m.x,c*=m.y,u*=m.x,d*=m.y,l+=x,c+=w,p=Tr(g),g=zx(p)}}return Pg({width:u,height:d,x:l,y:c})}function jS(e,t){const n=Ym(e).scrollLeft;return t?t.left+n:Ya(oi(e)).left+n}function l5(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:jS(e,r)),i=r.top+t.scrollTop;return{x:o,y:i}}function eee(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=oi(r),a=t?Gm(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Ho(1);const u=Ho(0),d=Xo(r);if((d||!d&&!i)&&((eu(r)!=="body"||Df(s))&&(l=Ym(r)),Xo(r))){const f=Ya(r);c=Ql(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const h=s&&!d&&!i?l5(s,l,!0):Ho(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function tee(e){return Array.from(e.getClientRects())}function nee(e){const t=oi(e),n=Ym(e),r=e.ownerDocument.body,o=zn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=zn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+jS(e);const a=-n.scrollTop;return po(r).direction==="rtl"&&(s+=zn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function ree(e,t){const n=Tr(e),r=oi(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const c=FS();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function oee(e,t){const n=Ya(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Xo(e)?Ql(e):Ho(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function Mk(e,t,n){let r;if(t==="viewport")r=ree(e,n);else if(t==="document")r=nee(oi(e));else if(Hn(t))r=oee(t,n);else{const o=a5(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Pg(r)}function c5(e,t){const n=Cs(e);return n===t||!Hn(n)||Fc(n)?!1:po(n).position==="fixed"||c5(n,t)}function iee(e,t){const n=t.get(e);if(n)return n;let r=Ud(e,[],!1).filter(a=>Hn(a)&&eu(a)!=="body"),o=null;const i=po(e).position==="fixed";let s=i?Cs(e):e;for(;Hn(s)&&!Fc(s);){const a=po(s),l=NS(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Df(s)&&!l&&c5(e,s))?r=r.filter(u=>u!==s):o=a,s=Cs(s)}return t.set(e,r),r}function see(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?Gm(t)?[]:iee(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const d=Mk(t,u,o);return c.top=zn(d.top,c.top),c.right=ji(d.right,c.right),c.bottom=ji(d.bottom,c.bottom),c.left=zn(d.left,c.left),c},Mk(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function aee(e){const{width:t,height:n}=s5(e);return{width:t,height:n}}function lee(e,t,n){const r=Xo(t),o=oi(t),i=n==="fixed",s=Ya(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Ho(0);if(r||!r&&!i)if((eu(t)!=="body"||Df(o))&&(a=Ym(t)),r){const h=Ya(t,!0,i,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else o&&(l.x=jS(o));const c=o&&!r&&!i?l5(o,a):Ho(0),u=s.left+a.scrollLeft-l.x-c.x,d=s.top+a.scrollTop-l.y-c.y;return{x:u,y:d,width:s.width,height:s.height}}function Z0(e){return po(e).position==="static"}function Dk(e,t){if(!Xo(e)||po(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return oi(e)===n&&(n=n.ownerDocument.body),n}function u5(e,t){const n=Tr(e);if(Gm(e))return n;if(!Xo(e)){let o=Cs(e);for(;o&&!Fc(o);){if(Hn(o)&&!Z0(o))return o;o=Cs(o)}return n}let r=Dk(e,t);for(;r&&XJ(r)&&Z0(r);)r=Dk(r,t);return r&&Fc(r)&&Z0(r)&&!NS(r)?n:r||QJ(e)||n}const cee=async function(e){const t=this.getOffsetParent||u5,n=this.getDimensions,r=await n(e.floating);return{reference:lee(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function uee(e){return po(e).direction==="rtl"}const dee={convertOffsetParentRelativeRectToViewportRelativeRect:eee,getDocumentElement:oi,getClippingRect:see,getOffsetParent:u5,getElementRects:cee,getClientRects:tee,getDimensions:aee,getScale:Ql,isElement:Hn,isRTL:uee};function d5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function fee(e,t){let n=null,r;const o=oi(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const c=e.getBoundingClientRect(),{left:u,top:d,width:h,height:f}=c;if(a||t(),!h||!f)return;const p=Kh(d),g=Kh(o.clientWidth-(u+h)),m=Kh(o.clientHeight-(d+f)),b=Kh(u),x={rootMargin:-p+"px "+-g+"px "+-m+"px "+-b+"px",threshold:zn(0,ji(1,l))||1};let w=!0;function C(S){const E=S[0].intersectionRatio;if(E!==l){if(!w)return s();E?s(!1,E):r=setTimeout(()=>{s(!1,1e-7)},1e3)}E===1&&!d5(c,e.getBoundingClientRect())&&s(),w=!1}try{n=new IntersectionObserver(C,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,x)}n.observe(e)}return s(!0),i}function f5(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=LS(e),u=o||i?[...c?Ud(c):[],...Ud(t)]:[];u.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const d=c&&a?fee(c,n):null;let h=-1,f=null;s&&(f=new ResizeObserver(b=>{let[v]=b;v&&v.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var x;(x=f)==null||x.observe(t)})),n()}),c&&!l&&f.observe(c),f.observe(t));let p,g=l?Ya(e):null;l&&m();function m(){const b=Ya(e);g&&!d5(g,b)&&n(),g=b,p=requestAnimationFrame(m)}return n(),()=>{var b;u.forEach(v=>{o&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),d==null||d(),(b=f)==null||b.disconnect(),f=null,l&&cancelAnimationFrame(p)}}const J0=Nc,hee=qJ,pee=GJ,gee=HJ,mee=KJ,bee=WJ,Ok=VJ,yee=YJ,vee=(e,t,n)=>{const r=new Map,o={platform:dee,...n},i={...o.platform,_c:r};return BJ(e,t,{...o,platform:i})};var Fp=typeof document<"u"?_.useLayoutEffect:_.useEffect;function Mg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Mg(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Mg(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function h5(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ak(e,t){const n=h5(e);return Math.round(t*n)/n}function ey(e){const t=R.useRef(e);return Fp(()=>{t.current=e}),t}function p5(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=R.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,f]=R.useState(r);Mg(h,r)||f(r);const[p,g]=R.useState(null),[m,b]=R.useState(null),v=R.useCallback(z=>{z!==S.current&&(S.current=z,g(z))},[]),x=R.useCallback(z=>{z!==E.current&&(E.current=z,b(z))},[]),w=i||p,C=s||m,S=R.useRef(null),E=R.useRef(null),P=R.useRef(u),M=l!=null,D=ey(l),A=ey(o),I=ey(c),$=R.useCallback(()=>{if(!S.current||!E.current)return;const z={placement:t,strategy:n,middleware:h};A.current&&(z.platform=A.current),vee(S.current,E.current,z).then(B=>{const O={...B,isPositioned:I.current!==!1};j.current&&!Mg(P.current,O)&&(P.current=O,La.flushSync(()=>{d(O)}))})},[h,t,n,A,I]);Fp(()=>{c===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,d(z=>({...z,isPositioned:!1})))},[c]);const j=R.useRef(!1);Fp(()=>(j.current=!0,()=>{j.current=!1}),[]),Fp(()=>{if(w&&(S.current=w),C&&(E.current=C),w&&C){if(D.current)return D.current(w,C,$);$()}},[w,C,$,D,M]);const T=R.useMemo(()=>({reference:S,floating:E,setReference:v,setFloating:x}),[v,x]),N=R.useMemo(()=>({reference:w,floating:C}),[w,C]),F=R.useMemo(()=>{const z={position:n,left:0,top:0};if(!N.floating)return z;const B=Ak(N.floating,u.x),O=Ak(N.floating,u.y);return a?{...z,transform:"translate("+B+"px, "+O+"px)",...h5(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:O}},[n,a,N.floating,u.x,u.y]);return R.useMemo(()=>({...u,update:$,refs:T,elements:N,floatingStyles:F}),[u,$,T,N,F])}const xee=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Ok({element:r.current,padding:o}).fn(n):{}:r?Ok({element:r,padding:o}).fn(n):{}}}},$S=(e,t)=>({...hee(e),options:[e,t]}),g5=(e,t)=>({...pee(e),options:[e,t]}),wee=(e,t)=>({...yee(e),options:[e,t]}),m5=(e,t)=>({...gee(e),options:[e,t]}),b5=(e,t)=>({...mee(e),options:[e,t]}),See=(e,t)=>({...bee(e),options:[e,t]}),Cee=(e,t)=>({...xee(e),options:[e,t]});var _ee="Arrow",y5=R.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return y.jsx(me.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:y.jsx("polygon",{points:"0,0 30,0 15,10"})})});y5.displayName=_ee;var Eee=y5;function Km(e){const[t,n]=R.useState(void 0);return Dn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var zS="Popper",[v5,ii]=yn(zS),[Ree,x5]=v5(zS),w5=e=>{const{__scopePopper:t,children:n}=e,[r,o]=R.useState(null);return y.jsx(Ree,{scope:t,anchor:r,onAnchorChange:o,children:n})};w5.displayName=zS;var S5="PopperAnchor",C5=R.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=x5(S5,n),s=R.useRef(null),a=Te(t,s);return R.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:y.jsx(me.div,{...o,ref:a})});C5.displayName=S5;var BS="PopperContent",[kee,Pee]=v5(BS),_5=R.forwardRef((e,t)=>{var W,q,X,J,ne,Q;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:f="optimized",onPlaced:p,...g}=e,m=x5(BS,n),[b,v]=R.useState(null),x=Te(t,oe=>v(oe)),[w,C]=R.useState(null),S=Km(w),E=(S==null?void 0:S.width)??0,P=(S==null?void 0:S.height)??0,M=r+(i!=="center"?"-"+i:""),D=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},A=Array.isArray(c)?c:[c],I=A.length>0,$={padding:D,boundary:A.filter(Dee),altBoundary:I},{refs:j,floatingStyles:T,placement:N,isPositioned:F,middlewareData:z}=p5({strategy:"fixed",placement:M,whileElementsMounted:(...oe)=>f5(...oe,{animationFrame:f==="always"}),elements:{reference:m.anchor},middleware:[$S({mainAxis:o+P,alignmentAxis:s}),l&&g5({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?wee():void 0,...$}),l&&m5({...$}),b5({...$,apply:({elements:oe,rects:ee,availableWidth:ue,availableHeight:he})=>{const{width:we,height:ge}=ee.reference,ye=oe.floating.style;ye.setProperty("--radix-popper-available-width",`${ue}px`),ye.setProperty("--radix-popper-available-height",`${he}px`),ye.setProperty("--radix-popper-anchor-width",`${we}px`),ye.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),w&&Cee({element:w,padding:a}),Oee({arrowWidth:E,arrowHeight:P}),h&&See({strategy:"referenceHidden",...$})]}),[B,O]=k5(N),U=gn(p);Dn(()=>{F&&(U==null||U())},[F,U]);const L=(W=z.arrow)==null?void 0:W.x,k=(q=z.arrow)==null?void 0:q.y,H=((X=z.arrow)==null?void 0:X.centerOffset)!==0,[G,Y]=R.useState();return Dn(()=>{b&&Y(window.getComputedStyle(b).zIndex)},[b]),y.jsx("div",{ref:j.setFloating,"data-radix-popper-content-wrapper":"",style:{...T,transform:F?T.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:G,"--radix-popper-transform-origin":[(J=z.transformOrigin)==null?void 0:J.x,(ne=z.transformOrigin)==null?void 0:ne.y].join(" "),...((Q=z.hide)==null?void 0:Q.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:y.jsx(kee,{scope:n,placedSide:B,onArrowChange:C,arrowX:L,arrowY:k,shouldHideArrow:H,children:y.jsx(me.div,{"data-side":B,"data-align":O,...g,ref:x,style:{...g.style,animation:F?void 0:"none"}})})})});_5.displayName=BS;var E5="PopperArrow",Mee={top:"bottom",right:"left",bottom:"top",left:"right"},R5=R.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=Pee(E5,r),s=Mee[i.placedSide];return y.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:y.jsx(Eee,{...o,ref:n,style:{...o.style,display:"block"}})})});R5.displayName=E5;function Dee(e){return e!==null}var Oee=e=>({name:"transformOrigin",options:e,fn(t){var m,b,v;const{placement:n,rects:r,middlewareData:o}=t,s=((m=o.arrow)==null?void 0:m.centerOffset)!==0,a=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[c,u]=k5(n),d={start:"0%",center:"50%",end:"100%"}[u],h=(((b=o.arrow)==null?void 0:b.x)??0)+a/2,f=(((v=o.arrow)==null?void 0:v.y)??0)+l/2;let p="",g="";return c==="bottom"?(p=s?d:`${h}px`,g=`${-l}px`):c==="top"?(p=s?d:`${h}px`,g=`${r.floating.height+l}px`):c==="right"?(p=`${-l}px`,g=s?d:`${f}px`):c==="left"&&(p=`${r.floating.width+l}px`,g=s?d:`${f}px`),{data:{x:p,y:g}}}});function k5(e){const[t,n="center"]=e.split("-");return[t,n]}var Of=w5,tu=C5,Af=_5,Tf=R5,Aee="Portal",If=R.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=R.useState(!1);Dn(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?Jt.createPortal(y.jsx(me.div,{...r,ref:t}),s):null});If.displayName=Aee;function Tee(e,t=globalThis==null?void 0:globalThis.document){const n=gn(e);R.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Iee="DismissableLayer",Bx="dismissableLayer.update",Nee="dismissableLayer.pointerDownOutside",Fee="dismissableLayer.focusOutside",Tk,P5=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),cl=R.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=e,c=R.useContext(P5),[u,d]=R.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=R.useState({}),p=Te(t,E=>d(E)),g=Array.from(c.layers),[m]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(m),v=u?g.indexOf(u):-1,x=c.layersWithOutsidePointerEventsDisabled.size>0,w=v>=b,C=$ee(E=>{const P=E.target,M=[...c.branches].some(D=>D.contains(P));!w||M||(o==null||o(E),s==null||s(E),E.defaultPrevented||a==null||a())},h),S=zee(E=>{const P=E.target;[...c.branches].some(D=>D.contains(P))||(i==null||i(E),s==null||s(E),E.defaultPrevented||a==null||a())},h);return Tee(E=>{v===c.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},h),R.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Tk=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),Ik(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Tk)}},[u,h,n,c]),R.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),Ik())},[u,c]),R.useEffect(()=>{const E=()=>f({});return document.addEventListener(Bx,E),()=>document.removeEventListener(Bx,E)},[]),y.jsx(me.div,{...l,ref:p,style:{pointerEvents:x?w?"auto":"none":void 0,...e.style},onFocusCapture:ce(e.onFocusCapture,S.onFocusCapture),onBlurCapture:ce(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:ce(e.onPointerDownCapture,C.onPointerDownCapture)})});cl.displayName=Iee;var Lee="DismissableLayerBranch",jee=R.forwardRef((e,t)=>{const n=R.useContext(P5),r=R.useRef(null),o=Te(t,r);return R.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),y.jsx(me.div,{...e,ref:o})});jee.displayName=Lee;function $ee(e,t=globalThis==null?void 0:globalThis.document){const n=gn(e),r=R.useRef(!1),o=R.useRef(()=>{});return R.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let l=function(){M5(Nee,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function zee(e,t=globalThis==null?void 0:globalThis.document){const n=gn(e),r=R.useRef(!1);return R.useEffect(()=>{const o=i=>{i.target&&!r.current&&M5(Fee,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ik(){const e=new CustomEvent(Bx);document.dispatchEvent(e)}function M5(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?RO(o,i):o.dispatchEvent(i)}var ty,VS="HoverCard",[D5,JEe]=yn(VS,[ii]),Xm=ii(),[Bee,HS]=D5(VS),O5=e=>{const{__scopeHoverCard:t,children:n,open:r,defaultOpen:o,onOpenChange:i,openDelay:s=700,closeDelay:a=300}=e,l=Xm(t),c=R.useRef(0),u=R.useRef(0),d=R.useRef(!1),h=R.useRef(!1),[f=!1,p]=Un({prop:r,defaultProp:o,onChange:i}),g=R.useCallback(()=>{clearTimeout(u.current),c.current=window.setTimeout(()=>p(!0),s)},[s,p]),m=R.useCallback(()=>{clearTimeout(c.current),!d.current&&!h.current&&(u.current=window.setTimeout(()=>p(!1),a))},[a,p]),b=R.useCallback(()=>p(!1),[p]);return R.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(u.current)},[]),y.jsx(Bee,{scope:t,open:f,onOpenChange:p,onOpen:g,onClose:m,onDismiss:b,hasSelectionRef:d,isPointerDownOnContentRef:h,children:y.jsx(Of,{...l,children:n})})};O5.displayName=VS;var A5="HoverCardTrigger",T5=R.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=HS(A5,n),i=Xm(n);return y.jsx(tu,{asChild:!0,...i,children:y.jsx(me.a,{"data-state":o.open?"open":"closed",...r,ref:t,onPointerEnter:ce(e.onPointerEnter,Og(o.onOpen)),onPointerLeave:ce(e.onPointerLeave,Og(o.onClose)),onFocus:ce(e.onFocus,o.onOpen),onBlur:ce(e.onBlur,o.onClose),onTouchStart:ce(e.onTouchStart,s=>s.preventDefault())})})});T5.displayName=A5;var Vee="HoverCardPortal",[e2e,Hee]=D5(Vee,{forceMount:void 0}),Dg="HoverCardContent",I5=R.forwardRef((e,t)=>{const n=Hee(Dg,e.__scopeHoverCard),{forceMount:r=n.forceMount,...o}=e,i=HS(Dg,e.__scopeHoverCard);return y.jsx(hn,{present:r||i.open,children:y.jsx(Wee,{"data-state":i.open?"open":"closed",...o,onPointerEnter:ce(e.onPointerEnter,Og(i.onOpen)),onPointerLeave:ce(e.onPointerLeave,Og(i.onClose)),ref:t})})});I5.displayName=Dg;var Wee=R.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,...a}=e,l=HS(Dg,n),c=Xm(n),u=R.useRef(null),d=Te(t,u),[h,f]=R.useState(!1);return R.useEffect(()=>{if(h){const p=document.body;return ty=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=ty,p.style.webkitUserSelect=ty}}},[h]),R.useEffect(()=>{if(u.current){const p=()=>{f(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var m;((m=document.getSelection())==null?void 0:m.toString())!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",p),()=>{document.removeEventListener("pointerup",p),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),R.useEffect(()=>{u.current&&Gee(u.current).forEach(g=>g.setAttribute("tabindex","-1"))}),y.jsx(cl,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:s,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:ce(i,p=>{p.preventDefault()}),onDismiss:l.onDismiss,children:y.jsx(Af,{...c,...a,onPointerDown:ce(a.onPointerDown,p=>{p.currentTarget.contains(p.target)&&f(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:d,style:{...a.style,userSelect:h?"text":void 0,WebkitUserSelect:h?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),Uee="HoverCardArrow",qee=R.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=Xm(n);return y.jsx(Tf,{...o,...r,ref:t})});qee.displayName=Uee;function Og(e){return t=>t.pointerType==="touch"?void 0:e()}function Gee(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}var Yee=O5,Kee=T5,N5=I5;const Qm=Yee,Zm=Kee,Nf=R.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>y.jsx(N5,{ref:o,align:t,sideOffset:n,className:ie("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));Nf.displayName=N5.displayName;function F5({card:e}){const t=se(r=>r.isDashboardEditing),{setCardInfo:n}=tn();return y.jsxs(Qm,{openDelay:0,children:[y.jsx(Zm,{children:y.jsx(GA,{className:"size-4 text-muted-foreground/40"})}),y.jsx(Nf,{align:"start",className:"w-[300px] text-sm text-muted-foreground",onMouseDown:r=>r.stopPropagation(),children:y.jsx(Vo,{enabled:t,type:"textarea",text:e.info||"",onSave:r=>n(e.id,r),children:e.info||"Add info"})})]})}function Xee({card:e,renderFilterInfo:t}){var p,g,m,b,v,x,w,C,S,E,P,M,D,A,I,$;se(j=>j.themeStyle);const{data:n,isLoading:r}=Fi(e),o=(n==null?void 0:n.records)||[],i=se(j=>j.isDashboardEditing),{getCurrency:s,getLocale:a}=t5(e),l=(g=(p=e.preferences)==null?void 0:p.formatNumber)==null?void 0:g.colorRanges,{metricKeys:c}=mn(o||[]),u=(m=o==null?void 0:o[0])==null?void 0:m[c==null?void 0:c[0]],d=(b=o==null?void 0:o[0])==null?void 0:b[c==null?void 0:c[1]],h=(o==null?void 0:o.length)>0,f=d&&d-u!==0?(u-d)/d:null;return y.jsx("div",{className:"flex min-w-fit grow flex-col overflow-auto",children:y.jsxs("div",{className:"grow",children:[h?y.jsx("div",{className:"",children:y.jsxs("div",{className:ie("flex items-end gap-1.5",{"animate-pulse":r}),children:[y.jsx("p",{style:{color:eS(u,l)},className:"text-3xl font-semibold",children:br({number:u,decimalPlaces:((x=(v=e.preferences)==null?void 0:v.formatNumber)==null?void 0:x.decimalPlaces)||0,useSuffix:!!((C=(w=e.preferences)==null?void 0:w.formatNumber)!=null&&C.suffix),customSuffix:((E=(S=e.preferences)==null?void 0:S.formatNumber)==null?void 0:E.suffix)||"",locale:a()||"",currency:s()||""})}),f&&y.jsxs("div",{className:"flex items-end gap-1",children:[y.jsx(n5,{className:"",children:f}),d&&y.jsx("div",{className:"ml-0.5 mr-1 min-w-fit text-sm font-normal text-muted-foreground",children:`from ${br({number:d,decimalPlaces:((M=(P=e.preferences)==null?void 0:P.formatNumber)==null?void 0:M.decimalPlaces)||0,useSuffix:!!((A=(D=e.preferences)==null?void 0:D.formatNumber)!=null&&A.suffix),customSuffix:(($=(I=e.preferences)==null?void 0:I.formatNumber)==null?void 0:$.suffix)||"",locale:a()||"",currency:s()||""})}`})]})]})}):y.jsx("div",{className:"flex h-9 items-center justify-center"}),y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsxs(Gc,{className:"flex items-center gap-2 text-base font-medium text-muted-foreground",children:[e.title,(i||e.info)&&y.jsx(F5,{card:e})]}),t==null?void 0:t()]})]})})}var Qee="VisuallyHidden",WS=R.forwardRef((e,t)=>y.jsx(me.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));WS.displayName=Qee;var Zee=WS,[Jm,t2e]=yn("Tooltip",[ii]),eb=ii(),L5="TooltipProvider",Jee=700,Vx="tooltip.open",[ete,US]=Jm(L5),qS=e=>{const{__scopeTooltip:t,delayDuration:n=Jee,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,[s,a]=R.useState(!0),l=R.useRef(!1),c=R.useRef(0);return R.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),y.jsx(ete,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:R.useCallback(()=>{window.clearTimeout(c.current),a(!1)},[]),onClose:R.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:R.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:i})};qS.displayName=L5;var tb="Tooltip",[tte,nb]=Jm(tb),j5=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=US(tb,e.__scopeTooltip),c=eb(t),[u,d]=R.useState(null),h=dn(),f=R.useRef(0),p=s??l.disableHoverableContent,g=a??l.delayDuration,m=R.useRef(!1),[b=!1,v]=Un({prop:r,defaultProp:o,onChange:E=>{E?(l.onOpen(),document.dispatchEvent(new CustomEvent(Vx))):l.onClose(),i==null||i(E)}}),x=R.useMemo(()=>b?m.current?"delayed-open":"instant-open":"closed",[b]),w=R.useCallback(()=>{window.clearTimeout(f.current),f.current=0,m.current=!1,v(!0)},[v]),C=R.useCallback(()=>{window.clearTimeout(f.current),f.current=0,v(!1)},[v]),S=R.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{m.current=!0,v(!0),f.current=0},g)},[g,v]);return R.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),y.jsx(Of,{...c,children:y.jsx(tte,{scope:t,contentId:h,open:b,stateAttribute:x,trigger:u,onTriggerChange:d,onTriggerEnter:R.useCallback(()=>{l.isOpenDelayed?S():w()},[l.isOpenDelayed,S,w]),onTriggerLeave:R.useCallback(()=>{p?C():(window.clearTimeout(f.current),f.current=0)},[C,p]),onOpen:w,onClose:C,disableHoverableContent:p,children:n})})};j5.displayName=tb;var Hx="TooltipTrigger",GS=R.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=nb(Hx,n),i=US(Hx,n),s=eb(n),a=R.useRef(null),l=Te(t,a,o.onTriggerChange),c=R.useRef(!1),u=R.useRef(!1),d=R.useCallback(()=>c.current=!1,[]);return R.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),y.jsx(tu,{asChild:!0,...s,children:y.jsx(me.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:ce(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:ce(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:ce(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:ce(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:ce(e.onBlur,o.onClose),onClick:ce(e.onClick,o.onClose)})})});GS.displayName=Hx;var nte="TooltipPortal",[n2e,rte]=Jm(nte,{forceMount:void 0}),Lc="TooltipContent",$5=R.forwardRef((e,t)=>{const n=rte(Lc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=nb(Lc,e.__scopeTooltip);return y.jsx(hn,{present:r||s.open,children:s.disableHoverableContent?y.jsx(z5,{side:o,...i,ref:t}):y.jsx(ote,{side:o,...i,ref:t})})}),ote=R.forwardRef((e,t)=>{const n=nb(Lc,e.__scopeTooltip),r=US(Lc,e.__scopeTooltip),o=R.useRef(null),i=Te(t,o),[s,a]=R.useState(null),{trigger:l,onClose:c}=n,u=o.current,{onPointerInTransitChange:d}=r,h=R.useCallback(()=>{a(null),d(!1)},[d]),f=R.useCallback((p,g)=>{const m=p.currentTarget,b={x:p.clientX,y:p.clientY},v=lte(b,m.getBoundingClientRect()),x=cte(b,v),w=ute(g.getBoundingClientRect()),C=fte([...x,...w]);a(C),d(!0)},[d]);return R.useEffect(()=>()=>h(),[h]),R.useEffect(()=>{if(l&&u){const p=m=>f(m,u),g=m=>f(m,l);return l.addEventListener("pointerleave",p),u.addEventListener("pointerleave",g),()=>{l.removeEventListener("pointerleave",p),u.removeEventListener("pointerleave",g)}}},[l,u,f,h]),R.useEffect(()=>{if(s){const p=g=>{const m=g.target,b={x:g.clientX,y:g.clientY},v=(l==null?void 0:l.contains(m))||(u==null?void 0:u.contains(m)),x=!dte(b,s);v?h():x&&(h(),c())};return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[l,u,s,c,h]),y.jsx(z5,{...e,ref:i})}),[ite,ste]=Jm(tb,{isInside:!1}),z5=R.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=nb(Lc,n),c=eb(n),{onClose:u}=l;return R.useEffect(()=>(document.addEventListener(Vx,u),()=>document.removeEventListener(Vx,u)),[u]),R.useEffect(()=>{if(l.trigger){const d=h=>{const f=h.target;f!=null&&f.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),y.jsx(cl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:y.jsxs(Af,{"data-state":l.stateAttribute,...c,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[y.jsx(x1,{children:r}),y.jsx(ite,{scope:n,isInside:!0,children:y.jsx(Zee,{id:l.contentId,role:"tooltip",children:o||r})})]})})});$5.displayName=Lc;var B5="TooltipArrow",ate=R.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=eb(n);return ste(B5,n).isInside?null:y.jsx(Tf,{...o,...r,ref:t})});ate.displayName=B5;function lte(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function cte(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ute(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function dte(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function fte(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),hte(t)}function hte(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var pte=qS,gte=j5,mte=GS,V5=$5;const H5=pte,YS=gte,KS=mte,rb=R.forwardRef(({className:e,sideOffset:t=4,...n},r)=>y.jsx(V5,{ref:r,sideOffset:t,className:ie("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));rb.displayName=V5.displayName;function Ag({card:e,isLoading:t,data:n}){var h,f;const r=n||[],{keys:o}=mn(r),i=se(p=>p.selectedSheetId),s=se(p=>p.isVisualEditing),a=(f=(h=e==null?void 0:e.preferences)==null?void 0:h.textVisualOptions)==null?void 0:f.isDynamicText,{setCardDescription:l}=tn(),{setCard:c}=Im();function u(){var b;if(t)return y.jsxs("div",{className:"space-y-2",children:[y.jsx(Ca,{className:"h-3 w-full animate-pulse bg-muted"}),y.jsx(Ca,{className:"h-3 w-3/4 animate-pulse bg-muted"}),y.jsx(Ca,{className:"h-3 w-1/2 animate-pulse bg-muted"})]});const g=(b=r==null?void 0:r[0])==null?void 0:b[o[0]],m=y.jsx("div",{dangerouslySetInnerHTML:{__html:g}});return y.jsx("div",{className:"text-sm text-foreground/80 hover:cursor-text",onMouseDown:v=>v.stopPropagation(),children:m})}function d(){const p=(e==null?void 0:e.description)||"";return y.jsx("div",{onMouseDown:g=>g.stopPropagation(),children:y.jsx(Vo,{enabled:!0,type:"textarea",className:"w-full rounded-md bg-muted",text:(e==null?void 0:e.description)||"Double click to add description",onSave:g=>{s===!1&&l(i,e.id,g),s===!0&&c({...e,description:g})},children:y.jsx("div",{className:"text-sm text-foreground/70 hover:cursor-text",dangerouslySetInnerHTML:{__html:p}})})})}return y.jsxs(y.Fragment,{children:[!a&&d(),a===!0&&u()]})}const Nk=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Fk=ja,XS=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Fk(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(c=>{const u=n==null?void 0:n[c],d=i==null?void 0:i[c];if(u===null)return null;const h=Nk(u)||Nk(d);return o[c][h]}),a=n&&Object.entries(n).reduce((c,u)=>{let[d,h]=u;return h===void 0||(c[d]=h),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:h,...f}=u;return Object.entries(f).every(p=>{let[g,m]=p;return Array.isArray(m)?m.includes({...i,...a}[g]):{...i,...a}[g]===m})?[...c,d,h]:c},[]);return Fk(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},qd=XS("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),bn=R.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?Ni:"button";return y.jsx(s,{className:ie(qd({variant:t,size:n,className:e})),ref:i,...o})});bn.displayName="Button";var bte="Label",W5=R.forwardRef((e,t)=>y.jsx(me.label,{...e,ref:t,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));W5.displayName=bte;var U5=W5;const yte=XS("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Lt=R.forwardRef(({className:e,...t},n)=>y.jsx(U5,{ref:n,className:ie(yte(),e),...t}));Lt.displayName=U5.displayName;var vte="Separator",Lk="horizontal",xte=["horizontal","vertical"],q5=R.forwardRef((e,t)=>{const{decorative:n,orientation:r=Lk,...o}=e,i=wte(r)?r:Lk,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return y.jsx(me.div,{"data-orientation":i,...a,...o,ref:t})});q5.displayName=vte;function wte(e){return xte.includes(e)}var G5=q5;const ob=R.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>y.jsx(G5,{ref:o,decorative:n,orientation:t,className:ie("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));ob.displayName=G5.displayName;function Ste(){const e=se(g=>g.themeStyle),t=se(g=>g.filterValues),n=se(g=>g.dashboard.filters),r=se(g=>g.filteringCards),o=se(g=>g.selectedSheetId),{removeFilterValues:i,removeFilteringCard:s,setFilterValues:a,setFilteringCards:l}=tn(),c=n==null?void 0:n.filter(g=>g.sheetId===o||!g.sheetId),u=t==null?void 0:t.filter(g=>(c==null?void 0:c.some(m=>m.id===g.filterId))||g.filterId.endsWith(o));if(!u||u.length===0)return null;const d=u.map(g=>{const m=n==null?void 0:n.find(b=>b.id===g.filterId);return{filterId:g.filterId,name:(m==null?void 0:m.title)||g.name,values:g.values}});function h(g){return g instanceof Date?g.toLocaleDateString():g}function f(g){const m=r==null?void 0:r.find(b=>g.filterId.startsWith(b.id));m&&s(m),i(g.filterId)}function p(g){return y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{style:{borderRadius:e==null?void 0:e.controlInputRadius},className:"flex w-fit items-center gap-2 border border-border bg-muted px-2 py-1",children:[y.jsx("span",{className:"break-words",children:g.name}),y.jsx(al,{onClick:()=>f(g),className:"size-3 hover:cursor-pointer"})]}),y.jsx("div",{className:"flex flex-col gap-1 px-1",children:g.values.map((m,b)=>y.jsx("div",{style:{borderRadius:e==null?void 0:e.cardBorderRadius},className:"inline-block",children:h(m)},(m==null?void 0:m.toString())+b))})]})}return y.jsxs(Qm,{openDelay:50,children:[y.jsx(Zm,{children:y.jsx(UA,{onClick:()=>{l([]),a([])},className:"size-3.5 text-muted-foreground hover:cursor-pointer"})}),y.jsxs(Nf,{style:{borderRadius:e==null?void 0:e.cardBorderRadius},className:"min-h-fit w-[300px] flex-col space-y-4 px-0 text-xs",align:"start",children:[y.jsx(Lt,{className:"px-5 font-medium",children:"Active Filters"}),y.jsx("div",{className:"h-fit max-h-[150px] min-h-0 grow overflow-auto",children:d==null?void 0:d.map((g,m)=>y.jsxs("div",{className:"px-5",children:[p(g),m<d.length-1&&y.jsx(ob,{className:"my-4"})]},g.name))})]})]})}const Cte=R.forwardRef(({className:e,containerClassName:t,containerStyle:n,...r},o)=>y.jsx("div",{style:n,className:ie("relative w-full overflow-auto",t),children:y.jsx("table",{ref:o,className:ie("w-full caption-bottom text-sm",e),...r})}));Cte.displayName="Table";const QS=R.forwardRef(({className:e,...t},n)=>y.jsx("thead",{ref:n,className:ie("[&_tr]:border-b",e),...t}));QS.displayName="TableHeader";const ZS=R.forwardRef(({className:e,...t},n)=>y.jsx("tbody",{ref:n,className:ie("[&_tr:last-child]:border-0",e),...t}));ZS.displayName="TableBody";const _te=R.forwardRef(({className:e,...t},n)=>y.jsx("tfoot",{ref:n,className:ie("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));_te.displayName="TableFooter";const dd=R.forwardRef(({className:e,...t},n)=>y.jsx("tr",{ref:n,className:ie("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));dd.displayName="TableRow";const JS=R.forwardRef(({className:e,...t},n)=>y.jsx("th",{ref:n,className:ie("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));JS.displayName="TableHead";const Tg=R.forwardRef(({className:e,...t},n)=>y.jsx("td",{ref:n,className:ie("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Tg.displayName="TableCell";const Ete=R.forwardRef(({className:e,...t},n)=>y.jsx("caption",{ref:n,className:ie("mt-4 text-sm text-muted-foreground",e),...t}));Ete.displayName="TableCaption";/**
245
+ `):e}function WK(e,t){const{element:n,datasetIndex:r,index:o}=t,i=e.getDatasetMeta(r).controller,{label:s,value:a}=i.getLabelAndValue(o);return{chart:e,label:s,parsed:i.getParsed(o),raw:e.data.datasets[r].data[o],formattedValue:a,dataset:i.getDataset(),dataIndex:o,datasetIndex:r,element:n}}function CR(e,t){const n=e.chart.ctx,{body:r,footer:o,title:i}=e,{boxWidth:s,boxHeight:a}=t,l=un(t.bodyFont),c=un(t.titleFont),u=un(t.footerFont),d=i.length,h=o.length,f=r.length,p=On(t.padding);let g=p.height,m=0,b=r.reduce((w,C)=>w+C.before.length+C.lines.length+C.after.length,0);if(b+=e.beforeBody.length+e.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),b){const w=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;g+=f*w+(b-f)*l.lineHeight+(b-1)*t.bodySpacing}h&&(g+=t.footerMarginTop+h*u.lineHeight+(h-1)*t.footerSpacing);let v=0;const x=function(w){m=Math.max(m,n.measureText(w).width+v)};return n.save(),n.font=c.string,yt(e.title,x),n.font=l.string,yt(e.beforeBody.concat(e.afterBody),x),v=t.displayColors?s+2+t.boxPadding:0,yt(r,w=>{yt(w.before,x),yt(w.lines,x),yt(w.after,x)}),v=0,n.font=u.string,yt(e.footer,x),n.restore(),m+=p.width,{width:m,height:g}}function UK(e,t){const{y:n,height:r}=t;return n<r/2?"top":n>e.height-r/2?"bottom":"center"}function qK(e,t,n,r){const{x:o,width:i}=r,s=n.caretSize+n.caretPadding;if(e==="left"&&o+i+s>t.width||e==="right"&&o-i-s<0)return!0}function GK(e,t,n,r){const{x:o,width:i}=n,{width:s,chartArea:{left:a,right:l}}=e;let c="center";return r==="center"?c=o<=(a+l)/2?"left":"right":o<=i/2?c="left":o>=s-i/2&&(c="right"),qK(c,e,t,n)&&(c="center"),c}function _R(e,t,n){const r=n.yAlign||t.yAlign||UK(e,n);return{xAlign:n.xAlign||t.xAlign||GK(e,t,n,r),yAlign:r}}function YK(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function KK(e,t,n){let{y:r,height:o}=e;return t==="top"?r+=n:t==="bottom"?r-=o+n:r-=o/2,r}function ER(e,t,n,r){const{caretSize:o,caretPadding:i,cornerRadius:s}=e,{xAlign:a,yAlign:l}=n,c=o+i,{topLeft:u,topRight:d,bottomLeft:h,bottomRight:f}=ka(s);let p=YK(t,a);const g=KK(t,l,c);return l==="center"?a==="left"?p+=c:a==="right"&&(p-=c):a==="left"?p-=Math.max(u,h)+o:a==="right"&&(p+=Math.max(d,f)+o),{x:Sn(p,0,r.width-t.width),y:Sn(g,0,r.height-t.height)}}function Fh(e,t,n){const r=On(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function RR(e){return _o([],gi(e))}function XK(e,t,n){return Ds(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function kR(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const JT={beforeTitle:ci,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(r>0&&t.dataIndex<r)return n[t.dataIndex]}return""},afterTitle:ci,beforeBody:ci,beforeLabel:ci,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return ze(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:ci,afterBody:ci,beforeFooter:ci,footer:ci,afterFooter:ci};function ar(e,t,n,r){const o=e[t].call(n,r);return typeof o>"u"?JT[t].call(n,r):o}var vv;let PR=(vv=class extends ri{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,r=this.options.setContext(this.getContext()),o=r.enabled&&n.options.animation&&r.animations,i=new AT(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=XK(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:r}=n,o=ar(r,"beforeTitle",this,t),i=ar(r,"title",this,t),s=ar(r,"afterTitle",this,t);let a=[];return a=_o(a,gi(o)),a=_o(a,gi(i)),a=_o(a,gi(s)),a}getBeforeBody(t,n){return RR(ar(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,o=[];return yt(t,i=>{const s={before:[],lines:[],after:[]},a=kR(r,i);_o(s.before,gi(ar(a,"beforeLabel",this,i))),_o(s.lines,ar(a,"label",this,i)),_o(s.after,gi(ar(a,"afterLabel",this,i))),o.push(s)}),o}getAfterBody(t,n){return RR(ar(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:r}=n,o=ar(r,"beforeFooter",this,t),i=ar(r,"footer",this,t),s=ar(r,"afterFooter",this,t);let a=[];return a=_o(a,gi(o)),a=_o(a,gi(i)),a=_o(a,gi(s)),a}_createItems(t){const n=this._active,r=this.chart.data,o=[],i=[],s=[];let a=[],l,c;for(l=0,c=n.length;l<c;++l)a.push(WK(this.chart,n[l]));return t.filter&&(a=a.filter((u,d,h)=>t.filter(u,d,h,r))),t.itemSort&&(a=a.sort((u,d)=>t.itemSort(u,d,r))),yt(a,u=>{const d=kR(t.callbacks,u);o.push(ar(d,"labelColor",this,u)),i.push(ar(d,"labelPointStyle",this,u)),s.push(ar(d,"labelTextColor",this,u))}),this.labelColors=o,this.labelPointStyles=i,this.labelTextColors=s,this.dataPoints=a,a}update(t,n){const r=this.options.setContext(this.getContext()),o=this._active;let i,s=[];if(!o.length)this.opacity!==0&&(i={opacity:0});else{const a=Wu[r.position].call(this,o,this._eventPosition);s=this._createItems(r),this.title=this.getTitle(s,r),this.beforeBody=this.getBeforeBody(s,r),this.body=this.getBody(s,r),this.afterBody=this.getAfterBody(s,r),this.footer=this.getFooter(s,r);const l=this._size=CR(this,r),c=Object.assign({},a,l),u=_R(this.chart,r,c),d=ER(r,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,i={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=s,this.$context=void 0,i&&this._resolveAnimations().update(this,i),t&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,r,o){const i=this.getCaretPosition(t,r,o);n.lineTo(i.x1,i.y1),n.lineTo(i.x2,i.y2),n.lineTo(i.x3,i.y3)}getCaretPosition(t,n,r){const{xAlign:o,yAlign:i}=this,{caretSize:s,cornerRadius:a}=r,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:d}=ka(a),{x:h,y:f}=t,{width:p,height:g}=n;let m,b,v,x,w,C;return i==="center"?(w=f+g/2,o==="left"?(m=h,b=m-s,x=w+s,C=w-s):(m=h+p,b=m+s,x=w-s,C=w+s),v=m):(o==="left"?b=h+Math.max(l,u)+s:o==="right"?b=h+p-Math.max(c,d)-s:b=this.caretX,i==="top"?(x=f,w=x-s,m=b-s,v=b+s):(x=f+g,w=x+s,m=b+s,v=b-s),C=x),{x1:m,x2:b,x3:v,y1:x,y2:w,y3:C}}drawTitle(t,n,r){const o=this.title,i=o.length;let s,a,l;if(i){const c=Yl(r.rtl,this.x,this.width);for(t.x=Fh(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",s=un(r.titleFont),a=r.titleSpacing,n.fillStyle=r.titleColor,n.font=s.string,l=0;l<i;++l)n.fillText(o[l],c.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+a,l+1===i&&(t.y+=r.titleMarginBottom-a)}}_drawColorBox(t,n,r,o,i){const s=this.labelColors[r],a=this.labelPointStyles[r],{boxHeight:l,boxWidth:c}=i,u=un(i.bodyFont),d=Fh(this,"left",i),h=o.x(d),f=l<u.lineHeight?(u.lineHeight-l)/2:0,p=n.y+f;if(i.usePointStyle){const g={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},m=o.leftForLtr(h,c)+c/2,b=p+l/2;t.strokeStyle=i.multiKeyBackground,t.fillStyle=i.multiKeyBackground,ag(t,g,m,b),t.strokeStyle=s.borderColor,t.fillStyle=s.backgroundColor,ag(t,g,m,b)}else{t.lineWidth=tt(s.borderWidth)?Math.max(...Object.values(s.borderWidth)):s.borderWidth||1,t.strokeStyle=s.borderColor,t.setLineDash(s.borderDash||[]),t.lineDashOffset=s.borderDashOffset||0;const g=o.leftForLtr(h,c),m=o.leftForLtr(o.xPlus(h,1),c-2),b=ka(s.borderRadius);Object.values(b).some(v=>v!==0)?(t.beginPath(),t.fillStyle=i.multiKeyBackground,Id(t,{x:g,y:p,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=s.backgroundColor,t.beginPath(),Id(t,{x:m,y:p+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=i.multiKeyBackground,t.fillRect(g,p,c,l),t.strokeRect(g,p,c,l),t.fillStyle=s.backgroundColor,t.fillRect(m,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[r]}drawBody(t,n,r){const{body:o}=this,{bodySpacing:i,bodyAlign:s,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=r,d=un(r.bodyFont);let h=d.lineHeight,f=0;const p=Yl(r.rtl,this.x,this.width),g=function(P){n.fillText(P,p.x(t.x+f),t.y+h/2),t.y+=h+i},m=p.textAlign(s);let b,v,x,w,C,S,E;for(n.textAlign=s,n.textBaseline="middle",n.font=d.string,t.x=Fh(this,m,r),n.fillStyle=r.bodyColor,yt(this.beforeBody,g),f=a&&m!=="right"?s==="center"?c/2+u:c+2+u:0,w=0,S=o.length;w<S;++w){for(b=o[w],v=this.labelTextColors[w],n.fillStyle=v,yt(b.before,g),x=b.lines,a&&x.length&&(this._drawColorBox(n,t,w,p,r),h=Math.max(d.lineHeight,l)),C=0,E=x.length;C<E;++C)g(x[C]),h=d.lineHeight;yt(b.after,g)}f=0,h=d.lineHeight,yt(this.afterBody,g),t.y-=i}drawFooter(t,n,r){const o=this.footer,i=o.length;let s,a;if(i){const l=Yl(r.rtl,this.x,this.width);for(t.x=Fh(this,r.footerAlign,r),t.y+=r.footerMarginTop,n.textAlign=l.textAlign(r.footerAlign),n.textBaseline="middle",s=un(r.footerFont),n.fillStyle=r.footerColor,n.font=s.string,a=0;a<i;++a)n.fillText(o[a],l.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+r.footerSpacing}}drawBackground(t,n,r,o){const{xAlign:i,yAlign:s}=this,{x:a,y:l}=t,{width:c,height:u}=r,{topLeft:d,topRight:h,bottomLeft:f,bottomRight:p}=ka(o.cornerRadius);n.fillStyle=o.backgroundColor,n.strokeStyle=o.borderColor,n.lineWidth=o.borderWidth,n.beginPath(),n.moveTo(a+d,l),s==="top"&&this.drawCaret(t,n,r,o),n.lineTo(a+c-h,l),n.quadraticCurveTo(a+c,l,a+c,l+h),s==="center"&&i==="right"&&this.drawCaret(t,n,r,o),n.lineTo(a+c,l+u-p),n.quadraticCurveTo(a+c,l+u,a+c-p,l+u),s==="bottom"&&this.drawCaret(t,n,r,o),n.lineTo(a+f,l+u),n.quadraticCurveTo(a,l+u,a,l+u-f),s==="center"&&i==="left"&&this.drawCaret(t,n,r,o),n.lineTo(a,l+d),n.quadraticCurveTo(a,l,a+d,l),n.closePath(),n.fill(),o.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,r=this.$animations,o=r&&r.x,i=r&&r.y;if(o||i){const s=Wu[t.position].call(this,this._active,this._eventPosition);if(!s)return;const a=this._size=CR(this,t),l=Object.assign({},s,this._size),c=_R(n,t,l),u=ER(t,l,c,n);(o._to!==u.x||i._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=s.x,this.caretY=s.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const o={width:this.width,height:this.height},i={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const s=On(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=r,this.drawBackground(i,t,o,n),kT(t,n.textDirection),i.y+=s.top,this.drawTitle(i,t,n),this.drawBody(i,t,n),this.drawFooter(i,t,n),PT(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const r=this._active,o=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),i=!rg(r,o),s=this._positionChanged(o,n);(i||s)&&(this._active=o,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const o=this.options,i=this._active||[],s=this._getActiveElements(t,i,n,r),a=this._positionChanged(s,t),l=n||!rg(s,i)||a;return l&&(this._active=s,(o.enabled||o.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,r,o){const i=this.options;if(t.type==="mouseout")return[];if(!o)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const s=this.chart.getElementsAtEventForMode(t,i.mode,i,r);return i.reverse&&s.reverse(),s}_positionChanged(t,n){const{caretX:r,caretY:o,options:i}=this,s=Wu[i.position].call(this,t,n);return s!==!1&&(r!==s.x||o!==s.y)}},pe(vv,"positioners",Wu),vv);var eI={id:"tooltip",_element:PR,positioners:Wu,afterInit(e,t,n){n&&(e.tooltip=new PR({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:JT},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},QK=Object.freeze({__proto__:null,Colors:uK,Decimation:pK,Filler:IK,Legend:zK,SubTitle:HK,Title:VK,Tooltip:eI});const ZK=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function JK(e,t,n,r){const o=e.indexOf(t);if(o===-1)return ZK(e,t,n,r);const i=e.lastIndexOf(t);return o!==i?n:o}const eX=(e,t)=>e===null?null:Sn(Math.round(e),0,t);function MR(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class Fd extends Os{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const r=this.getLabels();for(const{index:o,label:i}of n)r[o]===i&&r.splice(o,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(ze(t))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===t?n:JK(r,t,Ae(n,t),this._addedLabels),eX(n,r.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:r,max:o}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(r=0),n||(o=this.getLabels().length-1)),this.min=r,this.max=o}buildTicks(){const t=this.min,n=this.max,r=this.options.offset,o=[];let i=this.getLabels();i=t===0&&n===i.length-1?i:i.slice(t,n+1),this._valueRange=Math.max(i.length-(r?0:1),1),this._startValue=this.min-(r?.5:0);for(let s=t;s<=n;s++)o.push({value:s});return o}getLabelForValue(t){return MR.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}pe(Fd,"id","category"),pe(Fd,"defaults",{ticks:{callback:MR}});function tX(e,t){const n=[],{bounds:o,step:i,min:s,max:a,precision:l,count:c,maxTicks:u,maxDigits:d,includeBounds:h}=e,f=i||1,p=u-1,{min:g,max:m}=t,b=!ze(s),v=!ze(a),x=!ze(c),w=(m-g)/(d+1);let C=C2((m-g)/p/f)*f,S,E,P,M;if(C<1e-14&&!b&&!v)return[{value:g},{value:m}];M=Math.ceil(m/C)-Math.floor(g/C),M>p&&(C=C2(M*C/p/f)*f),ze(l)||(S=Math.pow(10,l),C=Math.ceil(C*S)/S),o==="ticks"?(E=Math.floor(g/C)*C,P=Math.ceil(m/C)*C):(E=g,P=m),b&&v&&i&&KU((a-s)/i,C/1e3)?(M=Math.round(Math.min((a-s)/C,u)),C=(a-s)/M,E=s,P=a):x?(E=b?s:E,P=v?a:P,M=c-1,C=(P-E)/M):(M=(P-E)/C,nd(M,Math.round(M),C/1e3)?M=Math.round(M):M=Math.ceil(M));const D=Math.max(_2(C),_2(E));S=Math.pow(10,ze(l)?D:l),E=Math.round(E*S)/S,P=Math.round(P*S)/S;let A=0;for(b&&(h&&E!==s?(n.push({value:s}),E<s&&A++,nd(Math.round((E+A*C)*S)/S,s,DR(s,w,e))&&A++):E<s&&A++);A<M;++A){const I=Math.round((E+A*C)*S)/S;if(v&&I>a)break;n.push({value:I})}return v&&h&&P!==a?n.length&&nd(n[n.length-1].value,a,DR(a,w,e))?n[n.length-1].value=a:n.push({value:a}):(!v||P===a)&&n.push({value:P}),n}function DR(e,t,{horizontal:n,minRotation:r}){const o=co(r),i=(n?Math.sin(o):Math.cos(o))||.001,s=.75*t*(""+e).length;return Math.min(t/i,s)}class dg extends Os{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return ze(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:o,max:i}=this;const s=l=>o=n?o:l,a=l=>i=r?i:l;if(t){const l=$o(o),c=$o(i);l<0&&c<0?a(0):l>0&&c>0&&s(0)}if(o===i){let l=i===0?1:Math.abs(i*.05);a(i+l),t||s(o-l)}this.min=o,this.max=i}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=t,o;return r?(o=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,o>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${o} ticks. Limiting to 1000.`),o=1e3)):(o=this.computeTickLimit(),n=n||11),n&&(o=Math.min(n,o)),o}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let r=this.getTickLimit();r=Math.max(2,r);const o={maxTicks:r,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},i=this._range||this,s=tX(o,i);return t.bounds==="ticks"&&uT(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}configure(){const t=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&t.length){const o=(r-n)/Math.max(t.length-1,1)/2;n-=o,r+=o}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(t){return Pf(t,this.chart.options.locale,this.options.ticks.format)}}class Ua extends dg{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Qt(t)?t:0,this.max=Qt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=co(this.options.ticks.minRotation),o=(t?Math.sin(r):Math.cos(r))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,i.lineHeight/o))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}pe(Ua,"id","linear"),pe(Ua,"defaults",{ticks:{callback:Lm.formatters.numeric}});const Ld=e=>Math.floor(ls(e)),Ys=(e,t)=>Math.pow(10,Ld(e)+t);function OR(e){return e/Math.pow(10,Ld(e))===1}function AR(e,t,n){const r=Math.pow(10,n),o=Math.floor(e/r);return Math.ceil(t/r)-o}function nX(e,t){const n=t-e;let r=Ld(n);for(;AR(e,t,r)>10;)r++;for(;AR(e,t,r)<10;)r--;return Math.min(r,Ld(e))}function rX(e,{min:t,max:n}){t=kr(e.min,t);const r=[],o=Ld(t);let i=nX(t,n),s=i<0?Math.pow(10,Math.abs(i)):1;const a=Math.pow(10,i),l=o>i?Math.pow(10,o):0,c=Math.round((t-l)*s)/s,u=Math.floor((t-l)/a/10)*a*10;let d=Math.floor((c-u)/Math.pow(10,i)),h=kr(e.min,Math.round((l+u+d*Math.pow(10,i))*s)/s);for(;h<n;)r.push({value:h,major:OR(h),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(i++,d=2,s=i>=0?1:s),h=Math.round((l+u+d*Math.pow(10,i))*s)/s;const f=kr(e.max,h);return r.push({value:f,major:OR(f),significand:d}),r}class Dc extends Os{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const r=dg.prototype.parse.apply(this,[t,n]);if(r===0){this._zero=!0;return}return Qt(r)&&r>0?r:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Qt(t)?Math.max(0,t):null,this.max=Qt(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Qt(this._userMin)&&(this.min=t===Ys(this.min,0)?Ys(this.min,-1):Ys(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let r=this.min,o=this.max;const i=a=>r=t?r:a,s=a=>o=n?o:a;r===o&&(r<=0?(i(1),s(10)):(i(Ys(r,-1)),s(Ys(o,1)))),r<=0&&i(Ys(o,-1)),o<=0&&s(Ys(r,1)),this.min=r,this.max=o}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},r=rX(n,this);return t.bounds==="ticks"&&uT(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}getLabelForValue(t){return t===void 0?"0":Pf(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=ls(t),this._valueRange=ls(this.max)-ls(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(ls(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}pe(Dc,"id","logarithmic"),pe(Dc,"defaults",{ticks:{callback:Lm.formatters.logarithmic,major:{enabled:!0}}});function bx(e){const t=e.ticks;if(t.display&&e.display){const n=On(t.backdropPadding);return Ae(t.font&&t.font.size,zt.font.size)+n.height}return 0}function oX(e,t,n){return n=jt(n)?n:[n],{w:fq(e,t.string,n),h:n.length*t.lineHeight}}function TR(e,t,n,r,o){return e===r||e===o?{start:t-n/2,end:t+n/2}:e<r||e>o?{start:t-n,end:t}:{start:t,end:t+n}}function iX(e){const t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),r=[],o=[],i=e._pointLabels.length,s=e.options.pointLabels,a=s.centerPointLabels?Bt/i:0;for(let l=0;l<i;l++){const c=s.setContext(e.getPointLabelContext(l));o[l]=c.padding;const u=e.getPointPosition(l,e.drawingArea+o[l],a),d=un(c.font),h=oX(e.ctx,d,e._pointLabels[l]);r[l]=h;const f=Mr(e.getIndexAngle(l)+a),p=Math.round(sS(f)),g=TR(p,u.x,h.w,0,180),m=TR(p,u.y,h.h,90,270);sX(n,t,f,g,m)}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=cX(e,r,o)}function sX(e,t,n,r,o){const i=Math.abs(Math.sin(n)),s=Math.abs(Math.cos(n));let a=0,l=0;r.start<t.l?(a=(t.l-r.start)/i,e.l=Math.min(e.l,t.l-a)):r.end>t.r&&(a=(r.end-t.r)/i,e.r=Math.max(e.r,t.r+a)),o.start<t.t?(l=(t.t-o.start)/s,e.t=Math.min(e.t,t.t-l)):o.end>t.b&&(l=(o.end-t.b)/s,e.b=Math.max(e.b,t.b+l))}function aX(e,t,n){const r=e.drawingArea,{extra:o,additionalAngle:i,padding:s,size:a}=n,l=e.getPointPosition(t,r+o+s,i),c=Math.round(sS(Mr(l.angle+en))),u=fX(l.y,a.h,c),d=uX(c),h=dX(l.x,a.w,d);return{visible:!0,x:l.x,y:u,textAlign:d,left:h,top:u,right:h+a.w,bottom:u+a.h}}function lX(e,t){if(!t)return!0;const{left:n,top:r,right:o,bottom:i}=e;return!(Mi({x:n,y:r},t)||Mi({x:n,y:i},t)||Mi({x:o,y:r},t)||Mi({x:o,y:i},t))}function cX(e,t,n){const r=[],o=e._pointLabels.length,i=e.options,{centerPointLabels:s,display:a}=i.pointLabels,l={extra:bx(i)/2,additionalAngle:s?Bt/o:0};let c;for(let u=0;u<o;u++){l.padding=n[u],l.size=t[u];const d=aX(e,u,l);r.push(d),a==="auto"&&(d.visible=lX(d,c),d.visible&&(c=d))}return r}function uX(e){return e===0||e===180?"center":e<180?"left":"right"}function dX(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function fX(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function hX(e,t,n){const{left:r,top:o,right:i,bottom:s}=n,{backdropColor:a}=t;if(!ze(a)){const l=ka(t.borderRadius),c=On(t.backdropPadding);e.fillStyle=a;const u=r-c.left,d=o-c.top,h=i-r+c.width,f=s-o+c.height;Object.values(l).some(p=>p!==0)?(e.beginPath(),Id(e,{x:u,y:d,w:h,h:f,radius:l}),e.fill()):e.fillRect(u,d,h,f)}}function pX(e,t){const{ctx:n,options:{pointLabels:r}}=e;for(let o=t-1;o>=0;o--){const i=e._pointLabelItems[o];if(!i.visible)continue;const s=r.setContext(e.getPointLabelContext(o));hX(n,s,i);const a=un(s.font),{x:l,y:c,textAlign:u}=i;Wa(n,e._pointLabels[o],l,c+a.lineHeight/2,a,{color:s.color,textAlign:u,textBaseline:"middle"})}}function tI(e,t,n,r){const{ctx:o}=e;if(n)o.arc(e.xCenter,e.yCenter,t,0,$t);else{let i=e.getPointPosition(0,t);o.moveTo(i.x,i.y);for(let s=1;s<r;s++)i=e.getPointPosition(s,t),o.lineTo(i.x,i.y)}}function gX(e,t,n,r,o){const i=e.ctx,s=t.circular,{color:a,lineWidth:l}=t;!s&&!r||!a||!l||n<0||(i.save(),i.strokeStyle=a,i.lineWidth=l,i.setLineDash(o.dash||[]),i.lineDashOffset=o.dashOffset,i.beginPath(),tI(e,n,s,r),i.closePath(),i.stroke(),i.restore())}function mX(e,t,n){return Ds(e,{label:n,index:t,type:"pointLabel"})}class Uu extends dg{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=On(bx(this.options)/2),n=this.width=this.maxWidth-t.width,r=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+n/2+t.left),this.yCenter=Math.floor(this.top+r/2+t.top),this.drawingArea=Math.floor(Math.min(n,r)/2)}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!1);this.min=Qt(t)&&!isNaN(t)?t:0,this.max=Qt(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/bx(this.options))}generateTickLabels(t){dg.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,r)=>{const o=_t(this.options.pointLabels.callback,[n,r],this);return o||o===0?o:""}).filter((n,r)=>this.chart.getDataVisibility(r))}fit(){const t=this.options;t.display&&t.pointLabels.display?iX(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,n,r,o){this.xCenter+=Math.floor((t-n)/2),this.yCenter+=Math.floor((r-o)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,n,r,o))}getIndexAngle(t){const n=$t/(this._pointLabels.length||1),r=this.options.startAngle||0;return Mr(t*n+co(r))}getDistanceFromCenterForValue(t){if(ze(t))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*n:(t-this.min)*n}getValueForDistanceFromCenter(t){if(ze(t))return NaN;const n=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(t){const n=this._pointLabels||[];if(t>=0&&t<n.length){const r=n[t];return mX(this.getContext(),t,r)}}getPointPosition(t,n,r=0){const o=this.getIndexAngle(t)-en+r;return{x:Math.cos(o)*n+this.xCenter,y:Math.sin(o)*n+this.yCenter,angle:o}}getPointPositionForValue(t,n){return this.getPointPosition(t,this.getDistanceFromCenterForValue(n))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:n,top:r,right:o,bottom:i}=this._pointLabelItems[t];return{left:n,top:r,right:o,bottom:i}}drawBackground(){const{backgroundColor:t,grid:{circular:n}}=this.options;if(t){const r=this.ctx;r.save(),r.beginPath(),tI(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),r.closePath(),r.fillStyle=t,r.fill(),r.restore()}}drawGrid(){const t=this.ctx,n=this.options,{angleLines:r,grid:o,border:i}=n,s=this._pointLabels.length;let a,l,c;if(n.pointLabels.display&&pX(this,s),o.display&&this.ticks.forEach((u,d)=>{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(u.value);const h=this.getContext(d),f=o.setContext(h),p=i.setContext(h);gX(this,f,l,s,p)}}),r.display){for(t.save(),a=s-1;a>=0;a--){const u=r.setContext(this.getPointLabelContext(a)),{color:d,lineWidth:h}=u;!h||!d||(t.lineWidth=h,t.strokeStyle=d,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,l=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,n=this.options,r=n.ticks;if(!r.display)return;const o=this.getIndexAngle(0);let i,s;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(o),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!n.reverse)return;const c=r.setContext(this.getContext(l)),u=un(c.font);if(i=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=u.string,s=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const d=On(c.backdropPadding);t.fillRect(-s/2-d.left,-i-u.size/2-d.top,s+d.width,u.size+d.height)}Wa(t,a.label,0,-i,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}pe(Uu,"id","radialLinear"),pe(Uu,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Lm.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),pe(Uu,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),pe(Uu,"descriptors",{angleLines:{_fallback:"grid"}});const zm={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}},gr=Object.keys(zm);function IR(e,t){return e-t}function NR(e,t){if(ze(t))return null;const n=e._adapter,{parser:r,round:o,isoWeekday:i}=e._parseOpts;let s=t;return typeof r=="function"&&(s=r(s)),Qt(s)||(s=typeof r=="string"?n.parse(s,r):n.parse(s)),s===null?null:(o&&(s=o==="week"&&(kc(i)||i===!0)?n.startOf(s,"isoWeek",i):n.startOf(s,o)),+s)}function FR(e,t,n,r){const o=gr.length;for(let i=gr.indexOf(e);i<o-1;++i){const s=zm[gr[i]],a=s.steps?s.steps:Number.MAX_SAFE_INTEGER;if(s.common&&Math.ceil((n-t)/(a*s.size))<=r)return gr[i]}return gr[o-1]}function bX(e,t,n,r,o){for(let i=gr.length-1;i>=gr.indexOf(n);i--){const s=gr[i];if(zm[s].common&&e._adapter.diff(o,r,s)>=t-1)return s}return gr[n?gr.indexOf(n):0]}function yX(e){for(let t=gr.indexOf(e)+1,n=gr.length;t<n;++t)if(zm[gr[t]].common)return gr[t]}function LR(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:r,hi:o}=aS(n,t),i=n[r]>=t?n[r]:n[o];e[i]=!0}}function vX(e,t,n,r){const o=e._adapter,i=+o.startOf(t[0].value,r),s=t[t.length-1].value;let a,l;for(a=i;a<=s;a=+o.add(a,1,r))l=n[a],l>=0&&(t[l].major=!0);return t}function jR(e,t,n){const r=[],o={},i=t.length;let s,a;for(s=0;s<i;++s)a=t[s],o[a]=s,r.push({value:a,major:!1});return i===0||!n?r:vX(e,r,o,n)}class jd extends Os{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const r=t.time||(t.time={}),o=this._adapter=new PG._date(t.adapters.date);o.init(n),td(r.displayFormats,o.formats()),this._parseOpts={parser:r.parser,round:r.round,isoWeekday:r.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:NR(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,r=t.time.unit||"day";let{min:o,max:i,minDefined:s,maxDefined:a}=this.getUserBounds();function l(c){!s&&!isNaN(c.min)&&(o=Math.min(o,c.min)),!a&&!isNaN(c.max)&&(i=Math.max(i,c.max))}(!s||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),o=Qt(o)&&!isNaN(o)?o:+n.startOf(Date.now(),r),i=Qt(i)&&!isNaN(i)?i:+n.endOf(Date.now(),r)+1,this.min=Math.min(o,i-1),this.max=Math.max(o+1,i)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],r=t[t.length-1]),{min:n,max:r}}buildTicks(){const t=this.options,n=t.time,r=t.ticks,o=r.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&o.length&&(this.min=this._userMin||o[0],this.max=this._userMax||o[o.length-1]);const i=this.min,s=this.max,a=JU(o,i,s);return this._unit=n.unit||(r.autoSkip?FR(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):bX(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:yX(this._unit),this.initOffsets(o),t.reverse&&a.reverse(),jR(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,r=0,o,i;this.options.offset&&t.length&&(o=this.getDecimalForValue(t[0]),t.length===1?n=1-o:n=(this.getDecimalForValue(t[1])-o)/2,i=this.getDecimalForValue(t[t.length-1]),t.length===1?r=i:r=(i-this.getDecimalForValue(t[t.length-2]))/2);const s=t.length<3?.5:.25;n=Sn(n,0,s),r=Sn(r,0,s),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const t=this._adapter,n=this.min,r=this.max,o=this.options,i=o.time,s=i.unit||FR(i.minUnit,n,r,this._getLabelCapacity(n)),a=Ae(o.ticks.stepSize,1),l=s==="week"?i.isoWeekday:!1,c=kc(l)||l===!0,u={};let d=n,h,f;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":s),t.diff(r,n,s)>1e5*a)throw new Error(n+" and "+r+" are too far apart with stepSize of "+a+" "+s);const p=o.ticks.source==="data"&&this.getDataTimestamps();for(h=d,f=0;h<r;h=+t.add(h,a,s),f++)LR(u,h,p);return(h===r||o.bounds==="ticks"||f===1)&&LR(u,h,p),Object.keys(u).sort(IR).map(g=>+g)}getLabelForValue(t){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(t,r.tooltipFormat):n.format(t,r.displayFormats.datetime)}format(t,n){const o=this.options.time.displayFormats,i=this._unit,s=n||o[i];return this._adapter.format(t,s)}_tickFormatFunction(t,n,r,o){const i=this.options,s=i.ticks.callback;if(s)return _t(s,[t,n,r],this);const a=i.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],d=c&&a[c],h=r[n],f=c&&d&&h&&h.major;return this._adapter.format(t,o||(f?d:u))}generateTickLabels(t){let n,r,o;for(n=0,r=t.length;n<r;++n)o=t[n],o.label=this._tickFormatFunction(o.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,r=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+r)*n.factor)}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+r*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,r=this.ctx.measureText(t).width,o=co(this.isHorizontal()?n.maxRotation:n.minRotation),i=Math.cos(o),s=Math.sin(o),a=this._resolveTickFontOptions(0).size;return{w:r*i+a*s,h:r*s+a*i}}_getLabelCapacity(t){const n=this.options.time,r=n.displayFormats,o=r[n.unit]||r.millisecond,i=this._tickFormatFunction(t,0,jR(this,[t],this._majorUnit),o),s=this._getLabelSize(i),a=Math.floor(this.isHorizontal()?this.width/s.w:this.height/s.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,r;if(t.length)return t;const o=this.getMatchingVisibleMetas();if(this._normalized&&o.length)return this._cache.data=o[0].controller.getAllParsedValues(this);for(n=0,r=o.length;n<r;++n)t=t.concat(o[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,r;if(t.length)return t;const o=this.getLabels();for(n=0,r=o.length;n<r;++n)t.push(NR(this,o[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return hT(t.sort(IR))}}pe(jd,"id","time"),pe(jd,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Lh(e,t,n){let r=0,o=e.length-1,i,s,a,l;n?(t>=e[r].pos&&t<=e[o].pos&&({lo:r,hi:o}=Pi(e,"pos",t)),{pos:i,time:a}=e[r],{pos:s,time:l}=e[o]):(t>=e[r].time&&t<=e[o].time&&({lo:r,hi:o}=Pi(e,"time",t)),{time:i,pos:a}=e[r],{time:s,pos:l}=e[o]);const c=s-i;return c?a+(l-a)*(t-i)/c:a}class yx extends jd{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=Lh(n,this.min),this._tableRange=Lh(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:r}=this,o=[],i=[];let s,a,l,c,u;for(s=0,a=t.length;s<a;++s)c=t[s],c>=n&&c<=r&&o.push(c);if(o.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(s=0,a=o.length;s<a;++s)u=o[s+1],l=o[s-1],c=o[s],Math.round((u+l)/2)!==c&&i.push({time:c,pos:s/(a-1)});return i}_generate(){const t=this.min,n=this.max;let r=super.getDataTimestamps();return(!r.includes(t)||!r.length)&&r.splice(0,0,t),(!r.includes(n)||r.length===1)&&r.push(n),r.sort((o,i)=>o-i)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?t=this.normalize(n.concat(r)):t=n.length?n:r,t=this._cache.all=t,t}getDecimalForValue(t){return(Lh(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return Lh(this._table,r*this._tableRange+this._minPos,!0)}}pe(yx,"id","timeseries"),pe(yx,"defaults",jd.defaults);var xX=Object.freeze({__proto__:null,CategoryScale:Fd,LinearScale:Ua,LogarithmicScale:Dc,RadialLinearScale:Uu,TimeScale:jd,TimeSeriesScale:yx});const wX=[kG,rK,QK,xX];class vs{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let r=0;for(let o=0;o<this._n&&o<32;o++){const i=n[o],s=t+i,a=Math.abs(t)<Math.abs(i)?t-(s-i):i-(s-t);a&&(n[r++]=a),t=s}return n[r]=t,this._n=r+1,this}valueOf(){const t=this._partials;let n=this._n,r,o,i,s=0;if(n>0){for(s=t[--n];n>0&&(r=s,o=t[--n],s=r+o,i=o-(s-r),!i););n>0&&(i<0&&t[n-1]<0||i>0&&t[n-1]>0)&&(o=i*2,r=s+o,o==r-s&&(s=r))}return s}}function*SX(e){for(const t of e)yield*t}function nI(e){return Array.from(SX(e))}function Ll(e,t,n){e=+e,t=+t,n=(o=arguments.length)<2?(t=e,e=0,1):o<3?1:+n;for(var r=-1,o=Math.max(0,Math.ceil((t-e)/n))|0,i=new Array(o);++r<o;)i[r]=e+r*n;return i}var ke=1e-6,rI=1e-12,Xe=Math.PI,Xt=Xe/2,$R=Xe/4,Fr=Xe*2,Qn=180/Xe,Et=Xe/180,at=Math.abs,Kc=Math.atan,Go=Math.atan2,$e=Math.cos,jh=Math.ceil,oI=Math.exp,fg=Math.log,q0=Math.pow,Ie=Math.sin,Yr=Math.sign||function(e){return e>0?1:e<0?-1:0},nr=Math.sqrt,vS=Math.tan;function iI(e){return e>1?0:e<-1?Xe:Math.acos(e)}function Zr(e){return e>1?Xt:e<-1?-Xt:Math.asin(e)}function wn(){}function hg(e,t){e&&BR.hasOwnProperty(e.type)&&BR[e.type](e,t)}var zR={Feature:function(e,t){hg(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,o=n.length;++r<o;)hg(n[r].geometry,t)}},BR={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)e=n[r],t.point(e[0],e[1],e[2])},LineString:function(e,t){vx(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)vx(n[r],t,0)},Polygon:function(e,t){VR(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)VR(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,o=n.length;++r<o;)hg(n[r],t)}};function vx(e,t,n){var r=-1,o=e.length-n,i;for(t.lineStart();++r<o;)i=e[r],t.point(i[0],i[1],i[2]);t.lineEnd()}function VR(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)vx(e[n],t,1);t.polygonEnd()}function na(e,t){e&&zR.hasOwnProperty(e.type)?zR[e.type](e,t):hg(e,t)}function xx(e){return[Go(e[1],e[0]),Zr(e[2])]}function Oc(e){var t=e[0],n=e[1],r=$e(n);return[r*$e(t),r*Ie(t),Ie(n)]}function $h(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function pg(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function G0(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function zh(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function wx(e){var t=nr(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function Sx(e,t){function n(r,o){return r=e(r,o),t(r[0],r[1])}return e.invert&&t.invert&&(n.invert=function(r,o){return r=t.invert(r,o),r&&e.invert(r[0],r[1])}),n}function Cx(e,t){return at(e)>Xe&&(e-=Math.round(e/Fr)*Fr),[e,t]}Cx.invert=Cx;function sI(e,t,n){return(e%=Fr)?t||n?Sx(WR(e),UR(t,n)):WR(e):t||n?UR(t,n):Cx}function HR(e){return function(t,n){return t+=e,at(t)>Xe&&(t-=Math.round(t/Fr)*Fr),[t,n]}}function WR(e){var t=HR(e);return t.invert=HR(-e),t}function UR(e,t){var n=$e(e),r=Ie(e),o=$e(t),i=Ie(t);function s(a,l){var c=$e(l),u=$e(a)*c,d=Ie(a)*c,h=Ie(l),f=h*n+u*r;return[Go(d*o-f*i,u*n-h*r),Zr(f*o+d*i)]}return s.invert=function(a,l){var c=$e(l),u=$e(a)*c,d=Ie(a)*c,h=Ie(l),f=h*o-d*i;return[Go(d*o+h*i,u*n+f*r),Zr(f*n-u*r)]},s}function CX(e){e=sI(e[0]*Et,e[1]*Et,e.length>2?e[2]*Et:0);function t(n){return n=e(n[0]*Et,n[1]*Et),n[0]*=Qn,n[1]*=Qn,n}return t.invert=function(n){return n=e.invert(n[0]*Et,n[1]*Et),n[0]*=Qn,n[1]*=Qn,n},t}function _X(e,t,n,r,o,i){if(n){var s=$e(t),a=Ie(t),l=r*n;o==null?(o=t+r*Fr,i=t-l/2):(o=qR(s,o),i=qR(s,i),(r>0?o<i:o>i)&&(o+=r*Fr));for(var c,u=o;r>0?u>i:u<i;u-=l)c=xx([s,-a*$e(u),-a*Ie(u)]),e.point(c[0],c[1])}}function qR(e,t){t=Oc(t),t[0]-=e,wx(t);var n=iI(-t[1]);return((-t[2]<0?-n:n)+Fr-ke)%Fr}function aI(){var e=[],t;return{point:function(n,r,o){t.push([n,r,o])},lineStart:function(){e.push(t=[])},lineEnd:wn,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Tp(e,t){return at(e[0]-t[0])<ke&&at(e[1]-t[1])<ke}function Bh(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function lI(e,t,n,r,o){var i=[],s=[],a,l;if(e.forEach(function(p){if(!((g=p.length-1)<=0)){var g,m=p[0],b=p[g],v;if(Tp(m,b)){if(!m[2]&&!b[2]){for(o.lineStart(),a=0;a<g;++a)o.point((m=p[a])[0],m[1]);o.lineEnd();return}b[0]+=2*ke}i.push(v=new Bh(m,p,null,!0)),s.push(v.o=new Bh(m,null,v,!1)),i.push(v=new Bh(b,p,null,!1)),s.push(v.o=new Bh(b,null,v,!0))}}),!!i.length){for(s.sort(t),GR(i),GR(s),a=0,l=s.length;a<l;++a)s[a].e=n=!n;for(var c=i[0],u,d;;){for(var h=c,f=!0;h.v;)if((h=h.n)===c)return;u=h.z,o.lineStart();do{if(h.v=h.o.v=!0,h.e){if(f)for(a=0,l=u.length;a<l;++a)o.point((d=u[a])[0],d[1]);else r(h.x,h.n.x,1,o);h=h.n}else{if(f)for(u=h.p.z,a=u.length-1;a>=0;--a)o.point((d=u[a])[0],d[1]);else r(h.x,h.p.x,-1,o);h=h.p}h=h.o,u=h.z,f=!f}while(!h.v);o.lineEnd()}}}function GR(e){if(t=e.length){for(var t,n=0,r=e[0],o;++n<t;)r.n=o=e[n],o.p=r,r=o;r.n=o=e[0],o.p=r}}function Y0(e){return at(e[0])<=Xe?e[0]:Yr(e[0])*((at(e[0])+Xe)%Fr-Xe)}function cI(e,t){var n=Y0(t),r=t[1],o=Ie(r),i=[Ie(n),-$e(n),0],s=0,a=0,l=new vs;o===1?r=Xt+ke:o===-1&&(r=-Xt-ke);for(var c=0,u=e.length;c<u;++c)if(h=(d=e[c]).length)for(var d,h,f=d[h-1],p=Y0(f),g=f[1]/2+$R,m=Ie(g),b=$e(g),v=0;v<h;++v,p=w,m=S,b=E,f=x){var x=d[v],w=Y0(x),C=x[1]/2+$R,S=Ie(C),E=$e(C),P=w-p,M=P>=0?1:-1,D=M*P,A=D>Xe,I=m*S;if(l.add(Go(I*M*Ie(D),b*E+I*$e(D))),s+=A?P+M*Fr:P,A^p>=n^w>=n){var $=pg(Oc(f),Oc(x));wx($);var j=pg(i,$);wx(j);var T=(A^P>=0?-1:1)*Zr(j[2]);(r>T||r===T&&($[0]||$[1]))&&(a+=A^P>=0?1:-1)}}return(s<-1e-6||s<ke&&l<-1e-12)^a&1}function uI(e,t,n,r){return function(o){var i=t(o),s=aI(),a=t(s),l=!1,c,u,d,h={point:f,lineStart:g,lineEnd:m,polygonStart:function(){h.point=b,h.lineStart=v,h.lineEnd=x,u=[],c=[]},polygonEnd:function(){h.point=f,h.lineStart=g,h.lineEnd=m,u=nI(u);var w=cI(c,r);u.length?(l||(o.polygonStart(),l=!0),lI(u,RX,w,n,o)):w&&(l||(o.polygonStart(),l=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),l&&(o.polygonEnd(),l=!1),u=c=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function f(w,C){e(w,C)&&o.point(w,C)}function p(w,C){i.point(w,C)}function g(){h.point=p,i.lineStart()}function m(){h.point=f,i.lineEnd()}function b(w,C){d.push([w,C]),a.point(w,C)}function v(){a.lineStart(),d=[]}function x(){b(d[0][0],d[0][1]),a.lineEnd();var w=a.clean(),C=s.result(),S,E=C.length,P,M,D;if(d.pop(),c.push(d),d=null,!!E){if(w&1){if(M=C[0],(P=M.length-1)>0){for(l||(o.polygonStart(),l=!0),o.lineStart(),S=0;S<P;++S)o.point((D=M[S])[0],D[1]);o.lineEnd()}return}E>1&&w&2&&C.push(C.pop().concat(C.shift())),u.push(C.filter(EX))}}return h}}function EX(e){return e.length>1}function RX(e,t){return((e=e.x)[0]<0?e[1]-Xt-ke:Xt-e[1])-((t=t.x)[0]<0?t[1]-Xt-ke:Xt-t[1])}const YR=uI(function(){return!0},kX,MX,[-Xe,-Xt]);function kX(e){var t=NaN,n=NaN,r=NaN,o;return{lineStart:function(){e.lineStart(),o=1},point:function(i,s){var a=i>0?Xe:-Xe,l=at(i-t);at(l-Xe)<ke?(e.point(t,n=(n+s)/2>0?Xt:-Xt),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(i,n),o=0):r!==a&&l>=Xe&&(at(t-r)<ke&&(t-=r*ke),at(i-a)<ke&&(i-=a*ke),n=PX(t,n,i,s),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),o=0),e.point(t=i,n=s),r=a},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-o}}}function PX(e,t,n,r){var o,i,s=Ie(e-n);return at(s)>ke?Kc((Ie(t)*(i=$e(r))*Ie(n)-Ie(r)*(o=$e(t))*Ie(e))/(o*i*s)):(t+r)/2}function MX(e,t,n,r){var o;if(e==null)o=n*Xt,r.point(-Xe,o),r.point(0,o),r.point(Xe,o),r.point(Xe,0),r.point(Xe,-o),r.point(0,-o),r.point(-Xe,-o),r.point(-Xe,0),r.point(-Xe,o);else if(at(e[0]-t[0])>ke){var i=e[0]<t[0]?Xe:-Xe;o=n*i/2,r.point(-i,o),r.point(0,o),r.point(i,o)}else r.point(t[0],t[1])}function DX(e){var t=$e(e),n=2*Et,r=t>0,o=at(t)>ke;function i(u,d,h,f){_X(f,e,n,h,u,d)}function s(u,d){return $e(u)*$e(d)>t}function a(u){var d,h,f,p,g;return{lineStart:function(){p=f=!1,g=1},point:function(m,b){var v=[m,b],x,w=s(m,b),C=r?w?0:c(m,b):w?c(m+(m<0?Xe:-Xe),b):0;if(!d&&(p=f=w)&&u.lineStart(),w!==f&&(x=l(d,v),(!x||Tp(d,x)||Tp(v,x))&&(v[2]=1)),w!==f)g=0,w?(u.lineStart(),x=l(v,d),u.point(x[0],x[1])):(x=l(d,v),u.point(x[0],x[1],2),u.lineEnd()),d=x;else if(o&&d&&r^w){var S;!(C&h)&&(S=l(v,d,!0))&&(g=0,r?(u.lineStart(),u.point(S[0][0],S[0][1]),u.point(S[1][0],S[1][1]),u.lineEnd()):(u.point(S[1][0],S[1][1]),u.lineEnd(),u.lineStart(),u.point(S[0][0],S[0][1],3)))}w&&(!d||!Tp(d,v))&&u.point(v[0],v[1]),d=v,f=w,h=C},lineEnd:function(){f&&u.lineEnd(),d=null},clean:function(){return g|(p&&f)<<1}}}function l(u,d,h){var f=Oc(u),p=Oc(d),g=[1,0,0],m=pg(f,p),b=$h(m,m),v=m[0],x=b-v*v;if(!x)return!h&&u;var w=t*b/x,C=-t*v/x,S=pg(g,m),E=zh(g,w),P=zh(m,C);G0(E,P);var M=S,D=$h(E,M),A=$h(M,M),I=D*D-A*($h(E,E)-1);if(!(I<0)){var $=nr(I),j=zh(M,(-D-$)/A);if(G0(j,E),j=xx(j),!h)return j;var T=u[0],N=d[0],F=u[1],z=d[1],B;N<T&&(B=T,T=N,N=B);var O=N-T,U=at(O-Xe)<ke,L=U||O<ke;if(!U&&z<F&&(B=F,F=z,z=B),L?U?F+z>0^j[1]<(at(j[0]-T)<ke?F:z):F<=j[1]&&j[1]<=z:O>Xe^(T<=j[0]&&j[0]<=N)){var k=zh(M,(-D+$)/A);return G0(k,E),[j,xx(k)]}}}function c(u,d){var h=r?e:Xe-e,f=0;return u<-h?f|=1:u>h&&(f|=2),d<-h?f|=4:d>h&&(f|=8),f}return uI(s,a,i,r?[0,-e]:[-Xe,e-Xe])}function OX(e,t,n,r,o,i){var s=e[0],a=e[1],l=t[0],c=t[1],u=0,d=1,h=l-s,f=c-a,p;if(p=n-s,!(!h&&p>0)){if(p/=h,h<0){if(p<u)return;p<d&&(d=p)}else if(h>0){if(p>d)return;p>u&&(u=p)}if(p=o-s,!(!h&&p<0)){if(p/=h,h<0){if(p>d)return;p>u&&(u=p)}else if(h>0){if(p<u)return;p<d&&(d=p)}if(p=r-a,!(!f&&p>0)){if(p/=f,f<0){if(p<u)return;p<d&&(d=p)}else if(f>0){if(p>d)return;p>u&&(u=p)}if(p=i-a,!(!f&&p<0)){if(p/=f,f<0){if(p>d)return;p>u&&(u=p)}else if(f>0){if(p<u)return;p<d&&(d=p)}return u>0&&(e[0]=s+u*h,e[1]=a+u*f),d<1&&(t[0]=s+d*h,t[1]=a+d*f),!0}}}}}var Vh=1e9,Hh=-1e9;function AX(e,t,n,r){function o(c,u){return e<=c&&c<=n&&t<=u&&u<=r}function i(c,u,d,h){var f=0,p=0;if(c==null||(f=s(c,d))!==(p=s(u,d))||l(c,u)<0^d>0)do h.point(f===0||f===3?e:n,f>1?r:t);while((f=(f+d+4)%4)!==p);else h.point(u[0],u[1])}function s(c,u){return at(c[0]-e)<ke?u>0?0:3:at(c[0]-n)<ke?u>0?2:1:at(c[1]-t)<ke?u>0?1:0:u>0?3:2}function a(c,u){return l(c.x,u.x)}function l(c,u){var d=s(c,1),h=s(u,1);return d!==h?d-h:d===0?u[1]-c[1]:d===1?c[0]-u[0]:d===2?c[1]-u[1]:u[0]-c[0]}return function(c){var u=c,d=aI(),h,f,p,g,m,b,v,x,w,C,S,E={point:P,lineStart:I,lineEnd:$,polygonStart:D,polygonEnd:A};function P(T,N){o(T,N)&&u.point(T,N)}function M(){for(var T=0,N=0,F=f.length;N<F;++N)for(var z=f[N],B=1,O=z.length,U=z[0],L,k,H=U[0],G=U[1];B<O;++B)L=H,k=G,U=z[B],H=U[0],G=U[1],k<=r?G>r&&(H-L)*(r-k)>(G-k)*(e-L)&&++T:G<=r&&(H-L)*(r-k)<(G-k)*(e-L)&&--T;return T}function D(){u=d,h=[],f=[],S=!0}function A(){var T=M(),N=S&&T,F=(h=nI(h)).length;(N||F)&&(c.polygonStart(),N&&(c.lineStart(),i(null,null,1,c),c.lineEnd()),F&&lI(h,a,T,i,c),c.polygonEnd()),u=c,h=f=p=null}function I(){E.point=j,f&&f.push(p=[]),C=!0,w=!1,v=x=NaN}function $(){h&&(j(g,m),b&&w&&d.rejoin(),h.push(d.result())),E.point=P,w&&u.lineEnd()}function j(T,N){var F=o(T,N);if(f&&p.push([T,N]),C)g=T,m=N,b=F,C=!1,F&&(u.lineStart(),u.point(T,N));else if(F&&w)u.point(T,N);else{var z=[v=Math.max(Hh,Math.min(Vh,v)),x=Math.max(Hh,Math.min(Vh,x))],B=[T=Math.max(Hh,Math.min(Vh,T)),N=Math.max(Hh,Math.min(Vh,N))];OX(z,B,e,t,n,r)?(w||(u.lineStart(),u.point(z[0],z[1])),u.point(B[0],B[1]),F||u.lineEnd(),S=!1):F&&(u.lineStart(),u.point(T,N),S=!1)}v=T,x=N,w=F}return E}}var _x,Ex,Ip,Np,Ac={sphere:wn,point:wn,lineStart:TX,lineEnd:wn,polygonStart:wn,polygonEnd:wn};function TX(){Ac.point=NX,Ac.lineEnd=IX}function IX(){Ac.point=Ac.lineEnd=wn}function NX(e,t){e*=Et,t*=Et,Ex=e,Ip=Ie(t),Np=$e(t),Ac.point=FX}function FX(e,t){e*=Et,t*=Et;var n=Ie(t),r=$e(t),o=at(e-Ex),i=$e(o),s=Ie(o),a=r*s,l=Np*n-Ip*r*i,c=Ip*n+Np*r*i;_x.add(Go(nr(a*a+l*l),c)),Ex=e,Ip=n,Np=r}function LX(e){return _x=new vs,na(e,Ac),+_x}var Rx=[null,null],jX={type:"LineString",coordinates:Rx};function kx(e,t){return Rx[0]=e,Rx[1]=t,LX(jX)}var KR={Feature:function(e,t){return gg(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,o=n.length;++r<o;)if(gg(n[r].geometry,t))return!0;return!1}},XR={Sphere:function(){return!0},Point:function(e,t){return QR(e.coordinates,t)},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)if(QR(n[r],t))return!0;return!1},LineString:function(e,t){return ZR(e.coordinates,t)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)if(ZR(n[r],t))return!0;return!1},Polygon:function(e,t){return JR(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)if(JR(n[r],t))return!0;return!1},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,o=n.length;++r<o;)if(gg(n[r],t))return!0;return!1}};function gg(e,t){return e&&XR.hasOwnProperty(e.type)?XR[e.type](e,t):!1}function QR(e,t){return kx(e,t)===0}function ZR(e,t){for(var n,r,o,i=0,s=e.length;i<s;i++){if(r=kx(e[i],t),r===0||i>0&&(o=kx(e[i],e[i-1]),o>0&&n<=o&&r<=o&&(n+r-o)*(1-Math.pow((n-r)/o,2))<rI*o))return!0;n=r}return!1}function JR(e,t){return!!cI(e.map($X),dI(t))}function $X(e){return e=e.map(dI),e.pop(),e}function dI(e){return[e[0]*Et,e[1]*Et]}function zX(e,t){return(e&&KR.hasOwnProperty(e.type)?KR[e.type]:gg)(e,t)}function ek(e,t,n){var r=Ll(e,t-ke,n).concat(t);return function(o){return r.map(function(i){return[o,i]})}}function tk(e,t,n){var r=Ll(e,t-ke,n).concat(t);return function(o){return r.map(function(i){return[i,o]})}}function fI(){var e,t,n,r,o,i,s,a,l=10,c=l,u=90,d=360,h,f,p,g,m=2.5;function b(){return{type:"MultiLineString",coordinates:v()}}function v(){return Ll(jh(r/u)*u,n,u).map(p).concat(Ll(jh(a/d)*d,s,d).map(g)).concat(Ll(jh(t/l)*l,e,l).filter(function(x){return at(x%u)>ke}).map(h)).concat(Ll(jh(i/c)*c,o,c).filter(function(x){return at(x%d)>ke}).map(f))}return b.lines=function(){return v().map(function(x){return{type:"LineString",coordinates:x}})},b.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(g(s).slice(1),p(n).reverse().slice(1),g(a).reverse().slice(1))]}},b.extent=function(x){return arguments.length?b.extentMajor(x).extentMinor(x):b.extentMinor()},b.extentMajor=function(x){return arguments.length?(r=+x[0][0],n=+x[1][0],a=+x[0][1],s=+x[1][1],r>n&&(x=r,r=n,n=x),a>s&&(x=a,a=s,s=x),b.precision(m)):[[r,a],[n,s]]},b.extentMinor=function(x){return arguments.length?(t=+x[0][0],e=+x[1][0],i=+x[0][1],o=+x[1][1],t>e&&(x=t,t=e,e=x),i>o&&(x=i,i=o,o=x),b.precision(m)):[[t,i],[e,o]]},b.step=function(x){return arguments.length?b.stepMajor(x).stepMinor(x):b.stepMinor()},b.stepMajor=function(x){return arguments.length?(u=+x[0],d=+x[1],b):[u,d]},b.stepMinor=function(x){return arguments.length?(l=+x[0],c=+x[1],b):[l,c]},b.precision=function(x){return arguments.length?(m=+x,h=ek(i,o,90),f=tk(t,e,m),p=ek(a,s,90),g=tk(r,n,m),b):m},b.extentMajor([[-180,-90+ke],[180,90-ke]]).extentMinor([[-180,-80-ke],[180,80+ke]])}function BX(){return fI()()}const Px=e=>e;var K0=new vs,Mx=new vs,hI,pI,Dx,Ox,Si={point:wn,lineStart:wn,lineEnd:wn,polygonStart:function(){Si.lineStart=VX,Si.lineEnd=WX},polygonEnd:function(){Si.lineStart=Si.lineEnd=Si.point=wn,K0.add(at(Mx)),Mx=new vs},result:function(){var e=K0/2;return K0=new vs,e}};function VX(){Si.point=HX}function HX(e,t){Si.point=gI,hI=Dx=e,pI=Ox=t}function gI(e,t){Mx.add(Ox*e-Dx*t),Dx=e,Ox=t}function WX(){gI(hI,pI)}var Tc=1/0,mg=Tc,$d=-Tc,bg=$d,yg={point:UX,lineStart:wn,lineEnd:wn,polygonStart:wn,polygonEnd:wn,result:function(){var e=[[Tc,mg],[$d,bg]];return $d=bg=-(mg=Tc=1/0),e}};function UX(e,t){e<Tc&&(Tc=e),e>$d&&($d=e),t<mg&&(mg=t),t>bg&&(bg=t)}var Ax=0,Tx=0,qu=0,vg=0,xg=0,jl=0,Ix=0,Nx=0,Gu=0,mI,bI,To,Io,Gr={point:qa,lineStart:nk,lineEnd:rk,polygonStart:function(){Gr.lineStart=YX,Gr.lineEnd=KX},polygonEnd:function(){Gr.point=qa,Gr.lineStart=nk,Gr.lineEnd=rk},result:function(){var e=Gu?[Ix/Gu,Nx/Gu]:jl?[vg/jl,xg/jl]:qu?[Ax/qu,Tx/qu]:[NaN,NaN];return Ax=Tx=qu=vg=xg=jl=Ix=Nx=Gu=0,e}};function qa(e,t){Ax+=e,Tx+=t,++qu}function nk(){Gr.point=qX}function qX(e,t){Gr.point=GX,qa(To=e,Io=t)}function GX(e,t){var n=e-To,r=t-Io,o=nr(n*n+r*r);vg+=o*(To+e)/2,xg+=o*(Io+t)/2,jl+=o,qa(To=e,Io=t)}function rk(){Gr.point=qa}function YX(){Gr.point=XX}function KX(){yI(mI,bI)}function XX(e,t){Gr.point=yI,qa(mI=To=e,bI=Io=t)}function yI(e,t){var n=e-To,r=t-Io,o=nr(n*n+r*r);vg+=o*(To+e)/2,xg+=o*(Io+t)/2,jl+=o,o=Io*e-To*t,Ix+=o*(To+e),Nx+=o*(Io+t),Gu+=o*3,qa(To=e,Io=t)}function vI(e){this._context=e}vI.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:{this._context.moveTo(e,t),this._point=1;break}case 1:{this._context.lineTo(e,t);break}default:{this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,Fr);break}}},result:wn};var Fx=new vs,X0,xI,wI,Yu,Ku,zd={point:wn,lineStart:function(){zd.point=QX},lineEnd:function(){X0&&SI(xI,wI),zd.point=wn},polygonStart:function(){X0=!0},polygonEnd:function(){X0=null},result:function(){var e=+Fx;return Fx=new vs,e}};function QX(e,t){zd.point=SI,xI=Yu=e,wI=Ku=t}function SI(e,t){Yu-=e,Ku-=t,Fx.add(nr(Yu*Yu+Ku*Ku)),Yu=e,Ku=t}let ok,wg,ik,sk;class ak{constructor(t){this._append=t==null?CI:ZX(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,n){switch(this._point){case 0:{this._append`M${t},${n}`,this._point=1;break}case 1:{this._append`L${t},${n}`;break}default:{if(this._append`M${t},${n}`,this._radius!==ik||this._append!==wg){const r=this._radius,o=this._;this._="",this._append`m0,${r}a${r},${r} 0 1,1 0,${-2*r}a${r},${r} 0 1,1 0,${2*r}z`,ik=r,wg=this._append,sk=this._,this._=o}this._+=sk;break}}}result(){const t=this._;return this._="",t.length?t:null}}function CI(e){let t=1;this._+=e[0];for(const n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function ZX(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return CI;if(t!==ok){const n=10**t;ok=t,wg=function(o){let i=1;this._+=o[0];for(const s=o.length;i<s;++i)this._+=Math.round(arguments[i]*n)/n+o[i]}}return wg}function lk(e,t){let n=3,r=4.5,o,i;function s(a){return a&&(typeof r=="function"&&i.pointRadius(+r.apply(this,arguments)),na(a,o(i))),i.result()}return s.area=function(a){return na(a,o(Si)),Si.result()},s.measure=function(a){return na(a,o(zd)),zd.result()},s.bounds=function(a){return na(a,o(yg)),yg.result()},s.centroid=function(a){return na(a,o(Gr)),Gr.result()},s.projection=function(a){return arguments.length?(o=a==null?(e=null,Px):(e=a).stream,s):e},s.context=function(a){return arguments.length?(i=a==null?(t=null,new ak(n)):new vI(t=a),typeof r!="function"&&i.pointRadius(r),s):t},s.pointRadius=function(a){return arguments.length?(r=typeof a=="function"?a:(i.pointRadius(+a),+a),s):r},s.digits=function(a){if(!arguments.length)return n;if(a==null)n=null;else{const l=Math.floor(a);if(!(l>=0))throw new RangeError(`invalid digits: ${a}`);n=l}return t===null&&(i=new ak(n)),s},s.projection(e).digits(n).context(t)}function xS(e){return function(t){var n=new Lx;for(var r in e)n[r]=e[r];return n.stream=t,n}}function Lx(){}Lx.prototype={constructor:Lx,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function wS(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),na(n,e.stream(yg)),t(yg.result()),r!=null&&e.clipExtent(r),e}function SS(e,t,n){return wS(e,function(r){var o=t[1][0]-t[0][0],i=t[1][1]-t[0][1],s=Math.min(o/(r[1][0]-r[0][0]),i/(r[1][1]-r[0][1])),a=+t[0][0]+(o-s*(r[1][0]+r[0][0]))/2,l=+t[0][1]+(i-s*(r[1][1]+r[0][1]))/2;e.scale(150*s).translate([a,l])},n)}function _I(e,t,n){return SS(e,[[0,0],t],n)}function EI(e,t,n){return wS(e,function(r){var o=+t,i=o/(r[1][0]-r[0][0]),s=(o-i*(r[1][0]+r[0][0]))/2,a=-i*r[0][1];e.scale(150*i).translate([s,a])},n)}function RI(e,t,n){return wS(e,function(r){var o=+t,i=o/(r[1][1]-r[0][1]),s=-i*r[0][0],a=(o-i*(r[1][1]+r[0][1]))/2;e.scale(150*i).translate([s,a])},n)}var ck=16,JX=$e(30*Et);function uk(e,t){return+t?tQ(e,t):eQ(e)}function eQ(e){return xS({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function tQ(e,t){function n(r,o,i,s,a,l,c,u,d,h,f,p,g,m){var b=c-r,v=u-o,x=b*b+v*v;if(x>4*t&&g--){var w=s+h,C=a+f,S=l+p,E=nr(w*w+C*C+S*S),P=Zr(S/=E),M=at(at(S)-1)<ke||at(i-d)<ke?(i+d)/2:Go(C,w),D=e(M,P),A=D[0],I=D[1],$=A-r,j=I-o,T=v*$-b*j;(T*T/x>t||at((b*$+v*j)/x-.5)>.3||s*h+a*f+l*p<JX)&&(n(r,o,i,s,a,l,A,I,M,w/=E,C/=E,S,g,m),m.point(A,I),n(A,I,M,w,C,S,c,u,d,h,f,p,g,m))}}return function(r){var o,i,s,a,l,c,u,d,h,f,p,g,m={point:b,lineStart:v,lineEnd:w,polygonStart:function(){r.polygonStart(),m.lineStart=C},polygonEnd:function(){r.polygonEnd(),m.lineStart=v}};function b(P,M){P=e(P,M),r.point(P[0],P[1])}function v(){d=NaN,m.point=x,r.lineStart()}function x(P,M){var D=Oc([P,M]),A=e(P,M);n(d,h,u,f,p,g,d=A[0],h=A[1],u=P,f=D[0],p=D[1],g=D[2],ck,r),r.point(d,h)}function w(){m.point=b,r.lineEnd()}function C(){v(),m.point=S,m.lineEnd=E}function S(P,M){x(o=P,M),i=d,s=h,a=f,l=p,c=g,m.point=x}function E(){n(d,h,u,f,p,g,i,s,o,a,l,c,ck,r),m.lineEnd=w,w()}return m}}var nQ=xS({point:function(e,t){this.stream.point(e*Et,t*Et)}});function rQ(e){return xS({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function oQ(e,t,n,r,o){function i(s,a){return s*=r,a*=o,[t+e*s,n-e*a]}return i.invert=function(s,a){return[(s-t)/e*r,(n-a)/e*o]},i}function dk(e,t,n,r,o,i){if(!i)return oQ(e,t,n,r,o);var s=$e(i),a=Ie(i),l=s*e,c=a*e,u=s/e,d=a/e,h=(a*n-s*t)/e,f=(a*t+s*n)/e;function p(g,m){return g*=r,m*=o,[l*g-c*m+t,n-c*g-l*m]}return p.invert=function(g,m){return[r*(u*g-d*m+h),o*(f-d*g-u*m)]},p}function zi(e){return kI(function(){return e})()}function kI(e){var t,n=150,r=480,o=250,i=0,s=0,a=0,l=0,c=0,u,d=0,h=1,f=1,p=null,g=YR,m=null,b,v,x,w=Px,C=.5,S,E,P,M,D;function A(T){return P(T[0]*Et,T[1]*Et)}function I(T){return T=P.invert(T[0],T[1]),T&&[T[0]*Qn,T[1]*Qn]}A.stream=function(T){return M&&D===T?M:M=nQ(rQ(u)(g(S(w(D=T)))))},A.preclip=function(T){return arguments.length?(g=T,p=void 0,j()):g},A.postclip=function(T){return arguments.length?(w=T,m=b=v=x=null,j()):w},A.clipAngle=function(T){return arguments.length?(g=+T?DX(p=T*Et):(p=null,YR),j()):p*Qn},A.clipExtent=function(T){return arguments.length?(w=T==null?(m=b=v=x=null,Px):AX(m=+T[0][0],b=+T[0][1],v=+T[1][0],x=+T[1][1]),j()):m==null?null:[[m,b],[v,x]]},A.scale=function(T){return arguments.length?(n=+T,$()):n},A.translate=function(T){return arguments.length?(r=+T[0],o=+T[1],$()):[r,o]},A.center=function(T){return arguments.length?(i=T[0]%360*Et,s=T[1]%360*Et,$()):[i*Qn,s*Qn]},A.rotate=function(T){return arguments.length?(a=T[0]%360*Et,l=T[1]%360*Et,c=T.length>2?T[2]%360*Et:0,$()):[a*Qn,l*Qn,c*Qn]},A.angle=function(T){return arguments.length?(d=T%360*Et,$()):d*Qn},A.reflectX=function(T){return arguments.length?(h=T?-1:1,$()):h<0},A.reflectY=function(T){return arguments.length?(f=T?-1:1,$()):f<0},A.precision=function(T){return arguments.length?(S=uk(E,C=T*T),j()):nr(C)},A.fitExtent=function(T,N){return SS(A,T,N)},A.fitSize=function(T,N){return _I(A,T,N)},A.fitWidth=function(T,N){return EI(A,T,N)},A.fitHeight=function(T,N){return RI(A,T,N)};function $(){var T=dk(n,0,0,h,f,d).apply(null,t(i,s)),N=dk(n,r-T[0],o-T[1],h,f,d);return u=sI(a,l,c),E=Sx(t,N),P=Sx(u,E),S=uk(E,C),j()}function j(){return M=D=null,A}return function(){return t=e.apply(this,arguments),A.invert=t.invert&&I,$()}}function CS(e){var t=0,n=Xe/3,r=kI(e),o=r(t,n);return o.parallels=function(i){return arguments.length?r(t=i[0]*Et,n=i[1]*Et):[t*Qn,n*Qn]},o}function iQ(e){var t=$e(e);function n(r,o){return[r*t,Ie(o)/t]}return n.invert=function(r,o){return[r/t,Zr(o*t)]},n}function sQ(e,t){var n=Ie(e),r=(n+Ie(t))/2;if(at(r)<ke)return iQ(e);var o=1+n*(2*r-n),i=nr(o)/r;function s(a,l){var c=nr(o-2*r*Ie(l))/r;return[c*Ie(a*=r),i-c*$e(a)]}return s.invert=function(a,l){var c=i-l,u=Go(a,at(c))*Yr(c);return c*r<0&&(u-=Xe*Yr(a)*Yr(c)),[u/r,Zr((o-(a*a+c*c)*r*r)/(2*r))]},s}function Sg(){return CS(sQ).scale(155.424).center([0,33.6442])}function PI(){return Sg().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function aQ(e){var t=e.length;return{point:function(n,r){for(var o=-1;++o<t;)e[o].point(n,r)},sphere:function(){for(var n=-1;++n<t;)e[n].sphere()},lineStart:function(){for(var n=-1;++n<t;)e[n].lineStart()},lineEnd:function(){for(var n=-1;++n<t;)e[n].lineEnd()},polygonStart:function(){for(var n=-1;++n<t;)e[n].polygonStart()},polygonEnd:function(){for(var n=-1;++n<t;)e[n].polygonEnd()}}}function lQ(){var e,t,n=PI(),r,o=Sg().rotate([154,0]).center([-2,58.5]).parallels([55,65]),i,s=Sg().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,l,c={point:function(h,f){l=[h,f]}};function u(h){var f=h[0],p=h[1];return l=null,r.point(f,p),l||(i.point(f,p),l)||(a.point(f,p),l)}u.invert=function(h){var f=n.scale(),p=n.translate(),g=(h[0]-p[0])/f,m=(h[1]-p[1])/f;return(m>=.12&&m<.234&&g>=-.425&&g<-.214?o:m>=.166&&m<.234&&g>=-.214&&g<-.115?s:n).invert(h)},u.stream=function(h){return e&&t===h?e:e=aQ([n.stream(t=h),o.stream(h),s.stream(h)])},u.precision=function(h){return arguments.length?(n.precision(h),o.precision(h),s.precision(h),d()):n.precision()},u.scale=function(h){return arguments.length?(n.scale(h),o.scale(h*.35),s.scale(h),u.translate(n.translate())):n.scale()},u.translate=function(h){if(!arguments.length)return n.translate();var f=n.scale(),p=+h[0],g=+h[1];return r=n.translate(h).clipExtent([[p-.455*f,g-.238*f],[p+.455*f,g+.238*f]]).stream(c),i=o.translate([p-.307*f,g+.201*f]).clipExtent([[p-.425*f+ke,g+.12*f+ke],[p-.214*f-ke,g+.234*f-ke]]).stream(c),a=s.translate([p-.205*f,g+.212*f]).clipExtent([[p-.214*f+ke,g+.166*f+ke],[p-.115*f-ke,g+.234*f-ke]]).stream(c),d()},u.fitExtent=function(h,f){return SS(u,h,f)},u.fitSize=function(h,f){return _I(u,h,f)},u.fitWidth=function(h,f){return EI(u,h,f)},u.fitHeight=function(h,f){return RI(u,h,f)};function d(){return e=t=null,u}return u.scale(1070)}function MI(e){return function(t,n){var r=$e(t),o=$e(n),i=e(r*o);return i===1/0?[2,0]:[i*o*Ie(t),i*Ie(n)]}}function Mf(e){return function(t,n){var r=nr(t*t+n*n),o=e(r),i=Ie(o),s=$e(o);return[Go(t*i,r*s),Zr(r&&n*i/r)]}}var DI=MI(function(e){return nr(2/(1+e))});DI.invert=Mf(function(e){return 2*Zr(e/2)});function cQ(){return zi(DI).scale(124.75).clipAngle(180-.001)}var OI=MI(function(e){return(e=iI(e))&&e/Ie(e)});OI.invert=Mf(function(e){return e});function uQ(){return zi(OI).scale(79.4188).clipAngle(180-.001)}function Bm(e,t){return[e,fg(vS((Xt+t)/2))]}Bm.invert=function(e,t){return[e,2*Kc(oI(t))-Xt]};function dQ(){return AI(Bm).scale(961/Fr)}function AI(e){var t=zi(e),n=t.center,r=t.scale,o=t.translate,i=t.clipExtent,s=null,a,l,c;t.scale=function(d){return arguments.length?(r(d),u()):r()},t.translate=function(d){return arguments.length?(o(d),u()):o()},t.center=function(d){return arguments.length?(n(d),u()):n()},t.clipExtent=function(d){return arguments.length?(d==null?s=a=l=c=null:(s=+d[0][0],a=+d[0][1],l=+d[1][0],c=+d[1][1]),u()):s==null?null:[[s,a],[l,c]]};function u(){var d=Xe*r(),h=t(CX(t.rotate()).invert([0,0]));return i(s==null?[[h[0]-d,h[1]-d],[h[0]+d,h[1]+d]]:e===Bm?[[Math.max(h[0]-d,s),a],[Math.min(h[0]+d,l),c]]:[[s,Math.max(h[1]-d,a)],[l,Math.min(h[1]+d,c)]])}return u()}function Wh(e){return vS((Xt+e)/2)}function fQ(e,t){var n=$e(e),r=e===t?Ie(e):fg(n/$e(t))/fg(Wh(t)/Wh(e)),o=n*q0(Wh(e),r)/r;if(!r)return Bm;function i(s,a){o>0?a<-Xt+ke&&(a=-Xt+ke):a>Xt-ke&&(a=Xt-ke);var l=o/q0(Wh(a),r);return[l*Ie(r*s),o-l*$e(r*s)]}return i.invert=function(s,a){var l=o-a,c=Yr(r)*nr(s*s+l*l),u=Go(s,at(l))*Yr(l);return l*r<0&&(u-=Xe*Yr(s)*Yr(l)),[u/r,2*Kc(q0(o/c,1/r))-Xt]},i}function hQ(){return CS(fQ).scale(109.5).parallels([30,30])}function Cg(e,t){return[e,t]}Cg.invert=Cg;function pQ(){return zi(Cg).scale(152.63)}function gQ(e,t){var n=$e(e),r=e===t?Ie(e):(n-$e(t))/(t-e),o=n/r+e;if(at(r)<ke)return Cg;function i(s,a){var l=o-a,c=r*s;return[l*Ie(c),o-l*$e(c)]}return i.invert=function(s,a){var l=o-a,c=Go(s,at(l))*Yr(l);return l*r<0&&(c-=Xe*Yr(s)*Yr(l)),[c/r,o-Yr(r)*nr(s*s+l*l)]},i}function mQ(){return CS(gQ).scale(131.154).center([0,13.9389])}var sd=1.340264,ad=-.081106,ld=893e-6,cd=.003796,_g=nr(3)/2,bQ=12;function TI(e,t){var n=Zr(_g*Ie(t)),r=n*n,o=r*r*r;return[e*$e(n)/(_g*(sd+3*ad*r+o*(7*ld+9*cd*r))),n*(sd+ad*r+o*(ld+cd*r))]}TI.invert=function(e,t){for(var n=t,r=n*n,o=r*r*r,i=0,s,a,l;i<bQ&&(a=n*(sd+ad*r+o*(ld+cd*r))-t,l=sd+3*ad*r+o*(7*ld+9*cd*r),n-=s=a/l,r=n*n,o=r*r*r,!(at(s)<rI));++i);return[_g*e*(sd+3*ad*r+o*(7*ld+9*cd*r))/$e(n),Zr(Ie(n)/_g)]};function yQ(){return zi(TI).scale(177.158)}function II(e,t){var n=$e(t),r=$e(e)*n;return[n*Ie(e)/r,Ie(t)/r]}II.invert=Mf(Kc);function vQ(){return zi(II).scale(144.049).clipAngle(60)}function NI(e,t){var n=t*t,r=n*n;return[e*(.8707-.131979*n+r*(-.013791+r*(.003971*n-.001529*r))),t*(1.007226+n*(.015085+r*(-.044475+.028874*n-.005916*r)))]}NI.invert=function(e,t){var n=t,r=25,o;do{var i=n*n,s=i*i;n-=o=(n*(1.007226+i*(.015085+s*(-.044475+.028874*i-.005916*s)))-t)/(1.007226+i*(.015085*3+s*(-.044475*7+.028874*9*i-.005916*11*s)))}while(at(o)>ke&&--r>0);return[e/(.8707+(i=n*n)*(-.131979+i*(-.013791+i*i*i*(.003971-.001529*i)))),n]};function xQ(){return zi(NI).scale(175.295)}function FI(e,t){return[$e(t)*Ie(e),Ie(t)]}FI.invert=Mf(Zr);function wQ(){return zi(FI).scale(249.5).clipAngle(90+ke)}function LI(e,t){var n=$e(t),r=1+$e(e)*n;return[n*Ie(e)/r,Ie(t)/r]}LI.invert=Mf(function(e){return 2*Kc(e)});function SQ(){return zi(LI).scale(250).clipAngle(142)}function jI(e,t){return[fg(vS((Xt+t)/2)),-e]}jI.invert=function(e,t){return[-t,2*Kc(oI(e))-Xt]};function CQ(){var e=AI(jI),t=e.center,n=e.rotate;return e.center=function(r){return arguments.length?t([-r[1],r[0]]):(r=t(),[r[1],-r[0]])},e.rotate=function(r){return arguments.length?n([r[0],r[1],r.length>2?r[2]+90:90]):(r=n(),[r[0],r[1],r[2]-90])},n([0,0,90]).scale(159.155)}function ht(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(r*6,++r*6);return n}function Vm(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function _S(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Xc(){}var Ga=.7,Ic=1/Ga,Kl="\\s*([+-]?\\d+)\\s*",Bd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Bo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_Q=/^#([0-9a-f]{3,8})$/,EQ=new RegExp(`^rgb\\(${Kl},${Kl},${Kl}\\)$`),RQ=new RegExp(`^rgb\\(${Bo},${Bo},${Bo}\\)$`),kQ=new RegExp(`^rgba\\(${Kl},${Kl},${Kl},${Bd}\\)$`),PQ=new RegExp(`^rgba\\(${Bo},${Bo},${Bo},${Bd}\\)$`),MQ=new RegExp(`^hsl\\(${Bd},${Bo},${Bo}\\)$`),DQ=new RegExp(`^hsla\\(${Bd},${Bo},${Bo},${Bd}\\)$`),fk={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Vm(Xc,ES,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:hk,formatHex:hk,formatHex8:OQ,formatHsl:AQ,formatRgb:pk,toString:pk});function hk(){return this.rgb().formatHex()}function OQ(){return this.rgb().formatHex8()}function AQ(){return zI(this).formatHsl()}function pk(){return this.rgb().formatRgb()}function ES(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=_Q.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?gk(t):n===3?new Vn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Uh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Uh(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=EQ.exec(e))?new Vn(t[1],t[2],t[3],1):(t=RQ.exec(e))?new Vn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=kQ.exec(e))?Uh(t[1],t[2],t[3],t[4]):(t=PQ.exec(e))?Uh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=MQ.exec(e))?yk(t[1],t[2]/100,t[3]/100,1):(t=DQ.exec(e))?yk(t[1],t[2]/100,t[3]/100,t[4]):fk.hasOwnProperty(e)?gk(fk[e]):e==="transparent"?new Vn(NaN,NaN,NaN,0):null}function gk(e){return new Vn(e>>16&255,e>>8&255,e&255,1)}function Uh(e,t,n,r){return r<=0&&(e=t=n=NaN),new Vn(e,t,n,r)}function $I(e){return e instanceof Xc||(e=ES(e)),e?(e=e.rgb(),new Vn(e.r,e.g,e.b,e.opacity)):new Vn}function Vd(e,t,n,r){return arguments.length===1?$I(e):new Vn(e,t,n,r??1)}function Vn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Vm(Vn,Vd,_S(Xc,{brighter(e){return e=e==null?Ic:Math.pow(Ic,e),new Vn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ga:Math.pow(Ga,e),new Vn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Vn(Oa(this.r),Oa(this.g),Oa(this.b),Eg(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:mk,formatHex:mk,formatHex8:TQ,formatRgb:bk,toString:bk}));function mk(){return`#${ua(this.r)}${ua(this.g)}${ua(this.b)}`}function TQ(){return`#${ua(this.r)}${ua(this.g)}${ua(this.b)}${ua((isNaN(this.opacity)?1:this.opacity)*255)}`}function bk(){const e=Eg(this.opacity);return`${e===1?"rgb(":"rgba("}${Oa(this.r)}, ${Oa(this.g)}, ${Oa(this.b)}${e===1?")":`, ${e})`}`}function Eg(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Oa(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ua(e){return e=Oa(e),(e<16?"0":"")+e.toString(16)}function yk(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new lo(e,t,n,r)}function zI(e){if(e instanceof lo)return new lo(e.h,e.s,e.l,e.opacity);if(e instanceof Xc||(e=ES(e)),!e)return new lo;if(e instanceof lo)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,a=i-o,l=(i+o)/2;return a?(t===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-t)/a+2:s=(t-n)/a+4,a/=l<.5?i+o:2-i-o,s*=60):a=l>0&&l<1?0:s,new lo(s,a,l,e.opacity)}function IQ(e,t,n,r){return arguments.length===1?zI(e):new lo(e,t,n,r??1)}function lo(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Vm(lo,IQ,_S(Xc,{brighter(e){return e=e==null?Ic:Math.pow(Ic,e),new lo(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ga:Math.pow(Ga,e),new lo(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new Vn(Q0(e>=240?e-240:e+120,o,r),Q0(e,o,r),Q0(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new lo(vk(this.h),qh(this.s),qh(this.l),Eg(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Eg(this.opacity);return`${e===1?"hsl(":"hsla("}${vk(this.h)}, ${qh(this.s)*100}%, ${qh(this.l)*100}%${e===1?")":`, ${e})`}`}}));function vk(e){return e=(e||0)%360,e<0?e+360:e}function qh(e){return Math.max(0,Math.min(1,e||0))}function Q0(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const NQ=Math.PI/180,FQ=180/Math.PI;var BI=-.14861,RS=1.78277,kS=-.29227,Hm=-.90649,Hd=1.97294,xk=Hd*Hm,wk=Hd*RS,Sk=RS*kS-Hm*BI;function LQ(e){if(e instanceof Aa)return new Aa(e.h,e.s,e.l,e.opacity);e instanceof Vn||(e=$I(e));var t=e.r/255,n=e.g/255,r=e.b/255,o=(Sk*r+xk*t-wk*n)/(Sk+xk-wk),i=r-o,s=(Hd*(n-o)-kS*i)/Hm,a=Math.sqrt(s*s+i*i)/(Hd*o*(1-o)),l=a?Math.atan2(s,i)*FQ-120:NaN;return new Aa(l<0?l+360:l,a,o,e.opacity)}function Yo(e,t,n,r){return arguments.length===1?LQ(e):new Aa(e,t,n,r??1)}function Aa(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Vm(Aa,Yo,_S(Xc,{brighter(e){return e=e==null?Ic:Math.pow(Ic,e),new Aa(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ga:Math.pow(Ga,e),new Aa(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*NQ,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),o=Math.sin(e);return new Vn(255*(t+n*(BI*r+RS*o)),255*(t+n*(kS*r+Hm*o)),255*(t+n*(Hd*r)),this.opacity)}}));function jQ(e,t,n,r,o){var i=e*e,s=i*e;return((1-3*e+3*i-s)*t+(4-6*i+3*s)*n+(1+3*e+3*i-3*s)*r+s*o)/6}function $Q(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),o=e[r],i=e[r+1],s=r>0?e[r-1]:2*o-i,a=r<t-1?e[r+2]:2*i-o;return jQ((n-r/t)*t,s,o,i,a)}}const PS=e=>()=>e;function VI(e,t){return function(n){return e+n*t}}function zQ(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function BQ(e,t){var n=t-e;return n?VI(e,n>180||n<-180?n-360*Math.round(n/360):n):PS(isNaN(e)?t:e)}function VQ(e){return(e=+e)==1?Xl:function(t,n){return n-t?zQ(t,n,e):PS(isNaN(t)?n:t)}}function Xl(e,t){var n=t-e;return n?VI(e,n):PS(isNaN(e)?t:e)}(function e(t){var n=VQ(t);function r(o,i){var s=n((o=Vd(o)).r,(i=Vd(i)).r),a=n(o.g,i.g),l=n(o.b,i.b),c=Xl(o.opacity,i.opacity);return function(u){return o.r=s(u),o.g=a(u),o.b=l(u),o.opacity=c(u),o+""}}return r.gamma=e,r})(1);function HQ(e){return function(t){var n=t.length,r=new Array(n),o=new Array(n),i=new Array(n),s,a;for(s=0;s<n;++s)a=Vd(t[s]),r[s]=a.r||0,o[s]=a.g||0,i[s]=a.b||0;return r=e(r),o=e(o),i=e(i),a.opacity=1,function(l){return a.r=r(l),a.g=o(l),a.b=i(l),a+""}}}var WQ=HQ($Q);function HI(e){return function t(n){n=+n;function r(o,i){var s=e((o=Yo(o)).h,(i=Yo(i)).h),a=Xl(o.s,i.s),l=Xl(o.l,i.l),c=Xl(o.opacity,i.opacity);return function(u){return o.h=s(u),o.s=a(u),o.l=l(Math.pow(u,n)),o.opacity=c(u),o+""}}return r.gamma=t,r}(1)}HI(BQ);var MS=HI(Xl);const Mt=e=>WQ(e[e.length-1]);var UQ=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(ht);const qQ=Mt(UQ);var GQ=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(ht);const YQ=Mt(GQ);var KQ=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(ht);const XQ=Mt(KQ);var QQ=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(ht);const ZQ=Mt(QQ);var JQ=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(ht);const eZ=Mt(JQ);var tZ=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(ht);const nZ=Mt(tZ);var rZ=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(ht);const oZ=Mt(rZ);var iZ=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(ht);const sZ=Mt(iZ);var aZ=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(ht);const lZ=Mt(aZ);var cZ=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(ht);const uZ=Mt(cZ);var dZ=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(ht);const fZ=Mt(dZ);var hZ=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(ht);const pZ=Mt(hZ);var gZ=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(ht);const mZ=Mt(gZ);var bZ=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(ht);const yZ=Mt(bZ);var vZ=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(ht);const xZ=Mt(vZ);var wZ=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(ht);const SZ=Mt(wZ);var CZ=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(ht);const _Z=Mt(CZ);var EZ=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(ht);const RZ=Mt(EZ);var kZ=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(ht);const PZ=Mt(kZ);var MZ=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(ht);const DZ=Mt(MZ);var OZ=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(ht);const AZ=Mt(OZ);var TZ=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(ht);const IZ=Mt(TZ);var NZ=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(ht);const FZ=Mt(NZ);var LZ=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(ht);const jZ=Mt(LZ);var $Z=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(ht);const zZ=Mt($Z);var BZ=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(ht);const VZ=Mt(BZ);var HZ=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(ht);const WZ=Mt(HZ);function UZ(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-e*(35.34-e*(2381.73-e*(6402.7-e*(7024.72-e*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+e*(170.73+e*(52.82-e*(131.46-e*(176.58-e*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+e*(442.36-e*(2482.43-e*(6167.24-e*(6614.94-e*2475.67)))))))+")"}const qZ=MS(Yo(300,.5,0),Yo(-240,.5,1));var GZ=MS(Yo(-100,.75,.35),Yo(80,1.5,.8)),YZ=MS(Yo(260,.75,.35),Yo(80,1.5,.8)),Gh=Yo();function KZ(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return Gh.h=360*e-100,Gh.s=1.5-1.5*t,Gh.l=.8-.9*t,Gh+""}var Yh=Vd(),XZ=Math.PI/3,QZ=Math.PI*2/3;function ZZ(e){var t;return e=(.5-e)*Math.PI,Yh.r=255*(t=Math.sin(e))*t,Yh.g=255*(t=Math.sin(e+XZ))*t,Yh.b=255*(t=Math.sin(e+QZ))*t,Yh+""}function JZ(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-e*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+e*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-e*6838.66)))))))+")"}function Wm(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}const eJ=Wm(ht("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));var tJ=Wm(ht("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),nJ=Wm(ht("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),rJ=Wm(ht("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function oJ(e){return e}function iJ(e){if(e==null)return oJ;var t,n,r=e.scale[0],o=e.scale[1],i=e.translate[0],s=e.translate[1];return function(a,l){l||(t=n=0);var c=2,u=a.length,d=new Array(u);for(d[0]=(t+=a[0])*r+i,d[1]=(n+=a[1])*o+s;c<u;)d[c]=a[c],++c;return d}}function sJ(e,t){for(var n,r=e.length,o=r-t;o<--r;)n=e[o],e[o++]=e[r],e[r]=n}function aJ(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(n){return Ck(e,n)})}:Ck(e,t)}function Ck(e,t){var n=t.id,r=t.bbox,o=t.properties==null?{}:t.properties,i=lJ(e,t);return n==null&&r==null?{type:"Feature",properties:o,geometry:i}:r==null?{type:"Feature",id:n,properties:o,geometry:i}:{type:"Feature",id:n,bbox:r,properties:o,geometry:i}}function lJ(e,t){var n=iJ(e.transform),r=e.arcs;function o(u,d){d.length&&d.pop();for(var h=r[u<0?~u:u],f=0,p=h.length;f<p;++f)d.push(n(h[f],f));u<0&&sJ(d,p)}function i(u){return n(u)}function s(u){for(var d=[],h=0,f=u.length;h<f;++h)o(u[h],d);return d.length<2&&d.push(d[0]),d}function a(u){for(var d=s(u);d.length<4;)d.push(d[0]);return d}function l(u){return u.map(a)}function c(u){var d=u.type,h;switch(d){case"GeometryCollection":return{type:d,geometries:u.geometries.map(c)};case"Point":h=i(u.coordinates);break;case"MultiPoint":h=u.coordinates.map(i);break;case"LineString":h=s(u.arcs);break;case"MultiLineString":h=u.arcs.map(s);break;case"Polygon":h=l(u.arcs);break;case"MultiPolygon":h=u.arcs.map(l);break;default:return null}return{type:d,coordinates:h}}return c(t)}const ud={geoAzimuthalEqualArea:cQ,geoAzimuthalEquidistant:uQ,geoGnomonic:vQ,geoOrthographic:wQ,geoStereographic:SQ,geoEqualEarth:yQ,geoAlbers:PI,geoAlbersUsa:lQ,geoConicConformal:hQ,geoConicEqualArea:Sg,geoConicEquidistant:mQ,geoEquirectangular:pQ,geoMercator:dQ,geoTransverseMercator:CQ,geoNaturalEarth1:xQ};Object.keys(ud).forEach(e=>{ud[`${e.charAt(3).toLowerCase()}${e.slice(4)}`]=ud[e]});class ll extends Os{constructor(t){super(t),this.outlineBounds=null,this.oldChartBounds=null,this.geoPath=lk()}init(t){t.position="chartArea",super.init(t),typeof t.projection=="function"?this.projection=t.projection:this.projection=(ud[t.projection]||ud.albersUsa)(),this.geoPath.projection(this.projection),this.outlineBounds=null,this.oldChartBounds=null}computeBounds(t){const n=lk(this.projection.fitWidth(1e3,t)).bounds(t),r=Math.ceil(n[1][1]-n[0][1]),o=Math.ceil(n[1][0]-n[0][0]),i=this.projection.translate();this.outlineBounds={width:o,height:r,aspectRatio:o/r,refScale:this.projection.scale(),refX:i[0],refY:i[1]}}updateBounds(){const t=this.chart.chartArea,n=this.outlineBounds;if(!n)return!1;const r=this.options.padding,o=typeof r=="number"?r:r.top,i=typeof r=="number"?r:r.left,s=typeof r=="number"?r:r.bottom,a=typeof r=="number"?r:r.right,l=t.right-t.left-i-a,c=t.bottom-t.top-o-s,u=this.oldChartBounds;this.oldChartBounds={chartWidth:l,chartHeight:c};const d=Math.min(l/n.width,c/n.height),h=n.width*d,f=n.height*d,p=(l-h)*.5+t.left+i,g=(c-f)*.5+t.top+o,m=this.options;return this.projection.scale(n.refScale*d*m.projectionScale).translate([d*n.refX+p+m.projectionOffset[0],d*n.refY+g+m.projectionOffset[1]]),!u||u.chartWidth!==this.oldChartBounds.chartWidth||u.chartHeight!==this.oldChartBounds.chartHeight}}ll.id="projection";ll.defaults={projection:"albersUsa",projectionScale:1,projectionOffset:[0,0],padding:0};ll.descriptors={_scriptable:e=>e!=="projection",_indexable:e=>e!=="projectionOffset"};const Um={position:"chartArea",property:"value",grid:{z:1,drawOnChartArea:!1},ticks:{z:1},legend:{align:"right",position:"bottom-right",length:100,width:50,margin:8,indicatorWidth:10}};function cJ(e){const{indicatorWidth:t,align:n,margin:r}=e,o=(typeof r=="number"?r:r.left)+(n==="right"?t:0),i=(typeof r=="number"?r:r.top)+(n==="bottom"?t:0),s=(typeof r=="number"?r:r.right)+(n==="left"?t:0),a=(typeof r=="number"?r:r.bottom)+(n==="top"?t:0);return{left:o,top:i,right:s,bottom:a}}function uJ(e,t,n,r,o){const{indicatorWidth:i,align:s,position:a}=t,l=s==="top"||s==="bottom",c=(s==="left"?o.w:n)+(l?i:0),u=(s==="top"?o.h:r)+(l?0:i),d=cJ(t);if(typeof a=="string")switch(a){case"top-left":return[d.left,d.top];case"top":return[(e.right-c)/2,d.top];case"left":return[d.left,(e.bottom-u)/2];case"top-right":return[e.right-c-d.right,d.top];case"bottom-right":return[e.right-c-d.right,e.bottom-u-d.bottom];case"bottom":return[(e.right-c)/2,e.bottom-u-d.bottom];case"bottom-left":return[d.left,e.bottom-u-d.bottom];default:return[e.right-c-d.right,(e.bottom-u)/2]}return[a.x,a.y]}class $l extends Ua{constructor(){super(...arguments),this.legendSize={w:0,h:0}}init(t){t.position="chartArea",super.init(t),this.axis="r"}parse(t,n){return t&&typeof t[this.options.property]=="number"?t[this.options.property]:super.parse(t,n)}isHorizontal(){return this.options.legend.align==="top"||this.options.legend.align==="bottom"}_getNormalizedValue(t){return t==null||Number.isNaN(t)?null:(t-this._startValue)/this._valueRange}update(t,n,r){const o=Math.min(n,this.bottom==null?Number.POSITIVE_INFINITY:this.bottom),i=Math.min(t,this.right==null?Number.POSITIVE_INFINITY:this.right),s=this.options.legend,a=this.isHorizontal(),l=(f,p)=>f<1?p*f:f,c=Math.min(i,l(a?s.length:s.width,i))-(a?0:s.indicatorWidth),u=Math.min(o,l(a?s.width:s.length,o))-(a?s.indicatorWidth:0);this.legendSize={w:c,h:u},this.bottom=u,this.height=u,this.right=c,this.width=c;const d=this.options.position;this.options.position=this.options.legend.align;const h=super.update(c,u,r);return this.options.position=d,this.height=Math.min(u,this.height),this.width=Math.min(c,this.width),h}_computeLabelArea(){}draw(t){if(!this._isVisible())return;const n=uJ(t,this.options.legend,this.width,this.height,this.legendSize),{ctx:r}=this;r.save(),r.translate(n[0],n[1]);const o=this.options.position;this.options.position=this.options.legend.align,super.draw({...t,bottom:this.height+10,right:this.width}),this.options.position=o;const{indicatorWidth:i}=this.options.legend;switch(this.options.legend.align){case"left":r.translate(this.legendSize.w,0);break;case"top":r.translate(0,this.legendSize.h);break;case"bottom":r.translate(0,-i);break;default:r.translate(-i,0);break}this._drawIndicator(),r.restore()}_drawIndicator(){}}class WI extends Dc{constructor(){super(...arguments),this.legendSize={w:0,h:0}}init(t){$l.prototype.init.call(this,t)}parse(t,n){return $l.prototype.parse.call(this,t,n)}isHorizontal(){return this.options.legend.align==="top"||this.options.legend.align==="bottom"}_getNormalizedValue(t){return t==null||Number.isNaN(t)?null:(Math.log10(t)-this._startValue)/this._valueRange}update(t,n,r){return $l.prototype.update.call(this,t,n,r)}_computeLabelArea(){}draw(t){return $l.prototype.draw.call(this,t)}_drawIndicator(){}}const Ci={interpolateBlues:IZ,interpolateBrBG:qQ,interpolateBuGn:uZ,interpolateBuPu:fZ,interpolateCividis:UZ,interpolateCool:YZ,interpolateCubehelixDefault:qZ,interpolateGnBu:pZ,interpolateGreens:FZ,interpolateGreys:jZ,interpolateInferno:nJ,interpolateMagma:tJ,interpolateOrRd:mZ,interpolateOranges:WZ,interpolatePRGn:YQ,interpolatePiYG:XQ,interpolatePlasma:rJ,interpolatePuBu:xZ,interpolatePuBuGn:yZ,interpolatePuOr:ZQ,interpolatePuRd:SZ,interpolatePurples:zZ,interpolateRainbow:KZ,interpolateRdBu:eZ,interpolateRdGy:nZ,interpolateRdPu:_Z,interpolateRdYlBu:oZ,interpolateRdYlGn:sZ,interpolateReds:VZ,interpolateSinebow:ZZ,interpolateSpectral:lZ,interpolateTurbo:JZ,interpolateViridis:eJ,interpolateWarm:GZ,interpolateYlGn:PZ,interpolateYlGnBu:RZ,interpolateYlOrBr:DZ,interpolateYlOrRd:AZ};Object.keys(Ci).forEach(e=>{Ci[`${e.charAt(11).toLowerCase()}${e.slice(12)}`]=Ci[e],Ci[e.slice(11)]=Ci[e]});function UI(e,t){const n=1/t;if(e<=n)return 0;if(e>=1-n)return 1;for(let r=0;r<1;r+=n)if(e<r)return r-n/2;return e}const qI={interpolate:"blues",missing:"transparent",quantize:0};class xs extends $l{get interpolate(){const t=this.options;return t?typeof t.interpolate=="function"?t.interpolate:Ci[t.interpolate]||Ci.blues:n=>`rgb(${n},${n},${n})`}getColorForValue(t){const n=this._getNormalizedValue(t);return n==null||Number.isNaN(n)?this.options.missing:this.getColor(n)}getColor(t){let n=t;return this.options.quantize>0&&(n=UI(n,this.options.quantize)),this.interpolate(n)}_drawIndicator(){const{indicatorWidth:t}=this.options.legend,n=this._reversePixels;if(this.isHorizontal()){const r=this.width;if(this.options.quantize>0){const o=r/this.options.quantize,i=n?s=>r-o-s:s=>s;for(let s=0;s<r;s+=o){const a=(s+o/2)/r;this.ctx.fillStyle=this.getColor(a),this.ctx.fillRect(i(s),0,o,t)}}else{const o=n?i=>r-1-i:i=>i;for(let i=0;i<r;i+=1)this.ctx.fillStyle=this.getColor((i+.5)/r),this.ctx.fillRect(o(i),0,1,t)}}else{const r=this.height;if(this.options.quantize>0){const o=r/this.options.quantize,i=n?s=>r-o-s:s=>s;for(let s=0;s<r;s+=o){const a=(s+o/2)/r;this.ctx.fillStyle=this.getColor(a),this.ctx.fillRect(0,i(s),t,o)}}else{const o=n?i=>r-1-i:i=>i;for(let i=0;i<r;i+=1)this.ctx.fillStyle=this.getColor((i+.5)/r),this.ctx.fillRect(0,o(i),t,1)}}}}xs.id="color";xs.defaults=fn({},[Ua.defaults,Um,qI]);xs.descriptors={_scriptable:e=>e!=="interpolate",_indexable:!1};class DS extends WI{constructor(){super(...arguments),this.interpolate=t=>`rgb(${t},${t},${t})`}init(t){super.init(t),typeof t.interpolate=="function"?this.interpolate=t.interpolate:this.interpolate=Ci[t.interpolate]||Ci.blues}getColorForValue(t){return xs.prototype.getColorForValue.call(this,t)}getColor(t){let n=t;return this.options.quantize>0&&(n=UI(n,this.options.quantize)),this.interpolate(n)}_drawIndicator(){return xs.prototype._drawIndicator.call(this)}}DS.id="colorLogarithmic";DS.defaults=fn({},[Dc.defaults,Um,qI]);DS.descriptors={_scriptable:e=>e!=="interpolate",_indexable:!1};const GI={missing:1,mode:"area",range:[2,20],legend:{align:"bottom",length:90,width:70,indicatorWidth:42}};class ws extends $l{constructor(){super(...arguments),this._model=null}getSizeForValue(t){const n=this._getNormalizedValue(t);return n==null||Number.isNaN(n)?this.options.missing:this.getSizeImpl(n)}getSizeImpl(t){const[n,r]=this.options.range;if(this.options.mode==="area"){const i=r*r*Math.PI,s=n*n*Math.PI,a=i-s,l=t*a+s;return Math.sqrt(l/Math.PI)}const o=r-n;return t*o+n}_drawIndicator(){const{ctx:t}=this,n=this.options.legend.indicatorWidth/2,r=this.isHorizontal(),o=this.ticks,i=this.getLabelItems(),s=i?i.map(a=>({[r?"x":"y"]:a.options.translation[r?0:1]})):o.map((a,l)=>({[r?"x":"y"]:this.getPixelForTick(l)}));if((this._gridLineItems||[]).forEach(a=>{if(t.save(),t.strokeStyle=a.color,t.lineWidth=a.width,t.setLineDash&&(t.setLineDash(a.borderDash),t.lineDashOffset=a.borderDashOffset),t.beginPath(),this.options.grid.drawTicks)switch(this.options.legend.align){case"left":t.moveTo(0,a.ty1),t.lineTo(n,a.ty2);break;case"top":t.moveTo(a.tx1,0),t.lineTo(a.tx2,n);break;case"bottom":t.moveTo(a.tx1,n),t.lineTo(a.tx2,n*2);break;default:t.moveTo(n,a.ty1),t.lineTo(n*2,a.ty2);break}t.stroke(),t.restore()}),this._model){const a=this._model;t.strokeStyle=a.borderColor,t.lineWidth=a.borderWidth||0,t.fillStyle=a.backgroundColor}else t.fillStyle="blue";o.forEach((a,l)=>{const c=s[l],u=this.getSizeForValue(a.value),d=r?c.x:n,h=r?n:c.y,f={pointStyle:"circle",borderWidth:0,...this._model||{},radius:u};ag(t,f,d,h)})}}ws.id="size";ws.defaults=fn({},[Ua.defaults,Um,GI]);ws.descriptors={_scriptable:!0,_indexable:e=>e!=="range"};class YI extends WI{constructor(){super(...arguments),this._model=null}getSizeForValue(t){const n=this._getNormalizedValue(t);return n==null||Number.isNaN(n)?this.options.missing:this.getSizeImpl(n)}getSizeImpl(t){return ws.prototype.getSizeImpl.call(this,t)}_drawIndicator(){ws.prototype._drawIndicator.call(this)}}YI.id="sizeLogarithmic";YI.defaults=fn({},[Dc.defaults,Um,GI]);function dJ(e,t){return[[e[0][0]-t,e[0][1]-t],[e[1][0]+t,e[1][1]+t]]}class Li extends ri{constructor(){super(...arguments),this.cache=void 0}inRange(t,n){const r=this.getBounds(),o=(Number.isNaN(t)||t>=r.x&&t<=r.x2)&&(Number.isNaN(n)||n>=r.y&&n<=r.y2),i=this.projectionScale.geoPath.projection();if(o&&!Number.isNaN(t)&&!Number.isNaN(n)&&typeof i.invert=="function"){const s=i.invert([t,n]);return s!=null&&zX(this.feature,s)}return o}inXRange(t){return this.inRange(t,Number.NaN)}inYRange(t){return this.inRange(Number.NaN,t)}getCenterPoint(){if(this.cache&&this.cache.center)return this.cache.center;let t;if(this.center){const n=this.projectionScale.projection([this.center.longitude,this.center.latitude]);t={x:n[0],y:n[1]}}else{const n=this.projectionScale.geoPath.centroid(this.feature);t={x:n[0],y:n[1]}}return this.cache={...this.cache||{},center:t},t}getBounds(){if(this.cache&&this.cache.bounds)return this.cache.bounds;const t=dJ(this.projectionScale.geoPath.bounds(this.feature),this.options.borderWidth/2),n={x:t[0][0],x2:t[1][0],y:t[0][1],y2:t[1][1],width:t[1][0]-t[0][0],height:t[1][1]-t[0][1]};return this.cache={...this.cache||{},bounds:n},n}_drawInCache(t){const n=this.getBounds();if(!Number.isFinite(n.x))return;const r=this.cache&&this.cache.canvas?this.cache.canvas:t.createElement("canvas"),o=Math.floor(n.x),i=Math.floor(n.y),s=Math.ceil(n.x+n.width),a=Math.ceil(n.y+n.height),l=this.pixelRatio||1,c=Math.ceil(Math.max(s-o,1)*l),u=Math.ceil(Math.max(a-i,1)*l);if(c<=0||u<=0)return;r.width=c,r.height=u;const d=r.getContext("2d");d&&(d.clearRect(0,0,r.width,r.height),d.save(),d.scale(l,l),d.translate(-o,-i),this._drawImpl(d),d.restore(),this.cache={...this.cache||{},canvas:r,canvasKey:this._optionsToKey()})}_optionsToKey(){const{options:t}=this;return`${t.backgroundColor};${t.borderColor};${t.borderWidth};${this.pixelRatio}`}_drawImpl(t){const{feature:n}=this,{options:r}=this;t.beginPath(),this.projectionScale.geoPath.context(t)(n),r.backgroundColor&&(t.fillStyle=r.backgroundColor,t.fill()),r.borderColor&&(t.strokeStyle=r.borderColor,t.lineWidth=r.borderWidth,t.stroke())}draw(t){const{feature:n}=this;if(!n)return;(!this.cache||this.cache.canvasKey!==this._optionsToKey())&&t.canvas.ownerDocument!=null&&this._drawInCache(t.canvas.ownerDocument);const r=this.getBounds();if(this.cache&&this.cache.canvas&&this.cache.canvas.width>0&&this.cache.canvas.height>0){const o=Math.floor(r.x),i=Math.floor(r.y),s=Math.ceil(r.x+r.width),a=Math.ceil(r.y+r.height),l=s-o,c=a-i;l>0&&c>0&&t.drawImage(this.cache.canvas,o,i,s-o,a-i)}else Number.isFinite(r.x)&&(t.save(),this._drawImpl(t),t.restore())}}Li.id="geoFeature";Li.defaults={...zo.defaults,outlineBackgroundColor:null,outlineBorderWidth:0,graticuleBorderColor:"#CCCCCC",graticuleBorderWidth:0};Li.defaultRoutes={outlineBorderColor:"borderColor",...zo.defaultRoutes||{}};const KI={showOutline:!1,showGraticule:!1,clipMap:!0},XI={scales:{projection:{axis:"x",type:ll.id,position:"chartArea",display:!1}}};function _k(e){const t={...e};return Object.keys(e).forEach(n=>{let r=n;if(n.startsWith("outline")){const o=n.slice(7);r=o[0].toLowerCase()+o.slice(1)}else if(n.startsWith("hoverOutline"))r=`hover${n.slice(12)}`;else return;delete t[n],t[r]=e[n]}),t}class QI extends Kr{getGeoDataset(){return super.getDataset()}getGeoOptions(){return this.chart.options}getProjectionScale(){return this.getScaleForId("projection")}linkScales(){const t=this.getGeoDataset(),n=this.getMeta();n.xAxisID="projection",t.xAxisID="projection",n.yAxisID="projection",t.yAxisID="projection",n.xScale=this.getScaleForId("projection"),n.yScale=this.getScaleForId("projection"),this.getProjectionScale().computeBounds(this.resolveOutline())}showOutline(){return Ae(this.getGeoDataset().showOutline,this.getGeoOptions().showOutline)}clipMap(){return Ae(this.getGeoDataset().clipMap,this.getGeoOptions().clipMap)}getGraticule(){return Ae(this.getGeoDataset().showGraticule,this.getGeoOptions().showGraticule)}update(t){super.update(t);const n=this.getMeta(),r=this.getProjectionScale(),o=r.updateBounds();if(this.showOutline()){const i=n.dataset;if(o&&delete i.cache,i.projectionScale=r,i.pixelRatio=this.chart.currentDevicePixelRatio,t!=="resize"){const s=_k(this.resolveDatasetElementOptions(t)),a={feature:this.resolveOutline(),options:s};this.updateElement(i,void 0,a,t),this.getGraticule()&&(n.graticule=s)}}else this.getGraticule()&&t!=="resize"&&(n.graticule=_k(this.resolveDatasetElementOptions(t)));this.updateElements(n.data,0,n.data.length,t),o&&n.data.forEach(i=>delete i.cache)}resolveOutline(){const n=this.getGeoDataset().outline||{type:"Sphere"};return Array.isArray(n)?{type:"FeatureCollection",features:n}:n}showGraticule(){const t=this.getGraticule(),n=this.getMeta().graticule;if(!t||!n)return;const{ctx:r}=this.chart,i=this.getProjectionScale().geoPath.context(r);if(r.save(),r.beginPath(),typeof t=="boolean")t&&i(BX());else{const s=fI();t.stepMajor&&s.stepMajor(t.stepMajor),t.stepMinor&&s.stepMinor(t.stepMinor),i(s())}r.strokeStyle=n.graticuleBorderColor,r.lineWidth=n.graticuleBorderWidth,r.stroke(),r.restore()}draw(){const{chart:t}=this,n=this.clipMap();let r=!1;(n===!0||n==="outline"||n==="outline+graticule")&&(r=!0,Ea(t.ctx,t.chartArea)),this.showOutline()&&this.getMeta().dataset&&this.getMeta().dataset.draw.call(this.getMeta().dataset,t.ctx,t.chartArea),n===!0||n==="graticule"||n==="outline+graticule"?r||Ea(t.ctx,t.chartArea):r&&(r=!1,Ra(t.ctx)),this.showGraticule(),n===!0||n==="items"?r||Ea(t.ctx,t.chartArea):r&&(r=!1,Ra(t.ctx)),this.getMeta().data.forEach(o=>o.draw.call(o,t.ctx,t.chartArea)),r&&(r=!1,Ra(t.ctx))}}function ZI(e,t,n,r=[],o=[]){ln.addControllers(n),Array.isArray(r)?ln.addElements(...r):ln.addElements(r),Array.isArray(o)?ln.addScales(...o):ln.addScales(o);const i=t;return i.type=e,i}class Qc extends QI{initialize(){super.initialize(),this.enableOptionSharing=!0}linkScales(){super.linkScales();const t=this.getGeoDataset(),n=this.getMeta();n.vAxisID="color",n.rAxisID="color",t.vAxisID="color",t.rAxisID="color",n.rScale=this.getScaleForId("color"),n.vScale=n.rScale,n.iScale=n.xScale,n.iAxisID=n.xAxisID,t.iAxisID=n.xAxisID}_getOtherScale(t){return t}parse(t,n){const r=this.getMeta().rScale,{data:o}=this.getDataset(),i=this._cachedMeta;for(let s=t;s<t+n;s+=1)i._parsed[s]={[r.axis]:r.parse(o[s],s)}}updateElements(t,n,r,o){const i=this.resolveDataElementOptions(n,o),s=this.getSharedOptions(i),a=this.includeOptions(o,s),l=this.getProjectionScale();this.updateSharedOptions(s,o,i);for(let c=n;c<n+r;c+=1){const u=t[c];u.projectionScale=l,u.feature=this._data[c].feature,u.center=this._data[c].center,u.pixelRatio=this.chart.currentDevicePixelRatio;const d=u.getCenterPoint(),h={x:d.x,y:d.y};a&&(h.options=s||this.resolveDataElementOptions(c,o)),this.updateElement(u,c,h,o)}}indexToColor(t){const n=this.getMeta().rScale;return n.getColorForValue(this.getParsed(t)[n.axis])}}Qc.id="choropleth";Qc.defaults=fn({},[KI,{datasetElementType:Li.id,dataElementType:Li.id}]);Qc.overrides=fn({},[XI,{plugins:{tooltip:{callbacks:{title(){return""},label(e){var t,n,r,o;return e.formattedValue==null?(n=(t=e.chart.data)===null||t===void 0?void 0:t.labels)===null||n===void 0?void 0:n[e.dataIndex]:`${(o=(r=e.chart.data)===null||r===void 0?void 0:r.labels)===null||o===void 0?void 0:o[e.dataIndex]}: ${e.formattedValue}`}}},colors:{enabled:!1}},scales:{color:{type:xs.id,axis:"x"}},elements:{geoFeature:{backgroundColor(e){return e.dataIndex==null?null:e.chart.getDatasetMeta(e.datasetIndex).controller.indexToColor(e.dataIndex)}}}}]);class fJ extends Pt{constructor(t,n){super(t,ZI("choropleth",n,Qc,Li,[xs,ll]))}}fJ.id=Qc.id;class Zc extends QI{initialize(){super.initialize(),this.enableOptionSharing=!0}linkScales(){super.linkScales();const t=this.getGeoDataset(),n=this.getMeta();n.vAxisID="size",n.rAxisID="size",t.vAxisID="size",t.rAxisID="size",n.rScale=this.getScaleForId("size"),n.vScale=n.rScale,n.iScale=n.xScale,n.iAxisID=n.xAxisID,t.iAxisID=n.xAxisID}_getOtherScale(t){return t}parse(t,n){const r=this.getMeta().rScale,o=this.getDataset().data,i=this._cachedMeta;for(let s=t;s<t+n;s+=1){const a=o[s];i._parsed[s]={x:a.longitude==null?a.x:a.longitude,y:a.latitude==null?a.y:a.latitude,[r.axis]:r.parse(a,s)}}}updateElements(t,n,r,o){const i=o==="reset",s=this.resolveDataElementOptions(n,o),a=this.getSharedOptions(s),l=this.includeOptions(o,a),c=this.getProjectionScale();this.getMeta().rScale._model=s,this.updateSharedOptions(a,o,s);for(let u=n;u<n+r;u+=1){const d=t[u],h=this.getParsed(u),f=c.projection([h.x,h.y]),p={x:f?f[0]:0,y:f?f[1]:0,skip:Number.isNaN(h.x)||Number.isNaN(h.y)};l&&(p.options=a||this.resolveDataElementOptions(u,o),i&&(p.options.radius=0)),this.updateElement(d,u,p,o)}}indexToRadius(t){const n=this.getMeta().rScale;return n.getSizeForValue(this.getParsed(t)[n.axis])}}Zc.id="bubbleMap";Zc.defaults=fn({},[KI,{dataElementType:Da.id,datasetElementType:Li.id,showOutline:!0,clipMap:"outline+graticule"}]);Zc.overrides=fn({},[XI,{plugins:{tooltip:{callbacks:{title(){return""},label(e){var t,n,r,o;return e.formattedValue==null?(n=(t=e.chart.data)===null||t===void 0?void 0:t.labels)===null||n===void 0?void 0:n[e.dataIndex]:`${(o=(r=e.chart.data)===null||r===void 0?void 0:r.labels)===null||o===void 0?void 0:o[e.dataIndex]}: ${e.formattedValue}`}}}},scales:{size:{axis:"x",type:ws.id}},elements:{point:{radius(e){return e.dataIndex==null?null:e.chart.getDatasetMeta(e.datasetIndex).controller.indexToRadius(e.dataIndex)},hoverRadius(e){return e.dataIndex==null?null:e.chart.getDatasetMeta(e.datasetIndex).controller.indexToRadius(e.dataIndex)+1}}}}]);class hJ extends Pt{constructor(t,n){super(t,ZI("bubbleMap",n,Zc,Li,[ws,ll]))}}hJ.id=Zc.id;function pJ(e){var n;return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0},y:{display:!0}},plugins:{...(n=e==null?void 0:e.options)==null?void 0:n.plugins,legend:{position:"bottom",align:"center"}}}}}function gJ(e){var n;return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{beginAtZero:!0,stack:1,reverse:!0},y:{stacked:!0,beginAtZero:!0}},plugins:{...(n=e==null?void 0:e.options)==null?void 0:n.plugins,legend:{position:"bottom",align:"center"}}}}}function mJ(e){var n;return{...e,type:"bar",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}},plugins:{...(n=e==null?void 0:e.options)==null?void 0:n.plugins,legend:{position:"bottom",align:"center"}}}}}function bJ(e,t=!1){var r;return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0,beginAtZero:!1},y:{display:!0,stacked:t}},plugins:{...(r=e==null?void 0:e.options)==null?void 0:r.plugins,legend:{position:"bottom",align:"center"}}}}}function yJ(e,t){var r,o,i,s,a;return{...e,type:t==="stackedBar"?"bar":"line",options:{...e==null?void 0:e.options,scales:{x:{...(o=(r=e==null?void 0:e.options)==null?void 0:r.scales)==null?void 0:o.x,display:!0,stacked:!0},y:{...(s=(i=e==null?void 0:e.options)==null?void 0:i.scales)==null?void 0:s.y,display:!0,stacked:t==="stackedBar"}},plugins:{...(a=e==null?void 0:e.options)==null?void 0:a.plugins,legend:{display:!1,position:"bottom",align:"center"}}}}}function vJ(e){var n;return{...e,type:"line",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}},plugins:{...(n=e==null?void 0:e.options)==null?void 0:n.plugins,legend:{position:"bottom",align:"center"}}}}}function xJ(e,t){var r;return{...t,type:e,options:{...t==null?void 0:t.options,scales:{x:{display:!1},y:{display:!1}},plugins:{...(r=t==null?void 0:t.options)==null?void 0:r.plugins,legend:{position:"bottom",align:"center",maxHeight:0,labels:{useBorderRadius:!0,borderRadius:2}}},borderRadius:0}}}function wJ(e){var r,o;const t=se.getState().theme;let n={...e,type:"radar",options:{...e==null?void 0:e.options,scales:{x:{display:!1},y:{display:!1},r:{grid:{display:!0},angleLines:{},ticks:{}}},plugins:{...(r=e==null?void 0:e.options)==null?void 0:r.plugins,legend:{position:"bottom",align:"center"}}}};return t==="dark"&&(n={...n,options:{...n.options,scales:{...(o=n==null?void 0:n.options)==null?void 0:o.scales,r:{grid:{color:bt.slate[800]},angleLines:{color:bt.slate[800]},ticks:{color:bt.slate[800],showLabelBackdrop:!1}}}}}),n}function SJ(e,t,n){const r={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{label:function(i){var f;const s=i.dataset.label,a=i.dataIndex,l=i.dataset.data,c=(f=l==null?void 0:l[a])==null?void 0:f.label,u=n==null?void 0:n[0],d=n==null?void 0:n[1],h=n==null?void 0:n[2];if(t==="bubble")return c?`${s} (${c}): ${u}: ${i.raw.x.toFixed(2)}, ${d}: ${i.raw.y.toFixed(2)}, ${h}: ${i.raw.r.toFixed(2)}`:`${s}: ${u}: ${i.raw.x.toFixed(2)}, ${d}: ${i.raw.y.toFixed(2)}, ${h}: ${i.raw.r.toFixed(2)}`;if(t==="scatter")return c?`${s} (${c}): ${u}: ${i.raw.x.toFixed(2)}, ${d}: ${i.raw.y.toFixed(2)}`:`${s}: ${u}: ${i.raw.x.toFixed(2)}, ${d}: ${i.raw.y.toFixed(2)}`}}},datalabels:{display:!1}},scales:{x:{title:{display:!0,text:n[0]},beginAtZero:!0,ticks:{precision:0}},y:{title:{display:!0,text:n[1]},beginAtZero:!0,ticks:{precision:0}}}};return{...e,options:{...e==null?void 0:e.options,...r}}}function CJ({data:e,cfg:t,customCfg:n,preferences:r,cardType:o}){var P,M,D,A,I;const i=((P=r==null?void 0:r.chartOptions)==null?void 0:P.indexAxis)||"y",s={...t,options:{indexAxis:i}},{metricKeys:a,dimensionKeys:l}=mn(e),c=JA(a,e),u=Gl(c,n);u.forEach(($,j)=>{var T,N,F;$.shrinkAnchor=((F=(N=(T=n==null?void 0:n.data)==null?void 0:T.datasets)==null?void 0:N[j])==null?void 0:F.shrinkAnchor)||"top"});const{plugins:d,options:h}=Fm((r==null?void 0:r.customVisualCode)||""),f=l[0],p=Nm(e,f),g=Mn((s==null?void 0:s.options)||{},(n==null?void 0:n.options)||{}),m=Mn(g,(r==null?void 0:r.chartOptions)||{});Array(u.length).fill(!0);const b=e.map($=>$[f]),v=e.map($=>$[a[0]]),x=(M=u[0])==null?void 0:M.backgroundColor.slice(),w={...m,plugins:{...m.plugins,legend:{...(D=m.plugins)==null?void 0:D.legend,labels:{generateLabels:$=>{const j=$.data.labels;return b.map((T,N)=>({text:T,fillStyle:x[N],hidden:!j.includes(T.toString()),index:N,datasetIndex:0,lineWidth:0}))}},onClick:($,j,T)=>{const N=T.chart,F=j.index,z=b[F],B=N.data.datasets[0],O=N.data.labels,U=B.data,L=B.backgroundColor,k=O.indexOf(z.toString());k>=0?(O.splice(k,1),U.splice(k,1),L.splice(k,1)):(O.splice(F,0,b[F].toString()),U.splice(F,0,Number(v[F])),L.splice(F,0,x[F])),N.update()}},datalabels:{...(A=m.plugins)==null?void 0:A.datalabels,anchor:$=>$.dataset.data[$.dataIndex]<.02?"end":"start",align:$=>$.dataset.data[$.dataIndex]<.02?"end":"center",textAlign:"center",font:{size:14},formatter:($,j)=>{var T,N,F,z;return br({number:Number($),decimalPlaces:((T=r==null?void 0:r.numberAxisFormat)==null?void 0:T.decimalPlaces)||0,useSuffix:!!((N=r==null?void 0:r.numberAxisFormat)!=null&&N.suffix),customSuffix:"",locale:((F=r==null?void 0:r.numberAxisFormat)==null?void 0:F.locale)||"",currency:((z=r==null?void 0:r.numberAxisFormat)==null?void 0:z.currency)||""})}},tooltip:{...(I=m.plugins)==null?void 0:I.tooltip,callbacks:{title:function($){var z,B,O,U;const T=((B=(z=$==null?void 0:$[0])==null?void 0:z.dataset)==null?void 0:B.data).reduce((L,k)=>L+k,0),F=(((O=$==null?void 0:$[0])==null?void 0:O.parsed[i==="x"?"y":"x"])/T*100).toFixed(2);return`${(U=$==null?void 0:$[0])==null?void 0:U.label} (${F}%)`},label:function($){var U,L,k,H;$.dataset.label;const j=$.dataset.data;j.reduce((G,Y)=>G+Y,0);const T=$.parsed[i==="x"?"y":"x"],N=j.indexOf(T),F=j[N-1],z=br({number:Number(T),decimalPlaces:((U=r==null?void 0:r.numberAxisFormat)==null?void 0:U.decimalPlaces)||0,useSuffix:!!((L=r==null?void 0:r.numberAxisFormat)!=null&&L.suffix),customSuffix:"",locale:((k=r==null?void 0:r.numberAxisFormat)==null?void 0:k.locale)||"",currency:((H=r==null?void 0:r.numberAxisFormat)==null?void 0:H.currency)||""});let B=0;return F!==void 0&&(B=Number((T/F*100).toFixed(2))),z+(F!==void 0?` | Converted: ${B}%`:"")}}}}},C=Mn(m,w),S=Mn(C,h);return delete S.scales,{type:o,data:{labels:p,datasets:u},options:S,plugins:[...d]}}function _J({data:e,cfg:t,customCfg:n,preferences:r}){var C,S;const o=bJ(t),i=EJ(e),s=Gl(i,n),{plugins:a,options:l}=Fm((r==null?void 0:r.customVisualCode)||""),c=Mn((o==null?void 0:o.options)||{},(t==null?void 0:t.options)||{}),u=Mn(c,(r==null?void 0:r.chartOptions)||{}),d=Mn(u,(n==null?void 0:n.options)||{}),h={...d,plugins:{...d==null?void 0:d.plugins,tooltip:{...(C=d==null?void 0:d.plugins)==null?void 0:C.tooltip,callbacks:{label:function(E){if(Array.isArray(E.raw)&&E.raw.every(P=>P===null))return null}}}}},f=Mn(h,l),p=rT(t,r),g=Mn(f,p),m={...g,plugins:{...g==null?void 0:g.plugins,datalabels:{...(S=g==null?void 0:g.plugins)==null?void 0:S.datalabels,formatter:(E,P)=>E.map(D=>{var A,I,$,j;return br({number:Number(D),decimalPlaces:((A=r==null?void 0:r.numberAxisFormat)==null?void 0:A.decimalPlaces)||0,useSuffix:!!((I=r==null?void 0:r.numberAxisFormat)!=null&&I.suffix),customSuffix:"",locale:(($=r==null?void 0:r.numberAxisFormat)==null?void 0:$.locale)||"",currency:((j=r==null?void 0:r.numberAxisFormat)==null?void 0:j.currency)||""})}).slice(0,2).join(" - ")}}},{dimensionKeys:b}=mn(e),v=b[0];return{type:"bar",data:{labels:[...new Set(Nm(e,v))],datasets:s},options:m,plugins:[...a]}}function EJ(e){var d,h,f,p;const{dimensionKeys:t,metricKeys:n}=mn(e),r=se.getState().themeStyle,o=(h=(d=r==null?void 0:r.chart)==null?void 0:d.dataset)==null?void 0:h.backgroundColor,i=(p=(f=r==null?void 0:r.chart)==null?void 0:f.dataset)==null?void 0:p.borderColor,s=t==null?void 0:t[1],a=t==null?void 0:t[0],l=[...new Set(e.map(g=>g==null?void 0:g[a]))];return[...new Set(e.map(g=>g==null?void 0:g[s]))].map((g,m)=>{const b=e.filter(w=>(w==null?void 0:w[s])===g),x=l.map(w=>{const C=b.filter(S=>(S==null?void 0:S[a])===w);return C.length===0?[[null,null,null]]:C.map(S=>[S==null?void 0:S[n[0]],S==null?void 0:S[n[1]],S==null?void 0:S[n[2]],w])}).flat();return{label:g,data:x,backgroundColor:o==null?void 0:o[m%o.length],borderColor:i==null?void 0:i[m%i.length],borderSkipped:!1}})}function OS({data:e,cardType:t="bar",cfg:n,customCfg:r,provider:o="chartjs",userSettings:i,preferences:s,topoJson:a,queryConfig:l}){var h,f,p,g,m,b,v,x,w;let c=e;const u=l&&l.pivotColumns&&l.pivotColumns.length>0,d=l&&l.groupByColumns&&l.groupByColumns.length>0;if(u&&d&&(c=pU(e,(l==null?void 0:l.metricColumns)||[])),t==="map"){if(!a)return null;const C=(h=s==null?void 0:s.mapVisualOptions)==null?void 0:h.objectKey;if(!C)return null;const S=aJ(a,(f=a==null?void 0:a.objects)==null?void 0:f[C]).features;if(!S)return null;const E={plugins:{datalabels:{display:!1}},scales:{x:{display:!1,grid:{display:!1}},y:{display:!1,grid:{display:!1}},projection:{axis:"x",projection:((p=s==null?void 0:s.mapVisualOptions)==null?void 0:p.projection)||"mercator",projectionScale:((g=s==null?void 0:s.mapVisualOptions)==null?void 0:g.projectionScale)||1,projectionOffset:((m=s==null?void 0:s.mapVisualOptions)==null?void 0:m.projectionOffset)||[0,0]},color:{axis:"x",interpolate:((b=s==null?void 0:s.mapVisualOptions)==null?void 0:b.colorScale)||"blues",quantize:5,legend:{position:"bottom-right",align:"right"}}}},{keys:P}=mn(c),M=S.map(T=>{var B;const N=P==null?void 0:P[0],F=P==null?void 0:P[1],z=(B=c.find(O=>(O==null?void 0:O[N])===T.properties.NAME||(O==null?void 0:O[N])===T.properties.name))==null?void 0:B[F];return{feature:T,value:z}}),A=Gl([{label:C,data:M,borderColor:"lightgray"}],r),I={type:"choropleth",data:{labels:S.map(T=>T.properties.NAME||T.properties.name),datasets:A},options:E},{options:$}=sx({cfg:I,preferences:s,customCfg:r,cardType:t});return{...I,options:$}}if(t==="bar"){const C=mJ(n);return Ws({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="horizontalBar"){const C=pJ(n);return Ws({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="funnel")return CJ({data:c,cfg:n,customCfg:r,preferences:s,cardType:t});if(t==="pyramid"){const C=gJ(n),{dimensionKeys:S,metricKeys:E}=mn(c),P=ng({dataArray:c,groupKey:S[0],pivotKey:S[1],valueKey:E[0]}),M=Ws({data:P,cfg:C,customCfg:r,cardType:t,preferences:s}),D="x2";return{...M,data:{...M.data,datasets:M.data.datasets.map((I,$)=>$===1?{...I,xAxisID:D}:I)},options:{...M.options,scales:{...(v=M==null?void 0:M.options)==null?void 0:v.scales,[D]:{beginAtZero:!0,stack:1}}}}}if(t==="stackedBar"||t==="stackedLine"){const C=yJ(n,t),{dimensionKeys:S,metricKeys:E}=mn(c);return(!u||!d)&&(c=ng({dataArray:c,groupKey:S[0],pivotKey:S[1],valueKey:E[0],sortChart:s==null?void 0:s.sortChart})),Ws({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="line"){const C=vJ(n);return Ws({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="range")return _J({data:c,cfg:n,customCfg:r,preferences:s});if(t==="pie"||t==="doughnut"||t==="polarArea"){const C=xJ(t,n),{dimensionKeys:S,metricKeys:E}=mn(c),P=JA(E,c),M=Gl(P,r),{plugins:D,options:A}=Fm((s==null?void 0:s.customVisualCode)||""),I=S[0],$=Nm(c,I),j=Mn((C==null?void 0:C.options)||{},(r==null?void 0:r.options)||{}),T=Mn(j,(s==null?void 0:s.chartOptions)||{}),N={...T,plugins:{...T.plugins,datalabels:{...(x=T.plugins)==null?void 0:x.datalabels,formatter:(U,L)=>{var k,H,G,Y;return br({number:Number(U),decimalPlaces:((k=s==null?void 0:s.numberAxisFormat)==null?void 0:k.decimalPlaces)||0,useSuffix:!!((H=s==null?void 0:s.numberAxisFormat)!=null&&H.suffix),customSuffix:"",locale:((G=s==null?void 0:s.numberAxisFormat)==null?void 0:G.locale)||"",currency:((Y=s==null?void 0:s.numberAxisFormat)==null?void 0:Y.currency)||""})}},tooltip:{...(w=T.plugins)==null?void 0:w.tooltip,callbacks:{label:function(U){var W,q,X,J;U.dataset.label;const k=U.dataset.data.reduce((ne,Q)=>ne+Q,0),H=U.parsed,G=br({number:Number(H),decimalPlaces:((W=s==null?void 0:s.numberAxisFormat)==null?void 0:W.decimalPlaces)||0,useSuffix:!!((q=s==null?void 0:s.numberAxisFormat)!=null&&q.suffix),customSuffix:"",locale:((X=s==null?void 0:s.numberAxisFormat)==null?void 0:X.locale)||"",currency:((J=s==null?void 0:s.numberAxisFormat)==null?void 0:J.currency)||""}),Y=(H/k*100).toFixed(2);return G+` (${Y}%)`}}}}},F=Mn(T,N),z=Mn(F,A);return{type:t,data:{labels:$,datasets:M},options:z,plugins:[t==="doughnut"?{id:"doughnutLabel",beforeDatasetsDraw:function(U,L,k){var Q,oe,ee,ue;const{ctx:H,data:G}=U;H.save();const Y=U.getDatasetMeta(0).data[0].x,W=U.getDatasetMeta(0).data[0].y,q=Sc(kd()),X=window.getComputedStyle(H.canvas).fontFamily;H.font=`1em ${X}`,H.fontWeight="bolder",H.fillStyle=q,H.textAlign="center",H.textBaseline="middle";const J=G.datasets[0].data.reduce((he,we)=>he+we,0),ne=br({number:Number(J),decimalPlaces:((Q=s==null?void 0:s.numberAxisFormat)==null?void 0:Q.decimalPlaces)||0,useSuffix:!!((oe=s==null?void 0:s.numberAxisFormat)!=null&&oe.suffix),customSuffix:"",locale:((ee=s==null?void 0:s.numberAxisFormat)==null?void 0:ee.locale)||"",currency:((ue=s==null?void 0:s.numberAxisFormat)==null?void 0:ue.currency)||""});H.fillText(ne,Y,W)}}:"",...D]}}if(t==="radar"){const C=wJ(n);return Ws({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="bubble"||t==="scatter"){const{metricKeys:C}=mn(c),S=rU(c,t),E=Gl(S,r),P=SJ(n,t,C),{options:M}=sx({cardType:t,cfg:P,preferences:s,customCfg:r});return{type:t,data:{datasets:E},options:M}}return Ws({data:c,cfg:n,customCfg:r,cardType:t,preferences:s})}function RJ({chart:e,elementIndex:t,datasetIndex:n,cardType:r,cfg:o,apply:i}){const s=se.getState().theme;if(!o)return;const a=s==="dark"?"rgb(238,238,238,0.2)":"rgb(238,238,238,0.8)";["bar","line","horizontalBar","bubble","scatter"].includes(r)&&PJ(e,t,o,i,a),["pie","doughnut","polarArea","funnel"].includes(r)&&MJ(e,t,o,i,a),["stackedBar","pyramid"].includes(r)&&kJ({chart:e,elementIndex:t,datasetIndex:n,cfg:o,apply:i,blurColor:a})}function kJ(e){var a,l,c,u;const{chart:t,elementIndex:n,datasetIndex:r,cfg:o,apply:i,blurColor:s}=e;i?(l=(a=t==null?void 0:t.data)==null?void 0:a.datasets)==null||l.forEach((d,h)=>{var f,p;typeof d.backgroundColor=="string"&&(d.backgroundColor=new Array(d.data.length).fill(d.backgroundColor),d.borderColor=new Array(d.data.length).fill(d.borderColor)),d.backgroundColor=(f=d==null?void 0:d.backgroundColor)==null?void 0:f.map((g,m)=>m===n&&h===r?g:s),d.borderColor=(p=d==null?void 0:d.borderColor)==null?void 0:p.map((g,m)=>m===n&&h===r?g:s)}):(u=(c=t==null?void 0:t.data)==null?void 0:c.datasets)==null||u.forEach((d,h)=>{var f,p,g,m,b,v;d.backgroundColor=new Array(d.data.length).fill((g=(p=(f=o==null?void 0:o.data)==null?void 0:f.datasets)==null?void 0:p[h])==null?void 0:g.backgroundColor),d.borderColor=new Array(d.data.length).fill((v=(b=(m=o==null?void 0:o.data)==null?void 0:m.datasets)==null?void 0:b[h])==null?void 0:v.borderColor)}),t==null||t.update()}function PJ(e,t,n,r,o){var i,s,a,l;r?(s=(i=e==null?void 0:e.data)==null?void 0:i.datasets)==null||s.forEach(c=>{var u,d;typeof c.backgroundColor=="string"&&(c.backgroundColor=new Array(c.data.length).fill(c.backgroundColor),c.borderColor=new Array(c.data.length).fill(c.borderColor)),c.backgroundColor=(u=c==null?void 0:c.backgroundColor)==null?void 0:u.map((h,f)=>f===t?h:o),c.borderColor=(d=c==null?void 0:c.borderColor)==null?void 0:d.map((h,f)=>f===t?h:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,u)=>{var d,h,f,p,g,m;c.backgroundColor=new Array(c.data.length).fill((f=(h=(d=n==null?void 0:n.data)==null?void 0:d.datasets)==null?void 0:h[u])==null?void 0:f.backgroundColor),c.borderColor=new Array(c.data.length).fill((m=(g=(p=n==null?void 0:n.data)==null?void 0:p.datasets)==null?void 0:g[u])==null?void 0:m.borderColor)}),e==null||e.update()}function MJ(e,t,n,r,o){var i,s,a,l;r?(s=(i=e==null?void 0:e.data)==null?void 0:i.datasets)==null||s.forEach(c=>{var u,d;c.backgroundColor=(u=c==null?void 0:c.backgroundColor)==null?void 0:u.map((h,f)=>f===t?h:o),c.borderColor=(d=c==null?void 0:c.borderColor)==null?void 0:d.map((h,f)=>f===t?h:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,u)=>{var d,h,f,p,g,m,b,v;typeof c.backgroundColor=="string"&&(c.backgroundColor=(f=(h=(d=n==null?void 0:n.data)==null?void 0:d.datasets)==null?void 0:h[u])==null?void 0:f.backgroundColor,c.borderColor=(m=(g=(p=n==null?void 0:n.data)==null?void 0:p.datasets)==null?void 0:g[u])==null?void 0:m.borderColor),c.backgroundColor=(b=c==null?void 0:c.backgroundColor)==null?void 0:b.map((x,w)=>{var C;return(C=n.data.datasets[u].backgroundColor)==null?void 0:C[w]}),c.borderColor=(v=c==null?void 0:c.borderColor)==null?void 0:v.map((x,w)=>{var C;return(C=n.data.datasets[u].borderColor)==null?void 0:C[w]})}),e==null||e.update()}function DJ({card:e,data:t,datasetIndex:n,clickIndex:r,value:o}){var i,s,a,l,c,u;try{if(!t)return;const{keys:d,dimensionKeys:h,metricKeys:f}=mn(t);if(e.type==="map"){const p=d[0],g=((s=(i=o==null?void 0:o.feature)==null?void 0:i.properties)==null?void 0:s.name)||((l=(a=o==null?void 0:o.feature)==null?void 0:a.properties)==null?void 0:l.NAME);return[{columnName:p,columnValue:g}]}if(["bar","horizontalBar","line","pie","doughnut","radar","polarArea","funnel"].includes(e.type)){const p=h[0],g=(c=t[r])==null?void 0:c[p];return[{columnName:p,columnValue:g,metric:f[n],value:o}]}if(["stackedBar","pyramid"].includes(e.type)){const p=ng({dataArray:t,groupKey:h[0],pivotKey:h[1],valueKey:f[0]}),g=h[0],m=(u=p[r])==null?void 0:u[g],b=h[1],{metricKeys:v}=mn(p),x=v[n];return[{columnName:g,columnValue:m,metric:f[0],value:o},{columnName:b,columnValue:x,metric:f[0],value:o}]}if(e.type==="bubble"||e.type==="scatter"){const p=h[0],g=o.label;return[{columnName:p,columnValue:g,metric1:f[0],value1:o.x,metric2:f[1],value2:o.y,metric3:f==null?void 0:f[2],value3:o==null?void 0:o.r}]}}catch(d){console.error("Error in getAdhocFilter",d)}}function OJ(e,t){var r,o;if((((r=e.data.datasets)==null?void 0:r.filter(i=>!!i.fill))||[]).length>0){const i=(o=e==null?void 0:e.data.datasets)==null?void 0:o.map(a=>({...a,backgroundColor:[a.backgroundColor].map(l=>{const c=t.createLinearGradient(0,0,0,400);return c.addColorStop(0,l),c.addColorStop(.7,hU("--semaphor-background")),c})}));return{...e,data:{...e.data,datasets:i}}}return e}function JI(e){var a,l,c,u,d,h;const t=(((l=(a=e.preferences)==null?void 0:a.mapVisualOptions)==null?void 0:l.topoJsonUrl)==="custom"?(u=(c=e.preferences)==null?void 0:c.mapVisualOptions)==null?void 0:u.customTopoJsonUrl:(h=(d=e.preferences)==null?void 0:d.mapVisualOptions)==null?void 0:h.topoJsonUrl)||"",n=!!t&&e.type==="map",{data:r,isLoading:o,isFetching:i,isError:s}=wf({queryKey:["topojson",t],queryFn:()=>fetch(t).then(f=>f.json()),enabled:n,staleTime:1/0});return{data:r,isLoading:o,isFetching:i,isError:s}}function AJ(e){var s,a;const[t]=_.useState({id:"",title:"",type:"bar"}),{getCard:n}=tn(),r=n(e),o=e5(r||t),i={...r,data:((s=o==null?void 0:o.data)==null?void 0:s.records)||[]};return{...o,data:((a=o==null?void 0:o.data)==null?void 0:a.records)||[],card:i}}function e5(e){var D;const{onChartElementClicked:t}=jr(),[n,r]=_.useState(0),o=se(A=>A.themeStyle),i=se(A=>A.filteringCards),s=se(A=>A.selectedSheetId),a=se(A=>A.selectedLensId),l=se(A=>A.filterValues),c=_.useRef(l),u=(D=e==null?void 0:e.preferences)==null?void 0:D.onClickFilter,{addFilteringCard:d,addOrUpdateFilterValues:h,removeFilterValues:f,removeFilteringCard:p}=tn(),{data:g,isLoading:m,isFetching:b,isError:v,queryKey:x,isFilteringCard:w,isSingleCardFrame:C}=Fi(e),{data:S}=JI(e);let E;E=_.useMemo(()=>{if(!(!(g!=null&&g.records)||!(g!=null&&g.records.length)))return OS({data:g==null?void 0:g.records,cardType:e.type,queryConfig:e.queryConfig,customCfg:e.customCfg,preferences:e.preferences,topoJson:S})},[g==null?void 0:g.records,e,S,o]);const P=_.useRef({filteringCards:i});_.useEffect(()=>{e.connectionId&&!w&&(c.current=l)},[l,a,e.connectionId,w]),_.useEffect(()=>{var I;w&&(P.current.filteringCards=[...i||[]]),!w&&((I=P.current.filteringCards)==null?void 0:I.find($=>$.id===e.id))&&C&&r($=>$+1)},[w,C,e.id,i]);function M(A,I,$,j){var F;let T=!1;if(!(g!=null&&g.records))return;const N=DJ({card:e,data:g==null?void 0:g.records,datasetIndex:I,clickIndex:$,value:j});if(console.log("fieldValues",N),t==null||t(e,N),!!(((F=e==null?void 0:e.preferences)==null?void 0:F.onClickFilter)??[]).length){if(w){const z=e.id;f(z),p(e)}else{if(T=!0,!N)return;const z=[];N.forEach((B,O)=>{const U=u==null?void 0:u.find(k=>k.columnIndex===O);if(!U)return;const L={filterId:e.id+"-"+B.columnName+"-"+s,connectionId:e==null?void 0:e.connectionId,tableName:e.lastSelectedTable,name:B.columnName,expression:U.expression,valueType:hm(N[U.columnIndex].columnValue),operation:"=",values:[N[U.columnIndex].columnValue]};z.push(L)}),h(z),d(e)}RJ({chart:A,elementIndex:$,datasetIndex:I,cardType:e.type,cfg:E,apply:T})}}return{isError:v,isLoading:m,isFetching:b,data:g,visualKey:n,handleDatapointClick:M,cfg:E,queryKey:x}}function Vo({children:e,containerClassName:t,className:n,text:r,onSave:o,type:i="input",placeholder:s,enabled:a}){const[l,c]=_.useState(!1),[u,d]=_.useState(r),h=se(b=>b.isDashboardEditing);_.useEffect(()=>{d(b=>b!==r?r:b)},[r]);const f=b=>{b.stopPropagation(),h&&c(!0)};function p(b){if(b.stopPropagation(),b.key==="Escape"){c(!1);return}b.key==="Enter"&&b.shiftKey||(b.key==="Enter"||b.key==="Tab")&&(c(!1),o(u))}function g(){return i==="textarea"?y.jsx("textarea",{className:ie("resize rounded-sm bg-background px-2 py-1 text-sm outline-[0.5px] outline-muted",n),onChange:b=>d(b.target.value),value:u,autoFocus:!0,placeholder:s,onBlur:()=>c(!1),onKeyDown:p}):y.jsx("input",{onMouseDown:b=>b.stopPropagation(),type:"text",className:ie("rounded-sm bg-background px-2 py-1 text-sm outline-[0.5px] outline-muted",n),onChange:b=>d(b.target.value),value:u,autoFocus:!0,placeholder:s,onBlur:()=>c(!1),onKeyDown:p})}function m(){return a?y.jsxs("div",{className:"flex grow items-center gap-2",children:[y.jsx("div",{children:l?g():e}),!l&&y.jsx(Z1,{onClick:()=>c(!0),className:"hidden size-3 cursor-pointer text-muted-foreground group-hover/editable:block"})]}):e}return y.jsx("div",{className:ie("flex",t),role:"editable",onDoubleClick:f,onMouseDown:b=>b.stopPropagation(),children:y.jsx("div",{className:"group/editable flex grow items-center gap-2",children:m()})})}function t5(e){const{authToken:t}=jr(),n=gz(t==null?void 0:t.accessToken);function r(){var i,s,a,l,c,u;if((s=(i=e.preferences)==null?void 0:i.formatNumber)!=null&&s.currency&&((l=(a=e.preferences)==null?void 0:a.formatNumber)==null?void 0:l.currency)!=="none")return n!=null&&n.currency?n==null?void 0:n.currency:(u=(c=e.preferences)==null?void 0:c.formatNumber)==null?void 0:u.currency}function o(){var i,s,a,l,c,u;if((s=(i=e.preferences)==null?void 0:i.formatNumber)!=null&&s.locale&&((l=(a=e.preferences)==null?void 0:a.formatNumber)==null?void 0:l.locale)!=="none")return n!=null&&n.locale?n==null?void 0:n.locale:(u=(c=e.preferences)==null?void 0:c.formatNumber)==null?void 0:u.locale}return{getCurrency:r,getLocale:o}}function Rg({card:e,data:t}){var x,w,C,S,E,P,M,D,A,I,$,j,T,N,F,z;const n=se(B=>B.actions.setCardTitle),r=se(B=>B.actions.setCardDescription),o=se(B=>B.isVisualEditing),i=se(B=>B.isDashboardEditing),s=er(B=>B.card),a=er(B=>B.actions.setCard);er(B=>B.actions.setNumberFormat);const{getCurrency:l,getLocale:c}=t5(e),u=se(B=>B.selectedSheetId),d=(w=(x=e.preferences)==null?void 0:x.formatNumber)==null?void 0:w.colorRanges,{metricKeys:h}=mn(t),f=(C=t==null?void 0:t[0])==null?void 0:C[h==null?void 0:h[0]],p=(S=t==null?void 0:t[0])==null?void 0:S[h==null?void 0:h[1]],g=t&&t.length>0;function m(B){o?a({...s,title:B}):n(u,e.id,B)}function b(B){o?a({...s,description:B}):r(u,e.id,B)}const v=p&&p-f!==0?(f-p)/p:null;return y.jsxs("div",{className:"kpi-card flex grow flex-col overflow-auto",children:[y.jsxs(pm,{className:"grow pb-3",children:[y.jsx(Vo,{enabled:i,text:o?s.title:e.title,onSave:m,children:y.jsx("div",{className:"flex items-center gap-2",children:y.jsx(Gc,{className:"text-base font-medium text-muted-foreground",children:e.title})})}),g&&y.jsxs("div",{className:"flex flex-wrap items-end gap-3 text-foreground",children:[y.jsx("p",{style:{color:eS(f,d)},className:"text-3xl font-semibold",children:br({number:f,decimalPlaces:((P=(E=e.preferences)==null?void 0:E.formatNumber)==null?void 0:P.decimalPlaces)||0,useSuffix:!!((D=(M=e.preferences)==null?void 0:M.formatNumber)!=null&&D.suffix),customSuffix:((I=(A=e.preferences)==null?void 0:A.formatNumber)==null?void 0:I.suffix)||"",locale:c()||"",currency:l()||""})}),p&&y.jsxs("span",{className:"min-w-fit text-base font-normal text-muted-foreground",children:["from  ",br({number:p,decimalPlaces:((j=($=e.preferences)==null?void 0:$.formatNumber)==null?void 0:j.decimalPlaces)||0,useSuffix:!!((N=(T=e.preferences)==null?void 0:T.formatNumber)!=null&&N.suffix),customSuffix:((z=(F=e.preferences)==null?void 0:F.formatNumber)==null?void 0:z.suffix)||"",locale:c()||"",currency:l()||""})]})]})]}),v&&y.jsxs(gm,{className:"grow items-start gap-1 pb-4 text-sm",children:[y.jsx(n5,{children:v}),y.jsxs("div",{className:"flex gap-1 text-muted-foreground",children:[v>0?"up ":"down ",y.jsx(Vo,{enabled:i,text:e.description||"",onSave:b,children:e.description})]})]})]})}function n5({children:e,className:t}){var i,s;const n=se(a=>a.themeStyle),r=e>0?y.jsx("span",{children:"+"}):y.jsx("span",{children:"-"}),o=`${Math.abs(e*100).toFixed(0)}%`;return y.jsxs("div",{style:{borderRadius:(s=(i=n==null?void 0:n.chart)==null?void 0:i.options)==null?void 0:s.borderRadius},className:ie("flex items-center px-1 text-sm font-semibold",{"bg-green-600/10 text-green-600":e>0,"bg-destructive/10 text-destructive":e<0},t),children:[r,y.jsx("span",{className:"ml-[1px]",children:o})]})}const TJ=["top","right","bottom","left"],ji=Math.min,zn=Math.max,Wd=Math.round,Kh=Math.floor,Ho=e=>({x:e,y:e}),IJ={left:"right",right:"left",bottom:"top",top:"bottom"},NJ={start:"end",end:"start"};function jx(e,t,n){return zn(e,ji(t,n))}function Ko(e,t){return typeof e=="function"?e(t):e}function $i(e){return e.split("-")[0]}function Jc(e){return e.split("-")[1]}function AS(e){return e==="x"?"y":"x"}function TS(e){return e==="y"?"height":"width"}function Ss(e){return["top","bottom"].includes($i(e))?"y":"x"}function IS(e){return AS(Ss(e))}function FJ(e,t,n){n===void 0&&(n=!1);const r=Jc(e),o=IS(e),i=TS(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=kg(s)),[s,kg(s)]}function LJ(e){const t=kg(e);return[$x(e),t,$x(t)]}function $x(e){return e.replace(/start|end/g,t=>NJ[t])}function jJ(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function $J(e,t,n,r){const o=Jc(e);let i=jJ($i(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map($x)))),i}function kg(e){return e.replace(/left|right|bottom|top/g,t=>IJ[t])}function zJ(e){return{top:0,right:0,bottom:0,left:0,...e}}function r5(e){return typeof e!="number"?zJ(e):{top:e,right:e,bottom:e,left:e}}function Pg(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Ek(e,t,n){let{reference:r,floating:o}=e;const i=Ss(t),s=IS(t),a=TS(s),l=$i(t),c=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let f;switch(l){case"top":f={x:u,y:r.y-o.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-o.width,y:d};break;default:f={x:r.x,y:r.y}}switch(Jc(t)){case"start":f[s]-=h*(n&&c?-1:1);break;case"end":f[s]+=h*(n&&c?-1:1);break}return f}const BJ=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=Ek(c,r,l),h=r,f={},p=0;for(let g=0;g<a.length;g++){const{name:m,fn:b}=a[g],{x:v,y:x,data:w,reset:C}=await b({x:u,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:f,rects:c,platform:s,elements:{reference:e,floating:t}});u=v??u,d=x??d,f={...f,[m]:{...f[m],...w}},C&&p<=50&&(p++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(c=C.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:u,y:d}=Ek(c,h,l)),g=-1)}return{x:u,y:d,placement:h,strategy:o,middlewareData:f}};async function Nc(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:f=0}=Ko(t,e),p=r5(f),m=a[h?d==="floating"?"reference":"floating":d],b=Pg(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(m)))==null||n?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),w=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},C=Pg(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:x,strategy:l}):v);return{top:(b.top-C.top+p.top)/w.y,bottom:(C.bottom-b.bottom+p.bottom)/w.y,left:(b.left-C.left+p.left)/w.x,right:(C.right-b.right+p.right)/w.x}}const VJ=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=Ko(e,t)||{};if(c==null)return{};const d=r5(u),h={x:n,y:r},f=IS(o),p=TS(f),g=await s.getDimensions(c),m=f==="y",b=m?"top":"left",v=m?"bottom":"right",x=m?"clientHeight":"clientWidth",w=i.reference[p]+i.reference[f]-h[f]-i.floating[p],C=h[f]-i.reference[f],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let E=S?S[x]:0;(!E||!await(s.isElement==null?void 0:s.isElement(S)))&&(E=a.floating[x]||i.floating[p]);const P=w/2-C/2,M=E/2-g[p]/2-1,D=ji(d[b],M),A=ji(d[v],M),I=D,$=E-g[p]-A,j=E/2-g[p]/2+P,T=jx(I,j,$),N=!l.arrow&&Jc(o)!=null&&j!==T&&i.reference[p]/2-(j<I?D:A)-g[p]/2<0,F=N?j<I?j-I:j-$:0;return{[f]:h[f]+F,data:{[f]:T,centerOffset:j-T-F,...N&&{alignmentOffset:F}},reset:N}}}),HJ=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...m}=Ko(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=$i(o),v=Ss(a),x=$i(a)===a,w=await(l.isRTL==null?void 0:l.isRTL(c.floating)),C=h||(x||!g?[kg(a)]:LJ(a)),S=p!=="none";!h&&S&&C.push(...$J(a,g,p,w));const E=[a,...C],P=await Nc(t,m),M=[];let D=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&M.push(P[b]),d){const j=FJ(o,s,w);M.push(P[j[0]],P[j[1]])}if(D=[...D,{placement:o,overflows:M}],!M.every(j=>j<=0)){var A,I;const j=(((A=i.flip)==null?void 0:A.index)||0)+1,T=E[j];if(T)return{data:{index:j,overflows:D},reset:{placement:T}};let N=(I=D.filter(F=>F.overflows[0]<=0).sort((F,z)=>F.overflows[1]-z.overflows[1])[0])==null?void 0:I.placement;if(!N)switch(f){case"bestFit":{var $;const F=($=D.filter(z=>{if(S){const B=Ss(z.placement);return B===v||B==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(B=>B>0).reduce((B,O)=>B+O,0)]).sort((z,B)=>z[1]-B[1])[0])==null?void 0:$[0];F&&(N=F);break}case"initialPlacement":N=a;break}if(o!==N)return{reset:{placement:N}}}return{}}}};function Rk(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function kk(e){return TJ.some(t=>e[t]>=0)}const WJ=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Ko(e,t);switch(r){case"referenceHidden":{const i=await Nc(t,{...o,elementContext:"reference"}),s=Rk(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:kk(s)}}}case"escaped":{const i=await Nc(t,{...o,altBoundary:!0}),s=Rk(i,n.floating);return{data:{escapedOffsets:s,escaped:kk(s)}}}default:return{}}}}};async function UJ(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=$i(n),a=Jc(n),l=Ss(n)==="y",c=["left","top"].includes(s)?-1:1,u=i&&l?-1:1,d=Ko(t,e);let{mainAxis:h,crossAxis:f,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof p=="number"&&(f=a==="end"?p*-1:p),l?{x:f*u,y:h*c}:{x:h*c,y:f*u}}const qJ=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await UJ(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},GJ=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:m=>{let{x:b,y:v}=m;return{x:b,y:v}}},...l}=Ko(e,t),c={x:n,y:r},u=await Nc(t,l),d=Ss($i(o)),h=AS(d);let f=c[h],p=c[d];if(i){const m=h==="y"?"top":"left",b=h==="y"?"bottom":"right",v=f+u[m],x=f-u[b];f=jx(v,f,x)}if(s){const m=d==="y"?"top":"left",b=d==="y"?"bottom":"right",v=p+u[m],x=p-u[b];p=jx(v,p,x)}const g=a.fn({...t,[h]:f,[d]:p});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[h]:i,[d]:s}}}}}},YJ=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Ko(e,t),u={x:n,y:r},d=Ss(o),h=AS(d);let f=u[h],p=u[d];const g=Ko(a,t),m=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const x=h==="y"?"height":"width",w=i.reference[h]-i.floating[x]+m.mainAxis,C=i.reference[h]+i.reference[x]-m.mainAxis;f<w?f=w:f>C&&(f=C)}if(c){var b,v;const x=h==="y"?"width":"height",w=["top","left"].includes($i(o)),C=i.reference[d]-i.floating[x]+(w&&((b=s.offset)==null?void 0:b[d])||0)+(w?0:m.crossAxis),S=i.reference[d]+i.reference[x]+(w?0:((v=s.offset)==null?void 0:v[d])||0)-(w?m.crossAxis:0);p<C?p=C:p>S&&(p=S)}return{[h]:f,[d]:p}}}},KJ=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:l=()=>{},...c}=Ko(e,t),u=await Nc(t,c),d=$i(o),h=Jc(o),f=Ss(o)==="y",{width:p,height:g}=i.floating;let m,b;d==="top"||d==="bottom"?(m=d,b=h===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(b=d,m=h==="end"?"top":"bottom");const v=g-u.top-u.bottom,x=p-u.left-u.right,w=ji(g-u[m],v),C=ji(p-u[b],x),S=!t.middlewareData.shift;let E=w,P=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=v),S&&!h){const D=zn(u.left,0),A=zn(u.right,0),I=zn(u.top,0),$=zn(u.bottom,0);f?P=p-2*(D!==0||A!==0?D+A:zn(u.left,u.right)):E=g-2*(I!==0||$!==0?I+$:zn(u.top,u.bottom))}await l({...t,availableWidth:P,availableHeight:E});const M=await s.getDimensions(a.floating);return p!==M.width||g!==M.height?{reset:{rects:!0}}:{}}}};function qm(){return typeof window<"u"}function eu(e){return o5(e)?(e.nodeName||"").toLowerCase():"#document"}function Tr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function oi(e){var t;return(t=(o5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function o5(e){return qm()?e instanceof Node||e instanceof Tr(e).Node:!1}function Hn(e){return qm()?e instanceof Element||e instanceof Tr(e).Element:!1}function Xo(e){return qm()?e instanceof HTMLElement||e instanceof Tr(e).HTMLElement:!1}function Pk(e){return!qm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Tr(e).ShadowRoot}function Df(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=po(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function XJ(e){return["table","td","th"].includes(eu(e))}function Gm(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function NS(e){const t=FS(),n=Hn(e)?po(e):e;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function QJ(e){let t=Cs(e);for(;Xo(t)&&!Fc(t);){if(NS(t))return t;if(Gm(t))return null;t=Cs(t)}return null}function FS(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Fc(e){return["html","body","#document"].includes(eu(e))}function po(e){return Tr(e).getComputedStyle(e)}function Ym(e){return Hn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Cs(e){if(eu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Pk(e)&&e.host||oi(e);return Pk(t)?t.host:t}function i5(e){const t=Cs(e);return Fc(t)?e.ownerDocument?e.ownerDocument.body:e.body:Xo(t)&&Df(t)?t:i5(t)}function Ud(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=i5(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Tr(o);if(i){const a=zx(s);return t.concat(s,s.visualViewport||[],Df(o)?o:[],a&&n?Ud(a):[])}return t.concat(o,Ud(o,[],n))}function zx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function s5(e){const t=po(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Xo(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Wd(n)!==i||Wd(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function LS(e){return Hn(e)?e:e.contextElement}function Ql(e){const t=LS(e);if(!Xo(t))return Ho(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=s5(t);let s=(i?Wd(n.width):n.width)/r,a=(i?Wd(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const ZJ=Ho(0);function a5(e){const t=Tr(e);return!FS()||!t.visualViewport?ZJ:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function JJ(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Tr(e)?!1:t}function Ya(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=LS(e);let s=Ho(1);t&&(r?Hn(r)&&(s=Ql(r)):s=Ql(e));const a=JJ(i,n,r)?a5(i):Ho(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i){const h=Tr(i),f=r&&Hn(r)?Tr(r):r;let p=h,g=zx(p);for(;g&&r&&f!==p;){const m=Ql(g),b=g.getBoundingClientRect(),v=po(g),x=b.left+(g.clientLeft+parseFloat(v.paddingLeft))*m.x,w=b.top+(g.clientTop+parseFloat(v.paddingTop))*m.y;l*=m.x,c*=m.y,u*=m.x,d*=m.y,l+=x,c+=w,p=Tr(g),g=zx(p)}}return Pg({width:u,height:d,x:l,y:c})}function jS(e,t){const n=Ym(e).scrollLeft;return t?t.left+n:Ya(oi(e)).left+n}function l5(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:jS(e,r)),i=r.top+t.scrollTop;return{x:o,y:i}}function eee(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=oi(r),a=t?Gm(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Ho(1);const u=Ho(0),d=Xo(r);if((d||!d&&!i)&&((eu(r)!=="body"||Df(s))&&(l=Ym(r)),Xo(r))){const f=Ya(r);c=Ql(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const h=s&&!d&&!i?l5(s,l,!0):Ho(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function tee(e){return Array.from(e.getClientRects())}function nee(e){const t=oi(e),n=Ym(e),r=e.ownerDocument.body,o=zn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=zn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+jS(e);const a=-n.scrollTop;return po(r).direction==="rtl"&&(s+=zn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function ree(e,t){const n=Tr(e),r=oi(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const c=FS();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function oee(e,t){const n=Ya(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Xo(e)?Ql(e):Ho(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function Mk(e,t,n){let r;if(t==="viewport")r=ree(e,n);else if(t==="document")r=nee(oi(e));else if(Hn(t))r=oee(t,n);else{const o=a5(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Pg(r)}function c5(e,t){const n=Cs(e);return n===t||!Hn(n)||Fc(n)?!1:po(n).position==="fixed"||c5(n,t)}function iee(e,t){const n=t.get(e);if(n)return n;let r=Ud(e,[],!1).filter(a=>Hn(a)&&eu(a)!=="body"),o=null;const i=po(e).position==="fixed";let s=i?Cs(e):e;for(;Hn(s)&&!Fc(s);){const a=po(s),l=NS(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Df(s)&&!l&&c5(e,s))?r=r.filter(u=>u!==s):o=a,s=Cs(s)}return t.set(e,r),r}function see(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?Gm(t)?[]:iee(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const d=Mk(t,u,o);return c.top=zn(d.top,c.top),c.right=ji(d.right,c.right),c.bottom=ji(d.bottom,c.bottom),c.left=zn(d.left,c.left),c},Mk(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function aee(e){const{width:t,height:n}=s5(e);return{width:t,height:n}}function lee(e,t,n){const r=Xo(t),o=oi(t),i=n==="fixed",s=Ya(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Ho(0);if(r||!r&&!i)if((eu(t)!=="body"||Df(o))&&(a=Ym(t)),r){const h=Ya(t,!0,i,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else o&&(l.x=jS(o));const c=o&&!r&&!i?l5(o,a):Ho(0),u=s.left+a.scrollLeft-l.x-c.x,d=s.top+a.scrollTop-l.y-c.y;return{x:u,y:d,width:s.width,height:s.height}}function Z0(e){return po(e).position==="static"}function Dk(e,t){if(!Xo(e)||po(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return oi(e)===n&&(n=n.ownerDocument.body),n}function u5(e,t){const n=Tr(e);if(Gm(e))return n;if(!Xo(e)){let o=Cs(e);for(;o&&!Fc(o);){if(Hn(o)&&!Z0(o))return o;o=Cs(o)}return n}let r=Dk(e,t);for(;r&&XJ(r)&&Z0(r);)r=Dk(r,t);return r&&Fc(r)&&Z0(r)&&!NS(r)?n:r||QJ(e)||n}const cee=async function(e){const t=this.getOffsetParent||u5,n=this.getDimensions,r=await n(e.floating);return{reference:lee(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function uee(e){return po(e).direction==="rtl"}const dee={convertOffsetParentRelativeRectToViewportRelativeRect:eee,getDocumentElement:oi,getClippingRect:see,getOffsetParent:u5,getElementRects:cee,getClientRects:tee,getDimensions:aee,getScale:Ql,isElement:Hn,isRTL:uee};function d5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function fee(e,t){let n=null,r;const o=oi(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const c=e.getBoundingClientRect(),{left:u,top:d,width:h,height:f}=c;if(a||t(),!h||!f)return;const p=Kh(d),g=Kh(o.clientWidth-(u+h)),m=Kh(o.clientHeight-(d+f)),b=Kh(u),x={rootMargin:-p+"px "+-g+"px "+-m+"px "+-b+"px",threshold:zn(0,ji(1,l))||1};let w=!0;function C(S){const E=S[0].intersectionRatio;if(E!==l){if(!w)return s();E?s(!1,E):r=setTimeout(()=>{s(!1,1e-7)},1e3)}E===1&&!d5(c,e.getBoundingClientRect())&&s(),w=!1}try{n=new IntersectionObserver(C,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,x)}n.observe(e)}return s(!0),i}function f5(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=LS(e),u=o||i?[...c?Ud(c):[],...Ud(t)]:[];u.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const d=c&&a?fee(c,n):null;let h=-1,f=null;s&&(f=new ResizeObserver(b=>{let[v]=b;v&&v.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var x;(x=f)==null||x.observe(t)})),n()}),c&&!l&&f.observe(c),f.observe(t));let p,g=l?Ya(e):null;l&&m();function m(){const b=Ya(e);g&&!d5(g,b)&&n(),g=b,p=requestAnimationFrame(m)}return n(),()=>{var b;u.forEach(v=>{o&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),d==null||d(),(b=f)==null||b.disconnect(),f=null,l&&cancelAnimationFrame(p)}}const J0=Nc,hee=qJ,pee=GJ,gee=HJ,mee=KJ,bee=WJ,Ok=VJ,yee=YJ,vee=(e,t,n)=>{const r=new Map,o={platform:dee,...n},i={...o.platform,_c:r};return BJ(e,t,{...o,platform:i})};var Fp=typeof document<"u"?_.useLayoutEffect:_.useEffect;function Mg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Mg(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Mg(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function h5(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ak(e,t){const n=h5(e);return Math.round(t*n)/n}function ey(e){const t=R.useRef(e);return Fp(()=>{t.current=e}),t}function p5(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=R.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,f]=R.useState(r);Mg(h,r)||f(r);const[p,g]=R.useState(null),[m,b]=R.useState(null),v=R.useCallback(z=>{z!==S.current&&(S.current=z,g(z))},[]),x=R.useCallback(z=>{z!==E.current&&(E.current=z,b(z))},[]),w=i||p,C=s||m,S=R.useRef(null),E=R.useRef(null),P=R.useRef(u),M=l!=null,D=ey(l),A=ey(o),I=ey(c),$=R.useCallback(()=>{if(!S.current||!E.current)return;const z={placement:t,strategy:n,middleware:h};A.current&&(z.platform=A.current),vee(S.current,E.current,z).then(B=>{const O={...B,isPositioned:I.current!==!1};j.current&&!Mg(P.current,O)&&(P.current=O,La.flushSync(()=>{d(O)}))})},[h,t,n,A,I]);Fp(()=>{c===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,d(z=>({...z,isPositioned:!1})))},[c]);const j=R.useRef(!1);Fp(()=>(j.current=!0,()=>{j.current=!1}),[]),Fp(()=>{if(w&&(S.current=w),C&&(E.current=C),w&&C){if(D.current)return D.current(w,C,$);$()}},[w,C,$,D,M]);const T=R.useMemo(()=>({reference:S,floating:E,setReference:v,setFloating:x}),[v,x]),N=R.useMemo(()=>({reference:w,floating:C}),[w,C]),F=R.useMemo(()=>{const z={position:n,left:0,top:0};if(!N.floating)return z;const B=Ak(N.floating,u.x),O=Ak(N.floating,u.y);return a?{...z,transform:"translate("+B+"px, "+O+"px)",...h5(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:O}},[n,a,N.floating,u.x,u.y]);return R.useMemo(()=>({...u,update:$,refs:T,elements:N,floatingStyles:F}),[u,$,T,N,F])}const xee=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Ok({element:r.current,padding:o}).fn(n):{}:r?Ok({element:r,padding:o}).fn(n):{}}}},$S=(e,t)=>({...hee(e),options:[e,t]}),g5=(e,t)=>({...pee(e),options:[e,t]}),wee=(e,t)=>({...yee(e),options:[e,t]}),m5=(e,t)=>({...gee(e),options:[e,t]}),b5=(e,t)=>({...mee(e),options:[e,t]}),See=(e,t)=>({...bee(e),options:[e,t]}),Cee=(e,t)=>({...xee(e),options:[e,t]});var _ee="Arrow",y5=R.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return y.jsx(me.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:y.jsx("polygon",{points:"0,0 30,0 15,10"})})});y5.displayName=_ee;var Eee=y5;function Km(e){const[t,n]=R.useState(void 0);return Dn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var zS="Popper",[v5,ii]=yn(zS),[Ree,x5]=v5(zS),w5=e=>{const{__scopePopper:t,children:n}=e,[r,o]=R.useState(null);return y.jsx(Ree,{scope:t,anchor:r,onAnchorChange:o,children:n})};w5.displayName=zS;var S5="PopperAnchor",C5=R.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=x5(S5,n),s=R.useRef(null),a=Te(t,s);return R.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:y.jsx(me.div,{...o,ref:a})});C5.displayName=S5;var BS="PopperContent",[kee,Pee]=v5(BS),_5=R.forwardRef((e,t)=>{var W,q,X,J,ne,Q;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:f="optimized",onPlaced:p,...g}=e,m=x5(BS,n),[b,v]=R.useState(null),x=Te(t,oe=>v(oe)),[w,C]=R.useState(null),S=Km(w),E=(S==null?void 0:S.width)??0,P=(S==null?void 0:S.height)??0,M=r+(i!=="center"?"-"+i:""),D=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},A=Array.isArray(c)?c:[c],I=A.length>0,$={padding:D,boundary:A.filter(Dee),altBoundary:I},{refs:j,floatingStyles:T,placement:N,isPositioned:F,middlewareData:z}=p5({strategy:"fixed",placement:M,whileElementsMounted:(...oe)=>f5(...oe,{animationFrame:f==="always"}),elements:{reference:m.anchor},middleware:[$S({mainAxis:o+P,alignmentAxis:s}),l&&g5({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?wee():void 0,...$}),l&&m5({...$}),b5({...$,apply:({elements:oe,rects:ee,availableWidth:ue,availableHeight:he})=>{const{width:we,height:ge}=ee.reference,ye=oe.floating.style;ye.setProperty("--radix-popper-available-width",`${ue}px`),ye.setProperty("--radix-popper-available-height",`${he}px`),ye.setProperty("--radix-popper-anchor-width",`${we}px`),ye.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),w&&Cee({element:w,padding:a}),Oee({arrowWidth:E,arrowHeight:P}),h&&See({strategy:"referenceHidden",...$})]}),[B,O]=k5(N),U=gn(p);Dn(()=>{F&&(U==null||U())},[F,U]);const L=(W=z.arrow)==null?void 0:W.x,k=(q=z.arrow)==null?void 0:q.y,H=((X=z.arrow)==null?void 0:X.centerOffset)!==0,[G,Y]=R.useState();return Dn(()=>{b&&Y(window.getComputedStyle(b).zIndex)},[b]),y.jsx("div",{ref:j.setFloating,"data-radix-popper-content-wrapper":"",style:{...T,transform:F?T.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:G,"--radix-popper-transform-origin":[(J=z.transformOrigin)==null?void 0:J.x,(ne=z.transformOrigin)==null?void 0:ne.y].join(" "),...((Q=z.hide)==null?void 0:Q.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:y.jsx(kee,{scope:n,placedSide:B,onArrowChange:C,arrowX:L,arrowY:k,shouldHideArrow:H,children:y.jsx(me.div,{"data-side":B,"data-align":O,...g,ref:x,style:{...g.style,animation:F?void 0:"none"}})})})});_5.displayName=BS;var E5="PopperArrow",Mee={top:"bottom",right:"left",bottom:"top",left:"right"},R5=R.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=Pee(E5,r),s=Mee[i.placedSide];return y.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:y.jsx(Eee,{...o,ref:n,style:{...o.style,display:"block"}})})});R5.displayName=E5;function Dee(e){return e!==null}var Oee=e=>({name:"transformOrigin",options:e,fn(t){var m,b,v;const{placement:n,rects:r,middlewareData:o}=t,s=((m=o.arrow)==null?void 0:m.centerOffset)!==0,a=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[c,u]=k5(n),d={start:"0%",center:"50%",end:"100%"}[u],h=(((b=o.arrow)==null?void 0:b.x)??0)+a/2,f=(((v=o.arrow)==null?void 0:v.y)??0)+l/2;let p="",g="";return c==="bottom"?(p=s?d:`${h}px`,g=`${-l}px`):c==="top"?(p=s?d:`${h}px`,g=`${r.floating.height+l}px`):c==="right"?(p=`${-l}px`,g=s?d:`${f}px`):c==="left"&&(p=`${r.floating.width+l}px`,g=s?d:`${f}px`),{data:{x:p,y:g}}}});function k5(e){const[t,n="center"]=e.split("-");return[t,n]}var Of=w5,tu=C5,Af=_5,Tf=R5,Aee="Portal",If=R.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=R.useState(!1);Dn(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?Jt.createPortal(y.jsx(me.div,{...r,ref:t}),s):null});If.displayName=Aee;function Tee(e,t=globalThis==null?void 0:globalThis.document){const n=gn(e);R.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Iee="DismissableLayer",Bx="dismissableLayer.update",Nee="dismissableLayer.pointerDownOutside",Fee="dismissableLayer.focusOutside",Tk,P5=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),cl=R.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=e,c=R.useContext(P5),[u,d]=R.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=R.useState({}),p=Te(t,E=>d(E)),g=Array.from(c.layers),[m]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(m),v=u?g.indexOf(u):-1,x=c.layersWithOutsidePointerEventsDisabled.size>0,w=v>=b,C=$ee(E=>{const P=E.target,M=[...c.branches].some(D=>D.contains(P));!w||M||(o==null||o(E),s==null||s(E),E.defaultPrevented||a==null||a())},h),S=zee(E=>{const P=E.target;[...c.branches].some(D=>D.contains(P))||(i==null||i(E),s==null||s(E),E.defaultPrevented||a==null||a())},h);return Tee(E=>{v===c.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},h),R.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Tk=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),Ik(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Tk)}},[u,h,n,c]),R.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),Ik())},[u,c]),R.useEffect(()=>{const E=()=>f({});return document.addEventListener(Bx,E),()=>document.removeEventListener(Bx,E)},[]),y.jsx(me.div,{...l,ref:p,style:{pointerEvents:x?w?"auto":"none":void 0,...e.style},onFocusCapture:ce(e.onFocusCapture,S.onFocusCapture),onBlurCapture:ce(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:ce(e.onPointerDownCapture,C.onPointerDownCapture)})});cl.displayName=Iee;var Lee="DismissableLayerBranch",jee=R.forwardRef((e,t)=>{const n=R.useContext(P5),r=R.useRef(null),o=Te(t,r);return R.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),y.jsx(me.div,{...e,ref:o})});jee.displayName=Lee;function $ee(e,t=globalThis==null?void 0:globalThis.document){const n=gn(e),r=R.useRef(!1),o=R.useRef(()=>{});return R.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let l=function(){M5(Nee,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function zee(e,t=globalThis==null?void 0:globalThis.document){const n=gn(e),r=R.useRef(!1);return R.useEffect(()=>{const o=i=>{i.target&&!r.current&&M5(Fee,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ik(){const e=new CustomEvent(Bx);document.dispatchEvent(e)}function M5(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?RO(o,i):o.dispatchEvent(i)}var ty,VS="HoverCard",[D5,JEe]=yn(VS,[ii]),Xm=ii(),[Bee,HS]=D5(VS),O5=e=>{const{__scopeHoverCard:t,children:n,open:r,defaultOpen:o,onOpenChange:i,openDelay:s=700,closeDelay:a=300}=e,l=Xm(t),c=R.useRef(0),u=R.useRef(0),d=R.useRef(!1),h=R.useRef(!1),[f=!1,p]=Un({prop:r,defaultProp:o,onChange:i}),g=R.useCallback(()=>{clearTimeout(u.current),c.current=window.setTimeout(()=>p(!0),s)},[s,p]),m=R.useCallback(()=>{clearTimeout(c.current),!d.current&&!h.current&&(u.current=window.setTimeout(()=>p(!1),a))},[a,p]),b=R.useCallback(()=>p(!1),[p]);return R.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(u.current)},[]),y.jsx(Bee,{scope:t,open:f,onOpenChange:p,onOpen:g,onClose:m,onDismiss:b,hasSelectionRef:d,isPointerDownOnContentRef:h,children:y.jsx(Of,{...l,children:n})})};O5.displayName=VS;var A5="HoverCardTrigger",T5=R.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=HS(A5,n),i=Xm(n);return y.jsx(tu,{asChild:!0,...i,children:y.jsx(me.a,{"data-state":o.open?"open":"closed",...r,ref:t,onPointerEnter:ce(e.onPointerEnter,Og(o.onOpen)),onPointerLeave:ce(e.onPointerLeave,Og(o.onClose)),onFocus:ce(e.onFocus,o.onOpen),onBlur:ce(e.onBlur,o.onClose),onTouchStart:ce(e.onTouchStart,s=>s.preventDefault())})})});T5.displayName=A5;var Vee="HoverCardPortal",[e2e,Hee]=D5(Vee,{forceMount:void 0}),Dg="HoverCardContent",I5=R.forwardRef((e,t)=>{const n=Hee(Dg,e.__scopeHoverCard),{forceMount:r=n.forceMount,...o}=e,i=HS(Dg,e.__scopeHoverCard);return y.jsx(hn,{present:r||i.open,children:y.jsx(Wee,{"data-state":i.open?"open":"closed",...o,onPointerEnter:ce(e.onPointerEnter,Og(i.onOpen)),onPointerLeave:ce(e.onPointerLeave,Og(i.onClose)),ref:t})})});I5.displayName=Dg;var Wee=R.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,...a}=e,l=HS(Dg,n),c=Xm(n),u=R.useRef(null),d=Te(t,u),[h,f]=R.useState(!1);return R.useEffect(()=>{if(h){const p=document.body;return ty=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=ty,p.style.webkitUserSelect=ty}}},[h]),R.useEffect(()=>{if(u.current){const p=()=>{f(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var m;((m=document.getSelection())==null?void 0:m.toString())!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",p),()=>{document.removeEventListener("pointerup",p),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),R.useEffect(()=>{u.current&&Gee(u.current).forEach(g=>g.setAttribute("tabindex","-1"))}),y.jsx(cl,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:s,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:ce(i,p=>{p.preventDefault()}),onDismiss:l.onDismiss,children:y.jsx(Af,{...c,...a,onPointerDown:ce(a.onPointerDown,p=>{p.currentTarget.contains(p.target)&&f(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:d,style:{...a.style,userSelect:h?"text":void 0,WebkitUserSelect:h?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),Uee="HoverCardArrow",qee=R.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=Xm(n);return y.jsx(Tf,{...o,...r,ref:t})});qee.displayName=Uee;function Og(e){return t=>t.pointerType==="touch"?void 0:e()}function Gee(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}var Yee=O5,Kee=T5,N5=I5;const Qm=Yee,Zm=Kee,Nf=R.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>y.jsx(N5,{ref:o,align:t,sideOffset:n,className:ie("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));Nf.displayName=N5.displayName;function F5({card:e}){const t=se(r=>r.isDashboardEditing),{setCardInfo:n}=tn();return y.jsxs(Qm,{openDelay:0,children:[y.jsx(Zm,{children:y.jsx(GA,{className:"size-4 text-muted-foreground/40"})}),y.jsx(Nf,{align:"start",className:"w-[300px] text-sm text-muted-foreground",onMouseDown:r=>r.stopPropagation(),children:y.jsx(Vo,{enabled:t,type:"textarea",text:e.info||"",onSave:r=>n(e.id,r),children:e.info||"Add info"})})]})}function Xee({card:e,renderFilterInfo:t}){var p,g,m,b,v,x,w,C,S,E,P,M,D,A,I,$;se(j=>j.themeStyle);const{data:n,isLoading:r}=Fi(e),o=(n==null?void 0:n.records)||[],i=se(j=>j.isDashboardEditing),{getCurrency:s,getLocale:a}=t5(e),l=(g=(p=e.preferences)==null?void 0:p.formatNumber)==null?void 0:g.colorRanges,{metricKeys:c}=mn(o||[]),u=(m=o==null?void 0:o[0])==null?void 0:m[c==null?void 0:c[0]],d=(b=o==null?void 0:o[0])==null?void 0:b[c==null?void 0:c[1]],h=(o==null?void 0:o.length)>0,f=d&&d-u!==0?(u-d)/d:null;return y.jsx("div",{className:"flex min-w-fit grow flex-col overflow-auto",children:y.jsxs("div",{className:"grow",children:[h?y.jsx("div",{className:"",children:y.jsxs("div",{className:ie("flex items-end gap-1.5",{"animate-pulse":r}),children:[y.jsx("p",{style:{color:eS(u,l)},className:"text-3xl font-semibold",children:br({number:u,decimalPlaces:((x=(v=e.preferences)==null?void 0:v.formatNumber)==null?void 0:x.decimalPlaces)||0,useSuffix:!!((C=(w=e.preferences)==null?void 0:w.formatNumber)!=null&&C.suffix),customSuffix:((E=(S=e.preferences)==null?void 0:S.formatNumber)==null?void 0:E.suffix)||"",locale:a()||"",currency:s()||""})}),f&&y.jsxs("div",{className:"flex items-end gap-1",children:[y.jsx(n5,{className:"",children:f}),d&&y.jsx("div",{className:"ml-0.5 mr-1 min-w-fit text-sm font-normal text-muted-foreground",children:`from ${br({number:d,decimalPlaces:((M=(P=e.preferences)==null?void 0:P.formatNumber)==null?void 0:M.decimalPlaces)||0,useSuffix:!!((A=(D=e.preferences)==null?void 0:D.formatNumber)!=null&&A.suffix),customSuffix:(($=(I=e.preferences)==null?void 0:I.formatNumber)==null?void 0:$.suffix)||"",locale:a()||"",currency:s()||""})}`})]})]})}):y.jsx("div",{className:"flex h-9 items-center justify-center"}),y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsxs(Gc,{className:"flex items-center gap-2 text-base font-medium text-muted-foreground",children:[e.title,(i||e.info)&&y.jsx(F5,{card:e})]}),t==null?void 0:t()]})]})})}var Qee="VisuallyHidden",WS=R.forwardRef((e,t)=>y.jsx(me.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));WS.displayName=Qee;var Zee=WS,[Jm,t2e]=yn("Tooltip",[ii]),eb=ii(),L5="TooltipProvider",Jee=700,Vx="tooltip.open",[ete,US]=Jm(L5),qS=e=>{const{__scopeTooltip:t,delayDuration:n=Jee,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,[s,a]=R.useState(!0),l=R.useRef(!1),c=R.useRef(0);return R.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),y.jsx(ete,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:R.useCallback(()=>{window.clearTimeout(c.current),a(!1)},[]),onClose:R.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:R.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:i})};qS.displayName=L5;var tb="Tooltip",[tte,nb]=Jm(tb),j5=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=US(tb,e.__scopeTooltip),c=eb(t),[u,d]=R.useState(null),h=dn(),f=R.useRef(0),p=s??l.disableHoverableContent,g=a??l.delayDuration,m=R.useRef(!1),[b=!1,v]=Un({prop:r,defaultProp:o,onChange:E=>{E?(l.onOpen(),document.dispatchEvent(new CustomEvent(Vx))):l.onClose(),i==null||i(E)}}),x=R.useMemo(()=>b?m.current?"delayed-open":"instant-open":"closed",[b]),w=R.useCallback(()=>{window.clearTimeout(f.current),f.current=0,m.current=!1,v(!0)},[v]),C=R.useCallback(()=>{window.clearTimeout(f.current),f.current=0,v(!1)},[v]),S=R.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{m.current=!0,v(!0),f.current=0},g)},[g,v]);return R.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),y.jsx(Of,{...c,children:y.jsx(tte,{scope:t,contentId:h,open:b,stateAttribute:x,trigger:u,onTriggerChange:d,onTriggerEnter:R.useCallback(()=>{l.isOpenDelayed?S():w()},[l.isOpenDelayed,S,w]),onTriggerLeave:R.useCallback(()=>{p?C():(window.clearTimeout(f.current),f.current=0)},[C,p]),onOpen:w,onClose:C,disableHoverableContent:p,children:n})})};j5.displayName=tb;var Hx="TooltipTrigger",GS=R.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=nb(Hx,n),i=US(Hx,n),s=eb(n),a=R.useRef(null),l=Te(t,a,o.onTriggerChange),c=R.useRef(!1),u=R.useRef(!1),d=R.useCallback(()=>c.current=!1,[]);return R.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),y.jsx(tu,{asChild:!0,...s,children:y.jsx(me.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:ce(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:ce(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:ce(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:ce(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:ce(e.onBlur,o.onClose),onClick:ce(e.onClick,o.onClose)})})});GS.displayName=Hx;var nte="TooltipPortal",[n2e,rte]=Jm(nte,{forceMount:void 0}),Lc="TooltipContent",$5=R.forwardRef((e,t)=>{const n=rte(Lc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=nb(Lc,e.__scopeTooltip);return y.jsx(hn,{present:r||s.open,children:s.disableHoverableContent?y.jsx(z5,{side:o,...i,ref:t}):y.jsx(ote,{side:o,...i,ref:t})})}),ote=R.forwardRef((e,t)=>{const n=nb(Lc,e.__scopeTooltip),r=US(Lc,e.__scopeTooltip),o=R.useRef(null),i=Te(t,o),[s,a]=R.useState(null),{trigger:l,onClose:c}=n,u=o.current,{onPointerInTransitChange:d}=r,h=R.useCallback(()=>{a(null),d(!1)},[d]),f=R.useCallback((p,g)=>{const m=p.currentTarget,b={x:p.clientX,y:p.clientY},v=lte(b,m.getBoundingClientRect()),x=cte(b,v),w=ute(g.getBoundingClientRect()),C=fte([...x,...w]);a(C),d(!0)},[d]);return R.useEffect(()=>()=>h(),[h]),R.useEffect(()=>{if(l&&u){const p=m=>f(m,u),g=m=>f(m,l);return l.addEventListener("pointerleave",p),u.addEventListener("pointerleave",g),()=>{l.removeEventListener("pointerleave",p),u.removeEventListener("pointerleave",g)}}},[l,u,f,h]),R.useEffect(()=>{if(s){const p=g=>{const m=g.target,b={x:g.clientX,y:g.clientY},v=(l==null?void 0:l.contains(m))||(u==null?void 0:u.contains(m)),x=!dte(b,s);v?h():x&&(h(),c())};return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[l,u,s,c,h]),y.jsx(z5,{...e,ref:i})}),[ite,ste]=Jm(tb,{isInside:!1}),z5=R.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=nb(Lc,n),c=eb(n),{onClose:u}=l;return R.useEffect(()=>(document.addEventListener(Vx,u),()=>document.removeEventListener(Vx,u)),[u]),R.useEffect(()=>{if(l.trigger){const d=h=>{const f=h.target;f!=null&&f.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),y.jsx(cl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:y.jsxs(Af,{"data-state":l.stateAttribute,...c,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[y.jsx(x1,{children:r}),y.jsx(ite,{scope:n,isInside:!0,children:y.jsx(Zee,{id:l.contentId,role:"tooltip",children:o||r})})]})})});$5.displayName=Lc;var B5="TooltipArrow",ate=R.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=eb(n);return ste(B5,n).isInside?null:y.jsx(Tf,{...o,...r,ref:t})});ate.displayName=B5;function lte(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function cte(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ute(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function dte(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function fte(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),hte(t)}function hte(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var pte=qS,gte=j5,mte=GS,V5=$5;const H5=pte,YS=gte,KS=mte,rb=R.forwardRef(({className:e,sideOffset:t=4,...n},r)=>y.jsx(V5,{ref:r,sideOffset:t,className:ie("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));rb.displayName=V5.displayName;function Ag({card:e,isLoading:t,data:n}){var h,f;const r=n||[],{keys:o}=mn(r),i=se(p=>p.selectedSheetId),s=se(p=>p.isVisualEditing),a=(f=(h=e==null?void 0:e.preferences)==null?void 0:h.textVisualOptions)==null?void 0:f.isDynamicText,{setCardDescription:l}=tn(),{setCard:c}=Im();function u(){var b;if(t)return y.jsxs("div",{className:"space-y-2",children:[y.jsx(Ca,{className:"h-3 w-full animate-pulse bg-muted"}),y.jsx(Ca,{className:"h-3 w-3/4 animate-pulse bg-muted"}),y.jsx(Ca,{className:"h-3 w-1/2 animate-pulse bg-muted"})]});const g=(b=r==null?void 0:r[0])==null?void 0:b[o[0]],m=y.jsx("div",{dangerouslySetInnerHTML:{__html:g}});return y.jsx("div",{className:"text-sm text-foreground/80 hover:cursor-text",onMouseDown:v=>v.stopPropagation(),children:m})}function d(){const p=(e==null?void 0:e.description)||"";return y.jsx("div",{onMouseDown:g=>g.stopPropagation(),children:y.jsx(Vo,{enabled:!0,type:"textarea",className:"w-full rounded-md bg-muted",text:(e==null?void 0:e.description)||"Double click to add description",onSave:g=>{s===!1&&l(i,e.id,g),s===!0&&c({...e,description:g})},children:y.jsx("div",{className:"text-sm text-foreground/70 hover:cursor-text",dangerouslySetInnerHTML:{__html:p}})})})}return y.jsxs(y.Fragment,{children:[!a&&d(),a===!0&&u()]})}const Nk=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Fk=ja,XS=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Fk(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(c=>{const u=n==null?void 0:n[c],d=i==null?void 0:i[c];if(u===null)return null;const h=Nk(u)||Nk(d);return o[c][h]}),a=n&&Object.entries(n).reduce((c,u)=>{let[d,h]=u;return h===void 0||(c[d]=h),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:h,...f}=u;return Object.entries(f).every(p=>{let[g,m]=p;return Array.isArray(m)?m.includes({...i,...a}[g]):{...i,...a}[g]===m})?[...c,d,h]:c},[]);return Fk(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},qd=XS("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),bn=R.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?Ni:"button";return y.jsx(s,{className:ie(qd({variant:t,size:n,className:e})),ref:i,...o})});bn.displayName="Button";var bte="Label",W5=R.forwardRef((e,t)=>y.jsx(me.label,{...e,ref:t,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));W5.displayName=bte;var U5=W5;const yte=XS("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Lt=R.forwardRef(({className:e,...t},n)=>y.jsx(U5,{ref:n,className:ie(yte(),e),...t}));Lt.displayName=U5.displayName;var vte="Separator",Lk="horizontal",xte=["horizontal","vertical"],q5=R.forwardRef((e,t)=>{const{decorative:n,orientation:r=Lk,...o}=e,i=wte(r)?r:Lk,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return y.jsx(me.div,{"data-orientation":i,...a,...o,ref:t})});q5.displayName=vte;function wte(e){return xte.includes(e)}var G5=q5;const ob=R.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>y.jsx(G5,{ref:o,decorative:n,orientation:t,className:ie("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));ob.displayName=G5.displayName;function Ste(){const e=se(g=>g.themeStyle),t=se(g=>g.filterValues),n=se(g=>g.dashboard.filters),r=se(g=>g.filteringCards),o=se(g=>g.selectedSheetId),{removeFilterValues:i,removeFilteringCard:s,setFilterValues:a,setFilteringCards:l}=tn(),c=n==null?void 0:n.filter(g=>g.sheetId===o||!g.sheetId),u=t==null?void 0:t.filter(g=>(c==null?void 0:c.some(m=>m.id===g.filterId))||g.filterId.endsWith(o));if(!u||u.length===0)return null;const d=u.map(g=>{const m=n==null?void 0:n.find(b=>b.id===g.filterId);return{filterId:g.filterId,name:(m==null?void 0:m.title)||g.name,values:g.values}});function h(g){return g instanceof Date?g.toLocaleDateString():g}function f(g){const m=r==null?void 0:r.find(b=>g.filterId.startsWith(b.id));m&&s(m),i(g.filterId)}function p(g){return y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{style:{borderRadius:e==null?void 0:e.controlInputRadius},className:"flex w-fit items-center gap-2 border border-border bg-muted px-2 py-1",children:[y.jsx("span",{className:"break-words",children:g.name}),y.jsx(al,{onClick:()=>f(g),className:"size-3 hover:cursor-pointer"})]}),y.jsx("div",{className:"flex flex-col gap-1 px-1",children:g.values.map((m,b)=>y.jsx("div",{style:{borderRadius:e==null?void 0:e.cardBorderRadius},className:"inline-block",children:h(m)},(m==null?void 0:m.toString())+b))})]})}return y.jsxs(Qm,{openDelay:50,children:[y.jsx(Zm,{children:y.jsx(UA,{onClick:()=>{l([]),a([])},className:"size-3.5 text-muted-foreground hover:cursor-pointer"})}),y.jsxs(Nf,{style:{borderRadius:e==null?void 0:e.cardBorderRadius},className:"min-h-fit w-[300px] flex-col space-y-4 px-0 text-xs",align:"start",children:[y.jsx(Lt,{className:"px-5 font-medium",children:"Active Filters"}),y.jsx("div",{className:"h-fit max-h-[150px] min-h-0 grow overflow-auto",children:d==null?void 0:d.map((g,m)=>y.jsxs("div",{className:"px-5",children:[p(g),m<d.length-1&&y.jsx(ob,{className:"my-4"})]},g.name))})]})]})}const Cte=R.forwardRef(({className:e,containerClassName:t,containerStyle:n,...r},o)=>y.jsx("div",{style:n,className:ie("relative w-full overflow-auto",t),children:y.jsx("table",{ref:o,className:ie("w-full caption-bottom text-sm",e),...r})}));Cte.displayName="Table";const QS=R.forwardRef(({className:e,...t},n)=>y.jsx("thead",{ref:n,className:ie("[&_tr]:border-b",e),...t}));QS.displayName="TableHeader";const ZS=R.forwardRef(({className:e,...t},n)=>y.jsx("tbody",{ref:n,className:ie("[&_tr:last-child]:border-0",e),...t}));ZS.displayName="TableBody";const _te=R.forwardRef(({className:e,...t},n)=>y.jsx("tfoot",{ref:n,className:ie("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));_te.displayName="TableFooter";const dd=R.forwardRef(({className:e,...t},n)=>y.jsx("tr",{ref:n,className:ie("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));dd.displayName="TableRow";const JS=R.forwardRef(({className:e,...t},n)=>y.jsx("th",{ref:n,className:ie("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));JS.displayName="TableHead";const Tg=R.forwardRef(({className:e,...t},n)=>y.jsx("td",{ref:n,className:ie("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Tg.displayName="TableCell";const Ete=R.forwardRef(({className:e,...t},n)=>y.jsx("caption",{ref:n,className:ie("mt-4 text-sm text-muted-foreground",e),...t}));Ete.displayName="TableCaption";/**
246
246
  * table-core
247
247
  *
248
248
  * Copyright (c) TanStack