react-semaphor 0.0.447 → 0.0.448
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,U,Y+"."+J
|
|
|
242
242
|
* Released under the MIT License
|
|
243
243
|
*/class iG{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=mT.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 gi=new iG;const B2="transparent",sG={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const r=O2(e||B2),o=r.valid&&O2(t||B2);return o&&o.valid?o.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class aG{constructor(t,n,r,o){const i=n[r];o=Lt([t.to,o,i,t.from]);const s=Lt([t.from,i,o]);this._active=!0,this._fn=t.fn||sG[t.type||typeof s],this._easing=id[t.easing]||id.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=Lt([t.to,n,o,t.from]),this._from=Lt([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 IT{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!tt(t))return;const n=Object.keys(Bt.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];($t(i.properties)&&i.properties||[o]).forEach(a=>{(a===o||!r.has(a))&&r.set(a,s)})})}_animateOptions(t,n){const r=n.options,o=cG(t,r);if(!o)return[];const i=this._createAnimations(o,r);return r.$shared&&lG(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 aG(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 gi.add(this._chart,r),!0}}function lG(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 cG(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 V2(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 uG(e,t,n){if(n===!1)return!1;const r=V2(e,n),o=V2(t,n);return{top:o.end,right:r.end,bottom:o.start,left:r.start}}function dG(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 NT(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 H2(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],Zt(c)&&(i||t===0||zo(t)===zo(c))&&(t+=c)}return!u&&!r.all?0:t}function fG(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 L0(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function hG(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function pG(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 gG(e,t,n){const r=e[t]||(e[t]={});return r[n]||(r[n]={})}function W2(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 q2(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=hG(i,s,r),d=t.length;let h;for(let f=0;f<d;++f){const p=t[f],{[l]:g,[c]:m}=p,y=p._stacks||(p._stacks={});h=y[c]=gG(o,u,g),h[a]=m,h._top=W2(h,s,!0,r.type),h._bottom=W2(h,s,!1,r.type);const x=h._visualValues||(h._visualValues={});x[a]=m}}function j0(e,t){const n=e.scales;return Object.keys(n).filter(r=>n[r].axis===t).shift()}function mG(e,t){return As(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function bG(e,t,n){return As(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function Ru(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 $0=e=>e==="reset"||e==="none",U2=(e,t)=>t?e:Object.assign({},e),yG=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:NT(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=L0(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&&Ru(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,j0(t,"x")),s=n.yAxisID=Ae(r.yAxisID,j0(t,"y")),a=n.rAxisID=Ae(r.rAxisID,j0(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&&P2(this._data,this),t._stacked&&Ru(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),r=this._data;if(tt(n)){const o=this._cachedMeta;this._data=fG(n,o)}else if(r!==n){if(r){P2(r,this);const o=this._cachedMeta;Ru(o),o._parsed=[]}n&&Object.isExtensible(n)&&rU(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=L0(n.vScale,n),n.stack!==r.stack&&(o=!0,Ru(n),n.stack=r.stack),this._resyncElements(t),(o||i!==n._stacked)&&(q2(this,n._parsed),n._stacked=L0(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{$t(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&&q2(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(ys(f,a),h),y:s.parse(ys(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:NT(o,!0),values:n._stacks[t.axis]._visualValues};return H2(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=H2(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=yG(n,r,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:d}=pG(a);let h,f;function p(){f=o[h];const g=f[a.axis];return!Zt(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],Zt(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=dG(Ae(this.options.clip,uG(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=bG(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=mG(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&&Id(r);if(a)return U2(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(Bt.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(U2(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 IT(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||$0(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){$0(o)?Object.assign(t,r):this._resolveAnimations(n,o).update(t,r)}updateSharedOptions(t,n,r){t&&!$0(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&&Ru(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])}}ge(Kr,"defaults",{}),ge(Kr,"datasetElementType",null),ge(Kr,"dataElementType",null);function vG(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=gT(r.sort((o,i)=>o-i))}return e._cache.$bar}function xG(e){const t=e.iScale,n=vG(t,e.type);let r=t._length,o,i,s,a;const l=()=>{s===32767||s===-32768||(Id(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 wG(e,t,n,r){const o=n.barThickness;let i,s;return Be(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 SG(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 CG(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 FT(e,t,n,r){return $t(e)?CG(e,t,n,r):t[n.axis]=n.parse(e,r),t}function G2(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(FT(h,d,i,c));return l}function z0(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function _G(e,t,n){return e!==0?zo(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}function EG(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 RG(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}=EG(e);o==="middle"&&n&&(e.enableBorderRadius=!0,(n._top||0)===r?o=c:(n._bottom||0)===r?o=u:(i[Y2(u,s,a,l)]=!0,o=c)),i[Y2(o,s,a,l)]=!0,e.borderSkipped=i}function Y2(e,t,n,r){return r?(e=kG(e,t,n),e=K2(e,n,t)):e=K2(e,t,n),e}function kG(e,t,n){return e===t?n:e===n?t:e}function K2(e,t,n){return e==="start"?t:e==="end"?n:e}function PG(e,{inflateAmount:t},n){e.inflateAmount=t==="auto"?n===1?.33:0:t}class Aa extends Kr{parsePrimitiveData(t,n,r,o){return G2(t,n,r,o)}parseArrayData(t,n,r,o){return G2(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(ys(g,c),h),d.push(FT(ys(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=z0(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||Be(p[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),m=this._calculateBarIndexPixels(f,u),y=(p._stacks||{})[a.axis],x={horizontal:c,base:g.base,enableBorderRadius:!y||z0(p._custom)||s===y._top||s===y._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&&(x.options=d||this.resolveDataElementOptions(f,t[f].active?"active":o));const v=x.options||t[f].options;RG(x,v,y,s),PG(x,v,u.ratio),this.updateElement(t[f],f,x,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(Be(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||xG(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=z0(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&&zo(d)!==zo(c.barEnd)&&(h=0),h+=d);const m=!Be(i)&&!u?i:h;let y=n.getPixelForValue(m);if(this.chart.getDataVisibility(t)?p=n.getPixelForValue(h+f):p=y,g=p-y,Math.abs(g)<s){g=_G(g,n,a)*s,d===a&&(y-=g/2);const x=n.getPixelForDecimal(0),v=n.getPixelForDecimal(1),_=Math.min(x,v),C=Math.max(x,v);y=Math.max(Math.min(y,C),_),p=y+g,r&&!u&&(l._stacks[n.axis]._visualValues[o]=n.getValueForPixel(p)-n.getValueForPixel(y))}if(y===n.getPixelForValue(a)){const x=zo(g)*n.getLineWidthForValue(a)/2;y+=x,g-=x}return{size:g,base:y,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"?SG(t,n,o,c):wG(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)}}ge(Aa,"id","bar"),ge(Aa,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),ge(Aa,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});class Pp 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]),y=g[d]=i?a.getBasePixel():a.getPixelForValue(p[d]);g.skip=isNaN(m)||isNaN(y),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}}ge(Pp,"id","bubble"),ge(Pp,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),ge(Pp,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});function DG(e,t,n){let r=1,o=1,i=0,s=0;if(t<zt){const a=e,l=a+t,c=Math.cos(a),u=Math.sin(a),d=Math.cos(l),h=Math.sin(l),f=(v,_,C)=>Nd(v,a,l,!0)?1:Math.max(_,_*n,C,C*n),p=(v,_,C)=>Nd(v,a,l,!0)?-1:Math.min(_,_*n,C,C*n),g=f(0,c,d),m=f(tn,u,h),y=p(Vt,c,d),x=p(Vt+tn,u,h);r=(g-y)/2,o=(m-x)/2,i=-(g+y)/2,s=-(m+x)/2}return{ratioX:r,ratioY:o,offsetX:i,offsetY:s}}class fa 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=>+ys(r[c],l)}let s,a;for(s=t,a=t+n;s<a;++s)o._parsed[s]=i(s)}}_getRotation(){return uo(this.options.rotation-90)}_getCircumference(){return uo(this.options.circumference)}_getRotationExtents(){let t=zt,n=-zt;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(Vq(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:u,rotation:d}=this._getRotationExtents(),{ratioX:h,ratioY:f,offsetX:p,offsetY:g}=DG(d,u,l),m=(r.width-s)/h,y=(r.height-s)/f,x=Math.max(Math.min(m,y)/2,0),v=uT(this.options.radius,x),_=Math.max(v*l,0),C=(v-_)/this._getVisibleDatasetWeightTotal();this.offsetX=p*v,this.offsetY=g*v,o.total=this.calculateTotal(),this.outerRadius=v-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/zt)}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 y=this._getRotation(),x;for(x=0;x<n;++x)y+=this._circumference(x,i);for(x=n;x<n+r;++x){const v=this._circumference(x,i),_=t[x],C={x:u+this.offsetX,y:d+this.offsetY,startAngle:y,endAngle:y+v,circumference:v,outerRadius:p,innerRadius:f};m&&(C.options=g||this.resolveDataElementOptions(x,_.active?"active":o)),y+=v,this.updateElement(_,x,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)?zt*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,r=this.chart,o=r.data.labels||[],i=Df(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}}ge(fa,"id","doughnut"),ge(fa,"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"}),ge(fa,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),ge(fa,"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 Dp 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}=yT(n,o,s);this._drawStart=a,this._drawCount=l,vT(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=Mc(p)?p:Number.POSITIVE_INFINITY,y=this.chart._animationsDisabled||i||o==="none",x=n+r,v=t.length;let _=n>0&&this.getParsed(n-1);for(let C=0;C<v;++C){const w=t[C],S=y?w:{};if(C<n||C>=x){S.skip=!0;continue}const k=this.getParsed(C),M=Be(k[f]),D=S[h]=s.getPixelForValue(k[h],C),A=S[f]=i||M?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,k,l):k[f],C);S.skip=isNaN(D)||isNaN(A)||M,S.stop=C>0&&Math.abs(k[h]-_[h])>m,g&&(S.parsed=k,S.raw=c.data[C]),d&&(S.options=u||this.resolveDataElementOptions(C,w.active?"active":o)),y||this.updateElement(w,C,S,o),_=k}}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()}}ge(Dp,"id","line"),ge(Dp,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),ge(Dp,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class ad 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=Df(n._parsed[t].r,r.options.locale);return{label:o[t]||"",value:i}}parseObjectData(t,n,r,o){return kT.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*Vt;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 y=f,x=f+this._computeAngle(p,o,g),v=s.getDataVisibility(p)?c.getDistanceFromCenterForValue(this.getParsed(p).r):0;f=x,i&&(l.animateScale&&(v=0),l.animateRotate&&(y=x=h));const _={x:u,y:d,innerRadius:0,outerRadius:v,startAngle:y,endAngle:x,options:this.resolveDataElementOptions(p,m.active?"active":o)};this.updateElement(m,p,_,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)?uo(this.resolveDataElementOptions(t,n).angle||r):0}}ge(ad,"id","polarArea"),ge(ad,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),ge(ad,"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 fx extends fa{}ge(fx,"id","pie"),ge(fx,"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 kT.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)}}}ge(Mp,"id","radar"),ge(Mp,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),ge(Mp,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});class Op 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}=yT(n,r,o);if(this._drawStart=i,this._drawCount=s,vT(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,y=Mc(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||i||o==="none";let v=n>0&&this.getParsed(n-1);for(let _=n;_<n+r;++_){const C=t[_],w=this.getParsed(_),S=x?C:{},k=Be(w[p]),M=S[f]=s.getPixelForValue(w[f],_),D=S[p]=i||k?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,w,l):w[p],_);S.skip=isNaN(M)||isNaN(D)||k,S.stop=_>0&&Math.abs(w[f]-v[f])>y,m&&(S.parsed=w,S.raw=c.data[_]),h&&(S.options=d||this.resolveDataElementOptions(_,C.active?"active":o)),x||this.updateElement(C,_,S,o),v=w}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}}ge(Op,"id","scatter"),ge(Op,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),ge(Op,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});var MG=Object.freeze({__proto__:null,BarController:Aa,BubbleController:Pp,DoughnutController:fa,LineController:Dp,PieController:fx,PolarAreaController:ad,RadarController:Mp,ScatterController:Op});function Ks(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class vS{constructor(t){ge(this,"options");this.options=t||{}}static override(t){Object.assign(vS.prototype,t)}init(){}formats(){return Ks()}parse(){return Ks()}format(){return Ks()}add(){return Ks()}diff(){return Ks()}startOf(){return Ks()}endOf(){return Ks()}}var OG={_date:vS};function AG(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?tU:Di;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=>!Be(g[d.axis]));u.lo-=Math.max(0,f);const p=h.slice(u.hi).findIndex(g=>!Be(g[d.axis]));u.hi+=Math.max(0,p)}return u}}return{lo:0,hi:i.length-1}}function zm(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}=AG(i[a],t,s,o);for(let f=d;f<=h;++f){const p=u[f];p.skip||r(p,c,f)}}}function TG(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 B0(e,t,n,r,o){const i=[];return!o&&!e.isPointInArea(t)||zm(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 IG(e,t,n,r){let o=[];function i(s,a,l){const{startAngle:c,endAngle:u}=s.getProps(["startAngle","endAngle"],r),{angle:d}=hT(s,{x:t.x,y:t.y});Nd(d,c,u)&&o.push({element:s,datasetIndex:a,index:l})}return zm(e,n,t,i),o}function NG(e,t,n,r,o,i){let s=[];const a=TG(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 zm(e,n,t,c),s}function V0(e,t,n,r,o,i){return!i&&!e.isPointInArea(t)?[]:n==="r"&&!r?IG(e,t,n,o):NG(e,t,n,r,o,i)}function X2(e,t,n,r,o){const i=[],s=n==="x"?"inXRange":"inYRange";let a=!1;return zm(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 FG={modes:{index(e,t,n,r){const o=ea(t,e),i=n.axis||"x",s=n.includeInvisible||!1,a=n.intersect?B0(e,o,i,r,s):V0(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=ea(t,e),i=n.axis||"xy",s=n.includeInvisible||!1;let a=n.intersect?B0(e,o,i,r,s):V0(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=ea(t,e),i=n.axis||"xy",s=n.includeInvisible||!1;return B0(e,o,i,r,s)},nearest(e,t,n,r){const o=ea(t,e),i=n.axis||"xy",s=n.includeInvisible||!1;return V0(e,o,i,n.intersect,r,s)},x(e,t,n,r){const o=ea(t,e);return X2(e,o,"x",n.intersect,r)},y(e,t,n,r){const o=ea(t,e);return X2(e,o,"y",n.intersect,r)}}};const LT=["left","top","right","bottom"];function ku(e,t){return e.filter(n=>n.pos===t)}function Q2(e,t){return e.filter(n=>LT.indexOf(n.pos)===-1&&n.box.axis===t)}function Pu(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 LG(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 jG(e){const t={};for(const n of e){const{stack:r,pos:o,stackWeight:i}=n;if(!r||!LT.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 $G(e,t){const n=jG(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 zG(e){const t=LG(e),n=Pu(t.filter(c=>c.box.fullSize),!0),r=Pu(ku(t,"left"),!0),o=Pu(ku(t,"right")),i=Pu(ku(t,"top"),!0),s=Pu(ku(t,"bottom")),a=Q2(t,"x"),l=Q2(t,"y");return{fullSize:n,leftAndTop:r.concat(i),rightAndBottom:o.concat(l).concat(s).concat(a),chartArea:ku(t,"chartArea"),vertical:r.concat(o).concat(l),horizontal:i.concat(s).concat(a)}}function Z2(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function jT(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 BG(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&&jT(s,i.getPadding());const a=Math.max(0,t.outerWidth-Z2(s,e,"left","right")),l=Math.max(0,t.outerHeight-Z2(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 VG(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 HG(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 qu(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,HG(a.horizontal,t));const{same:d,other:h}=BG(t,n,a,r);c|=d&&o.length,u=u||h,l.fullSize||o.push(a)}return c&&qu(o,t,n,r)||u}function Oh(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 J2(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;Id(c.start)&&(s=c.start),l.fullSize?Oh(l,o.left,s,n.outerWidth-o.right-o.left,h):Oh(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;Id(c.start)&&(i=c.start),l.fullSize?Oh(l,i,o.top,h,n.outerHeight-o.bottom-o.top):Oh(l,i,t.top+c.placed,h,d),c.start=i,c.placed+=d,i=l.right}}t.x=i,t.y=s}var Vn={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=Tn(e.options.layout.padding),i=Math.max(t-o.width,0),s=Math.max(n-o.height,0),a=zG(e.boxes),l=a.vertical,c=a.horizontal;xt(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);jT(h,Tn(r));const f=Object.assign({maxPadding:h,w:i,h:s,x:o.left,y:o.top},o),p=$G(l.concat(c),d);qu(a.fullSize,f,d,p),qu(l,f,d,p),qu(c,f,d,p)&&qu(l,f,d,p),VG(f),J2(a.leftAndTop,f,d,p),f.x+=f.w,f.y+=f.h,J2(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},xt(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 $T{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 WG extends $T{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Ap="$chartjs",qG={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},eR=e=>e===null||e==="";function UG(e,t){const n=e.style,r=e.getAttribute("height"),o=e.getAttribute("width");if(e[Ap]={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",eR(o)){const i=L2(e,"width");i!==void 0&&(e.width=i)}if(eR(r))if(e.style.height==="")e.height=e.width/(t||2);else{const i=L2(e,"height");i!==void 0&&(e.height=i)}return e}const zT=YU?{passive:!0}:!1;function GG(e,t,n){e&&e.addEventListener(t,n,zT)}function YG(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,zT)}function KG(e,t){const n=qG[e.type]||e.type,{x:r,y:o}=ea(e,t);return{type:n,chart:t,native:e,x:r!==void 0?r:null,y:o!==void 0?o:null}}function ug(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function XG(e,t,n){const r=e.canvas,o=new MutationObserver(i=>{let s=!1;for(const a of i)s=s||ug(a.addedNodes,r),s=s&&!ug(a.removedNodes,r);s&&n()});return o.observe(document,{childList:!0,subtree:!0}),o}function QG(e,t,n){const r=e.canvas,o=new MutationObserver(i=>{let s=!1;for(const a of i)s=s||ug(a.removedNodes,r),s=s&&!ug(a.addedNodes,r);s&&n()});return o.observe(document,{childList:!0,subtree:!0}),o}const Ld=new Map;let tR=0;function BT(){const e=window.devicePixelRatio;e!==tR&&(tR=e,Ld.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function ZG(e,t){Ld.size||window.addEventListener("resize",BT),Ld.set(e,t)}function JG(e){Ld.delete(e),Ld.size||window.removeEventListener("resize",BT)}function eY(e,t,n){const r=e.canvas,o=r&&yS(r);if(!o)return;const i=bT((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),ZG(e,i),s}function H0(e,t,n){n&&n.disconnect(),t==="resize"&&JG(e)}function tY(e,t,n){const r=e.canvas,o=bT(i=>{e.ctx!==null&&n(KG(i,e))},e);return GG(r,t,o),o}class nY extends $T{acquireContext(t,n){const r=t&&t.getContext&&t.getContext("2d");return r&&r.canvas===t?(UG(t,n),r):null}releaseContext(t){const n=t.canvas;if(!n[Ap])return!1;const r=n[Ap].initial;["height","width"].forEach(i=>{const s=r[i];Be(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[Ap],!0}addEventListener(t,n,r){this.removeEventListener(t,n);const o=t.$proxies||(t.$proxies={}),s={attach:XG,detach:QG,resize:eY}[n]||tY;o[n]=s(t,n,r)}removeEventListener(t,n){const r=t.$proxies||(t.$proxies={}),o=r[n];if(!o)return;({attach:H0,detach:H0,resize:H0}[n]||YG)(t,n,o),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,r,o){return GU(t,n,r,o)}isAttached(t){const n=t&&yS(t);return!!(n&&n.isConnected)}}function rY(e){return!bS()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?WG:nY}var kp;let oi=(kp=class{constructor(){ge(this,"x");ge(this,"y");ge(this,"active",!1);ge(this,"options");ge(this,"$animations")}tooltipPosition(t){const{x:n,y:r}=this.getProps(["x","y"],t);return{x:n,y:r}}hasValue(){return Mc(this.x)&&Mc(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}},ge(kp,"defaults",{}),ge(kp,"defaultRoutes"),kp);function oY(e,t){const n=e.options.ticks,r=iY(e),o=Math.min(n.maxTicksLimit||r,r),i=n.major.enabled?aY(t):[],s=i.length,a=i[0],l=i[s-1],c=[];if(s>o)return lY(t,c,i,s/o),c;const u=sY(i,t,o);if(s>0){let d,h;const f=s>1?Math.round((l-a)/(s-1)):null;for(Ah(t,c,u,Be(f)?0:a-f,a),d=0,h=s-1;d<h;d++)Ah(t,c,u,i[d],i[d+1]);return Ah(t,c,u,l,Be(f)?t.length:l+f),c}return Ah(t,c,u),c}function iY(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 sY(e,t,n){const r=cY(e),o=t.length/n;if(!r)return Math.max(o,1);const i=Xq(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 aY(e){const t=[];let n,r;for(n=0,r=e.length;n<r;n++)e[n].major&&t.push(n);return t}function lY(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 Ah(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 cY(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 uY=e=>e==="left"?"right":e==="right"?"left":e,nR=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,rR=(e,t)=>Math.min(t||e,e);function oR(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 dY(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 fY(e,t){xt(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 Du(e){return e.drawTicks?e.tickLength:0}function iR(e,t){if(!e.display)return 0;const n=fn(e.font,t),r=Tn(e.padding);return($t(e.text)?e.text.length:1)*n.lineHeight+r.height}function hY(e,t){return As(e,{scale:t,type:"scale"})}function pY(e,t,n){return As(e,{tick:n,index:t,type:"tick"})}function gY(e,t,n){let r=dS(e);return(n&&t!=="right"||!n&&t==="right")&&(r=uY(r)),r}function mY(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=zn(r,i,a),tt(n)){const y=Object.keys(n)[0],x=n[y];p=u[y].getPixelForValue(x)+g-t}else n==="center"?p=(c.bottom+c.top)/2+g-t:p=nR(e,n,t);h=a-i}else{if(tt(n)){const y=Object.keys(n)[0],x=n[y];f=u[y].getPixelForValue(x)-m+t}else n==="center"?f=(c.left+c.right)/2-m+t:f=nR(e,n,t);p=zn(r,s,o),d=n==="left"?-tn:tn}return{titleX:f,titleY:p,maxWidth:h,rotation:d}}class Ts extends oi{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=Pr(t,Number.POSITIVE_INFINITY),n=Pr(n,Number.NEGATIVE_INFINITY),r=Pr(r,Number.POSITIVE_INFINITY),o=Pr(o,Number.NEGATIVE_INFINITY),{min:Pr(t,r),max:Pr(n,o),minDefined:Zt(t),maxDefined:Zt(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:Pr(n,Pr(r,n)),max:Pr(r,Pr(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(){Rt(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=EU(this,i,o),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?oR(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),s.display&&(s.autoSkip||s.source==="auto")&&(this.ticks=oY(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(){Rt(this.options.afterUpdate,[this])}beforeSetDimensions(){Rt(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(){Rt(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),Rt(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){Rt(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=Rt(n.callback,[i.value,r,t],this)}afterTickToLabelConversion(){Rt(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){Rt(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,r=rR(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=_n(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-Du(t.grid)-n.padding-iR(t.title,this.chart.options.font),c=Math.sqrt(d*d+h*h),s=cS(Math.min(Math.asin(_n((u.highest.height+6)/a,-1,1)),Math.asin(_n(l/c,-1,1))-Math.asin(_n(h/c,-1,1)))),s=Math.max(o,Math.min(i,s))),this.labelRotation=s}afterCalculateLabelRotation(){Rt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){Rt(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=iR(o,n.options.font);if(a?(t.width=this.maxWidth,t.height=Du(i)+l):(t.height=this.maxHeight,t.width=Du(i)+l),r.display&&this.ticks.length){const{first:c,last:u,widest:d,highest:h}=this._getLabelSizes(),f=r.padding*2,p=uo(this.labelRotation),g=Math.cos(p),m=Math.sin(p);if(a){const y=r.mirror?0:m*d.width+g*h.height;t.height=Math.min(this.maxHeight,t.height+y+f)}else{const y=r.mirror?0:g*d.width+m*h.height;t.width=Math.min(this.maxWidth,t.width+y+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(){Rt(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++)Be(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=oR(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/rR(n,r));let c=0,u=0,d,h,f,p,g,m,y,x,v,_,C;for(d=0;d<n;d+=l){if(p=t[d].label,g=this._resolveTickFontOptions(d),o.font=m=g.string,y=i[m]=i[m]||{data:{},gc:[]},x=g.lineHeight,v=_=0,!Be(p)&&!$t(p))v=ag(o,y.data,y.gc,v,p),_=x;else if($t(p))for(h=0,f=p.length;h<f;++h)C=p[h],!Be(C)&&!$t(C)&&(v=ag(o,y.data,y.gc,v,C),_+=x);s.push(v),a.push(_),c=Math.max(v,c),u=Math.max(_,u)}fY(i,n);const w=s.indexOf(c),S=a.indexOf(u),k=M=>({width:s[M]||0,height:a[M]||0});return{first:k(0),last:k(n-1),widest:k(w),highest:k(S),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 eU(this._alignToPixels?Ys(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=pY(this.getContext(),t,r))}return this.$context||(this.$context=hY(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=uo(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=Du(i),f=[],p=a.setContext(this.getContext()),g=p.display?p.width:0,m=g/2,y=function(N){return Ys(r,N,g)};let x,v,_,C,w,S,k,M,D,A,I,$;if(s==="top")x=y(this.bottom),S=this.bottom-h,M=x-m,A=y(t.top)+m,$=t.bottom;else if(s==="bottom")x=y(this.top),A=t.top,$=y(t.bottom)-m,S=x+m,M=this.top+h;else if(s==="left")x=y(this.right),w=this.right-h,k=x-m,D=y(t.left)+m,I=t.right;else if(s==="right")x=y(this.left),D=t.left,I=y(t.right)-m,w=x+m,k=this.left+h;else if(n==="x"){if(s==="center")x=y((t.top+t.bottom)/2+.5);else if(tt(s)){const N=Object.keys(s)[0],F=s[N];x=y(this.chart.scales[N].getPixelForValue(F))}A=t.top,$=t.bottom,S=x+m,M=S+h}else if(n==="y"){if(s==="center")x=y((t.left+t.right)/2);else if(tt(s)){const N=Object.keys(s)[0],F=s[N];x=y(this.chart.scales[N].getPixelForValue(F))}w=x-m,k=w-h,D=t.left,I=t.right}const j=Ae(o.ticks.maxTicksLimit,d),T=Math.max(1,Math.ceil(d/j));for(v=0;v<d;v+=T){const N=this.getContext(v),F=i.setContext(N),z=a.setContext(N),B=F.lineWidth,O=F.color,q=z.dash||[],L=z.dashOffset,P=F.tickWidth,H=F.tickColor,U=F.tickBorderDash||[],Y=F.tickBorderDashOffset;_=dY(this,v,l),_!==void 0&&(C=Ys(r,_,B),c?w=k=D=I=C:S=M=A=$=C,f.push({tx1:w,ty1:S,tx2:k,ty2:M,x1:D,y1:A,x2:I,y2:$,width:B,color:O,borderDash:q,borderDashOffset:L,tickWidth:P,tickColor:H,tickBorderDash:U,tickBorderDashOffset:Y}))}return this._ticksLength=d,this._borderValue=x,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=Du(r.grid),f=h+u,p=d?-u:f,g=-uo(this.labelRotation),m=[];let y,x,v,_,C,w,S,k,M,D,A,I,$="middle";if(o==="top")w=this.bottom-p,S=this._getXAxisLabelAlignment();else if(o==="bottom")w=this.top+p,S=this._getXAxisLabelAlignment();else if(o==="left"){const T=this._getYAxisLabelAlignment(h);S=T.textAlign,C=T.x}else if(o==="right"){const T=this._getYAxisLabelAlignment(h);S=T.textAlign,C=T.x}else if(n==="x"){if(o==="center")w=(t.top+t.bottom)/2+f;else if(tt(o)){const T=Object.keys(o)[0],N=o[T];w=this.chart.scales[T].getPixelForValue(N)+f}S=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)}S=this._getYAxisLabelAlignment(h).textAlign}n==="y"&&(l==="start"?$="top":l==="end"&&($="bottom"));const j=this._getLabelSizes();for(y=0,x=a.length;y<x;++y){v=a[y],_=v.label;const T=i.setContext(this.getContext(y));k=this.getPixelForTick(y)+i.labelOffset,M=this._resolveTickFontOptions(y),D=M.lineHeight,A=$t(_)?_.length:1;const N=A/2,F=T.color,z=T.textStrokeColor,B=T.textStrokeWidth;let O=S;s?(C=k,S==="inner"&&(y===x-1?O=this.options.reverse?"left":"right":y===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))):(w=k,I=(1-A)*D/2);let q;if(T.showLabelBackdrop){const L=Tn(T.backdropPadding),P=j.heights[y],H=j.widths[y];let U=I-L.top,Y=0-L.left;switch($){case"middle":U-=P/2;break;case"bottom":U-=P;break}switch(S){case"center":Y-=H/2;break;case"right":Y-=H;break;case"inner":y===x-1?Y-=H:y>0&&(Y-=H/2);break}q={left:Y,top:U,width:H+L.width,height:P+L.height,color:T.backdropColor}}m.push({label:_,font:M,textOffset:I,options:{rotation:g,color:F,strokeColor:z,strokeWidth:B,textAlign:O,textBaseline:$,translation:[C,w],backdrop:q}})}return m}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-uo(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=Ys(t,this.left,s)-s/2,u=Ys(t,this.right,a)+a/2,d=h=l):(d=Ys(t,this.top,s)-s/2,h=Ys(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&&Pa(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;Ga(r,c,0,u,l,a)}o&&Da(r)}drawTitle(){const{ctx:t,options:{position:n,title:r,reverse:o}}=this;if(!r.display)return;const i=fn(r.font),s=Tn(r.padding),a=r.align;let l=i.lineHeight/2;n==="bottom"||n==="center"||tt(n)?(l+=s.bottom,$t(r.text)&&(l+=i.lineHeight*(r.text.length-1))):l+=s.top;const{titleX:c,titleY:u,maxWidth:d,rotation:h}=mY(this,l,n,a);Ga(t,r.text,0,0,i,{color:r.color,maxWidth:d,rotation:h,textAlign:gY(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!==Ts.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 fn(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Th{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;vY(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,bY(t,s,r),this.override&&Bt.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 Bt[o]&&(delete Bt[o][r],this.override&&delete Ua[r])}}function bY(e,t,n){const r=pn(Object.create(null),[n?Bt.get(n):{},Bt.get(t),e.defaults]);Bt.set(t,r),e.defaultRoutes&&yY(t,e.defaultRoutes),e.descriptors&&Bt.describe(t,e.descriptors)}function yY(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(".");Bt.route(i,o,l,a)})}function vY(e){return"id"in e&&"defaults"in e}class xY{constructor(){this.controllers=new Th(Kr,"datasets",!0),this.elements=new Th(oi,"elements"),this.plugins=new Th(Object,"plugins"),this.scales=new Th(Ts,"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):xt(o,s=>{const a=r||this._getRegistryForType(s);this._exec(t,a,s)})})}_exec(t,n,r){const o=lS(t);Rt(r["before"+o],[],r),n[t](r),Rt(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 un=new xY;class wY{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(Rt(a,l,s)===!1&&o.cancelable)return!1}return!0}invalidate(){Be(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=SY(r);return o===!1&&!n?[]:_Y(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 SY(e){const t={},n=[],r=Object.keys(un.plugins.items);for(let i=0;i<r.length;i++)n.push(un.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 CY(e,t){return!t&&e===!1?null:e===!0?{}:e}function _Y(e,{plugins:t,localIds:n},r,o){const i=[],s=e.getContext();for(const a of t){const l=a.id,c=CY(r[l],o);c!==null&&i.push({plugin:a,options:EY(e.config,{plugin:a,local:n[l]},c,s)})}return i}function EY(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 hx(e,t){const n=Bt.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function RY(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function kY(e,t){return e===t?"_index_":"_value_"}function sR(e){if(e==="x"||e==="y"||e==="r")return e}function PY(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function px(e,...t){if(sR(e))return e;for(const n of t){const r=n.axis||PY(n.position)||e.length>1&&sR(e[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function aR(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function DY(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 aR(e,"x",n[0])||aR(e,"y",n[0])}return{}}function MY(e,t){const n=Ua[e.type]||{scales:{}},r=t.scales||{},o=hx(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=px(s,a,DY(s,e),Bt.scales[a.type]),c=kY(l,o),u=n.scales||{};i[s]=rd(Object.create(null),[{axis:l},a,u[l],u[c]])}),e.data.datasets.forEach(s=>{const a=s.type||e.type,l=s.indexAxis||hx(a,t),u=(Ua[a]||{}).scales||{};Object.keys(u).forEach(d=>{const h=RY(d,l),f=s[h+"AxisID"]||h;i[f]=i[f]||Object.create(null),rd(i[f],[{axis:h},r[f],u[d]])})}),Object.keys(i).forEach(s=>{const a=i[s];rd(a,[Bt.scales[a.type],Bt.scale])}),i}function VT(e){const t=e.options||(e.options={});t.plugins=Ae(t.plugins,{}),t.scales=MY(e,t)}function HT(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function OY(e){return e=e||{},e.data=HT(e.data),VT(e),e}const lR=new Map,WT=new Set;function Ih(e,t){let n=lR.get(e);return n||(n=t(),lR.set(e,n),WT.add(n)),n}const Mu=(e,t,n)=>{const r=ys(t,n);r!==void 0&&e.add(r)};class AY{constructor(t){this._config=OY(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=HT(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(),VT(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Ih(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return Ih(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return Ih(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,r=this.type;return Ih(`${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=>Mu(l,t,d))),u.forEach(d=>Mu(l,o,d)),u.forEach(d=>Mu(l,Ua[i]||{},d)),u.forEach(d=>Mu(l,Bt,d)),u.forEach(d=>Mu(l,dx,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),WT.has(n)&&s.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,Ua[n]||{},Bt.datasets[n]||{},{type:n},Bt,dx]}resolveNamedOptions(t,n,r,o=[""]){const i={$shared:!0},{resolver:s,subPrefixes:a}=cR(this._resolverCache,t,o);let l=s;if(IY(s,n)){i.$shared=!1,r=vs(r)?r():r;const c=this.createResolver(t,r,a);l=Oc(s,r,c)}for(const c of n)i[c]=l[c];return i}createResolver(t,n,r=[""],o){const{resolver:i}=cR(this._resolverCache,t,r);return tt(n)?Oc(i,n,void 0,o):i}}function cR(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:pS(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},r.set(o,i)),i}const TY=e=>tt(e)&&Object.getOwnPropertyNames(e).some(t=>vs(e[t]));function IY(e,t){const{isScriptable:n,isIndexable:r}=CT(e);for(const o of t){const i=n(o),s=r(o),a=(s||i)&&e[o];if(i&&(vs(a)||TY(a))||s&&$t(a))return!0}return!1}var NY="4.4.8";const FY=["top","bottom","left","right","chartArea"];function uR(e,t){return e==="top"||e==="bottom"||FY.indexOf(e)===-1&&t==="x"}function dR(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function fR(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),Rt(n&&n.onComplete,[e],t)}function LY(e){const t=e.chart,n=t.options.animation;Rt(n&&n.onProgress,[e],t)}function qT(e){return bS()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Tp={},hR=e=>{const t=qT(e);return Object.values(Tp).filter(n=>n.canvas===t).pop()};function jY(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 $Y(e,t,n,r){return!n||e.type==="mouseout"?null:r?t:e}function Nh(e,t,n){return e.options.clip?e[n]:t[n]}function zY(e,t){const{xScale:n,yScale:r}=e;return n&&r?{left:Nh(n,t,"left"),right:Nh(n,t,"right"),top:Nh(r,t,"top"),bottom:Nh(r,t,"bottom")}:t}class Mt{static register(...t){un.add(...t),pR()}static unregister(...t){un.remove(...t),pR()}constructor(t,n){const r=this.config=new AY(n),o=qT(t),i=hR(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||rY(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=Bq(),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 wY,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=oU(d=>this.update(d),s.resizeDelay||0),this._dataChanges=[],Tp[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}gi.listen(this,"complete",fR),gi.listen(this,"progress",LY),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:r,height:o,_aspectRatio:i}=this;return Be(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 un}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():F2(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return T2(this.canvas,this.ctx),this}stop(){return gi.stop(this),this}resize(t,n){gi.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,F2(this,a,!0)&&(this.notifyPlugins("resize",{size:s}),Rt(r.onResize,[this,s],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};xt(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=px(s,a),c=l==="r",u=l==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),xt(i,s=>{const a=s.options,l=a.id,c=px(l,a),u=Ae(a.type,s.dtype);(a.position===void 0||uR(a.position,c)!==uR(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=un.getScale(u);d=new h({id:l,type:u,ctx:this.ctx,chart:this}),r[d.id]=d}d.init(a,t)}),xt(o,(s,a)=>{s||delete r[a]}),xt(r,s=>{Vn.configure(this,s,s.options),Vn.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(dR("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||hx(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=un.getController(a),{datasetElementType:c,dataElementType:u}=Bt.datasets[a];Object.assign(l,{dataElementType:un.getElement(u),datasetElementType:c&&un.getElement(c)}),s.controller=new l(this,r),t.push(s.controller)}}return this._updateMetasets(),t}_resetElements(){xt(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||xt(i,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(dR("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){xt(this.scales,t=>{Vn.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(t.events);(!_2(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;jY(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(!_2(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;Vn.update(this,this.width,this.height,t);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],xt(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,vs(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&&(gi.has(this)?this.attached&&!gi.running(this)&&gi.start(this):(this.draw(),fR({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=zY(t,this.chartArea),s={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(o&&Pa(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&&Da(n),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return Mi(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,r,o){const i=FG.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=As(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);Id(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(),gi.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(),T2(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete Tp[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)};xt(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(){xt(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},xt(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}});!og(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=Gq(t),c=$Y(t,this._lastEvent,r,l);r&&(this._lastEvent=null,Rt(i.onHover,[t,a,this],this),l&&Rt(i.onClick,[t,a,this],this));const u=!og(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)}}ge(Mt,"defaults",Bt),ge(Mt,"instances",Tp),ge(Mt,"overrides",Ua),ge(Mt,"registry",un),ge(Mt,"version",NY),ge(Mt,"getChart",hR);function pR(){return xt(Mt.instances,e=>e._plugins.invalidate())}function BY(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+tn,r-tn),e.closePath(),e.clip()}function VY(e){return hS(e,["outerStart","outerEnd","innerStart","innerEnd"])}function HY(e,t,n,r){const o=VY(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 _n(l,0,Math.min(i,c))};return{outerStart:a(o.outerStart),outerEnd:a(o.outerEnd),innerStart:_n(o.innerStart,0,s),innerEnd:_n(o.innerEnd,0,s)}}function Cl(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function dg(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/Vt)/d,m=(p-g)/2,y=l+m+f,x=o-m-f,{outerStart:v,outerEnd:_,innerStart:C,innerEnd:w}=HY(t,h,d,x-y),S=d-v,k=d-_,M=y+v/S,D=x-_/k,A=h+C,I=h+w,$=y+C/A,j=x-w/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),_>0){const B=Cl(k,D,s,a);e.arc(B.x,B.y,_,D,x+tn)}const N=Cl(I,x,s,a);if(e.lineTo(N.x,N.y),w>0){const B=Cl(I,j,s,a);e.arc(B.x,B.y,w,x+tn,j+Math.PI)}const F=(x-w/h+(y+C/h))/2;if(e.arc(s,a,h,x-w/h,F,!0),e.arc(s,a,h,F,y+C/h,!0),C>0){const B=Cl(A,$,s,a);e.arc(B.x,B.y,C,$+Math.PI,y-tn)}const z=Cl(S,y,s,a);if(e.lineTo(z.x,z.y),v>0){const B=Cl(S,M,s,a);e.arc(B.x,B.y,v,y-tn,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 WY(e,t,n,r,o){const{fullCircles:i,startAngle:s,circumference:a}=t;let l=t.endAngle;if(i){dg(e,t,n,r,l,o);for(let c=0;c<i;++c)e.fill();isNaN(a)||(l=s+(a%zt||zt))}return dg(e,t,n,r,l,o),e.fill(),l}function qY(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){dg(e,t,n,r,p,o);for(let g=0;g<i;++g)e.stroke();isNaN(a)||(p=s+(a%zt||zt))}f&&BY(e,t,p),i||(dg(e,t,n,r,p,o),e.stroke())}class $l extends oi{constructor(n){super();ge(this,"circumference");ge(this,"endAngle");ge(this,"fullCircles");ge(this,"innerRadius");ge(this,"outerRadius");ge(this,"pixelMargin");ge(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}=hT(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=Nd(s,l,c)&&l!==c,m=p>=zt||g,y=Pi(a,u+f,d+f);return m&&y}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>zt?Math.floor(o/zt):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(Vt,o||0)),u=i*c;n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,WY(n,this,u,s,a),qY(n,this,u,s,a),n.restore()}}ge($l,"id","arc"),ge($l,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),ge($l,"defaultRoutes",{backgroundColor:"backgroundColor"}),ge($l,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function UT(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 UY(e,t,n){e.lineTo(n.x,n.y)}function GY(e){return e.stepped?mU:e.tension||e.cubicInterpolationMode==="monotone"?bU:UY}function GT(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 YY(e,t,n,r){const{points:o,options:i}=t,{count:s,start:a,loop:l,ilen:c}=GT(o,n,r),u=GY(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 KY(e,t,n,r){const o=t.points,{count:i,start:s,ilen:a}=GT(o,n,r),{move:l=!0,reverse:c}=r||{};let u=0,d=0,h,f,p,g,m,y;const x=_=>(s+(c?a-_:_))%i,v=()=>{g!==m&&(e.lineTo(u,m),e.lineTo(u,g),e.lineTo(u,y))};for(l&&(f=o[x(0)],e.moveTo(f.x,f.y)),h=0;h<=a;++h){if(f=o[x(h)],f.skip)continue;const _=f.x,C=f.y,w=_|0;w===p?(C<g?g=C:C>m&&(m=C),u=(d*u+_)/++d):(v(),e.lineTo(_,C),p=w,d=0,g=m=C),y=C}v()}function gx(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?KY:YY}function XY(e){return e.stepped?KU:e.tension||e.cubicInterpolationMode==="monotone"?XU:ta}function QY(e,t,n,r){let o=t._path;o||(o=t._path=new Path2D,t.path(o,n,r)&&o.closePath()),UT(e,t.options),e.stroke(o)}function ZY(e,t,n,r){const{segments:o,options:i}=t,s=gx(t);for(const a of o)UT(e,i,a.style),e.beginPath(),s(e,t,a,{start:n,end:n+r-1})&&e.closePath(),e.stroke()}const JY=typeof Path2D=="function";function eK(e,t,n,r){JY&&!t.options.segment?QY(e,t,n,r):ZY(e,t,n,r)}class us extends oi{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;BU(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=nG(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=TT(this,{property:n,start:o,end:o});if(!s.length)return;const a=[],l=XY(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 gx(this)(t,this,n,r)}path(t,n,r){const o=this.segments,i=gx(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(),eK(t,this,r,o),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}ge(us,"id","line"),ge(us,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),ge(us,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),ge(us,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function gR(e,t,n,r){const o=e.options,{[n]:i}=e.getProps([n],r);return Math.abs(t-i)<o.radius+o.hitRadius}class Ta extends oi{constructor(n){super();ge(this,"parsed");ge(this,"skip");ge(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 gR(this,n,"x",r)}inYRange(n,r){return gR(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,lg(n,o,this.x,this.y))}getRange(){const n=this.options||{};return n.radius+n.hitRadius}}ge(Ta,"id","point"),ge(Ta,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),ge(Ta,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function YT(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 ds(e,t,n,r){return e?0:_n(t,n,r)}function tK(e,t,n){const r=e.options.borderWidth,o=e.borderSkipped,i=ST(r);return{t:ds(o.top,i.top,0,n),r:ds(o.right,i.right,0,t),b:ds(o.bottom,i.bottom,0,n),l:ds(o.left,i.left,0,t)}}function nK(e,t,n){const{enableBorderRadius:r}=e.getProps(["enableBorderRadius"]),o=e.options.borderRadius,i=Ma(o),s=Math.min(t,n),a=e.borderSkipped,l=r||tt(o);return{topLeft:ds(!l||a.top||a.left,i.topLeft,0,s),topRight:ds(!l||a.top||a.right,i.topRight,0,s),bottomLeft:ds(!l||a.bottom||a.left,i.bottomLeft,0,s),bottomRight:ds(!l||a.bottom||a.right,i.bottomRight,0,s)}}function rK(e){const t=YT(e),n=t.right-t.left,r=t.bottom-t.top,o=tK(e,n/2,r/2),i=nK(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 W0(e,t,n,r){const o=t===null,i=n===null,a=e&&!(o&&i)&&YT(e,r);return a&&(o||Pi(t,a.left,a.right))&&(i||Pi(n,a.top,a.bottom))}function oK(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function iK(e,t){e.rect(t.x,t.y,t.w,t.h)}function q0(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 Bo extends oi{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}=rK(this),a=oK(s.radius)?Fd:iK;t.save(),(s.w!==i.w||s.h!==i.h)&&(t.beginPath(),a(t,q0(s,n,i)),t.clip(),a(t,q0(i,-n,s)),t.fillStyle=r,t.fill("evenodd")),t.beginPath(),a(t,q0(i,n)),t.fillStyle=o,t.fill(),t.restore()}inRange(t,n,r){return W0(this,t,n,r)}inXRange(t,n){return W0(this,t,null,n)}inYRange(t,n){return W0(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}}ge(Bo,"id","bar"),ge(Bo,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),ge(Bo,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});var sK=Object.freeze({__proto__:null,ArcElement:$l,BarElement:Bo,LineElement:us,PointElement:Ta});const mx=["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)"],mR=mx.map(e=>e.replace("rgb(","rgba(").replace(")",", 0.5)"));function KT(e){return mx[e%mx.length]}function XT(e){return mR[e%mR.length]}function aK(e,t){return e.borderColor=KT(t),e.backgroundColor=XT(t),++t}function lK(e,t){return e.backgroundColor=e.data.map(()=>KT(t++)),t}function cK(e,t){return e.backgroundColor=e.data.map(()=>XT(t++)),t}function uK(e){let t=0;return(n,r)=>{const o=e.getDatasetMeta(r).controller;o instanceof fa?t=lK(n,t):o instanceof ad?t=cK(n,t):o&&(t=aK(n,t))}}function bR(e){let t;for(t in e)if(e[t].borderColor||e[t].backgroundColor)return!0;return!1}function dK(e){return e&&(e.borderColor||e.backgroundColor)}function fK(){return Bt.borderColor!=="rgba(0,0,0,0.1)"||Bt.backgroundColor!=="rgba(0,0,0,0.1)"}var hK={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=bR(r)||dK(o)||i&&bR(i)||fK();if(!n.forceOverride&&s)return;const a=uK(e);r.forEach(a)}};function pK(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,y=0,x;const v=Math.floor((d+1)*a)+1+t,_=Math.min(Math.floor((d+2)*a)+1,n)+t,C=_-v;for(x=v;x<_;x++)m+=e[x].x,y+=e[x].y;m/=C,y/=C;const w=Math.floor(d*a)+1+t,S=Math.min(Math.floor((d+1)*a)+1,n)+t,{x:k,y:M}=e[u];for(f=p=-1,x=w;x<S;x++)p=.5*Math.abs((k-m)*(e[x].y-M)-(k-e[x].x)*(y-M)),p>f&&(f=p,h=e[x],g=x);s[l++]=h,u=g}return s[l++]=e[c],s}function gK(e,t,n,r){let o=0,i=0,s,a,l,c,u,d,h,f,p,g;const m=[],y=t+n-1,x=e[t].x,_=e[y].x-x;for(s=t;s<t+n;++s){a=e[s],l=(a.x-x)/_*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 w=s-1;if(!Be(d)&&!Be(h)){const S=Math.min(d,h),k=Math.max(d,h);S!==f&&S!==w&&m.push({...e[S],x:o}),k!==f&&k!==w&&m.push({...e[k],x:o})}s>0&&w!==f&&m.push(e[w]),m.push(a),u=C,i=0,p=g=c,d=h=f=s}}return m}function QT(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 yR(e){e.data.datasets.forEach(t=>{QT(t)})}function mK(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=_n(Di(t,i.axis,s).lo,0,n-1)),c?o=_n(Di(t,i.axis,a).hi+1,r,n)-r:o=n-r,{start:r,count:o}}var bK={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(e,t,n)=>{if(!n.enabled){yR(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(Lt([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}=mK(l,c);const f=n.threshold||4*r;if(h<=f){QT(o);return}Be(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=pK(c,d,h,r,n);break;case"min-max":p=gK(c,d,h,r);break;default:throw new Error(`Unsupported decimation algorithm '${n.algorithm}'`)}o._decimated=p})},destroy(e){yR(e)}};function yK(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=xS(l,c,o);const u=bx(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=TT(t,u);for(const h of d){const f=bx(n,i[h.start],i[h.end],h.loop),p=AT(a,o,f);for(const g of p)s.push({source:g,target:h,start:{[n]:vR(u,f,"start",Math.max)},end:{[n]:vR(u,f,"end",Math.min)}})}}return s}function bx(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 vK(e,t){const{x:n=null,y:r=null}=e||{},o=t.points,i=[];return t.segments.forEach(({start:s,end:a})=>{a=xS(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 xS(e,t,n){for(;t>e;t--){const r=n[t];if(!isNaN(r.x)&&!isNaN(r.y))break}return t}function vR(e,t,n,r){return e&&t?r(e[n],t[n]):e?e[n]:t?t[n]:0}function ZT(e,t){let n=[],r=!1;return $t(e)?(r=!0,n=e):n=vK(e,t),n.length?new us({points:n,options:{tension:0},_loop:r,_fullLoop:r}):null}function xR(e){return e&&e.fill!==!1}function xK(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(!Zt(o))return o;if(s=e[o],!s)return!1;if(s.visible)return o;i.push(o),o=s.fill}return!1}function wK(e,t,n){const r=EK(e);if(tt(r))return isNaN(r.value)?!1:r;let o=parseFloat(r);return Zt(o)&&Math.floor(o)===o?SK(r[0],t,o,n):["origin","start","end","stack","shape"].indexOf(r)>=0&&r}function SK(e,t,n,r){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=r?!1:n}function CK(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 _K(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 EK(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 RK(e){const{scale:t,index:n,line:r}=e,o=[],i=r.segments,s=r.points,a=kK(t,n);a.push(ZT({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++)PK(o,s[u],a)}return new us({points:o,options:{}})}function kK(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 PK(e,t,n){const r=[];for(let o=0;o<n.length;o++){const i=n[o],{first:s,last:a,point:l}=DK(i,t,"x");if(!(!l||s&&a)){if(s)r.unshift(l);else if(e.push(l),!a)break}}e.push(...r)}function DK(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(Pi(o,d,h)){a=o===d,l=o===h;break}}return{first:a,last:l,point:r}}class JT{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:zt},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 MK(e){const{chart:t,fill:n,line:r}=e;if(Zt(n))return OK(t,n);if(n==="stack")return RK(e);if(n==="shape")return!0;const o=AK(e);return o instanceof JT?o:ZT(o,r)}function OK(e,t){const n=e.getDatasetMeta(t);return n&&e.isDatasetVisible(t)?n.dataset:null}function AK(e){return(e.scale||{}).getPointPositionForValue?IK(e):TK(e)}function TK(e){const{scale:t={},fill:n}=e,r=CK(n,t);if(Zt(r)){const o=t.isHorizontal();return{x:o?r:null,y:o?null:r}}return null}function IK(e){const{scale:t,fill:n}=e,r=t.options,o=t.getLabels().length,i=r.reverse?t.max:t.min,s=_K(n,t,i),a=[];if(r.grid.circular){const l=t.getPointPositionForValue(0,i);return new JT({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=MK(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&&(Pa(e,n),NK(e,{line:o,target:r,above:u,below:d,area:n,scale:i,axis:s}),Da(e))}function NK(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&&(wR(e,r,s.top),SR(e,{line:n,target:r,color:o,scale:a,property:l}),e.restore(),e.save(),wR(e,r,s.bottom)),SR(e,{line:n,target:r,color:i,scale:a,property:l}),e.restore()}function wR(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[xS(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 SR(e,t){const{line:n,target:r,property:o,color:i,scale:s}=t,a=yK(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,FK(e,s,f&&bx(o,u,d)),e.beginPath();const p=!!n.pathSegment(e,l);let g;if(f){p?e.closePath():CR(e,r,d,o);const m=!!r.pathSegment(e,c,{move:p,reverse:!0});g=p&&m,g||CR(e,r,u,o)}e.closePath(),e.fill(g?"evenodd":"nonzero"),e.restore()}}function FK(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 CR(e,t,n,r){const o=t.interpolate(n,r);o&&e.lineTo(o.x,o.y)}var LK={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 us&&(l={visible:e.isDatasetVisible(s),index:s,fill:wK(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=xK(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;xR(i)&&U0(e.ctx,i,e.chartArea)}},beforeDatasetDraw(e,t,n){const r=t.meta.$filler;!xR(r)||n.drawTime!=="beforeDatasetDraw"||U0(e.ctx,r,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const _R=(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)}},jK=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class ER extends oi{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=Rt(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=fn(r.font),i=o.size,s=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=_R(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,y)=>{const{itemWidth:x,itemHeight:v}=$K(r,n,i,m,o);y>0&&f+v+2*a>u&&(d+=h+a,c.push({width:h,height:f}),p+=h+a,g++,h=f=0),l[y]={left:p,top:f,col:g,width:x,height:v},h=Math.max(h,x),f+=v+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=Ql(i,this.left,this.width);if(this.isHorizontal()){let a=0,l=zn(r,this.left+o,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=zn(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=zn(r,this.top+t+o,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=zn(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;Pa(t,this),this._draw(),Da(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:r,ctx:o}=this,{align:i,labels:s}=t,a=Bt.color,l=Ql(t.rtl,this.left,this.width),c=fn(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}=_R(s,d),y=function(w,S,k){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;o.save();const M=Ae(k.lineWidth,1);if(o.fillStyle=Ae(k.fillStyle,a),o.lineCap=Ae(k.lineCap,"butt"),o.lineDashOffset=Ae(k.lineDashOffset,0),o.lineJoin=Ae(k.lineJoin,"miter"),o.lineWidth=M,o.strokeStyle=Ae(k.strokeStyle,a),o.setLineDash(Ae(k.lineDash,[])),s.usePointStyle){const D={radius:g*Math.SQRT2/2,pointStyle:k.pointStyle,rotation:k.rotation,borderWidth:M},A=l.xPlus(w,p/2),I=S+h;wT(o,D,A,I,s.pointStyleWidth&&p)}else{const D=S+Math.max((d-g)/2,0),A=l.leftForLtr(w,p),I=Ma(k.borderRadius);o.beginPath(),Object.values(I).some($=>$!==0)?Fd(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()},x=function(w,S,k){Ga(o,k.text,w,S+m/2,c,{strikethrough:k.hidden,textAlign:l.textAlign(k.textAlign)})},v=this.isHorizontal(),_=this._computeTitleHeight();v?f={x:zn(i,this.left+u,this.right-r[0]),y:this.top+u+_,line:0}:f={x:this.left+u,y:zn(i,this.top+_+u,this.bottom-n[0].height),line:0},DT(this.ctx,t.textDirection);const C=m+u;this.legendItems.forEach((w,S)=>{o.strokeStyle=w.fontColor,o.fillStyle=w.fontColor;const k=o.measureText(w.text).width,M=l.textAlign(w.textAlign||(w.textAlign=s.textAlign)),D=p+h+k;let A=f.x,I=f.y;l.setWidth(this.width),v?S>0&&A+D+u>this.right&&(I=f.y+=C,f.line++,A=f.x=zn(i,this.left+u,this.right-r[f.line])):S>0&&I+C>this.bottom&&(A=f.x=A+n[f.line].width+u,f.line++,I=f.y=zn(i,this.top+_+u,this.bottom-n[f.line].height));const $=l.x(A);if(y($,I,w),A=iU(M,A+p+h,v?A+D:this.right,t.rtl),x(l.x(A),I,w),v)f.x+=D+u;else if(typeof w.text!="string"){const j=c.lineHeight;f.y+=eI(w,j)+u}else f.y+=C}),MT(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,r=fn(n.font),o=Tn(n.padding);if(!n.display)return;const i=Ql(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=zn(t.align,d,this.right-h);else{const p=this.columnSizes.reduce((g,m)=>Math.max(g,m.height),0);u=c+zn(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const f=zn(a,d,d+h);s.textAlign=i.textAlign(dS(a)),s.textBaseline="middle",s.strokeStyle=n.color,s.fillStyle=n.color,s.font=r.string,Ga(s,n.text,f,u,r)}_computeTitleHeight(){const t=this.options.title,n=fn(t.font),r=Tn(t.padding);return t.display?n.lineHeight+r.height:0}_getLegendItemAt(t,n){let r,o,i;if(Pi(t,this.left,this.right)&&Pi(n,this.top,this.bottom)){for(i=this.legendHitBoxes,r=0;r<i.length;++r)if(o=i[r],Pi(t,o.left,o.left+o.width)&&Pi(n,o.top,o.top+o.height))return this.legendItems[r]}return null}handleEvent(t){const n=this.options;if(!VK(t.type,n))return;const r=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const o=this._hoveredItem,i=jK(o,r);o&&!i&&Rt(n.onLeave,[t,o,this],this),this._hoveredItem=r,r&&!i&&Rt(n.onHover,[t,r,this],this)}else r&&Rt(n.onClick,[t,r,this],this)}}function $K(e,t,n,r,o){const i=zK(r,e,t,n),s=BK(o,r,t.lineHeight);return{itemWidth:i,itemHeight:s}}function zK(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 BK(e,t,n){let r=e;return typeof t.text!="string"&&(r=eI(t,n)),r}function eI(e,t){const n=e.text?e.text.length:0;return t*n}function VK(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var HK={id:"legend",_element:ER,start(e,t,n){const r=e.legend=new ER({ctx:e.ctx,options:n,chart:e});Vn.configure(e,r,n),Vn.addBox(e,r)},stop(e){Vn.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const r=e.legend;Vn.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=Tn(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 wS=class extends oi{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=$t(r.text)?r.text.length:1;this._padding=Tn(r.padding);const i=o*fn(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=zn(a,r,i),d=n+t,c=i-r):(s.position==="left"?(u=r+t,d=zn(a,o,n),l=Vt*-.5):(u=i-t,d=zn(a,n,o),l=Vt*.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=fn(n.font),i=r.lineHeight/2+this._padding.top,{titleX:s,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(i);Ga(t,n.text,0,0,r,{color:n.color,maxWidth:l,rotation:c,textAlign:dS(n.align),textBaseline:"middle",translation:[s,a]})}};function WK(e,t){const n=new wS({ctx:e.ctx,options:t,chart:e});Vn.configure(e,n,t),Vn.addBox(e,n),e.titleBlock=n}var qK={id:"title",_element:wS,start(e,t,n){WK(e,n)},stop(e){const t=e.titleBlock;Vn.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const r=e.titleBlock;Vn.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 Fh=new WeakMap;var UK={id:"subtitle",start(e,t,n){const r=new wS({ctx:e.ctx,options:n,chart:e});Vn.configure(e,r,n),Vn.addBox(e,r),Fh.set(e,r)},stop(e){Vn.removeBox(e,Fh.get(e)),Fh.delete(e)},beforeUpdate(e,t,n){const r=Fh.get(e);Vn.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 Uu={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=ux(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 Eo(e,t){return t&&($t(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function mi(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
|
|
244
244
|
`)>-1?e.split(`
|
|
245
|
-
`):e}function GK(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 RR(e,t){const n=e.chart.ctx,{body:r,footer:o,title:i}=e,{boxWidth:s,boxHeight:a}=t,l=fn(t.bodyFont),c=fn(t.titleFont),u=fn(t.footerFont),d=i.length,h=o.length,f=r.length,p=Tn(t.padding);let g=p.height,m=0,y=r.reduce((_,C)=>_+C.before.length+C.lines.length+C.after.length,0);if(y+=e.beforeBody.length+e.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),y){const _=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;g+=f*_+(y-f)*l.lineHeight+(y-1)*t.bodySpacing}h&&(g+=t.footerMarginTop+h*u.lineHeight+(h-1)*t.footerSpacing);let x=0;const v=function(_){m=Math.max(m,n.measureText(_).width+x)};return n.save(),n.font=c.string,xt(e.title,v),n.font=l.string,xt(e.beforeBody.concat(e.afterBody),v),x=t.displayColors?s+2+t.boxPadding:0,xt(r,_=>{xt(_.before,v),xt(_.lines,v),xt(_.after,v)}),x=0,n.font=u.string,xt(e.footer,v),n.restore(),m+=p.width,{width:m,height:g}}function YK(e,t){const{y:n,height:r}=t;return n<r/2?"top":n>e.height-r/2?"bottom":"center"}function KK(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 XK(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"),KK(c,e,t,n)&&(c="center"),c}function kR(e,t,n){const r=n.yAlign||t.yAlign||YK(e,n);return{xAlign:n.xAlign||t.xAlign||XK(e,t,n,r),yAlign:r}}function QK(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function ZK(e,t,n){let{y:r,height:o}=e;return t==="top"?r+=n:t==="bottom"?r-=o+n:r-=o/2,r}function PR(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}=Ma(s);let p=QK(t,a);const g=ZK(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:_n(p,0,r.width-t.width),y:_n(g,0,r.height-t.height)}}function Lh(e,t,n){const r=Tn(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function DR(e){return Eo([],mi(e))}function JK(e,t,n){return As(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function MR(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const tI={beforeTitle:ui,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:ui,beforeBody:ui,beforeLabel:ui,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 Be(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:ui,afterBody:ui,beforeFooter:ui,footer:ui,afterFooter:ui};function ar(e,t,n,r){const o=e[t].call(n,r);return typeof o>"u"?tI[t].call(n,r):o}var xv;let OR=(xv=class extends oi{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 IT(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=JK(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=Eo(a,mi(o)),a=Eo(a,mi(i)),a=Eo(a,mi(s)),a}getBeforeBody(t,n){return DR(ar(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,o=[];return xt(t,i=>{const s={before:[],lines:[],after:[]},a=MR(r,i);Eo(s.before,mi(ar(a,"beforeLabel",this,i))),Eo(s.lines,ar(a,"label",this,i)),Eo(s.after,mi(ar(a,"afterLabel",this,i))),o.push(s)}),o}getAfterBody(t,n){return DR(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=Eo(a,mi(o)),a=Eo(a,mi(i)),a=Eo(a,mi(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(GK(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))),xt(a,u=>{const d=MR(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=Uu[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=RR(this,r),c=Object.assign({},a,l),u=kR(this.chart,r,c),d=PR(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}=Ma(a),{x:h,y:f}=t,{width:p,height:g}=n;let m,y,x,v,_,C;return i==="center"?(_=f+g/2,o==="left"?(m=h,y=m-s,v=_+s,C=_-s):(m=h+p,y=m+s,v=_-s,C=_+s),x=m):(o==="left"?y=h+Math.max(l,u)+s:o==="right"?y=h+p-Math.max(c,d)-s:y=this.caretX,i==="top"?(v=f,_=v-s,m=y-s,x=y+s):(v=f+g,_=v+s,m=y+s,x=y-s),C=v),{x1:m,x2:y,x3:x,y1:v,y2:_,y3:C}}drawTitle(t,n,r){const o=this.title,i=o.length;let s,a,l;if(i){const c=Ql(r.rtl,this.x,this.width);for(t.x=Lh(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",s=fn(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=fn(i.bodyFont),d=Lh(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,y=p+l/2;t.strokeStyle=i.multiKeyBackground,t.fillStyle=i.multiKeyBackground,lg(t,g,m,y),t.strokeStyle=s.borderColor,t.fillStyle=s.backgroundColor,lg(t,g,m,y)}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),y=Ma(s.borderRadius);Object.values(y).some(x=>x!==0)?(t.beginPath(),t.fillStyle=i.multiKeyBackground,Fd(t,{x:g,y:p,w:c,h:l,radius:y}),t.fill(),t.stroke(),t.fillStyle=s.backgroundColor,t.beginPath(),Fd(t,{x:m,y:p+1,w:c-2,h:l-2,radius:y}),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=fn(r.bodyFont);let h=d.lineHeight,f=0;const p=Ql(r.rtl,this.x,this.width),g=function(k){n.fillText(k,p.x(t.x+f),t.y+h/2),t.y+=h+i},m=p.textAlign(s);let y,x,v,_,C,w,S;for(n.textAlign=s,n.textBaseline="middle",n.font=d.string,t.x=Lh(this,m,r),n.fillStyle=r.bodyColor,xt(this.beforeBody,g),f=a&&m!=="right"?s==="center"?c/2+u:c+2+u:0,_=0,w=o.length;_<w;++_){for(y=o[_],x=this.labelTextColors[_],n.fillStyle=x,xt(y.before,g),v=y.lines,a&&v.length&&(this._drawColorBox(n,t,_,p,r),h=Math.max(d.lineHeight,l)),C=0,S=v.length;C<S;++C)g(v[C]),h=d.lineHeight;xt(y.after,g)}f=0,h=d.lineHeight,xt(this.afterBody,g),t.y-=i}drawFooter(t,n,r){const o=this.footer,i=o.length;let s,a;if(i){const l=Ql(r.rtl,this.x,this.width);for(t.x=Lh(this,r.footerAlign,r),t.y+=r.footerMarginTop,n.textAlign=l.textAlign(r.footerAlign),n.textBaseline="middle",s=fn(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}=Ma(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=Uu[t.position].call(this,this._active,this._eventPosition);if(!s)return;const a=this._size=RR(this,t),l=Object.assign({},s,this._size),c=kR(n,t,l),u=PR(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=Tn(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),DT(t,n.textDirection),i.y+=s.top,this.drawTitle(i,t,n),this.drawBody(i,t,n),this.drawFooter(i,t,n),MT(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=!og(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||!og(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=Uu[i.position].call(this,t,n);return s!==!1&&(r!==s.x||o!==s.y)}},ge(xv,"positioners",Uu),xv);var nI={id:"tooltip",_element:OR,positioners:Uu,afterInit(e,t,n){n&&(e.tooltip=new OR({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:tI},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"]},eX=Object.freeze({__proto__:null,Colors:hK,Decimation:bK,Filler:LK,Legend:HK,SubTitle:UK,Title:qK,Tooltip:nI});const tX=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function nX(e,t,n,r){const o=e.indexOf(t);if(o===-1)return tX(e,t,n,r);const i=e.lastIndexOf(t);return o!==i?n:o}const rX=(e,t)=>e===null?null:_n(Math.round(e),0,t);function AR(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class jd extends Ts{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(Be(t))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===t?n:nX(r,t,Ae(n,t),this._addedLabels),rX(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 AR.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}}ge(jd,"id","category"),ge(jd,"defaults",{ticks:{callback:AR}});function oX(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,y=!Be(s),x=!Be(a),v=!Be(c),_=(m-g)/(d+1);let C=R2((m-g)/p/f)*f,w,S,k,M;if(C<1e-14&&!y&&!x)return[{value:g},{value:m}];M=Math.ceil(m/C)-Math.floor(g/C),M>p&&(C=R2(M*C/p/f)*f),Be(l)||(w=Math.pow(10,l),C=Math.ceil(C*w)/w),o==="ticks"?(S=Math.floor(g/C)*C,k=Math.ceil(m/C)*C):(S=g,k=m),y&&x&&i&&Zq((a-s)/i,C/1e3)?(M=Math.round(Math.min((a-s)/C,u)),C=(a-s)/M,S=s,k=a):v?(S=y?s:S,k=x?a:k,M=c-1,C=(k-S)/M):(M=(k-S)/C,od(M,Math.round(M),C/1e3)?M=Math.round(M):M=Math.ceil(M));const D=Math.max(k2(C),k2(S));w=Math.pow(10,Be(l)?D:l),S=Math.round(S*w)/w,k=Math.round(k*w)/w;let A=0;for(y&&(h&&S!==s?(n.push({value:s}),S<s&&A++,od(Math.round((S+A*C)*w)/w,s,TR(s,_,e))&&A++):S<s&&A++);A<M;++A){const I=Math.round((S+A*C)*w)/w;if(x&&I>a)break;n.push({value:I})}return x&&h&&k!==a?n.length&&od(n[n.length-1].value,a,TR(a,_,e))?n[n.length-1].value=a:n.push({value:a}):(!x||k===a)&&n.push({value:k}),n}function TR(e,t,{horizontal:n,minRotation:r}){const o=uo(r),i=(n?Math.sin(o):Math.cos(o))||.001,s=.75*t*(""+e).length;return Math.min(t/i,s)}class fg extends Ts{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 Be(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=zo(o),c=zo(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=oX(o,i);return t.bounds==="ticks"&&fT(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 Df(t,this.chart.options.locale,this.options.ticks.format)}}class Ya extends fg{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Zt(t)?t:0,this.max=Zt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=uo(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}}ge(Ya,"id","linear"),ge(Ya,"defaults",{ticks:{callback:jm.formatters.numeric}});const $d=e=>Math.floor(cs(e)),Xs=(e,t)=>Math.pow(10,$d(e)+t);function IR(e){return e/Math.pow(10,$d(e))===1}function NR(e,t,n){const r=Math.pow(10,n),o=Math.floor(e/r);return Math.ceil(t/r)-o}function iX(e,t){const n=t-e;let r=$d(n);for(;NR(e,t,r)>10;)r++;for(;NR(e,t,r)<10;)r--;return Math.min(r,$d(e))}function sX(e,{min:t,max:n}){t=Pr(e.min,t);const r=[],o=$d(t);let i=iX(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=Pr(e.min,Math.round((l+u+d*Math.pow(10,i))*s)/s);for(;h<n;)r.push({value:h,major:IR(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=Pr(e.max,h);return r.push({value:f,major:IR(f),significand:d}),r}class Tc extends Ts{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const r=fg.prototype.parse.apply(this,[t,n]);if(r===0){this._zero=!0;return}return Zt(r)&&r>0?r:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Zt(t)?Math.max(0,t):null,this.max=Zt(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Zt(this._userMin)&&(this.min=t===Xs(this.min,0)?Xs(this.min,-1):Xs(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(Xs(r,-1)),s(Xs(o,1)))),r<=0&&i(Xs(o,-1)),o<=0&&s(Xs(r,1)),this.min=r,this.max=o}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},r=sX(n,this);return t.bounds==="ticks"&&fT(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":Df(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=cs(t),this._valueRange=cs(this.max)-cs(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(cs(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}ge(Tc,"id","logarithmic"),ge(Tc,"defaults",{ticks:{callback:jm.formatters.logarithmic,major:{enabled:!0}}});function yx(e){const t=e.ticks;if(t.display&&e.display){const n=Tn(t.backdropPadding);return Ae(t.font&&t.font.size,Bt.font.size)+n.height}return 0}function aX(e,t,n){return n=$t(n)?n:[n],{w:gU(e,t.string,n),h:n.length*t.lineHeight}}function FR(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 lX(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?Vt/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=fn(c.font),h=aX(e.ctx,d,e._pointLabels[l]);r[l]=h;const f=Mr(e.getIndexAngle(l)+a),p=Math.round(cS(f)),g=FR(p,u.x,h.w,0,180),m=FR(p,u.y,h.h,90,270);cX(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=fX(e,r,o)}function cX(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 uX(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(cS(Mr(l.angle+tn))),u=gX(l.y,a.h,c),d=hX(c),h=pX(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 dX(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 fX(e,t,n){const r=[],o=e._pointLabels.length,i=e.options,{centerPointLabels:s,display:a}=i.pointLabels,l={extra:yx(i)/2,additionalAngle:s?Vt/o:0};let c;for(let u=0;u<o;u++){l.padding=n[u],l.size=t[u];const d=uX(e,u,l);r.push(d),a==="auto"&&(d.visible=dX(d,c),d.visible&&(c=d))}return r}function hX(e){return e===0||e===180?"center":e<180?"left":"right"}function pX(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function gX(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function mX(e,t,n){const{left:r,top:o,right:i,bottom:s}=n,{backdropColor:a}=t;if(!Be(a)){const l=Ma(t.borderRadius),c=Tn(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(),Fd(e,{x:u,y:d,w:h,h:f,radius:l}),e.fill()):e.fillRect(u,d,h,f)}}function bX(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));mX(n,s,i);const a=fn(s.font),{x:l,y:c,textAlign:u}=i;Ga(n,e._pointLabels[o],l,c+a.lineHeight/2,a,{color:s.color,textAlign:u,textBaseline:"middle"})}}function rI(e,t,n,r){const{ctx:o}=e;if(n)o.arc(e.xCenter,e.yCenter,t,0,zt);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 yX(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(),rI(e,n,s,r),i.closePath(),i.stroke(),i.restore())}function vX(e,t,n){return As(e,{label:n,index:t,type:"pointLabel"})}class Gu extends fg{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=Tn(yx(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=Zt(t)&&!isNaN(t)?t:0,this.max=Zt(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/yx(this.options))}generateTickLabels(t){fg.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,r)=>{const o=Rt(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?lX(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=zt/(this._pointLabels.length||1),r=this.options.startAngle||0;return Mr(t*n+uo(r))}getDistanceFromCenterForValue(t){if(Be(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(Be(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 vX(this.getContext(),t,r)}}getPointPosition(t,n,r=0){const o=this.getIndexAngle(t)-tn+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(),rI(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&&bX(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);yX(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=fn(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=Tn(c.backdropPadding);t.fillRect(-s/2-d.left,-i-u.size/2-d.top,s+d.width,u.size+d.height)}Ga(t,a.label,0,-i,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}ge(Gu,"id","radialLinear"),ge(Gu,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:jm.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),ge(Gu,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),ge(Gu,"descriptors",{angleLines:{_fallback:"grid"}});const Bm={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(Bm);function LR(e,t){return e-t}function jR(e,t){if(Be(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)),Zt(s)||(s=typeof r=="string"?n.parse(s,r):n.parse(s)),s===null?null:(o&&(s=o==="week"&&(Mc(i)||i===!0)?n.startOf(s,"isoWeek",i):n.startOf(s,o)),+s)}function $R(e,t,n,r){const o=gr.length;for(let i=gr.indexOf(e);i<o-1;++i){const s=Bm[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 xX(e,t,n,r,o){for(let i=gr.length-1;i>=gr.indexOf(n);i--){const s=gr[i];if(Bm[s].common&&e._adapter.diff(o,r,s)>=t-1)return s}return gr[n?gr.indexOf(n):0]}function wX(e){for(let t=gr.indexOf(e)+1,n=gr.length;t<n;++t)if(Bm[gr[t]].common)return gr[t]}function zR(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:r,hi:o}=uS(n,t),i=n[r]>=t?n[r]:n[o];e[i]=!0}}function SX(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 BR(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:SX(e,r,o,n)}class zd extends Ts{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 OG._date(t.adapters.date);o.init(n),rd(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:jR(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=Zt(o)&&!isNaN(o)?o:+n.startOf(Date.now(),r),i=Zt(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=nU(o,i,s);return this._unit=n.unit||(r.autoSkip?$R(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):xX(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:wX(this._unit),this.initOffsets(o),t.reverse&&a.reverse(),BR(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=_n(n,0,s),r=_n(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||$R(i.minUnit,n,r,this._getLabelCapacity(n)),a=Ae(o.ticks.stepSize,1),l=s==="week"?i.isoWeekday:!1,c=Mc(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++)zR(u,h,p);return(h===r||o.bounds==="ticks"||f===1)&&zR(u,h,p),Object.keys(u).sort(LR).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 Rt(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=uo(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,BR(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(jR(this,o[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return gT(t.sort(LR))}}ge(zd,"id","time"),ge(zd,"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 jh(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}=Di(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}=Di(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 vx extends zd{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=jh(n,this.min),this._tableRange=jh(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(jh(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return jh(this._table,r*this._tableRange+this._minPos,!0)}}ge(vx,"id","timeseries"),ge(vx,"defaults",zd.defaults);var CX=Object.freeze({__proto__:null,CategoryScale:jd,LinearScale:Ya,LogarithmicScale:Tc,RadialLinearScale:Gu,TimeScale:zd,TimeSeriesScale:vx});const _X=[MG,sK,eX,CX];class xs{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*EX(e){for(const t of e)yield*t}function oI(e){return Array.from(EX(e))}function zl(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,iI=1e-12,Qe=Math.PI,Qt=Qe/2,VR=Qe/4,Lr=Qe*2,Zn=180/Qe,kt=Qe/180,at=Math.abs,Qc=Math.atan,Yo=Math.atan2,ze=Math.cos,$h=Math.ceil,sI=Math.exp,hg=Math.log,G0=Math.pow,Ie=Math.sin,Yr=Math.sign||function(e){return e>0?1:e<0?-1:0},nr=Math.sqrt,SS=Math.tan;function aI(e){return e>1?0:e<-1?Qe:Math.acos(e)}function Zr(e){return e>1?Qt:e<-1?-Qt:Math.asin(e)}function Cn(){}function pg(e,t){e&&WR.hasOwnProperty(e.type)&&WR[e.type](e,t)}var HR={Feature:function(e,t){pg(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,o=n.length;++r<o;)pg(n[r].geometry,t)}},WR={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){xx(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)xx(n[r],t,0)},Polygon:function(e,t){qR(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)qR(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,o=n.length;++r<o;)pg(n[r],t)}};function xx(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 qR(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)xx(e[n],t,1);t.polygonEnd()}function oa(e,t){e&&HR.hasOwnProperty(e.type)?HR[e.type](e,t):pg(e,t)}function wx(e){return[Yo(e[1],e[0]),Zr(e[2])]}function Ic(e){var t=e[0],n=e[1],r=ze(n);return[r*ze(t),r*Ie(t),Ie(n)]}function zh(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function gg(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 Y0(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Bh(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Sx(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 Cx(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 _x(e,t){return at(e)>Qe&&(e-=Math.round(e/Lr)*Lr),[e,t]}_x.invert=_x;function lI(e,t,n){return(e%=Lr)?t||n?Cx(GR(e),YR(t,n)):GR(e):t||n?YR(t,n):_x}function UR(e){return function(t,n){return t+=e,at(t)>Qe&&(t-=Math.round(t/Lr)*Lr),[t,n]}}function GR(e){var t=UR(e);return t.invert=UR(-e),t}function YR(e,t){var n=ze(e),r=Ie(e),o=ze(t),i=Ie(t);function s(a,l){var c=ze(l),u=ze(a)*c,d=Ie(a)*c,h=Ie(l),f=h*n+u*r;return[Yo(d*o-f*i,u*n-h*r),Zr(f*o+d*i)]}return s.invert=function(a,l){var c=ze(l),u=ze(a)*c,d=Ie(a)*c,h=Ie(l),f=h*o-d*i;return[Yo(d*o+h*i,u*n+f*r),Zr(f*n-u*r)]},s}function RX(e){e=lI(e[0]*kt,e[1]*kt,e.length>2?e[2]*kt:0);function t(n){return n=e(n[0]*kt,n[1]*kt),n[0]*=Zn,n[1]*=Zn,n}return t.invert=function(n){return n=e.invert(n[0]*kt,n[1]*kt),n[0]*=Zn,n[1]*=Zn,n},t}function kX(e,t,n,r,o,i){if(n){var s=ze(t),a=Ie(t),l=r*n;o==null?(o=t+r*Lr,i=t-l/2):(o=KR(s,o),i=KR(s,i),(r>0?o<i:o>i)&&(o+=r*Lr));for(var c,u=o;r>0?u>i:u<i;u-=l)c=wx([s,-a*ze(u),-a*Ie(u)]),e.point(c[0],c[1])}}function KR(e,t){t=Ic(t),t[0]-=e,Sx(t);var n=aI(-t[1]);return((-t[2]<0?-n:n)+Lr-ke)%Lr}function cI(){var e=[],t;return{point:function(n,r,o){t.push([n,r,o])},lineStart:function(){e.push(t=[])},lineEnd:Cn,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Ip(e,t){return at(e[0]-t[0])<ke&&at(e[1]-t[1])<ke}function Vh(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 uI(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],y=p[g],x;if(Ip(m,y)){if(!m[2]&&!y[2]){for(o.lineStart(),a=0;a<g;++a)o.point((m=p[a])[0],m[1]);o.lineEnd();return}y[0]+=2*ke}i.push(x=new Vh(m,p,null,!0)),s.push(x.o=new Vh(m,null,x,!1)),i.push(x=new Vh(y,p,null,!1)),s.push(x.o=new Vh(y,null,x,!0))}}),!!i.length){for(s.sort(t),XR(i),XR(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 XR(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 K0(e){return at(e[0])<=Qe?e[0]:Yr(e[0])*((at(e[0])+Qe)%Lr-Qe)}function dI(e,t){var n=K0(t),r=t[1],o=Ie(r),i=[Ie(n),-ze(n),0],s=0,a=0,l=new xs;o===1?r=Qt+ke:o===-1&&(r=-Qt-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=K0(f),g=f[1]/2+VR,m=Ie(g),y=ze(g),x=0;x<h;++x,p=_,m=w,y=S,f=v){var v=d[x],_=K0(v),C=v[1]/2+VR,w=Ie(C),S=ze(C),k=_-p,M=k>=0?1:-1,D=M*k,A=D>Qe,I=m*w;if(l.add(Yo(I*M*Ie(D),y*S+I*ze(D))),s+=A?k+M*Lr:k,A^p>=n^_>=n){var $=gg(Ic(f),Ic(v));Sx($);var j=gg(i,$);Sx(j);var T=(A^k>=0?-1:1)*Zr(j[2]);(r>T||r===T&&($[0]||$[1]))&&(a+=A^k>=0?1:-1)}}return(s<-1e-6||s<ke&&l<-1e-12)^a&1}function fI(e,t,n,r){return function(o){var i=t(o),s=cI(),a=t(s),l=!1,c,u,d,h={point:f,lineStart:g,lineEnd:m,polygonStart:function(){h.point=y,h.lineStart=x,h.lineEnd=v,u=[],c=[]},polygonEnd:function(){h.point=f,h.lineStart=g,h.lineEnd=m,u=oI(u);var _=dI(c,r);u.length?(l||(o.polygonStart(),l=!0),uI(u,DX,_,n,o)):_&&(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(_,C){e(_,C)&&o.point(_,C)}function p(_,C){i.point(_,C)}function g(){h.point=p,i.lineStart()}function m(){h.point=f,i.lineEnd()}function y(_,C){d.push([_,C]),a.point(_,C)}function x(){a.lineStart(),d=[]}function v(){y(d[0][0],d[0][1]),a.lineEnd();var _=a.clean(),C=s.result(),w,S=C.length,k,M,D;if(d.pop(),c.push(d),d=null,!!S){if(_&1){if(M=C[0],(k=M.length-1)>0){for(l||(o.polygonStart(),l=!0),o.lineStart(),w=0;w<k;++w)o.point((D=M[w])[0],D[1]);o.lineEnd()}return}S>1&&_&2&&C.push(C.pop().concat(C.shift())),u.push(C.filter(PX))}}return h}}function PX(e){return e.length>1}function DX(e,t){return((e=e.x)[0]<0?e[1]-Qt-ke:Qt-e[1])-((t=t.x)[0]<0?t[1]-Qt-ke:Qt-t[1])}const QR=fI(function(){return!0},MX,AX,[-Qe,-Qt]);function MX(e){var t=NaN,n=NaN,r=NaN,o;return{lineStart:function(){e.lineStart(),o=1},point:function(i,s){var a=i>0?Qe:-Qe,l=at(i-t);at(l-Qe)<ke?(e.point(t,n=(n+s)/2>0?Qt:-Qt),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(i,n),o=0):r!==a&&l>=Qe&&(at(t-r)<ke&&(t-=r*ke),at(i-a)<ke&&(i-=a*ke),n=OX(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 OX(e,t,n,r){var o,i,s=Ie(e-n);return at(s)>ke?Qc((Ie(t)*(i=ze(r))*Ie(n)-Ie(r)*(o=ze(t))*Ie(e))/(o*i*s)):(t+r)/2}function AX(e,t,n,r){var o;if(e==null)o=n*Qt,r.point(-Qe,o),r.point(0,o),r.point(Qe,o),r.point(Qe,0),r.point(Qe,-o),r.point(0,-o),r.point(-Qe,-o),r.point(-Qe,0),r.point(-Qe,o);else if(at(e[0]-t[0])>ke){var i=e[0]<t[0]?Qe:-Qe;o=n*i/2,r.point(-i,o),r.point(0,o),r.point(i,o)}else r.point(t[0],t[1])}function TX(e){var t=ze(e),n=2*kt,r=t>0,o=at(t)>ke;function i(u,d,h,f){kX(f,e,n,h,u,d)}function s(u,d){return ze(u)*ze(d)>t}function a(u){var d,h,f,p,g;return{lineStart:function(){p=f=!1,g=1},point:function(m,y){var x=[m,y],v,_=s(m,y),C=r?_?0:c(m,y):_?c(m+(m<0?Qe:-Qe),y):0;if(!d&&(p=f=_)&&u.lineStart(),_!==f&&(v=l(d,x),(!v||Ip(d,v)||Ip(x,v))&&(x[2]=1)),_!==f)g=0,_?(u.lineStart(),v=l(x,d),u.point(v[0],v[1])):(v=l(d,x),u.point(v[0],v[1],2),u.lineEnd()),d=v;else if(o&&d&&r^_){var w;!(C&h)&&(w=l(x,d,!0))&&(g=0,r?(u.lineStart(),u.point(w[0][0],w[0][1]),u.point(w[1][0],w[1][1]),u.lineEnd()):(u.point(w[1][0],w[1][1]),u.lineEnd(),u.lineStart(),u.point(w[0][0],w[0][1],3)))}_&&(!d||!Ip(d,x))&&u.point(x[0],x[1]),d=x,f=_,h=C},lineEnd:function(){f&&u.lineEnd(),d=null},clean:function(){return g|(p&&f)<<1}}}function l(u,d,h){var f=Ic(u),p=Ic(d),g=[1,0,0],m=gg(f,p),y=zh(m,m),x=m[0],v=y-x*x;if(!v)return!h&&u;var _=t*y/v,C=-t*x/v,w=gg(g,m),S=Bh(g,_),k=Bh(m,C);Y0(S,k);var M=w,D=zh(S,M),A=zh(M,M),I=D*D-A*(zh(S,S)-1);if(!(I<0)){var $=nr(I),j=Bh(M,(-D-$)/A);if(Y0(j,S),j=wx(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,q=at(O-Qe)<ke,L=q||O<ke;if(!q&&z<F&&(B=F,F=z,z=B),L?q?F+z>0^j[1]<(at(j[0]-T)<ke?F:z):F<=j[1]&&j[1]<=z:O>Qe^(T<=j[0]&&j[0]<=N)){var P=Bh(M,(-D+$)/A);return Y0(P,S),[j,wx(P)]}}}function c(u,d){var h=r?e:Qe-e,f=0;return u<-h?f|=1:u>h&&(f|=2),d<-h?f|=4:d>h&&(f|=8),f}return fI(s,a,i,r?[0,-e]:[-Qe,e-Qe])}function IX(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 Hh=1e9,Wh=-1e9;function NX(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=cI(),h,f,p,g,m,y,x,v,_,C,w,S={point:k,lineStart:I,lineEnd:$,polygonStart:D,polygonEnd:A};function k(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,q=z[0],L,P,H=q[0],U=q[1];B<O;++B)L=H,P=U,q=z[B],H=q[0],U=q[1],P<=r?U>r&&(H-L)*(r-P)>(U-P)*(e-L)&&++T:U<=r&&(H-L)*(r-P)<(U-P)*(e-L)&&--T;return T}function D(){u=d,h=[],f=[],w=!0}function A(){var T=M(),N=w&&T,F=(h=oI(h)).length;(N||F)&&(c.polygonStart(),N&&(c.lineStart(),i(null,null,1,c),c.lineEnd()),F&&uI(h,a,T,i,c),c.polygonEnd()),u=c,h=f=p=null}function I(){S.point=j,f&&f.push(p=[]),C=!0,_=!1,x=v=NaN}function $(){h&&(j(g,m),y&&_&&d.rejoin(),h.push(d.result())),S.point=k,_&&u.lineEnd()}function j(T,N){var F=o(T,N);if(f&&p.push([T,N]),C)g=T,m=N,y=F,C=!1,F&&(u.lineStart(),u.point(T,N));else if(F&&_)u.point(T,N);else{var z=[x=Math.max(Wh,Math.min(Hh,x)),v=Math.max(Wh,Math.min(Hh,v))],B=[T=Math.max(Wh,Math.min(Hh,T)),N=Math.max(Wh,Math.min(Hh,N))];IX(z,B,e,t,n,r)?(_||(u.lineStart(),u.point(z[0],z[1])),u.point(B[0],B[1]),F||u.lineEnd(),w=!1):F&&(u.lineStart(),u.point(T,N),w=!1)}x=T,v=N,_=F}return S}}var Ex,Rx,Np,Fp,Nc={sphere:Cn,point:Cn,lineStart:FX,lineEnd:Cn,polygonStart:Cn,polygonEnd:Cn};function FX(){Nc.point=jX,Nc.lineEnd=LX}function LX(){Nc.point=Nc.lineEnd=Cn}function jX(e,t){e*=kt,t*=kt,Rx=e,Np=Ie(t),Fp=ze(t),Nc.point=$X}function $X(e,t){e*=kt,t*=kt;var n=Ie(t),r=ze(t),o=at(e-Rx),i=ze(o),s=Ie(o),a=r*s,l=Fp*n-Np*r*i,c=Np*n+Fp*r*i;Ex.add(Yo(nr(a*a+l*l),c)),Rx=e,Np=n,Fp=r}function zX(e){return Ex=new xs,oa(e,Nc),+Ex}var kx=[null,null],BX={type:"LineString",coordinates:kx};function Px(e,t){return kx[0]=e,kx[1]=t,zX(BX)}var ZR={Feature:function(e,t){return mg(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,o=n.length;++r<o;)if(mg(n[r].geometry,t))return!0;return!1}},JR={Sphere:function(){return!0},Point:function(e,t){return ek(e.coordinates,t)},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)if(ek(n[r],t))return!0;return!1},LineString:function(e,t){return tk(e.coordinates,t)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)if(tk(n[r],t))return!0;return!1},Polygon:function(e,t){return nk(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)if(nk(n[r],t))return!0;return!1},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,o=n.length;++r<o;)if(mg(n[r],t))return!0;return!1}};function mg(e,t){return e&&JR.hasOwnProperty(e.type)?JR[e.type](e,t):!1}function ek(e,t){return Px(e,t)===0}function tk(e,t){for(var n,r,o,i=0,s=e.length;i<s;i++){if(r=Px(e[i],t),r===0||i>0&&(o=Px(e[i],e[i-1]),o>0&&n<=o&&r<=o&&(n+r-o)*(1-Math.pow((n-r)/o,2))<iI*o))return!0;n=r}return!1}function nk(e,t){return!!dI(e.map(VX),hI(t))}function VX(e){return e=e.map(hI),e.pop(),e}function hI(e){return[e[0]*kt,e[1]*kt]}function HX(e,t){return(e&&ZR.hasOwnProperty(e.type)?ZR[e.type]:mg)(e,t)}function rk(e,t,n){var r=zl(e,t-ke,n).concat(t);return function(o){return r.map(function(i){return[o,i]})}}function ok(e,t,n){var r=zl(e,t-ke,n).concat(t);return function(o){return r.map(function(i){return[i,o]})}}function pI(){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 y(){return{type:"MultiLineString",coordinates:x()}}function x(){return zl($h(r/u)*u,n,u).map(p).concat(zl($h(a/d)*d,s,d).map(g)).concat(zl($h(t/l)*l,e,l).filter(function(v){return at(v%u)>ke}).map(h)).concat(zl($h(i/c)*c,o,c).filter(function(v){return at(v%d)>ke}).map(f))}return y.lines=function(){return x().map(function(v){return{type:"LineString",coordinates:v}})},y.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(g(s).slice(1),p(n).reverse().slice(1),g(a).reverse().slice(1))]}},y.extent=function(v){return arguments.length?y.extentMajor(v).extentMinor(v):y.extentMinor()},y.extentMajor=function(v){return arguments.length?(r=+v[0][0],n=+v[1][0],a=+v[0][1],s=+v[1][1],r>n&&(v=r,r=n,n=v),a>s&&(v=a,a=s,s=v),y.precision(m)):[[r,a],[n,s]]},y.extentMinor=function(v){return arguments.length?(t=+v[0][0],e=+v[1][0],i=+v[0][1],o=+v[1][1],t>e&&(v=t,t=e,e=v),i>o&&(v=i,i=o,o=v),y.precision(m)):[[t,i],[e,o]]},y.step=function(v){return arguments.length?y.stepMajor(v).stepMinor(v):y.stepMinor()},y.stepMajor=function(v){return arguments.length?(u=+v[0],d=+v[1],y):[u,d]},y.stepMinor=function(v){return arguments.length?(l=+v[0],c=+v[1],y):[l,c]},y.precision=function(v){return arguments.length?(m=+v,h=rk(i,o,90),f=ok(t,e,m),p=rk(a,s,90),g=ok(r,n,m),y):m},y.extentMajor([[-180,-90+ke],[180,90-ke]]).extentMinor([[-180,-80-ke],[180,80+ke]])}function WX(){return pI()()}const Dx=e=>e;var X0=new xs,Mx=new xs,gI,mI,Ox,Ax,Ci={point:Cn,lineStart:Cn,lineEnd:Cn,polygonStart:function(){Ci.lineStart=qX,Ci.lineEnd=GX},polygonEnd:function(){Ci.lineStart=Ci.lineEnd=Ci.point=Cn,X0.add(at(Mx)),Mx=new xs},result:function(){var e=X0/2;return X0=new xs,e}};function qX(){Ci.point=UX}function UX(e,t){Ci.point=bI,gI=Ox=e,mI=Ax=t}function bI(e,t){Mx.add(Ax*e-Ox*t),Ox=e,Ax=t}function GX(){bI(gI,mI)}var Fc=1/0,bg=Fc,Bd=-Fc,yg=Bd,vg={point:YX,lineStart:Cn,lineEnd:Cn,polygonStart:Cn,polygonEnd:Cn,result:function(){var e=[[Fc,bg],[Bd,yg]];return Bd=yg=-(bg=Fc=1/0),e}};function YX(e,t){e<Fc&&(Fc=e),e>Bd&&(Bd=e),t<bg&&(bg=t),t>yg&&(yg=t)}var Tx=0,Ix=0,Yu=0,xg=0,wg=0,Bl=0,Nx=0,Fx=0,Ku=0,yI,vI,Io,No,Gr={point:Ka,lineStart:ik,lineEnd:sk,polygonStart:function(){Gr.lineStart=QX,Gr.lineEnd=ZX},polygonEnd:function(){Gr.point=Ka,Gr.lineStart=ik,Gr.lineEnd=sk},result:function(){var e=Ku?[Nx/Ku,Fx/Ku]:Bl?[xg/Bl,wg/Bl]:Yu?[Tx/Yu,Ix/Yu]:[NaN,NaN];return Tx=Ix=Yu=xg=wg=Bl=Nx=Fx=Ku=0,e}};function Ka(e,t){Tx+=e,Ix+=t,++Yu}function ik(){Gr.point=KX}function KX(e,t){Gr.point=XX,Ka(Io=e,No=t)}function XX(e,t){var n=e-Io,r=t-No,o=nr(n*n+r*r);xg+=o*(Io+e)/2,wg+=o*(No+t)/2,Bl+=o,Ka(Io=e,No=t)}function sk(){Gr.point=Ka}function QX(){Gr.point=JX}function ZX(){xI(yI,vI)}function JX(e,t){Gr.point=xI,Ka(yI=Io=e,vI=No=t)}function xI(e,t){var n=e-Io,r=t-No,o=nr(n*n+r*r);xg+=o*(Io+e)/2,wg+=o*(No+t)/2,Bl+=o,o=No*e-Io*t,Nx+=o*(Io+e),Fx+=o*(No+t),Ku+=o*3,Ka(Io=e,No=t)}function wI(e){this._context=e}wI.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,Lr);break}}},result:Cn};var Lx=new xs,Q0,SI,CI,Xu,Qu,Vd={point:Cn,lineStart:function(){Vd.point=eQ},lineEnd:function(){Q0&&_I(SI,CI),Vd.point=Cn},polygonStart:function(){Q0=!0},polygonEnd:function(){Q0=null},result:function(){var e=+Lx;return Lx=new xs,e}};function eQ(e,t){Vd.point=_I,SI=Xu=e,CI=Qu=t}function _I(e,t){Xu-=e,Qu-=t,Lx.add(nr(Xu*Xu+Qu*Qu)),Xu=e,Qu=t}let ak,Sg,lk,ck;class uk{constructor(t){this._append=t==null?EI:tQ(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!==lk||this._append!==Sg){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`,lk=r,Sg=this._append,ck=this._,this._=o}this._+=ck;break}}}result(){const t=this._;return this._="",t.length?t:null}}function EI(e){let t=1;this._+=e[0];for(const n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function tQ(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return EI;if(t!==ak){const n=10**t;ak=t,Sg=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 Sg}function dk(e,t){let n=3,r=4.5,o,i;function s(a){return a&&(typeof r=="function"&&i.pointRadius(+r.apply(this,arguments)),oa(a,o(i))),i.result()}return s.area=function(a){return oa(a,o(Ci)),Ci.result()},s.measure=function(a){return oa(a,o(Vd)),Vd.result()},s.bounds=function(a){return oa(a,o(vg)),vg.result()},s.centroid=function(a){return oa(a,o(Gr)),Gr.result()},s.projection=function(a){return arguments.length?(o=a==null?(e=null,Dx):(e=a).stream,s):e},s.context=function(a){return arguments.length?(i=a==null?(t=null,new uk(n)):new wI(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 uk(n)),s},s.projection(e).digits(n).context(t)}function CS(e){return function(t){var n=new jx;for(var r in e)n[r]=e[r];return n.stream=t,n}}function jx(){}jx.prototype={constructor:jx,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 _S(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),oa(n,e.stream(vg)),t(vg.result()),r!=null&&e.clipExtent(r),e}function ES(e,t,n){return _S(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 RI(e,t,n){return ES(e,[[0,0],t],n)}function kI(e,t,n){return _S(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 PI(e,t,n){return _S(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 fk=16,nQ=ze(30*kt);function hk(e,t){return+t?oQ(e,t):rQ(e)}function rQ(e){return CS({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function oQ(e,t){function n(r,o,i,s,a,l,c,u,d,h,f,p,g,m){var y=c-r,x=u-o,v=y*y+x*x;if(v>4*t&&g--){var _=s+h,C=a+f,w=l+p,S=nr(_*_+C*C+w*w),k=Zr(w/=S),M=at(at(w)-1)<ke||at(i-d)<ke?(i+d)/2:Yo(C,_),D=e(M,k),A=D[0],I=D[1],$=A-r,j=I-o,T=x*$-y*j;(T*T/v>t||at((y*$+x*j)/v-.5)>.3||s*h+a*f+l*p<nQ)&&(n(r,o,i,s,a,l,A,I,M,_/=S,C/=S,w,g,m),m.point(A,I),n(A,I,M,_,C,w,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:y,lineStart:x,lineEnd:_,polygonStart:function(){r.polygonStart(),m.lineStart=C},polygonEnd:function(){r.polygonEnd(),m.lineStart=x}};function y(k,M){k=e(k,M),r.point(k[0],k[1])}function x(){d=NaN,m.point=v,r.lineStart()}function v(k,M){var D=Ic([k,M]),A=e(k,M);n(d,h,u,f,p,g,d=A[0],h=A[1],u=k,f=D[0],p=D[1],g=D[2],fk,r),r.point(d,h)}function _(){m.point=y,r.lineEnd()}function C(){x(),m.point=w,m.lineEnd=S}function w(k,M){v(o=k,M),i=d,s=h,a=f,l=p,c=g,m.point=v}function S(){n(d,h,u,f,p,g,i,s,o,a,l,c,fk,r),m.lineEnd=_,_()}return m}}var iQ=CS({point:function(e,t){this.stream.point(e*kt,t*kt)}});function sQ(e){return CS({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function aQ(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 pk(e,t,n,r,o,i){if(!i)return aQ(e,t,n,r,o);var s=ze(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 Bi(e){return DI(function(){return e})()}function DI(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=QR,m=null,y,x,v,_=Dx,C=.5,w,S,k,M,D;function A(T){return k(T[0]*kt,T[1]*kt)}function I(T){return T=k.invert(T[0],T[1]),T&&[T[0]*Zn,T[1]*Zn]}A.stream=function(T){return M&&D===T?M:M=iQ(sQ(u)(g(w(_(D=T)))))},A.preclip=function(T){return arguments.length?(g=T,p=void 0,j()):g},A.postclip=function(T){return arguments.length?(_=T,m=y=x=v=null,j()):_},A.clipAngle=function(T){return arguments.length?(g=+T?TX(p=T*kt):(p=null,QR),j()):p*Zn},A.clipExtent=function(T){return arguments.length?(_=T==null?(m=y=x=v=null,Dx):NX(m=+T[0][0],y=+T[0][1],x=+T[1][0],v=+T[1][1]),j()):m==null?null:[[m,y],[x,v]]},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*kt,s=T[1]%360*kt,$()):[i*Zn,s*Zn]},A.rotate=function(T){return arguments.length?(a=T[0]%360*kt,l=T[1]%360*kt,c=T.length>2?T[2]%360*kt:0,$()):[a*Zn,l*Zn,c*Zn]},A.angle=function(T){return arguments.length?(d=T%360*kt,$()):d*Zn},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?(w=hk(S,C=T*T),j()):nr(C)},A.fitExtent=function(T,N){return ES(A,T,N)},A.fitSize=function(T,N){return RI(A,T,N)},A.fitWidth=function(T,N){return kI(A,T,N)},A.fitHeight=function(T,N){return PI(A,T,N)};function $(){var T=pk(n,0,0,h,f,d).apply(null,t(i,s)),N=pk(n,r-T[0],o-T[1],h,f,d);return u=lI(a,l,c),S=Cx(t,N),k=Cx(u,S),w=hk(S,C),j()}function j(){return M=D=null,A}return function(){return t=e.apply(this,arguments),A.invert=t.invert&&I,$()}}function RS(e){var t=0,n=Qe/3,r=DI(e),o=r(t,n);return o.parallels=function(i){return arguments.length?r(t=i[0]*kt,n=i[1]*kt):[t*Zn,n*Zn]},o}function lQ(e){var t=ze(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 cQ(e,t){var n=Ie(e),r=(n+Ie(t))/2;if(at(r)<ke)return lQ(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*ze(a)]}return s.invert=function(a,l){var c=i-l,u=Yo(a,at(c))*Yr(c);return c*r<0&&(u-=Qe*Yr(a)*Yr(c)),[u/r,Zr((o-(a*a+c*c)*r*r)/(2*r))]},s}function Cg(){return RS(cQ).scale(155.424).center([0,33.6442])}function MI(){return Cg().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function uQ(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 dQ(){var e,t,n=MI(),r,o=Cg().rotate([154,0]).center([-2,58.5]).parallels([55,65]),i,s=Cg().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=uQ([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 ES(u,h,f)},u.fitSize=function(h,f){return RI(u,h,f)},u.fitWidth=function(h,f){return kI(u,h,f)},u.fitHeight=function(h,f){return PI(u,h,f)};function d(){return e=t=null,u}return u.scale(1070)}function OI(e){return function(t,n){var r=ze(t),o=ze(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=ze(o);return[Yo(t*i,r*s),Zr(r&&n*i/r)]}}var AI=OI(function(e){return nr(2/(1+e))});AI.invert=Mf(function(e){return 2*Zr(e/2)});function fQ(){return Bi(AI).scale(124.75).clipAngle(180-.001)}var TI=OI(function(e){return(e=aI(e))&&e/Ie(e)});TI.invert=Mf(function(e){return e});function hQ(){return Bi(TI).scale(79.4188).clipAngle(180-.001)}function Vm(e,t){return[e,hg(SS((Qt+t)/2))]}Vm.invert=function(e,t){return[e,2*Qc(sI(t))-Qt]};function pQ(){return II(Vm).scale(961/Lr)}function II(e){var t=Bi(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=Qe*r(),h=t(RX(t.rotate()).invert([0,0]));return i(s==null?[[h[0]-d,h[1]-d],[h[0]+d,h[1]+d]]:e===Vm?[[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 qh(e){return SS((Qt+e)/2)}function gQ(e,t){var n=ze(e),r=e===t?Ie(e):hg(n/ze(t))/hg(qh(t)/qh(e)),o=n*G0(qh(e),r)/r;if(!r)return Vm;function i(s,a){o>0?a<-Qt+ke&&(a=-Qt+ke):a>Qt-ke&&(a=Qt-ke);var l=o/G0(qh(a),r);return[l*Ie(r*s),o-l*ze(r*s)]}return i.invert=function(s,a){var l=o-a,c=Yr(r)*nr(s*s+l*l),u=Yo(s,at(l))*Yr(l);return l*r<0&&(u-=Qe*Yr(s)*Yr(l)),[u/r,2*Qc(G0(o/c,1/r))-Qt]},i}function mQ(){return RS(gQ).scale(109.5).parallels([30,30])}function _g(e,t){return[e,t]}_g.invert=_g;function bQ(){return Bi(_g).scale(152.63)}function yQ(e,t){var n=ze(e),r=e===t?Ie(e):(n-ze(t))/(t-e),o=n/r+e;if(at(r)<ke)return _g;function i(s,a){var l=o-a,c=r*s;return[l*Ie(c),o-l*ze(c)]}return i.invert=function(s,a){var l=o-a,c=Yo(s,at(l))*Yr(l);return l*r<0&&(c-=Qe*Yr(s)*Yr(l)),[c/r,o-Yr(r)*nr(s*s+l*l)]},i}function vQ(){return RS(yQ).scale(131.154).center([0,13.9389])}var ld=1.340264,cd=-.081106,ud=893e-6,dd=.003796,Eg=nr(3)/2,xQ=12;function NI(e,t){var n=Zr(Eg*Ie(t)),r=n*n,o=r*r*r;return[e*ze(n)/(Eg*(ld+3*cd*r+o*(7*ud+9*dd*r))),n*(ld+cd*r+o*(ud+dd*r))]}NI.invert=function(e,t){for(var n=t,r=n*n,o=r*r*r,i=0,s,a,l;i<xQ&&(a=n*(ld+cd*r+o*(ud+dd*r))-t,l=ld+3*cd*r+o*(7*ud+9*dd*r),n-=s=a/l,r=n*n,o=r*r*r,!(at(s)<iI));++i);return[Eg*e*(ld+3*cd*r+o*(7*ud+9*dd*r))/ze(n),Zr(Ie(n)/Eg)]};function wQ(){return Bi(NI).scale(177.158)}function FI(e,t){var n=ze(t),r=ze(e)*n;return[n*Ie(e)/r,Ie(t)/r]}FI.invert=Mf(Qc);function SQ(){return Bi(FI).scale(144.049).clipAngle(60)}function LI(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)))]}LI.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 CQ(){return Bi(LI).scale(175.295)}function jI(e,t){return[ze(t)*Ie(e),Ie(t)]}jI.invert=Mf(Zr);function _Q(){return Bi(jI).scale(249.5).clipAngle(90+ke)}function $I(e,t){var n=ze(t),r=1+ze(e)*n;return[n*Ie(e)/r,Ie(t)/r]}$I.invert=Mf(function(e){return 2*Qc(e)});function EQ(){return Bi($I).scale(250).clipAngle(142)}function zI(e,t){return[hg(SS((Qt+t)/2)),-e]}zI.invert=function(e,t){return[-t,2*Qc(sI(e))-Qt]};function RQ(){var e=II(zI),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 pt(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 Hm(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function kS(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Zc(){}var Xa=.7,Lc=1/Xa,Zl="\\s*([+-]?\\d+)\\s*",Hd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Vo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",kQ=/^#([0-9a-f]{3,8})$/,PQ=new RegExp(`^rgb\\(${Zl},${Zl},${Zl}\\)$`),DQ=new RegExp(`^rgb\\(${Vo},${Vo},${Vo}\\)$`),MQ=new RegExp(`^rgba\\(${Zl},${Zl},${Zl},${Hd}\\)$`),OQ=new RegExp(`^rgba\\(${Vo},${Vo},${Vo},${Hd}\\)$`),AQ=new RegExp(`^hsl\\(${Hd},${Vo},${Vo}\\)$`),TQ=new RegExp(`^hsla\\(${Hd},${Vo},${Vo},${Hd}\\)$`),gk={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};Hm(Zc,PS,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:mk,formatHex:mk,formatHex8:IQ,formatHsl:NQ,formatRgb:bk,toString:bk});function mk(){return this.rgb().formatHex()}function IQ(){return this.rgb().formatHex8()}function NQ(){return VI(this).formatHsl()}function bk(){return this.rgb().formatRgb()}function PS(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=kQ.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?yk(t):n===3?new Hn(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=PQ.exec(e))?new Hn(t[1],t[2],t[3],1):(t=DQ.exec(e))?new Hn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=MQ.exec(e))?Uh(t[1],t[2],t[3],t[4]):(t=OQ.exec(e))?Uh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=AQ.exec(e))?wk(t[1],t[2]/100,t[3]/100,1):(t=TQ.exec(e))?wk(t[1],t[2]/100,t[3]/100,t[4]):gk.hasOwnProperty(e)?yk(gk[e]):e==="transparent"?new Hn(NaN,NaN,NaN,0):null}function yk(e){return new Hn(e>>16&255,e>>8&255,e&255,1)}function Uh(e,t,n,r){return r<=0&&(e=t=n=NaN),new Hn(e,t,n,r)}function BI(e){return e instanceof Zc||(e=PS(e)),e?(e=e.rgb(),new Hn(e.r,e.g,e.b,e.opacity)):new Hn}function Wd(e,t,n,r){return arguments.length===1?BI(e):new Hn(e,t,n,r??1)}function Hn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Hm(Hn,Wd,kS(Zc,{brighter(e){return e=e==null?Lc:Math.pow(Lc,e),new Hn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Xa:Math.pow(Xa,e),new Hn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Hn(Ia(this.r),Ia(this.g),Ia(this.b),Rg(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:vk,formatHex:vk,formatHex8:FQ,formatRgb:xk,toString:xk}));function vk(){return`#${ha(this.r)}${ha(this.g)}${ha(this.b)}`}function FQ(){return`#${ha(this.r)}${ha(this.g)}${ha(this.b)}${ha((isNaN(this.opacity)?1:this.opacity)*255)}`}function xk(){const e=Rg(this.opacity);return`${e===1?"rgb(":"rgba("}${Ia(this.r)}, ${Ia(this.g)}, ${Ia(this.b)}${e===1?")":`, ${e})`}`}function Rg(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ia(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ha(e){return e=Ia(e),(e<16?"0":"")+e.toString(16)}function wk(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 VI(e){if(e instanceof lo)return new lo(e.h,e.s,e.l,e.opacity);if(e instanceof Zc||(e=PS(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 LQ(e,t,n,r){return arguments.length===1?VI(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}Hm(lo,LQ,kS(Zc,{brighter(e){return e=e==null?Lc:Math.pow(Lc,e),new lo(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Xa:Math.pow(Xa,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 Hn(Z0(e>=240?e-240:e+120,o,r),Z0(e,o,r),Z0(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new lo(Sk(this.h),Gh(this.s),Gh(this.l),Rg(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=Rg(this.opacity);return`${e===1?"hsl(":"hsla("}${Sk(this.h)}, ${Gh(this.s)*100}%, ${Gh(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Sk(e){return e=(e||0)%360,e<0?e+360:e}function Gh(e){return Math.max(0,Math.min(1,e||0))}function Z0(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 jQ=Math.PI/180,$Q=180/Math.PI;var HI=-.14861,DS=1.78277,MS=-.29227,Wm=-.90649,qd=1.97294,Ck=qd*Wm,_k=qd*DS,Ek=DS*MS-Wm*HI;function zQ(e){if(e instanceof Na)return new Na(e.h,e.s,e.l,e.opacity);e instanceof Hn||(e=BI(e));var t=e.r/255,n=e.g/255,r=e.b/255,o=(Ek*r+Ck*t-_k*n)/(Ek+Ck-_k),i=r-o,s=(qd*(n-o)-MS*i)/Wm,a=Math.sqrt(s*s+i*i)/(qd*o*(1-o)),l=a?Math.atan2(s,i)*$Q-120:NaN;return new Na(l<0?l+360:l,a,o,e.opacity)}function Ko(e,t,n,r){return arguments.length===1?zQ(e):new Na(e,t,n,r??1)}function Na(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Hm(Na,Ko,kS(Zc,{brighter(e){return e=e==null?Lc:Math.pow(Lc,e),new Na(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Xa:Math.pow(Xa,e),new Na(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*jQ,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),o=Math.sin(e);return new Hn(255*(t+n*(HI*r+DS*o)),255*(t+n*(MS*r+Wm*o)),255*(t+n*(qd*r)),this.opacity)}}));function BQ(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 VQ(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 BQ((n-r/t)*t,s,o,i,a)}}const OS=e=>()=>e;function WI(e,t){return function(n){return e+n*t}}function HQ(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 WQ(e,t){var n=t-e;return n?WI(e,n>180||n<-180?n-360*Math.round(n/360):n):OS(isNaN(e)?t:e)}function qQ(e){return(e=+e)==1?Jl:function(t,n){return n-t?HQ(t,n,e):OS(isNaN(t)?n:t)}}function Jl(e,t){var n=t-e;return n?WI(e,n):OS(isNaN(e)?t:e)}(function e(t){var n=qQ(t);function r(o,i){var s=n((o=Wd(o)).r,(i=Wd(i)).r),a=n(o.g,i.g),l=n(o.b,i.b),c=Jl(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 UQ(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=Wd(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 GQ=UQ(VQ);function qI(e){return function t(n){n=+n;function r(o,i){var s=e((o=Ko(o)).h,(i=Ko(i)).h),a=Jl(o.s,i.s),l=Jl(o.l,i.l),c=Jl(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)}qI(WQ);var AS=qI(Jl);const Ot=e=>GQ(e[e.length-1]);var YQ=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(pt);const KQ=Ot(YQ);var XQ=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(pt);const QQ=Ot(XQ);var ZQ=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(pt);const JQ=Ot(ZQ);var eZ=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(pt);const tZ=Ot(eZ);var nZ=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(pt);const rZ=Ot(nZ);var oZ=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(pt);const iZ=Ot(oZ);var sZ=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(pt);const aZ=Ot(sZ);var lZ=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(pt);const cZ=Ot(lZ);var uZ=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(pt);const dZ=Ot(uZ);var fZ=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(pt);const hZ=Ot(fZ);var pZ=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(pt);const gZ=Ot(pZ);var mZ=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(pt);const bZ=Ot(mZ);var yZ=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(pt);const vZ=Ot(yZ);var xZ=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(pt);const wZ=Ot(xZ);var SZ=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(pt);const CZ=Ot(SZ);var _Z=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(pt);const EZ=Ot(_Z);var RZ=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(pt);const kZ=Ot(RZ);var PZ=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(pt);const DZ=Ot(PZ);var MZ=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(pt);const OZ=Ot(MZ);var AZ=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(pt);const TZ=Ot(AZ);var IZ=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(pt);const NZ=Ot(IZ);var FZ=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(pt);const LZ=Ot(FZ);var jZ=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(pt);const $Z=Ot(jZ);var zZ=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(pt);const BZ=Ot(zZ);var VZ=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(pt);const HZ=Ot(VZ);var WZ=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(pt);const qZ=Ot(WZ);var UZ=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(pt);const GZ=Ot(UZ);function YZ(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 KZ=AS(Ko(300,.5,0),Ko(-240,.5,1));var XZ=AS(Ko(-100,.75,.35),Ko(80,1.5,.8)),QZ=AS(Ko(260,.75,.35),Ko(80,1.5,.8)),Yh=Ko();function ZZ(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return Yh.h=360*e-100,Yh.s=1.5-1.5*t,Yh.l=.8-.9*t,Yh+""}var Kh=Wd(),JZ=Math.PI/3,eJ=Math.PI*2/3;function tJ(e){var t;return e=(.5-e)*Math.PI,Kh.r=255*(t=Math.sin(e))*t,Kh.g=255*(t=Math.sin(e+JZ))*t,Kh.b=255*(t=Math.sin(e+eJ))*t,Kh+""}function nJ(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 qm(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}const rJ=qm(pt("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));var oJ=qm(pt("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),iJ=qm(pt("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),sJ=qm(pt("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function aJ(e){return e}function lJ(e){if(e==null)return aJ;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 cJ(e,t){for(var n,r=e.length,o=r-t;o<--r;)n=e[o],e[o++]=e[r],e[r]=n}function uJ(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(n){return Rk(e,n)})}:Rk(e,t)}function Rk(e,t){var n=t.id,r=t.bbox,o=t.properties==null?{}:t.properties,i=dJ(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 dJ(e,t){var n=lJ(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&&cJ(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 fd={geoAzimuthalEqualArea:fQ,geoAzimuthalEquidistant:hQ,geoGnomonic:SQ,geoOrthographic:_Q,geoStereographic:EQ,geoEqualEarth:wQ,geoAlbers:MI,geoAlbersUsa:dQ,geoConicConformal:mQ,geoConicEqualArea:Cg,geoConicEquidistant:vQ,geoEquirectangular:bQ,geoMercator:pQ,geoTransverseMercator:RQ,geoNaturalEarth1:CQ};Object.keys(fd).forEach(e=>{fd[`${e.charAt(3).toLowerCase()}${e.slice(4)}`]=fd[e]});class dl extends Ts{constructor(t){super(t),this.outlineBounds=null,this.oldChartBounds=null,this.geoPath=dk()}init(t){t.position="chartArea",super.init(t),typeof t.projection=="function"?this.projection=t.projection:this.projection=(fd[t.projection]||fd.albersUsa)(),this.geoPath.projection(this.projection),this.outlineBounds=null,this.oldChartBounds=null}computeBounds(t){const n=dk(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}}dl.id="projection";dl.defaults={projection:"albersUsa",projectionScale:1,projectionOffset:[0,0],padding:0};dl.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 fJ(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 hJ(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=fJ(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 Vl extends Ya{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=hJ(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 UI extends Tc{constructor(){super(...arguments),this.legendSize={w:0,h:0}}init(t){Vl.prototype.init.call(this,t)}parse(t,n){return Vl.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 Vl.prototype.update.call(this,t,n,r)}_computeLabelArea(){}draw(t){return Vl.prototype.draw.call(this,t)}_drawIndicator(){}}const _i={interpolateBlues:LZ,interpolateBrBG:KQ,interpolateBuGn:hZ,interpolateBuPu:gZ,interpolateCividis:YZ,interpolateCool:QZ,interpolateCubehelixDefault:KZ,interpolateGnBu:bZ,interpolateGreens:$Z,interpolateGreys:BZ,interpolateInferno:iJ,interpolateMagma:oJ,interpolateOrRd:vZ,interpolateOranges:GZ,interpolatePRGn:QQ,interpolatePiYG:JQ,interpolatePlasma:sJ,interpolatePuBu:CZ,interpolatePuBuGn:wZ,interpolatePuOr:tZ,interpolatePuRd:EZ,interpolatePurples:HZ,interpolateRainbow:ZZ,interpolateRdBu:rZ,interpolateRdGy:iZ,interpolateRdPu:kZ,interpolateRdYlBu:aZ,interpolateRdYlGn:cZ,interpolateReds:qZ,interpolateSinebow:tJ,interpolateSpectral:dZ,interpolateTurbo:nJ,interpolateViridis:rJ,interpolateWarm:XZ,interpolateYlGn:OZ,interpolateYlGnBu:DZ,interpolateYlOrBr:TZ,interpolateYlOrRd:NZ};Object.keys(_i).forEach(e=>{_i[`${e.charAt(11).toLowerCase()}${e.slice(12)}`]=_i[e],_i[e.slice(11)]=_i[e]});function GI(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 YI={interpolate:"blues",missing:"transparent",quantize:0};class ws extends Vl{get interpolate(){const t=this.options;return t?typeof t.interpolate=="function"?t.interpolate:_i[t.interpolate]||_i.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=GI(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)}}}}ws.id="color";ws.defaults=pn({},[Ya.defaults,Um,YI]);ws.descriptors={_scriptable:e=>e!=="interpolate",_indexable:!1};class TS extends UI{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=_i[t.interpolate]||_i.blues}getColorForValue(t){return ws.prototype.getColorForValue.call(this,t)}getColor(t){let n=t;return this.options.quantize>0&&(n=GI(n,this.options.quantize)),this.interpolate(n)}_drawIndicator(){return ws.prototype._drawIndicator.call(this)}}TS.id="colorLogarithmic";TS.defaults=pn({},[Tc.defaults,Um,YI]);TS.descriptors={_scriptable:e=>e!=="interpolate",_indexable:!1};const KI={missing:1,mode:"area",range:[2,20],legend:{align:"bottom",length:90,width:70,indicatorWidth:42}};class Ss extends Vl{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};lg(t,f,d,h)})}}Ss.id="size";Ss.defaults=pn({},[Ya.defaults,Um,KI]);Ss.descriptors={_scriptable:!0,_indexable:e=>e!=="range"};class XI extends UI{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 Ss.prototype.getSizeImpl.call(this,t)}_drawIndicator(){Ss.prototype._drawIndicator.call(this)}}XI.id="sizeLogarithmic";XI.defaults=pn({},[Tc.defaults,Um,KI]);function pJ(e,t){return[[e[0][0]-t,e[0][1]-t],[e[1][0]+t,e[1][1]+t]]}class ji extends oi{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&&HX(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=pJ(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())}}ji.id="geoFeature";ji.defaults={...Bo.defaults,outlineBackgroundColor:null,outlineBorderWidth:0,graticuleBorderColor:"#CCCCCC",graticuleBorderWidth:0};ji.defaultRoutes={outlineBorderColor:"borderColor",...Bo.defaultRoutes||{}};const QI={showOutline:!1,showGraticule:!1,clipMap:!0},ZI={scales:{projection:{axis:"x",type:dl.id,position:"chartArea",display:!1}}};function kk(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 JI 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=kk(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=kk(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(WX());else{const s=pI();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,Pa(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||Pa(t.ctx,t.chartArea):r&&(r=!1,Da(t.ctx)),this.showGraticule(),n===!0||n==="items"?r||Pa(t.ctx,t.chartArea):r&&(r=!1,Da(t.ctx)),this.getMeta().data.forEach(o=>o.draw.call(o,t.ctx,t.chartArea)),r&&(r=!1,Da(t.ctx))}}function e5(e,t,n,r=[],o=[]){un.addControllers(n),Array.isArray(r)?un.addElements(...r):un.addElements(r),Array.isArray(o)?un.addScales(...o):un.addScales(o);const i=t;return i.type=e,i}class Jc extends JI{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])}}Jc.id="choropleth";Jc.defaults=pn({},[QI,{datasetElementType:ji.id,dataElementType:ji.id}]);Jc.overrides=pn({},[ZI,{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:ws.id,axis:"x"}},elements:{geoFeature:{backgroundColor(e){return e.dataIndex==null?null:e.chart.getDatasetMeta(e.datasetIndex).controller.indexToColor(e.dataIndex)}}}}]);class gJ extends Mt{constructor(t,n){super(t,e5("choropleth",n,Jc,ji,[ws,dl]))}}gJ.id=Jc.id;class eu extends JI{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])}}eu.id="bubbleMap";eu.defaults=pn({},[QI,{dataElementType:Ta.id,datasetElementType:ji.id,showOutline:!0,clipMap:"outline+graticule"}]);eu.overrides=pn({},[ZI,{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:Ss.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 mJ extends Mt{constructor(t,n){super(t,e5("bubbleMap",n,eu,ji,[Ss,dl]))}}mJ.id=eu.id;function bJ(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 yJ(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 vJ(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 xJ(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 wJ(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 SJ(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 CJ(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 _J(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:vt.slate[800]},angleLines:{color:vt.slate[800]},ticks:{color:vt.slate[800],showLabelBackdrop:!1}}}}}),n}function EJ(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 RJ({data:e,cfg:t,customCfg:n,preferences:r,cardType:o}){var k,M,D,A,I;const i=((k=r==null?void 0:r.chartOptions)==null?void 0:k.indexAxis)||"y",s={...t,options:{indexAxis:i}},{metricKeys:a,dimensionKeys:l}=vn(e),c=tT(a,e),u=Xl(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}=Lm((r==null?void 0:r.customVisualCode)||""),f=l[0],p=Fm(e,f),g=On((s==null?void 0:s.options)||{},(n==null?void 0:n.options)||{}),m=On(g,(r==null?void 0:r.chartOptions)||{});Array(u.length).fill(!0);const y=e.map($=>$[f]),x=e.map($=>$[a[0]]),v=(M=u[0])==null?void 0:M.backgroundColor.slice(),_={...m,plugins:{...m.plugins,legend:{...(D=m.plugins)==null?void 0:D.legend,labels:{generateLabels:$=>{const j=$.data.labels;return y.map((T,N)=>({text:T,fillStyle:v[N],hidden:!j.includes(T.toString()),index:N,datasetIndex:0,lineWidth:0}))}},onClick:($,j,T)=>{const N=T.chart,F=j.index,z=y[F],B=N.data.datasets[0],O=N.data.labels,q=B.data,L=B.backgroundColor,P=O.indexOf(z.toString());P>=0?(O.splice(P,1),q.splice(P,1),L.splice(P,1)):(O.splice(F,0,y[F].toString()),q.splice(F,0,Number(x[F])),L.splice(F,0,v[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,q;const T=((B=(z=$==null?void 0:$[0])==null?void 0:z.dataset)==null?void 0:B.data).reduce((L,P)=>L+P,0),F=(((O=$==null?void 0:$[0])==null?void 0:O.parsed[i==="x"?"y":"x"])/T*100).toFixed(2);return`${(q=$==null?void 0:$[0])==null?void 0:q.label} (${F}%)`},label:function($){var q,L,P,H;$.dataset.label;const j=$.dataset.data;j.reduce((U,Y)=>U+Y,0);const T=$.parsed[i==="x"?"y":"x"],N=j.indexOf(T),F=j[N-1],z=br({number:Number(T),decimalPlaces:((q=r==null?void 0:r.numberAxisFormat)==null?void 0:q.decimalPlaces)||0,useSuffix:!!((L=r==null?void 0:r.numberAxisFormat)!=null&&L.suffix),customSuffix:"",locale:((P=r==null?void 0:r.numberAxisFormat)==null?void 0:P.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: ${B}%`:"")}}}}},C=On(m,_),w=On(C,h);return delete w.scales,{type:o,data:{labels:p,datasets:u},options:w,plugins:[...d]}}function kJ({data:e,cfg:t,customCfg:n,preferences:r}){var C,w;const o=xJ(t),i=PJ(e),s=Xl(i,n),{plugins:a,options:l}=Lm((r==null?void 0:r.customVisualCode)||""),c=On((o==null?void 0:o.options)||{},(t==null?void 0:t.options)||{}),u=On(c,(r==null?void 0:r.chartOptions)||{}),d=On(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(S){if(Array.isArray(S.raw)&&S.raw.every(k=>k===null))return null}}}}},f=On(h,l),p=iT(t,r),g=On(f,p),m={...g,plugins:{...g==null?void 0:g.plugins,datalabels:{...(w=g==null?void 0:g.plugins)==null?void 0:w.datalabels,formatter:(S,k)=>S.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:y}=vn(e),x=y[0];return{type:"bar",data:{labels:[...new Set(Fm(e,x))],datasets:s},options:m,plugins:[...a]}}function PJ(e){var d,h,f,p;const{dimensionKeys:t,metricKeys:n}=vn(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 y=e.filter(_=>(_==null?void 0:_[s])===g),v=l.map(_=>{const C=y.filter(w=>(w==null?void 0:w[a])===_);return C.length===0?[[null,null,null]]:C.map(w=>[w==null?void 0:w[n[0]],w==null?void 0:w[n[1]],w==null?void 0:w[n[2]],_])}).flat();return{label:g,data:v,backgroundColor:o==null?void 0:o[m%o.length],borderColor:i==null?void 0:i[m%i.length],borderSkipped:!1}})}function IS({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,y,x,v,_;let c=e;const u=l&&l.pivotColumns&&l.pivotColumns.length>0,d=l&&l.groupByColumns&&l.groupByColumns.length>0;if(u&&d&&(c=bq(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 w=uJ(a,(f=a==null?void 0:a.objects)==null?void 0:f[C]).features;if(!w)return null;const S={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:((y=s==null?void 0:s.mapVisualOptions)==null?void 0:y.colorScale)||"blues",quantize:5,legend:{position:"bottom-right",align:"right"}}}},{keys:k}=vn(c),M=w.map(T=>{var B;const N=k==null?void 0:k[0],F=k==null?void 0:k[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=Xl([{label:C,data:M,borderColor:"lightgray"}],r),I={type:"choropleth",data:{labels:w.map(T=>T.properties.NAME||T.properties.name),datasets:A},options:S},{options:$}=ax({cfg:I,preferences:s,customCfg:r,cardType:t});return{...I,options:$}}if(t==="bar"){const C=vJ(n);return Us({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="horizontalBar"){const C=bJ(n);return Us({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="funnel")return RJ({data:c,cfg:n,customCfg:r,preferences:s,cardType:t});if(t==="pyramid"){const C=yJ(n),{dimensionKeys:w,metricKeys:S}=vn(c),k=rg({dataArray:c,groupKey:w[0],pivotKey:w[1],valueKey:S[0]}),M=Us({data:k,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:{...(x=M==null?void 0:M.options)==null?void 0:x.scales,[D]:{beginAtZero:!0,stack:1}}}}}if(t==="stackedBar"||t==="stackedLine"){const C=wJ(n,t),{dimensionKeys:w,metricKeys:S}=vn(c);return(!u||!d)&&(c=rg({dataArray:c,groupKey:w[0],pivotKey:w[1],valueKey:S[0],sortChart:s==null?void 0:s.sortChart})),Us({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="line"){const C=SJ(n);return Us({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="range")return kJ({data:c,cfg:n,customCfg:r,preferences:s});if(t==="pie"||t==="doughnut"||t==="polarArea"){const C=CJ(t,n),{dimensionKeys:w,metricKeys:S}=vn(c),k=tT(S,c),M=Xl(k,r),{plugins:D,options:A}=Lm((s==null?void 0:s.customVisualCode)||""),I=w[0],$=Fm(c,I),j=On((C==null?void 0:C.options)||{},(r==null?void 0:r.options)||{}),T=On(j,(s==null?void 0:s.chartOptions)||{}),N={...T,plugins:{...T.plugins,datalabels:{...(v=T.plugins)==null?void 0:v.datalabels,formatter:(q,L)=>{var P,H,U,Y;return br({number:Number(q),decimalPlaces:((P=s==null?void 0:s.numberAxisFormat)==null?void 0:P.decimalPlaces)||0,useSuffix:!!((H=s==null?void 0:s.numberAxisFormat)!=null&&H.suffix),customSuffix:"",locale:((U=s==null?void 0:s.numberAxisFormat)==null?void 0:U.locale)||"",currency:((Y=s==null?void 0:s.numberAxisFormat)==null?void 0:Y.currency)||""})}},tooltip:{...(_=T.plugins)==null?void 0:_.tooltip,callbacks:{label:function(q){var W,G,X,J;q.dataset.label;const P=q.dataset.data.reduce((ne,Q)=>ne+Q,0),H=q.parsed,U=br({number:Number(H),decimalPlaces:((W=s==null?void 0:s.numberAxisFormat)==null?void 0:W.decimalPlaces)||0,useSuffix:!!((G=s==null?void 0:s.numberAxisFormat)!=null&&G.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/P*100).toFixed(2);return U+` (${Y}%)`}}}}},F=On(T,N),z=On(F,A);return{type:t,data:{labels:$,datasets:M},options:z,plugins:[t==="doughnut"?{id:"doughnutLabel",beforeDatasetsDraw:function(q,L,P){var Q,oe,ee,ue;const{ctx:H,data:U}=q;H.save();const Y=q.getDatasetMeta(0).data[0].x,W=q.getDatasetMeta(0).data[0].y,G=Ec(Dd()),X=window.getComputedStyle(H.canvas).fontFamily;H.font=`1em ${X}`,H.fontWeight="bolder",H.fillStyle=G,H.textAlign="center",H.textBaseline="middle";const J=U.datasets[0].data.reduce((pe,we)=>pe+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=_J(n);return Us({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="bubble"||t==="scatter"){const{metricKeys:C}=vn(c),w=sq(c,t),S=Xl(w,r),k=EJ(n,t,C),{options:M}=ax({cardType:t,cfg:k,preferences:s,customCfg:r});return{type:t,data:{datasets:S},options:M}}return Us({data:c,cfg:n,customCfg:r,cardType:t,preferences:s})}function DJ({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)&&OJ(e,t,o,i,a),["pie","doughnut","polarArea","funnel"].includes(r)&&AJ(e,t,o,i,a),["stackedBar","pyramid"].includes(r)&&MJ({chart:e,elementIndex:t,datasetIndex:n,cfg:o,apply:i,blurColor:a})}function MJ(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,y,x;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((x=(y=(m=o==null?void 0:o.data)==null?void 0:m.datasets)==null?void 0:y[h])==null?void 0:x.borderColor)}),t==null||t.update()}function OJ(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 AJ(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,y,x;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=(y=c==null?void 0:c.backgroundColor)==null?void 0:y.map((v,_)=>{var C;return(C=n.data.datasets[u].backgroundColor)==null?void 0:C[_]}),c.borderColor=(x=c==null?void 0:c.borderColor)==null?void 0:x.map((v,_)=>{var C;return(C=n.data.datasets[u].borderColor)==null?void 0:C[_]})}),e==null||e.update()}function TJ({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}=vn(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=rg({dataArray:t,groupKey:h[0],pivotKey:h[1],valueKey:f[0]}),g=h[0],m=(u=p[r])==null?void 0:u[g],y=h[1],{metricKeys:x}=vn(p),v=x[n];return[{columnName:g,columnValue:m,metric:f[0],value:o},{columnName:y,columnValue:v,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 IJ(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,mq("--semaphor-background")),c})}));return{...e,data:{...e.data,datasets:i}}}return e}function t5(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}=co({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 NJ(e){var s,a;const[t]=E.useState({id:"",title:"",type:"bar"}),{getCard:n}=rn(),r=n(e),o=n5(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 n5(e){var D;const{onChartElementClicked:t}=wr(),[n,r]=E.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=E.useRef(l),u=(D=e==null?void 0:e.preferences)==null?void 0:D.onClickFilter,{addFilteringCard:d,addOrUpdateFilterValues:h,removeFilterValues:f,removeFilteringCard:p}=rn(),{data:g,isLoading:m,isFetching:y,isError:x,queryKey:v,isFilteringCard:_,isSingleCardFrame:C}=Li(e),{data:w}=t5(e);let S;S=E.useMemo(()=>{if(!(!(g!=null&&g.records)||!(g!=null&&g.records.length)))return IS({data:g==null?void 0:g.records,cardType:e.type,queryConfig:e.queryConfig,customCfg:e.customCfg,preferences:e.preferences,topoJson:w})},[g==null?void 0:g.records,e,w,o]);const k=E.useRef({filteringCards:i});E.useEffect(()=>{e.connectionId&&!_&&(c.current=l)},[l,a,e.connectionId,_]),E.useEffect(()=>{var I;_&&(k.current.filteringCards=[...i||[]]),!_&&((I=k.current.filteringCards)==null?void 0:I.find($=>$.id===e.id))&&C&&r($=>$+1)},[_,C,e.id,i]);function M(A,I,$,j){var F;let T=!1;if(!(g!=null&&g.records))return;const N=TJ({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(_){const z=e.id;f(z),p(e)}else{if(T=!0,!N)return;const z=[];N.forEach((B,O)=>{const q=u==null?void 0:u.find(P=>P.columnIndex===O);if(!q)return;const L={filterId:e.id+"-"+B.columnName+"-"+s,connectionId:e==null?void 0:e.connectionId,tableName:e.lastSelectedTable,name:B.columnName,expression:q.expression,valueType:pm(N[q.columnIndex].columnValue),operation:"=",values:[N[q.columnIndex].columnValue]};z.push(L)}),h(z),d(e)}DJ({chart:A,elementIndex:$,datasetIndex:I,cardType:e.type,cfg:S,apply:T})}}return{isError:x,isLoading:m,isFetching:y,data:g,visualKey:n,handleDatapointClick:M,cfg:S,queryKey:v}}function Ho({children:e,containerClassName:t,className:n,text:r,onSave:o,type:i="input",placeholder:s,enabled:a}){const[l,c]=E.useState(!1),[u,d]=E.useState(r),h=se(y=>y.isDashboardEditing);E.useEffect(()=>{d(y=>y!==r?r:y)},[r]);const f=y=>{y.stopPropagation(),h&&c(!0)};function p(y){if(y.stopPropagation(),y.key==="Escape"){c(!1);return}y.key==="Enter"&&y.shiftKey||(y.key==="Enter"||y.key==="Tab")&&(c(!1),o(u))}function g(){return i==="textarea"?b.jsx("textarea",{className:ie("resize rounded-sm bg-background px-2 py-1 text-sm outline-[0.5px] outline-muted",n),onChange:y=>d(y.target.value),value:u,autoFocus:!0,placeholder:s,onBlur:()=>c(!1),onKeyDown:p}):b.jsx("input",{onMouseDown:y=>y.stopPropagation(),type:"text",className:ie("rounded-sm bg-background px-2 py-1 text-sm outline-[0.5px] outline-muted",n),onChange:y=>d(y.target.value),value:u,autoFocus:!0,placeholder:s,onBlur:()=>c(!1),onKeyDown:p})}function m(){return a?b.jsxs("div",{className:"flex grow items-center gap-2",children:[b.jsx("div",{children:l?g():e}),!l&&b.jsx(eS,{onClick:()=>c(!0),className:"hidden size-3 cursor-pointer text-muted-foreground group-hover/editable:block"})]}):e}return b.jsx("div",{className:ie("flex",t),role:"editable",onDoubleClick:f,onMouseDown:y=>y.stopPropagation(),children:b.jsx("div",{className:"group/editable flex grow items-center gap-2",children:m()})})}function r5(e){const{authToken:t}=wr(),n=yz(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 kg({card:e,data:t}){var v,_,C,w,S,k,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=lt(B=>B.card),a=lt(B=>B.actions.setCard);lt(B=>B.actions.setNumberFormat);const{getCurrency:l,getLocale:c}=r5(e),u=se(B=>B.selectedSheetId),d=(_=(v=e.preferences)==null?void 0:v.formatNumber)==null?void 0:_.colorRanges,{metricKeys:h}=vn(t),f=(C=t==null?void 0:t[0])==null?void 0:C[h==null?void 0:h[0]],p=(w=t==null?void 0:t[0])==null?void 0:w[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 y(B){o?a({...s,description:B}):r(u,e.id,B)}const x=p&&p-f!==0?(f-p)/p:null;return b.jsxs("div",{className:"kpi-card flex grow flex-col overflow-auto",children:[b.jsxs(gm,{className:"grow pb-3",children:[b.jsx(Ho,{enabled:i,text:o?s.title:e.title,onSave:m,children:b.jsx("div",{className:"flex items-center gap-2",children:b.jsx(Kc,{className:"text-base font-medium text-muted-foreground",children:e.title})})}),g&&b.jsxs("div",{className:"flex flex-wrap items-end gap-3 text-foreground",children:[b.jsx("p",{style:{color:rS(f,d)},className:"text-3xl font-semibold",children:br({number:f,decimalPlaces:((k=(S=e.preferences)==null?void 0:S.formatNumber)==null?void 0:k.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&&b.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()||""})]})]})]}),x&&b.jsxs(mm,{className:"grow items-start gap-1 pb-4 text-sm",children:[b.jsx(o5,{children:x}),b.jsxs("div",{className:"flex gap-1 text-muted-foreground",children:[x>0?"up ":"down ",b.jsx(Ho,{enabled:i,text:e.description||"",onSave:y,children:e.description})]})]})]})}function o5({children:e,className:t}){var i,s;const n=se(a=>a.themeStyle),r=e>0?b.jsx("span",{children:"+"}):b.jsx("span",{children:"-"}),o=`${Math.abs(e*100).toFixed(0)}%`;return b.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,b.jsx("span",{className:"ml-[1px]",children:o})]})}const FJ=["top","right","bottom","left"],$i=Math.min,Bn=Math.max,Ud=Math.round,Xh=Math.floor,Wo=e=>({x:e,y:e}),LJ={left:"right",right:"left",bottom:"top",top:"bottom"},jJ={start:"end",end:"start"};function $x(e,t,n){return Bn(e,$i(t,n))}function Xo(e,t){return typeof e=="function"?e(t):e}function zi(e){return e.split("-")[0]}function tu(e){return e.split("-")[1]}function NS(e){return e==="x"?"y":"x"}function FS(e){return e==="y"?"height":"width"}function Cs(e){return["top","bottom"].includes(zi(e))?"y":"x"}function LS(e){return NS(Cs(e))}function $J(e,t,n){n===void 0&&(n=!1);const r=tu(e),o=LS(e),i=FS(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Pg(s)),[s,Pg(s)]}function zJ(e){const t=Pg(e);return[zx(e),t,zx(t)]}function zx(e){return e.replace(/start|end/g,t=>jJ[t])}function BJ(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 VJ(e,t,n,r){const o=tu(e);let i=BJ(zi(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(zx)))),i}function Pg(e){return e.replace(/left|right|bottom|top/g,t=>LJ[t])}function HJ(e){return{top:0,right:0,bottom:0,left:0,...e}}function i5(e){return typeof e!="number"?HJ(e):{top:e,right:e,bottom:e,left:e}}function Dg(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 Pk(e,t,n){let{reference:r,floating:o}=e;const i=Cs(t),s=LS(t),a=FS(s),l=zi(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(tu(t)){case"start":f[s]-=h*(n&&c?-1:1);break;case"end":f[s]+=h*(n&&c?-1:1);break}return f}const WJ=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}=Pk(c,r,l),h=r,f={},p=0;for(let g=0;g<a.length;g++){const{name:m,fn:y}=a[g],{x,y:v,data:_,reset:C}=await y({x:u,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:f,rects:c,platform:s,elements:{reference:e,floating:t}});u=x??u,d=v??d,f={...f,[m]:{...f[m],..._}},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}=Pk(c,h,l)),g=-1)}return{x:u,y:d,placement:h,strategy:o,middlewareData:f}};async function jc(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}=Xo(t,e),p=i5(f),m=a[h?d==="floating"?"reference":"floating":d],y=Dg(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})),x=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),_=await(i.isElement==null?void 0:i.isElement(v))?await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1}:{x:1,y:1},C=Dg(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:v,strategy:l}):x);return{top:(y.top-C.top+p.top)/_.y,bottom:(C.bottom-y.bottom+p.bottom)/_.y,left:(y.left-C.left+p.left)/_.x,right:(C.right-y.right+p.right)/_.x}}const qJ=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}=Xo(e,t)||{};if(c==null)return{};const d=i5(u),h={x:n,y:r},f=LS(o),p=FS(f),g=await s.getDimensions(c),m=f==="y",y=m?"top":"left",x=m?"bottom":"right",v=m?"clientHeight":"clientWidth",_=i.reference[p]+i.reference[f]-h[f]-i.floating[p],C=h[f]-i.reference[f],w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let S=w?w[v]:0;(!S||!await(s.isElement==null?void 0:s.isElement(w)))&&(S=a.floating[v]||i.floating[p]);const k=_/2-C/2,M=S/2-g[p]/2-1,D=$i(d[y],M),A=$i(d[x],M),I=D,$=S-g[p]-A,j=S/2-g[p]/2+k,T=$x(I,j,$),N=!l.arrow&&tu(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}}}),UJ=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}=Xo(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=zi(o),x=Cs(a),v=zi(a)===a,_=await(l.isRTL==null?void 0:l.isRTL(c.floating)),C=h||(v||!g?[Pg(a)]:zJ(a)),w=p!=="none";!h&&w&&C.push(...VJ(a,g,p,_));const S=[a,...C],k=await jc(t,m),M=[];let D=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&M.push(k[y]),d){const j=$J(o,s,_);M.push(k[j[0]],k[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=S[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(w){const B=Cs(z.placement);return B===x||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 Dk(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Mk(e){return FJ.some(t=>e[t]>=0)}const GJ=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Xo(e,t);switch(r){case"referenceHidden":{const i=await jc(t,{...o,elementContext:"reference"}),s=Dk(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Mk(s)}}}case"escaped":{const i=await jc(t,{...o,altBoundary:!0}),s=Dk(i,n.floating);return{data:{escapedOffsets:s,escaped:Mk(s)}}}default:return{}}}}};async function YJ(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=zi(n),a=tu(n),l=Cs(n)==="y",c=["left","top"].includes(s)?-1:1,u=i&&l?-1:1,d=Xo(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 KJ=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 YJ(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}}}}},XJ=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:y,y:x}=m;return{x:y,y:x}}},...l}=Xo(e,t),c={x:n,y:r},u=await jc(t,l),d=Cs(zi(o)),h=NS(d);let f=c[h],p=c[d];if(i){const m=h==="y"?"top":"left",y=h==="y"?"bottom":"right",x=f+u[m],v=f-u[y];f=$x(x,f,v)}if(s){const m=d==="y"?"top":"left",y=d==="y"?"bottom":"right",x=p+u[m],v=p-u[y];p=$x(x,p,v)}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}}}}}},QJ=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}=Xo(e,t),u={x:n,y:r},d=Cs(o),h=NS(d);let f=u[h],p=u[d];const g=Xo(a,t),m=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const v=h==="y"?"height":"width",_=i.reference[h]-i.floating[v]+m.mainAxis,C=i.reference[h]+i.reference[v]-m.mainAxis;f<_?f=_:f>C&&(f=C)}if(c){var y,x;const v=h==="y"?"width":"height",_=["top","left"].includes(zi(o)),C=i.reference[d]-i.floating[v]+(_&&((y=s.offset)==null?void 0:y[d])||0)+(_?0:m.crossAxis),w=i.reference[d]+i.reference[v]+(_?0:((x=s.offset)==null?void 0:x[d])||0)-(_?m.crossAxis:0);p<C?p=C:p>w&&(p=w)}return{[h]:f,[d]:p}}}},ZJ=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}=Xo(e,t),u=await jc(t,c),d=zi(o),h=tu(o),f=Cs(o)==="y",{width:p,height:g}=i.floating;let m,y;d==="top"||d==="bottom"?(m=d,y=h===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,m=h==="end"?"top":"bottom");const x=g-u.top-u.bottom,v=p-u.left-u.right,_=$i(g-u[m],x),C=$i(p-u[y],v),w=!t.middlewareData.shift;let S=_,k=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(k=v),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(S=x),w&&!h){const D=Bn(u.left,0),A=Bn(u.right,0),I=Bn(u.top,0),$=Bn(u.bottom,0);f?k=p-2*(D!==0||A!==0?D+A:Bn(u.left,u.right)):S=g-2*(I!==0||$!==0?I+$:Bn(u.top,u.bottom))}await l({...t,availableWidth:k,availableHeight:S});const M=await s.getDimensions(a.floating);return p!==M.width||g!==M.height?{reset:{rects:!0}}:{}}}};function Gm(){return typeof window<"u"}function nu(e){return s5(e)?(e.nodeName||"").toLowerCase():"#document"}function Ir(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ii(e){var t;return(t=(s5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function s5(e){return Gm()?e instanceof Node||e instanceof Ir(e).Node:!1}function Wn(e){return Gm()?e instanceof Element||e instanceof Ir(e).Element:!1}function Qo(e){return Gm()?e instanceof HTMLElement||e instanceof Ir(e).HTMLElement:!1}function Ok(e){return!Gm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ir(e).ShadowRoot}function Of(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=go(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function JJ(e){return["table","td","th"].includes(nu(e))}function Ym(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function jS(e){const t=$S(),n=Wn(e)?go(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 eee(e){let t=_s(e);for(;Qo(t)&&!$c(t);){if(jS(t))return t;if(Ym(t))return null;t=_s(t)}return null}function $S(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function $c(e){return["html","body","#document"].includes(nu(e))}function go(e){return Ir(e).getComputedStyle(e)}function Km(e){return Wn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function _s(e){if(nu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ok(e)&&e.host||ii(e);return Ok(t)?t.host:t}function a5(e){const t=_s(e);return $c(t)?e.ownerDocument?e.ownerDocument.body:e.body:Qo(t)&&Of(t)?t:a5(t)}function Gd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=a5(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Ir(o);if(i){const a=Bx(s);return t.concat(s,s.visualViewport||[],Of(o)?o:[],a&&n?Gd(a):[])}return t.concat(o,Gd(o,[],n))}function Bx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function l5(e){const t=go(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Qo(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Ud(n)!==i||Ud(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function zS(e){return Wn(e)?e:e.contextElement}function ec(e){const t=zS(e);if(!Qo(t))return Wo(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=l5(t);let s=(i?Ud(n.width):n.width)/r,a=(i?Ud(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const tee=Wo(0);function c5(e){const t=Ir(e);return!$S()||!t.visualViewport?tee:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nee(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ir(e)?!1:t}function Qa(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=zS(e);let s=Wo(1);t&&(r?Wn(r)&&(s=ec(r)):s=ec(e));const a=nee(i,n,r)?c5(i):Wo(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=Ir(i),f=r&&Wn(r)?Ir(r):r;let p=h,g=Bx(p);for(;g&&r&&f!==p;){const m=ec(g),y=g.getBoundingClientRect(),x=go(g),v=y.left+(g.clientLeft+parseFloat(x.paddingLeft))*m.x,_=y.top+(g.clientTop+parseFloat(x.paddingTop))*m.y;l*=m.x,c*=m.y,u*=m.x,d*=m.y,l+=v,c+=_,p=Ir(g),g=Bx(p)}}return Dg({width:u,height:d,x:l,y:c})}function BS(e,t){const n=Km(e).scrollLeft;return t?t.left+n:Qa(ii(e)).left+n}function u5(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:BS(e,r)),i=r.top+t.scrollTop;return{x:o,y:i}}function ree(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=ii(r),a=t?Ym(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Wo(1);const u=Wo(0),d=Qo(r);if((d||!d&&!i)&&((nu(r)!=="body"||Of(s))&&(l=Km(r)),Qo(r))){const f=Qa(r);c=ec(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const h=s&&!d&&!i?u5(s,l,!0):Wo(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 oee(e){return Array.from(e.getClientRects())}function iee(e){const t=ii(e),n=Km(e),r=e.ownerDocument.body,o=Bn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Bn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+BS(e);const a=-n.scrollTop;return go(r).direction==="rtl"&&(s+=Bn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function see(e,t){const n=Ir(e),r=ii(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=$S();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function aee(e,t){const n=Qa(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Qo(e)?ec(e):Wo(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 Ak(e,t,n){let r;if(t==="viewport")r=see(e,n);else if(t==="document")r=iee(ii(e));else if(Wn(t))r=aee(t,n);else{const o=c5(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Dg(r)}function d5(e,t){const n=_s(e);return n===t||!Wn(n)||$c(n)?!1:go(n).position==="fixed"||d5(n,t)}function lee(e,t){const n=t.get(e);if(n)return n;let r=Gd(e,[],!1).filter(a=>Wn(a)&&nu(a)!=="body"),o=null;const i=go(e).position==="fixed";let s=i?_s(e):e;for(;Wn(s)&&!$c(s);){const a=go(s),l=jS(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Of(s)&&!l&&d5(e,s))?r=r.filter(u=>u!==s):o=a,s=_s(s)}return t.set(e,r),r}function cee(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?Ym(t)?[]:lee(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const d=Ak(t,u,o);return c.top=Bn(d.top,c.top),c.right=$i(d.right,c.right),c.bottom=$i(d.bottom,c.bottom),c.left=Bn(d.left,c.left),c},Ak(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function uee(e){const{width:t,height:n}=l5(e);return{width:t,height:n}}function dee(e,t,n){const r=Qo(t),o=ii(t),i=n==="fixed",s=Qa(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Wo(0);if(r||!r&&!i)if((nu(t)!=="body"||Of(o))&&(a=Km(t)),r){const h=Qa(t,!0,i,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else o&&(l.x=BS(o));const c=o&&!r&&!i?u5(o,a):Wo(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 J0(e){return go(e).position==="static"}function Tk(e,t){if(!Qo(e)||go(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ii(e)===n&&(n=n.ownerDocument.body),n}function f5(e,t){const n=Ir(e);if(Ym(e))return n;if(!Qo(e)){let o=_s(e);for(;o&&!$c(o);){if(Wn(o)&&!J0(o))return o;o=_s(o)}return n}let r=Tk(e,t);for(;r&&JJ(r)&&J0(r);)r=Tk(r,t);return r&&$c(r)&&J0(r)&&!jS(r)?n:r||eee(e)||n}const fee=async function(e){const t=this.getOffsetParent||f5,n=this.getDimensions,r=await n(e.floating);return{reference:dee(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function hee(e){return go(e).direction==="rtl"}const pee={convertOffsetParentRelativeRectToViewportRelativeRect:ree,getDocumentElement:ii,getClippingRect:cee,getOffsetParent:f5,getElementRects:fee,getClientRects:oee,getDimensions:uee,getScale:ec,isElement:Wn,isRTL:hee};function h5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function gee(e,t){let n=null,r;const o=ii(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=Xh(d),g=Xh(o.clientWidth-(u+h)),m=Xh(o.clientHeight-(d+f)),y=Xh(u),v={rootMargin:-p+"px "+-g+"px "+-m+"px "+-y+"px",threshold:Bn(0,$i(1,l))||1};let _=!0;function C(w){const S=w[0].intersectionRatio;if(S!==l){if(!_)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}S===1&&!h5(c,e.getBoundingClientRect())&&s(),_=!1}try{n=new IntersectionObserver(C,{...v,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,v)}n.observe(e)}return s(!0),i}function p5(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=zS(e),u=o||i?[...c?Gd(c):[],...Gd(t)]:[];u.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const d=c&&a?gee(c,n):null;let h=-1,f=null;s&&(f=new ResizeObserver(y=>{let[x]=y;x&&x.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(t)})),n()}),c&&!l&&f.observe(c),f.observe(t));let p,g=l?Qa(e):null;l&&m();function m(){const y=Qa(e);g&&!h5(g,y)&&n(),g=y,p=requestAnimationFrame(m)}return n(),()=>{var y;u.forEach(x=>{o&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),d==null||d(),(y=f)==null||y.disconnect(),f=null,l&&cancelAnimationFrame(p)}}const ey=jc,mee=KJ,bee=XJ,yee=UJ,vee=ZJ,xee=GJ,Ik=qJ,wee=QJ,See=(e,t,n)=>{const r=new Map,o={platform:pee,...n},i={...o.platform,_c:r};return WJ(e,t,{...o,platform:i})};var Lp=typeof document<"u"?E.useLayoutEffect:E.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 g5(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Nk(e,t){const n=g5(e);return Math.round(t*n)/n}function ty(e){const t=R.useRef(e);return Lp(()=>{t.current=e}),t}function m5(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,y]=R.useState(null),x=R.useCallback(z=>{z!==w.current&&(w.current=z,g(z))},[]),v=R.useCallback(z=>{z!==S.current&&(S.current=z,y(z))},[]),_=i||p,C=s||m,w=R.useRef(null),S=R.useRef(null),k=R.useRef(u),M=l!=null,D=ty(l),A=ty(o),I=ty(c),$=R.useCallback(()=>{if(!w.current||!S.current)return;const z={placement:t,strategy:n,middleware:h};A.current&&(z.platform=A.current),See(w.current,S.current,z).then(B=>{const O={...B,isPositioned:I.current!==!1};j.current&&!Mg(k.current,O)&&(k.current=O,za.flushSync(()=>{d(O)}))})},[h,t,n,A,I]);Lp(()=>{c===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,d(z=>({...z,isPositioned:!1})))},[c]);const j=R.useRef(!1);Lp(()=>(j.current=!0,()=>{j.current=!1}),[]),Lp(()=>{if(_&&(w.current=_),C&&(S.current=C),_&&C){if(D.current)return D.current(_,C,$);$()}},[_,C,$,D,M]);const T=R.useMemo(()=>({reference:w,floating:S,setReference:x,setFloating:v}),[x,v]),N=R.useMemo(()=>({reference:_,floating:C}),[_,C]),F=R.useMemo(()=>{const z={position:n,left:0,top:0};if(!N.floating)return z;const B=Nk(N.floating,u.x),O=Nk(N.floating,u.y);return a?{...z,transform:"translate("+B+"px, "+O+"px)",...g5(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 Cee=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?Ik({element:r.current,padding:o}).fn(n):{}:r?Ik({element:r,padding:o}).fn(n):{}}}},VS=(e,t)=>({...mee(e),options:[e,t]}),b5=(e,t)=>({...bee(e),options:[e,t]}),_ee=(e,t)=>({...wee(e),options:[e,t]}),y5=(e,t)=>({...yee(e),options:[e,t]}),v5=(e,t)=>({...vee(e),options:[e,t]}),Eee=(e,t)=>({...xee(e),options:[e,t]}),Ree=(e,t)=>({...Cee(e),options:[e,t]});var kee="Arrow",x5=R.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return b.jsx(be.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:b.jsx("polygon",{points:"0,0 30,0 15,10"})})});x5.displayName=kee;var Pee=x5;function Xm(e){const[t,n]=R.useState(void 0);return An(()=>{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 HS="Popper",[w5,si]=xn(HS),[Dee,S5]=w5(HS),C5=e=>{const{__scopePopper:t,children:n}=e,[r,o]=R.useState(null);return b.jsx(Dee,{scope:t,anchor:r,onAnchorChange:o,children:n})};C5.displayName=HS;var _5="PopperAnchor",E5=R.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=S5(_5,n),s=R.useRef(null),a=Te(t,s);return R.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:b.jsx(be.div,{...o,ref:a})});E5.displayName=_5;var WS="PopperContent",[Mee,Oee]=w5(WS),R5=R.forwardRef((e,t)=>{var W,G,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=S5(WS,n),[y,x]=R.useState(null),v=Te(t,oe=>x(oe)),[_,C]=R.useState(null),w=Xm(_),S=(w==null?void 0:w.width)??0,k=(w==null?void 0:w.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(Tee),altBoundary:I},{refs:j,floatingStyles:T,placement:N,isPositioned:F,middlewareData:z}=m5({strategy:"fixed",placement:M,whileElementsMounted:(...oe)=>p5(...oe,{animationFrame:f==="always"}),elements:{reference:m.anchor},middleware:[VS({mainAxis:o+k,alignmentAxis:s}),l&&b5({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?_ee():void 0,...$}),l&&y5({...$}),v5({...$,apply:({elements:oe,rects:ee,availableWidth:ue,availableHeight:pe})=>{const{width:we,height:me}=ee.reference,ye=oe.floating.style;ye.setProperty("--radix-popper-available-width",`${ue}px`),ye.setProperty("--radix-popper-available-height",`${pe}px`),ye.setProperty("--radix-popper-anchor-width",`${we}px`),ye.setProperty("--radix-popper-anchor-height",`${me}px`)}}),_&&Ree({element:_,padding:a}),Iee({arrowWidth:S,arrowHeight:k}),h&&Eee({strategy:"referenceHidden",...$})]}),[B,O]=D5(N),q=yn(p);An(()=>{F&&(q==null||q())},[F,q]);const L=(W=z.arrow)==null?void 0:W.x,P=(G=z.arrow)==null?void 0:G.y,H=((X=z.arrow)==null?void 0:X.centerOffset)!==0,[U,Y]=R.useState();return An(()=>{y&&Y(window.getComputedStyle(y).zIndex)},[y]),b.jsx("div",{ref:j.setFloating,"data-radix-popper-content-wrapper":"",style:{...T,transform:F?T.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--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:b.jsx(Mee,{scope:n,placedSide:B,onArrowChange:C,arrowX:L,arrowY:P,shouldHideArrow:H,children:b.jsx(be.div,{"data-side":B,"data-align":O,...g,ref:v,style:{...g.style,animation:F?void 0:"none"}})})})});R5.displayName=WS;var k5="PopperArrow",Aee={top:"bottom",right:"left",bottom:"top",left:"right"},P5=R.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=Oee(k5,r),s=Aee[i.placedSide];return b.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:b.jsx(Pee,{...o,ref:n,style:{...o.style,display:"block"}})})});P5.displayName=k5;function Tee(e){return e!==null}var Iee=e=>({name:"transformOrigin",options:e,fn(t){var m,y,x;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]=D5(n),d={start:"0%",center:"50%",end:"100%"}[u],h=(((y=o.arrow)==null?void 0:y.x)??0)+a/2,f=(((x=o.arrow)==null?void 0:x.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 D5(e){const[t,n="center"]=e.split("-");return[t,n]}var Af=C5,ru=E5,Tf=R5,If=P5,Nee="Portal",Nf=R.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=R.useState(!1);An(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?en.createPortal(b.jsx(be.div,{...r,ref:t}),s):null});Nf.displayName=Nee;function Fee(e,t=globalThis==null?void 0:globalThis.document){const n=yn(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 Lee="DismissableLayer",Vx="dismissableLayer.update",jee="dismissableLayer.pointerDownOutside",$ee="dismissableLayer.focusOutside",Fk,M5=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fl=R.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=e,c=R.useContext(M5),[u,d]=R.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=R.useState({}),p=Te(t,S=>d(S)),g=Array.from(c.layers),[m]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=g.indexOf(m),x=u?g.indexOf(u):-1,v=c.layersWithOutsidePointerEventsDisabled.size>0,_=x>=y,C=Vee(S=>{const k=S.target,M=[...c.branches].some(D=>D.contains(k));!_||M||(o==null||o(S),s==null||s(S),S.defaultPrevented||a==null||a())},h),w=Hee(S=>{const k=S.target;[...c.branches].some(D=>D.contains(k))||(i==null||i(S),s==null||s(S),S.defaultPrevented||a==null||a())},h);return Fee(S=>{x===c.layers.size-1&&(r==null||r(S),!S.defaultPrevented&&a&&(S.preventDefault(),a()))},h),R.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Fk=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),Lk(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Fk)}},[u,h,n,c]),R.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),Lk())},[u,c]),R.useEffect(()=>{const S=()=>f({});return document.addEventListener(Vx,S),()=>document.removeEventListener(Vx,S)},[]),b.jsx(be.div,{...l,ref:p,style:{pointerEvents:v?_?"auto":"none":void 0,...e.style},onFocusCapture:de(e.onFocusCapture,w.onFocusCapture),onBlurCapture:de(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:de(e.onPointerDownCapture,C.onPointerDownCapture)})});fl.displayName=Lee;var zee="DismissableLayerBranch",Bee=R.forwardRef((e,t)=>{const n=R.useContext(M5),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]),b.jsx(be.div,{...e,ref:o})});Bee.displayName=zee;function Vee(e,t=globalThis==null?void 0:globalThis.document){const n=yn(e),r=R.useRef(!1),o=R.useRef(()=>{});return R.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let l=function(){O5(jee,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 Hee(e,t=globalThis==null?void 0:globalThis.document){const n=yn(e),r=R.useRef(!1);return R.useEffect(()=>{const o=i=>{i.target&&!r.current&&O5($ee,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 Lk(){const e=new CustomEvent(Vx);document.dispatchEvent(e)}function O5(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?PO(o,i):o.dispatchEvent(i)}var ny,qS="HoverCard",[A5,n2e]=xn(qS,[si]),Qm=si(),[Wee,US]=A5(qS),T5=e=>{const{__scopeHoverCard:t,children:n,open:r,defaultOpen:o,onOpenChange:i,openDelay:s=700,closeDelay:a=300}=e,l=Qm(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]),y=R.useCallback(()=>p(!1),[p]);return R.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(u.current)},[]),b.jsx(Wee,{scope:t,open:f,onOpenChange:p,onOpen:g,onClose:m,onDismiss:y,hasSelectionRef:d,isPointerDownOnContentRef:h,children:b.jsx(Af,{...l,children:n})})};T5.displayName=qS;var I5="HoverCardTrigger",N5=R.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=US(I5,n),i=Qm(n);return b.jsx(ru,{asChild:!0,...i,children:b.jsx(be.a,{"data-state":o.open?"open":"closed",...r,ref:t,onPointerEnter:de(e.onPointerEnter,Ag(o.onOpen)),onPointerLeave:de(e.onPointerLeave,Ag(o.onClose)),onFocus:de(e.onFocus,o.onOpen),onBlur:de(e.onBlur,o.onClose),onTouchStart:de(e.onTouchStart,s=>s.preventDefault())})})});N5.displayName=I5;var qee="HoverCardPortal",[r2e,Uee]=A5(qee,{forceMount:void 0}),Og="HoverCardContent",F5=R.forwardRef((e,t)=>{const n=Uee(Og,e.__scopeHoverCard),{forceMount:r=n.forceMount,...o}=e,i=US(Og,e.__scopeHoverCard);return b.jsx(gn,{present:r||i.open,children:b.jsx(Gee,{"data-state":i.open?"open":"closed",...o,onPointerEnter:de(e.onPointerEnter,Ag(i.onOpen)),onPointerLeave:de(e.onPointerLeave,Ag(i.onClose)),ref:t})})});F5.displayName=Og;var Gee=R.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,...a}=e,l=US(Og,n),c=Qm(n),u=R.useRef(null),d=Te(t,u),[h,f]=R.useState(!1);return R.useEffect(()=>{if(h){const p=document.body;return ny=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=ny,p.style.webkitUserSelect=ny}}},[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&&Xee(u.current).forEach(g=>g.setAttribute("tabindex","-1"))}),b.jsx(fl,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:s,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:de(i,p=>{p.preventDefault()}),onDismiss:l.onDismiss,children:b.jsx(Tf,{...c,...a,onPointerDown:de(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)"}})})}),Yee="HoverCardArrow",Kee=R.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=Qm(n);return b.jsx(If,{...o,...r,ref:t})});Kee.displayName=Yee;function Ag(e){return t=>t.pointerType==="touch"?void 0:e()}function Xee(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 Qee=T5,Zee=N5,L5=F5;const Zm=Qee,Jm=Zee,Ff=R.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>b.jsx(L5,{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}));Ff.displayName=L5.displayName;function j5({card:e}){const t=se(r=>r.isDashboardEditing),{setCardInfo:n}=rn();return b.jsxs(Zm,{openDelay:0,children:[b.jsx(Jm,{children:b.jsx(KA,{className:"size-4 text-muted-foreground/40"})}),b.jsx(Ff,{align:"start",className:"w-[300px] text-sm text-muted-foreground",onMouseDown:r=>r.stopPropagation(),children:b.jsx(Ho,{enabled:t,type:"textarea",text:e.info||"",onSave:r=>n(e.id,r),children:e.info||"Describe what this card shows"})})]})}function Jee({card:e,renderFilterInfo:t}){var p,g,m,y,x,v,_,C,w,S,k,M,D,A,I,$;se(j=>j.themeStyle);const{data:n,isLoading:r}=Li(e),o=(n==null?void 0:n.records)||[],i=se(j=>j.isDashboardEditing),{getCurrency:s,getLocale:a}=r5(e),l=(g=(p=e.preferences)==null?void 0:p.formatNumber)==null?void 0:g.colorRanges,{metricKeys:c}=vn(o||[]),u=(m=o==null?void 0:o[0])==null?void 0:m[c==null?void 0:c[0]],d=(y=o==null?void 0:o[0])==null?void 0:y[c==null?void 0:c[1]],h=(o==null?void 0:o.length)>0,f=d&&d-u!==0?(u-d)/d:null;return b.jsx("div",{className:"flex min-w-fit grow flex-col overflow-auto",children:b.jsxs("div",{className:"grow",children:[h?b.jsx("div",{className:"",children:b.jsxs("div",{className:ie("flex items-end gap-1.5",{"animate-pulse":r}),children:[b.jsx("p",{style:{color:rS(u,l)},className:"text-3xl font-semibold",children:br({number:u,decimalPlaces:((v=(x=e.preferences)==null?void 0:x.formatNumber)==null?void 0:v.decimalPlaces)||0,useSuffix:!!((C=(_=e.preferences)==null?void 0:_.formatNumber)!=null&&C.suffix),customSuffix:((S=(w=e.preferences)==null?void 0:w.formatNumber)==null?void 0:S.suffix)||"",locale:a()||"",currency:s()||""})}),f&&b.jsxs("div",{className:"flex items-end gap-1",children:[b.jsx(o5,{className:"",children:f}),d&&b.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=(k=e.preferences)==null?void 0:k.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()||""})}`})]})]})}):b.jsx("div",{className:"flex h-9 items-center justify-center"}),b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsxs(Kc,{className:"flex items-center gap-2 text-base font-medium text-muted-foreground",children:[e.title,(i||e.info)&&b.jsx(j5,{card:e})]}),t==null?void 0:t()]})]})})}var ete="VisuallyHidden",GS=R.forwardRef((e,t)=>b.jsx(be.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}}));GS.displayName=ete;var tte=GS,[eb,o2e]=xn("Tooltip",[si]),tb=si(),$5="TooltipProvider",nte=700,Hx="tooltip.open",[rte,YS]=eb($5),KS=e=>{const{__scopeTooltip:t,delayDuration:n=nte,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)},[]),b.jsx(rte,{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})};KS.displayName=$5;var nb="Tooltip",[ote,rb]=eb(nb),z5=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=YS(nb,e.__scopeTooltip),c=tb(t),[u,d]=R.useState(null),h=hn(),f=R.useRef(0),p=s??l.disableHoverableContent,g=a??l.delayDuration,m=R.useRef(!1),[y=!1,x]=Un({prop:r,defaultProp:o,onChange:S=>{S?(l.onOpen(),document.dispatchEvent(new CustomEvent(Hx))):l.onClose(),i==null||i(S)}}),v=R.useMemo(()=>y?m.current?"delayed-open":"instant-open":"closed",[y]),_=R.useCallback(()=>{window.clearTimeout(f.current),f.current=0,m.current=!1,x(!0)},[x]),C=R.useCallback(()=>{window.clearTimeout(f.current),f.current=0,x(!1)},[x]),w=R.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{m.current=!0,x(!0),f.current=0},g)},[g,x]);return R.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),b.jsx(Af,{...c,children:b.jsx(ote,{scope:t,contentId:h,open:y,stateAttribute:v,trigger:u,onTriggerChange:d,onTriggerEnter:R.useCallback(()=>{l.isOpenDelayed?w():_()},[l.isOpenDelayed,w,_]),onTriggerLeave:R.useCallback(()=>{p?C():(window.clearTimeout(f.current),f.current=0)},[C,p]),onOpen:_,onClose:C,disableHoverableContent:p,children:n})})};z5.displayName=nb;var Wx="TooltipTrigger",XS=R.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=rb(Wx,n),i=YS(Wx,n),s=tb(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]),b.jsx(ru,{asChild:!0,...s,children:b.jsx(be.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:de(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:de(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:de(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:de(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:de(e.onBlur,o.onClose),onClick:de(e.onClick,o.onClose)})})});XS.displayName=Wx;var ite="TooltipPortal",[i2e,ste]=eb(ite,{forceMount:void 0}),zc="TooltipContent",B5=R.forwardRef((e,t)=>{const n=ste(zc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=rb(zc,e.__scopeTooltip);return b.jsx(gn,{present:r||s.open,children:s.disableHoverableContent?b.jsx(V5,{side:o,...i,ref:t}):b.jsx(ate,{side:o,...i,ref:t})})}),ate=R.forwardRef((e,t)=>{const n=rb(zc,e.__scopeTooltip),r=YS(zc,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,y={x:p.clientX,y:p.clientY},x=dte(y,m.getBoundingClientRect()),v=fte(y,x),_=hte(g.getBoundingClientRect()),C=gte([...v,..._]);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,y={x:g.clientX,y:g.clientY},x=(l==null?void 0:l.contains(m))||(u==null?void 0:u.contains(m)),v=!pte(y,s);x?h():v&&(h(),c())};return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[l,u,s,c,h]),b.jsx(V5,{...e,ref:i})}),[lte,cte]=eb(nb,{isInside:!1}),V5=R.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=rb(zc,n),c=tb(n),{onClose:u}=l;return R.useEffect(()=>(document.addEventListener(Hx,u),()=>document.removeEventListener(Hx,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]),b.jsx(fl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:b.jsxs(Tf,{"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:[b.jsx(S1,{children:r}),b.jsx(lte,{scope:n,isInside:!0,children:b.jsx(tte,{id:l.contentId,role:"tooltip",children:o||r})})]})})});B5.displayName=zc;var H5="TooltipArrow",ute=R.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=tb(n);return cte(H5,n).isInside?null:b.jsx(If,{...o,...r,ref:t})});ute.displayName=H5;function dte(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 fte(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 hte(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 pte(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 gte(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),mte(t)}function mte(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 bte=KS,yte=z5,vte=XS,W5=B5;const q5=bte,QS=yte,ZS=vte,ob=R.forwardRef(({className:e,sideOffset:t=4,...n},r)=>b.jsx(W5,{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}));ob.displayName=W5.displayName;function Tg({card:e,isLoading:t,data:n}){var h,f;const r=n||[],{keys:o}=vn(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}=rn(),{setCard:c}=Nm();function u(){var y;if(t)return b.jsxs("div",{className:"space-y-2",children:[b.jsx(Ra,{className:"h-3 w-full animate-pulse bg-muted"}),b.jsx(Ra,{className:"h-3 w-3/4 animate-pulse bg-muted"}),b.jsx(Ra,{className:"h-3 w-1/2 animate-pulse bg-muted"})]});const g=(y=r==null?void 0:r[0])==null?void 0:y[o[0]],m=b.jsx("div",{dangerouslySetInnerHTML:{__html:g}});return b.jsx("div",{className:"text-sm text-foreground/80 hover:cursor-text",onMouseDown:x=>x.stopPropagation(),children:m})}function d(){const p=(e==null?void 0:e.description)||"";return b.jsx("div",{onMouseDown:g=>g.stopPropagation(),children:b.jsx(Ho,{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:b.jsx("div",{className:"text-sm text-foreground/70 hover:cursor-text",dangerouslySetInnerHTML:{__html:p}})})})}return b.jsxs(b.Fragment,{children:[!a&&d(),a===!0&&u()]})}const jk=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,$k=Ba,JS=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return $k(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=jk(u)||jk(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 $k(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},Yd=JS("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"}}),nn=R.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?Fi:"button";return b.jsx(s,{className:ie(Yd({variant:t,size:n,className:e})),ref:i,...o})});nn.displayName="Button";var xte="Label",U5=R.forwardRef((e,t)=>b.jsx(be.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())}}));U5.displayName=xte;var G5=U5;const wte=JS("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),jt=R.forwardRef(({className:e,...t},n)=>b.jsx(G5,{ref:n,className:ie(wte(),e),...t}));jt.displayName=G5.displayName;var Ste="Separator",zk="horizontal",Cte=["horizontal","vertical"],Y5=R.forwardRef((e,t)=>{const{decorative:n,orientation:r=zk,...o}=e,i=_te(r)?r:zk,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return b.jsx(be.div,{"data-orientation":i,...a,...o,ref:t})});Y5.displayName=Ste;function _te(e){return Cte.includes(e)}var K5=Y5;const ib=R.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>b.jsx(K5,{ref:o,decorative:n,orientation:t,className:ie("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));ib.displayName=K5.displayName;function Ete(){const e=se(w=>w.isDashboardEditing),t=se(w=>w.dashboard.defaultFilterValues),n=se(w=>w.themeStyle),r=se(w=>w.filterValues),o=se(w=>w.dashboard.filters),i=se(w=>w.filteringCards),s=se(w=>w.selectedSheetId),a=se(w=>w.onSaveFunction),{removeFilterValues:l,removeFilteringCard:c,setFilterValues:u,setFilteringCards:d,setDefaultFilterValues:h,getDashboard:f}=rn(),p=o==null?void 0:o.filter(w=>w.sheetId===s||!w.sheetId),g=r==null?void 0:r.filter(w=>(p==null?void 0:p.some(S=>S.id===w.filterId))||w.filterId.endsWith(s));if(!g||g.length===0)return null;const m=g.map(w=>{const S=o==null?void 0:o.find(k=>k.id===w.filterId);return{filterId:w.filterId,name:(S==null?void 0:S.title)||w.name,values:w.values,dataType:S==null?void 0:S.dataType}});function y(w){return w instanceof Date?w.toLocaleDateString():w}function x(w){const S=i==null?void 0:i.find(k=>w.filterId.startsWith(k.id));S&&c(S),l(w.filterId)}function v(w){const S=il(w.dataType||"");function k(){return w.values.map((D,A)=>b.jsx("div",{style:{borderRadius:n==null?void 0:n.cardBorderRadius},className:"inline-block",children:y(D)},(D==null?void 0:D.toString())+A))}function M(){console.log(w.values);const D=w.values[0],A=w.values[1];if(console.log(D,A),!D||!A)return null;const I=new Date(D),$=new Date(A);return`${I.toLocaleDateString()} - ${$.toLocaleDateString()}`}return b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{style:{borderRadius:n==null?void 0:n.controlInputRadius},className:"flex w-fit items-center gap-2 rounded-sm border border-border bg-muted px-2 py-1",children:[b.jsx("span",{className:"break-words",children:w.name}),b.jsx(ul,{onClick:()=>x(w),className:"size-3 hover:cursor-pointer"})]}),b.jsx("div",{className:"flex flex-col gap-1 px-1",children:S?M():k()})]})}function _(w){const S=f();S&&(a==null||a(S,w))}function C(){return b.jsxs(b.Fragment,{children:[b.jsx(ib,{}),b.jsxs("div",{className:"space-y-3",children:[b.jsx("p",{className:"text-xs text-muted-foreground",children:"Start with these filters? Set them as default."}),b.jsxs("div",{className:"flex flex-row-reverse gap-2",children:[b.jsxs(nn,{onClick:()=>{h(r||[]),_("Default filter values set")},style:{borderRadius:n==null?void 0:n.controlInputRadius},className:"h-7 text-xs",variant:"outline",children:[t&&(t==null?void 0:t.length)>0&&b.jsx(Os,{className:"mr-2 size-3.5 text-green-500"}),"Set Dashboard Default"]}),b.jsx(nn,{onClick:()=>{h(void 0),_("Default filter values reset")},style:{borderRadius:n==null?void 0:n.controlInputRadius},className:"h-7 text-xs",variant:"secondary",children:"Reset"})]})]})]})}return b.jsxs(Zm,{openDelay:50,children:[b.jsx(Jm,{children:b.jsx(GA,{onClick:()=>{d([]),u([])},className:"size-3.5 text-muted-foreground hover:cursor-pointer"})}),b.jsxs(Ff,{onMouseDown:w=>w.stopPropagation(),style:{borderRadius:n==null?void 0:n.cardBorderRadius},className:"min-h-fit w-[310px] flex-col space-y-3 px-5 text-xs",align:"start",children:[b.jsxs("div",{children:[b.jsx(jt,{className:"font-medium leading-none",children:"Filter Context"}),b.jsx("p",{className:"text-xs text-muted-foreground",children:"Showing results with the following filters."})]}),b.jsx("div",{className:"h-fit max-h-[150px] min-h-0 grow space-y-3 overflow-auto",children:m==null?void 0:m.map(w=>b.jsx("div",{children:v(w)},w.name))}),e&&C()]})]})}const Rte=R.forwardRef(({className:e,containerClassName:t,containerStyle:n,...r},o)=>b.jsx("div",{style:n,className:ie("relative w-full overflow-auto",t),children:b.jsx("table",{ref:o,className:ie("w-full caption-bottom text-sm",e),...r})}));Rte.displayName="Table";const eC=R.forwardRef(({className:e,...t},n)=>b.jsx("thead",{ref:n,className:ie("[&_tr]:border-b",e),...t}));eC.displayName="TableHeader";const tC=R.forwardRef(({className:e,...t},n)=>b.jsx("tbody",{ref:n,className:ie("[&_tr:last-child]:border-0",e),...t}));tC.displayName="TableBody";const kte=R.forwardRef(({className:e,...t},n)=>b.jsx("tfoot",{ref:n,className:ie("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));kte.displayName="TableFooter";const hd=R.forwardRef(({className:e,...t},n)=>b.jsx("tr",{ref:n,className:ie("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));hd.displayName="TableRow";const nC=R.forwardRef(({className:e,...t},n)=>b.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}));nC.displayName="TableHead";const Ig=R.forwardRef(({className:e,...t},n)=>b.jsx("td",{ref:n,className:ie("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Ig.displayName="TableCell";const Pte=R.forwardRef(({className:e,...t},n)=>b.jsx("caption",{ref:n,className:ie("mt-4 text-sm text-muted-foreground",e),...t}));Pte.displayName="TableCaption";/**
|
|
245
|
+
`):e}function GK(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 RR(e,t){const n=e.chart.ctx,{body:r,footer:o,title:i}=e,{boxWidth:s,boxHeight:a}=t,l=fn(t.bodyFont),c=fn(t.titleFont),u=fn(t.footerFont),d=i.length,h=o.length,f=r.length,p=Tn(t.padding);let g=p.height,m=0,y=r.reduce((_,C)=>_+C.before.length+C.lines.length+C.after.length,0);if(y+=e.beforeBody.length+e.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),y){const _=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;g+=f*_+(y-f)*l.lineHeight+(y-1)*t.bodySpacing}h&&(g+=t.footerMarginTop+h*u.lineHeight+(h-1)*t.footerSpacing);let x=0;const v=function(_){m=Math.max(m,n.measureText(_).width+x)};return n.save(),n.font=c.string,xt(e.title,v),n.font=l.string,xt(e.beforeBody.concat(e.afterBody),v),x=t.displayColors?s+2+t.boxPadding:0,xt(r,_=>{xt(_.before,v),xt(_.lines,v),xt(_.after,v)}),x=0,n.font=u.string,xt(e.footer,v),n.restore(),m+=p.width,{width:m,height:g}}function YK(e,t){const{y:n,height:r}=t;return n<r/2?"top":n>e.height-r/2?"bottom":"center"}function KK(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 XK(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"),KK(c,e,t,n)&&(c="center"),c}function kR(e,t,n){const r=n.yAlign||t.yAlign||YK(e,n);return{xAlign:n.xAlign||t.xAlign||XK(e,t,n,r),yAlign:r}}function QK(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function ZK(e,t,n){let{y:r,height:o}=e;return t==="top"?r+=n:t==="bottom"?r-=o+n:r-=o/2,r}function PR(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}=Ma(s);let p=QK(t,a);const g=ZK(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:_n(p,0,r.width-t.width),y:_n(g,0,r.height-t.height)}}function Lh(e,t,n){const r=Tn(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function DR(e){return Eo([],mi(e))}function JK(e,t,n){return As(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function MR(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const tI={beforeTitle:ui,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:ui,beforeBody:ui,beforeLabel:ui,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 Be(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:ui,afterBody:ui,beforeFooter:ui,footer:ui,afterFooter:ui};function ar(e,t,n,r){const o=e[t].call(n,r);return typeof o>"u"?tI[t].call(n,r):o}var xv;let OR=(xv=class extends oi{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 IT(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=JK(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=Eo(a,mi(o)),a=Eo(a,mi(i)),a=Eo(a,mi(s)),a}getBeforeBody(t,n){return DR(ar(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,o=[];return xt(t,i=>{const s={before:[],lines:[],after:[]},a=MR(r,i);Eo(s.before,mi(ar(a,"beforeLabel",this,i))),Eo(s.lines,ar(a,"label",this,i)),Eo(s.after,mi(ar(a,"afterLabel",this,i))),o.push(s)}),o}getAfterBody(t,n){return DR(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=Eo(a,mi(o)),a=Eo(a,mi(i)),a=Eo(a,mi(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(GK(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))),xt(a,u=>{const d=MR(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=Uu[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=RR(this,r),c=Object.assign({},a,l),u=kR(this.chart,r,c),d=PR(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}=Ma(a),{x:h,y:f}=t,{width:p,height:g}=n;let m,y,x,v,_,C;return i==="center"?(_=f+g/2,o==="left"?(m=h,y=m-s,v=_+s,C=_-s):(m=h+p,y=m+s,v=_-s,C=_+s),x=m):(o==="left"?y=h+Math.max(l,u)+s:o==="right"?y=h+p-Math.max(c,d)-s:y=this.caretX,i==="top"?(v=f,_=v-s,m=y-s,x=y+s):(v=f+g,_=v+s,m=y+s,x=y-s),C=v),{x1:m,x2:y,x3:x,y1:v,y2:_,y3:C}}drawTitle(t,n,r){const o=this.title,i=o.length;let s,a,l;if(i){const c=Ql(r.rtl,this.x,this.width);for(t.x=Lh(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",s=fn(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=fn(i.bodyFont),d=Lh(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,y=p+l/2;t.strokeStyle=i.multiKeyBackground,t.fillStyle=i.multiKeyBackground,lg(t,g,m,y),t.strokeStyle=s.borderColor,t.fillStyle=s.backgroundColor,lg(t,g,m,y)}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),y=Ma(s.borderRadius);Object.values(y).some(x=>x!==0)?(t.beginPath(),t.fillStyle=i.multiKeyBackground,Fd(t,{x:g,y:p,w:c,h:l,radius:y}),t.fill(),t.stroke(),t.fillStyle=s.backgroundColor,t.beginPath(),Fd(t,{x:m,y:p+1,w:c-2,h:l-2,radius:y}),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=fn(r.bodyFont);let h=d.lineHeight,f=0;const p=Ql(r.rtl,this.x,this.width),g=function(k){n.fillText(k,p.x(t.x+f),t.y+h/2),t.y+=h+i},m=p.textAlign(s);let y,x,v,_,C,w,S;for(n.textAlign=s,n.textBaseline="middle",n.font=d.string,t.x=Lh(this,m,r),n.fillStyle=r.bodyColor,xt(this.beforeBody,g),f=a&&m!=="right"?s==="center"?c/2+u:c+2+u:0,_=0,w=o.length;_<w;++_){for(y=o[_],x=this.labelTextColors[_],n.fillStyle=x,xt(y.before,g),v=y.lines,a&&v.length&&(this._drawColorBox(n,t,_,p,r),h=Math.max(d.lineHeight,l)),C=0,S=v.length;C<S;++C)g(v[C]),h=d.lineHeight;xt(y.after,g)}f=0,h=d.lineHeight,xt(this.afterBody,g),t.y-=i}drawFooter(t,n,r){const o=this.footer,i=o.length;let s,a;if(i){const l=Ql(r.rtl,this.x,this.width);for(t.x=Lh(this,r.footerAlign,r),t.y+=r.footerMarginTop,n.textAlign=l.textAlign(r.footerAlign),n.textBaseline="middle",s=fn(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}=Ma(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=Uu[t.position].call(this,this._active,this._eventPosition);if(!s)return;const a=this._size=RR(this,t),l=Object.assign({},s,this._size),c=kR(n,t,l),u=PR(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=Tn(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),DT(t,n.textDirection),i.y+=s.top,this.drawTitle(i,t,n),this.drawBody(i,t,n),this.drawFooter(i,t,n),MT(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=!og(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||!og(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=Uu[i.position].call(this,t,n);return s!==!1&&(r!==s.x||o!==s.y)}},ge(xv,"positioners",Uu),xv);var nI={id:"tooltip",_element:OR,positioners:Uu,afterInit(e,t,n){n&&(e.tooltip=new OR({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:tI},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"]},eX=Object.freeze({__proto__:null,Colors:hK,Decimation:bK,Filler:LK,Legend:HK,SubTitle:UK,Title:qK,Tooltip:nI});const tX=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function nX(e,t,n,r){const o=e.indexOf(t);if(o===-1)return tX(e,t,n,r);const i=e.lastIndexOf(t);return o!==i?n:o}const rX=(e,t)=>e===null?null:_n(Math.round(e),0,t);function AR(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class jd extends Ts{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(Be(t))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===t?n:nX(r,t,Ae(n,t),this._addedLabels),rX(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 AR.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}}ge(jd,"id","category"),ge(jd,"defaults",{ticks:{callback:AR}});function oX(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,y=!Be(s),x=!Be(a),v=!Be(c),_=(m-g)/(d+1);let C=R2((m-g)/p/f)*f,w,S,k,M;if(C<1e-14&&!y&&!x)return[{value:g},{value:m}];M=Math.ceil(m/C)-Math.floor(g/C),M>p&&(C=R2(M*C/p/f)*f),Be(l)||(w=Math.pow(10,l),C=Math.ceil(C*w)/w),o==="ticks"?(S=Math.floor(g/C)*C,k=Math.ceil(m/C)*C):(S=g,k=m),y&&x&&i&&Zq((a-s)/i,C/1e3)?(M=Math.round(Math.min((a-s)/C,u)),C=(a-s)/M,S=s,k=a):v?(S=y?s:S,k=x?a:k,M=c-1,C=(k-S)/M):(M=(k-S)/C,od(M,Math.round(M),C/1e3)?M=Math.round(M):M=Math.ceil(M));const D=Math.max(k2(C),k2(S));w=Math.pow(10,Be(l)?D:l),S=Math.round(S*w)/w,k=Math.round(k*w)/w;let A=0;for(y&&(h&&S!==s?(n.push({value:s}),S<s&&A++,od(Math.round((S+A*C)*w)/w,s,TR(s,_,e))&&A++):S<s&&A++);A<M;++A){const I=Math.round((S+A*C)*w)/w;if(x&&I>a)break;n.push({value:I})}return x&&h&&k!==a?n.length&&od(n[n.length-1].value,a,TR(a,_,e))?n[n.length-1].value=a:n.push({value:a}):(!x||k===a)&&n.push({value:k}),n}function TR(e,t,{horizontal:n,minRotation:r}){const o=uo(r),i=(n?Math.sin(o):Math.cos(o))||.001,s=.75*t*(""+e).length;return Math.min(t/i,s)}class fg extends Ts{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 Be(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=zo(o),c=zo(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=oX(o,i);return t.bounds==="ticks"&&fT(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 Df(t,this.chart.options.locale,this.options.ticks.format)}}class Ya extends fg{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Zt(t)?t:0,this.max=Zt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=uo(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}}ge(Ya,"id","linear"),ge(Ya,"defaults",{ticks:{callback:jm.formatters.numeric}});const $d=e=>Math.floor(cs(e)),Xs=(e,t)=>Math.pow(10,$d(e)+t);function IR(e){return e/Math.pow(10,$d(e))===1}function NR(e,t,n){const r=Math.pow(10,n),o=Math.floor(e/r);return Math.ceil(t/r)-o}function iX(e,t){const n=t-e;let r=$d(n);for(;NR(e,t,r)>10;)r++;for(;NR(e,t,r)<10;)r--;return Math.min(r,$d(e))}function sX(e,{min:t,max:n}){t=Pr(e.min,t);const r=[],o=$d(t);let i=iX(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=Pr(e.min,Math.round((l+u+d*Math.pow(10,i))*s)/s);for(;h<n;)r.push({value:h,major:IR(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=Pr(e.max,h);return r.push({value:f,major:IR(f),significand:d}),r}class Tc extends Ts{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const r=fg.prototype.parse.apply(this,[t,n]);if(r===0){this._zero=!0;return}return Zt(r)&&r>0?r:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Zt(t)?Math.max(0,t):null,this.max=Zt(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Zt(this._userMin)&&(this.min=t===Xs(this.min,0)?Xs(this.min,-1):Xs(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(Xs(r,-1)),s(Xs(o,1)))),r<=0&&i(Xs(o,-1)),o<=0&&s(Xs(r,1)),this.min=r,this.max=o}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},r=sX(n,this);return t.bounds==="ticks"&&fT(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":Df(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=cs(t),this._valueRange=cs(this.max)-cs(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(cs(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}ge(Tc,"id","logarithmic"),ge(Tc,"defaults",{ticks:{callback:jm.formatters.logarithmic,major:{enabled:!0}}});function yx(e){const t=e.ticks;if(t.display&&e.display){const n=Tn(t.backdropPadding);return Ae(t.font&&t.font.size,Bt.font.size)+n.height}return 0}function aX(e,t,n){return n=$t(n)?n:[n],{w:gU(e,t.string,n),h:n.length*t.lineHeight}}function FR(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 lX(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?Vt/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=fn(c.font),h=aX(e.ctx,d,e._pointLabels[l]);r[l]=h;const f=Mr(e.getIndexAngle(l)+a),p=Math.round(cS(f)),g=FR(p,u.x,h.w,0,180),m=FR(p,u.y,h.h,90,270);cX(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=fX(e,r,o)}function cX(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 uX(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(cS(Mr(l.angle+tn))),u=gX(l.y,a.h,c),d=hX(c),h=pX(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 dX(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 fX(e,t,n){const r=[],o=e._pointLabels.length,i=e.options,{centerPointLabels:s,display:a}=i.pointLabels,l={extra:yx(i)/2,additionalAngle:s?Vt/o:0};let c;for(let u=0;u<o;u++){l.padding=n[u],l.size=t[u];const d=uX(e,u,l);r.push(d),a==="auto"&&(d.visible=dX(d,c),d.visible&&(c=d))}return r}function hX(e){return e===0||e===180?"center":e<180?"left":"right"}function pX(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function gX(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function mX(e,t,n){const{left:r,top:o,right:i,bottom:s}=n,{backdropColor:a}=t;if(!Be(a)){const l=Ma(t.borderRadius),c=Tn(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(),Fd(e,{x:u,y:d,w:h,h:f,radius:l}),e.fill()):e.fillRect(u,d,h,f)}}function bX(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));mX(n,s,i);const a=fn(s.font),{x:l,y:c,textAlign:u}=i;Ga(n,e._pointLabels[o],l,c+a.lineHeight/2,a,{color:s.color,textAlign:u,textBaseline:"middle"})}}function rI(e,t,n,r){const{ctx:o}=e;if(n)o.arc(e.xCenter,e.yCenter,t,0,zt);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 yX(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(),rI(e,n,s,r),i.closePath(),i.stroke(),i.restore())}function vX(e,t,n){return As(e,{label:n,index:t,type:"pointLabel"})}class Gu extends fg{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=Tn(yx(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=Zt(t)&&!isNaN(t)?t:0,this.max=Zt(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/yx(this.options))}generateTickLabels(t){fg.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,r)=>{const o=Rt(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?lX(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=zt/(this._pointLabels.length||1),r=this.options.startAngle||0;return Mr(t*n+uo(r))}getDistanceFromCenterForValue(t){if(Be(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(Be(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 vX(this.getContext(),t,r)}}getPointPosition(t,n,r=0){const o=this.getIndexAngle(t)-tn+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(),rI(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&&bX(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);yX(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=fn(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=Tn(c.backdropPadding);t.fillRect(-s/2-d.left,-i-u.size/2-d.top,s+d.width,u.size+d.height)}Ga(t,a.label,0,-i,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}ge(Gu,"id","radialLinear"),ge(Gu,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:jm.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),ge(Gu,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),ge(Gu,"descriptors",{angleLines:{_fallback:"grid"}});const Bm={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(Bm);function LR(e,t){return e-t}function jR(e,t){if(Be(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)),Zt(s)||(s=typeof r=="string"?n.parse(s,r):n.parse(s)),s===null?null:(o&&(s=o==="week"&&(Mc(i)||i===!0)?n.startOf(s,"isoWeek",i):n.startOf(s,o)),+s)}function $R(e,t,n,r){const o=gr.length;for(let i=gr.indexOf(e);i<o-1;++i){const s=Bm[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 xX(e,t,n,r,o){for(let i=gr.length-1;i>=gr.indexOf(n);i--){const s=gr[i];if(Bm[s].common&&e._adapter.diff(o,r,s)>=t-1)return s}return gr[n?gr.indexOf(n):0]}function wX(e){for(let t=gr.indexOf(e)+1,n=gr.length;t<n;++t)if(Bm[gr[t]].common)return gr[t]}function zR(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:r,hi:o}=uS(n,t),i=n[r]>=t?n[r]:n[o];e[i]=!0}}function SX(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 BR(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:SX(e,r,o,n)}class zd extends Ts{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 OG._date(t.adapters.date);o.init(n),rd(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:jR(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=Zt(o)&&!isNaN(o)?o:+n.startOf(Date.now(),r),i=Zt(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=nU(o,i,s);return this._unit=n.unit||(r.autoSkip?$R(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):xX(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:wX(this._unit),this.initOffsets(o),t.reverse&&a.reverse(),BR(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=_n(n,0,s),r=_n(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||$R(i.minUnit,n,r,this._getLabelCapacity(n)),a=Ae(o.ticks.stepSize,1),l=s==="week"?i.isoWeekday:!1,c=Mc(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++)zR(u,h,p);return(h===r||o.bounds==="ticks"||f===1)&&zR(u,h,p),Object.keys(u).sort(LR).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 Rt(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=uo(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,BR(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(jR(this,o[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return gT(t.sort(LR))}}ge(zd,"id","time"),ge(zd,"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 jh(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}=Di(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}=Di(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 vx extends zd{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=jh(n,this.min),this._tableRange=jh(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(jh(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return jh(this._table,r*this._tableRange+this._minPos,!0)}}ge(vx,"id","timeseries"),ge(vx,"defaults",zd.defaults);var CX=Object.freeze({__proto__:null,CategoryScale:jd,LinearScale:Ya,LogarithmicScale:Tc,RadialLinearScale:Gu,TimeScale:zd,TimeSeriesScale:vx});const _X=[MG,sK,eX,CX];class xs{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*EX(e){for(const t of e)yield*t}function oI(e){return Array.from(EX(e))}function zl(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,iI=1e-12,Qe=Math.PI,Qt=Qe/2,VR=Qe/4,Lr=Qe*2,Zn=180/Qe,kt=Qe/180,at=Math.abs,Qc=Math.atan,Yo=Math.atan2,ze=Math.cos,$h=Math.ceil,sI=Math.exp,hg=Math.log,G0=Math.pow,Ie=Math.sin,Yr=Math.sign||function(e){return e>0?1:e<0?-1:0},nr=Math.sqrt,SS=Math.tan;function aI(e){return e>1?0:e<-1?Qe:Math.acos(e)}function Zr(e){return e>1?Qt:e<-1?-Qt:Math.asin(e)}function Cn(){}function pg(e,t){e&&WR.hasOwnProperty(e.type)&&WR[e.type](e,t)}var HR={Feature:function(e,t){pg(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,o=n.length;++r<o;)pg(n[r].geometry,t)}},WR={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){xx(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)xx(n[r],t,0)},Polygon:function(e,t){qR(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)qR(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,o=n.length;++r<o;)pg(n[r],t)}};function xx(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 qR(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)xx(e[n],t,1);t.polygonEnd()}function oa(e,t){e&&HR.hasOwnProperty(e.type)?HR[e.type](e,t):pg(e,t)}function wx(e){return[Yo(e[1],e[0]),Zr(e[2])]}function Ic(e){var t=e[0],n=e[1],r=ze(n);return[r*ze(t),r*Ie(t),Ie(n)]}function zh(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function gg(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 Y0(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Bh(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Sx(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 Cx(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 _x(e,t){return at(e)>Qe&&(e-=Math.round(e/Lr)*Lr),[e,t]}_x.invert=_x;function lI(e,t,n){return(e%=Lr)?t||n?Cx(GR(e),YR(t,n)):GR(e):t||n?YR(t,n):_x}function UR(e){return function(t,n){return t+=e,at(t)>Qe&&(t-=Math.round(t/Lr)*Lr),[t,n]}}function GR(e){var t=UR(e);return t.invert=UR(-e),t}function YR(e,t){var n=ze(e),r=Ie(e),o=ze(t),i=Ie(t);function s(a,l){var c=ze(l),u=ze(a)*c,d=Ie(a)*c,h=Ie(l),f=h*n+u*r;return[Yo(d*o-f*i,u*n-h*r),Zr(f*o+d*i)]}return s.invert=function(a,l){var c=ze(l),u=ze(a)*c,d=Ie(a)*c,h=Ie(l),f=h*o-d*i;return[Yo(d*o+h*i,u*n+f*r),Zr(f*n-u*r)]},s}function RX(e){e=lI(e[0]*kt,e[1]*kt,e.length>2?e[2]*kt:0);function t(n){return n=e(n[0]*kt,n[1]*kt),n[0]*=Zn,n[1]*=Zn,n}return t.invert=function(n){return n=e.invert(n[0]*kt,n[1]*kt),n[0]*=Zn,n[1]*=Zn,n},t}function kX(e,t,n,r,o,i){if(n){var s=ze(t),a=Ie(t),l=r*n;o==null?(o=t+r*Lr,i=t-l/2):(o=KR(s,o),i=KR(s,i),(r>0?o<i:o>i)&&(o+=r*Lr));for(var c,u=o;r>0?u>i:u<i;u-=l)c=wx([s,-a*ze(u),-a*Ie(u)]),e.point(c[0],c[1])}}function KR(e,t){t=Ic(t),t[0]-=e,Sx(t);var n=aI(-t[1]);return((-t[2]<0?-n:n)+Lr-ke)%Lr}function cI(){var e=[],t;return{point:function(n,r,o){t.push([n,r,o])},lineStart:function(){e.push(t=[])},lineEnd:Cn,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Ip(e,t){return at(e[0]-t[0])<ke&&at(e[1]-t[1])<ke}function Vh(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 uI(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],y=p[g],x;if(Ip(m,y)){if(!m[2]&&!y[2]){for(o.lineStart(),a=0;a<g;++a)o.point((m=p[a])[0],m[1]);o.lineEnd();return}y[0]+=2*ke}i.push(x=new Vh(m,p,null,!0)),s.push(x.o=new Vh(m,null,x,!1)),i.push(x=new Vh(y,p,null,!1)),s.push(x.o=new Vh(y,null,x,!0))}}),!!i.length){for(s.sort(t),XR(i),XR(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 XR(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 K0(e){return at(e[0])<=Qe?e[0]:Yr(e[0])*((at(e[0])+Qe)%Lr-Qe)}function dI(e,t){var n=K0(t),r=t[1],o=Ie(r),i=[Ie(n),-ze(n),0],s=0,a=0,l=new xs;o===1?r=Qt+ke:o===-1&&(r=-Qt-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=K0(f),g=f[1]/2+VR,m=Ie(g),y=ze(g),x=0;x<h;++x,p=_,m=w,y=S,f=v){var v=d[x],_=K0(v),C=v[1]/2+VR,w=Ie(C),S=ze(C),k=_-p,M=k>=0?1:-1,D=M*k,A=D>Qe,I=m*w;if(l.add(Yo(I*M*Ie(D),y*S+I*ze(D))),s+=A?k+M*Lr:k,A^p>=n^_>=n){var $=gg(Ic(f),Ic(v));Sx($);var j=gg(i,$);Sx(j);var T=(A^k>=0?-1:1)*Zr(j[2]);(r>T||r===T&&($[0]||$[1]))&&(a+=A^k>=0?1:-1)}}return(s<-1e-6||s<ke&&l<-1e-12)^a&1}function fI(e,t,n,r){return function(o){var i=t(o),s=cI(),a=t(s),l=!1,c,u,d,h={point:f,lineStart:g,lineEnd:m,polygonStart:function(){h.point=y,h.lineStart=x,h.lineEnd=v,u=[],c=[]},polygonEnd:function(){h.point=f,h.lineStart=g,h.lineEnd=m,u=oI(u);var _=dI(c,r);u.length?(l||(o.polygonStart(),l=!0),uI(u,DX,_,n,o)):_&&(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(_,C){e(_,C)&&o.point(_,C)}function p(_,C){i.point(_,C)}function g(){h.point=p,i.lineStart()}function m(){h.point=f,i.lineEnd()}function y(_,C){d.push([_,C]),a.point(_,C)}function x(){a.lineStart(),d=[]}function v(){y(d[0][0],d[0][1]),a.lineEnd();var _=a.clean(),C=s.result(),w,S=C.length,k,M,D;if(d.pop(),c.push(d),d=null,!!S){if(_&1){if(M=C[0],(k=M.length-1)>0){for(l||(o.polygonStart(),l=!0),o.lineStart(),w=0;w<k;++w)o.point((D=M[w])[0],D[1]);o.lineEnd()}return}S>1&&_&2&&C.push(C.pop().concat(C.shift())),u.push(C.filter(PX))}}return h}}function PX(e){return e.length>1}function DX(e,t){return((e=e.x)[0]<0?e[1]-Qt-ke:Qt-e[1])-((t=t.x)[0]<0?t[1]-Qt-ke:Qt-t[1])}const QR=fI(function(){return!0},MX,AX,[-Qe,-Qt]);function MX(e){var t=NaN,n=NaN,r=NaN,o;return{lineStart:function(){e.lineStart(),o=1},point:function(i,s){var a=i>0?Qe:-Qe,l=at(i-t);at(l-Qe)<ke?(e.point(t,n=(n+s)/2>0?Qt:-Qt),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(i,n),o=0):r!==a&&l>=Qe&&(at(t-r)<ke&&(t-=r*ke),at(i-a)<ke&&(i-=a*ke),n=OX(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 OX(e,t,n,r){var o,i,s=Ie(e-n);return at(s)>ke?Qc((Ie(t)*(i=ze(r))*Ie(n)-Ie(r)*(o=ze(t))*Ie(e))/(o*i*s)):(t+r)/2}function AX(e,t,n,r){var o;if(e==null)o=n*Qt,r.point(-Qe,o),r.point(0,o),r.point(Qe,o),r.point(Qe,0),r.point(Qe,-o),r.point(0,-o),r.point(-Qe,-o),r.point(-Qe,0),r.point(-Qe,o);else if(at(e[0]-t[0])>ke){var i=e[0]<t[0]?Qe:-Qe;o=n*i/2,r.point(-i,o),r.point(0,o),r.point(i,o)}else r.point(t[0],t[1])}function TX(e){var t=ze(e),n=2*kt,r=t>0,o=at(t)>ke;function i(u,d,h,f){kX(f,e,n,h,u,d)}function s(u,d){return ze(u)*ze(d)>t}function a(u){var d,h,f,p,g;return{lineStart:function(){p=f=!1,g=1},point:function(m,y){var x=[m,y],v,_=s(m,y),C=r?_?0:c(m,y):_?c(m+(m<0?Qe:-Qe),y):0;if(!d&&(p=f=_)&&u.lineStart(),_!==f&&(v=l(d,x),(!v||Ip(d,v)||Ip(x,v))&&(x[2]=1)),_!==f)g=0,_?(u.lineStart(),v=l(x,d),u.point(v[0],v[1])):(v=l(d,x),u.point(v[0],v[1],2),u.lineEnd()),d=v;else if(o&&d&&r^_){var w;!(C&h)&&(w=l(x,d,!0))&&(g=0,r?(u.lineStart(),u.point(w[0][0],w[0][1]),u.point(w[1][0],w[1][1]),u.lineEnd()):(u.point(w[1][0],w[1][1]),u.lineEnd(),u.lineStart(),u.point(w[0][0],w[0][1],3)))}_&&(!d||!Ip(d,x))&&u.point(x[0],x[1]),d=x,f=_,h=C},lineEnd:function(){f&&u.lineEnd(),d=null},clean:function(){return g|(p&&f)<<1}}}function l(u,d,h){var f=Ic(u),p=Ic(d),g=[1,0,0],m=gg(f,p),y=zh(m,m),x=m[0],v=y-x*x;if(!v)return!h&&u;var _=t*y/v,C=-t*x/v,w=gg(g,m),S=Bh(g,_),k=Bh(m,C);Y0(S,k);var M=w,D=zh(S,M),A=zh(M,M),I=D*D-A*(zh(S,S)-1);if(!(I<0)){var $=nr(I),j=Bh(M,(-D-$)/A);if(Y0(j,S),j=wx(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,q=at(O-Qe)<ke,L=q||O<ke;if(!q&&z<F&&(B=F,F=z,z=B),L?q?F+z>0^j[1]<(at(j[0]-T)<ke?F:z):F<=j[1]&&j[1]<=z:O>Qe^(T<=j[0]&&j[0]<=N)){var P=Bh(M,(-D+$)/A);return Y0(P,S),[j,wx(P)]}}}function c(u,d){var h=r?e:Qe-e,f=0;return u<-h?f|=1:u>h&&(f|=2),d<-h?f|=4:d>h&&(f|=8),f}return fI(s,a,i,r?[0,-e]:[-Qe,e-Qe])}function IX(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 Hh=1e9,Wh=-1e9;function NX(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=cI(),h,f,p,g,m,y,x,v,_,C,w,S={point:k,lineStart:I,lineEnd:$,polygonStart:D,polygonEnd:A};function k(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,q=z[0],L,P,H=q[0],U=q[1];B<O;++B)L=H,P=U,q=z[B],H=q[0],U=q[1],P<=r?U>r&&(H-L)*(r-P)>(U-P)*(e-L)&&++T:U<=r&&(H-L)*(r-P)<(U-P)*(e-L)&&--T;return T}function D(){u=d,h=[],f=[],w=!0}function A(){var T=M(),N=w&&T,F=(h=oI(h)).length;(N||F)&&(c.polygonStart(),N&&(c.lineStart(),i(null,null,1,c),c.lineEnd()),F&&uI(h,a,T,i,c),c.polygonEnd()),u=c,h=f=p=null}function I(){S.point=j,f&&f.push(p=[]),C=!0,_=!1,x=v=NaN}function $(){h&&(j(g,m),y&&_&&d.rejoin(),h.push(d.result())),S.point=k,_&&u.lineEnd()}function j(T,N){var F=o(T,N);if(f&&p.push([T,N]),C)g=T,m=N,y=F,C=!1,F&&(u.lineStart(),u.point(T,N));else if(F&&_)u.point(T,N);else{var z=[x=Math.max(Wh,Math.min(Hh,x)),v=Math.max(Wh,Math.min(Hh,v))],B=[T=Math.max(Wh,Math.min(Hh,T)),N=Math.max(Wh,Math.min(Hh,N))];IX(z,B,e,t,n,r)?(_||(u.lineStart(),u.point(z[0],z[1])),u.point(B[0],B[1]),F||u.lineEnd(),w=!1):F&&(u.lineStart(),u.point(T,N),w=!1)}x=T,v=N,_=F}return S}}var Ex,Rx,Np,Fp,Nc={sphere:Cn,point:Cn,lineStart:FX,lineEnd:Cn,polygonStart:Cn,polygonEnd:Cn};function FX(){Nc.point=jX,Nc.lineEnd=LX}function LX(){Nc.point=Nc.lineEnd=Cn}function jX(e,t){e*=kt,t*=kt,Rx=e,Np=Ie(t),Fp=ze(t),Nc.point=$X}function $X(e,t){e*=kt,t*=kt;var n=Ie(t),r=ze(t),o=at(e-Rx),i=ze(o),s=Ie(o),a=r*s,l=Fp*n-Np*r*i,c=Np*n+Fp*r*i;Ex.add(Yo(nr(a*a+l*l),c)),Rx=e,Np=n,Fp=r}function zX(e){return Ex=new xs,oa(e,Nc),+Ex}var kx=[null,null],BX={type:"LineString",coordinates:kx};function Px(e,t){return kx[0]=e,kx[1]=t,zX(BX)}var ZR={Feature:function(e,t){return mg(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,o=n.length;++r<o;)if(mg(n[r].geometry,t))return!0;return!1}},JR={Sphere:function(){return!0},Point:function(e,t){return ek(e.coordinates,t)},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)if(ek(n[r],t))return!0;return!1},LineString:function(e,t){return tk(e.coordinates,t)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)if(tk(n[r],t))return!0;return!1},Polygon:function(e,t){return nk(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)if(nk(n[r],t))return!0;return!1},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,o=n.length;++r<o;)if(mg(n[r],t))return!0;return!1}};function mg(e,t){return e&&JR.hasOwnProperty(e.type)?JR[e.type](e,t):!1}function ek(e,t){return Px(e,t)===0}function tk(e,t){for(var n,r,o,i=0,s=e.length;i<s;i++){if(r=Px(e[i],t),r===0||i>0&&(o=Px(e[i],e[i-1]),o>0&&n<=o&&r<=o&&(n+r-o)*(1-Math.pow((n-r)/o,2))<iI*o))return!0;n=r}return!1}function nk(e,t){return!!dI(e.map(VX),hI(t))}function VX(e){return e=e.map(hI),e.pop(),e}function hI(e){return[e[0]*kt,e[1]*kt]}function HX(e,t){return(e&&ZR.hasOwnProperty(e.type)?ZR[e.type]:mg)(e,t)}function rk(e,t,n){var r=zl(e,t-ke,n).concat(t);return function(o){return r.map(function(i){return[o,i]})}}function ok(e,t,n){var r=zl(e,t-ke,n).concat(t);return function(o){return r.map(function(i){return[i,o]})}}function pI(){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 y(){return{type:"MultiLineString",coordinates:x()}}function x(){return zl($h(r/u)*u,n,u).map(p).concat(zl($h(a/d)*d,s,d).map(g)).concat(zl($h(t/l)*l,e,l).filter(function(v){return at(v%u)>ke}).map(h)).concat(zl($h(i/c)*c,o,c).filter(function(v){return at(v%d)>ke}).map(f))}return y.lines=function(){return x().map(function(v){return{type:"LineString",coordinates:v}})},y.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(g(s).slice(1),p(n).reverse().slice(1),g(a).reverse().slice(1))]}},y.extent=function(v){return arguments.length?y.extentMajor(v).extentMinor(v):y.extentMinor()},y.extentMajor=function(v){return arguments.length?(r=+v[0][0],n=+v[1][0],a=+v[0][1],s=+v[1][1],r>n&&(v=r,r=n,n=v),a>s&&(v=a,a=s,s=v),y.precision(m)):[[r,a],[n,s]]},y.extentMinor=function(v){return arguments.length?(t=+v[0][0],e=+v[1][0],i=+v[0][1],o=+v[1][1],t>e&&(v=t,t=e,e=v),i>o&&(v=i,i=o,o=v),y.precision(m)):[[t,i],[e,o]]},y.step=function(v){return arguments.length?y.stepMajor(v).stepMinor(v):y.stepMinor()},y.stepMajor=function(v){return arguments.length?(u=+v[0],d=+v[1],y):[u,d]},y.stepMinor=function(v){return arguments.length?(l=+v[0],c=+v[1],y):[l,c]},y.precision=function(v){return arguments.length?(m=+v,h=rk(i,o,90),f=ok(t,e,m),p=rk(a,s,90),g=ok(r,n,m),y):m},y.extentMajor([[-180,-90+ke],[180,90-ke]]).extentMinor([[-180,-80-ke],[180,80+ke]])}function WX(){return pI()()}const Dx=e=>e;var X0=new xs,Mx=new xs,gI,mI,Ox,Ax,Ci={point:Cn,lineStart:Cn,lineEnd:Cn,polygonStart:function(){Ci.lineStart=qX,Ci.lineEnd=GX},polygonEnd:function(){Ci.lineStart=Ci.lineEnd=Ci.point=Cn,X0.add(at(Mx)),Mx=new xs},result:function(){var e=X0/2;return X0=new xs,e}};function qX(){Ci.point=UX}function UX(e,t){Ci.point=bI,gI=Ox=e,mI=Ax=t}function bI(e,t){Mx.add(Ax*e-Ox*t),Ox=e,Ax=t}function GX(){bI(gI,mI)}var Fc=1/0,bg=Fc,Bd=-Fc,yg=Bd,vg={point:YX,lineStart:Cn,lineEnd:Cn,polygonStart:Cn,polygonEnd:Cn,result:function(){var e=[[Fc,bg],[Bd,yg]];return Bd=yg=-(bg=Fc=1/0),e}};function YX(e,t){e<Fc&&(Fc=e),e>Bd&&(Bd=e),t<bg&&(bg=t),t>yg&&(yg=t)}var Tx=0,Ix=0,Yu=0,xg=0,wg=0,Bl=0,Nx=0,Fx=0,Ku=0,yI,vI,Io,No,Gr={point:Ka,lineStart:ik,lineEnd:sk,polygonStart:function(){Gr.lineStart=QX,Gr.lineEnd=ZX},polygonEnd:function(){Gr.point=Ka,Gr.lineStart=ik,Gr.lineEnd=sk},result:function(){var e=Ku?[Nx/Ku,Fx/Ku]:Bl?[xg/Bl,wg/Bl]:Yu?[Tx/Yu,Ix/Yu]:[NaN,NaN];return Tx=Ix=Yu=xg=wg=Bl=Nx=Fx=Ku=0,e}};function Ka(e,t){Tx+=e,Ix+=t,++Yu}function ik(){Gr.point=KX}function KX(e,t){Gr.point=XX,Ka(Io=e,No=t)}function XX(e,t){var n=e-Io,r=t-No,o=nr(n*n+r*r);xg+=o*(Io+e)/2,wg+=o*(No+t)/2,Bl+=o,Ka(Io=e,No=t)}function sk(){Gr.point=Ka}function QX(){Gr.point=JX}function ZX(){xI(yI,vI)}function JX(e,t){Gr.point=xI,Ka(yI=Io=e,vI=No=t)}function xI(e,t){var n=e-Io,r=t-No,o=nr(n*n+r*r);xg+=o*(Io+e)/2,wg+=o*(No+t)/2,Bl+=o,o=No*e-Io*t,Nx+=o*(Io+e),Fx+=o*(No+t),Ku+=o*3,Ka(Io=e,No=t)}function wI(e){this._context=e}wI.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,Lr);break}}},result:Cn};var Lx=new xs,Q0,SI,CI,Xu,Qu,Vd={point:Cn,lineStart:function(){Vd.point=eQ},lineEnd:function(){Q0&&_I(SI,CI),Vd.point=Cn},polygonStart:function(){Q0=!0},polygonEnd:function(){Q0=null},result:function(){var e=+Lx;return Lx=new xs,e}};function eQ(e,t){Vd.point=_I,SI=Xu=e,CI=Qu=t}function _I(e,t){Xu-=e,Qu-=t,Lx.add(nr(Xu*Xu+Qu*Qu)),Xu=e,Qu=t}let ak,Sg,lk,ck;class uk{constructor(t){this._append=t==null?EI:tQ(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!==lk||this._append!==Sg){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`,lk=r,Sg=this._append,ck=this._,this._=o}this._+=ck;break}}}result(){const t=this._;return this._="",t.length?t:null}}function EI(e){let t=1;this._+=e[0];for(const n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function tQ(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return EI;if(t!==ak){const n=10**t;ak=t,Sg=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 Sg}function dk(e,t){let n=3,r=4.5,o,i;function s(a){return a&&(typeof r=="function"&&i.pointRadius(+r.apply(this,arguments)),oa(a,o(i))),i.result()}return s.area=function(a){return oa(a,o(Ci)),Ci.result()},s.measure=function(a){return oa(a,o(Vd)),Vd.result()},s.bounds=function(a){return oa(a,o(vg)),vg.result()},s.centroid=function(a){return oa(a,o(Gr)),Gr.result()},s.projection=function(a){return arguments.length?(o=a==null?(e=null,Dx):(e=a).stream,s):e},s.context=function(a){return arguments.length?(i=a==null?(t=null,new uk(n)):new wI(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 uk(n)),s},s.projection(e).digits(n).context(t)}function CS(e){return function(t){var n=new jx;for(var r in e)n[r]=e[r];return n.stream=t,n}}function jx(){}jx.prototype={constructor:jx,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 _S(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),oa(n,e.stream(vg)),t(vg.result()),r!=null&&e.clipExtent(r),e}function ES(e,t,n){return _S(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 RI(e,t,n){return ES(e,[[0,0],t],n)}function kI(e,t,n){return _S(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 PI(e,t,n){return _S(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 fk=16,nQ=ze(30*kt);function hk(e,t){return+t?oQ(e,t):rQ(e)}function rQ(e){return CS({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function oQ(e,t){function n(r,o,i,s,a,l,c,u,d,h,f,p,g,m){var y=c-r,x=u-o,v=y*y+x*x;if(v>4*t&&g--){var _=s+h,C=a+f,w=l+p,S=nr(_*_+C*C+w*w),k=Zr(w/=S),M=at(at(w)-1)<ke||at(i-d)<ke?(i+d)/2:Yo(C,_),D=e(M,k),A=D[0],I=D[1],$=A-r,j=I-o,T=x*$-y*j;(T*T/v>t||at((y*$+x*j)/v-.5)>.3||s*h+a*f+l*p<nQ)&&(n(r,o,i,s,a,l,A,I,M,_/=S,C/=S,w,g,m),m.point(A,I),n(A,I,M,_,C,w,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:y,lineStart:x,lineEnd:_,polygonStart:function(){r.polygonStart(),m.lineStart=C},polygonEnd:function(){r.polygonEnd(),m.lineStart=x}};function y(k,M){k=e(k,M),r.point(k[0],k[1])}function x(){d=NaN,m.point=v,r.lineStart()}function v(k,M){var D=Ic([k,M]),A=e(k,M);n(d,h,u,f,p,g,d=A[0],h=A[1],u=k,f=D[0],p=D[1],g=D[2],fk,r),r.point(d,h)}function _(){m.point=y,r.lineEnd()}function C(){x(),m.point=w,m.lineEnd=S}function w(k,M){v(o=k,M),i=d,s=h,a=f,l=p,c=g,m.point=v}function S(){n(d,h,u,f,p,g,i,s,o,a,l,c,fk,r),m.lineEnd=_,_()}return m}}var iQ=CS({point:function(e,t){this.stream.point(e*kt,t*kt)}});function sQ(e){return CS({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function aQ(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 pk(e,t,n,r,o,i){if(!i)return aQ(e,t,n,r,o);var s=ze(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 Bi(e){return DI(function(){return e})()}function DI(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=QR,m=null,y,x,v,_=Dx,C=.5,w,S,k,M,D;function A(T){return k(T[0]*kt,T[1]*kt)}function I(T){return T=k.invert(T[0],T[1]),T&&[T[0]*Zn,T[1]*Zn]}A.stream=function(T){return M&&D===T?M:M=iQ(sQ(u)(g(w(_(D=T)))))},A.preclip=function(T){return arguments.length?(g=T,p=void 0,j()):g},A.postclip=function(T){return arguments.length?(_=T,m=y=x=v=null,j()):_},A.clipAngle=function(T){return arguments.length?(g=+T?TX(p=T*kt):(p=null,QR),j()):p*Zn},A.clipExtent=function(T){return arguments.length?(_=T==null?(m=y=x=v=null,Dx):NX(m=+T[0][0],y=+T[0][1],x=+T[1][0],v=+T[1][1]),j()):m==null?null:[[m,y],[x,v]]},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*kt,s=T[1]%360*kt,$()):[i*Zn,s*Zn]},A.rotate=function(T){return arguments.length?(a=T[0]%360*kt,l=T[1]%360*kt,c=T.length>2?T[2]%360*kt:0,$()):[a*Zn,l*Zn,c*Zn]},A.angle=function(T){return arguments.length?(d=T%360*kt,$()):d*Zn},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?(w=hk(S,C=T*T),j()):nr(C)},A.fitExtent=function(T,N){return ES(A,T,N)},A.fitSize=function(T,N){return RI(A,T,N)},A.fitWidth=function(T,N){return kI(A,T,N)},A.fitHeight=function(T,N){return PI(A,T,N)};function $(){var T=pk(n,0,0,h,f,d).apply(null,t(i,s)),N=pk(n,r-T[0],o-T[1],h,f,d);return u=lI(a,l,c),S=Cx(t,N),k=Cx(u,S),w=hk(S,C),j()}function j(){return M=D=null,A}return function(){return t=e.apply(this,arguments),A.invert=t.invert&&I,$()}}function RS(e){var t=0,n=Qe/3,r=DI(e),o=r(t,n);return o.parallels=function(i){return arguments.length?r(t=i[0]*kt,n=i[1]*kt):[t*Zn,n*Zn]},o}function lQ(e){var t=ze(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 cQ(e,t){var n=Ie(e),r=(n+Ie(t))/2;if(at(r)<ke)return lQ(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*ze(a)]}return s.invert=function(a,l){var c=i-l,u=Yo(a,at(c))*Yr(c);return c*r<0&&(u-=Qe*Yr(a)*Yr(c)),[u/r,Zr((o-(a*a+c*c)*r*r)/(2*r))]},s}function Cg(){return RS(cQ).scale(155.424).center([0,33.6442])}function MI(){return Cg().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function uQ(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 dQ(){var e,t,n=MI(),r,o=Cg().rotate([154,0]).center([-2,58.5]).parallels([55,65]),i,s=Cg().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=uQ([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 ES(u,h,f)},u.fitSize=function(h,f){return RI(u,h,f)},u.fitWidth=function(h,f){return kI(u,h,f)},u.fitHeight=function(h,f){return PI(u,h,f)};function d(){return e=t=null,u}return u.scale(1070)}function OI(e){return function(t,n){var r=ze(t),o=ze(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=ze(o);return[Yo(t*i,r*s),Zr(r&&n*i/r)]}}var AI=OI(function(e){return nr(2/(1+e))});AI.invert=Mf(function(e){return 2*Zr(e/2)});function fQ(){return Bi(AI).scale(124.75).clipAngle(180-.001)}var TI=OI(function(e){return(e=aI(e))&&e/Ie(e)});TI.invert=Mf(function(e){return e});function hQ(){return Bi(TI).scale(79.4188).clipAngle(180-.001)}function Vm(e,t){return[e,hg(SS((Qt+t)/2))]}Vm.invert=function(e,t){return[e,2*Qc(sI(t))-Qt]};function pQ(){return II(Vm).scale(961/Lr)}function II(e){var t=Bi(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=Qe*r(),h=t(RX(t.rotate()).invert([0,0]));return i(s==null?[[h[0]-d,h[1]-d],[h[0]+d,h[1]+d]]:e===Vm?[[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 qh(e){return SS((Qt+e)/2)}function gQ(e,t){var n=ze(e),r=e===t?Ie(e):hg(n/ze(t))/hg(qh(t)/qh(e)),o=n*G0(qh(e),r)/r;if(!r)return Vm;function i(s,a){o>0?a<-Qt+ke&&(a=-Qt+ke):a>Qt-ke&&(a=Qt-ke);var l=o/G0(qh(a),r);return[l*Ie(r*s),o-l*ze(r*s)]}return i.invert=function(s,a){var l=o-a,c=Yr(r)*nr(s*s+l*l),u=Yo(s,at(l))*Yr(l);return l*r<0&&(u-=Qe*Yr(s)*Yr(l)),[u/r,2*Qc(G0(o/c,1/r))-Qt]},i}function mQ(){return RS(gQ).scale(109.5).parallels([30,30])}function _g(e,t){return[e,t]}_g.invert=_g;function bQ(){return Bi(_g).scale(152.63)}function yQ(e,t){var n=ze(e),r=e===t?Ie(e):(n-ze(t))/(t-e),o=n/r+e;if(at(r)<ke)return _g;function i(s,a){var l=o-a,c=r*s;return[l*Ie(c),o-l*ze(c)]}return i.invert=function(s,a){var l=o-a,c=Yo(s,at(l))*Yr(l);return l*r<0&&(c-=Qe*Yr(s)*Yr(l)),[c/r,o-Yr(r)*nr(s*s+l*l)]},i}function vQ(){return RS(yQ).scale(131.154).center([0,13.9389])}var ld=1.340264,cd=-.081106,ud=893e-6,dd=.003796,Eg=nr(3)/2,xQ=12;function NI(e,t){var n=Zr(Eg*Ie(t)),r=n*n,o=r*r*r;return[e*ze(n)/(Eg*(ld+3*cd*r+o*(7*ud+9*dd*r))),n*(ld+cd*r+o*(ud+dd*r))]}NI.invert=function(e,t){for(var n=t,r=n*n,o=r*r*r,i=0,s,a,l;i<xQ&&(a=n*(ld+cd*r+o*(ud+dd*r))-t,l=ld+3*cd*r+o*(7*ud+9*dd*r),n-=s=a/l,r=n*n,o=r*r*r,!(at(s)<iI));++i);return[Eg*e*(ld+3*cd*r+o*(7*ud+9*dd*r))/ze(n),Zr(Ie(n)/Eg)]};function wQ(){return Bi(NI).scale(177.158)}function FI(e,t){var n=ze(t),r=ze(e)*n;return[n*Ie(e)/r,Ie(t)/r]}FI.invert=Mf(Qc);function SQ(){return Bi(FI).scale(144.049).clipAngle(60)}function LI(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)))]}LI.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 CQ(){return Bi(LI).scale(175.295)}function jI(e,t){return[ze(t)*Ie(e),Ie(t)]}jI.invert=Mf(Zr);function _Q(){return Bi(jI).scale(249.5).clipAngle(90+ke)}function $I(e,t){var n=ze(t),r=1+ze(e)*n;return[n*Ie(e)/r,Ie(t)/r]}$I.invert=Mf(function(e){return 2*Qc(e)});function EQ(){return Bi($I).scale(250).clipAngle(142)}function zI(e,t){return[hg(SS((Qt+t)/2)),-e]}zI.invert=function(e,t){return[-t,2*Qc(sI(e))-Qt]};function RQ(){var e=II(zI),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 pt(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 Hm(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function kS(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Zc(){}var Xa=.7,Lc=1/Xa,Zl="\\s*([+-]?\\d+)\\s*",Hd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Vo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",kQ=/^#([0-9a-f]{3,8})$/,PQ=new RegExp(`^rgb\\(${Zl},${Zl},${Zl}\\)$`),DQ=new RegExp(`^rgb\\(${Vo},${Vo},${Vo}\\)$`),MQ=new RegExp(`^rgba\\(${Zl},${Zl},${Zl},${Hd}\\)$`),OQ=new RegExp(`^rgba\\(${Vo},${Vo},${Vo},${Hd}\\)$`),AQ=new RegExp(`^hsl\\(${Hd},${Vo},${Vo}\\)$`),TQ=new RegExp(`^hsla\\(${Hd},${Vo},${Vo},${Hd}\\)$`),gk={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};Hm(Zc,PS,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:mk,formatHex:mk,formatHex8:IQ,formatHsl:NQ,formatRgb:bk,toString:bk});function mk(){return this.rgb().formatHex()}function IQ(){return this.rgb().formatHex8()}function NQ(){return VI(this).formatHsl()}function bk(){return this.rgb().formatRgb()}function PS(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=kQ.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?yk(t):n===3?new Hn(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=PQ.exec(e))?new Hn(t[1],t[2],t[3],1):(t=DQ.exec(e))?new Hn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=MQ.exec(e))?Uh(t[1],t[2],t[3],t[4]):(t=OQ.exec(e))?Uh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=AQ.exec(e))?wk(t[1],t[2]/100,t[3]/100,1):(t=TQ.exec(e))?wk(t[1],t[2]/100,t[3]/100,t[4]):gk.hasOwnProperty(e)?yk(gk[e]):e==="transparent"?new Hn(NaN,NaN,NaN,0):null}function yk(e){return new Hn(e>>16&255,e>>8&255,e&255,1)}function Uh(e,t,n,r){return r<=0&&(e=t=n=NaN),new Hn(e,t,n,r)}function BI(e){return e instanceof Zc||(e=PS(e)),e?(e=e.rgb(),new Hn(e.r,e.g,e.b,e.opacity)):new Hn}function Wd(e,t,n,r){return arguments.length===1?BI(e):new Hn(e,t,n,r??1)}function Hn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Hm(Hn,Wd,kS(Zc,{brighter(e){return e=e==null?Lc:Math.pow(Lc,e),new Hn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Xa:Math.pow(Xa,e),new Hn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Hn(Ia(this.r),Ia(this.g),Ia(this.b),Rg(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:vk,formatHex:vk,formatHex8:FQ,formatRgb:xk,toString:xk}));function vk(){return`#${ha(this.r)}${ha(this.g)}${ha(this.b)}`}function FQ(){return`#${ha(this.r)}${ha(this.g)}${ha(this.b)}${ha((isNaN(this.opacity)?1:this.opacity)*255)}`}function xk(){const e=Rg(this.opacity);return`${e===1?"rgb(":"rgba("}${Ia(this.r)}, ${Ia(this.g)}, ${Ia(this.b)}${e===1?")":`, ${e})`}`}function Rg(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ia(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ha(e){return e=Ia(e),(e<16?"0":"")+e.toString(16)}function wk(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 VI(e){if(e instanceof lo)return new lo(e.h,e.s,e.l,e.opacity);if(e instanceof Zc||(e=PS(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 LQ(e,t,n,r){return arguments.length===1?VI(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}Hm(lo,LQ,kS(Zc,{brighter(e){return e=e==null?Lc:Math.pow(Lc,e),new lo(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Xa:Math.pow(Xa,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 Hn(Z0(e>=240?e-240:e+120,o,r),Z0(e,o,r),Z0(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new lo(Sk(this.h),Gh(this.s),Gh(this.l),Rg(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=Rg(this.opacity);return`${e===1?"hsl(":"hsla("}${Sk(this.h)}, ${Gh(this.s)*100}%, ${Gh(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Sk(e){return e=(e||0)%360,e<0?e+360:e}function Gh(e){return Math.max(0,Math.min(1,e||0))}function Z0(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 jQ=Math.PI/180,$Q=180/Math.PI;var HI=-.14861,DS=1.78277,MS=-.29227,Wm=-.90649,qd=1.97294,Ck=qd*Wm,_k=qd*DS,Ek=DS*MS-Wm*HI;function zQ(e){if(e instanceof Na)return new Na(e.h,e.s,e.l,e.opacity);e instanceof Hn||(e=BI(e));var t=e.r/255,n=e.g/255,r=e.b/255,o=(Ek*r+Ck*t-_k*n)/(Ek+Ck-_k),i=r-o,s=(qd*(n-o)-MS*i)/Wm,a=Math.sqrt(s*s+i*i)/(qd*o*(1-o)),l=a?Math.atan2(s,i)*$Q-120:NaN;return new Na(l<0?l+360:l,a,o,e.opacity)}function Ko(e,t,n,r){return arguments.length===1?zQ(e):new Na(e,t,n,r??1)}function Na(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Hm(Na,Ko,kS(Zc,{brighter(e){return e=e==null?Lc:Math.pow(Lc,e),new Na(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Xa:Math.pow(Xa,e),new Na(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*jQ,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),o=Math.sin(e);return new Hn(255*(t+n*(HI*r+DS*o)),255*(t+n*(MS*r+Wm*o)),255*(t+n*(qd*r)),this.opacity)}}));function BQ(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 VQ(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 BQ((n-r/t)*t,s,o,i,a)}}const OS=e=>()=>e;function WI(e,t){return function(n){return e+n*t}}function HQ(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 WQ(e,t){var n=t-e;return n?WI(e,n>180||n<-180?n-360*Math.round(n/360):n):OS(isNaN(e)?t:e)}function qQ(e){return(e=+e)==1?Jl:function(t,n){return n-t?HQ(t,n,e):OS(isNaN(t)?n:t)}}function Jl(e,t){var n=t-e;return n?WI(e,n):OS(isNaN(e)?t:e)}(function e(t){var n=qQ(t);function r(o,i){var s=n((o=Wd(o)).r,(i=Wd(i)).r),a=n(o.g,i.g),l=n(o.b,i.b),c=Jl(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 UQ(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=Wd(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 GQ=UQ(VQ);function qI(e){return function t(n){n=+n;function r(o,i){var s=e((o=Ko(o)).h,(i=Ko(i)).h),a=Jl(o.s,i.s),l=Jl(o.l,i.l),c=Jl(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)}qI(WQ);var AS=qI(Jl);const Ot=e=>GQ(e[e.length-1]);var YQ=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(pt);const KQ=Ot(YQ);var XQ=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(pt);const QQ=Ot(XQ);var ZQ=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(pt);const JQ=Ot(ZQ);var eZ=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(pt);const tZ=Ot(eZ);var nZ=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(pt);const rZ=Ot(nZ);var oZ=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(pt);const iZ=Ot(oZ);var sZ=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(pt);const aZ=Ot(sZ);var lZ=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(pt);const cZ=Ot(lZ);var uZ=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(pt);const dZ=Ot(uZ);var fZ=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(pt);const hZ=Ot(fZ);var pZ=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(pt);const gZ=Ot(pZ);var mZ=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(pt);const bZ=Ot(mZ);var yZ=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(pt);const vZ=Ot(yZ);var xZ=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(pt);const wZ=Ot(xZ);var SZ=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(pt);const CZ=Ot(SZ);var _Z=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(pt);const EZ=Ot(_Z);var RZ=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(pt);const kZ=Ot(RZ);var PZ=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(pt);const DZ=Ot(PZ);var MZ=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(pt);const OZ=Ot(MZ);var AZ=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(pt);const TZ=Ot(AZ);var IZ=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(pt);const NZ=Ot(IZ);var FZ=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(pt);const LZ=Ot(FZ);var jZ=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(pt);const $Z=Ot(jZ);var zZ=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(pt);const BZ=Ot(zZ);var VZ=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(pt);const HZ=Ot(VZ);var WZ=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(pt);const qZ=Ot(WZ);var UZ=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(pt);const GZ=Ot(UZ);function YZ(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 KZ=AS(Ko(300,.5,0),Ko(-240,.5,1));var XZ=AS(Ko(-100,.75,.35),Ko(80,1.5,.8)),QZ=AS(Ko(260,.75,.35),Ko(80,1.5,.8)),Yh=Ko();function ZZ(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return Yh.h=360*e-100,Yh.s=1.5-1.5*t,Yh.l=.8-.9*t,Yh+""}var Kh=Wd(),JZ=Math.PI/3,eJ=Math.PI*2/3;function tJ(e){var t;return e=(.5-e)*Math.PI,Kh.r=255*(t=Math.sin(e))*t,Kh.g=255*(t=Math.sin(e+JZ))*t,Kh.b=255*(t=Math.sin(e+eJ))*t,Kh+""}function nJ(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 qm(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}const rJ=qm(pt("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));var oJ=qm(pt("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),iJ=qm(pt("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),sJ=qm(pt("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function aJ(e){return e}function lJ(e){if(e==null)return aJ;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 cJ(e,t){for(var n,r=e.length,o=r-t;o<--r;)n=e[o],e[o++]=e[r],e[r]=n}function uJ(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(n){return Rk(e,n)})}:Rk(e,t)}function Rk(e,t){var n=t.id,r=t.bbox,o=t.properties==null?{}:t.properties,i=dJ(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 dJ(e,t){var n=lJ(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&&cJ(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 fd={geoAzimuthalEqualArea:fQ,geoAzimuthalEquidistant:hQ,geoGnomonic:SQ,geoOrthographic:_Q,geoStereographic:EQ,geoEqualEarth:wQ,geoAlbers:MI,geoAlbersUsa:dQ,geoConicConformal:mQ,geoConicEqualArea:Cg,geoConicEquidistant:vQ,geoEquirectangular:bQ,geoMercator:pQ,geoTransverseMercator:RQ,geoNaturalEarth1:CQ};Object.keys(fd).forEach(e=>{fd[`${e.charAt(3).toLowerCase()}${e.slice(4)}`]=fd[e]});class dl extends Ts{constructor(t){super(t),this.outlineBounds=null,this.oldChartBounds=null,this.geoPath=dk()}init(t){t.position="chartArea",super.init(t),typeof t.projection=="function"?this.projection=t.projection:this.projection=(fd[t.projection]||fd.albersUsa)(),this.geoPath.projection(this.projection),this.outlineBounds=null,this.oldChartBounds=null}computeBounds(t){const n=dk(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}}dl.id="projection";dl.defaults={projection:"albersUsa",projectionScale:1,projectionOffset:[0,0],padding:0};dl.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 fJ(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 hJ(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=fJ(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 Vl extends Ya{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=hJ(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 UI extends Tc{constructor(){super(...arguments),this.legendSize={w:0,h:0}}init(t){Vl.prototype.init.call(this,t)}parse(t,n){return Vl.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 Vl.prototype.update.call(this,t,n,r)}_computeLabelArea(){}draw(t){return Vl.prototype.draw.call(this,t)}_drawIndicator(){}}const _i={interpolateBlues:LZ,interpolateBrBG:KQ,interpolateBuGn:hZ,interpolateBuPu:gZ,interpolateCividis:YZ,interpolateCool:QZ,interpolateCubehelixDefault:KZ,interpolateGnBu:bZ,interpolateGreens:$Z,interpolateGreys:BZ,interpolateInferno:iJ,interpolateMagma:oJ,interpolateOrRd:vZ,interpolateOranges:GZ,interpolatePRGn:QQ,interpolatePiYG:JQ,interpolatePlasma:sJ,interpolatePuBu:CZ,interpolatePuBuGn:wZ,interpolatePuOr:tZ,interpolatePuRd:EZ,interpolatePurples:HZ,interpolateRainbow:ZZ,interpolateRdBu:rZ,interpolateRdGy:iZ,interpolateRdPu:kZ,interpolateRdYlBu:aZ,interpolateRdYlGn:cZ,interpolateReds:qZ,interpolateSinebow:tJ,interpolateSpectral:dZ,interpolateTurbo:nJ,interpolateViridis:rJ,interpolateWarm:XZ,interpolateYlGn:OZ,interpolateYlGnBu:DZ,interpolateYlOrBr:TZ,interpolateYlOrRd:NZ};Object.keys(_i).forEach(e=>{_i[`${e.charAt(11).toLowerCase()}${e.slice(12)}`]=_i[e],_i[e.slice(11)]=_i[e]});function GI(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 YI={interpolate:"blues",missing:"transparent",quantize:0};class ws extends Vl{get interpolate(){const t=this.options;return t?typeof t.interpolate=="function"?t.interpolate:_i[t.interpolate]||_i.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=GI(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)}}}}ws.id="color";ws.defaults=pn({},[Ya.defaults,Um,YI]);ws.descriptors={_scriptable:e=>e!=="interpolate",_indexable:!1};class TS extends UI{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=_i[t.interpolate]||_i.blues}getColorForValue(t){return ws.prototype.getColorForValue.call(this,t)}getColor(t){let n=t;return this.options.quantize>0&&(n=GI(n,this.options.quantize)),this.interpolate(n)}_drawIndicator(){return ws.prototype._drawIndicator.call(this)}}TS.id="colorLogarithmic";TS.defaults=pn({},[Tc.defaults,Um,YI]);TS.descriptors={_scriptable:e=>e!=="interpolate",_indexable:!1};const KI={missing:1,mode:"area",range:[2,20],legend:{align:"bottom",length:90,width:70,indicatorWidth:42}};class Ss extends Vl{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};lg(t,f,d,h)})}}Ss.id="size";Ss.defaults=pn({},[Ya.defaults,Um,KI]);Ss.descriptors={_scriptable:!0,_indexable:e=>e!=="range"};class XI extends UI{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 Ss.prototype.getSizeImpl.call(this,t)}_drawIndicator(){Ss.prototype._drawIndicator.call(this)}}XI.id="sizeLogarithmic";XI.defaults=pn({},[Tc.defaults,Um,KI]);function pJ(e,t){return[[e[0][0]-t,e[0][1]-t],[e[1][0]+t,e[1][1]+t]]}class ji extends oi{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&&HX(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=pJ(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())}}ji.id="geoFeature";ji.defaults={...Bo.defaults,outlineBackgroundColor:null,outlineBorderWidth:0,graticuleBorderColor:"#CCCCCC",graticuleBorderWidth:0};ji.defaultRoutes={outlineBorderColor:"borderColor",...Bo.defaultRoutes||{}};const QI={showOutline:!1,showGraticule:!1,clipMap:!0},ZI={scales:{projection:{axis:"x",type:dl.id,position:"chartArea",display:!1}}};function kk(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 JI 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=kk(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=kk(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(WX());else{const s=pI();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,Pa(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||Pa(t.ctx,t.chartArea):r&&(r=!1,Da(t.ctx)),this.showGraticule(),n===!0||n==="items"?r||Pa(t.ctx,t.chartArea):r&&(r=!1,Da(t.ctx)),this.getMeta().data.forEach(o=>o.draw.call(o,t.ctx,t.chartArea)),r&&(r=!1,Da(t.ctx))}}function e5(e,t,n,r=[],o=[]){un.addControllers(n),Array.isArray(r)?un.addElements(...r):un.addElements(r),Array.isArray(o)?un.addScales(...o):un.addScales(o);const i=t;return i.type=e,i}class Jc extends JI{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])}}Jc.id="choropleth";Jc.defaults=pn({},[QI,{datasetElementType:ji.id,dataElementType:ji.id}]);Jc.overrides=pn({},[ZI,{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:ws.id,axis:"x"}},elements:{geoFeature:{backgroundColor(e){return e.dataIndex==null?null:e.chart.getDatasetMeta(e.datasetIndex).controller.indexToColor(e.dataIndex)}}}}]);class gJ extends Mt{constructor(t,n){super(t,e5("choropleth",n,Jc,ji,[ws,dl]))}}gJ.id=Jc.id;class eu extends JI{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])}}eu.id="bubbleMap";eu.defaults=pn({},[QI,{dataElementType:Ta.id,datasetElementType:ji.id,showOutline:!0,clipMap:"outline+graticule"}]);eu.overrides=pn({},[ZI,{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:Ss.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 mJ extends Mt{constructor(t,n){super(t,e5("bubbleMap",n,eu,ji,[Ss,dl]))}}mJ.id=eu.id;function bJ(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 yJ(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 vJ(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 xJ(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 wJ(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 SJ(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 CJ(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 _J(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:vt.slate[800]},angleLines:{color:vt.slate[800]},ticks:{color:vt.slate[800],showLabelBackdrop:!1}}}}}),n}function EJ(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 RJ({data:e,cfg:t,customCfg:n,preferences:r,cardType:o}){var k,M,D,A,I;const i=((k=r==null?void 0:r.chartOptions)==null?void 0:k.indexAxis)||"y",s={...t,options:{indexAxis:i}},{metricKeys:a,dimensionKeys:l}=vn(e),c=tT(a,e),u=Xl(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}=Lm((r==null?void 0:r.customVisualCode)||""),f=l[0],p=Fm(e,f),g=On((s==null?void 0:s.options)||{},(n==null?void 0:n.options)||{}),m=On(g,(r==null?void 0:r.chartOptions)||{});Array(u.length).fill(!0);const y=e.map($=>$[f]),x=e.map($=>$[a[0]]),v=(M=u[0])==null?void 0:M.backgroundColor.slice(),_={...m,plugins:{...m.plugins,legend:{...(D=m.plugins)==null?void 0:D.legend,labels:{generateLabels:$=>{const j=$.data.labels;return y.map((T,N)=>({text:T,fillStyle:v[N],hidden:!j.includes(T.toString()),index:N,datasetIndex:0,lineWidth:0}))}},onClick:($,j,T)=>{const N=T.chart,F=j.index,z=y[F],B=N.data.datasets[0],O=N.data.labels,q=B.data,L=B.backgroundColor,P=O.indexOf(z.toString());P>=0?(O.splice(P,1),q.splice(P,1),L.splice(P,1)):(O.splice(F,0,y[F].toString()),q.splice(F,0,Number(x[F])),L.splice(F,0,v[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,q;const T=((B=(z=$==null?void 0:$[0])==null?void 0:z.dataset)==null?void 0:B.data).reduce((L,P)=>L+P,0),F=(((O=$==null?void 0:$[0])==null?void 0:O.parsed[i==="x"?"y":"x"])/T*100).toFixed(2);return`${(q=$==null?void 0:$[0])==null?void 0:q.label} (${F}%)`},label:function($){var q,L,P,H;$.dataset.label;const j=$.dataset.data;j.reduce((U,Y)=>U+Y,0);const T=$.parsed[i==="x"?"y":"x"],N=j.indexOf(T),F=j[N-1],z=br({number:Number(T),decimalPlaces:((q=r==null?void 0:r.numberAxisFormat)==null?void 0:q.decimalPlaces)||0,useSuffix:!!((L=r==null?void 0:r.numberAxisFormat)!=null&&L.suffix),customSuffix:"",locale:((P=r==null?void 0:r.numberAxisFormat)==null?void 0:P.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: ${B}%`:"")}}}}},C=On(m,_),w=On(C,h);return delete w.scales,{type:o,data:{labels:p,datasets:u},options:w,plugins:[...d]}}function kJ({data:e,cfg:t,customCfg:n,preferences:r}){var C,w;const o=xJ(t),i=PJ(e),s=Xl(i,n),{plugins:a,options:l}=Lm((r==null?void 0:r.customVisualCode)||""),c=On((o==null?void 0:o.options)||{},(t==null?void 0:t.options)||{}),u=On(c,(r==null?void 0:r.chartOptions)||{}),d=On(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(S){if(Array.isArray(S.raw)&&S.raw.every(k=>k===null))return null}}}}},f=On(h,l),p=iT(t,r),g=On(f,p),m={...g,plugins:{...g==null?void 0:g.plugins,datalabels:{...(w=g==null?void 0:g.plugins)==null?void 0:w.datalabels,formatter:(S,k)=>S.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:y}=vn(e),x=y[0];return{type:"bar",data:{labels:[...new Set(Fm(e,x))],datasets:s},options:m,plugins:[...a]}}function PJ(e){var d,h,f,p;const{dimensionKeys:t,metricKeys:n}=vn(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 y=e.filter(_=>(_==null?void 0:_[s])===g),v=l.map(_=>{const C=y.filter(w=>(w==null?void 0:w[a])===_);return C.length===0?[[null,null,null]]:C.map(w=>[w==null?void 0:w[n[0]],w==null?void 0:w[n[1]],w==null?void 0:w[n[2]],_])}).flat();return{label:g,data:v,backgroundColor:o==null?void 0:o[m%o.length],borderColor:i==null?void 0:i[m%i.length],borderSkipped:!1}})}function IS({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,y,x,v,_;let c=e;const u=l&&l.pivotColumns&&l.pivotColumns.length>0,d=l&&l.groupByColumns&&l.groupByColumns.length>0;if(u&&d&&(c=bq(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 w=uJ(a,(f=a==null?void 0:a.objects)==null?void 0:f[C]).features;if(!w)return null;const S={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:((y=s==null?void 0:s.mapVisualOptions)==null?void 0:y.colorScale)||"blues",quantize:5,legend:{position:"bottom-right",align:"right"}}}},{keys:k}=vn(c),M=w.map(T=>{var B;const N=k==null?void 0:k[0],F=k==null?void 0:k[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=Xl([{label:C,data:M,borderColor:"lightgray"}],r),I={type:"choropleth",data:{labels:w.map(T=>T.properties.NAME||T.properties.name),datasets:A},options:S},{options:$}=ax({cfg:I,preferences:s,customCfg:r,cardType:t});return{...I,options:$}}if(t==="bar"){const C=vJ(n);return Us({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="horizontalBar"){const C=bJ(n);return Us({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="funnel")return RJ({data:c,cfg:n,customCfg:r,preferences:s,cardType:t});if(t==="pyramid"){const C=yJ(n),{dimensionKeys:w,metricKeys:S}=vn(c),k=rg({dataArray:c,groupKey:w[0],pivotKey:w[1],valueKey:S[0]}),M=Us({data:k,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:{...(x=M==null?void 0:M.options)==null?void 0:x.scales,[D]:{beginAtZero:!0,stack:1}}}}}if(t==="stackedBar"||t==="stackedLine"){const C=wJ(n,t),{dimensionKeys:w,metricKeys:S}=vn(c);return(!u||!d)&&(c=rg({dataArray:c,groupKey:w[0],pivotKey:w[1],valueKey:S[0],sortChart:s==null?void 0:s.sortChart})),Us({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="line"){const C=SJ(n);return Us({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="range")return kJ({data:c,cfg:n,customCfg:r,preferences:s});if(t==="pie"||t==="doughnut"||t==="polarArea"){const C=CJ(t,n),{dimensionKeys:w,metricKeys:S}=vn(c),k=tT(S,c),M=Xl(k,r),{plugins:D,options:A}=Lm((s==null?void 0:s.customVisualCode)||""),I=w[0],$=Fm(c,I),j=On((C==null?void 0:C.options)||{},(r==null?void 0:r.options)||{}),T=On(j,(s==null?void 0:s.chartOptions)||{}),N={...T,plugins:{...T.plugins,datalabels:{...(v=T.plugins)==null?void 0:v.datalabels,formatter:(q,L)=>{var P,H,U,Y;return br({number:Number(q),decimalPlaces:((P=s==null?void 0:s.numberAxisFormat)==null?void 0:P.decimalPlaces)||0,useSuffix:!!((H=s==null?void 0:s.numberAxisFormat)!=null&&H.suffix),customSuffix:"",locale:((U=s==null?void 0:s.numberAxisFormat)==null?void 0:U.locale)||"",currency:((Y=s==null?void 0:s.numberAxisFormat)==null?void 0:Y.currency)||""})}},tooltip:{...(_=T.plugins)==null?void 0:_.tooltip,callbacks:{label:function(q){var W,G,X,J;q.dataset.label;const P=q.dataset.data.reduce((ne,Q)=>ne+Q,0),H=q.parsed,U=br({number:Number(H),decimalPlaces:((W=s==null?void 0:s.numberAxisFormat)==null?void 0:W.decimalPlaces)||0,useSuffix:!!((G=s==null?void 0:s.numberAxisFormat)!=null&&G.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/P*100).toFixed(2);return U+` (${Y}%)`}}}}},F=On(T,N),z=On(F,A);return{type:t,data:{labels:$,datasets:M},options:z,plugins:[t==="doughnut"?{id:"doughnutLabel",beforeDatasetsDraw:function(q,L,P){var Q,oe,ee,ue;const{ctx:H,data:U}=q;H.save();const Y=q.getDatasetMeta(0).data[0].x,W=q.getDatasetMeta(0).data[0].y,G=Ec(Dd()),X=window.getComputedStyle(H.canvas).fontFamily;H.font=`1em ${X}`,H.fontWeight="bolder",H.fillStyle=G,H.textAlign="center",H.textBaseline="middle";const J=U.datasets[0].data.reduce((pe,we)=>pe+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=_J(n);return Us({data:c,cfg:C,customCfg:r,cardType:t,preferences:s})}if(t==="bubble"||t==="scatter"){const{metricKeys:C}=vn(c),w=sq(c,t),S=Xl(w,r),k=EJ(n,t,C),{options:M}=ax({cardType:t,cfg:k,preferences:s,customCfg:r});return{type:t,data:{datasets:S},options:M}}return Us({data:c,cfg:n,customCfg:r,cardType:t,preferences:s})}function DJ({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)&&OJ(e,t,o,i,a),["pie","doughnut","polarArea","funnel"].includes(r)&&AJ(e,t,o,i,a),["stackedBar","pyramid"].includes(r)&&MJ({chart:e,elementIndex:t,datasetIndex:n,cfg:o,apply:i,blurColor:a})}function MJ(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,y,x;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((x=(y=(m=o==null?void 0:o.data)==null?void 0:m.datasets)==null?void 0:y[h])==null?void 0:x.borderColor)}),t==null||t.update()}function OJ(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 AJ(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,y,x;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=(y=c==null?void 0:c.backgroundColor)==null?void 0:y.map((v,_)=>{var C;return(C=n.data.datasets[u].backgroundColor)==null?void 0:C[_]}),c.borderColor=(x=c==null?void 0:c.borderColor)==null?void 0:x.map((v,_)=>{var C;return(C=n.data.datasets[u].borderColor)==null?void 0:C[_]})}),e==null||e.update()}function TJ({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}=vn(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=rg({dataArray:t,groupKey:h[0],pivotKey:h[1],valueKey:f[0]}),g=h[0],m=(u=p[r])==null?void 0:u[g],y=h[1],{metricKeys:x}=vn(p),v=x[n];return[{columnName:g,columnValue:m,metric:f[0],value:o},{columnName:y,columnValue:v,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 IJ(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,mq("--semaphor-background")),c})}));return{...e,data:{...e.data,datasets:i}}}return e}function t5(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}=co({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 NJ(e){var s,a;const[t]=E.useState({id:"",title:"",type:"bar"}),{getCard:n}=rn(),r=n(e),o=n5(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 n5(e){var D;const{onChartElementClicked:t}=wr(),[n,r]=E.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=E.useRef(l),u=(D=e==null?void 0:e.preferences)==null?void 0:D.onClickFilter,{addFilteringCard:d,addOrUpdateFilterValues:h,removeFilterValues:f,removeFilteringCard:p}=rn(),{data:g,isLoading:m,isFetching:y,isError:x,queryKey:v,isFilteringCard:_,isSingleCardFrame:C}=Li(e),{data:w}=t5(e);let S;S=E.useMemo(()=>{if(!(!(g!=null&&g.records)||!(g!=null&&g.records.length)))return IS({data:g==null?void 0:g.records,cardType:e.type,queryConfig:e.queryConfig,customCfg:e.customCfg,preferences:e.preferences,topoJson:w})},[g==null?void 0:g.records,e,w,o]);const k=E.useRef({filteringCards:i});E.useEffect(()=>{e.connectionId&&!_&&(c.current=l)},[l,a,e.connectionId,_]),E.useEffect(()=>{var I;_&&(k.current.filteringCards=[...i||[]]),!_&&((I=k.current.filteringCards)==null?void 0:I.find($=>$.id===e.id))&&C&&r($=>$+1)},[_,C,e.id,i]);function M(A,I,$,j){var F;let T=!1;if(!(g!=null&&g.records))return;const N=TJ({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(_){const z=e.id;f(z),p(e)}else{if(T=!0,!N)return;const z=[];N.forEach((B,O)=>{const q=u==null?void 0:u.find(P=>P.columnIndex===O);if(!q)return;const L={filterId:e.id+"-"+B.columnName+"-"+s,connectionId:e==null?void 0:e.connectionId,tableName:e.lastSelectedTable,name:B.columnName,expression:q.expression,valueType:pm(N[q.columnIndex].columnValue),operation:"=",values:[N[q.columnIndex].columnValue]};z.push(L)}),h(z),d(e)}DJ({chart:A,elementIndex:$,datasetIndex:I,cardType:e.type,cfg:S,apply:T})}}return{isError:x,isLoading:m,isFetching:y,data:g,visualKey:n,handleDatapointClick:M,cfg:S,queryKey:v}}function Ho({children:e,containerClassName:t,className:n,text:r,onSave:o,type:i="input",placeholder:s,enabled:a}){const[l,c]=E.useState(!1),[u,d]=E.useState(r),h=se(y=>y.isDashboardEditing);E.useEffect(()=>{d(y=>y!==r?r:y)},[r]);const f=y=>{y.stopPropagation(),h&&c(!0)};function p(y){if(y.stopPropagation(),y.key==="Escape"){c(!1);return}y.key==="Enter"&&y.shiftKey||(y.key==="Enter"||y.key==="Tab")&&(c(!1),o(u))}function g(){return i==="textarea"?b.jsx("textarea",{className:ie("resize rounded-sm bg-background px-2 py-1 text-sm outline-[0.5px] outline-muted",n),onChange:y=>d(y.target.value),value:u,autoFocus:!0,placeholder:s,onBlur:()=>c(!1),onKeyDown:p}):b.jsx("input",{onMouseDown:y=>y.stopPropagation(),type:"text",className:ie("rounded-sm bg-background px-2 py-1 text-sm outline-[0.5px] outline-muted",n),onChange:y=>d(y.target.value),value:u,autoFocus:!0,placeholder:s,onBlur:()=>c(!1),onKeyDown:p})}function m(){return a?b.jsxs("div",{className:"flex grow items-center gap-2",children:[b.jsx("div",{children:l?g():e}),!l&&b.jsx(eS,{onClick:()=>c(!0),className:"hidden size-3 cursor-pointer text-muted-foreground group-hover/editable:block"})]}):e}return b.jsx("div",{className:ie("flex",t),role:"editable",onDoubleClick:f,onMouseDown:y=>y.stopPropagation(),children:b.jsx("div",{className:"group/editable flex grow items-center gap-2",children:m()})})}function r5(e){const{authToken:t}=wr(),n=yz(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 kg({card:e,data:t}){var v,_,C,w,S,k,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=lt(B=>B.card),a=lt(B=>B.actions.setCard);lt(B=>B.actions.setNumberFormat);const{getCurrency:l,getLocale:c}=r5(e),u=se(B=>B.selectedSheetId),d=(_=(v=e.preferences)==null?void 0:v.formatNumber)==null?void 0:_.colorRanges,{metricKeys:h}=vn(t),f=(C=t==null?void 0:t[0])==null?void 0:C[h==null?void 0:h[0]],p=(w=t==null?void 0:t[0])==null?void 0:w[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 y(B){o?a({...s,description:B}):r(u,e.id,B)}const x=p&&p-f!==0?(f-p)/p:null;return b.jsxs("div",{className:"kpi-card flex grow flex-col overflow-auto",children:[b.jsxs(gm,{className:"grow pb-3",children:[b.jsx(Ho,{enabled:i,text:o?s.title:e.title,onSave:m,children:b.jsx("div",{className:"flex items-center gap-2",children:b.jsx(Kc,{className:"text-base font-medium text-muted-foreground",children:e.title})})}),g&&b.jsxs("div",{className:"flex flex-wrap items-end gap-3 text-foreground",children:[b.jsx("p",{style:{color:rS(f,d)},className:"text-3xl font-semibold",children:br({number:f,decimalPlaces:((k=(S=e.preferences)==null?void 0:S.formatNumber)==null?void 0:k.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&&b.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()||""})]})]})]}),x&&b.jsxs(mm,{className:"grow items-start gap-1 pb-4 text-sm",children:[b.jsx(o5,{children:x}),b.jsxs("div",{className:"flex gap-1 text-muted-foreground",children:[x>0?"up ":"down ",b.jsx(Ho,{enabled:i,text:e.description||"",onSave:y,children:e.description})]})]})]})}function o5({children:e,className:t}){var i,s;const n=se(a=>a.themeStyle),r=e>0?b.jsx("span",{children:"+"}):b.jsx("span",{children:"-"}),o=`${Math.abs(e*100).toFixed(0)}%`;return b.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,b.jsx("span",{className:"ml-[1px]",children:o})]})}const FJ=["top","right","bottom","left"],$i=Math.min,Bn=Math.max,Ud=Math.round,Xh=Math.floor,Wo=e=>({x:e,y:e}),LJ={left:"right",right:"left",bottom:"top",top:"bottom"},jJ={start:"end",end:"start"};function $x(e,t,n){return Bn(e,$i(t,n))}function Xo(e,t){return typeof e=="function"?e(t):e}function zi(e){return e.split("-")[0]}function tu(e){return e.split("-")[1]}function NS(e){return e==="x"?"y":"x"}function FS(e){return e==="y"?"height":"width"}function Cs(e){return["top","bottom"].includes(zi(e))?"y":"x"}function LS(e){return NS(Cs(e))}function $J(e,t,n){n===void 0&&(n=!1);const r=tu(e),o=LS(e),i=FS(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Pg(s)),[s,Pg(s)]}function zJ(e){const t=Pg(e);return[zx(e),t,zx(t)]}function zx(e){return e.replace(/start|end/g,t=>jJ[t])}function BJ(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 VJ(e,t,n,r){const o=tu(e);let i=BJ(zi(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(zx)))),i}function Pg(e){return e.replace(/left|right|bottom|top/g,t=>LJ[t])}function HJ(e){return{top:0,right:0,bottom:0,left:0,...e}}function i5(e){return typeof e!="number"?HJ(e):{top:e,right:e,bottom:e,left:e}}function Dg(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 Pk(e,t,n){let{reference:r,floating:o}=e;const i=Cs(t),s=LS(t),a=FS(s),l=zi(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(tu(t)){case"start":f[s]-=h*(n&&c?-1:1);break;case"end":f[s]+=h*(n&&c?-1:1);break}return f}const WJ=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}=Pk(c,r,l),h=r,f={},p=0;for(let g=0;g<a.length;g++){const{name:m,fn:y}=a[g],{x,y:v,data:_,reset:C}=await y({x:u,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:f,rects:c,platform:s,elements:{reference:e,floating:t}});u=x??u,d=v??d,f={...f,[m]:{...f[m],..._}},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}=Pk(c,h,l)),g=-1)}return{x:u,y:d,placement:h,strategy:o,middlewareData:f}};async function jc(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}=Xo(t,e),p=i5(f),m=a[h?d==="floating"?"reference":"floating":d],y=Dg(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})),x=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),_=await(i.isElement==null?void 0:i.isElement(v))?await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1}:{x:1,y:1},C=Dg(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:v,strategy:l}):x);return{top:(y.top-C.top+p.top)/_.y,bottom:(C.bottom-y.bottom+p.bottom)/_.y,left:(y.left-C.left+p.left)/_.x,right:(C.right-y.right+p.right)/_.x}}const qJ=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}=Xo(e,t)||{};if(c==null)return{};const d=i5(u),h={x:n,y:r},f=LS(o),p=FS(f),g=await s.getDimensions(c),m=f==="y",y=m?"top":"left",x=m?"bottom":"right",v=m?"clientHeight":"clientWidth",_=i.reference[p]+i.reference[f]-h[f]-i.floating[p],C=h[f]-i.reference[f],w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let S=w?w[v]:0;(!S||!await(s.isElement==null?void 0:s.isElement(w)))&&(S=a.floating[v]||i.floating[p]);const k=_/2-C/2,M=S/2-g[p]/2-1,D=$i(d[y],M),A=$i(d[x],M),I=D,$=S-g[p]-A,j=S/2-g[p]/2+k,T=$x(I,j,$),N=!l.arrow&&tu(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}}}),UJ=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}=Xo(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=zi(o),x=Cs(a),v=zi(a)===a,_=await(l.isRTL==null?void 0:l.isRTL(c.floating)),C=h||(v||!g?[Pg(a)]:zJ(a)),w=p!=="none";!h&&w&&C.push(...VJ(a,g,p,_));const S=[a,...C],k=await jc(t,m),M=[];let D=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&M.push(k[y]),d){const j=$J(o,s,_);M.push(k[j[0]],k[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=S[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(w){const B=Cs(z.placement);return B===x||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 Dk(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Mk(e){return FJ.some(t=>e[t]>=0)}const GJ=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Xo(e,t);switch(r){case"referenceHidden":{const i=await jc(t,{...o,elementContext:"reference"}),s=Dk(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Mk(s)}}}case"escaped":{const i=await jc(t,{...o,altBoundary:!0}),s=Dk(i,n.floating);return{data:{escapedOffsets:s,escaped:Mk(s)}}}default:return{}}}}};async function YJ(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=zi(n),a=tu(n),l=Cs(n)==="y",c=["left","top"].includes(s)?-1:1,u=i&&l?-1:1,d=Xo(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 KJ=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 YJ(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}}}}},XJ=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:y,y:x}=m;return{x:y,y:x}}},...l}=Xo(e,t),c={x:n,y:r},u=await jc(t,l),d=Cs(zi(o)),h=NS(d);let f=c[h],p=c[d];if(i){const m=h==="y"?"top":"left",y=h==="y"?"bottom":"right",x=f+u[m],v=f-u[y];f=$x(x,f,v)}if(s){const m=d==="y"?"top":"left",y=d==="y"?"bottom":"right",x=p+u[m],v=p-u[y];p=$x(x,p,v)}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}}}}}},QJ=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}=Xo(e,t),u={x:n,y:r},d=Cs(o),h=NS(d);let f=u[h],p=u[d];const g=Xo(a,t),m=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const v=h==="y"?"height":"width",_=i.reference[h]-i.floating[v]+m.mainAxis,C=i.reference[h]+i.reference[v]-m.mainAxis;f<_?f=_:f>C&&(f=C)}if(c){var y,x;const v=h==="y"?"width":"height",_=["top","left"].includes(zi(o)),C=i.reference[d]-i.floating[v]+(_&&((y=s.offset)==null?void 0:y[d])||0)+(_?0:m.crossAxis),w=i.reference[d]+i.reference[v]+(_?0:((x=s.offset)==null?void 0:x[d])||0)-(_?m.crossAxis:0);p<C?p=C:p>w&&(p=w)}return{[h]:f,[d]:p}}}},ZJ=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}=Xo(e,t),u=await jc(t,c),d=zi(o),h=tu(o),f=Cs(o)==="y",{width:p,height:g}=i.floating;let m,y;d==="top"||d==="bottom"?(m=d,y=h===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,m=h==="end"?"top":"bottom");const x=g-u.top-u.bottom,v=p-u.left-u.right,_=$i(g-u[m],x),C=$i(p-u[y],v),w=!t.middlewareData.shift;let S=_,k=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(k=v),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(S=x),w&&!h){const D=Bn(u.left,0),A=Bn(u.right,0),I=Bn(u.top,0),$=Bn(u.bottom,0);f?k=p-2*(D!==0||A!==0?D+A:Bn(u.left,u.right)):S=g-2*(I!==0||$!==0?I+$:Bn(u.top,u.bottom))}await l({...t,availableWidth:k,availableHeight:S});const M=await s.getDimensions(a.floating);return p!==M.width||g!==M.height?{reset:{rects:!0}}:{}}}};function Gm(){return typeof window<"u"}function nu(e){return s5(e)?(e.nodeName||"").toLowerCase():"#document"}function Ir(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ii(e){var t;return(t=(s5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function s5(e){return Gm()?e instanceof Node||e instanceof Ir(e).Node:!1}function Wn(e){return Gm()?e instanceof Element||e instanceof Ir(e).Element:!1}function Qo(e){return Gm()?e instanceof HTMLElement||e instanceof Ir(e).HTMLElement:!1}function Ok(e){return!Gm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ir(e).ShadowRoot}function Of(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=go(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function JJ(e){return["table","td","th"].includes(nu(e))}function Ym(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function jS(e){const t=$S(),n=Wn(e)?go(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 eee(e){let t=_s(e);for(;Qo(t)&&!$c(t);){if(jS(t))return t;if(Ym(t))return null;t=_s(t)}return null}function $S(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function $c(e){return["html","body","#document"].includes(nu(e))}function go(e){return Ir(e).getComputedStyle(e)}function Km(e){return Wn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function _s(e){if(nu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ok(e)&&e.host||ii(e);return Ok(t)?t.host:t}function a5(e){const t=_s(e);return $c(t)?e.ownerDocument?e.ownerDocument.body:e.body:Qo(t)&&Of(t)?t:a5(t)}function Gd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=a5(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Ir(o);if(i){const a=Bx(s);return t.concat(s,s.visualViewport||[],Of(o)?o:[],a&&n?Gd(a):[])}return t.concat(o,Gd(o,[],n))}function Bx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function l5(e){const t=go(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Qo(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Ud(n)!==i||Ud(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function zS(e){return Wn(e)?e:e.contextElement}function ec(e){const t=zS(e);if(!Qo(t))return Wo(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=l5(t);let s=(i?Ud(n.width):n.width)/r,a=(i?Ud(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const tee=Wo(0);function c5(e){const t=Ir(e);return!$S()||!t.visualViewport?tee:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nee(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ir(e)?!1:t}function Qa(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=zS(e);let s=Wo(1);t&&(r?Wn(r)&&(s=ec(r)):s=ec(e));const a=nee(i,n,r)?c5(i):Wo(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=Ir(i),f=r&&Wn(r)?Ir(r):r;let p=h,g=Bx(p);for(;g&&r&&f!==p;){const m=ec(g),y=g.getBoundingClientRect(),x=go(g),v=y.left+(g.clientLeft+parseFloat(x.paddingLeft))*m.x,_=y.top+(g.clientTop+parseFloat(x.paddingTop))*m.y;l*=m.x,c*=m.y,u*=m.x,d*=m.y,l+=v,c+=_,p=Ir(g),g=Bx(p)}}return Dg({width:u,height:d,x:l,y:c})}function BS(e,t){const n=Km(e).scrollLeft;return t?t.left+n:Qa(ii(e)).left+n}function u5(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:BS(e,r)),i=r.top+t.scrollTop;return{x:o,y:i}}function ree(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=ii(r),a=t?Ym(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Wo(1);const u=Wo(0),d=Qo(r);if((d||!d&&!i)&&((nu(r)!=="body"||Of(s))&&(l=Km(r)),Qo(r))){const f=Qa(r);c=ec(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const h=s&&!d&&!i?u5(s,l,!0):Wo(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 oee(e){return Array.from(e.getClientRects())}function iee(e){const t=ii(e),n=Km(e),r=e.ownerDocument.body,o=Bn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Bn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+BS(e);const a=-n.scrollTop;return go(r).direction==="rtl"&&(s+=Bn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function see(e,t){const n=Ir(e),r=ii(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=$S();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function aee(e,t){const n=Qa(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Qo(e)?ec(e):Wo(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 Ak(e,t,n){let r;if(t==="viewport")r=see(e,n);else if(t==="document")r=iee(ii(e));else if(Wn(t))r=aee(t,n);else{const o=c5(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Dg(r)}function d5(e,t){const n=_s(e);return n===t||!Wn(n)||$c(n)?!1:go(n).position==="fixed"||d5(n,t)}function lee(e,t){const n=t.get(e);if(n)return n;let r=Gd(e,[],!1).filter(a=>Wn(a)&&nu(a)!=="body"),o=null;const i=go(e).position==="fixed";let s=i?_s(e):e;for(;Wn(s)&&!$c(s);){const a=go(s),l=jS(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Of(s)&&!l&&d5(e,s))?r=r.filter(u=>u!==s):o=a,s=_s(s)}return t.set(e,r),r}function cee(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?Ym(t)?[]:lee(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const d=Ak(t,u,o);return c.top=Bn(d.top,c.top),c.right=$i(d.right,c.right),c.bottom=$i(d.bottom,c.bottom),c.left=Bn(d.left,c.left),c},Ak(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function uee(e){const{width:t,height:n}=l5(e);return{width:t,height:n}}function dee(e,t,n){const r=Qo(t),o=ii(t),i=n==="fixed",s=Qa(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Wo(0);if(r||!r&&!i)if((nu(t)!=="body"||Of(o))&&(a=Km(t)),r){const h=Qa(t,!0,i,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else o&&(l.x=BS(o));const c=o&&!r&&!i?u5(o,a):Wo(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 J0(e){return go(e).position==="static"}function Tk(e,t){if(!Qo(e)||go(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ii(e)===n&&(n=n.ownerDocument.body),n}function f5(e,t){const n=Ir(e);if(Ym(e))return n;if(!Qo(e)){let o=_s(e);for(;o&&!$c(o);){if(Wn(o)&&!J0(o))return o;o=_s(o)}return n}let r=Tk(e,t);for(;r&&JJ(r)&&J0(r);)r=Tk(r,t);return r&&$c(r)&&J0(r)&&!jS(r)?n:r||eee(e)||n}const fee=async function(e){const t=this.getOffsetParent||f5,n=this.getDimensions,r=await n(e.floating);return{reference:dee(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function hee(e){return go(e).direction==="rtl"}const pee={convertOffsetParentRelativeRectToViewportRelativeRect:ree,getDocumentElement:ii,getClippingRect:cee,getOffsetParent:f5,getElementRects:fee,getClientRects:oee,getDimensions:uee,getScale:ec,isElement:Wn,isRTL:hee};function h5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function gee(e,t){let n=null,r;const o=ii(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=Xh(d),g=Xh(o.clientWidth-(u+h)),m=Xh(o.clientHeight-(d+f)),y=Xh(u),v={rootMargin:-p+"px "+-g+"px "+-m+"px "+-y+"px",threshold:Bn(0,$i(1,l))||1};let _=!0;function C(w){const S=w[0].intersectionRatio;if(S!==l){if(!_)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}S===1&&!h5(c,e.getBoundingClientRect())&&s(),_=!1}try{n=new IntersectionObserver(C,{...v,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,v)}n.observe(e)}return s(!0),i}function p5(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=zS(e),u=o||i?[...c?Gd(c):[],...Gd(t)]:[];u.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const d=c&&a?gee(c,n):null;let h=-1,f=null;s&&(f=new ResizeObserver(y=>{let[x]=y;x&&x.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(t)})),n()}),c&&!l&&f.observe(c),f.observe(t));let p,g=l?Qa(e):null;l&&m();function m(){const y=Qa(e);g&&!h5(g,y)&&n(),g=y,p=requestAnimationFrame(m)}return n(),()=>{var y;u.forEach(x=>{o&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),d==null||d(),(y=f)==null||y.disconnect(),f=null,l&&cancelAnimationFrame(p)}}const ey=jc,mee=KJ,bee=XJ,yee=UJ,vee=ZJ,xee=GJ,Ik=qJ,wee=QJ,See=(e,t,n)=>{const r=new Map,o={platform:pee,...n},i={...o.platform,_c:r};return WJ(e,t,{...o,platform:i})};var Lp=typeof document<"u"?E.useLayoutEffect:E.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 g5(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Nk(e,t){const n=g5(e);return Math.round(t*n)/n}function ty(e){const t=R.useRef(e);return Lp(()=>{t.current=e}),t}function m5(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,y]=R.useState(null),x=R.useCallback(z=>{z!==w.current&&(w.current=z,g(z))},[]),v=R.useCallback(z=>{z!==S.current&&(S.current=z,y(z))},[]),_=i||p,C=s||m,w=R.useRef(null),S=R.useRef(null),k=R.useRef(u),M=l!=null,D=ty(l),A=ty(o),I=ty(c),$=R.useCallback(()=>{if(!w.current||!S.current)return;const z={placement:t,strategy:n,middleware:h};A.current&&(z.platform=A.current),See(w.current,S.current,z).then(B=>{const O={...B,isPositioned:I.current!==!1};j.current&&!Mg(k.current,O)&&(k.current=O,za.flushSync(()=>{d(O)}))})},[h,t,n,A,I]);Lp(()=>{c===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,d(z=>({...z,isPositioned:!1})))},[c]);const j=R.useRef(!1);Lp(()=>(j.current=!0,()=>{j.current=!1}),[]),Lp(()=>{if(_&&(w.current=_),C&&(S.current=C),_&&C){if(D.current)return D.current(_,C,$);$()}},[_,C,$,D,M]);const T=R.useMemo(()=>({reference:w,floating:S,setReference:x,setFloating:v}),[x,v]),N=R.useMemo(()=>({reference:_,floating:C}),[_,C]),F=R.useMemo(()=>{const z={position:n,left:0,top:0};if(!N.floating)return z;const B=Nk(N.floating,u.x),O=Nk(N.floating,u.y);return a?{...z,transform:"translate("+B+"px, "+O+"px)",...g5(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 Cee=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?Ik({element:r.current,padding:o}).fn(n):{}:r?Ik({element:r,padding:o}).fn(n):{}}}},VS=(e,t)=>({...mee(e),options:[e,t]}),b5=(e,t)=>({...bee(e),options:[e,t]}),_ee=(e,t)=>({...wee(e),options:[e,t]}),y5=(e,t)=>({...yee(e),options:[e,t]}),v5=(e,t)=>({...vee(e),options:[e,t]}),Eee=(e,t)=>({...xee(e),options:[e,t]}),Ree=(e,t)=>({...Cee(e),options:[e,t]});var kee="Arrow",x5=R.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return b.jsx(be.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:b.jsx("polygon",{points:"0,0 30,0 15,10"})})});x5.displayName=kee;var Pee=x5;function Xm(e){const[t,n]=R.useState(void 0);return An(()=>{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 HS="Popper",[w5,si]=xn(HS),[Dee,S5]=w5(HS),C5=e=>{const{__scopePopper:t,children:n}=e,[r,o]=R.useState(null);return b.jsx(Dee,{scope:t,anchor:r,onAnchorChange:o,children:n})};C5.displayName=HS;var _5="PopperAnchor",E5=R.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=S5(_5,n),s=R.useRef(null),a=Te(t,s);return R.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:b.jsx(be.div,{...o,ref:a})});E5.displayName=_5;var WS="PopperContent",[Mee,Oee]=w5(WS),R5=R.forwardRef((e,t)=>{var W,G,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=S5(WS,n),[y,x]=R.useState(null),v=Te(t,oe=>x(oe)),[_,C]=R.useState(null),w=Xm(_),S=(w==null?void 0:w.width)??0,k=(w==null?void 0:w.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(Tee),altBoundary:I},{refs:j,floatingStyles:T,placement:N,isPositioned:F,middlewareData:z}=m5({strategy:"fixed",placement:M,whileElementsMounted:(...oe)=>p5(...oe,{animationFrame:f==="always"}),elements:{reference:m.anchor},middleware:[VS({mainAxis:o+k,alignmentAxis:s}),l&&b5({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?_ee():void 0,...$}),l&&y5({...$}),v5({...$,apply:({elements:oe,rects:ee,availableWidth:ue,availableHeight:pe})=>{const{width:we,height:me}=ee.reference,ye=oe.floating.style;ye.setProperty("--radix-popper-available-width",`${ue}px`),ye.setProperty("--radix-popper-available-height",`${pe}px`),ye.setProperty("--radix-popper-anchor-width",`${we}px`),ye.setProperty("--radix-popper-anchor-height",`${me}px`)}}),_&&Ree({element:_,padding:a}),Iee({arrowWidth:S,arrowHeight:k}),h&&Eee({strategy:"referenceHidden",...$})]}),[B,O]=D5(N),q=yn(p);An(()=>{F&&(q==null||q())},[F,q]);const L=(W=z.arrow)==null?void 0:W.x,P=(G=z.arrow)==null?void 0:G.y,H=((X=z.arrow)==null?void 0:X.centerOffset)!==0,[U,Y]=R.useState();return An(()=>{y&&Y(window.getComputedStyle(y).zIndex)},[y]),b.jsx("div",{ref:j.setFloating,"data-radix-popper-content-wrapper":"",style:{...T,transform:F?T.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--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:b.jsx(Mee,{scope:n,placedSide:B,onArrowChange:C,arrowX:L,arrowY:P,shouldHideArrow:H,children:b.jsx(be.div,{"data-side":B,"data-align":O,...g,ref:v,style:{...g.style,animation:F?void 0:"none"}})})})});R5.displayName=WS;var k5="PopperArrow",Aee={top:"bottom",right:"left",bottom:"top",left:"right"},P5=R.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=Oee(k5,r),s=Aee[i.placedSide];return b.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:b.jsx(Pee,{...o,ref:n,style:{...o.style,display:"block"}})})});P5.displayName=k5;function Tee(e){return e!==null}var Iee=e=>({name:"transformOrigin",options:e,fn(t){var m,y,x;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]=D5(n),d={start:"0%",center:"50%",end:"100%"}[u],h=(((y=o.arrow)==null?void 0:y.x)??0)+a/2,f=(((x=o.arrow)==null?void 0:x.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 D5(e){const[t,n="center"]=e.split("-");return[t,n]}var Af=C5,ru=E5,Tf=R5,If=P5,Nee="Portal",Nf=R.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=R.useState(!1);An(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?en.createPortal(b.jsx(be.div,{...r,ref:t}),s):null});Nf.displayName=Nee;function Fee(e,t=globalThis==null?void 0:globalThis.document){const n=yn(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 Lee="DismissableLayer",Vx="dismissableLayer.update",jee="dismissableLayer.pointerDownOutside",$ee="dismissableLayer.focusOutside",Fk,M5=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fl=R.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=e,c=R.useContext(M5),[u,d]=R.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=R.useState({}),p=Te(t,S=>d(S)),g=Array.from(c.layers),[m]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=g.indexOf(m),x=u?g.indexOf(u):-1,v=c.layersWithOutsidePointerEventsDisabled.size>0,_=x>=y,C=Vee(S=>{const k=S.target,M=[...c.branches].some(D=>D.contains(k));!_||M||(o==null||o(S),s==null||s(S),S.defaultPrevented||a==null||a())},h),w=Hee(S=>{const k=S.target;[...c.branches].some(D=>D.contains(k))||(i==null||i(S),s==null||s(S),S.defaultPrevented||a==null||a())},h);return Fee(S=>{x===c.layers.size-1&&(r==null||r(S),!S.defaultPrevented&&a&&(S.preventDefault(),a()))},h),R.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Fk=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),Lk(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Fk)}},[u,h,n,c]),R.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),Lk())},[u,c]),R.useEffect(()=>{const S=()=>f({});return document.addEventListener(Vx,S),()=>document.removeEventListener(Vx,S)},[]),b.jsx(be.div,{...l,ref:p,style:{pointerEvents:v?_?"auto":"none":void 0,...e.style},onFocusCapture:de(e.onFocusCapture,w.onFocusCapture),onBlurCapture:de(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:de(e.onPointerDownCapture,C.onPointerDownCapture)})});fl.displayName=Lee;var zee="DismissableLayerBranch",Bee=R.forwardRef((e,t)=>{const n=R.useContext(M5),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]),b.jsx(be.div,{...e,ref:o})});Bee.displayName=zee;function Vee(e,t=globalThis==null?void 0:globalThis.document){const n=yn(e),r=R.useRef(!1),o=R.useRef(()=>{});return R.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let l=function(){O5(jee,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 Hee(e,t=globalThis==null?void 0:globalThis.document){const n=yn(e),r=R.useRef(!1);return R.useEffect(()=>{const o=i=>{i.target&&!r.current&&O5($ee,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 Lk(){const e=new CustomEvent(Vx);document.dispatchEvent(e)}function O5(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?PO(o,i):o.dispatchEvent(i)}var ny,qS="HoverCard",[A5,n2e]=xn(qS,[si]),Qm=si(),[Wee,US]=A5(qS),T5=e=>{const{__scopeHoverCard:t,children:n,open:r,defaultOpen:o,onOpenChange:i,openDelay:s=700,closeDelay:a=300}=e,l=Qm(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]),y=R.useCallback(()=>p(!1),[p]);return R.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(u.current)},[]),b.jsx(Wee,{scope:t,open:f,onOpenChange:p,onOpen:g,onClose:m,onDismiss:y,hasSelectionRef:d,isPointerDownOnContentRef:h,children:b.jsx(Af,{...l,children:n})})};T5.displayName=qS;var I5="HoverCardTrigger",N5=R.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=US(I5,n),i=Qm(n);return b.jsx(ru,{asChild:!0,...i,children:b.jsx(be.a,{"data-state":o.open?"open":"closed",...r,ref:t,onPointerEnter:de(e.onPointerEnter,Ag(o.onOpen)),onPointerLeave:de(e.onPointerLeave,Ag(o.onClose)),onFocus:de(e.onFocus,o.onOpen),onBlur:de(e.onBlur,o.onClose),onTouchStart:de(e.onTouchStart,s=>s.preventDefault())})})});N5.displayName=I5;var qee="HoverCardPortal",[r2e,Uee]=A5(qee,{forceMount:void 0}),Og="HoverCardContent",F5=R.forwardRef((e,t)=>{const n=Uee(Og,e.__scopeHoverCard),{forceMount:r=n.forceMount,...o}=e,i=US(Og,e.__scopeHoverCard);return b.jsx(gn,{present:r||i.open,children:b.jsx(Gee,{"data-state":i.open?"open":"closed",...o,onPointerEnter:de(e.onPointerEnter,Ag(i.onOpen)),onPointerLeave:de(e.onPointerLeave,Ag(i.onClose)),ref:t})})});F5.displayName=Og;var Gee=R.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,...a}=e,l=US(Og,n),c=Qm(n),u=R.useRef(null),d=Te(t,u),[h,f]=R.useState(!1);return R.useEffect(()=>{if(h){const p=document.body;return ny=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=ny,p.style.webkitUserSelect=ny}}},[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&&Xee(u.current).forEach(g=>g.setAttribute("tabindex","-1"))}),b.jsx(fl,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:s,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:de(i,p=>{p.preventDefault()}),onDismiss:l.onDismiss,children:b.jsx(Tf,{...c,...a,onPointerDown:de(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)"}})})}),Yee="HoverCardArrow",Kee=R.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=Qm(n);return b.jsx(If,{...o,...r,ref:t})});Kee.displayName=Yee;function Ag(e){return t=>t.pointerType==="touch"?void 0:e()}function Xee(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 Qee=T5,Zee=N5,L5=F5;const Zm=Qee,Jm=Zee,Ff=R.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>b.jsx(L5,{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}));Ff.displayName=L5.displayName;function j5({card:e}){const t=se(r=>r.isDashboardEditing),{setCardInfo:n}=rn();return b.jsxs(Zm,{openDelay:0,children:[b.jsx(Jm,{children:b.jsx(KA,{className:"size-4 text-muted-foreground/40"})}),b.jsx(Ff,{align:"start",className:"w-[300px] text-sm text-muted-foreground",onMouseDown:r=>r.stopPropagation(),children:b.jsx(Ho,{enabled:t,type:"textarea",text:e.info||"",onSave:r=>n(e.id,r),children:e.info||"Describe what this card shows"})})]})}function Jee({card:e,renderFilterInfo:t}){var p,g,m,y,x,v,_,C,w,S,k,M,D,A,I,$;se(j=>j.themeStyle);const{data:n,isLoading:r}=Li(e),o=(n==null?void 0:n.records)||[],i=se(j=>j.isDashboardEditing),{getCurrency:s,getLocale:a}=r5(e),l=(g=(p=e.preferences)==null?void 0:p.formatNumber)==null?void 0:g.colorRanges,{metricKeys:c}=vn(o||[]),u=(m=o==null?void 0:o[0])==null?void 0:m[c==null?void 0:c[0]],d=(y=o==null?void 0:o[0])==null?void 0:y[c==null?void 0:c[1]],h=(o==null?void 0:o.length)>0,f=d&&d-u!==0?(u-d)/d:null;return b.jsx("div",{className:"flex min-w-fit grow flex-col overflow-auto",children:b.jsxs("div",{className:"grow",children:[h?b.jsx("div",{className:"",children:b.jsxs("div",{className:ie("flex items-end gap-1.5",{"animate-pulse":r}),children:[b.jsx("p",{style:{color:rS(u,l)},className:"text-3xl font-semibold",children:br({number:u,decimalPlaces:((v=(x=e.preferences)==null?void 0:x.formatNumber)==null?void 0:v.decimalPlaces)||0,useSuffix:!!((C=(_=e.preferences)==null?void 0:_.formatNumber)!=null&&C.suffix),customSuffix:((S=(w=e.preferences)==null?void 0:w.formatNumber)==null?void 0:S.suffix)||"",locale:a()||"",currency:s()||""})}),f&&b.jsxs("div",{className:"flex items-end gap-1",children:[b.jsx(o5,{className:"",children:f}),d&&b.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=(k=e.preferences)==null?void 0:k.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()||""})}`})]})]})}):b.jsx("div",{className:"flex h-9 items-center justify-center"}),b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsxs(Kc,{className:"flex items-center gap-2 text-base font-medium text-muted-foreground",children:[e.title,(i||e.info)&&b.jsx(j5,{card:e})]}),t==null?void 0:t()]})]})})}var ete="VisuallyHidden",GS=R.forwardRef((e,t)=>b.jsx(be.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}}));GS.displayName=ete;var tte=GS,[eb,o2e]=xn("Tooltip",[si]),tb=si(),$5="TooltipProvider",nte=700,Hx="tooltip.open",[rte,YS]=eb($5),KS=e=>{const{__scopeTooltip:t,delayDuration:n=nte,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)},[]),b.jsx(rte,{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})};KS.displayName=$5;var nb="Tooltip",[ote,rb]=eb(nb),z5=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=YS(nb,e.__scopeTooltip),c=tb(t),[u,d]=R.useState(null),h=hn(),f=R.useRef(0),p=s??l.disableHoverableContent,g=a??l.delayDuration,m=R.useRef(!1),[y=!1,x]=Un({prop:r,defaultProp:o,onChange:S=>{S?(l.onOpen(),document.dispatchEvent(new CustomEvent(Hx))):l.onClose(),i==null||i(S)}}),v=R.useMemo(()=>y?m.current?"delayed-open":"instant-open":"closed",[y]),_=R.useCallback(()=>{window.clearTimeout(f.current),f.current=0,m.current=!1,x(!0)},[x]),C=R.useCallback(()=>{window.clearTimeout(f.current),f.current=0,x(!1)},[x]),w=R.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{m.current=!0,x(!0),f.current=0},g)},[g,x]);return R.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),b.jsx(Af,{...c,children:b.jsx(ote,{scope:t,contentId:h,open:y,stateAttribute:v,trigger:u,onTriggerChange:d,onTriggerEnter:R.useCallback(()=>{l.isOpenDelayed?w():_()},[l.isOpenDelayed,w,_]),onTriggerLeave:R.useCallback(()=>{p?C():(window.clearTimeout(f.current),f.current=0)},[C,p]),onOpen:_,onClose:C,disableHoverableContent:p,children:n})})};z5.displayName=nb;var Wx="TooltipTrigger",XS=R.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=rb(Wx,n),i=YS(Wx,n),s=tb(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]),b.jsx(ru,{asChild:!0,...s,children:b.jsx(be.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:de(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:de(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:de(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:de(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:de(e.onBlur,o.onClose),onClick:de(e.onClick,o.onClose)})})});XS.displayName=Wx;var ite="TooltipPortal",[i2e,ste]=eb(ite,{forceMount:void 0}),zc="TooltipContent",B5=R.forwardRef((e,t)=>{const n=ste(zc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=rb(zc,e.__scopeTooltip);return b.jsx(gn,{present:r||s.open,children:s.disableHoverableContent?b.jsx(V5,{side:o,...i,ref:t}):b.jsx(ate,{side:o,...i,ref:t})})}),ate=R.forwardRef((e,t)=>{const n=rb(zc,e.__scopeTooltip),r=YS(zc,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,y={x:p.clientX,y:p.clientY},x=dte(y,m.getBoundingClientRect()),v=fte(y,x),_=hte(g.getBoundingClientRect()),C=gte([...v,..._]);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,y={x:g.clientX,y:g.clientY},x=(l==null?void 0:l.contains(m))||(u==null?void 0:u.contains(m)),v=!pte(y,s);x?h():v&&(h(),c())};return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[l,u,s,c,h]),b.jsx(V5,{...e,ref:i})}),[lte,cte]=eb(nb,{isInside:!1}),V5=R.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=rb(zc,n),c=tb(n),{onClose:u}=l;return R.useEffect(()=>(document.addEventListener(Hx,u),()=>document.removeEventListener(Hx,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]),b.jsx(fl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:b.jsxs(Tf,{"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:[b.jsx(S1,{children:r}),b.jsx(lte,{scope:n,isInside:!0,children:b.jsx(tte,{id:l.contentId,role:"tooltip",children:o||r})})]})})});B5.displayName=zc;var H5="TooltipArrow",ute=R.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=tb(n);return cte(H5,n).isInside?null:b.jsx(If,{...o,...r,ref:t})});ute.displayName=H5;function dte(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 fte(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 hte(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 pte(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 gte(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),mte(t)}function mte(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 bte=KS,yte=z5,vte=XS,W5=B5;const q5=bte,QS=yte,ZS=vte,ob=R.forwardRef(({className:e,sideOffset:t=4,...n},r)=>b.jsx(W5,{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}));ob.displayName=W5.displayName;function Tg({card:e,isLoading:t,data:n}){var h,f;const r=n||[],{keys:o}=vn(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}=rn(),{setCard:c}=Nm();function u(){var y;if(t)return b.jsxs("div",{className:"space-y-2",children:[b.jsx(Ra,{className:"h-3 w-full animate-pulse bg-muted"}),b.jsx(Ra,{className:"h-3 w-3/4 animate-pulse bg-muted"}),b.jsx(Ra,{className:"h-3 w-1/2 animate-pulse bg-muted"})]});const g=(y=r==null?void 0:r[0])==null?void 0:y[o[0]],m=b.jsx("div",{dangerouslySetInnerHTML:{__html:g}});return b.jsx("div",{className:"text-sm text-foreground/80 hover:cursor-text",onMouseDown:x=>x.stopPropagation(),children:m})}function d(){const p=(e==null?void 0:e.description)||"";return b.jsx("div",{onMouseDown:g=>g.stopPropagation(),children:b.jsx(Ho,{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:b.jsx("div",{className:"text-sm text-foreground/70 hover:cursor-text",dangerouslySetInnerHTML:{__html:p}})})})}return b.jsxs(b.Fragment,{children:[!a&&d(),a===!0&&u()]})}const jk=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,$k=Ba,JS=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return $k(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=jk(u)||jk(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 $k(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},Yd=JS("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"}}),nn=R.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?Fi:"button";return b.jsx(s,{className:ie(Yd({variant:t,size:n,className:e})),ref:i,...o})});nn.displayName="Button";var xte="Label",U5=R.forwardRef((e,t)=>b.jsx(be.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())}}));U5.displayName=xte;var G5=U5;const wte=JS("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),jt=R.forwardRef(({className:e,...t},n)=>b.jsx(G5,{ref:n,className:ie(wte(),e),...t}));jt.displayName=G5.displayName;var Ste="Separator",zk="horizontal",Cte=["horizontal","vertical"],Y5=R.forwardRef((e,t)=>{const{decorative:n,orientation:r=zk,...o}=e,i=_te(r)?r:zk,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return b.jsx(be.div,{"data-orientation":i,...a,...o,ref:t})});Y5.displayName=Ste;function _te(e){return Cte.includes(e)}var K5=Y5;const ib=R.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>b.jsx(K5,{ref:o,decorative:n,orientation:t,className:ie("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));ib.displayName=K5.displayName;function Ete(){const e=se(w=>w.isDashboardEditing),t=se(w=>w.dashboard.defaultFilterValues),n=se(w=>w.themeStyle),r=se(w=>w.filterValues),o=se(w=>w.dashboard.filters),i=se(w=>w.filteringCards),s=se(w=>w.selectedSheetId),a=se(w=>w.onSaveFunction),{removeFilterValues:l,removeFilteringCard:c,setFilterValues:u,setFilteringCards:d,setDefaultFilterValues:h,getDashboard:f}=rn(),p=o==null?void 0:o.filter(w=>w.sheetId===s||!w.sheetId),g=r==null?void 0:r.filter(w=>(p==null?void 0:p.some(S=>S.id===w.filterId))||w.filterId.endsWith(s));if(!g||g.length===0)return null;const m=g.map(w=>{const S=o==null?void 0:o.find(k=>k.id===w.filterId);return{filterId:w.filterId,name:(S==null?void 0:S.title)||w.name,values:w.values,dataType:S==null?void 0:S.dataType}});function y(w){return w instanceof Date?w.toLocaleDateString():w}function x(w){const S=i==null?void 0:i.find(k=>w.filterId.startsWith(k.id));S&&c(S),l(w.filterId)}function v(w){const S=il(w.dataType||"");function k(){return w.values.map((D,A)=>b.jsx("div",{style:{borderRadius:n==null?void 0:n.cardBorderRadius},className:"inline-block",children:y(D)},(D==null?void 0:D.toString())+A))}function M(){console.log(w.values);const D=w.values[0],A=w.values[1];if(console.log(D,A),!D||!A)return null;const I=new Date(D),$=new Date(A);return`${I.toLocaleDateString()} - ${$.toLocaleDateString()}`}return b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{style:{borderRadius:n==null?void 0:n.controlInputRadius},className:"flex w-fit items-center gap-2 rounded-sm border border-border bg-muted px-2 py-1",children:[b.jsx("span",{className:"break-words",children:w.name}),b.jsx(ul,{onClick:()=>x(w),className:"size-3 hover:cursor-pointer"})]}),b.jsx("div",{className:"flex flex-col gap-1 px-1",children:S?M():k()})]})}function _(w){const S=f();S&&(a==null||a(S,w))}function C(){return b.jsxs(b.Fragment,{children:[b.jsx(ib,{}),b.jsxs("div",{className:"space-y-3",children:[b.jsx("p",{className:"text-xs text-muted-foreground",children:"Start with these filters? Set them as default."}),b.jsxs("div",{className:"flex flex-row-reverse gap-2",children:[b.jsxs(nn,{onClick:()=>{h(r||[]),_("Default filters saved successfully.")},style:{borderRadius:n==null?void 0:n.controlInputRadius},className:"h-7 text-xs",variant:"outline",children:[t&&(t==null?void 0:t.length)>0&&b.jsx(Os,{className:"mr-2 size-3.5 text-green-500"}),"Set Dashboard Default"]}),b.jsx(nn,{onClick:()=>{h(void 0),_("Default filters cleared")},style:{borderRadius:n==null?void 0:n.controlInputRadius},className:"h-7 text-xs",variant:"secondary",children:"Reset"})]})]})]})}return b.jsxs(Zm,{openDelay:50,children:[b.jsx(Jm,{children:b.jsx(GA,{onClick:()=>{d([]),u([])},className:"size-3.5 text-muted-foreground hover:cursor-pointer"})}),b.jsxs(Ff,{onMouseDown:w=>w.stopPropagation(),style:{borderRadius:n==null?void 0:n.cardBorderRadius},className:"min-h-fit w-[310px] flex-col space-y-3 px-5 text-xs",align:"start",children:[b.jsxs("div",{children:[b.jsx(jt,{className:"font-medium leading-none",children:"Filter Context"}),b.jsx("p",{className:"text-xs text-muted-foreground",children:"Showing results with the following filters."})]}),b.jsx("div",{className:"h-fit max-h-[150px] min-h-0 grow space-y-3 overflow-auto",children:m==null?void 0:m.map(w=>b.jsx("div",{children:v(w)},w.name))}),e&&C()]})]})}const Rte=R.forwardRef(({className:e,containerClassName:t,containerStyle:n,...r},o)=>b.jsx("div",{style:n,className:ie("relative w-full overflow-auto",t),children:b.jsx("table",{ref:o,className:ie("w-full caption-bottom text-sm",e),...r})}));Rte.displayName="Table";const eC=R.forwardRef(({className:e,...t},n)=>b.jsx("thead",{ref:n,className:ie("[&_tr]:border-b",e),...t}));eC.displayName="TableHeader";const tC=R.forwardRef(({className:e,...t},n)=>b.jsx("tbody",{ref:n,className:ie("[&_tr:last-child]:border-0",e),...t}));tC.displayName="TableBody";const kte=R.forwardRef(({className:e,...t},n)=>b.jsx("tfoot",{ref:n,className:ie("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));kte.displayName="TableFooter";const hd=R.forwardRef(({className:e,...t},n)=>b.jsx("tr",{ref:n,className:ie("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));hd.displayName="TableRow";const nC=R.forwardRef(({className:e,...t},n)=>b.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}));nC.displayName="TableHead";const Ig=R.forwardRef(({className:e,...t},n)=>b.jsx("td",{ref:n,className:ie("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Ig.displayName="TableCell";const Pte=R.forwardRef(({className:e,...t},n)=>b.jsx("caption",{ref:n,className:ie("mt-4 text-sm text-muted-foreground",e),...t}));Pte.displayName="TableCaption";/**
|
|
246
246
|
* table-core
|
|
247
247
|
*
|
|
248
248
|
* Copyright (c) TanStack
|