react-semaphor 0.0.382 → 0.0.383

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.
@@ -257,7 +257,7 @@ Valid keys: `+JSON.stringify(Object.keys(M),null," "));var Z=ne(B,J,U,q,Y+"."+J
257
257
  * Released under the MIT License
258
258
  */class CH{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=PO.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 Ho=new CH;const R_="transparent",_H={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const r=m_(e||R_),o=r.valid&&m_(t||R_);return o&&o.valid?o.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class EH{constructor(t,n,r,o){const i=n[r];o=Et([t.to,o,i,t.from]);const s=Et([t.from,i,o]);this._active=!0,this._fn=t.fn||_H[t.type||typeof s],this._easing=lu[t.easing]||lu.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=Et([t.to,n,o,t.from]),this._from=Et([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 GO{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!qe(t))return;const n=Object.keys(Mt.animation),r=this._properties;Object.getOwnPropertyNames(t).forEach(o=>{const i=t[o];if(!qe(i))return;const s={};for(const a of n)s[a]=i[a];(kt(i.properties)&&i.properties||[o]).forEach(a=>{(a===o||!r.has(a))&&r.set(a,s)})})}_animateOptions(t,n){const r=n.options,o=kH(t,r);if(!o)return[];const i=this._createAnimations(o,r);return r.$shared&&RH(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 EH(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 Ho.add(this._chart,r),!0}}function RH(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 kH(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 k_(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 PH(e,t,n){if(n===!1)return!1;const r=k_(e,n),o=k_(t,n);return{top:o.end,right:r.end,bottom:o.start,left:r.start}}function MH(e){let t,n,r,o;return qe(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 qO(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 P_(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],jt(c)&&(i||t===0||bo(t)===bo(c))&&(t+=c)}return!u&&!r.all?0:t}function OH(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 ab(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function TH(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function DH(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 IH(e,t,n){const r=e[t]||(e[t]={});return r[n]||(r[n]={})}function M_(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 O_(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=TH(i,s,r),d=t.length;let h;for(let f=0;f<d;++f){const p=t[f],{[l]:g,[c]:b}=p,y=p._stacks||(p._stacks={});h=y[c]=IH(o,u,g),h[a]=b,h._top=M_(h,s,!0,r.type),h._bottom=M_(h,s,!1,r.type);const v=h._visualValues||(h._visualValues={});v[a]=b}}function lb(e,t){const n=e.scales;return Object.keys(n).filter(r=>n[r].axis===t).shift()}function AH(e,t){return es(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function NH(e,t,n){return es(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function kc(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 cb=e=>e==="reset"||e==="none",T_=(e,t)=>t?e:Object.assign({},e),FH=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:qO(n,!0),values:null};class Or{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=ab(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&&kc(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=Oe(r.xAxisID,lb(t,"x")),s=n.yAxisID=Oe(r.yAxisID,lb(t,"y")),a=n.rAxisID=Oe(r.rAxisID,lb(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&&h_(this._data,this),t._stacked&&kc(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),r=this._data;if(qe(n)){const o=this._cachedMeta;this._data=OH(n,o)}else if(r!==n){if(r){h_(r,this);const o=this._cachedMeta;kc(o),o._parsed=[]}n&&Object.isExtensible(n)&&wV(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=ab(n.vScale,n),n.stack!==r.stack&&(o=!0,kc(n),n.stack=r.stack),this._resyncElements(t),(o||i!==n._stacked)&&(O_(this,n._parsed),n._stacked=ab(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{kt(o[t])?h=this.parseArrayData(r,o,t,n):qe(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&&O_(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(Vi(f,a),h),y:s.parse(Vi(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:qO(o,!0),values:n._stacks[t.axis]._visualValues};return P_(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=P_(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=FH(n,r,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:d}=DH(a);let h,f;function p(){f=o[h];const g=f[a.axis];return!jt(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],jt(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=MH(Oe(this.options.clip,PH(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=NH(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=AH(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&&Iu(r);if(a)return T_(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(Mt.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(T_(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 GO(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||cb(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){cb(o)?Object.assign(t,r):this._resolveAnimations(n,o).update(t,r)}updateSharedOptions(t,n,r){t&&!cb(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&&kc(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])}}he(Or,"defaults",{}),he(Or,"datasetElementType",null),he(Or,"dataElementType",null);function jH(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=kO(r.sort((o,i)=>o-i))}return e._cache.$bar}function LH(e){const t=e.iScale,n=jH(t,e.type);let r=t._length,o,i,s,a;const l=()=>{s===32767||s===-32768||(Iu(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 $H(e,t,n,r){const o=n.barThickness;let i,s;return Fe(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 zH(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 BH(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 YO(e,t,n,r){return kt(e)?BH(e,t,n,r):t[n.axis]=n.parse(e,r),t}function D_(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(YO(h,d,i,c));return l}function ub(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function VH(e,t,n){return e!==0?bo(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}function HH(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 WH(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}=HH(e);o==="middle"&&n&&(e.enableBorderRadius=!0,(n._top||0)===r?o=c:(n._bottom||0)===r?o=u:(i[I_(u,s,a,l)]=!0,o=c)),i[I_(o,s,a,l)]=!0,e.borderSkipped=i}function I_(e,t,n,r){return r?(e=UH(e,t,n),e=A_(e,n,t)):e=A_(e,t,n),e}function UH(e,t,n){return e===t?n:e===n?t:e}function A_(e,t,n){return e==="start"?t:e==="end"?n:e}function GH(e,{inflateAmount:t},n){e.inflateAmount=t==="auto"?n===1?.33:0:t}class gh extends Or{parsePrimitiveData(t,n,r,o){return D_(t,n,r,o)}parseArrayData(t,n,r,o){return D_(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(Vi(g,c),h),d.push(YO(Vi(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=ub(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||Fe(p[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),b=this._calculateBarIndexPixels(f,u),y=(p._stacks||{})[a.axis],v={horizontal:c,base:g.base,enableBorderRadius:!y||ub(p._custom)||s===y._top||s===y._bottom,x:c?g.head:b.center,y:c?b.center:g.head,height:c?b.size:Math.abs(g.size),width:c?Math.abs(g.size):b.size};h&&(v.options=d||this.resolveDataElementOptions(f,t[f].active?"active":o));const x=v.options||t[f].options;WH(v,x,y,s),GH(v,x,u.ratio),this.updateElement(t[f],f,v,o)}}_getStacks(t,n){const{iScale:r}=this._cachedMeta,o=r.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),i=r.options.stacked,s=[],a=this._cachedMeta.controller.getParsed(n),l=a&&a[r.axis],c=u=>{const d=u._parsed.find(f=>f[r.axis]===l),h=d&&d[u.vScale.axis];if(Fe(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||LH(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=ub(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&&bo(d)!==bo(c.barEnd)&&(h=0),h+=d);const b=!Fe(i)&&!u?i:h;let y=n.getPixelForValue(b);if(this.chart.getDataVisibility(t)?p=n.getPixelForValue(h+f):p=y,g=p-y,Math.abs(g)<s){g=VH(g,n,a)*s,d===a&&(y-=g/2);const v=n.getPixelForDecimal(0),x=n.getPixelForDecimal(1),_=Math.min(v,x),w=Math.max(v,x);y=Math.max(Math.min(y,w),_),p=y+g,r&&!u&&(l._stacks[n.axis]._visualValues[o]=n.getValueForPixel(p)-n.getValueForPixel(y))}if(y===n.getPixelForValue(a)){const v=bo(g)*n.getLineWidthForValue(a)/2;y+=v,g-=v}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=Oe(o.maxBarThickness,1/0);let a,l;if(n.grouped){const c=i?this._getStackCount(t):n.stackCount,u=o.barThickness==="flex"?zH(t,n,o,c):$H(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)}}he(gh,"id","bar"),he(gh,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),he(gh,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});class mh extends Or{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=Oe(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=Oe(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={},b=g[u]=i?s.getPixelForDecimal(.5):s.getPixelForValue(p[u]),y=g[d]=i?a.getBasePixel():a.getPixelForValue(p[d]);g.skip=isNaN(b)||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+=Oe(r&&r._custom,i),o}}he(mh,"id","bubble"),he(mh,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),he(mh,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});function qH(e,t,n){let r=1,o=1,i=0,s=0;if(t<Pt){const a=e,l=a+t,c=Math.cos(a),u=Math.sin(a),d=Math.cos(l),h=Math.sin(l),f=(x,_,w)=>Au(x,a,l,!0)?1:Math.max(_,_*n,w,w*n),p=(x,_,w)=>Au(x,a,l,!0)?-1:Math.min(_,_*n,w,w*n),g=f(0,c,d),b=f(zt,u,h),y=p(Ot,c,d),v=p(Ot+zt,u,h);r=(g-y)/2,o=(b-v)/2,i=-(g+y)/2,s=-(b+v)/2}return{ratioX:r,ratioY:o,offsetX:i,offsetY:s}}class Ms extends Or{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(qe(r[t])){const{key:l="value"}=this._parsing;i=c=>+Vi(r[c],l)}let s,a;for(s=t,a=t+n;s<a;++s)o._parsed[s]=i(s)}}_getRotation(){return Vr(this.options.rotation-90)}_getCircumference(){return Vr(this.options.circumference)}_getRotationExtents(){let t=Pt,n=-Pt;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(sV(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:u,rotation:d}=this._getRotationExtents(),{ratioX:h,ratioY:f,offsetX:p,offsetY:g}=qH(d,u,l),b=(r.width-s)/h,y=(r.height-s)/f,v=Math.max(Math.min(b,y)/2,0),x=SO(this.options.radius,v),_=Math.max(x*l,0),w=(x-_)/this._getVisibleDatasetWeightTotal();this.offsetX=p*x,this.offsetY=g*x,o.total=this.calculateTotal(),this.outerRadius=x-w*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-w*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/Pt)}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:b}=this._getSharedOptions(n,o);let y=this._getRotation(),v;for(v=0;v<n;++v)y+=this._circumference(v,i);for(v=n;v<n+r;++v){const x=this._circumference(v,i),_=t[v],w={x:u+this.offsetX,y:d+this.offsetY,startAngle:y,endAngle:y+x,circumference:x,outerRadius:p,innerRadius:f};b&&(w.options=g||this.resolveDataElementOptions(v,_.active?"active":o)),y+=x,this.updateElement(_,v,w,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)?Pt*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,r=this.chart,o=r.data.labels||[],i=Sd(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(Oe(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}he(Ms,"id","doughnut"),he(Ms,"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"}),he(Ms,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),he(Ms,"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 bh extends Or{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}=OO(n,o,s);this._drawStart=a,this._drawCount=l,TO(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,b=jl(p)?p:Number.POSITIVE_INFINITY,y=this.chart._animationsDisabled||i||o==="none",v=n+r,x=t.length;let _=n>0&&this.getParsed(n-1);for(let w=0;w<x;++w){const S=t[w],R=y?S:{};if(w<n||w>=v){R.skip=!0;continue}const P=this.getParsed(w),O=Fe(P[f]),T=R[h]=s.getPixelForValue(P[h],w),I=R[f]=i||O?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,P,l):P[f],w);R.skip=isNaN(T)||isNaN(I)||O,R.stop=w>0&&Math.abs(P[h]-_[h])>b,g&&(R.parsed=P,R.raw=c.data[w]),d&&(R.options=u||this.resolveDataElementOptions(w,S.active?"active":o)),y||this.updateElement(S,w,R,o),_=P}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,r=n.options&&n.options.borderWidth||0,o=t.data||[];if(!o.length)return r;const i=o[0].size(this.resolveDataElementOptions(0)),s=o[o.length-1].size(this.resolveDataElementOptions(o.length-1));return Math.max(r,i,s)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}he(bh,"id","line"),he(bh,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),he(bh,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class uu extends Or{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=Sd(n._parsed[t].r,r.options.locale);return{label:o[t]||"",value:i}}parseObjectData(t,n,r,o){return $O.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*Ot;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 b=t[p];let y=f,v=f+this._computeAngle(p,o,g),x=s.getDataVisibility(p)?c.getDistanceFromCenterForValue(this.getParsed(p).r):0;f=v,i&&(l.animateScale&&(x=0),l.animateRotate&&(y=v=h));const _={x:u,y:d,innerRadius:0,outerRadius:x,startAngle:y,endAngle:v,options:this.resolveDataElementOptions(p,b.active?"active":o)};this.updateElement(b,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)?Vr(this.resolveDataElementOptions(t,n).angle||r):0}}he(uu,"id","polarArea"),he(uu,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),he(uu,"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 S0 extends Ms{}he(S0,"id","pie"),he(S0,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});class yh extends Or{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 $O.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)}}}he(yh,"id","radar"),he(yh,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),he(yh,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});class vh extends Or{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}=OO(n,r,o);if(this._drawStart=i,this._drawCount=s,TO(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:b}=this.options,y=jl(g)?g:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||i||o==="none";let x=n>0&&this.getParsed(n-1);for(let _=n;_<n+r;++_){const w=t[_],S=this.getParsed(_),R=v?w:{},P=Fe(S[p]),O=R[f]=s.getPixelForValue(S[f],_),T=R[p]=i||P?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,S,l):S[p],_);R.skip=isNaN(O)||isNaN(T)||P,R.stop=_>0&&Math.abs(S[f]-x[f])>y,b&&(R.parsed=S,R.raw=c.data[_]),h&&(R.options=d||this.resolveDataElementOptions(_,w.active?"active":o)),v||this.updateElement(w,_,R,o),x=S}this.updateSharedOptions(d,o,u)}getMaxOverflow(){const t=this._cachedMeta,n=t.data||[];if(!this.options.showLine){let a=0;for(let l=n.length-1;l>=0;--l)a=Math.max(a,n[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const r=t.dataset,o=r.options&&r.options.borderWidth||0;if(!n.length)return o;const i=n[0].size(this.resolveDataElementOptions(0)),s=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(o,i,s)/2}}he(vh,"id","scatter"),he(vh,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),he(vh,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});var YH=Object.freeze({__proto__:null,BarController:gh,BubbleController:mh,DoughnutController:Ms,LineController:bh,PieController:S0,PolarAreaController:uu,RadarController:yh,ScatterController:vh});function ps(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class ww{constructor(t){he(this,"options");this.options=t||{}}static override(t){Object.assign(ww.prototype,t)}init(){}formats(){return ps()}parse(){return ps()}format(){return ps()}add(){return ps()}diff(){return ps()}startOf(){return ps()}endOf(){return ps()}}var KH={_date:ww};function XH(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?vV:ni;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=>!Fe(g[d.axis]));u.lo-=Math.max(0,f);const p=h.slice(u.hi).findIndex(g=>!Fe(g[d.axis]));u.hi+=Math.max(0,p)}return u}}return{lo:0,hi:i.length-1}}function yg(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}=XH(i[a],t,s,o);for(let f=d;f<=h;++f){const p=u[f];p.skip||r(p,c,f)}}}function QH(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 db(e,t,n,r,o){const i=[];return!o&&!e.isPointInArea(t)||yg(e,n,t,function(a,l,c){!o&&!ri(a,e.chartArea,0)||a.inRange(t.x,t.y,r)&&i.push({element:a,datasetIndex:l,index:c})},!0),i}function ZH(e,t,n,r){let o=[];function i(s,a,l){const{startAngle:c,endAngle:u}=s.getProps(["startAngle","endAngle"],r),{angle:d}=EO(s,{x:t.x,y:t.y});Au(d,c,u)&&o.push({element:s,datasetIndex:a,index:l})}return yg(e,n,t,i),o}function JH(e,t,n,r,o,i){let s=[];const a=QH(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 b=a(t,p);b<l?(s=[{element:u,datasetIndex:d,index:h}],l=b):b===l&&s.push({element:u,datasetIndex:d,index:h})}return yg(e,n,t,c),s}function fb(e,t,n,r,o,i){return!i&&!e.isPointInArea(t)?[]:n==="r"&&!r?ZH(e,t,n,o):JH(e,t,n,r,o,i)}function N_(e,t,n,r,o){const i=[],s=n==="x"?"inXRange":"inYRange";let a=!1;return yg(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 eW={modes:{index(e,t,n,r){const o=vs(t,e),i=n.axis||"x",s=n.includeInvisible||!1,a=n.intersect?db(e,o,i,r,s):fb(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=vs(t,e),i=n.axis||"xy",s=n.includeInvisible||!1;let a=n.intersect?db(e,o,i,r,s):fb(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=vs(t,e),i=n.axis||"xy",s=n.includeInvisible||!1;return db(e,o,i,r,s)},nearest(e,t,n,r){const o=vs(t,e),i=n.axis||"xy",s=n.includeInvisible||!1;return fb(e,o,i,n.intersect,r,s)},x(e,t,n,r){const o=vs(t,e);return N_(e,o,"x",n.intersect,r)},y(e,t,n,r){const o=vs(t,e);return N_(e,o,"y",n.intersect,r)}}};const KO=["left","top","right","bottom"];function Pc(e,t){return e.filter(n=>n.pos===t)}function F_(e,t){return e.filter(n=>KO.indexOf(n.pos)===-1&&n.box.axis===t)}function Mc(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 tW(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 nW(e){const t={};for(const n of e){const{stack:r,pos:o,stackWeight:i}=n;if(!r||!KO.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 rW(e,t){const n=nW(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 oW(e){const t=tW(e),n=Mc(t.filter(c=>c.box.fullSize),!0),r=Mc(Pc(t,"left"),!0),o=Mc(Pc(t,"right")),i=Mc(Pc(t,"top"),!0),s=Mc(Pc(t,"bottom")),a=F_(t,"x"),l=F_(t,"y");return{fullSize:n,leftAndTop:r.concat(i),rightAndBottom:o.concat(l).concat(s).concat(a),chartArea:Pc(t,"chartArea"),vertical:r.concat(o).concat(l),horizontal:i.concat(s).concat(a)}}function j_(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function XO(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 iW(e,t,n,r){const{pos:o,box:i}=n,s=e.maxPadding;if(!qe(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&&XO(s,i.getPadding());const a=Math.max(0,t.outerWidth-j_(s,e,"left","right")),l=Math.max(0,t.outerHeight-j_(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 sW(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 aW(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 qc(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,aW(a.horizontal,t));const{same:d,other:h}=iW(t,n,a,r);c|=d&&o.length,u=u||h,l.fullSize||o.push(a)}return c&&qc(o,t,n,r)||u}function Cf(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 L_(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;Iu(c.start)&&(s=c.start),l.fullSize?Cf(l,o.left,s,n.outerWidth-o.right-o.left,h):Cf(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;Iu(c.start)&&(i=c.start),l.fullSize?Cf(l,i,o.top,h,n.outerHeight-o.bottom-o.top):Cf(l,i,t.top+c.placed,h,d),c.start=i,c.placed+=d,i=l.right}}t.x=i,t.y=s}var bn={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,r){if(!e)return;const o=sn(e.options.layout.padding),i=Math.max(t-o.width,0),s=Math.max(n-o.height,0),a=oW(e.boxes),l=a.vertical,c=a.horizontal;ut(e.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});const u=l.reduce((g,b)=>b.box.options&&b.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);XO(h,sn(r));const f=Object.assign({maxPadding:h,w:i,h:s,x:o.left,y:o.top},o),p=rW(l.concat(c),d);qc(a.fullSize,f,d,p),qc(l,f,d,p),qc(c,f,d,p)&&qc(l,f,d,p),sW(f),L_(a.leftAndTop,f,d,p),f.x+=f.w,f.y+=f.h,L_(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},ut(a.chartArea,g=>{const b=g.box;Object.assign(b,e.chartArea),b.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class QO{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 lW extends QO{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const xh="$chartjs",cW={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},$_=e=>e===null||e==="";function uW(e,t){const n=e.style,r=e.getAttribute("height"),o=e.getAttribute("width");if(e[xh]={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",$_(o)){const i=S_(e,"width");i!==void 0&&(e.width=i)}if($_(r))if(e.style.height==="")e.height=e.width/(t||2);else{const i=S_(e,"height");i!==void 0&&(e.height=i)}return e}const ZO=fH?{passive:!0}:!1;function dW(e,t,n){e&&e.addEventListener(t,n,ZO)}function fW(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,ZO)}function hW(e,t){const n=cW[e.type]||e.type,{x:r,y:o}=vs(e,t);return{type:n,chart:t,native:e,x:r!==void 0?r:null,y:o!==void 0?o:null}}function Xh(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function pW(e,t,n){const r=e.canvas,o=new MutationObserver(i=>{let s=!1;for(const a of i)s=s||Xh(a.addedNodes,r),s=s&&!Xh(a.removedNodes,r);s&&n()});return o.observe(document,{childList:!0,subtree:!0}),o}function gW(e,t,n){const r=e.canvas,o=new MutationObserver(i=>{let s=!1;for(const a of i)s=s||Xh(a.removedNodes,r),s=s&&!Xh(a.addedNodes,r);s&&n()});return o.observe(document,{childList:!0,subtree:!0}),o}const Fu=new Map;let z_=0;function JO(){const e=window.devicePixelRatio;e!==z_&&(z_=e,Fu.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function mW(e,t){Fu.size||window.addEventListener("resize",JO),Fu.set(e,t)}function bW(e){Fu.delete(e),Fu.size||window.removeEventListener("resize",JO)}function yW(e,t,n){const r=e.canvas,o=r&&xw(r);if(!o)return;const i=MO((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),mW(e,i),s}function hb(e,t,n){n&&n.disconnect(),t==="resize"&&bW(e)}function vW(e,t,n){const r=e.canvas,o=MO(i=>{e.ctx!==null&&n(hW(i,e))},e);return dW(r,t,o),o}class xW extends QO{acquireContext(t,n){const r=t&&t.getContext&&t.getContext("2d");return r&&r.canvas===t?(uW(t,n),r):null}releaseContext(t){const n=t.canvas;if(!n[xh])return!1;const r=n[xh].initial;["height","width"].forEach(i=>{const s=r[i];Fe(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[xh],!0}addEventListener(t,n,r){this.removeEventListener(t,n);const o=t.$proxies||(t.$proxies={}),s={attach:pW,detach:gW,resize:yW}[n]||vW;o[n]=s(t,n,r)}removeEventListener(t,n){const r=t.$proxies||(t.$proxies={}),o=r[n];if(!o)return;({attach:hb,detach:hb,resize:hb}[n]||fW)(t,n,o),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,r,o){return dH(t,n,r,o)}isAttached(t){const n=t&&xw(t);return!!(n&&n.isConnected)}}function wW(e){return!vw()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?lW:xW}var ph;let Io=(ph=class{constructor(){he(this,"x");he(this,"y");he(this,"active",!1);he(this,"options");he(this,"$animations")}tooltipPosition(t){const{x:n,y:r}=this.getProps(["x","y"],t);return{x:n,y:r}}hasValue(){return jl(this.x)&&jl(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}},he(ph,"defaults",{}),he(ph,"defaultRoutes"),ph);function SW(e,t){const n=e.options.ticks,r=CW(e),o=Math.min(n.maxTicksLimit||r,r),i=n.major.enabled?EW(t):[],s=i.length,a=i[0],l=i[s-1],c=[];if(s>o)return RW(t,c,i,s/o),c;const u=_W(i,t,o);if(s>0){let d,h;const f=s>1?Math.round((l-a)/(s-1)):null;for(_f(t,c,u,Fe(f)?0:a-f,a),d=0,h=s-1;d<h;d++)_f(t,c,u,i[d],i[d+1]);return _f(t,c,u,l,Fe(f)?t.length:l+f),c}return _f(t,c,u),c}function CW(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 _W(e,t,n){const r=kW(e),o=t.length/n;if(!r)return Math.max(o,1);const i=pV(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 EW(e){const t=[];let n,r;for(n=0,r=e.length;n<r;n++)e[n].major&&t.push(n);return t}function RW(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 _f(e,t,n,r,o){const i=Oe(r,0),s=Math.min(Oe(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 kW(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 PW=e=>e==="left"?"right":e==="right"?"left":e,B_=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,V_=(e,t)=>Math.min(t||e,e);function H_(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 MW(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 OW(e,t){ut(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 Oc(e){return e.drawTicks?e.tickLength:0}function W_(e,t){if(!e.display)return 0;const n=Ut(e.font,t),r=sn(e.padding);return(kt(e.text)?e.text.length:1)*n.lineHeight+r.height}function TW(e,t){return es(e,{scale:t,type:"scale"})}function DW(e,t,n){return es(e,{tick:n,index:t,type:"tick"})}function IW(e,t,n){let r=hw(e);return(n&&t!=="right"||!n&&t==="right")&&(r=PW(r)),r}function AW(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,b=a-i;if(e.isHorizontal()){if(f=pn(r,i,a),qe(n)){const y=Object.keys(n)[0],v=n[y];p=u[y].getPixelForValue(v)+g-t}else n==="center"?p=(c.bottom+c.top)/2+g-t:p=B_(e,n,t);h=a-i}else{if(qe(n)){const y=Object.keys(n)[0],v=n[y];f=u[y].getPixelForValue(v)-b+t}else n==="center"?f=(c.left+c.right)/2-b+t:f=B_(e,n,t);p=pn(r,s,o),d=n==="left"?-zt:zt}return{titleX:f,titleY:p,maxWidth:h,rotation:d}}class ts extends Io{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=cr(t,Number.POSITIVE_INFINITY),n=cr(n,Number.NEGATIVE_INFINITY),r=cr(r,Number.POSITIVE_INFINITY),o=cr(o,Number.NEGATIVE_INFINITY),{min:cr(t,r),max:cr(n,o),minDefined:jt(t),maxDefined:jt(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:cr(n,cr(r,n)),max:cr(r,cr(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(){pt(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=HV(this,i,o),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?H_(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),s.display&&(s.autoSkip||s.source==="auto")&&(this.ticks=SW(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(){pt(this.options.afterUpdate,[this])}beforeSetDimensions(){pt(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(){pt(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),pt(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){pt(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=pt(n.callback,[i.value,r,t],this)}afterTickToLabelConversion(){pt(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){pt(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,r=V_(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=Jt(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-Oc(t.grid)-n.padding-W_(t.title,this.chart.options.font),c=Math.sqrt(d*d+h*h),s=dw(Math.min(Math.asin(Jt((u.highest.height+6)/a,-1,1)),Math.asin(Jt(l/c,-1,1))-Math.asin(Jt(h/c,-1,1)))),s=Math.max(o,Math.min(i,s))),this.labelRotation=s}afterCalculateLabelRotation(){pt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){pt(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=W_(o,n.options.font);if(a?(t.width=this.maxWidth,t.height=Oc(i)+l):(t.height=this.maxHeight,t.width=Oc(i)+l),r.display&&this.ticks.length){const{first:c,last:u,widest:d,highest:h}=this._getLabelSizes(),f=r.padding*2,p=Vr(this.labelRotation),g=Math.cos(p),b=Math.sin(p);if(a){const y=r.mirror?0:b*d.width+g*h.height;t.height=Math.min(this.maxHeight,t.height+y+f)}else{const y=r.mirror?0:g*d.width+b*h.height;t.width=Math.min(this.maxWidth,t.width+y+f)}this._calculatePadding(c,u,b,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(){pt(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++)Fe(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=H_(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/V_(n,r));let c=0,u=0,d,h,f,p,g,b,y,v,x,_,w;for(d=0;d<n;d+=l){if(p=t[d].label,g=this._resolveTickFontOptions(d),o.font=b=g.string,y=i[b]=i[b]||{data:{},gc:[]},v=g.lineHeight,x=_=0,!Fe(p)&&!kt(p))x=qh(o,y.data,y.gc,x,p),_=v;else if(kt(p))for(h=0,f=p.length;h<f;++h)w=p[h],!Fe(w)&&!kt(w)&&(x=qh(o,y.data,y.gc,x,w),_+=v);s.push(x),a.push(_),c=Math.max(x,c),u=Math.max(_,u)}OW(i,n);const S=s.indexOf(c),R=a.indexOf(u),P=O=>({width:s[O]||0,height:a[O]||0});return{first:P(0),last:P(n-1),widest:P(S),highest:P(R),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 yV(this._alignToPixels?hs(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=DW(this.getContext(),t,r))}return this.$context||(this.$context=TW(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=Vr(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=Oc(i),f=[],p=a.setContext(this.getContext()),g=p.display?p.width:0,b=g/2,y=function(F){return hs(r,F,g)};let v,x,_,w,S,R,P,O,T,I,A,W;if(s==="top")v=y(this.bottom),R=this.bottom-h,O=v-b,I=y(t.top)+b,W=t.bottom;else if(s==="bottom")v=y(this.top),I=t.top,W=y(t.bottom)-b,R=v+b,O=this.top+h;else if(s==="left")v=y(this.right),S=this.right-h,P=v-b,T=y(t.left)+b,A=t.right;else if(s==="right")v=y(this.left),T=t.left,A=y(t.right)-b,S=v+b,P=this.left+h;else if(n==="x"){if(s==="center")v=y((t.top+t.bottom)/2+.5);else if(qe(s)){const F=Object.keys(s)[0],N=s[F];v=y(this.chart.scales[F].getPixelForValue(N))}I=t.top,W=t.bottom,R=v+b,O=R+h}else if(n==="y"){if(s==="center")v=y((t.left+t.right)/2);else if(qe(s)){const F=Object.keys(s)[0],N=s[F];v=y(this.chart.scales[F].getPixelForValue(N))}S=v-b,P=S-h,T=t.left,A=t.right}const $=Oe(o.ticks.maxTicksLimit,d),D=Math.max(1,Math.ceil(d/$));for(x=0;x<d;x+=D){const F=this.getContext(x),N=i.setContext(F),j=a.setContext(F),H=N.lineWidth,M=N.color,V=j.dash||[],L=j.dashOffset,k=N.tickWidth,U=N.tickColor,q=N.tickBorderDash||[],Y=N.tickBorderDashOffset;_=MW(this,x,l),_!==void 0&&(w=hs(r,_,H),c?S=P=T=A=w:R=O=I=W=w,f.push({tx1:S,ty1:R,tx2:P,ty2:O,x1:T,y1:I,x2:A,y2:W,width:H,color:M,borderDash:V,borderDashOffset:L,tickWidth:k,tickColor:U,tickBorderDash:q,tickBorderDashOffset:Y}))}return this._ticksLength=d,this._borderValue=v,f}_computeLabelItems(t){const n=this.axis,r=this.options,{position:o,ticks:i}=r,s=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:u,mirror:d}=i,h=Oc(r.grid),f=h+u,p=d?-u:f,g=-Vr(this.labelRotation),b=[];let y,v,x,_,w,S,R,P,O,T,I,A,W="middle";if(o==="top")S=this.bottom-p,R=this._getXAxisLabelAlignment();else if(o==="bottom")S=this.top+p,R=this._getXAxisLabelAlignment();else if(o==="left"){const D=this._getYAxisLabelAlignment(h);R=D.textAlign,w=D.x}else if(o==="right"){const D=this._getYAxisLabelAlignment(h);R=D.textAlign,w=D.x}else if(n==="x"){if(o==="center")S=(t.top+t.bottom)/2+f;else if(qe(o)){const D=Object.keys(o)[0],F=o[D];S=this.chart.scales[D].getPixelForValue(F)+f}R=this._getXAxisLabelAlignment()}else if(n==="y"){if(o==="center")w=(t.left+t.right)/2-f;else if(qe(o)){const D=Object.keys(o)[0],F=o[D];w=this.chart.scales[D].getPixelForValue(F)}R=this._getYAxisLabelAlignment(h).textAlign}n==="y"&&(l==="start"?W="top":l==="end"&&(W="bottom"));const $=this._getLabelSizes();for(y=0,v=a.length;y<v;++y){x=a[y],_=x.label;const D=i.setContext(this.getContext(y));P=this.getPixelForTick(y)+i.labelOffset,O=this._resolveTickFontOptions(y),T=O.lineHeight,I=kt(_)?_.length:1;const F=I/2,N=D.color,j=D.textStrokeColor,H=D.textStrokeWidth;let M=R;s?(w=P,R==="inner"&&(y===v-1?M=this.options.reverse?"left":"right":y===0?M=this.options.reverse?"right":"left":M="center"),o==="top"?c==="near"||g!==0?A=-I*T+T/2:c==="center"?A=-$.highest.height/2-F*T+T:A=-$.highest.height+T/2:c==="near"||g!==0?A=T/2:c==="center"?A=$.highest.height/2-F*T:A=$.highest.height-I*T,d&&(A*=-1),g!==0&&!D.showLabelBackdrop&&(w+=T/2*Math.sin(g))):(S=P,A=(1-I)*T/2);let V;if(D.showLabelBackdrop){const L=sn(D.backdropPadding),k=$.heights[y],U=$.widths[y];let q=A-L.top,Y=0-L.left;switch(W){case"middle":q-=k/2;break;case"bottom":q-=k;break}switch(R){case"center":Y-=U/2;break;case"right":Y-=U;break;case"inner":y===v-1?Y-=U:y>0&&(Y-=U/2);break}V={left:Y,top:q,width:U+L.width,height:k+L.height,color:D.backdropColor}}b.push({label:_,font:O,textOffset:A,options:{rotation:g,color:N,strokeColor:j,strokeWidth:H,textAlign:M,textBaseline:W,translation:[w,S],backdrop:V}})}return b}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-Vr(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=hs(t,this.left,s)-s/2,u=hs(t,this.right,a)+a/2,d=h=l):(d=hs(t,this.top,s)-s/2,h=hs(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&&Ws(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;la(r,c,0,u,l,a)}o&&Us(r)}drawTitle(){const{ctx:t,options:{position:n,title:r,reverse:o}}=this;if(!r.display)return;const i=Ut(r.font),s=sn(r.padding),a=r.align;let l=i.lineHeight/2;n==="bottom"||n==="center"||qe(n)?(l+=s.bottom,kt(r.text)&&(l+=i.lineHeight*(r.text.length-1))):l+=s.top;const{titleX:c,titleY:u,maxWidth:d,rotation:h}=AW(this,l,n,a);la(t,r.text,0,0,i,{color:r.color,maxWidth:d,rotation:h,textAlign:IW(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=Oe(t.grid&&t.grid.z,-1),o=Oe(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 Ut(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Ef{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;jW(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,NW(t,s,r),this.override&&Mt.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 Mt[o]&&(delete Mt[o][r],this.override&&delete aa[r])}}function NW(e,t,n){const r=en(Object.create(null),[n?Mt.get(n):{},Mt.get(t),e.defaults]);Mt.set(t,r),e.defaultRoutes&&FW(t,e.defaultRoutes),e.descriptors&&Mt.describe(t,e.descriptors)}function FW(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(".");Mt.route(i,o,l,a)})}function jW(e){return"id"in e&&"defaults"in e}class LW{constructor(){this.controllers=new Ef(Or,"datasets",!0),this.elements=new Ef(Io,"elements"),this.plugins=new Ef(Object,"plugins"),this.scales=new Ef(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):ut(o,s=>{const a=r||this._getRegistryForType(s);this._exec(t,a,s)})})}_exec(t,n,r){const o=uw(t);pt(r["before"+o],[],r),n[t](r),pt(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 Pn=new LW;class $W{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(pt(a,l,s)===!1&&o.cancelable)return!1}return!0}invalidate(){Fe(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=Oe(r.options&&r.options.plugins,{}),i=zW(r);return o===!1&&!n?[]:VW(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 zW(e){const t={},n=[],r=Object.keys(Pn.plugins.items);for(let i=0;i<r.length;i++)n.push(Pn.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 BW(e,t){return!t&&e===!1?null:e===!0?{}:e}function VW(e,{plugins:t,localIds:n},r,o){const i=[],s=e.getContext();for(const a of t){const l=a.id,c=BW(r[l],o);c!==null&&i.push({plugin:a,options:HW(e.config,{plugin:a,local:n[l]},c,s)})}return i}function HW(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 C0(e,t){const n=Mt.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function WW(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function UW(e,t){return e===t?"_index_":"_value_"}function U_(e){if(e==="x"||e==="y"||e==="r")return e}function GW(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function _0(e,...t){if(U_(e))return e;for(const n of t){const r=n.axis||GW(n.position)||e.length>1&&U_(e[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function G_(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function qW(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 G_(e,"x",n[0])||G_(e,"y",n[0])}return{}}function YW(e,t){const n=aa[e.type]||{scales:{}},r=t.scales||{},o=C0(e.type,t),i=Object.create(null);return Object.keys(r).forEach(s=>{const a=r[s];if(!qe(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=_0(s,a,qW(s,e),Mt.scales[a.type]),c=UW(l,o),u=n.scales||{};i[s]=su(Object.create(null),[{axis:l},a,u[l],u[c]])}),e.data.datasets.forEach(s=>{const a=s.type||e.type,l=s.indexAxis||C0(a,t),u=(aa[a]||{}).scales||{};Object.keys(u).forEach(d=>{const h=WW(d,l),f=s[h+"AxisID"]||h;i[f]=i[f]||Object.create(null),su(i[f],[{axis:h},r[f],u[d]])})}),Object.keys(i).forEach(s=>{const a=i[s];su(a,[Mt.scales[a.type],Mt.scale])}),i}function eT(e){const t=e.options||(e.options={});t.plugins=Oe(t.plugins,{}),t.scales=YW(e,t)}function tT(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function KW(e){return e=e||{},e.data=tT(e.data),eT(e),e}const q_=new Map,nT=new Set;function Rf(e,t){let n=q_.get(e);return n||(n=t(),q_.set(e,n),nT.add(n)),n}const Tc=(e,t,n)=>{const r=Vi(t,n);r!==void 0&&e.add(r)};class XW{constructor(t){this._config=KW(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=tT(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(),eT(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Rf(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return Rf(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return Rf(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,r=this.type;return Rf(`${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=>Tc(l,t,d))),u.forEach(d=>Tc(l,o,d)),u.forEach(d=>Tc(l,aa[i]||{},d)),u.forEach(d=>Tc(l,Mt,d)),u.forEach(d=>Tc(l,w0,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),nT.has(n)&&s.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,aa[n]||{},Mt.datasets[n]||{},{type:n},Mt,w0]}resolveNamedOptions(t,n,r,o=[""]){const i={$shared:!0},{resolver:s,subPrefixes:a}=Y_(this._resolverCache,t,o);let l=s;if(ZW(s,n)){i.$shared=!1,r=Hi(r)?r():r;const c=this.createResolver(t,r,a);l=Ll(s,r,c)}for(const c of n)i[c]=l[c];return i}createResolver(t,n,r=[""],o){const{resolver:i}=Y_(this._resolverCache,t,r);return qe(n)?Ll(i,n,void 0,o):i}}function Y_(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:mw(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},r.set(o,i)),i}const QW=e=>qe(e)&&Object.getOwnPropertyNames(e).some(t=>Hi(e[t]));function ZW(e,t){const{isScriptable:n,isIndexable:r}=NO(e);for(const o of t){const i=n(o),s=r(o),a=(s||i)&&e[o];if(i&&(Hi(a)||QW(a))||s&&kt(a))return!0}return!1}var JW="4.4.8";const eU=["top","bottom","left","right","chartArea"];function K_(e,t){return e==="top"||e==="bottom"||eU.indexOf(e)===-1&&t==="x"}function X_(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function Q_(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),pt(n&&n.onComplete,[e],t)}function tU(e){const t=e.chart,n=t.options.animation;pt(n&&n.onProgress,[e],t)}function rT(e){return vw()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const wh={},Z_=e=>{const t=rT(e);return Object.values(wh).filter(n=>n.canvas===t).pop()};function nU(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 rU(e,t,n,r){return!n||e.type==="mouseout"?null:r?t:e}function kf(e,t,n){return e.options.clip?e[n]:t[n]}function oU(e,t){const{xScale:n,yScale:r}=e;return n&&r?{left:kf(n,t,"left"),right:kf(n,t,"right"),top:kf(r,t,"top"),bottom:kf(r,t,"bottom")}:t}class It{static register(...t){Pn.add(...t),J_()}static unregister(...t){Pn.remove(...t),J_()}constructor(t,n){const r=this.config=new XW(n),o=rT(t),i=Z_(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||wW(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=iV(),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 $W,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=SV(d=>this.update(d),s.resizeDelay||0),this._dataChanges=[],wh[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Ho.listen(this,"complete",Q_),Ho.listen(this,"progress",tU),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:r,height:o,_aspectRatio:i}=this;return Fe(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 Pn}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():w_(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return y_(this.canvas,this.ctx),this}stop(){return Ho.stop(this),this}resize(t,n){Ho.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,w_(this,a,!0)&&(this.notifyPlugins("resize",{size:s}),pt(r.onResize,[this,s],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};ut(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=_0(s,a),c=l==="r",u=l==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),ut(i,s=>{const a=s.options,l=a.id,c=_0(l,a),u=Oe(a.type,s.dtype);(a.position===void 0||K_(a.position,c)!==K_(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=Pn.getScale(u);d=new h({id:l,type:u,ctx:this.ctx,chart:this}),r[d.id]=d}d.init(a,t)}),ut(o,(s,a)=>{s||delete r[a]}),ut(r,s=>{bn.configure(this,s,s.options),bn.addBox(this,s)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,r=t.length;if(t.sort((o,i)=>o.index-i.index),r>n){for(let o=n;o<r;++o)this._destroyDatasetMeta(o);t.splice(n,r-n)}this._sortedMetasets=t.slice(0).sort(X_("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||C0(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=Pn.getController(a),{datasetElementType:c,dataElementType:u}=Mt.datasets[a];Object.assign(l,{dataElementType:Pn.getElement(u),datasetElementType:c&&Pn.getElement(c)}),s.controller=new l(this,r),t.push(s.controller)}}return this._updateMetasets(),t}_resetElements(){ut(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||ut(i,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(X_("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){ut(this.scales,t=>{bn.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(t.events);(!c_(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;nU(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(!c_(o,r(i)))return;return Array.from(o).map(i=>i.split(",")).map(i=>({method:i[1],start:+i[2],count:+i[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;bn.update(this,this.width,this.height,t);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],ut(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,Hi(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&&(Ho.has(this)?this.attached&&!Ho.running(this)&&Ho.start(this):(this.draw(),Q_({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=oU(t,this.chartArea),s={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(o&&Ws(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&&Us(n),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return ri(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,r,o){const i=eW.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=es(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);Iu(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(),Ho.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(),y_(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete wh[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)};ut(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(){ut(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},ut(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}});!Wh(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=dV(t),c=rU(t,this._lastEvent,r,l);r&&(this._lastEvent=null,pt(i.onHover,[t,a,this],this),l&&pt(i.onClick,[t,a,this],this));const u=!Wh(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)}}he(It,"defaults",Mt),he(It,"instances",wh),he(It,"overrides",aa),he(It,"registry",Pn),he(It,"version",JW),he(It,"getChart",Z_);function J_(){return ut(It.instances,e=>e._plugins.invalidate())}function iU(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+zt,r-zt),e.closePath(),e.clip()}function sU(e){return gw(e,["outerStart","outerEnd","innerStart","innerEnd"])}function aU(e,t,n,r){const o=sU(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 Jt(l,0,Math.min(i,c))};return{outerStart:a(o.outerStart),outerEnd:a(o.outerEnd),innerStart:Jt(o.innerStart,0,s),innerEnd:Jt(o.innerEnd,0,s)}}function Na(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function Qh(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 D=u>0?u-r:0,F=d>0?d-r:0,N=(D+F)/2,j=N!==0?p*N/(N+r):p;f=(p-j)/2}const g=Math.max(.001,p*d-n/Ot)/d,b=(p-g)/2,y=l+b+f,v=o-b-f,{outerStart:x,outerEnd:_,innerStart:w,innerEnd:S}=aU(t,h,d,v-y),R=d-x,P=d-_,O=y+x/R,T=v-_/P,I=h+w,A=h+S,W=y+w/I,$=v-S/A;if(e.beginPath(),i){const D=(O+T)/2;if(e.arc(s,a,d,O,D),e.arc(s,a,d,D,T),_>0){const H=Na(P,T,s,a);e.arc(H.x,H.y,_,T,v+zt)}const F=Na(A,v,s,a);if(e.lineTo(F.x,F.y),S>0){const H=Na(A,$,s,a);e.arc(H.x,H.y,S,v+zt,$+Math.PI)}const N=(v-S/h+(y+w/h))/2;if(e.arc(s,a,h,v-S/h,N,!0),e.arc(s,a,h,N,y+w/h,!0),w>0){const H=Na(I,W,s,a);e.arc(H.x,H.y,w,W+Math.PI,y-zt)}const j=Na(R,y,s,a);if(e.lineTo(j.x,j.y),x>0){const H=Na(R,O,s,a);e.arc(H.x,H.y,x,y-zt,O)}}else{e.moveTo(s,a);const D=Math.cos(O)*d+s,F=Math.sin(O)*d+a;e.lineTo(D,F);const N=Math.cos(T)*d+s,j=Math.sin(T)*d+a;e.lineTo(N,j)}e.closePath()}function lU(e,t,n,r,o){const{fullCircles:i,startAngle:s,circumference:a}=t;let l=t.endAngle;if(i){Qh(e,t,n,r,l,o);for(let c=0;c<i;++c)e.fill();isNaN(a)||(l=s+(a%Pt||Pt))}return Qh(e,t,n,r,l,o),e.fill(),l}function cU(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){Qh(e,t,n,r,p,o);for(let g=0;g<i;++g)e.stroke();isNaN(a)||(p=s+(a%Pt||Pt))}f&&iU(e,t,p),i||(Qh(e,t,n,r,p,o),e.stroke())}class Ya extends Io{constructor(n){super();he(this,"circumference");he(this,"endAngle");he(this,"fullCircles");he(this,"innerRadius");he(this,"outerRadius");he(this,"pixelMargin");he(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}=EO(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=Oe(h,c-l),g=Au(s,l,c)&&l!==c,b=p>=Pt||g,y=ti(a,u+f,d+f);return b&&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>Pt?Math.floor(o/Pt):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(Ot,o||0)),u=i*c;n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,lU(n,this,u,s,a),cU(n,this,u,s,a),n.restore()}}he(Ya,"id","arc"),he(Ya,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),he(Ya,"defaultRoutes",{backgroundColor:"backgroundColor"}),he(Ya,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function oT(e,t,n=t){e.lineCap=Oe(n.borderCapStyle,t.borderCapStyle),e.setLineDash(Oe(n.borderDash,t.borderDash)),e.lineDashOffset=Oe(n.borderDashOffset,t.borderDashOffset),e.lineJoin=Oe(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=Oe(n.borderWidth,t.borderWidth),e.strokeStyle=Oe(n.borderColor,t.borderColor)}function uU(e,t,n){e.lineTo(n.x,n.y)}function dU(e){return e.stepped?AV:e.tension||e.cubicInterpolationMode==="monotone"?NV:uU}function iT(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 fU(e,t,n,r){const{points:o,options:i}=t,{count:s,start:a,loop:l,ilen:c}=iT(o,n,r),u=dU(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 hU(e,t,n,r){const o=t.points,{count:i,start:s,ilen:a}=iT(o,n,r),{move:l=!0,reverse:c}=r||{};let u=0,d=0,h,f,p,g,b,y;const v=_=>(s+(c?a-_:_))%i,x=()=>{g!==b&&(e.lineTo(u,b),e.lineTo(u,g),e.lineTo(u,y))};for(l&&(f=o[v(0)],e.moveTo(f.x,f.y)),h=0;h<=a;++h){if(f=o[v(h)],f.skip)continue;const _=f.x,w=f.y,S=_|0;S===p?(w<g?g=w:w>b&&(b=w),u=(d*u+_)/++d):(x(),e.lineTo(_,w),p=S,d=0,g=b=w),y=w}x()}function E0(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?hU:fU}function pU(e){return e.stepped?hH:e.tension||e.cubicInterpolationMode==="monotone"?pH:xs}function gU(e,t,n,r){let o=t._path;o||(o=t._path=new Path2D,t.path(o,n,r)&&o.closePath()),oT(e,t.options),e.stroke(o)}function mU(e,t,n,r){const{segments:o,options:i}=t,s=E0(t);for(const a of o)oT(e,i,a.style),e.beginPath(),s(e,t,a,{start:n,end:n+r-1})&&e.closePath(),e.stroke()}const bU=typeof Path2D=="function";function yU(e,t,n,r){bU&&!t.options.segment?gU(e,t,n,r):mU(e,t,n,r)}class Di extends Io{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;iH(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=xH(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=UO(this,{property:n,start:o,end:o});if(!s.length)return;const a=[],l=pU(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])),b=l(f,p,g,r.stepped);b[n]=t[n],a.push(b)}return a.length===1?a[0]:a}pathSegment(t,n,r){return E0(this)(t,this,n,r)}path(t,n,r){const o=this.segments,i=E0(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(),yU(t,this,r,o),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}he(Di,"id","line"),he(Di,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),he(Di,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),he(Di,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function eE(e,t,n,r){const o=e.options,{[n]:i}=e.getProps([n],r);return Math.abs(t-i)<o.radius+o.hitRadius}class Ys extends Io{constructor(n){super();he(this,"parsed");he(this,"skip");he(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 eE(this,n,"x",r)}inYRange(n,r){return eE(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||!ri(this,r,this.size(o)/2)||(n.strokeStyle=o.borderColor,n.lineWidth=o.borderWidth,n.fillStyle=o.backgroundColor,Yh(n,o,this.x,this.y))}getRange(){const n=this.options||{};return n.radius+n.hitRadius}}he(Ys,"id","point"),he(Ys,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),he(Ys,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function sT(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 Ii(e,t,n,r){return e?0:Jt(t,n,r)}function vU(e,t,n){const r=e.options.borderWidth,o=e.borderSkipped,i=AO(r);return{t:Ii(o.top,i.top,0,n),r:Ii(o.right,i.right,0,t),b:Ii(o.bottom,i.bottom,0,n),l:Ii(o.left,i.left,0,t)}}function xU(e,t,n){const{enableBorderRadius:r}=e.getProps(["enableBorderRadius"]),o=e.options.borderRadius,i=Gs(o),s=Math.min(t,n),a=e.borderSkipped,l=r||qe(o);return{topLeft:Ii(!l||a.top||a.left,i.topLeft,0,s),topRight:Ii(!l||a.top||a.right,i.topRight,0,s),bottomLeft:Ii(!l||a.bottom||a.left,i.bottomLeft,0,s),bottomRight:Ii(!l||a.bottom||a.right,i.bottomRight,0,s)}}function wU(e){const t=sT(e),n=t.right-t.left,r=t.bottom-t.top,o=vU(e,n/2,r/2),i=xU(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 pb(e,t,n,r){const o=t===null,i=n===null,a=e&&!(o&&i)&&sT(e,r);return a&&(o||ti(t,a.left,a.right))&&(i||ti(n,a.top,a.bottom))}function SU(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function CU(e,t){e.rect(t.x,t.y,t.w,t.h)}function gb(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 Ks extends Io{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}=wU(this),a=SU(s.radius)?Nu:CU;t.save(),(s.w!==i.w||s.h!==i.h)&&(t.beginPath(),a(t,gb(s,n,i)),t.clip(),a(t,gb(i,-n,s)),t.fillStyle=r,t.fill("evenodd")),t.beginPath(),a(t,gb(i,n)),t.fillStyle=o,t.fill(),t.restore()}inRange(t,n,r){return pb(this,t,n,r)}inXRange(t,n){return pb(this,t,null,n)}inYRange(t,n){return pb(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}}he(Ks,"id","bar"),he(Ks,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),he(Ks,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});var _U=Object.freeze({__proto__:null,ArcElement:Ya,BarElement:Ks,LineElement:Di,PointElement:Ys});const R0=["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)"],tE=R0.map(e=>e.replace("rgb(","rgba(").replace(")",", 0.5)"));function aT(e){return R0[e%R0.length]}function lT(e){return tE[e%tE.length]}function EU(e,t){return e.borderColor=aT(t),e.backgroundColor=lT(t),++t}function RU(e,t){return e.backgroundColor=e.data.map(()=>aT(t++)),t}function kU(e,t){return e.backgroundColor=e.data.map(()=>lT(t++)),t}function PU(e){let t=0;return(n,r)=>{const o=e.getDatasetMeta(r).controller;o instanceof Ms?t=RU(n,t):o instanceof uu?t=kU(n,t):o&&(t=EU(n,t))}}function nE(e){let t;for(t in e)if(e[t].borderColor||e[t].backgroundColor)return!0;return!1}function MU(e){return e&&(e.borderColor||e.backgroundColor)}function OU(){return Mt.borderColor!=="rgba(0,0,0,0.1)"||Mt.backgroundColor!=="rgba(0,0,0,0.1)"}var TU={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=nE(r)||MU(o)||i&&nE(i)||OU();if(!n.forceOverride&&s)return;const a=PU(e);r.forEach(a)}};function DU(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 b=0,y=0,v;const x=Math.floor((d+1)*a)+1+t,_=Math.min(Math.floor((d+2)*a)+1,n)+t,w=_-x;for(v=x;v<_;v++)b+=e[v].x,y+=e[v].y;b/=w,y/=w;const S=Math.floor(d*a)+1+t,R=Math.min(Math.floor((d+1)*a)+1,n)+t,{x:P,y:O}=e[u];for(f=p=-1,v=S;v<R;v++)p=.5*Math.abs((P-b)*(e[v].y-O)-(P-e[v].x)*(y-O)),p>f&&(f=p,h=e[v],g=v);s[l++]=h,u=g}return s[l++]=e[c],s}function IU(e,t,n,r){let o=0,i=0,s,a,l,c,u,d,h,f,p,g;const b=[],y=t+n-1,v=e[t].x,_=e[y].x-v;for(s=t;s<t+n;++s){a=e[s],l=(a.x-v)/_*r,c=a.y;const w=l|0;if(w===u)c<p?(p=c,d=s):c>g&&(g=c,h=s),o=(i*o+a.x)/++i;else{const S=s-1;if(!Fe(d)&&!Fe(h)){const R=Math.min(d,h),P=Math.max(d,h);R!==f&&R!==S&&b.push({...e[R],x:o}),P!==f&&P!==S&&b.push({...e[P],x:o})}s>0&&S!==f&&b.push(e[S]),b.push(a),u=w,i=0,p=g=c,d=h=f=s}}return b}function cT(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 rE(e){e.data.datasets.forEach(t=>{cT(t)})}function AU(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=Jt(ni(t,i.axis,s).lo,0,n-1)),c?o=Jt(ni(t,i.axis,a).hi+1,r,n)-r:o=n-r,{start:r,count:o}}var NU={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(e,t,n)=>{if(!n.enabled){rE(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(Et([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}=AU(l,c);const f=n.threshold||4*r;if(h<=f){cT(o);return}Fe(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=DU(c,d,h,r,n);break;case"min-max":p=IU(c,d,h,r);break;default:throw new Error(`Unsupported decimation algorithm '${n.algorithm}'`)}o._decimated=p})},destroy(e){rE(e)}};function FU(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=Sw(l,c,o);const u=k0(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=UO(t,u);for(const h of d){const f=k0(n,i[h.start],i[h.end],h.loop),p=WO(a,o,f);for(const g of p)s.push({source:g,target:h,start:{[n]:oE(u,f,"start",Math.max)},end:{[n]:oE(u,f,"end",Math.min)}})}}return s}function k0(e,t,n,r){if(r)return;let o=t[e],i=n[e];return e==="angle"&&(o=dr(o),i=dr(i)),{property:e,start:o,end:i}}function jU(e,t){const{x:n=null,y:r=null}=e||{},o=t.points,i=[];return t.segments.forEach(({start:s,end:a})=>{a=Sw(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 Sw(e,t,n){for(;t>e;t--){const r=n[t];if(!isNaN(r.x)&&!isNaN(r.y))break}return t}function oE(e,t,n,r){return e&&t?r(e[n],t[n]):e?e[n]:t?t[n]:0}function uT(e,t){let n=[],r=!1;return kt(e)?(r=!0,n=e):n=jU(e,t),n.length?new Di({points:n,options:{tension:0},_loop:r,_fullLoop:r}):null}function iE(e){return e&&e.fill!==!1}function LU(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(!jt(o))return o;if(s=e[o],!s)return!1;if(s.visible)return o;i.push(o),o=s.fill}return!1}function $U(e,t,n){const r=HU(e);if(qe(r))return isNaN(r.value)?!1:r;let o=parseFloat(r);return jt(o)&&Math.floor(o)===o?zU(r[0],t,o,n):["origin","start","end","stack","shape"].indexOf(r)>=0&&r}function zU(e,t,n,r){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=r?!1:n}function BU(e,t){let n=null;return e==="start"?n=t.bottom:e==="end"?n=t.top:qe(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function VU(e,t,n){let r;return e==="start"?r=n:e==="end"?r=t.options.reverse?t.min:t.max:qe(e)?r=e.value:r=t.getBaseValue(),r}function HU(e){const t=e.options,n=t.fill;let r=Oe(n&&n.target,n);return r===void 0&&(r=!!t.backgroundColor),r===!1||r===null?!1:r===!0?"origin":r}function WU(e){const{scale:t,index:n,line:r}=e,o=[],i=r.segments,s=r.points,a=UU(t,n);a.push(uT({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++)GU(o,s[u],a)}return new Di({points:o,options:{}})}function UU(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 GU(e,t,n){const r=[];for(let o=0;o<n.length;o++){const i=n[o],{first:s,last:a,point:l}=qU(i,t,"x");if(!(!l||s&&a)){if(s)r.unshift(l);else if(e.push(l),!a)break}}e.push(...r)}function qU(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(ti(o,d,h)){a=o===d,l=o===h;break}}return{first:a,last:l,point:r}}class dT{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:Pt},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 YU(e){const{chart:t,fill:n,line:r}=e;if(jt(n))return KU(t,n);if(n==="stack")return WU(e);if(n==="shape")return!0;const o=XU(e);return o instanceof dT?o:uT(o,r)}function KU(e,t){const n=e.getDatasetMeta(t);return n&&e.isDatasetVisible(t)?n.dataset:null}function XU(e){return(e.scale||{}).getPointPositionForValue?ZU(e):QU(e)}function QU(e){const{scale:t={},fill:n}=e,r=BU(n,t);if(jt(r)){const o=t.isHorizontal();return{x:o?r:null,y:o?null:r}}return null}function ZU(e){const{scale:t,fill:n}=e,r=t.options,o=t.getLabels().length,i=r.reverse?t.max:t.min,s=VU(n,t,i),a=[];if(r.grid.circular){const l=t.getPointPositionForValue(0,i);return new dT({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 mb(e,t,n){const r=YU(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&&(Ws(e,n),JU(e,{line:o,target:r,above:u,below:d,area:n,scale:i,axis:s}),Us(e))}function JU(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&&(sE(e,r,s.top),aE(e,{line:n,target:r,color:o,scale:a,property:l}),e.restore(),e.save(),sE(e,r,s.bottom)),aE(e,{line:n,target:r,color:i,scale:a,property:l}),e.restore()}function sE(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[Sw(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 aE(e,t){const{line:n,target:r,property:o,color:i,scale:s}=t,a=FU(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,eG(e,s,f&&k0(o,u,d)),e.beginPath();const p=!!n.pathSegment(e,l);let g;if(f){p?e.closePath():lE(e,r,d,o);const b=!!r.pathSegment(e,c,{move:p,reverse:!0});g=p&&b,g||lE(e,r,u,o)}e.closePath(),e.fill(g?"evenodd":"nonzero"),e.restore()}}function eG(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 lE(e,t,n,r){const o=t.interpolate(n,r);o&&e.lineTo(o.x,o.y)}var tG={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 Di&&(l={visible:e.isDatasetVisible(s),index:s,fill:$U(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=LU(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&&mb(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;iE(i)&&mb(e.ctx,i,e.chartArea)}},beforeDatasetDraw(e,t,n){const r=t.meta.$filler;!iE(r)||n.drawTime!=="beforeDatasetDraw"||mb(e.ctx,r,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const cE=(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)}},nG=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class uE extends Io{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=pt(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=Ut(r.font),i=o.size,s=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=cE(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 b=r+n/2+i.measureText(p.text).width;(g===0||c[c.length-1]+b+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:b,height:o},c[c.length-1]+=b+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((b,y)=>{const{itemWidth:v,itemHeight:x}=rG(r,n,i,b,o);y>0&&f+x+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:v,height:x},h=Math.max(h,v),f+=x+a}),d+=h,c.push({width:h,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:r,labels:{padding:o},rtl:i}}=this,s=il(i,this.left,this.width);if(this.isHorizontal()){let a=0,l=pn(r,this.left+o,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=pn(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=pn(r,this.top+t+o,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=pn(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;Ws(t,this),this._draw(),Us(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:r,ctx:o}=this,{align:i,labels:s}=t,a=Mt.color,l=il(t.rtl,this.left,this.width),c=Ut(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:b}=cE(s,d),y=function(S,R,P){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;o.save();const O=Oe(P.lineWidth,1);if(o.fillStyle=Oe(P.fillStyle,a),o.lineCap=Oe(P.lineCap,"butt"),o.lineDashOffset=Oe(P.lineDashOffset,0),o.lineJoin=Oe(P.lineJoin,"miter"),o.lineWidth=O,o.strokeStyle=Oe(P.strokeStyle,a),o.setLineDash(Oe(P.lineDash,[])),s.usePointStyle){const T={radius:g*Math.SQRT2/2,pointStyle:P.pointStyle,rotation:P.rotation,borderWidth:O},I=l.xPlus(S,p/2),A=R+h;IO(o,T,I,A,s.pointStyleWidth&&p)}else{const T=R+Math.max((d-g)/2,0),I=l.leftForLtr(S,p),A=Gs(P.borderRadius);o.beginPath(),Object.values(A).some(W=>W!==0)?Nu(o,{x:I,y:T,w:p,h:g,radius:A}):o.rect(I,T,p,g),o.fill(),O!==0&&o.stroke()}o.restore()},v=function(S,R,P){la(o,P.text,S,R+b/2,c,{strikethrough:P.hidden,textAlign:l.textAlign(P.textAlign)})},x=this.isHorizontal(),_=this._computeTitleHeight();x?f={x:pn(i,this.left+u,this.right-r[0]),y:this.top+u+_,line:0}:f={x:this.left+u,y:pn(i,this.top+_+u,this.bottom-n[0].height),line:0},BO(this.ctx,t.textDirection);const w=b+u;this.legendItems.forEach((S,R)=>{o.strokeStyle=S.fontColor,o.fillStyle=S.fontColor;const P=o.measureText(S.text).width,O=l.textAlign(S.textAlign||(S.textAlign=s.textAlign)),T=p+h+P;let I=f.x,A=f.y;l.setWidth(this.width),x?R>0&&I+T+u>this.right&&(A=f.y+=w,f.line++,I=f.x=pn(i,this.left+u,this.right-r[f.line])):R>0&&A+w>this.bottom&&(I=f.x=I+n[f.line].width+u,f.line++,A=f.y=pn(i,this.top+_+u,this.bottom-n[f.line].height));const W=l.x(I);if(y(W,A,S),I=CV(O,I+p+h,x?I+T:this.right,t.rtl),v(l.x(I),A,S),x)f.x+=T+u;else if(typeof S.text!="string"){const $=c.lineHeight;f.y+=fT(S,$)+u}else f.y+=w}),VO(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,r=Ut(n.font),o=sn(n.padding);if(!n.display)return;const i=il(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=pn(t.align,d,this.right-h);else{const p=this.columnSizes.reduce((g,b)=>Math.max(g,b.height),0);u=c+pn(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const f=pn(a,d,d+h);s.textAlign=i.textAlign(hw(a)),s.textBaseline="middle",s.strokeStyle=n.color,s.fillStyle=n.color,s.font=r.string,la(s,n.text,f,u,r)}_computeTitleHeight(){const t=this.options.title,n=Ut(t.font),r=sn(t.padding);return t.display?n.lineHeight+r.height:0}_getLegendItemAt(t,n){let r,o,i;if(ti(t,this.left,this.right)&&ti(n,this.top,this.bottom)){for(i=this.legendHitBoxes,r=0;r<i.length;++r)if(o=i[r],ti(t,o.left,o.left+o.width)&&ti(n,o.top,o.top+o.height))return this.legendItems[r]}return null}handleEvent(t){const n=this.options;if(!sG(t.type,n))return;const r=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const o=this._hoveredItem,i=nG(o,r);o&&!i&&pt(n.onLeave,[t,o,this],this),this._hoveredItem=r,r&&!i&&pt(n.onHover,[t,r,this],this)}else r&&pt(n.onClick,[t,r,this],this)}}function rG(e,t,n,r,o){const i=oG(r,e,t,n),s=iG(o,r,t.lineHeight);return{itemWidth:i,itemHeight:s}}function oG(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 iG(e,t,n){let r=e;return typeof t.text!="string"&&(r=fT(t,n)),r}function fT(e,t){const n=e.text?e.text.length:0;return t*n}function sG(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var aG={id:"legend",_element:uE,start(e,t,n){const r=e.legend=new uE({ctx:e.ctx,options:n,chart:e});bn.configure(e,r,n),bn.addBox(e,r)},stop(e){bn.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const r=e.legend;bn.configure(e,r,n),r.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const r=t.datasetIndex,o=n.chart;o.isDatasetVisible(r)?(o.hide(r),t.hidden=!0):(o.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:o,color:i,useBorderRadius:s,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),u=sn(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 Cw=class extends Io{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=kt(r.text)?r.text.length:1;this._padding=sn(r.padding);const i=o*Ut(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=pn(a,r,i),d=n+t,c=i-r):(s.position==="left"?(u=r+t,d=pn(a,o,n),l=Ot*-.5):(u=i-t,d=pn(a,n,o),l=Ot*.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=Ut(n.font),i=r.lineHeight/2+this._padding.top,{titleX:s,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(i);la(t,n.text,0,0,r,{color:n.color,maxWidth:l,rotation:c,textAlign:hw(n.align),textBaseline:"middle",translation:[s,a]})}};function lG(e,t){const n=new Cw({ctx:e.ctx,options:t,chart:e});bn.configure(e,n,t),bn.addBox(e,n),e.titleBlock=n}var cG={id:"title",_element:Cw,start(e,t,n){lG(e,n)},stop(e){const t=e.titleBlock;bn.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const r=e.titleBlock;bn.configure(e,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Pf=new WeakMap;var uG={id:"subtitle",start(e,t,n){const r=new Cw({ctx:e.ctx,options:n,chart:e});bn.configure(e,r,n),bn.addBox(e,r),Pf.set(e,r)},stop(e){bn.removeBox(e,Pf.get(e)),Pf.delete(e)},beforeUpdate(e,t,n){const r=Pf.get(e);bn.configure(e,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Yc={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=x0(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 to(e,t){return t&&(kt(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Wo(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
259
259
  `)>-1?e.split(`
260
- `):e}function dG(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 dE(e,t){const n=e.chart.ctx,{body:r,footer:o,title:i}=e,{boxWidth:s,boxHeight:a}=t,l=Ut(t.bodyFont),c=Ut(t.titleFont),u=Ut(t.footerFont),d=i.length,h=o.length,f=r.length,p=sn(t.padding);let g=p.height,b=0,y=r.reduce((_,w)=>_+w.before.length+w.lines.length+w.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 v=0;const x=function(_){b=Math.max(b,n.measureText(_).width+v)};return n.save(),n.font=c.string,ut(e.title,x),n.font=l.string,ut(e.beforeBody.concat(e.afterBody),x),v=t.displayColors?s+2+t.boxPadding:0,ut(r,_=>{ut(_.before,x),ut(_.lines,x),ut(_.after,x)}),v=0,n.font=u.string,ut(e.footer,x),n.restore(),b+=p.width,{width:b,height:g}}function fG(e,t){const{y:n,height:r}=t;return n<r/2?"top":n>e.height-r/2?"bottom":"center"}function hG(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 pG(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"),hG(c,e,t,n)&&(c="center"),c}function fE(e,t,n){const r=n.yAlign||t.yAlign||fG(e,n);return{xAlign:n.xAlign||t.xAlign||pG(e,t,n,r),yAlign:r}}function gG(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function mG(e,t,n){let{y:r,height:o}=e;return t==="top"?r+=n:t==="bottom"?r-=o+n:r-=o/2,r}function hE(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}=Gs(s);let p=gG(t,a);const g=mG(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:Jt(p,0,r.width-t.width),y:Jt(g,0,r.height-t.height)}}function Mf(e,t,n){const r=sn(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function pE(e){return to([],Wo(e))}function bG(e,t,n){return es(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function gE(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const hT={beforeTitle:$o,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:$o,beforeBody:$o,beforeLabel:$o,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 Fe(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:$o,afterBody:$o,beforeFooter:$o,footer:$o,afterFooter:$o};function jn(e,t,n,r){const o=e[t].call(n,r);return typeof o>"u"?hT[t].call(n,r):o}var My;let mE=(My=class extends Io{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 GO(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=bG(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:r}=n,o=jn(r,"beforeTitle",this,t),i=jn(r,"title",this,t),s=jn(r,"afterTitle",this,t);let a=[];return a=to(a,Wo(o)),a=to(a,Wo(i)),a=to(a,Wo(s)),a}getBeforeBody(t,n){return pE(jn(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,o=[];return ut(t,i=>{const s={before:[],lines:[],after:[]},a=gE(r,i);to(s.before,Wo(jn(a,"beforeLabel",this,i))),to(s.lines,jn(a,"label",this,i)),to(s.after,Wo(jn(a,"afterLabel",this,i))),o.push(s)}),o}getAfterBody(t,n){return pE(jn(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:r}=n,o=jn(r,"beforeFooter",this,t),i=jn(r,"footer",this,t),s=jn(r,"afterFooter",this,t);let a=[];return a=to(a,Wo(o)),a=to(a,Wo(i)),a=to(a,Wo(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(dG(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))),ut(a,u=>{const d=gE(t.callbacks,u);o.push(jn(d,"labelColor",this,u)),i.push(jn(d,"labelPointStyle",this,u)),s.push(jn(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=Yc[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=dE(this,r),c=Object.assign({},a,l),u=fE(this.chart,r,c),d=hE(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}=Gs(a),{x:h,y:f}=t,{width:p,height:g}=n;let b,y,v,x,_,w;return i==="center"?(_=f+g/2,o==="left"?(b=h,y=b-s,x=_+s,w=_-s):(b=h+p,y=b+s,x=_-s,w=_+s),v=b):(o==="left"?y=h+Math.max(l,u)+s:o==="right"?y=h+p-Math.max(c,d)-s:y=this.caretX,i==="top"?(x=f,_=x-s,b=y-s,v=y+s):(x=f+g,_=x+s,b=y+s,v=y-s),w=x),{x1:b,x2:y,x3:v,y1:x,y2:_,y3:w}}drawTitle(t,n,r){const o=this.title,i=o.length;let s,a,l;if(i){const c=il(r.rtl,this.x,this.width);for(t.x=Mf(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",s=Ut(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=Ut(i.bodyFont),d=Mf(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},b=o.leftForLtr(h,c)+c/2,y=p+l/2;t.strokeStyle=i.multiKeyBackground,t.fillStyle=i.multiKeyBackground,Yh(t,g,b,y),t.strokeStyle=s.borderColor,t.fillStyle=s.backgroundColor,Yh(t,g,b,y)}else{t.lineWidth=qe(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),b=o.leftForLtr(o.xPlus(h,1),c-2),y=Gs(s.borderRadius);Object.values(y).some(v=>v!==0)?(t.beginPath(),t.fillStyle=i.multiKeyBackground,Nu(t,{x:g,y:p,w:c,h:l,radius:y}),t.fill(),t.stroke(),t.fillStyle=s.backgroundColor,t.beginPath(),Nu(t,{x:b,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(b,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=Ut(r.bodyFont);let h=d.lineHeight,f=0;const p=il(r.rtl,this.x,this.width),g=function(P){n.fillText(P,p.x(t.x+f),t.y+h/2),t.y+=h+i},b=p.textAlign(s);let y,v,x,_,w,S,R;for(n.textAlign=s,n.textBaseline="middle",n.font=d.string,t.x=Mf(this,b,r),n.fillStyle=r.bodyColor,ut(this.beforeBody,g),f=a&&b!=="right"?s==="center"?c/2+u:c+2+u:0,_=0,S=o.length;_<S;++_){for(y=o[_],v=this.labelTextColors[_],n.fillStyle=v,ut(y.before,g),x=y.lines,a&&x.length&&(this._drawColorBox(n,t,_,p,r),h=Math.max(d.lineHeight,l)),w=0,R=x.length;w<R;++w)g(x[w]),h=d.lineHeight;ut(y.after,g)}f=0,h=d.lineHeight,ut(this.afterBody,g),t.y-=i}drawFooter(t,n,r){const o=this.footer,i=o.length;let s,a;if(i){const l=il(r.rtl,this.x,this.width);for(t.x=Mf(this,r.footerAlign,r),t.y+=r.footerMarginTop,n.textAlign=l.textAlign(r.footerAlign),n.textBaseline="middle",s=Ut(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}=Gs(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=Yc[t.position].call(this,this._active,this._eventPosition);if(!s)return;const a=this._size=dE(this,t),l=Object.assign({},s,this._size),c=fE(n,t,l),u=hE(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=sn(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),BO(t,n.textDirection),i.y+=s.top,this.drawTitle(i,t,n),this.drawBody(i,t,n),this.drawFooter(i,t,n),VO(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=!Wh(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||!Wh(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=Yc[i.position].call(this,t,n);return s!==!1&&(r!==s.x||o!==s.y)}},he(My,"positioners",Yc),My);var pT={id:"tooltip",_element:mE,positioners:Yc,afterInit(e,t,n){n&&(e.tooltip=new mE({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:hT},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"]},yG=Object.freeze({__proto__:null,Colors:TU,Decimation:NU,Filler:tG,Legend:aG,SubTitle:uG,Title:cG,Tooltip:pT});const vG=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function xG(e,t,n,r){const o=e.indexOf(t);if(o===-1)return vG(e,t,n,r);const i=e.lastIndexOf(t);return o!==i?n:o}const wG=(e,t)=>e===null?null:Jt(Math.round(e),0,t);function bE(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class Zh 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(Fe(t))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===t?n:xG(r,t,Oe(n,t),this._addedLabels),wG(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 bE.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}}he(Zh,"id","category"),he(Zh,"defaults",{ticks:{callback:bE}});function SG(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:b}=t,y=!Fe(s),v=!Fe(a),x=!Fe(c),_=(b-g)/(d+1);let w=d_((b-g)/p/f)*f,S,R,P,O;if(w<1e-14&&!y&&!v)return[{value:g},{value:b}];O=Math.ceil(b/w)-Math.floor(g/w),O>p&&(w=d_(O*w/p/f)*f),Fe(l)||(S=Math.pow(10,l),w=Math.ceil(w*S)/S),o==="ticks"?(R=Math.floor(g/w)*w,P=Math.ceil(b/w)*w):(R=g,P=b),y&&v&&i&&mV((a-s)/i,w/1e3)?(O=Math.round(Math.min((a-s)/w,u)),w=(a-s)/O,R=s,P=a):x?(R=y?s:R,P=v?a:P,O=c-1,w=(P-R)/O):(O=(P-R)/w,au(O,Math.round(O),w/1e3)?O=Math.round(O):O=Math.ceil(O));const T=Math.max(f_(w),f_(R));S=Math.pow(10,Fe(l)?T:l),R=Math.round(R*S)/S,P=Math.round(P*S)/S;let I=0;for(y&&(h&&R!==s?(n.push({value:s}),R<s&&I++,au(Math.round((R+I*w)*S)/S,s,yE(s,_,e))&&I++):R<s&&I++);I<O;++I){const A=Math.round((R+I*w)*S)/S;if(v&&A>a)break;n.push({value:A})}return v&&h&&P!==a?n.length&&au(n[n.length-1].value,a,yE(a,_,e))?n[n.length-1].value=a:n.push({value:a}):(!v||P===a)&&n.push({value:P}),n}function yE(e,t,{horizontal:n,minRotation:r}){const o=Vr(r),i=(n?Math.sin(o):Math.cos(o))||.001,s=.75*t*(""+e).length;return Math.min(t/i,s)}class Jh 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 Fe(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=bo(o),c=bo(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=SG(o,i);return t.bounds==="ticks"&&_O(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 Sd(t,this.chart.options.locale,this.options.ticks.format)}}class zl extends Jh{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=jt(t)?t:0,this.max=jt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=Vr(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}}he(zl,"id","linear"),he(zl,"defaults",{ticks:{callback:mg.formatters.numeric}});const ju=e=>Math.floor(Ti(e)),gs=(e,t)=>Math.pow(10,ju(e)+t);function vE(e){return e/Math.pow(10,ju(e))===1}function xE(e,t,n){const r=Math.pow(10,n),o=Math.floor(e/r);return Math.ceil(t/r)-o}function CG(e,t){const n=t-e;let r=ju(n);for(;xE(e,t,r)>10;)r++;for(;xE(e,t,r)<10;)r--;return Math.min(r,ju(e))}function _G(e,{min:t,max:n}){t=cr(e.min,t);const r=[],o=ju(t);let i=CG(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=cr(e.min,Math.round((l+u+d*Math.pow(10,i))*s)/s);for(;h<n;)r.push({value:h,major:vE(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=cr(e.max,h);return r.push({value:f,major:vE(f),significand:d}),r}class Bl 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=Jh.prototype.parse.apply(this,[t,n]);if(r===0){this._zero=!0;return}return jt(r)&&r>0?r:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=jt(t)?Math.max(0,t):null,this.max=jt(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!jt(this._userMin)&&(this.min=t===gs(this.min,0)?gs(this.min,-1):gs(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(gs(r,-1)),s(gs(o,1)))),r<=0&&i(gs(o,-1)),o<=0&&s(gs(r,1)),this.min=r,this.max=o}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},r=_G(n,this);return t.bounds==="ticks"&&_O(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":Sd(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Ti(t),this._valueRange=Ti(this.max)-Ti(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Ti(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}he(Bl,"id","logarithmic"),he(Bl,"defaults",{ticks:{callback:mg.formatters.logarithmic,major:{enabled:!0}}});function P0(e){const t=e.ticks;if(t.display&&e.display){const n=sn(t.backdropPadding);return Oe(t.font&&t.font.size,Mt.font.size)+n.height}return 0}function EG(e,t,n){return n=kt(n)?n:[n],{w:IV(e,t.string,n),h:n.length*t.lineHeight}}function wE(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 RG(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?Ot/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=Ut(c.font),h=EG(e.ctx,d,e._pointLabels[l]);r[l]=h;const f=dr(e.getIndexAngle(l)+a),p=Math.round(dw(f)),g=wE(p,u.x,h.w,0,180),b=wE(p,u.y,h.h,90,270);kG(n,t,f,g,b)}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=OG(e,r,o)}function kG(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 PG(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(dw(dr(l.angle+zt))),u=IG(l.y,a.h,c),d=TG(c),h=DG(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 MG(e,t){if(!t)return!0;const{left:n,top:r,right:o,bottom:i}=e;return!(ri({x:n,y:r},t)||ri({x:n,y:i},t)||ri({x:o,y:r},t)||ri({x:o,y:i},t))}function OG(e,t,n){const r=[],o=e._pointLabels.length,i=e.options,{centerPointLabels:s,display:a}=i.pointLabels,l={extra:P0(i)/2,additionalAngle:s?Ot/o:0};let c;for(let u=0;u<o;u++){l.padding=n[u],l.size=t[u];const d=PG(e,u,l);r.push(d),a==="auto"&&(d.visible=MG(d,c),d.visible&&(c=d))}return r}function TG(e){return e===0||e===180?"center":e<180?"left":"right"}function DG(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function IG(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function AG(e,t,n){const{left:r,top:o,right:i,bottom:s}=n,{backdropColor:a}=t;if(!Fe(a)){const l=Gs(t.borderRadius),c=sn(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(),Nu(e,{x:u,y:d,w:h,h:f,radius:l}),e.fill()):e.fillRect(u,d,h,f)}}function NG(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));AG(n,s,i);const a=Ut(s.font),{x:l,y:c,textAlign:u}=i;la(n,e._pointLabels[o],l,c+a.lineHeight/2,a,{color:s.color,textAlign:u,textBaseline:"middle"})}}function gT(e,t,n,r){const{ctx:o}=e;if(n)o.arc(e.xCenter,e.yCenter,t,0,Pt);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 FG(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(),gT(e,n,s,r),i.closePath(),i.stroke(),i.restore())}function jG(e,t,n){return es(e,{label:n,index:t,type:"pointLabel"})}class Kc extends Jh{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=sn(P0(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=jt(t)&&!isNaN(t)?t:0,this.max=jt(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/P0(this.options))}generateTickLabels(t){Jh.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,r)=>{const o=pt(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?RG(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=Pt/(this._pointLabels.length||1),r=this.options.startAngle||0;return dr(t*n+Vr(r))}getDistanceFromCenterForValue(t){if(Fe(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(Fe(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 jG(this.getContext(),t,r)}}getPointPosition(t,n,r=0){const o=this.getIndexAngle(t)-zt+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(),gT(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&&NG(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);FG(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=Ut(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=sn(c.backdropPadding);t.fillRect(-s/2-d.left,-i-u.size/2-d.top,s+d.width,u.size+d.height)}la(t,a.label,0,-i,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}he(Kc,"id","radialLinear"),he(Kc,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:mg.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),he(Kc,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),he(Kc,"descriptors",{angleLines:{_fallback:"grid"}});const vg={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}},qn=Object.keys(vg);function SE(e,t){return e-t}function CE(e,t){if(Fe(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)),jt(s)||(s=typeof r=="string"?n.parse(s,r):n.parse(s)),s===null?null:(o&&(s=o==="week"&&(jl(i)||i===!0)?n.startOf(s,"isoWeek",i):n.startOf(s,o)),+s)}function _E(e,t,n,r){const o=qn.length;for(let i=qn.indexOf(e);i<o-1;++i){const s=vg[qn[i]],a=s.steps?s.steps:Number.MAX_SAFE_INTEGER;if(s.common&&Math.ceil((n-t)/(a*s.size))<=r)return qn[i]}return qn[o-1]}function LG(e,t,n,r,o){for(let i=qn.length-1;i>=qn.indexOf(n);i--){const s=qn[i];if(vg[s].common&&e._adapter.diff(o,r,s)>=t-1)return s}return qn[n?qn.indexOf(n):0]}function $G(e){for(let t=qn.indexOf(e)+1,n=qn.length;t<n;++t)if(vg[qn[t]].common)return qn[t]}function EE(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:r,hi:o}=fw(n,t),i=n[r]>=t?n[r]:n[o];e[i]=!0}}function zG(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 RE(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:zG(e,r,o,n)}class Lu 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 KH._date(t.adapters.date);o.init(n),su(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:CE(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=jt(o)&&!isNaN(o)?o:+n.startOf(Date.now(),r),i=jt(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=xV(o,i,s);return this._unit=n.unit||(r.autoSkip?_E(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):LG(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:$G(this._unit),this.initOffsets(o),t.reverse&&a.reverse(),RE(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=Jt(n,0,s),r=Jt(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||_E(i.minUnit,n,r,this._getLabelCapacity(n)),a=Oe(o.ticks.stepSize,1),l=s==="week"?i.isoWeekday:!1,c=jl(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++)EE(u,h,p);return(h===r||o.bounds==="ticks"||f===1)&&EE(u,h,p),Object.keys(u).sort(SE).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 pt(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=Vr(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,RE(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(CE(this,o[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return kO(t.sort(SE))}}he(Lu,"id","time"),he(Lu,"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 Of(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}=ni(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}=ni(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 M0 extends Lu{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=Of(n,this.min),this._tableRange=Of(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(Of(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return Of(this._table,r*this._tableRange+this._minPos,!0)}}he(M0,"id","timeseries"),he(M0,"defaults",Lu.defaults);var BG=Object.freeze({__proto__:null,CategoryScale:Zh,LinearScale:zl,LogarithmicScale:Bl,RadialLinearScale:Kc,TimeScale:Lu,TimeSeriesScale:M0});const VG=[YH,_U,yG,BG];class Wi{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*HG(e){for(const t of e)yield*t}function mT(e){return Array.from(HG(e))}function Ka(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 _e=1e-6,bT=1e-12,We=Math.PI,Ft=We/2,kE=We/4,yr=We*2,Rn=180/We,gt=We/180,tt=Math.abs,ic=Math.atan,Co=Math.atan2,Ne=Math.cos,Tf=Math.ceil,yT=Math.exp,ep=Math.log,bb=Math.pow,Ie=Math.sin,Mr=Math.sign||function(e){return e>0?1:e<0?-1:0},Tn=Math.sqrt,_w=Math.tan;function vT(e){return e>1?0:e<-1?We:Math.acos(e)}function Dr(e){return e>1?Ft:e<-1?-Ft:Math.asin(e)}function Zt(){}function tp(e,t){e&&ME.hasOwnProperty(e.type)&&ME[e.type](e,t)}var PE={Feature:function(e,t){tp(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,o=n.length;++r<o;)tp(n[r].geometry,t)}},ME={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){O0(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)O0(n[r],t,0)},Polygon:function(e,t){OE(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)OE(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,o=n.length;++r<o;)tp(n[r],t)}};function O0(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 OE(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)O0(e[n],t,1);t.polygonEnd()}function Ss(e,t){e&&PE.hasOwnProperty(e.type)?PE[e.type](e,t):tp(e,t)}function T0(e){return[Co(e[1],e[0]),Dr(e[2])]}function Vl(e){var t=e[0],n=e[1],r=Ne(n);return[r*Ne(t),r*Ie(t),Ie(n)]}function Df(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function np(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 yb(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function If(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function D0(e){var t=Tn(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function I0(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 A0(e,t){return tt(e)>We&&(e-=Math.round(e/yr)*yr),[e,t]}A0.invert=A0;function xT(e,t,n){return(e%=yr)?t||n?I0(DE(e),IE(t,n)):DE(e):t||n?IE(t,n):A0}function TE(e){return function(t,n){return t+=e,tt(t)>We&&(t-=Math.round(t/yr)*yr),[t,n]}}function DE(e){var t=TE(e);return t.invert=TE(-e),t}function IE(e,t){var n=Ne(e),r=Ie(e),o=Ne(t),i=Ie(t);function s(a,l){var c=Ne(l),u=Ne(a)*c,d=Ie(a)*c,h=Ie(l),f=h*n+u*r;return[Co(d*o-f*i,u*n-h*r),Dr(f*o+d*i)]}return s.invert=function(a,l){var c=Ne(l),u=Ne(a)*c,d=Ie(a)*c,h=Ie(l),f=h*o-d*i;return[Co(d*o+h*i,u*n+f*r),Dr(f*n-u*r)]},s}function WG(e){e=xT(e[0]*gt,e[1]*gt,e.length>2?e[2]*gt:0);function t(n){return n=e(n[0]*gt,n[1]*gt),n[0]*=Rn,n[1]*=Rn,n}return t.invert=function(n){return n=e.invert(n[0]*gt,n[1]*gt),n[0]*=Rn,n[1]*=Rn,n},t}function UG(e,t,n,r,o,i){if(n){var s=Ne(t),a=Ie(t),l=r*n;o==null?(o=t+r*yr,i=t-l/2):(o=AE(s,o),i=AE(s,i),(r>0?o<i:o>i)&&(o+=r*yr));for(var c,u=o;r>0?u>i:u<i;u-=l)c=T0([s,-a*Ne(u),-a*Ie(u)]),e.point(c[0],c[1])}}function AE(e,t){t=Vl(t),t[0]-=e,D0(t);var n=vT(-t[1]);return((-t[2]<0?-n:n)+yr-_e)%yr}function wT(){var e=[],t;return{point:function(n,r,o){t.push([n,r,o])},lineStart:function(){e.push(t=[])},lineEnd:Zt,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Sh(e,t){return tt(e[0]-t[0])<_e&&tt(e[1]-t[1])<_e}function Af(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 ST(e,t,n,r,o){var i=[],s=[],a,l;if(e.forEach(function(p){if(!((g=p.length-1)<=0)){var g,b=p[0],y=p[g],v;if(Sh(b,y)){if(!b[2]&&!y[2]){for(o.lineStart(),a=0;a<g;++a)o.point((b=p[a])[0],b[1]);o.lineEnd();return}y[0]+=2*_e}i.push(v=new Af(b,p,null,!0)),s.push(v.o=new Af(b,null,v,!1)),i.push(v=new Af(y,p,null,!1)),s.push(v.o=new Af(y,null,v,!0))}}),!!i.length){for(s.sort(t),NE(i),NE(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 NE(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 vb(e){return tt(e[0])<=We?e[0]:Mr(e[0])*((tt(e[0])+We)%yr-We)}function CT(e,t){var n=vb(t),r=t[1],o=Ie(r),i=[Ie(n),-Ne(n),0],s=0,a=0,l=new Wi;o===1?r=Ft+_e:o===-1&&(r=-Ft-_e);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=vb(f),g=f[1]/2+kE,b=Ie(g),y=Ne(g),v=0;v<h;++v,p=_,b=S,y=R,f=x){var x=d[v],_=vb(x),w=x[1]/2+kE,S=Ie(w),R=Ne(w),P=_-p,O=P>=0?1:-1,T=O*P,I=T>We,A=b*S;if(l.add(Co(A*O*Ie(T),y*R+A*Ne(T))),s+=I?P+O*yr:P,I^p>=n^_>=n){var W=np(Vl(f),Vl(x));D0(W);var $=np(i,W);D0($);var D=(I^P>=0?-1:1)*Dr($[2]);(r>D||r===D&&(W[0]||W[1]))&&(a+=I^P>=0?1:-1)}}return(s<-1e-6||s<_e&&l<-1e-12)^a&1}function _T(e,t,n,r){return function(o){var i=t(o),s=wT(),a=t(s),l=!1,c,u,d,h={point:f,lineStart:g,lineEnd:b,polygonStart:function(){h.point=y,h.lineStart=v,h.lineEnd=x,u=[],c=[]},polygonEnd:function(){h.point=f,h.lineStart=g,h.lineEnd=b,u=mT(u);var _=CT(c,r);u.length?(l||(o.polygonStart(),l=!0),ST(u,qG,_,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(_,w){e(_,w)&&o.point(_,w)}function p(_,w){i.point(_,w)}function g(){h.point=p,i.lineStart()}function b(){h.point=f,i.lineEnd()}function y(_,w){d.push([_,w]),a.point(_,w)}function v(){a.lineStart(),d=[]}function x(){y(d[0][0],d[0][1]),a.lineEnd();var _=a.clean(),w=s.result(),S,R=w.length,P,O,T;if(d.pop(),c.push(d),d=null,!!R){if(_&1){if(O=w[0],(P=O.length-1)>0){for(l||(o.polygonStart(),l=!0),o.lineStart(),S=0;S<P;++S)o.point((T=O[S])[0],T[1]);o.lineEnd()}return}R>1&&_&2&&w.push(w.pop().concat(w.shift())),u.push(w.filter(GG))}}return h}}function GG(e){return e.length>1}function qG(e,t){return((e=e.x)[0]<0?e[1]-Ft-_e:Ft-e[1])-((t=t.x)[0]<0?t[1]-Ft-_e:Ft-t[1])}const FE=_T(function(){return!0},YG,XG,[-We,-Ft]);function YG(e){var t=NaN,n=NaN,r=NaN,o;return{lineStart:function(){e.lineStart(),o=1},point:function(i,s){var a=i>0?We:-We,l=tt(i-t);tt(l-We)<_e?(e.point(t,n=(n+s)/2>0?Ft:-Ft),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(i,n),o=0):r!==a&&l>=We&&(tt(t-r)<_e&&(t-=r*_e),tt(i-a)<_e&&(i-=a*_e),n=KG(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 KG(e,t,n,r){var o,i,s=Ie(e-n);return tt(s)>_e?ic((Ie(t)*(i=Ne(r))*Ie(n)-Ie(r)*(o=Ne(t))*Ie(e))/(o*i*s)):(t+r)/2}function XG(e,t,n,r){var o;if(e==null)o=n*Ft,r.point(-We,o),r.point(0,o),r.point(We,o),r.point(We,0),r.point(We,-o),r.point(0,-o),r.point(-We,-o),r.point(-We,0),r.point(-We,o);else if(tt(e[0]-t[0])>_e){var i=e[0]<t[0]?We:-We;o=n*i/2,r.point(-i,o),r.point(0,o),r.point(i,o)}else r.point(t[0],t[1])}function QG(e){var t=Ne(e),n=2*gt,r=t>0,o=tt(t)>_e;function i(u,d,h,f){UG(f,e,n,h,u,d)}function s(u,d){return Ne(u)*Ne(d)>t}function a(u){var d,h,f,p,g;return{lineStart:function(){p=f=!1,g=1},point:function(b,y){var v=[b,y],x,_=s(b,y),w=r?_?0:c(b,y):_?c(b+(b<0?We:-We),y):0;if(!d&&(p=f=_)&&u.lineStart(),_!==f&&(x=l(d,v),(!x||Sh(d,x)||Sh(v,x))&&(v[2]=1)),_!==f)g=0,_?(u.lineStart(),x=l(v,d),u.point(x[0],x[1])):(x=l(d,v),u.point(x[0],x[1],2),u.lineEnd()),d=x;else if(o&&d&&r^_){var S;!(w&h)&&(S=l(v,d,!0))&&(g=0,r?(u.lineStart(),u.point(S[0][0],S[0][1]),u.point(S[1][0],S[1][1]),u.lineEnd()):(u.point(S[1][0],S[1][1]),u.lineEnd(),u.lineStart(),u.point(S[0][0],S[0][1],3)))}_&&(!d||!Sh(d,v))&&u.point(v[0],v[1]),d=v,f=_,h=w},lineEnd:function(){f&&u.lineEnd(),d=null},clean:function(){return g|(p&&f)<<1}}}function l(u,d,h){var f=Vl(u),p=Vl(d),g=[1,0,0],b=np(f,p),y=Df(b,b),v=b[0],x=y-v*v;if(!x)return!h&&u;var _=t*y/x,w=-t*v/x,S=np(g,b),R=If(g,_),P=If(b,w);yb(R,P);var O=S,T=Df(R,O),I=Df(O,O),A=T*T-I*(Df(R,R)-1);if(!(A<0)){var W=Tn(A),$=If(O,(-T-W)/I);if(yb($,R),$=T0($),!h)return $;var D=u[0],F=d[0],N=u[1],j=d[1],H;F<D&&(H=D,D=F,F=H);var M=F-D,V=tt(M-We)<_e,L=V||M<_e;if(!V&&j<N&&(H=N,N=j,j=H),L?V?N+j>0^$[1]<(tt($[0]-D)<_e?N:j):N<=$[1]&&$[1]<=j:M>We^(D<=$[0]&&$[0]<=F)){var k=If(O,(-T+W)/I);return yb(k,R),[$,T0(k)]}}}function c(u,d){var h=r?e:We-e,f=0;return u<-h?f|=1:u>h&&(f|=2),d<-h?f|=4:d>h&&(f|=8),f}return _T(s,a,i,r?[0,-e]:[-We,e-We])}function ZG(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 Nf=1e9,Ff=-1e9;function JG(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 tt(c[0]-e)<_e?u>0?0:3:tt(c[0]-n)<_e?u>0?2:1:tt(c[1]-t)<_e?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=wT(),h,f,p,g,b,y,v,x,_,w,S,R={point:P,lineStart:A,lineEnd:W,polygonStart:T,polygonEnd:I};function P(D,F){o(D,F)&&u.point(D,F)}function O(){for(var D=0,F=0,N=f.length;F<N;++F)for(var j=f[F],H=1,M=j.length,V=j[0],L,k,U=V[0],q=V[1];H<M;++H)L=U,k=q,V=j[H],U=V[0],q=V[1],k<=r?q>r&&(U-L)*(r-k)>(q-k)*(e-L)&&++D:q<=r&&(U-L)*(r-k)<(q-k)*(e-L)&&--D;return D}function T(){u=d,h=[],f=[],S=!0}function I(){var D=O(),F=S&&D,N=(h=mT(h)).length;(F||N)&&(c.polygonStart(),F&&(c.lineStart(),i(null,null,1,c),c.lineEnd()),N&&ST(h,a,D,i,c),c.polygonEnd()),u=c,h=f=p=null}function A(){R.point=$,f&&f.push(p=[]),w=!0,_=!1,v=x=NaN}function W(){h&&($(g,b),y&&_&&d.rejoin(),h.push(d.result())),R.point=P,_&&u.lineEnd()}function $(D,F){var N=o(D,F);if(f&&p.push([D,F]),w)g=D,b=F,y=N,w=!1,N&&(u.lineStart(),u.point(D,F));else if(N&&_)u.point(D,F);else{var j=[v=Math.max(Ff,Math.min(Nf,v)),x=Math.max(Ff,Math.min(Nf,x))],H=[D=Math.max(Ff,Math.min(Nf,D)),F=Math.max(Ff,Math.min(Nf,F))];ZG(j,H,e,t,n,r)?(_||(u.lineStart(),u.point(j[0],j[1])),u.point(H[0],H[1]),N||u.lineEnd(),S=!1):N&&(u.lineStart(),u.point(D,F),S=!1)}v=D,x=F,_=N}return R}}var N0,F0,Ch,_h,Hl={sphere:Zt,point:Zt,lineStart:eq,lineEnd:Zt,polygonStart:Zt,polygonEnd:Zt};function eq(){Hl.point=nq,Hl.lineEnd=tq}function tq(){Hl.point=Hl.lineEnd=Zt}function nq(e,t){e*=gt,t*=gt,F0=e,Ch=Ie(t),_h=Ne(t),Hl.point=rq}function rq(e,t){e*=gt,t*=gt;var n=Ie(t),r=Ne(t),o=tt(e-F0),i=Ne(o),s=Ie(o),a=r*s,l=_h*n-Ch*r*i,c=Ch*n+_h*r*i;N0.add(Co(Tn(a*a+l*l),c)),F0=e,Ch=n,_h=r}function oq(e){return N0=new Wi,Ss(e,Hl),+N0}var j0=[null,null],iq={type:"LineString",coordinates:j0};function L0(e,t){return j0[0]=e,j0[1]=t,oq(iq)}var jE={Feature:function(e,t){return rp(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,o=n.length;++r<o;)if(rp(n[r].geometry,t))return!0;return!1}},LE={Sphere:function(){return!0},Point:function(e,t){return $E(e.coordinates,t)},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)if($E(n[r],t))return!0;return!1},LineString:function(e,t){return zE(e.coordinates,t)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)if(zE(n[r],t))return!0;return!1},Polygon:function(e,t){return BE(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)if(BE(n[r],t))return!0;return!1},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,o=n.length;++r<o;)if(rp(n[r],t))return!0;return!1}};function rp(e,t){return e&&LE.hasOwnProperty(e.type)?LE[e.type](e,t):!1}function $E(e,t){return L0(e,t)===0}function zE(e,t){for(var n,r,o,i=0,s=e.length;i<s;i++){if(r=L0(e[i],t),r===0||i>0&&(o=L0(e[i],e[i-1]),o>0&&n<=o&&r<=o&&(n+r-o)*(1-Math.pow((n-r)/o,2))<bT*o))return!0;n=r}return!1}function BE(e,t){return!!CT(e.map(sq),ET(t))}function sq(e){return e=e.map(ET),e.pop(),e}function ET(e){return[e[0]*gt,e[1]*gt]}function aq(e,t){return(e&&jE.hasOwnProperty(e.type)?jE[e.type]:rp)(e,t)}function VE(e,t,n){var r=Ka(e,t-_e,n).concat(t);return function(o){return r.map(function(i){return[o,i]})}}function HE(e,t,n){var r=Ka(e,t-_e,n).concat(t);return function(o){return r.map(function(i){return[i,o]})}}function RT(){var e,t,n,r,o,i,s,a,l=10,c=l,u=90,d=360,h,f,p,g,b=2.5;function y(){return{type:"MultiLineString",coordinates:v()}}function v(){return Ka(Tf(r/u)*u,n,u).map(p).concat(Ka(Tf(a/d)*d,s,d).map(g)).concat(Ka(Tf(t/l)*l,e,l).filter(function(x){return tt(x%u)>_e}).map(h)).concat(Ka(Tf(i/c)*c,o,c).filter(function(x){return tt(x%d)>_e}).map(f))}return y.lines=function(){return v().map(function(x){return{type:"LineString",coordinates:x}})},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(x){return arguments.length?y.extentMajor(x).extentMinor(x):y.extentMinor()},y.extentMajor=function(x){return arguments.length?(r=+x[0][0],n=+x[1][0],a=+x[0][1],s=+x[1][1],r>n&&(x=r,r=n,n=x),a>s&&(x=a,a=s,s=x),y.precision(b)):[[r,a],[n,s]]},y.extentMinor=function(x){return arguments.length?(t=+x[0][0],e=+x[1][0],i=+x[0][1],o=+x[1][1],t>e&&(x=t,t=e,e=x),i>o&&(x=i,i=o,o=x),y.precision(b)):[[t,i],[e,o]]},y.step=function(x){return arguments.length?y.stepMajor(x).stepMinor(x):y.stepMinor()},y.stepMajor=function(x){return arguments.length?(u=+x[0],d=+x[1],y):[u,d]},y.stepMinor=function(x){return arguments.length?(l=+x[0],c=+x[1],y):[l,c]},y.precision=function(x){return arguments.length?(b=+x,h=VE(i,o,90),f=HE(t,e,b),p=VE(a,s,90),g=HE(r,n,b),y):b},y.extentMajor([[-180,-90+_e],[180,90-_e]]).extentMinor([[-180,-80-_e],[180,80+_e]])}function lq(){return RT()()}const $0=e=>e;var xb=new Wi,z0=new Wi,kT,PT,B0,V0,Xo={point:Zt,lineStart:Zt,lineEnd:Zt,polygonStart:function(){Xo.lineStart=cq,Xo.lineEnd=dq},polygonEnd:function(){Xo.lineStart=Xo.lineEnd=Xo.point=Zt,xb.add(tt(z0)),z0=new Wi},result:function(){var e=xb/2;return xb=new Wi,e}};function cq(){Xo.point=uq}function uq(e,t){Xo.point=MT,kT=B0=e,PT=V0=t}function MT(e,t){z0.add(V0*e-B0*t),B0=e,V0=t}function dq(){MT(kT,PT)}var Wl=1/0,op=Wl,$u=-Wl,ip=$u,sp={point:fq,lineStart:Zt,lineEnd:Zt,polygonStart:Zt,polygonEnd:Zt,result:function(){var e=[[Wl,op],[$u,ip]];return $u=ip=-(op=Wl=1/0),e}};function fq(e,t){e<Wl&&(Wl=e),e>$u&&($u=e),t<op&&(op=t),t>ip&&(ip=t)}var H0=0,W0=0,Xc=0,ap=0,lp=0,Xa=0,U0=0,G0=0,Qc=0,OT,TT,uo,fo,kr={point:ca,lineStart:WE,lineEnd:UE,polygonStart:function(){kr.lineStart=gq,kr.lineEnd=mq},polygonEnd:function(){kr.point=ca,kr.lineStart=WE,kr.lineEnd=UE},result:function(){var e=Qc?[U0/Qc,G0/Qc]:Xa?[ap/Xa,lp/Xa]:Xc?[H0/Xc,W0/Xc]:[NaN,NaN];return H0=W0=Xc=ap=lp=Xa=U0=G0=Qc=0,e}};function ca(e,t){H0+=e,W0+=t,++Xc}function WE(){kr.point=hq}function hq(e,t){kr.point=pq,ca(uo=e,fo=t)}function pq(e,t){var n=e-uo,r=t-fo,o=Tn(n*n+r*r);ap+=o*(uo+e)/2,lp+=o*(fo+t)/2,Xa+=o,ca(uo=e,fo=t)}function UE(){kr.point=ca}function gq(){kr.point=bq}function mq(){DT(OT,TT)}function bq(e,t){kr.point=DT,ca(OT=uo=e,TT=fo=t)}function DT(e,t){var n=e-uo,r=t-fo,o=Tn(n*n+r*r);ap+=o*(uo+e)/2,lp+=o*(fo+t)/2,Xa+=o,o=fo*e-uo*t,U0+=o*(uo+e),G0+=o*(fo+t),Qc+=o*3,ca(uo=e,fo=t)}function IT(e){this._context=e}IT.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,yr);break}}},result:Zt};var q0=new Wi,wb,AT,NT,Zc,Jc,zu={point:Zt,lineStart:function(){zu.point=yq},lineEnd:function(){wb&&FT(AT,NT),zu.point=Zt},polygonStart:function(){wb=!0},polygonEnd:function(){wb=null},result:function(){var e=+q0;return q0=new Wi,e}};function yq(e,t){zu.point=FT,AT=Zc=e,NT=Jc=t}function FT(e,t){Zc-=e,Jc-=t,q0.add(Tn(Zc*Zc+Jc*Jc)),Zc=e,Jc=t}let GE,cp,qE,YE;class KE{constructor(t){this._append=t==null?jT:vq(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!==qE||this._append!==cp){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`,qE=r,cp=this._append,YE=this._,this._=o}this._+=YE;break}}}result(){const t=this._;return this._="",t.length?t:null}}function jT(e){let t=1;this._+=e[0];for(const n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function vq(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return jT;if(t!==GE){const n=10**t;GE=t,cp=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 cp}function XE(e,t){let n=3,r=4.5,o,i;function s(a){return a&&(typeof r=="function"&&i.pointRadius(+r.apply(this,arguments)),Ss(a,o(i))),i.result()}return s.area=function(a){return Ss(a,o(Xo)),Xo.result()},s.measure=function(a){return Ss(a,o(zu)),zu.result()},s.bounds=function(a){return Ss(a,o(sp)),sp.result()},s.centroid=function(a){return Ss(a,o(kr)),kr.result()},s.projection=function(a){return arguments.length?(o=a==null?(e=null,$0):(e=a).stream,s):e},s.context=function(a){return arguments.length?(i=a==null?(t=null,new KE(n)):new IT(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 KE(n)),s},s.projection(e).digits(n).context(t)}function Ew(e){return function(t){var n=new Y0;for(var r in e)n[r]=e[r];return n.stream=t,n}}function Y0(){}Y0.prototype={constructor:Y0,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 Rw(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),Ss(n,e.stream(sp)),t(sp.result()),r!=null&&e.clipExtent(r),e}function kw(e,t,n){return Rw(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 LT(e,t,n){return kw(e,[[0,0],t],n)}function $T(e,t,n){return Rw(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 zT(e,t,n){return Rw(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 QE=16,xq=Ne(30*gt);function ZE(e,t){return+t?Sq(e,t):wq(e)}function wq(e){return Ew({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function Sq(e,t){function n(r,o,i,s,a,l,c,u,d,h,f,p,g,b){var y=c-r,v=u-o,x=y*y+v*v;if(x>4*t&&g--){var _=s+h,w=a+f,S=l+p,R=Tn(_*_+w*w+S*S),P=Dr(S/=R),O=tt(tt(S)-1)<_e||tt(i-d)<_e?(i+d)/2:Co(w,_),T=e(O,P),I=T[0],A=T[1],W=I-r,$=A-o,D=v*W-y*$;(D*D/x>t||tt((y*W+v*$)/x-.5)>.3||s*h+a*f+l*p<xq)&&(n(r,o,i,s,a,l,I,A,O,_/=R,w/=R,S,g,b),b.point(I,A),n(I,A,O,_,w,S,c,u,d,h,f,p,g,b))}}return function(r){var o,i,s,a,l,c,u,d,h,f,p,g,b={point:y,lineStart:v,lineEnd:_,polygonStart:function(){r.polygonStart(),b.lineStart=w},polygonEnd:function(){r.polygonEnd(),b.lineStart=v}};function y(P,O){P=e(P,O),r.point(P[0],P[1])}function v(){d=NaN,b.point=x,r.lineStart()}function x(P,O){var T=Vl([P,O]),I=e(P,O);n(d,h,u,f,p,g,d=I[0],h=I[1],u=P,f=T[0],p=T[1],g=T[2],QE,r),r.point(d,h)}function _(){b.point=y,r.lineEnd()}function w(){v(),b.point=S,b.lineEnd=R}function S(P,O){x(o=P,O),i=d,s=h,a=f,l=p,c=g,b.point=x}function R(){n(d,h,u,f,p,g,i,s,o,a,l,c,QE,r),b.lineEnd=_,_()}return b}}var Cq=Ew({point:function(e,t){this.stream.point(e*gt,t*gt)}});function _q(e){return Ew({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function Eq(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 JE(e,t,n,r,o,i){if(!i)return Eq(e,t,n,r,o);var s=Ne(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,b){return g*=r,b*=o,[l*g-c*b+t,n-c*g-l*b]}return p.invert=function(g,b){return[r*(u*g-d*b+h),o*(f-d*g-u*b)]},p}function ui(e){return BT(function(){return e})()}function BT(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=FE,b=null,y,v,x,_=$0,w=.5,S,R,P,O,T;function I(D){return P(D[0]*gt,D[1]*gt)}function A(D){return D=P.invert(D[0],D[1]),D&&[D[0]*Rn,D[1]*Rn]}I.stream=function(D){return O&&T===D?O:O=Cq(_q(u)(g(S(_(T=D)))))},I.preclip=function(D){return arguments.length?(g=D,p=void 0,$()):g},I.postclip=function(D){return arguments.length?(_=D,b=y=v=x=null,$()):_},I.clipAngle=function(D){return arguments.length?(g=+D?QG(p=D*gt):(p=null,FE),$()):p*Rn},I.clipExtent=function(D){return arguments.length?(_=D==null?(b=y=v=x=null,$0):JG(b=+D[0][0],y=+D[0][1],v=+D[1][0],x=+D[1][1]),$()):b==null?null:[[b,y],[v,x]]},I.scale=function(D){return arguments.length?(n=+D,W()):n},I.translate=function(D){return arguments.length?(r=+D[0],o=+D[1],W()):[r,o]},I.center=function(D){return arguments.length?(i=D[0]%360*gt,s=D[1]%360*gt,W()):[i*Rn,s*Rn]},I.rotate=function(D){return arguments.length?(a=D[0]%360*gt,l=D[1]%360*gt,c=D.length>2?D[2]%360*gt:0,W()):[a*Rn,l*Rn,c*Rn]},I.angle=function(D){return arguments.length?(d=D%360*gt,W()):d*Rn},I.reflectX=function(D){return arguments.length?(h=D?-1:1,W()):h<0},I.reflectY=function(D){return arguments.length?(f=D?-1:1,W()):f<0},I.precision=function(D){return arguments.length?(S=ZE(R,w=D*D),$()):Tn(w)},I.fitExtent=function(D,F){return kw(I,D,F)},I.fitSize=function(D,F){return LT(I,D,F)},I.fitWidth=function(D,F){return $T(I,D,F)},I.fitHeight=function(D,F){return zT(I,D,F)};function W(){var D=JE(n,0,0,h,f,d).apply(null,t(i,s)),F=JE(n,r-D[0],o-D[1],h,f,d);return u=xT(a,l,c),R=I0(t,F),P=I0(u,R),S=ZE(R,w),$()}function $(){return O=T=null,I}return function(){return t=e.apply(this,arguments),I.invert=t.invert&&A,W()}}function Pw(e){var t=0,n=We/3,r=BT(e),o=r(t,n);return o.parallels=function(i){return arguments.length?r(t=i[0]*gt,n=i[1]*gt):[t*Rn,n*Rn]},o}function Rq(e){var t=Ne(e);function n(r,o){return[r*t,Ie(o)/t]}return n.invert=function(r,o){return[r/t,Dr(o*t)]},n}function kq(e,t){var n=Ie(e),r=(n+Ie(t))/2;if(tt(r)<_e)return Rq(e);var o=1+n*(2*r-n),i=Tn(o)/r;function s(a,l){var c=Tn(o-2*r*Ie(l))/r;return[c*Ie(a*=r),i-c*Ne(a)]}return s.invert=function(a,l){var c=i-l,u=Co(a,tt(c))*Mr(c);return c*r<0&&(u-=We*Mr(a)*Mr(c)),[u/r,Dr((o-(a*a+c*c)*r*r)/(2*r))]},s}function up(){return Pw(kq).scale(155.424).center([0,33.6442])}function VT(){return up().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function Pq(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 Mq(){var e,t,n=VT(),r,o=up().rotate([154,0]).center([-2,58.5]).parallels([55,65]),i,s=up().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,b=(h[1]-p[1])/f;return(b>=.12&&b<.234&&g>=-.425&&g<-.214?o:b>=.166&&b<.234&&g>=-.214&&g<-.115?s:n).invert(h)},u.stream=function(h){return e&&t===h?e:e=Pq([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+_e,g+.12*f+_e],[p-.214*f-_e,g+.234*f-_e]]).stream(c),a=s.translate([p-.205*f,g+.212*f]).clipExtent([[p-.214*f+_e,g+.166*f+_e],[p-.115*f-_e,g+.234*f-_e]]).stream(c),d()},u.fitExtent=function(h,f){return kw(u,h,f)},u.fitSize=function(h,f){return LT(u,h,f)},u.fitWidth=function(h,f){return $T(u,h,f)},u.fitHeight=function(h,f){return zT(u,h,f)};function d(){return e=t=null,u}return u.scale(1070)}function HT(e){return function(t,n){var r=Ne(t),o=Ne(n),i=e(r*o);return i===1/0?[2,0]:[i*o*Ie(t),i*Ie(n)]}}function Cd(e){return function(t,n){var r=Tn(t*t+n*n),o=e(r),i=Ie(o),s=Ne(o);return[Co(t*i,r*s),Dr(r&&n*i/r)]}}var WT=HT(function(e){return Tn(2/(1+e))});WT.invert=Cd(function(e){return 2*Dr(e/2)});function Oq(){return ui(WT).scale(124.75).clipAngle(180-.001)}var UT=HT(function(e){return(e=vT(e))&&e/Ie(e)});UT.invert=Cd(function(e){return e});function Tq(){return ui(UT).scale(79.4188).clipAngle(180-.001)}function xg(e,t){return[e,ep(_w((Ft+t)/2))]}xg.invert=function(e,t){return[e,2*ic(yT(t))-Ft]};function Dq(){return GT(xg).scale(961/yr)}function GT(e){var t=ui(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=We*r(),h=t(WG(t.rotate()).invert([0,0]));return i(s==null?[[h[0]-d,h[1]-d],[h[0]+d,h[1]+d]]:e===xg?[[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 jf(e){return _w((Ft+e)/2)}function Iq(e,t){var n=Ne(e),r=e===t?Ie(e):ep(n/Ne(t))/ep(jf(t)/jf(e)),o=n*bb(jf(e),r)/r;if(!r)return xg;function i(s,a){o>0?a<-Ft+_e&&(a=-Ft+_e):a>Ft-_e&&(a=Ft-_e);var l=o/bb(jf(a),r);return[l*Ie(r*s),o-l*Ne(r*s)]}return i.invert=function(s,a){var l=o-a,c=Mr(r)*Tn(s*s+l*l),u=Co(s,tt(l))*Mr(l);return l*r<0&&(u-=We*Mr(s)*Mr(l)),[u/r,2*ic(bb(o/c,1/r))-Ft]},i}function Aq(){return Pw(Iq).scale(109.5).parallels([30,30])}function dp(e,t){return[e,t]}dp.invert=dp;function Nq(){return ui(dp).scale(152.63)}function Fq(e,t){var n=Ne(e),r=e===t?Ie(e):(n-Ne(t))/(t-e),o=n/r+e;if(tt(r)<_e)return dp;function i(s,a){var l=o-a,c=r*s;return[l*Ie(c),o-l*Ne(c)]}return i.invert=function(s,a){var l=o-a,c=Co(s,tt(l))*Mr(l);return l*r<0&&(c-=We*Mr(s)*Mr(l)),[c/r,o-Mr(r)*Tn(s*s+l*l)]},i}function jq(){return Pw(Fq).scale(131.154).center([0,13.9389])}var du=1.340264,fu=-.081106,hu=893e-6,pu=.003796,fp=Tn(3)/2,Lq=12;function qT(e,t){var n=Dr(fp*Ie(t)),r=n*n,o=r*r*r;return[e*Ne(n)/(fp*(du+3*fu*r+o*(7*hu+9*pu*r))),n*(du+fu*r+o*(hu+pu*r))]}qT.invert=function(e,t){for(var n=t,r=n*n,o=r*r*r,i=0,s,a,l;i<Lq&&(a=n*(du+fu*r+o*(hu+pu*r))-t,l=du+3*fu*r+o*(7*hu+9*pu*r),n-=s=a/l,r=n*n,o=r*r*r,!(tt(s)<bT));++i);return[fp*e*(du+3*fu*r+o*(7*hu+9*pu*r))/Ne(n),Dr(Ie(n)/fp)]};function $q(){return ui(qT).scale(177.158)}function YT(e,t){var n=Ne(t),r=Ne(e)*n;return[n*Ie(e)/r,Ie(t)/r]}YT.invert=Cd(ic);function zq(){return ui(YT).scale(144.049).clipAngle(60)}function KT(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)))]}KT.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(tt(o)>_e&&--r>0);return[e/(.8707+(i=n*n)*(-.131979+i*(-.013791+i*i*i*(.003971-.001529*i)))),n]};function Bq(){return ui(KT).scale(175.295)}function XT(e,t){return[Ne(t)*Ie(e),Ie(t)]}XT.invert=Cd(Dr);function Vq(){return ui(XT).scale(249.5).clipAngle(90+_e)}function QT(e,t){var n=Ne(t),r=1+Ne(e)*n;return[n*Ie(e)/r,Ie(t)/r]}QT.invert=Cd(function(e){return 2*ic(e)});function Hq(){return ui(QT).scale(250).clipAngle(142)}function ZT(e,t){return[ep(_w((Ft+t)/2)),-e]}ZT.invert=function(e,t){return[-t,2*ic(yT(e))-Ft]};function Wq(){var e=GT(ZT),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 st(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 wg(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Mw(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function sc(){}var ua=.7,Ul=1/ua,sl="\\s*([+-]?\\d+)\\s*",Bu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",yo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Uq=/^#([0-9a-f]{3,8})$/,Gq=new RegExp(`^rgb\\(${sl},${sl},${sl}\\)$`),qq=new RegExp(`^rgb\\(${yo},${yo},${yo}\\)$`),Yq=new RegExp(`^rgba\\(${sl},${sl},${sl},${Bu}\\)$`),Kq=new RegExp(`^rgba\\(${yo},${yo},${yo},${Bu}\\)$`),Xq=new RegExp(`^hsl\\(${Bu},${yo},${yo}\\)$`),Qq=new RegExp(`^hsla\\(${Bu},${yo},${yo},${Bu}\\)$`),eR={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};wg(sc,Ow,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:tR,formatHex:tR,formatHex8:Zq,formatHsl:Jq,formatRgb:nR,toString:nR});function tR(){return this.rgb().formatHex()}function Zq(){return this.rgb().formatHex8()}function Jq(){return eD(this).formatHsl()}function nR(){return this.rgb().formatRgb()}function Ow(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Uq.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?rR(t):n===3?new yn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Lf(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Lf(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=Gq.exec(e))?new yn(t[1],t[2],t[3],1):(t=qq.exec(e))?new yn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Yq.exec(e))?Lf(t[1],t[2],t[3],t[4]):(t=Kq.exec(e))?Lf(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Xq.exec(e))?sR(t[1],t[2]/100,t[3]/100,1):(t=Qq.exec(e))?sR(t[1],t[2]/100,t[3]/100,t[4]):eR.hasOwnProperty(e)?rR(eR[e]):e==="transparent"?new yn(NaN,NaN,NaN,0):null}function rR(e){return new yn(e>>16&255,e>>8&255,e&255,1)}function Lf(e,t,n,r){return r<=0&&(e=t=n=NaN),new yn(e,t,n,r)}function JT(e){return e instanceof sc||(e=Ow(e)),e?(e=e.rgb(),new yn(e.r,e.g,e.b,e.opacity)):new yn}function Vu(e,t,n,r){return arguments.length===1?JT(e):new yn(e,t,n,r??1)}function yn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}wg(yn,Vu,Mw(sc,{brighter(e){return e=e==null?Ul:Math.pow(Ul,e),new yn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ua:Math.pow(ua,e),new yn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new yn(Xs(this.r),Xs(this.g),Xs(this.b),hp(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:oR,formatHex:oR,formatHex8:eY,formatRgb:iR,toString:iR}));function oR(){return`#${Os(this.r)}${Os(this.g)}${Os(this.b)}`}function eY(){return`#${Os(this.r)}${Os(this.g)}${Os(this.b)}${Os((isNaN(this.opacity)?1:this.opacity)*255)}`}function iR(){const e=hp(this.opacity);return`${e===1?"rgb(":"rgba("}${Xs(this.r)}, ${Xs(this.g)}, ${Xs(this.b)}${e===1?")":`, ${e})`}`}function hp(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Xs(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Os(e){return e=Xs(e),(e<16?"0":"")+e.toString(16)}function sR(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Br(e,t,n,r)}function eD(e){if(e instanceof Br)return new Br(e.h,e.s,e.l,e.opacity);if(e instanceof sc||(e=Ow(e)),!e)return new Br;if(e instanceof Br)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 Br(s,a,l,e.opacity)}function tY(e,t,n,r){return arguments.length===1?eD(e):new Br(e,t,n,r??1)}function Br(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}wg(Br,tY,Mw(sc,{brighter(e){return e=e==null?Ul:Math.pow(Ul,e),new Br(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ua:Math.pow(ua,e),new Br(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 yn(Sb(e>=240?e-240:e+120,o,r),Sb(e,o,r),Sb(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Br(aR(this.h),$f(this.s),$f(this.l),hp(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=hp(this.opacity);return`${e===1?"hsl(":"hsla("}${aR(this.h)}, ${$f(this.s)*100}%, ${$f(this.l)*100}%${e===1?")":`, ${e})`}`}}));function aR(e){return e=(e||0)%360,e<0?e+360:e}function $f(e){return Math.max(0,Math.min(1,e||0))}function Sb(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 nY=Math.PI/180,rY=180/Math.PI;var tD=-.14861,Tw=1.78277,Dw=-.29227,Sg=-.90649,Hu=1.97294,lR=Hu*Sg,cR=Hu*Tw,uR=Tw*Dw-Sg*tD;function oY(e){if(e instanceof Qs)return new Qs(e.h,e.s,e.l,e.opacity);e instanceof yn||(e=JT(e));var t=e.r/255,n=e.g/255,r=e.b/255,o=(uR*r+lR*t-cR*n)/(uR+lR-cR),i=r-o,s=(Hu*(n-o)-Dw*i)/Sg,a=Math.sqrt(s*s+i*i)/(Hu*o*(1-o)),l=a?Math.atan2(s,i)*rY-120:NaN;return new Qs(l<0?l+360:l,a,o,e.opacity)}function _o(e,t,n,r){return arguments.length===1?oY(e):new Qs(e,t,n,r??1)}function Qs(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}wg(Qs,_o,Mw(sc,{brighter(e){return e=e==null?Ul:Math.pow(Ul,e),new Qs(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ua:Math.pow(ua,e),new Qs(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*nY,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),o=Math.sin(e);return new yn(255*(t+n*(tD*r+Tw*o)),255*(t+n*(Dw*r+Sg*o)),255*(t+n*(Hu*r)),this.opacity)}}));function iY(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 sY(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 iY((n-r/t)*t,s,o,i,a)}}const Iw=e=>()=>e;function nD(e,t){return function(n){return e+n*t}}function aY(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 lY(e,t){var n=t-e;return n?nD(e,n>180||n<-180?n-360*Math.round(n/360):n):Iw(isNaN(e)?t:e)}function cY(e){return(e=+e)==1?al:function(t,n){return n-t?aY(t,n,e):Iw(isNaN(t)?n:t)}}function al(e,t){var n=t-e;return n?nD(e,n):Iw(isNaN(e)?t:e)}(function e(t){var n=cY(t);function r(o,i){var s=n((o=Vu(o)).r,(i=Vu(i)).r),a=n(o.g,i.g),l=n(o.b,i.b),c=al(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 uY(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=Vu(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 dY=uY(sY);function rD(e){return function t(n){n=+n;function r(o,i){var s=e((o=_o(o)).h,(i=_o(i)).h),a=al(o.s,i.s),l=al(o.l,i.l),c=al(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)}rD(lY);var Aw=rD(al);const bt=e=>dY(e[e.length-1]);var fY=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(st);const hY=bt(fY);var pY=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(st);const gY=bt(pY);var mY=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(st);const bY=bt(mY);var yY=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(st);const vY=bt(yY);var xY=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(st);const wY=bt(xY);var SY=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(st);const CY=bt(SY);var _Y=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(st);const EY=bt(_Y);var RY=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(st);const kY=bt(RY);var PY=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(st);const MY=bt(PY);var OY=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(st);const TY=bt(OY);var DY=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(st);const IY=bt(DY);var AY=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(st);const NY=bt(AY);var FY=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(st);const jY=bt(FY);var LY=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(st);const $Y=bt(LY);var zY=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(st);const BY=bt(zY);var VY=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(st);const HY=bt(VY);var WY=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(st);const UY=bt(WY);var GY=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(st);const qY=bt(GY);var YY=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(st);const KY=bt(YY);var XY=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(st);const QY=bt(XY);var ZY=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(st);const JY=bt(ZY);var eK=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(st);const tK=bt(eK);var nK=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(st);const rK=bt(nK);var oK=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(st);const iK=bt(oK);var sK=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(st);const aK=bt(sK);var lK=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(st);const cK=bt(lK);var uK=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(st);const dK=bt(uK);function fK(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 hK=Aw(_o(300,.5,0),_o(-240,.5,1));var pK=Aw(_o(-100,.75,.35),_o(80,1.5,.8)),gK=Aw(_o(260,.75,.35),_o(80,1.5,.8)),zf=_o();function mK(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return zf.h=360*e-100,zf.s=1.5-1.5*t,zf.l=.8-.9*t,zf+""}var Bf=Vu(),bK=Math.PI/3,yK=Math.PI*2/3;function vK(e){var t;return e=(.5-e)*Math.PI,Bf.r=255*(t=Math.sin(e))*t,Bf.g=255*(t=Math.sin(e+bK))*t,Bf.b=255*(t=Math.sin(e+yK))*t,Bf+""}function xK(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 Cg(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}const wK=Cg(st("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));var SK=Cg(st("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),CK=Cg(st("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),_K=Cg(st("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function EK(e){return e}function RK(e){if(e==null)return EK;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 kK(e,t){for(var n,r=e.length,o=r-t;o<--r;)n=e[o],e[o++]=e[r],e[r]=n}function PK(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(n){return dR(e,n)})}:dR(e,t)}function dR(e,t){var n=t.id,r=t.bbox,o=t.properties==null?{}:t.properties,i=MK(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 MK(e,t){var n=RK(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&&kK(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 gu={geoAzimuthalEqualArea:Oq,geoAzimuthalEquidistant:Tq,geoGnomonic:zq,geoOrthographic:Vq,geoStereographic:Hq,geoEqualEarth:$q,geoAlbers:VT,geoAlbersUsa:Mq,geoConicConformal:Aq,geoConicEqualArea:up,geoConicEquidistant:jq,geoEquirectangular:Nq,geoMercator:Dq,geoTransverseMercator:Wq,geoNaturalEarth1:Bq};Object.keys(gu).forEach(e=>{gu[`${e.charAt(3).toLowerCase()}${e.slice(4)}`]=gu[e]});class _a extends ts{constructor(t){super(t),this.outlineBounds=null,this.oldChartBounds=null,this.geoPath=XE()}init(t){t.position="chartArea",super.init(t),typeof t.projection=="function"?this.projection=t.projection:this.projection=(gu[t.projection]||gu.albersUsa)(),this.geoPath.projection(this.projection),this.outlineBounds=null,this.oldChartBounds=null}computeBounds(t){const n=XE(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,b=this.options;return this.projection.scale(n.refScale*d*b.projectionScale).translate([d*n.refX+p+b.projectionOffset[0],d*n.refY+g+b.projectionOffset[1]]),!u||u.chartWidth!==this.oldChartBounds.chartWidth||u.chartHeight!==this.oldChartBounds.chartHeight}}_a.id="projection";_a.defaults={projection:"albersUsa",projectionScale:1,projectionOffset:[0,0],padding:0};_a.descriptors={_scriptable:e=>e!=="projection",_indexable:e=>e!=="projectionOffset"};const _g={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 OK(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 TK(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=OK(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 Qa extends zl{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=TK(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 oD extends Bl{constructor(){super(...arguments),this.legendSize={w:0,h:0}}init(t){Qa.prototype.init.call(this,t)}parse(t,n){return Qa.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 Qa.prototype.update.call(this,t,n,r)}_computeLabelArea(){}draw(t){return Qa.prototype.draw.call(this,t)}_drawIndicator(){}}const Qo={interpolateBlues:tK,interpolateBrBG:hY,interpolateBuGn:TY,interpolateBuPu:IY,interpolateCividis:fK,interpolateCool:gK,interpolateCubehelixDefault:hK,interpolateGnBu:NY,interpolateGreens:rK,interpolateGreys:iK,interpolateInferno:CK,interpolateMagma:SK,interpolateOrRd:jY,interpolateOranges:dK,interpolatePRGn:gY,interpolatePiYG:bY,interpolatePlasma:_K,interpolatePuBu:BY,interpolatePuBuGn:$Y,interpolatePuOr:vY,interpolatePuRd:HY,interpolatePurples:aK,interpolateRainbow:mK,interpolateRdBu:wY,interpolateRdGy:CY,interpolateRdPu:UY,interpolateRdYlBu:EY,interpolateRdYlGn:kY,interpolateReds:cK,interpolateSinebow:vK,interpolateSpectral:MY,interpolateTurbo:xK,interpolateViridis:wK,interpolateWarm:pK,interpolateYlGn:KY,interpolateYlGnBu:qY,interpolateYlOrBr:QY,interpolateYlOrRd:JY};Object.keys(Qo).forEach(e=>{Qo[`${e.charAt(11).toLowerCase()}${e.slice(12)}`]=Qo[e],Qo[e.slice(11)]=Qo[e]});function iD(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 sD={interpolate:"blues",missing:"transparent",quantize:0};class Ui extends Qa{get interpolate(){const t=this.options;return t?typeof t.interpolate=="function"?t.interpolate:Qo[t.interpolate]||Qo.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=iD(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)}}}}Ui.id="color";Ui.defaults=en({},[zl.defaults,_g,sD]);Ui.descriptors={_scriptable:e=>e!=="interpolate",_indexable:!1};class Nw extends oD{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=Qo[t.interpolate]||Qo.blues}getColorForValue(t){return Ui.prototype.getColorForValue.call(this,t)}getColor(t){let n=t;return this.options.quantize>0&&(n=iD(n,this.options.quantize)),this.interpolate(n)}_drawIndicator(){return Ui.prototype._drawIndicator.call(this)}}Nw.id="colorLogarithmic";Nw.defaults=en({},[Bl.defaults,_g,sD]);Nw.descriptors={_scriptable:e=>e!=="interpolate",_indexable:!1};const aD={missing:1,mode:"area",range:[2,20],legend:{align:"bottom",length:90,width:70,indicatorWidth:42}};class Gi extends Qa{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};Yh(t,f,d,h)})}}Gi.id="size";Gi.defaults=en({},[zl.defaults,_g,aD]);Gi.descriptors={_scriptable:!0,_indexable:e=>e!=="range"};class lD extends oD{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 Gi.prototype.getSizeImpl.call(this,t)}_drawIndicator(){Gi.prototype._drawIndicator.call(this)}}lD.id="sizeLogarithmic";lD.defaults=en({},[Bl.defaults,_g,aD]);function DK(e,t){return[[e[0][0]-t,e[0][1]-t],[e[1][0]+t,e[1][1]+t]]}class ai extends Io{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&&aq(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=DK(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())}}ai.id="geoFeature";ai.defaults={...Ks.defaults,outlineBackgroundColor:null,outlineBorderWidth:0,graticuleBorderColor:"#CCCCCC",graticuleBorderWidth:0};ai.defaultRoutes={outlineBorderColor:"borderColor",...Ks.defaultRoutes||{}};const cD={showOutline:!1,showGraticule:!1,clipMap:!0},uD={scales:{projection:{axis:"x",type:_a.id,position:"chartArea",display:!1}}};function fR(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 dD extends Or{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 Oe(this.getGeoDataset().showOutline,this.getGeoOptions().showOutline)}clipMap(){return Oe(this.getGeoDataset().clipMap,this.getGeoOptions().clipMap)}getGraticule(){return Oe(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=fR(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=fR(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(lq());else{const s=RT();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,Ws(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||Ws(t.ctx,t.chartArea):r&&(r=!1,Us(t.ctx)),this.showGraticule(),n===!0||n==="items"?r||Ws(t.ctx,t.chartArea):r&&(r=!1,Us(t.ctx)),this.getMeta().data.forEach(o=>o.draw.call(o,t.ctx,t.chartArea)),r&&(r=!1,Us(t.ctx))}}function fD(e,t,n,r=[],o=[]){Pn.addControllers(n),Array.isArray(r)?Pn.addElements(...r):Pn.addElements(r),Array.isArray(o)?Pn.addScales(...o):Pn.addScales(o);const i=t;return i.type=e,i}class ac extends dD{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])}}ac.id="choropleth";ac.defaults=en({},[cD,{datasetElementType:ai.id,dataElementType:ai.id}]);ac.overrides=en({},[uD,{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:Ui.id,axis:"x"}},elements:{geoFeature:{backgroundColor(e){return e.dataIndex==null?null:e.chart.getDatasetMeta(e.datasetIndex).controller.indexToColor(e.dataIndex)}}}}]);class IK extends It{constructor(t,n){super(t,fD("choropleth",n,ac,ai,[Ui,_a]))}}IK.id=ac.id;class lc extends dD{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])}}lc.id="bubbleMap";lc.defaults=en({},[cD,{dataElementType:Ys.id,datasetElementType:ai.id,showOutline:!0,clipMap:"outline+graticule"}]);lc.overrides=en({},[uD,{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:Gi.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 AK extends It{constructor(t,n){super(t,fD("bubbleMap",n,lc,ai,[Gi,_a]))}}AK.id=lc.id;function NK(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 FK(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 jK(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 LK(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 $K(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:{position:"bottom",align:"center"}}}}}function zK(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 BK(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 VK(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:Qe.slate[800]},angleLines:{color:Qe.slate[800]},ticks:{color:Qe.slate[800],showLabelBackdrop:!1}}}}}),n}function Fw({data:e,cardType:t="bar",cfg:n,customCfg:r,provider:o="chartjs",userSettings:i,preferences:s,topoJson:a}){var l,c,u,d,h,f,p,g,b,y;if(t==="map"){if(!a)return null;const v=(l=s==null?void 0:s.mapVisualOptions)==null?void 0:l.objectKey;if(!v)return null;const x=PK(a,(c=a==null?void 0:a.objects)==null?void 0:c[v]).features;if(!x)return null;const _={plugins:{datalabels:{display:!1}},scales:{x:{display:!1,grid:{display:!1}},y:{display:!1,grid:{display:!1}},projection:{axis:"x",projection:((u=s==null?void 0:s.mapVisualOptions)==null?void 0:u.projection)||"mercator",projectionScale:((d=s==null?void 0:s.mapVisualOptions)==null?void 0:d.projectionScale)||1,projectionOffset:((h=s==null?void 0:s.mapVisualOptions)==null?void 0:h.projectionOffset)||[0,0]},color:{axis:"x",interpolate:((f=s==null?void 0:s.mapVisualOptions)==null?void 0:f.colorScale)||"blues",quantize:5,legend:{position:"bottom-right",align:"right"}}}},{keys:w}=Qt(e),S=x.map(A=>{var F;const W=w==null?void 0:w[0],$=w==null?void 0:w[1],D=(F=e.find(N=>(N==null?void 0:N[W])===A.properties.NAME||(N==null?void 0:N[W])===A.properties.name))==null?void 0:F[$];return{feature:A,value:D}}),P=Uc([{label:v,data:S,borderColor:"lightgray"}],r),O={type:"choropleth",data:{labels:x.map(A=>A.properties.NAME||A.properties.name),datasets:P},options:_},{options:T}=bO({cfg:O,preferences:s,customCfg:r});return{...O,options:T}}if(t==="bar"){const v=jK(n);return ds({data:e,cfg:v,customCfg:r,cardType:t,preferences:s})}if(t==="horizontalBar"){const v=NK(n);return ds({data:e,cfg:v,customCfg:r,cardType:t,preferences:s})}if(t==="pyramid"){const v=FK(n),{dimensionKeys:x,metricKeys:_}=Qt(e),w=Hh({dataArray:e,groupKey:x[0],pivotKey:x[1],valueKey:_[0]}),S=ds({data:w,cfg:v,customCfg:r,cardType:t,preferences:s}),R="x2";return{...S,data:{...S.data,datasets:S.data.datasets.map((O,T)=>T===1?{...O,xAxisID:R}:O)},options:{...S.options,scales:{...(p=S==null?void 0:S.options)==null?void 0:p.scales,[R]:{beginAtZero:!0,stack:1}}}}}if(t==="stackedBar"||t==="stackedLine"){const v=$K(n,t),{dimensionKeys:x,metricKeys:_}=Qt(e),w=Hh({dataArray:e,groupKey:x[0],pivotKey:x[1],valueKey:_[0],sortChart:s==null?void 0:s.sortChart});return ds({data:w,cfg:v,customCfg:r,cardType:t,preferences:s})}if(t==="line"){const v=zK(n);return ds({data:e,cfg:v,customCfg:r,cardType:t,preferences:s})}if(t==="range"){const v=LK(n),x=nB(e),_=Uc(x,r),{plugins:w,options:S}=b0((s==null?void 0:s.customVisualCode)||""),R=Vn((v==null?void 0:v.options)||{},(n==null?void 0:n.options)||{}),P=Vn(R,(s==null?void 0:s.chartOptions)||{}),O=Vn(P,(r==null?void 0:r.options)||{}),T=Vn(O,S),I=mO(n,s),A=Vn(T,I),W={...A,plugins:{...A==null?void 0:A.plugins,datalabels:{...(g=A==null?void 0:A.plugins)==null?void 0:g.datalabels,formatter:(j,H)=>j.map(V=>{var L,k,U,q;return Pr({number:Number(V),decimalPlaces:((L=s==null?void 0:s.numberAxisFormat)==null?void 0:L.decimalPlaces)||0,useSuffix:!!((k=s==null?void 0:s.numberAxisFormat)!=null&&k.suffix),customSuffix:"",locale:((U=s==null?void 0:s.numberAxisFormat)==null?void 0:U.locale)||"",currency:((q=s==null?void 0:s.numberAxisFormat)==null?void 0:q.currency)||""})}).slice(0,2).join(" - ")}}},{dimensionKeys:$}=Qt(e),D=$[0];return{type:"bar",data:{labels:[...new Set(m0(e,D))],datasets:_},options:W,plugins:[...w]}}if(t==="pie"||t==="doughnut"||t==="polarArea"){const v=BK(t,n),{dimensionKeys:x,metricKeys:_}=Qt(e),w=rB(_,e),S=Uc(w,r),{plugins:R,options:P}=b0((s==null?void 0:s.customVisualCode)||""),O=x[0],T=m0(e,O),I=Vn((v==null?void 0:v.options)||{},(r==null?void 0:r.options)||{}),A=Vn(I,(s==null?void 0:s.chartOptions)||{}),W={...A,plugins:{...A.plugins,datalabels:{...(b=A.plugins)==null?void 0:b.datalabels,formatter:(j,H)=>{var M,V,L,k;return Pr({number:Number(j),decimalPlaces:((M=s==null?void 0:s.numberAxisFormat)==null?void 0:M.decimalPlaces)||0,useSuffix:!!((V=s==null?void 0:s.numberAxisFormat)!=null&&V.suffix),customSuffix:"",locale:((L=s==null?void 0:s.numberAxisFormat)==null?void 0:L.locale)||"",currency:((k=s==null?void 0:s.numberAxisFormat)==null?void 0:k.currency)||""})}},tooltip:{...(y=A.plugins)==null?void 0:y.tooltip,callbacks:{label:function(j){var U,q,Y,B;j.dataset.label;const M=j.dataset.data.reduce((G,X)=>G+X,0),V=j.parsed,L=Pr({number:Number(V),decimalPlaces:((U=s==null?void 0:s.numberAxisFormat)==null?void 0:U.decimalPlaces)||0,useSuffix:!!((q=s==null?void 0:s.numberAxisFormat)!=null&&q.suffix),customSuffix:"",locale:((Y=s==null?void 0:s.numberAxisFormat)==null?void 0:Y.locale)||"",currency:((B=s==null?void 0:s.numberAxisFormat)==null?void 0:B.currency)||""}),k=(V/M*100).toFixed(2);return L+` (${k}%)`}}}}},$=Vn(A,W),D=Vn($,P);return{type:t,data:{labels:T,datasets:S},options:D,plugins:[t==="doughnut"?{id:"doughnutLabel",beforeDatasetsDraw:function(j,H,M){var X,J,ne,Z;const{ctx:V,data:L}=j;V.save();const k=j.getDatasetMeta(0).data[0].x,U=j.getDatasetMeta(0).data[0].y,q=Dl(Mu()),Y=window.getComputedStyle(V.canvas).fontFamily;V.font=`1em ${Y}`,V.fontWeight="bolder",V.fillStyle=q,V.textAlign="center",V.textBaseline="middle";const B=L.datasets[0].data.reduce((oe,ee)=>oe+ee,0),G=Pr({number:Number(B),decimalPlaces:((X=s==null?void 0:s.numberAxisFormat)==null?void 0:X.decimalPlaces)||0,useSuffix:!!((J=s==null?void 0:s.numberAxisFormat)!=null&&J.suffix),customSuffix:"",locale:((ne=s==null?void 0:s.numberAxisFormat)==null?void 0:ne.locale)||"",currency:((Z=s==null?void 0:s.numberAxisFormat)==null?void 0:Z.currency)||""});V.fillText(G,k,U)}}:"",...R]}}if(t==="radar"){const v=VK(n);return ds({data:e,cfg:v,customCfg:r,cardType:t,preferences:s})}if(t==="bubble"||t==="scatter"){const{metricKeys:v}=Qt(e);if(v.length<3){console.log("Bubble charts require 3 numeric columns");return}const x=tB(e,t),_=Uc(x,r),w={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{label:function(P){var F;const O=P.dataset.label,T=P.dataIndex,I=P.dataset.data,A=(F=I==null?void 0:I[T])==null?void 0:F.label,W=v[0],$=v[1],D=v[2];return A?`${O} (${A}): ${W}: ${P.raw.x.toFixed(2)}, ${$}: ${P.raw.y.toFixed(2)}, ${D}: ${P.raw.r.toFixed(2)}`:`${O}: ${W}: ${P.raw.x.toFixed(2)}, ${$}: ${P.raw.y.toFixed(2)}, ${D}: ${P.raw.r.toFixed(2)}`}}},datalabels:{display:!1}},scales:{x:{title:{display:!0,text:v[0]},beginAtZero:!0,ticks:{precision:0}},y:{title:{display:!0,text:v[1]},beginAtZero:!0,ticks:{precision:0}}}},S=Vn(w,(r==null?void 0:r.options)||{});return{type:t,data:{datasets:_},options:S}}return ds({data:e,cfg:n,customCfg:r,cardType:t,preferences:s})}function HK({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)&&UK(e,t,o,i,a),["pie","doughnut","polarArea"].includes(r)&&GK(e,t,o,i,a),["stackedBar","pyramid"].includes(r)&&WK({chart:e,elementIndex:t,datasetIndex:n,cfg:o,apply:i,blurColor:a})}function WK(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,b)=>b===n&&h===r?g:s),d.borderColor=(p=d==null?void 0:d.borderColor)==null?void 0:p.map((g,b)=>b===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,b,y,v;d.backgroundColor=new Array(d.data.length).fill((g=(p=(f=o==null?void 0:o.data)==null?void 0:f.datasets)==null?void 0:p[h])==null?void 0:g.backgroundColor),d.borderColor=new Array(d.data.length).fill((v=(y=(b=o==null?void 0:o.data)==null?void 0:b.datasets)==null?void 0:y[h])==null?void 0:v.borderColor)}),t==null||t.update()}function UK(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,b;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((b=(g=(p=n==null?void 0:n.data)==null?void 0:p.datasets)==null?void 0:g[u])==null?void 0:b.borderColor)}),e==null||e.update()}function GK(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,b,y,v;typeof c.backgroundColor=="string"&&(c.backgroundColor=(f=(h=(d=n==null?void 0:n.data)==null?void 0:d.datasets)==null?void 0:h[u])==null?void 0:f.backgroundColor,c.borderColor=(b=(g=(p=n==null?void 0:n.data)==null?void 0:p.datasets)==null?void 0:g[u])==null?void 0:b.borderColor),c.backgroundColor=(y=c==null?void 0:c.backgroundColor)==null?void 0:y.map((x,_)=>{var w;return(w=n.data.datasets[u].backgroundColor)==null?void 0:w[_]}),c.borderColor=(v=c==null?void 0:c.borderColor)==null?void 0:v.map((x,_)=>{var w;return(w=n.data.datasets[u].borderColor)==null?void 0:w[_]})}),e==null||e.update()}function qK({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}=Qt(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"].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=Hh({dataArray:t,groupKey:h[0],pivotKey:h[1],valueKey:f[0]}),g=h[0],b=(u=p[r])==null?void 0:u[g],y=h[1],{metricKeys:v}=Qt(p),x=v[n];return[{columnName:g,columnValue:b,metric:f[0],value:o},{columnName:y,columnValue:x,metric:f[0],value:o}]}if(e.type==="bubble"||e.type==="scatter"){const p=h[0],g=o.label;return[{columnName:p,columnValue:g,metric1:f[0],value1:o.x,metric2:f[1],value2:o.y,metric3:f==null?void 0:f[2],value3:o==null?void 0:o.r}]}}catch(d){console.error("Error in getAdhocFilter",d)}}function YK(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,FB("--semaphor-background")),c})}));return{...e,data:{...e.data,datasets:i}}}return e}function hD(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}=md({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 KK(e){var s,a;const[t]=E.useState({id:"",title:"",type:"bar"}),{getCard:n}=Bt(),r=n(e),o=pD(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 pD(e){var W,$,D,F;const{onChartElementClicked:t}=xr(),[n,r]=E.useState(0);((W=e==null?void 0:e.preferences)==null?void 0:W.filterOnClickColumnIndex)===void 0||($=e.preferences)==null||$.filterOnClickColumnIndex;const o=se(N=>N.isVisualEditing),i=se(N=>N.filteringCards),s=se(N=>N.selectedSheetId),a=se(N=>N.selectedLensId);se(N=>N.selectedCardId),se(N=>N.dashboard),se(N=>N.isDashboardEditing),se(N=>N.themeStyle);const l=se(N=>N.filterValues),c=E.useRef(l),u=(D=e==null?void 0:e.preferences)==null?void 0:D.onClickFilter,{addFilteringCard:d,getCardFrame:h,addOrUpdateFilterValues:f,removeFilterValues:p,removeFilteringCard:g}=Bt(),{data:b,isLoading:y,isFetching:v,isError:x,queryKey:_}=Bi(e),{data:w}=hD(e),S=i==null?void 0:i.find(N=>N.id===e.id),R=h(e.id),P=(R==null?void 0:R.cards)||[],O=(P==null?void 0:P.length)==1;let T;b&&b.records&&((F=b.records)==null?void 0:F.length)>0&&e.type!=="custom"&&(T=Fw({data:b==null?void 0:b.records,cardType:e.type,cfg:e.cfg,customCfg:e.customCfg,preferences:e.preferences,topoJson:w}));const I=E.useRef({filteringCards:i});E.useEffect(()=>{!(b!=null&&b.records)||y||v||S&&O||o||r(N=>N+1)},[b==null?void 0:b.records,y,v,S,O,o]),E.useEffect(()=>{e.connectionId&&!S&&(c.current=l)},[l,a,e.connectionId,S]),E.useEffect(()=>{var j;S&&(I.current.filteringCards=[...i||[]]),!S&&((j=I.current.filteringCards)==null?void 0:j.find(H=>H.id===e.id))&&O&&r(H=>H+1)},[S,O,e.id,i]);function A(N,j,H,M){var k;let V=!1;if(!(b!=null&&b.records))return;const L=qK({card:e,data:b==null?void 0:b.records,datasetIndex:j,clickIndex:H,value:M});if(console.log("fieldValues",L),t==null||t(e,L),!!(((k=e==null?void 0:e.preferences)==null?void 0:k.onClickFilter)??[]).length){if(S){const U=e.id;p(U),g(e)}else{if(V=!0,!L)return;const U=[];L.forEach((q,Y)=>{const B=u==null?void 0:u.find(X=>X.columnIndex===Y);if(!B)return;const G={filterId:e.id+"-"+q.columnName+"-"+s,connectionId:e==null?void 0:e.connectionId,tableName:e.lastSelectedTable,name:q.columnName,expression:B.expression,valueType:Gp(L[B.columnIndex].columnValue),operation:"=",values:[L[B.columnIndex].columnValue]};U.push(G)}),f(U),d(e)}HK({chart:N,elementIndex:H,datasetIndex:j,cardType:e.type,cfg:T,apply:V})}}return{isError:x,isLoading:y,isFetching:v,data:b,visualKey:n,handleDatapointClick:A,cfg:T,queryKey:_}}function vo({children:e,containerClassName:t,className:n,text:r,onSave:o,type:i="input"}){const[s,a]=E.useState(!1),[l,c]=E.useState(r),u=se(f=>f.isDashboardEditing),d=f=>{f.stopPropagation(),u&&a(!0)};function h(){return i==="textarea"?m.jsx("textarea",{className:ie("grow rounded-sm bg-background px-2 py-1 text-sm outline-dashed outline-[0.5px] outline-primary/50",n),onChange:f=>c(f.target.value),value:l,autoFocus:!0,onBlur:()=>a(!1),onKeyDown:f=>{f.stopPropagation(),!(f.key==="Enter"&&f.shiftKey)&&(f.key==="Enter"||f.key==="Tab")&&(a(!1),o(l))}}):m.jsx("input",{onMouseDown:f=>f.stopPropagation(),type:"text",className:ie("rounded-sm bg-background px-2 py-1 text-sm outline-dashed outline-[0.5px] outline-primary/50",n),onChange:f=>c(f.target.value),value:l,autoFocus:!0,onBlur:()=>a(!1),onKeyDown:f=>{f.stopPropagation(),(f.key==="Enter"||f.key==="Tab")&&(a(!1),o(l))}})}return m.jsx("div",{className:ie("flex",t),role:"editable",onDoubleClick:d,children:s?h():e})}function gD(e){const{authToken:t}=xr(),n=A8(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 pp({card:e,data:t}){var v,x,_,w,S,R,P,O,T,I,A,W,$,D,F,N;const n=se(j=>j.actions.setCardTitle),r=se(j=>j.actions.setCardDescription),o=se(j=>j.isVisualEditing),i=Wn(j=>j.card),s=Wn(j=>j.actions.setCard);Wn(j=>j.actions.setNumberFormat);const{getCurrency:a,getLocale:l}=gD(e),c=se(j=>j.selectedSheetId),u=(x=(v=e.preferences)==null?void 0:v.formatNumber)==null?void 0:x.colorRanges,{metricKeys:d}=Qt(t),h=(_=t==null?void 0:t[0])==null?void 0:_[d==null?void 0:d[0]],f=(w=t==null?void 0:t[0])==null?void 0:w[d==null?void 0:d[1]],p=t&&t.length>0;function g(j){o?s({...i,title:j}):n(c,e.id,j)}function b(j){o?s({...i,description:j}):r(c,e.id,j)}const y=f&&f-h!==0?(h-f)/f:null;return m.jsxs("div",{className:"kpi-card flex grow flex-col overflow-auto",children:[m.jsxs(Yp,{className:"grow pb-3",children:[m.jsx(vo,{text:o?i.title:e.title,onSave:g,children:m.jsx("div",{className:"flex items-center gap-2",children:m.jsx(nc,{className:"text-base font-medium text-muted-foreground",children:e.title})})}),p&&m.jsxs("div",{className:"flex flex-wrap items-end gap-3 text-foreground",children:[m.jsx("p",{style:{color:iw(h,u)},className:"text-3xl font-semibold",children:Pr({number:h,decimalPlaces:((R=(S=e.preferences)==null?void 0:S.formatNumber)==null?void 0:R.decimalPlaces)||0,useSuffix:!!((O=(P=e.preferences)==null?void 0:P.formatNumber)!=null&&O.suffix),customSuffix:((I=(T=e.preferences)==null?void 0:T.formatNumber)==null?void 0:I.suffix)||"",locale:l()||"",currency:a()||""})}),f&&m.jsxs("span",{className:"min-w-fit text-base font-normal text-muted-foreground",children:["from  ",Pr({number:f,decimalPlaces:((W=(A=e.preferences)==null?void 0:A.formatNumber)==null?void 0:W.decimalPlaces)||0,useSuffix:!!((D=($=e.preferences)==null?void 0:$.formatNumber)!=null&&D.suffix),customSuffix:((N=(F=e.preferences)==null?void 0:F.formatNumber)==null?void 0:N.suffix)||"",locale:l()||"",currency:a()||""})]})]})]}),y&&m.jsxs(Kp,{className:"grow items-start gap-1 pb-4 text-sm",children:[m.jsx(mD,{children:y}),m.jsxs("div",{className:"flex gap-1 text-muted-foreground",children:[y>0?"up ":"down ",m.jsx(vo,{text:e.description||"",onSave:b,children:e.description})]})]})]})}function mD({children:e,className:t}){var i,s;const n=se(a=>a.themeStyle),r=e>0?m.jsx("span",{children:"+"}):m.jsx("span",{children:"-"}),o=`${Math.abs(e*100).toFixed(0)}%`;return m.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,m.jsx("span",{className:"ml-[1px]",children:o})]})}const XK=["top","right","bottom","left"],li=Math.min,gn=Math.max,Wu=Math.round,Vf=Math.floor,xo=e=>({x:e,y:e}),QK={left:"right",right:"left",bottom:"top",top:"bottom"},ZK={start:"end",end:"start"};function K0(e,t,n){return gn(e,li(t,n))}function Eo(e,t){return typeof e=="function"?e(t):e}function ci(e){return e.split("-")[0]}function cc(e){return e.split("-")[1]}function jw(e){return e==="x"?"y":"x"}function Lw(e){return e==="y"?"height":"width"}function qi(e){return["top","bottom"].includes(ci(e))?"y":"x"}function $w(e){return jw(qi(e))}function JK(e,t,n){n===void 0&&(n=!1);const r=cc(e),o=$w(e),i=Lw(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=gp(s)),[s,gp(s)]}function eX(e){const t=gp(e);return[X0(e),t,X0(t)]}function X0(e){return e.replace(/start|end/g,t=>ZK[t])}function tX(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 nX(e,t,n,r){const o=cc(e);let i=tX(ci(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(X0)))),i}function gp(e){return e.replace(/left|right|bottom|top/g,t=>QK[t])}function rX(e){return{top:0,right:0,bottom:0,left:0,...e}}function bD(e){return typeof e!="number"?rX(e):{top:e,right:e,bottom:e,left:e}}function mp(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 hR(e,t,n){let{reference:r,floating:o}=e;const i=qi(t),s=$w(t),a=Lw(s),l=ci(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(cc(t)){case"start":f[s]-=h*(n&&c?-1:1);break;case"end":f[s]+=h*(n&&c?-1:1);break}return f}const oX=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}=hR(c,r,l),h=r,f={},p=0;for(let g=0;g<a.length;g++){const{name:b,fn:y}=a[g],{x:v,y:x,data:_,reset:w}=await y({x:u,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:f,rects:c,platform:s,elements:{reference:e,floating:t}});u=v??u,d=x??d,f={...f,[b]:{...f[b],..._}},w&&p<=50&&(p++,typeof w=="object"&&(w.placement&&(h=w.placement),w.rects&&(c=w.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):w.rects),{x:u,y:d}=hR(c,h,l)),g=-1)}return{x:u,y:d,placement:h,strategy:o,middlewareData:f}};async function Gl(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}=Eo(t,e),p=bD(f),b=a[h?d==="floating"?"reference":"floating":d],y=mp(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(b)))==null||n?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),_=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},w=mp(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:x,strategy:l}):v);return{top:(y.top-w.top+p.top)/_.y,bottom:(w.bottom-y.bottom+p.bottom)/_.y,left:(y.left-w.left+p.left)/_.x,right:(w.right-y.right+p.right)/_.x}}const iX=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}=Eo(e,t)||{};if(c==null)return{};const d=bD(u),h={x:n,y:r},f=$w(o),p=Lw(f),g=await s.getDimensions(c),b=f==="y",y=b?"top":"left",v=b?"bottom":"right",x=b?"clientHeight":"clientWidth",_=i.reference[p]+i.reference[f]-h[f]-i.floating[p],w=h[f]-i.reference[f],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let R=S?S[x]:0;(!R||!await(s.isElement==null?void 0:s.isElement(S)))&&(R=a.floating[x]||i.floating[p]);const P=_/2-w/2,O=R/2-g[p]/2-1,T=li(d[y],O),I=li(d[v],O),A=T,W=R-g[p]-I,$=R/2-g[p]/2+P,D=K0(A,$,W),F=!l.arrow&&cc(o)!=null&&$!==D&&i.reference[p]/2-($<A?T:I)-g[p]/2<0,N=F?$<A?$-A:$-W:0;return{[f]:h[f]+N,data:{[f]:D,centerOffset:$-D-N,...F&&{alignmentOffset:N}},reset:F}}}),sX=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,...b}=Eo(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=ci(o),v=qi(a),x=ci(a)===a,_=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=h||(x||!g?[gp(a)]:eX(a)),S=p!=="none";!h&&S&&w.push(...nX(a,g,p,_));const R=[a,...w],P=await Gl(t,b),O=[];let T=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&O.push(P[y]),d){const $=JK(o,s,_);O.push(P[$[0]],P[$[1]])}if(T=[...T,{placement:o,overflows:O}],!O.every($=>$<=0)){var I,A;const $=(((I=i.flip)==null?void 0:I.index)||0)+1,D=R[$];if(D)return{data:{index:$,overflows:T},reset:{placement:D}};let F=(A=T.filter(N=>N.overflows[0]<=0).sort((N,j)=>N.overflows[1]-j.overflows[1])[0])==null?void 0:A.placement;if(!F)switch(f){case"bestFit":{var W;const N=(W=T.filter(j=>{if(S){const H=qi(j.placement);return H===v||H==="y"}return!0}).map(j=>[j.placement,j.overflows.filter(H=>H>0).reduce((H,M)=>H+M,0)]).sort((j,H)=>j[1]-H[1])[0])==null?void 0:W[0];N&&(F=N);break}case"initialPlacement":F=a;break}if(o!==F)return{reset:{placement:F}}}return{}}}};function pR(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function gR(e){return XK.some(t=>e[t]>=0)}const aX=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Eo(e,t);switch(r){case"referenceHidden":{const i=await Gl(t,{...o,elementContext:"reference"}),s=pR(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:gR(s)}}}case"escaped":{const i=await Gl(t,{...o,altBoundary:!0}),s=pR(i,n.floating);return{data:{escapedOffsets:s,escaped:gR(s)}}}default:return{}}}}};async function lX(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=ci(n),a=cc(n),l=qi(n)==="y",c=["left","top"].includes(s)?-1:1,u=i&&l?-1:1,d=Eo(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 cX=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 lX(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}}}}},uX=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:b=>{let{x:y,y:v}=b;return{x:y,y:v}}},...l}=Eo(e,t),c={x:n,y:r},u=await Gl(t,l),d=qi(ci(o)),h=jw(d);let f=c[h],p=c[d];if(i){const b=h==="y"?"top":"left",y=h==="y"?"bottom":"right",v=f+u[b],x=f-u[y];f=K0(v,f,x)}if(s){const b=d==="y"?"top":"left",y=d==="y"?"bottom":"right",v=p+u[b],x=p-u[y];p=K0(v,p,x)}const g=a.fn({...t,[h]:f,[d]:p});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[h]:i,[d]:s}}}}}},dX=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}=Eo(e,t),u={x:n,y:r},d=qi(o),h=jw(d);let f=u[h],p=u[d];const g=Eo(a,t),b=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const x=h==="y"?"height":"width",_=i.reference[h]-i.floating[x]+b.mainAxis,w=i.reference[h]+i.reference[x]-b.mainAxis;f<_?f=_:f>w&&(f=w)}if(c){var y,v;const x=h==="y"?"width":"height",_=["top","left"].includes(ci(o)),w=i.reference[d]-i.floating[x]+(_&&((y=s.offset)==null?void 0:y[d])||0)+(_?0:b.crossAxis),S=i.reference[d]+i.reference[x]+(_?0:((v=s.offset)==null?void 0:v[d])||0)-(_?b.crossAxis:0);p<w?p=w:p>S&&(p=S)}return{[h]:f,[d]:p}}}},fX=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}=Eo(e,t),u=await Gl(t,c),d=ci(o),h=cc(o),f=qi(o)==="y",{width:p,height:g}=i.floating;let b,y;d==="top"||d==="bottom"?(b=d,y=h===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,b=h==="end"?"top":"bottom");const v=g-u.top-u.bottom,x=p-u.left-u.right,_=li(g-u[b],v),w=li(p-u[y],x),S=!t.middlewareData.shift;let R=_,P=w;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(R=v),S&&!h){const T=gn(u.left,0),I=gn(u.right,0),A=gn(u.top,0),W=gn(u.bottom,0);f?P=p-2*(T!==0||I!==0?T+I:gn(u.left,u.right)):R=g-2*(A!==0||W!==0?A+W:gn(u.top,u.bottom))}await l({...t,availableWidth:P,availableHeight:R});const O=await s.getDimensions(a.floating);return p!==O.width||g!==O.height?{reset:{rects:!0}}:{}}}};function Eg(){return typeof window<"u"}function uc(e){return yD(e)?(e.nodeName||"").toLowerCase():"#document"}function gr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ao(e){var t;return(t=(yD(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function yD(e){return Eg()?e instanceof Node||e instanceof gr(e).Node:!1}function vn(e){return Eg()?e instanceof Element||e instanceof gr(e).Element:!1}function Ro(e){return Eg()?e instanceof HTMLElement||e instanceof gr(e).HTMLElement:!1}function mR(e){return!Eg()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof gr(e).ShadowRoot}function _d(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=qr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function hX(e){return["table","td","th"].includes(uc(e))}function Rg(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function zw(e){const t=Bw(),n=vn(e)?qr(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 pX(e){let t=Yi(e);for(;Ro(t)&&!ql(t);){if(zw(t))return t;if(Rg(t))return null;t=Yi(t)}return null}function Bw(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ql(e){return["html","body","#document"].includes(uc(e))}function qr(e){return gr(e).getComputedStyle(e)}function kg(e){return vn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Yi(e){if(uc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||mR(e)&&e.host||Ao(e);return mR(t)?t.host:t}function vD(e){const t=Yi(e);return ql(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ro(t)&&_d(t)?t:vD(t)}function Uu(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=vD(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=gr(o);if(i){const a=Q0(s);return t.concat(s,s.visualViewport||[],_d(o)?o:[],a&&n?Uu(a):[])}return t.concat(o,Uu(o,[],n))}function Q0(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function xD(e){const t=qr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ro(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Wu(n)!==i||Wu(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function Vw(e){return vn(e)?e:e.contextElement}function ll(e){const t=Vw(e);if(!Ro(t))return xo(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=xD(t);let s=(i?Wu(n.width):n.width)/r,a=(i?Wu(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const gX=xo(0);function wD(e){const t=gr(e);return!Bw()||!t.visualViewport?gX:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function mX(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==gr(e)?!1:t}function da(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Vw(e);let s=xo(1);t&&(r?vn(r)&&(s=ll(r)):s=ll(e));const a=mX(i,n,r)?wD(i):xo(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=gr(i),f=r&&vn(r)?gr(r):r;let p=h,g=Q0(p);for(;g&&r&&f!==p;){const b=ll(g),y=g.getBoundingClientRect(),v=qr(g),x=y.left+(g.clientLeft+parseFloat(v.paddingLeft))*b.x,_=y.top+(g.clientTop+parseFloat(v.paddingTop))*b.y;l*=b.x,c*=b.y,u*=b.x,d*=b.y,l+=x,c+=_,p=gr(g),g=Q0(p)}}return mp({width:u,height:d,x:l,y:c})}function Hw(e,t){const n=kg(e).scrollLeft;return t?t.left+n:da(Ao(e)).left+n}function SD(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:Hw(e,r)),i=r.top+t.scrollTop;return{x:o,y:i}}function bX(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=Ao(r),a=t?Rg(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=xo(1);const u=xo(0),d=Ro(r);if((d||!d&&!i)&&((uc(r)!=="body"||_d(s))&&(l=kg(r)),Ro(r))){const f=da(r);c=ll(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const h=s&&!d&&!i?SD(s,l,!0):xo(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 yX(e){return Array.from(e.getClientRects())}function vX(e){const t=Ao(e),n=kg(e),r=e.ownerDocument.body,o=gn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=gn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Hw(e);const a=-n.scrollTop;return qr(r).direction==="rtl"&&(s+=gn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function xX(e,t){const n=gr(e),r=Ao(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=Bw();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function wX(e,t){const n=da(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Ro(e)?ll(e):xo(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 bR(e,t,n){let r;if(t==="viewport")r=xX(e,n);else if(t==="document")r=vX(Ao(e));else if(vn(t))r=wX(t,n);else{const o=wD(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return mp(r)}function CD(e,t){const n=Yi(e);return n===t||!vn(n)||ql(n)?!1:qr(n).position==="fixed"||CD(n,t)}function SX(e,t){const n=t.get(e);if(n)return n;let r=Uu(e,[],!1).filter(a=>vn(a)&&uc(a)!=="body"),o=null;const i=qr(e).position==="fixed";let s=i?Yi(e):e;for(;vn(s)&&!ql(s);){const a=qr(s),l=zw(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||_d(s)&&!l&&CD(e,s))?r=r.filter(u=>u!==s):o=a,s=Yi(s)}return t.set(e,r),r}function CX(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?Rg(t)?[]:SX(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const d=bR(t,u,o);return c.top=gn(d.top,c.top),c.right=li(d.right,c.right),c.bottom=li(d.bottom,c.bottom),c.left=gn(d.left,c.left),c},bR(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function _X(e){const{width:t,height:n}=xD(e);return{width:t,height:n}}function EX(e,t,n){const r=Ro(t),o=Ao(t),i=n==="fixed",s=da(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=xo(0);if(r||!r&&!i)if((uc(t)!=="body"||_d(o))&&(a=kg(t)),r){const h=da(t,!0,i,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else o&&(l.x=Hw(o));const c=o&&!r&&!i?SD(o,a):xo(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 Cb(e){return qr(e).position==="static"}function yR(e,t){if(!Ro(e)||qr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ao(e)===n&&(n=n.ownerDocument.body),n}function _D(e,t){const n=gr(e);if(Rg(e))return n;if(!Ro(e)){let o=Yi(e);for(;o&&!ql(o);){if(vn(o)&&!Cb(o))return o;o=Yi(o)}return n}let r=yR(e,t);for(;r&&hX(r)&&Cb(r);)r=yR(r,t);return r&&ql(r)&&Cb(r)&&!zw(r)?n:r||pX(e)||n}const RX=async function(e){const t=this.getOffsetParent||_D,n=this.getDimensions,r=await n(e.floating);return{reference:EX(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function kX(e){return qr(e).direction==="rtl"}const PX={convertOffsetParentRelativeRectToViewportRelativeRect:bX,getDocumentElement:Ao,getClippingRect:CX,getOffsetParent:_D,getElementRects:RX,getClientRects:yX,getDimensions:_X,getScale:ll,isElement:vn,isRTL:kX};function ED(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function MX(e,t){let n=null,r;const o=Ao(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=Vf(d),g=Vf(o.clientWidth-(u+h)),b=Vf(o.clientHeight-(d+f)),y=Vf(u),x={rootMargin:-p+"px "+-g+"px "+-b+"px "+-y+"px",threshold:gn(0,li(1,l))||1};let _=!0;function w(S){const R=S[0].intersectionRatio;if(R!==l){if(!_)return s();R?s(!1,R):r=setTimeout(()=>{s(!1,1e-7)},1e3)}R===1&&!ED(c,e.getBoundingClientRect())&&s(),_=!1}try{n=new IntersectionObserver(w,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(w,x)}n.observe(e)}return s(!0),i}function RD(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=Vw(e),u=o||i?[...c?Uu(c):[],...Uu(t)]:[];u.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const d=c&&a?MX(c,n):null;let h=-1,f=null;s&&(f=new ResizeObserver(y=>{let[v]=y;v&&v.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var x;(x=f)==null||x.observe(t)})),n()}),c&&!l&&f.observe(c),f.observe(t));let p,g=l?da(e):null;l&&b();function b(){const y=da(e);g&&!ED(g,y)&&n(),g=y,p=requestAnimationFrame(b)}return n(),()=>{var y;u.forEach(v=>{o&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),d==null||d(),(y=f)==null||y.disconnect(),f=null,l&&cancelAnimationFrame(p)}}const _b=Gl,OX=cX,TX=uX,DX=sX,IX=fX,AX=aX,vR=iX,NX=dX,FX=(e,t,n)=>{const r=new Map,o={platform:PX,...n},i={...o.platform,_c:r};return oX(e,t,{...o,platform:i})};var Eh=typeof document<"u"?E.useLayoutEffect:E.useEffect;function bp(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(!bp(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)&&!bp(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function kD(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xR(e,t){const n=kD(e);return Math.round(t*n)/n}function Eb(e){const t=C.useRef(e);return Eh(()=>{t.current=e}),t}function PD(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]=C.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,f]=C.useState(r);bp(h,r)||f(r);const[p,g]=C.useState(null),[b,y]=C.useState(null),v=C.useCallback(j=>{j!==S.current&&(S.current=j,g(j))},[]),x=C.useCallback(j=>{j!==R.current&&(R.current=j,y(j))},[]),_=i||p,w=s||b,S=C.useRef(null),R=C.useRef(null),P=C.useRef(u),O=l!=null,T=Eb(l),I=Eb(o),A=Eb(c),W=C.useCallback(()=>{if(!S.current||!R.current)return;const j={placement:t,strategy:n,middleware:h};I.current&&(j.platform=I.current),FX(S.current,R.current,j).then(H=>{const M={...H,isPositioned:A.current!==!1};$.current&&!bp(P.current,M)&&(P.current=M,na.flushSync(()=>{d(M)}))})},[h,t,n,I,A]);Eh(()=>{c===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,d(j=>({...j,isPositioned:!1})))},[c]);const $=C.useRef(!1);Eh(()=>($.current=!0,()=>{$.current=!1}),[]),Eh(()=>{if(_&&(S.current=_),w&&(R.current=w),_&&w){if(T.current)return T.current(_,w,W);W()}},[_,w,W,T,O]);const D=C.useMemo(()=>({reference:S,floating:R,setReference:v,setFloating:x}),[v,x]),F=C.useMemo(()=>({reference:_,floating:w}),[_,w]),N=C.useMemo(()=>{const j={position:n,left:0,top:0};if(!F.floating)return j;const H=xR(F.floating,u.x),M=xR(F.floating,u.y);return a?{...j,transform:"translate("+H+"px, "+M+"px)",...kD(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:M}},[n,a,F.floating,u.x,u.y]);return C.useMemo(()=>({...u,update:W,refs:D,elements:F,floatingStyles:N}),[u,W,D,F,N])}const jX=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?vR({element:r.current,padding:o}).fn(n):{}:r?vR({element:r,padding:o}).fn(n):{}}}},Ww=(e,t)=>({...OX(e),options:[e,t]}),MD=(e,t)=>({...TX(e),options:[e,t]}),LX=(e,t)=>({...NX(e),options:[e,t]}),OD=(e,t)=>({...DX(e),options:[e,t]}),TD=(e,t)=>({...IX(e),options:[e,t]}),$X=(e,t)=>({...AX(e),options:[e,t]}),zX=(e,t)=>({...jX(e),options:[e,t]});var BX="Arrow",DD=C.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return m.jsx(ge.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});DD.displayName=BX;var VX=DD;function Pg(e){const[t,n]=C.useState(void 0);return on(()=>{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 Uw="Popper",[ID,No]=Xt(Uw),[HX,AD]=ID(Uw),ND=e=>{const{__scopePopper:t,children:n}=e,[r,o]=C.useState(null);return m.jsx(HX,{scope:t,anchor:r,onAnchorChange:o,children:n})};ND.displayName=Uw;var FD="PopperAnchor",jD=C.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=AD(FD,n),s=C.useRef(null),a=Te(t,s);return C.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:m.jsx(ge.div,{...o,ref:a})});jD.displayName=FD;var Gw="PopperContent",[WX,UX]=ID(Gw),LD=C.forwardRef((e,t)=>{var B,G,X,J,ne,Z;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,b=AD(Gw,n),[y,v]=C.useState(null),x=Te(t,oe=>v(oe)),[_,w]=C.useState(null),S=Pg(_),R=(S==null?void 0:S.width)??0,P=(S==null?void 0:S.height)??0,O=r+(i!=="center"?"-"+i:""),T=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},I=Array.isArray(c)?c:[c],A=I.length>0,W={padding:T,boundary:I.filter(qX),altBoundary:A},{refs:$,floatingStyles:D,placement:F,isPositioned:N,middlewareData:j}=PD({strategy:"fixed",placement:O,whileElementsMounted:(...oe)=>RD(...oe,{animationFrame:f==="always"}),elements:{reference:b.anchor},middleware:[Ww({mainAxis:o+P,alignmentAxis:s}),l&&MD({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?LX():void 0,...W}),l&&OD({...W}),TD({...W,apply:({elements:oe,rects:ee,availableWidth:de,availableHeight:fe})=>{const{width:xe,height:pe}=ee.reference,be=oe.floating.style;be.setProperty("--radix-popper-available-width",`${de}px`),be.setProperty("--radix-popper-available-height",`${fe}px`),be.setProperty("--radix-popper-anchor-width",`${xe}px`),be.setProperty("--radix-popper-anchor-height",`${pe}px`)}}),_&&zX({element:_,padding:a}),YX({arrowWidth:R,arrowHeight:P}),h&&$X({strategy:"referenceHidden",...W})]}),[H,M]=BD(F),V=Kt(p);on(()=>{N&&(V==null||V())},[N,V]);const L=(B=j.arrow)==null?void 0:B.x,k=(G=j.arrow)==null?void 0:G.y,U=((X=j.arrow)==null?void 0:X.centerOffset)!==0,[q,Y]=C.useState();return on(()=>{y&&Y(window.getComputedStyle(y).zIndex)},[y]),m.jsx("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:N?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:q,"--radix-popper-transform-origin":[(J=j.transformOrigin)==null?void 0:J.x,(ne=j.transformOrigin)==null?void 0:ne.y].join(" "),...((Z=j.hide)==null?void 0:Z.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(WX,{scope:n,placedSide:H,onArrowChange:w,arrowX:L,arrowY:k,shouldHideArrow:U,children:m.jsx(ge.div,{"data-side":H,"data-align":M,...g,ref:x,style:{...g.style,animation:N?void 0:"none"}})})})});LD.displayName=Gw;var $D="PopperArrow",GX={top:"bottom",right:"left",bottom:"top",left:"right"},zD=C.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=UX($D,r),s=GX[i.placedSide];return m.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:m.jsx(VX,{...o,ref:n,style:{...o.style,display:"block"}})})});zD.displayName=$D;function qX(e){return e!==null}var YX=e=>({name:"transformOrigin",options:e,fn(t){var b,y,v;const{placement:n,rects:r,middlewareData:o}=t,s=((b=o.arrow)==null?void 0:b.centerOffset)!==0,a=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[c,u]=BD(n),d={start:"0%",center:"50%",end:"100%"}[u],h=(((y=o.arrow)==null?void 0:y.x)??0)+a/2,f=(((v=o.arrow)==null?void 0:v.y)??0)+l/2;let p="",g="";return c==="bottom"?(p=s?d:`${h}px`,g=`${-l}px`):c==="top"?(p=s?d:`${h}px`,g=`${r.floating.height+l}px`):c==="right"?(p=`${-l}px`,g=s?d:`${f}px`):c==="left"&&(p=`${r.floating.width+l}px`,g=s?d:`${f}px`),{data:{x:p,y:g}}}});function BD(e){const[t,n="center"]=e.split("-");return[t,n]}var Ed=ND,dc=jD,Rd=LD,kd=zD,KX="Portal",Pd=C.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=C.useState(!1);on(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?mn.createPortal(m.jsx(ge.div,{...r,ref:t}),s):null});Pd.displayName=KX;function XX(e,t=globalThis==null?void 0:globalThis.document){const n=Kt(e);C.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 QX="DismissableLayer",Z0="dismissableLayer.update",ZX="dismissableLayer.pointerDownOutside",JX="dismissableLayer.focusOutside",wR,VD=C.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ea=C.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=e,c=C.useContext(VD),[u,d]=C.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=C.useState({}),p=Te(t,R=>d(R)),g=Array.from(c.layers),[b]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=g.indexOf(b),v=u?g.indexOf(u):-1,x=c.layersWithOutsidePointerEventsDisabled.size>0,_=v>=y,w=nQ(R=>{const P=R.target,O=[...c.branches].some(T=>T.contains(P));!_||O||(o==null||o(R),s==null||s(R),R.defaultPrevented||a==null||a())},h),S=rQ(R=>{const P=R.target;[...c.branches].some(T=>T.contains(P))||(i==null||i(R),s==null||s(R),R.defaultPrevented||a==null||a())},h);return XX(R=>{v===c.layers.size-1&&(r==null||r(R),!R.defaultPrevented&&a&&(R.preventDefault(),a()))},h),C.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(wR=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),SR(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=wR)}},[u,h,n,c]),C.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),SR())},[u,c]),C.useEffect(()=>{const R=()=>f({});return document.addEventListener(Z0,R),()=>document.removeEventListener(Z0,R)},[]),m.jsx(ge.div,{...l,ref:p,style:{pointerEvents:x?_?"auto":"none":void 0,...e.style},onFocusCapture:le(e.onFocusCapture,S.onFocusCapture),onBlurCapture:le(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:le(e.onPointerDownCapture,w.onPointerDownCapture)})});Ea.displayName=QX;var eQ="DismissableLayerBranch",tQ=C.forwardRef((e,t)=>{const n=C.useContext(VD),r=C.useRef(null),o=Te(t,r);return C.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),m.jsx(ge.div,{...e,ref:o})});tQ.displayName=eQ;function nQ(e,t=globalThis==null?void 0:globalThis.document){const n=Kt(e),r=C.useRef(!1),o=C.useRef(()=>{});return C.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let l=function(){HD(ZX,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 rQ(e,t=globalThis==null?void 0:globalThis.document){const n=Kt(e),r=C.useRef(!1);return C.useEffect(()=>{const o=i=>{i.target&&!r.current&&HD(JX,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 SR(){const e=new CustomEvent(Z0);document.dispatchEvent(e)}function HD(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?zP(o,i):o.dispatchEvent(i)}var Rb,qw="HoverCard",[WD,vve]=Xt(qw,[No]),Mg=No(),[oQ,Yw]=WD(qw),UD=e=>{const{__scopeHoverCard:t,children:n,open:r,defaultOpen:o,onOpenChange:i,openDelay:s=700,closeDelay:a=300}=e,l=Mg(t),c=C.useRef(0),u=C.useRef(0),d=C.useRef(!1),h=C.useRef(!1),[f=!1,p]=xn({prop:r,defaultProp:o,onChange:i}),g=C.useCallback(()=>{clearTimeout(u.current),c.current=window.setTimeout(()=>p(!0),s)},[s,p]),b=C.useCallback(()=>{clearTimeout(c.current),!d.current&&!h.current&&(u.current=window.setTimeout(()=>p(!1),a))},[a,p]),y=C.useCallback(()=>p(!1),[p]);return C.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(u.current)},[]),m.jsx(oQ,{scope:t,open:f,onOpenChange:p,onOpen:g,onClose:b,onDismiss:y,hasSelectionRef:d,isPointerDownOnContentRef:h,children:m.jsx(Ed,{...l,children:n})})};UD.displayName=qw;var GD="HoverCardTrigger",qD=C.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=Yw(GD,n),i=Mg(n);return m.jsx(dc,{asChild:!0,...i,children:m.jsx(ge.a,{"data-state":o.open?"open":"closed",...r,ref:t,onPointerEnter:le(e.onPointerEnter,vp(o.onOpen)),onPointerLeave:le(e.onPointerLeave,vp(o.onClose)),onFocus:le(e.onFocus,o.onOpen),onBlur:le(e.onBlur,o.onClose),onTouchStart:le(e.onTouchStart,s=>s.preventDefault())})})});qD.displayName=GD;var iQ="HoverCardPortal",[xve,sQ]=WD(iQ,{forceMount:void 0}),yp="HoverCardContent",YD=C.forwardRef((e,t)=>{const n=sQ(yp,e.__scopeHoverCard),{forceMount:r=n.forceMount,...o}=e,i=Yw(yp,e.__scopeHoverCard);return m.jsx(Yt,{present:r||i.open,children:m.jsx(aQ,{"data-state":i.open?"open":"closed",...o,onPointerEnter:le(e.onPointerEnter,vp(i.onOpen)),onPointerLeave:le(e.onPointerLeave,vp(i.onClose)),ref:t})})});YD.displayName=yp;var aQ=C.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,...a}=e,l=Yw(yp,n),c=Mg(n),u=C.useRef(null),d=Te(t,u),[h,f]=C.useState(!1);return C.useEffect(()=>{if(h){const p=document.body;return Rb=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=Rb,p.style.webkitUserSelect=Rb}}},[h]),C.useEffect(()=>{if(u.current){const p=()=>{f(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var b;((b=document.getSelection())==null?void 0:b.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]),C.useEffect(()=>{u.current&&uQ(u.current).forEach(g=>g.setAttribute("tabindex","-1"))}),m.jsx(Ea,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:s,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:le(i,p=>{p.preventDefault()}),onDismiss:l.onDismiss,children:m.jsx(Rd,{...c,...a,onPointerDown:le(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)"}})})}),lQ="HoverCardArrow",cQ=C.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=Mg(n);return m.jsx(kd,{...o,...r,ref:t})});cQ.displayName=lQ;function vp(e){return t=>t.pointerType==="touch"?void 0:e()}function uQ(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 dQ=UD,fQ=qD,KD=YD;const Md=dQ,Od=fQ,fc=C.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>m.jsx(KD,{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}));fc.displayName=KD.displayName;function XD({card:e}){const{setCardInfo:t}=Bt();return m.jsxs(Md,{openDelay:0,children:[m.jsx(Od,{children:m.jsx(sO,{className:"size-4 text-muted-foreground/40"})}),m.jsx(fc,{align:"start",className:"w-[300px]",onMouseDown:n=>n.stopPropagation(),children:m.jsx(vo,{type:"textarea",text:e.info||"",onSave:n=>t(e.id,n),children:m.jsx("p",{className:"text-sm text-muted-foreground",children:e.info||"Double-click to add info"})})})]})}function hQ({card:e,renderFilterInfo:t}){var p,g,b,y,v,x,_,w,S,R,P,O,T,I,A,W;se($=>$.themeStyle);const{data:n,isLoading:r}=Bi(e),o=(n==null?void 0:n.records)||[],i=se($=>$.isDashboardEditing),{getCurrency:s,getLocale:a}=gD(e),l=(g=(p=e.preferences)==null?void 0:p.formatNumber)==null?void 0:g.colorRanges,{metricKeys:c}=Qt(o||[]),u=(b=o==null?void 0:o[0])==null?void 0:b[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 m.jsx("div",{className:"flex min-w-fit grow flex-col overflow-auto",children:m.jsxs("div",{className:"grow",children:[h?m.jsx("div",{className:"",children:m.jsxs("div",{className:ie("flex items-end gap-1.5",{"animate-pulse":r}),children:[m.jsx("p",{style:{color:iw(u,l)},className:"text-3xl font-semibold",children:Pr({number:u,decimalPlaces:((x=(v=e.preferences)==null?void 0:v.formatNumber)==null?void 0:x.decimalPlaces)||0,useSuffix:!!((w=(_=e.preferences)==null?void 0:_.formatNumber)!=null&&w.suffix),customSuffix:((R=(S=e.preferences)==null?void 0:S.formatNumber)==null?void 0:R.suffix)||"",locale:a()||"",currency:s()||""})}),f&&m.jsxs("div",{className:"flex items-end gap-1",children:[m.jsx(mD,{className:"",children:f}),d&&m.jsx("div",{className:"ml-0.5 mr-1 min-w-fit text-sm font-normal text-muted-foreground",children:`from ${Pr({number:d,decimalPlaces:((O=(P=e.preferences)==null?void 0:P.formatNumber)==null?void 0:O.decimalPlaces)||0,useSuffix:!!((I=(T=e.preferences)==null?void 0:T.formatNumber)!=null&&I.suffix),customSuffix:((W=(A=e.preferences)==null?void 0:A.formatNumber)==null?void 0:W.suffix)||"",locale:a()||"",currency:s()||""})}`})]})]})}):m.jsx("div",{className:"flex h-9 items-center justify-center"}),m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsxs(nc,{className:"flex items-center gap-2 text-base font-medium text-muted-foreground",children:[e.title,(i||e.info)&&m.jsx(XD,{card:e})]}),t==null?void 0:t()]})]})})}var pQ="VisuallyHidden",Kw=C.forwardRef((e,t)=>m.jsx(ge.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}}));Kw.displayName=pQ;var gQ=Kw,[Og,wve]=Xt("Tooltip",[No]),Tg=No(),QD="TooltipProvider",mQ=700,J0="tooltip.open",[bQ,Xw]=Og(QD),ZD=e=>{const{__scopeTooltip:t,delayDuration:n=mQ,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,[s,a]=C.useState(!0),l=C.useRef(!1),c=C.useRef(0);return C.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),m.jsx(bQ,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:C.useCallback(()=>{window.clearTimeout(c.current),a(!1)},[]),onClose:C.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:C.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:i})};ZD.displayName=QD;var Dg="Tooltip",[yQ,Ig]=Og(Dg),JD=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=Xw(Dg,e.__scopeTooltip),c=Tg(t),[u,d]=C.useState(null),h=Gt(),f=C.useRef(0),p=s??l.disableHoverableContent,g=a??l.delayDuration,b=C.useRef(!1),[y=!1,v]=xn({prop:r,defaultProp:o,onChange:R=>{R?(l.onOpen(),document.dispatchEvent(new CustomEvent(J0))):l.onClose(),i==null||i(R)}}),x=C.useMemo(()=>y?b.current?"delayed-open":"instant-open":"closed",[y]),_=C.useCallback(()=>{window.clearTimeout(f.current),f.current=0,b.current=!1,v(!0)},[v]),w=C.useCallback(()=>{window.clearTimeout(f.current),f.current=0,v(!1)},[v]),S=C.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{b.current=!0,v(!0),f.current=0},g)},[g,v]);return C.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),m.jsx(Ed,{...c,children:m.jsx(yQ,{scope:t,contentId:h,open:y,stateAttribute:x,trigger:u,onTriggerChange:d,onTriggerEnter:C.useCallback(()=>{l.isOpenDelayed?S():_()},[l.isOpenDelayed,S,_]),onTriggerLeave:C.useCallback(()=>{p?w():(window.clearTimeout(f.current),f.current=0)},[w,p]),onOpen:_,onClose:w,disableHoverableContent:p,children:n})})};JD.displayName=Dg;var ev="TooltipTrigger",Qw=C.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Ig(ev,n),i=Xw(ev,n),s=Tg(n),a=C.useRef(null),l=Te(t,a,o.onTriggerChange),c=C.useRef(!1),u=C.useRef(!1),d=C.useCallback(()=>c.current=!1,[]);return C.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),m.jsx(dc,{asChild:!0,...s,children:m.jsx(ge.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:le(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:le(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:le(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:le(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:le(e.onBlur,o.onClose),onClick:le(e.onClick,o.onClose)})})});Qw.displayName=ev;var vQ="TooltipPortal",[Sve,xQ]=Og(vQ,{forceMount:void 0}),Yl="TooltipContent",eI=C.forwardRef((e,t)=>{const n=xQ(Yl,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=Ig(Yl,e.__scopeTooltip);return m.jsx(Yt,{present:r||s.open,children:s.disableHoverableContent?m.jsx(tI,{side:o,...i,ref:t}):m.jsx(wQ,{side:o,...i,ref:t})})}),wQ=C.forwardRef((e,t)=>{const n=Ig(Yl,e.__scopeTooltip),r=Xw(Yl,e.__scopeTooltip),o=C.useRef(null),i=Te(t,o),[s,a]=C.useState(null),{trigger:l,onClose:c}=n,u=o.current,{onPointerInTransitChange:d}=r,h=C.useCallback(()=>{a(null),d(!1)},[d]),f=C.useCallback((p,g)=>{const b=p.currentTarget,y={x:p.clientX,y:p.clientY},v=EQ(y,b.getBoundingClientRect()),x=RQ(y,v),_=kQ(g.getBoundingClientRect()),w=MQ([...x,..._]);a(w),d(!0)},[d]);return C.useEffect(()=>()=>h(),[h]),C.useEffect(()=>{if(l&&u){const p=b=>f(b,u),g=b=>f(b,l);return l.addEventListener("pointerleave",p),u.addEventListener("pointerleave",g),()=>{l.removeEventListener("pointerleave",p),u.removeEventListener("pointerleave",g)}}},[l,u,f,h]),C.useEffect(()=>{if(s){const p=g=>{const b=g.target,y={x:g.clientX,y:g.clientY},v=(l==null?void 0:l.contains(b))||(u==null?void 0:u.contains(b)),x=!PQ(y,s);v?h():x&&(h(),c())};return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[l,u,s,c,h]),m.jsx(tI,{...e,ref:i})}),[SQ,CQ]=Og(Dg,{isInside:!1}),tI=C.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=Ig(Yl,n),c=Tg(n),{onClose:u}=l;return C.useEffect(()=>(document.addEventListener(J0,u),()=>document.removeEventListener(J0,u)),[u]),C.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]),m.jsx(Ea,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:m.jsxs(Rd,{"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:[m.jsx(Ex,{children:r}),m.jsx(SQ,{scope:n,isInside:!0,children:m.jsx(gQ,{id:l.contentId,role:"tooltip",children:o||r})})]})})});eI.displayName=Yl;var nI="TooltipArrow",_Q=C.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Tg(n);return CQ(nI,n).isInside?null:m.jsx(kd,{...o,...r,ref:t})});_Q.displayName=nI;function EQ(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 RQ(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 kQ(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 PQ(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 MQ(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),OQ(t)}function OQ(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 TQ=ZD,DQ=JD,IQ=Qw,rI=eI;const AQ=TQ,oI=DQ,iI=IQ,Zw=C.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(rI,{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}));Zw.displayName=rI.displayName;function xp({card:e,isLoading:t,data:n}){var h,f;const r=n||[],{keys:o}=Qt(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}=Bt(),{setCard:c}=xd();function u(){var y;if(t)return m.jsxs("div",{className:"space-y-2",children:[m.jsx(rl,{className:"h-3 w-full animate-pulse bg-muted"}),m.jsx(rl,{className:"h-3 w-3/4 animate-pulse bg-muted"}),m.jsx(rl,{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]],b=m.jsx("div",{dangerouslySetInnerHTML:{__html:g}});return m.jsx("div",{className:"text-sm text-foreground/80 hover:cursor-text",onMouseDown:v=>v.stopPropagation(),children:b})}function d(){const p=(e==null?void 0:e.description)||"";return m.jsx("div",{onMouseDown:g=>g.stopPropagation(),children:m.jsx(vo,{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:m.jsx("div",{className:"text-sm text-foreground/70 hover:cursor-text",dangerouslySetInnerHTML:{__html:p}})})})}return m.jsxs(m.Fragment,{children:[!a&&d(),a===!0&&u()]})}const CR=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,_R=Ml,Jw=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return _R(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=CR(u)||CR(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,b]=p;return Array.isArray(b)?b.includes({...i,...a}[g]):{...i,...a}[g]===b})?[...c,d,h]:c},[]);return _R(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},Gu=Jw("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"}}),qt=C.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?si:"button";return m.jsx(s,{className:ie(Gu({variant:t,size:n,className:e})),ref:i,...o})});qt.displayName="Button";var NQ="Separator",ER="horizontal",FQ=["horizontal","vertical"],sI=C.forwardRef((e,t)=>{const{decorative:n,orientation:r=ER,...o}=e,i=jQ(r)?r:ER,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return m.jsx(ge.div,{"data-orientation":i,...a,...o,ref:t})});sI.displayName=NQ;function jQ(e){return FQ.includes(e)}var aI=sI;const Ag=C.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>m.jsx(aI,{ref:o,decorative:n,orientation:t,className:ie("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));Ag.displayName=aI.displayName;function LQ(){var g,b;const e=se(y=>y.themeStyle),t=se(y=>y.filterValues),n=se(y=>y.dashboard.filters),r=se(y=>y.filteringCards),o=se(y=>y.selectedSheetId),{removeFilterValues:i,removeFilteringCard:s,setFilterValues:a,setFilteringCards:l}=Bt(),c=n==null?void 0:n.filter(y=>y.sheetId===o||!y.sheetId),u=t==null?void 0:t.filter(y=>(c==null?void 0:c.some(v=>v.id===y.filterId))||y.filterId.endsWith(o));if(!u||u.length===0)return null;const d=u.map(y=>{const v=n==null?void 0:n.find(x=>x.id===y.filterId);return{filterId:y.filterId,name:(v==null?void 0:v.title)||y.name,values:y.values}});function h(y){return y instanceof Date?y.toLocaleDateString():y}function f(y){const v=r==null?void 0:r.find(x=>y.filterId.startsWith(x.id));v&&s(v),i(y.filterId)}function p(y){var v,x;return m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{style:{borderRadius:(x=(v=e==null?void 0:e.chart)==null?void 0:v.options)==null?void 0:x.borderRadius},className:"flex w-fit items-center gap-2 bg-muted-foreground px-2 py-1 font-semibold text-muted",children:[m.jsx("span",{className:"break-words",children:y.name}),m.jsx(Ca,{onClick:()=>f(y),className:"size-3 text-muted hover:cursor-pointer hover:text-background"})]}),m.jsx("div",{className:"flex flex-wrap gap-1",children:y.values.map(_=>{var w,S;return m.jsx("span",{style:{borderRadius:(S=(w=e==null?void 0:e.chart)==null?void 0:w.options)==null?void 0:S.borderRadius},className:"inline-block",children:h(_)},_==null?void 0:_.toString())})})]})}return m.jsxs(Md,{openDelay:100,children:[m.jsx(Od,{children:m.jsx(oO,{className:"z-100 size-3.5 text-muted-foreground/40"})}),m.jsxs(fc,{style:{borderRadius:(b=(g=e==null?void 0:e.chart)==null?void 0:g.options)==null?void 0:b.borderRadius},className:"relative flex min-h-fit w-[300px] flex-col px-0 text-xs",align:"start",children:[m.jsx(rO,{onClick:()=>{l([]),a([])},className:"absolute right-4 size-3.5 text-muted-foreground/40 hover:cursor-pointer"}),m.jsx("div",{className:"h-fit max-h-[150px] min-h-0 grow overflow-auto",children:d==null?void 0:d.map(y=>m.jsxs("div",{className:"px-5",children:[p(y),m.jsx(Ag,{className:"my-2"})]},y.name))})]})]})}const $Q=C.forwardRef(({className:e,containerClassName:t,containerStyle:n,...r},o)=>m.jsx("div",{style:n,className:ie("relative w-full overflow-auto",t),children:m.jsx("table",{ref:o,className:ie("w-full caption-bottom text-sm",e),...r})}));$Q.displayName="Table";const e1=C.forwardRef(({className:e,...t},n)=>m.jsx("thead",{ref:n,className:ie("[&_tr]:border-b",e),...t}));e1.displayName="TableHeader";const t1=C.forwardRef(({className:e,...t},n)=>m.jsx("tbody",{ref:n,className:ie("[&_tr:last-child]:border-0",e),...t}));t1.displayName="TableBody";const zQ=C.forwardRef(({className:e,...t},n)=>m.jsx("tfoot",{ref:n,className:ie("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));zQ.displayName="TableFooter";const mu=C.forwardRef(({className:e,...t},n)=>m.jsx("tr",{ref:n,className:ie("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));mu.displayName="TableRow";const n1=C.forwardRef(({className:e,...t},n)=>m.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}));n1.displayName="TableHead";const r1=C.forwardRef(({className:e,...t},n)=>m.jsx("td",{ref:n,className:ie("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));r1.displayName="TableCell";const BQ=C.forwardRef(({className:e,...t},n)=>m.jsx("caption",{ref:n,className:ie("mt-4 text-sm text-muted-foreground",e),...t}));BQ.displayName="TableCaption";/**
260
+ `):e}function dG(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 dE(e,t){const n=e.chart.ctx,{body:r,footer:o,title:i}=e,{boxWidth:s,boxHeight:a}=t,l=Ut(t.bodyFont),c=Ut(t.titleFont),u=Ut(t.footerFont),d=i.length,h=o.length,f=r.length,p=sn(t.padding);let g=p.height,b=0,y=r.reduce((_,w)=>_+w.before.length+w.lines.length+w.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 v=0;const x=function(_){b=Math.max(b,n.measureText(_).width+v)};return n.save(),n.font=c.string,ut(e.title,x),n.font=l.string,ut(e.beforeBody.concat(e.afterBody),x),v=t.displayColors?s+2+t.boxPadding:0,ut(r,_=>{ut(_.before,x),ut(_.lines,x),ut(_.after,x)}),v=0,n.font=u.string,ut(e.footer,x),n.restore(),b+=p.width,{width:b,height:g}}function fG(e,t){const{y:n,height:r}=t;return n<r/2?"top":n>e.height-r/2?"bottom":"center"}function hG(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 pG(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"),hG(c,e,t,n)&&(c="center"),c}function fE(e,t,n){const r=n.yAlign||t.yAlign||fG(e,n);return{xAlign:n.xAlign||t.xAlign||pG(e,t,n,r),yAlign:r}}function gG(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function mG(e,t,n){let{y:r,height:o}=e;return t==="top"?r+=n:t==="bottom"?r-=o+n:r-=o/2,r}function hE(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}=Gs(s);let p=gG(t,a);const g=mG(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:Jt(p,0,r.width-t.width),y:Jt(g,0,r.height-t.height)}}function Mf(e,t,n){const r=sn(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function pE(e){return to([],Wo(e))}function bG(e,t,n){return es(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function gE(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const hT={beforeTitle:$o,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:$o,beforeBody:$o,beforeLabel:$o,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 Fe(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:$o,afterBody:$o,beforeFooter:$o,footer:$o,afterFooter:$o};function jn(e,t,n,r){const o=e[t].call(n,r);return typeof o>"u"?hT[t].call(n,r):o}var My;let mE=(My=class extends Io{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 GO(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=bG(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:r}=n,o=jn(r,"beforeTitle",this,t),i=jn(r,"title",this,t),s=jn(r,"afterTitle",this,t);let a=[];return a=to(a,Wo(o)),a=to(a,Wo(i)),a=to(a,Wo(s)),a}getBeforeBody(t,n){return pE(jn(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,o=[];return ut(t,i=>{const s={before:[],lines:[],after:[]},a=gE(r,i);to(s.before,Wo(jn(a,"beforeLabel",this,i))),to(s.lines,jn(a,"label",this,i)),to(s.after,Wo(jn(a,"afterLabel",this,i))),o.push(s)}),o}getAfterBody(t,n){return pE(jn(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:r}=n,o=jn(r,"beforeFooter",this,t),i=jn(r,"footer",this,t),s=jn(r,"afterFooter",this,t);let a=[];return a=to(a,Wo(o)),a=to(a,Wo(i)),a=to(a,Wo(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(dG(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))),ut(a,u=>{const d=gE(t.callbacks,u);o.push(jn(d,"labelColor",this,u)),i.push(jn(d,"labelPointStyle",this,u)),s.push(jn(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=Yc[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=dE(this,r),c=Object.assign({},a,l),u=fE(this.chart,r,c),d=hE(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}=Gs(a),{x:h,y:f}=t,{width:p,height:g}=n;let b,y,v,x,_,w;return i==="center"?(_=f+g/2,o==="left"?(b=h,y=b-s,x=_+s,w=_-s):(b=h+p,y=b+s,x=_-s,w=_+s),v=b):(o==="left"?y=h+Math.max(l,u)+s:o==="right"?y=h+p-Math.max(c,d)-s:y=this.caretX,i==="top"?(x=f,_=x-s,b=y-s,v=y+s):(x=f+g,_=x+s,b=y+s,v=y-s),w=x),{x1:b,x2:y,x3:v,y1:x,y2:_,y3:w}}drawTitle(t,n,r){const o=this.title,i=o.length;let s,a,l;if(i){const c=il(r.rtl,this.x,this.width);for(t.x=Mf(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",s=Ut(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=Ut(i.bodyFont),d=Mf(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},b=o.leftForLtr(h,c)+c/2,y=p+l/2;t.strokeStyle=i.multiKeyBackground,t.fillStyle=i.multiKeyBackground,Yh(t,g,b,y),t.strokeStyle=s.borderColor,t.fillStyle=s.backgroundColor,Yh(t,g,b,y)}else{t.lineWidth=qe(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),b=o.leftForLtr(o.xPlus(h,1),c-2),y=Gs(s.borderRadius);Object.values(y).some(v=>v!==0)?(t.beginPath(),t.fillStyle=i.multiKeyBackground,Nu(t,{x:g,y:p,w:c,h:l,radius:y}),t.fill(),t.stroke(),t.fillStyle=s.backgroundColor,t.beginPath(),Nu(t,{x:b,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(b,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=Ut(r.bodyFont);let h=d.lineHeight,f=0;const p=il(r.rtl,this.x,this.width),g=function(P){n.fillText(P,p.x(t.x+f),t.y+h/2),t.y+=h+i},b=p.textAlign(s);let y,v,x,_,w,S,R;for(n.textAlign=s,n.textBaseline="middle",n.font=d.string,t.x=Mf(this,b,r),n.fillStyle=r.bodyColor,ut(this.beforeBody,g),f=a&&b!=="right"?s==="center"?c/2+u:c+2+u:0,_=0,S=o.length;_<S;++_){for(y=o[_],v=this.labelTextColors[_],n.fillStyle=v,ut(y.before,g),x=y.lines,a&&x.length&&(this._drawColorBox(n,t,_,p,r),h=Math.max(d.lineHeight,l)),w=0,R=x.length;w<R;++w)g(x[w]),h=d.lineHeight;ut(y.after,g)}f=0,h=d.lineHeight,ut(this.afterBody,g),t.y-=i}drawFooter(t,n,r){const o=this.footer,i=o.length;let s,a;if(i){const l=il(r.rtl,this.x,this.width);for(t.x=Mf(this,r.footerAlign,r),t.y+=r.footerMarginTop,n.textAlign=l.textAlign(r.footerAlign),n.textBaseline="middle",s=Ut(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}=Gs(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=Yc[t.position].call(this,this._active,this._eventPosition);if(!s)return;const a=this._size=dE(this,t),l=Object.assign({},s,this._size),c=fE(n,t,l),u=hE(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=sn(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),BO(t,n.textDirection),i.y+=s.top,this.drawTitle(i,t,n),this.drawBody(i,t,n),this.drawFooter(i,t,n),VO(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=!Wh(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||!Wh(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=Yc[i.position].call(this,t,n);return s!==!1&&(r!==s.x||o!==s.y)}},he(My,"positioners",Yc),My);var pT={id:"tooltip",_element:mE,positioners:Yc,afterInit(e,t,n){n&&(e.tooltip=new mE({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:hT},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"]},yG=Object.freeze({__proto__:null,Colors:TU,Decimation:NU,Filler:tG,Legend:aG,SubTitle:uG,Title:cG,Tooltip:pT});const vG=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function xG(e,t,n,r){const o=e.indexOf(t);if(o===-1)return vG(e,t,n,r);const i=e.lastIndexOf(t);return o!==i?n:o}const wG=(e,t)=>e===null?null:Jt(Math.round(e),0,t);function bE(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class Zh 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(Fe(t))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===t?n:xG(r,t,Oe(n,t),this._addedLabels),wG(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 bE.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}}he(Zh,"id","category"),he(Zh,"defaults",{ticks:{callback:bE}});function SG(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:b}=t,y=!Fe(s),v=!Fe(a),x=!Fe(c),_=(b-g)/(d+1);let w=d_((b-g)/p/f)*f,S,R,P,O;if(w<1e-14&&!y&&!v)return[{value:g},{value:b}];O=Math.ceil(b/w)-Math.floor(g/w),O>p&&(w=d_(O*w/p/f)*f),Fe(l)||(S=Math.pow(10,l),w=Math.ceil(w*S)/S),o==="ticks"?(R=Math.floor(g/w)*w,P=Math.ceil(b/w)*w):(R=g,P=b),y&&v&&i&&mV((a-s)/i,w/1e3)?(O=Math.round(Math.min((a-s)/w,u)),w=(a-s)/O,R=s,P=a):x?(R=y?s:R,P=v?a:P,O=c-1,w=(P-R)/O):(O=(P-R)/w,au(O,Math.round(O),w/1e3)?O=Math.round(O):O=Math.ceil(O));const T=Math.max(f_(w),f_(R));S=Math.pow(10,Fe(l)?T:l),R=Math.round(R*S)/S,P=Math.round(P*S)/S;let I=0;for(y&&(h&&R!==s?(n.push({value:s}),R<s&&I++,au(Math.round((R+I*w)*S)/S,s,yE(s,_,e))&&I++):R<s&&I++);I<O;++I){const A=Math.round((R+I*w)*S)/S;if(v&&A>a)break;n.push({value:A})}return v&&h&&P!==a?n.length&&au(n[n.length-1].value,a,yE(a,_,e))?n[n.length-1].value=a:n.push({value:a}):(!v||P===a)&&n.push({value:P}),n}function yE(e,t,{horizontal:n,minRotation:r}){const o=Vr(r),i=(n?Math.sin(o):Math.cos(o))||.001,s=.75*t*(""+e).length;return Math.min(t/i,s)}class Jh 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 Fe(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=bo(o),c=bo(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=SG(o,i);return t.bounds==="ticks"&&_O(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 Sd(t,this.chart.options.locale,this.options.ticks.format)}}class zl extends Jh{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=jt(t)?t:0,this.max=jt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=Vr(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}}he(zl,"id","linear"),he(zl,"defaults",{ticks:{callback:mg.formatters.numeric}});const ju=e=>Math.floor(Ti(e)),gs=(e,t)=>Math.pow(10,ju(e)+t);function vE(e){return e/Math.pow(10,ju(e))===1}function xE(e,t,n){const r=Math.pow(10,n),o=Math.floor(e/r);return Math.ceil(t/r)-o}function CG(e,t){const n=t-e;let r=ju(n);for(;xE(e,t,r)>10;)r++;for(;xE(e,t,r)<10;)r--;return Math.min(r,ju(e))}function _G(e,{min:t,max:n}){t=cr(e.min,t);const r=[],o=ju(t);let i=CG(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=cr(e.min,Math.round((l+u+d*Math.pow(10,i))*s)/s);for(;h<n;)r.push({value:h,major:vE(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=cr(e.max,h);return r.push({value:f,major:vE(f),significand:d}),r}class Bl 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=Jh.prototype.parse.apply(this,[t,n]);if(r===0){this._zero=!0;return}return jt(r)&&r>0?r:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=jt(t)?Math.max(0,t):null,this.max=jt(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!jt(this._userMin)&&(this.min=t===gs(this.min,0)?gs(this.min,-1):gs(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(gs(r,-1)),s(gs(o,1)))),r<=0&&i(gs(o,-1)),o<=0&&s(gs(r,1)),this.min=r,this.max=o}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},r=_G(n,this);return t.bounds==="ticks"&&_O(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":Sd(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Ti(t),this._valueRange=Ti(this.max)-Ti(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Ti(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}he(Bl,"id","logarithmic"),he(Bl,"defaults",{ticks:{callback:mg.formatters.logarithmic,major:{enabled:!0}}});function P0(e){const t=e.ticks;if(t.display&&e.display){const n=sn(t.backdropPadding);return Oe(t.font&&t.font.size,Mt.font.size)+n.height}return 0}function EG(e,t,n){return n=kt(n)?n:[n],{w:IV(e,t.string,n),h:n.length*t.lineHeight}}function wE(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 RG(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?Ot/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=Ut(c.font),h=EG(e.ctx,d,e._pointLabels[l]);r[l]=h;const f=dr(e.getIndexAngle(l)+a),p=Math.round(dw(f)),g=wE(p,u.x,h.w,0,180),b=wE(p,u.y,h.h,90,270);kG(n,t,f,g,b)}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=OG(e,r,o)}function kG(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 PG(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(dw(dr(l.angle+zt))),u=IG(l.y,a.h,c),d=TG(c),h=DG(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 MG(e,t){if(!t)return!0;const{left:n,top:r,right:o,bottom:i}=e;return!(ri({x:n,y:r},t)||ri({x:n,y:i},t)||ri({x:o,y:r},t)||ri({x:o,y:i},t))}function OG(e,t,n){const r=[],o=e._pointLabels.length,i=e.options,{centerPointLabels:s,display:a}=i.pointLabels,l={extra:P0(i)/2,additionalAngle:s?Ot/o:0};let c;for(let u=0;u<o;u++){l.padding=n[u],l.size=t[u];const d=PG(e,u,l);r.push(d),a==="auto"&&(d.visible=MG(d,c),d.visible&&(c=d))}return r}function TG(e){return e===0||e===180?"center":e<180?"left":"right"}function DG(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function IG(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function AG(e,t,n){const{left:r,top:o,right:i,bottom:s}=n,{backdropColor:a}=t;if(!Fe(a)){const l=Gs(t.borderRadius),c=sn(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(),Nu(e,{x:u,y:d,w:h,h:f,radius:l}),e.fill()):e.fillRect(u,d,h,f)}}function NG(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));AG(n,s,i);const a=Ut(s.font),{x:l,y:c,textAlign:u}=i;la(n,e._pointLabels[o],l,c+a.lineHeight/2,a,{color:s.color,textAlign:u,textBaseline:"middle"})}}function gT(e,t,n,r){const{ctx:o}=e;if(n)o.arc(e.xCenter,e.yCenter,t,0,Pt);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 FG(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(),gT(e,n,s,r),i.closePath(),i.stroke(),i.restore())}function jG(e,t,n){return es(e,{label:n,index:t,type:"pointLabel"})}class Kc extends Jh{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=sn(P0(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=jt(t)&&!isNaN(t)?t:0,this.max=jt(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/P0(this.options))}generateTickLabels(t){Jh.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,r)=>{const o=pt(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?RG(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=Pt/(this._pointLabels.length||1),r=this.options.startAngle||0;return dr(t*n+Vr(r))}getDistanceFromCenterForValue(t){if(Fe(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(Fe(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 jG(this.getContext(),t,r)}}getPointPosition(t,n,r=0){const o=this.getIndexAngle(t)-zt+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(),gT(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&&NG(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);FG(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=Ut(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=sn(c.backdropPadding);t.fillRect(-s/2-d.left,-i-u.size/2-d.top,s+d.width,u.size+d.height)}la(t,a.label,0,-i,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}he(Kc,"id","radialLinear"),he(Kc,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:mg.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),he(Kc,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),he(Kc,"descriptors",{angleLines:{_fallback:"grid"}});const vg={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}},qn=Object.keys(vg);function SE(e,t){return e-t}function CE(e,t){if(Fe(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)),jt(s)||(s=typeof r=="string"?n.parse(s,r):n.parse(s)),s===null?null:(o&&(s=o==="week"&&(jl(i)||i===!0)?n.startOf(s,"isoWeek",i):n.startOf(s,o)),+s)}function _E(e,t,n,r){const o=qn.length;for(let i=qn.indexOf(e);i<o-1;++i){const s=vg[qn[i]],a=s.steps?s.steps:Number.MAX_SAFE_INTEGER;if(s.common&&Math.ceil((n-t)/(a*s.size))<=r)return qn[i]}return qn[o-1]}function LG(e,t,n,r,o){for(let i=qn.length-1;i>=qn.indexOf(n);i--){const s=qn[i];if(vg[s].common&&e._adapter.diff(o,r,s)>=t-1)return s}return qn[n?qn.indexOf(n):0]}function $G(e){for(let t=qn.indexOf(e)+1,n=qn.length;t<n;++t)if(vg[qn[t]].common)return qn[t]}function EE(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:r,hi:o}=fw(n,t),i=n[r]>=t?n[r]:n[o];e[i]=!0}}function zG(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 RE(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:zG(e,r,o,n)}class Lu 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 KH._date(t.adapters.date);o.init(n),su(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:CE(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=jt(o)&&!isNaN(o)?o:+n.startOf(Date.now(),r),i=jt(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=xV(o,i,s);return this._unit=n.unit||(r.autoSkip?_E(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):LG(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:$G(this._unit),this.initOffsets(o),t.reverse&&a.reverse(),RE(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=Jt(n,0,s),r=Jt(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||_E(i.minUnit,n,r,this._getLabelCapacity(n)),a=Oe(o.ticks.stepSize,1),l=s==="week"?i.isoWeekday:!1,c=jl(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++)EE(u,h,p);return(h===r||o.bounds==="ticks"||f===1)&&EE(u,h,p),Object.keys(u).sort(SE).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 pt(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=Vr(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,RE(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(CE(this,o[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return kO(t.sort(SE))}}he(Lu,"id","time"),he(Lu,"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 Of(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}=ni(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}=ni(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 M0 extends Lu{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=Of(n,this.min),this._tableRange=Of(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(Of(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return Of(this._table,r*this._tableRange+this._minPos,!0)}}he(M0,"id","timeseries"),he(M0,"defaults",Lu.defaults);var BG=Object.freeze({__proto__:null,CategoryScale:Zh,LinearScale:zl,LogarithmicScale:Bl,RadialLinearScale:Kc,TimeScale:Lu,TimeSeriesScale:M0});const VG=[YH,_U,yG,BG];class Wi{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*HG(e){for(const t of e)yield*t}function mT(e){return Array.from(HG(e))}function Ka(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 _e=1e-6,bT=1e-12,We=Math.PI,Ft=We/2,kE=We/4,yr=We*2,Rn=180/We,gt=We/180,tt=Math.abs,ic=Math.atan,Co=Math.atan2,Ne=Math.cos,Tf=Math.ceil,yT=Math.exp,ep=Math.log,bb=Math.pow,Ie=Math.sin,Mr=Math.sign||function(e){return e>0?1:e<0?-1:0},Tn=Math.sqrt,_w=Math.tan;function vT(e){return e>1?0:e<-1?We:Math.acos(e)}function Dr(e){return e>1?Ft:e<-1?-Ft:Math.asin(e)}function Zt(){}function tp(e,t){e&&ME.hasOwnProperty(e.type)&&ME[e.type](e,t)}var PE={Feature:function(e,t){tp(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,o=n.length;++r<o;)tp(n[r].geometry,t)}},ME={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){O0(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)O0(n[r],t,0)},Polygon:function(e,t){OE(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)OE(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,o=n.length;++r<o;)tp(n[r],t)}};function O0(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 OE(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)O0(e[n],t,1);t.polygonEnd()}function Ss(e,t){e&&PE.hasOwnProperty(e.type)?PE[e.type](e,t):tp(e,t)}function T0(e){return[Co(e[1],e[0]),Dr(e[2])]}function Vl(e){var t=e[0],n=e[1],r=Ne(n);return[r*Ne(t),r*Ie(t),Ie(n)]}function Df(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function np(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 yb(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function If(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function D0(e){var t=Tn(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function I0(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 A0(e,t){return tt(e)>We&&(e-=Math.round(e/yr)*yr),[e,t]}A0.invert=A0;function xT(e,t,n){return(e%=yr)?t||n?I0(DE(e),IE(t,n)):DE(e):t||n?IE(t,n):A0}function TE(e){return function(t,n){return t+=e,tt(t)>We&&(t-=Math.round(t/yr)*yr),[t,n]}}function DE(e){var t=TE(e);return t.invert=TE(-e),t}function IE(e,t){var n=Ne(e),r=Ie(e),o=Ne(t),i=Ie(t);function s(a,l){var c=Ne(l),u=Ne(a)*c,d=Ie(a)*c,h=Ie(l),f=h*n+u*r;return[Co(d*o-f*i,u*n-h*r),Dr(f*o+d*i)]}return s.invert=function(a,l){var c=Ne(l),u=Ne(a)*c,d=Ie(a)*c,h=Ie(l),f=h*o-d*i;return[Co(d*o+h*i,u*n+f*r),Dr(f*n-u*r)]},s}function WG(e){e=xT(e[0]*gt,e[1]*gt,e.length>2?e[2]*gt:0);function t(n){return n=e(n[0]*gt,n[1]*gt),n[0]*=Rn,n[1]*=Rn,n}return t.invert=function(n){return n=e.invert(n[0]*gt,n[1]*gt),n[0]*=Rn,n[1]*=Rn,n},t}function UG(e,t,n,r,o,i){if(n){var s=Ne(t),a=Ie(t),l=r*n;o==null?(o=t+r*yr,i=t-l/2):(o=AE(s,o),i=AE(s,i),(r>0?o<i:o>i)&&(o+=r*yr));for(var c,u=o;r>0?u>i:u<i;u-=l)c=T0([s,-a*Ne(u),-a*Ie(u)]),e.point(c[0],c[1])}}function AE(e,t){t=Vl(t),t[0]-=e,D0(t);var n=vT(-t[1]);return((-t[2]<0?-n:n)+yr-_e)%yr}function wT(){var e=[],t;return{point:function(n,r,o){t.push([n,r,o])},lineStart:function(){e.push(t=[])},lineEnd:Zt,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Sh(e,t){return tt(e[0]-t[0])<_e&&tt(e[1]-t[1])<_e}function Af(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 ST(e,t,n,r,o){var i=[],s=[],a,l;if(e.forEach(function(p){if(!((g=p.length-1)<=0)){var g,b=p[0],y=p[g],v;if(Sh(b,y)){if(!b[2]&&!y[2]){for(o.lineStart(),a=0;a<g;++a)o.point((b=p[a])[0],b[1]);o.lineEnd();return}y[0]+=2*_e}i.push(v=new Af(b,p,null,!0)),s.push(v.o=new Af(b,null,v,!1)),i.push(v=new Af(y,p,null,!1)),s.push(v.o=new Af(y,null,v,!0))}}),!!i.length){for(s.sort(t),NE(i),NE(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 NE(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 vb(e){return tt(e[0])<=We?e[0]:Mr(e[0])*((tt(e[0])+We)%yr-We)}function CT(e,t){var n=vb(t),r=t[1],o=Ie(r),i=[Ie(n),-Ne(n),0],s=0,a=0,l=new Wi;o===1?r=Ft+_e:o===-1&&(r=-Ft-_e);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=vb(f),g=f[1]/2+kE,b=Ie(g),y=Ne(g),v=0;v<h;++v,p=_,b=S,y=R,f=x){var x=d[v],_=vb(x),w=x[1]/2+kE,S=Ie(w),R=Ne(w),P=_-p,O=P>=0?1:-1,T=O*P,I=T>We,A=b*S;if(l.add(Co(A*O*Ie(T),y*R+A*Ne(T))),s+=I?P+O*yr:P,I^p>=n^_>=n){var W=np(Vl(f),Vl(x));D0(W);var $=np(i,W);D0($);var D=(I^P>=0?-1:1)*Dr($[2]);(r>D||r===D&&(W[0]||W[1]))&&(a+=I^P>=0?1:-1)}}return(s<-1e-6||s<_e&&l<-1e-12)^a&1}function _T(e,t,n,r){return function(o){var i=t(o),s=wT(),a=t(s),l=!1,c,u,d,h={point:f,lineStart:g,lineEnd:b,polygonStart:function(){h.point=y,h.lineStart=v,h.lineEnd=x,u=[],c=[]},polygonEnd:function(){h.point=f,h.lineStart=g,h.lineEnd=b,u=mT(u);var _=CT(c,r);u.length?(l||(o.polygonStart(),l=!0),ST(u,qG,_,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(_,w){e(_,w)&&o.point(_,w)}function p(_,w){i.point(_,w)}function g(){h.point=p,i.lineStart()}function b(){h.point=f,i.lineEnd()}function y(_,w){d.push([_,w]),a.point(_,w)}function v(){a.lineStart(),d=[]}function x(){y(d[0][0],d[0][1]),a.lineEnd();var _=a.clean(),w=s.result(),S,R=w.length,P,O,T;if(d.pop(),c.push(d),d=null,!!R){if(_&1){if(O=w[0],(P=O.length-1)>0){for(l||(o.polygonStart(),l=!0),o.lineStart(),S=0;S<P;++S)o.point((T=O[S])[0],T[1]);o.lineEnd()}return}R>1&&_&2&&w.push(w.pop().concat(w.shift())),u.push(w.filter(GG))}}return h}}function GG(e){return e.length>1}function qG(e,t){return((e=e.x)[0]<0?e[1]-Ft-_e:Ft-e[1])-((t=t.x)[0]<0?t[1]-Ft-_e:Ft-t[1])}const FE=_T(function(){return!0},YG,XG,[-We,-Ft]);function YG(e){var t=NaN,n=NaN,r=NaN,o;return{lineStart:function(){e.lineStart(),o=1},point:function(i,s){var a=i>0?We:-We,l=tt(i-t);tt(l-We)<_e?(e.point(t,n=(n+s)/2>0?Ft:-Ft),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(i,n),o=0):r!==a&&l>=We&&(tt(t-r)<_e&&(t-=r*_e),tt(i-a)<_e&&(i-=a*_e),n=KG(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 KG(e,t,n,r){var o,i,s=Ie(e-n);return tt(s)>_e?ic((Ie(t)*(i=Ne(r))*Ie(n)-Ie(r)*(o=Ne(t))*Ie(e))/(o*i*s)):(t+r)/2}function XG(e,t,n,r){var o;if(e==null)o=n*Ft,r.point(-We,o),r.point(0,o),r.point(We,o),r.point(We,0),r.point(We,-o),r.point(0,-o),r.point(-We,-o),r.point(-We,0),r.point(-We,o);else if(tt(e[0]-t[0])>_e){var i=e[0]<t[0]?We:-We;o=n*i/2,r.point(-i,o),r.point(0,o),r.point(i,o)}else r.point(t[0],t[1])}function QG(e){var t=Ne(e),n=2*gt,r=t>0,o=tt(t)>_e;function i(u,d,h,f){UG(f,e,n,h,u,d)}function s(u,d){return Ne(u)*Ne(d)>t}function a(u){var d,h,f,p,g;return{lineStart:function(){p=f=!1,g=1},point:function(b,y){var v=[b,y],x,_=s(b,y),w=r?_?0:c(b,y):_?c(b+(b<0?We:-We),y):0;if(!d&&(p=f=_)&&u.lineStart(),_!==f&&(x=l(d,v),(!x||Sh(d,x)||Sh(v,x))&&(v[2]=1)),_!==f)g=0,_?(u.lineStart(),x=l(v,d),u.point(x[0],x[1])):(x=l(d,v),u.point(x[0],x[1],2),u.lineEnd()),d=x;else if(o&&d&&r^_){var S;!(w&h)&&(S=l(v,d,!0))&&(g=0,r?(u.lineStart(),u.point(S[0][0],S[0][1]),u.point(S[1][0],S[1][1]),u.lineEnd()):(u.point(S[1][0],S[1][1]),u.lineEnd(),u.lineStart(),u.point(S[0][0],S[0][1],3)))}_&&(!d||!Sh(d,v))&&u.point(v[0],v[1]),d=v,f=_,h=w},lineEnd:function(){f&&u.lineEnd(),d=null},clean:function(){return g|(p&&f)<<1}}}function l(u,d,h){var f=Vl(u),p=Vl(d),g=[1,0,0],b=np(f,p),y=Df(b,b),v=b[0],x=y-v*v;if(!x)return!h&&u;var _=t*y/x,w=-t*v/x,S=np(g,b),R=If(g,_),P=If(b,w);yb(R,P);var O=S,T=Df(R,O),I=Df(O,O),A=T*T-I*(Df(R,R)-1);if(!(A<0)){var W=Tn(A),$=If(O,(-T-W)/I);if(yb($,R),$=T0($),!h)return $;var D=u[0],F=d[0],N=u[1],j=d[1],H;F<D&&(H=D,D=F,F=H);var M=F-D,V=tt(M-We)<_e,L=V||M<_e;if(!V&&j<N&&(H=N,N=j,j=H),L?V?N+j>0^$[1]<(tt($[0]-D)<_e?N:j):N<=$[1]&&$[1]<=j:M>We^(D<=$[0]&&$[0]<=F)){var k=If(O,(-T+W)/I);return yb(k,R),[$,T0(k)]}}}function c(u,d){var h=r?e:We-e,f=0;return u<-h?f|=1:u>h&&(f|=2),d<-h?f|=4:d>h&&(f|=8),f}return _T(s,a,i,r?[0,-e]:[-We,e-We])}function ZG(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 Nf=1e9,Ff=-1e9;function JG(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 tt(c[0]-e)<_e?u>0?0:3:tt(c[0]-n)<_e?u>0?2:1:tt(c[1]-t)<_e?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=wT(),h,f,p,g,b,y,v,x,_,w,S,R={point:P,lineStart:A,lineEnd:W,polygonStart:T,polygonEnd:I};function P(D,F){o(D,F)&&u.point(D,F)}function O(){for(var D=0,F=0,N=f.length;F<N;++F)for(var j=f[F],H=1,M=j.length,V=j[0],L,k,U=V[0],q=V[1];H<M;++H)L=U,k=q,V=j[H],U=V[0],q=V[1],k<=r?q>r&&(U-L)*(r-k)>(q-k)*(e-L)&&++D:q<=r&&(U-L)*(r-k)<(q-k)*(e-L)&&--D;return D}function T(){u=d,h=[],f=[],S=!0}function I(){var D=O(),F=S&&D,N=(h=mT(h)).length;(F||N)&&(c.polygonStart(),F&&(c.lineStart(),i(null,null,1,c),c.lineEnd()),N&&ST(h,a,D,i,c),c.polygonEnd()),u=c,h=f=p=null}function A(){R.point=$,f&&f.push(p=[]),w=!0,_=!1,v=x=NaN}function W(){h&&($(g,b),y&&_&&d.rejoin(),h.push(d.result())),R.point=P,_&&u.lineEnd()}function $(D,F){var N=o(D,F);if(f&&p.push([D,F]),w)g=D,b=F,y=N,w=!1,N&&(u.lineStart(),u.point(D,F));else if(N&&_)u.point(D,F);else{var j=[v=Math.max(Ff,Math.min(Nf,v)),x=Math.max(Ff,Math.min(Nf,x))],H=[D=Math.max(Ff,Math.min(Nf,D)),F=Math.max(Ff,Math.min(Nf,F))];ZG(j,H,e,t,n,r)?(_||(u.lineStart(),u.point(j[0],j[1])),u.point(H[0],H[1]),N||u.lineEnd(),S=!1):N&&(u.lineStart(),u.point(D,F),S=!1)}v=D,x=F,_=N}return R}}var N0,F0,Ch,_h,Hl={sphere:Zt,point:Zt,lineStart:eq,lineEnd:Zt,polygonStart:Zt,polygonEnd:Zt};function eq(){Hl.point=nq,Hl.lineEnd=tq}function tq(){Hl.point=Hl.lineEnd=Zt}function nq(e,t){e*=gt,t*=gt,F0=e,Ch=Ie(t),_h=Ne(t),Hl.point=rq}function rq(e,t){e*=gt,t*=gt;var n=Ie(t),r=Ne(t),o=tt(e-F0),i=Ne(o),s=Ie(o),a=r*s,l=_h*n-Ch*r*i,c=Ch*n+_h*r*i;N0.add(Co(Tn(a*a+l*l),c)),F0=e,Ch=n,_h=r}function oq(e){return N0=new Wi,Ss(e,Hl),+N0}var j0=[null,null],iq={type:"LineString",coordinates:j0};function L0(e,t){return j0[0]=e,j0[1]=t,oq(iq)}var jE={Feature:function(e,t){return rp(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,o=n.length;++r<o;)if(rp(n[r].geometry,t))return!0;return!1}},LE={Sphere:function(){return!0},Point:function(e,t){return $E(e.coordinates,t)},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)if($E(n[r],t))return!0;return!1},LineString:function(e,t){return zE(e.coordinates,t)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)if(zE(n[r],t))return!0;return!1},Polygon:function(e,t){return BE(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,o=n.length;++r<o;)if(BE(n[r],t))return!0;return!1},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,o=n.length;++r<o;)if(rp(n[r],t))return!0;return!1}};function rp(e,t){return e&&LE.hasOwnProperty(e.type)?LE[e.type](e,t):!1}function $E(e,t){return L0(e,t)===0}function zE(e,t){for(var n,r,o,i=0,s=e.length;i<s;i++){if(r=L0(e[i],t),r===0||i>0&&(o=L0(e[i],e[i-1]),o>0&&n<=o&&r<=o&&(n+r-o)*(1-Math.pow((n-r)/o,2))<bT*o))return!0;n=r}return!1}function BE(e,t){return!!CT(e.map(sq),ET(t))}function sq(e){return e=e.map(ET),e.pop(),e}function ET(e){return[e[0]*gt,e[1]*gt]}function aq(e,t){return(e&&jE.hasOwnProperty(e.type)?jE[e.type]:rp)(e,t)}function VE(e,t,n){var r=Ka(e,t-_e,n).concat(t);return function(o){return r.map(function(i){return[o,i]})}}function HE(e,t,n){var r=Ka(e,t-_e,n).concat(t);return function(o){return r.map(function(i){return[i,o]})}}function RT(){var e,t,n,r,o,i,s,a,l=10,c=l,u=90,d=360,h,f,p,g,b=2.5;function y(){return{type:"MultiLineString",coordinates:v()}}function v(){return Ka(Tf(r/u)*u,n,u).map(p).concat(Ka(Tf(a/d)*d,s,d).map(g)).concat(Ka(Tf(t/l)*l,e,l).filter(function(x){return tt(x%u)>_e}).map(h)).concat(Ka(Tf(i/c)*c,o,c).filter(function(x){return tt(x%d)>_e}).map(f))}return y.lines=function(){return v().map(function(x){return{type:"LineString",coordinates:x}})},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(x){return arguments.length?y.extentMajor(x).extentMinor(x):y.extentMinor()},y.extentMajor=function(x){return arguments.length?(r=+x[0][0],n=+x[1][0],a=+x[0][1],s=+x[1][1],r>n&&(x=r,r=n,n=x),a>s&&(x=a,a=s,s=x),y.precision(b)):[[r,a],[n,s]]},y.extentMinor=function(x){return arguments.length?(t=+x[0][0],e=+x[1][0],i=+x[0][1],o=+x[1][1],t>e&&(x=t,t=e,e=x),i>o&&(x=i,i=o,o=x),y.precision(b)):[[t,i],[e,o]]},y.step=function(x){return arguments.length?y.stepMajor(x).stepMinor(x):y.stepMinor()},y.stepMajor=function(x){return arguments.length?(u=+x[0],d=+x[1],y):[u,d]},y.stepMinor=function(x){return arguments.length?(l=+x[0],c=+x[1],y):[l,c]},y.precision=function(x){return arguments.length?(b=+x,h=VE(i,o,90),f=HE(t,e,b),p=VE(a,s,90),g=HE(r,n,b),y):b},y.extentMajor([[-180,-90+_e],[180,90-_e]]).extentMinor([[-180,-80-_e],[180,80+_e]])}function lq(){return RT()()}const $0=e=>e;var xb=new Wi,z0=new Wi,kT,PT,B0,V0,Xo={point:Zt,lineStart:Zt,lineEnd:Zt,polygonStart:function(){Xo.lineStart=cq,Xo.lineEnd=dq},polygonEnd:function(){Xo.lineStart=Xo.lineEnd=Xo.point=Zt,xb.add(tt(z0)),z0=new Wi},result:function(){var e=xb/2;return xb=new Wi,e}};function cq(){Xo.point=uq}function uq(e,t){Xo.point=MT,kT=B0=e,PT=V0=t}function MT(e,t){z0.add(V0*e-B0*t),B0=e,V0=t}function dq(){MT(kT,PT)}var Wl=1/0,op=Wl,$u=-Wl,ip=$u,sp={point:fq,lineStart:Zt,lineEnd:Zt,polygonStart:Zt,polygonEnd:Zt,result:function(){var e=[[Wl,op],[$u,ip]];return $u=ip=-(op=Wl=1/0),e}};function fq(e,t){e<Wl&&(Wl=e),e>$u&&($u=e),t<op&&(op=t),t>ip&&(ip=t)}var H0=0,W0=0,Xc=0,ap=0,lp=0,Xa=0,U0=0,G0=0,Qc=0,OT,TT,uo,fo,kr={point:ca,lineStart:WE,lineEnd:UE,polygonStart:function(){kr.lineStart=gq,kr.lineEnd=mq},polygonEnd:function(){kr.point=ca,kr.lineStart=WE,kr.lineEnd=UE},result:function(){var e=Qc?[U0/Qc,G0/Qc]:Xa?[ap/Xa,lp/Xa]:Xc?[H0/Xc,W0/Xc]:[NaN,NaN];return H0=W0=Xc=ap=lp=Xa=U0=G0=Qc=0,e}};function ca(e,t){H0+=e,W0+=t,++Xc}function WE(){kr.point=hq}function hq(e,t){kr.point=pq,ca(uo=e,fo=t)}function pq(e,t){var n=e-uo,r=t-fo,o=Tn(n*n+r*r);ap+=o*(uo+e)/2,lp+=o*(fo+t)/2,Xa+=o,ca(uo=e,fo=t)}function UE(){kr.point=ca}function gq(){kr.point=bq}function mq(){DT(OT,TT)}function bq(e,t){kr.point=DT,ca(OT=uo=e,TT=fo=t)}function DT(e,t){var n=e-uo,r=t-fo,o=Tn(n*n+r*r);ap+=o*(uo+e)/2,lp+=o*(fo+t)/2,Xa+=o,o=fo*e-uo*t,U0+=o*(uo+e),G0+=o*(fo+t),Qc+=o*3,ca(uo=e,fo=t)}function IT(e){this._context=e}IT.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,yr);break}}},result:Zt};var q0=new Wi,wb,AT,NT,Zc,Jc,zu={point:Zt,lineStart:function(){zu.point=yq},lineEnd:function(){wb&&FT(AT,NT),zu.point=Zt},polygonStart:function(){wb=!0},polygonEnd:function(){wb=null},result:function(){var e=+q0;return q0=new Wi,e}};function yq(e,t){zu.point=FT,AT=Zc=e,NT=Jc=t}function FT(e,t){Zc-=e,Jc-=t,q0.add(Tn(Zc*Zc+Jc*Jc)),Zc=e,Jc=t}let GE,cp,qE,YE;class KE{constructor(t){this._append=t==null?jT:vq(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!==qE||this._append!==cp){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`,qE=r,cp=this._append,YE=this._,this._=o}this._+=YE;break}}}result(){const t=this._;return this._="",t.length?t:null}}function jT(e){let t=1;this._+=e[0];for(const n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function vq(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return jT;if(t!==GE){const n=10**t;GE=t,cp=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 cp}function XE(e,t){let n=3,r=4.5,o,i;function s(a){return a&&(typeof r=="function"&&i.pointRadius(+r.apply(this,arguments)),Ss(a,o(i))),i.result()}return s.area=function(a){return Ss(a,o(Xo)),Xo.result()},s.measure=function(a){return Ss(a,o(zu)),zu.result()},s.bounds=function(a){return Ss(a,o(sp)),sp.result()},s.centroid=function(a){return Ss(a,o(kr)),kr.result()},s.projection=function(a){return arguments.length?(o=a==null?(e=null,$0):(e=a).stream,s):e},s.context=function(a){return arguments.length?(i=a==null?(t=null,new KE(n)):new IT(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 KE(n)),s},s.projection(e).digits(n).context(t)}function Ew(e){return function(t){var n=new Y0;for(var r in e)n[r]=e[r];return n.stream=t,n}}function Y0(){}Y0.prototype={constructor:Y0,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 Rw(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),Ss(n,e.stream(sp)),t(sp.result()),r!=null&&e.clipExtent(r),e}function kw(e,t,n){return Rw(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 LT(e,t,n){return kw(e,[[0,0],t],n)}function $T(e,t,n){return Rw(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 zT(e,t,n){return Rw(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 QE=16,xq=Ne(30*gt);function ZE(e,t){return+t?Sq(e,t):wq(e)}function wq(e){return Ew({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function Sq(e,t){function n(r,o,i,s,a,l,c,u,d,h,f,p,g,b){var y=c-r,v=u-o,x=y*y+v*v;if(x>4*t&&g--){var _=s+h,w=a+f,S=l+p,R=Tn(_*_+w*w+S*S),P=Dr(S/=R),O=tt(tt(S)-1)<_e||tt(i-d)<_e?(i+d)/2:Co(w,_),T=e(O,P),I=T[0],A=T[1],W=I-r,$=A-o,D=v*W-y*$;(D*D/x>t||tt((y*W+v*$)/x-.5)>.3||s*h+a*f+l*p<xq)&&(n(r,o,i,s,a,l,I,A,O,_/=R,w/=R,S,g,b),b.point(I,A),n(I,A,O,_,w,S,c,u,d,h,f,p,g,b))}}return function(r){var o,i,s,a,l,c,u,d,h,f,p,g,b={point:y,lineStart:v,lineEnd:_,polygonStart:function(){r.polygonStart(),b.lineStart=w},polygonEnd:function(){r.polygonEnd(),b.lineStart=v}};function y(P,O){P=e(P,O),r.point(P[0],P[1])}function v(){d=NaN,b.point=x,r.lineStart()}function x(P,O){var T=Vl([P,O]),I=e(P,O);n(d,h,u,f,p,g,d=I[0],h=I[1],u=P,f=T[0],p=T[1],g=T[2],QE,r),r.point(d,h)}function _(){b.point=y,r.lineEnd()}function w(){v(),b.point=S,b.lineEnd=R}function S(P,O){x(o=P,O),i=d,s=h,a=f,l=p,c=g,b.point=x}function R(){n(d,h,u,f,p,g,i,s,o,a,l,c,QE,r),b.lineEnd=_,_()}return b}}var Cq=Ew({point:function(e,t){this.stream.point(e*gt,t*gt)}});function _q(e){return Ew({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function Eq(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 JE(e,t,n,r,o,i){if(!i)return Eq(e,t,n,r,o);var s=Ne(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,b){return g*=r,b*=o,[l*g-c*b+t,n-c*g-l*b]}return p.invert=function(g,b){return[r*(u*g-d*b+h),o*(f-d*g-u*b)]},p}function ui(e){return BT(function(){return e})()}function BT(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=FE,b=null,y,v,x,_=$0,w=.5,S,R,P,O,T;function I(D){return P(D[0]*gt,D[1]*gt)}function A(D){return D=P.invert(D[0],D[1]),D&&[D[0]*Rn,D[1]*Rn]}I.stream=function(D){return O&&T===D?O:O=Cq(_q(u)(g(S(_(T=D)))))},I.preclip=function(D){return arguments.length?(g=D,p=void 0,$()):g},I.postclip=function(D){return arguments.length?(_=D,b=y=v=x=null,$()):_},I.clipAngle=function(D){return arguments.length?(g=+D?QG(p=D*gt):(p=null,FE),$()):p*Rn},I.clipExtent=function(D){return arguments.length?(_=D==null?(b=y=v=x=null,$0):JG(b=+D[0][0],y=+D[0][1],v=+D[1][0],x=+D[1][1]),$()):b==null?null:[[b,y],[v,x]]},I.scale=function(D){return arguments.length?(n=+D,W()):n},I.translate=function(D){return arguments.length?(r=+D[0],o=+D[1],W()):[r,o]},I.center=function(D){return arguments.length?(i=D[0]%360*gt,s=D[1]%360*gt,W()):[i*Rn,s*Rn]},I.rotate=function(D){return arguments.length?(a=D[0]%360*gt,l=D[1]%360*gt,c=D.length>2?D[2]%360*gt:0,W()):[a*Rn,l*Rn,c*Rn]},I.angle=function(D){return arguments.length?(d=D%360*gt,W()):d*Rn},I.reflectX=function(D){return arguments.length?(h=D?-1:1,W()):h<0},I.reflectY=function(D){return arguments.length?(f=D?-1:1,W()):f<0},I.precision=function(D){return arguments.length?(S=ZE(R,w=D*D),$()):Tn(w)},I.fitExtent=function(D,F){return kw(I,D,F)},I.fitSize=function(D,F){return LT(I,D,F)},I.fitWidth=function(D,F){return $T(I,D,F)},I.fitHeight=function(D,F){return zT(I,D,F)};function W(){var D=JE(n,0,0,h,f,d).apply(null,t(i,s)),F=JE(n,r-D[0],o-D[1],h,f,d);return u=xT(a,l,c),R=I0(t,F),P=I0(u,R),S=ZE(R,w),$()}function $(){return O=T=null,I}return function(){return t=e.apply(this,arguments),I.invert=t.invert&&A,W()}}function Pw(e){var t=0,n=We/3,r=BT(e),o=r(t,n);return o.parallels=function(i){return arguments.length?r(t=i[0]*gt,n=i[1]*gt):[t*Rn,n*Rn]},o}function Rq(e){var t=Ne(e);function n(r,o){return[r*t,Ie(o)/t]}return n.invert=function(r,o){return[r/t,Dr(o*t)]},n}function kq(e,t){var n=Ie(e),r=(n+Ie(t))/2;if(tt(r)<_e)return Rq(e);var o=1+n*(2*r-n),i=Tn(o)/r;function s(a,l){var c=Tn(o-2*r*Ie(l))/r;return[c*Ie(a*=r),i-c*Ne(a)]}return s.invert=function(a,l){var c=i-l,u=Co(a,tt(c))*Mr(c);return c*r<0&&(u-=We*Mr(a)*Mr(c)),[u/r,Dr((o-(a*a+c*c)*r*r)/(2*r))]},s}function up(){return Pw(kq).scale(155.424).center([0,33.6442])}function VT(){return up().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function Pq(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 Mq(){var e,t,n=VT(),r,o=up().rotate([154,0]).center([-2,58.5]).parallels([55,65]),i,s=up().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,b=(h[1]-p[1])/f;return(b>=.12&&b<.234&&g>=-.425&&g<-.214?o:b>=.166&&b<.234&&g>=-.214&&g<-.115?s:n).invert(h)},u.stream=function(h){return e&&t===h?e:e=Pq([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+_e,g+.12*f+_e],[p-.214*f-_e,g+.234*f-_e]]).stream(c),a=s.translate([p-.205*f,g+.212*f]).clipExtent([[p-.214*f+_e,g+.166*f+_e],[p-.115*f-_e,g+.234*f-_e]]).stream(c),d()},u.fitExtent=function(h,f){return kw(u,h,f)},u.fitSize=function(h,f){return LT(u,h,f)},u.fitWidth=function(h,f){return $T(u,h,f)},u.fitHeight=function(h,f){return zT(u,h,f)};function d(){return e=t=null,u}return u.scale(1070)}function HT(e){return function(t,n){var r=Ne(t),o=Ne(n),i=e(r*o);return i===1/0?[2,0]:[i*o*Ie(t),i*Ie(n)]}}function Cd(e){return function(t,n){var r=Tn(t*t+n*n),o=e(r),i=Ie(o),s=Ne(o);return[Co(t*i,r*s),Dr(r&&n*i/r)]}}var WT=HT(function(e){return Tn(2/(1+e))});WT.invert=Cd(function(e){return 2*Dr(e/2)});function Oq(){return ui(WT).scale(124.75).clipAngle(180-.001)}var UT=HT(function(e){return(e=vT(e))&&e/Ie(e)});UT.invert=Cd(function(e){return e});function Tq(){return ui(UT).scale(79.4188).clipAngle(180-.001)}function xg(e,t){return[e,ep(_w((Ft+t)/2))]}xg.invert=function(e,t){return[e,2*ic(yT(t))-Ft]};function Dq(){return GT(xg).scale(961/yr)}function GT(e){var t=ui(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=We*r(),h=t(WG(t.rotate()).invert([0,0]));return i(s==null?[[h[0]-d,h[1]-d],[h[0]+d,h[1]+d]]:e===xg?[[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 jf(e){return _w((Ft+e)/2)}function Iq(e,t){var n=Ne(e),r=e===t?Ie(e):ep(n/Ne(t))/ep(jf(t)/jf(e)),o=n*bb(jf(e),r)/r;if(!r)return xg;function i(s,a){o>0?a<-Ft+_e&&(a=-Ft+_e):a>Ft-_e&&(a=Ft-_e);var l=o/bb(jf(a),r);return[l*Ie(r*s),o-l*Ne(r*s)]}return i.invert=function(s,a){var l=o-a,c=Mr(r)*Tn(s*s+l*l),u=Co(s,tt(l))*Mr(l);return l*r<0&&(u-=We*Mr(s)*Mr(l)),[u/r,2*ic(bb(o/c,1/r))-Ft]},i}function Aq(){return Pw(Iq).scale(109.5).parallels([30,30])}function dp(e,t){return[e,t]}dp.invert=dp;function Nq(){return ui(dp).scale(152.63)}function Fq(e,t){var n=Ne(e),r=e===t?Ie(e):(n-Ne(t))/(t-e),o=n/r+e;if(tt(r)<_e)return dp;function i(s,a){var l=o-a,c=r*s;return[l*Ie(c),o-l*Ne(c)]}return i.invert=function(s,a){var l=o-a,c=Co(s,tt(l))*Mr(l);return l*r<0&&(c-=We*Mr(s)*Mr(l)),[c/r,o-Mr(r)*Tn(s*s+l*l)]},i}function jq(){return Pw(Fq).scale(131.154).center([0,13.9389])}var du=1.340264,fu=-.081106,hu=893e-6,pu=.003796,fp=Tn(3)/2,Lq=12;function qT(e,t){var n=Dr(fp*Ie(t)),r=n*n,o=r*r*r;return[e*Ne(n)/(fp*(du+3*fu*r+o*(7*hu+9*pu*r))),n*(du+fu*r+o*(hu+pu*r))]}qT.invert=function(e,t){for(var n=t,r=n*n,o=r*r*r,i=0,s,a,l;i<Lq&&(a=n*(du+fu*r+o*(hu+pu*r))-t,l=du+3*fu*r+o*(7*hu+9*pu*r),n-=s=a/l,r=n*n,o=r*r*r,!(tt(s)<bT));++i);return[fp*e*(du+3*fu*r+o*(7*hu+9*pu*r))/Ne(n),Dr(Ie(n)/fp)]};function $q(){return ui(qT).scale(177.158)}function YT(e,t){var n=Ne(t),r=Ne(e)*n;return[n*Ie(e)/r,Ie(t)/r]}YT.invert=Cd(ic);function zq(){return ui(YT).scale(144.049).clipAngle(60)}function KT(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)))]}KT.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(tt(o)>_e&&--r>0);return[e/(.8707+(i=n*n)*(-.131979+i*(-.013791+i*i*i*(.003971-.001529*i)))),n]};function Bq(){return ui(KT).scale(175.295)}function XT(e,t){return[Ne(t)*Ie(e),Ie(t)]}XT.invert=Cd(Dr);function Vq(){return ui(XT).scale(249.5).clipAngle(90+_e)}function QT(e,t){var n=Ne(t),r=1+Ne(e)*n;return[n*Ie(e)/r,Ie(t)/r]}QT.invert=Cd(function(e){return 2*ic(e)});function Hq(){return ui(QT).scale(250).clipAngle(142)}function ZT(e,t){return[ep(_w((Ft+t)/2)),-e]}ZT.invert=function(e,t){return[-t,2*ic(yT(e))-Ft]};function Wq(){var e=GT(ZT),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 st(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 wg(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Mw(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function sc(){}var ua=.7,Ul=1/ua,sl="\\s*([+-]?\\d+)\\s*",Bu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",yo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Uq=/^#([0-9a-f]{3,8})$/,Gq=new RegExp(`^rgb\\(${sl},${sl},${sl}\\)$`),qq=new RegExp(`^rgb\\(${yo},${yo},${yo}\\)$`),Yq=new RegExp(`^rgba\\(${sl},${sl},${sl},${Bu}\\)$`),Kq=new RegExp(`^rgba\\(${yo},${yo},${yo},${Bu}\\)$`),Xq=new RegExp(`^hsl\\(${Bu},${yo},${yo}\\)$`),Qq=new RegExp(`^hsla\\(${Bu},${yo},${yo},${Bu}\\)$`),eR={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};wg(sc,Ow,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:tR,formatHex:tR,formatHex8:Zq,formatHsl:Jq,formatRgb:nR,toString:nR});function tR(){return this.rgb().formatHex()}function Zq(){return this.rgb().formatHex8()}function Jq(){return eD(this).formatHsl()}function nR(){return this.rgb().formatRgb()}function Ow(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Uq.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?rR(t):n===3?new yn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Lf(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Lf(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=Gq.exec(e))?new yn(t[1],t[2],t[3],1):(t=qq.exec(e))?new yn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Yq.exec(e))?Lf(t[1],t[2],t[3],t[4]):(t=Kq.exec(e))?Lf(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Xq.exec(e))?sR(t[1],t[2]/100,t[3]/100,1):(t=Qq.exec(e))?sR(t[1],t[2]/100,t[3]/100,t[4]):eR.hasOwnProperty(e)?rR(eR[e]):e==="transparent"?new yn(NaN,NaN,NaN,0):null}function rR(e){return new yn(e>>16&255,e>>8&255,e&255,1)}function Lf(e,t,n,r){return r<=0&&(e=t=n=NaN),new yn(e,t,n,r)}function JT(e){return e instanceof sc||(e=Ow(e)),e?(e=e.rgb(),new yn(e.r,e.g,e.b,e.opacity)):new yn}function Vu(e,t,n,r){return arguments.length===1?JT(e):new yn(e,t,n,r??1)}function yn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}wg(yn,Vu,Mw(sc,{brighter(e){return e=e==null?Ul:Math.pow(Ul,e),new yn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ua:Math.pow(ua,e),new yn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new yn(Xs(this.r),Xs(this.g),Xs(this.b),hp(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:oR,formatHex:oR,formatHex8:eY,formatRgb:iR,toString:iR}));function oR(){return`#${Os(this.r)}${Os(this.g)}${Os(this.b)}`}function eY(){return`#${Os(this.r)}${Os(this.g)}${Os(this.b)}${Os((isNaN(this.opacity)?1:this.opacity)*255)}`}function iR(){const e=hp(this.opacity);return`${e===1?"rgb(":"rgba("}${Xs(this.r)}, ${Xs(this.g)}, ${Xs(this.b)}${e===1?")":`, ${e})`}`}function hp(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Xs(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Os(e){return e=Xs(e),(e<16?"0":"")+e.toString(16)}function sR(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Br(e,t,n,r)}function eD(e){if(e instanceof Br)return new Br(e.h,e.s,e.l,e.opacity);if(e instanceof sc||(e=Ow(e)),!e)return new Br;if(e instanceof Br)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 Br(s,a,l,e.opacity)}function tY(e,t,n,r){return arguments.length===1?eD(e):new Br(e,t,n,r??1)}function Br(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}wg(Br,tY,Mw(sc,{brighter(e){return e=e==null?Ul:Math.pow(Ul,e),new Br(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ua:Math.pow(ua,e),new Br(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 yn(Sb(e>=240?e-240:e+120,o,r),Sb(e,o,r),Sb(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Br(aR(this.h),$f(this.s),$f(this.l),hp(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=hp(this.opacity);return`${e===1?"hsl(":"hsla("}${aR(this.h)}, ${$f(this.s)*100}%, ${$f(this.l)*100}%${e===1?")":`, ${e})`}`}}));function aR(e){return e=(e||0)%360,e<0?e+360:e}function $f(e){return Math.max(0,Math.min(1,e||0))}function Sb(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 nY=Math.PI/180,rY=180/Math.PI;var tD=-.14861,Tw=1.78277,Dw=-.29227,Sg=-.90649,Hu=1.97294,lR=Hu*Sg,cR=Hu*Tw,uR=Tw*Dw-Sg*tD;function oY(e){if(e instanceof Qs)return new Qs(e.h,e.s,e.l,e.opacity);e instanceof yn||(e=JT(e));var t=e.r/255,n=e.g/255,r=e.b/255,o=(uR*r+lR*t-cR*n)/(uR+lR-cR),i=r-o,s=(Hu*(n-o)-Dw*i)/Sg,a=Math.sqrt(s*s+i*i)/(Hu*o*(1-o)),l=a?Math.atan2(s,i)*rY-120:NaN;return new Qs(l<0?l+360:l,a,o,e.opacity)}function _o(e,t,n,r){return arguments.length===1?oY(e):new Qs(e,t,n,r??1)}function Qs(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}wg(Qs,_o,Mw(sc,{brighter(e){return e=e==null?Ul:Math.pow(Ul,e),new Qs(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ua:Math.pow(ua,e),new Qs(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*nY,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),o=Math.sin(e);return new yn(255*(t+n*(tD*r+Tw*o)),255*(t+n*(Dw*r+Sg*o)),255*(t+n*(Hu*r)),this.opacity)}}));function iY(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 sY(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 iY((n-r/t)*t,s,o,i,a)}}const Iw=e=>()=>e;function nD(e,t){return function(n){return e+n*t}}function aY(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 lY(e,t){var n=t-e;return n?nD(e,n>180||n<-180?n-360*Math.round(n/360):n):Iw(isNaN(e)?t:e)}function cY(e){return(e=+e)==1?al:function(t,n){return n-t?aY(t,n,e):Iw(isNaN(t)?n:t)}}function al(e,t){var n=t-e;return n?nD(e,n):Iw(isNaN(e)?t:e)}(function e(t){var n=cY(t);function r(o,i){var s=n((o=Vu(o)).r,(i=Vu(i)).r),a=n(o.g,i.g),l=n(o.b,i.b),c=al(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 uY(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=Vu(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 dY=uY(sY);function rD(e){return function t(n){n=+n;function r(o,i){var s=e((o=_o(o)).h,(i=_o(i)).h),a=al(o.s,i.s),l=al(o.l,i.l),c=al(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)}rD(lY);var Aw=rD(al);const bt=e=>dY(e[e.length-1]);var fY=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(st);const hY=bt(fY);var pY=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(st);const gY=bt(pY);var mY=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(st);const bY=bt(mY);var yY=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(st);const vY=bt(yY);var xY=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(st);const wY=bt(xY);var SY=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(st);const CY=bt(SY);var _Y=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(st);const EY=bt(_Y);var RY=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(st);const kY=bt(RY);var PY=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(st);const MY=bt(PY);var OY=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(st);const TY=bt(OY);var DY=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(st);const IY=bt(DY);var AY=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(st);const NY=bt(AY);var FY=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(st);const jY=bt(FY);var LY=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(st);const $Y=bt(LY);var zY=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(st);const BY=bt(zY);var VY=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(st);const HY=bt(VY);var WY=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(st);const UY=bt(WY);var GY=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(st);const qY=bt(GY);var YY=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(st);const KY=bt(YY);var XY=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(st);const QY=bt(XY);var ZY=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(st);const JY=bt(ZY);var eK=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(st);const tK=bt(eK);var nK=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(st);const rK=bt(nK);var oK=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(st);const iK=bt(oK);var sK=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(st);const aK=bt(sK);var lK=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(st);const cK=bt(lK);var uK=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(st);const dK=bt(uK);function fK(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 hK=Aw(_o(300,.5,0),_o(-240,.5,1));var pK=Aw(_o(-100,.75,.35),_o(80,1.5,.8)),gK=Aw(_o(260,.75,.35),_o(80,1.5,.8)),zf=_o();function mK(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return zf.h=360*e-100,zf.s=1.5-1.5*t,zf.l=.8-.9*t,zf+""}var Bf=Vu(),bK=Math.PI/3,yK=Math.PI*2/3;function vK(e){var t;return e=(.5-e)*Math.PI,Bf.r=255*(t=Math.sin(e))*t,Bf.g=255*(t=Math.sin(e+bK))*t,Bf.b=255*(t=Math.sin(e+yK))*t,Bf+""}function xK(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 Cg(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}const wK=Cg(st("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));var SK=Cg(st("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),CK=Cg(st("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),_K=Cg(st("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function EK(e){return e}function RK(e){if(e==null)return EK;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 kK(e,t){for(var n,r=e.length,o=r-t;o<--r;)n=e[o],e[o++]=e[r],e[r]=n}function PK(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(n){return dR(e,n)})}:dR(e,t)}function dR(e,t){var n=t.id,r=t.bbox,o=t.properties==null?{}:t.properties,i=MK(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 MK(e,t){var n=RK(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&&kK(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 gu={geoAzimuthalEqualArea:Oq,geoAzimuthalEquidistant:Tq,geoGnomonic:zq,geoOrthographic:Vq,geoStereographic:Hq,geoEqualEarth:$q,geoAlbers:VT,geoAlbersUsa:Mq,geoConicConformal:Aq,geoConicEqualArea:up,geoConicEquidistant:jq,geoEquirectangular:Nq,geoMercator:Dq,geoTransverseMercator:Wq,geoNaturalEarth1:Bq};Object.keys(gu).forEach(e=>{gu[`${e.charAt(3).toLowerCase()}${e.slice(4)}`]=gu[e]});class _a extends ts{constructor(t){super(t),this.outlineBounds=null,this.oldChartBounds=null,this.geoPath=XE()}init(t){t.position="chartArea",super.init(t),typeof t.projection=="function"?this.projection=t.projection:this.projection=(gu[t.projection]||gu.albersUsa)(),this.geoPath.projection(this.projection),this.outlineBounds=null,this.oldChartBounds=null}computeBounds(t){const n=XE(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,b=this.options;return this.projection.scale(n.refScale*d*b.projectionScale).translate([d*n.refX+p+b.projectionOffset[0],d*n.refY+g+b.projectionOffset[1]]),!u||u.chartWidth!==this.oldChartBounds.chartWidth||u.chartHeight!==this.oldChartBounds.chartHeight}}_a.id="projection";_a.defaults={projection:"albersUsa",projectionScale:1,projectionOffset:[0,0],padding:0};_a.descriptors={_scriptable:e=>e!=="projection",_indexable:e=>e!=="projectionOffset"};const _g={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 OK(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 TK(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=OK(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 Qa extends zl{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=TK(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 oD extends Bl{constructor(){super(...arguments),this.legendSize={w:0,h:0}}init(t){Qa.prototype.init.call(this,t)}parse(t,n){return Qa.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 Qa.prototype.update.call(this,t,n,r)}_computeLabelArea(){}draw(t){return Qa.prototype.draw.call(this,t)}_drawIndicator(){}}const Qo={interpolateBlues:tK,interpolateBrBG:hY,interpolateBuGn:TY,interpolateBuPu:IY,interpolateCividis:fK,interpolateCool:gK,interpolateCubehelixDefault:hK,interpolateGnBu:NY,interpolateGreens:rK,interpolateGreys:iK,interpolateInferno:CK,interpolateMagma:SK,interpolateOrRd:jY,interpolateOranges:dK,interpolatePRGn:gY,interpolatePiYG:bY,interpolatePlasma:_K,interpolatePuBu:BY,interpolatePuBuGn:$Y,interpolatePuOr:vY,interpolatePuRd:HY,interpolatePurples:aK,interpolateRainbow:mK,interpolateRdBu:wY,interpolateRdGy:CY,interpolateRdPu:UY,interpolateRdYlBu:EY,interpolateRdYlGn:kY,interpolateReds:cK,interpolateSinebow:vK,interpolateSpectral:MY,interpolateTurbo:xK,interpolateViridis:wK,interpolateWarm:pK,interpolateYlGn:KY,interpolateYlGnBu:qY,interpolateYlOrBr:QY,interpolateYlOrRd:JY};Object.keys(Qo).forEach(e=>{Qo[`${e.charAt(11).toLowerCase()}${e.slice(12)}`]=Qo[e],Qo[e.slice(11)]=Qo[e]});function iD(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 sD={interpolate:"blues",missing:"transparent",quantize:0};class Ui extends Qa{get interpolate(){const t=this.options;return t?typeof t.interpolate=="function"?t.interpolate:Qo[t.interpolate]||Qo.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=iD(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)}}}}Ui.id="color";Ui.defaults=en({},[zl.defaults,_g,sD]);Ui.descriptors={_scriptable:e=>e!=="interpolate",_indexable:!1};class Nw extends oD{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=Qo[t.interpolate]||Qo.blues}getColorForValue(t){return Ui.prototype.getColorForValue.call(this,t)}getColor(t){let n=t;return this.options.quantize>0&&(n=iD(n,this.options.quantize)),this.interpolate(n)}_drawIndicator(){return Ui.prototype._drawIndicator.call(this)}}Nw.id="colorLogarithmic";Nw.defaults=en({},[Bl.defaults,_g,sD]);Nw.descriptors={_scriptable:e=>e!=="interpolate",_indexable:!1};const aD={missing:1,mode:"area",range:[2,20],legend:{align:"bottom",length:90,width:70,indicatorWidth:42}};class Gi extends Qa{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};Yh(t,f,d,h)})}}Gi.id="size";Gi.defaults=en({},[zl.defaults,_g,aD]);Gi.descriptors={_scriptable:!0,_indexable:e=>e!=="range"};class lD extends oD{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 Gi.prototype.getSizeImpl.call(this,t)}_drawIndicator(){Gi.prototype._drawIndicator.call(this)}}lD.id="sizeLogarithmic";lD.defaults=en({},[Bl.defaults,_g,aD]);function DK(e,t){return[[e[0][0]-t,e[0][1]-t],[e[1][0]+t,e[1][1]+t]]}class ai extends Io{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&&aq(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=DK(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())}}ai.id="geoFeature";ai.defaults={...Ks.defaults,outlineBackgroundColor:null,outlineBorderWidth:0,graticuleBorderColor:"#CCCCCC",graticuleBorderWidth:0};ai.defaultRoutes={outlineBorderColor:"borderColor",...Ks.defaultRoutes||{}};const cD={showOutline:!1,showGraticule:!1,clipMap:!0},uD={scales:{projection:{axis:"x",type:_a.id,position:"chartArea",display:!1}}};function fR(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 dD extends Or{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 Oe(this.getGeoDataset().showOutline,this.getGeoOptions().showOutline)}clipMap(){return Oe(this.getGeoDataset().clipMap,this.getGeoOptions().clipMap)}getGraticule(){return Oe(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=fR(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=fR(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(lq());else{const s=RT();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,Ws(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||Ws(t.ctx,t.chartArea):r&&(r=!1,Us(t.ctx)),this.showGraticule(),n===!0||n==="items"?r||Ws(t.ctx,t.chartArea):r&&(r=!1,Us(t.ctx)),this.getMeta().data.forEach(o=>o.draw.call(o,t.ctx,t.chartArea)),r&&(r=!1,Us(t.ctx))}}function fD(e,t,n,r=[],o=[]){Pn.addControllers(n),Array.isArray(r)?Pn.addElements(...r):Pn.addElements(r),Array.isArray(o)?Pn.addScales(...o):Pn.addScales(o);const i=t;return i.type=e,i}class ac extends dD{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])}}ac.id="choropleth";ac.defaults=en({},[cD,{datasetElementType:ai.id,dataElementType:ai.id}]);ac.overrides=en({},[uD,{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:Ui.id,axis:"x"}},elements:{geoFeature:{backgroundColor(e){return e.dataIndex==null?null:e.chart.getDatasetMeta(e.datasetIndex).controller.indexToColor(e.dataIndex)}}}}]);class IK extends It{constructor(t,n){super(t,fD("choropleth",n,ac,ai,[Ui,_a]))}}IK.id=ac.id;class lc extends dD{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])}}lc.id="bubbleMap";lc.defaults=en({},[cD,{dataElementType:Ys.id,datasetElementType:ai.id,showOutline:!0,clipMap:"outline+graticule"}]);lc.overrides=en({},[uD,{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:Gi.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 AK extends It{constructor(t,n){super(t,fD("bubbleMap",n,lc,ai,[Gi,_a]))}}AK.id=lc.id;function NK(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 FK(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 jK(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 LK(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 $K(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:{position:"bottom",align:"center"}}}}}function zK(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 BK(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 VK(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:Qe.slate[800]},angleLines:{color:Qe.slate[800]},ticks:{color:Qe.slate[800],showLabelBackdrop:!1}}}}}),n}function Fw({data:e,cardType:t="bar",cfg:n,customCfg:r,provider:o="chartjs",userSettings:i,preferences:s,topoJson:a}){var l,c,u,d,h,f,p,g,b,y;if(t==="map"){if(!a)return null;const v=(l=s==null?void 0:s.mapVisualOptions)==null?void 0:l.objectKey;if(!v)return null;const x=PK(a,(c=a==null?void 0:a.objects)==null?void 0:c[v]).features;if(!x)return null;const _={plugins:{datalabels:{display:!1}},scales:{x:{display:!1,grid:{display:!1}},y:{display:!1,grid:{display:!1}},projection:{axis:"x",projection:((u=s==null?void 0:s.mapVisualOptions)==null?void 0:u.projection)||"mercator",projectionScale:((d=s==null?void 0:s.mapVisualOptions)==null?void 0:d.projectionScale)||1,projectionOffset:((h=s==null?void 0:s.mapVisualOptions)==null?void 0:h.projectionOffset)||[0,0]},color:{axis:"x",interpolate:((f=s==null?void 0:s.mapVisualOptions)==null?void 0:f.colorScale)||"blues",quantize:5,legend:{position:"bottom-right",align:"right"}}}},{keys:w}=Qt(e),S=x.map(A=>{var F;const W=w==null?void 0:w[0],$=w==null?void 0:w[1],D=(F=e.find(N=>(N==null?void 0:N[W])===A.properties.NAME||(N==null?void 0:N[W])===A.properties.name))==null?void 0:F[$];return{feature:A,value:D}}),P=Uc([{label:v,data:S,borderColor:"lightgray"}],r),O={type:"choropleth",data:{labels:x.map(A=>A.properties.NAME||A.properties.name),datasets:P},options:_},{options:T}=bO({cfg:O,preferences:s,customCfg:r});return{...O,options:T}}if(t==="bar"){const v=jK(n);return ds({data:e,cfg:v,customCfg:r,cardType:t,preferences:s})}if(t==="horizontalBar"){const v=NK(n);return ds({data:e,cfg:v,customCfg:r,cardType:t,preferences:s})}if(t==="pyramid"){const v=FK(n),{dimensionKeys:x,metricKeys:_}=Qt(e),w=Hh({dataArray:e,groupKey:x[0],pivotKey:x[1],valueKey:_[0]}),S=ds({data:w,cfg:v,customCfg:r,cardType:t,preferences:s}),R="x2";return{...S,data:{...S.data,datasets:S.data.datasets.map((O,T)=>T===1?{...O,xAxisID:R}:O)},options:{...S.options,scales:{...(p=S==null?void 0:S.options)==null?void 0:p.scales,[R]:{beginAtZero:!0,stack:1}}}}}if(t==="stackedBar"||t==="stackedLine"){const v=$K(n,t),{dimensionKeys:x,metricKeys:_}=Qt(e),w=Hh({dataArray:e,groupKey:x[0],pivotKey:x[1],valueKey:_[0],sortChart:s==null?void 0:s.sortChart});return ds({data:w,cfg:v,customCfg:r,cardType:t,preferences:s})}if(t==="line"){const v=zK(n);return ds({data:e,cfg:v,customCfg:r,cardType:t,preferences:s})}if(t==="range"){const v=LK(n),x=nB(e),_=Uc(x,r),{plugins:w,options:S}=b0((s==null?void 0:s.customVisualCode)||""),R=Vn((v==null?void 0:v.options)||{},(n==null?void 0:n.options)||{}),P=Vn(R,(s==null?void 0:s.chartOptions)||{}),O=Vn(P,(r==null?void 0:r.options)||{}),T=Vn(O,S),I=mO(n,s),A=Vn(T,I),W={...A,plugins:{...A==null?void 0:A.plugins,datalabels:{...(g=A==null?void 0:A.plugins)==null?void 0:g.datalabels,formatter:(j,H)=>j.map(V=>{var L,k,U,q;return Pr({number:Number(V),decimalPlaces:((L=s==null?void 0:s.numberAxisFormat)==null?void 0:L.decimalPlaces)||0,useSuffix:!!((k=s==null?void 0:s.numberAxisFormat)!=null&&k.suffix),customSuffix:"",locale:((U=s==null?void 0:s.numberAxisFormat)==null?void 0:U.locale)||"",currency:((q=s==null?void 0:s.numberAxisFormat)==null?void 0:q.currency)||""})}).slice(0,2).join(" - ")}}},{dimensionKeys:$}=Qt(e),D=$[0];return{type:"bar",data:{labels:[...new Set(m0(e,D))],datasets:_},options:W,plugins:[...w]}}if(t==="pie"||t==="doughnut"||t==="polarArea"){const v=BK(t,n),{dimensionKeys:x,metricKeys:_}=Qt(e),w=rB(_,e),S=Uc(w,r),{plugins:R,options:P}=b0((s==null?void 0:s.customVisualCode)||""),O=x[0],T=m0(e,O),I=Vn((v==null?void 0:v.options)||{},(r==null?void 0:r.options)||{}),A=Vn(I,(s==null?void 0:s.chartOptions)||{}),W={...A,plugins:{...A.plugins,datalabels:{...(b=A.plugins)==null?void 0:b.datalabels,formatter:(j,H)=>{var M,V,L,k;return Pr({number:Number(j),decimalPlaces:((M=s==null?void 0:s.numberAxisFormat)==null?void 0:M.decimalPlaces)||0,useSuffix:!!((V=s==null?void 0:s.numberAxisFormat)!=null&&V.suffix),customSuffix:"",locale:((L=s==null?void 0:s.numberAxisFormat)==null?void 0:L.locale)||"",currency:((k=s==null?void 0:s.numberAxisFormat)==null?void 0:k.currency)||""})}},tooltip:{...(y=A.plugins)==null?void 0:y.tooltip,callbacks:{label:function(j){var U,q,Y,B;j.dataset.label;const M=j.dataset.data.reduce((G,X)=>G+X,0),V=j.parsed,L=Pr({number:Number(V),decimalPlaces:((U=s==null?void 0:s.numberAxisFormat)==null?void 0:U.decimalPlaces)||0,useSuffix:!!((q=s==null?void 0:s.numberAxisFormat)!=null&&q.suffix),customSuffix:"",locale:((Y=s==null?void 0:s.numberAxisFormat)==null?void 0:Y.locale)||"",currency:((B=s==null?void 0:s.numberAxisFormat)==null?void 0:B.currency)||""}),k=(V/M*100).toFixed(2);return L+` (${k}%)`}}}}},$=Vn(A,W),D=Vn($,P);return{type:t,data:{labels:T,datasets:S},options:D,plugins:[t==="doughnut"?{id:"doughnutLabel",beforeDatasetsDraw:function(j,H,M){var X,J,ne,Z;const{ctx:V,data:L}=j;V.save();const k=j.getDatasetMeta(0).data[0].x,U=j.getDatasetMeta(0).data[0].y,q=Dl(Mu()),Y=window.getComputedStyle(V.canvas).fontFamily;V.font=`1em ${Y}`,V.fontWeight="bolder",V.fillStyle=q,V.textAlign="center",V.textBaseline="middle";const B=L.datasets[0].data.reduce((oe,ee)=>oe+ee,0),G=Pr({number:Number(B),decimalPlaces:((X=s==null?void 0:s.numberAxisFormat)==null?void 0:X.decimalPlaces)||0,useSuffix:!!((J=s==null?void 0:s.numberAxisFormat)!=null&&J.suffix),customSuffix:"",locale:((ne=s==null?void 0:s.numberAxisFormat)==null?void 0:ne.locale)||"",currency:((Z=s==null?void 0:s.numberAxisFormat)==null?void 0:Z.currency)||""});V.fillText(G,k,U)}}:"",...R]}}if(t==="radar"){const v=VK(n);return ds({data:e,cfg:v,customCfg:r,cardType:t,preferences:s})}if(t==="bubble"||t==="scatter"){const{metricKeys:v}=Qt(e),x=tB(e,t),_=Uc(x,r),w={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{label:function(P){var F;const O=P.dataset.label,T=P.dataIndex,I=P.dataset.data,A=(F=I==null?void 0:I[T])==null?void 0:F.label,W=v==null?void 0:v[0],$=v==null?void 0:v[1],D=v==null?void 0:v[2];if(t==="bubble")return A?`${O} (${A}): ${W}: ${P.raw.x.toFixed(2)}, ${$}: ${P.raw.y.toFixed(2)}, ${D}: ${P.raw.r.toFixed(2)}`:`${O}: ${W}: ${P.raw.x.toFixed(2)}, ${$}: ${P.raw.y.toFixed(2)}, ${D}: ${P.raw.r.toFixed(2)}`;if(t==="scatter")return A?`${O} (${A}): ${W}: ${P.raw.x.toFixed(2)}, ${$}: ${P.raw.y.toFixed(2)}`:`${O}: ${W}: ${P.raw.x.toFixed(2)}, ${$}: ${P.raw.y.toFixed(2)}`}}},datalabels:{display:!1}},scales:{x:{title:{display:!0,text:v[0]},beginAtZero:!0,ticks:{precision:0}},y:{title:{display:!0,text:v[1]},beginAtZero:!0,ticks:{precision:0}}}},S=Vn(w,(r==null?void 0:r.options)||{});return{type:t,data:{datasets:_},options:S}}return ds({data:e,cfg:n,customCfg:r,cardType:t,preferences:s})}function HK({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)&&UK(e,t,o,i,a),["pie","doughnut","polarArea"].includes(r)&&GK(e,t,o,i,a),["stackedBar","pyramid"].includes(r)&&WK({chart:e,elementIndex:t,datasetIndex:n,cfg:o,apply:i,blurColor:a})}function WK(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,b)=>b===n&&h===r?g:s),d.borderColor=(p=d==null?void 0:d.borderColor)==null?void 0:p.map((g,b)=>b===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,b,y,v;d.backgroundColor=new Array(d.data.length).fill((g=(p=(f=o==null?void 0:o.data)==null?void 0:f.datasets)==null?void 0:p[h])==null?void 0:g.backgroundColor),d.borderColor=new Array(d.data.length).fill((v=(y=(b=o==null?void 0:o.data)==null?void 0:b.datasets)==null?void 0:y[h])==null?void 0:v.borderColor)}),t==null||t.update()}function UK(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,b;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((b=(g=(p=n==null?void 0:n.data)==null?void 0:p.datasets)==null?void 0:g[u])==null?void 0:b.borderColor)}),e==null||e.update()}function GK(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,b,y,v;typeof c.backgroundColor=="string"&&(c.backgroundColor=(f=(h=(d=n==null?void 0:n.data)==null?void 0:d.datasets)==null?void 0:h[u])==null?void 0:f.backgroundColor,c.borderColor=(b=(g=(p=n==null?void 0:n.data)==null?void 0:p.datasets)==null?void 0:g[u])==null?void 0:b.borderColor),c.backgroundColor=(y=c==null?void 0:c.backgroundColor)==null?void 0:y.map((x,_)=>{var w;return(w=n.data.datasets[u].backgroundColor)==null?void 0:w[_]}),c.borderColor=(v=c==null?void 0:c.borderColor)==null?void 0:v.map((x,_)=>{var w;return(w=n.data.datasets[u].borderColor)==null?void 0:w[_]})}),e==null||e.update()}function qK({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}=Qt(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"].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=Hh({dataArray:t,groupKey:h[0],pivotKey:h[1],valueKey:f[0]}),g=h[0],b=(u=p[r])==null?void 0:u[g],y=h[1],{metricKeys:v}=Qt(p),x=v[n];return[{columnName:g,columnValue:b,metric:f[0],value:o},{columnName:y,columnValue:x,metric:f[0],value:o}]}if(e.type==="bubble"||e.type==="scatter"){const p=h[0],g=o.label;return[{columnName:p,columnValue:g,metric1:f[0],value1:o.x,metric2:f[1],value2:o.y,metric3:f==null?void 0:f[2],value3:o==null?void 0:o.r}]}}catch(d){console.error("Error in getAdhocFilter",d)}}function YK(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,FB("--semaphor-background")),c})}));return{...e,data:{...e.data,datasets:i}}}return e}function hD(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}=md({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 KK(e){var s,a;const[t]=E.useState({id:"",title:"",type:"bar"}),{getCard:n}=Bt(),r=n(e),o=pD(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 pD(e){var W,$,D,F;const{onChartElementClicked:t}=xr(),[n,r]=E.useState(0);((W=e==null?void 0:e.preferences)==null?void 0:W.filterOnClickColumnIndex)===void 0||($=e.preferences)==null||$.filterOnClickColumnIndex;const o=se(N=>N.isVisualEditing),i=se(N=>N.filteringCards),s=se(N=>N.selectedSheetId),a=se(N=>N.selectedLensId);se(N=>N.selectedCardId),se(N=>N.dashboard),se(N=>N.isDashboardEditing),se(N=>N.themeStyle);const l=se(N=>N.filterValues),c=E.useRef(l),u=(D=e==null?void 0:e.preferences)==null?void 0:D.onClickFilter,{addFilteringCard:d,getCardFrame:h,addOrUpdateFilterValues:f,removeFilterValues:p,removeFilteringCard:g}=Bt(),{data:b,isLoading:y,isFetching:v,isError:x,queryKey:_}=Bi(e),{data:w}=hD(e),S=i==null?void 0:i.find(N=>N.id===e.id),R=h(e.id),P=(R==null?void 0:R.cards)||[],O=(P==null?void 0:P.length)==1;let T;b&&b.records&&((F=b.records)==null?void 0:F.length)>0&&e.type!=="custom"&&(T=Fw({data:b==null?void 0:b.records,cardType:e.type,cfg:e.cfg,customCfg:e.customCfg,preferences:e.preferences,topoJson:w}));const I=E.useRef({filteringCards:i});E.useEffect(()=>{!(b!=null&&b.records)||y||v||S&&O||o||r(N=>N+1)},[b==null?void 0:b.records,y,v,S,O,o]),E.useEffect(()=>{e.connectionId&&!S&&(c.current=l)},[l,a,e.connectionId,S]),E.useEffect(()=>{var j;S&&(I.current.filteringCards=[...i||[]]),!S&&((j=I.current.filteringCards)==null?void 0:j.find(H=>H.id===e.id))&&O&&r(H=>H+1)},[S,O,e.id,i]);function A(N,j,H,M){var k;let V=!1;if(!(b!=null&&b.records))return;const L=qK({card:e,data:b==null?void 0:b.records,datasetIndex:j,clickIndex:H,value:M});if(console.log("fieldValues",L),t==null||t(e,L),!!(((k=e==null?void 0:e.preferences)==null?void 0:k.onClickFilter)??[]).length){if(S){const U=e.id;p(U),g(e)}else{if(V=!0,!L)return;const U=[];L.forEach((q,Y)=>{const B=u==null?void 0:u.find(X=>X.columnIndex===Y);if(!B)return;const G={filterId:e.id+"-"+q.columnName+"-"+s,connectionId:e==null?void 0:e.connectionId,tableName:e.lastSelectedTable,name:q.columnName,expression:B.expression,valueType:Gp(L[B.columnIndex].columnValue),operation:"=",values:[L[B.columnIndex].columnValue]};U.push(G)}),f(U),d(e)}HK({chart:N,elementIndex:H,datasetIndex:j,cardType:e.type,cfg:T,apply:V})}}return{isError:x,isLoading:y,isFetching:v,data:b,visualKey:n,handleDatapointClick:A,cfg:T,queryKey:_}}function vo({children:e,containerClassName:t,className:n,text:r,onSave:o,type:i="input"}){const[s,a]=E.useState(!1),[l,c]=E.useState(r),u=se(f=>f.isDashboardEditing),d=f=>{f.stopPropagation(),u&&a(!0)};function h(){return i==="textarea"?m.jsx("textarea",{className:ie("grow rounded-sm bg-background px-2 py-1 text-sm outline-dashed outline-[0.5px] outline-primary/50",n),onChange:f=>c(f.target.value),value:l,autoFocus:!0,onBlur:()=>a(!1),onKeyDown:f=>{f.stopPropagation(),!(f.key==="Enter"&&f.shiftKey)&&(f.key==="Enter"||f.key==="Tab")&&(a(!1),o(l))}}):m.jsx("input",{onMouseDown:f=>f.stopPropagation(),type:"text",className:ie("rounded-sm bg-background px-2 py-1 text-sm outline-dashed outline-[0.5px] outline-primary/50",n),onChange:f=>c(f.target.value),value:l,autoFocus:!0,onBlur:()=>a(!1),onKeyDown:f=>{f.stopPropagation(),(f.key==="Enter"||f.key==="Tab")&&(a(!1),o(l))}})}return m.jsx("div",{className:ie("flex",t),role:"editable",onDoubleClick:d,children:s?h():e})}function gD(e){const{authToken:t}=xr(),n=A8(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 pp({card:e,data:t}){var v,x,_,w,S,R,P,O,T,I,A,W,$,D,F,N;const n=se(j=>j.actions.setCardTitle),r=se(j=>j.actions.setCardDescription),o=se(j=>j.isVisualEditing),i=Wn(j=>j.card),s=Wn(j=>j.actions.setCard);Wn(j=>j.actions.setNumberFormat);const{getCurrency:a,getLocale:l}=gD(e),c=se(j=>j.selectedSheetId),u=(x=(v=e.preferences)==null?void 0:v.formatNumber)==null?void 0:x.colorRanges,{metricKeys:d}=Qt(t),h=(_=t==null?void 0:t[0])==null?void 0:_[d==null?void 0:d[0]],f=(w=t==null?void 0:t[0])==null?void 0:w[d==null?void 0:d[1]],p=t&&t.length>0;function g(j){o?s({...i,title:j}):n(c,e.id,j)}function b(j){o?s({...i,description:j}):r(c,e.id,j)}const y=f&&f-h!==0?(h-f)/f:null;return m.jsxs("div",{className:"kpi-card flex grow flex-col overflow-auto",children:[m.jsxs(Yp,{className:"grow pb-3",children:[m.jsx(vo,{text:o?i.title:e.title,onSave:g,children:m.jsx("div",{className:"flex items-center gap-2",children:m.jsx(nc,{className:"text-base font-medium text-muted-foreground",children:e.title})})}),p&&m.jsxs("div",{className:"flex flex-wrap items-end gap-3 text-foreground",children:[m.jsx("p",{style:{color:iw(h,u)},className:"text-3xl font-semibold",children:Pr({number:h,decimalPlaces:((R=(S=e.preferences)==null?void 0:S.formatNumber)==null?void 0:R.decimalPlaces)||0,useSuffix:!!((O=(P=e.preferences)==null?void 0:P.formatNumber)!=null&&O.suffix),customSuffix:((I=(T=e.preferences)==null?void 0:T.formatNumber)==null?void 0:I.suffix)||"",locale:l()||"",currency:a()||""})}),f&&m.jsxs("span",{className:"min-w-fit text-base font-normal text-muted-foreground",children:["from  ",Pr({number:f,decimalPlaces:((W=(A=e.preferences)==null?void 0:A.formatNumber)==null?void 0:W.decimalPlaces)||0,useSuffix:!!((D=($=e.preferences)==null?void 0:$.formatNumber)!=null&&D.suffix),customSuffix:((N=(F=e.preferences)==null?void 0:F.formatNumber)==null?void 0:N.suffix)||"",locale:l()||"",currency:a()||""})]})]})]}),y&&m.jsxs(Kp,{className:"grow items-start gap-1 pb-4 text-sm",children:[m.jsx(mD,{children:y}),m.jsxs("div",{className:"flex gap-1 text-muted-foreground",children:[y>0?"up ":"down ",m.jsx(vo,{text:e.description||"",onSave:b,children:e.description})]})]})]})}function mD({children:e,className:t}){var i,s;const n=se(a=>a.themeStyle),r=e>0?m.jsx("span",{children:"+"}):m.jsx("span",{children:"-"}),o=`${Math.abs(e*100).toFixed(0)}%`;return m.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,m.jsx("span",{className:"ml-[1px]",children:o})]})}const XK=["top","right","bottom","left"],li=Math.min,gn=Math.max,Wu=Math.round,Vf=Math.floor,xo=e=>({x:e,y:e}),QK={left:"right",right:"left",bottom:"top",top:"bottom"},ZK={start:"end",end:"start"};function K0(e,t,n){return gn(e,li(t,n))}function Eo(e,t){return typeof e=="function"?e(t):e}function ci(e){return e.split("-")[0]}function cc(e){return e.split("-")[1]}function jw(e){return e==="x"?"y":"x"}function Lw(e){return e==="y"?"height":"width"}function qi(e){return["top","bottom"].includes(ci(e))?"y":"x"}function $w(e){return jw(qi(e))}function JK(e,t,n){n===void 0&&(n=!1);const r=cc(e),o=$w(e),i=Lw(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=gp(s)),[s,gp(s)]}function eX(e){const t=gp(e);return[X0(e),t,X0(t)]}function X0(e){return e.replace(/start|end/g,t=>ZK[t])}function tX(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 nX(e,t,n,r){const o=cc(e);let i=tX(ci(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(X0)))),i}function gp(e){return e.replace(/left|right|bottom|top/g,t=>QK[t])}function rX(e){return{top:0,right:0,bottom:0,left:0,...e}}function bD(e){return typeof e!="number"?rX(e):{top:e,right:e,bottom:e,left:e}}function mp(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 hR(e,t,n){let{reference:r,floating:o}=e;const i=qi(t),s=$w(t),a=Lw(s),l=ci(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(cc(t)){case"start":f[s]-=h*(n&&c?-1:1);break;case"end":f[s]+=h*(n&&c?-1:1);break}return f}const oX=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}=hR(c,r,l),h=r,f={},p=0;for(let g=0;g<a.length;g++){const{name:b,fn:y}=a[g],{x:v,y:x,data:_,reset:w}=await y({x:u,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:f,rects:c,platform:s,elements:{reference:e,floating:t}});u=v??u,d=x??d,f={...f,[b]:{...f[b],..._}},w&&p<=50&&(p++,typeof w=="object"&&(w.placement&&(h=w.placement),w.rects&&(c=w.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):w.rects),{x:u,y:d}=hR(c,h,l)),g=-1)}return{x:u,y:d,placement:h,strategy:o,middlewareData:f}};async function Gl(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}=Eo(t,e),p=bD(f),b=a[h?d==="floating"?"reference":"floating":d],y=mp(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(b)))==null||n?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),_=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},w=mp(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:x,strategy:l}):v);return{top:(y.top-w.top+p.top)/_.y,bottom:(w.bottom-y.bottom+p.bottom)/_.y,left:(y.left-w.left+p.left)/_.x,right:(w.right-y.right+p.right)/_.x}}const iX=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}=Eo(e,t)||{};if(c==null)return{};const d=bD(u),h={x:n,y:r},f=$w(o),p=Lw(f),g=await s.getDimensions(c),b=f==="y",y=b?"top":"left",v=b?"bottom":"right",x=b?"clientHeight":"clientWidth",_=i.reference[p]+i.reference[f]-h[f]-i.floating[p],w=h[f]-i.reference[f],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let R=S?S[x]:0;(!R||!await(s.isElement==null?void 0:s.isElement(S)))&&(R=a.floating[x]||i.floating[p]);const P=_/2-w/2,O=R/2-g[p]/2-1,T=li(d[y],O),I=li(d[v],O),A=T,W=R-g[p]-I,$=R/2-g[p]/2+P,D=K0(A,$,W),F=!l.arrow&&cc(o)!=null&&$!==D&&i.reference[p]/2-($<A?T:I)-g[p]/2<0,N=F?$<A?$-A:$-W:0;return{[f]:h[f]+N,data:{[f]:D,centerOffset:$-D-N,...F&&{alignmentOffset:N}},reset:F}}}),sX=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,...b}=Eo(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=ci(o),v=qi(a),x=ci(a)===a,_=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=h||(x||!g?[gp(a)]:eX(a)),S=p!=="none";!h&&S&&w.push(...nX(a,g,p,_));const R=[a,...w],P=await Gl(t,b),O=[];let T=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&O.push(P[y]),d){const $=JK(o,s,_);O.push(P[$[0]],P[$[1]])}if(T=[...T,{placement:o,overflows:O}],!O.every($=>$<=0)){var I,A;const $=(((I=i.flip)==null?void 0:I.index)||0)+1,D=R[$];if(D)return{data:{index:$,overflows:T},reset:{placement:D}};let F=(A=T.filter(N=>N.overflows[0]<=0).sort((N,j)=>N.overflows[1]-j.overflows[1])[0])==null?void 0:A.placement;if(!F)switch(f){case"bestFit":{var W;const N=(W=T.filter(j=>{if(S){const H=qi(j.placement);return H===v||H==="y"}return!0}).map(j=>[j.placement,j.overflows.filter(H=>H>0).reduce((H,M)=>H+M,0)]).sort((j,H)=>j[1]-H[1])[0])==null?void 0:W[0];N&&(F=N);break}case"initialPlacement":F=a;break}if(o!==F)return{reset:{placement:F}}}return{}}}};function pR(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function gR(e){return XK.some(t=>e[t]>=0)}const aX=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Eo(e,t);switch(r){case"referenceHidden":{const i=await Gl(t,{...o,elementContext:"reference"}),s=pR(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:gR(s)}}}case"escaped":{const i=await Gl(t,{...o,altBoundary:!0}),s=pR(i,n.floating);return{data:{escapedOffsets:s,escaped:gR(s)}}}default:return{}}}}};async function lX(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=ci(n),a=cc(n),l=qi(n)==="y",c=["left","top"].includes(s)?-1:1,u=i&&l?-1:1,d=Eo(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 cX=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 lX(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}}}}},uX=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:b=>{let{x:y,y:v}=b;return{x:y,y:v}}},...l}=Eo(e,t),c={x:n,y:r},u=await Gl(t,l),d=qi(ci(o)),h=jw(d);let f=c[h],p=c[d];if(i){const b=h==="y"?"top":"left",y=h==="y"?"bottom":"right",v=f+u[b],x=f-u[y];f=K0(v,f,x)}if(s){const b=d==="y"?"top":"left",y=d==="y"?"bottom":"right",v=p+u[b],x=p-u[y];p=K0(v,p,x)}const g=a.fn({...t,[h]:f,[d]:p});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[h]:i,[d]:s}}}}}},dX=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}=Eo(e,t),u={x:n,y:r},d=qi(o),h=jw(d);let f=u[h],p=u[d];const g=Eo(a,t),b=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const x=h==="y"?"height":"width",_=i.reference[h]-i.floating[x]+b.mainAxis,w=i.reference[h]+i.reference[x]-b.mainAxis;f<_?f=_:f>w&&(f=w)}if(c){var y,v;const x=h==="y"?"width":"height",_=["top","left"].includes(ci(o)),w=i.reference[d]-i.floating[x]+(_&&((y=s.offset)==null?void 0:y[d])||0)+(_?0:b.crossAxis),S=i.reference[d]+i.reference[x]+(_?0:((v=s.offset)==null?void 0:v[d])||0)-(_?b.crossAxis:0);p<w?p=w:p>S&&(p=S)}return{[h]:f,[d]:p}}}},fX=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}=Eo(e,t),u=await Gl(t,c),d=ci(o),h=cc(o),f=qi(o)==="y",{width:p,height:g}=i.floating;let b,y;d==="top"||d==="bottom"?(b=d,y=h===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,b=h==="end"?"top":"bottom");const v=g-u.top-u.bottom,x=p-u.left-u.right,_=li(g-u[b],v),w=li(p-u[y],x),S=!t.middlewareData.shift;let R=_,P=w;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(R=v),S&&!h){const T=gn(u.left,0),I=gn(u.right,0),A=gn(u.top,0),W=gn(u.bottom,0);f?P=p-2*(T!==0||I!==0?T+I:gn(u.left,u.right)):R=g-2*(A!==0||W!==0?A+W:gn(u.top,u.bottom))}await l({...t,availableWidth:P,availableHeight:R});const O=await s.getDimensions(a.floating);return p!==O.width||g!==O.height?{reset:{rects:!0}}:{}}}};function Eg(){return typeof window<"u"}function uc(e){return yD(e)?(e.nodeName||"").toLowerCase():"#document"}function gr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ao(e){var t;return(t=(yD(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function yD(e){return Eg()?e instanceof Node||e instanceof gr(e).Node:!1}function vn(e){return Eg()?e instanceof Element||e instanceof gr(e).Element:!1}function Ro(e){return Eg()?e instanceof HTMLElement||e instanceof gr(e).HTMLElement:!1}function mR(e){return!Eg()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof gr(e).ShadowRoot}function _d(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=qr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function hX(e){return["table","td","th"].includes(uc(e))}function Rg(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function zw(e){const t=Bw(),n=vn(e)?qr(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 pX(e){let t=Yi(e);for(;Ro(t)&&!ql(t);){if(zw(t))return t;if(Rg(t))return null;t=Yi(t)}return null}function Bw(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ql(e){return["html","body","#document"].includes(uc(e))}function qr(e){return gr(e).getComputedStyle(e)}function kg(e){return vn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Yi(e){if(uc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||mR(e)&&e.host||Ao(e);return mR(t)?t.host:t}function vD(e){const t=Yi(e);return ql(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ro(t)&&_d(t)?t:vD(t)}function Uu(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=vD(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=gr(o);if(i){const a=Q0(s);return t.concat(s,s.visualViewport||[],_d(o)?o:[],a&&n?Uu(a):[])}return t.concat(o,Uu(o,[],n))}function Q0(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function xD(e){const t=qr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ro(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Wu(n)!==i||Wu(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function Vw(e){return vn(e)?e:e.contextElement}function ll(e){const t=Vw(e);if(!Ro(t))return xo(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=xD(t);let s=(i?Wu(n.width):n.width)/r,a=(i?Wu(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const gX=xo(0);function wD(e){const t=gr(e);return!Bw()||!t.visualViewport?gX:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function mX(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==gr(e)?!1:t}function da(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Vw(e);let s=xo(1);t&&(r?vn(r)&&(s=ll(r)):s=ll(e));const a=mX(i,n,r)?wD(i):xo(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=gr(i),f=r&&vn(r)?gr(r):r;let p=h,g=Q0(p);for(;g&&r&&f!==p;){const b=ll(g),y=g.getBoundingClientRect(),v=qr(g),x=y.left+(g.clientLeft+parseFloat(v.paddingLeft))*b.x,_=y.top+(g.clientTop+parseFloat(v.paddingTop))*b.y;l*=b.x,c*=b.y,u*=b.x,d*=b.y,l+=x,c+=_,p=gr(g),g=Q0(p)}}return mp({width:u,height:d,x:l,y:c})}function Hw(e,t){const n=kg(e).scrollLeft;return t?t.left+n:da(Ao(e)).left+n}function SD(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:Hw(e,r)),i=r.top+t.scrollTop;return{x:o,y:i}}function bX(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=Ao(r),a=t?Rg(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=xo(1);const u=xo(0),d=Ro(r);if((d||!d&&!i)&&((uc(r)!=="body"||_d(s))&&(l=kg(r)),Ro(r))){const f=da(r);c=ll(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const h=s&&!d&&!i?SD(s,l,!0):xo(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 yX(e){return Array.from(e.getClientRects())}function vX(e){const t=Ao(e),n=kg(e),r=e.ownerDocument.body,o=gn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=gn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Hw(e);const a=-n.scrollTop;return qr(r).direction==="rtl"&&(s+=gn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function xX(e,t){const n=gr(e),r=Ao(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=Bw();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function wX(e,t){const n=da(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Ro(e)?ll(e):xo(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 bR(e,t,n){let r;if(t==="viewport")r=xX(e,n);else if(t==="document")r=vX(Ao(e));else if(vn(t))r=wX(t,n);else{const o=wD(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return mp(r)}function CD(e,t){const n=Yi(e);return n===t||!vn(n)||ql(n)?!1:qr(n).position==="fixed"||CD(n,t)}function SX(e,t){const n=t.get(e);if(n)return n;let r=Uu(e,[],!1).filter(a=>vn(a)&&uc(a)!=="body"),o=null;const i=qr(e).position==="fixed";let s=i?Yi(e):e;for(;vn(s)&&!ql(s);){const a=qr(s),l=zw(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||_d(s)&&!l&&CD(e,s))?r=r.filter(u=>u!==s):o=a,s=Yi(s)}return t.set(e,r),r}function CX(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?Rg(t)?[]:SX(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const d=bR(t,u,o);return c.top=gn(d.top,c.top),c.right=li(d.right,c.right),c.bottom=li(d.bottom,c.bottom),c.left=gn(d.left,c.left),c},bR(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function _X(e){const{width:t,height:n}=xD(e);return{width:t,height:n}}function EX(e,t,n){const r=Ro(t),o=Ao(t),i=n==="fixed",s=da(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=xo(0);if(r||!r&&!i)if((uc(t)!=="body"||_d(o))&&(a=kg(t)),r){const h=da(t,!0,i,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else o&&(l.x=Hw(o));const c=o&&!r&&!i?SD(o,a):xo(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 Cb(e){return qr(e).position==="static"}function yR(e,t){if(!Ro(e)||qr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ao(e)===n&&(n=n.ownerDocument.body),n}function _D(e,t){const n=gr(e);if(Rg(e))return n;if(!Ro(e)){let o=Yi(e);for(;o&&!ql(o);){if(vn(o)&&!Cb(o))return o;o=Yi(o)}return n}let r=yR(e,t);for(;r&&hX(r)&&Cb(r);)r=yR(r,t);return r&&ql(r)&&Cb(r)&&!zw(r)?n:r||pX(e)||n}const RX=async function(e){const t=this.getOffsetParent||_D,n=this.getDimensions,r=await n(e.floating);return{reference:EX(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function kX(e){return qr(e).direction==="rtl"}const PX={convertOffsetParentRelativeRectToViewportRelativeRect:bX,getDocumentElement:Ao,getClippingRect:CX,getOffsetParent:_D,getElementRects:RX,getClientRects:yX,getDimensions:_X,getScale:ll,isElement:vn,isRTL:kX};function ED(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function MX(e,t){let n=null,r;const o=Ao(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=Vf(d),g=Vf(o.clientWidth-(u+h)),b=Vf(o.clientHeight-(d+f)),y=Vf(u),x={rootMargin:-p+"px "+-g+"px "+-b+"px "+-y+"px",threshold:gn(0,li(1,l))||1};let _=!0;function w(S){const R=S[0].intersectionRatio;if(R!==l){if(!_)return s();R?s(!1,R):r=setTimeout(()=>{s(!1,1e-7)},1e3)}R===1&&!ED(c,e.getBoundingClientRect())&&s(),_=!1}try{n=new IntersectionObserver(w,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(w,x)}n.observe(e)}return s(!0),i}function RD(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=Vw(e),u=o||i?[...c?Uu(c):[],...Uu(t)]:[];u.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const d=c&&a?MX(c,n):null;let h=-1,f=null;s&&(f=new ResizeObserver(y=>{let[v]=y;v&&v.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var x;(x=f)==null||x.observe(t)})),n()}),c&&!l&&f.observe(c),f.observe(t));let p,g=l?da(e):null;l&&b();function b(){const y=da(e);g&&!ED(g,y)&&n(),g=y,p=requestAnimationFrame(b)}return n(),()=>{var y;u.forEach(v=>{o&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),d==null||d(),(y=f)==null||y.disconnect(),f=null,l&&cancelAnimationFrame(p)}}const _b=Gl,OX=cX,TX=uX,DX=sX,IX=fX,AX=aX,vR=iX,NX=dX,FX=(e,t,n)=>{const r=new Map,o={platform:PX,...n},i={...o.platform,_c:r};return oX(e,t,{...o,platform:i})};var Eh=typeof document<"u"?E.useLayoutEffect:E.useEffect;function bp(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(!bp(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)&&!bp(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function kD(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xR(e,t){const n=kD(e);return Math.round(t*n)/n}function Eb(e){const t=C.useRef(e);return Eh(()=>{t.current=e}),t}function PD(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]=C.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,f]=C.useState(r);bp(h,r)||f(r);const[p,g]=C.useState(null),[b,y]=C.useState(null),v=C.useCallback(j=>{j!==S.current&&(S.current=j,g(j))},[]),x=C.useCallback(j=>{j!==R.current&&(R.current=j,y(j))},[]),_=i||p,w=s||b,S=C.useRef(null),R=C.useRef(null),P=C.useRef(u),O=l!=null,T=Eb(l),I=Eb(o),A=Eb(c),W=C.useCallback(()=>{if(!S.current||!R.current)return;const j={placement:t,strategy:n,middleware:h};I.current&&(j.platform=I.current),FX(S.current,R.current,j).then(H=>{const M={...H,isPositioned:A.current!==!1};$.current&&!bp(P.current,M)&&(P.current=M,na.flushSync(()=>{d(M)}))})},[h,t,n,I,A]);Eh(()=>{c===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,d(j=>({...j,isPositioned:!1})))},[c]);const $=C.useRef(!1);Eh(()=>($.current=!0,()=>{$.current=!1}),[]),Eh(()=>{if(_&&(S.current=_),w&&(R.current=w),_&&w){if(T.current)return T.current(_,w,W);W()}},[_,w,W,T,O]);const D=C.useMemo(()=>({reference:S,floating:R,setReference:v,setFloating:x}),[v,x]),F=C.useMemo(()=>({reference:_,floating:w}),[_,w]),N=C.useMemo(()=>{const j={position:n,left:0,top:0};if(!F.floating)return j;const H=xR(F.floating,u.x),M=xR(F.floating,u.y);return a?{...j,transform:"translate("+H+"px, "+M+"px)",...kD(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:M}},[n,a,F.floating,u.x,u.y]);return C.useMemo(()=>({...u,update:W,refs:D,elements:F,floatingStyles:N}),[u,W,D,F,N])}const jX=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?vR({element:r.current,padding:o}).fn(n):{}:r?vR({element:r,padding:o}).fn(n):{}}}},Ww=(e,t)=>({...OX(e),options:[e,t]}),MD=(e,t)=>({...TX(e),options:[e,t]}),LX=(e,t)=>({...NX(e),options:[e,t]}),OD=(e,t)=>({...DX(e),options:[e,t]}),TD=(e,t)=>({...IX(e),options:[e,t]}),$X=(e,t)=>({...AX(e),options:[e,t]}),zX=(e,t)=>({...jX(e),options:[e,t]});var BX="Arrow",DD=C.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return m.jsx(ge.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});DD.displayName=BX;var VX=DD;function Pg(e){const[t,n]=C.useState(void 0);return on(()=>{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 Uw="Popper",[ID,No]=Xt(Uw),[HX,AD]=ID(Uw),ND=e=>{const{__scopePopper:t,children:n}=e,[r,o]=C.useState(null);return m.jsx(HX,{scope:t,anchor:r,onAnchorChange:o,children:n})};ND.displayName=Uw;var FD="PopperAnchor",jD=C.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=AD(FD,n),s=C.useRef(null),a=Te(t,s);return C.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:m.jsx(ge.div,{...o,ref:a})});jD.displayName=FD;var Gw="PopperContent",[WX,UX]=ID(Gw),LD=C.forwardRef((e,t)=>{var B,G,X,J,ne,Z;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,b=AD(Gw,n),[y,v]=C.useState(null),x=Te(t,oe=>v(oe)),[_,w]=C.useState(null),S=Pg(_),R=(S==null?void 0:S.width)??0,P=(S==null?void 0:S.height)??0,O=r+(i!=="center"?"-"+i:""),T=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},I=Array.isArray(c)?c:[c],A=I.length>0,W={padding:T,boundary:I.filter(qX),altBoundary:A},{refs:$,floatingStyles:D,placement:F,isPositioned:N,middlewareData:j}=PD({strategy:"fixed",placement:O,whileElementsMounted:(...oe)=>RD(...oe,{animationFrame:f==="always"}),elements:{reference:b.anchor},middleware:[Ww({mainAxis:o+P,alignmentAxis:s}),l&&MD({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?LX():void 0,...W}),l&&OD({...W}),TD({...W,apply:({elements:oe,rects:ee,availableWidth:de,availableHeight:fe})=>{const{width:xe,height:pe}=ee.reference,be=oe.floating.style;be.setProperty("--radix-popper-available-width",`${de}px`),be.setProperty("--radix-popper-available-height",`${fe}px`),be.setProperty("--radix-popper-anchor-width",`${xe}px`),be.setProperty("--radix-popper-anchor-height",`${pe}px`)}}),_&&zX({element:_,padding:a}),YX({arrowWidth:R,arrowHeight:P}),h&&$X({strategy:"referenceHidden",...W})]}),[H,M]=BD(F),V=Kt(p);on(()=>{N&&(V==null||V())},[N,V]);const L=(B=j.arrow)==null?void 0:B.x,k=(G=j.arrow)==null?void 0:G.y,U=((X=j.arrow)==null?void 0:X.centerOffset)!==0,[q,Y]=C.useState();return on(()=>{y&&Y(window.getComputedStyle(y).zIndex)},[y]),m.jsx("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:N?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:q,"--radix-popper-transform-origin":[(J=j.transformOrigin)==null?void 0:J.x,(ne=j.transformOrigin)==null?void 0:ne.y].join(" "),...((Z=j.hide)==null?void 0:Z.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(WX,{scope:n,placedSide:H,onArrowChange:w,arrowX:L,arrowY:k,shouldHideArrow:U,children:m.jsx(ge.div,{"data-side":H,"data-align":M,...g,ref:x,style:{...g.style,animation:N?void 0:"none"}})})})});LD.displayName=Gw;var $D="PopperArrow",GX={top:"bottom",right:"left",bottom:"top",left:"right"},zD=C.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=UX($D,r),s=GX[i.placedSide];return m.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:m.jsx(VX,{...o,ref:n,style:{...o.style,display:"block"}})})});zD.displayName=$D;function qX(e){return e!==null}var YX=e=>({name:"transformOrigin",options:e,fn(t){var b,y,v;const{placement:n,rects:r,middlewareData:o}=t,s=((b=o.arrow)==null?void 0:b.centerOffset)!==0,a=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[c,u]=BD(n),d={start:"0%",center:"50%",end:"100%"}[u],h=(((y=o.arrow)==null?void 0:y.x)??0)+a/2,f=(((v=o.arrow)==null?void 0:v.y)??0)+l/2;let p="",g="";return c==="bottom"?(p=s?d:`${h}px`,g=`${-l}px`):c==="top"?(p=s?d:`${h}px`,g=`${r.floating.height+l}px`):c==="right"?(p=`${-l}px`,g=s?d:`${f}px`):c==="left"&&(p=`${r.floating.width+l}px`,g=s?d:`${f}px`),{data:{x:p,y:g}}}});function BD(e){const[t,n="center"]=e.split("-");return[t,n]}var Ed=ND,dc=jD,Rd=LD,kd=zD,KX="Portal",Pd=C.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=C.useState(!1);on(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?mn.createPortal(m.jsx(ge.div,{...r,ref:t}),s):null});Pd.displayName=KX;function XX(e,t=globalThis==null?void 0:globalThis.document){const n=Kt(e);C.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 QX="DismissableLayer",Z0="dismissableLayer.update",ZX="dismissableLayer.pointerDownOutside",JX="dismissableLayer.focusOutside",wR,VD=C.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ea=C.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=e,c=C.useContext(VD),[u,d]=C.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=C.useState({}),p=Te(t,R=>d(R)),g=Array.from(c.layers),[b]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=g.indexOf(b),v=u?g.indexOf(u):-1,x=c.layersWithOutsidePointerEventsDisabled.size>0,_=v>=y,w=nQ(R=>{const P=R.target,O=[...c.branches].some(T=>T.contains(P));!_||O||(o==null||o(R),s==null||s(R),R.defaultPrevented||a==null||a())},h),S=rQ(R=>{const P=R.target;[...c.branches].some(T=>T.contains(P))||(i==null||i(R),s==null||s(R),R.defaultPrevented||a==null||a())},h);return XX(R=>{v===c.layers.size-1&&(r==null||r(R),!R.defaultPrevented&&a&&(R.preventDefault(),a()))},h),C.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(wR=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),SR(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=wR)}},[u,h,n,c]),C.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),SR())},[u,c]),C.useEffect(()=>{const R=()=>f({});return document.addEventListener(Z0,R),()=>document.removeEventListener(Z0,R)},[]),m.jsx(ge.div,{...l,ref:p,style:{pointerEvents:x?_?"auto":"none":void 0,...e.style},onFocusCapture:le(e.onFocusCapture,S.onFocusCapture),onBlurCapture:le(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:le(e.onPointerDownCapture,w.onPointerDownCapture)})});Ea.displayName=QX;var eQ="DismissableLayerBranch",tQ=C.forwardRef((e,t)=>{const n=C.useContext(VD),r=C.useRef(null),o=Te(t,r);return C.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),m.jsx(ge.div,{...e,ref:o})});tQ.displayName=eQ;function nQ(e,t=globalThis==null?void 0:globalThis.document){const n=Kt(e),r=C.useRef(!1),o=C.useRef(()=>{});return C.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let l=function(){HD(ZX,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 rQ(e,t=globalThis==null?void 0:globalThis.document){const n=Kt(e),r=C.useRef(!1);return C.useEffect(()=>{const o=i=>{i.target&&!r.current&&HD(JX,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 SR(){const e=new CustomEvent(Z0);document.dispatchEvent(e)}function HD(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?zP(o,i):o.dispatchEvent(i)}var Rb,qw="HoverCard",[WD,vve]=Xt(qw,[No]),Mg=No(),[oQ,Yw]=WD(qw),UD=e=>{const{__scopeHoverCard:t,children:n,open:r,defaultOpen:o,onOpenChange:i,openDelay:s=700,closeDelay:a=300}=e,l=Mg(t),c=C.useRef(0),u=C.useRef(0),d=C.useRef(!1),h=C.useRef(!1),[f=!1,p]=xn({prop:r,defaultProp:o,onChange:i}),g=C.useCallback(()=>{clearTimeout(u.current),c.current=window.setTimeout(()=>p(!0),s)},[s,p]),b=C.useCallback(()=>{clearTimeout(c.current),!d.current&&!h.current&&(u.current=window.setTimeout(()=>p(!1),a))},[a,p]),y=C.useCallback(()=>p(!1),[p]);return C.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(u.current)},[]),m.jsx(oQ,{scope:t,open:f,onOpenChange:p,onOpen:g,onClose:b,onDismiss:y,hasSelectionRef:d,isPointerDownOnContentRef:h,children:m.jsx(Ed,{...l,children:n})})};UD.displayName=qw;var GD="HoverCardTrigger",qD=C.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=Yw(GD,n),i=Mg(n);return m.jsx(dc,{asChild:!0,...i,children:m.jsx(ge.a,{"data-state":o.open?"open":"closed",...r,ref:t,onPointerEnter:le(e.onPointerEnter,vp(o.onOpen)),onPointerLeave:le(e.onPointerLeave,vp(o.onClose)),onFocus:le(e.onFocus,o.onOpen),onBlur:le(e.onBlur,o.onClose),onTouchStart:le(e.onTouchStart,s=>s.preventDefault())})})});qD.displayName=GD;var iQ="HoverCardPortal",[xve,sQ]=WD(iQ,{forceMount:void 0}),yp="HoverCardContent",YD=C.forwardRef((e,t)=>{const n=sQ(yp,e.__scopeHoverCard),{forceMount:r=n.forceMount,...o}=e,i=Yw(yp,e.__scopeHoverCard);return m.jsx(Yt,{present:r||i.open,children:m.jsx(aQ,{"data-state":i.open?"open":"closed",...o,onPointerEnter:le(e.onPointerEnter,vp(i.onOpen)),onPointerLeave:le(e.onPointerLeave,vp(i.onClose)),ref:t})})});YD.displayName=yp;var aQ=C.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,...a}=e,l=Yw(yp,n),c=Mg(n),u=C.useRef(null),d=Te(t,u),[h,f]=C.useState(!1);return C.useEffect(()=>{if(h){const p=document.body;return Rb=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=Rb,p.style.webkitUserSelect=Rb}}},[h]),C.useEffect(()=>{if(u.current){const p=()=>{f(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var b;((b=document.getSelection())==null?void 0:b.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]),C.useEffect(()=>{u.current&&uQ(u.current).forEach(g=>g.setAttribute("tabindex","-1"))}),m.jsx(Ea,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:s,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:le(i,p=>{p.preventDefault()}),onDismiss:l.onDismiss,children:m.jsx(Rd,{...c,...a,onPointerDown:le(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)"}})})}),lQ="HoverCardArrow",cQ=C.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=Mg(n);return m.jsx(kd,{...o,...r,ref:t})});cQ.displayName=lQ;function vp(e){return t=>t.pointerType==="touch"?void 0:e()}function uQ(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 dQ=UD,fQ=qD,KD=YD;const Md=dQ,Od=fQ,fc=C.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>m.jsx(KD,{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}));fc.displayName=KD.displayName;function XD({card:e}){const{setCardInfo:t}=Bt();return m.jsxs(Md,{openDelay:0,children:[m.jsx(Od,{children:m.jsx(sO,{className:"size-4 text-muted-foreground/40"})}),m.jsx(fc,{align:"start",className:"w-[300px]",onMouseDown:n=>n.stopPropagation(),children:m.jsx(vo,{type:"textarea",text:e.info||"",onSave:n=>t(e.id,n),children:m.jsx("p",{className:"text-sm text-muted-foreground",children:e.info||"Double-click to add info"})})})]})}function hQ({card:e,renderFilterInfo:t}){var p,g,b,y,v,x,_,w,S,R,P,O,T,I,A,W;se($=>$.themeStyle);const{data:n,isLoading:r}=Bi(e),o=(n==null?void 0:n.records)||[],i=se($=>$.isDashboardEditing),{getCurrency:s,getLocale:a}=gD(e),l=(g=(p=e.preferences)==null?void 0:p.formatNumber)==null?void 0:g.colorRanges,{metricKeys:c}=Qt(o||[]),u=(b=o==null?void 0:o[0])==null?void 0:b[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 m.jsx("div",{className:"flex min-w-fit grow flex-col overflow-auto",children:m.jsxs("div",{className:"grow",children:[h?m.jsx("div",{className:"",children:m.jsxs("div",{className:ie("flex items-end gap-1.5",{"animate-pulse":r}),children:[m.jsx("p",{style:{color:iw(u,l)},className:"text-3xl font-semibold",children:Pr({number:u,decimalPlaces:((x=(v=e.preferences)==null?void 0:v.formatNumber)==null?void 0:x.decimalPlaces)||0,useSuffix:!!((w=(_=e.preferences)==null?void 0:_.formatNumber)!=null&&w.suffix),customSuffix:((R=(S=e.preferences)==null?void 0:S.formatNumber)==null?void 0:R.suffix)||"",locale:a()||"",currency:s()||""})}),f&&m.jsxs("div",{className:"flex items-end gap-1",children:[m.jsx(mD,{className:"",children:f}),d&&m.jsx("div",{className:"ml-0.5 mr-1 min-w-fit text-sm font-normal text-muted-foreground",children:`from ${Pr({number:d,decimalPlaces:((O=(P=e.preferences)==null?void 0:P.formatNumber)==null?void 0:O.decimalPlaces)||0,useSuffix:!!((I=(T=e.preferences)==null?void 0:T.formatNumber)!=null&&I.suffix),customSuffix:((W=(A=e.preferences)==null?void 0:A.formatNumber)==null?void 0:W.suffix)||"",locale:a()||"",currency:s()||""})}`})]})]})}):m.jsx("div",{className:"flex h-9 items-center justify-center"}),m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsxs(nc,{className:"flex items-center gap-2 text-base font-medium text-muted-foreground",children:[e.title,(i||e.info)&&m.jsx(XD,{card:e})]}),t==null?void 0:t()]})]})})}var pQ="VisuallyHidden",Kw=C.forwardRef((e,t)=>m.jsx(ge.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}}));Kw.displayName=pQ;var gQ=Kw,[Og,wve]=Xt("Tooltip",[No]),Tg=No(),QD="TooltipProvider",mQ=700,J0="tooltip.open",[bQ,Xw]=Og(QD),ZD=e=>{const{__scopeTooltip:t,delayDuration:n=mQ,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,[s,a]=C.useState(!0),l=C.useRef(!1),c=C.useRef(0);return C.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),m.jsx(bQ,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:C.useCallback(()=>{window.clearTimeout(c.current),a(!1)},[]),onClose:C.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:C.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:i})};ZD.displayName=QD;var Dg="Tooltip",[yQ,Ig]=Og(Dg),JD=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=Xw(Dg,e.__scopeTooltip),c=Tg(t),[u,d]=C.useState(null),h=Gt(),f=C.useRef(0),p=s??l.disableHoverableContent,g=a??l.delayDuration,b=C.useRef(!1),[y=!1,v]=xn({prop:r,defaultProp:o,onChange:R=>{R?(l.onOpen(),document.dispatchEvent(new CustomEvent(J0))):l.onClose(),i==null||i(R)}}),x=C.useMemo(()=>y?b.current?"delayed-open":"instant-open":"closed",[y]),_=C.useCallback(()=>{window.clearTimeout(f.current),f.current=0,b.current=!1,v(!0)},[v]),w=C.useCallback(()=>{window.clearTimeout(f.current),f.current=0,v(!1)},[v]),S=C.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{b.current=!0,v(!0),f.current=0},g)},[g,v]);return C.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),m.jsx(Ed,{...c,children:m.jsx(yQ,{scope:t,contentId:h,open:y,stateAttribute:x,trigger:u,onTriggerChange:d,onTriggerEnter:C.useCallback(()=>{l.isOpenDelayed?S():_()},[l.isOpenDelayed,S,_]),onTriggerLeave:C.useCallback(()=>{p?w():(window.clearTimeout(f.current),f.current=0)},[w,p]),onOpen:_,onClose:w,disableHoverableContent:p,children:n})})};JD.displayName=Dg;var ev="TooltipTrigger",Qw=C.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Ig(ev,n),i=Xw(ev,n),s=Tg(n),a=C.useRef(null),l=Te(t,a,o.onTriggerChange),c=C.useRef(!1),u=C.useRef(!1),d=C.useCallback(()=>c.current=!1,[]);return C.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),m.jsx(dc,{asChild:!0,...s,children:m.jsx(ge.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:le(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:le(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:le(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:le(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:le(e.onBlur,o.onClose),onClick:le(e.onClick,o.onClose)})})});Qw.displayName=ev;var vQ="TooltipPortal",[Sve,xQ]=Og(vQ,{forceMount:void 0}),Yl="TooltipContent",eI=C.forwardRef((e,t)=>{const n=xQ(Yl,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=Ig(Yl,e.__scopeTooltip);return m.jsx(Yt,{present:r||s.open,children:s.disableHoverableContent?m.jsx(tI,{side:o,...i,ref:t}):m.jsx(wQ,{side:o,...i,ref:t})})}),wQ=C.forwardRef((e,t)=>{const n=Ig(Yl,e.__scopeTooltip),r=Xw(Yl,e.__scopeTooltip),o=C.useRef(null),i=Te(t,o),[s,a]=C.useState(null),{trigger:l,onClose:c}=n,u=o.current,{onPointerInTransitChange:d}=r,h=C.useCallback(()=>{a(null),d(!1)},[d]),f=C.useCallback((p,g)=>{const b=p.currentTarget,y={x:p.clientX,y:p.clientY},v=EQ(y,b.getBoundingClientRect()),x=RQ(y,v),_=kQ(g.getBoundingClientRect()),w=MQ([...x,..._]);a(w),d(!0)},[d]);return C.useEffect(()=>()=>h(),[h]),C.useEffect(()=>{if(l&&u){const p=b=>f(b,u),g=b=>f(b,l);return l.addEventListener("pointerleave",p),u.addEventListener("pointerleave",g),()=>{l.removeEventListener("pointerleave",p),u.removeEventListener("pointerleave",g)}}},[l,u,f,h]),C.useEffect(()=>{if(s){const p=g=>{const b=g.target,y={x:g.clientX,y:g.clientY},v=(l==null?void 0:l.contains(b))||(u==null?void 0:u.contains(b)),x=!PQ(y,s);v?h():x&&(h(),c())};return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[l,u,s,c,h]),m.jsx(tI,{...e,ref:i})}),[SQ,CQ]=Og(Dg,{isInside:!1}),tI=C.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=Ig(Yl,n),c=Tg(n),{onClose:u}=l;return C.useEffect(()=>(document.addEventListener(J0,u),()=>document.removeEventListener(J0,u)),[u]),C.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]),m.jsx(Ea,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:m.jsxs(Rd,{"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:[m.jsx(Ex,{children:r}),m.jsx(SQ,{scope:n,isInside:!0,children:m.jsx(gQ,{id:l.contentId,role:"tooltip",children:o||r})})]})})});eI.displayName=Yl;var nI="TooltipArrow",_Q=C.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Tg(n);return CQ(nI,n).isInside?null:m.jsx(kd,{...o,...r,ref:t})});_Q.displayName=nI;function EQ(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 RQ(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 kQ(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 PQ(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 MQ(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),OQ(t)}function OQ(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 TQ=ZD,DQ=JD,IQ=Qw,rI=eI;const AQ=TQ,oI=DQ,iI=IQ,Zw=C.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(rI,{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}));Zw.displayName=rI.displayName;function xp({card:e,isLoading:t,data:n}){var h,f;const r=n||[],{keys:o}=Qt(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}=Bt(),{setCard:c}=xd();function u(){var y;if(t)return m.jsxs("div",{className:"space-y-2",children:[m.jsx(rl,{className:"h-3 w-full animate-pulse bg-muted"}),m.jsx(rl,{className:"h-3 w-3/4 animate-pulse bg-muted"}),m.jsx(rl,{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]],b=m.jsx("div",{dangerouslySetInnerHTML:{__html:g}});return m.jsx("div",{className:"text-sm text-foreground/80 hover:cursor-text",onMouseDown:v=>v.stopPropagation(),children:b})}function d(){const p=(e==null?void 0:e.description)||"";return m.jsx("div",{onMouseDown:g=>g.stopPropagation(),children:m.jsx(vo,{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:m.jsx("div",{className:"text-sm text-foreground/70 hover:cursor-text",dangerouslySetInnerHTML:{__html:p}})})})}return m.jsxs(m.Fragment,{children:[!a&&d(),a===!0&&u()]})}const CR=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,_R=Ml,Jw=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return _R(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=CR(u)||CR(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,b]=p;return Array.isArray(b)?b.includes({...i,...a}[g]):{...i,...a}[g]===b})?[...c,d,h]:c},[]);return _R(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},Gu=Jw("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"}}),qt=C.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?si:"button";return m.jsx(s,{className:ie(Gu({variant:t,size:n,className:e})),ref:i,...o})});qt.displayName="Button";var NQ="Separator",ER="horizontal",FQ=["horizontal","vertical"],sI=C.forwardRef((e,t)=>{const{decorative:n,orientation:r=ER,...o}=e,i=jQ(r)?r:ER,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return m.jsx(ge.div,{"data-orientation":i,...a,...o,ref:t})});sI.displayName=NQ;function jQ(e){return FQ.includes(e)}var aI=sI;const Ag=C.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>m.jsx(aI,{ref:o,decorative:n,orientation:t,className:ie("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));Ag.displayName=aI.displayName;function LQ(){var g,b;const e=se(y=>y.themeStyle),t=se(y=>y.filterValues),n=se(y=>y.dashboard.filters),r=se(y=>y.filteringCards),o=se(y=>y.selectedSheetId),{removeFilterValues:i,removeFilteringCard:s,setFilterValues:a,setFilteringCards:l}=Bt(),c=n==null?void 0:n.filter(y=>y.sheetId===o||!y.sheetId),u=t==null?void 0:t.filter(y=>(c==null?void 0:c.some(v=>v.id===y.filterId))||y.filterId.endsWith(o));if(!u||u.length===0)return null;const d=u.map(y=>{const v=n==null?void 0:n.find(x=>x.id===y.filterId);return{filterId:y.filterId,name:(v==null?void 0:v.title)||y.name,values:y.values}});function h(y){return y instanceof Date?y.toLocaleDateString():y}function f(y){const v=r==null?void 0:r.find(x=>y.filterId.startsWith(x.id));v&&s(v),i(y.filterId)}function p(y){var v,x;return m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{style:{borderRadius:(x=(v=e==null?void 0:e.chart)==null?void 0:v.options)==null?void 0:x.borderRadius},className:"flex w-fit items-center gap-2 bg-muted-foreground px-2 py-1 font-semibold text-muted",children:[m.jsx("span",{className:"break-words",children:y.name}),m.jsx(Ca,{onClick:()=>f(y),className:"size-3 text-muted hover:cursor-pointer hover:text-background"})]}),m.jsx("div",{className:"flex flex-wrap gap-1",children:y.values.map(_=>{var w,S;return m.jsx("span",{style:{borderRadius:(S=(w=e==null?void 0:e.chart)==null?void 0:w.options)==null?void 0:S.borderRadius},className:"inline-block",children:h(_)},_==null?void 0:_.toString())})})]})}return m.jsxs(Md,{openDelay:100,children:[m.jsx(Od,{children:m.jsx(oO,{className:"z-100 size-3.5 text-muted-foreground/40"})}),m.jsxs(fc,{style:{borderRadius:(b=(g=e==null?void 0:e.chart)==null?void 0:g.options)==null?void 0:b.borderRadius},className:"relative flex min-h-fit w-[300px] flex-col px-0 text-xs",align:"start",children:[m.jsx(rO,{onClick:()=>{l([]),a([])},className:"absolute right-4 size-3.5 text-muted-foreground/40 hover:cursor-pointer"}),m.jsx("div",{className:"h-fit max-h-[150px] min-h-0 grow overflow-auto",children:d==null?void 0:d.map(y=>m.jsxs("div",{className:"px-5",children:[p(y),m.jsx(Ag,{className:"my-2"})]},y.name))})]})]})}const $Q=C.forwardRef(({className:e,containerClassName:t,containerStyle:n,...r},o)=>m.jsx("div",{style:n,className:ie("relative w-full overflow-auto",t),children:m.jsx("table",{ref:o,className:ie("w-full caption-bottom text-sm",e),...r})}));$Q.displayName="Table";const e1=C.forwardRef(({className:e,...t},n)=>m.jsx("thead",{ref:n,className:ie("[&_tr]:border-b",e),...t}));e1.displayName="TableHeader";const t1=C.forwardRef(({className:e,...t},n)=>m.jsx("tbody",{ref:n,className:ie("[&_tr:last-child]:border-0",e),...t}));t1.displayName="TableBody";const zQ=C.forwardRef(({className:e,...t},n)=>m.jsx("tfoot",{ref:n,className:ie("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));zQ.displayName="TableFooter";const mu=C.forwardRef(({className:e,...t},n)=>m.jsx("tr",{ref:n,className:ie("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));mu.displayName="TableRow";const n1=C.forwardRef(({className:e,...t},n)=>m.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}));n1.displayName="TableHead";const r1=C.forwardRef(({className:e,...t},n)=>m.jsx("td",{ref:n,className:ie("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));r1.displayName="TableCell";const BQ=C.forwardRef(({className:e,...t},n)=>m.jsx("caption",{ref:n,className:ie("mt-4 text-sm text-muted-foreground",e),...t}));BQ.displayName="TableCaption";/**
261
261
  * table-core
262
262
  *
263
263
  * Copyright (c) TanStack
@@ -361,7 +361,7 @@ prismjs/prism.js:
361
361
  * @namespace
362
362
  * @public
363
363
  *)
364
- */function Pge({message:e,onAddToDashboard:t}){var i;const n=(i=e==null?void 0:e.parts)==null?void 0:i.filter(s=>s.type==="tool-invocation"&&s.toolInvocation.toolName==="getData"&&s.toolInvocation.state==="result");if(!n)return null;const o=n.map(s=>s.toolInvocation).map(s=>{const a=s.result;if(a.status==="error")return null;const l=a.data.records;return{chartCfg:Fw({cardType:s.args.chartType,data:l}),chartTitle:s.args.chartTitle,chartType:s.args.chartType,sql:s.args.sql,data:l,connectionId:s.args.connectionId}}).filter(s=>s!==null);return!o||o.length===0?null:m.jsx("div",{className:"",children:o.map((s,a)=>m.jsxs("div",{className:"group relative isolate flex h-[350px] w-[99%] grow flex-col",children:[m.jsxs(qt,{className:"invisible absolute right-0 top-0 z-10 h-8 p-2 group-hover:visible",onClick:()=>{t==null||t({sql:s.sql,data:s.data,cardCfg:s.chartCfg,cardTitle:s.chartTitle,connectionId:s.connectionId,cardType:s.chartType})},size:"sm",variant:"outline",children:[m.jsx(pg,{className:"mr-1 size-4"}),"Add"]}),m.jsx(u1,{cfg:s.chartCfg})]},a))})}function Mge({message:e,showTools:t}){var r;if(!t)return null;const n=(r=e==null?void 0:e.parts)==null?void 0:r.filter(o=>o.type==="tool-invocation");return m.jsx("div",{className:"space-y-3",children:n==null?void 0:n.map((o,i)=>{const s=o.toolInvocation;return m.jsxs(Nce,{children:[m.jsxs(Fce,{className:"rounded-md bg-green-200 p-1 px-2 font-mono text-xs text-black",children:[m.jsx("span",{className:"font-bold",children:"Tool:"})," ",s.toolName]}),m.jsx(jce,{className:"mt-2 font-mono text-xs",children:m.jsxs("div",{className:"space-y-2 px-2",children:[m.jsxs("div",{className:"space-y-1",children:[m.jsx("span",{children:"Args:"}),m.jsx(Dp,{language:"json",code:JSON.stringify(s.args,null,2)})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("span",{children:"Result:"}),m.jsx(Dp,{language:"json",code:JSON.stringify(s.result,null,2)})]})]})})]},i)})})}function Oge({message:e}){return e.role!=="user"?null:m.jsxs("div",{className:"rounded-md bg-muted/50 p-3 text-sm",children:[m.jsx(vB,{className:"float-left mr-2 size-4"}),m.jsx("div",{children:e.content})]})}function Tge({message:e}){if(e.role!=="system")return null;const t=e.content.split("|"),n=t[0],r=t[1]||"{}",o=JSON.parse(r);return m.jsxs("div",{className:"space-y-1",children:[m.jsxs("div",{children:[m.jsx("span",{className:"font-bold",children:"System Message:"})," ",n]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("span",{className:"font-mono text-xs",children:"Scope:"}),m.jsx(Dp,{language:"json",code:JSON.stringify(o,null,2)})]})]})}function Dge({message:e,handleRun:t}){if(e.role!=="assistant")return null;const n={p:({node:r,...o})=>m.jsx("p",{className:"text-sm",...o}),code:({node:r,...o})=>{var s,a;const i=(a=(s=r==null?void 0:r.children)==null?void 0:s[0])==null?void 0:a.value;return i&&/^#([0-9a-fA-F]{6})$/.test(i)?m.jsx("code",{className:"rounded-md bg-muted px-2 py-1 text-xs",style:{backgroundColor:i},...o}):m.jsx("code",{className:"rounded-md bg-muted px-2 py-1 text-xs",...o})},pre:r=>m.jsx(Ige,{...r,handleRun:t}),li:({node:r,...o})=>m.jsx("li",{className:"my-2 list-outside pl-4 text-sm",...o})};return m.jsx(vpe,{components:n,children:e.content.replace(/DuckDB/gi,"Semaphor")})}function e4({status:e,isLoading:t}){return t?m.jsx("div",{className:"flex items-center text-xs text-muted-foreground",children:e}):null}function t4({messages:e,showTools:t=!1,showSystemMessage:n=!1,handleRun:r,onAddToDashboard:o}){return e==null?void 0:e.map(i=>m.jsxs("div",{className:ie("relative my-4 space-y-4 text-sm text-foreground/80"),children:[m.jsx(Oge,{message:i}),n&&m.jsx(Tge,{message:i}),m.jsx(Mge,{message:i,showTools:t}),m.jsx(Pge,{onAddToDashboard:o,message:i}),m.jsx(Dge,{message:i,handleRun:r})]},i.id))}function Ige({children:e,handleRun:t}){const n=se(a=>a.isVisualEditing),[r,o]=E.useState(!1);E.useRef(null);const i=()=>{navigator.clipboard.writeText(s).then(()=>{o(!0),setTimeout(()=>o(!1),2e3)})},s=Qv(e);return m.jsxs("pre",{className:"relative my-2 space-y-2 rounded-md bg-muted/50",children:[m.jsxs("div",{className:"float-right m-1.5",children:[m.jsx(qt,{className:"h-8 p-2 text-xs text-muted-foreground hover:text-foreground",onClick:i,size:"sm",variant:"ghost",children:r?m.jsx(oc,{className:"size-3"}):m.jsx(eO,{className:"size-3"})}),n&&m.jsx(qt,{className:"h-8 p-2 text-muted-foreground hover:text-foreground",onClick:()=>t==null?void 0:t(s),size:"sm",variant:"ghost",children:m.jsx(lO,{className:"size-3"})})]}),m.jsx(Dp,{code:s})]})}function Qv(e){return typeof e=="string"?e:Array.isArray(e)?e.map(Qv).join(""):E.isValidElement(e)?Qv(e.props.children):""}const Dp=({code:e,language:t="sql"})=>{const n=se(r=>r.theme);return m.jsx(kge,{code:e,language:t,theme:n==="dark"?Xv.vsDark:Xv.vsLight,children:({className:r,style:o,tokens:i,getLineProps:s,getTokenProps:a})=>m.jsx("pre",{className:`${r} border-1 whitespace-pre-wrap rounded-md border border-muted p-2 text-xs`,style:{...o},children:i.map((l,c)=>m.jsx("div",{...s({line:l}),children:l.map((u,d)=>m.jsx("span",{...a({token:u})},d))},c))})})};function n4(e,t){return t||(e==="ready"?"":e==="error"?"Error":e==="streaming"?"":"Thinking...")}function Age(e,t){return e.some(n=>n.tableName&&n.tableName===t.tableName||n.datamodelName&&n.datamodelName===t.datamodelName)}function Nge(e){return e.filter((n,r,o)=>r===o.findIndex(i=>i.tableName===n.tableName&&i.datamodelName===n.datamodelName))}function Fge(e,t){return e.filter(n=>!(n.connectionId===t.connectionId&&n.tableName===t.tableName&&n.datamodelName===t.datamodelName))}const r4=E.forwardRef(({input:e,setInput:t,handleInputChange:n,handleSubmit:r,isLoading:o,stop:i},s)=>{const[a,l]=E.useState(2),c=5,u=h=>{const p=h.target.rows;h.target.rows=1;const g=Math.floor(h.target.scrollHeight/24);g===p&&(h.target.rows=g),g>=c&&(h.target.rows=c,h.target.scrollTop=h.target.scrollHeight),l(Math.min(g,c)),n(h)},d=h=>{if(h.key==="Enter"){if(h.shiftKey)return;h.preventDefault(),r&&e.trim()!==""&&(r(h),t(""),l(1))}};return m.jsxs("form",{onSubmit:r,className:"flex w-full items-end gap-2 rounded-md border py-3 pl-1 pr-2",children:[m.jsx(nm,{autoFocus:!0,ref:s,placeholder:"Type your question...",className:ie("min-h-7 resize-none border-none focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"),disabled:o,value:e,rows:a,onKeyDown:d,onChange:u}),m.jsxs("div",{className:"mr-2 flex items-center gap-2",children:[o===!0&&m.jsx(qt,{size:"sm",className:"h-9 rounded-full p-2.5",onClick:()=>i(),children:m.jsx(pB,{className:"size-3.5 bg-background"})}),o===!1&&m.jsx(qt,{disabled:o===!1&&!e,size:"sm",className:"h-9 rounded-full p-2.5",onClick:()=>i(),children:m.jsx(cB,{className:"size-4 font-bold"})})]})]})});function jge({handleChatBox:e}){const t=E.useRef(null),[n,r]=E.useState(""),[o,i]=E.useState(!1),s=se(T=>T.dashboard.aiScopeTables),{setSelectedConnectionId:a}=xd(),l=se(T=>T.selectedSheetId),{addFrame:c,setSelectedFrameId:u,setIsDashboardEditing:d}=Bt(),{authToken:h}=xr(),f=Cx(),{messages:p,setMessages:g,reload:b,input:y,setInput:v,status:x,handleInputChange:_,handleSubmit:w,stop:S}=lF({api:"https://semaphor.cloud/api/v1/chat",headers:{Authorization:`Bearer ${h==null?void 0:h.accessToken}`},maxSteps:10,async onToolCall({toolCall:T}){if(T.toolName==="getTables")return r("Initializing..."),{tables:s||[]};if(T.toolName==="getSchemas"&&r("Analyzing..."),T.toolName==="getData"){r("Fetching...");const I=T.args;if(!(I!=null&&I.sql)||!(I!=null&&I.connectionId))return"Please provide sql, connectionId and table";try{return{status:"success",data:await f.fetchQuery({queryKey:["chat",I.connectionId,I.sql],queryFn:()=>qp("https://semaphor.cloud/api/v1/query",(h==null?void 0:h.accessToken)||(h==null?void 0:h.accessToken)||"",{connection_id:I.connectionId,sql:I.sql,cache_config:yx({})})})}}catch(A){return console.log("error",A.message),r("Error fetching data"),{status:"error",message:A.message}}}},onFinish(T,I){r(T.content),I.finishReason==="stop"&&r("")}}),R=()=>{var T;(T=t.current)==null||T.scrollIntoView({behavior:"smooth"})};E.useEffect(()=>{R()},[p]);function P({sql:T,data:I,cardCfg:A,cardTitle:W,connectionId:$,cardType:D}){if(!l)return;const F={id:zi(),title:W||"Title",description:"Description",preferences:{onClickFilter:[{columnIndex:0,expression:""}],chartOptions:{indexAxis:D==="horizontalBar"?"y":"x"}},type:A.type,cfg:A,sql:T,data:I,connectionId:$},N={id:zi(),cards:[F],activeCardId:F.id};d(!0),c(l,N,"start"),u(N.id)}const O=!["ready","error"].includes(x);return m.jsxs("div",{role:"chat-box",className:"flex h-full grow flex-col justify-between break-words rounded-md",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2 px-6 pb-3 pt-6",children:[m.jsxs("div",{className:"flex items-center gap-4",children:[m.jsx(Rt,{className:"flex items-center gap-2 text-xl",children:"Assistant"}),m.jsxs(Md,{openDelay:0,children:[m.jsx(Od,{children:m.jsx(xB,{className:"size-4 text-muted-foreground"})}),m.jsx(fc,{className:"w-70 p-2",children:m.jsx("div",{className:"flex justify-between space-x-2 text-muted-foreground",children:m.jsxs("div",{children:[(s==null?void 0:s.length)===0&&m.jsx("p",{className:"text-sm",children:"No tables in scope"}),m.jsx("div",{className:"space-y-2",children:s==null?void 0:s.map((T,I)=>m.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[m.jsx(yB,{className:"size-3 text-muted-foreground/70"}),m.jsx("span",{children:bP({schemaName:T.schemaName||"",tableName:T.tableName||"",modelName:T.datamodelName||"",connectionType:T.connectionType||""})})]},I))})]})})})]})]}),m.jsxs("div",{className:"flex items-center",children:[m.jsx(qt,{className:"h-7 p-2",size:"sm",variant:"ghost",onClick:()=>{g([]),b()},children:m.jsx(cO,{className:"size-3.5 text-muted-foreground"})}),m.jsx(qt,{className:"h-7 p-2",size:"sm",variant:"ghost",onClick:()=>e(!1),children:m.jsx(Ca,{className:"size-4 text-muted-foreground"})})]})]}),m.jsxs(Zs,{className:"flex flex-1 basis-0 flex-col flex-wrap justify-end px-6 py-3",children:[m.jsxs("div",{className:"pb-4",children:[m.jsx(t4,{messages:p,onAddToDashboard:P}),m.jsx(e4,{status:n4(x,n),isLoading:O}),m.jsx("div",{ref:t})]}),m.jsx(Fd,{orientation:"vertical"})]}),m.jsx("div",{className:"px-6 pb-6",children:m.jsx(r4,{setInput:v,stop:S,input:y,handleInputChange:_,handleSubmit:w,isLoading:O})})]})}const{createElement:Jl,createContext:Lge,forwardRef:o4,useCallback:$n,useContext:i4,useEffect:ea,useImperativeHandle:s4,useLayoutEffect:$ge,useMemo:zge,useRef:Un,useState:hl}=C,Ek=C[`useId${Math.random()}`.slice(0,5)],Bge=$ge,cm=Lge(null);cm.displayName="PanelGroupContext";const ta=Bge,Vge=typeof Ek=="function"?Ek:()=>null;let Hge=0;function bS(e=null){const t=Vge(),n=Un(e||t||null);return n.current===null&&(n.current=""+Hge++),e??n.current}function a4({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:o,forwardedRef:i,id:s,maxSize:a,minSize:l,onCollapse:c,onExpand:u,onResize:d,order:h,style:f,tagName:p="div",...g}){const b=i4(cm);if(b===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:v,getPanelSize:x,getPanelStyle:_,groupId:w,isPanelCollapsed:S,reevaluatePanelConstraints:R,registerPanel:P,resizePanel:O,unregisterPanel:T}=b,I=bS(s),A=Un({callbacks:{onCollapse:c,onExpand:u,onResize:d},constraints:{collapsedSize:n,collapsible:r,defaultSize:o,maxSize:a,minSize:l},id:I,idIsFromProps:s!==void 0,order:h});Un({didLogMissingDefaultSizeWarning:!1}),ta(()=>{const{callbacks:$,constraints:D}=A.current,F={...D};A.current.id=I,A.current.idIsFromProps=s!==void 0,A.current.order=h,$.onCollapse=c,$.onExpand=u,$.onResize=d,D.collapsedSize=n,D.collapsible=r,D.defaultSize=o,D.maxSize=a,D.minSize=l,(F.collapsedSize!==D.collapsedSize||F.collapsible!==D.collapsible||F.maxSize!==D.maxSize||F.minSize!==D.minSize)&&R(A.current,F)}),ta(()=>{const $=A.current;return P($),()=>{T($)}},[h,I,P,T]),s4(i,()=>({collapse:()=>{y(A.current)},expand:$=>{v(A.current,$)},getId(){return I},getSize(){return x(A.current)},isCollapsed(){return S(A.current)},isExpanded(){return!S(A.current)},resize:$=>{O(A.current,$)}}),[y,v,x,S,I,O]);const W=_(A.current,o);return Jl(p,{...g,children:e,className:t,id:s,style:{...W,...f},"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-group-id":w,"data-panel-id":I,"data-panel-size":parseFloat(""+W.flexGrow).toFixed(1)})}const l4=o4((e,t)=>Jl(a4,{...e,forwardedRef:t}));a4.displayName="Panel";l4.displayName="forwardRef(Panel)";let Zv=null,As=null;function Wge(e,t){if(t){const n=(t&h4)!==0,r=(t&p4)!==0,o=(t&g4)!==0,i=(t&m4)!==0;if(n)return o?"se-resize":i?"ne-resize":"e-resize";if(r)return o?"sw-resize":i?"nw-resize":"w-resize";if(o)return"s-resize";if(i)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Uge(){As!==null&&(document.head.removeChild(As),Zv=null,As=null)}function xy(e,t){const n=Wge(e,t);Zv!==n&&(Zv=n,As===null&&(As=document.createElement("style"),document.head.appendChild(As)),As.innerHTML=`*{cursor: ${n}!important;}`)}function c4(e){return e.type==="keydown"}function u4(e){return e.type.startsWith("pointer")}function d4(e){return e.type.startsWith("mouse")}function um(e){if(u4(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(d4(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function Gge(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function qge(e,t,n){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Yge(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Pk(e),b:Pk(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Ve(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:kk(Rk(n.a)),b:kk(Rk(n.b))};if(o.a===o.b){const i=r.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let a=i.length;for(;a--;){const l=i[a];if(l===s.a)return 1;if(l===s.b)return-1}}return Math.sign(o.a-o.b)}const Kge=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Xge(e){var t;const n=getComputedStyle((t=f4(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function Qge(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Xge(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||Kge.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Rk(e){let t=e.length;for(;t--;){const n=e[t];if(Ve(n,"Missing node"),Qge(n))return n}return null}function kk(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Pk(e){const t=[];for(;e;)t.push(e),e=f4(e);return t}function f4(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const h4=1,p4=2,g4=4,m4=8,Zge=Gge()==="coarse";let Gr=[],pl=!1,Si=new Map,dm=new Map;const od=new Set;function Jge(e,t,n,r,o){var i;const{ownerDocument:s}=t,a={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:o},l=(i=Si.get(s))!==null&&i!==void 0?i:0;return Si.set(s,l+1),od.add(a),Ip(),function(){var u;dm.delete(e),od.delete(a);const d=(u=Si.get(s))!==null&&u!==void 0?u:1;if(Si.set(s,d-1),Ip(),d===1&&Si.delete(s),Gr.includes(a)){const h=Gr.indexOf(a);h>=0&&Gr.splice(h,1),vS(),o("up",!0,null)}}}function Mk(e){const{target:t}=e,{x:n,y:r}=um(e);pl=!0,yS({target:t,x:n,y:r}),Ip(),Gr.length>0&&(Ap("down",e),e.preventDefault(),e.stopPropagation())}function $c(e){const{x:t,y:n}=um(e);if(pl&&e.buttons===0&&(pl=!1,Ap("up",e)),!pl){const{target:r}=e;yS({target:r,x:t,y:n})}Ap("move",e),vS(),Gr.length>0&&e.preventDefault()}function Va(e){const{target:t}=e,{x:n,y:r}=um(e);dm.clear(),pl=!1,Gr.length>0&&e.preventDefault(),Ap("up",e),yS({target:t,x:n,y:r}),vS(),Ip()}function yS({target:e,x:t,y:n}){Gr.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),od.forEach(o=>{const{element:i,hitAreaMargins:s}=o,a=i.getBoundingClientRect(),{bottom:l,left:c,right:u,top:d}=a,h=Zge?s.coarse:s.fine;if(t>=c-h&&t<=u+h&&n>=d-h&&n<=l+h){if(r!==null&&document.contains(r)&&i!==r&&!i.contains(r)&&!r.contains(i)&&Yge(r,i)>0){let p=r,g=!1;for(;p&&!p.contains(i);){if(qge(p.getBoundingClientRect(),a)){g=!0;break}p=p.parentElement}if(g)return}Gr.push(o)}})}function wy(e,t){dm.set(e,t)}function vS(){let e=!1,t=!1;Gr.forEach(r=>{const{direction:o}=r;o==="horizontal"?e=!0:t=!0});let n=0;dm.forEach(r=>{n|=r}),e&&t?xy("intersection",n):e?xy("horizontal",n):t?xy("vertical",n):Uge()}function Ip(){Si.forEach((e,t)=>{const{body:n}=t;n.removeEventListener("contextmenu",Va),n.removeEventListener("pointerdown",Mk),n.removeEventListener("pointerleave",$c),n.removeEventListener("pointermove",$c)}),window.removeEventListener("pointerup",Va),window.removeEventListener("pointercancel",Va),od.size>0&&(pl?(Gr.length>0&&Si.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("contextmenu",Va),n.addEventListener("pointerleave",$c),n.addEventListener("pointermove",$c))}),window.addEventListener("pointerup",Va),window.addEventListener("pointercancel",Va)):Si.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("pointerdown",Mk,{capture:!0}),n.addEventListener("pointermove",$c))}))}function Ap(e,t){od.forEach(n=>{const{setResizeHandlerState:r}=n,o=Gr.includes(n);r(e,o,t)})}function eme(){const[e,t]=hl(0);return $n(()=>t(n=>n+1),[])}function Ve(e,t){if(!e)throw console.error(t),Error(t)}const xS=10;function ga(e,t,n=xS){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function Jo(e,t,n=xS){return ga(e,t,n)===0}function ur(e,t,n){return ga(e,t,n)===0}function tme(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const o=e[r],i=t[r];if(!ur(o,i,n))return!1}return!0}function Za({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Ve(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:i,maxSize:s=100,minSize:a=0}=r;if(ga(n,a)<0)if(i){const l=(o+a)/2;ga(n,l)<0?n=o:n=a}else n=a;return n=Math.min(s,n),n=parseFloat(n.toFixed(xS)),n}function tu({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:i}){if(ur(e,0))return t;const s=[...t],[a,l]=r;Ve(a!=null,"Invalid first pivot index"),Ve(l!=null,"Invalid second pivot index");let c=0;if(i==="keyboard"){{const d=e<0?l:a,h=n[d];Ve(h,`Panel constraints not found for index ${d}`);const{collapsedSize:f=0,collapsible:p,minSize:g=0}=h;if(p){const b=t[d];if(Ve(b!=null,`Previous layout not found for panel index ${d}`),ur(b,f)){const y=g-b;ga(y,Math.abs(e))>0&&(e=e<0?0-y:y)}}}{const d=e<0?a:l,h=n[d];Ve(h,`No panel constraints found for index ${d}`);const{collapsedSize:f=0,collapsible:p,minSize:g=0}=h;if(p){const b=t[d];if(Ve(b!=null,`Previous layout not found for panel index ${d}`),ur(b,g)){const y=b-f;ga(y,Math.abs(e))>0&&(e=e<0?0-y:y)}}}}{const d=e<0?1:-1;let h=e<0?l:a,f=0;for(;;){const g=t[h];Ve(g!=null,`Previous layout not found for panel index ${h}`);const y=Za({panelConstraints:n,panelIndex:h,size:100})-g;if(f+=y,h+=d,h<0||h>=n.length)break}const p=Math.min(Math.abs(e),Math.abs(f));e=e<0?0-p:p}{let h=e<0?a:l;for(;h>=0&&h<n.length;){const f=Math.abs(e)-Math.abs(c),p=t[h];Ve(p!=null,`Previous layout not found for panel index ${h}`);const g=p-f,b=Za({panelConstraints:n,panelIndex:h,size:g});if(!ur(p,b)&&(c+=p-b,s[h]=b,c.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?h--:h++}}if(tme(o,s))return o;{const d=e<0?l:a,h=t[d];Ve(h!=null,`Previous layout not found for panel index ${d}`);const f=h+c,p=Za({panelConstraints:n,panelIndex:d,size:f});if(s[d]=p,!ur(p,f)){let g=f-p,y=e<0?l:a;for(;y>=0&&y<n.length;){const v=s[y];Ve(v!=null,`Previous layout not found for panel index ${y}`);const x=v+g,_=Za({panelConstraints:n,panelIndex:y,size:x});if(ur(v,_)||(g-=_-v,s[y]=_),ur(g,0))break;e>0?y--:y++}}}const u=s.reduce((d,h)=>h+d,0);return ur(u,100)?s:o}function nme({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,i=0,s=0;const a=n[0];Ve(a!=null,"No pivot index found"),t.forEach((d,h)=>{const{constraints:f}=d,{maxSize:p=100,minSize:g=0}=f;h===a?(r=g,o=p):(i+=g,s+=p)});const l=Math.min(o,100-i),c=Math.max(r,100-s),u=e[a];return{valueMax:l,valueMin:c,valueNow:u}}function id(e,t=document){return Array.from(t.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function b4(e,t,n=document){const o=id(e,n).findIndex(i=>i.getAttribute("data-panel-resize-handle-id")===t);return o??null}function y4(e,t,n){const r=b4(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function v4(e,t=document){var n;if(t instanceof HTMLElement&&(t==null||(n=t.dataset)===null||n===void 0?void 0:n.panelGroupId)==e)return t;const r=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return r||null}function fm(e,t=document){const n=t.querySelector(`[data-panel-resize-handle-id="${e}"]`);return n||null}function rme(e,t,n,r=document){var o,i,s,a;const l=fm(t,r),c=id(e,r),u=l?c.indexOf(l):-1,d=(o=(i=n[u])===null||i===void 0?void 0:i.id)!==null&&o!==void 0?o:null,h=(s=(a=n[u+1])===null||a===void 0?void 0:a.id)!==null&&s!==void 0?s:null;return[d,h]}function ome({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:o,panelGroupElement:i,setLayout:s}){Un({didWarnAboutMissingResizeHandle:!1}),ta(()=>{if(!i)return;const a=id(n,i);for(let l=0;l<o.length-1;l++){const{valueMax:c,valueMin:u,valueNow:d}=nme({layout:r,panelsArray:o,pivotIndices:[l,l+1]}),h=a[l];if(h!=null){const f=o[l];Ve(f,`No panel data found for index "${l}"`),h.setAttribute("aria-controls",f.id),h.setAttribute("aria-valuemax",""+Math.round(c)),h.setAttribute("aria-valuemin",""+Math.round(u)),h.setAttribute("aria-valuenow",d!=null?""+Math.round(d):"")}}return()=>{a.forEach((l,c)=>{l.removeAttribute("aria-controls"),l.removeAttribute("aria-valuemax"),l.removeAttribute("aria-valuemin"),l.removeAttribute("aria-valuenow")})}},[n,r,o,i]),ea(()=>{if(!i)return;const a=t.current;Ve(a,"Eager values not found");const{panelDataArray:l}=a,c=v4(n,i);Ve(c!=null,`No group found for id "${n}"`);const u=id(n,i);Ve(u,`No resize handles found for group id "${n}"`);const d=u.map(h=>{const f=h.getAttribute("data-panel-resize-handle-id");Ve(f,"Resize handle element has no handle id attribute");const[p,g]=rme(n,f,l,i);if(p==null||g==null)return()=>{};const b=y=>{if(!y.defaultPrevented)switch(y.key){case"Enter":{y.preventDefault();const v=l.findIndex(x=>x.id===p);if(v>=0){const x=l[v];Ve(x,`No panel data found for index ${v}`);const _=r[v],{collapsedSize:w=0,collapsible:S,minSize:R=0}=x.constraints;if(_!=null&&S){const P=tu({delta:ur(_,w)?R-w:w-_,initialLayout:r,panelConstraints:l.map(O=>O.constraints),pivotIndices:y4(n,f,i),prevLayout:r,trigger:"keyboard"});r!==P&&s(P)}}break}}};return h.addEventListener("keydown",b),()=>{h.removeEventListener("keydown",b)}});return()=>{d.forEach(h=>h())}},[i,e,t,n,r,o,s])}function Ok(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function x4(e,t){const n=e==="horizontal",{x:r,y:o}=um(t);return n?r:o}function ime(e,t,n,r,o){const i=n==="horizontal",s=fm(t,o);Ve(s,`No resize handle element found for id "${t}"`);const a=s.getAttribute("data-panel-group-id");Ve(a,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=x4(n,e),u=v4(a,o);Ve(u,`No group element found for id "${a}"`);const d=u.getBoundingClientRect(),h=i?d.width:d.height;return(c-l)/h*100}function sme(e,t,n,r,o,i){if(c4(e)){const s=n==="horizontal";let a=0;e.shiftKey?a=100:o!=null?a=o:a=10;let l=0;switch(e.key){case"ArrowDown":l=s?0:a;break;case"ArrowLeft":l=s?-a:0;break;case"ArrowRight":l=s?a:0;break;case"ArrowUp":l=s?0:-a;break;case"End":l=100;break;case"Home":l=-100;break}return l}else return r==null?0:ime(e,t,n,r,i)}function ame({panelDataArray:e}){const t=Array(e.length),n=e.map(i=>i.constraints);let r=0,o=100;for(let i=0;i<e.length;i++){const s=n[i];Ve(s,`Panel constraints not found for index ${i}`);const{defaultSize:a}=s;a!=null&&(r++,t[i]=a,o-=a)}for(let i=0;i<e.length;i++){const s=n[i];Ve(s,`Panel constraints not found for index ${i}`);const{defaultSize:a}=s;if(a!=null)continue;const l=e.length-r,c=o/l;r++,t[i]=c,o-=c}return t}function Ha(e,t,n){t.forEach((r,o)=>{const i=e[o];Ve(i,`Panel data not found for index ${o}`);const{callbacks:s,constraints:a,id:l}=i,{collapsedSize:c=0,collapsible:u}=a,d=n[l];if(d==null||r!==d){n[l]=r;const{onCollapse:h,onExpand:f,onResize:p}=s;p&&p(r,d),u&&(h||f)&&(f&&(d==null||Jo(d,c))&&!Jo(r,c)&&f(),h&&(d==null||!Jo(d,c))&&Jo(r,c)&&h())}})}function lh(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function lme({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:o,precision:i=3}){const s=n[o];let a;return s==null?a=e!=null?e.toPrecision(i):"1":r.length===1?a="1":a=s.toPrecision(i),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function cme(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function Tk(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function w4(e){return`react-resizable-panels:${e}`}function S4(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:o,order:i}=t;return o?r:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function C4(e,t){try{const n=w4(e),r=t.getItem(n);if(r){const o=JSON.parse(r);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function ume(e,t,n){var r,o;const i=(r=C4(e,n))!==null&&r!==void 0?r:{},s=S4(t);return(o=i[s])!==null&&o!==void 0?o:null}function dme(e,t,n,r,o){var i;const s=w4(e),a=S4(t),l=(i=C4(e,o))!==null&&i!==void 0?i:{};l[a]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(s,JSON.stringify(l))}catch(c){console.error(c)}}function Dk({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((i,s)=>i+s,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!ur(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const s=n[i];Ve(s!=null,`No layout data found for index ${i}`);const a=100/r*s;n[i]=a}let o=0;for(let i=0;i<t.length;i++){const s=n[i];Ve(s!=null,`No layout data found for index ${i}`);const a=Za({panelConstraints:t,panelIndex:i,size:s});s!=a&&(o+=s-a,n[i]=a)}if(!ur(o,0))for(let i=0;i<t.length;i++){const s=n[i];Ve(s!=null,`No layout data found for index ${i}`);const a=s+o,l=Za({panelConstraints:t,panelIndex:i,size:a});if(s!==l&&(o-=l-s,n[i]=l,ur(o,0)))break}return n}const fme=100,nu={getItem:e=>(Tk(nu),nu.getItem(e)),setItem:(e,t)=>{Tk(nu),nu.setItem(e,t)}},Ik={};function _4({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:o,id:i=null,onLayout:s=null,keyboardResizeBy:a=null,storage:l=nu,style:c,tagName:u="div",...d}){const h=bS(i),f=Un(null),[p,g]=hl(null),[b,y]=hl([]),v=eme(),x=Un({}),_=Un(new Map),w=Un(0),S=Un({autoSaveId:e,direction:r,dragState:p,id:h,keyboardResizeBy:a,onLayout:s,storage:l}),R=Un({layout:b,panelDataArray:[],panelDataArrayChanged:!1});Un({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),s4(o,()=>({getId:()=>S.current.id,getLayout:()=>{const{layout:k}=R.current;return k},setLayout:k=>{const{onLayout:U}=S.current,{layout:q,panelDataArray:Y}=R.current,B=Dk({layout:k,panelConstraints:Y.map(G=>G.constraints)});Ok(q,B)||(y(B),R.current.layout=B,U&&U(B),Ha(Y,B,x.current))}}),[]),ta(()=>{S.current.autoSaveId=e,S.current.direction=r,S.current.dragState=p,S.current.id=h,S.current.onLayout=s,S.current.storage=l}),ome({committedValuesRef:S,eagerValuesRef:R,groupId:h,layout:b,panelDataArray:R.current.panelDataArray,setLayout:y,panelGroupElement:f.current}),ea(()=>{const{panelDataArray:k}=R.current;if(e){if(b.length===0||b.length!==k.length)return;let U=Ik[e];U==null&&(U=cme(dme,fme),Ik[e]=U);const q=[...k],Y=new Map(_.current);U(e,q,Y,b,l)}},[e,b,l]),ea(()=>{});const P=$n(k=>{const{onLayout:U}=S.current,{layout:q,panelDataArray:Y}=R.current;if(k.constraints.collapsible){const B=Y.map(ne=>ne.constraints),{collapsedSize:G=0,panelSize:X,pivotIndices:J}=ms(Y,k,q);if(Ve(X!=null,`Panel size not found for panel "${k.id}"`),!Jo(X,G)){_.current.set(k.id,X);const Z=Ua(Y,k)===Y.length-1?X-G:G-X,oe=tu({delta:Z,initialLayout:q,panelConstraints:B,pivotIndices:J,prevLayout:q,trigger:"imperative-api"});lh(q,oe)||(y(oe),R.current.layout=oe,U&&U(oe),Ha(Y,oe,x.current))}}},[]),O=$n((k,U)=>{const{onLayout:q}=S.current,{layout:Y,panelDataArray:B}=R.current;if(k.constraints.collapsible){const G=B.map(ee=>ee.constraints),{collapsedSize:X=0,panelSize:J=0,minSize:ne=0,pivotIndices:Z}=ms(B,k,Y),oe=U??ne;if(Jo(J,X)){const ee=_.current.get(k.id),de=ee!=null&&ee>=oe?ee:oe,xe=Ua(B,k)===B.length-1?J-de:de-J,pe=tu({delta:xe,initialLayout:Y,panelConstraints:G,pivotIndices:Z,prevLayout:Y,trigger:"imperative-api"});lh(Y,pe)||(y(pe),R.current.layout=pe,q&&q(pe),Ha(B,pe,x.current))}}},[]),T=$n(k=>{const{layout:U,panelDataArray:q}=R.current,{panelSize:Y}=ms(q,k,U);return Ve(Y!=null,`Panel size not found for panel "${k.id}"`),Y},[]),I=$n((k,U)=>{const{panelDataArray:q}=R.current,Y=Ua(q,k);return lme({defaultSize:U,dragState:p,layout:b,panelData:q,panelIndex:Y})},[p,b]),A=$n(k=>{const{layout:U,panelDataArray:q}=R.current,{collapsedSize:Y=0,collapsible:B,panelSize:G}=ms(q,k,U);return Ve(G!=null,`Panel size not found for panel "${k.id}"`),B===!0&&Jo(G,Y)},[]),W=$n(k=>{const{layout:U,panelDataArray:q}=R.current,{collapsedSize:Y=0,collapsible:B,panelSize:G}=ms(q,k,U);return Ve(G!=null,`Panel size not found for panel "${k.id}"`),!B||ga(G,Y)>0},[]),$=$n(k=>{const{panelDataArray:U}=R.current;U.push(k),U.sort((q,Y)=>{const B=q.order,G=Y.order;return B==null&&G==null?0:B==null?-1:G==null?1:B-G}),R.current.panelDataArrayChanged=!0,v()},[v]);ta(()=>{if(R.current.panelDataArrayChanged){R.current.panelDataArrayChanged=!1;const{autoSaveId:k,onLayout:U,storage:q}=S.current,{layout:Y,panelDataArray:B}=R.current;let G=null;if(k){const J=ume(k,B,q);J&&(_.current=new Map(Object.entries(J.expandToSizes)),G=J.layout)}G==null&&(G=ame({panelDataArray:B}));const X=Dk({layout:G,panelConstraints:B.map(J=>J.constraints)});Ok(Y,X)||(y(X),R.current.layout=X,U&&U(X),Ha(B,X,x.current))}}),ta(()=>{const k=R.current;return()=>{k.layout=[]}},[]);const D=$n(k=>{let U=!1;const q=f.current;return q&&window.getComputedStyle(q,null).getPropertyValue("direction")==="rtl"&&(U=!0),function(B){B.preventDefault();const G=f.current;if(!G)return()=>null;const{direction:X,dragState:J,id:ne,keyboardResizeBy:Z,onLayout:oe}=S.current,{layout:ee,panelDataArray:de}=R.current,{initialLayout:fe}=J??{},xe=y4(ne,k,G);let pe=sme(B,k,X,J,Z,G);const be=X==="horizontal";be&&U&&(pe=-pe);const je=de.map(Ge=>Ge.constraints),nt=tu({delta:pe,initialLayout:fe??ee,panelConstraints:je,pivotIndices:xe,prevLayout:ee,trigger:c4(B)?"keyboard":"mouse-or-touch"}),Vt=!lh(ee,nt);(u4(B)||d4(B))&&w.current!=pe&&(w.current=pe,!Vt&&pe!==0?be?wy(k,pe<0?h4:p4):wy(k,pe<0?g4:m4):wy(k,0)),Vt&&(y(nt),R.current.layout=nt,oe&&oe(nt),Ha(de,nt,x.current))}},[]),F=$n((k,U)=>{const{onLayout:q}=S.current,{layout:Y,panelDataArray:B}=R.current,G=B.map(ee=>ee.constraints),{panelSize:X,pivotIndices:J}=ms(B,k,Y);Ve(X!=null,`Panel size not found for panel "${k.id}"`);const Z=Ua(B,k)===B.length-1?X-U:U-X,oe=tu({delta:Z,initialLayout:Y,panelConstraints:G,pivotIndices:J,prevLayout:Y,trigger:"imperative-api"});lh(Y,oe)||(y(oe),R.current.layout=oe,q&&q(oe),Ha(B,oe,x.current))},[]),N=$n((k,U)=>{const{layout:q,panelDataArray:Y}=R.current,{collapsedSize:B=0,collapsible:G}=U,{collapsedSize:X=0,collapsible:J,maxSize:ne=100,minSize:Z=0}=k.constraints,{panelSize:oe}=ms(Y,k,q);oe!=null&&(G&&J&&Jo(oe,B)?Jo(B,X)||F(k,X):oe<Z?F(k,Z):oe>ne&&F(k,ne))},[F]),j=$n((k,U)=>{const{direction:q}=S.current,{layout:Y}=R.current;if(!f.current)return;const B=fm(k,f.current);Ve(B,`Drag handle element not found for id "${k}"`);const G=x4(q,U);g({dragHandleId:k,dragHandleRect:B.getBoundingClientRect(),initialCursorPosition:G,initialLayout:Y})},[]),H=$n(()=>{g(null)},[]),M=$n(k=>{const{panelDataArray:U}=R.current,q=Ua(U,k);q>=0&&(U.splice(q,1),delete x.current[k.id],R.current.panelDataArrayChanged=!0,v())},[v]),V=zge(()=>({collapsePanel:P,direction:r,dragState:p,expandPanel:O,getPanelSize:T,getPanelStyle:I,groupId:h,isPanelCollapsed:A,isPanelExpanded:W,reevaluatePanelConstraints:N,registerPanel:$,registerResizeHandle:D,resizePanel:F,startDragging:j,stopDragging:H,unregisterPanel:M,panelGroupElement:f.current}),[P,p,r,O,T,I,h,A,W,N,$,D,F,j,H,M]),L={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return Jl(cm.Provider,{value:V},Jl(u,{...d,children:t,className:n,id:i,ref:f,style:{...L,...c},"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":h}))}const E4=o4((e,t)=>Jl(_4,{...e,forwardedRef:t}));_4.displayName="PanelGroup";E4.displayName="forwardRef(PanelGroup)";function Ua(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function ms(e,t,n){const r=Ua(e,t),i=r===e.length-1?[r-1,r]:[r,r+1],s=n[r];return{...t.constraints,panelSize:s,pivotIndices:i}}function hme({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){ea(()=>{if(e||n==null||r==null)return;const o=fm(t,r);if(o==null)return;const i=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const a=o.getAttribute("data-panel-group-id");Ve(a,`No group element found for id "${a}"`);const l=id(a,r),c=b4(a,t,r);Ve(c!==null,`No resize element found for id "${t}"`);const u=s.shiftKey?c>0?c-1:l.length-1:c+1<l.length?c+1:0;l[u].focus();break}}};return o.addEventListener("keydown",i),()=>{o.removeEventListener("keydown",i)}},[r,e,t,n])}function wS({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:o,onBlur:i,onDragging:s,onFocus:a,style:l={},tabIndex:c=0,tagName:u="div",...d}){var h,f;const p=Un(null),g=Un({onDragging:s});ea(()=>{g.current.onDragging=s});const b=i4(cm);if(b===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:y,groupId:v,registerResizeHandle:x,startDragging:_,stopDragging:w,panelGroupElement:S}=b,R=bS(o),[P,O]=hl("inactive"),[T,I]=hl(!1),[A,W]=hl(null),$=Un({state:P});ta(()=>{$.current.state=P}),ea(()=>{if(n)W(null);else{const j=x(R);W(()=>j)}},[n,R,x]);const D=(h=r==null?void 0:r.coarse)!==null&&h!==void 0?h:15,F=(f=r==null?void 0:r.fine)!==null&&f!==void 0?f:5;return ea(()=>{if(n||A==null)return;const j=p.current;return Ve(j,"Element ref not attached"),Jge(R,j,y,{coarse:D,fine:F},(M,V,L)=>{if(V)switch(M){case"down":{O("drag"),Ve(L,'Expected event to be defined for "down" action'),_(R,L);const{onDragging:k}=g.current;k&&k(!0);break}case"move":{const{state:k}=$.current;k!=="drag"&&O("hover"),Ve(L,'Expected event to be defined for "move" action'),A(L);break}case"up":{O("hover"),w();const{onDragging:k}=g.current;k&&k(!1);break}}else O("inactive")})},[D,y,n,F,x,R,A,_,w]),hme({disabled:n,handleId:R,resizeHandler:A,panelGroupElement:S}),Jl(u,{...d,children:e,className:t,id:o,onBlur:()=>{I(!1),i==null||i()},onFocus:()=>{I(!0),a==null||a()},ref:p,role:"separator",style:{...{touchAction:"none",userSelect:"none"},...l},tabIndex:c,"data-panel-group-direction":y,"data-panel-group-id":v,"data-resize-handle":"","data-resize-handle-active":P==="drag"?"pointer":T?"keyboard":void 0,"data-resize-handle-state":P,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":R})}wS.displayName="PanelResizeHandle";const R4=({className:e,...t})=>m.jsx(E4,{className:ie("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),Jv=l4,pme=({withHandle:e,className:t,...n})=>m.jsx(wS,{className:ie("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&m.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:m.jsx(dB,{className:"h-2.5 w-2.5"})})}),gme=({withHandle:e,className:t,onTabClick:n,open:r,...o})=>m.jsx(wS,{className:ie("relative flex w-px items-start justify-end bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",{"justify-start":r},t),...o,children:e&&!r&&m.jsx("div",{className:ie("z-50 flex items-center justify-start",{"border-l":r}),children:m.jsx(qt,{variant:"secondary",className:ie("h-7 p-0.5",{"rounded-bl-none rounded-br-md rounded-tl-none rounded-tr-md":r,"mt-0 rounded-bl-md rounded-br-none rounded-tl-md rounded-tr-none":!r}),onClick:()=>n(!r),children:r?m.jsx(rw,{className:"size-4"}):m.jsx(QM,{className:"size-4"})})})});var SS="Dialog",[k4,P4]=Xt(SS),[mme,Qr]=k4(SS),M4=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=e,a=C.useRef(null),l=C.useRef(null),[c=!1,u]=xn({prop:r,defaultProp:o,onChange:i});return m.jsx(mme,{scope:t,triggerRef:a,contentRef:l,contentId:Gt(),titleId:Gt(),descriptionId:Gt(),open:c,onOpenChange:u,onOpenToggle:C.useCallback(()=>u(d=>!d),[u]),modal:s,children:n})};M4.displayName=SS;var O4="DialogTrigger",T4=C.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Qr(O4,n),i=Te(t,o.triggerRef);return m.jsx(ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":ES(o.open),...r,ref:i,onClick:le(e.onClick,o.onOpenToggle)})});T4.displayName=O4;var CS="DialogPortal",[bme,D4]=k4(CS,{forceMount:void 0}),I4=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=Qr(CS,t);return m.jsx(bme,{scope:t,forceMount:n,children:C.Children.map(r,s=>m.jsx(Yt,{present:n||i.open,children:m.jsx(Pd,{asChild:!0,container:o,children:s})}))})};I4.displayName=CS;var Np="DialogOverlay",A4=C.forwardRef((e,t)=>{const n=D4(Np,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Qr(Np,e.__scopeDialog);return i.modal?m.jsx(Yt,{present:r||i.open,children:m.jsx(yme,{...o,ref:t})}):null});A4.displayName=Np;var yme=C.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Qr(Np,n);return m.jsx(Dd,{as:si,allowPinchZoom:!0,shards:[o.contentRef],children:m.jsx(ge.div,{"data-state":ES(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),ma="DialogContent",N4=C.forwardRef((e,t)=>{const n=D4(ma,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Qr(ma,e.__scopeDialog);return m.jsx(Yt,{present:r||i.open,children:i.modal?m.jsx(vme,{...o,ref:t}):m.jsx(xme,{...o,ref:t})})});N4.displayName=ma;var vme=C.forwardRef((e,t)=>{const n=Qr(ma,e.__scopeDialog),r=C.useRef(null),o=Te(t,n.contentRef,r);return C.useEffect(()=>{const i=r.current;if(i)return Lg(i)},[]),m.jsx(F4,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:le(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:le(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&i.preventDefault()}),onFocusOutside:le(e.onFocusOutside,i=>i.preventDefault())})}),xme=C.forwardRef((e,t)=>{const n=Qr(ma,e.__scopeDialog),r=C.useRef(!1),o=C.useRef(!1);return m.jsx(F4,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),F4=C.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=e,a=Qr(ma,n),l=C.useRef(null),c=Te(t,l);return Fg(),m.jsxs(m.Fragment,{children:[m.jsx(Td,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:m.jsx(Ea,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":ES(a.open),...s,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),m.jsxs(m.Fragment,{children:[m.jsx(Sme,{titleId:a.titleId}),m.jsx(_me,{contentRef:l,descriptionId:a.descriptionId})]})]})}),_S="DialogTitle",j4=C.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Qr(_S,n);return m.jsx(ge.h2,{id:o.titleId,...r,ref:t})});j4.displayName=_S;var L4="DialogDescription",$4=C.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Qr(L4,n);return m.jsx(ge.p,{id:o.descriptionId,...r,ref:t})});$4.displayName=L4;var z4="DialogClose",B4=C.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Qr(z4,n);return m.jsx(ge.button,{type:"button",...r,ref:t,onClick:le(e.onClick,()=>o.onOpenChange(!1))})});B4.displayName=z4;function ES(e){return e?"open":"closed"}var V4="DialogTitleWarning",[wme,H4]=E9(V4,{contentName:ma,titleName:_S,docsSlug:"dialog"}),Sme=({titleId:e})=>{const t=H4(V4),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
364
+ */function Pge({message:e,onAddToDashboard:t}){var i;const n=(i=e==null?void 0:e.parts)==null?void 0:i.filter(s=>s.type==="tool-invocation"&&s.toolInvocation.toolName==="getData"&&s.toolInvocation.state==="result");if(!n)return null;const o=n.map(s=>s.toolInvocation).map(s=>{const a=s.result;if(a.status==="error")return null;const l=a.data.records;return{chartCfg:Fw({cardType:s.args.chartType,data:l}),chartTitle:s.args.chartTitle,chartType:s.args.chartType,sql:s.args.sql,data:l,connectionId:s.args.connectionId}}).filter(s=>s!==null);return!o||o.length===0?null:m.jsx("div",{className:"",children:o.map((s,a)=>m.jsxs("div",{className:"group relative isolate flex h-[350px] w-[99%] grow flex-col",children:[m.jsxs(qt,{className:"invisible absolute right-0 top-0 z-10 h-8 p-2 group-hover:visible",onClick:()=>{t==null||t({sql:s.sql,data:s.data,cardCfg:s.chartCfg,cardTitle:s.chartTitle,connectionId:s.connectionId,cardType:s.chartType})},size:"sm",variant:"outline",children:[m.jsx(pg,{className:"mr-1 size-4"}),"Add"]}),m.jsx(u1,{cfg:s.chartCfg})]},a))})}function Mge({message:e,showTools:t}){var r;if(!t)return null;const n=(r=e==null?void 0:e.parts)==null?void 0:r.filter(o=>o.type==="tool-invocation");return m.jsx("div",{className:"space-y-3",children:n==null?void 0:n.map((o,i)=>{const s=o.toolInvocation;return m.jsxs(Nce,{children:[m.jsxs(Fce,{className:"rounded-md bg-green-200 p-1 px-2 font-mono text-xs text-black",children:[m.jsx("span",{className:"font-bold",children:"Tool:"})," ",s.toolName]}),m.jsx(jce,{className:"mt-2 font-mono text-xs",children:m.jsxs("div",{className:"space-y-2 px-2",children:[m.jsxs("div",{className:"space-y-1",children:[m.jsx("span",{children:"Args:"}),m.jsx(Dp,{language:"json",code:JSON.stringify(s.args,null,2)})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("span",{children:"Result:"}),m.jsx(Dp,{language:"json",code:JSON.stringify(s.result,null,2)})]})]})})]},i)})})}function Oge({message:e}){return e.role!=="user"?null:m.jsxs("div",{className:"rounded-md bg-muted/50 p-3 text-sm",children:[m.jsx(vB,{className:"float-left mr-2 size-4"}),m.jsx("div",{className:"whitespace-pre-line",children:e.content})]})}function Tge({message:e}){if(e.role!=="system")return null;const t=e.content.split("|"),n=t[0],r=t[1]||"{}",o=JSON.parse(r);return m.jsxs("div",{className:"space-y-1",children:[m.jsxs("div",{children:[m.jsx("span",{className:"font-bold",children:"System Message:"})," ",n]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("span",{className:"font-mono text-xs",children:"Scope:"}),m.jsx(Dp,{language:"json",code:JSON.stringify(o,null,2)})]})]})}function Dge({message:e,handleRun:t}){if(e.role!=="assistant")return null;const n={p:({node:r,...o})=>m.jsx("p",{className:"text-sm",...o}),code:({node:r,...o})=>{var s,a;const i=(a=(s=r==null?void 0:r.children)==null?void 0:s[0])==null?void 0:a.value;return i&&/^#([0-9a-fA-F]{6})$/.test(i)?m.jsx("code",{className:"rounded-md bg-muted px-2 py-1 text-xs",style:{backgroundColor:i},...o}):m.jsx("code",{className:"rounded-md bg-muted px-2 py-1 text-xs",...o})},pre:r=>m.jsx(Ige,{...r,handleRun:t}),li:({node:r,...o})=>m.jsx("li",{className:"my-2 list-outside pl-4 text-sm",...o})};return m.jsx(vpe,{components:n,children:e.content.replace(/DuckDB/gi,"Semaphor")})}function e4({status:e,isLoading:t}){return t?m.jsx("div",{className:"flex items-center text-xs text-muted-foreground",children:e}):null}function t4({messages:e,showTools:t=!1,showSystemMessage:n=!1,handleRun:r,onAddToDashboard:o}){return e==null?void 0:e.map(i=>m.jsxs("div",{className:ie("relative my-4 space-y-4 text-sm text-foreground/80"),children:[m.jsx(Oge,{message:i}),n&&m.jsx(Tge,{message:i}),m.jsx(Mge,{message:i,showTools:t}),m.jsx(Pge,{onAddToDashboard:o,message:i}),m.jsx(Dge,{message:i,handleRun:r})]},i.id))}function Ige({children:e,handleRun:t}){const n=se(a=>a.isVisualEditing),[r,o]=E.useState(!1);E.useRef(null);const i=()=>{navigator.clipboard.writeText(s).then(()=>{o(!0),setTimeout(()=>o(!1),2e3)})},s=Qv(e);return m.jsxs("pre",{className:"relative my-2 space-y-2 rounded-md bg-muted/50",children:[m.jsxs("div",{className:"float-right m-1.5",children:[m.jsx(qt,{className:"h-8 p-2 text-xs text-muted-foreground hover:text-foreground",onClick:i,size:"sm",variant:"ghost",children:r?m.jsx(oc,{className:"size-3"}):m.jsx(eO,{className:"size-3"})}),n&&m.jsx(qt,{className:"h-8 p-2 text-muted-foreground hover:text-foreground",onClick:()=>t==null?void 0:t(s),size:"sm",variant:"ghost",children:m.jsx(lO,{className:"size-3"})})]}),m.jsx(Dp,{code:s})]})}function Qv(e){return typeof e=="string"?e:Array.isArray(e)?e.map(Qv).join(""):E.isValidElement(e)?Qv(e.props.children):""}const Dp=({code:e,language:t="sql"})=>{const n=se(r=>r.theme);return m.jsx(kge,{code:e,language:t,theme:n==="dark"?Xv.vsDark:Xv.vsLight,children:({className:r,style:o,tokens:i,getLineProps:s,getTokenProps:a})=>m.jsx("pre",{className:`${r} border-1 whitespace-pre-wrap rounded-md border border-muted p-2 text-xs`,style:{...o},children:i.map((l,c)=>m.jsx("div",{...s({line:l}),children:l.map((u,d)=>m.jsx("span",{...a({token:u})},d))},c))})})};function n4(e,t){return t||(e==="ready"?"":e==="error"?"Error":e==="streaming"?"":"Thinking...")}function Age(e,t){return e.some(n=>n.tableName&&n.tableName===t.tableName||n.datamodelName&&n.datamodelName===t.datamodelName)}function Nge(e){return e.filter((n,r,o)=>r===o.findIndex(i=>i.tableName===n.tableName&&i.datamodelName===n.datamodelName))}function Fge(e,t){return e.filter(n=>!(n.connectionId===t.connectionId&&n.tableName===t.tableName&&n.datamodelName===t.datamodelName))}const r4=E.forwardRef(({input:e,setInput:t,handleInputChange:n,handleSubmit:r,isLoading:o,stop:i},s)=>{const[a,l]=E.useState(2),c=5,u=h=>{const p=h.target.rows;h.target.rows=1;const g=Math.floor(h.target.scrollHeight/24);g===p&&(h.target.rows=g),g>=c&&(h.target.rows=c,h.target.scrollTop=h.target.scrollHeight),l(Math.min(g,c)),n(h)},d=h=>{if(h.key==="Enter"){if(h.shiftKey)return;h.preventDefault(),r&&e.trim()!==""&&(r(h),t(""),l(1))}};return m.jsxs("form",{onSubmit:r,className:"flex w-full items-end gap-2 rounded-md border py-3 pl-1 pr-2",children:[m.jsx(nm,{autoFocus:!0,ref:s,placeholder:"Type your question...",className:ie("min-h-7 resize-none border-none focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"),disabled:o,value:e,rows:a,onKeyDown:d,onChange:u}),m.jsxs("div",{className:"mr-2 flex items-center gap-2",children:[o===!0&&m.jsx(qt,{size:"sm",className:"h-9 rounded-full p-2.5",onClick:()=>i(),children:m.jsx(pB,{className:"size-3.5 bg-background"})}),o===!1&&m.jsx(qt,{disabled:o===!1&&!e,size:"sm",className:"h-9 rounded-full p-2.5",onClick:()=>i(),children:m.jsx(cB,{className:"size-4 font-bold"})})]})]})});function jge({handleChatBox:e}){const t=E.useRef(null),[n,r]=E.useState(""),[o,i]=E.useState(!1),s=se(T=>T.dashboard.aiScopeTables),{setSelectedConnectionId:a}=xd(),l=se(T=>T.selectedSheetId),{addFrame:c,setSelectedFrameId:u,setIsDashboardEditing:d}=Bt(),{authToken:h}=xr(),f=Cx(),{messages:p,setMessages:g,reload:b,input:y,setInput:v,status:x,handleInputChange:_,handleSubmit:w,stop:S}=lF({api:"https://semaphor.cloud/api/v1/chat",headers:{Authorization:`Bearer ${h==null?void 0:h.accessToken}`},maxSteps:10,async onToolCall({toolCall:T}){if(T.toolName==="getTables")return r("Initializing..."),{tables:s||[]};if(T.toolName==="getSchemas"&&r("Analyzing..."),T.toolName==="getData"){r("Fetching...");const I=T.args;if(!(I!=null&&I.sql)||!(I!=null&&I.connectionId))return"Please provide sql, connectionId and table";try{return{status:"success",data:await f.fetchQuery({queryKey:["chat",I.connectionId,I.sql],queryFn:()=>qp("https://semaphor.cloud/api/v1/query",(h==null?void 0:h.accessToken)||(h==null?void 0:h.accessToken)||"",{connection_id:I.connectionId,sql:I.sql,cache_config:yx({})})})}}catch(A){return console.log("error",A.message),r("Error fetching data"),{status:"error",message:A.message}}}},onFinish(T,I){r(T.content),I.finishReason==="stop"&&r("")}}),R=()=>{var T;(T=t.current)==null||T.scrollIntoView({behavior:"smooth"})};E.useEffect(()=>{R()},[p]);function P({sql:T,data:I,cardCfg:A,cardTitle:W,connectionId:$,cardType:D}){if(!l)return;const F={id:zi(),title:W||"Title",description:"Description",preferences:{onClickFilter:[{columnIndex:0,expression:""}],chartOptions:{indexAxis:D==="horizontalBar"?"y":"x"}},type:A.type,cfg:A,sql:T,data:I,connectionId:$},N={id:zi(),cards:[F],activeCardId:F.id};d(!0),c(l,N,"start"),u(N.id)}const O=!["ready","error"].includes(x);return m.jsxs("div",{role:"chat-box",className:"flex h-full grow flex-col justify-between break-words rounded-md",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2 px-6 pb-3 pt-6",children:[m.jsxs("div",{className:"flex items-center gap-4",children:[m.jsx(Rt,{className:"flex items-center gap-2 text-xl",children:"Assistant"}),m.jsxs(Md,{openDelay:0,children:[m.jsx(Od,{children:m.jsx(xB,{className:"size-4 text-muted-foreground"})}),m.jsx(fc,{className:"w-70 p-2",children:m.jsx("div",{className:"flex justify-between space-x-2 text-muted-foreground",children:m.jsxs("div",{children:[(s==null?void 0:s.length)===0&&m.jsx("p",{className:"text-sm",children:"No tables in scope"}),m.jsx("div",{className:"space-y-2",children:s==null?void 0:s.map((T,I)=>m.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[m.jsx(yB,{className:"size-3 text-muted-foreground/70"}),m.jsx("span",{children:bP({schemaName:T.schemaName||"",tableName:T.tableName||"",modelName:T.datamodelName||"",connectionType:T.connectionType||""})})]},I))})]})})})]})]}),m.jsxs("div",{className:"flex items-center",children:[m.jsx(qt,{className:"h-7 p-2",size:"sm",variant:"ghost",onClick:()=>{g([]),b()},children:m.jsx(cO,{className:"size-3.5 text-muted-foreground"})}),m.jsx(qt,{className:"h-7 p-2",size:"sm",variant:"ghost",onClick:()=>e(!1),children:m.jsx(Ca,{className:"size-4 text-muted-foreground"})})]})]}),m.jsxs(Zs,{className:"flex flex-1 basis-0 flex-col flex-wrap justify-end px-6 py-3",children:[m.jsxs("div",{className:"pb-4",children:[m.jsx(t4,{messages:p,onAddToDashboard:P}),m.jsx(e4,{status:n4(x,n),isLoading:O}),m.jsx("div",{ref:t})]}),m.jsx(Fd,{orientation:"vertical"})]}),m.jsx("div",{className:"px-6 pb-6",children:m.jsx(r4,{setInput:v,stop:S,input:y,handleInputChange:_,handleSubmit:w,isLoading:O})})]})}const{createElement:Jl,createContext:Lge,forwardRef:o4,useCallback:$n,useContext:i4,useEffect:ea,useImperativeHandle:s4,useLayoutEffect:$ge,useMemo:zge,useRef:Un,useState:hl}=C,Ek=C[`useId${Math.random()}`.slice(0,5)],Bge=$ge,cm=Lge(null);cm.displayName="PanelGroupContext";const ta=Bge,Vge=typeof Ek=="function"?Ek:()=>null;let Hge=0;function bS(e=null){const t=Vge(),n=Un(e||t||null);return n.current===null&&(n.current=""+Hge++),e??n.current}function a4({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:o,forwardedRef:i,id:s,maxSize:a,minSize:l,onCollapse:c,onExpand:u,onResize:d,order:h,style:f,tagName:p="div",...g}){const b=i4(cm);if(b===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:v,getPanelSize:x,getPanelStyle:_,groupId:w,isPanelCollapsed:S,reevaluatePanelConstraints:R,registerPanel:P,resizePanel:O,unregisterPanel:T}=b,I=bS(s),A=Un({callbacks:{onCollapse:c,onExpand:u,onResize:d},constraints:{collapsedSize:n,collapsible:r,defaultSize:o,maxSize:a,minSize:l},id:I,idIsFromProps:s!==void 0,order:h});Un({didLogMissingDefaultSizeWarning:!1}),ta(()=>{const{callbacks:$,constraints:D}=A.current,F={...D};A.current.id=I,A.current.idIsFromProps=s!==void 0,A.current.order=h,$.onCollapse=c,$.onExpand=u,$.onResize=d,D.collapsedSize=n,D.collapsible=r,D.defaultSize=o,D.maxSize=a,D.minSize=l,(F.collapsedSize!==D.collapsedSize||F.collapsible!==D.collapsible||F.maxSize!==D.maxSize||F.minSize!==D.minSize)&&R(A.current,F)}),ta(()=>{const $=A.current;return P($),()=>{T($)}},[h,I,P,T]),s4(i,()=>({collapse:()=>{y(A.current)},expand:$=>{v(A.current,$)},getId(){return I},getSize(){return x(A.current)},isCollapsed(){return S(A.current)},isExpanded(){return!S(A.current)},resize:$=>{O(A.current,$)}}),[y,v,x,S,I,O]);const W=_(A.current,o);return Jl(p,{...g,children:e,className:t,id:s,style:{...W,...f},"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-group-id":w,"data-panel-id":I,"data-panel-size":parseFloat(""+W.flexGrow).toFixed(1)})}const l4=o4((e,t)=>Jl(a4,{...e,forwardedRef:t}));a4.displayName="Panel";l4.displayName="forwardRef(Panel)";let Zv=null,As=null;function Wge(e,t){if(t){const n=(t&h4)!==0,r=(t&p4)!==0,o=(t&g4)!==0,i=(t&m4)!==0;if(n)return o?"se-resize":i?"ne-resize":"e-resize";if(r)return o?"sw-resize":i?"nw-resize":"w-resize";if(o)return"s-resize";if(i)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Uge(){As!==null&&(document.head.removeChild(As),Zv=null,As=null)}function xy(e,t){const n=Wge(e,t);Zv!==n&&(Zv=n,As===null&&(As=document.createElement("style"),document.head.appendChild(As)),As.innerHTML=`*{cursor: ${n}!important;}`)}function c4(e){return e.type==="keydown"}function u4(e){return e.type.startsWith("pointer")}function d4(e){return e.type.startsWith("mouse")}function um(e){if(u4(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(d4(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function Gge(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function qge(e,t,n){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Yge(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Pk(e),b:Pk(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Ve(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:kk(Rk(n.a)),b:kk(Rk(n.b))};if(o.a===o.b){const i=r.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let a=i.length;for(;a--;){const l=i[a];if(l===s.a)return 1;if(l===s.b)return-1}}return Math.sign(o.a-o.b)}const Kge=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Xge(e){var t;const n=getComputedStyle((t=f4(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function Qge(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Xge(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||Kge.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Rk(e){let t=e.length;for(;t--;){const n=e[t];if(Ve(n,"Missing node"),Qge(n))return n}return null}function kk(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Pk(e){const t=[];for(;e;)t.push(e),e=f4(e);return t}function f4(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const h4=1,p4=2,g4=4,m4=8,Zge=Gge()==="coarse";let Gr=[],pl=!1,Si=new Map,dm=new Map;const od=new Set;function Jge(e,t,n,r,o){var i;const{ownerDocument:s}=t,a={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:o},l=(i=Si.get(s))!==null&&i!==void 0?i:0;return Si.set(s,l+1),od.add(a),Ip(),function(){var u;dm.delete(e),od.delete(a);const d=(u=Si.get(s))!==null&&u!==void 0?u:1;if(Si.set(s,d-1),Ip(),d===1&&Si.delete(s),Gr.includes(a)){const h=Gr.indexOf(a);h>=0&&Gr.splice(h,1),vS(),o("up",!0,null)}}}function Mk(e){const{target:t}=e,{x:n,y:r}=um(e);pl=!0,yS({target:t,x:n,y:r}),Ip(),Gr.length>0&&(Ap("down",e),e.preventDefault(),e.stopPropagation())}function $c(e){const{x:t,y:n}=um(e);if(pl&&e.buttons===0&&(pl=!1,Ap("up",e)),!pl){const{target:r}=e;yS({target:r,x:t,y:n})}Ap("move",e),vS(),Gr.length>0&&e.preventDefault()}function Va(e){const{target:t}=e,{x:n,y:r}=um(e);dm.clear(),pl=!1,Gr.length>0&&e.preventDefault(),Ap("up",e),yS({target:t,x:n,y:r}),vS(),Ip()}function yS({target:e,x:t,y:n}){Gr.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),od.forEach(o=>{const{element:i,hitAreaMargins:s}=o,a=i.getBoundingClientRect(),{bottom:l,left:c,right:u,top:d}=a,h=Zge?s.coarse:s.fine;if(t>=c-h&&t<=u+h&&n>=d-h&&n<=l+h){if(r!==null&&document.contains(r)&&i!==r&&!i.contains(r)&&!r.contains(i)&&Yge(r,i)>0){let p=r,g=!1;for(;p&&!p.contains(i);){if(qge(p.getBoundingClientRect(),a)){g=!0;break}p=p.parentElement}if(g)return}Gr.push(o)}})}function wy(e,t){dm.set(e,t)}function vS(){let e=!1,t=!1;Gr.forEach(r=>{const{direction:o}=r;o==="horizontal"?e=!0:t=!0});let n=0;dm.forEach(r=>{n|=r}),e&&t?xy("intersection",n):e?xy("horizontal",n):t?xy("vertical",n):Uge()}function Ip(){Si.forEach((e,t)=>{const{body:n}=t;n.removeEventListener("contextmenu",Va),n.removeEventListener("pointerdown",Mk),n.removeEventListener("pointerleave",$c),n.removeEventListener("pointermove",$c)}),window.removeEventListener("pointerup",Va),window.removeEventListener("pointercancel",Va),od.size>0&&(pl?(Gr.length>0&&Si.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("contextmenu",Va),n.addEventListener("pointerleave",$c),n.addEventListener("pointermove",$c))}),window.addEventListener("pointerup",Va),window.addEventListener("pointercancel",Va)):Si.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("pointerdown",Mk,{capture:!0}),n.addEventListener("pointermove",$c))}))}function Ap(e,t){od.forEach(n=>{const{setResizeHandlerState:r}=n,o=Gr.includes(n);r(e,o,t)})}function eme(){const[e,t]=hl(0);return $n(()=>t(n=>n+1),[])}function Ve(e,t){if(!e)throw console.error(t),Error(t)}const xS=10;function ga(e,t,n=xS){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function Jo(e,t,n=xS){return ga(e,t,n)===0}function ur(e,t,n){return ga(e,t,n)===0}function tme(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const o=e[r],i=t[r];if(!ur(o,i,n))return!1}return!0}function Za({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Ve(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:i,maxSize:s=100,minSize:a=0}=r;if(ga(n,a)<0)if(i){const l=(o+a)/2;ga(n,l)<0?n=o:n=a}else n=a;return n=Math.min(s,n),n=parseFloat(n.toFixed(xS)),n}function tu({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:i}){if(ur(e,0))return t;const s=[...t],[a,l]=r;Ve(a!=null,"Invalid first pivot index"),Ve(l!=null,"Invalid second pivot index");let c=0;if(i==="keyboard"){{const d=e<0?l:a,h=n[d];Ve(h,`Panel constraints not found for index ${d}`);const{collapsedSize:f=0,collapsible:p,minSize:g=0}=h;if(p){const b=t[d];if(Ve(b!=null,`Previous layout not found for panel index ${d}`),ur(b,f)){const y=g-b;ga(y,Math.abs(e))>0&&(e=e<0?0-y:y)}}}{const d=e<0?a:l,h=n[d];Ve(h,`No panel constraints found for index ${d}`);const{collapsedSize:f=0,collapsible:p,minSize:g=0}=h;if(p){const b=t[d];if(Ve(b!=null,`Previous layout not found for panel index ${d}`),ur(b,g)){const y=b-f;ga(y,Math.abs(e))>0&&(e=e<0?0-y:y)}}}}{const d=e<0?1:-1;let h=e<0?l:a,f=0;for(;;){const g=t[h];Ve(g!=null,`Previous layout not found for panel index ${h}`);const y=Za({panelConstraints:n,panelIndex:h,size:100})-g;if(f+=y,h+=d,h<0||h>=n.length)break}const p=Math.min(Math.abs(e),Math.abs(f));e=e<0?0-p:p}{let h=e<0?a:l;for(;h>=0&&h<n.length;){const f=Math.abs(e)-Math.abs(c),p=t[h];Ve(p!=null,`Previous layout not found for panel index ${h}`);const g=p-f,b=Za({panelConstraints:n,panelIndex:h,size:g});if(!ur(p,b)&&(c+=p-b,s[h]=b,c.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?h--:h++}}if(tme(o,s))return o;{const d=e<0?l:a,h=t[d];Ve(h!=null,`Previous layout not found for panel index ${d}`);const f=h+c,p=Za({panelConstraints:n,panelIndex:d,size:f});if(s[d]=p,!ur(p,f)){let g=f-p,y=e<0?l:a;for(;y>=0&&y<n.length;){const v=s[y];Ve(v!=null,`Previous layout not found for panel index ${y}`);const x=v+g,_=Za({panelConstraints:n,panelIndex:y,size:x});if(ur(v,_)||(g-=_-v,s[y]=_),ur(g,0))break;e>0?y--:y++}}}const u=s.reduce((d,h)=>h+d,0);return ur(u,100)?s:o}function nme({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,i=0,s=0;const a=n[0];Ve(a!=null,"No pivot index found"),t.forEach((d,h)=>{const{constraints:f}=d,{maxSize:p=100,minSize:g=0}=f;h===a?(r=g,o=p):(i+=g,s+=p)});const l=Math.min(o,100-i),c=Math.max(r,100-s),u=e[a];return{valueMax:l,valueMin:c,valueNow:u}}function id(e,t=document){return Array.from(t.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function b4(e,t,n=document){const o=id(e,n).findIndex(i=>i.getAttribute("data-panel-resize-handle-id")===t);return o??null}function y4(e,t,n){const r=b4(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function v4(e,t=document){var n;if(t instanceof HTMLElement&&(t==null||(n=t.dataset)===null||n===void 0?void 0:n.panelGroupId)==e)return t;const r=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return r||null}function fm(e,t=document){const n=t.querySelector(`[data-panel-resize-handle-id="${e}"]`);return n||null}function rme(e,t,n,r=document){var o,i,s,a;const l=fm(t,r),c=id(e,r),u=l?c.indexOf(l):-1,d=(o=(i=n[u])===null||i===void 0?void 0:i.id)!==null&&o!==void 0?o:null,h=(s=(a=n[u+1])===null||a===void 0?void 0:a.id)!==null&&s!==void 0?s:null;return[d,h]}function ome({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:o,panelGroupElement:i,setLayout:s}){Un({didWarnAboutMissingResizeHandle:!1}),ta(()=>{if(!i)return;const a=id(n,i);for(let l=0;l<o.length-1;l++){const{valueMax:c,valueMin:u,valueNow:d}=nme({layout:r,panelsArray:o,pivotIndices:[l,l+1]}),h=a[l];if(h!=null){const f=o[l];Ve(f,`No panel data found for index "${l}"`),h.setAttribute("aria-controls",f.id),h.setAttribute("aria-valuemax",""+Math.round(c)),h.setAttribute("aria-valuemin",""+Math.round(u)),h.setAttribute("aria-valuenow",d!=null?""+Math.round(d):"")}}return()=>{a.forEach((l,c)=>{l.removeAttribute("aria-controls"),l.removeAttribute("aria-valuemax"),l.removeAttribute("aria-valuemin"),l.removeAttribute("aria-valuenow")})}},[n,r,o,i]),ea(()=>{if(!i)return;const a=t.current;Ve(a,"Eager values not found");const{panelDataArray:l}=a,c=v4(n,i);Ve(c!=null,`No group found for id "${n}"`);const u=id(n,i);Ve(u,`No resize handles found for group id "${n}"`);const d=u.map(h=>{const f=h.getAttribute("data-panel-resize-handle-id");Ve(f,"Resize handle element has no handle id attribute");const[p,g]=rme(n,f,l,i);if(p==null||g==null)return()=>{};const b=y=>{if(!y.defaultPrevented)switch(y.key){case"Enter":{y.preventDefault();const v=l.findIndex(x=>x.id===p);if(v>=0){const x=l[v];Ve(x,`No panel data found for index ${v}`);const _=r[v],{collapsedSize:w=0,collapsible:S,minSize:R=0}=x.constraints;if(_!=null&&S){const P=tu({delta:ur(_,w)?R-w:w-_,initialLayout:r,panelConstraints:l.map(O=>O.constraints),pivotIndices:y4(n,f,i),prevLayout:r,trigger:"keyboard"});r!==P&&s(P)}}break}}};return h.addEventListener("keydown",b),()=>{h.removeEventListener("keydown",b)}});return()=>{d.forEach(h=>h())}},[i,e,t,n,r,o,s])}function Ok(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function x4(e,t){const n=e==="horizontal",{x:r,y:o}=um(t);return n?r:o}function ime(e,t,n,r,o){const i=n==="horizontal",s=fm(t,o);Ve(s,`No resize handle element found for id "${t}"`);const a=s.getAttribute("data-panel-group-id");Ve(a,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=x4(n,e),u=v4(a,o);Ve(u,`No group element found for id "${a}"`);const d=u.getBoundingClientRect(),h=i?d.width:d.height;return(c-l)/h*100}function sme(e,t,n,r,o,i){if(c4(e)){const s=n==="horizontal";let a=0;e.shiftKey?a=100:o!=null?a=o:a=10;let l=0;switch(e.key){case"ArrowDown":l=s?0:a;break;case"ArrowLeft":l=s?-a:0;break;case"ArrowRight":l=s?a:0;break;case"ArrowUp":l=s?0:-a;break;case"End":l=100;break;case"Home":l=-100;break}return l}else return r==null?0:ime(e,t,n,r,i)}function ame({panelDataArray:e}){const t=Array(e.length),n=e.map(i=>i.constraints);let r=0,o=100;for(let i=0;i<e.length;i++){const s=n[i];Ve(s,`Panel constraints not found for index ${i}`);const{defaultSize:a}=s;a!=null&&(r++,t[i]=a,o-=a)}for(let i=0;i<e.length;i++){const s=n[i];Ve(s,`Panel constraints not found for index ${i}`);const{defaultSize:a}=s;if(a!=null)continue;const l=e.length-r,c=o/l;r++,t[i]=c,o-=c}return t}function Ha(e,t,n){t.forEach((r,o)=>{const i=e[o];Ve(i,`Panel data not found for index ${o}`);const{callbacks:s,constraints:a,id:l}=i,{collapsedSize:c=0,collapsible:u}=a,d=n[l];if(d==null||r!==d){n[l]=r;const{onCollapse:h,onExpand:f,onResize:p}=s;p&&p(r,d),u&&(h||f)&&(f&&(d==null||Jo(d,c))&&!Jo(r,c)&&f(),h&&(d==null||!Jo(d,c))&&Jo(r,c)&&h())}})}function lh(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function lme({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:o,precision:i=3}){const s=n[o];let a;return s==null?a=e!=null?e.toPrecision(i):"1":r.length===1?a="1":a=s.toPrecision(i),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function cme(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function Tk(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function w4(e){return`react-resizable-panels:${e}`}function S4(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:o,order:i}=t;return o?r:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function C4(e,t){try{const n=w4(e),r=t.getItem(n);if(r){const o=JSON.parse(r);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function ume(e,t,n){var r,o;const i=(r=C4(e,n))!==null&&r!==void 0?r:{},s=S4(t);return(o=i[s])!==null&&o!==void 0?o:null}function dme(e,t,n,r,o){var i;const s=w4(e),a=S4(t),l=(i=C4(e,o))!==null&&i!==void 0?i:{};l[a]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(s,JSON.stringify(l))}catch(c){console.error(c)}}function Dk({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((i,s)=>i+s,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!ur(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const s=n[i];Ve(s!=null,`No layout data found for index ${i}`);const a=100/r*s;n[i]=a}let o=0;for(let i=0;i<t.length;i++){const s=n[i];Ve(s!=null,`No layout data found for index ${i}`);const a=Za({panelConstraints:t,panelIndex:i,size:s});s!=a&&(o+=s-a,n[i]=a)}if(!ur(o,0))for(let i=0;i<t.length;i++){const s=n[i];Ve(s!=null,`No layout data found for index ${i}`);const a=s+o,l=Za({panelConstraints:t,panelIndex:i,size:a});if(s!==l&&(o-=l-s,n[i]=l,ur(o,0)))break}return n}const fme=100,nu={getItem:e=>(Tk(nu),nu.getItem(e)),setItem:(e,t)=>{Tk(nu),nu.setItem(e,t)}},Ik={};function _4({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:o,id:i=null,onLayout:s=null,keyboardResizeBy:a=null,storage:l=nu,style:c,tagName:u="div",...d}){const h=bS(i),f=Un(null),[p,g]=hl(null),[b,y]=hl([]),v=eme(),x=Un({}),_=Un(new Map),w=Un(0),S=Un({autoSaveId:e,direction:r,dragState:p,id:h,keyboardResizeBy:a,onLayout:s,storage:l}),R=Un({layout:b,panelDataArray:[],panelDataArrayChanged:!1});Un({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),s4(o,()=>({getId:()=>S.current.id,getLayout:()=>{const{layout:k}=R.current;return k},setLayout:k=>{const{onLayout:U}=S.current,{layout:q,panelDataArray:Y}=R.current,B=Dk({layout:k,panelConstraints:Y.map(G=>G.constraints)});Ok(q,B)||(y(B),R.current.layout=B,U&&U(B),Ha(Y,B,x.current))}}),[]),ta(()=>{S.current.autoSaveId=e,S.current.direction=r,S.current.dragState=p,S.current.id=h,S.current.onLayout=s,S.current.storage=l}),ome({committedValuesRef:S,eagerValuesRef:R,groupId:h,layout:b,panelDataArray:R.current.panelDataArray,setLayout:y,panelGroupElement:f.current}),ea(()=>{const{panelDataArray:k}=R.current;if(e){if(b.length===0||b.length!==k.length)return;let U=Ik[e];U==null&&(U=cme(dme,fme),Ik[e]=U);const q=[...k],Y=new Map(_.current);U(e,q,Y,b,l)}},[e,b,l]),ea(()=>{});const P=$n(k=>{const{onLayout:U}=S.current,{layout:q,panelDataArray:Y}=R.current;if(k.constraints.collapsible){const B=Y.map(ne=>ne.constraints),{collapsedSize:G=0,panelSize:X,pivotIndices:J}=ms(Y,k,q);if(Ve(X!=null,`Panel size not found for panel "${k.id}"`),!Jo(X,G)){_.current.set(k.id,X);const Z=Ua(Y,k)===Y.length-1?X-G:G-X,oe=tu({delta:Z,initialLayout:q,panelConstraints:B,pivotIndices:J,prevLayout:q,trigger:"imperative-api"});lh(q,oe)||(y(oe),R.current.layout=oe,U&&U(oe),Ha(Y,oe,x.current))}}},[]),O=$n((k,U)=>{const{onLayout:q}=S.current,{layout:Y,panelDataArray:B}=R.current;if(k.constraints.collapsible){const G=B.map(ee=>ee.constraints),{collapsedSize:X=0,panelSize:J=0,minSize:ne=0,pivotIndices:Z}=ms(B,k,Y),oe=U??ne;if(Jo(J,X)){const ee=_.current.get(k.id),de=ee!=null&&ee>=oe?ee:oe,xe=Ua(B,k)===B.length-1?J-de:de-J,pe=tu({delta:xe,initialLayout:Y,panelConstraints:G,pivotIndices:Z,prevLayout:Y,trigger:"imperative-api"});lh(Y,pe)||(y(pe),R.current.layout=pe,q&&q(pe),Ha(B,pe,x.current))}}},[]),T=$n(k=>{const{layout:U,panelDataArray:q}=R.current,{panelSize:Y}=ms(q,k,U);return Ve(Y!=null,`Panel size not found for panel "${k.id}"`),Y},[]),I=$n((k,U)=>{const{panelDataArray:q}=R.current,Y=Ua(q,k);return lme({defaultSize:U,dragState:p,layout:b,panelData:q,panelIndex:Y})},[p,b]),A=$n(k=>{const{layout:U,panelDataArray:q}=R.current,{collapsedSize:Y=0,collapsible:B,panelSize:G}=ms(q,k,U);return Ve(G!=null,`Panel size not found for panel "${k.id}"`),B===!0&&Jo(G,Y)},[]),W=$n(k=>{const{layout:U,panelDataArray:q}=R.current,{collapsedSize:Y=0,collapsible:B,panelSize:G}=ms(q,k,U);return Ve(G!=null,`Panel size not found for panel "${k.id}"`),!B||ga(G,Y)>0},[]),$=$n(k=>{const{panelDataArray:U}=R.current;U.push(k),U.sort((q,Y)=>{const B=q.order,G=Y.order;return B==null&&G==null?0:B==null?-1:G==null?1:B-G}),R.current.panelDataArrayChanged=!0,v()},[v]);ta(()=>{if(R.current.panelDataArrayChanged){R.current.panelDataArrayChanged=!1;const{autoSaveId:k,onLayout:U,storage:q}=S.current,{layout:Y,panelDataArray:B}=R.current;let G=null;if(k){const J=ume(k,B,q);J&&(_.current=new Map(Object.entries(J.expandToSizes)),G=J.layout)}G==null&&(G=ame({panelDataArray:B}));const X=Dk({layout:G,panelConstraints:B.map(J=>J.constraints)});Ok(Y,X)||(y(X),R.current.layout=X,U&&U(X),Ha(B,X,x.current))}}),ta(()=>{const k=R.current;return()=>{k.layout=[]}},[]);const D=$n(k=>{let U=!1;const q=f.current;return q&&window.getComputedStyle(q,null).getPropertyValue("direction")==="rtl"&&(U=!0),function(B){B.preventDefault();const G=f.current;if(!G)return()=>null;const{direction:X,dragState:J,id:ne,keyboardResizeBy:Z,onLayout:oe}=S.current,{layout:ee,panelDataArray:de}=R.current,{initialLayout:fe}=J??{},xe=y4(ne,k,G);let pe=sme(B,k,X,J,Z,G);const be=X==="horizontal";be&&U&&(pe=-pe);const je=de.map(Ge=>Ge.constraints),nt=tu({delta:pe,initialLayout:fe??ee,panelConstraints:je,pivotIndices:xe,prevLayout:ee,trigger:c4(B)?"keyboard":"mouse-or-touch"}),Vt=!lh(ee,nt);(u4(B)||d4(B))&&w.current!=pe&&(w.current=pe,!Vt&&pe!==0?be?wy(k,pe<0?h4:p4):wy(k,pe<0?g4:m4):wy(k,0)),Vt&&(y(nt),R.current.layout=nt,oe&&oe(nt),Ha(de,nt,x.current))}},[]),F=$n((k,U)=>{const{onLayout:q}=S.current,{layout:Y,panelDataArray:B}=R.current,G=B.map(ee=>ee.constraints),{panelSize:X,pivotIndices:J}=ms(B,k,Y);Ve(X!=null,`Panel size not found for panel "${k.id}"`);const Z=Ua(B,k)===B.length-1?X-U:U-X,oe=tu({delta:Z,initialLayout:Y,panelConstraints:G,pivotIndices:J,prevLayout:Y,trigger:"imperative-api"});lh(Y,oe)||(y(oe),R.current.layout=oe,q&&q(oe),Ha(B,oe,x.current))},[]),N=$n((k,U)=>{const{layout:q,panelDataArray:Y}=R.current,{collapsedSize:B=0,collapsible:G}=U,{collapsedSize:X=0,collapsible:J,maxSize:ne=100,minSize:Z=0}=k.constraints,{panelSize:oe}=ms(Y,k,q);oe!=null&&(G&&J&&Jo(oe,B)?Jo(B,X)||F(k,X):oe<Z?F(k,Z):oe>ne&&F(k,ne))},[F]),j=$n((k,U)=>{const{direction:q}=S.current,{layout:Y}=R.current;if(!f.current)return;const B=fm(k,f.current);Ve(B,`Drag handle element not found for id "${k}"`);const G=x4(q,U);g({dragHandleId:k,dragHandleRect:B.getBoundingClientRect(),initialCursorPosition:G,initialLayout:Y})},[]),H=$n(()=>{g(null)},[]),M=$n(k=>{const{panelDataArray:U}=R.current,q=Ua(U,k);q>=0&&(U.splice(q,1),delete x.current[k.id],R.current.panelDataArrayChanged=!0,v())},[v]),V=zge(()=>({collapsePanel:P,direction:r,dragState:p,expandPanel:O,getPanelSize:T,getPanelStyle:I,groupId:h,isPanelCollapsed:A,isPanelExpanded:W,reevaluatePanelConstraints:N,registerPanel:$,registerResizeHandle:D,resizePanel:F,startDragging:j,stopDragging:H,unregisterPanel:M,panelGroupElement:f.current}),[P,p,r,O,T,I,h,A,W,N,$,D,F,j,H,M]),L={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return Jl(cm.Provider,{value:V},Jl(u,{...d,children:t,className:n,id:i,ref:f,style:{...L,...c},"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":h}))}const E4=o4((e,t)=>Jl(_4,{...e,forwardedRef:t}));_4.displayName="PanelGroup";E4.displayName="forwardRef(PanelGroup)";function Ua(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function ms(e,t,n){const r=Ua(e,t),i=r===e.length-1?[r-1,r]:[r,r+1],s=n[r];return{...t.constraints,panelSize:s,pivotIndices:i}}function hme({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){ea(()=>{if(e||n==null||r==null)return;const o=fm(t,r);if(o==null)return;const i=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const a=o.getAttribute("data-panel-group-id");Ve(a,`No group element found for id "${a}"`);const l=id(a,r),c=b4(a,t,r);Ve(c!==null,`No resize element found for id "${t}"`);const u=s.shiftKey?c>0?c-1:l.length-1:c+1<l.length?c+1:0;l[u].focus();break}}};return o.addEventListener("keydown",i),()=>{o.removeEventListener("keydown",i)}},[r,e,t,n])}function wS({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:o,onBlur:i,onDragging:s,onFocus:a,style:l={},tabIndex:c=0,tagName:u="div",...d}){var h,f;const p=Un(null),g=Un({onDragging:s});ea(()=>{g.current.onDragging=s});const b=i4(cm);if(b===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:y,groupId:v,registerResizeHandle:x,startDragging:_,stopDragging:w,panelGroupElement:S}=b,R=bS(o),[P,O]=hl("inactive"),[T,I]=hl(!1),[A,W]=hl(null),$=Un({state:P});ta(()=>{$.current.state=P}),ea(()=>{if(n)W(null);else{const j=x(R);W(()=>j)}},[n,R,x]);const D=(h=r==null?void 0:r.coarse)!==null&&h!==void 0?h:15,F=(f=r==null?void 0:r.fine)!==null&&f!==void 0?f:5;return ea(()=>{if(n||A==null)return;const j=p.current;return Ve(j,"Element ref not attached"),Jge(R,j,y,{coarse:D,fine:F},(M,V,L)=>{if(V)switch(M){case"down":{O("drag"),Ve(L,'Expected event to be defined for "down" action'),_(R,L);const{onDragging:k}=g.current;k&&k(!0);break}case"move":{const{state:k}=$.current;k!=="drag"&&O("hover"),Ve(L,'Expected event to be defined for "move" action'),A(L);break}case"up":{O("hover"),w();const{onDragging:k}=g.current;k&&k(!1);break}}else O("inactive")})},[D,y,n,F,x,R,A,_,w]),hme({disabled:n,handleId:R,resizeHandler:A,panelGroupElement:S}),Jl(u,{...d,children:e,className:t,id:o,onBlur:()=>{I(!1),i==null||i()},onFocus:()=>{I(!0),a==null||a()},ref:p,role:"separator",style:{...{touchAction:"none",userSelect:"none"},...l},tabIndex:c,"data-panel-group-direction":y,"data-panel-group-id":v,"data-resize-handle":"","data-resize-handle-active":P==="drag"?"pointer":T?"keyboard":void 0,"data-resize-handle-state":P,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":R})}wS.displayName="PanelResizeHandle";const R4=({className:e,...t})=>m.jsx(E4,{className:ie("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),Jv=l4,pme=({withHandle:e,className:t,...n})=>m.jsx(wS,{className:ie("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&m.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:m.jsx(dB,{className:"h-2.5 w-2.5"})})}),gme=({withHandle:e,className:t,onTabClick:n,open:r,...o})=>m.jsx(wS,{className:ie("relative flex w-px items-start justify-end bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",{"justify-start":r},t),...o,children:e&&!r&&m.jsx("div",{className:ie("z-50 flex items-center justify-start",{"border-l":r}),children:m.jsx(qt,{variant:"secondary",className:ie("h-7 p-0.5",{"rounded-bl-none rounded-br-md rounded-tl-none rounded-tr-md":r,"mt-0 rounded-bl-md rounded-br-none rounded-tl-md rounded-tr-none":!r}),onClick:()=>n(!r),children:r?m.jsx(rw,{className:"size-4"}):m.jsx(QM,{className:"size-4"})})})});var SS="Dialog",[k4,P4]=Xt(SS),[mme,Qr]=k4(SS),M4=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=e,a=C.useRef(null),l=C.useRef(null),[c=!1,u]=xn({prop:r,defaultProp:o,onChange:i});return m.jsx(mme,{scope:t,triggerRef:a,contentRef:l,contentId:Gt(),titleId:Gt(),descriptionId:Gt(),open:c,onOpenChange:u,onOpenToggle:C.useCallback(()=>u(d=>!d),[u]),modal:s,children:n})};M4.displayName=SS;var O4="DialogTrigger",T4=C.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Qr(O4,n),i=Te(t,o.triggerRef);return m.jsx(ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":ES(o.open),...r,ref:i,onClick:le(e.onClick,o.onOpenToggle)})});T4.displayName=O4;var CS="DialogPortal",[bme,D4]=k4(CS,{forceMount:void 0}),I4=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=Qr(CS,t);return m.jsx(bme,{scope:t,forceMount:n,children:C.Children.map(r,s=>m.jsx(Yt,{present:n||i.open,children:m.jsx(Pd,{asChild:!0,container:o,children:s})}))})};I4.displayName=CS;var Np="DialogOverlay",A4=C.forwardRef((e,t)=>{const n=D4(Np,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Qr(Np,e.__scopeDialog);return i.modal?m.jsx(Yt,{present:r||i.open,children:m.jsx(yme,{...o,ref:t})}):null});A4.displayName=Np;var yme=C.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Qr(Np,n);return m.jsx(Dd,{as:si,allowPinchZoom:!0,shards:[o.contentRef],children:m.jsx(ge.div,{"data-state":ES(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),ma="DialogContent",N4=C.forwardRef((e,t)=>{const n=D4(ma,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Qr(ma,e.__scopeDialog);return m.jsx(Yt,{present:r||i.open,children:i.modal?m.jsx(vme,{...o,ref:t}):m.jsx(xme,{...o,ref:t})})});N4.displayName=ma;var vme=C.forwardRef((e,t)=>{const n=Qr(ma,e.__scopeDialog),r=C.useRef(null),o=Te(t,n.contentRef,r);return C.useEffect(()=>{const i=r.current;if(i)return Lg(i)},[]),m.jsx(F4,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:le(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:le(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&i.preventDefault()}),onFocusOutside:le(e.onFocusOutside,i=>i.preventDefault())})}),xme=C.forwardRef((e,t)=>{const n=Qr(ma,e.__scopeDialog),r=C.useRef(!1),o=C.useRef(!1);return m.jsx(F4,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),F4=C.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=e,a=Qr(ma,n),l=C.useRef(null),c=Te(t,l);return Fg(),m.jsxs(m.Fragment,{children:[m.jsx(Td,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:m.jsx(Ea,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":ES(a.open),...s,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),m.jsxs(m.Fragment,{children:[m.jsx(Sme,{titleId:a.titleId}),m.jsx(_me,{contentRef:l,descriptionId:a.descriptionId})]})]})}),_S="DialogTitle",j4=C.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Qr(_S,n);return m.jsx(ge.h2,{id:o.titleId,...r,ref:t})});j4.displayName=_S;var L4="DialogDescription",$4=C.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Qr(L4,n);return m.jsx(ge.p,{id:o.descriptionId,...r,ref:t})});$4.displayName=L4;var z4="DialogClose",B4=C.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Qr(z4,n);return m.jsx(ge.button,{type:"button",...r,ref:t,onClick:le(e.onClick,()=>o.onOpenChange(!1))})});B4.displayName=z4;function ES(e){return e?"open":"closed"}var V4="DialogTitleWarning",[wme,H4]=E9(V4,{contentName:ma,titleName:_S,docsSlug:"dialog"}),Sme=({titleId:e})=>{const t=H4(V4),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
365
365
 
366
366
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
367
367